@cetusprotocol/terminal 0.0.2 → 0.0.4
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 +24323 -22399
- 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/common/CopyButton.d.ts +1 -0
- package/dist/components/swap/TokenSelectModal/WarnTokenDialog.d.ts +2 -2
- package/dist/components/swap/TradeInput.d.ts +2 -1
- package/dist/hooks/swap/useSwapHelper.d.ts +2 -1
- package/dist/style.css +1 -1
- package/dist/style.css.gz +0 -0
- package/package.json +2 -2
package/dist/cetus-swap.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(Vt,te){typeof exports=="object"&&typeof module<"u"?te(exports,require("react"),require("react-dom"),require("@mysten/dapp-kit")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","@mysten/dapp-kit"],te):(Vt=typeof globalThis<"u"?globalThis:Vt||self,te(Vt.CetusSwap={},Vt.React,Vt.ReactDOM,Vt.dappKit))})(this,function(Vt,te,$n,$r){"use strict";var gX=Object.defineProperty;var vX=(Vt,te,$n)=>te in Vt?gX(Vt,te,{enumerable:!0,configurable:!0,writable:!0,value:$n}):Vt[te]=$n;var vt=(Vt,te,$n)=>(vX(Vt,typeof te!="symbol"?te+"":te,$n),$n);function J0(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const I=J0(te),Y0=J0($n);function R3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z0={exports:{}},sr=Z0.exports={},Bn,Ln;function af(){throw new Error("setTimeout has not been defined")}function cf(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Bn=setTimeout:Bn=af}catch{Bn=af}try{typeof clearTimeout=="function"?Ln=clearTimeout:Ln=cf}catch{Ln=cf}})();function Q0(e){if(Bn===setTimeout)return setTimeout(e,0);if((Bn===af||!Bn)&&setTimeout)return Bn=setTimeout,setTimeout(e,0);try{return Bn(e,0)}catch{try{return Bn.call(null,e,0)}catch{return Bn.call(this,e,0)}}}function D3(e){if(Ln===clearTimeout)return clearTimeout(e);if((Ln===cf||!Ln)&&clearTimeout)return Ln=clearTimeout,clearTimeout(e);try{return Ln(e)}catch{try{return Ln.call(null,e)}catch{return Ln.call(this,e)}}}var li=[],no=!1,ws,jc=-1;function $3(){!no||!ws||(no=!1,ws.length?li=ws.concat(li):jc=-1,li.length&&em())}function em(){if(!no){var e=Q0($3);no=!0;for(var t=li.length;t;){for(ws=li,li=[];++jc<t;)ws&&ws[jc].run();jc=-1,t=li.length}ws=null,no=!1,D3(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];li.push(new tm(e,t)),li.length===1&&!no&&Q0(em)};function tm(e,t){this.fun=e,this.array=t}tm.prototype.run=function(){this.fun.apply(null,this.array)},sr.title="browser",sr.browser=!0,sr.env={},sr.argv=[],sr.version="",sr.versions={};function fi(){}sr.on=fi,sr.addListener=fi,sr.once=fi,sr.off=fi,sr.removeListener=fi,sr.removeAllListeners=fi,sr.emit=fi,sr.prependListener=fi,sr.prependOnceListener=fi,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 B3=Z0.exports;const hn=R3(B3);var jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function kc(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 uf={exports:{}},da={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,55 +6,60 @@
|
|
|
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
|
-
`+ut[
|
|
9
|
+
*/var rm;function L3(){if(rm)return da;rm=1;var e=te,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,u){var l,f={},h=null,y=null;u!==void 0&&(h=""+u),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(y=c.ref);for(l in c)n.call(c,l)&&!s.hasOwnProperty(l)&&(f[l]=c[l]);if(a&&a.defaultProps)for(l in c=a.defaultProps,c)f[l]===void 0&&(f[l]=c[l]);return{$$typeof:t,type:a,key:h,ref:y,props:f,_owner:i.current}}return da.Fragment=r,da.jsx=o,da.jsxs=o,da}var ha={},nm;function F3(){return nm||(nm=1,hn.env.NODE_ENV!=="production"&&function(){var e=te,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),b=Symbol.iterator,_="@@iterator";function A(z){if(z===null||typeof z!="object")return null;var oe=b&&z[b]||z[_];return typeof oe=="function"?oe:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function N(z){{for(var oe=arguments.length,he=new Array(oe>1?oe-1:0),ke=1;ke<oe;ke++)he[ke-1]=arguments[ke];R("error",z,he)}}function R(z,oe,he){{var ke=P.ReactDebugCurrentFrame,He=ke.getStackAddendum();He!==""&&(oe+="%s",he=he.concat([He]));var Ne=he.map(function(ze){return String(ze)});Ne.unshift("Warning: "+oe),Function.prototype.apply.call(console[z],console,Ne)}}var F=!1,L=!1,W=!1,q=!1,X=!1,ie;ie=Symbol.for("react.module.reference");function ae(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===s||X||z===i||z===u||z===l||q||z===y||F||L||W||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===f||z.$$typeof===o||z.$$typeof===a||z.$$typeof===c||z.$$typeof===ie||z.getModuleId!==void 0))}function ce(z,oe,he){var ke=z.displayName;if(ke)return ke;var He=oe.displayName||oe.name||"";return He!==""?he+"("+He+")":he}function V(z){return z.displayName||"Context"}function $(z){if(z==null)return null;if(typeof z.tag=="number"&&N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof z=="function")return z.displayName||z.name||null;if(typeof z=="string")return z;switch(z){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof z=="object")switch(z.$$typeof){case a:var oe=z;return V(oe)+".Consumer";case o:var he=z;return V(he._context)+".Provider";case c:return ce(z,z.render,"ForwardRef");case f:var ke=z.displayName||null;return ke!==null?ke:$(z.type)||"Memo";case h:{var He=z,Ne=He._payload,ze=He._init;try{return $(ze(Ne))}catch{return null}}}return null}var p=Object.assign,d=0,m,x,M,E,O,C,g;function v(){}v.__reactDisabledLog=!0;function j(){{if(d===0){m=console.log,x=console.info,M=console.warn,E=console.error,O=console.group,C=console.groupCollapsed,g=console.groupEnd;var z={configurable:!0,enumerable:!0,value:v,writable:!0};Object.defineProperties(console,{info:z,log:z,warn:z,error:z,group:z,groupCollapsed:z,groupEnd:z})}d++}}function ee(){{if(d--,d===0){var z={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:p({},z,{value:m}),info:p({},z,{value:x}),warn:p({},z,{value:M}),error:p({},z,{value:E}),group:p({},z,{value:O}),groupCollapsed:p({},z,{value:C}),groupEnd:p({},z,{value:g})})}d<0&&N("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=P.ReactCurrentDispatcher,ye;function pe(z,oe,he){{if(ye===void 0)try{throw Error()}catch(He){var ke=He.stack.trim().match(/\n( *(at )?)/);ye=ke&&ke[1]||""}return`
|
|
10
|
+
`+ye+z}}var Ee=!1,Se;{var Je=typeof WeakMap=="function"?WeakMap:Map;Se=new Je}function Ue(z,oe){if(!z||Ee)return"";{var he=Se.get(z);if(he!==void 0)return he}var ke;Ee=!0;var He=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ne;Ne=se.current,se.current=null,j();try{if(oe){var ze=function(){throw Error()};if(Object.defineProperty(ze.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ze,[])}catch(Yt){ke=Yt}Reflect.construct(z,[],ze)}else{try{ze.call()}catch(Yt){ke=Yt}z.call(ze.prototype)}}else{try{throw Error()}catch(Yt){ke=Yt}z()}}catch(Yt){if(Yt&&ke&&typeof Yt.stack=="string"){for(var ut=Yt.stack.split(`
|
|
11
|
+
`),Jt=ke.stack.split(`
|
|
12
|
+
`),Nt=ut.length-1,Bt=Jt.length-1;Nt>=1&&Bt>=0&&ut[Nt]!==Jt[Bt];)Bt--;for(;Nt>=1&&Bt>=0;Nt--,Bt--)if(ut[Nt]!==Jt[Bt]){if(Nt!==1||Bt!==1)do if(Nt--,Bt--,Bt<0||ut[Nt]!==Jt[Bt]){var ir=`
|
|
13
|
+
`+ut[Nt].replace(" at new "," at ");return z.displayName&&ir.includes("<anonymous>")&&(ir=ir.replace("<anonymous>",z.displayName)),typeof z=="function"&&Se.set(z,ir),ir}while(Nt>=1&&Bt>=0);break}}}finally{Ee=!1,se.current=Ne,ee(),Error.prepareStackTrace=He}var Sr=z?z.displayName||z.name:"",or=Sr?pe(Sr):"";return typeof z=="function"&&Se.set(z,or),or}function lt(z,oe,he){return Ue(z,!1)}function ht(z){var oe=z.prototype;return!!(oe&&oe.isReactComponent)}function $e(z,oe,he){if(z==null)return"";if(typeof z=="function")return Ue(z,ht(z));if(typeof z=="string")return pe(z);switch(z){case u:return pe("Suspense");case l:return pe("SuspenseList")}if(typeof z=="object")switch(z.$$typeof){case c:return lt(z.render);case f:return $e(z.type,oe,he);case h:{var ke=z,He=ke._payload,Ne=ke._init;try{return $e(Ne(He),oe,he)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,_e={},ge=P.ReactDebugCurrentFrame;function Ae(z){if(z){var oe=z._owner,he=$e(z.type,z._source,oe?oe.type:null);ge.setExtraStackFrame(he)}else ge.setExtraStackFrame(null)}function Ge(z,oe,he,ke,He){{var Ne=Function.call.bind(mt);for(var ze in z)if(Ne(z,ze)){var ut=void 0;try{if(typeof z[ze]!="function"){var Jt=Error((ke||"React class")+": "+he+" type `"+ze+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof z[ze]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Jt.name="Invariant Violation",Jt}ut=z[ze](oe,ze,ke,he,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Nt){ut=Nt}ut&&!(ut instanceof Error)&&(Ae(He),N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ke||"React class",he,ze,typeof ut),Ae(null)),ut instanceof Error&&!(ut.message in _e)&&(_e[ut.message]=!0,Ae(He),N("Failed %s type: %s",he,ut.message),Ae(null))}}}var De=Array.isArray;function Oe(z){return De(z)}function Ie(z){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,he=oe&&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 N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ie(z)),ft(z)}var We=P.ReactCurrentOwner,jt={key:!0,ref:!0,__self:!0,__source:!0},St,et,At;At={};function $t(z){if(mt.call(z,"ref")){var oe=Object.getOwnPropertyDescriptor(z,"ref").get;if(oe&&oe.isReactWarning)return!1}return z.ref!==void 0}function nt(z){if(mt.call(z,"key")){var oe=Object.getOwnPropertyDescriptor(z,"key").get;if(oe&&oe.isReactWarning)return!1}return z.key!==void 0}function Et(z,oe){if(typeof z.ref=="string"&&We.current&&oe&&We.current.stateNode!==oe){var he=$(We.current.type);At[he]||(N('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',$(We.current.type),z.ref),At[he]=!0)}}function Ot(z,oe){{var he=function(){St||(St=!0,N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};he.isReactWarning=!0,Object.defineProperty(z,"key",{get:he,configurable:!0})}}function st(z,oe){{var he=function(){et||(et=!0,N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",oe))};he.isReactWarning=!0,Object.defineProperty(z,"ref",{get:he,configurable:!0})}}var kt=function(z,oe,he,ke,He,Ne,ze){var ut={$$typeof:t,type:z,key:oe,ref:he,props:ze,_owner:Ne};return ut._store={},Object.defineProperty(ut._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ut,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.defineProperty(ut,"_source",{configurable:!1,enumerable:!1,writable:!1,value:He}),Object.freeze&&(Object.freeze(ut.props),Object.freeze(ut)),ut};function It(z,oe,he,ke,He){{var Ne,ze={},ut=null,Jt=null;he!==void 0&&(dt(he),ut=""+he),nt(oe)&&(dt(oe.key),ut=""+oe.key),$t(oe)&&(Jt=oe.ref,Et(oe,He));for(Ne in oe)mt.call(oe,Ne)&&!jt.hasOwnProperty(Ne)&&(ze[Ne]=oe[Ne]);if(z&&z.defaultProps){var Nt=z.defaultProps;for(Ne in Nt)ze[Ne]===void 0&&(ze[Ne]=Nt[Ne])}if(ut||Jt){var Bt=typeof z=="function"?z.displayName||z.name||"Unknown":z;ut&&Ot(ze,Bt),Jt&&st(ze,Bt)}return kt(z,ut,Jt,He,ke,We.current,ze)}}var it=P.ReactCurrentOwner,wt=P.ReactDebugCurrentFrame;function Mt(z){if(z){var oe=z._owner,he=$e(z.type,z._source,oe?oe.type:null);wt.setExtraStackFrame(he)}else wt.setExtraStackFrame(null)}var Ye;Ye=!1;function gt(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function Pt(){{if(it.current){var z=$(it.current.type);if(z)return`
|
|
14
14
|
|
|
15
|
-
Check the render method of \``+z+"`."}return""}}function ot(z){{if(z!==void 0){var
|
|
15
|
+
Check the render method of \``+z+"`."}return""}}function ot(z){{if(z!==void 0){var oe=z.fileName.replace(/^.*[\\\/]/,""),he=z.lineNumber;return`
|
|
16
16
|
|
|
17
|
-
Check your code at `+
|
|
17
|
+
Check your code at `+oe+":"+he+"."}return""}}var _t={};function Ut(z){{var oe=Pt();if(!oe){var he=typeof z=="string"?z:z.displayName||z.name;he&&(oe=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+he+">.")}return
|
|
19
|
+
Check the top-level render call using <`+he+">.")}return oe}}function k(z,oe){{if(!z._store||z._store.validated||z.key!=null)return;z._store.validated=!0;var he=Ut(oe);if(_t[he])return;_t[he]=!0;var ke="";z&&z._owner&&z._owner!==it.current&&(ke=" It was passed a child from "+$(z._owner.type)+"."),Mt(z),N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',he,ke),Mt(null)}}function S(z,oe){{if(typeof z!="object")return;if(Oe(z))for(var he=0;he<z.length;he++){var ke=z[he];gt(ke)&&k(ke,oe)}else if(gt(z))z._store&&(z._store.validated=!0);else if(z){var He=A(z);if(typeof He=="function"&&He!==z.entries)for(var Ne=He.call(z),ze;!(ze=Ne.next()).done;)gt(ze.value)&&k(ze.value,oe)}}}function T(z){{var oe=z.type;if(oe==null||typeof oe=="string")return;var he;if(typeof oe=="function")he=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===c||oe.$$typeof===f))he=oe.propTypes;else return;if(he){var ke=$(oe);Ge(he,z.props,"prop",ke,z)}else if(oe.PropTypes!==void 0&&!Ye){Ye=!0;var He=$(oe);N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",He||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function B(z){{for(var oe=Object.keys(z.props),he=0;he<oe.length;he++){var ke=oe[he];if(ke!=="children"&&ke!=="key"){Mt(z),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),Mt(null);break}}z.ref!==null&&(Mt(z),N("Invalid attribute `ref` supplied to `React.Fragment`."),Mt(null))}}var K={};function Z(z,oe,he,ke,He,Ne){{var ze=ae(z);if(!ze){var ut="";(z===void 0||typeof z=="object"&&z!==null&&Object.keys(z).length===0)&&(ut+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Jt=ot(He);Jt?ut+=Jt:ut+=Pt();var Nt;z===null?Nt="null":Oe(z)?Nt="array":z!==void 0&&z.$$typeof===t?(Nt="<"+($(z.type)||"Unknown")+" />",ut=" Did you accidentally export a JSX literal instead of a component?"):Nt=typeof z,N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Nt,ut)}var Bt=It(z,oe,he,He,Ne);if(Bt==null)return Bt;if(ze){var ir=oe.children;if(ir!==void 0)if(ke)if(Oe(ir)){for(var Sr=0;Sr<ir.length;Sr++)S(ir[Sr],z);Object.freeze&&Object.freeze(ir)}else N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else S(ir,z)}if(mt.call(oe,"key")){var or=$(z),Yt=Object.keys(oe).filter(function(Vr){return Vr!=="key"}),vr=Yt.length>0?"{key: someKey, "+Yt.join(": ..., ")+": ...}":"{key: someKey}";if(!K[or+vr]){var Nn=Yt.length>0?"{"+Yt.join(": ..., ")+": ...}":"{}";N(`A props object containing a "key" prop is being spread into JSX:
|
|
20
20
|
let props = %s;
|
|
21
21
|
<%s {...props} />
|
|
22
22
|
React keys must be passed directly to JSX without using spread:
|
|
23
23
|
let props = %s;
|
|
24
|
-
<%s key={someKey} {...props} />`,gr,sr,Cn,sr),K[sr+gr]=!0}}return z===n?B($t):M($t),$t}}function ee(z,ie,he){return Z(z,ie,he,!0)}function Be(z,ie,he){return Z(z,ie,he,!1)}var rt=Be,Re=ee;ea.Fragment=n,ea.jsx=rt,ea.jsxs=Re}()),ea}Pi.env.NODE_ENV==="production"?Bl.exports=w3():Bl.exports=_3();var b=Bl.exports;const nW="",iW="",sW="";window._iconfont_svg_string_4776227='<svg><symbol id="icon-more" viewBox="0 0 1024 1024"><path d="M499.2 217.6m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 524.8m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 832m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path></symbol><symbol id="icon-docs" viewBox="0 0 1024 1024"><path d="M665.6 41.728c65.9456 0 121.2928 45.312 136.6016 106.496 5.0688-2.6624 10.8544-4.096 16.9984-4.096a140.8 140.8 0 0 1 140.8 140.8v563.2a140.8 140.8 0 0 1-140.8 140.8H358.4a140.8512 140.8512 0 0 1-135.4752-102.4H204.8a140.8 140.8 0 0 1-140.8-140.8v-563.2A140.8 140.8 0 0 1 204.8 41.728h460.8z m140.8 177.0496v526.9504a140.8 140.8 0 0 1-140.8 140.8l-358.4 0.1024c11.7248 15.5136 30.3104 25.4976 51.2 25.4976h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64a38.3488 38.3488 0 0 1-12.8-2.1504zM665.6 118.528H204.8c-35.328 0-64 28.672-64 64v563.2c0 35.328 28.672 64 64 64h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64z m-153.6 281.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h256z m102.4-153.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h358.4z" ></path></symbol><symbol id="icon-link1" viewBox="0 0 1024 1024"><path d="M719.872 268.8l3.738 0.205 0.768 0.051-4.506-0.256a38.502 38.502 0 0 1 28.416 12.544l0.973 1.126a38.554 38.554 0 0 1 1.74 2.253l-2.713-3.379a38.605 38.605 0 0 1 9.984 25.549V563.2a38.4 38.4 0 1 1-76.8 0V394.086L281.856 758.221a38.4 38.4 0 0 1-51.712-56.832L620.646 345.6H463.872a38.4 38.4 0 0 1-38.042-33.178l-0.358-5.222a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-icon-kfckfc" viewBox="0 0 1024 1024"><path d="M53.504 102.912c-0.41 0.563 30.208 42.086 67.84 92.006L299.008 430.9 408.32 576l-7.014 7.885c-3.943 4.352-84.327 90.521-178.432 191.488C128.717 876.595 51.354 960 51.2 960.87c-0.358 0.922 16.077 1.69 39.731 1.536l40.243-0.204 13.21-14.49A217385.626 217385.626 0 0 0 440.32 629.914l4.71-5.479 37.837 50.33L610.048 843.93l89.6 118.63H836.71c114.023 0 136.858-0.358 136.141-2.458-0.563-1.484-35.328-48.025-77.312-103.782-41.984-55.603-90.01-119.398-106.65-141.568-16.793-22.17-66.15-88.064-110.028-146.074-43.879-58.163-79.821-106.598-79.821-107.366 0-1.331 231.782-251.187 310.58-334.746l22.527-23.808h-41.42l-41.217 0.154-48.179 51.814a48197.632 48197.632 0 0 1-144.23 154.88l-95.847 102.912L445.03 258.202 328.55 103.68l-137.062-0.922c-75.418-0.563-137.626-0.41-137.984 0.154z m324.762 166.4c44.8 59.7 113.97 151.5 153.65 204.288 39.732 52.531 127.796 169.677 195.892 259.994 68.045 90.47 124.365 165.376 125.286 166.707 1.178 1.69-12.288 2.253-61.235 2.253h-62.566L605.286 737.69c-286.208-379.802-430.592-571.7-432.332-574.516-1.127-1.69 11.724-2.252 61.081-2.252h62.567l81.664 108.39z" ></path></symbol><symbol id="icon-icon_telegram" viewBox="0 0 1024 1024"><path d="M824.87808 503.6032c55.8592 0 100.096 12.544 133.4272 37.5296 34.2016 26.7264 55.9104 66.7136 64.2048 120.9344h-94.208c-5.8368-27.4944-17.5104-47.5136-34.2016-60.8768-17.5104-13.312-40.8576-19.968-69.2224-19.968-35.0208 0-62.5664 12.4928-82.5856 39.168-19.968 25.856-30.0032 62.5152-30.0032 109.2608 0 47.5136 9.216 85.0432 29.184 111.7184 18.3296 25.856 45.8752 39.2192 82.5856 39.2192 63.3856 0 98.4064-31.6928 105.8816-94.208H1024.19968c-9.984 58.368-32.512 101.7344-66.7136 130.048-33.3824 27.5456-78.3872 41.728-134.2976 41.728-66.7136 0-118.4256-21.7088-155.136-65.024-35.84-41.728-53.3504-95.9488-53.3504-162.6624 0-65.024 17.5104-118.4256 52.5312-159.2832 37.5296-45.056 90.112-67.584 157.6448-67.584z m75.7248-333.6704l-53.76 245.4528a353.792 353.792 0 0 0-12.6464-0.256c-164.096 0-316.3648 113.7664-357.0176 266.752L381.63968 771.9424c-11.6224 10.9056-20.7872 20.1216-41.5744 20.1216l14.1824-205.2608 385.1776-336.7424c16.896-14.5408-3.6352-21.6576-26.112-8.3968L237.76768 532.2752 32.35328 470.1696c-44.288-13.1584-44.544-42.7008 10.0352-64l800.3072-298.9568c36.5568-15.9744 71.8336 8.5504 57.856 62.72z" ></path></symbol><symbol id="icon-icon_medium" viewBox="0 0 1024 1024"><path d="M576.819712 497.6128c-0.7168 169.6768-139.5712 294.7584-293.376 292.3008C127.795712 787.4048-0.357888 656.1792 0.000512 495.2064 0.358912 334.9504 130.611712 204.032 288.819712 204.8c159.9488 0.768 288.2048 131.1744 288 292.8128m27.904-1.536c0.9216-72.9088 12.3904-143.3088 50.1248-207.0528 7.168-12.1856 15.872-23.8592 25.6512-33.9968 44.4928-46.08 99.4816-44.0832 141.312 4.5056 28.8768 33.5872 45.8752 73.216 56.064 115.8656 24.576 102.5536 21.2992 203.5712-19.968 301.6704-11.9808 28.416-28.5184 54.2208-52.9408 73.728-36.2496 29.1328-76.8 29.3888-112.5376-0.3072-39.2704-32.6656-59.4944-77.5168-70.7584-125.696-9.8304-41.984-14.2848-85.248-21.0944-128l4.1472-0.7168M1024.000512 470.5792c-3.1744 93.952-4.9152 159.8976-22.1696 224.0512-3.0208 11.264-6.656 22.7328-12.4928 32.6656-3.8912 6.656-11.776 14.3872-18.3296 14.8992-5.3248 0.4096-14.08-8.192-16.6912-14.6944-7.5776-18.7392-14.848-38.0928-18.6368-57.9584-16.384-86.3744-18.4832-173.7216-10.496-261.0176 3.584-39.424 11.9296-78.4896 19.1488-117.5552 1.792-9.728 6.7584-19.2512 11.776-27.9552 9.728-16.4864 22.3744-16.896 30.9248 0 7.68 15.2576 15.0528 31.744 17.408 48.4864 8.8064 62.0544 15.4112 124.416 19.5584 159.0784" ></path></symbol><symbol id="icon-icon_discord" viewBox="0 0 1024 1024"><path d="M831.8976 213.6064A748.032 748.032 0 0 0 641.7408 153.6c-8.192 14.848-17.7664 34.8672-24.3712 50.7904a694.8864 694.8864 0 0 0-210.688 0c-6.6048-15.872-16.384-35.8912-24.6272-50.7904a745.5744 745.5744 0 0 0-190.3104 60.16C71.424 396.4928 38.8096 574.6176 55.0912 750.2848a758.784 758.784 0 0 0 233.216 120.064c18.7904-26.0096 35.5328-53.6064 49.92-82.688a490.0864 490.0864 0 0 1-78.6432-38.4c6.656-4.9664 13.056-10.0864 19.3024-15.36 151.6544 71.2704 316.416 71.2704 466.2272 0 6.2976 5.2736 12.8 10.3936 19.3024 15.36a488.8576 488.8576 0 0 1-78.848 38.5024c14.4384 28.9792 31.1296 56.6784 49.9712 82.6368a757.2992 757.2992 0 0 0 233.3184-120.1152c19.1488-203.6224-32.6656-380.16-136.96-536.6784zM358.912 642.2528c-45.568 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0.1024 52.0192-36.5056 94.72-82.8416 94.72z m306.176 0c-45.5168 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0 52.0192-36.5056 94.72-82.8416 94.72z" ></path></symbol><symbol id="icon-icon_del" viewBox="0 0 1024 1024"><path d="M512 64a243.2512 243.2512 0 0 1 240.1792 204.8h-1.3312a140.8 140.8 0 0 1 139.1104 162.4576l-63.6928 409.6a140.8 140.8 0 0 1-139.1616 119.1424H336.896a140.8 140.8 0 0 1-139.1616-119.1424l-63.6928-409.6A140.8 140.8 0 0 1 271.8208 268.8a243.2 243.2 0 0 1 240.1792-204.8z m238.848 281.6h-477.696A64 64 0 0 0 209.92 419.4304l63.6928 409.6A64 64 0 0 0 336.896 883.2h350.208a64 64 0 0 0 63.2832-54.1696l63.6928-409.6a64 64 0 0 0-63.232-73.8304zM409.6 473.6a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8A38.4 38.4 0 0 1 409.6 473.6z m204.8 0a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8a38.4 38.4 0 0 1 38.4-38.4z m-102.4-332.8a166.4512 166.4512 0 0 0-160.0512 120.7296l-1.8944 7.2704h323.84l-1.8432-7.2704a166.5024 166.5024 0 0 0-150.6304-120.4736L512 140.8z" ></path></symbol><symbol id="icon-plorer" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0zM726.886 324.3L577.741 764.11c-11.776 34.713-60.826 34.816-72.704 0.051L440.73 575.59l-197.94-71.987c-31.744-11.622-33.536-54.63-5.427-69.785l5.632-2.458 434.586-155.546a38.4 38.4 0 0 1 49.305 48.487z m-98.252 50.586L369.05 467.763l115.2 41.984a38.4 38.4 0 0 1 20.992 18.381l2.252 5.325 33.792 98.97 87.348-257.537z" ></path></symbol><symbol id="icon-disconnect" viewBox="0 0 1024 1024"><path d="M575.357 738.274a38.4 38.4 0 0 1 0 54.306l-72.408 72.408A243.2 243.2 0 1 1 159.012 521.05l72.408-72.408a38.4 38.4 0 1 1 54.306 54.306l-72.408 72.408a166.4 166.4 0 0 0 235.325 235.325l72.408-72.408a38.4 38.4 0 0 1 54.306 0z m-108.612-181.02a38.4 38.4 0 0 1 0 54.307L358.134 720.172a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0zM756.376 702.07a38.4 38.4 0 1 1-54.306 54.306L267.624 321.93a38.4 38.4 0 1 1 54.306-54.306L756.376 702.07z m-36.204-398.242a38.4 38.4 0 0 1 0 54.306L611.561 466.745a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0z m144.816-144.816a243.2 243.2 0 0 1 0 343.937l-72.408 72.408a38.4 38.4 0 1 1-54.306-54.306l72.408-72.408a166.4 166.4 0 0 0-235.325-235.325l-72.408 72.408a38.4 38.4 0 0 1-54.306-54.306l72.408-72.408a243.2 243.2 0 0 1 343.937 0z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M665.6 396.8a140.8 140.8 0 0 1 140.8 140.8v128a140.8 140.8 0 0 1-140.8 140.8h-128a140.8 140.8 0 0 1-140.8-140.8v-128a140.8 140.8 0 0 1 140.8-140.8h128z m0 76.8h-128c-35.328 0-64 28.672-64 64v128c0 35.328 28.672 64 64 64h128c35.328 0 64-28.672 64-64v-128c0-35.328-28.672-64-64-64z" ></path><path d="M537.6 217.6c49.46 0 89.6 40.14 89.6 89.6v25.6a38.4 38.4 0 0 1-76.8 0v-25.6a12.8 12.8 0 0 0-12.8-12.8H307.2a12.8 12.8 0 0 0-12.8 12.8v230.4c0 7.066 5.734 12.8 12.8 12.8h25.6a38.4 38.4 0 0 1 0 76.8h-25.6a89.6 89.6 0 0 1-89.6-89.6V307.2c0-49.46 40.14-89.6 89.6-89.6h230.4z" ></path></symbol><symbol id="icon-link" viewBox="0 0 1024 1024"><path d="M436.992 281.6a38.4 38.4 0 0 1 0 76.8 217.6 217.6 0 1 0 217.6 217.6 38.4 38.4 0 1 1 76.8 0 294.4 294.4 0 1 1-294.4-294.4z m385.28-102.4l3.8912 0.2048 0.6144 0.0512-4.5056-0.256a38.2464 38.2464 0 0 1 28.416 12.544l0.8704 1.024a38.5536 38.5536 0 0 1 2.0992 2.7136l-2.9696-3.7376a38.656 38.656 0 0 1 9.984 25.5488V473.6a38.4 38.4 0 1 1-76.8 0V304.4864l-399.616 364.1344a38.4 38.4 0 0 1-51.712-56.832L723.0464 256H566.272a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-unfold" viewBox="0 0 2048 1024"><path d="M565.248 78.131a76.8 76.8 0 0 1 108.544 0l362.086 361.984a25.6 25.6 0 0 0 36.25 0l361.984-361.984a76.8 76.8 0 0 1 108.544 108.544l-361.984 362.189a179.2 179.2 0 0 1-253.44 0L565.248 186.675a76.8 76.8 0 0 1 0-108.544z" ></path></symbol><symbol id="icon-rpc" viewBox="0 0 1024 1024"><path d="M204.8 678.4a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m168.96-573.44a268.8 268.8 0 0 1 207.872 439.245l38.144 38.144a192 192 0 1 1-55.603 53.094l-39.27-39.373A268.8 268.8 0 1 1 373.76 104.96zM204.8 755.2a64 64 0 1 0 0 128 64 64 0 0 0 0-128z m517.12-125.44a115.2 115.2 0 1 0 0 230.4 115.2 115.2 0 0 0 0-230.4z m-348.16-448a192 192 0 1 0 0 384 192 192 0 0 0 0-384zM819.2 64a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m0 76.8a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" ></path></symbol><symbol id="icon-mev" viewBox="0 0 1024 1024"><path d="M651.162 95.488c53.401 56.422 131.84 113.818 235.212 171.674a38.4 38.4 0 0 1 19.456 29.9c12.032 129.024-12.544 251.75-73.625 367.156-60.211 113.817-158.976 226.457-295.936 338.33a38.4 38.4 0 0 1-48.589 0C356.608 895.436 259.328 782.181 196.045 662.681c-64.103-121.19-90.266-243.405-77.824-365.876a38.4 38.4 0 0 1 20.531-30.259C239.923 214.323 319.846 156.98 378.624 94.925c104.96-110.95 169.37-108.442 272.538 0.512z m126.464 196.506l-1.178 0.819a41.933 41.933 0 0 1-10.035 3.84c-4.25 1.024-5.427 1.28-14.695 3.328a122.368 122.368 0 0 0-16.896 4.403c-43.878 16.384-71.168 47.411-83.097 96.666-2.304 9.625-3.328 20.838-3.687 38.4l-0.204 13.516v15.872l0.05 9.728v2.048l0.052 3.482c0.256 35.328 0.154 51.2-1.024 71.424-4.506 79.36-42.291 140.39-108.954 178.483-29.542 16.896-61.9 23.962-99.328 23.91h-8.704a9243.136 9243.136 0 0 0-29.286-0.153h-17.46l-10.034-0.051h-22.938c40.448 50.841 88.371 100.71 143.77 149.504l17.97 15.513 17.511-14.899c101.018-88.064 176.077-175.513 225.28-262.144l9.523-17.408c50.893-96.205 73.063-197.273 66.56-303.974l-3.584-2.407a1479.786 1479.786 0 0 1-49.664-29.9z m-171.52 5.12h-1.127c-15.155 0.102-30.054 3.584-45.107 10.598-46.285 21.504-77.056 71.373-76.39 128.051 0.307 25.703 0.256 51.354 0 87.603l-0.103 10.445c-0.102 14.49-0.512 24.371-1.74 34.816-4.865 42.803-19.661 79.77-43.674 110.285l-1.792 2.15 1.331 0.052h1.331c24.832 0 44.288-4.199 61.03-13.824 44.033-25.19 67.38-62.72 70.4-116.122 1.025-18.022 1.127-32.768 0.871-66.56v-5.478l-0.051-5.223v-21.504c0-5.12 0.051-9.728 0.153-14.49 0.512-22.681 1.895-38.604 5.837-54.937a225.075 225.075 0 0 1 35.687-79.514l4.71-6.246h-11.366z m1.484-136.295l-12.236-12.544c-73.728-77.926-87.245-78.438-160.973-0.563-60.467 63.898-139.674 122.112-237.466 174.95l-3.942 2.048-0.768 17.562c-2.407 88.064 18.176 176.384 61.952 265.42l9.779 19.047c9.267 17.51 19.354 34.919 30.26 52.224l-0.871 0.154c2.406-0.512 2.406-0.512 6.144-0.973 15.104-1.536 29.593-6.86 43.776-15.974 36.454-23.552 56.883-56.576 62.105-102.247 0.82-7.168 1.127-14.848 1.23-26.726l0.102-10.343c0.256-35.84 0.307-61.132 0-86.22-1.024-86.58 46.899-164.199 120.78-198.554a183.552 183.552 0 0 1 77.312-17.766h1.536l53.044 0.256h16.076a775.117 775.117 0 0 1-67.84-59.75z" ></path></symbol><symbol id="icon-caution" viewBox="0 0 1024 1024"><path d="M512 682.666667c-47.146667 0-85.333333-42.112-85.333333-94.037334V94.037333C426.666667 42.112 464.853333 0 512 0s85.333333 42.112 85.333333 94.037333v494.592C597.333333 640.554667 559.146667 682.666667 512 682.666667zM512 1024c-47.146667 0-85.333333-35.2-85.333333-78.592v-98.816C426.666667 803.2 464.853333 768 512 768s85.333333 35.2 85.333333 78.592v98.816C597.333333 988.8 559.146667 1024 512 1024z" ></path></symbol><symbol id="icon-settings" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0z m104.858 211.762a89.6 89.6 0 0 1 77.568 44.8l47.257 81.818a89.6 89.6 0 0 1 0 89.6l-47.257 81.818a89.6 89.6 0 0 1-77.568 44.8h-94.516a89.6 89.6 0 0 1-77.568-44.8L339.917 556.8a89.6 89.6 0 0 1 0-89.6l47.257-81.818a89.6 89.6 0 0 1 77.568-44.8h94.516z m0 76.8h-94.516a12.8 12.8 0 0 0-11.059 6.4L406.426 505.6a12.8 12.8 0 0 0 0 12.8l47.257 81.818a12.8 12.8 0 0 0 11.06 6.4h94.515a12.8 12.8 0 0 0 11.059-6.4l47.257-81.818a12.8 12.8 0 0 0 0-12.8l-47.257-81.818a12.8 12.8 0 0 0-11.06-6.4z" ></path></symbol><symbol id="icon-back" viewBox="0 0 1024 1024"><path d="M67.738 495.616l36.3 32.358 220.468 194.868c13.926 12.236 14.438 33.792 1.024 46.796l-0.41 0.41a31.898 31.898 0 0 1-44.288 0L20.736 518.554a31.744 31.744 0 0 1 0-45.773l260.096-251.597a31.898 31.898 0 0 1 44.288 0l0.46 0.41a31.846 31.846 0 0 1-1.023 46.848l-220.57 194.816-36.352 32.358z" ></path></symbol><symbol id="icon-wallet" viewBox="0 0 1024 1024"><path d="M825.6 115.2A134.4 134.4 0 0 1 960 249.6v384c0 60.877-40.448 112.282-95.949 128.82L864 785.868a140.8 140.8 0 0 1-179.456 135.373l-467.2-133.479A140.8 140.8 0 0 1 115.2 652.288V249.6a134.4 134.4 0 0 1 134.4-134.4h576zM256 225.331c-35.328 0-64 28.672-64 64V652.34c0 28.57 18.944 53.709 46.438 61.543l467.2 133.478a64 64 0 0 0 81.562-61.491v-47.616a38.502 38.502 0 0 1 0-17.306V422.861a64 64 0 0 0-46.438-61.543l-467.2-133.478A64 64 0 0 0 256 225.28zM825.6 192H427.827l334.029 95.437A140.8 140.8 0 0 1 864 422.86v253.645c11.776-10.548 19.2-25.856 19.2-42.906v-384c0-31.795-25.805-57.6-57.6-57.6z m-192 259.226a38.4 38.4 0 0 1 38.4 38.4V633.6a38.4 38.4 0 1 1-76.8 0V489.574a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-star" viewBox="0 0 1024 1024"><path d="M474.778 72.653a84.992 84.992 0 0 1 113.1 37.683l90.727 179.712c1.024 2.15 3.277 3.686 5.939 4.096l202.906 29.082c18.278 2.56 35.174 11.059 48.128 24.064a83.302 83.302 0 0 1-1.23 119.09l-148.12 142.542a6.605 6.605 0 0 0-2.049 5.939l34.765 195.584c3.277 18.483 0.154 37.58-8.806 54.17a85.043 85.043 0 0 1-114.176 34.457L515.84 804.659a8.55 8.55 0 0 0-7.885 0l-179.968 94.31c-16.589 8.705-35.635 11.674-54.118 8.5a83.968 83.968 0 0 1-68.813-97.28l34.97-195.328a6.605 6.605 0 0 0-2.048-5.94L89.702 466.484a83.61 83.61 0 0 1-24.832-48.128 83.968 83.968 0 0 1 71.732-95.078l204.339-29.184a7.834 7.834 0 0 0 5.939-4.096l89.395-179.251c8.192-16.59 21.76-29.952 38.503-38.093z m36.198 68.25l-2.56 0.767a7.475 7.475 0 0 0-3.43 3.328l-89.344 179.303c-12.39 24.832-36.301 41.933-63.847 45.875l-204.339 29.133c-4.352 0.614-7.168 4.198-6.605 7.885a6.81 6.81 0 0 0 2.048 3.89l148.275 142.49c20.173 19.354 29.338 47.36 24.423 74.804l-34.919 195.379c-0.665 3.584 1.946 7.27 6.247 8.038 1.894 0.307 3.789 0 5.427-0.819l179.968-94.31a85.35 85.35 0 0 1 79.155 0l180.173 94.361c3.994 2.1 9.011 0.615 10.957-3.02a6.4 6.4 0 0 0 0.717-4.199l-34.714-195.533a83.354 83.354 0 0 1 24.371-74.65l148.122-142.591a6.502 6.502 0 0 0 0.102-9.524 8.14 8.14 0 0 0-4.608-2.252l-202.957-29.082c-27.392-3.942-51.2-20.89-63.59-45.517l-90.726-179.712c-1.844-3.635-6.81-5.273-10.906-3.277l2.56-0.768z" ></path></symbol><symbol id="icon-trade" viewBox="0 0 1024 1024"><path d="M1002.93153 563.627l-433.237 432.64a67.243 67.243 0 0 1-29.696 21.93c-0.853 0.171-1.45 0.342-1.963 0.342a61.27 61.27 0 0 1-22.442 4.608c-1.11 0-2.304 0.853-3.414 0.853-2.048 0-3.84-1.365-5.973-1.365a54.87 54.87 0 0 1-13.653-2.987 77.312 77.312 0 0 1-15.275-6.144c-2.987-1.621-5.803-3.67-8.533-5.803-2.56-1.962-5.718-2.816-7.936-5.461L21.34153 563.627a71.68 71.68 0 0 1 0-102.059 72.704 72.704 0 0 1 102.57 0l316.16 315.477V73.472C440.07353 33.109 472.92753 0 513.29053 0a73.387 73.387 0 0 1 73.216 73.472v701.355L900.53153 461.653a72.363 72.363 0 0 1 102.4 102.059z" ></path></symbol><symbol id="icon-verticalslider" viewBox="0 0 1024 1024"><path d="M310.426 441.6a166.4 166.4 0 0 1 38.4 328.346V870.4a38.4 38.4 0 1 1-76.8 0V769.946a166.451 166.451 0 0 1 38.4-328.346z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z m403.2-403.2a38.4 38.4 0 0 1 38.4 38.4v55.654a166.451 166.451 0 0 1-38.4 328.346 166.4 166.4 0 0 1-38.4-328.346V153.6a38.4 38.4 0 0 1 38.4-38.4z m0 166.4a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2zM310.323 115.2a38.4 38.4 0 0 1 38.4 38.4v146.534a38.4 38.4 0 0 1-76.8 0V153.6a38.4 38.4 0 0 1 38.4-38.4z m403.2 525.26a38.4 38.4 0 0 1 38.4 38.4V870.4a38.4 38.4 0 1 1-76.8 0V678.86a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-swap" viewBox="0 0 1024 1024"><path d="M321.434 116.224a51.2 51.2 0 0 1 69.888 74.752c-47.77 44.646-87.04 81.818-117.658 111.462l-1.997 1.844h289.229a51.2 51.2 0 0 1 50.842 45.26l0.358 5.94a51.2 51.2 0 0 1-51.2 51.2H154.47a51.763 51.763 0 0 1-52.07-52.839c0.205-11.52 3.123-19.097 7.782-27.136 3.226-5.53 7.22-10.752 12.8-17.203 8.192-9.626 20.992-23.04 38.656-40.704a7171.584 7171.584 0 0 1 159.744-152.576z m509.593 188.058a51.2 51.2 0 0 1 0 102.4h-93.593a51.2 51.2 0 0 1 0-102.4h93.593zM663.194 853.709a51.2 51.2 0 0 1-69.888-74.803c47.77-44.647 87.04-81.818 117.657-111.412l2.048-1.894H153.6a51.2 51.2 0 0 1-50.842-45.21l-0.358-5.99a51.2 51.2 0 0 1 51.2-51.2h676.557c27.904 0 52.582 22.272 52.07 52.838a51.456 51.456 0 0 1-7.782 27.136c-3.226 5.53-7.22 10.752-12.8 17.204-8.192 9.625-20.992 23.04-38.656 40.704a7171.584 7171.584 0 0 1-159.744 152.627z" ></path></symbol><symbol id="icon-star_sel" viewBox="0 0 1024 1024"><path d="M470.63 127.846L381.286 307.2a46.182 46.182 0 0 1-34.918 24.986l-204.34 29.184a45.568 45.568 0 0 0-39.167 51.456 45.344 45.344 0 0 0 13.465 26.01l148.276 142.438c10.905 10.496 15.872 25.6 13.21 40.448l-34.97 195.328a45.568 45.568 0 0 0 37.58 52.633 46.95 46.95 0 0 0 29.748-4.659l179.968-94.31a46.95 46.95 0 0 1 43.52 0l180.121 94.361c22.528 11.827 50.586 3.43 62.618-18.688a44.8 44.8 0 0 0 4.71-29.184L746.394 621.62a45.005 45.005 0 0 1 13.21-40.294l148.12-142.592a44.902 44.902 0 0 0 0.666-64.256 46.54 46.54 0 0 0-26.368-13.21l-202.956-29.081a46.182 46.182 0 0 1-34.765-24.781l-90.727-179.712a46.592 46.592 0 0 0-82.944 0.205z" ></path></symbol><symbol id="icon-tips" viewBox="0 0 1024 1024"><path d="M512 166.4a345.6 345.6 0 1 1 0 691.2 345.6 345.6 0 0 1 0-691.2z m0 76.8a268.8 268.8 0 1 0 0 537.6 268.8 268.8 0 0 0 0-537.6z m0 196.3a38.4 38.4 0 0 1 38.4 38.4v219.29a38.4 38.4 0 1 1-76.8 0V477.9a38.4 38.4 0 0 1 38.4-38.4z m0-153.087a38.4 38.4 0 0 1 38.4 38.4v45.414a38.4 38.4 0 1 1-76.8 0v-45.363a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-sel" viewBox="0 0 1024 1024"><path d="M783.36 281.2416a51.2 51.2 0 0 1 71.68 73.0624l-407.9616 400.384a51.2 51.2 0 0 1-67.8912 3.4304l-206.3872-165.376a51.2 51.2 0 1 1 64-79.9232l170.9568 137.0112 375.6032-368.64z" ></path></symbol><symbol id="icon-spread" viewBox="0 0 1024 1024"><path d="M143.36 678.4a38.4 38.4 0 0 1 38.4 38.4v112.64c0 7.066 5.734 12.8 12.8 12.8H307.2a38.4 38.4 0 1 1 0 76.8H194.56a89.6 89.6 0 0 1-89.6-89.6V716.8a38.4 38.4 0 0 1 38.4-38.4z m327.68-573.44a38.4 38.4 0 0 1 0 76.8H234.342L842.24 790.477v-242.33a38.4 38.4 0 1 1 76.8 0V829.44a89.6 89.6 0 0 1-89.6 89.6H552.96a38.4 38.4 0 1 1 0-76.8l232.346-0.051L181.76 237.773V471.04a38.4 38.4 0 0 1-76.8 0V194.56c0-49.46 40.14-89.6 89.6-89.6h276.48z m358.4 0c49.46 0 89.6 40.14 89.6 89.6V307.2a38.4 38.4 0 1 1-76.8 0V194.56a12.8 12.8 0 0 0-12.8-12.8H716.8a38.4 38.4 0 1 1 0-76.8h112.64z" ></path></symbol><symbol id="icon-refresh" viewBox="0 0 1024 1024"><path d="M601.446 178.176a344.576 344.576 0 0 1 124.621 62.413 38.4 38.4 0 0 1 5.12 55.45l-94.566 107.878a38.4 38.4 0 1 1-57.754-50.586l65.741-75.11-4.915-2.816a268.646 268.646 0 0 0-43.008-18.535l-15.104-4.505A268.8 268.8 0 1 0 771.635 581.58a38.4 38.4 0 1 1 74.189 19.865 345.6 345.6 0 1 1-244.378-423.27z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M763.392 256.512a51.2 51.2 0 0 1 0 72.3968L582.2464 509.952l183.1424 183.1424a51.2 51.2 0 0 1-72.3968 72.3968l-183.1424-183.1424-180.992 181.0432a51.2 51.2 0 0 1-72.3968-72.3968L437.504 509.952 258.56 330.9568A51.2 51.2 0 0 1 330.9568 258.56L509.952 437.504l181.0432-180.992a51.2 51.2 0 0 1 72.3968 0z" ></path></symbol><symbol id="icon-alert" viewBox="0 0 1024 1024"><path d="M558.08 125.0816c12.6464 7.5776 23.1936 18.1248 30.72 30.72L959.232 773.12a89.6 89.6 0 0 1-76.8 135.68H141.6192a89.6 89.6 0 0 1-76.8-135.68L435.1488 155.8016a89.6 89.6 0 0 1 122.9312-30.72zM501.0432 195.328L130.6624 812.5952a12.8 12.8 0 0 0 10.9568 19.4048h740.7616a12.8 12.8 0 0 0 10.9568-19.4048L522.9568 195.328a12.8 12.8 0 0 0-21.9136 0zM512 524.8a38.4 38.4 0 0 1 38.4 38.4v153.6a38.4 38.4 0 1 1-76.8 0v-153.6a38.4 38.4 0 0 1 38.4-38.4z m0-204.8a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 1 1-76.8 0V358.4a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M572.33 707.67l220.673-220.673a85.333 85.333 0 0 0-60.331-145.664H291.328a85.333 85.333 0 0 0-60.33 145.664L451.668 707.67a85.333 85.333 0 0 0 120.662 0z" ></path></symbol></svg>',(e=>{var t=(r=(r=document.getElementsByTagName("script"))[r.length-1]).getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,s,o,a,c=function(f,h){h.parentNode.insertBefore(f,h)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch{}}n=function(){var f,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_4776227,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(f=document.body).firstChild?c(h,f.firstChild):f.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(s=n,o=e.document,a=!1,l(),o.onreadystatechange=function(){o.readyState=="complete"&&(o.onreadystatechange=null,u())})}function u(){a||(a=!0,s())}function l(){try{o.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);const oW="",aW="",cW="",uW="";function jn(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 x3="1.18.0",S3="1.40.0",E3={"-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 Ll extends Error{}class Ul extends Ll{constructor(t,r){super(t),this.code=r,this.type=E3[r]??"ServerError"}}class ap extends Ll{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var cp=e=>{throw TypeError(e)},Fl=(e,t,r)=>t.has(e)||cp("Cannot "+r),er=(e,t,r)=>(Fl(e,t,"read from private field"),r?r.call(e):t.get(e)),fs=(e,t,r)=>t.has(e)?cp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ws=(e,t,r,n)=>(Fl(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),up=(e,t,r)=>(Fl(e,t,"access private method"),r),M3=(e,t,r,n)=>({set _(i){Ws(e,t,i,r)},get _(){return er(e,t,n)}}),ds,ta,ni,hs,ra,Ks,wc,lp,fp;function C3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const A3={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class T3{constructor(t,r={}){if(fs(this,wc),fs(this,ds,0),fs(this,ta,0),fs(this,ni,null),fs(this,hs,null),fs(this,ra,new Set),fs(this,Ks,new Map),this.endpoint=t,this.options={...A3,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=C3(this.endpoint))}async makeRequest(t,r){const n=await up(this,wc,lp).call(this);return new Promise((i,s)=>{Ws(this,ds,er(this,ds)+1),er(this,Ks).set(er(this,ds),{resolve:i,reject:s,timeout:setTimeout(()=>{er(this,Ks).delete(er(this,ds)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:er(this,ds),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new Ul(i.message,i.code);return s})}async subscribe(t){const r=new O3(t);return er(this,ra).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}ds=new WeakMap,ta=new WeakMap,ni=new WeakMap,hs=new WeakMap,ra=new WeakMap,Ks=new WeakMap,wc=new WeakSet,lp=function(){return er(this,hs)?er(this,hs):(Ws(this,hs,new Promise(e=>{var t;(t=er(this,ni))==null||t.close(),Ws(this,ni,new this.options.WebSocketConstructor(this.endpoint)),er(this,ni).addEventListener("open",()=>{Ws(this,ta,0),e(er(this,ni))}),er(this,ni).addEventListener("close",()=>{M3(this,ta)._++,er(this,ta)<=this.options.maxReconnects&&setTimeout(()=>{up(this,wc,fp).call(this)},this.options.reconnectTimeout)}),er(this,ni).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,Ks).has(n.id)){const{resolve:i,timeout:s}=er(this,Ks).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,hs))},fp=async function(){var e;return(e=er(this,ni))==null||e.close(),Ws(this,hs,null),Promise.allSettled([...er(this,ra)].map(t=>t.subscribe(this)))};class O3{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 dp=e=>{throw TypeError(e)},zl=(e,t,r)=>t.has(e)||dp("Cannot "+r),Xr=(e,t,r)=>(zl(e,t,"read from private field"),r?r.call(e):t.get(e)),_c=(e,t,r)=>t.has(e)?dp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Vl=(e,t,r,n)=>(zl(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),I3=(e,t,r)=>(zl(e,t,"access private method"),r),na,an,ia,ql,hp;class pp{constructor(t){_c(this,ql),_c(this,na,0),_c(this,an),_c(this,ia),Vl(this,an,t)}fetch(t,r){const n=Xr(this,an).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;Vl(this,na,Xr(this,na)+1);const r=await this.fetch(((i=Xr(this,an).rpc)==null?void 0:i.url)??Xr(this,an).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":x3,"Client-Target-Api-Version":S3,"Client-Request-Method":t.method,...(s=Xr(this,an).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:Xr(this,na),method:t.method,params:t.params})});if(!r.ok)throw new ap(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new Ul(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await I3(this,ql,hp).call(this).subscribe(t);return async()=>!!await r()}}na=new WeakMap,an=new WeakMap,ia=new WeakMap,ql=new WeakSet,hp=function(){var e;if(!Xr(this,ia)){const t=Xr(this,an).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");Vl(this,ia,new T3(((e=Xr(this,an).websocket)==null?void 0:e.url)??Xr(this,an).url,{WebSocketConstructor:t,...Xr(this,an).websocket}))}return Xr(this,ia)};function mp(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 k3(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],R=0;for(let F=_-1;(P!==0||R<f)&&F!==-1;F--,R++)P+=256*w[F]>>>0,w[F]=P%r>>>0,P=P/r>>>0;if(P!==0)throw new Error("Non-zero carry");f=R,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 R=0;for(let F=y-1;(P!==0||R<h)&&F!==-1;F--,R++)P+=r*_[F]>>>0,_[F]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");h=R,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 j3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const gp=k3(j3),Xs=e=>gp.encode(e),ii=e=>gp.decode(e),P3=Xs,N3=ii;function cn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const Gl=8192;function zr(e){if(e.length<Gl)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=Gl){const n=e.slice(r,r+Gl);t+=String.fromCharCode(...n)}return btoa(t)}const vp=zr,yp=cn;function Ys(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 si(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const bp=si,wp=Ys;function Hl(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 R3(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 _p{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}=R3(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 xp(e,t){switch(t){case"base58":return Xs(e);case"base64":return zr(e);case"hex":return si(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function D3(e,t){switch(t){case"base58":return ii(e);case"base64":return cn(e);case"hex":return Ys(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Wl(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 Sp{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 Kl(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return Kl(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return Kl(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return Hl(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 xp(this.toBytes(),t)}}function Kl(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 Ep=e=>{throw TypeError(e)},Mp=(e,t,r)=>t.has(e)||Ep("Cannot "+r),un=(e,t,r)=>(Mp(e,t,"read from private field"),r?r.call(e):t.get(e)),xc=(e,t,r)=>t.has(e)?Ep("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Sc=(e,t,r,n)=>(Mp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Js,sa,Ec,Ni;const $3=class m3{constructor(t){xc(this,Js),xc(this,sa),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Sc(this,Js,t.write),Sc(this,sa,t.serialize??((r,n)=>{const i=new Sp({initialSize:this.serializedSize(r)??void 0,...n});return un(this,Js).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),un(this,Js).call(this,t,r)}serialize(t,r){return this.validate(t),new Ap(this,un(this,sa).call(this,t,r))}parse(t){const r=new _p(t);return this.read(r)}fromHex(t){return this.parse(Ys(t))}fromBase58(t){return this.parse(ii(t))}fromBase64(t){return this.parse(cn(t))}transform({name:t,input:r,output:n,validate:i}){return new m3({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>un(this,Js).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>un(this,sa).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};Js=new WeakMap,sa=new WeakMap;let Pn=$3;const Cp=Symbol.for("@mysten/serialized-bcs");function B3(e){return!!e&&typeof e=="object"&&e[Cp]===!0}class Ap{constructor(t,r){xc(this,Ec),xc(this,Ni),Sc(this,Ec,t),Sc(this,Ni,r)}get[Cp](){return!0}toBytes(){return un(this,Ni)}toHex(){return si(un(this,Ni))}toBase64(){return zr(un(this,Ni))}toBase58(){return Xs(un(this,Ni))}parse(){return un(this,Ec).parse(un(this,Ni))}}Ec=new WeakMap,Ni=new WeakMap;function Mc({size:e,...t}){return new Pn({...t,serializedSize:()=>e})}function Xl({readMethod:e,writeMethod:t,...r}){return Mc({...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 Yl({readMethod:e,writeMethod:t,...r}){return Mc({...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 L3({serialize:e,...t}){const r=new Pn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function U3({toBytes:e,fromBytes:t,...r}){return new Pn({...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=Hl(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 F3(e){let t=null;function r(){return t||(t=e()),t}return new Pn({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 Xl({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Xl({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Xl({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Yl({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Yl({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Yl({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Mc({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 L3({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(Hl(t)),...e})},bytes(e,t){return Mc({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 U3({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Pn({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 Pn({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 Pn({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 Pn({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 Pn({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 F3(e)}},z3=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:_p,BcsType:Pn,BcsWriter:Sp,SerializedBcs:Ap,bcs:G,decodeStr:D3,encodeStr:xp,fromB58:N3,fromB64:yp,fromBase58:ii,fromBase64:cn,fromHEX:wp,fromHex:Ys,isSerializedBcs:B3,splitGenericParameters:Wl,toB58:P3,toB64:vp,toBase58:Xs,toBase64:zr,toHEX:bp,toHex:si},Symbol.toStringTag,{value:"Module"})),V3=32;function Jl(e){try{return ii(e).length===V3}catch{return!1}}const Cc=32;function oi(e){return G3(e)&&H3(e)===Cc}function oa(e){return oi(e)}function q3(e){return e.includes("::")?Zl(e):e}function Zl(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("<")?Wl(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>q3(o.trim())):[];return{address:Dr(t),module:r,name:i,typeParams:s}}function Tp(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Zl(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Tp(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Dr(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Cc*2,"0")}`}function ai(e,t=!1){return Dr(e,t)}function G3(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function H3(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const W3=/^vector<(.+)>$/,K3=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let Op=class Jo{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(W3);if(n)return{vector:Jo.parseFromStr(n[1],r)};const i=t.match(K3);if(i)return{struct:{address:r?Dr(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Jo.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return Wl(t).map(n=>Jo.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<${Jo.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Jo.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function X3(e){return G.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function Y3(e){return G.enum("Option",{None:null,Some:e})}const Qt=G.bytes(Cc).transform({validate:e=>{const t=typeof e=="string"?e:si(e);if(!t||!oi(Dr(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?Ys(Dr(e)):e,output:e=>Dr(si(e))}),ln=G.vector(G.u8()).transform({name:"ObjectDigest",input:e=>ii(e),output:e=>Xs(new Uint8Array(e)),validate:e=>{if(ii(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Yr=G.struct("SuiObjectRef",{objectId:Qt,version:G.u64(),digest:ln}),Ip=G.struct("SharedObjectRef",{objectId:Qt,initialSharedVersion:G.u64(),mutable:G.bool()}),kp=G.enum("ObjectArg",{ImmOrOwnedObject:Yr,SharedObject:Ip,Receiving:Yr}),jp=G.enum("CallArg",{Pure:G.struct("Pure",{bytes:G.vector(G.u8()).transform({input:e=>typeof e=="string"?cn(e):e,output:e=>zr(new Uint8Array(e))})}),Object:kp}),Ql=G.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:G.lazy(()=>Ql),struct:G.lazy(()=>Bp),u16:null,u32:null,u256:null}),ef=Ql.transform({input:e=>typeof e=="string"?Op.parseFromStr(e,!0):e,output:e=>Op.tagToString(e)}),Nn=G.enum("Argument",{GasCoin:null,Input:G.u16(),Result:G.u16(),NestedResult:G.tuple([G.u16(),G.u16()])}),Pp=G.struct("ProgrammableMoveCall",{package:Qt,module:G.string(),function:G.string(),typeArguments:G.vector(ef),arguments:G.vector(Nn)}),Np=G.enum("Command",{MoveCall:Pp,TransferObjects:G.struct("TransferObjects",{objects:G.vector(Nn),address:Nn}),SplitCoins:G.struct("SplitCoins",{coin:Nn,amounts:G.vector(Nn)}),MergeCoins:G.struct("MergeCoins",{destination:Nn,sources:G.vector(Nn)}),Publish:G.struct("Publish",{modules:G.vector(G.vector(G.u8()).transform({input:e=>typeof e=="string"?cn(e):e,output:e=>zr(new Uint8Array(e))})),dependencies:G.vector(Qt)}),MakeMoveVec:G.struct("MakeMoveVec",{type:Y3(ef).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:G.vector(Nn)}),Upgrade:G.struct("Upgrade",{modules:G.vector(G.vector(G.u8()).transform({input:e=>typeof e=="string"?cn(e):e,output:e=>zr(new Uint8Array(e))})),dependencies:G.vector(Qt),package:Qt,ticket:Nn})}),Rp=G.struct("ProgrammableTransaction",{inputs:G.vector(jp),commands:G.vector(Np)}),Dp=G.enum("TransactionKind",{ProgrammableTransaction:Rp,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),$p=G.enum("TransactionExpiration",{None:null,Epoch:X3()}),Bp=G.struct("StructTag",{address:Qt,module:G.string(),name:G.string(),typeParams:G.vector(Ql)}),Lp=G.struct("GasData",{payment:G.vector(Yr),owner:Qt,price:G.u64(),budget:G.u64()}),Up=G.struct("TransactionDataV1",{kind:Dp,sender:Qt,gasData:Lp,expiration:$p}),Fp=G.enum("TransactionData",{V1:Up}),zp=G.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Vp=G.enum("IntentVersion",{V0:null}),qp=G.enum("AppId",{Sui:null}),Gp=G.struct("Intent",{scope:zp,version:Vp,appId:qp});function Hp(e){return G.struct(`IntentMessage<${e.name}>`,{intent:Gp,value:e})}const Wp=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())}),Kp=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())}),Xp=G.struct("MultiSigPkMap",{pubKey:Kp,weight:G.u8()}),Yp=G.struct("MultiSigPublicKey",{pk_map:G.vector(Xp),threshold:G.u16()}),J3=G.struct("MultiSig",{sigs:G.vector(Wp),bitmap:G.u16(),multisig_pk:Yp}),Z3=G.vector(G.u8()).transform({input:e=>typeof e=="string"?cn(e):e,output:e=>zr(new Uint8Array(e))}),Jp=G.struct("SenderSignedTransaction",{intentMessage:Hp(Fp),txSignatures:G.vector(Z3)}),Q3=G.vector(Jp,{name:"SenderSignedData"}),eS=G.struct("PasskeyAuthenticator",{authenticatorData:G.vector(G.u8()),clientDataJson:G.string(),userSignature:G.vector(G.u8())}),tS=G.enum("PackageUpgradeError",{UnableToFetchPackage:G.struct("UnableToFetchPackage",{packageId:Qt}),NotAPackage:G.struct("NotAPackage",{objectId:Qt}),IncompatibleUpgrade:null,DigestDoesNotMatch:G.struct("DigestDoesNotMatch",{digest:G.vector(G.u8())}),UnknownUpgradePolicy:G.struct("UnknownUpgradePolicy",{policy:G.u8()}),PackageIDDoesNotMatch:G.struct("PackageIDDoesNotMatch",{packageId:Qt,ticketId:Qt})}),rS=G.struct("ModuleId",{address:Qt,name:G.string()}),Zp=G.struct("MoveLocation",{module:rS,function:G.u16(),instruction:G.u16(),functionName:G.option(G.string())}),nS=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}),iS=G.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),sS=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:Qt}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:G.option(Zp),MoveAbort:G.tuple([Zp,G.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:G.struct("CommandArgumentError",{argIdx:G.u16(),kind:nS}),TypeArgumentError:G.struct("TypeArgumentError",{argumentIdx:G.u16(),kind:iS}),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:tS}),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(Qt)}),AddressDeniedForCoin:G.struct("AddressDeniedForCoin",{address:Qt,coinType:G.string()}),CoinTypeGlobalPause:G.struct("CoinTypeGlobalPause",{coinType:G.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Qp=G.enum("ExecutionStatus",{Success:null,Failed:G.struct("ExecutionFailed",{error:sS,command:G.option(G.u64())})}),em=G.struct("GasCostSummary",{computationCost:G.u64(),storageCost:G.u64(),storageRebate:G.u64(),nonRefundableStorageFee:G.u64()}),Zs=G.enum("Owner",{AddressOwner:Qt,ObjectOwner:Qt,Shared:G.struct("Shared",{initialSharedVersion:G.u64()}),Immutable:null}),oS=G.struct("TransactionEffectsV1",{status:Qp,executedEpoch:G.u64(),gasUsed:em,modifiedAtVersions:G.vector(G.tuple([Qt,G.u64()])),sharedObjects:G.vector(Yr),transactionDigest:ln,created:G.vector(G.tuple([Yr,Zs])),mutated:G.vector(G.tuple([Yr,Zs])),unwrapped:G.vector(G.tuple([Yr,Zs])),deleted:G.vector(Yr),unwrappedThenDeleted:G.vector(Yr),wrapped:G.vector(Yr),gasObject:G.tuple([Yr,Zs]),eventsDigest:G.option(ln),dependencies:G.vector(ln)}),tf=G.tuple([G.u64(),ln]),aS=G.enum("ObjectIn",{NotExist:null,Exist:G.tuple([tf,Zs])}),cS=G.enum("ObjectOut",{NotExist:null,ObjectWrite:G.tuple([ln,Zs]),PackageWrite:tf}),uS=G.enum("IDOperation",{None:null,Created:null,Deleted:null}),lS=G.struct("EffectsObjectChange",{inputState:aS,outputState:cS,idOperation:uS}),fS=G.enum("UnchangedSharedKind",{ReadOnlyRoot:tf,MutateDeleted:G.u64(),ReadDeleted:G.u64(),Cancelled:G.u64(),PerEpochConfig:null}),dS=G.struct("TransactionEffectsV2",{status:Qp,executedEpoch:G.u64(),gasUsed:em,transactionDigest:ln,gasObjectIndex:G.option(G.u32()),eventsDigest:G.option(ln),dependencies:G.vector(ln),lamportVersion:G.u64(),changedObjects:G.vector(G.tuple([Qt,lS])),unchangedSharedObjects:G.vector(G.tuple([Qt,fS])),auxDataDigest:G.option(ln)}),hS=G.enum("TransactionEffects",{V1:oS,V2:dS}),rf={...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:Qt,AppId:qp,Argument:Nn,CallArg:jp,CompressedSignature:Wp,GasData:Lp,Intent:Gp,IntentMessage:Hp,IntentScope:zp,IntentVersion:Vp,MultiSig:J3,MultiSigPkMap:Xp,MultiSigPublicKey:Yp,ObjectArg:kp,ObjectDigest:ln,ProgrammableMoveCall:Pp,ProgrammableTransaction:Rp,PublicKey:Kp,SenderSignedData:Q3,SenderSignedTransaction:Jp,SharedObjectRef:Ip,StructTag:Bp,SuiObjectRef:Yr,Command:Np,TransactionData:Fp,TransactionDataV1:Up,TransactionExpiration:$p,TransactionKind:Dp,TypeTag:ef,TransactionEffects:hS,PasskeyAuthenticator:eS},tm="…";function pS(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${tm}${e.slice(-4)}`}function mS(e){return`${e.slice(0,10)}${tm}`}const rm=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,nm=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,gS=235;function im(e){return e.length>gS?!1:e.includes("@")?rm.test(e):nm.test(e)}function sm(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!rm.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!nm.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 vS=9,yS=BigInt(1e9),bS="0x1",om="0x2",wS="0x3",_S=ai("0x6"),xS="sui_system",nf=`${om}::sui::SUI`,SS=ai("0x5"),ES=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,MS=/^\d+$/,CS=64,am="/",cm=e=>{const t=e.split(am);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!MS.test(i)||!im(r)?!1:ES.test(n)&&n.length<CS},AS=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(am)&&!cm(r))return!1;return!0};function sf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function TS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function um(e,...t){if(!TS(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 lm(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 OS(e,t){um(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 Ac=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),ps=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),fm=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,ci=ps?e=>e:e=>fm(e);function Qs(e){for(let t=0;t<e.length;t++)e[t]=fm(e[t])}function IS(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function aa(e){return typeof e=="string"&&(e=IS(e)),um(e),e}let kS=class{clone(){return this._cloneInto()}};function jS(e){const t=(n,i)=>e(i).update(aa(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const PS=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 NS extends kS{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,sf(t),sf(r),sf(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=Ac(this.buffer)}update(t){lm(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=aa(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(ps||Qs(i),this.compress(i,0,!1),ps||Qs(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));ps||Qs(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);ps||Qs(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){lm(this),OS(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),ps||Qs(n),this.compress(n,0,!0),ps||Qs(n);const i=Ac(t);this.get().forEach((s,o)=>i[o]=ci(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 Tc=BigInt(2**32-1),of=BigInt(32);function dm(e,t=!1){return t?{h:Number(e&Tc),l:Number(e>>of&Tc)}:{h:Number(e>>of&Tc)|0,l:Number(e&Tc)|0}}function RS(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}=dm(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const DS=(e,t)=>BigInt(e>>>0)<<of|BigInt(t>>>0),$S=(e,t,r)=>e>>>r,BS=(e,t,r)=>e<<32-r|t>>>r,LS=(e,t,r)=>e>>>r|t<<32-r,US=(e,t,r)=>e<<32-r|t>>>r,FS=(e,t,r)=>e<<64-r|t>>>r-32,zS=(e,t,r)=>e>>>r-32|t<<64-r,VS=(e,t)=>t,qS=(e,t)=>e,GS=(e,t,r)=>e<<r|t>>>32-r,HS=(e,t,r)=>t<<r|e>>>32-r,WS=(e,t,r)=>t<<r-32|e>>>64-r,KS=(e,t,r)=>e<<r-32|t>>>64-r;function XS(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const kr={fromBig:dm,split:RS,toBig:DS,shrSH:$S,shrSL:BS,rotrSH:LS,rotrSL:US,rotrBH:FS,rotrBL:zS,rotr32H:VS,rotr32L:qS,rotlSH:GS,rotlSL:HS,rotlBH:WS,rotlBL:KS,add:XS,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},lr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),ke=new Uint32Array(32);function Ri(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=kr.add3L(c,l,o);u=kr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:_}={Dh:w^u,Dl:_^c},{Dh:w,Dl:_}={Dh:kr.rotr32H(w,_),Dl:kr.rotr32L(w,_)},{h:y,l:h}=kr.add(y,h,w,_),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:kr.rotrSH(f,l,24),Bl:kr.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 Di(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=kr.add3L(c,l,o);u=kr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:_}={Dh:w^u,Dl:_^c},{Dh:w,Dl:_}={Dh:kr.rotrSH(w,_,16),Dl:kr.rotrSL(w,_,16)},{h:y,l:h}=kr.add(y,h,w,_),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:kr.rotrBH(f,l,63),Bl:kr.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 hm extends NS{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=lr[0]|0,this.v0h=lr[1]|0,this.v1l=lr[2]|0,this.v1h=lr[3]|0,this.v2l=lr[4]|0,this.v2h=lr[5]|0,this.v3l=lr[6]|0,this.v3h=lr[7]|0,this.v4l=lr[8]|0,this.v4h=lr[9]|0,this.v5l=lr[10]|0,this.v5h=lr[11]|0,this.v6l=lr[12]|0,this.v6h=lr[13]|0,this.v7l=lr[14]|0,this.v7h=lr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=Ac(aa(t.salt));this.v4l^=ci(n[0]),this.v4h^=ci(n[1]),this.v5l^=ci(n[2]),this.v5h^=ci(n[3])}if(t.personalization){const n=Ac(aa(t.personalization));this.v6l^=ci(n[0]),this.v6h^=ci(n[1]),this.v7l^=ci(n[2]),this.v7h^=ci(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(aa(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(lr,16);let{h:i,l:s}=kr.fromBig(BigInt(this.length));ke[24]=lr[8]^s,ke[25]=lr[9]^i,n&&(ke[28]=~ke[28],ke[29]=~ke[29]);let o=0;const a=PS;for(let c=0;c<12;c++)Ri(0,4,8,12,t,r+2*a[o++]),Di(0,4,8,12,t,r+2*a[o++]),Ri(1,5,9,13,t,r+2*a[o++]),Di(1,5,9,13,t,r+2*a[o++]),Ri(2,6,10,14,t,r+2*a[o++]),Di(2,6,10,14,t,r+2*a[o++]),Ri(3,7,11,15,t,r+2*a[o++]),Di(3,7,11,15,t,r+2*a[o++]),Ri(0,5,10,15,t,r+2*a[o++]),Di(0,5,10,15,t,r+2*a[o++]),Ri(1,6,11,12,t,r+2*a[o++]),Di(1,6,11,12,t,r+2*a[o++]),Ri(2,7,8,13,t,r+2*a[o++]),Di(2,7,8,13,t,r+2*a[o++]),Ri(3,4,9,14,t,r+2*a[o++]),Di(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 pm=jS(e=>new hm(e)),YS=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:hm,blake2b:pm},Symbol.toStringTag,{value:"Module"}));function JS(e,t,r){const n=rf.Address.serialize(e).toBytes(),i=rf.TypeTag.serialize(t).toBytes(),s=rf.u64().serialize(r.length).toBytes(),o=pm.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${si(o.digest().slice(0,32))}`}const ZS=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:yS,MOVE_STDLIB_ADDRESS:bS,SUI_ADDRESS_LENGTH:Cc,SUI_CLOCK_OBJECT_ID:_S,SUI_DECIMALS:vS,SUI_FRAMEWORK_ADDRESS:om,SUI_SYSTEM_ADDRESS:wS,SUI_SYSTEM_MODULE_NAME:xS,SUI_SYSTEM_STATE_OBJECT_ID:SS,SUI_TYPE_ARG:nf,deriveDynamicFieldID:JS,formatAddress:pS,formatDigest:mS,fromB64:yp,fromBase58:ii,fromBase64:cn,fromHEX:wp,fromHex:Ys,isValidNamedPackage:cm,isValidNamedType:AS,isValidSuiAddress:oi,isValidSuiNSName:im,isValidSuiObjectId:oa,isValidTransactionDigest:Jl,normalizeStructTag:Tp,normalizeSuiAddress:Dr,normalizeSuiNSName:sm,normalizeSuiObjectId:ai,parseStructTag:Zl,toB64:vp,toBase58:Xs,toBase64:zr,toHEX:bp,toHex:si},Symbol.toStringTag,{value:"Module"}));var af=Object.defineProperty,QS=Object.getOwnPropertyDescriptor,eE=Object.getOwnPropertyNames,tE=Object.prototype.hasOwnProperty,rE=(e,t)=>{for(var r in t)af(e,r,{get:t[r],enumerable:!0})},nE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eE(t))!tE.call(e,i)&&i!==r&&af(e,i,{get:()=>t[i],enumerable:!(n=QS(t,i))||n.enumerable});return e},iE=e=>nE(af({},"__esModule",{value:!0}),e),mm={};rE(mm,{BIC_REGEX:()=>vm,CUID2_REGEX:()=>ym,DECIMAL_REGEX:()=>bm,EMAIL_REGEX:()=>wm,EMOJI_REGEX:()=>_m,HEXADECIMAL_REGEX:()=>xm,HEX_COLOR_REGEX:()=>Sm,IMEI_REGEX:()=>Em,IPV4_REGEX:()=>Mm,IPV6_REGEX:()=>Cm,IP_REGEX:()=>Am,ISO_DATE_REGEX:()=>Tm,ISO_DATE_TIME_REGEX:()=>Om,ISO_TIMESTAMP_REGEX:()=>jm,ISO_TIME_REGEX:()=>Im,ISO_TIME_SECOND_REGEX:()=>km,ISO_WEEK_REGEX:()=>Pm,MAC48_REGEX:()=>Nm,MAC64_REGEX:()=>Rm,MAC_REGEX:()=>Dm,OCTAL_REGEX:()=>$m,ULID_REGEX:()=>Bm,UUID_REGEX:()=>Lm,ValiError:()=>Oc,_addIssue:()=>le,_isLuhnAlgo:()=>cf,_isValidObjectKey:()=>ms,_stringify:()=>jr,any:()=>bv,array:()=>wv,arrayAsync:()=>_v,awaitAsync:()=>gm,bic:()=>qm,bigint:()=>xv,blob:()=>Sv,boolean:()=>Ev,brand:()=>Gm,bytes:()=>Hm,check:()=>Wm,checkAsync:()=>Km,checkItems:()=>Xm,config:()=>xE,creditCard:()=>Ym,cuid2:()=>Jm,custom:()=>Mv,customAsync:()=>Cv,date:()=>Av,decimal:()=>Zm,deleteGlobalConfig:()=>oE,deleteGlobalMessage:()=>cE,deleteSchemaMessage:()=>lE,deleteSpecificMessage:()=>dE,email:()=>Qm,emoji:()=>eg,empty:()=>tg,endsWith:()=>rg,entriesFromList:()=>pE,enum:()=>hf,enum_:()=>hf,everyItem:()=>ng,excludes:()=>ig,fallback:()=>SE,fallbackAsync:()=>EE,file:()=>Tv,filterItems:()=>sg,findItem:()=>og,finite:()=>ag,flatten:()=>ME,forward:()=>CE,forwardAsync:()=>AE,function:()=>pf,function_:()=>pf,getDefault:()=>fi,getDefaults:()=>uf,getDefaultsAsync:()=>lf,getDotPath:()=>Vm,getFallback:()=>ua,getFallbacks:()=>ff,getFallbacksAsync:()=>df,getGlobalConfig:()=>ca,getGlobalMessage:()=>Um,getSchemaMessage:()=>Fm,getSpecificMessage:()=>zm,hash:()=>cg,hexColor:()=>lg,hexadecimal:()=>ug,imei:()=>fg,includes:()=>dg,instance:()=>Ov,integer:()=>hg,intersect:()=>Iv,intersectAsync:()=>kv,ip:()=>pg,ipv4:()=>mg,ipv6:()=>gg,is:()=>TE,isOfKind:()=>mE,isOfType:()=>gE,isValiError:()=>vE,isoDate:()=>vg,isoDateTime:()=>yg,isoTime:()=>bg,isoTimeSecond:()=>wg,isoTimestamp:()=>_g,isoWeek:()=>xg,keyof:()=>OE,lazy:()=>jv,lazyAsync:()=>Pv,length:()=>Sg,literal:()=>Nv,looseObject:()=>Rv,looseObjectAsync:()=>Dv,looseTuple:()=>$v,looseTupleAsync:()=>Bv,mac:()=>Eg,mac48:()=>Mg,mac64:()=>Cg,map:()=>Lv,mapAsync:()=>Uv,mapItems:()=>Ag,maxBytes:()=>Tg,maxLength:()=>Og,maxSize:()=>Ig,maxValue:()=>kg,mimeType:()=>jg,minBytes:()=>Pg,minLength:()=>Ng,minSize:()=>Rg,minValue:()=>Dg,multipleOf:()=>$g,nan:()=>Fv,never:()=>zv,nonEmpty:()=>Bg,nonNullable:()=>Vv,nonNullableAsync:()=>qv,nonNullish:()=>Gv,nonNullishAsync:()=>Hv,nonOptional:()=>mf,nonOptionalAsync:()=>gf,normalize:()=>Lg,notBytes:()=>Ug,notLength:()=>Fg,notSize:()=>zg,notValue:()=>Vg,null:()=>vf,null_:()=>vf,nullable:()=>Wv,nullableAsync:()=>Kv,nullish:()=>Xv,nullishAsync:()=>Yv,number:()=>Jv,object:()=>Zv,objectAsync:()=>Qv,objectWithRest:()=>e1,objectWithRestAsync:()=>t1,octal:()=>qg,omit:()=>IE,optional:()=>yf,optionalAsync:()=>bf,parse:()=>x1,parseAsync:()=>S1,parser:()=>kE,parserAsync:()=>jE,partial:()=>PE,partialAsync:()=>NE,partialCheck:()=>Hg,partialCheckAsync:()=>Wg,pick:()=>RE,picklist:()=>wf,pipe:()=>DE,pipeAsync:()=>$E,promise:()=>r1,rawCheck:()=>Kg,rawCheckAsync:()=>Xg,rawTransform:()=>Yg,rawTransformAsync:()=>Jg,readonly:()=>Zg,record:()=>n1,recordAsync:()=>i1,reduceItems:()=>Qg,regex:()=>ev,required:()=>BE,requiredAsync:()=>LE,safeInteger:()=>tv,safeParse:()=>E1,safeParseAsync:()=>M1,safeParser:()=>UE,safeParserAsync:()=>FE,set:()=>s1,setAsync:()=>o1,setGlobalConfig:()=>sE,setGlobalMessage:()=>aE,setSchemaMessage:()=>uE,setSpecificMessage:()=>fE,size:()=>rv,someItem:()=>nv,sortItems:()=>iv,startsWith:()=>sv,strictObject:()=>a1,strictObjectAsync:()=>c1,strictTuple:()=>u1,strictTupleAsync:()=>l1,string:()=>f1,symbol:()=>d1,toLowerCase:()=>ov,toMaxValue:()=>av,toMinValue:()=>cv,toUpperCase:()=>uv,transform:()=>lv,transformAsync:()=>fv,trim:()=>dv,trimEnd:()=>hv,trimStart:()=>pv,tuple:()=>h1,tupleAsync:()=>p1,tupleWithRest:()=>m1,tupleWithRestAsync:()=>g1,ulid:()=>mv,undefined:()=>_f,undefined_:()=>_f,union:()=>v1,unionAsync:()=>y1,unknown:()=>b1,unwrap:()=>zE,url:()=>gv,uuid:()=>vv,value:()=>yv,variant:()=>w1,variantAsync:()=>_1,void:()=>Sf,void_:()=>Sf});var $i=iE(mm);function gm(){return{kind:"transformation",type:"await",reference:gm,async:!0,async _run(e){return e.value=await e.value,e}}}var vm=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,ym=/^[a-z][\da-z]*$/u,bm=/^\d+$/u,wm=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_m=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,xm=/^(?:0h|0x)?[\da-f]+$/iu,Sm=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,Em=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,Mm=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,Cm=/^(?:(?:[\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,Am=/^(?:(?:[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,Tm=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,Om=/^\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,Im=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,km=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,jm=/^\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,Pm=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,Nm=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,Rm=/^(?:[\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,Dm=/^(?:[\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,$m=/^(?:0o)?[0-7]+$/iu,Bm=/^[\da-hjkmnp-tv-z]{26}$/iu,Lm=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,Jr;function sE(e){Jr={...Jr,...e}}function ca(e){return{lang:(e==null?void 0:e.lang)??(Jr==null?void 0:Jr.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(Jr==null?void 0:Jr.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(Jr==null?void 0:Jr.abortPipeEarly)}}function oE(){Jr=void 0}var ui;function aE(e,t){ui||(ui=new Map),ui.set(t,e)}function Um(e){return ui==null?void 0:ui.get(e)}function cE(e){ui==null||ui.delete(e)}var li;function uE(e,t){li||(li=new Map),li.set(t,e)}function Fm(e){return li==null?void 0:li.get(e)}function lE(e){li==null||li.delete(e)}var fn;function fE(e,t,r){fn||(fn=new Map),fn.get(e)||fn.set(e,new Map),fn.get(e).set(r,t)}function zm(e,t){var r;return(r=fn==null?void 0:fn.get(e))==null?void 0:r.get(t)}function dE(e,t){var r;(r=fn==null?void 0:fn.get(e))==null||r.delete(t)}function jr(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)??jr(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??zm(e.reference,c.lang)??(u?Fm(c.lang):null)??n.message??Um(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 hE=/\D/gu;function cf(e){const t=e.replace(hE,"");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 ms(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function pE(e,t){const r={};for(const n of e)r[n]=t;return r}function Vm(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 mE(e,t){return t.kind===e}function gE(e,t){return t.type===e}function vE(e){return e instanceof Oc}var Oc=class extends Error{constructor(t){super(t[0].message);p3(this,"issues");this.name="ValiError",this.issues=t}};function qm(e){return{kind:"validation",type:"bic",reference:qm,async:!1,expects:null,requirement:vm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function Gm(e){return{kind:"transformation",type:"brand",reference:Gm,async:!1,name:e,_run(t){return t}}}function Hm(e,t){return{kind:"validation",type:"bytes",reference:Hm,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 Wm(e,t){return{kind:"validation",type:"check",reference:Wm,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 Km(e,t){return{kind:"validation",type:"check",reference:Km,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 Xm(e,t){return{kind:"validation",type:"check_items",reference:Xm,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 yE=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,bE=/[- ]/gu,wE=[/^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 Ym(e){return{kind:"validation",type:"credit_card",reference:Ym,async:!1,expects:null,requirement(t){let r;return yE.test(t)&&(r=t.replace(bE,""))&&wE.some(n=>n.test(r))&&cf(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function Jm(e){return{kind:"validation",type:"cuid2",reference:Jm,async:!1,expects:null,requirement:ym,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function Zm(e){return{kind:"validation",type:"decimal",reference:Zm,async:!1,expects:null,requirement:bm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function Qm(e){return{kind:"validation",type:"email",reference:Qm,expects:null,async:!1,requirement:wm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function eg(e){return{kind:"validation",type:"emoji",reference:eg,async:!1,expects:null,requirement:_m,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function tg(e){return{kind:"validation",type:"empty",reference:tg,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 rg(e,t){return{kind:"validation",type:"ends_with",reference:rg,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 ng(e,t){return{kind:"validation",type:"every_item",reference:ng,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 ig(e,t){const r=jr(e);return{kind:"validation",type:"excludes",reference:ig,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 sg(e){return{kind:"transformation",type:"filter_items",reference:sg,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function og(e){return{kind:"transformation",type:"find_item",reference:og,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function ag(e){return{kind:"validation",type:"finite",reference:ag,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 _E={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 cg(e,t){return{kind:"validation",type:"hash",reference:cg,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${_E[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function ug(e){return{kind:"validation",type:"hexadecimal",reference:ug,async:!1,expects:null,requirement:xm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function lg(e){return{kind:"validation",type:"hex_color",reference:lg,async:!1,expects:null,requirement:Sm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function fg(e){return{kind:"validation",type:"imei",reference:fg,async:!1,expects:null,requirement(t){return Em.test(t)&&cf(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function dg(e,t){const r=jr(e);return{kind:"validation",type:"includes",reference:dg,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 hg(e){return{kind:"validation",type:"integer",reference:hg,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 pg(e){return{kind:"validation",type:"ip",reference:pg,async:!1,expects:null,requirement:Am,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function mg(e){return{kind:"validation",type:"ipv4",reference:mg,async:!1,expects:null,requirement:Mm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function gg(e){return{kind:"validation",type:"ipv6",reference:gg,async:!1,expects:null,requirement:Cm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function vg(e){return{kind:"validation",type:"iso_date",reference:vg,async:!1,expects:null,requirement:Tm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function yg(e){return{kind:"validation",type:"iso_date_time",reference:yg,async:!1,expects:null,requirement:Om,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function bg(e){return{kind:"validation",type:"iso_time",reference:bg,async:!1,expects:null,requirement:Im,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function wg(e){return{kind:"validation",type:"iso_time_second",reference:wg,async:!1,expects:null,requirement:km,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function _g(e){return{kind:"validation",type:"iso_timestamp",reference:_g,async:!1,expects:null,requirement:jm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function xg(e){return{kind:"validation",type:"iso_week",reference:xg,async:!1,expects:null,requirement:Pm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function Sg(e,t){return{kind:"validation",type:"length",reference:Sg,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 Eg(e){return{kind:"validation",type:"mac",reference:Eg,async:!1,expects:null,requirement:Dm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function Mg(e){return{kind:"validation",type:"mac48",reference:Mg,async:!1,expects:null,requirement:Nm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function Cg(e){return{kind:"validation",type:"mac64",reference:Cg,async:!1,expects:null,requirement:Rm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function Ag(e){return{kind:"transformation",type:"map_items",reference:Ag,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function Tg(e,t){return{kind:"validation",type:"max_bytes",reference:Tg,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 Og(e,t){return{kind:"validation",type:"max_length",reference:Og,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 Ig(e,t){return{kind:"validation",type:"max_size",reference:Ig,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 kg(e,t){return{kind:"validation",type:"max_value",reference:kg,async:!1,expects:`<=${e instanceof Date?e.toJSON():jr(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():jr(r.value)}),r}}}function jg(e,t){return{kind:"validation",type:"mime_type",reference:jg,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 Pg(e,t){return{kind:"validation",type:"min_bytes",reference:Pg,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 Ng(e,t){return{kind:"validation",type:"min_length",reference:Ng,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 Rg(e,t){return{kind:"validation",type:"min_size",reference:Rg,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 Dg(e,t){return{kind:"validation",type:"min_value",reference:Dg,async:!1,expects:`>=${e instanceof Date?e.toJSON():jr(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():jr(r.value)}),r}}}function $g(e,t){return{kind:"validation",type:"multiple_of",reference:$g,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 Bg(e){return{kind:"validation",type:"non_empty",reference:Bg,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 Lg(e){return{kind:"transformation",type:"normalize",reference:Lg,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function Ug(e,t){return{kind:"validation",type:"not_bytes",reference:Ug,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 Fg(e,t){return{kind:"validation",type:"not_length",reference:Fg,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 zg(e,t){return{kind:"validation",type:"not_size",reference:zg,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 Vg(e,t){return{kind:"validation",type:"not_value",reference:Vg,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${jr(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():jr(r.value)}),r}}}function qg(e){return{kind:"validation",type:"octal",reference:qg,async:!1,expects:null,requirement:$m,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function Gg(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 Hg(e,t,r){return{kind:"validation",type:"partial_check",reference:Hg,async:!1,expects:null,requirement:t,message:r,_run(n,i){return Gg(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function Wg(e,t,r){return{kind:"validation",type:"partial_check",reference:Wg,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return Gg(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Kg(e){return{kind:"validation",type:"raw_check",reference:Kg,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 Xg(e){return{kind:"validation",type:"raw_check",reference:Xg,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 Yg(e){return{kind:"transformation",type:"raw_transform",reference:Yg,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 Jg(e){return{kind:"transformation",type:"raw_transform",reference:Jg,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 Zg(){return{kind:"transformation",type:"readonly",reference:Zg,async:!1,_run(e){return e}}}function Qg(e,t){return{kind:"transformation",type:"reduce_items",reference:Qg,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function ev(e,t){return{kind:"validation",type:"regex",reference:ev,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 tv(e){return{kind:"validation",type:"safe_integer",reference:tv,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 rv(e,t){return{kind:"validation",type:"size",reference:rv,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size!==this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function nv(e,t){return{kind:"validation",type:"some_item",reference:nv,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 iv(e){return{kind:"transformation",type:"sort_items",reference:iv,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function sv(e,t){return{kind:"validation",type:"starts_with",reference:sv,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 ov(){return{kind:"transformation",type:"to_lower_case",reference:ov,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function av(e){return{kind:"transformation",type:"to_max_value",reference:av,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function cv(e){return{kind:"transformation",type:"to_min_value",reference:cv,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function uv(){return{kind:"transformation",type:"to_upper_case",reference:uv,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function lv(e){return{kind:"transformation",type:"transform",reference:lv,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function fv(e){return{kind:"transformation",type:"transform",reference:fv,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function dv(){return{kind:"transformation",type:"trim",reference:dv,async:!1,_run(e){return e.value=e.value.trim(),e}}}function hv(){return{kind:"transformation",type:"trim_end",reference:hv,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function pv(){return{kind:"transformation",type:"trim_start",reference:pv,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function mv(e){return{kind:"validation",type:"ulid",reference:mv,async:!1,expects:null,requirement:Bm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function gv(e){return{kind:"validation",type:"url",reference:gv,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 vv(e){return{kind:"validation",type:"uuid",reference:vv,async:!1,expects:null,requirement:Lm,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function yv(e,t){return{kind:"validation",type:"value",reference:yv,async:!1,expects:e instanceof Date?e.toJSON():jr(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():jr(r.value)}),r}}}function xE(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function ua(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function SE(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:ua(this,r,n)}:r}}}function EE(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await ua(this,r,n)}:r}}}function ME(e){const t={};for(const r of e)if(r.path){const n=Vm(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 CE(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 AE(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 fi(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function uf(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=uf(e.entries[r]);return t}return"items"in e?e.items.map(uf):fi(e)}async function lf(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await lf(r)]))):"items"in e?Promise.all(e.items.map(lf)):fi(e)}function ff(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=ff(e.entries[r]);return t}return"items"in e?e.items.map(ff):ua(e)}async function df(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await df(r)]))):"items"in e?Promise.all(e.items.map(df)):ua(e)}function TE(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function bv(){return{kind:"schema",type:"any",reference:bv,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function wv(e,t){return{kind:"schema",type:"array",reference:wv,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 _v(e,t){return{kind:"schema",type:"array",reference:_v,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 xv(e){return{kind:"schema",type:"bigint",reference:xv,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function Sv(e){return{kind:"schema",type:"blob",reference:Sv,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function Ev(e){return{kind:"schema",type:"boolean",reference:Ev,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function Mv(e,t){return{kind:"schema",type:"custom",reference:Mv,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 Cv(e,t){return{kind:"schema",type:"custom",reference:Cv,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 Av(e){return{kind:"schema",type:"date",reference:Av,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 hf(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:hf,expects:r.map(jr).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 Tv(e){return{kind:"schema",type:"file",reference:Tv,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function pf(e){return{kind:"schema",type:"function",reference:pf,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function Ov(e,t){return{kind:"schema",type:"instance",reference:Ov,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 Ic(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=Ic(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=Ic(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function Iv(e,t){return{kind:"schema",type:"intersect",reference:Iv,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=Ic(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 kv(e,t){return{kind:"schema",type:"intersect",reference:kv,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=Ic(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 jv(e){return{kind:"schema",type:"lazy",reference:jv,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function Pv(e){return{kind:"schema",type:"lazy",reference:Pv,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function Nv(e,t){return{kind:"schema",type:"literal",reference:Nv,expects:jr(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 Rv(e,t){return{kind:"schema",type:"loose_object",reference:Rv,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)ms(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function Dv(e,t){return{kind:"schema",type:"loose_object",reference:Dv,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)ms(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function $v(e,t){return{kind:"schema",type:"loose_tuple",reference:$v,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 Bv(e,t){return{kind:"schema",type:"loose_tuple",reference:Bv,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 Lv(e,t,r){return{kind:"schema",type:"map",reference:Lv,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 Uv(e,t,r){return{kind:"schema",type:"map",reference:Uv,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 Fv(e){return{kind:"schema",type:"nan",reference:Fv,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function zv(e){return{kind:"schema",type:"never",reference:zv,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function Vv(e,t){return{kind:"schema",type:"non_nullable",reference:Vv,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 qv(e,t){return{kind:"schema",type:"non_nullable",reference:qv,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 Gv(e,t){return{kind:"schema",type:"non_nullish",reference:Gv,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 Hv(e,t){return{kind:"schema",type:"non_nullish",reference:Hv,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 mf(e,t){return{kind:"schema",type:"non_optional",reference:mf,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 gf(e,t){return{kind:"schema",type:"non_optional",reference:gf,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 vf(e){return{kind:"schema",type:"null",reference:vf,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:le(this,"type",t,r),t}}}function Wv(e,...t){const r={kind:"schema",type:"nullable",reference:Wv,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=fi(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 Kv(e,...t){const r={kind:"schema",type:"nullable",reference:Kv,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await fi(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 Xv(e,...t){const r={kind:"schema",type:"nullish",reference:Xv,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=fi(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 Yv(e,...t){const r={kind:"schema",type:"nullish",reference:Yv,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 fi(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 Jv(e){return{kind:"schema",type:"number",reference:Jv,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 Zv(e,t){return{kind:"schema",type:"object",reference:Zv,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 Qv(e,t){return{kind:"schema",type:"object",reference:Qv,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 e1(e,t,r){return{kind:"schema",type:"object_with_rest",reference:e1,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(ms(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 t1(e,t,r){return{kind:"schema",type:"object_with_rest",reference:t1,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])=>ms(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 yf(e,...t){const r={kind:"schema",type:"optional",reference:yf,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=fi(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 bf(e,...t){const r={kind:"schema",type:"optional",reference:bf,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await fi(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 wf(e,t){return{kind:"schema",type:"picklist",reference:wf,expects:e.map(jr).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 r1(e){return{kind:"schema",type:"promise",reference:r1,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function n1(e,t,r){return{kind:"schema",type:"record",reference:n1,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(ms(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 i1(e,t,r){return{kind:"schema",type:"record",reference:i1,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])=>ms(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 s1(e,t){return{kind:"schema",type:"set",reference:s1,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 o1(e,t){return{kind:"schema",type:"set",reference:o1,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 a1(e,t){return{kind:"schema",type:"strict_object",reference:a1,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 c1(e,t){return{kind:"schema",type:"strict_object",reference:c1,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 u1(e,t){return{kind:"schema",type:"strict_tuple",reference:u1,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 l1(e,t){return{kind:"schema",type:"strict_tuple",reference:l1,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 f1(e){return{kind:"schema",type:"string",reference:f1,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function d1(e){return{kind:"schema",type:"symbol",reference:d1,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function h1(e,t){return{kind:"schema",type:"tuple",reference:h1,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 p1(e,t){return{kind:"schema",type:"tuple",reference:p1,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 m1(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:m1,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 g1(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:g1,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 _f(e){return{kind:"schema",type:"undefined",reference:_f,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function kc(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function v1(e,t){return{kind:"schema",type:"union",reference:v1,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:kc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:kc(o)})}return r}}}function y1(e,t){return{kind:"schema",type:"union",reference:y1,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:kc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:kc(o)})}return r}}}function b1(){return{kind:"schema",type:"unknown",reference:b1,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function xf(e,t,r=new Set){for(const n of t)n.type==="variant"?xf(e,n.options,r):r.add(n.entries[e].expects);return r}function w1(e,t,r){let n;return{kind:"schema",type:"variant",reference:w1,expects:"Object",async:!1,key:e,options:t,message:r,_run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!u.entries[this.key]._run({typed:!1,value:a},s).issues){const l=u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...xf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function _1(e,t,r){let n;return{kind:"schema",type:"variant",reference:_1,expects:"Object",async:!0,key:e,options:t,message:r,async _run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!(await u.entries[this.key]._run({typed:!1,value:a},s)).issues){const l=await u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...xf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function Sf(e){return{kind:"schema",type:"void",reference:Sf,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function OE(e,t){return wf(Object.keys(e.entries),t)}function IE(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function x1(e,t,r){const n=e._run({typed:!1,value:t},ca(r));if(n.issues)throw new Oc(n.issues);return n.value}async function S1(e,t,r){const n=await e._run({typed:!1,value:t},ca(r));if(n.issues)throw new Oc(n.issues);return n.value}function kE(e,t){const r=n=>x1(e,n,t);return r.schema=e,r.config=t,r}function jE(e,t){const r=n=>S1(e,n,t);return r.schema=e,r.config=t,r}function PE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?yf(e.entries[n]):e.entries[n];return{...e,entries:r}}function NE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?bf(e.entries[n]):e.entries[n];return{...e,entries:r}}function RE(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function DE(...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 $E(...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 BE(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)?mf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function LE(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)?gf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function E1(e,t,r){const n=e._run({typed:!1,value:t},ca(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function M1(e,t,r){const n=await e._run({typed:!1,value:t},ca(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function UE(e,t){const r=n=>E1(e,n,t);return r.schema=e,r.config=t,r}function FE(e,t){const r=n=>M1(e,n,t);return r.schema=e,r.config=t,r}function zE(e){return e.wrapped}const VE=Symbol.for("@mysten/transaction");function qE(e){return!!e&&typeof e=="object"&&e[VE]===!0}const C1=Symbol.for("@mysten/SuiClient");function GE(e){return typeof e=="object"&&e!==null&&e[C1]===!0}class la{get[C1](){return!0}constructor(t){this.transport=t.transport??new pp({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!oi(Dr(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||!oi(Dr(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||!oi(Dr(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||!oi(Dr(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||!oi(Dr(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||!oa(ai(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||!oa(ai(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(!Jl(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(!Jl(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||!oi(Dr(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||!oa(ai(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(qE(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||!oa(ai(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=ii(t.digest);return si(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=>sm(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 HE=bc(Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:Ul,SuiClient:la,SuiHTTPStatusError:ap,SuiHTTPTransport:pp,SuiHTTPTransportError:Ll,getFullnodeUrl:mp,isSuiClient:GE},Symbol.toStringTag,{value:"Module"}))),WE=bc(ZS),Sr=bc(z3);var Ef=Object.defineProperty,KE=Object.getOwnPropertyDescriptor,XE=Object.getOwnPropertyNames,YE=Object.prototype.hasOwnProperty,JE=(e,t)=>{for(var r in t)Ef(e,r,{get:t[r],enumerable:!0})},ZE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XE(t))!YE.call(e,i)&&i!==r&&Ef(e,i,{get:()=>t[i],enumerable:!(n=KE(t,i))||n.enumerable});return e},QE=e=>ZE(Ef({},"__esModule",{value:!0}),e),A1={};JE(A1,{SUI_ADDRESS_LENGTH:()=>Mf,isValidSuiAddress:()=>O1,isValidSuiObjectId:()=>rM,isValidTransactionDigest:()=>tM,normalizeStructTag:()=>I1,normalizeSuiAddress:()=>Af,normalizeSuiObjectId:()=>iM,parseStructTag:()=>Cf});var Vr=QE(A1),T1=Sr;const eM=32;function tM(e){try{return(0,T1.fromBase58)(e).length===eM}catch{return!1}}const Mf=32;function O1(e){return sM(e)&&oM(e)===Mf}function rM(e){return O1(e)}function nM(e){return e.includes("::")?Cf(e):e}function Cf(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,T1.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>nM(o.trim())):[];return{address:Af(t),module:r,name:i,typeParams:s}}function I1(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Cf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:I1(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Af(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Mf*2,"0")}`}function iM(e,t=!1){return Af(e,t)}function sM(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function oM(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Tf=Object.defineProperty,aM=Object.getOwnPropertyDescriptor,cM=Object.getOwnPropertyNames,uM=Object.prototype.hasOwnProperty,lM=(e,t)=>{for(var r in t)Tf(e,r,{get:t[r],enumerable:!0})},fM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cM(t))!uM.call(e,i)&&i!==r&&Tf(e,i,{get:()=>t[i],enumerable:!(n=aM(t,i))||n.enumerable});return e},dM=e=>fM(Tf({},"__esModule",{value:!0}),e),k1={};lM(k1,{TypeTagSerializer:()=>gs});var j1=dM(k1),hM=Sr,pM=Vr;const mM=/^vector<(.+)>$/,gM=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class gs{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(mM);if(n)return{vector:gs.parseFromStr(n[1],r)};const i=t.match(gM);if(i)return{struct:{address:r?(0,pM.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:gs.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,hM.splitGenericParameters)(t).map(n=>gs.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<${gs.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(gs.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Of=Object.defineProperty,vM=Object.getOwnPropertyDescriptor,yM=Object.getOwnPropertyNames,bM=Object.prototype.hasOwnProperty,wM=(e,t)=>{for(var r in t)Of(e,r,{get:t[r],enumerable:!0})},_M=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yM(t))!bM.call(e,i)&&i!==r&&Of(e,i,{get:()=>t[i],enumerable:!(n=vM(t,i))||n.enumerable});return e},xM=e=>_M(Of({},"__esModule",{value:!0}),e),P1={};wM(P1,{Address:()=>Rn,AppId:()=>J1,Argument:()=>Dn,CallArg:()=>L1,Command:()=>F1,CompressedSignature:()=>ey,GasData:()=>H1,Intent:()=>Z1,IntentMessage:()=>Q1,IntentScope:()=>X1,IntentVersion:()=>Y1,MultiSig:()=>MM,MultiSigPkMap:()=>ry,MultiSigPublicKey:()=>ny,ObjectArg:()=>B1,ObjectDigest:()=>D1,PasskeyAuthenticator:()=>AM,ProgrammableMoveCall:()=>U1,ProgrammableTransaction:()=>z1,PublicKey:()=>ty,SenderSignedData:()=>CM,SenderSignedTransaction:()=>sy,SharedObjectRef:()=>$1,StructTag:()=>G1,SuiObjectRef:()=>jc,TransactionData:()=>K1,TransactionDataV1:()=>W1,TransactionExpiration:()=>q1,TransactionKind:()=>V1,TypeTag:()=>kf,base64String:()=>iy});var N1=xM(P1),de=Sr,fa=Vr,R1=j1;function SM(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function EM(e){return de.bcs.enum("Option",{None:null,Some:e})}const Rn=de.bcs.bytes(fa.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,fa.isValidSuiAddress)((0,fa.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,fa.normalizeSuiAddress)(e)):e,output:e=>(0,fa.normalizeSuiAddress)((0,de.toHex)(e))}),D1=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")}}),jc=de.bcs.struct("SuiObjectRef",{objectId:Rn,version:de.bcs.u64(),digest:D1}),$1=de.bcs.struct("SharedObjectRef",{objectId:Rn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),B1=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:jc,SharedObject:$1,Receiving:jc}),L1=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:B1}),If=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>If),struct:de.bcs.lazy(()=>G1),u16:null,u32:null,u256:null}),kf=If.transform({input:e=>typeof e=="string"?R1.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>R1.TypeTagSerializer.tagToString(e)}),Dn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),U1=de.bcs.struct("ProgrammableMoveCall",{package:Rn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(kf),arguments:de.bcs.vector(Dn)}),F1=de.bcs.enum("Command",{MoveCall:U1,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Dn),address:Dn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Dn,amounts:de.bcs.vector(Dn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Dn,sources:de.bcs.vector(Dn)}),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(Rn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:EM(kf).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Dn)}),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(Rn),package:Rn,ticket:Dn})}),z1=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(L1),commands:de.bcs.vector(F1)}),V1=de.bcs.enum("TransactionKind",{ProgrammableTransaction:z1,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),q1=de.bcs.enum("TransactionExpiration",{None:null,Epoch:SM()}),G1=de.bcs.struct("StructTag",{address:Rn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(If)}),H1=de.bcs.struct("GasData",{payment:de.bcs.vector(jc),owner:Rn,price:de.bcs.u64(),budget:de.bcs.u64()}),W1=de.bcs.struct("TransactionDataV1",{kind:V1,sender:Rn,gasData:H1,expiration:q1}),K1=de.bcs.enum("TransactionData",{V1:W1}),X1=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Y1=de.bcs.enum("IntentVersion",{V0:null}),J1=de.bcs.enum("AppId",{Sui:null}),Z1=de.bcs.struct("Intent",{scope:X1,version:Y1,appId:J1});function Q1(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:Z1,value:e})}const ey=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())}),ty=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())}),ry=de.bcs.struct("MultiSigPkMap",{pubKey:ty,weight:de.bcs.u8()}),ny=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector(ry),threshold:de.bcs.u16()}),MM=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(ey),bitmap:de.bcs.u16(),multisig_pk:ny}),iy=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))}),sy=de.bcs.struct("SenderSignedTransaction",{intentMessage:Q1(K1),txSignatures:de.bcs.vector(iy)}),CM=de.bcs.vector(sy,{name:"SenderSignedData"}),AM=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var jf=Object.defineProperty,TM=Object.getOwnPropertyDescriptor,OM=Object.getOwnPropertyNames,IM=Object.prototype.hasOwnProperty,kM=(e,t)=>{for(var r in t)jf(e,r,{get:t[r],enumerable:!0})},jM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OM(t))!IM.call(e,i)&&i!==r&&jf(e,i,{get:()=>t[i],enumerable:!(n=TM(t,i))||n.enumerable});return e},PM=e=>jM(jf({},"__esModule",{value:!0}),e),oy={};kM(oy,{TransactionEffects:()=>WM});var NM=PM(oy),ge=Sr,Nt=N1;const RM=ge.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ge.bcs.struct("UnableToFetchPackage",{packageId:Nt.Address}),NotAPackage:ge.bcs.struct("NotAPackage",{objectId:Nt.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:Nt.Address,ticketId:Nt.Address})}),DM=ge.bcs.struct("ModuleId",{address:Nt.Address,name:ge.bcs.string()}),ay=ge.bcs.struct("MoveLocation",{module:DM,function:ge.bcs.u16(),instruction:ge.bcs.u16(),functionName:ge.bcs.option(ge.bcs.string())}),$M=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}),BM=ge.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),LM=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:Nt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ge.bcs.option(ay),MoveAbort:ge.bcs.tuple([ay,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:$M}),TypeArgumentError:ge.bcs.struct("TypeArgumentError",{argumentIdx:ge.bcs.u16(),kind:BM}),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:RM}),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(Nt.Address)}),AddressDeniedForCoin:ge.bcs.struct("AddressDeniedForCoin",{address:Nt.Address,coinType:ge.bcs.string()}),CoinTypeGlobalPause:ge.bcs.struct("CoinTypeGlobalPause",{coinType:ge.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),cy=ge.bcs.enum("ExecutionStatus",{Success:null,Failed:ge.bcs.struct("ExecutionFailed",{error:LM,command:ge.bcs.option(ge.bcs.u64())})}),uy=ge.bcs.struct("GasCostSummary",{computationCost:ge.bcs.u64(),storageCost:ge.bcs.u64(),storageRebate:ge.bcs.u64(),nonRefundableStorageFee:ge.bcs.u64()}),eo=ge.bcs.enum("Owner",{AddressOwner:Nt.Address,ObjectOwner:Nt.Address,Shared:ge.bcs.struct("Shared",{initialSharedVersion:ge.bcs.u64()}),Immutable:null}),UM=ge.bcs.struct("TransactionEffectsV1",{status:cy,executedEpoch:ge.bcs.u64(),gasUsed:uy,modifiedAtVersions:ge.bcs.vector(ge.bcs.tuple([Nt.Address,ge.bcs.u64()])),sharedObjects:ge.bcs.vector(Nt.SuiObjectRef),transactionDigest:Nt.ObjectDigest,created:ge.bcs.vector(ge.bcs.tuple([Nt.SuiObjectRef,eo])),mutated:ge.bcs.vector(ge.bcs.tuple([Nt.SuiObjectRef,eo])),unwrapped:ge.bcs.vector(ge.bcs.tuple([Nt.SuiObjectRef,eo])),deleted:ge.bcs.vector(Nt.SuiObjectRef),unwrappedThenDeleted:ge.bcs.vector(Nt.SuiObjectRef),wrapped:ge.bcs.vector(Nt.SuiObjectRef),gasObject:ge.bcs.tuple([Nt.SuiObjectRef,eo]),eventsDigest:ge.bcs.option(Nt.ObjectDigest),dependencies:ge.bcs.vector(Nt.ObjectDigest)}),Pf=ge.bcs.tuple([ge.bcs.u64(),Nt.ObjectDigest]),FM=ge.bcs.enum("ObjectIn",{NotExist:null,Exist:ge.bcs.tuple([Pf,eo])}),zM=ge.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ge.bcs.tuple([Nt.ObjectDigest,eo]),PackageWrite:Pf}),VM=ge.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),qM=ge.bcs.struct("EffectsObjectChange",{inputState:FM,outputState:zM,idOperation:VM}),GM=ge.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:Pf,MutateDeleted:ge.bcs.u64(),ReadDeleted:ge.bcs.u64(),Cancelled:ge.bcs.u64(),PerEpochConfig:null}),HM=ge.bcs.struct("TransactionEffectsV2",{status:cy,executedEpoch:ge.bcs.u64(),gasUsed:uy,transactionDigest:Nt.ObjectDigest,gasObjectIndex:ge.bcs.option(ge.bcs.u32()),eventsDigest:ge.bcs.option(Nt.ObjectDigest),dependencies:ge.bcs.vector(Nt.ObjectDigest),lamportVersion:ge.bcs.u64(),changedObjects:ge.bcs.vector(ge.bcs.tuple([Nt.Address,qM])),unchangedSharedObjects:ge.bcs.vector(ge.bcs.tuple([Nt.Address,GM])),auxDataDigest:ge.bcs.option(Nt.ObjectDigest)}),WM=ge.bcs.enum("TransactionEffects",{V1:UM,V2:HM});var Nf=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,XM=Object.getOwnPropertyNames,YM=Object.prototype.hasOwnProperty,JM=(e,t)=>{for(var r in t)Nf(e,r,{get:t[r],enumerable:!0})},ZM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XM(t))!YM.call(e,i)&&i!==r&&Nf(e,i,{get:()=>t[i],enumerable:!(n=KM(t,i))||n.enumerable});return e},QM=e=>ZM(Nf({},"__esModule",{value:!0}),e),ly={};JM(ly,{BcsType:()=>rC.BcsType,TypeTagSerializer:()=>tC.TypeTagSerializer,bcs:()=>nC});var di=QM(ly),$n=Sr,Rt=N1,eC=NM,tC=j1,rC=Sr;const nC={...$n.bcs,U8:$n.bcs.u8(),U16:$n.bcs.u16(),U32:$n.bcs.u32(),U64:$n.bcs.u64(),U128:$n.bcs.u128(),U256:$n.bcs.u256(),ULEB128:$n.bcs.uleb128(),Bool:$n.bcs.bool(),String:$n.bcs.string(),Address:Rt.Address,AppId:Rt.AppId,Argument:Rt.Argument,CallArg:Rt.CallArg,CompressedSignature:Rt.CompressedSignature,GasData:Rt.GasData,Intent:Rt.Intent,IntentMessage:Rt.IntentMessage,IntentScope:Rt.IntentScope,IntentVersion:Rt.IntentVersion,MultiSig:Rt.MultiSig,MultiSigPkMap:Rt.MultiSigPkMap,MultiSigPublicKey:Rt.MultiSigPublicKey,ObjectArg:Rt.ObjectArg,ObjectDigest:Rt.ObjectDigest,ProgrammableMoveCall:Rt.ProgrammableMoveCall,ProgrammableTransaction:Rt.ProgrammableTransaction,PublicKey:Rt.PublicKey,SenderSignedData:Rt.SenderSignedData,SenderSignedTransaction:Rt.SenderSignedTransaction,SharedObjectRef:Rt.SharedObjectRef,StructTag:Rt.StructTag,SuiObjectRef:Rt.SuiObjectRef,Command:Rt.Command,TransactionData:Rt.TransactionData,TransactionDataV1:Rt.TransactionDataV1,TransactionExpiration:Rt.TransactionExpiration,TransactionKind:Rt.TransactionKind,TypeTag:Rt.TypeTag,TransactionEffects:eC.TransactionEffects,PasskeyAuthenticator:Rt.PasskeyAuthenticator};var Rf=Object.defineProperty,iC=Object.getOwnPropertyDescriptor,sC=Object.getOwnPropertyNames,oC=Object.prototype.hasOwnProperty,aC=(e,t)=>{for(var r in t)Rf(e,r,{get:t[r],enumerable:!0})},cC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sC(t))!oC.call(e,i)&&i!==r&&Rf(e,i,{get:()=>t[i],enumerable:!(n=iC(t,i))||n.enumerable});return e},uC=e=>cC(Rf({},"__esModule",{value:!0}),e),fy={};aC(fy,{formatAddress:()=>fC,formatDigest:()=>dC});var lC=uC(fy);const dy="…";function fC(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${dy}${e.slice(-4)}`}function dC(e){return`${e.slice(0,10)}${dy}`}var Df=Object.defineProperty,hC=Object.getOwnPropertyDescriptor,pC=Object.getOwnPropertyNames,mC=Object.prototype.hasOwnProperty,gC=(e,t)=>{for(var r in t)Df(e,r,{get:t[r],enumerable:!0})},vC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pC(t))!mC.call(e,i)&&i!==r&&Df(e,i,{get:()=>t[i],enumerable:!(n=hC(t,i))||n.enumerable});return e},yC=e=>vC(Df({},"__esModule",{value:!0}),e),hy={};gC(hy,{isValidSuiNSName:()=>wC,normalizeSuiNSName:()=>_C});var py=yC(hy);const my=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,gy=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,bC=235;function wC(e){return e.length>bC?!1:e.includes("@")?my.test(e):gy.test(e)}function _C(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!my.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!gy.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 $f=Object.defineProperty,xC=Object.getOwnPropertyDescriptor,SC=Object.getOwnPropertyNames,EC=Object.prototype.hasOwnProperty,MC=(e,t)=>{for(var r in t)$f(e,r,{get:t[r],enumerable:!0})},CC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of SC(t))!EC.call(e,i)&&i!==r&&$f(e,i,{get:()=>t[i],enumerable:!(n=xC(t,i))||n.enumerable});return e},AC=e=>CC($f({},"__esModule",{value:!0}),e),vy={};MC(vy,{MIST_PER_SUI:()=>IC,MOVE_STDLIB_ADDRESS:()=>kC,SUI_CLOCK_OBJECT_ID:()=>PC,SUI_DECIMALS:()=>OC,SUI_FRAMEWORK_ADDRESS:()=>by,SUI_SYSTEM_ADDRESS:()=>jC,SUI_SYSTEM_MODULE_NAME:()=>NC,SUI_SYSTEM_STATE_OBJECT_ID:()=>DC,SUI_TYPE_ARG:()=>RC});var TC=AC(vy),yy=Vr;const OC=9,IC=BigInt(1e9),kC="0x1",by="0x2",jC="0x3",PC=(0,yy.normalizeSuiObjectId)("0x6"),NC="sui_system",RC=`${by}::sui::SUI`,DC=(0,yy.normalizeSuiObjectId)("0x5");var Bf=Object.defineProperty,$C=Object.getOwnPropertyDescriptor,BC=Object.getOwnPropertyNames,LC=Object.prototype.hasOwnProperty,UC=(e,t)=>{for(var r in t)Bf(e,r,{get:t[r],enumerable:!0})},FC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of BC(t))!LC.call(e,i)&&i!==r&&Bf(e,i,{get:()=>t[i],enumerable:!(n=$C(t,i))||n.enumerable});return e},zC=e=>FC(Bf({},"__esModule",{value:!0}),e),wy={};UC(wy,{isValidNamedPackage:()=>Sy,isValidNamedType:()=>WC});var _y=zC(wy),VC=py;const qC=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,GC=/^\d+$/,HC=64,xy="/",Sy=e=>{const t=e.split(xy);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!GC.test(i)||!(0,VC.isValidSuiNSName)(r)?!1:qC.test(n)&&n.length<HC},WC=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(xy)&&!Sy(r))return!1;return!0},Ey=bc(YS);var Lf=Object.defineProperty,KC=Object.getOwnPropertyDescriptor,XC=Object.getOwnPropertyNames,YC=Object.prototype.hasOwnProperty,JC=(e,t)=>{for(var r in t)Lf(e,r,{get:t[r],enumerable:!0})},ZC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XC(t))!YC.call(e,i)&&i!==r&&Lf(e,i,{get:()=>t[i],enumerable:!(n=KC(t,i))||n.enumerable});return e},QC=e=>ZC(Lf({},"__esModule",{value:!0}),e),My={};JC(My,{deriveDynamicFieldID:()=>n5});var e5=QC(My),t5=Sr,r5=Ey,Uf=di;function n5(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=r5.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,t5.toHex)(o.digest().slice(0,32))}`}var Ff=Object.defineProperty,i5=Object.getOwnPropertyDescriptor,s5=Object.getOwnPropertyNames,o5=Object.prototype.hasOwnProperty,a5=(e,t)=>{for(var r in t)Ff(e,r,{get:t[r],enumerable:!0})},c5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of s5(t))!o5.call(e,i)&&i!==r&&Ff(e,i,{get:()=>t[i],enumerable:!(n=i5(t,i))||n.enumerable});return e},u5=e=>c5(Ff({},"__esModule",{value:!0}),e),Cy={};a5(Cy,{MIST_PER_SUI:()=>hi.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>hi.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Bi.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>hi.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>hi.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>hi.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>hi.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>hi.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>hi.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>hi.SUI_TYPE_ARG,deriveDynamicFieldID:()=>l5.deriveDynamicFieldID,formatAddress:()=>Ty.formatAddress,formatDigest:()=>Ty.formatDigest,fromB64:()=>Bn.fromB64,fromBase58:()=>Bn.fromBase58,fromBase64:()=>Bn.fromBase64,fromHEX:()=>Bn.fromHEX,fromHex:()=>Bn.fromHex,isValidNamedPackage:()=>Iy.isValidNamedPackage,isValidNamedType:()=>Iy.isValidNamedType,isValidSuiAddress:()=>Bi.isValidSuiAddress,isValidSuiNSName:()=>Oy.isValidSuiNSName,isValidSuiObjectId:()=>Bi.isValidSuiObjectId,isValidTransactionDigest:()=>Bi.isValidTransactionDigest,normalizeStructTag:()=>Bi.normalizeStructTag,normalizeSuiAddress:()=>Bi.normalizeSuiAddress,normalizeSuiNSName:()=>Oy.normalizeSuiNSName,normalizeSuiObjectId:()=>Bi.normalizeSuiObjectId,parseStructTag:()=>Bi.parseStructTag,toB64:()=>Bn.toB64,toBase58:()=>Bn.toBase58,toBase64:()=>Bn.toBase64,toHEX:()=>Bn.toHEX,toHex:()=>Bn.toHex});var Ay=u5(Cy),Ty=lC,Bi=Vr,Bn=Sr,Oy=py,hi=TC,Iy=_y,l5=e5,zf=Object.defineProperty,f5=Object.getOwnPropertyDescriptor,d5=Object.getOwnPropertyNames,h5=Object.prototype.hasOwnProperty,p5=(e,t)=>{for(var r in t)zf(e,r,{get:t[r],enumerable:!0})},m5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of d5(t))!h5.call(e,i)&&i!==r&&zf(e,i,{get:()=>t[i],enumerable:!(n=f5(t,i))||n.enumerable});return e},g5=e=>m5(zf({},"__esModule",{value:!0}),e),ky={};p5(ky,{getPureBcsSchema:()=>Vf,isTxContext:()=>M5,normalizedTypeToMoveTypeSignature:()=>C5,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>Ny});var jy=g5(ky),Jt=di,Py=Ay,da=Vr;const v5="object",y5="ID",b5="ascii",w5="String",_5="string",x5="String",S5="option",E5="Option";function M5(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,da.normalizeSuiAddress)(t.package)===(0,da.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function Vf(e){if(typeof e=="string")switch(e){case"address":return Jt.bcs.Address;case"bool":return Jt.bcs.Bool;case"u8":return Jt.bcs.U8;case"u16":return Jt.bcs.U16;case"u32":return Jt.bcs.U32;case"u64":return Jt.bcs.U64;case"u128":return Jt.bcs.U128;case"u256":return Jt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Jt.bcs.vector(Jt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=Vf(e.vector);return t?Jt.bcs.vector(t):null}if("datatype"in e){const t=(0,da.normalizeSuiAddress)(e.datatype.package);if(t===(0,da.normalizeSuiAddress)(Py.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===b5&&e.datatype.type===w5||e.datatype.module===_5&&e.datatype.type===x5)return Jt.bcs.String;if(e.datatype.module===S5&&e.datatype.type===E5){const r=Vf(e.datatype.typeParameters[0]);return r?Jt.bcs.vector(r):null}}if(t===(0,da.normalizeSuiAddress)(Py.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===v5&&e.datatype.type===y5)return Jt.bcs.Address}return null}function C5(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:ha(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:ha(e.MutableReference)}:{ref:null,body:ha(e)}}function ha(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:ha(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(ha)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function Ny(e){if(typeof e=="string")switch(e){case"address":return Jt.bcs.Address;case"bool":return Jt.bcs.Bool;case"u8":return Jt.bcs.U8;case"u16":return Jt.bcs.U16;case"u32":return Jt.bcs.U32;case"u64":return Jt.bcs.U64;case"u128":return Jt.bcs.U128;case"u256":return Jt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Jt.bcs.vector(Ny(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var qf=Object.defineProperty,A5=Object.getOwnPropertyDescriptor,T5=Object.getOwnPropertyNames,O5=Object.prototype.hasOwnProperty,I5=(e,t)=>{for(var r in t)qf(e,r,{get:t[r],enumerable:!0})},k5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of T5(t))!O5.call(e,i)&&i!==r&&qf(e,i,{get:()=>t[i],enumerable:!(n=A5(t,i))||n.enumerable});return e},j5=e=>k5(qf({},"__esModule",{value:!0}),e),Ry={};I5(Ry,{Inputs:()=>R5});var Pc=j5(Ry),P5=Sr,Gf=Vr;function N5(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,P5.toBase64)(e):e.toBase64()}}}const R5={Pure:N5,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,Gf.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,Gf.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,Gf.normalizeSuiAddress)(e)}}}}};var Hf=Object.defineProperty,D5=Object.getOwnPropertyDescriptor,$5=Object.getOwnPropertyNames,B5=Object.prototype.hasOwnProperty,L5=(e,t)=>{for(var r in t)Hf(e,r,{get:t[r],enumerable:!0})},U5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $5(t))!B5.call(e,i)&&i!==r&&Hf(e,i,{get:()=>t[i],enumerable:!(n=D5(t,i))||n.enumerable});return e},F5=e=>U5(Hf({},"__esModule",{value:!0}),e),Dy={};L5(Dy,{$Intent:()=>Uy,Argument:()=>Zr,BCSBytes:()=>ma,Command:()=>Fy,GasData:()=>By,JsonU64:()=>Li,NormalizedCallArg:()=>G5,ObjectArg:()=>Wf,ObjectID:()=>vs,ObjectRef:()=>Nc,OpenMoveTypeSignature:()=>Ly,OpenMoveTypeSignatureBody:()=>Rc,StructTag:()=>z5,SuiAddress:()=>pa,TransactionData:()=>H5,TransactionExpiration:()=>zy,safeEnum:()=>ro});var to=F5(Dy),ae=$i,$y=Vr;function ro(e){const t=Object.entries(e).map(([r,n])=>(0,ae.object)({[r]:n}));return(0,ae.pipe)((0,ae.union)(t),(0,ae.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const pa=(0,ae.pipe)((0,ae.string)(),(0,ae.transform)(e=>(0,$y.normalizeSuiAddress)(e)),(0,ae.check)($y.isValidSuiAddress)),vs=pa,ma=(0,ae.string)(),Li=(0,ae.pipe)((0,ae.union)([(0,ae.string)(),(0,ae.pipe)((0,ae.number)(),(0,ae.integer)())]),(0,ae.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Nc=(0,ae.object)({objectId:pa,version:Li,digest:(0,ae.string)()}),Zr=(0,ae.pipe)((0,ae.union)([(0,ae.object)({GasCoin:(0,ae.literal)(!0)}),(0,ae.object)({Input:(0,ae.pipe)((0,ae.number)(),(0,ae.integer)()),type:(0,ae.optional)((0,ae.literal)("pure"))}),(0,ae.object)({Input:(0,ae.pipe)((0,ae.number)(),(0,ae.integer)()),type:(0,ae.optional)((0,ae.literal)("object"))}),(0,ae.object)({Result:(0,ae.pipe)((0,ae.number)(),(0,ae.integer)())}),(0,ae.object)({NestedResult:(0,ae.tuple)([(0,ae.pipe)((0,ae.number)(),(0,ae.integer)()),(0,ae.pipe)((0,ae.number)(),(0,ae.integer)())])})]),(0,ae.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),By=(0,ae.object)({budget:(0,ae.nullable)(Li),price:(0,ae.nullable)(Li),owner:(0,ae.nullable)(pa),payment:(0,ae.nullable)((0,ae.array)(Nc))}),z5=(0,ae.object)({address:(0,ae.string)(),module:(0,ae.string)(),name:(0,ae.string)(),typeParams:(0,ae.array)((0,ae.string)())}),Rc=(0,ae.union)([(0,ae.literal)("address"),(0,ae.literal)("bool"),(0,ae.literal)("u8"),(0,ae.literal)("u16"),(0,ae.literal)("u32"),(0,ae.literal)("u64"),(0,ae.literal)("u128"),(0,ae.literal)("u256"),(0,ae.object)({vector:(0,ae.lazy)(()=>Rc)}),(0,ae.object)({datatype:(0,ae.object)({package:(0,ae.string)(),module:(0,ae.string)(),type:(0,ae.string)(),typeParameters:(0,ae.array)((0,ae.lazy)(()=>Rc))})}),(0,ae.object)({typeParameter:(0,ae.pipe)((0,ae.number)(),(0,ae.integer)())})]),Ly=(0,ae.object)({ref:(0,ae.nullable)((0,ae.union)([(0,ae.literal)("&"),(0,ae.literal)("&mut")])),body:Rc}),V5=(0,ae.object)({package:vs,module:(0,ae.string)(),function:(0,ae.string)(),typeArguments:(0,ae.array)((0,ae.string)()),arguments:(0,ae.array)(Zr),_argumentTypes:(0,ae.optional)((0,ae.nullable)((0,ae.array)(Ly)))}),Uy=(0,ae.object)({name:(0,ae.string)(),inputs:(0,ae.record)((0,ae.string)(),(0,ae.union)([Zr,(0,ae.array)(Zr)])),data:(0,ae.record)((0,ae.string)(),(0,ae.unknown)())}),Fy=ro({MoveCall:V5,TransferObjects:(0,ae.object)({objects:(0,ae.array)(Zr),address:Zr}),SplitCoins:(0,ae.object)({coin:Zr,amounts:(0,ae.array)(Zr)}),MergeCoins:(0,ae.object)({destination:Zr,sources:(0,ae.array)(Zr)}),Publish:(0,ae.object)({modules:(0,ae.array)(ma),dependencies:(0,ae.array)(vs)}),MakeMoveVec:(0,ae.object)({type:(0,ae.nullable)((0,ae.string)()),elements:(0,ae.array)(Zr)}),Upgrade:(0,ae.object)({modules:(0,ae.array)(ma),dependencies:(0,ae.array)(vs),package:vs,ticket:Zr}),$Intent:Uy}),Wf=ro({ImmOrOwnedObject:Nc,SharedObject:(0,ae.object)({objectId:vs,initialSharedVersion:Li,mutable:(0,ae.boolean)()}),Receiving:Nc}),q5=ro({Object:Wf,Pure:(0,ae.object)({bytes:ma}),UnresolvedPure:(0,ae.object)({value:(0,ae.unknown)()}),UnresolvedObject:(0,ae.object)({objectId:vs,version:(0,ae.optional)((0,ae.nullable)(Li)),digest:(0,ae.optional)((0,ae.nullable)((0,ae.string)())),initialSharedVersion:(0,ae.optional)((0,ae.nullable)(Li))})}),G5=ro({Object:Wf,Pure:(0,ae.object)({bytes:ma})}),zy=ro({None:(0,ae.literal)(!0),Epoch:Li}),H5=(0,ae.object)({version:(0,ae.literal)(2),sender:(0,ae.nullish)(pa),expiration:(0,ae.nullish)(zy),gasData:By,inputs:(0,ae.array)(q5),commands:(0,ae.array)(Fy)});var Kf=Object.defineProperty,W5=Object.getOwnPropertyDescriptor,K5=Object.getOwnPropertyNames,X5=Object.prototype.hasOwnProperty,Y5=(e,t)=>{for(var r in t)Kf(e,r,{get:t[r],enumerable:!0})},J5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of K5(t))!X5.call(e,i)&&i!==r&&Kf(e,i,{get:()=>t[i],enumerable:!(n=W5(t,i))||n.enumerable});return e},Z5=e=>J5(Kf({},"__esModule",{value:!0}),e),Vy={};Y5(Vy,{Commands:()=>Q5,UpgradePolicy:()=>Hy});var Xf=Z5(Vy),qy=Sr,Ln=$i,Gy=Vr,Un=to,Hy=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(Hy||{});const Q5={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,Ln.parse)(Un.Argument,r)),address:(0,Ln.parse)(Un.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Ln.parse)(Un.Argument,e),amounts:t.map(r=>(0,Ln.parse)(Un.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Ln.parse)(Un.Argument,e),sources:t.map(r=>(0,Ln.parse)(Un.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,qy.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,Gy.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,qy.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,Gy.normalizeSuiObjectId)(i)),package:r,ticket:(0,Ln.parse)(Un.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Ln.parse)(Un.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,Ln.parse)(Un.Argument,s)):(0,Ln.parse)(Un.Argument,i)])),data:r}}}};var Yf=Object.defineProperty,eA=Object.getOwnPropertyDescriptor,tA=Object.getOwnPropertyNames,rA=Object.prototype.hasOwnProperty,nA=(e,t)=>{for(var r in t)Yf(e,r,{get:t[r],enumerable:!0})},iA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tA(t))!rA.call(e,i)&&i!==r&&Yf(e,i,{get:()=>t[i],enumerable:!(n=eA(t,i))||n.enumerable});return e},sA=e=>iA(Yf({},"__esModule",{value:!0}),e),Wy={};nA(Wy,{NormalizedCallArg:()=>Jf,ObjectRef:()=>Dc,SerializedTransactionDataV1:()=>bA,StructTag:()=>Zy,TransactionArgument:()=>Fn,TypeTag:()=>$c,serializeV1TransactionData:()=>wA,transactionDataFromV1:()=>_A});var Ky=sA(Wy),no=Sr,re=$i,Xy=di,ga=to;const Dc=(0,re.object)({digest:(0,re.string)(),objectId:(0,re.string)(),version:(0,re.union)([(0,re.pipe)((0,re.number)(),(0,re.integer)()),(0,re.string)(),(0,re.bigint)()])}),oA=(0,ga.safeEnum)({ImmOrOwned:Dc,Shared:(0,re.object)({objectId:ga.ObjectID,initialSharedVersion:ga.JsonU64,mutable:(0,re.boolean)()}),Receiving:Dc}),Jf=(0,ga.safeEnum)({Object:oA,Pure:(0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))}),Yy=(0,re.union)([(0,re.object)({kind:(0,re.literal)("Input"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),value:(0,re.unknown)(),type:(0,re.optional)((0,re.literal)("object"))}),(0,re.object)({kind:(0,re.literal)("Input"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),value:(0,re.unknown)(),type:(0,re.literal)("pure")})]),aA=(0,re.union)([(0,re.object)({Epoch:(0,re.pipe)((0,re.number)(),(0,re.integer)())}),(0,re.object)({None:(0,re.nullable)((0,re.literal)(!0))})]),Jy=(0,re.pipe)((0,re.union)([(0,re.number)(),(0,re.string)(),(0,re.bigint)()]),(0,re.check)(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),$c=(0,re.union)([(0,re.object)({bool:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u8:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u64:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u128:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({address:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({signer:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({vector:(0,re.lazy)(()=>$c)}),(0,re.object)({struct:(0,re.lazy)(()=>Zy)}),(0,re.object)({u16:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u32:(0,re.nullable)((0,re.literal)(!0))}),(0,re.object)({u256:(0,re.nullable)((0,re.literal)(!0))})]),Zy=(0,re.object)({address:(0,re.string)(),module:(0,re.string)(),name:(0,re.string)(),typeParams:(0,re.array)($c)}),cA=(0,re.object)({budget:(0,re.optional)(Jy),price:(0,re.optional)(Jy),payment:(0,re.optional)((0,re.array)(Dc)),owner:(0,re.optional)((0,re.string)())}),uA=[Yy,(0,re.object)({kind:(0,re.literal)("GasCoin")}),(0,re.object)({kind:(0,re.literal)("Result"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)())}),(0,re.object)({kind:(0,re.literal)("NestedResult"),index:(0,re.pipe)((0,re.number)(),(0,re.integer)()),resultIndex:(0,re.pipe)((0,re.number)(),(0,re.integer)())})],Fn=(0,re.union)([...uA]),lA=(0,re.object)({kind:(0,re.literal)("MoveCall"),target:(0,re.pipe)((0,re.string)(),(0,re.check)(e=>e.split("::").length===3)),typeArguments:(0,re.array)((0,re.string)()),arguments:(0,re.array)(Fn)}),fA=(0,re.object)({kind:(0,re.literal)("TransferObjects"),objects:(0,re.array)(Fn),address:Fn}),dA=(0,re.object)({kind:(0,re.literal)("SplitCoins"),coin:Fn,amounts:(0,re.array)(Fn)}),hA=(0,re.object)({kind:(0,re.literal)("MergeCoins"),destination:Fn,sources:(0,re.array)(Fn)}),pA=(0,re.object)({kind:(0,re.literal)("MakeMoveVec"),type:(0,re.union)([(0,re.object)({Some:$c}),(0,re.object)({None:(0,re.nullable)((0,re.literal)(!0))})]),objects:(0,re.array)(Fn)}),mA=(0,re.object)({kind:(0,re.literal)("Publish"),modules:(0,re.array)((0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))),dependencies:(0,re.array)((0,re.string)())}),gA=(0,re.object)({kind:(0,re.literal)("Upgrade"),modules:(0,re.array)((0,re.array)((0,re.pipe)((0,re.number)(),(0,re.integer)()))),dependencies:(0,re.array)((0,re.string)()),packageId:(0,re.string)(),ticket:Fn}),vA=[lA,fA,dA,hA,mA,gA,pA],yA=(0,re.union)([...vA]),bA=(0,re.object)({version:(0,re.literal)(1),sender:(0,re.optional)((0,re.string)()),expiration:(0,re.nullish)(aA),gasConfig:cA,inputs:(0,re.array)(Yy),transactions:(0,re.array)(yA)});function wA(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,no.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:Xy.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>pi(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:pi(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>pi(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=>pi(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,no.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:pi(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>pi(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>pi(i,t)),address:pi(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,no.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:pi(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function pi(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 _A(e){var t,r,n;return(0,re.parse)(ga.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,re.is)(Jf,i.value)){const s=(0,re.parse)(Jf,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,no.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?Xy.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>mi(s))}};case"MergeCoins":return{MergeCoins:{destination:mi(i.destination),sources:i.sources.map(s=>mi(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=>mi(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,no.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:mi(i.coin),amounts:i.amounts.map(s=>mi(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>mi(s)),address:mi(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,no.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:mi(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function mi(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 Zf=Object.defineProperty,xA=Object.getOwnPropertyDescriptor,SA=Object.getOwnPropertyNames,EA=Object.prototype.hasOwnProperty,MA=(e,t)=>{for(var r in t)Zf(e,r,{get:t[r],enumerable:!0})},CA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of SA(t))!EA.call(e,i)&&i!==r&&Zf(e,i,{get:()=>t[i],enumerable:!(n=xA(t,i))||n.enumerable});return e},AA=e=>CA(Zf({},"__esModule",{value:!0}),e),Qy={};MA(Qy,{SerializedTransactionDataV2:()=>DA});var TA=AA(Qy),je=$i,ar=to;function va(e){return(0,je.union)(Object.entries(e).map(([t,r])=>(0,je.object)({[t]:r})))}const dn=va({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)())])}),OA=(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))}),IA=(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)(dn)}),kA=(0,je.object)({name:(0,je.string)(),inputs:(0,je.record)((0,je.string)(),(0,je.union)([dn,(0,je.array)(dn)])),data:(0,je.record)((0,je.string)(),(0,je.unknown)())}),jA=va({MoveCall:IA,TransferObjects:(0,je.object)({objects:(0,je.array)(dn),address:dn}),SplitCoins:(0,je.object)({coin:dn,amounts:(0,je.array)(dn)}),MergeCoins:(0,je.object)({destination:dn,sources:(0,je.array)(dn)}),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)(dn)}),Upgrade:(0,je.object)({modules:(0,je.array)(ar.BCSBytes),dependencies:(0,je.array)(ar.ObjectID),package:ar.ObjectID,ticket:dn}),$Intent:kA}),PA=va({ImmOrOwnedObject:ar.ObjectRef,SharedObject:(0,je.object)({objectId:ar.ObjectID,initialSharedVersion:ar.JsonU64,mutable:(0,je.boolean)()}),Receiving:ar.ObjectRef}),NA=va({Object:PA,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))})}),RA=va({None:(0,je.literal)(!0),Epoch:ar.JsonU64}),DA=(0,je.object)({version:(0,je.literal)(2),sender:(0,je.nullish)(ar.SuiAddress),expiration:(0,je.nullish)(RA),gasData:OA,inputs:(0,je.array)(NA),commands:(0,je.array)(jA)});var Qf=Object.defineProperty,$A=Object.getOwnPropertyDescriptor,BA=Object.getOwnPropertyNames,LA=Object.prototype.hasOwnProperty,UA=(e,t)=>{for(var r in t)Qf(e,r,{get:t[r],enumerable:!0})},FA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of BA(t))!LA.call(e,i)&&i!==r&&Qf(e,i,{get:()=>t[i],enumerable:!(n=$A(t,i))||n.enumerable});return e},zA=e=>FA(Qf({},"__esModule",{value:!0}),e),eb={};UA(eb,{getClient:()=>io,resolveTransactionData:()=>KA});var tb=zA(eb),VA=$i,rb=di,ed=Ay,qA=to,ya=Pc,td=jy;const GA=50,HA=1000n,WA=5e10;async function KA(e,t,r){return await QA(e,t),await ZA(e,t),t.onlyTransactionKind||(await XA(e,t),await YA(e,t),await JA(e,t)),await eT(e),await r()}async function XA(e,t){e.gasConfig.price||(e.gasConfig.price=String(await io(t).getReferenceGasPrice()))}async function YA(e,t){if(e.gasConfig.budget)return;const r=await io(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(WA),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=HA*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 JA(e,t){if(!e.gasConfig.payment){const n=(await io(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:ed.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,VA.parse)(qA.ObjectRef,i))}}async function ZA(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,ed.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?iT(n,GA):[],s=(await Promise.all(i.map(l=>io(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,ed.normalizeSuiAddress)(f.UnresolvedObject.objectId),_=u.get(y);f.UnresolvedObject.initialSharedVersion??(_==null?void 0:_.initialSharedVersion)?h=ya.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(_==null?void 0:_.initialSharedVersion),mutable:tT(e,l)}):rT(e,l)&&(h=ya.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??ya.Inputs.ObjectRef({objectId:y,digest:f.UnresolvedObject.digest??(_==null?void 0:_.digest),version:f.UnresolvedObject.version??(_==null?void 0:_.version)})}}async function QA(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=>{nb(c,rb.bcs.U64,e)});break;case"TransferObjects":nb(a.TransferObjects.address,rb.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=io(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,td.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,td.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,R;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)??((R=_.UnresolvedObject)==null?void 0:R.objectId),A=(0,td.getPureBcsSchema)(f.body);if(A){y.type="pure",r[r.indexOf(_)]=ya.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 eT(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 nb(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=ya.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function tT(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 rT(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=nT(i.MoveCall._argumentTypes[s])||r}}),r}function nT(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 io(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 iT(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var rd=Object.defineProperty,sT=Object.getOwnPropertyDescriptor,oT=Object.getOwnPropertyNames,aT=Object.prototype.hasOwnProperty,cT=(e,t)=>{for(var r in t)rd(e,r,{get:t[r],enumerable:!0})},uT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oT(t))!aT.call(e,i)&&i!==r&&rd(e,i,{get:()=>t[i],enumerable:!(n=sT(t,i))||n.enumerable});return e},lT=e=>uT(rd({},"__esModule",{value:!0}),e),ib={};cT(ib,{createObjectMethods:()=>fT});var sb=lT(ib);function fT(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 nd=Object.defineProperty,dT=Object.getOwnPropertyDescriptor,hT=Object.getOwnPropertyNames,pT=Object.prototype.hasOwnProperty,mT=(e,t)=>{for(var r in t)nd(e,r,{get:t[r],enumerable:!0})},gT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hT(t))!pT.call(e,i)&&i!==r&&nd(e,i,{get:()=>t[i],enumerable:!(n=dT(t,i))||n.enumerable});return e},vT=e=>gT(nd({},"__esModule",{value:!0}),e),ob={};mT(ob,{createPure:()=>bT});var ab=vT(ob),yT=Sr,tr=di;function bT(e){function t(r,n){if(typeof r=="string")return e(ba(r).serialize(n));if(r instanceof Uint8Array||(0,yT.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(tr.bcs.U8.serialize(r)),t.u16=r=>e(tr.bcs.U16.serialize(r)),t.u32=r=>e(tr.bcs.U32.serialize(r)),t.u64=r=>e(tr.bcs.U64.serialize(r)),t.u128=r=>e(tr.bcs.U128.serialize(r)),t.u256=r=>e(tr.bcs.U256.serialize(r)),t.bool=r=>e(tr.bcs.Bool.serialize(r)),t.string=r=>e(tr.bcs.String.serialize(r)),t.address=r=>e(tr.bcs.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(tr.bcs.vector(ba(r)).serialize(n)),t.option=(r,n)=>e(tr.bcs.option(ba(r)).serialize(n)),t}function ba(e){switch(e){case"u8":return tr.bcs.u8();case"u16":return tr.bcs.u16();case"u32":return tr.bcs.u32();case"u64":return tr.bcs.u64();case"u128":return tr.bcs.u128();case"u256":return tr.bcs.u256();case"bool":return tr.bcs.bool();case"string":return tr.bcs.string();case"id":case"address":return tr.bcs.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?tr.bcs.vector(ba(n)):tr.bcs.option(ba(n))}throw new Error(`Invalid Pure type name: ${e}`)}var id=Object.defineProperty,wT=Object.getOwnPropertyDescriptor,_T=Object.getOwnPropertyNames,xT=Object.prototype.hasOwnProperty,ST=(e,t)=>{for(var r in t)id(e,r,{get:t[r],enumerable:!0})},ET=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _T(t))!xT.call(e,i)&&i!==r&&id(e,i,{get:()=>t[i],enumerable:!(n=wT(t,i))||n.enumerable});return e},MT=e=>ET(id({},"__esModule",{value:!0}),e),cb={};ST(cb,{hashTypedData:()=>TT});var CT=MT(cb),AT=Ey;function TT(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,AT.blake2b)(n,{dkLen:32})}var sd=Object.defineProperty,OT=Object.getOwnPropertyDescriptor,IT=Object.getOwnPropertyNames,kT=Object.prototype.hasOwnProperty,jT=(e,t)=>{for(var r in t)sd(e,r,{get:t[r],enumerable:!0})},PT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of IT(t))!kT.call(e,i)&&i!==r&&sd(e,i,{get:()=>t[i],enumerable:!(n=OT(t,i))||n.enumerable});return e},NT=e=>PT(sd({},"__esModule",{value:!0}),e),ub={};jT(ub,{TransactionDataBuilder:()=>ys});var od=NT(ub),RT=Sr,ad=$i,Bc=di,DT=Vr,cd=to,$T=Ky,BT=CT;function lb(e){return(0,DT.normalizeSuiAddress)(e).replace("0x","")}class ys{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=Bc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return ys.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=Bc.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 ys.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 ys((0,ad.parse)(cd.TransactionData,t)):new ys((0,ad.parse)(cd.TransactionData,(0,$T.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,BT.hashTypedData)("TransactionData",t);return(0,RT.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 Bc.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:lb(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:lb(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return Bc.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 ys.getDigestFromBytes(t)}snapshot(){return(0,ad.parse)(cd.TransactionData,this)}}var ud=Object.defineProperty,LT=Object.getOwnPropertyDescriptor,UT=Object.getOwnPropertyNames,FT=Object.prototype.hasOwnProperty,zT=(e,t)=>{for(var r in t)ud(e,r,{get:t[r],enumerable:!0})},VT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of UT(t))!FT.call(e,i)&&i!==r&&ud(e,i,{get:()=>t[i],enumerable:!(n=LT(t,i))||n.enumerable});return e},qT=e=>VT(ud({},"__esModule",{value:!0}),e),fb={};zT(fb,{extractMutableReference:()=>db,extractReference:()=>hb,extractStructTag:()=>HT,getIdFromCallArg:()=>WT});var GT=qT(fb),wa=Vr;function db(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function hb(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function HT(e){if(typeof e=="object"&&"Struct"in e)return e;const t=hb(e),r=db(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function WT(e){if(typeof e=="string")return(0,wa.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,wa.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,wa.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,wa.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,wa.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var ld=Object.defineProperty,KT=Object.getOwnPropertyDescriptor,XT=Object.getOwnPropertyNames,YT=Object.prototype.hasOwnProperty,pb=e=>{throw TypeError(e)},JT=(e,t)=>{for(var r in t)ld(e,r,{get:t[r],enumerable:!0})},ZT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XT(t))!YT.call(e,i)&&i!==r&&ld(e,i,{get:()=>t[i],enumerable:!(n=KT(t,i))||n.enumerable});return e},QT=e=>ZT(ld({},"__esModule",{value:!0}),e),fd=(e,t,r)=>t.has(e)||pb("Cannot "+r),St=(e,t,r)=>(fd(e,t,"read from private field"),r?r.call(e):t.get(e)),_a=(e,t,r)=>t.has(e)?pb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),bs=(e,t,r,n)=>(fd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),gi=(e,t,r)=>(fd(e,t,"access private method"),r),mb={};JT(mb,{Transaction:()=>oO,isTransaction:()=>wb});var Lc=QT(mb),Uc=Sr,Ui=$i,eO=Vr,ws=Xf,_s=to,gb=Ky,tO=TA,Fc=Pc,rO=tb,nO=sb,iO=ab,xa=od,vb=GT,Sa,Ea,xs,Mt,hn,zc,dd,hd,pd;function yb(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 bb=Symbol.for("@mysten/transaction");function wb(e){return!!e&&typeof e=="object"&&e[bb]===!0}const _b={buildPlugins:new Map,serializationPlugins:new Map},md=Symbol.for("@mysten/transaction/registry");function Ma(){try{const e=globalThis;return e[md]||(e[md]=_b),e[md]}catch{return _b}}const sO=class Z0{constructor(){_a(this,hn),_a(this,Sa),_a(this,Ea),_a(this,xs,new Map),_a(this,Mt),this.object=(0,nO.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Ui.is)(_s.Argument,r))return r;const n=(0,vb.getIdFromCallArg)(r),i=St(this,Mt).inputs.find(a=>n===(0,vb.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:St(this,Mt).inputs.indexOf(i),type:"object"}:St(this,Mt).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,eO.normalizeSuiAddress)(r)}}:r)});const t=Ma();bs(this,Mt,new xa.TransactionDataBuilder),bs(this,Ea,[...t.buildPlugins.values()]),bs(this,Sa,[...t.serializationPlugins.values()])}static fromKind(t){const r=new Z0;return bs(r,Mt,xa.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,Uc.fromBase64)(t):t)),r}static from(t){const r=new Z0;return wb(t)?bs(r,Mt,new xa.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?bs(r,Mt,xa.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,Uc.fromBase64)(t):t)):bs(r,Mt,xa.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){Ma().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){Ma().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){Ma().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){Ma().buildPlugins.delete(t)}addSerializationPlugin(t){St(this,Sa).push(t)}addBuildPlugin(t){St(this,Ea).push(t)}addIntentResolver(t,r){if(St(this,xs).has(t)&&St(this,xs).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);St(this,xs).set(t,r)}setSender(t){St(this,Mt).sender=t}setSenderIfNotSet(t){St(this,Mt).sender||(St(this,Mt).sender=t)}setExpiration(t){St(this,Mt).expiration=t?(0,Ui.parse)(_s.TransactionExpiration,t):null}setGasPrice(t){St(this,Mt).gasConfig.price=String(t)}setGasBudget(t){St(this,Mt).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){St(this,Mt).gasData.budget==null&&(St(this,Mt).gasConfig.budget=String(t))}setGasOwner(t){St(this,Mt).gasConfig.owner=t}setGasPayment(t){St(this,Mt).gasConfig.payment=t.map(r=>(0,Ui.parse)(_s.ObjectRef,r))}get blockData(){return(0,gb.serializeV1TransactionData)(St(this,Mt).snapshot())}getData(){return St(this,Mt).snapshot()}get[bb](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,iO.createPure)(t=>(0,Uc.isSerializedBcs)(t)?St(this,Mt).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):St(this,Mt).addInput("pure",(0,Ui.is)(_s.NormalizedCallArg,t)?(0,Ui.parse)(_s.NormalizedCallArg,t):t instanceof Uint8Array?Fc.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(Fc.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(Fc.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(Fc.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=St(this,Mt).commands.push(t);return yb(r-1)}splitCoins(t,r){const n=ws.Commands.SplitCoins(typeof t=="string"?this.object(t):gi(this,hn,dd).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):gi(this,hn,zc).call(this,s))),i=St(this,Mt).commands.push(n);return yb(i-1,r.length)}mergeCoins(t,r){return this.add(ws.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(ws.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(ws.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(ws.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>gi(this,hn,zc).call(this,n))}))}transferObjects(t,r){return this.add(ws.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):gi(this,hn,zc).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(ws.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,gb.serializeV1TransactionData)(St(this,Mt).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Ui.parse)(tO.SerializedTransactionDataV2,St(this,Mt).snapshot()),(r,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(t){const{signer:r,...n}=t,i=await this.build(n);return r.signTransaction(i)}async build(t={}){return await this.prepareForSerialization(t),await gi(this,hn,hd).call(this,t),St(this,Mt).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await gi(this,hn,hd).call(this,t),St(this,Mt).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of St(this,Mt).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...St(this,Sa)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!St(this,xs).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(St(this,xs).get(s))}await gi(this,hn,pd).call(this,n,t)}};Sa=new WeakMap,Ea=new WeakMap,xs=new WeakMap,Mt=new WeakMap,hn=new WeakSet,zc=function(e){return(0,Uc.isSerializedBcs)(e)?this.pure(e):gi(this,hn,dd).call(this,e)},dd=function(e){return typeof e=="function"?(0,Ui.parse)(_s.Argument,e(this)):(0,Ui.parse)(_s.Argument,e)},hd=async function(e){if(!e.onlyTransactionKind&&!St(this,Mt).sender)throw new Error("Missing transaction sender");await gi(this,hn,pd).call(this,[...St(this,Ea),rO.resolveTransactionData],e)},pd=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(St(this,Mt),t,async()=>{if(o)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);o=!0,await s(),a=!0}),!o)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await r(0)()};let oO=sO;var gd=Object.defineProperty,aO=Object.getOwnPropertyDescriptor,cO=Object.getOwnPropertyNames,uO=Object.prototype.hasOwnProperty,xb=e=>{throw TypeError(e)},lO=(e,t)=>{for(var r in t)gd(e,r,{get:t[r],enumerable:!0})},fO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cO(t))!uO.call(e,i)&&i!==r&&gd(e,i,{get:()=>t[i],enumerable:!(n=aO(t,i))||n.enumerable});return e},dO=e=>fO(gd({},"__esModule",{value:!0}),e),Sb=(e,t,r)=>t.has(e)||xb("Cannot "+r),fr=(e,t,r)=>(Sb(e,t,"read from private field"),r?r.call(e):t.get(e)),vd=(e,t,r)=>t.has(e)?xb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Eb=(e,t,r,n)=>(Sb(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Mb={};lO(Mb,{AsyncCache:()=>Ab,InMemoryCache:()=>Tb,ObjectCache:()=>hO});var Cb=dO(Mb),yd=Vr,Ss,Er,Vc;class Ab{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,yd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,yd.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,yd.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 Tb extends Ab{constructor(){super(...arguments),vd(this,Ss,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return fr(this,Ss)[t].get(r)??null}async set(t,r,n){fr(this,Ss)[t].set(r,n)}async delete(t,r){fr(this,Ss)[t].delete(r)}async clear(t){if(t)fr(this,Ss)[t].clear();else for(const r of Object.values(fr(this,Ss)))r.clear()}}Ss=new WeakMap;class hO{constructor({cache:t=new Tb,onEffects:r}){vd(this,Er),vd(this,Vc),Eb(this,Er,t),Eb(this,Vc,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,Vc))==null?void 0:r.call(this,t)])}}Er=new WeakMap,Vc=new WeakMap;var bd=Object.defineProperty,pO=Object.getOwnPropertyDescriptor,mO=Object.getOwnPropertyNames,gO=Object.prototype.hasOwnProperty,Ob=e=>{throw TypeError(e)},vO=(e,t)=>{for(var r in t)bd(e,r,{get:t[r],enumerable:!0})},yO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mO(t))!gO.call(e,i)&&i!==r&&bd(e,i,{get:()=>t[i],enumerable:!(n=pO(t,i))||n.enumerable});return e},bO=e=>yO(bd({},"__esModule",{value:!0}),e),Ib=(e,t,r)=>t.has(e)||Ob("Cannot "+r),Ca=(e,t,r)=>(Ib(e,t,"read from private field"),r?r.call(e):t.get(e)),kb=(e,t,r)=>t.has(e)?Ob("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),wd=(e,t,r,n)=>(Ib(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),jb={};vO(jb,{CachingTransactionExecutor:()=>SO});var Pb=bO(jb),wO=di,_O=Cb,xO=Lc,so,oo;class SO{constructor({client:t,...r}){kb(this,so),kb(this,oo,null),wd(this,so,t),this.cache=new _O.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:Ca(this,so),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,xO.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await Ca(this,so).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=wO.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;wd(this,oo,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){Ca(this,oo)&&(await Ca(this,so).waitForTransaction({digest:Ca(this,oo)}),wd(this,oo,null))}}so=new WeakMap,oo=new WeakMap;var _d=Object.defineProperty,EO=Object.getOwnPropertyDescriptor,MO=Object.getOwnPropertyNames,CO=Object.prototype.hasOwnProperty,Nb=e=>{throw TypeError(e)},AO=(e,t)=>{for(var r in t)_d(e,r,{get:t[r],enumerable:!0})},TO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MO(t))!CO.call(e,i)&&i!==r&&_d(e,i,{get:()=>t[i],enumerable:!(n=EO(t,i))||n.enumerable});return e},OO=e=>TO(_d({},"__esModule",{value:!0}),e),IO=(e,t,r)=>t.has(e)||Nb("Cannot "+r),pn=(e,t,r)=>(IO(e,t,"read from private field"),r?r.call(e):t.get(e)),Rb=(e,t,r)=>t.has(e)?Nb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Db={};AO(Db,{ParallelQueue:()=>jO,SerialQueue:()=>kO});var $b=OO(Db),Fi,Es;class kO{constructor(){Rb(this,Fi,[])}async runTask(t){return new Promise((r,n)=>{pn(this,Fi).push(()=>{t().finally(()=>{pn(this,Fi).shift(),pn(this,Fi).length>0&&pn(this,Fi)[0]()}).then(r,n)}),pn(this,Fi).length===1&&pn(this,Fi)[0]()})}}Fi=new WeakMap;class jO{constructor(t){Rb(this,Es,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{pn(this,Es).length>0?pn(this,Es).shift()():this.activeTasks--}).then(r,n)):pn(this,Es).push(()=>{t().finally(()=>{pn(this,Es).length>0?pn(this,Es).shift()():this.activeTasks--}).then(r,n)})})}}Es=new WeakMap;var xd=Object.defineProperty,PO=Object.getOwnPropertyDescriptor,NO=Object.getOwnPropertyNames,RO=Object.prototype.hasOwnProperty,Bb=e=>{throw TypeError(e)},DO=(e,t)=>{for(var r in t)xd(e,r,{get:t[r],enumerable:!0})},$O=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NO(t))!RO.call(e,i)&&i!==r&&xd(e,i,{get:()=>t[i],enumerable:!(n=PO(t,i))||n.enumerable});return e},BO=e=>$O(xd({},"__esModule",{value:!0}),e),Lb=(e,t,r)=>t.has(e)||Bb("Cannot "+r),Mr=(e,t,r)=>(Lb(e,t,"read from private field"),r?r.call(e):t.get(e)),ao=(e,t,r)=>t.has(e)?Bb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Sd=(e,t,r,n)=>(Lb(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ub={};DO(Ub,{SerialTransactionExecutor:()=>zO,getGasCoinFromEffects:()=>Vb});var Fb=BO(Ub),LO=Sr,zb=Lc,UO=Pb,FO=$b,qc,Aa,mn,Gc,Ed,Hc;class zO{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){ao(this,qc,new FO.SerialQueue),ao(this,Aa),ao(this,mn),ao(this,Gc),ao(this,Ed,async i=>{if(!i.V2)return;const s=Vb(i).ref;s?Mr(this,mn).cache.setCustom("gasCoin",s):Mr(this,mn).cache.deleteCustom("gasCoin")}),ao(this,Hc,async i=>{const s=await Mr(this,mn).cache.getCustom("gasCoin"),o=zb.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Mr(this,Gc)),o.setSenderIfNotSet(Mr(this,Aa).toSuiAddress()),Mr(this,mn).buildTransaction({transaction:o})}),Sd(this,Aa,t),Sd(this,Gc,r),Sd(this,mn,new UO.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Mr(this,Ed).call(this,i)}))}async applyEffects(t){return Mr(this,mn).applyEffects(t)}async buildTransaction(t){return Mr(this,qc).runTask(()=>Mr(this,Hc).call(this,t))}resetCache(){return Mr(this,mn).reset()}waitForLastTransaction(){return Mr(this,mn).waitForLastTransaction()}executeTransaction(t,r){return Mr(this,qc).runTask(async()=>{const n=(0,zb.isTransaction)(t)?await Mr(this,Hc).call(this,t):t,{signature:i}=await Mr(this,Aa).signTransaction(n),s=await Mr(this,mn).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,LO.toBase64)(o),data:s}})}}qc=new WeakMap,Aa=new WeakMap,mn=new WeakMap,Gc=new WeakMap,Ed=new WeakMap,Hc=new WeakMap;function Vb(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 Md=Object.defineProperty,VO=Object.getOwnPropertyDescriptor,qO=Object.getOwnPropertyNames,GO=Object.prototype.hasOwnProperty,qb=e=>{throw TypeError(e)},HO=(e,t)=>{for(var r in t)Md(e,r,{get:t[r],enumerable:!0})},WO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qO(t))!GO.call(e,i)&&i!==r&&Md(e,i,{get:()=>t[i],enumerable:!(n=VO(t,i))||n.enumerable});return e},KO=e=>WO(Md({},"__esModule",{value:!0}),e),Cd=(e,t,r)=>t.has(e)||qb("Cannot "+r),qe=(e,t,r)=>(Cd(e,t,"read from private field"),r?r.call(e):t.get(e)),dr=(e,t,r)=>t.has(e)?qb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),rr=(e,t,r,n)=>(Cd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Qr=(e,t,r)=>(Cd(e,t,"access private method"),r),Gb=(e,t,r,n)=>({set _(i){rr(e,t,i,r)},get _(){return qe(e,t,n)}}),Hb={};HO(Hb,{ParallelTransactionExecutor:()=>e7});var XO=KO(Hb),YO=Sr,Wb=di,JO=Lc,ZO=od,QO=Pb,Kb=$b,Xb=Fb,zi,zn,Wc,Ta,Oa,Ia,Kc,co,Pr,Vi,Ms,Cs,Ad,Xc,ka,uo,lo,vi,$r,Yb,Jb,ja,Td,Zb,Od,Qb;const Pa={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class e7{constructor(t){dr(this,$r),dr(this,zi),dr(this,zn),dr(this,Wc),dr(this,Ta),dr(this,Oa),dr(this,Ia),dr(this,Kc),dr(this,co),dr(this,Pr),dr(this,Vi,[]),dr(this,Ms),dr(this,Cs,new Map),dr(this,Ad,new Kb.SerialQueue),dr(this,Xc),dr(this,ka,null),dr(this,uo,null),dr(this,lo,0),dr(this,vi,null),rr(this,zi,t.signer),rr(this,zn,t.client),rr(this,Wc,t.coinBatchSize??Pa.coinBatchSize),rr(this,Ta,t.initialCoinBalance??Pa.initialCoinBalance),rr(this,Oa,t.minimumCoinBalance??Pa.minimumCoinBalance),rr(this,Kc,t.defaultGasBudget??qe(this,Oa)),rr(this,Ia,t.epochBoundaryWindow??Pa.epochBoundaryWindow),rr(this,co,t.maxPoolSize??Pa.maxPoolSize),rr(this,Ms,new QO.CachingTransactionExecutor({client:t.client,cache:t.cache})),rr(this,Xc,new Kb.ParallelQueue(qe(this,co))),rr(this,Pr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return rr(this,vi,null),Qr(this,$r,ja).call(this,()=>qe(this,Ms).reset())}async waitForLastTransaction(){await Qr(this,$r,ja).call(this,()=>Qr(this,$r,Td).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=t7(),o=await Qr(this,$r,Yb).call(this,t),a=()=>{qe(this,Xc).runTask(()=>Qr(this,$r,Jb).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{qe(this,Cs).get(u)?(c.add(u),qe(this,Cs).get(u).push(()=>{c.delete(u),c.size===0&&a()})):qe(this,Cs).set(u,[])}),c.size===0&&a(),n}}zi=new WeakMap,zn=new WeakMap,Wc=new WeakMap,Ta=new WeakMap,Oa=new WeakMap,Ia=new WeakMap,Kc=new WeakMap,co=new WeakMap,Pr=new WeakMap,Vi=new WeakMap,Ms=new WeakMap,Cs=new WeakMap,Ad=new WeakMap,Xc=new WeakMap,ka=new WeakMap,uo=new WeakMap,lo=new WeakMap,vi=new WeakMap,$r=new WeakSet,Yb=async function(e){const t=new Set;let r=!1;return e.addSerializationPlugin(async(n,i,s)=>{await s(),!r&&(r=!0,n.inputs.forEach(o=>{var a,c,u,l,f;(c=(a=o.Object)==null?void 0:a.ImmOrOwnedObject)!=null&&c.objectId?t.add(o.Object.ImmOrOwnedObject.objectId):(l=(u=o.Object)==null?void 0:u.Receiving)!=null&&l.objectId?t.add(o.Object.Receiving.objectId):(f=o.UnresolvedObject)!=null&&f.objectId&&!o.UnresolvedObject.initialSharedVersion&&t.add(o.UnresolvedObject.objectId)}))}),await e.prepareForSerialization({client:qe(this,zn)}),t},Jb=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(qe(this,zi).toSuiAddress()),await qe(this,Ad).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await Qr(this,$r,Od).call(this)),e.setGasBudgetIfNotSet(qe(this,Kc)),await Qr(this,$r,ja).call(this),n=await Qr(this,$r,Zb).call(this),Gb(this,lo)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await qe(this,Ms).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:qe(this,zn)}),{signature:o}=await qe(this,zi).signTransaction(s),a=await qe(this,Ms).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=Wb.bcs.TransactionEffects.parse(c),l=(0,Xb.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===qe(this,zi).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new ZO.TransactionDataBuilder(e.getData()).mapArguments(_=>(_.$kind==="GasCoin"&&(y=!0),_)),!y&&n.balance>=qe(this,Oa)?qe(this,Vi).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(qe(this,Pr)||rr(this,Pr,new Map),qe(this,Pr).set(l.ref.objectId,l.ref))}return rr(this,ka,a.digest),{digest:a.digest,effects:(0,YO.toBase64)(c),data:a}}catch(s){throw n&&(qe(this,Pr)||rr(this,Pr,new Map),qe(this,Pr).set(n.id,null)),await Qr(this,$r,ja).call(this,async()=>{await Promise.all([qe(this,Ms).cache.deleteObjects([...t]),Qr(this,$r,Td).call(this)])}),s}finally{t.forEach(s=>{const o=qe(this,Cs).get(s);o&&o.length>0?o.shift()():o&&qe(this,Cs).delete(s)}),Gb(this,lo)._--}},ja=async function(e){qe(this,uo)&&await qe(this,uo),rr(this,uo,(e==null?void 0:e().then(()=>{rr(this,uo,null)},()=>{}))??null)},Td=async function(){const e=qe(this,ka);e&&(rr(this,ka,null),await qe(this,zn).waitForTransaction({digest:e}))},Zb=async function(){if(qe(this,Vi).length===0&&qe(this,lo)<=qe(this,co)&&await Qr(this,$r,Qb).call(this),qe(this,Vi).length===0)throw new Error("No coins available");return qe(this,Vi).shift()},Od=async function(){if((qe(this,vi)?qe(this,vi).expiration-qe(this,Ia)-Date.now():0)>0)return qe(this,vi).price;if(qe(this,vi)){const r=Math.max(qe(this,vi).expiration+qe(this,Ia)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await qe(this,zn).getLatestSuiSystemState();return rr(this,vi,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),Qr(this,$r,Od).call(this)},Qb=async function(){var u;const e=Math.min(qe(this,Wc),qe(this,co)-(qe(this,Vi).length+qe(this,lo))+1);if(e===0)return;const t=new JO.Transaction,r=qe(this,zi).toSuiAddress();if(t.setSender(r),qe(this,Pr)){const l=[],f=[];for(const[h,y]of qe(this,Pr))y?l.push(y):f.push(h);if(f.length>0){const h=await qe(this,zn).multiGetObjects({ids:f});l.push(...h.filter(y=>y.data!==null).map(({data:y})=>({objectId:y.objectId,version:y.version,digest:y.digest})))}t.setGasPayment(l),rr(this,Pr,new Map)}const n=new Array(e).fill(qe(this,Ta)),i=t.splitCoins(t.gas,n),s=[];for(let l=0;l<n.length;l++)s.push(i[l]);t.transferObjects(s,r),await this.waitForLastTransaction();const o=await qe(this,zn).signAndExecuteTransaction({transaction:t,signer:qe(this,zi),options:{showRawEffects:!0}}),a=Wb.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,Vi).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(qe(this,Ta))})}),qe(this,Pr)||rr(this,Pr,new Map);const c=(0,Xb.getGasCoinFromEffects)(a).ref;qe(this,Pr).set(c.objectId,c),await qe(this,zn).waitForTransaction({digest:o.digest})};function t7(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var Id=Object.defineProperty,r7=Object.getOwnPropertyDescriptor,n7=Object.getOwnPropertyNames,i7=Object.prototype.hasOwnProperty,s7=(e,t)=>{for(var r in t)Id(e,r,{get:t[r],enumerable:!0})},o7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of n7(t))!i7.call(e,i)&&i!==r&&Id(e,i,{get:()=>t[i],enumerable:!(n=r7(t,i))||n.enumerable});return e},a7=e=>o7(Id({},"__esModule",{value:!0}),e),ew={};s7(ew,{coinWithBalance:()=>f7});var c7=a7(ew),Yc=$i,u7=di,tw=Vr,Jc=Xf,rw=Pc,l7=tb;const Zc="CoinWithBalance",nw=(0,tw.normalizeStructTag)("0x2::sui::SUI");function f7({type:e=nw,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(Zc,h7);const i=e==="gas"?e:(0,tw.normalizeStructTag)(e);return n.add(Jc.Commands.Intent({name:Zc,inputs:{},data:{type:i===nw&&r?"gas":i,balance:BigInt(t)}}))}}const d7=(0,Yc.object)({type:(0,Yc.string)(),balance:(0,Yc.bigint)()});async function h7(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===Zc){const{type:h,balance:y}=(0,Yc.parse)(d7,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,l7.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await p7({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!==Zc)continue;const{type:y,balance:_}=h.$Intent.data;if(_===0n){e.replaceCommand(f,Jc.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",rw.Inputs.ObjectRef({objectId:P.coinObjectId,digest:P.digest,version:P.version})));I.length>0&&w.push(Jc.Commands.MergeCoins(A,I)),c.set(y,A)}w.push(Jc.Commands.SplitCoins(c.get(y),[e.addInput("pure",rw.Inputs.Pure(u7.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 p7({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 kd=Object.defineProperty,m7=Object.getOwnPropertyDescriptor,g7=Object.getOwnPropertyNames,v7=Object.prototype.hasOwnProperty,y7=(e,t)=>{for(var r in t)kd(e,r,{get:t[r],enumerable:!0})},b7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of g7(t))!v7.call(e,i)&&i!==r&&kd(e,i,{get:()=>t[i],enumerable:!(n=m7(t,i))||n.enumerable});return e},w7=e=>b7(kd({},"__esModule",{value:!0}),e),iw={};y7(iw,{Arguments:()=>E7});var _7=w7(iw),x7=sb,S7=ab;const E7={pure:(0,S7.createPure)(e=>t=>t.pure(e)),object:(0,x7.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 jd=Object.defineProperty,M7=Object.getOwnPropertyDescriptor,C7=Object.getOwnPropertyNames,A7=Object.prototype.hasOwnProperty,T7=(e,t)=>{for(var r in t)jd(e,r,{get:t[r],enumerable:!0})},O7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of C7(t))!A7.call(e,i)&&i!==r&&jd(e,i,{get:()=>t[i],enumerable:!(n=M7(t,i))||n.enumerable});return e},I7=e=>O7(jd({},"__esModule",{value:!0}),e),sw={};T7(sw,{findTransactionBlockNames:()=>j7,listToRequests:()=>N7,replaceNames:()=>P7});var k7=I7(sw),ow=_y;const fo="/",j7=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){aw([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(fo)){if(!(0,ow.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}aw(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function aw(e){const t=new Set;for(const r of e)if(r.includes(fo)){if(!(0,ow.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const P7=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(fo))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(fo)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(fo)&&(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(fo)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},N7=(e,t)=>{const r=[],n=cw(e.packages),i=cw(e.types);for(const[s,o]of n.entries())r.push({id:s,type:"package",name:o});for(const[s,o]of i.entries())r.push({id:s+n.length,type:"moveType",name:o});return R7(r,t)},cw=e=>[...new Set(e)],R7=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var Pd=Object.defineProperty,D7=Object.getOwnPropertyDescriptor,$7=Object.getOwnPropertyNames,B7=Object.prototype.hasOwnProperty,L7=(e,t)=>{for(var r in t)Pd(e,r,{get:t[r],enumerable:!0})},U7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $7(t))!B7.call(e,i)&&i!==r&&Pd(e,i,{get:()=>t[i],enumerable:!(n=D7(t,i))||n.enumerable});return e},F7=e=>U7(Pd({},"__esModule",{value:!0}),e),uw={};L7(uw,{namedPackagesPlugin:()=>V7});var z7=F7(uw),Nd=k7;const V7=({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,Nd.findTransactionBlockNames)(s),u=(0,Nd.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,Nd.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} />`,vr,or,Nn,or),K[or+vr]=!0}}return z===n?B(Bt):T(Bt),Bt}}function re(z,oe,he){return Z(z,oe,he,!0)}function Be(z,oe,he){return Z(z,oe,he,!1)}var rt=Be,Re=re;ha.Fragment=n,ha.jsx=rt,ha.jsxs=Re}()),ha}hn.env.NODE_ENV==="production"?uf.exports=L3():uf.exports=F3();var w=uf.exports;const yX="",bX="",wX="";window._iconfont_svg_string_4776227='<svg><symbol id="icon-more" viewBox="0 0 1024 1024"><path d="M499.2 217.6m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 524.8m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 832m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path></symbol><symbol id="icon-docs" viewBox="0 0 1024 1024"><path d="M665.6 41.728c65.9456 0 121.2928 45.312 136.6016 106.496 5.0688-2.6624 10.8544-4.096 16.9984-4.096a140.8 140.8 0 0 1 140.8 140.8v563.2a140.8 140.8 0 0 1-140.8 140.8H358.4a140.8512 140.8512 0 0 1-135.4752-102.4H204.8a140.8 140.8 0 0 1-140.8-140.8v-563.2A140.8 140.8 0 0 1 204.8 41.728h460.8z m140.8 177.0496v526.9504a140.8 140.8 0 0 1-140.8 140.8l-358.4 0.1024c11.7248 15.5136 30.3104 25.4976 51.2 25.4976h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64a38.3488 38.3488 0 0 1-12.8-2.1504zM665.6 118.528H204.8c-35.328 0-64 28.672-64 64v563.2c0 35.328 28.672 64 64 64h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64z m-153.6 281.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h256z m102.4-153.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h358.4z" ></path></symbol><symbol id="icon-link1" viewBox="0 0 1024 1024"><path d="M719.872 268.8l3.738 0.205 0.768 0.051-4.506-0.256a38.502 38.502 0 0 1 28.416 12.544l0.973 1.126a38.554 38.554 0 0 1 1.74 2.253l-2.713-3.379a38.605 38.605 0 0 1 9.984 25.549V563.2a38.4 38.4 0 1 1-76.8 0V394.086L281.856 758.221a38.4 38.4 0 0 1-51.712-56.832L620.646 345.6H463.872a38.4 38.4 0 0 1-38.042-33.178l-0.358-5.222a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-icon-kfckfc" viewBox="0 0 1024 1024"><path d="M53.504 102.912c-0.41 0.563 30.208 42.086 67.84 92.006L299.008 430.9 408.32 576l-7.014 7.885c-3.943 4.352-84.327 90.521-178.432 191.488C128.717 876.595 51.354 960 51.2 960.87c-0.358 0.922 16.077 1.69 39.731 1.536l40.243-0.204 13.21-14.49A217385.626 217385.626 0 0 0 440.32 629.914l4.71-5.479 37.837 50.33L610.048 843.93l89.6 118.63H836.71c114.023 0 136.858-0.358 136.141-2.458-0.563-1.484-35.328-48.025-77.312-103.782-41.984-55.603-90.01-119.398-106.65-141.568-16.793-22.17-66.15-88.064-110.028-146.074-43.879-58.163-79.821-106.598-79.821-107.366 0-1.331 231.782-251.187 310.58-334.746l22.527-23.808h-41.42l-41.217 0.154-48.179 51.814a48197.632 48197.632 0 0 1-144.23 154.88l-95.847 102.912L445.03 258.202 328.55 103.68l-137.062-0.922c-75.418-0.563-137.626-0.41-137.984 0.154z m324.762 166.4c44.8 59.7 113.97 151.5 153.65 204.288 39.732 52.531 127.796 169.677 195.892 259.994 68.045 90.47 124.365 165.376 125.286 166.707 1.178 1.69-12.288 2.253-61.235 2.253h-62.566L605.286 737.69c-286.208-379.802-430.592-571.7-432.332-574.516-1.127-1.69 11.724-2.252 61.081-2.252h62.567l81.664 108.39z" ></path></symbol><symbol id="icon-icon_telegram" viewBox="0 0 1024 1024"><path d="M824.87808 503.6032c55.8592 0 100.096 12.544 133.4272 37.5296 34.2016 26.7264 55.9104 66.7136 64.2048 120.9344h-94.208c-5.8368-27.4944-17.5104-47.5136-34.2016-60.8768-17.5104-13.312-40.8576-19.968-69.2224-19.968-35.0208 0-62.5664 12.4928-82.5856 39.168-19.968 25.856-30.0032 62.5152-30.0032 109.2608 0 47.5136 9.216 85.0432 29.184 111.7184 18.3296 25.856 45.8752 39.2192 82.5856 39.2192 63.3856 0 98.4064-31.6928 105.8816-94.208H1024.19968c-9.984 58.368-32.512 101.7344-66.7136 130.048-33.3824 27.5456-78.3872 41.728-134.2976 41.728-66.7136 0-118.4256-21.7088-155.136-65.024-35.84-41.728-53.3504-95.9488-53.3504-162.6624 0-65.024 17.5104-118.4256 52.5312-159.2832 37.5296-45.056 90.112-67.584 157.6448-67.584z m75.7248-333.6704l-53.76 245.4528a353.792 353.792 0 0 0-12.6464-0.256c-164.096 0-316.3648 113.7664-357.0176 266.752L381.63968 771.9424c-11.6224 10.9056-20.7872 20.1216-41.5744 20.1216l14.1824-205.2608 385.1776-336.7424c16.896-14.5408-3.6352-21.6576-26.112-8.3968L237.76768 532.2752 32.35328 470.1696c-44.288-13.1584-44.544-42.7008 10.0352-64l800.3072-298.9568c36.5568-15.9744 71.8336 8.5504 57.856 62.72z" ></path></symbol><symbol id="icon-icon_medium" viewBox="0 0 1024 1024"><path d="M576.819712 497.6128c-0.7168 169.6768-139.5712 294.7584-293.376 292.3008C127.795712 787.4048-0.357888 656.1792 0.000512 495.2064 0.358912 334.9504 130.611712 204.032 288.819712 204.8c159.9488 0.768 288.2048 131.1744 288 292.8128m27.904-1.536c0.9216-72.9088 12.3904-143.3088 50.1248-207.0528 7.168-12.1856 15.872-23.8592 25.6512-33.9968 44.4928-46.08 99.4816-44.0832 141.312 4.5056 28.8768 33.5872 45.8752 73.216 56.064 115.8656 24.576 102.5536 21.2992 203.5712-19.968 301.6704-11.9808 28.416-28.5184 54.2208-52.9408 73.728-36.2496 29.1328-76.8 29.3888-112.5376-0.3072-39.2704-32.6656-59.4944-77.5168-70.7584-125.696-9.8304-41.984-14.2848-85.248-21.0944-128l4.1472-0.7168M1024.000512 470.5792c-3.1744 93.952-4.9152 159.8976-22.1696 224.0512-3.0208 11.264-6.656 22.7328-12.4928 32.6656-3.8912 6.656-11.776 14.3872-18.3296 14.8992-5.3248 0.4096-14.08-8.192-16.6912-14.6944-7.5776-18.7392-14.848-38.0928-18.6368-57.9584-16.384-86.3744-18.4832-173.7216-10.496-261.0176 3.584-39.424 11.9296-78.4896 19.1488-117.5552 1.792-9.728 6.7584-19.2512 11.776-27.9552 9.728-16.4864 22.3744-16.896 30.9248 0 7.68 15.2576 15.0528 31.744 17.408 48.4864 8.8064 62.0544 15.4112 124.416 19.5584 159.0784" ></path></symbol><symbol id="icon-icon_discord" viewBox="0 0 1024 1024"><path d="M831.8976 213.6064A748.032 748.032 0 0 0 641.7408 153.6c-8.192 14.848-17.7664 34.8672-24.3712 50.7904a694.8864 694.8864 0 0 0-210.688 0c-6.6048-15.872-16.384-35.8912-24.6272-50.7904a745.5744 745.5744 0 0 0-190.3104 60.16C71.424 396.4928 38.8096 574.6176 55.0912 750.2848a758.784 758.784 0 0 0 233.216 120.064c18.7904-26.0096 35.5328-53.6064 49.92-82.688a490.0864 490.0864 0 0 1-78.6432-38.4c6.656-4.9664 13.056-10.0864 19.3024-15.36 151.6544 71.2704 316.416 71.2704 466.2272 0 6.2976 5.2736 12.8 10.3936 19.3024 15.36a488.8576 488.8576 0 0 1-78.848 38.5024c14.4384 28.9792 31.1296 56.6784 49.9712 82.6368a757.2992 757.2992 0 0 0 233.3184-120.1152c19.1488-203.6224-32.6656-380.16-136.96-536.6784zM358.912 642.2528c-45.568 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0.1024 52.0192-36.5056 94.72-82.8416 94.72z m306.176 0c-45.5168 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0 52.0192-36.5056 94.72-82.8416 94.72z" ></path></symbol><symbol id="icon-icon_del" viewBox="0 0 1024 1024"><path d="M512 64a243.2512 243.2512 0 0 1 240.1792 204.8h-1.3312a140.8 140.8 0 0 1 139.1104 162.4576l-63.6928 409.6a140.8 140.8 0 0 1-139.1616 119.1424H336.896a140.8 140.8 0 0 1-139.1616-119.1424l-63.6928-409.6A140.8 140.8 0 0 1 271.8208 268.8a243.2 243.2 0 0 1 240.1792-204.8z m238.848 281.6h-477.696A64 64 0 0 0 209.92 419.4304l63.6928 409.6A64 64 0 0 0 336.896 883.2h350.208a64 64 0 0 0 63.2832-54.1696l63.6928-409.6a64 64 0 0 0-63.232-73.8304zM409.6 473.6a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8A38.4 38.4 0 0 1 409.6 473.6z m204.8 0a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8a38.4 38.4 0 0 1 38.4-38.4z m-102.4-332.8a166.4512 166.4512 0 0 0-160.0512 120.7296l-1.8944 7.2704h323.84l-1.8432-7.2704a166.5024 166.5024 0 0 0-150.6304-120.4736L512 140.8z" ></path></symbol><symbol id="icon-plorer" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0zM726.886 324.3L577.741 764.11c-11.776 34.713-60.826 34.816-72.704 0.051L440.73 575.59l-197.94-71.987c-31.744-11.622-33.536-54.63-5.427-69.785l5.632-2.458 434.586-155.546a38.4 38.4 0 0 1 49.305 48.487z m-98.252 50.586L369.05 467.763l115.2 41.984a38.4 38.4 0 0 1 20.992 18.381l2.252 5.325 33.792 98.97 87.348-257.537z" ></path></symbol><symbol id="icon-disconnect" viewBox="0 0 1024 1024"><path d="M575.357 738.274a38.4 38.4 0 0 1 0 54.306l-72.408 72.408A243.2 243.2 0 1 1 159.012 521.05l72.408-72.408a38.4 38.4 0 1 1 54.306 54.306l-72.408 72.408a166.4 166.4 0 0 0 235.325 235.325l72.408-72.408a38.4 38.4 0 0 1 54.306 0z m-108.612-181.02a38.4 38.4 0 0 1 0 54.307L358.134 720.172a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0zM756.376 702.07a38.4 38.4 0 1 1-54.306 54.306L267.624 321.93a38.4 38.4 0 1 1 54.306-54.306L756.376 702.07z m-36.204-398.242a38.4 38.4 0 0 1 0 54.306L611.561 466.745a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0z m144.816-144.816a243.2 243.2 0 0 1 0 343.937l-72.408 72.408a38.4 38.4 0 1 1-54.306-54.306l72.408-72.408a166.4 166.4 0 0 0-235.325-235.325l-72.408 72.408a38.4 38.4 0 0 1-54.306-54.306l72.408-72.408a243.2 243.2 0 0 1 343.937 0z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M665.6 396.8a140.8 140.8 0 0 1 140.8 140.8v128a140.8 140.8 0 0 1-140.8 140.8h-128a140.8 140.8 0 0 1-140.8-140.8v-128a140.8 140.8 0 0 1 140.8-140.8h128z m0 76.8h-128c-35.328 0-64 28.672-64 64v128c0 35.328 28.672 64 64 64h128c35.328 0 64-28.672 64-64v-128c0-35.328-28.672-64-64-64z" ></path><path d="M537.6 217.6c49.46 0 89.6 40.14 89.6 89.6v25.6a38.4 38.4 0 0 1-76.8 0v-25.6a12.8 12.8 0 0 0-12.8-12.8H307.2a12.8 12.8 0 0 0-12.8 12.8v230.4c0 7.066 5.734 12.8 12.8 12.8h25.6a38.4 38.4 0 0 1 0 76.8h-25.6a89.6 89.6 0 0 1-89.6-89.6V307.2c0-49.46 40.14-89.6 89.6-89.6h230.4z" ></path></symbol><symbol id="icon-link" viewBox="0 0 1024 1024"><path d="M436.992 281.6a38.4 38.4 0 0 1 0 76.8 217.6 217.6 0 1 0 217.6 217.6 38.4 38.4 0 1 1 76.8 0 294.4 294.4 0 1 1-294.4-294.4z m385.28-102.4l3.8912 0.2048 0.6144 0.0512-4.5056-0.256a38.2464 38.2464 0 0 1 28.416 12.544l0.8704 1.024a38.5536 38.5536 0 0 1 2.0992 2.7136l-2.9696-3.7376a38.656 38.656 0 0 1 9.984 25.5488V473.6a38.4 38.4 0 1 1-76.8 0V304.4864l-399.616 364.1344a38.4 38.4 0 0 1-51.712-56.832L723.0464 256H566.272a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-unfold" viewBox="0 0 2048 1024"><path d="M565.248 78.131a76.8 76.8 0 0 1 108.544 0l362.086 361.984a25.6 25.6 0 0 0 36.25 0l361.984-361.984a76.8 76.8 0 0 1 108.544 108.544l-361.984 362.189a179.2 179.2 0 0 1-253.44 0L565.248 186.675a76.8 76.8 0 0 1 0-108.544z" ></path></symbol><symbol id="icon-rpc" viewBox="0 0 1024 1024"><path d="M204.8 678.4a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m168.96-573.44a268.8 268.8 0 0 1 207.872 439.245l38.144 38.144a192 192 0 1 1-55.603 53.094l-39.27-39.373A268.8 268.8 0 1 1 373.76 104.96zM204.8 755.2a64 64 0 1 0 0 128 64 64 0 0 0 0-128z m517.12-125.44a115.2 115.2 0 1 0 0 230.4 115.2 115.2 0 0 0 0-230.4z m-348.16-448a192 192 0 1 0 0 384 192 192 0 0 0 0-384zM819.2 64a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m0 76.8a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" ></path></symbol><symbol id="icon-mev" viewBox="0 0 1024 1024"><path d="M651.162 95.488c53.401 56.422 131.84 113.818 235.212 171.674a38.4 38.4 0 0 1 19.456 29.9c12.032 129.024-12.544 251.75-73.625 367.156-60.211 113.817-158.976 226.457-295.936 338.33a38.4 38.4 0 0 1-48.589 0C356.608 895.436 259.328 782.181 196.045 662.681c-64.103-121.19-90.266-243.405-77.824-365.876a38.4 38.4 0 0 1 20.531-30.259C239.923 214.323 319.846 156.98 378.624 94.925c104.96-110.95 169.37-108.442 272.538 0.512z m126.464 196.506l-1.178 0.819a41.933 41.933 0 0 1-10.035 3.84c-4.25 1.024-5.427 1.28-14.695 3.328a122.368 122.368 0 0 0-16.896 4.403c-43.878 16.384-71.168 47.411-83.097 96.666-2.304 9.625-3.328 20.838-3.687 38.4l-0.204 13.516v15.872l0.05 9.728v2.048l0.052 3.482c0.256 35.328 0.154 51.2-1.024 71.424-4.506 79.36-42.291 140.39-108.954 178.483-29.542 16.896-61.9 23.962-99.328 23.91h-8.704a9243.136 9243.136 0 0 0-29.286-0.153h-17.46l-10.034-0.051h-22.938c40.448 50.841 88.371 100.71 143.77 149.504l17.97 15.513 17.511-14.899c101.018-88.064 176.077-175.513 225.28-262.144l9.523-17.408c50.893-96.205 73.063-197.273 66.56-303.974l-3.584-2.407a1479.786 1479.786 0 0 1-49.664-29.9z m-171.52 5.12h-1.127c-15.155 0.102-30.054 3.584-45.107 10.598-46.285 21.504-77.056 71.373-76.39 128.051 0.307 25.703 0.256 51.354 0 87.603l-0.103 10.445c-0.102 14.49-0.512 24.371-1.74 34.816-4.865 42.803-19.661 79.77-43.674 110.285l-1.792 2.15 1.331 0.052h1.331c24.832 0 44.288-4.199 61.03-13.824 44.033-25.19 67.38-62.72 70.4-116.122 1.025-18.022 1.127-32.768 0.871-66.56v-5.478l-0.051-5.223v-21.504c0-5.12 0.051-9.728 0.153-14.49 0.512-22.681 1.895-38.604 5.837-54.937a225.075 225.075 0 0 1 35.687-79.514l4.71-6.246h-11.366z m1.484-136.295l-12.236-12.544c-73.728-77.926-87.245-78.438-160.973-0.563-60.467 63.898-139.674 122.112-237.466 174.95l-3.942 2.048-0.768 17.562c-2.407 88.064 18.176 176.384 61.952 265.42l9.779 19.047c9.267 17.51 19.354 34.919 30.26 52.224l-0.871 0.154c2.406-0.512 2.406-0.512 6.144-0.973 15.104-1.536 29.593-6.86 43.776-15.974 36.454-23.552 56.883-56.576 62.105-102.247 0.82-7.168 1.127-14.848 1.23-26.726l0.102-10.343c0.256-35.84 0.307-61.132 0-86.22-1.024-86.58 46.899-164.199 120.78-198.554a183.552 183.552 0 0 1 77.312-17.766h1.536l53.044 0.256h16.076a775.117 775.117 0 0 1-67.84-59.75z" ></path></symbol><symbol id="icon-caution" viewBox="0 0 1024 1024"><path d="M512 682.666667c-47.146667 0-85.333333-42.112-85.333333-94.037334V94.037333C426.666667 42.112 464.853333 0 512 0s85.333333 42.112 85.333333 94.037333v494.592C597.333333 640.554667 559.146667 682.666667 512 682.666667zM512 1024c-47.146667 0-85.333333-35.2-85.333333-78.592v-98.816C426.666667 803.2 464.853333 768 512 768s85.333333 35.2 85.333333 78.592v98.816C597.333333 988.8 559.146667 1024 512 1024z" ></path></symbol><symbol id="icon-settings" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0z m104.858 211.762a89.6 89.6 0 0 1 77.568 44.8l47.257 81.818a89.6 89.6 0 0 1 0 89.6l-47.257 81.818a89.6 89.6 0 0 1-77.568 44.8h-94.516a89.6 89.6 0 0 1-77.568-44.8L339.917 556.8a89.6 89.6 0 0 1 0-89.6l47.257-81.818a89.6 89.6 0 0 1 77.568-44.8h94.516z m0 76.8h-94.516a12.8 12.8 0 0 0-11.059 6.4L406.426 505.6a12.8 12.8 0 0 0 0 12.8l47.257 81.818a12.8 12.8 0 0 0 11.06 6.4h94.515a12.8 12.8 0 0 0 11.059-6.4l47.257-81.818a12.8 12.8 0 0 0 0-12.8l-47.257-81.818a12.8 12.8 0 0 0-11.06-6.4z" ></path></symbol><symbol id="icon-back" viewBox="0 0 1024 1024"><path d="M67.738 495.616l36.3 32.358 220.468 194.868c13.926 12.236 14.438 33.792 1.024 46.796l-0.41 0.41a31.898 31.898 0 0 1-44.288 0L20.736 518.554a31.744 31.744 0 0 1 0-45.773l260.096-251.597a31.898 31.898 0 0 1 44.288 0l0.46 0.41a31.846 31.846 0 0 1-1.023 46.848l-220.57 194.816-36.352 32.358z" ></path></symbol><symbol id="icon-wallet" viewBox="0 0 1024 1024"><path d="M825.6 115.2A134.4 134.4 0 0 1 960 249.6v384c0 60.877-40.448 112.282-95.949 128.82L864 785.868a140.8 140.8 0 0 1-179.456 135.373l-467.2-133.479A140.8 140.8 0 0 1 115.2 652.288V249.6a134.4 134.4 0 0 1 134.4-134.4h576zM256 225.331c-35.328 0-64 28.672-64 64V652.34c0 28.57 18.944 53.709 46.438 61.543l467.2 133.478a64 64 0 0 0 81.562-61.491v-47.616a38.502 38.502 0 0 1 0-17.306V422.861a64 64 0 0 0-46.438-61.543l-467.2-133.478A64 64 0 0 0 256 225.28zM825.6 192H427.827l334.029 95.437A140.8 140.8 0 0 1 864 422.86v253.645c11.776-10.548 19.2-25.856 19.2-42.906v-384c0-31.795-25.805-57.6-57.6-57.6z m-192 259.226a38.4 38.4 0 0 1 38.4 38.4V633.6a38.4 38.4 0 1 1-76.8 0V489.574a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-star" viewBox="0 0 1024 1024"><path d="M474.778 72.653a84.992 84.992 0 0 1 113.1 37.683l90.727 179.712c1.024 2.15 3.277 3.686 5.939 4.096l202.906 29.082c18.278 2.56 35.174 11.059 48.128 24.064a83.302 83.302 0 0 1-1.23 119.09l-148.12 142.542a6.605 6.605 0 0 0-2.049 5.939l34.765 195.584c3.277 18.483 0.154 37.58-8.806 54.17a85.043 85.043 0 0 1-114.176 34.457L515.84 804.659a8.55 8.55 0 0 0-7.885 0l-179.968 94.31c-16.589 8.705-35.635 11.674-54.118 8.5a83.968 83.968 0 0 1-68.813-97.28l34.97-195.328a6.605 6.605 0 0 0-2.048-5.94L89.702 466.484a83.61 83.61 0 0 1-24.832-48.128 83.968 83.968 0 0 1 71.732-95.078l204.339-29.184a7.834 7.834 0 0 0 5.939-4.096l89.395-179.251c8.192-16.59 21.76-29.952 38.503-38.093z m36.198 68.25l-2.56 0.767a7.475 7.475 0 0 0-3.43 3.328l-89.344 179.303c-12.39 24.832-36.301 41.933-63.847 45.875l-204.339 29.133c-4.352 0.614-7.168 4.198-6.605 7.885a6.81 6.81 0 0 0 2.048 3.89l148.275 142.49c20.173 19.354 29.338 47.36 24.423 74.804l-34.919 195.379c-0.665 3.584 1.946 7.27 6.247 8.038 1.894 0.307 3.789 0 5.427-0.819l179.968-94.31a85.35 85.35 0 0 1 79.155 0l180.173 94.361c3.994 2.1 9.011 0.615 10.957-3.02a6.4 6.4 0 0 0 0.717-4.199l-34.714-195.533a83.354 83.354 0 0 1 24.371-74.65l148.122-142.591a6.502 6.502 0 0 0 0.102-9.524 8.14 8.14 0 0 0-4.608-2.252l-202.957-29.082c-27.392-3.942-51.2-20.89-63.59-45.517l-90.726-179.712c-1.844-3.635-6.81-5.273-10.906-3.277l2.56-0.768z" ></path></symbol><symbol id="icon-trade" viewBox="0 0 1024 1024"><path d="M1002.93153 563.627l-433.237 432.64a67.243 67.243 0 0 1-29.696 21.93c-0.853 0.171-1.45 0.342-1.963 0.342a61.27 61.27 0 0 1-22.442 4.608c-1.11 0-2.304 0.853-3.414 0.853-2.048 0-3.84-1.365-5.973-1.365a54.87 54.87 0 0 1-13.653-2.987 77.312 77.312 0 0 1-15.275-6.144c-2.987-1.621-5.803-3.67-8.533-5.803-2.56-1.962-5.718-2.816-7.936-5.461L21.34153 563.627a71.68 71.68 0 0 1 0-102.059 72.704 72.704 0 0 1 102.57 0l316.16 315.477V73.472C440.07353 33.109 472.92753 0 513.29053 0a73.387 73.387 0 0 1 73.216 73.472v701.355L900.53153 461.653a72.363 72.363 0 0 1 102.4 102.059z" ></path></symbol><symbol id="icon-verticalslider" viewBox="0 0 1024 1024"><path d="M310.426 441.6a166.4 166.4 0 0 1 38.4 328.346V870.4a38.4 38.4 0 1 1-76.8 0V769.946a166.451 166.451 0 0 1 38.4-328.346z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z m403.2-403.2a38.4 38.4 0 0 1 38.4 38.4v55.654a166.451 166.451 0 0 1-38.4 328.346 166.4 166.4 0 0 1-38.4-328.346V153.6a38.4 38.4 0 0 1 38.4-38.4z m0 166.4a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2zM310.323 115.2a38.4 38.4 0 0 1 38.4 38.4v146.534a38.4 38.4 0 0 1-76.8 0V153.6a38.4 38.4 0 0 1 38.4-38.4z m403.2 525.26a38.4 38.4 0 0 1 38.4 38.4V870.4a38.4 38.4 0 1 1-76.8 0V678.86a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-swap" viewBox="0 0 1024 1024"><path d="M321.434 116.224a51.2 51.2 0 0 1 69.888 74.752c-47.77 44.646-87.04 81.818-117.658 111.462l-1.997 1.844h289.229a51.2 51.2 0 0 1 50.842 45.26l0.358 5.94a51.2 51.2 0 0 1-51.2 51.2H154.47a51.763 51.763 0 0 1-52.07-52.839c0.205-11.52 3.123-19.097 7.782-27.136 3.226-5.53 7.22-10.752 12.8-17.203 8.192-9.626 20.992-23.04 38.656-40.704a7171.584 7171.584 0 0 1 159.744-152.576z m509.593 188.058a51.2 51.2 0 0 1 0 102.4h-93.593a51.2 51.2 0 0 1 0-102.4h93.593zM663.194 853.709a51.2 51.2 0 0 1-69.888-74.803c47.77-44.647 87.04-81.818 117.657-111.412l2.048-1.894H153.6a51.2 51.2 0 0 1-50.842-45.21l-0.358-5.99a51.2 51.2 0 0 1 51.2-51.2h676.557c27.904 0 52.582 22.272 52.07 52.838a51.456 51.456 0 0 1-7.782 27.136c-3.226 5.53-7.22 10.752-12.8 17.204-8.192 9.625-20.992 23.04-38.656 40.704a7171.584 7171.584 0 0 1-159.744 152.627z" ></path></symbol><symbol id="icon-star_sel" viewBox="0 0 1024 1024"><path d="M470.63 127.846L381.286 307.2a46.182 46.182 0 0 1-34.918 24.986l-204.34 29.184a45.568 45.568 0 0 0-39.167 51.456 45.344 45.344 0 0 0 13.465 26.01l148.276 142.438c10.905 10.496 15.872 25.6 13.21 40.448l-34.97 195.328a45.568 45.568 0 0 0 37.58 52.633 46.95 46.95 0 0 0 29.748-4.659l179.968-94.31a46.95 46.95 0 0 1 43.52 0l180.121 94.361c22.528 11.827 50.586 3.43 62.618-18.688a44.8 44.8 0 0 0 4.71-29.184L746.394 621.62a45.005 45.005 0 0 1 13.21-40.294l148.12-142.592a44.902 44.902 0 0 0 0.666-64.256 46.54 46.54 0 0 0-26.368-13.21l-202.956-29.081a46.182 46.182 0 0 1-34.765-24.781l-90.727-179.712a46.592 46.592 0 0 0-82.944 0.205z" ></path></symbol><symbol id="icon-tips" viewBox="0 0 1024 1024"><path d="M512 166.4a345.6 345.6 0 1 1 0 691.2 345.6 345.6 0 0 1 0-691.2z m0 76.8a268.8 268.8 0 1 0 0 537.6 268.8 268.8 0 0 0 0-537.6z m0 196.3a38.4 38.4 0 0 1 38.4 38.4v219.29a38.4 38.4 0 1 1-76.8 0V477.9a38.4 38.4 0 0 1 38.4-38.4z m0-153.087a38.4 38.4 0 0 1 38.4 38.4v45.414a38.4 38.4 0 1 1-76.8 0v-45.363a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-sel" viewBox="0 0 1024 1024"><path d="M783.36 281.2416a51.2 51.2 0 0 1 71.68 73.0624l-407.9616 400.384a51.2 51.2 0 0 1-67.8912 3.4304l-206.3872-165.376a51.2 51.2 0 1 1 64-79.9232l170.9568 137.0112 375.6032-368.64z" ></path></symbol><symbol id="icon-spread" viewBox="0 0 1024 1024"><path d="M143.36 678.4a38.4 38.4 0 0 1 38.4 38.4v112.64c0 7.066 5.734 12.8 12.8 12.8H307.2a38.4 38.4 0 1 1 0 76.8H194.56a89.6 89.6 0 0 1-89.6-89.6V716.8a38.4 38.4 0 0 1 38.4-38.4z m327.68-573.44a38.4 38.4 0 0 1 0 76.8H234.342L842.24 790.477v-242.33a38.4 38.4 0 1 1 76.8 0V829.44a89.6 89.6 0 0 1-89.6 89.6H552.96a38.4 38.4 0 1 1 0-76.8l232.346-0.051L181.76 237.773V471.04a38.4 38.4 0 0 1-76.8 0V194.56c0-49.46 40.14-89.6 89.6-89.6h276.48z m358.4 0c49.46 0 89.6 40.14 89.6 89.6V307.2a38.4 38.4 0 1 1-76.8 0V194.56a12.8 12.8 0 0 0-12.8-12.8H716.8a38.4 38.4 0 1 1 0-76.8h112.64z" ></path></symbol><symbol id="icon-refresh" viewBox="0 0 1024 1024"><path d="M601.446 178.176a344.576 344.576 0 0 1 124.621 62.413 38.4 38.4 0 0 1 5.12 55.45l-94.566 107.878a38.4 38.4 0 1 1-57.754-50.586l65.741-75.11-4.915-2.816a268.646 268.646 0 0 0-43.008-18.535l-15.104-4.505A268.8 268.8 0 1 0 771.635 581.58a38.4 38.4 0 1 1 74.189 19.865 345.6 345.6 0 1 1-244.378-423.27z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M763.392 256.512a51.2 51.2 0 0 1 0 72.3968L582.2464 509.952l183.1424 183.1424a51.2 51.2 0 0 1-72.3968 72.3968l-183.1424-183.1424-180.992 181.0432a51.2 51.2 0 0 1-72.3968-72.3968L437.504 509.952 258.56 330.9568A51.2 51.2 0 0 1 330.9568 258.56L509.952 437.504l181.0432-180.992a51.2 51.2 0 0 1 72.3968 0z" ></path></symbol><symbol id="icon-alert" viewBox="0 0 1024 1024"><path d="M558.08 125.0816c12.6464 7.5776 23.1936 18.1248 30.72 30.72L959.232 773.12a89.6 89.6 0 0 1-76.8 135.68H141.6192a89.6 89.6 0 0 1-76.8-135.68L435.1488 155.8016a89.6 89.6 0 0 1 122.9312-30.72zM501.0432 195.328L130.6624 812.5952a12.8 12.8 0 0 0 10.9568 19.4048h740.7616a12.8 12.8 0 0 0 10.9568-19.4048L522.9568 195.328a12.8 12.8 0 0 0-21.9136 0zM512 524.8a38.4 38.4 0 0 1 38.4 38.4v153.6a38.4 38.4 0 1 1-76.8 0v-153.6a38.4 38.4 0 0 1 38.4-38.4z m0-204.8a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 1 1-76.8 0V358.4a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M572.33 707.67l220.673-220.673a85.333 85.333 0 0 0-60.331-145.664H291.328a85.333 85.333 0 0 0-60.33 145.664L451.668 707.67a85.333 85.333 0 0 0 120.662 0z" ></path></symbol></svg>',(e=>{var t=(r=(r=document.getElementsByTagName("script"))[r.length-1]).getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,s,o,a,c=function(f,h){h.parentNode.insertBefore(f,h)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch{}}n=function(){var f,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_4776227,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(f=document.body).firstChild?c(h,f.firstChild):f.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(s=n,o=e.document,a=!1,l(),o.onreadystatechange=function(){o.readyState=="complete"&&(o.onreadystatechange=null,u())})}function u(){a||(a=!0,s())}function l(){try{o.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);const _X="",xX="",SX="",EX="";function Fn(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const U3="1.18.0",z3="1.40.0",V3={"-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 lf extends Error{}class ff extends lf{constructor(t,r){super(t),this.code=r,this.type=V3[r]??"ServerError"}}class im extends lf{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var sm=e=>{throw TypeError(e)},df=(e,t,r)=>t.has(e)||sm("Cannot "+r),tr=(e,t,r)=>(df(e,t,"read from private field"),r?r.call(e):t.get(e)),_s=(e,t,r)=>t.has(e)?sm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),io=(e,t,r,n)=>(df(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),om=(e,t,r)=>(df(e,t,"access private method"),r),q3=(e,t,r,n)=>({set _(i){io(e,t,i,r)},get _(){return tr(e,t,n)}}),xs,pa,di,Ss,ma,so,Nc,am,cm;function G3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const W3={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class H3{constructor(t,r={}){if(_s(this,Nc),_s(this,xs,0),_s(this,pa,0),_s(this,di,null),_s(this,Ss,null),_s(this,ma,new Set),_s(this,so,new Map),this.endpoint=t,this.options={...W3,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=G3(this.endpoint))}async makeRequest(t,r){const n=await om(this,Nc,am).call(this);return new Promise((i,s)=>{io(this,xs,tr(this,xs)+1),tr(this,so).set(tr(this,xs),{resolve:i,reject:s,timeout:setTimeout(()=>{tr(this,so).delete(tr(this,xs)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:tr(this,xs),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new ff(i.message,i.code);return s})}async subscribe(t){const r=new K3(t);return tr(this,ma).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}xs=new WeakMap,pa=new WeakMap,di=new WeakMap,Ss=new WeakMap,ma=new WeakMap,so=new WeakMap,Nc=new WeakSet,am=function(){return tr(this,Ss)?tr(this,Ss):(io(this,Ss,new Promise(e=>{var t;(t=tr(this,di))==null||t.close(),io(this,di,new this.options.WebSocketConstructor(this.endpoint)),tr(this,di).addEventListener("open",()=>{io(this,pa,0),e(tr(this,di))}),tr(this,di).addEventListener("close",()=>{q3(this,pa)._++,tr(this,pa)<=this.options.maxReconnects&&setTimeout(()=>{om(this,Nc,cm).call(this)},this.options.reconnectTimeout)}),tr(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&&tr(this,so).has(n.id)){const{resolve:i,timeout:s}=tr(this,so).get(n.id);clearTimeout(s),i(n)}else if("params"in n){const{params:i}=n;tr(this,ma).forEach(s=>{s.subscriptionId===i.subscription&&i.subscription===s.subscriptionId&&s.onMessage(i.result)})}})})),tr(this,Ss))},cm=async function(){var e;return(e=tr(this,di))==null||e.close(),io(this,Ss,null),Promise.allSettled([...tr(this,ma)].map(t=>t.subscribe(this)))};class K3{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 um=e=>{throw TypeError(e)},hf=(e,t,r)=>t.has(e)||um("Cannot "+r),Zr=(e,t,r)=>(hf(e,t,"read from private field"),r?r.call(e):t.get(e)),Rc=(e,t,r)=>t.has(e)?um("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),pf=(e,t,r,n)=>(hf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),X3=(e,t,r)=>(hf(e,t,"access private method"),r),ga,pn,va,mf,lm;class fm{constructor(t){Rc(this,mf),Rc(this,ga,0),Rc(this,pn),Rc(this,va),pf(this,pn,t)}fetch(t,r){const n=Zr(this,pn).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;pf(this,ga,Zr(this,ga)+1);const r=await this.fetch(((i=Zr(this,pn).rpc)==null?void 0:i.url)??Zr(this,pn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":U3,"Client-Target-Api-Version":z3,"Client-Request-Method":t.method,...(s=Zr(this,pn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:Zr(this,ga),method:t.method,params:t.params})});if(!r.ok)throw new im(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new ff(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await X3(this,mf,lm).call(this).subscribe(t);return async()=>!!await r()}}ga=new WeakMap,pn=new WeakMap,va=new WeakMap,mf=new WeakSet,lm=function(){var e;if(!Zr(this,va)){const t=Zr(this,pn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");pf(this,va,new H3(((e=Zr(this,pn).websocket)==null?void 0:e.url)??Zr(this,pn).url,{WebSocketConstructor:t,...Zr(this,pn).websocket}))}return Zr(this,va)};function dm(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 J3(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,_=new Uint8Array(b);for(;h!==y;){let N=u[h],R=0;for(let F=b-1;(N!==0||R<f)&&F!==-1;F--,R++)N+=256*_[F]>>>0,_[F]=N%r>>>0,N=N/r>>>0;if(N!==0)throw new Error("Non-zero carry");f=R,h++}let A=b-f;for(;A!==b&&_[A]===0;)A++;let P=n.repeat(l);for(;A<b;++A)P+=e.charAt(_[A]);return P}function a(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let l=0,f=0,h=0;for(;u[l]===n;)f++,l++;const y=(u.length-l)*i+1>>>0,b=new Uint8Array(y);for(;u[l];){let N=t[u.charCodeAt(l)];if(N===255)return;let R=0;for(let F=y-1;(N!==0||R<h)&&F!==-1;F--,R++)N+=r*b[F]>>>0,b[F]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");h=R,l++}let _=y-h;for(;_!==y&&b[_]===0;)_++;const A=new Uint8Array(f+(y-_));let P=f;for(;_!==y;)A[P++]=b[_++];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 Y3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const hm=J3(Y3),oo=e=>hm.encode(e),hi=e=>hm.decode(e),Z3=oo,Q3=hi;function mn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const gf=8192;function qr(e){if(e.length<gf)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=gf){const n=e.slice(r,r+gf);t+=String.fromCharCode(...n)}return btoa(t)}const pm=qr,mm=mn;function ao(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 pi(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const gm=pi,vm=ao;function vf(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 eE(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 ym{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}=eE(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 bm(e,t){switch(t){case"base58":return oo(e);case"base64":return qr(e);case"hex":return pi(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function tE(e,t){switch(t){case"base58":return hi(e);case"base64":return mn(e);case"hex":return ao(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function yf(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 wm{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 bf(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return bf(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return bf(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return vf(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 bm(this.toBytes(),t)}}function bf(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 _m=e=>{throw TypeError(e)},xm=(e,t,r)=>t.has(e)||_m("Cannot "+r),gn=(e,t,r)=>(xm(e,t,"read from private field"),r?r.call(e):t.get(e)),Dc=(e,t,r)=>t.has(e)?_m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),$c=(e,t,r,n)=>(xm(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),co,ya,Bc,Vi;const rE=class k3{constructor(t){Dc(this,co),Dc(this,ya),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),$c(this,co,t.write),$c(this,ya,t.serialize??((r,n)=>{const i=new wm({initialSize:this.serializedSize(r)??void 0,...n});return gn(this,co).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),gn(this,co).call(this,t,r)}serialize(t,r){return this.validate(t),new Em(this,gn(this,ya).call(this,t,r))}parse(t){const r=new ym(t);return this.read(r)}fromHex(t){return this.parse(ao(t))}fromBase58(t){return this.parse(hi(t))}fromBase64(t){return this.parse(mn(t))}transform({name:t,input:r,output:n,validate:i}){return new k3({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>gn(this,co).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>gn(this,ya).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};co=new WeakMap,ya=new WeakMap;let Un=rE;const Sm=Symbol.for("@mysten/serialized-bcs");function nE(e){return!!e&&typeof e=="object"&&e[Sm]===!0}class Em{constructor(t,r){Dc(this,Bc),Dc(this,Vi),$c(this,Bc,t),$c(this,Vi,r)}get[Sm](){return!0}toBytes(){return gn(this,Vi)}toHex(){return pi(gn(this,Vi))}toBase64(){return qr(gn(this,Vi))}toBase58(){return oo(gn(this,Vi))}parse(){return gn(this,Bc).parse(gn(this,Vi))}}Bc=new WeakMap,Vi=new WeakMap;function Lc({size:e,...t}){return new Un({...t,serializedSize:()=>e})}function wf({readMethod:e,writeMethod:t,...r}){return Lc({...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 _f({readMethod:e,writeMethod:t,...r}){return Lc({...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 iE({serialize:e,...t}){const r=new Un({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function sE({toBytes:e,fromBytes:t,...r}){return new Un({...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=vf(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 oE(e){let t=null;function r(){return t||(t=e()),t}return new Un({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 wf({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return wf({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return wf({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return _f({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return _f({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return _f({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Lc({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 iE({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(vf(t)),...e})},bytes(e,t){return Lc({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 sE({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Un({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 Un({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 Un({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 Un({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 Un({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 oE(e)}},aE=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:ym,BcsType:Un,BcsWriter:wm,SerializedBcs:Em,bcs:G,decodeStr:tE,encodeStr:bm,fromB58:Q3,fromB64:mm,fromBase58:hi,fromBase64:mn,fromHEX:vm,fromHex:ao,isSerializedBcs:nE,splitGenericParameters:yf,toB58:Z3,toB64:pm,toBase58:oo,toBase64:qr,toHEX:gm,toHex:pi},Symbol.toStringTag,{value:"Module"})),cE=32;function xf(e){try{return hi(e).length===cE}catch{return!1}}const Fc=32;function mi(e){return lE(e)&&fE(e)===Fc}function ba(e){return mi(e)}function uE(e){return e.includes("::")?Sf(e):e}function Sf(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("<")?yf(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>uE(o.trim())):[];return{address:Br(t),module:r,name:i,typeParams:s}}function Cm(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Sf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Cm(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Br(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Fc*2,"0")}`}function gi(e,t=!1){return Br(e,t)}function lE(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function fE(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const dE=/^vector<(.+)>$/,hE=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let Mm=class la{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(dE);if(n)return{vector:la.parseFromStr(n[1],r)};const i=t.match(hE);if(i)return{struct:{address:r?Br(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:la.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return yf(t).map(n=>la.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<${la.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(la.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function pE(e){return G.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function mE(e){return G.enum("Option",{None:null,Some:e})}const er=G.bytes(Fc).transform({validate:e=>{const t=typeof e=="string"?e:pi(e);if(!t||!mi(Br(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?ao(Br(e)):e,output:e=>Br(pi(e))}),vn=G.vector(G.u8()).transform({name:"ObjectDigest",input:e=>hi(e),output:e=>oo(new Uint8Array(e)),validate:e=>{if(hi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Qr=G.struct("SuiObjectRef",{objectId:er,version:G.u64(),digest:vn}),Tm=G.struct("SharedObjectRef",{objectId:er,initialSharedVersion:G.u64(),mutable:G.bool()}),Am=G.enum("ObjectArg",{ImmOrOwnedObject:Qr,SharedObject:Tm,Receiving:Qr}),Om=G.enum("CallArg",{Pure:G.struct("Pure",{bytes:G.vector(G.u8()).transform({input:e=>typeof e=="string"?mn(e):e,output:e=>qr(new Uint8Array(e))})}),Object:Am}),Ef=G.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:G.lazy(()=>Ef),struct:G.lazy(()=>Rm),u16:null,u32:null,u256:null}),Cf=Ef.transform({input:e=>typeof e=="string"?Mm.parseFromStr(e,!0):e,output:e=>Mm.tagToString(e)}),zn=G.enum("Argument",{GasCoin:null,Input:G.u16(),Result:G.u16(),NestedResult:G.tuple([G.u16(),G.u16()])}),Im=G.struct("ProgrammableMoveCall",{package:er,module:G.string(),function:G.string(),typeArguments:G.vector(Cf),arguments:G.vector(zn)}),Pm=G.enum("Command",{MoveCall:Im,TransferObjects:G.struct("TransferObjects",{objects:G.vector(zn),address:zn}),SplitCoins:G.struct("SplitCoins",{coin:zn,amounts:G.vector(zn)}),MergeCoins:G.struct("MergeCoins",{destination:zn,sources:G.vector(zn)}),Publish:G.struct("Publish",{modules:G.vector(G.vector(G.u8()).transform({input:e=>typeof e=="string"?mn(e):e,output:e=>qr(new Uint8Array(e))})),dependencies:G.vector(er)}),MakeMoveVec:G.struct("MakeMoveVec",{type:mE(Cf).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:G.vector(zn)}),Upgrade:G.struct("Upgrade",{modules:G.vector(G.vector(G.u8()).transform({input:e=>typeof e=="string"?mn(e):e,output:e=>qr(new Uint8Array(e))})),dependencies:G.vector(er),package:er,ticket:zn})}),jm=G.struct("ProgrammableTransaction",{inputs:G.vector(Om),commands:G.vector(Pm)}),km=G.enum("TransactionKind",{ProgrammableTransaction:jm,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Nm=G.enum("TransactionExpiration",{None:null,Epoch:pE()}),Rm=G.struct("StructTag",{address:er,module:G.string(),name:G.string(),typeParams:G.vector(Ef)}),Dm=G.struct("GasData",{payment:G.vector(Qr),owner:er,price:G.u64(),budget:G.u64()}),$m=G.struct("TransactionDataV1",{kind:km,sender:er,gasData:Dm,expiration:Nm}),Bm=G.enum("TransactionData",{V1:$m}),Lm=G.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Fm=G.enum("IntentVersion",{V0:null}),Um=G.enum("AppId",{Sui:null}),zm=G.struct("Intent",{scope:Lm,version:Fm,appId:Um});function Vm(e){return G.struct(`IntentMessage<${e.name}>`,{intent:zm,value:e})}const qm=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())}),Gm=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())}),Wm=G.struct("MultiSigPkMap",{pubKey:Gm,weight:G.u8()}),Hm=G.struct("MultiSigPublicKey",{pk_map:G.vector(Wm),threshold:G.u16()}),gE=G.struct("MultiSig",{sigs:G.vector(qm),bitmap:G.u16(),multisig_pk:Hm}),vE=G.vector(G.u8()).transform({input:e=>typeof e=="string"?mn(e):e,output:e=>qr(new Uint8Array(e))}),Km=G.struct("SenderSignedTransaction",{intentMessage:Vm(Bm),txSignatures:G.vector(vE)}),yE=G.vector(Km,{name:"SenderSignedData"}),bE=G.struct("PasskeyAuthenticator",{authenticatorData:G.vector(G.u8()),clientDataJson:G.string(),userSignature:G.vector(G.u8())}),wE=G.enum("PackageUpgradeError",{UnableToFetchPackage:G.struct("UnableToFetchPackage",{packageId:er}),NotAPackage:G.struct("NotAPackage",{objectId:er}),IncompatibleUpgrade:null,DigestDoesNotMatch:G.struct("DigestDoesNotMatch",{digest:G.vector(G.u8())}),UnknownUpgradePolicy:G.struct("UnknownUpgradePolicy",{policy:G.u8()}),PackageIDDoesNotMatch:G.struct("PackageIDDoesNotMatch",{packageId:er,ticketId:er})}),_E=G.struct("ModuleId",{address:er,name:G.string()}),Xm=G.struct("MoveLocation",{module:_E,function:G.u16(),instruction:G.u16(),functionName:G.option(G.string())}),xE=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}),SE=G.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),EE=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:er}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:G.option(Xm),MoveAbort:G.tuple([Xm,G.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:G.struct("CommandArgumentError",{argIdx:G.u16(),kind:xE}),TypeArgumentError:G.struct("TypeArgumentError",{argumentIdx:G.u16(),kind:SE}),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:wE}),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(er)}),AddressDeniedForCoin:G.struct("AddressDeniedForCoin",{address:er,coinType:G.string()}),CoinTypeGlobalPause:G.struct("CoinTypeGlobalPause",{coinType:G.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Jm=G.enum("ExecutionStatus",{Success:null,Failed:G.struct("ExecutionFailed",{error:EE,command:G.option(G.u64())})}),Ym=G.struct("GasCostSummary",{computationCost:G.u64(),storageCost:G.u64(),storageRebate:G.u64(),nonRefundableStorageFee:G.u64()}),uo=G.enum("Owner",{AddressOwner:er,ObjectOwner:er,Shared:G.struct("Shared",{initialSharedVersion:G.u64()}),Immutable:null}),CE=G.struct("TransactionEffectsV1",{status:Jm,executedEpoch:G.u64(),gasUsed:Ym,modifiedAtVersions:G.vector(G.tuple([er,G.u64()])),sharedObjects:G.vector(Qr),transactionDigest:vn,created:G.vector(G.tuple([Qr,uo])),mutated:G.vector(G.tuple([Qr,uo])),unwrapped:G.vector(G.tuple([Qr,uo])),deleted:G.vector(Qr),unwrappedThenDeleted:G.vector(Qr),wrapped:G.vector(Qr),gasObject:G.tuple([Qr,uo]),eventsDigest:G.option(vn),dependencies:G.vector(vn)}),Mf=G.tuple([G.u64(),vn]),ME=G.enum("ObjectIn",{NotExist:null,Exist:G.tuple([Mf,uo])}),TE=G.enum("ObjectOut",{NotExist:null,ObjectWrite:G.tuple([vn,uo]),PackageWrite:Mf}),AE=G.enum("IDOperation",{None:null,Created:null,Deleted:null}),OE=G.struct("EffectsObjectChange",{inputState:ME,outputState:TE,idOperation:AE}),IE=G.enum("UnchangedSharedKind",{ReadOnlyRoot:Mf,MutateDeleted:G.u64(),ReadDeleted:G.u64(),Cancelled:G.u64(),PerEpochConfig:null}),PE=G.struct("TransactionEffectsV2",{status:Jm,executedEpoch:G.u64(),gasUsed:Ym,transactionDigest:vn,gasObjectIndex:G.option(G.u32()),eventsDigest:G.option(vn),dependencies:G.vector(vn),lamportVersion:G.u64(),changedObjects:G.vector(G.tuple([er,OE])),unchangedSharedObjects:G.vector(G.tuple([er,IE])),auxDataDigest:G.option(vn)}),jE=G.enum("TransactionEffects",{V1:CE,V2:PE}),Tf={...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:er,AppId:Um,Argument:zn,CallArg:Om,CompressedSignature:qm,GasData:Dm,Intent:zm,IntentMessage:Vm,IntentScope:Lm,IntentVersion:Fm,MultiSig:gE,MultiSigPkMap:Wm,MultiSigPublicKey:Hm,ObjectArg:Am,ObjectDigest:vn,ProgrammableMoveCall:Im,ProgrammableTransaction:jm,PublicKey:Gm,SenderSignedData:yE,SenderSignedTransaction:Km,SharedObjectRef:Tm,StructTag:Rm,SuiObjectRef:Qr,Command:Pm,TransactionData:Bm,TransactionDataV1:$m,TransactionExpiration:Nm,TransactionKind:km,TypeTag:Cf,TransactionEffects:jE,PasskeyAuthenticator:bE},Zm="…";function kE(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${Zm}${e.slice(-4)}`}function NE(e){return`${e.slice(0,10)}${Zm}`}const Qm=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,eg=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,RE=235;function tg(e){return e.length>RE?!1:e.includes("@")?Qm.test(e):eg.test(e)}function rg(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!Qm.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!eg.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 DE=9,$E=BigInt(1e9),BE="0x1",ng="0x2",LE="0x3",FE=gi("0x6"),UE="sui_system",Af=`${ng}::sui::SUI`,zE=gi("0x5"),VE=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,qE=/^\d+$/,GE=64,ig="/",sg=e=>{const t=e.split(ig);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!qE.test(i)||!tg(r)?!1:VE.test(n)&&n.length<GE},WE=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(ig)&&!sg(r))return!1;return!0};function Of(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function HE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function og(e,...t){if(!HE(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 ag(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 KE(e,t){og(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 Uc=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Es=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),cg=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,vi=Es?e=>e:e=>cg(e);function lo(e){for(let t=0;t<e.length;t++)e[t]=cg(e[t])}function XE(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=XE(e)),og(e),e}let JE=class{clone(){return this._cloneInto()}};function YE(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 ZE=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 QE extends JE{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,Of(t),Of(r),Of(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=Uc(this.buffer)}update(t){ag(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&&(Es||lo(i),this.compress(i,0,!1),Es||lo(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));Es||lo(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);Es||lo(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){ag(this),KE(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),Es||lo(n),this.compress(n,0,!0),Es||lo(n);const i=Uc(t);this.get().forEach((s,o)=>i[o]=vi(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 zc=BigInt(2**32-1),If=BigInt(32);function ug(e,t=!1){return t?{h:Number(e&zc),l:Number(e>>If&zc)}:{h:Number(e>>If&zc)|0,l:Number(e&zc)|0}}function eC(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}=ug(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const tC=(e,t)=>BigInt(e>>>0)<<If|BigInt(t>>>0),rC=(e,t,r)=>e>>>r,nC=(e,t,r)=>e<<32-r|t>>>r,iC=(e,t,r)=>e>>>r|t<<32-r,sC=(e,t,r)=>e<<32-r|t>>>r,oC=(e,t,r)=>e<<64-r|t>>>r-32,aC=(e,t,r)=>e>>>r-32|t<<64-r,cC=(e,t)=>t,uC=(e,t)=>e,lC=(e,t,r)=>e<<r|t>>>32-r,fC=(e,t,r)=>t<<r|e>>>32-r,dC=(e,t,r)=>t<<r-32|e>>>64-r,hC=(e,t,r)=>e<<r-32|t>>>64-r;function pC(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const kr={fromBig:ug,split:eC,toBig:tC,shrSH:rC,shrSL:nC,rotrSH:iC,rotrSL:sC,rotrBH:oC,rotrBL:aC,rotr32H:cC,rotr32L:uC,rotlSH:lC,rotlSL:fC,rotlBH:dC,rotlBL:hC,add:pC,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},fr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Pe=new Uint32Array(32);function qi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],_=Pe[2*n+1],A=kr.add3L(c,l,o);u=kr.add3H(A,u,f,a),c=A|0,{Dh:_,Dl:b}={Dh:_^u,Dl:b^c},{Dh:_,Dl:b}={Dh:kr.rotr32H(_,b),Dl:kr.rotr32L(_,b)},{h:y,l:h}=kr.add(y,h,_,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:kr.rotrSH(f,l,24),Bl:kr.rotrSL(f,l,24)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=_}function Gi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],_=Pe[2*n+1],A=kr.add3L(c,l,o);u=kr.add3H(A,u,f,a),c=A|0,{Dh:_,Dl:b}={Dh:_^u,Dl:b^c},{Dh:_,Dl:b}={Dh:kr.rotrSH(_,b,16),Dl:kr.rotrSL(_,b,16)},{h:y,l:h}=kr.add(y,h,_,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:kr.rotrBH(f,l,63),Bl:kr.rotrBL(f,l,63)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=_}class lg extends QE{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=fr[0]|0,this.v0h=fr[1]|0,this.v1l=fr[2]|0,this.v1h=fr[3]|0,this.v2l=fr[4]|0,this.v2h=fr[5]|0,this.v3l=fr[6]|0,this.v3h=fr[7]|0,this.v4l=fr[8]|0,this.v4h=fr[9]|0,this.v5l=fr[10]|0,this.v5h=fr[11]|0,this.v6l=fr[12]|0,this.v6h=fr[13]|0,this.v7l=fr[14]|0,this.v7h=fr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=Uc(wa(t.salt));this.v4l^=vi(n[0]),this.v4h^=vi(n[1]),this.v5l^=vi(n[2]),this.v5h^=vi(n[3])}if(t.personalization){const n=Uc(wa(t.personalization));this.v6l^=vi(n[0]),this.v6h^=vi(n[1]),this.v7l^=vi(n[2]),this.v7h^=vi(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:b,v7l:_,v7h:A}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,_,A]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,_,A){this.v0l=t|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=f|0,this.v5h=h|0,this.v6l=y|0,this.v6h=b|0,this.v7l=_|0,this.v7h=A|0}compress(t,r,n){this.get().forEach((c,u)=>Pe[u]=c),Pe.set(fr,16);let{h:i,l:s}=kr.fromBig(BigInt(this.length));Pe[24]=fr[8]^s,Pe[25]=fr[9]^i,n&&(Pe[28]=~Pe[28],Pe[29]=~Pe[29]);let o=0;const a=ZE;for(let c=0;c<12;c++)qi(0,4,8,12,t,r+2*a[o++]),Gi(0,4,8,12,t,r+2*a[o++]),qi(1,5,9,13,t,r+2*a[o++]),Gi(1,5,9,13,t,r+2*a[o++]),qi(2,6,10,14,t,r+2*a[o++]),Gi(2,6,10,14,t,r+2*a[o++]),qi(3,7,11,15,t,r+2*a[o++]),Gi(3,7,11,15,t,r+2*a[o++]),qi(0,5,10,15,t,r+2*a[o++]),Gi(0,5,10,15,t,r+2*a[o++]),qi(1,6,11,12,t,r+2*a[o++]),Gi(1,6,11,12,t,r+2*a[o++]),qi(2,7,8,13,t,r+2*a[o++]),Gi(2,7,8,13,t,r+2*a[o++]),qi(3,4,9,14,t,r+2*a[o++]),Gi(3,4,9,14,t,r+2*a[o++]);this.v0l^=Pe[0]^Pe[16],this.v0h^=Pe[1]^Pe[17],this.v1l^=Pe[2]^Pe[18],this.v1h^=Pe[3]^Pe[19],this.v2l^=Pe[4]^Pe[20],this.v2h^=Pe[5]^Pe[21],this.v3l^=Pe[6]^Pe[22],this.v3h^=Pe[7]^Pe[23],this.v4l^=Pe[8]^Pe[24],this.v4h^=Pe[9]^Pe[25],this.v5l^=Pe[10]^Pe[26],this.v5h^=Pe[11]^Pe[27],this.v6l^=Pe[12]^Pe[28],this.v6h^=Pe[13]^Pe[29],this.v7l^=Pe[14]^Pe[30],this.v7h^=Pe[15]^Pe[31],Pe.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const fg=YE(e=>new lg(e)),mC=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:lg,blake2b:fg},Symbol.toStringTag,{value:"Module"}));function gC(e,t,r){const n=Tf.Address.serialize(e).toBytes(),i=Tf.TypeTag.serialize(t).toBytes(),s=Tf.u64().serialize(r.length).toBytes(),o=fg.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${pi(o.digest().slice(0,32))}`}const vC=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:$E,MOVE_STDLIB_ADDRESS:BE,SUI_ADDRESS_LENGTH:Fc,SUI_CLOCK_OBJECT_ID:FE,SUI_DECIMALS:DE,SUI_FRAMEWORK_ADDRESS:ng,SUI_SYSTEM_ADDRESS:LE,SUI_SYSTEM_MODULE_NAME:UE,SUI_SYSTEM_STATE_OBJECT_ID:zE,SUI_TYPE_ARG:Af,deriveDynamicFieldID:gC,formatAddress:kE,formatDigest:NE,fromB64:mm,fromBase58:hi,fromBase64:mn,fromHEX:vm,fromHex:ao,isValidNamedPackage:sg,isValidNamedType:WE,isValidSuiAddress:mi,isValidSuiNSName:tg,isValidSuiObjectId:ba,isValidTransactionDigest:xf,normalizeStructTag:Cm,normalizeSuiAddress:Br,normalizeSuiNSName:rg,normalizeSuiObjectId:gi,parseStructTag:Sf,toB64:pm,toBase58:oo,toBase64:qr,toHEX:gm,toHex:pi},Symbol.toStringTag,{value:"Module"}));var Pf=Object.defineProperty,yC=Object.getOwnPropertyDescriptor,bC=Object.getOwnPropertyNames,wC=Object.prototype.hasOwnProperty,_C=(e,t)=>{for(var r in t)Pf(e,r,{get:t[r],enumerable:!0})},xC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bC(t))!wC.call(e,i)&&i!==r&&Pf(e,i,{get:()=>t[i],enumerable:!(n=yC(t,i))||n.enumerable});return e},SC=e=>xC(Pf({},"__esModule",{value:!0}),e),dg={};_C(dg,{BIC_REGEX:()=>pg,CUID2_REGEX:()=>mg,DECIMAL_REGEX:()=>gg,EMAIL_REGEX:()=>vg,EMOJI_REGEX:()=>yg,HEXADECIMAL_REGEX:()=>bg,HEX_COLOR_REGEX:()=>wg,IMEI_REGEX:()=>_g,IPV4_REGEX:()=>xg,IPV6_REGEX:()=>Sg,IP_REGEX:()=>Eg,ISO_DATE_REGEX:()=>Cg,ISO_DATE_TIME_REGEX:()=>Mg,ISO_TIMESTAMP_REGEX:()=>Og,ISO_TIME_REGEX:()=>Tg,ISO_TIME_SECOND_REGEX:()=>Ag,ISO_WEEK_REGEX:()=>Ig,MAC48_REGEX:()=>Pg,MAC64_REGEX:()=>jg,MAC_REGEX:()=>kg,OCTAL_REGEX:()=>Ng,ULID_REGEX:()=>Rg,UUID_REGEX:()=>Dg,ValiError:()=>Vc,_addIssue:()=>le,_isLuhnAlgo:()=>jf,_isValidObjectKey:()=>Cs,_stringify:()=>Nr,any:()=>g1,array:()=>v1,arrayAsync:()=>y1,awaitAsync:()=>hg,bic:()=>Ug,bigint:()=>b1,blob:()=>w1,boolean:()=>_1,brand:()=>zg,bytes:()=>Vg,check:()=>qg,checkAsync:()=>Gg,checkItems:()=>Wg,config:()=>UC,creditCard:()=>Hg,cuid2:()=>Kg,custom:()=>x1,customAsync:()=>S1,date:()=>E1,decimal:()=>Xg,deleteGlobalConfig:()=>CC,deleteGlobalMessage:()=>TC,deleteSchemaMessage:()=>OC,deleteSpecificMessage:()=>PC,email:()=>Jg,emoji:()=>Yg,empty:()=>Zg,endsWith:()=>Qg,entriesFromList:()=>kC,enum:()=>$f,enum_:()=>$f,everyItem:()=>ev,excludes:()=>tv,fallback:()=>zC,fallbackAsync:()=>VC,file:()=>C1,filterItems:()=>rv,findItem:()=>nv,finite:()=>iv,flatten:()=>qC,forward:()=>GC,forwardAsync:()=>WC,function:()=>Bf,function_:()=>Bf,getDefault:()=>wi,getDefaults:()=>kf,getDefaultsAsync:()=>Nf,getDotPath:()=>Fg,getFallback:()=>xa,getFallbacks:()=>Rf,getFallbacksAsync:()=>Df,getGlobalConfig:()=>_a,getGlobalMessage:()=>$g,getSchemaMessage:()=>Bg,getSpecificMessage:()=>Lg,hash:()=>sv,hexColor:()=>av,hexadecimal:()=>ov,imei:()=>cv,includes:()=>uv,instance:()=>M1,integer:()=>lv,intersect:()=>T1,intersectAsync:()=>A1,ip:()=>fv,ipv4:()=>dv,ipv6:()=>hv,is:()=>HC,isOfKind:()=>NC,isOfType:()=>RC,isValiError:()=>DC,isoDate:()=>pv,isoDateTime:()=>mv,isoTime:()=>gv,isoTimeSecond:()=>vv,isoTimestamp:()=>yv,isoWeek:()=>bv,keyof:()=>KC,lazy:()=>O1,lazyAsync:()=>I1,length:()=>wv,literal:()=>P1,looseObject:()=>j1,looseObjectAsync:()=>k1,looseTuple:()=>N1,looseTupleAsync:()=>R1,mac:()=>_v,mac48:()=>xv,mac64:()=>Sv,map:()=>D1,mapAsync:()=>$1,mapItems:()=>Ev,maxBytes:()=>Cv,maxLength:()=>Mv,maxSize:()=>Tv,maxValue:()=>Av,mimeType:()=>Ov,minBytes:()=>Iv,minLength:()=>Pv,minSize:()=>jv,minValue:()=>kv,multipleOf:()=>Nv,nan:()=>B1,never:()=>L1,nonEmpty:()=>Rv,nonNullable:()=>F1,nonNullableAsync:()=>U1,nonNullish:()=>z1,nonNullishAsync:()=>V1,nonOptional:()=>Lf,nonOptionalAsync:()=>Ff,normalize:()=>Dv,notBytes:()=>$v,notLength:()=>Bv,notSize:()=>Lv,notValue:()=>Fv,null:()=>Uf,null_:()=>Uf,nullable:()=>q1,nullableAsync:()=>G1,nullish:()=>W1,nullishAsync:()=>H1,number:()=>K1,object:()=>X1,objectAsync:()=>J1,objectWithRest:()=>Y1,objectWithRestAsync:()=>Z1,octal:()=>Uv,omit:()=>XC,optional:()=>zf,optionalAsync:()=>Vf,parse:()=>by,parseAsync:()=>wy,parser:()=>JC,parserAsync:()=>YC,partial:()=>ZC,partialAsync:()=>QC,partialCheck:()=>Vv,partialCheckAsync:()=>qv,pick:()=>eM,picklist:()=>qf,pipe:()=>tM,pipeAsync:()=>rM,promise:()=>Q1,rawCheck:()=>Gv,rawCheckAsync:()=>Wv,rawTransform:()=>Hv,rawTransformAsync:()=>Kv,readonly:()=>Xv,record:()=>ey,recordAsync:()=>ty,reduceItems:()=>Jv,regex:()=>Yv,required:()=>nM,requiredAsync:()=>iM,safeInteger:()=>Zv,safeParse:()=>_y,safeParseAsync:()=>xy,safeParser:()=>sM,safeParserAsync:()=>oM,set:()=>ry,setAsync:()=>ny,setGlobalConfig:()=>EC,setGlobalMessage:()=>MC,setSchemaMessage:()=>AC,setSpecificMessage:()=>IC,size:()=>Qv,someItem:()=>e1,sortItems:()=>t1,startsWith:()=>r1,strictObject:()=>iy,strictObjectAsync:()=>sy,strictTuple:()=>oy,strictTupleAsync:()=>ay,string:()=>cy,symbol:()=>uy,toLowerCase:()=>n1,toMaxValue:()=>i1,toMinValue:()=>s1,toUpperCase:()=>o1,transform:()=>a1,transformAsync:()=>c1,trim:()=>u1,trimEnd:()=>l1,trimStart:()=>f1,tuple:()=>ly,tupleAsync:()=>fy,tupleWithRest:()=>dy,tupleWithRestAsync:()=>hy,ulid:()=>d1,undefined:()=>Gf,undefined_:()=>Gf,union:()=>py,unionAsync:()=>my,unknown:()=>gy,unwrap:()=>aM,url:()=>h1,uuid:()=>p1,value:()=>m1,variant:()=>vy,variantAsync:()=>yy,void:()=>Hf,void_:()=>Hf});var Wi=SC(dg);function hg(){return{kind:"transformation",type:"await",reference:hg,async:!0,async _run(e){return e.value=await e.value,e}}}var pg=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,mg=/^[a-z][\da-z]*$/u,gg=/^\d+$/u,vg=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,yg=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,bg=/^(?:0h|0x)?[\da-f]+$/iu,wg=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,_g=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,xg=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,Sg=/^(?:(?:[\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,Eg=/^(?:(?:[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,Cg=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,Mg=/^\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,Tg=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,Ag=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,Og=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z|[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u,Ig=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,Pg=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,jg=/^(?:[\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,kg=/^(?:[\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,Ng=/^(?:0o)?[0-7]+$/iu,Rg=/^[\da-hjkmnp-tv-z]{26}$/iu,Dg=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,en;function EC(e){en={...en,...e}}function _a(e){return{lang:(e==null?void 0:e.lang)??(en==null?void 0:en.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(en==null?void 0:en.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(en==null?void 0:en.abortPipeEarly)}}function CC(){en=void 0}var yi;function MC(e,t){yi||(yi=new Map),yi.set(t,e)}function $g(e){return yi==null?void 0:yi.get(e)}function TC(e){yi==null||yi.delete(e)}var bi;function AC(e,t){bi||(bi=new Map),bi.set(t,e)}function Bg(e){return bi==null?void 0:bi.get(e)}function OC(e){bi==null||bi.delete(e)}var yn;function IC(e,t,r){yn||(yn=new Map),yn.get(e)||yn.set(e,new Map),yn.get(e).set(r,t)}function Lg(e,t){var r;return(r=yn==null?void 0:yn.get(e))==null?void 0:r.get(t)}function PC(e,t){var r;(r=yn==null?void 0:yn.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 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)??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??Lg(e.reference,c.lang)??(u?Bg(c.lang):null)??n.message??$g(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 jC=/\D/gu;function jf(e){const t=e.replace(jC,"");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 Cs(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function kC(e,t){const r={};for(const n of e)r[n]=t;return r}function Fg(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 NC(e,t){return t.kind===e}function RC(e,t){return t.type===e}function DC(e){return e instanceof Vc}var Vc=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function Ug(e){return{kind:"validation",type:"bic",reference:Ug,async:!1,expects:null,requirement:pg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function zg(e){return{kind:"transformation",type:"brand",reference:zg,async:!1,name:e,_run(t){return t}}}function Vg(e,t){return{kind:"validation",type:"bytes",reference:Vg,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 qg(e,t){return{kind:"validation",type:"check",reference:qg,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 Gg(e,t){return{kind:"validation",type:"check",reference:Gg,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 Wg(e,t){return{kind:"validation",type:"check_items",reference:Wg,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 $C=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,BC=/[- ]/gu,LC=[/^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 Hg(e){return{kind:"validation",type:"credit_card",reference:Hg,async:!1,expects:null,requirement(t){let r;return $C.test(t)&&(r=t.replace(BC,""))&&LC.some(n=>n.test(r))&&jf(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function Kg(e){return{kind:"validation",type:"cuid2",reference:Kg,async:!1,expects:null,requirement:mg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function Xg(e){return{kind:"validation",type:"decimal",reference:Xg,async:!1,expects:null,requirement:gg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function Jg(e){return{kind:"validation",type:"email",reference:Jg,expects:null,async:!1,requirement:vg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function Yg(e){return{kind:"validation",type:"emoji",reference:Yg,async:!1,expects:null,requirement:yg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function Zg(e){return{kind:"validation",type:"empty",reference:Zg,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 Qg(e,t){return{kind:"validation",type:"ends_with",reference:Qg,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 ev(e,t){return{kind:"validation",type:"every_item",reference:ev,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 tv(e,t){const r=Nr(e);return{kind:"validation",type:"excludes",reference:tv,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 rv(e){return{kind:"transformation",type:"filter_items",reference:rv,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function nv(e){return{kind:"transformation",type:"find_item",reference:nv,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function iv(e){return{kind:"validation",type:"finite",reference:iv,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 FC={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 sv(e,t){return{kind:"validation",type:"hash",reference:sv,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${FC[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function ov(e){return{kind:"validation",type:"hexadecimal",reference:ov,async:!1,expects:null,requirement:bg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function av(e){return{kind:"validation",type:"hex_color",reference:av,async:!1,expects:null,requirement:wg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function cv(e){return{kind:"validation",type:"imei",reference:cv,async:!1,expects:null,requirement(t){return _g.test(t)&&jf(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function uv(e,t){const r=Nr(e);return{kind:"validation",type:"includes",reference:uv,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 lv(e){return{kind:"validation",type:"integer",reference:lv,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 fv(e){return{kind:"validation",type:"ip",reference:fv,async:!1,expects:null,requirement:Eg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function dv(e){return{kind:"validation",type:"ipv4",reference:dv,async:!1,expects:null,requirement:xg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function hv(e){return{kind:"validation",type:"ipv6",reference:hv,async:!1,expects:null,requirement:Sg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function pv(e){return{kind:"validation",type:"iso_date",reference:pv,async:!1,expects:null,requirement:Cg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function mv(e){return{kind:"validation",type:"iso_date_time",reference:mv,async:!1,expects:null,requirement:Mg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function gv(e){return{kind:"validation",type:"iso_time",reference:gv,async:!1,expects:null,requirement:Tg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function vv(e){return{kind:"validation",type:"iso_time_second",reference:vv,async:!1,expects:null,requirement:Ag,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function yv(e){return{kind:"validation",type:"iso_timestamp",reference:yv,async:!1,expects:null,requirement:Og,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function bv(e){return{kind:"validation",type:"iso_week",reference:bv,async:!1,expects:null,requirement:Ig,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function wv(e,t){return{kind:"validation",type:"length",reference:wv,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 _v(e){return{kind:"validation",type:"mac",reference:_v,async:!1,expects:null,requirement:kg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function xv(e){return{kind:"validation",type:"mac48",reference:xv,async:!1,expects:null,requirement:Pg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function Sv(e){return{kind:"validation",type:"mac64",reference:Sv,async:!1,expects:null,requirement:jg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function Ev(e){return{kind:"transformation",type:"map_items",reference:Ev,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function Cv(e,t){return{kind:"validation",type:"max_bytes",reference:Cv,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 Mv(e,t){return{kind:"validation",type:"max_length",reference:Mv,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 Tv(e,t){return{kind:"validation",type:"max_size",reference:Tv,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 Av(e,t){return{kind:"validation",type:"max_value",reference:Av,async:!1,expects:`<=${e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function Ov(e,t){return{kind:"validation",type:"mime_type",reference:Ov,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 Iv(e,t){return{kind:"validation",type:"min_bytes",reference:Iv,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 Pv(e,t){return{kind:"validation",type:"min_length",reference:Pv,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 jv(e,t){return{kind:"validation",type:"min_size",reference:jv,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 kv(e,t){return{kind:"validation",type:"min_value",reference:kv,async:!1,expects:`>=${e instanceof Date?e.toJSON():Nr(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():Nr(r.value)}),r}}}function Nv(e,t){return{kind:"validation",type:"multiple_of",reference:Nv,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 Rv(e){return{kind:"validation",type:"non_empty",reference:Rv,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 Dv(e){return{kind:"transformation",type:"normalize",reference:Dv,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function $v(e,t){return{kind:"validation",type:"not_bytes",reference:$v,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 Bv(e,t){return{kind:"validation",type:"not_length",reference:Bv,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 Lv(e,t){return{kind:"validation",type:"not_size",reference:Lv,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 Fv(e,t){return{kind:"validation",type:"not_value",reference:Fv,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&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Nr(r.value)}),r}}}function Uv(e){return{kind:"validation",type:"octal",reference:Uv,async:!1,expects:null,requirement:Ng,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function zv(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 Vv(e,t,r){return{kind:"validation",type:"partial_check",reference:Vv,async:!1,expects:null,requirement:t,message:r,_run(n,i){return zv(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function qv(e,t,r){return{kind:"validation",type:"partial_check",reference:qv,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return zv(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Gv(e){return{kind:"validation",type:"raw_check",reference:Gv,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 Wv(e){return{kind:"validation",type:"raw_check",reference:Wv,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 Hv(e){return{kind:"transformation",type:"raw_transform",reference:Hv,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 Kv(e){return{kind:"transformation",type:"raw_transform",reference:Kv,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 Xv(){return{kind:"transformation",type:"readonly",reference:Xv,async:!1,_run(e){return e}}}function Jv(e,t){return{kind:"transformation",type:"reduce_items",reference:Jv,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function Yv(e,t){return{kind:"validation",type:"regex",reference:Yv,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 Zv(e){return{kind:"validation",type:"safe_integer",reference:Zv,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 Qv(e,t){return{kind:"validation",type:"size",reference:Qv,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 e1(e,t){return{kind:"validation",type:"some_item",reference:e1,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 t1(e){return{kind:"transformation",type:"sort_items",reference:t1,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function r1(e,t){return{kind:"validation",type:"starts_with",reference:r1,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 n1(){return{kind:"transformation",type:"to_lower_case",reference:n1,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function i1(e){return{kind:"transformation",type:"to_max_value",reference:i1,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function s1(e){return{kind:"transformation",type:"to_min_value",reference:s1,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function o1(){return{kind:"transformation",type:"to_upper_case",reference:o1,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function a1(e){return{kind:"transformation",type:"transform",reference:a1,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function c1(e){return{kind:"transformation",type:"transform",reference:c1,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function u1(){return{kind:"transformation",type:"trim",reference:u1,async:!1,_run(e){return e.value=e.value.trim(),e}}}function l1(){return{kind:"transformation",type:"trim_end",reference:l1,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function f1(){return{kind:"transformation",type:"trim_start",reference:f1,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function d1(e){return{kind:"validation",type:"ulid",reference:d1,async:!1,expects:null,requirement:Rg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function h1(e){return{kind:"validation",type:"url",reference:h1,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 p1(e){return{kind:"validation",type:"uuid",reference:p1,async:!1,expects:null,requirement:Dg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function m1(e,t){return{kind:"validation",type:"value",reference:m1,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)&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Nr(r.value)}),r}}}function UC(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function xa(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function zC(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:xa(this,r,n)}:r}}}function VC(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await xa(this,r,n)}:r}}}function qC(e){const t={};for(const r of e)if(r.path){const n=Fg(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 GC(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 WC(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 wi(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function kf(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=kf(e.entries[r]);return t}return"items"in e?e.items.map(kf):wi(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)):wi(e)}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):xa(e)}async function Df(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Df(r)]))):"items"in e?Promise.all(e.items.map(Df)):xa(e)}function HC(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function g1(){return{kind:"schema",type:"any",reference:g1,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function v1(e,t){return{kind:"schema",type:"array",reference:v1,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 y1(e,t){return{kind:"schema",type:"array",reference:y1,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 b1(e){return{kind:"schema",type:"bigint",reference:b1,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function w1(e){return{kind:"schema",type:"blob",reference:w1,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function _1(e){return{kind:"schema",type:"boolean",reference:_1,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function x1(e,t){return{kind:"schema",type:"custom",reference:x1,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 S1(e,t){return{kind:"schema",type:"custom",reference:S1,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 E1(e){return{kind:"schema",type:"date",reference:E1,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 $f(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:$f,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:le(this,"type",n,i),n}}}function C1(e){return{kind:"schema",type:"file",reference:C1,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function Bf(e){return{kind:"schema",type:"function",reference:Bf,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function M1(e,t){return{kind:"schema",type:"instance",reference:M1,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 qc(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=qc(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=qc(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function T1(e,t){return{kind:"schema",type:"intersect",reference:T1,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=qc(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 A1(e,t){return{kind:"schema",type:"intersect",reference:A1,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=qc(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 O1(e){return{kind:"schema",type:"lazy",reference:O1,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function I1(e){return{kind:"schema",type:"lazy",reference:I1,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function P1(e,t){return{kind:"schema",type:"literal",reference:P1,expects:Nr(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 j1(e,t){return{kind:"schema",type:"loose_object",reference:j1,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)Cs(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function k1(e,t){return{kind:"schema",type:"loose_object",reference:k1,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)Cs(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function N1(e,t){return{kind:"schema",type:"loose_tuple",reference:N1,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 R1(e,t){return{kind:"schema",type:"loose_tuple",reference:R1,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 D1(e,t,r){return{kind:"schema",type:"map",reference:D1,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 $1(e,t,r){return{kind:"schema",type:"map",reference:$1,expects:"Map",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;const c=await Promise.all([...s].map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"map",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"map",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),n.value.set(f.value,h.value)}}else le(this,"type",n,i);return n}}}function B1(e){return{kind:"schema",type:"nan",reference:B1,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function L1(e){return{kind:"schema",type:"never",reference:L1,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function F1(e,t){return{kind:"schema",type:"non_nullable",reference:F1,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 U1(e,t){return{kind:"schema",type:"non_nullable",reference:U1,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 z1(e,t){return{kind:"schema",type:"non_nullish",reference:z1,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 V1(e,t){return{kind:"schema",type:"non_nullish",reference:V1,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 Lf(e,t){return{kind:"schema",type:"non_optional",reference:Lf,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 Ff(e,t){return{kind:"schema",type:"non_optional",reference:Ff,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 q1(e,...t){const r={kind:"schema",type:"nullable",reference:q1,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=wi(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 G1(e,...t){const r={kind:"schema",type:"nullable",reference:G1,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await wi(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 W1(e,...t){const r={kind:"schema",type:"nullish",reference:W1,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=wi(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 H1(e,...t){const r={kind:"schema",type:"nullish",reference:H1,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 wi(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 K1(e){return{kind:"schema",type:"number",reference:K1,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 X1(e,t){return{kind:"schema",type:"object",reference:X1,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 J1(e,t){return{kind:"schema",type:"object",reference:J1,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 Y1(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Y1,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(Cs(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 Z1(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Z1,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])=>Cs(s,l)&&!(l in this.entries)).map(async([l,f])=>[l,f,await this.rest._run({typed:!1,value:f},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),(h.value!==void 0||l in s)&&(n.value[l]=h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value[l]=h.value}}else le(this,"type",n,i);return n}}}function zf(e,...t){const r={kind:"schema",type:"optional",reference:zf,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=wi(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 Vf(e,...t){const r={kind:"schema",type:"optional",reference:Vf,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await wi(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 qf(e,t){return{kind:"schema",type:"picklist",reference:qf,expects:e.map(Nr).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 Q1(e){return{kind:"schema",type:"promise",reference:Q1,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function ey(e,t,r){return{kind:"schema",type:"record",reference:ey,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(Cs(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 ty(e,t,r){return{kind:"schema",type:"record",reference:ty,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])=>Cs(s,u)).map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"object",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"object",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),f.typed&&(n.value[f.value]=h.value)}}else le(this,"type",n,i);return n}}}function ry(e,t){return{kind:"schema",type:"set",reference:ry,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 ny(e,t){return{kind:"schema",type:"set",reference:ny,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 iy(e,t){return{kind:"schema",type:"strict_object",reference:iy,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 sy(e,t){return{kind:"schema",type:"strict_object",reference:sy,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 oy(e,t){return{kind:"schema",type:"strict_tuple",reference:oy,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 ay(e,t){return{kind:"schema",type:"strict_tuple",reference:ay,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 cy(e){return{kind:"schema",type:"string",reference:cy,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function uy(e){return{kind:"schema",type:"symbol",reference:uy,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function ly(e,t){return{kind:"schema",type:"tuple",reference:ly,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 fy(e,t){return{kind:"schema",type:"tuple",reference:fy,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 dy(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:dy,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 hy(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:hy,expects:"Array",async:!0,items:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];const[c,u]=await Promise.all([Promise.all(this.items.map(async(l,f)=>{const h=s[f];return[f,h,await l._run({typed:!1,value:h},i)]})),Promise.all(s.slice(this.items.length).map(async(l,f)=>[f+this.items.length,l,await this.rest._run({typed:!1,value:l},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}}else le(this,"type",n,i);return n}}}function Gf(e){return{kind:"schema",type:"undefined",reference:Gf,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function Gc(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function py(e,t){return{kind:"schema",type:"union",reference:py,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){let i,s,o;for(const a of this.options){const c=a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Gc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Gc(o)})}return r}}}function my(e,t){return{kind:"schema",type:"union",reference:my,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!0,options:e,message:t,async _run(r,n){let i,s,o;for(const a of this.options){const c=await a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Gc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Gc(o)})}return r}}}function gy(){return{kind:"schema",type:"unknown",reference:gy,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function Wf(e,t,r=new Set){for(const n of t)n.type==="variant"?Wf(e,n.options,r):r.add(n.entries[e].expects);return r}function vy(e,t,r){let n;return{kind:"schema",type:"variant",reference:vy,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=[...Wf(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 yy(e,t,r){let n;return{kind:"schema",type:"variant",reference:yy,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=[...Wf(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 Hf(e){return{kind:"schema",type:"void",reference:Hf,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function KC(e,t){return qf(Object.keys(e.entries),t)}function XC(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function by(e,t,r){const n=e._run({typed:!1,value:t},_a(r));if(n.issues)throw new Vc(n.issues);return n.value}async function wy(e,t,r){const n=await e._run({typed:!1,value:t},_a(r));if(n.issues)throw new Vc(n.issues);return n.value}function JC(e,t){const r=n=>by(e,n,t);return r.schema=e,r.config=t,r}function YC(e,t){const r=n=>wy(e,n,t);return r.schema=e,r.config=t,r}function ZC(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?zf(e.entries[n]):e.entries[n];return{...e,entries:r}}function QC(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Vf(e.entries[n]):e.entries[n];return{...e,entries:r}}function eM(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function tM(...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 rM(...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 nM(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)?Lf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function iM(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)?Ff(e.entries[o],i):e.entries[o];return{...e,entries:s}}function _y(e,t,r){const n=e._run({typed:!1,value:t},_a(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function xy(e,t,r){const n=await e._run({typed:!1,value:t},_a(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function sM(e,t){const r=n=>_y(e,n,t);return r.schema=e,r.config=t,r}function oM(e,t){const r=n=>xy(e,n,t);return r.schema=e,r.config=t,r}function aM(e){return e.wrapped}const cM=Symbol.for("@mysten/transaction");function uM(e){return!!e&&typeof e=="object"&&e[cM]===!0}const Sy=Symbol.for("@mysten/SuiClient");function lM(e){return typeof e=="object"&&e!==null&&e[Sy]===!0}class Sa{get[Sy](){return!0}constructor(t){this.transport=t.transport??new fm({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!mi(Br(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||!mi(Br(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||!mi(Br(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||!mi(Br(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||!mi(Br(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||!ba(gi(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||!ba(gi(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(!xf(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(!xf(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:qr(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||!mi(Br(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||!ba(gi(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(uM(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=qr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=qr(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:qr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!ba(gi(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=hi(t.digest);return pi(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=>rg(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 fM=kc(Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:ff,SuiClient:Sa,SuiHTTPStatusError:im,SuiHTTPTransport:fm,SuiHTTPTransportError:lf,getFullnodeUrl:dm,isSuiClient:lM},Symbol.toStringTag,{value:"Module"}))),Ey=kc(vC),Er=kc(aE);var Kf=Object.defineProperty,dM=Object.getOwnPropertyDescriptor,hM=Object.getOwnPropertyNames,pM=Object.prototype.hasOwnProperty,mM=(e,t)=>{for(var r in t)Kf(e,r,{get:t[r],enumerable:!0})},gM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hM(t))!pM.call(e,i)&&i!==r&&Kf(e,i,{get:()=>t[i],enumerable:!(n=dM(t,i))||n.enumerable});return e},vM=e=>gM(Kf({},"__esModule",{value:!0}),e),Cy={};mM(Cy,{SUI_ADDRESS_LENGTH:()=>Xf,isValidSuiAddress:()=>Ty,isValidSuiObjectId:()=>wM,isValidTransactionDigest:()=>bM,normalizeStructTag:()=>Ay,normalizeSuiAddress:()=>Yf,normalizeSuiObjectId:()=>xM,parseStructTag:()=>Jf});var Gr=vM(Cy),My=Er;const yM=32;function bM(e){try{return(0,My.fromBase58)(e).length===yM}catch{return!1}}const Xf=32;function Ty(e){return SM(e)&&EM(e)===Xf}function wM(e){return Ty(e)}function _M(e){return e.includes("::")?Jf(e):e}function Jf(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,My.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>_M(o.trim())):[];return{address:Yf(t),module:r,name:i,typeParams:s}}function Ay(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Jf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Ay(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Yf(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Xf*2,"0")}`}function xM(e,t=!1){return Yf(e,t)}function SM(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function EM(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Zf=Object.defineProperty,CM=Object.getOwnPropertyDescriptor,MM=Object.getOwnPropertyNames,TM=Object.prototype.hasOwnProperty,AM=(e,t)=>{for(var r in t)Zf(e,r,{get:t[r],enumerable:!0})},OM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MM(t))!TM.call(e,i)&&i!==r&&Zf(e,i,{get:()=>t[i],enumerable:!(n=CM(t,i))||n.enumerable});return e},IM=e=>OM(Zf({},"__esModule",{value:!0}),e),Oy={};AM(Oy,{TypeTagSerializer:()=>Ms});var Iy=IM(Oy),PM=Er,jM=Gr;const kM=/^vector<(.+)>$/,NM=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Ms{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(kM);if(n)return{vector:Ms.parseFromStr(n[1],r)};const i=t.match(NM);if(i)return{struct:{address:r?(0,jM.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Ms.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,PM.splitGenericParameters)(t).map(n=>Ms.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${Ms.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Ms.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Qf=Object.defineProperty,RM=Object.getOwnPropertyDescriptor,DM=Object.getOwnPropertyNames,$M=Object.prototype.hasOwnProperty,BM=(e,t)=>{for(var r in t)Qf(e,r,{get:t[r],enumerable:!0})},LM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DM(t))!$M.call(e,i)&&i!==r&&Qf(e,i,{get:()=>t[i],enumerable:!(n=RM(t,i))||n.enumerable});return e},FM=e=>LM(Qf({},"__esModule",{value:!0}),e),Py={};BM(Py,{Address:()=>Vn,AppId:()=>Xy,Argument:()=>qn,CallArg:()=>$y,Command:()=>Ly,CompressedSignature:()=>Zy,GasData:()=>qy,Intent:()=>Jy,IntentMessage:()=>Yy,IntentScope:()=>Hy,IntentVersion:()=>Ky,MultiSig:()=>VM,MultiSigPkMap:()=>eb,MultiSigPublicKey:()=>tb,ObjectArg:()=>Dy,ObjectDigest:()=>Ny,PasskeyAuthenticator:()=>GM,ProgrammableMoveCall:()=>By,ProgrammableTransaction:()=>Fy,PublicKey:()=>Qy,SenderSignedData:()=>qM,SenderSignedTransaction:()=>nb,SharedObjectRef:()=>Ry,StructTag:()=>Vy,SuiObjectRef:()=>Wc,TransactionData:()=>Wy,TransactionDataV1:()=>Gy,TransactionExpiration:()=>zy,TransactionKind:()=>Uy,TypeTag:()=>td,base64String:()=>rb});var jy=FM(Py),de=Er,Ea=Gr,ky=Iy;function UM(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function zM(e){return de.bcs.enum("Option",{None:null,Some:e})}const Vn=de.bcs.bytes(Ea.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,Ea.isValidSuiAddress)((0,Ea.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,Ea.normalizeSuiAddress)(e)):e,output:e=>(0,Ea.normalizeSuiAddress)((0,de.toHex)(e))}),Ny=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")}}),Wc=de.bcs.struct("SuiObjectRef",{objectId:Vn,version:de.bcs.u64(),digest:Ny}),Ry=de.bcs.struct("SharedObjectRef",{objectId:Vn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),Dy=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:Wc,SharedObject:Ry,Receiving:Wc}),$y=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:Dy}),ed=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>ed),struct:de.bcs.lazy(()=>Vy),u16:null,u32:null,u256:null}),td=ed.transform({input:e=>typeof e=="string"?ky.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>ky.TypeTagSerializer.tagToString(e)}),qn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),By=de.bcs.struct("ProgrammableMoveCall",{package:Vn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(td),arguments:de.bcs.vector(qn)}),Ly=de.bcs.enum("Command",{MoveCall:By,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(qn),address:qn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:qn,amounts:de.bcs.vector(qn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:qn,sources:de.bcs.vector(qn)}),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(Vn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:zM(td).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(qn)}),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(Vn),package:Vn,ticket:qn})}),Fy=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector($y),commands:de.bcs.vector(Ly)}),Uy=de.bcs.enum("TransactionKind",{ProgrammableTransaction:Fy,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),zy=de.bcs.enum("TransactionExpiration",{None:null,Epoch:UM()}),Vy=de.bcs.struct("StructTag",{address:Vn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(ed)}),qy=de.bcs.struct("GasData",{payment:de.bcs.vector(Wc),owner:Vn,price:de.bcs.u64(),budget:de.bcs.u64()}),Gy=de.bcs.struct("TransactionDataV1",{kind:Uy,sender:Vn,gasData:qy,expiration:zy}),Wy=de.bcs.enum("TransactionData",{V1:Gy}),Hy=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Ky=de.bcs.enum("IntentVersion",{V0:null}),Xy=de.bcs.enum("AppId",{Sui:null}),Jy=de.bcs.struct("Intent",{scope:Hy,version:Ky,appId:Xy});function Yy(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:Jy,value:e})}const Zy=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())}),Qy=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())}),eb=de.bcs.struct("MultiSigPkMap",{pubKey:Qy,weight:de.bcs.u8()}),tb=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector(eb),threshold:de.bcs.u16()}),VM=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(Zy),bitmap:de.bcs.u16(),multisig_pk:tb}),rb=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))}),nb=de.bcs.struct("SenderSignedTransaction",{intentMessage:Yy(Wy),txSignatures:de.bcs.vector(rb)}),qM=de.bcs.vector(nb,{name:"SenderSignedData"}),GM=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var rd=Object.defineProperty,WM=Object.getOwnPropertyDescriptor,HM=Object.getOwnPropertyNames,KM=Object.prototype.hasOwnProperty,XM=(e,t)=>{for(var r in t)rd(e,r,{get:t[r],enumerable:!0})},JM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HM(t))!KM.call(e,i)&&i!==r&&rd(e,i,{get:()=>t[i],enumerable:!(n=WM(t,i))||n.enumerable});return e},YM=e=>JM(rd({},"__esModule",{value:!0}),e),ib={};XM(ib,{TransactionEffects:()=>fT});var ZM=YM(ib),ve=Er,Rt=jy;const QM=ve.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ve.bcs.struct("UnableToFetchPackage",{packageId:Rt.Address}),NotAPackage:ve.bcs.struct("NotAPackage",{objectId:Rt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:ve.bcs.struct("DigestDoesNotMatch",{digest:ve.bcs.vector(ve.bcs.u8())}),UnknownUpgradePolicy:ve.bcs.struct("UnknownUpgradePolicy",{policy:ve.bcs.u8()}),PackageIDDoesNotMatch:ve.bcs.struct("PackageIDDoesNotMatch",{packageId:Rt.Address,ticketId:Rt.Address})}),eT=ve.bcs.struct("ModuleId",{address:Rt.Address,name:ve.bcs.string()}),sb=ve.bcs.struct("MoveLocation",{module:eT,function:ve.bcs.u16(),instruction:ve.bcs.u16(),functionName:ve.bcs.option(ve.bcs.string())}),tT=ve.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:ve.bcs.struct("IndexOutOfBounds",{idx:ve.bcs.u16()}),SecondaryIndexOutOfBounds:ve.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidResultArity:ve.bcs.struct("InvalidResultArity",{resultIdx:ve.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),rT=ve.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),nT=ve.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:ve.bcs.struct("MoveObjectTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),MovePackageTooBig:ve.bcs.struct("MovePackageTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),CircularObjectOwnership:ve.bcs.struct("CircularObjectOwnership",{object:Rt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ve.bcs.option(sb),MoveAbort:ve.bcs.tuple([sb,ve.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:ve.bcs.struct("CommandArgumentError",{argIdx:ve.bcs.u16(),kind:tT}),TypeArgumentError:ve.bcs.struct("TypeArgumentError",{argumentIdx:ve.bcs.u16(),kind:rT}),UnusedValueWithoutDrop:ve.bcs.struct("UnusedValueWithoutDrop",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidPublicFunctionReturnType:ve.bcs.struct("InvalidPublicFunctionReturnType",{idx:ve.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:ve.bcs.struct("EffectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:ve.bcs.struct("PackageUpgradeError",{upgradeError:QM}),WrittenObjectsTooLarge:ve.bcs.struct("WrittenObjectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:ve.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:ve.bcs.vector(Rt.Address)}),AddressDeniedForCoin:ve.bcs.struct("AddressDeniedForCoin",{address:Rt.Address,coinType:ve.bcs.string()}),CoinTypeGlobalPause:ve.bcs.struct("CoinTypeGlobalPause",{coinType:ve.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),ob=ve.bcs.enum("ExecutionStatus",{Success:null,Failed:ve.bcs.struct("ExecutionFailed",{error:nT,command:ve.bcs.option(ve.bcs.u64())})}),ab=ve.bcs.struct("GasCostSummary",{computationCost:ve.bcs.u64(),storageCost:ve.bcs.u64(),storageRebate:ve.bcs.u64(),nonRefundableStorageFee:ve.bcs.u64()}),fo=ve.bcs.enum("Owner",{AddressOwner:Rt.Address,ObjectOwner:Rt.Address,Shared:ve.bcs.struct("Shared",{initialSharedVersion:ve.bcs.u64()}),Immutable:null}),iT=ve.bcs.struct("TransactionEffectsV1",{status:ob,executedEpoch:ve.bcs.u64(),gasUsed:ab,modifiedAtVersions:ve.bcs.vector(ve.bcs.tuple([Rt.Address,ve.bcs.u64()])),sharedObjects:ve.bcs.vector(Rt.SuiObjectRef),transactionDigest:Rt.ObjectDigest,created:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,fo])),mutated:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,fo])),unwrapped:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,fo])),deleted:ve.bcs.vector(Rt.SuiObjectRef),unwrappedThenDeleted:ve.bcs.vector(Rt.SuiObjectRef),wrapped:ve.bcs.vector(Rt.SuiObjectRef),gasObject:ve.bcs.tuple([Rt.SuiObjectRef,fo]),eventsDigest:ve.bcs.option(Rt.ObjectDigest),dependencies:ve.bcs.vector(Rt.ObjectDigest)}),nd=ve.bcs.tuple([ve.bcs.u64(),Rt.ObjectDigest]),sT=ve.bcs.enum("ObjectIn",{NotExist:null,Exist:ve.bcs.tuple([nd,fo])}),oT=ve.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ve.bcs.tuple([Rt.ObjectDigest,fo]),PackageWrite:nd}),aT=ve.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),cT=ve.bcs.struct("EffectsObjectChange",{inputState:sT,outputState:oT,idOperation:aT}),uT=ve.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:nd,MutateDeleted:ve.bcs.u64(),ReadDeleted:ve.bcs.u64(),Cancelled:ve.bcs.u64(),PerEpochConfig:null}),lT=ve.bcs.struct("TransactionEffectsV2",{status:ob,executedEpoch:ve.bcs.u64(),gasUsed:ab,transactionDigest:Rt.ObjectDigest,gasObjectIndex:ve.bcs.option(ve.bcs.u32()),eventsDigest:ve.bcs.option(Rt.ObjectDigest),dependencies:ve.bcs.vector(Rt.ObjectDigest),lamportVersion:ve.bcs.u64(),changedObjects:ve.bcs.vector(ve.bcs.tuple([Rt.Address,cT])),unchangedSharedObjects:ve.bcs.vector(ve.bcs.tuple([Rt.Address,uT])),auxDataDigest:ve.bcs.option(Rt.ObjectDigest)}),fT=ve.bcs.enum("TransactionEffects",{V1:iT,V2:lT});var id=Object.defineProperty,dT=Object.getOwnPropertyDescriptor,hT=Object.getOwnPropertyNames,pT=Object.prototype.hasOwnProperty,mT=(e,t)=>{for(var r in t)id(e,r,{get:t[r],enumerable:!0})},gT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hT(t))!pT.call(e,i)&&i!==r&&id(e,i,{get:()=>t[i],enumerable:!(n=dT(t,i))||n.enumerable});return e},vT=e=>gT(id({},"__esModule",{value:!0}),e),cb={};mT(cb,{BcsType:()=>wT.BcsType,TypeTagSerializer:()=>bT.TypeTagSerializer,bcs:()=>_T});var Gn=vT(cb),Wn=Er,Dt=jy,yT=ZM,bT=Iy,wT=Er;const _T={...Wn.bcs,U8:Wn.bcs.u8(),U16:Wn.bcs.u16(),U32:Wn.bcs.u32(),U64:Wn.bcs.u64(),U128:Wn.bcs.u128(),U256:Wn.bcs.u256(),ULEB128:Wn.bcs.uleb128(),Bool:Wn.bcs.bool(),String:Wn.bcs.string(),Address:Dt.Address,AppId:Dt.AppId,Argument:Dt.Argument,CallArg:Dt.CallArg,CompressedSignature:Dt.CompressedSignature,GasData:Dt.GasData,Intent:Dt.Intent,IntentMessage:Dt.IntentMessage,IntentScope:Dt.IntentScope,IntentVersion:Dt.IntentVersion,MultiSig:Dt.MultiSig,MultiSigPkMap:Dt.MultiSigPkMap,MultiSigPublicKey:Dt.MultiSigPublicKey,ObjectArg:Dt.ObjectArg,ObjectDigest:Dt.ObjectDigest,ProgrammableMoveCall:Dt.ProgrammableMoveCall,ProgrammableTransaction:Dt.ProgrammableTransaction,PublicKey:Dt.PublicKey,SenderSignedData:Dt.SenderSignedData,SenderSignedTransaction:Dt.SenderSignedTransaction,SharedObjectRef:Dt.SharedObjectRef,StructTag:Dt.StructTag,SuiObjectRef:Dt.SuiObjectRef,Command:Dt.Command,TransactionData:Dt.TransactionData,TransactionDataV1:Dt.TransactionDataV1,TransactionExpiration:Dt.TransactionExpiration,TransactionKind:Dt.TransactionKind,TypeTag:Dt.TypeTag,TransactionEffects:yT.TransactionEffects,PasskeyAuthenticator:Dt.PasskeyAuthenticator};var sd=Object.defineProperty,xT=Object.getOwnPropertyDescriptor,ST=Object.getOwnPropertyNames,ET=Object.prototype.hasOwnProperty,CT=(e,t)=>{for(var r in t)sd(e,r,{get:t[r],enumerable:!0})},MT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ST(t))!ET.call(e,i)&&i!==r&&sd(e,i,{get:()=>t[i],enumerable:!(n=xT(t,i))||n.enumerable});return e},TT=e=>MT(sd({},"__esModule",{value:!0}),e),ub={};CT(ub,{formatAddress:()=>OT,formatDigest:()=>IT});var AT=TT(ub);const lb="…";function OT(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${lb}${e.slice(-4)}`}function IT(e){return`${e.slice(0,10)}${lb}`}var od=Object.defineProperty,PT=Object.getOwnPropertyDescriptor,jT=Object.getOwnPropertyNames,kT=Object.prototype.hasOwnProperty,NT=(e,t)=>{for(var r in t)od(e,r,{get:t[r],enumerable:!0})},RT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jT(t))!kT.call(e,i)&&i!==r&&od(e,i,{get:()=>t[i],enumerable:!(n=PT(t,i))||n.enumerable});return e},DT=e=>RT(od({},"__esModule",{value:!0}),e),fb={};NT(fb,{isValidSuiNSName:()=>BT,normalizeSuiNSName:()=>LT});var db=DT(fb);const hb=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,pb=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,$T=235;function BT(e){return e.length>$T?!1:e.includes("@")?hb.test(e):pb.test(e)}function LT(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!hb.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!pb.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 ad=Object.defineProperty,FT=Object.getOwnPropertyDescriptor,UT=Object.getOwnPropertyNames,zT=Object.prototype.hasOwnProperty,VT=(e,t)=>{for(var r in t)ad(e,r,{get:t[r],enumerable:!0})},qT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of UT(t))!zT.call(e,i)&&i!==r&&ad(e,i,{get:()=>t[i],enumerable:!(n=FT(t,i))||n.enumerable});return e},GT=e=>qT(ad({},"__esModule",{value:!0}),e),mb={};VT(mb,{MIST_PER_SUI:()=>KT,MOVE_STDLIB_ADDRESS:()=>XT,SUI_CLOCK_OBJECT_ID:()=>YT,SUI_DECIMALS:()=>HT,SUI_FRAMEWORK_ADDRESS:()=>vb,SUI_SYSTEM_ADDRESS:()=>JT,SUI_SYSTEM_MODULE_NAME:()=>ZT,SUI_SYSTEM_STATE_OBJECT_ID:()=>eA,SUI_TYPE_ARG:()=>QT});var WT=GT(mb),gb=Gr;const HT=9,KT=BigInt(1e9),XT="0x1",vb="0x2",JT="0x3",YT=(0,gb.normalizeSuiObjectId)("0x6"),ZT="sui_system",QT=`${vb}::sui::SUI`,eA=(0,gb.normalizeSuiObjectId)("0x5");var cd=Object.defineProperty,tA=Object.getOwnPropertyDescriptor,rA=Object.getOwnPropertyNames,nA=Object.prototype.hasOwnProperty,iA=(e,t)=>{for(var r in t)cd(e,r,{get:t[r],enumerable:!0})},sA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rA(t))!nA.call(e,i)&&i!==r&&cd(e,i,{get:()=>t[i],enumerable:!(n=tA(t,i))||n.enumerable});return e},oA=e=>sA(cd({},"__esModule",{value:!0}),e),yb={};iA(yb,{isValidNamedPackage:()=>_b,isValidNamedType:()=>fA});var bb=oA(yb),aA=db;const cA=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,uA=/^\d+$/,lA=64,wb="/",_b=e=>{const t=e.split(wb);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!uA.test(i)||!(0,aA.isValidSuiNSName)(r)?!1:cA.test(n)&&n.length<lA},fA=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(wb)&&!_b(r))return!1;return!0},xb=kc(mC);var ud=Object.defineProperty,dA=Object.getOwnPropertyDescriptor,hA=Object.getOwnPropertyNames,pA=Object.prototype.hasOwnProperty,mA=(e,t)=>{for(var r in t)ud(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&&ud(e,i,{get:()=>t[i],enumerable:!(n=dA(t,i))||n.enumerable});return e},vA=e=>gA(ud({},"__esModule",{value:!0}),e),Sb={};mA(Sb,{deriveDynamicFieldID:()=>_A});var yA=vA(Sb),bA=Er,wA=xb,ld=Gn;function _A(e,t,r){const n=ld.bcs.Address.serialize(e).toBytes(),i=ld.bcs.TypeTag.serialize(t).toBytes(),s=ld.bcs.u64().serialize(r.length).toBytes(),o=wA.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,bA.toHex)(o.digest().slice(0,32))}`}var fd=Object.defineProperty,xA=Object.getOwnPropertyDescriptor,SA=Object.getOwnPropertyNames,EA=Object.prototype.hasOwnProperty,CA=(e,t)=>{for(var r in t)fd(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&&fd(e,i,{get:()=>t[i],enumerable:!(n=xA(t,i))||n.enumerable});return e},TA=e=>MA(fd({},"__esModule",{value:!0}),e),Eb={};CA(Eb,{MIST_PER_SUI:()=>_i.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>_i.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Hi.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>_i.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>_i.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>_i.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>_i.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>_i.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>_i.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>_i.SUI_TYPE_ARG,deriveDynamicFieldID:()=>AA.deriveDynamicFieldID,formatAddress:()=>Mb.formatAddress,formatDigest:()=>Mb.formatDigest,fromB64:()=>Hn.fromB64,fromBase58:()=>Hn.fromBase58,fromBase64:()=>Hn.fromBase64,fromHEX:()=>Hn.fromHEX,fromHex:()=>Hn.fromHex,isValidNamedPackage:()=>Ab.isValidNamedPackage,isValidNamedType:()=>Ab.isValidNamedType,isValidSuiAddress:()=>Hi.isValidSuiAddress,isValidSuiNSName:()=>Tb.isValidSuiNSName,isValidSuiObjectId:()=>Hi.isValidSuiObjectId,isValidTransactionDigest:()=>Hi.isValidTransactionDigest,normalizeStructTag:()=>Hi.normalizeStructTag,normalizeSuiAddress:()=>Hi.normalizeSuiAddress,normalizeSuiNSName:()=>Tb.normalizeSuiNSName,normalizeSuiObjectId:()=>Hi.normalizeSuiObjectId,parseStructTag:()=>Hi.parseStructTag,toB64:()=>Hn.toB64,toBase58:()=>Hn.toBase58,toBase64:()=>Hn.toBase64,toHEX:()=>Hn.toHEX,toHex:()=>Hn.toHex});var Cb=TA(Eb),Mb=AT,Hi=Gr,Hn=Er,Tb=db,_i=WT,Ab=bb,AA=yA,dd=Object.defineProperty,OA=Object.getOwnPropertyDescriptor,IA=Object.getOwnPropertyNames,PA=Object.prototype.hasOwnProperty,jA=(e,t)=>{for(var r in t)dd(e,r,{get:t[r],enumerable:!0})},kA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of IA(t))!PA.call(e,i)&&i!==r&&dd(e,i,{get:()=>t[i],enumerable:!(n=OA(t,i))||n.enumerable});return e},NA=e=>kA(dd({},"__esModule",{value:!0}),e),Ob={};jA(Ob,{getPureBcsSchema:()=>hd,isTxContext:()=>VA,normalizedTypeToMoveTypeSignature:()=>qA,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>jb});var Ib=NA(Ob),Zt=Gn,Pb=Cb,Ca=Gr;const RA="object",DA="ID",$A="ascii",BA="String",LA="string",FA="String",UA="option",zA="Option";function VA(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Ca.normalizeSuiAddress)(t.package)===(0,Ca.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function hd(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Zt.bcs.vector(Zt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=hd(e.vector);return t?Zt.bcs.vector(t):null}if("datatype"in e){const t=(0,Ca.normalizeSuiAddress)(e.datatype.package);if(t===(0,Ca.normalizeSuiAddress)(Pb.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===$A&&e.datatype.type===BA||e.datatype.module===LA&&e.datatype.type===FA)return Zt.bcs.String;if(e.datatype.module===UA&&e.datatype.type===zA){const r=hd(e.datatype.typeParameters[0]);return r?Zt.bcs.vector(r):null}}if(t===(0,Ca.normalizeSuiAddress)(Pb.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===RA&&e.datatype.type===DA)return Zt.bcs.Address}return null}function qA(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Ma(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Ma(e.MutableReference)}:{ref:null,body:Ma(e)}}function Ma(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:Ma(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(Ma)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function jb(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Zt.bcs.vector(jb(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var pd=Object.defineProperty,GA=Object.getOwnPropertyDescriptor,WA=Object.getOwnPropertyNames,HA=Object.prototype.hasOwnProperty,KA=(e,t)=>{for(var r in t)pd(e,r,{get:t[r],enumerable:!0})},XA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of WA(t))!HA.call(e,i)&&i!==r&&pd(e,i,{get:()=>t[i],enumerable:!(n=GA(t,i))||n.enumerable});return e},JA=e=>XA(pd({},"__esModule",{value:!0}),e),kb={};KA(kb,{Inputs:()=>QA});var Hc=JA(kb),YA=Er,md=Gr;function ZA(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,YA.toBase64)(e):e.toBase64()}}}const QA={Pure:ZA,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,md.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,md.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,md.normalizeSuiAddress)(e)}}}}};var gd=Object.defineProperty,e5=Object.getOwnPropertyDescriptor,t5=Object.getOwnPropertyNames,r5=Object.prototype.hasOwnProperty,n5=(e,t)=>{for(var r in t)gd(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&&gd(e,i,{get:()=>t[i],enumerable:!(n=e5(t,i))||n.enumerable});return e},s5=e=>i5(gd({},"__esModule",{value:!0}),e),Nb={};n5(Nb,{$Intent:()=>Bb,Argument:()=>tn,BCSBytes:()=>Aa,Command:()=>Lb,GasData:()=>Db,JsonU64:()=>Ki,NormalizedCallArg:()=>u5,ObjectArg:()=>vd,ObjectID:()=>Ts,ObjectRef:()=>Kc,OpenMoveTypeSignature:()=>$b,OpenMoveTypeSignatureBody:()=>Xc,StructTag:()=>o5,SuiAddress:()=>Ta,TransactionData:()=>l5,TransactionExpiration:()=>Fb,safeEnum:()=>po});var ho=s5(Nb),ue=Wi,Rb=Gr;function po(e){const t=Object.entries(e).map(([r,n])=>(0,ue.object)({[r]:n}));return(0,ue.pipe)((0,ue.union)(t),(0,ue.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const Ta=(0,ue.pipe)((0,ue.string)(),(0,ue.transform)(e=>(0,Rb.normalizeSuiAddress)(e)),(0,ue.check)(Rb.isValidSuiAddress)),Ts=Ta,Aa=(0,ue.string)(),Ki=(0,ue.pipe)((0,ue.union)([(0,ue.string)(),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())]),(0,ue.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Kc=(0,ue.object)({objectId:Ta,version:Ki,digest:(0,ue.string)()}),tn=(0,ue.pipe)((0,ue.union)([(0,ue.object)({GasCoin:(0,ue.literal)(!0)}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("pure"))}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("object"))}),(0,ue.object)({Result:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())}),(0,ue.object)({NestedResult:(0,ue.tuple)([(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())])})]),(0,ue.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),Db=(0,ue.object)({budget:(0,ue.nullable)(Ki),price:(0,ue.nullable)(Ki),owner:(0,ue.nullable)(Ta),payment:(0,ue.nullable)((0,ue.array)(Kc))}),o5=(0,ue.object)({address:(0,ue.string)(),module:(0,ue.string)(),name:(0,ue.string)(),typeParams:(0,ue.array)((0,ue.string)())}),Xc=(0,ue.union)([(0,ue.literal)("address"),(0,ue.literal)("bool"),(0,ue.literal)("u8"),(0,ue.literal)("u16"),(0,ue.literal)("u32"),(0,ue.literal)("u64"),(0,ue.literal)("u128"),(0,ue.literal)("u256"),(0,ue.object)({vector:(0,ue.lazy)(()=>Xc)}),(0,ue.object)({datatype:(0,ue.object)({package:(0,ue.string)(),module:(0,ue.string)(),type:(0,ue.string)(),typeParameters:(0,ue.array)((0,ue.lazy)(()=>Xc))})}),(0,ue.object)({typeParameter:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())})]),$b=(0,ue.object)({ref:(0,ue.nullable)((0,ue.union)([(0,ue.literal)("&"),(0,ue.literal)("&mut")])),body:Xc}),a5=(0,ue.object)({package:Ts,module:(0,ue.string)(),function:(0,ue.string)(),typeArguments:(0,ue.array)((0,ue.string)()),arguments:(0,ue.array)(tn),_argumentTypes:(0,ue.optional)((0,ue.nullable)((0,ue.array)($b)))}),Bb=(0,ue.object)({name:(0,ue.string)(),inputs:(0,ue.record)((0,ue.string)(),(0,ue.union)([tn,(0,ue.array)(tn)])),data:(0,ue.record)((0,ue.string)(),(0,ue.unknown)())}),Lb=po({MoveCall:a5,TransferObjects:(0,ue.object)({objects:(0,ue.array)(tn),address:tn}),SplitCoins:(0,ue.object)({coin:tn,amounts:(0,ue.array)(tn)}),MergeCoins:(0,ue.object)({destination:tn,sources:(0,ue.array)(tn)}),Publish:(0,ue.object)({modules:(0,ue.array)(Aa),dependencies:(0,ue.array)(Ts)}),MakeMoveVec:(0,ue.object)({type:(0,ue.nullable)((0,ue.string)()),elements:(0,ue.array)(tn)}),Upgrade:(0,ue.object)({modules:(0,ue.array)(Aa),dependencies:(0,ue.array)(Ts),package:Ts,ticket:tn}),$Intent:Bb}),vd=po({ImmOrOwnedObject:Kc,SharedObject:(0,ue.object)({objectId:Ts,initialSharedVersion:Ki,mutable:(0,ue.boolean)()}),Receiving:Kc}),c5=po({Object:vd,Pure:(0,ue.object)({bytes:Aa}),UnresolvedPure:(0,ue.object)({value:(0,ue.unknown)()}),UnresolvedObject:(0,ue.object)({objectId:Ts,version:(0,ue.optional)((0,ue.nullable)(Ki)),digest:(0,ue.optional)((0,ue.nullable)((0,ue.string)())),initialSharedVersion:(0,ue.optional)((0,ue.nullable)(Ki))})}),u5=po({Object:vd,Pure:(0,ue.object)({bytes:Aa})}),Fb=po({None:(0,ue.literal)(!0),Epoch:Ki}),l5=(0,ue.object)({version:(0,ue.literal)(2),sender:(0,ue.nullish)(Ta),expiration:(0,ue.nullish)(Fb),gasData:Db,inputs:(0,ue.array)(c5),commands:(0,ue.array)(Lb)});var yd=Object.defineProperty,f5=Object.getOwnPropertyDescriptor,d5=Object.getOwnPropertyNames,h5=Object.prototype.hasOwnProperty,p5=(e,t)=>{for(var r in t)yd(e,r,{get:t[r],enumerable:!0})},m5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of d5(t))!h5.call(e,i)&&i!==r&&yd(e,i,{get:()=>t[i],enumerable:!(n=f5(t,i))||n.enumerable});return e},g5=e=>m5(yd({},"__esModule",{value:!0}),e),Ub={};p5(Ub,{Commands:()=>v5,UpgradePolicy:()=>qb});var bd=g5(Ub),zb=Er,Kn=Wi,Vb=Gr,Xn=ho,qb=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(qb||{});const v5={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,Kn.parse)(Xn.Argument,r)),address:(0,Kn.parse)(Xn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Kn.parse)(Xn.Argument,e),amounts:t.map(r=>(0,Kn.parse)(Xn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Kn.parse)(Xn.Argument,e),sources:t.map(r=>(0,Kn.parse)(Xn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,zb.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,Vb.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,zb.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,Vb.normalizeSuiObjectId)(i)),package:r,ticket:(0,Kn.parse)(Xn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Kn.parse)(Xn.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,Kn.parse)(Xn.Argument,s)):(0,Kn.parse)(Xn.Argument,i)])),data:r}}}};var wd=Object.defineProperty,y5=Object.getOwnPropertyDescriptor,b5=Object.getOwnPropertyNames,w5=Object.prototype.hasOwnProperty,_5=(e,t)=>{for(var r in t)wd(e,r,{get:t[r],enumerable:!0})},x5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of b5(t))!w5.call(e,i)&&i!==r&&wd(e,i,{get:()=>t[i],enumerable:!(n=y5(t,i))||n.enumerable});return e},S5=e=>x5(wd({},"__esModule",{value:!0}),e),Gb={};_5(Gb,{NormalizedCallArg:()=>_d,ObjectRef:()=>Jc,SerializedTransactionDataV1:()=>$5,StructTag:()=>Jb,TransactionArgument:()=>Jn,TypeTag:()=>Yc,serializeV1TransactionData:()=>B5,transactionDataFromV1:()=>L5});var Wb=S5(Gb),mo=Er,ne=Wi,Hb=Gn,Oa=ho;const Jc=(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)()])}),E5=(0,Oa.safeEnum)({ImmOrOwned:Jc,Shared:(0,ne.object)({objectId:Oa.ObjectID,initialSharedVersion:Oa.JsonU64,mutable:(0,ne.boolean)()}),Receiving:Jc}),_d=(0,Oa.safeEnum)({Object:E5,Pure:(0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))}),Kb=(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")})]),C5=(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))})]),Xb=(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}})),Yc=(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)(()=>Yc)}),(0,ne.object)({struct:(0,ne.lazy)(()=>Jb)}),(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))})]),Jb=(0,ne.object)({address:(0,ne.string)(),module:(0,ne.string)(),name:(0,ne.string)(),typeParams:(0,ne.array)(Yc)}),M5=(0,ne.object)({budget:(0,ne.optional)(Xb),price:(0,ne.optional)(Xb),payment:(0,ne.optional)((0,ne.array)(Jc)),owner:(0,ne.optional)((0,ne.string)())}),T5=[Kb,(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)())})],Jn=(0,ne.union)([...T5]),A5=(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)(Jn)}),O5=(0,ne.object)({kind:(0,ne.literal)("TransferObjects"),objects:(0,ne.array)(Jn),address:Jn}),I5=(0,ne.object)({kind:(0,ne.literal)("SplitCoins"),coin:Jn,amounts:(0,ne.array)(Jn)}),P5=(0,ne.object)({kind:(0,ne.literal)("MergeCoins"),destination:Jn,sources:(0,ne.array)(Jn)}),j5=(0,ne.object)({kind:(0,ne.literal)("MakeMoveVec"),type:(0,ne.union)([(0,ne.object)({Some:Yc}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),objects:(0,ne.array)(Jn)}),k5=(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)())}),N5=(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:Jn}),R5=[A5,O5,I5,P5,k5,N5,j5],D5=(0,ne.union)([...R5]),$5=(0,ne.object)({version:(0,ne.literal)(1),sender:(0,ne.optional)((0,ne.string)()),expiration:(0,ne.nullish)(C5),gasConfig:M5,inputs:(0,ne.array)(Kb),transactions:(0,ne.array)(D5)});function B5(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,mo.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:Hb.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>xi(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:xi(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>xi(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=>xi(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,mo.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:xi(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>xi(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>xi(i,t)),address:xi(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,mo.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:xi(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function xi(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 L5(e){var t,r,n;return(0,ne.parse)(Oa.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)(_d,i.value)){const s=(0,ne.parse)(_d,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,mo.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?Hb.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,mo.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,mo.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 xd=Object.defineProperty,F5=Object.getOwnPropertyDescriptor,U5=Object.getOwnPropertyNames,z5=Object.prototype.hasOwnProperty,V5=(e,t)=>{for(var r in t)xd(e,r,{get:t[r],enumerable:!0})},q5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of U5(t))!z5.call(e,i)&&i!==r&&xd(e,i,{get:()=>t[i],enumerable:!(n=F5(t,i))||n.enumerable});return e},G5=e=>q5(xd({},"__esModule",{value:!0}),e),Yb={};V5(Yb,{SerializedTransactionDataV2:()=>eO});var W5=G5(Yb),je=Wi,cr=ho;function Ia(e){return(0,je.union)(Object.entries(e).map(([t,r])=>(0,je.object)({[t]:r})))}const bn=Ia({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)())])}),H5=(0,je.object)({budget:(0,je.nullable)(cr.JsonU64),price:(0,je.nullable)(cr.JsonU64),owner:(0,je.nullable)(cr.SuiAddress),payment:(0,je.nullable)((0,je.array)(cr.ObjectRef))}),K5=(0,je.object)({package:cr.ObjectID,module:(0,je.string)(),function:(0,je.string)(),typeArguments:(0,je.array)((0,je.string)()),arguments:(0,je.array)(bn)}),X5=(0,je.object)({name:(0,je.string)(),inputs:(0,je.record)((0,je.string)(),(0,je.union)([bn,(0,je.array)(bn)])),data:(0,je.record)((0,je.string)(),(0,je.unknown)())}),J5=Ia({MoveCall:K5,TransferObjects:(0,je.object)({objects:(0,je.array)(bn),address:bn}),SplitCoins:(0,je.object)({coin:bn,amounts:(0,je.array)(bn)}),MergeCoins:(0,je.object)({destination:bn,sources:(0,je.array)(bn)}),Publish:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID)}),MakeMoveVec:(0,je.object)({type:(0,je.nullable)((0,je.string)()),elements:(0,je.array)(bn)}),Upgrade:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID),package:cr.ObjectID,ticket:bn}),$Intent:X5}),Y5=Ia({ImmOrOwnedObject:cr.ObjectRef,SharedObject:(0,je.object)({objectId:cr.ObjectID,initialSharedVersion:cr.JsonU64,mutable:(0,je.boolean)()}),Receiving:cr.ObjectRef}),Z5=Ia({Object:Y5,Pure:(0,je.object)({bytes:cr.BCSBytes}),UnresolvedPure:(0,je.object)({value:(0,je.unknown)()}),UnresolvedObject:(0,je.object)({objectId:cr.ObjectID,version:(0,je.optional)((0,je.nullable)(cr.JsonU64)),digest:(0,je.optional)((0,je.nullable)((0,je.string)())),initialSharedVersion:(0,je.optional)((0,je.nullable)(cr.JsonU64))})}),Q5=Ia({None:(0,je.literal)(!0),Epoch:cr.JsonU64}),eO=(0,je.object)({version:(0,je.literal)(2),sender:(0,je.nullish)(cr.SuiAddress),expiration:(0,je.nullish)(Q5),gasData:H5,inputs:(0,je.array)(Z5),commands:(0,je.array)(J5)});var Sd=Object.defineProperty,tO=Object.getOwnPropertyDescriptor,rO=Object.getOwnPropertyNames,nO=Object.prototype.hasOwnProperty,iO=(e,t)=>{for(var r in t)Sd(e,r,{get:t[r],enumerable:!0})},sO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rO(t))!nO.call(e,i)&&i!==r&&Sd(e,i,{get:()=>t[i],enumerable:!(n=tO(t,i))||n.enumerable});return e},oO=e=>sO(Sd({},"__esModule",{value:!0}),e),Zb={};iO(Zb,{getClient:()=>go,resolveTransactionData:()=>dO});var Qb=oO(Zb),aO=Wi,ew=Gn,Ed=Cb,cO=ho,Pa=Hc,Cd=Ib;const uO=50,lO=1000n,fO=5e10;async function dO(e,t,r){return await vO(e,t),await gO(e,t),t.onlyTransactionKind||(await hO(e,t),await pO(e,t),await mO(e,t)),await yO(e),await r()}async function hO(e,t){e.gasConfig.price||(e.gasConfig.price=String(await go(t).getReferenceGasPrice()))}async function pO(e,t){if(e.gasConfig.budget)return;const r=await go(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(fO),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=lO*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 mO(e,t){if(!e.gasConfig.payment){const n=(await go(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Ed.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,aO.parse)(cO.ObjectRef,i))}}async function gO(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,Ed.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?xO(n,uO):[],s=(await Promise.all(i.map(l=>go(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,Ed.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=Pa.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:bO(e,l)}):wO(e,l)&&(h=Pa.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??Pa.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 vO(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=>{tw(c,ew.bcs.U64,e)});break;case"TransferObjects":tw(a.TransferObjects.address,ew.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=go(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,Cd.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,Cd.isTxContext)(c.at(-1))?c.slice(0,c.length-1):c;a._argumentTypes=l})),n.forEach(a=>{if(!a.MoveCall)return;const c=a.MoveCall,u=`${c.package}::${c.module}::${c.function}`,l=c._argumentTypes;if(l){if(l.length!==a.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${u}`);l.forEach((f,h)=>{var N,R;const y=c.arguments[h];if(y.$kind!=="Input")return;const b=r[y.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const _=((N=b.UnresolvedPure)==null?void 0:N.value)??((R=b.UnresolvedObject)==null?void 0:R.objectId),A=(0,Cd.getPureBcsSchema)(f.body);if(A){y.type="pure",r[r.indexOf(b)]=Pa.Inputs.Pure(A.serialize(_));return}if(typeof _!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(_,null,2)}`);y.type="object";const P=b.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:_}}:b;r[y.Input]=P})}})}function yO(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 tw(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=Pa.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function bO(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 wO(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=_O(i.MoveCall._argumentTypes[s])||r}}),r}function _O(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 go(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 xO(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var Md=Object.defineProperty,SO=Object.getOwnPropertyDescriptor,EO=Object.getOwnPropertyNames,CO=Object.prototype.hasOwnProperty,MO=(e,t)=>{for(var r in t)Md(e,r,{get:t[r],enumerable:!0})},TO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of EO(t))!CO.call(e,i)&&i!==r&&Md(e,i,{get:()=>t[i],enumerable:!(n=SO(t,i))||n.enumerable});return e},AO=e=>TO(Md({},"__esModule",{value:!0}),e),rw={};MO(rw,{createObjectMethods:()=>OO});var nw=AO(rw);function OO(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 Td=Object.defineProperty,IO=Object.getOwnPropertyDescriptor,PO=Object.getOwnPropertyNames,jO=Object.prototype.hasOwnProperty,kO=(e,t)=>{for(var r in t)Td(e,r,{get:t[r],enumerable:!0})},NO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of PO(t))!jO.call(e,i)&&i!==r&&Td(e,i,{get:()=>t[i],enumerable:!(n=IO(t,i))||n.enumerable});return e},RO=e=>NO(Td({},"__esModule",{value:!0}),e),iw={};kO(iw,{createPure:()=>$O});var sw=RO(iw),DO=Er,rr=Gn;function $O(e){function t(r,n){if(typeof r=="string")return e(ja(r).serialize(n));if(r instanceof Uint8Array||(0,DO.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(ja(r)).serialize(n)),t.option=(r,n)=>e(rr.bcs.option(ja(r)).serialize(n)),t}function ja(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(ja(n)):rr.bcs.option(ja(n))}throw new Error(`Invalid Pure type name: ${e}`)}var Ad=Object.defineProperty,BO=Object.getOwnPropertyDescriptor,LO=Object.getOwnPropertyNames,FO=Object.prototype.hasOwnProperty,UO=(e,t)=>{for(var r in t)Ad(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&&Ad(e,i,{get:()=>t[i],enumerable:!(n=BO(t,i))||n.enumerable});return e},VO=e=>zO(Ad({},"__esModule",{value:!0}),e),ow={};UO(ow,{hashTypedData:()=>WO});var qO=VO(ow),GO=xb;function WO(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,GO.blake2b)(n,{dkLen:32})}var Od=Object.defineProperty,HO=Object.getOwnPropertyDescriptor,KO=Object.getOwnPropertyNames,XO=Object.prototype.hasOwnProperty,JO=(e,t)=>{for(var r in t)Od(e,r,{get:t[r],enumerable:!0})},YO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of KO(t))!XO.call(e,i)&&i!==r&&Od(e,i,{get:()=>t[i],enumerable:!(n=HO(t,i))||n.enumerable});return e},ZO=e=>YO(Od({},"__esModule",{value:!0}),e),aw={};JO(aw,{TransactionDataBuilder:()=>As});var Id=ZO(aw),QO=Er,Pd=Wi,Zc=Gn,eI=Gr,jd=ho,tI=Wb,rI=qO;function cw(e){return(0,eI.normalizeSuiAddress)(e).replace("0x","")}class As{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=Zc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return As.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=Zc.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 As.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 As((0,Pd.parse)(jd.TransactionData,t)):new As((0,Pd.parse)(jd.TransactionData,(0,tI.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,rI.hashTypedData)("TransactionData",t);return(0,QO.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 Zc.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:cw(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:cw(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return Zc.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 As.getDigestFromBytes(t)}snapshot(){return(0,Pd.parse)(jd.TransactionData,this)}}var kd=Object.defineProperty,nI=Object.getOwnPropertyDescriptor,iI=Object.getOwnPropertyNames,sI=Object.prototype.hasOwnProperty,oI=(e,t)=>{for(var r in t)kd(e,r,{get:t[r],enumerable:!0})},aI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of iI(t))!sI.call(e,i)&&i!==r&&kd(e,i,{get:()=>t[i],enumerable:!(n=nI(t,i))||n.enumerable});return e},cI=e=>aI(kd({},"__esModule",{value:!0}),e),uw={};oI(uw,{extractMutableReference:()=>lw,extractReference:()=>fw,extractStructTag:()=>lI,getIdFromCallArg:()=>fI});var uI=cI(uw),ka=Gr;function lw(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function fw(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function lI(e){if(typeof e=="object"&&"Struct"in e)return e;const t=fw(e),r=lw(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function fI(e){if(typeof e=="string")return(0,ka.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,ka.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,ka.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,ka.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,ka.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var Nd=Object.defineProperty,dI=Object.getOwnPropertyDescriptor,hI=Object.getOwnPropertyNames,pI=Object.prototype.hasOwnProperty,dw=e=>{throw TypeError(e)},mI=(e,t)=>{for(var r in t)Nd(e,r,{get:t[r],enumerable:!0})},gI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hI(t))!pI.call(e,i)&&i!==r&&Nd(e,i,{get:()=>t[i],enumerable:!(n=dI(t,i))||n.enumerable});return e},vI=e=>gI(Nd({},"__esModule",{value:!0}),e),Rd=(e,t,r)=>t.has(e)||dw("Cannot "+r),Ct=(e,t,r)=>(Rd(e,t,"read from private field"),r?r.call(e):t.get(e)),Na=(e,t,r)=>t.has(e)?dw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Os=(e,t,r,n)=>(Rd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ei=(e,t,r)=>(Rd(e,t,"access private method"),r),hw={};mI(hw,{Transaction:()=>EI,isTransaction:()=>yw});var Qc=vI(hw),eu=Er,Xi=Wi,yI=Gr,Is=bd,Ps=ho,pw=Wb,bI=W5,tu=Hc,wI=Qb,_I=nw,xI=sw,Ra=Id,mw=uI,Da,$a,js,Tt,wn,ru,Dd,$d,Bd;function gw(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 vw=Symbol.for("@mysten/transaction");function yw(e){return!!e&&typeof e=="object"&&e[vw]===!0}const bw={buildPlugins:new Map,serializationPlugins:new Map},Ld=Symbol.for("@mysten/transaction/registry");function Ba(){try{const e=globalThis;return e[Ld]||(e[Ld]=bw),e[Ld]}catch{return bw}}const SI=class X0{constructor(){Na(this,wn),Na(this,Da),Na(this,$a),Na(this,js,new Map),Na(this,Tt),this.object=(0,_I.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Xi.is)(Ps.Argument,r))return r;const n=(0,mw.getIdFromCallArg)(r),i=Ct(this,Tt).inputs.find(a=>n===(0,mw.getIdFromCallArg)(a));return(s=i==null?void 0:i.Object)!=null&&s.SharedObject&&typeof r=="object"&&((o=r.Object)!=null&&o.SharedObject)&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||r.Object.SharedObject.mutable),i?{$kind:"Input",Input:Ct(this,Tt).inputs.indexOf(i),type:"object"}:Ct(this,Tt).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,yI.normalizeSuiAddress)(r)}}:r)});const t=Ba();Os(this,Tt,new Ra.TransactionDataBuilder),Os(this,$a,[...t.buildPlugins.values()]),Os(this,Da,[...t.serializationPlugins.values()])}static fromKind(t){const r=new X0;return Os(r,Tt,Ra.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,eu.fromBase64)(t):t)),r}static from(t){const r=new X0;return yw(t)?Os(r,Tt,new Ra.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?Os(r,Tt,Ra.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,eu.fromBase64)(t):t)):Os(r,Tt,Ra.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){Ba().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){Ba().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){Ba().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){Ba().buildPlugins.delete(t)}addSerializationPlugin(t){Ct(this,Da).push(t)}addBuildPlugin(t){Ct(this,$a).push(t)}addIntentResolver(t,r){if(Ct(this,js).has(t)&&Ct(this,js).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Ct(this,js).set(t,r)}setSender(t){Ct(this,Tt).sender=t}setSenderIfNotSet(t){Ct(this,Tt).sender||(Ct(this,Tt).sender=t)}setExpiration(t){Ct(this,Tt).expiration=t?(0,Xi.parse)(Ps.TransactionExpiration,t):null}setGasPrice(t){Ct(this,Tt).gasConfig.price=String(t)}setGasBudget(t){Ct(this,Tt).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Ct(this,Tt).gasData.budget==null&&(Ct(this,Tt).gasConfig.budget=String(t))}setGasOwner(t){Ct(this,Tt).gasConfig.owner=t}setGasPayment(t){Ct(this,Tt).gasConfig.payment=t.map(r=>(0,Xi.parse)(Ps.ObjectRef,r))}get blockData(){return(0,pw.serializeV1TransactionData)(Ct(this,Tt).snapshot())}getData(){return Ct(this,Tt).snapshot()}get[vw](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,xI.createPure)(t=>(0,eu.isSerializedBcs)(t)?Ct(this,Tt).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Ct(this,Tt).addInput("pure",(0,Xi.is)(Ps.NormalizedCallArg,t)?(0,Xi.parse)(Ps.NormalizedCallArg,t):t instanceof Uint8Array?tu.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(tu.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(tu.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(tu.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Ct(this,Tt).commands.push(t);return gw(r-1)}splitCoins(t,r){const n=Is.Commands.SplitCoins(typeof t=="string"?this.object(t):Ei(this,wn,Dd).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):Ei(this,wn,ru).call(this,s))),i=Ct(this,Tt).commands.push(n);return gw(i-1,r.length)}mergeCoins(t,r){return this.add(Is.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(Is.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(Is.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(Is.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>Ei(this,wn,ru).call(this,n))}))}transferObjects(t,r){return this.add(Is.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):Ei(this,wn,ru).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(Is.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,pw.serializeV1TransactionData)(Ct(this,Tt).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Xi.parse)(bI.SerializedTransactionDataV2,Ct(this,Tt).snapshot()),(r,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(t){const{signer:r,...n}=t,i=await this.build(n);return r.signTransaction(i)}async build(t={}){return await this.prepareForSerialization(t),await Ei(this,wn,$d).call(this,t),Ct(this,Tt).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await Ei(this,wn,$d).call(this,t),Ct(this,Tt).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Ct(this,Tt).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Ct(this,Da)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Ct(this,js).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Ct(this,js).get(s))}await Ei(this,wn,Bd).call(this,n,t)}};Da=new WeakMap,$a=new WeakMap,js=new WeakMap,Tt=new WeakMap,wn=new WeakSet,ru=function(e){return(0,eu.isSerializedBcs)(e)?this.pure(e):Ei(this,wn,Dd).call(this,e)},Dd=function(e){return typeof e=="function"?(0,Xi.parse)(Ps.Argument,e(this)):(0,Xi.parse)(Ps.Argument,e)},$d=async function(e){if(!e.onlyTransactionKind&&!Ct(this,Tt).sender)throw new Error("Missing transaction sender");await Ei(this,wn,Bd).call(this,[...Ct(this,$a),wI.resolveTransactionData],e)},Bd=async function(e,t){const r=n=>{if(n>=e.length)return()=>{};const i=e[n];return async()=>{const s=r(n+1);let o=!1,a=!1;if(await i(Ct(this,Tt),t,async()=>{if(o)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);o=!0,await s(),a=!0}),!o)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await r(0)()};let EI=SI;var Fd=Object.defineProperty,CI=Object.getOwnPropertyDescriptor,MI=Object.getOwnPropertyNames,TI=Object.prototype.hasOwnProperty,ww=e=>{throw TypeError(e)},AI=(e,t)=>{for(var r in t)Fd(e,r,{get:t[r],enumerable:!0})},OI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MI(t))!TI.call(e,i)&&i!==r&&Fd(e,i,{get:()=>t[i],enumerable:!(n=CI(t,i))||n.enumerable});return e},II=e=>OI(Fd({},"__esModule",{value:!0}),e),_w=(e,t,r)=>t.has(e)||ww("Cannot "+r),dr=(e,t,r)=>(_w(e,t,"read from private field"),r?r.call(e):t.get(e)),Ud=(e,t,r)=>t.has(e)?ww("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xw=(e,t,r,n)=>(_w(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Sw={};AI(Sw,{AsyncCache:()=>Cw,InMemoryCache:()=>Mw,ObjectCache:()=>PI});var Ew=II(Sw),zd=Gr,ks,Cr,nu;class Cw{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,zd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,zd.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,zd.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 Mw extends Cw{constructor(){super(...arguments),Ud(this,ks,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return dr(this,ks)[t].get(r)??null}async set(t,r,n){dr(this,ks)[t].set(r,n)}async delete(t,r){dr(this,ks)[t].delete(r)}async clear(t){if(t)dr(this,ks)[t].clear();else for(const r of Object.values(dr(this,ks)))r.clear()}}ks=new WeakMap;class PI{constructor({cache:t=new Mw,onEffects:r}){Ud(this,Cr),Ud(this,nu),xw(this,Cr,t),xw(this,nu,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await dr(this,Cr).getObjects(i)).filter(a=>a!==null),o=new Map(s.map(a=>[a.objectId,a]));for(const a of t.inputs){if(!a.UnresolvedObject)continue;const c=o.get(a.UnresolvedObject.objectId);c&&(c.initialSharedVersion&&!a.UnresolvedObject.initialSharedVersion?a.UnresolvedObject.initialSharedVersion=c.initialSharedVersion:(c.version&&!a.UnresolvedObject.version&&(a.UnresolvedObject.version=c.version),c.digest&&!a.UnresolvedObject.digest&&(a.UnresolvedObject.digest=c.digest)))}await Promise.all(t.commands.map(async a=>{if(a.MoveCall){const c=await this.getMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function});c&&(a.MoveCall._argumentTypes=c.parameters)}})),await n(),await Promise.all(t.commands.map(async a=>{var c;(c=a.MoveCall)!=null&&c._argumentTypes&&await dr(this,Cr).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await dr(this,Cr).clear()}async getMoveFunctionDefinition(t){return dr(this,Cr).getMoveFunctionDefinition(t)}async getObjects(t){return dr(this,Cr).getObjects(t)}async deleteObjects(t){return dr(this,Cr).deleteObjects(t)}async clearOwnedObjects(){await dr(this,Cr).clear("OwnedObject")}async clearCustom(){await dr(this,Cr).clear("Custom")}async getCustom(t){return dr(this,Cr).getCustom(t)}async setCustom(t,r){return dr(this,Cr).setCustom(t,r)}async deleteCustom(t){return dr(this,Cr).deleteCustom(t)}async applyEffects(t){var r;if(!t.V2)throw new Error(`Unsupported transaction effects version ${t.$kind}`);const{lamportVersion:n,changedObjects:i}=t.V2,s=[],o=[];i.forEach(([a,c])=>{var u;if(c.outputState.NotExist)s.push(a);else if(c.outputState.ObjectWrite){const[l,f]=c.outputState.ObjectWrite;o.push({objectId:a,digest:l,version:n,owner:f.AddressOwner??f.ObjectOwner??null,initialSharedVersion:((u=f.Shared)==null?void 0:u.initialSharedVersion)??null})}}),await Promise.all([dr(this,Cr).addObjects(o),dr(this,Cr).deleteObjects(s),(r=dr(this,nu))==null?void 0:r.call(this,t)])}}Cr=new WeakMap,nu=new WeakMap;var Vd=Object.defineProperty,jI=Object.getOwnPropertyDescriptor,kI=Object.getOwnPropertyNames,NI=Object.prototype.hasOwnProperty,Tw=e=>{throw TypeError(e)},RI=(e,t)=>{for(var r in t)Vd(e,r,{get:t[r],enumerable:!0})},DI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kI(t))!NI.call(e,i)&&i!==r&&Vd(e,i,{get:()=>t[i],enumerable:!(n=jI(t,i))||n.enumerable});return e},$I=e=>DI(Vd({},"__esModule",{value:!0}),e),Aw=(e,t,r)=>t.has(e)||Tw("Cannot "+r),La=(e,t,r)=>(Aw(e,t,"read from private field"),r?r.call(e):t.get(e)),Ow=(e,t,r)=>t.has(e)?Tw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),qd=(e,t,r,n)=>(Aw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Iw={};RI(Iw,{CachingTransactionExecutor:()=>UI});var Pw=$I(Iw),BI=Gn,LI=Ew,FI=Qc,vo,yo;class UI{constructor({client:t,...r}){Ow(this,vo),Ow(this,yo,null),qd(this,vo,t),this.cache=new LI.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:La(this,vo),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,FI.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await La(this,vo).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=BI.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;qd(this,yo,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){La(this,yo)&&(await La(this,vo).waitForTransaction({digest:La(this,yo)}),qd(this,yo,null))}}vo=new WeakMap,yo=new WeakMap;var Gd=Object.defineProperty,zI=Object.getOwnPropertyDescriptor,VI=Object.getOwnPropertyNames,qI=Object.prototype.hasOwnProperty,jw=e=>{throw TypeError(e)},GI=(e,t)=>{for(var r in t)Gd(e,r,{get:t[r],enumerable:!0})},WI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of VI(t))!qI.call(e,i)&&i!==r&&Gd(e,i,{get:()=>t[i],enumerable:!(n=zI(t,i))||n.enumerable});return e},HI=e=>WI(Gd({},"__esModule",{value:!0}),e),KI=(e,t,r)=>t.has(e)||jw("Cannot "+r),_n=(e,t,r)=>(KI(e,t,"read from private field"),r?r.call(e):t.get(e)),kw=(e,t,r)=>t.has(e)?jw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Nw={};GI(Nw,{ParallelQueue:()=>JI,SerialQueue:()=>XI});var Rw=HI(Nw),Ji,Ns;class XI{constructor(){kw(this,Ji,[])}async runTask(t){return new Promise((r,n)=>{_n(this,Ji).push(()=>{t().finally(()=>{_n(this,Ji).shift(),_n(this,Ji).length>0&&_n(this,Ji)[0]()}).then(r,n)}),_n(this,Ji).length===1&&_n(this,Ji)[0]()})}}Ji=new WeakMap;class JI{constructor(t){kw(this,Ns,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{_n(this,Ns).length>0?_n(this,Ns).shift()():this.activeTasks--}).then(r,n)):_n(this,Ns).push(()=>{t().finally(()=>{_n(this,Ns).length>0?_n(this,Ns).shift()():this.activeTasks--}).then(r,n)})})}}Ns=new WeakMap;var Wd=Object.defineProperty,YI=Object.getOwnPropertyDescriptor,ZI=Object.getOwnPropertyNames,QI=Object.prototype.hasOwnProperty,Dw=e=>{throw TypeError(e)},eP=(e,t)=>{for(var r in t)Wd(e,r,{get:t[r],enumerable:!0})},tP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ZI(t))!QI.call(e,i)&&i!==r&&Wd(e,i,{get:()=>t[i],enumerable:!(n=YI(t,i))||n.enumerable});return e},rP=e=>tP(Wd({},"__esModule",{value:!0}),e),$w=(e,t,r)=>t.has(e)||Dw("Cannot "+r),Mr=(e,t,r)=>($w(e,t,"read from private field"),r?r.call(e):t.get(e)),bo=(e,t,r)=>t.has(e)?Dw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Hd=(e,t,r,n)=>($w(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Bw={};eP(Bw,{SerialTransactionExecutor:()=>oP,getGasCoinFromEffects:()=>Uw});var Lw=rP(Bw),nP=Er,Fw=Qc,iP=Pw,sP=Rw,iu,Fa,xn,su,Kd,ou;class oP{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){bo(this,iu,new sP.SerialQueue),bo(this,Fa),bo(this,xn),bo(this,su),bo(this,Kd,async i=>{if(!i.V2)return;const s=Uw(i).ref;s?Mr(this,xn).cache.setCustom("gasCoin",s):Mr(this,xn).cache.deleteCustom("gasCoin")}),bo(this,ou,async i=>{const s=await Mr(this,xn).cache.getCustom("gasCoin"),o=Fw.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Mr(this,su)),o.setSenderIfNotSet(Mr(this,Fa).toSuiAddress()),Mr(this,xn).buildTransaction({transaction:o})}),Hd(this,Fa,t),Hd(this,su,r),Hd(this,xn,new iP.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Mr(this,Kd).call(this,i)}))}async applyEffects(t){return Mr(this,xn).applyEffects(t)}async buildTransaction(t){return Mr(this,iu).runTask(()=>Mr(this,ou).call(this,t))}resetCache(){return Mr(this,xn).reset()}waitForLastTransaction(){return Mr(this,xn).waitForLastTransaction()}executeTransaction(t,r){return Mr(this,iu).runTask(async()=>{const n=(0,Fw.isTransaction)(t)?await Mr(this,ou).call(this,t):t,{signature:i}=await Mr(this,Fa).signTransaction(n),s=await Mr(this,xn).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,nP.toBase64)(o),data:s}})}}iu=new WeakMap,Fa=new WeakMap,xn=new WeakMap,su=new WeakMap,Kd=new WeakMap,ou=new WeakMap;function Uw(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 Xd=Object.defineProperty,aP=Object.getOwnPropertyDescriptor,cP=Object.getOwnPropertyNames,uP=Object.prototype.hasOwnProperty,zw=e=>{throw TypeError(e)},lP=(e,t)=>{for(var r in t)Xd(e,r,{get:t[r],enumerable:!0})},fP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cP(t))!uP.call(e,i)&&i!==r&&Xd(e,i,{get:()=>t[i],enumerable:!(n=aP(t,i))||n.enumerable});return e},dP=e=>fP(Xd({},"__esModule",{value:!0}),e),Jd=(e,t,r)=>t.has(e)||zw("Cannot "+r),qe=(e,t,r)=>(Jd(e,t,"read from private field"),r?r.call(e):t.get(e)),hr=(e,t,r)=>t.has(e)?zw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),nr=(e,t,r,n)=>(Jd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),rn=(e,t,r)=>(Jd(e,t,"access private method"),r),Vw=(e,t,r,n)=>({set _(i){nr(e,t,i,r)},get _(){return qe(e,t,n)}}),qw={};lP(qw,{ParallelTransactionExecutor:()=>yP});var hP=dP(qw),pP=Er,Gw=Gn,mP=Qc,gP=Id,vP=Pw,Ww=Rw,Hw=Lw,Yi,Yn,au,Ua,za,Va,cu,wo,Rr,Zi,Rs,Ds,Yd,uu,qa,_o,xo,Ci,Lr,Kw,Xw,Ga,Zd,Jw,Qd,Yw;const Wa={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class yP{constructor(t){hr(this,Lr),hr(this,Yi),hr(this,Yn),hr(this,au),hr(this,Ua),hr(this,za),hr(this,Va),hr(this,cu),hr(this,wo),hr(this,Rr),hr(this,Zi,[]),hr(this,Rs),hr(this,Ds,new Map),hr(this,Yd,new Ww.SerialQueue),hr(this,uu),hr(this,qa,null),hr(this,_o,null),hr(this,xo,0),hr(this,Ci,null),nr(this,Yi,t.signer),nr(this,Yn,t.client),nr(this,au,t.coinBatchSize??Wa.coinBatchSize),nr(this,Ua,t.initialCoinBalance??Wa.initialCoinBalance),nr(this,za,t.minimumCoinBalance??Wa.minimumCoinBalance),nr(this,cu,t.defaultGasBudget??qe(this,za)),nr(this,Va,t.epochBoundaryWindow??Wa.epochBoundaryWindow),nr(this,wo,t.maxPoolSize??Wa.maxPoolSize),nr(this,Rs,new vP.CachingTransactionExecutor({client:t.client,cache:t.cache})),nr(this,uu,new Ww.ParallelQueue(qe(this,wo))),nr(this,Rr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return nr(this,Ci,null),rn(this,Lr,Ga).call(this,()=>qe(this,Rs).reset())}async waitForLastTransaction(){await rn(this,Lr,Ga).call(this,()=>rn(this,Lr,Zd).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=bP(),o=await rn(this,Lr,Kw).call(this,t),a=()=>{qe(this,uu).runTask(()=>rn(this,Lr,Xw).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{qe(this,Ds).get(u)?(c.add(u),qe(this,Ds).get(u).push(()=>{c.delete(u),c.size===0&&a()})):qe(this,Ds).set(u,[])}),c.size===0&&a(),n}}Yi=new WeakMap,Yn=new WeakMap,au=new WeakMap,Ua=new WeakMap,za=new WeakMap,Va=new WeakMap,cu=new WeakMap,wo=new WeakMap,Rr=new WeakMap,Zi=new WeakMap,Rs=new WeakMap,Ds=new WeakMap,Yd=new WeakMap,uu=new WeakMap,qa=new WeakMap,_o=new WeakMap,xo=new WeakMap,Ci=new WeakMap,Lr=new WeakSet,Kw=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,Yn)}),t},Xw=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(qe(this,Yi).toSuiAddress()),await qe(this,Yd).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await rn(this,Lr,Qd).call(this)),e.setGasBudgetIfNotSet(qe(this,cu)),await rn(this,Lr,Ga).call(this),n=await rn(this,Lr,Jw).call(this),Vw(this,xo)._++,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,Yn)}),{signature:o}=await qe(this,Yi).signTransaction(s),a=await qe(this,Rs).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=Gw.bcs.TransactionEffects.parse(c),l=(0,Hw.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===qe(this,Yi).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new gP.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=qe(this,za)?qe(this,Zi).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(qe(this,Rr)||nr(this,Rr,new Map),qe(this,Rr).set(l.ref.objectId,l.ref))}return nr(this,qa,a.digest),{digest:a.digest,effects:(0,pP.toBase64)(c),data:a}}catch(s){throw n&&(qe(this,Rr)||nr(this,Rr,new Map),qe(this,Rr).set(n.id,null)),await rn(this,Lr,Ga).call(this,async()=>{await Promise.all([qe(this,Rs).cache.deleteObjects([...t]),rn(this,Lr,Zd).call(this)])}),s}finally{t.forEach(s=>{const o=qe(this,Ds).get(s);o&&o.length>0?o.shift()():o&&qe(this,Ds).delete(s)}),Vw(this,xo)._--}},Ga=async function(e){qe(this,_o)&&await qe(this,_o),nr(this,_o,(e==null?void 0:e().then(()=>{nr(this,_o,null)},()=>{}))??null)},Zd=async function(){const e=qe(this,qa);e&&(nr(this,qa,null),await qe(this,Yn).waitForTransaction({digest:e}))},Jw=async function(){if(qe(this,Zi).length===0&&qe(this,xo)<=qe(this,wo)&&await rn(this,Lr,Yw).call(this),qe(this,Zi).length===0)throw new Error("No coins available");return qe(this,Zi).shift()},Qd=async function(){if((qe(this,Ci)?qe(this,Ci).expiration-qe(this,Va)-Date.now():0)>0)return qe(this,Ci).price;if(qe(this,Ci)){const r=Math.max(qe(this,Ci).expiration+qe(this,Va)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await qe(this,Yn).getLatestSuiSystemState();return nr(this,Ci,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),rn(this,Lr,Qd).call(this)},Yw=async function(){var u;const e=Math.min(qe(this,au),qe(this,wo)-(qe(this,Zi).length+qe(this,xo))+1);if(e===0)return;const t=new mP.Transaction,r=qe(this,Yi).toSuiAddress();if(t.setSender(r),qe(this,Rr)){const l=[],f=[];for(const[h,y]of qe(this,Rr))y?l.push(y):f.push(h);if(f.length>0){const h=await qe(this,Yn).multiGetObjects({ids:f});l.push(...h.filter(y=>y.data!==null).map(({data:y})=>({objectId:y.objectId,version:y.version,digest:y.digest})))}t.setGasPayment(l),nr(this,Rr,new Map)}const n=new Array(e).fill(qe(this,Ua)),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,Yn).signAndExecuteTransaction({transaction:t,signer:qe(this,Yi),options:{showRawEffects:!0}}),a=Gw.bcs.TransactionEffects.parse(Uint8Array.from(o.rawEffects));(u=a.V2)==null||u.changedObjects.forEach(([l,{outputState:f}],h)=>{var y;h===((y=a.V2)==null?void 0:y.gasObjectIndex)||!f.ObjectWrite||qe(this,Zi).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(qe(this,Ua))})}),qe(this,Rr)||nr(this,Rr,new Map);const c=(0,Hw.getGasCoinFromEffects)(a).ref;qe(this,Rr).set(c.objectId,c),await qe(this,Yn).waitForTransaction({digest:o.digest})};function bP(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var eh=Object.defineProperty,wP=Object.getOwnPropertyDescriptor,_P=Object.getOwnPropertyNames,xP=Object.prototype.hasOwnProperty,SP=(e,t)=>{for(var r in t)eh(e,r,{get:t[r],enumerable:!0})},EP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _P(t))!xP.call(e,i)&&i!==r&&eh(e,i,{get:()=>t[i],enumerable:!(n=wP(t,i))||n.enumerable});return e},CP=e=>EP(eh({},"__esModule",{value:!0}),e),Zw={};SP(Zw,{coinWithBalance:()=>OP});var MP=CP(Zw),lu=Wi,TP=Gn,Qw=Gr,fu=bd,e2=Hc,AP=Qb;const du="CoinWithBalance",t2=(0,Qw.normalizeStructTag)("0x2::sui::SUI");function OP({type:e=t2,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(du,PP);const i=e==="gas"?e:(0,Qw.normalizeStructTag)(e);return n.add(fu.Commands.Intent({name:du,inputs:{},data:{type:i===t2&&r?"gas":i,balance:BigInt(t)}}))}}const IP=(0,lu.object)({type:(0,lu.string)(),balance:(0,lu.bigint)()});async function PP(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===du){const{type:h,balance:y}=(0,lu.parse)(IP,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,AP.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await jP({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!==du)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,fu.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const _=[];if(!c.has(y)){const[A,...P]=o.get(y).map(N=>e.addInput("object",e2.Inputs.ObjectRef({objectId:N.coinObjectId,digest:N.digest,version:N.version})));P.length>0&&_.push(fu.Commands.MergeCoins(A,P)),c.set(y,A)}_.push(fu.Commands.SplitCoins(c.get(y),[e.addInput("pure",e2.Inputs.Pure(TP.bcs.u64().serialize(b)))])),e.replaceCommand(f,_),e.mapArguments(A=>A.$kind==="Result"&&A.Result===f?{$kind:"NestedResult",NestedResult:[f+_.length-1,0]}:A)}return r()}async function jP({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 th=Object.defineProperty,kP=Object.getOwnPropertyDescriptor,NP=Object.getOwnPropertyNames,RP=Object.prototype.hasOwnProperty,DP=(e,t)=>{for(var r in t)th(e,r,{get:t[r],enumerable:!0})},$P=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NP(t))!RP.call(e,i)&&i!==r&&th(e,i,{get:()=>t[i],enumerable:!(n=kP(t,i))||n.enumerable});return e},BP=e=>$P(th({},"__esModule",{value:!0}),e),r2={};DP(r2,{Arguments:()=>zP});var LP=BP(r2),FP=nw,UP=sw;const zP={pure:(0,UP.createPure)(e=>t=>t.pure(e)),object:(0,FP.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 rh=Object.defineProperty,VP=Object.getOwnPropertyDescriptor,qP=Object.getOwnPropertyNames,GP=Object.prototype.hasOwnProperty,WP=(e,t)=>{for(var r in t)rh(e,r,{get:t[r],enumerable:!0})},HP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qP(t))!GP.call(e,i)&&i!==r&&rh(e,i,{get:()=>t[i],enumerable:!(n=VP(t,i))||n.enumerable});return e},KP=e=>HP(rh({},"__esModule",{value:!0}),e),n2={};WP(n2,{findTransactionBlockNames:()=>JP,listToRequests:()=>ZP,replaceNames:()=>YP});var XP=KP(n2),i2=bb;const So="/",JP=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){s2([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(So)){if(!(0,i2.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}s2(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function s2(e){const t=new Set;for(const r of e)if(r.includes(So)){if(!(0,i2.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const YP=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(So))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(So)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(So)&&(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(So)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},ZP=(e,t)=>{const r=[],n=o2(e.packages),i=o2(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 QP(r,t)},o2=e=>[...new Set(e)],QP=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var nh=Object.defineProperty,e7=Object.getOwnPropertyDescriptor,t7=Object.getOwnPropertyNames,r7=Object.prototype.hasOwnProperty,n7=(e,t)=>{for(var r in t)nh(e,r,{get:t[r],enumerable:!0})},i7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of t7(t))!r7.call(e,i)&&i!==r&&nh(e,i,{get:()=>t[i],enumerable:!(n=e7(t,i))||n.enumerable});return e},s7=e=>i7(nh({},"__esModule",{value:!0}),e),a2={};n7(a2,{namedPackagesPlugin:()=>a7});var o7=s7(a2),ih=XP;const a7=({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,ih.findTransactionBlockNames)(s),u=(0,ih.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,ih.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`${c2(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=lw(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}},lw=e=>`key_${e}`;var Rd=Object.defineProperty,q7=Object.getOwnPropertyDescriptor,G7=Object.getOwnPropertyNames,H7=Object.prototype.hasOwnProperty,W7=(e,t)=>{for(var r in t)Rd(e,r,{get:t[r],enumerable:!0})},K7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of G7(t))!H7.call(e,i)&&i!==r&&Rd(e,i,{get:()=>t[i],enumerable:!(n=q7(t,i))||n.enumerable});return e},X7=e=>K7(Rd({},"__esModule",{value:!0}),e),fw={};W7(fw,{Arguments:()=>tI.Arguments,AsyncCache:()=>mw.AsyncCache,Commands:()=>hw.Commands,Inputs:()=>Y7.Inputs,ObjectCache:()=>mw.ObjectCache,ParallelTransactionExecutor:()=>Q7.ParallelTransactionExecutor,SerialTransactionExecutor:()=>Z7.SerialTransactionExecutor,Transaction:()=>pw.Transaction,TransactionDataBuilder:()=>J7.TransactionDataBuilder,UpgradePolicy:()=>hw.UpgradePolicy,coinWithBalance:()=>eI.coinWithBalance,getPureBcsSchema:()=>dw.getPureBcsSchema,isTransaction:()=>pw.isTransaction,namedPackagesPlugin:()=>rI.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>dw.normalizedTypeToMoveTypeSignature});var ho=X7(fw),dw=jy,Y7=Pc,hw=Xf,pw=Lc,J7=od,mw=Cb,Z7=Fb,Q7=XO,eI=c7,tI=_7,rI=z7,gw=HE,Dd=WE,nI=ho,iI=Object.create,$d=Object.defineProperty,sI=Object.defineProperties,oI=Object.getOwnPropertyDescriptor,aI=Object.getOwnPropertyDescriptors,vw=Object.getOwnPropertyNames,yw=Object.getOwnPropertySymbols,cI=Object.getPrototypeOf,bw=Object.prototype.hasOwnProperty,uI=Object.prototype.propertyIsEnumerable,ww=(e,t,r)=>t in e?$d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lI=(e,t)=>{for(var r in t||(t={}))bw.call(t,r)&&ww(e,r,t[r]);if(yw)for(var r of yw(t))uI.call(t,r)&&ww(e,r,t[r]);return e},fI=(e,t)=>sI(e,aI(t)),dI=(e=>typeof jn<"u"?jn:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof jn<"u"?jn:t)[r]}):e)(function(e){if(typeof jn<"u")return jn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),hI=(e,t)=>function(){return t||(0,e[vw(e)[0]])((t={exports:{}}).exports,t),t.exports},pI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vw(t))!bw.call(e,i)&&i!==r&&$d(e,i,{get:()=>t[i],enumerable:!(n=oI(t,i))||n.enumerable});return e},po=(e,t,r)=>(r=e!=null?iI(cI(e)):{},pI(!e||!e.__esModule?$d(r,"default",{value:e,enumerable:!0}):r,e)),Ct=(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())}),mo=hI({"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=dI("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,N=x;N<g;N+=E)v=l(d,N,N+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,N,d.length,m),N=0;N<T;N++)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],N=w[d];x="";var se=this.clone();for(se.negative=0;!se.isZero();){var ue=se.modrn(N).toString(d);se=se.idivn(N),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 N=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,N+=k/67108864|0,se=k&67108863}m.words[v]=se|0,g=N|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var R=function(d,m,x){var E=d.words,C=m.words,k=x.words,T=0,g,v,N,se=E[0]|0,ue=se&8191,xe=se>>>13,be=E[1]|0,Ce=be&8191,Me=be>>>13,Ye=E[2]|0,Ue=Ye&8191,lt=Ye>>>13,ht=E[3]|0,$e=ht&8191,mt=ht>>>13,we=E[4]|0,me=we&8191,Te=we>>>13,Ge=E[5]|0,De=Ge&8191,Oe=Ge>>>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,et=_t&8191,At=_t>>>13,Dt=E[9]|0,nt=Dt&8191,xt=Dt>>>13,Tt=C[0]|0,st=Tt&8191,jt=Tt>>>13,Ot=C[1]|0,it=Ot&8191,bt=Ot>>>13,Et=C[2]|0,Je=Et&8191,gt=Et>>>13,It=C[3]|0,ot=It&8191,wt=It>>>13,Ut=C[4]|0,j=Ut&8191,S=Ut>>>13,M=C[5]|0,B=M&8191,K=M>>>13,Z=C[6]|0,ee=Z&8191,Be=Z>>>13,rt=C[7]|0,Re=rt&8191,z=rt>>>13,ie=C[8]|0,he=ie&8191,Pe=ie>>>13,We=C[9]|0,Ne=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,N=Math.imul(xe,jt);var ut=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(ut>>>26)|0,ut&=67108863,g=Math.imul(Ce,st),v=Math.imul(Ce,jt),v=v+Math.imul(Me,st)|0,N=Math.imul(Me,jt),g=g+Math.imul(ue,it)|0,v=v+Math.imul(ue,bt)|0,v=v+Math.imul(xe,it)|0,N=N+Math.imul(xe,bt)|0;var Xt=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,jt),v=v+Math.imul(lt,st)|0,N=Math.imul(lt,jt),g=g+Math.imul(Ce,it)|0,v=v+Math.imul(Ce,bt)|0,v=v+Math.imul(Me,it)|0,N=N+Math.imul(Me,bt)|0,g=g+Math.imul(ue,Je)|0,v=v+Math.imul(ue,gt)|0,v=v+Math.imul(xe,Je)|0,N=N+Math.imul(xe,gt)|0;var Pt=(T+g|0)+((v&8191)<<13)|0;T=(N+(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,N=Math.imul(mt,jt),g=g+Math.imul(Ue,it)|0,v=v+Math.imul(Ue,bt)|0,v=v+Math.imul(lt,it)|0,N=N+Math.imul(lt,bt)|0,g=g+Math.imul(Ce,Je)|0,v=v+Math.imul(Ce,gt)|0,v=v+Math.imul(Me,Je)|0,N=N+Math.imul(Me,gt)|0,g=g+Math.imul(ue,ot)|0,v=v+Math.imul(ue,wt)|0,v=v+Math.imul(xe,ot)|0,N=N+Math.imul(xe,wt)|0;var $t=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+($t>>>26)|0,$t&=67108863,g=Math.imul(me,st),v=Math.imul(me,jt),v=v+Math.imul(Te,st)|0,N=Math.imul(Te,jt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,bt)|0,v=v+Math.imul(mt,it)|0,N=N+Math.imul(mt,bt)|0,g=g+Math.imul(Ue,Je)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(lt,Je)|0,N=N+Math.imul(lt,gt)|0,g=g+Math.imul(Ce,ot)|0,v=v+Math.imul(Ce,wt)|0,v=v+Math.imul(Me,ot)|0,N=N+Math.imul(Me,wt)|0,g=g+Math.imul(ue,j)|0,v=v+Math.imul(ue,S)|0,v=v+Math.imul(xe,j)|0,N=N+Math.imul(xe,S)|0;var nr=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(De,st),v=Math.imul(De,jt),v=v+Math.imul(Oe,st)|0,N=Math.imul(Oe,jt),g=g+Math.imul(me,it)|0,v=v+Math.imul(me,bt)|0,v=v+Math.imul(Te,it)|0,N=N+Math.imul(Te,bt)|0,g=g+Math.imul($e,Je)|0,v=v+Math.imul($e,gt)|0,v=v+Math.imul(mt,Je)|0,N=N+Math.imul(mt,gt)|0,g=g+Math.imul(Ue,ot)|0,v=v+Math.imul(Ue,wt)|0,v=v+Math.imul(lt,ot)|0,N=N+Math.imul(lt,wt)|0,g=g+Math.imul(Ce,j)|0,v=v+Math.imul(Ce,S)|0,v=v+Math.imul(Me,j)|0,N=N+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,N=N+Math.imul(xe,K)|0;var xr=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(xr>>>26)|0,xr&=67108863,g=Math.imul(Le,st),v=Math.imul(Le,jt),v=v+Math.imul(ft,st)|0,N=Math.imul(ft,jt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,bt)|0,v=v+Math.imul(Oe,it)|0,N=N+Math.imul(Oe,bt)|0,g=g+Math.imul(me,Je)|0,v=v+Math.imul(me,gt)|0,v=v+Math.imul(Te,Je)|0,N=N+Math.imul(Te,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,wt)|0,v=v+Math.imul(mt,ot)|0,N=N+Math.imul(mt,wt)|0,g=g+Math.imul(Ue,j)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(lt,j)|0,N=N+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,N=N+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,N=N+Math.imul(xe,Be)|0;var sr=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(sr>>>26)|0,sr&=67108863,g=Math.imul(He,st),v=Math.imul(He,jt),v=v+Math.imul(kt,st)|0,N=Math.imul(kt,jt),g=g+Math.imul(Le,it)|0,v=v+Math.imul(Le,bt)|0,v=v+Math.imul(ft,it)|0,N=N+Math.imul(ft,bt)|0,g=g+Math.imul(De,Je)|0,v=v+Math.imul(De,gt)|0,v=v+Math.imul(Oe,Je)|0,N=N+Math.imul(Oe,gt)|0,g=g+Math.imul(me,ot)|0,v=v+Math.imul(me,wt)|0,v=v+Math.imul(Te,ot)|0,N=N+Math.imul(Te,wt)|0,g=g+Math.imul($e,j)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,j)|0,N=N+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,N=N+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,N=N+Math.imul(Me,Be)|0,g=g+Math.imul(ue,Re)|0,v=v+Math.imul(ue,z)|0,v=v+Math.imul(xe,Re)|0,N=N+Math.imul(xe,z)|0;var Yt=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(et,st),v=Math.imul(et,jt),v=v+Math.imul(At,st)|0,N=Math.imul(At,jt),g=g+Math.imul(He,it)|0,v=v+Math.imul(He,bt)|0,v=v+Math.imul(kt,it)|0,N=N+Math.imul(kt,bt)|0,g=g+Math.imul(Le,Je)|0,v=v+Math.imul(Le,gt)|0,v=v+Math.imul(ft,Je)|0,N=N+Math.imul(ft,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(Oe,ot)|0,N=N+Math.imul(Oe,wt)|0,g=g+Math.imul(me,j)|0,v=v+Math.imul(me,S)|0,v=v+Math.imul(Te,j)|0,N=N+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,N=N+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,N=N+Math.imul(lt,Be)|0,g=g+Math.imul(Ce,Re)|0,v=v+Math.imul(Ce,z)|0,v=v+Math.imul(Me,Re)|0,N=N+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,N=N+Math.imul(xe,Pe)|0;var gr=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(gr>>>26)|0,gr&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,jt),v=v+Math.imul(xt,st)|0,N=Math.imul(xt,jt),g=g+Math.imul(et,it)|0,v=v+Math.imul(et,bt)|0,v=v+Math.imul(At,it)|0,N=N+Math.imul(At,bt)|0,g=g+Math.imul(He,Je)|0,v=v+Math.imul(He,gt)|0,v=v+Math.imul(kt,Je)|0,N=N+Math.imul(kt,gt)|0,g=g+Math.imul(Le,ot)|0,v=v+Math.imul(Le,wt)|0,v=v+Math.imul(ft,ot)|0,N=N+Math.imul(ft,wt)|0,g=g+Math.imul(De,j)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,j)|0,N=N+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,N=N+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,N=N+Math.imul(mt,Be)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,z)|0,v=v+Math.imul(lt,Re)|0,N=N+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,N=N+Math.imul(Me,Pe)|0,g=g+Math.imul(ue,Ne)|0,v=v+Math.imul(ue,Fe)|0,v=v+Math.imul(xe,Ne)|0,N=N+Math.imul(xe,Fe)|0;var Cn=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,bt),v=v+Math.imul(xt,it)|0,N=Math.imul(xt,bt),g=g+Math.imul(et,Je)|0,v=v+Math.imul(et,gt)|0,v=v+Math.imul(At,Je)|0,N=N+Math.imul(At,gt)|0,g=g+Math.imul(He,ot)|0,v=v+Math.imul(He,wt)|0,v=v+Math.imul(kt,ot)|0,N=N+Math.imul(kt,wt)|0,g=g+Math.imul(Le,j)|0,v=v+Math.imul(Le,S)|0,v=v+Math.imul(ft,j)|0,N=N+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,N=N+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,N=N+Math.imul(Te,Be)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,z)|0,v=v+Math.imul(mt,Re)|0,N=N+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,N=N+Math.imul(lt,Pe)|0,g=g+Math.imul(Ce,Ne)|0,v=v+Math.imul(Ce,Fe)|0,v=v+Math.imul(Me,Ne)|0,N=N+Math.imul(Me,Fe)|0;var Fr=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,g=Math.imul(nt,Je),v=Math.imul(nt,gt),v=v+Math.imul(xt,Je)|0,N=Math.imul(xt,gt),g=g+Math.imul(et,ot)|0,v=v+Math.imul(et,wt)|0,v=v+Math.imul(At,ot)|0,N=N+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,N=N+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,N=N+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,N=N+Math.imul(Oe,Be)|0,g=g+Math.imul(me,Re)|0,v=v+Math.imul(me,z)|0,v=v+Math.imul(Te,Re)|0,N=N+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,N=N+Math.imul(mt,Pe)|0,g=g+Math.imul(Ue,Ne)|0,v=v+Math.imul(Ue,Fe)|0,v=v+Math.imul(lt,Ne)|0,N=N+Math.imul(lt,Fe)|0;var An=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(An>>>26)|0,An&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,wt),v=v+Math.imul(xt,ot)|0,N=Math.imul(xt,wt),g=g+Math.imul(et,j)|0,v=v+Math.imul(et,S)|0,v=v+Math.imul(At,j)|0,N=N+Math.imul(At,S)|0,g=g+Math.imul(He,B)|0,v=v+Math.imul(He,K)|0,v=v+Math.imul(kt,B)|0,N=N+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,N=N+Math.imul(ft,Be)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,z)|0,v=v+Math.imul(Oe,Re)|0,N=N+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,N=N+Math.imul(Te,Pe)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,Fe)|0,v=v+Math.imul(mt,Ne)|0,N=N+Math.imul(mt,Fe)|0;var Oi=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,g=Math.imul(nt,j),v=Math.imul(nt,S),v=v+Math.imul(xt,j)|0,N=Math.imul(xt,S),g=g+Math.imul(et,B)|0,v=v+Math.imul(et,K)|0,v=v+Math.imul(At,B)|0,N=N+Math.imul(At,K)|0,g=g+Math.imul(He,ee)|0,v=v+Math.imul(He,Be)|0,v=v+Math.imul(kt,ee)|0,N=N+Math.imul(kt,Be)|0,g=g+Math.imul(Le,Re)|0,v=v+Math.imul(Le,z)|0,v=v+Math.imul(ft,Re)|0,N=N+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,N=N+Math.imul(Oe,Pe)|0,g=g+Math.imul(me,Ne)|0,v=v+Math.imul(me,Fe)|0,v=v+Math.imul(Te,Ne)|0,N=N+Math.imul(Te,Fe)|0;var Ii=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(xt,B)|0,N=Math.imul(xt,K),g=g+Math.imul(et,ee)|0,v=v+Math.imul(et,Be)|0,v=v+Math.imul(At,ee)|0,N=N+Math.imul(At,Be)|0,g=g+Math.imul(He,Re)|0,v=v+Math.imul(He,z)|0,v=v+Math.imul(kt,Re)|0,N=N+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,N=N+Math.imul(ft,Pe)|0,g=g+Math.imul(De,Ne)|0,v=v+Math.imul(De,Fe)|0,v=v+Math.imul(Oe,Ne)|0,N=N+Math.imul(Oe,Fe)|0;var Tn=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,g=Math.imul(nt,ee),v=Math.imul(nt,Be),v=v+Math.imul(xt,ee)|0,N=Math.imul(xt,Be),g=g+Math.imul(et,Re)|0,v=v+Math.imul(et,z)|0,v=v+Math.imul(At,Re)|0,N=N+Math.imul(At,z)|0,g=g+Math.imul(He,he)|0,v=v+Math.imul(He,Pe)|0,v=v+Math.imul(kt,he)|0,N=N+Math.imul(kt,Pe)|0,g=g+Math.imul(Le,Ne)|0,v=v+Math.imul(Le,Fe)|0,v=v+Math.imul(ft,Ne)|0,N=N+Math.imul(ft,Fe)|0;var ki=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(ki>>>26)|0,ki&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,z),v=v+Math.imul(xt,Re)|0,N=Math.imul(xt,z),g=g+Math.imul(et,he)|0,v=v+Math.imul(et,Pe)|0,v=v+Math.imul(At,he)|0,N=N+Math.imul(At,Pe)|0,g=g+Math.imul(He,Ne)|0,v=v+Math.imul(He,Fe)|0,v=v+Math.imul(kt,Ne)|0,N=N+Math.imul(kt,Fe)|0;var ji=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(ji>>>26)|0,ji&=67108863,g=Math.imul(nt,he),v=Math.imul(nt,Pe),v=v+Math.imul(xt,he)|0,N=Math.imul(xt,Pe),g=g+Math.imul(et,Ne)|0,v=v+Math.imul(et,Fe)|0,v=v+Math.imul(At,Ne)|0,N=N+Math.imul(At,Fe)|0;var D=(T+g|0)+((v&8191)<<13)|0;T=(N+(v>>>13)|0)+(D>>>26)|0,D&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,Fe),v=v+Math.imul(xt,Ne)|0,N=Math.imul(xt,Fe);var W=(T+g|0)+((v&8191)<<13)|0;return T=(N+(v>>>13)|0)+(W>>>26)|0,W&=67108863,k[0]=ut,k[1]=Xt,k[2]=Pt,k[3]=$t,k[4]=nr,k[5]=xr,k[6]=sr,k[7]=Yt,k[8]=gr,k[9]=Cn,k[10]=Fr,k[11]=An,k[12]=Oi,k[13]=Ii,k[14]=Tn,k[15]=ki,k[16]=ji,k[17]=D,k[18]=W,T!==0&&(k[19]=T,x.length++),x};Math.imul||(R=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 N=C-v,se=p.words[N]|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=R(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 N=0;for(v=this.length-1;v>=0&&(N!==0||v>=E);v--){var se=this.words[v]|0;this.words[v]=N<<26-C|se>>>C,N=se&T}return g&&N!==0&&(g.words[g.length++]=N),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 N=0;N<v.length;N++)v.words[N]=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(),N=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(N)),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(N)),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,N=1;!(x.words[0]&N)&&v<26;++v,N<<=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 ne(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ne,q);function ce(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(ce,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 ne;else if(d==="p192")m=new ce;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 N=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(N,new o(1).iushln(xe-Ce-1));se=se.redMul(Me),N=Me.redSqr(),ue=ue.redMul(N),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 N=m.words[C],se=v-1;se>=0;se--){var ue=N>>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)}}),go=9e15,qi=1e9,Bd="0123456789abcdef",Qc="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",eu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Ld={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-go,maxE:go,crypto:!1},_w,yi,at=!0,tu="[DecimalError] ",Gi=tu+"Invalid argument: ",xw=tu+"Precision limit exceeded",Sw=tu+"crypto unavailable",Ew="[object Decimal]",Cr=Math.floor,hr=Math.pow,mI=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,gI=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,vI=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Mw=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,gn=1e7,Ze=7,yI=9007199254740991,bI=Qc.length-1,Ud=eu.length-1,ve={toStringTag:Ew};ve.absoluteValue=ve.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ke(e)},ve.ceil=function(){return Ke(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(Gi+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())+Ze,n.rounding=1,r=wI(n,kw(n,r)),n.precision=e,n.rounding=t,Ke(yi==2||yi==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(at=!1,s=l.s*hr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=vr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=hr(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=Vt(u.plus(l).times(a),u.plus(c),o+2,1),vr(a.d).slice(0,o)===(r=vr(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 at=!0,Ke(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/Ze))*Ze,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},ve.dividedBy=ve.div=function(e){return Vt(this,new this.constructor(e))},ve.dividedToIntegerBy=ve.divToInt=function(e){var t=this,r=t.constructor;return Ke(Vt(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 Ke(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/su(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=vo(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)},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=vo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/su(5,e)),i=vo(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)},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,Vt(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,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!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,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!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?Ke(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)},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<=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(at=!1,t=Math.ceil(a/Ze),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),at=!0,Ke(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/Ze)>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(at=!1,a=f+y,o=Wi(u,a),n=t?iu(l,a+10):Wi(e,a),c=Vt(o,n,a,1),Na(c.d,i=f,h))do if(a+=10,o=Wi(u,a),n=t?iu(l,a+10):Wi(e,a),c=Vt(o,n,a,1),!s){+vr(c.d).slice(i+1,i+15)+1==1e14&&(c=Ke(c,f+1,0));break}while(Na(c.d,i+=10,h));return at=!0,Ke(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 at?Ke(e,a,c):e}if(r=Cr(e.e/Ze),l=Cr(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]=gn-1;--u[i],u[n]+=gn}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=nu(u,r),at?Ke(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]?Ke(new n(r),n.precision,n.rounding):(at=!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),at=!0,r.minus(t))},ve.naturalExponential=ve.exp=function(){return Fd(this)},ve.naturalLogarithm=ve.ln=function(){return Wi(this)},ve.negated=ve.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Ke(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)),at?Ke(e,a,c):e;if(s=Cr(f.e/Ze),n=Cr(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)/gn|0,u[i]%=gn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=nu(u,n),at?Ke(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(Gi+e);return r.d?(t=Cw(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},ve.round=function(){var e=this,t=e.constructor;return Ke(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())+Ze,n.rounding=1,r=xI(n,kw(n,r)),n.precision=e,n.rounding=t,Ke(yi>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(at=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=vr(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(Vt(o,s,r+2,1)).times(.5),vr(s.d).slice(0,r)===(t=vr(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 at=!0,Ke(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=Vt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Ke(yi==2||yi==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/Ze)+Cr(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%gn|0,t=a/gn|0;s[i]=(s[i]+t)%gn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=nu(s,r),at?Ke(e,f.precision,f.rounding):e},ve.toBinary=function(e,t){return Vd(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,qi),t===void 0?t=n.rounding:Br(t,0,8),Ke(r,e+r.e+1,t))},ve.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Vn(n,!0):(Br(e,0,qi),t===void 0?t=i.rounding:Br(t,0,8),n=Ke(new i(n),e+1,t),r=Vn(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=Vn(i):(Br(e,0,qi),t===void 0?t=s.rounding:Br(t,0,8),n=Ke(new s(i),e+i.e+1,t),r=Vn(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=Cw(_)-y.e-1,o=s%Ze,t.d[0]=hr(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(Gi+a);e=a.gt(t)?s>0?t:u:a}for(at=!1,a=new w(vr(_)),l=w.precision,w.precision=s=_.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,at=!0,h},ve.toHexadecimal=ve.toHex=function(e,t){return Vd(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]?(at=!1,r=Vt(r,e,0,t,1).times(e),at=!0,Ke(r)):(e.s=r.s,r=e),r},ve.toNumber=function(){return+this},ve.toOctal=function(e,t){return Vd(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(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=Cr(e.e/Ze),t>=e.d.length-1&&(r=u<0?-u:u)<=yI)return i=Aw(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)?Cr(u*(Math.log("0."+vr(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(at=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=Fd(e.times(Wi(a,n+r)),n),i.d&&(i=Ke(i,n+5,1),Na(i.d,n,s)&&(t=n+10,i=Ke(Fd(e.times(Wi(a,t+r)),t),t+5,1),+vr(i.d).slice(n+1,n+15)+1==1e14&&(i=Ke(i,n+1,0)))),i.s=o,at=!0,c.rounding=s,Ke(i,n,s))},ve.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Vn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Br(e,1,qi),t===void 0?t=i.rounding:Br(t,0,8),n=Ke(new i(n),e,t),r=Vn(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,qi),t===void 0?t=n.rounding:Br(t,0,8)),Ke(new n(r),e,t)},ve.toString=function(){var e=this,t=e.constructor,r=Vn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},ve.truncated=ve.trunc=function(){return Ke(new this.constructor(this),this.e+1,1)},ve.valueOf=ve.toJSON=function(){var e=this,t=e.constructor,r=Vn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function vr(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+=Hi(r)),s+=n;o=e[t],n=o+"",r=Ze-n.length,r&&(s+=Hi(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(Gi+e)}function Na(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=hr(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)==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 ru(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]+=Bd.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 wI(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/su(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=vo(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,R,F,L,H,q,X,ne,ce,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=gn,y=Ze,l=Cr(n.e/y)-Cr(i.e/y)),oe=m.length,ne=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<ne||h)&&H--;f++)q=h*c+(d[f]||0),P[f]=q/m|0,h=q%m|0;_=h||f<ne}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),oe=m.length,ne=d.length),X=oe,R=d.slice(0,oe),F=R.length;F<oe;)R[F++]=0;V=m.slice(),V.unshift(0),ce=m[0],m[1]>=c/2&&++ce;do h=0,u=t(m,R,oe,F),u<0?(L=R[0],oe!=F&&(L=L*c+(R[1]||0)),h=L/ce|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=R.length,u=t(w,R,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(R,w,F,c),u==-1&&(F=R.length,u=t(m,R,oe,F),u<1&&(h++,r(R,oe<F?V:m,F,c))),F=R.length):u===0&&(h++,R=[0]),P[f++]=h,u&&R[0]?R[F++]=d[X]||0:(R=[d[X]],F=1);while((X++<ne||R[0]!==void 0)&&H--);_=R[0]!==void 0}P[0]||P.shift()}if(y==1)I.e=l,_w=_;else{for(f=1,h=P[0];h>=10;h/=10)f++;I.e=f+l*y-1,Ke(I,a?s+I.e+1:s,o,_)}return I}}();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+=Ze,o=t,l=f[h=0],c=l/hr(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/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,(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=hr(10,Ze-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]==gn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=gn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return at&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function Vn(e,t,r){if(!e.isFinite())return Iw(e);var n,i=e.e,s=vr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+Hi(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Hi(-i-1)+s,r&&(n=r-o)>0&&(s+=Hi(n))):i>=o?(s+=Hi(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Hi(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Hi(n))),s}function nu(e,t){var r=e[0];for(t*=Ze;r>=10;r/=10)t++;return t}function iu(e,t,r){if(t>bI)throw at=!0,r&&(e.precision=r),Error(xw);return Ke(new e(Qc),t,1,!0)}function vn(e,t,r){if(t>Ud)throw Error(xw);return Ke(new e(eu),t,r,!0)}function Cw(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 Hi(e){for(var t="";e--;)t+="0";return t}function Aw(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Ze+4);for(at=!1;;){if(r%2&&(s=s.times(t),jw(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),jw(t.d,o)}return at=!0,s}function Tw(e){return e.d[e.d.length-1]&1}function Ow(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 Fd(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?(at=!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=Ke(s.times(e),c,1),r=r.times(++l),a=o.plus(Vt(s,r,c,1)),vr(a.d).slice(0,c)===vr(o.d).slice(0,c)){for(i=f;i--;)o=Ke(o.times(o),c,1);if(t==null)if(u<3&&Na(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=_,y,at=!0);else return h.precision=_,o}o=a}}function Wi(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,R=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?(at=!1,l=R):l=t,I.precision=l+=_,r=vr(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=vr(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=iu(I,l+2,R).times(s+""),w=Wi(new I(n+"."+r.slice(1)),l-_).plus(u),I.precision=R,t==null?Ke(w,R,P,at=!0):w;for(f=w,c=o=w=Vt(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(Vt(o,new I(i),l,1)),vr(u.d).slice(0,l)===vr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(iu(I,l+2,R).times(s+""))),c=Vt(c,new I(y),l,1),t==null)if(Na(c.d,l-_,P,a))I.precision=l+=_,u=o=w=Vt(f.minus(1),f.plus(1),l,1),h=Ke(w.times(w),l,1),i=a=1;else return Ke(c,I.precision=R,P,at=!0);else return I.precision=R,c;c=u,i+=2}}function Iw(e){return String(e.s*e.s/0)}function zd(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ze,r<0&&(n+=Ze),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ze;n<i;)e.d.push(+t.slice(n,n+=Ze));t=t.slice(n),n=Ze-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),at&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function _I(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Mw.test(t))return zd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(gI.test(t))r=16,t=t.toLowerCase();else if(mI.test(t))r=2;else if(vI.test(t))r=8;else throw Error(Gi+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=Aw(n,new n(r),s,s*2)),u=ru(t,r,gn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=nu(u,l),e.d=u,at=!1,o&&(e=Vt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?hr(2,c):Ra.pow(2,c))),at=!0,e)}function xI(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:vo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/su(5,r)),t=vo(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 vo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Ze);for(at=!1,c=r.times(r),a=new e(n);;){if(o=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 at=!0,o.d.length=l+1,o}function su(e,t){for(var r=e;--t;)r*=e;return r}function kw(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 yi=n?4:1,t;if(r=t.divToInt(i),r.isZero())yi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return yi=Tw(r)?n?2:3:n?4:1,t;yi=Tw(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Vd(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,_=r!==void 0;if(_?(Br(r,1,qi),n===void 0?n=y.rounding:Br(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=Iw(e);else{for(l=Vn(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=ru(Vn(h),10,i),h.e=h.d.length),f=ru(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=_w),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+=Bd.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=ru(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Bd.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 jw(e,t){if(e.length>t)return e.length=t,!0}function SI(e){return new this(e).abs()}function EI(e){return new this(e).acos()}function MI(e){return new this(e).acosh()}function CI(e,t){return new this(e).plus(t)}function AI(e){return new this(e).asin()}function TI(e){return new this(e).asinh()}function OI(e){return new this(e).atan()}function II(e){return new this(e).atanh()}function kI(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 jI(e){return new this(e).cbrt()}function PI(e){return Ke(e=new this(e),e.e+1,2)}function NI(e,t,r){return new this(e).clamp(t,r)}function RI(e){if(!e||typeof e!="object")throw Error(tu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,qi,"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]=Ld[r]),(n=e[r])!==void 0)if(Cr(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(Gi+r+": "+n);if(r="crypto",i&&(this[r]=Ld[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(Sw);else this[r]=!1;else throw Error(Gi+r+": "+n);return this}function DI(e){return new this(e).cos()}function $I(e){return new this(e).cosh()}function Pw(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,Nw(s)){u.s=s.s,at?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;at?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return zd(u,s.toString())}else if(c!=="string")throw Error(Gi+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),Mw.test(s)?zd(u,s):_I(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=RI,i.clone=Pw,i.isDecimal=Nw,i.abs=SI,i.acos=EI,i.acosh=MI,i.add=CI,i.asin=AI,i.asinh=TI,i.atan=OI,i.atanh=II,i.atan2=kI,i.cbrt=jI,i.ceil=PI,i.clamp=NI,i.cos=DI,i.cosh=$I,i.div=BI,i.exp=LI,i.floor=UI,i.hypot=FI,i.ln=zI,i.log=VI,i.log10=GI,i.log2=qI,i.max=HI,i.min=WI,i.mod=KI,i.mul=XI,i.pow=YI,i.random=JI,i.round=ZI,i.sign=QI,i.sin=e9,i.sinh=t9,i.sqrt=r9,i.sub=n9,i.sum=i9,i.tan=s9,i.tanh=o9,i.trunc=a9,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 BI(e,t){return new this(e).div(t)}function LI(e){return new this(e).exp()}function UI(e){return Ke(e=new this(e),e.e+1,3)}function FI(){var e,t,r=new this(0);for(at=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return at=!0,new this(1/0);r=t}return at=!0,r.sqrt()}function Nw(e){return e instanceof Ra||e&&e.toStringTag===Ew||!1}function zI(e){return new this(e).ln()}function VI(e,t){return new this(e).log(t)}function qI(e){return new this(e).log(2)}function GI(e){return new this(e).log(10)}function HI(){return Ow(this,arguments,"lt")}function WI(){return Ow(this,arguments,"gt")}function KI(e,t){return new this(e).mod(t)}function XI(e,t){return new this(e).mul(t)}function YI(e,t){return new this(e).pow(t)}function JI(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Br(e,1,qi),n=Math.ceil(e/Ze),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(Sw);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Ze,n&&e&&(i=hr(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 ZI(e){return Ke(e=new this(e),e.e+1,this.rounding)}function QI(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function e9(e){return new this(e).sin()}function t9(e){return new this(e).sinh()}function r9(e){return new this(e).sqrt()}function n9(e,t){return new this(e).sub(t)}function i9(){var e=0,t=arguments,r=new this(t[e]);for(at=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return at=!0,Ke(r,this.precision,this.rounding)}function s9(e){return new this(e).tan()}function o9(e){return new this(e).tanh()}function a9(e){return Ke(e=new this(e),e.e+1,1)}ve[Symbol.for("nodejs.util.inspect.custom")]=ve.toString,ve[Symbol.toStringTag]="Decimal";var Ra=ve.constructor=Pw(Ld);Qc=new Ra(Qc),eu=new Ra(eu);var ou=Ra,bi=po(mo()),qd=po(mo()),c9=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 qd.default(e).mul(new qd.default(this.slippage)).div(new qd.default("1000000000000000000")).toString())}swap(e,t,r,n){return Ct(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})})}},Rw="0x000000000000000000000000000000000000000000000000000000000000dee9",u9=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return Ct(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:Rw,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 Ct(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${Rw}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return Ct(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(Xi)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},l9=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return Ct(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})})}},f9=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return Ct(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(Xi)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},d9=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return Ct(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})})}},h9=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 Ct(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(Xi)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},p9=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return Ct(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(Xi),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},Dw=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(Xi)],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 Ct(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(Xi)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function $w(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 m9(e){return e.split("::")[0]}function As(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=As(r),u=fI(lI({},c),{type_arguments:i.map(l=>As(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>Ts.isSuiCoin(l)?l:As(l).source_address),u.source_address=$w(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===Lw||r===y9?"0x2":Dd.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=$w(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function Bw(e){return As(e).source_address}var g9="0x2::coin::Coin",v9=/^0x2::coin::Coin<(.+)>$/,Lw="0x2::sui::SUI",y9="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",Ts=class us{static getCoinTypeArg(t){const r=t.type.match(v9);return r?r[1]:null}static isSUI(t){const r=us.getCoinTypeArg(t);return r?us.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`${g9}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{Bw(i.coinAddress)===Bw(t)&&n.push(i)}),n}static isSuiCoin(t){return As(t).full_address===Lw}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=us.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=us.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=us.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:us.sortByBalance(a),remainingCoins:us.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 Uw(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 Ki(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 b9(e,t){e=Ki(e),t=Ki(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 Fw(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function Gd(e,t,r,n){const i=Ts.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:Fw(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(Ts.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(Ts.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=Ts.sortByBalance(i);o.slice(0,3).reduce((f,h)=>f+h.balance,BigInt(0))<BigInt(r)&&(o=Ts.sortByBalanceDes(i));let c=Ts.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 w9(e,t=!0){return Ct(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 _9(e){return!(!e.startsWith("0x")||e.length!==66)}var yo=po(mo()),au=po(mo()),Da=po(mo()),bo=new Da.default(0);new Da.default(1);var x9=new Da.default(2);x9.pow(new Da.default(128));var S9=new Da.default("18446744073709551615"),wo=1e9;function zw(e,t,r){let n=bo;return t?n=e.mul(new au.default(wo-r*wo)).div(new au.default(wo)):n=e.mul(new au.default(wo+r*wo)).div(new au.default(wo)),Number(n.toString())}function E9(e,t,r){return new ou(e).mul(ou.pow(2,-64)).pow(2).mul(ou.pow(10,t-r))}function M9(e,t,r,n){return Ct(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,_=Ki(u),w=Ki(l),A=new nI.Transaction,I=b9(_,w),P=n===0?"0x15c0555d7601d98ca2659a8387d377a81b1e285ee0808484e101f96d05806187":"0x2918cf39850de6d5d94d8196dc878c8c722cd79db659318e00bff57fbb4e2ede",R=I?_:w,F=I?w:_,L=[R,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(!_9(r))throw new AggregateError("Aggregator package not set","InvalidWallet");w9(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?bo:S9,ne=0;for(let x=0;x<q.length;x+=1)if(!q[x].parsedJson.data.is_exceed)if(t.byAmountIn){const E=new yo.BN(q[x].parsedJson.data.amount_out);E.gt(X)&&(ne=x,X=E)}else{const E=new yo.BN(q[x].parsedJson.data.amount_out);E.lt(X)&&(ne=x,X=E)}const ce=q[ne].parsedJson.data,oe=ce.step_results[0].current_sqrt_price,[V,$]=yield Promise.all([e.getCoinMetadata({coinType:R}).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=E9(oe,V,$),d={amountIn:new yo.BN((s=ce.amount_in)!=null?s:0),amountOut:new yo.BN((o=ce.amount_out)!=null?o:0),routes:[{path:[{id:y[ne],direction:I,provider:"CETUS",from:_,target:w,feeRate:ce.fee_rate,amountIn:ce.amount_in,amountOut:ce.amount_out,extendedDetails:{afterSqrtPrice:ce.after_sqrt_price}}],amountIn:new yo.BN((a=ce.amount_in)!=null?a:0),amountOut:new yo.BN((c=ce.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:ce.is_exceed,routeData:d}})}var C9=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return Ct(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})})}},A9=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 Ct(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})})}},T9=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 Ct(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})})}},O9=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return Ct(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})})}},I9=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return Ct(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=Fw(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(Xi)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},k9=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 Ct(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(Xi)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},Vw="CETUS",j9="DEEPBOOK",P9="KRIYA",N9="FLOWX",R9="FLOWXV3",D9="KRIYAV3",qw="TURBOS",Hd="AFTERMATH",$9="HAEDAL",B9="VOLO",L9="AFSUI",U9="BLUEMOVE",Gw="DEEPBOOKV3",Hw="SCALLOP",F9="https://api-sui.cetus.zone/router_v2",z9=class{constructor(e,t,r,n){this.endpoint=e?q9(e):F9,this.client=r||new gw.SuiClient({url:gw.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return Ct(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:As(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 Ct(this,null,function*(){return G9(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return Ct(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 Ct(this,null,function*(){const i=[],s=[],o=[],a=new Dw(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:`${Dd.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 Ct(this,null,function*(){let t;try{t=yield M9(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return Ct(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 bi.default(0)),u=t.reduce((y,_)=>y.add(_.amountOut),new bi.default(0)),l=zw(i?u:c,i,n);if(i)return yield this.expectInputSwap(s,r,t,new bi.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 Ct(this,null,function*(){const{routers:t,byAmountIn:r,slippage:n,txb:i,partner:s,isMergeTragetCoin:o,refreshAllCoins:a,payDeepFeeAmount:c}=e,u=t[0].path[0].from;let l=yield this.getCoins(u,a);const f=t[0].path[t[0].path.length-1].target,h=t.reduce((R,F)=>R.add(F.amountIn),new bi.default(0)),y=t.reduce((R,F)=>R.add(F.amountOut),new bi.default(0)),_=zw(r?y:h,r,n),A=Gd(i,l,BigInt((r?h:_).toString()),u);let I;if(c&&c>0){let R=yield this.getCoins(this.deepbookv3DeepFeeType());I=Gd(i,R,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 R=yield this.getCoins(f,a);const F=Gd(i,R,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:`${Dd.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 Vw:return new Dw(this.env,t);case j9:return new u9(this.env);case Gw:return new I9(this.env);case P9:return new l9(this.env);case D9:return new f9(this.env);case N9:return new d9(this.env);case R9:return new h9(this.env);case qw:return new p9(this.env);case Hd:return new c9(this.env);case $9:return new C9(this.env);case L9:return new A9(this.env);case B9:return new T9(this.env);case U9:return new O9(this.env);case Hw:return new k9(this.env);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return Ct(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return Ct(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return Ct(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return Ct(this,null,function*(){const e=yield K9(this.endpoint);return e?e.data:null})}};function V9(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 bi.default(e.amount_in.toString()),amountOut:new bi.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===Hd&&(l=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let f;return(i.provider===qw||i.provider===Hd||i.provider===Vw||i.provider===Gw||i.provider===Hw)&&(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 bi.default(n.amount_in.toString()),amountOut:new bi.default(n.amount_out.toString()),initialPrice:new ou(n.initial_price.toString())})),totalDeepFee:t}}var Xi="0x0000000000000000000000000000000000000000000000000000000000000006";po(mo());function q9(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function G9(e,t){return Ct(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield W9(e,t):r=yield H9(e,t),!r)return null;if(!r.ok)return{amountIn:bo,amountOut:bo,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:Uw(10001)}};const n=yield r.json();if(n.data!=null)return V9(n.data);const i=n.msg==="liquidity is not enough";return{amountIn:bo,amountOut:bo,routes:[],insufficientLiquidity:i,error:{code:10003,msg:Uw(10003)}}})}function H9(e,t){return Ct(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=Ki(r),h=Ki(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 W9(e,t){return Ct(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=Ki(r),y=Ki(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 K9(e){return Ct(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var Ww=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(Ww||{}),Kw=z9,X9=Ww,Xw=m9,$a=As,Wd={exports:{}},Kd={},Yw;function Jw(){return Yw||(Yw=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 R=P.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=P.indexOf("=");F===-1&&(F=R);var L=F===R?0:4-F%4;return[F,L]}function l(P){var R=u(P),F=R[0],L=R[1];return(F+L)*3/4-L}function f(P,R,F){return(R+F)*3/4-F}function h(P){var R,F=u(P),L=F[0],H=F[1],q=new s(f(P,L,H)),X=0,ne=H>0?L-4:L,ce;for(ce=0;ce<ne;ce+=4)R=i[P.charCodeAt(ce)]<<18|i[P.charCodeAt(ce+1)]<<12|i[P.charCodeAt(ce+2)]<<6|i[P.charCodeAt(ce+3)],q[X++]=R>>16&255,q[X++]=R>>8&255,q[X++]=R&255;return H===2&&(R=i[P.charCodeAt(ce)]<<2|i[P.charCodeAt(ce+1)]>>4,q[X++]=R&255),H===1&&(R=i[P.charCodeAt(ce)]<<10|i[P.charCodeAt(ce+1)]<<4|i[P.charCodeAt(ce+2)]>>2,q[X++]=R>>8&255,q[X++]=R&255),q}function y(P){return n[P>>18&63]+n[P>>12&63]+n[P>>6&63]+n[P&63]}function _(P,R,F){for(var L,H=[],q=R;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 R,F=P.length,L=F%3,H=[],q=16383,X=0,ne=F-L;X<ne;X+=q)H.push(_(P,X,X+q>ne?ne:X+q));return L===1?(R=P[F-1],H.push(n[R>>2]+n[R<<4&63]+"==")):L===2&&(R=(P[F-2]<<8)+P[F-1],H.push(n[R>>10]+n[R>>4&63]+n[R<<2&63]+"=")),H.join("")}var A={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */A.read=function(P,R,F,L,H){var q,X,ne=H*8-L-1,ce=(1<<ne)-1,oe=ce>>1,V=-7,$=F?H-1:0,p=F?-1:1,d=P[R+$];for($+=p,q=d&(1<<-V)-1,d>>=-V,V+=ne;V>0;q=q*256+P[R+$],$+=p,V-=8);for(X=q&(1<<-V)-1,q>>=-V,V+=L;V>0;X=X*256+P[R+$],$+=p,V-=8);if(q===0)q=1-oe;else{if(q===ce)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,R,F,L,H,q){var X,ne,ce,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=R<0||R===0&&1/R<0?1:0;for(R=Math.abs(R),isNaN(R)||R===1/0?(ne=isNaN(R)?1:0,X=V):(X=Math.floor(Math.log(R)/Math.LN2),R*(ce=Math.pow(2,-X))<1&&(X--,ce*=2),X+$>=1?R+=p/ce:R+=p*Math.pow(2,1-$),R*ce>=2&&(X++,ce/=2),X+$>=V?(ne=0,X=V):X+$>=1?(ne=(R*ce-1)*Math.pow(2,H),X=X+$):(ne=R*Math.pow(2,$-1)*Math.pow(2,H),X=0));H>=8;P[F+d]=ne&255,d+=m,ne/=256,H-=8);for(X=X<<H|ne,oe+=H;oe>0;P[F+d]=X&255,d+=m,X/=256,oe-=8);P[F+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=c2(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}},c2=e=>`key_${e}`;var sh=Object.defineProperty,c7=Object.getOwnPropertyDescriptor,u7=Object.getOwnPropertyNames,l7=Object.prototype.hasOwnProperty,f7=(e,t)=>{for(var r in t)sh(e,r,{get:t[r],enumerable:!0})},d7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of u7(t))!l7.call(e,i)&&i!==r&&sh(e,i,{get:()=>t[i],enumerable:!(n=c7(t,i))||n.enumerable});return e},h7=e=>d7(sh({},"__esModule",{value:!0}),e),u2={};f7(u2,{Arguments:()=>b7.Arguments,AsyncCache:()=>h2.AsyncCache,Commands:()=>f2.Commands,Inputs:()=>p7.Inputs,ObjectCache:()=>h2.ObjectCache,ParallelTransactionExecutor:()=>v7.ParallelTransactionExecutor,SerialTransactionExecutor:()=>g7.SerialTransactionExecutor,Transaction:()=>d2.Transaction,TransactionDataBuilder:()=>m7.TransactionDataBuilder,UpgradePolicy:()=>f2.UpgradePolicy,coinWithBalance:()=>y7.coinWithBalance,getPureBcsSchema:()=>l2.getPureBcsSchema,isTransaction:()=>d2.isTransaction,namedPackagesPlugin:()=>w7.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>l2.normalizedTypeToMoveTypeSignature});var Eo=h7(u2),l2=Ib,p7=Hc,f2=bd,d2=Qc,m7=Id,h2=Ew,g7=Lw,v7=hP,y7=MP,b7=LP,w7=o7,p2={},hu={},oh={},pu={},ah={},mu={};Object.defineProperty(mu,"__esModule",{value:!0}),mu.Convert=void 0;class _7{static toPriceFeed(t){return ch(t,Ti("PriceFeed"))}static priceFeedToJson(t){return uh(t,Ti("PriceFeed"))}static toPrice(t){return ch(t,Ti("Price"))}static priceToJson(t){return uh(t,Ti("Price"))}static toPriceFeedMetadata(t){return ch(t,Ti("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return uh(t,Ti("PriceFeedMetadata"))}}mu.Convert=_7;function Mi(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 x7(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 S7(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 Co(e,t,r,n=""){function i(l,f){return typeof l==typeof f?f:Mi(l,f,n)}function s(l,f){const h=l.length;for(let y=0;y<h;y++){const b=l[y];try{return Co(f,b,r)}catch{}}return Mi(l,f)}function o(l,f){return l.indexOf(f)!==-1?f:Mi(l,f)}function a(l,f){return Array.isArray(f)?f.map(h=>Co(h,l,r)):Mi("array",f)}function c(l){if(l===null)return null;const f=new Date(l);return isNaN(f.valueOf())?Mi("Date",l):f}function u(l,f,h){if(h===null||typeof h!="object"||Array.isArray(h))return Mi("object",h);const y={};return Object.getOwnPropertyNames(l).forEach(b=>{const _=l[b],A=Object.prototype.hasOwnProperty.call(h,b)?h[b]:void 0;y[_.key]=Co(A,_.typ,r,_.key)}),Object.getOwnPropertyNames(h).forEach(b=>{Object.prototype.hasOwnProperty.call(l,b)||(y[b]=Co(h[b],f,r,b))}),y}if(t==="any")return e;if(t===null)return e===null?e:Mi(t,e);if(t===!1)return Mi(t,e);for(;typeof t=="object"&&t.ref!==void 0;)t=E7[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):Mi(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function ch(e,t){return Co(e,t,x7)}function uh(e,t){return Co(e,t,S7)}function $s(...e){return{unionMembers:e}}function lh(e,t){return{props:e,additional:t}}function Ti(e){return{ref:e}}const E7={PriceFeed:lh([{json:"ema_price",js:"ema_price",typ:Ti("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:$s(void 0,Ti("PriceFeedMetadata"))},{json:"price",js:"price",typ:Ti("Price")},{json:"vaa",js:"vaa",typ:$s(void 0,"")}],"any"),Price:lh([{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:lh([{json:"attestation_time",js:"attestation_time",typ:$s(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:$s(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:$s(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:$s(void 0,0)},{json:"slot",js:"slot",typ:$s(void 0,0)}],"any")};var fh={},m2;function gu(){return m2||(m2=1,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},r={};r.byteLength=l,r.toByteArray=h,r.fromByteArray=_;for(var n=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;function u(N){var R=N.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=N.indexOf("=");F===-1&&(F=R);var L=F===R?0:4-F%4;return[F,L]}function l(N){var R=u(N),F=R[0],L=R[1];return(F+L)*3/4-L}function f(N,R,F){return(R+F)*3/4-F}function h(N){var R,F=u(N),L=F[0],W=F[1],q=new s(f(N,L,W)),X=0,ie=W>0?L-4:L,ae;for(ae=0;ae<ie;ae+=4)R=i[N.charCodeAt(ae)]<<18|i[N.charCodeAt(ae+1)]<<12|i[N.charCodeAt(ae+2)]<<6|i[N.charCodeAt(ae+3)],q[X++]=R>>16&255,q[X++]=R>>8&255,q[X++]=R&255;return W===2&&(R=i[N.charCodeAt(ae)]<<2|i[N.charCodeAt(ae+1)]>>4,q[X++]=R&255),W===1&&(R=i[N.charCodeAt(ae)]<<10|i[N.charCodeAt(ae+1)]<<4|i[N.charCodeAt(ae+2)]>>2,q[X++]=R>>8&255,q[X++]=R&255),q}function y(N){return n[N>>18&63]+n[N>>12&63]+n[N>>6&63]+n[N&63]}function b(N,R,F){for(var L,W=[],q=R;q<F;q+=3)L=(N[q]<<16&16711680)+(N[q+1]<<8&65280)+(N[q+2]&255),W.push(y(L));return W.join("")}function _(N){for(var R,F=N.length,L=F%3,W=[],q=16383,X=0,ie=F-L;X<ie;X+=q)W.push(b(N,X,X+q>ie?ie:X+q));return L===1?(R=N[F-1],W.push(n[R>>2]+n[R<<4&63]+"==")):L===2&&(R=(N[F-2]<<8)+N[F-1],W.push(n[R>>10]+n[R>>4&63]+n[R<<2&63]+"=")),W.join("")}var A={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */A.read=function(N,R,F,L,W){var q,X,ie=W*8-L-1,ae=(1<<ie)-1,ce=ae>>1,V=-7,$=F?W-1:0,p=F?-1:1,d=N[R+$];for($+=p,q=d&(1<<-V)-1,d>>=-V,V+=ie;V>0;q=q*256+N[R+$],$+=p,V-=8);for(X=q&(1<<-V)-1,q>>=-V,V+=L;V>0;X=X*256+N[R+$],$+=p,V-=8);if(q===0)q=1-ce;else{if(q===ae)return X?NaN:(d?-1:1)*(1/0);X=X+Math.pow(2,L),q=q-ce}return(d?-1:1)*X*Math.pow(2,q-L)},A.write=function(N,R,F,L,W,q){var X,ie,ae,ce=q*8-W-1,V=(1<<ce)-1,$=V>>1,p=W===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=L?0:q-1,m=L?1:-1,x=R<0||R===0&&1/R<0?1:0;for(R=Math.abs(R),isNaN(R)||R===1/0?(ie=isNaN(R)?1:0,X=V):(X=Math.floor(Math.log(R)/Math.LN2),R*(ae=Math.pow(2,-X))<1&&(X--,ae*=2),X+$>=1?R+=p/ae:R+=p*Math.pow(2,1-$),R*ae>=2&&(X++,ae/=2),X+$>=V?(ie=0,X=V):X+$>=1?(ie=(R*ae-1)*Math.pow(2,W),X=X+$):(ie=R*Math.pow(2,$-1)*Math.pow(2,W),X=0));W>=8;N[F+d]=ie&255,d+=m,ie/=256,W-=8);for(X=X<<W|ie,ce+=W;ce>0;N[F+d]=X&255,d+=m,X/=256,ce-=8);N[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(P){const R=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:ne}=globalThis;V.TYPED_ARRAY_SUPPORT=ce(),!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 ce(){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 ne<"u"&&(gt(j,ne)||j&>(j.buffer,ne)))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=N(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 N(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 Et(j).length;default:if(K)return B?-1:Ot(j).length;S=(""+S).toLowerCase(),K=!0}}V.byteLength=N;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 Ge(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 rt=Math.min(ee,Be),Re=this.slice(K,Z),z=S.slice(M,B);for(let ie=0;ie<rt;++ie)if(Re[ie]!==z[ie]){ee=Re[ie],Be=z[ie];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 rt(z,ie){return Z===1?z[ie]:z.readUInt16BE(ie*Z)}let Re;if(K){let z=-1;for(Re=M;Re<ee;Re++)if(rt(j,Re)===rt(S,z===-1?0:Re-z)){if(z===-1&&(z=Re),Re-z+1===Be)return z*Z}else z!==-1&&(Re-=Re-z),z=-1}else for(M+Be>ee&&(M=ee-Be),Re=M;Re>=0;Re--){let z=!0;for(let ie=0;ie<Be;ie++)if(rt(j,Re+ie)!==rt(S,ie)){z=!1;break}if(z)return Re}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 Ye(j,S,M,B){return Je(it(S),j,M,B)}function Ue(j,S,M,B){return Je(Et(S),j,M,B)}function lt(j,S,M,B){return Je(bt(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 Ye(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?R.fromByteArray(j):R.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 rt,Re,z,ie;switch(Be){case 1:Z<128&&(ee=Z);break;case 2:rt=j[K+1],(rt&192)===128&&(ie=(Z&31)<<6|rt&63,ie>127&&(ee=ie));break;case 3:rt=j[K+1],Re=j[K+2],(rt&192)===128&&(Re&192)===128&&(ie=(Z&15)<<12|(rt&63)<<6|Re&63,ie>2047&&(ie<55296||ie>57343)&&(ee=ie));break;case 4:rt=j[K+1],Re=j[K+2],z=j[K+3],(rt&192)===128&&(Re&192)===128&&(z&192)===128&&(ie=(Z&15)<<18|(rt&63)<<12|(Re&63)<<6|z&63,ie>65535&&ie<1114112&&(ee=ie))}}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 Ge(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=wt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Tt(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=wt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Tt(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=wt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Tt(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=wt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Tt(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=wt(function(S,M=0){return Le(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeBigUInt64BE=wt(function(S,M=0){return ft(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeIntLE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,M,B,rt-1,-rt)}let Z=0,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 rt=Math.pow(2,8*B-1);Ie(this,S,M,B,rt-1,-rt)}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=wt(function(S,M=0){return Le(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),V.prototype.writeBigInt64BE=wt(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 et(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}`}}}et("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),et("ERR_INVALID_ARG_TYPE",function(j,S){return`The "${j}" argument must be of type number. Received type ${typeof S}`},TypeError),et("ERR_OUT_OF_RANGE",function(j,S,M){let B=`The value of "${j}" is out of range.`,K=M;return Number.isInteger(M)&&Math.abs(M)>2**32?K=At(String(M)):typeof M=="bigint"&&(K=String(M),(M>BigInt(2)**BigInt(32)||M<-(BigInt(2)**BigInt(32)))&&(K=At(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function At(j){let S="",M=j.length;const B=j[0]==="-"?1:0;for(;M>=B+4;M-=3)S=`_${j.slice(M-3,M)}${S}`;return`${j.slice(0,M)}${S}`}function Dt(j,S,M){xt(S,"offset"),(j[S]===void 0||j[S+M]===void 0)&&Tt(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)}Dt(B,K,Z)}function xt(j,S){if(typeof j!="number")throw new _t.ERR_INVALID_ARG_TYPE(S,"number",j)}function Tt(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 bt(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 Et(j){return R.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 wt(j){return typeof BigInt>"u"?Ut:j}function Ut(){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}(Kd)),Kd}Wd.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=Jw().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 N=1;for(g=u(p,v,p.length,d),v=0;v<k;v++)N*=d;this.imuln(N),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 N=this.clone();for(N.negative=0;!N.isZero();){var se=N.modrn(v).toString(p);N=N.idivn(v),N.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,N=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+N,v+=C/67108864|0,N=C&67108863}d.words[g]=N|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,N=x[0]|0,se=N&8191,ue=N>>>13,xe=x[1]|0,be=xe&8191,Ce=xe>>>13,Me=x[2]|0,Ye=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,Ge=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,et=kt>>>13,At=x[9]|0,Dt=At&8191,nt=At>>>13,xt=E[0]|0,Tt=xt&8191,st=xt>>>13,jt=E[1]|0,Ot=jt&8191,it=jt>>>13,bt=E[2]|0,Et=bt&8191,Je=bt>>>13,gt=E[3]|0,It=gt&8191,ot=gt>>>13,wt=E[4]|0,Ut=wt&8191,j=wt>>>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,rt=Be&8191,Re=Be>>>13,z=E[8]|0,ie=z&8191,he=z>>>13,Pe=E[9]|0,We=Pe&8191,Ne=Pe>>>13;m.negative=p.negative^d.negative,m.length=19,T=Math.imul(se,Tt),g=Math.imul(se,st),g=g+Math.imul(ue,Tt)|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,Tt),g=Math.imul(be,st),g=g+Math.imul(Ce,Tt)|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 ut=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(ut>>>26)|0,ut&=67108863,T=Math.imul(Ye,Tt),g=Math.imul(Ye,st),g=g+Math.imul(Ue,Tt)|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,Et)|0,g=g+Math.imul(se,Je)|0,g=g+Math.imul(ue,Et)|0,v=v+Math.imul(ue,Je)|0;var Xt=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,T=Math.imul(ht,Tt),g=Math.imul(ht,st),g=g+Math.imul($e,Tt)|0,v=Math.imul($e,st),T=T+Math.imul(Ye,Ot)|0,g=g+Math.imul(Ye,it)|0,g=g+Math.imul(Ue,Ot)|0,v=v+Math.imul(Ue,it)|0,T=T+Math.imul(be,Et)|0,g=g+Math.imul(be,Je)|0,g=g+Math.imul(Ce,Et)|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,Tt),g=Math.imul(we,st),g=g+Math.imul(me,Tt)|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(Ye,Et)|0,g=g+Math.imul(Ye,Je)|0,g=g+Math.imul(Ue,Et)|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,Ut)|0,g=g+Math.imul(se,j)|0,g=g+Math.imul(ue,Ut)|0,v=v+Math.imul(ue,j)|0;var $t=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+($t>>>26)|0,$t&=67108863,T=Math.imul(Ge,Tt),g=Math.imul(Ge,st),g=g+Math.imul(De,Tt)|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,Et)|0,g=g+Math.imul(ht,Je)|0,g=g+Math.imul($e,Et)|0,v=v+Math.imul($e,Je)|0,T=T+Math.imul(Ye,It)|0,g=g+Math.imul(Ye,ot)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,ot)|0,T=T+Math.imul(be,Ut)|0,g=g+Math.imul(be,j)|0,g=g+Math.imul(Ce,Ut)|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 nr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(nr>>>26)|0,nr&=67108863,T=Math.imul(Ie,Tt),g=Math.imul(Ie,st),g=g+Math.imul(Le,Tt)|0,v=Math.imul(Le,st),T=T+Math.imul(Ge,Ot)|0,g=g+Math.imul(Ge,it)|0,g=g+Math.imul(De,Ot)|0,v=v+Math.imul(De,it)|0,T=T+Math.imul(we,Et)|0,g=g+Math.imul(we,Je)|0,g=g+Math.imul(me,Et)|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(Ye,Ut)|0,g=g+Math.imul(Ye,j)|0,g=g+Math.imul(Ue,Ut)|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 xr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(xr>>>26)|0,xr&=67108863,T=Math.imul(dt,Tt),g=Math.imul(dt,st),g=g+Math.imul(He,Tt)|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(Ge,Et)|0,g=g+Math.imul(Ge,Je)|0,g=g+Math.imul(De,Et)|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,Ut)|0,g=g+Math.imul(ht,j)|0,g=g+Math.imul($e,Ut)|0,v=v+Math.imul($e,j)|0,T=T+Math.imul(Ye,M)|0,g=g+Math.imul(Ye,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,rt)|0,g=g+Math.imul(se,Re)|0,g=g+Math.imul(ue,rt)|0,v=v+Math.imul(ue,Re)|0;var sr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(sr>>>26)|0,sr&=67108863,T=Math.imul(_t,Tt),g=Math.imul(_t,st),g=g+Math.imul(et,Tt)|0,v=Math.imul(et,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,Et)|0,g=g+Math.imul(Ie,Je)|0,g=g+Math.imul(Le,Et)|0,v=v+Math.imul(Le,Je)|0,T=T+Math.imul(Ge,It)|0,g=g+Math.imul(Ge,ot)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,ot)|0,T=T+Math.imul(we,Ut)|0,g=g+Math.imul(we,j)|0,g=g+Math.imul(me,Ut)|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(Ye,Z)|0,g=g+Math.imul(Ye,ee)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,ee)|0,T=T+Math.imul(be,rt)|0,g=g+Math.imul(be,Re)|0,g=g+Math.imul(Ce,rt)|0,v=v+Math.imul(Ce,Re)|0,T=T+Math.imul(se,ie)|0,g=g+Math.imul(se,he)|0,g=g+Math.imul(ue,ie)|0,v=v+Math.imul(ue,he)|0;var Yt=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,T=Math.imul(Dt,Tt),g=Math.imul(Dt,st),g=g+Math.imul(nt,Tt)|0,v=Math.imul(nt,st),T=T+Math.imul(_t,Ot)|0,g=g+Math.imul(_t,it)|0,g=g+Math.imul(et,Ot)|0,v=v+Math.imul(et,it)|0,T=T+Math.imul(dt,Et)|0,g=g+Math.imul(dt,Je)|0,g=g+Math.imul(He,Et)|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(Ge,Ut)|0,g=g+Math.imul(Ge,j)|0,g=g+Math.imul(De,Ut)|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(Ye,rt)|0,g=g+Math.imul(Ye,Re)|0,g=g+Math.imul(Ue,rt)|0,v=v+Math.imul(Ue,Re)|0,T=T+Math.imul(be,ie)|0,g=g+Math.imul(be,he)|0,g=g+Math.imul(Ce,ie)|0,v=v+Math.imul(Ce,he)|0,T=T+Math.imul(se,We)|0,g=g+Math.imul(se,Ne)|0,g=g+Math.imul(ue,We)|0,v=v+Math.imul(ue,Ne)|0;var gr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(gr>>>26)|0,gr&=67108863,T=Math.imul(Dt,Ot),g=Math.imul(Dt,it),g=g+Math.imul(nt,Ot)|0,v=Math.imul(nt,it),T=T+Math.imul(_t,Et)|0,g=g+Math.imul(_t,Je)|0,g=g+Math.imul(et,Et)|0,v=v+Math.imul(et,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,Ut)|0,g=g+Math.imul(Ie,j)|0,g=g+Math.imul(Le,Ut)|0,v=v+Math.imul(Le,j)|0,T=T+Math.imul(Ge,M)|0,g=g+Math.imul(Ge,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,rt)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,rt)|0,v=v+Math.imul($e,Re)|0,T=T+Math.imul(Ye,ie)|0,g=g+Math.imul(Ye,he)|0,g=g+Math.imul(Ue,ie)|0,v=v+Math.imul(Ue,he)|0,T=T+Math.imul(be,We)|0,g=g+Math.imul(be,Ne)|0,g=g+Math.imul(Ce,We)|0,v=v+Math.imul(Ce,Ne)|0;var Cn=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,T=Math.imul(Dt,Et),g=Math.imul(Dt,Je),g=g+Math.imul(nt,Et)|0,v=Math.imul(nt,Je),T=T+Math.imul(_t,It)|0,g=g+Math.imul(_t,ot)|0,g=g+Math.imul(et,It)|0,v=v+Math.imul(et,ot)|0,T=T+Math.imul(dt,Ut)|0,g=g+Math.imul(dt,j)|0,g=g+Math.imul(He,Ut)|0,v=v+Math.imul(He,j)|0,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(Ge,Z)|0,g=g+Math.imul(Ge,ee)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,ee)|0,T=T+Math.imul(we,rt)|0,g=g+Math.imul(we,Re)|0,g=g+Math.imul(me,rt)|0,v=v+Math.imul(me,Re)|0,T=T+Math.imul(ht,ie)|0,g=g+Math.imul(ht,he)|0,g=g+Math.imul($e,ie)|0,v=v+Math.imul($e,he)|0,T=T+Math.imul(Ye,We)|0,g=g+Math.imul(Ye,Ne)|0,g=g+Math.imul(Ue,We)|0,v=v+Math.imul(Ue,Ne)|0;var Fr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,T=Math.imul(Dt,It),g=Math.imul(Dt,ot),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,ot),T=T+Math.imul(_t,Ut)|0,g=g+Math.imul(_t,j)|0,g=g+Math.imul(et,Ut)|0,v=v+Math.imul(et,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(Ge,rt)|0,g=g+Math.imul(Ge,Re)|0,g=g+Math.imul(De,rt)|0,v=v+Math.imul(De,Re)|0,T=T+Math.imul(we,ie)|0,g=g+Math.imul(we,he)|0,g=g+Math.imul(me,ie)|0,v=v+Math.imul(me,he)|0,T=T+Math.imul(ht,We)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,We)|0,v=v+Math.imul($e,Ne)|0;var An=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(An>>>26)|0,An&=67108863,T=Math.imul(Dt,Ut),g=Math.imul(Dt,j),g=g+Math.imul(nt,Ut)|0,v=Math.imul(nt,j),T=T+Math.imul(_t,M)|0,g=g+Math.imul(_t,B)|0,g=g+Math.imul(et,M)|0,v=v+Math.imul(et,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,rt)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Le,rt)|0,v=v+Math.imul(Le,Re)|0,T=T+Math.imul(Ge,ie)|0,g=g+Math.imul(Ge,he)|0,g=g+Math.imul(De,ie)|0,v=v+Math.imul(De,he)|0,T=T+Math.imul(we,We)|0,g=g+Math.imul(we,Ne)|0,g=g+Math.imul(me,We)|0,v=v+Math.imul(me,Ne)|0;var Oi=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,T=Math.imul(Dt,M),g=Math.imul(Dt,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(et,Z)|0,v=v+Math.imul(et,ee)|0,T=T+Math.imul(dt,rt)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(He,rt)|0,v=v+Math.imul(He,Re)|0,T=T+Math.imul(Ie,ie)|0,g=g+Math.imul(Ie,he)|0,g=g+Math.imul(Le,ie)|0,v=v+Math.imul(Le,he)|0,T=T+Math.imul(Ge,We)|0,g=g+Math.imul(Ge,Ne)|0,g=g+Math.imul(De,We)|0,v=v+Math.imul(De,Ne)|0;var Ii=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,T=Math.imul(Dt,Z),g=Math.imul(Dt,ee),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,ee),T=T+Math.imul(_t,rt)|0,g=g+Math.imul(_t,Re)|0,g=g+Math.imul(et,rt)|0,v=v+Math.imul(et,Re)|0,T=T+Math.imul(dt,ie)|0,g=g+Math.imul(dt,he)|0,g=g+Math.imul(He,ie)|0,v=v+Math.imul(He,he)|0,T=T+Math.imul(Ie,We)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Le,We)|0,v=v+Math.imul(Le,Ne)|0;var Tn=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,T=Math.imul(Dt,rt),g=Math.imul(Dt,Re),g=g+Math.imul(nt,rt)|0,v=Math.imul(nt,Re),T=T+Math.imul(_t,ie)|0,g=g+Math.imul(_t,he)|0,g=g+Math.imul(et,ie)|0,v=v+Math.imul(et,he)|0,T=T+Math.imul(dt,We)|0,g=g+Math.imul(dt,Ne)|0,g=g+Math.imul(He,We)|0,v=v+Math.imul(He,Ne)|0;var ki=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(ki>>>26)|0,ki&=67108863,T=Math.imul(Dt,ie),g=Math.imul(Dt,he),g=g+Math.imul(nt,ie)|0,v=Math.imul(nt,he),T=T+Math.imul(_t,We)|0,g=g+Math.imul(_t,Ne)|0,g=g+Math.imul(et,We)|0,v=v+Math.imul(et,Ne)|0;var ji=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(ji>>>26)|0,ji&=67108863,T=Math.imul(Dt,We),g=Math.imul(Dt,Ne),g=g+Math.imul(nt,We)|0,v=Math.imul(nt,Ne);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]=ut,C[2]=Xt,C[3]=Pt,C[4]=$t,C[5]=nr,C[6]=xr,C[7]=sr,C[8]=Yt,C[9]=gr,C[10]=Cn,C[11]=Fr,C[12]=An,C[13]=Oi,C[14]=Ii,C[15]=Tn,C[16]=ki,C[17]=ji,C[18]=D,k!==0&&(C[19]=k,m.length++),m};Math.imul||(P=I);function R($,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,N=$.words[v]|0,se=p.words[g]|0,ue=N*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 R($,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=R(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 N=this.words[g]|0;this.words[g]=v<<26-E|N>>>E,v=N&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 N=x.clone()._ishlnsubmul(E,1,T);N.negative===0&&(x=N,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 N=0,se=1;!(d.words[0]&se)&&N<26;++N,se<<=1);if(N>0)for(d.iushrn(N);N-- >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 N;return d.cmpn(1)===0?N=x:N=E,N.cmpn(0)<0&&N.iadd(p),N},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 ne(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ne,H);function ce(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ce,H),ce.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 ne;else if(p==="p25519")d=new ce;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),N=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));N=N.redMul(Ce),v=Ce.redSqr(),se=se.redMul(v),ue=be}return N},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],N=g-1;N>=0;N--){var se=v>>N&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||N!==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,Hs)}(Wd);var Y9=Wd.exports;const Zw=Zo(Y9);/*!
|
|
33
|
+
*/(function(N){const R=r,F=A,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;N.Buffer=V,N.SlowBuffer=v,N.INSPECT_MAX_BYTES=50;const W=2147483647;N.kMaxLength=W;const{Uint8Array:q,ArrayBuffer:X,SharedArrayBuffer:ie}=globalThis;V.TYPED_ARRAY_SUPPORT=ae(),!V.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ae(){try{const k=new q(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,q.prototype),Object.setPrototypeOf(k,S),k.foo()===42}catch{return!1}}Object.defineProperty(V.prototype,"parent",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.buffer}}),Object.defineProperty(V.prototype,"offset",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.byteOffset}});function ce(k){if(k>W)throw new RangeError('The value "'+k+'" is invalid for option "size"');const S=new q(k);return Object.setPrototypeOf(S,V.prototype),S}function V(k,S,T){if(typeof k=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return $(k,S,T)}V.poolSize=8192;function $(k,S,T){if(typeof k=="string")return x(k,S);if(X.isView(k))return E(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(gt(k,X)||k&>(k.buffer,X)||typeof ie<"u"&&(gt(k,ie)||k&>(k.buffer,ie)))return O(k,S,T);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=k.valueOf&&k.valueOf();if(B!=null&&B!==k)return V.from(B,S,T);const K=C(k);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return V.from(k[Symbol.toPrimitive]("string"),S,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}V.from=function(k,S,T){return $(k,S,T)},Object.setPrototypeOf(V.prototype,q.prototype),Object.setPrototypeOf(V,q);function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function d(k,S,T){return p(k),k<=0?ce(k):S!==void 0?typeof T=="string"?ce(k).fill(S,T):ce(k).fill(S):ce(k)}V.alloc=function(k,S,T){return d(k,S,T)};function m(k){return p(k),ce(k<0?0:g(k)|0)}V.allocUnsafe=function(k){return m(k)},V.allocUnsafeSlow=function(k){return m(k)};function x(k,S){if((typeof S!="string"||S==="")&&(S="utf8"),!V.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const T=j(k,S)|0;let B=ce(T);const K=B.write(k,S);return K!==T&&(B=B.slice(0,K)),B}function M(k){const S=k.length<0?0:g(k.length)|0,T=ce(S);for(let B=0;B<S;B+=1)T[B]=k[B]&255;return T}function E(k){if(gt(k,q)){const S=new q(k);return O(S.buffer,S.byteOffset,S.byteLength)}return M(k)}function O(k,S,T){if(S<0||k.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(k.byteLength<S+(T||0))throw new RangeError('"length" is outside of buffer bounds');let B;return S===void 0&&T===void 0?B=new q(k):T===void 0?B=new q(k,S):B=new q(k,S,T),Object.setPrototypeOf(B,V.prototype),B}function C(k){if(V.isBuffer(k)){const S=g(k.length)|0,T=ce(S);return T.length===0||k.copy(T,0,0,S),T}if(k.length!==void 0)return typeof k.length!="number"||Pt(k.length)?ce(0):M(k);if(k.type==="Buffer"&&Array.isArray(k.data))return M(k.data)}function g(k){if(k>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return k|0}function v(k){return+k!=k&&(k=0),V.alloc(+k)}V.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==V.prototype},V.compare=function(S,T){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),gt(T,q)&&(T=V.from(T,T.offset,T.byteLength)),!V.isBuffer(S)||!V.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===T)return 0;let B=S.length,K=T.length;for(let Z=0,re=Math.min(B,K);Z<re;++Z)if(S[Z]!==T[Z]){B=S[Z],K=T[Z];break}return B<K?-1:K<B?1:0},V.isEncoding=function(S){switch(String(S).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},V.concat=function(S,T){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return V.alloc(0);let B;if(T===void 0)for(T=0,B=0;B<S.length;++B)T+=S[B].length;const K=V.allocUnsafe(T);let Z=0;for(B=0;B<S.length;++B){let re=S[B];if(gt(re,q))Z+re.length>K.length?(V.isBuffer(re)||(re=V.from(re)),re.copy(K,Z)):q.prototype.set.call(K,re,Z);else if(V.isBuffer(re))re.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=re.length}return K};function j(k,S){if(V.isBuffer(k))return k.length;if(X.isView(k)||gt(k,X))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const T=k.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&T===0)return 0;let K=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return It(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return Mt(k).length;default:if(K)return B?-1:It(k).length;S=(""+S).toLowerCase(),K=!0}}V.byteLength=j;function ee(k,S,T){let B=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,S>>>=0,T<=S))return"";for(k||(k="utf8");;)switch(k){case"hex":return Ge(this,S,T);case"utf8":case"utf-8":return $e(this,S,T);case"ascii":return ge(this,S,T);case"latin1":case"binary":return Ae(this,S,T);case"base64":return ht(this,S,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,S,T);default:if(B)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),B=!0}}V.prototype._isBuffer=!0;function se(k,S,T){const B=k[S];k[S]=k[T],k[T]=B}V.prototype.swap16=function(){const S=this.length;if(S%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let T=0;T<S;T+=2)se(this,T,T+1);return this},V.prototype.swap32=function(){const S=this.length;if(S%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let T=0;T<S;T+=4)se(this,T,T+3),se(this,T+1,T+2);return this},V.prototype.swap64=function(){const S=this.length;if(S%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let T=0;T<S;T+=8)se(this,T,T+7),se(this,T+1,T+6),se(this,T+2,T+5),se(this,T+3,T+4);return this},V.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?$e(this,0,S):ee.apply(this,arguments)},V.prototype.toLocaleString=V.prototype.toString,V.prototype.equals=function(S){if(!V.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:V.compare(this,S)===0},V.prototype.inspect=function(){let S="";const T=N.INSPECT_MAX_BYTES;return S=this.toString("hex",0,T).replace(/(.{2})/g,"$1 ").trim(),this.length>T&&(S+=" ... "),"<Buffer "+S+">"},L&&(V.prototype[L]=V.prototype.inspect),V.prototype.compare=function(S,T,B,K,Z){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),!V.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(T===void 0&&(T=0),B===void 0&&(B=S?S.length:0),K===void 0&&(K=0),Z===void 0&&(Z=this.length),T<0||B>S.length||K<0||Z>this.length)throw new RangeError("out of range index");if(K>=Z&&T>=B)return 0;if(K>=Z)return-1;if(T>=B)return 1;if(T>>>=0,B>>>=0,K>>>=0,Z>>>=0,this===S)return 0;let re=Z-K,Be=B-T;const rt=Math.min(re,Be),Re=this.slice(K,Z),z=S.slice(T,B);for(let oe=0;oe<rt;++oe)if(Re[oe]!==z[oe]){re=Re[oe],Be=z[oe];break}return re<Be?-1:Be<re?1:0};function ye(k,S,T,B,K){if(k.length===0)return-1;if(typeof T=="string"?(B=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,Pt(T)&&(T=K?0:k.length-1),T<0&&(T=k.length+T),T>=k.length){if(K)return-1;T=k.length-1}else if(T<0)if(K)T=0;else return-1;if(typeof S=="string"&&(S=V.from(S,B)),V.isBuffer(S))return S.length===0?-1:pe(k,S,T,B,K);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(k,S,T):q.prototype.lastIndexOf.call(k,S,T):pe(k,[S],T,B,K);throw new TypeError("val must be string, number or Buffer")}function pe(k,S,T,B,K){let Z=1,re=k.length,Be=S.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(k.length<2||S.length<2)return-1;Z=2,re/=2,Be/=2,T/=2}function rt(z,oe){return Z===1?z[oe]:z.readUInt16BE(oe*Z)}let Re;if(K){let z=-1;for(Re=T;Re<re;Re++)if(rt(k,Re)===rt(S,z===-1?0:Re-z)){if(z===-1&&(z=Re),Re-z+1===Be)return z*Z}else z!==-1&&(Re-=Re-z),z=-1}else for(T+Be>re&&(T=re-Be),Re=T;Re>=0;Re--){let z=!0;for(let oe=0;oe<Be;oe++)if(rt(k,Re+oe)!==rt(S,oe)){z=!1;break}if(z)return Re}return-1}V.prototype.includes=function(S,T,B){return this.indexOf(S,T,B)!==-1},V.prototype.indexOf=function(S,T,B){return ye(this,S,T,B,!0)},V.prototype.lastIndexOf=function(S,T,B){return ye(this,S,T,B,!1)};function Ee(k,S,T,B){T=Number(T)||0;const K=k.length-T;B?(B=Number(B),B>K&&(B=K)):B=K;const Z=S.length;B>Z/2&&(B=Z/2);let re;for(re=0;re<B;++re){const Be=parseInt(S.substr(re*2,2),16);if(Pt(Be))return re;k[T+re]=Be}return re}function Se(k,S,T,B){return Ye(It(S,k.length-T),k,T,B)}function Je(k,S,T,B){return Ye(it(S),k,T,B)}function Ue(k,S,T,B){return Ye(Mt(S),k,T,B)}function lt(k,S,T,B){return Ye(wt(S,k.length-T),k,T,B)}V.prototype.write=function(S,T,B,K){if(T===void 0)K="utf8",B=this.length,T=0;else if(B===void 0&&typeof T=="string")K=T,B=this.length,T=0;else if(isFinite(T))T=T>>>0,isFinite(B)?(B=B>>>0,K===void 0&&(K="utf8")):(K=B,B=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Z=this.length-T;if((B===void 0||B>Z)&&(B=Z),S.length>0&&(B<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");K||(K="utf8");let re=!1;for(;;)switch(K){case"hex":return Ee(this,S,T,B);case"utf8":case"utf-8":return Se(this,S,T,B);case"ascii":case"latin1":case"binary":return Je(this,S,T,B);case"base64":return Ue(this,S,T,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,S,T,B);default:if(re)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),re=!0}},V.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(k,S,T){return S===0&&T===k.length?R.fromByteArray(k):R.fromByteArray(k.slice(S,T))}function $e(k,S,T){T=Math.min(k.length,T);const B=[];let K=S;for(;K<T;){const Z=k[K];let re=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(K+Be<=T){let rt,Re,z,oe;switch(Be){case 1:Z<128&&(re=Z);break;case 2:rt=k[K+1],(rt&192)===128&&(oe=(Z&31)<<6|rt&63,oe>127&&(re=oe));break;case 3:rt=k[K+1],Re=k[K+2],(rt&192)===128&&(Re&192)===128&&(oe=(Z&15)<<12|(rt&63)<<6|Re&63,oe>2047&&(oe<55296||oe>57343)&&(re=oe));break;case 4:rt=k[K+1],Re=k[K+2],z=k[K+3],(rt&192)===128&&(Re&192)===128&&(z&192)===128&&(oe=(Z&15)<<18|(rt&63)<<12|(Re&63)<<6|z&63,oe>65535&&oe<1114112&&(re=oe))}}re===null?(re=65533,Be=1):re>65535&&(re-=65536,B.push(re>>>10&1023|55296),re=56320|re&1023),B.push(re),K+=Be}return _e(B)}const mt=4096;function _e(k){const S=k.length;if(S<=mt)return String.fromCharCode.apply(String,k);let T="",B=0;for(;B<S;)T+=String.fromCharCode.apply(String,k.slice(B,B+=mt));return T}function ge(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]&127);return B}function Ae(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]);return B}function Ge(k,S,T){const B=k.length;(!S||S<0)&&(S=0),(!T||T<0||T>B)&&(T=B);let K="";for(let Z=S;Z<T;++Z)K+=ot[k[Z]];return K}function De(k,S,T){const B=k.slice(S,T);let K="";for(let Z=0;Z<B.length-1;Z+=2)K+=String.fromCharCode(B[Z]+B[Z+1]*256);return K}V.prototype.slice=function(S,T){const B=this.length;S=~~S,T=T===void 0?B:~~T,S<0?(S+=B,S<0&&(S=0)):S>B&&(S=B),T<0?(T+=B,T<0&&(T=0)):T>B&&(T=B),T<S&&(T=S);const K=this.subarray(S,T);return Object.setPrototypeOf(K,V.prototype),K};function Oe(k,S,T){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+S>T)throw new RangeError("Trying to access beyond buffer length")}V.prototype.readUintLE=V.prototype.readUIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,re=0;for(;++re<T&&(Z*=256);)K+=this[S+re]*Z;return K},V.prototype.readUintBE=V.prototype.readUIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S+--T],Z=1;for(;T>0&&(Z*=256);)K+=this[S+--T]*Z;return K},V.prototype.readUint8=V.prototype.readUInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]},V.prototype.readUint16LE=V.prototype.readUInt16LE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]|this[S+1]<<8},V.prototype.readUint16BE=V.prototype.readUInt16BE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]<<8|this[S+1]},V.prototype.readUint32LE=V.prototype.readUInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},V.prototype.readUint32BE=V.prototype.readUInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},V.prototype.readBigUInt64LE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=T+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24,Z=this[++S]+this[++S]*2**8+this[++S]*2**16+B*2**24;return BigInt(K)+(BigInt(Z)<<BigInt(32))}),V.prototype.readBigUInt64BE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=T*2**24+this[++S]*2**16+this[++S]*2**8+this[++S],Z=this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B;return(BigInt(K)<<BigInt(32))+BigInt(Z)}),V.prototype.readIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,re=0;for(;++re<T&&(Z*=256);)K+=this[S+re]*Z;return Z*=128,K>=Z&&(K-=Math.pow(2,8*T)),K},V.prototype.readIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=T,Z=1,re=this[S+--K];for(;K>0&&(Z*=256);)re+=this[S+--K]*Z;return Z*=128,re>=Z&&(re-=Math.pow(2,8*T)),re},V.prototype.readInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},V.prototype.readInt16LE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S]|this[S+1]<<8;return B&32768?B|4294901760:B},V.prototype.readInt16BE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S+1]|this[S]<<8;return B&32768?B|4294901760:B},V.prototype.readInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},V.prototype.readInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},V.prototype.readBigInt64LE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=this[S+4]+this[S+5]*2**8+this[S+6]*2**16+(B<<24);return(BigInt(K)<<BigInt(32))+BigInt(T+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24)}),V.prototype.readBigInt64BE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=(T<<24)+this[++S]*2**16+this[++S]*2**8+this[++S];return(BigInt(K)<<BigInt(32))+BigInt(this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B)}),V.prototype.readFloatLE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),F.read(this,S,!0,23,4)},V.prototype.readFloatBE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),F.read(this,S,!1,23,4)},V.prototype.readDoubleLE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),F.read(this,S,!0,52,8)},V.prototype.readDoubleBE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),F.read(this,S,!1,52,8)};function Ie(k,S,T,B,K,Z){if(!V.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(S>K||S<Z)throw new RangeError('"value" argument is out of bounds');if(T+B>k.length)throw new RangeError("Index out of range")}V.prototype.writeUintLE=V.prototype.writeUIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=1,re=0;for(this[T]=S&255;++re<B&&(Z*=256);)this[T+re]=S/Z&255;return T+B},V.prototype.writeUintBE=V.prototype.writeUIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=B-1,re=1;for(this[T+Z]=S&255;--Z>=0&&(re*=256);)this[T+Z]=S/re&255;return T+B},V.prototype.writeUint8=V.prototype.writeUInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,255,0),this[T]=S&255,T+1},V.prototype.writeUint16LE=V.prototype.writeUInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeUint16BE=V.prototype.writeUInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeUint32LE=V.prototype.writeUInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T+3]=S>>>24,this[T+2]=S>>>16,this[T+1]=S>>>8,this[T]=S&255,T+4},V.prototype.writeUint32BE=V.prototype.writeUInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4};function Le(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return k[T++]=re,re=re>>8,k[T++]=re,re=re>>8,k[T++]=re,re=re>>8,k[T++]=re,T}function ft(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T+7]=Z,Z=Z>>8,k[T+6]=Z,Z=Z>>8,k[T+5]=Z,Z=Z>>8,k[T+4]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return k[T+3]=re,re=re>>8,k[T+2]=re,re=re>>8,k[T+1]=re,re=re>>8,k[T]=re,T+8}V.prototype.writeBigUInt64LE=_t(function(S,T=0){return Le(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeBigUInt64BE=_t(function(S,T=0){return ft(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,T,B,rt-1,-rt)}let Z=0,re=1,Be=0;for(this[T]=S&255;++Z<B&&(re*=256);)S<0&&Be===0&&this[T+Z-1]!==0&&(Be=1),this[T+Z]=(S/re>>0)-Be&255;return T+B},V.prototype.writeIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,T,B,rt-1,-rt)}let Z=B-1,re=1,Be=0;for(this[T+Z]=S&255;--Z>=0&&(re*=256);)S<0&&Be===0&&this[T+Z+1]!==0&&(Be=1),this[T+Z]=(S/re>>0)-Be&255;return T+B},V.prototype.writeInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,127,-128),S<0&&(S=255+S+1),this[T]=S&255,T+1},V.prototype.writeInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),this[T]=S&255,this[T+1]=S>>>8,this[T+2]=S>>>16,this[T+3]=S>>>24,T+4},V.prototype.writeInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4},V.prototype.writeBigInt64LE=_t(function(S,T=0){return Le(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),V.prototype.writeBigInt64BE=_t(function(S,T=0){return ft(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dt(k,S,T,B,K,Z){if(T+B>k.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function We(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,4),F.write(k,S,T,B,23,4),T+4}V.prototype.writeFloatLE=function(S,T,B){return We(this,S,T,!0,B)},V.prototype.writeFloatBE=function(S,T,B){return We(this,S,T,!1,B)};function jt(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,8),F.write(k,S,T,B,52,8),T+8}V.prototype.writeDoubleLE=function(S,T,B){return jt(this,S,T,!0,B)},V.prototype.writeDoubleBE=function(S,T,B){return jt(this,S,T,!1,B)},V.prototype.copy=function(S,T,B,K){if(!V.isBuffer(S))throw new TypeError("argument should be a Buffer");if(B||(B=0),!K&&K!==0&&(K=this.length),T>=S.length&&(T=S.length),T||(T=0),K>0&&K<B&&(K=B),K===B||S.length===0||this.length===0)return 0;if(T<0)throw new RangeError("targetStart out of bounds");if(B<0||B>=this.length)throw new RangeError("Index out of range");if(K<0)throw new RangeError("sourceEnd out of bounds");K>this.length&&(K=this.length),S.length-T<K-B&&(K=S.length-T+B);const Z=K-B;return this===S&&typeof q.prototype.copyWithin=="function"?this.copyWithin(T,B,K):q.prototype.set.call(S,this.subarray(B,K),T),Z},V.prototype.fill=function(S,T,B,K){if(typeof S=="string"){if(typeof T=="string"?(K=T,T=0,B=this.length):typeof B=="string"&&(K=B,B=this.length),K!==void 0&&typeof K!="string")throw new TypeError("encoding must be a string");if(typeof K=="string"&&!V.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(S.length===1){const re=S.charCodeAt(0);(K==="utf8"&&re<128||K==="latin1")&&(S=re)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(T<0||this.length<T||this.length<B)throw new RangeError("Out of range index");if(B<=T)return this;T=T>>>0,B=B===void 0?this.length:B>>>0,S||(S=0);let Z;if(typeof S=="number")for(Z=T;Z<B;++Z)this[Z]=S;else{const re=V.isBuffer(S)?S:V.from(S,K),Be=re.length;if(Be===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<B-T;++Z)this[Z+T]=re[Z%Be]}return this};const St={};function et(k,S,T){St[k]=class extends T{constructor(){super(),Object.defineProperty(this,"message",{value:S.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${k}]`,this.stack,delete this.name}get code(){return k}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${k}]: ${this.message}`}}}et("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),et("ERR_INVALID_ARG_TYPE",function(k,S){return`The "${k}" argument must be of type number. Received type ${typeof S}`},TypeError),et("ERR_OUT_OF_RANGE",function(k,S,T){let B=`The value of "${k}" is out of range.`,K=T;return Number.isInteger(T)&&Math.abs(T)>2**32?K=At(String(T)):typeof T=="bigint"&&(K=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(K=At(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function At(k){let S="",T=k.length;const B=k[0]==="-"?1:0;for(;T>=B+4;T-=3)S=`_${k.slice(T-3,T)}${S}`;return`${k.slice(0,T)}${S}`}function $t(k,S,T){Et(S,"offset"),(k[S]===void 0||k[S+T]===void 0)&&Ot(S,k.length-(T+1))}function nt(k,S,T,B,K,Z){if(k>T||k<S){const re=typeof S=="bigint"?"n":"";let Be;throw Z>3?S===0||S===BigInt(0)?Be=`>= 0${re} and < 2${re} ** ${(Z+1)*8}${re}`:Be=`>= -(2${re} ** ${(Z+1)*8-1}${re}) and < 2 ** ${(Z+1)*8-1}${re}`:Be=`>= ${S}${re} and <= ${T}${re}`,new St.ERR_OUT_OF_RANGE("value",Be,k)}$t(B,K,Z)}function Et(k,S){if(typeof k!="number")throw new St.ERR_INVALID_ARG_TYPE(S,"number",k)}function Ot(k,S,T){throw Math.floor(k)!==k?(Et(k,T),new St.ERR_OUT_OF_RANGE(T||"offset","an integer",k)):S<0?new St.ERR_BUFFER_OUT_OF_BOUNDS:new St.ERR_OUT_OF_RANGE(T||"offset",`>= ${T?1:0} and <= ${S}`,k)}const st=/[^+/0-9A-Za-z-_]/g;function kt(k){if(k=k.split("=")[0],k=k.trim().replace(st,""),k.length<2)return"";for(;k.length%4!==0;)k=k+"=";return k}function It(k,S){S=S||1/0;let T;const B=k.length;let K=null;const Z=[];for(let re=0;re<B;++re){if(T=k.charCodeAt(re),T>55295&&T<57344){if(!K){if(T>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(re+1===B){(S-=3)>-1&&Z.push(239,191,189);continue}K=T;continue}if(T<56320){(S-=3)>-1&&Z.push(239,191,189),K=T;continue}T=(K-55296<<10|T-56320)+65536}else K&&(S-=3)>-1&&Z.push(239,191,189);if(K=null,T<128){if((S-=1)<0)break;Z.push(T)}else if(T<2048){if((S-=2)<0)break;Z.push(T>>6|192,T&63|128)}else if(T<65536){if((S-=3)<0)break;Z.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((S-=4)<0)break;Z.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return Z}function it(k){const S=[];for(let T=0;T<k.length;++T)S.push(k.charCodeAt(T)&255);return S}function wt(k,S){let T,B,K;const Z=[];for(let re=0;re<k.length&&!((S-=2)<0);++re)T=k.charCodeAt(re),B=T>>8,K=T%256,Z.push(K),Z.push(B);return Z}function Mt(k){return R.toByteArray(kt(k))}function Ye(k,S,T,B){let K;for(K=0;K<B&&!(K+T>=S.length||K>=k.length);++K)S[K+T]=k[K];return K}function gt(k,S){return k instanceof S||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===S.name}function Pt(k){return k!==k}const ot=function(){const k="0123456789abcdef",S=new Array(256);for(let T=0;T<16;++T){const B=T*16;for(let K=0;K<16;++K)S[B+K]=k[T]+k[K]}return S}();function _t(k){return typeof BigInt>"u"?Ut:k}function Ut(){throw new Error("BigInt not supported")}})(t);const P=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=P,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode}(fh)),fh}var C7=gu();const dh=fa(C7);var nn={},hh={exports:{}};hh.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=gu().Buffer}catch{}s.isBN=function(p){return p instanceof s?!0:p!==null&&typeof p=="object"&&p.constructor.wordSize===s.wordSize&&Array.isArray(p.words)},s.max=function(p,d){return p.cmp(d)>0?p:d},s.min=function(p,d){return p.cmp(d)<0?p:d},s.prototype._init=function(p,d,m){if(typeof p=="number")return this._initNumber(p,d,m);if(typeof p=="object")return this._initArray(p,d,m);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),p=p.toString().replace(/\s+/g,"");var x=0;p[0]==="-"&&(x++,this.negative=1),x<p.length&&(d===16?this._parseHex(p,x,m):(this._parseBase(p,d,x),m==="le"&&this._initArray(this.toArray(),d,m)))},s.prototype._initNumber=function(p,d,m){p<0&&(this.negative=1,p=-p),p<67108864?(this.words=[p&67108863],this.length=1):p<4503599627370496?(this.words=[p&67108863,p/67108864&67108863],this.length=2):(n(p<9007199254740992),this.words=[p&67108863,p/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),d,m)},s.prototype._initArray=function(p,d,m){if(n(typeof p.length=="number"),p.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(p.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var M,E,O=0;if(m==="be")for(x=p.length-1,M=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);else if(m==="le")for(x=0,M=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);return this._strip()};function a($,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 M=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=8;else{var C=p.length-d;for(x=C%2===0?d+1:d;x<p.length;x+=2)O=c(p,d,x)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=8}this._strip()};function u($,p,d,m){for(var x=0,M=0,E=Math.min($.length,d),O=p;O<E;O++){var C=$.charCodeAt(O)-48;x*=m,C>=49?M=C-49+10:C>=17?M=C-17+10:M=C,n(C>=0&&M<m,"Invalid character"),x+=M}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,M=1;M<=67108863;M*=d)x++;x--,M=M/d|0;for(var E=p.length-m,O=E%x,C=Math.min(E,E-O)+m,g=0,v=m;v<C;v+=x)g=u(p,v,v+x,d),this.imuln(M),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(O!==0){var j=1;for(g=u(p,v,p.length,d),v=0;v<O;v++)j*=d;this.imuln(j),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var d=0;d<this.length;d++)p.words[d]=this.words[d];p.length=this.length,p.negative=this.negative,p.red=this.red};function l($,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],b=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(p,d){p=p||10,d=d|0||1;var m;if(p===16||p==="hex"){m="";for(var x=0,M=0,E=0;E<this.length;E++){var O=this.words[E],C=((O<<x|M)&16777215).toString(16);M=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),M!==0||E!==this.length-1?m=h[6-C.length]+C+m:m=C+m}for(M!==0&&(m=M.toString(16)+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(p===(p|0)&&p>=2&&p<=36){var g=y[p],v=b[p];m="";var j=this.clone();for(j.negative=0;!j.isZero();){var ee=j.modrn(v).toString(p);j=j.idivn(v),j.isZero()?m=ee+m:m=h[g-ee.length]+ee+m}for(this.isZero()&&(m="0"+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(p,d){return this.toArrayLike(o,p,d)}),s.prototype.toArray=function(p,d){return this.toArrayLike(Array,p,d)};var _=function(p,d){return p.allocUnsafe?p.allocUnsafe(d):new p(d)};s.prototype.toArrayLike=function(p,d,m){this._strip();var x=this.byteLength(),M=m||Math.max(1,x);n(x<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0");var E=_(p,M),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,M=0,E=0;M<this.length;M++){var O=this.words[M]<<E|x;p[m++]=O&255,m<p.length&&(p[m++]=O>>8&255),m<p.length&&(p[m++]=O>>16&255),E===6?(m<p.length&&(p[m++]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m<p.length)for(p[m++]=x;m<p.length;)p[m++]=0},s.prototype._toArrayLikeBE=function(p,d){for(var m=p.length-1,x=0,M=0,E=0;M<this.length;M++){var O=this.words[M]<<E|x;p[m--]=O&255,m>=0&&(p[m--]=O>>8&255),m>=0&&(p[m--]=O>>16&255),E===6?(m>=0&&(p[m--]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m>=0)for(p[m--]=x;m>=0;)p[m--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var d=p,m=0;return d>=4096&&(m+=13,d>>>=13),d>=64&&(m+=7,d>>>=7),d>=8&&(m+=4,d>>>=4),d>=2&&(m+=2,d>>>=2),m+d},s.prototype._zeroBits=function(p){if(p===0)return 26;var d=p,m=0;return d&8191||(m+=13,d>>>=13),d&127||(m+=7,d>>>=7),d&15||(m+=4,d>>>=4),d&3||(m+=2,d>>>=2),d&1||m++,m},s.prototype.bitLength=function(){var p=this.words[this.length-1],d=this._countBits(p);return(this.length-1)*26+d};function A($){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 M=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;for(;M!==0&&E<m.length;E++)d=(m.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;if(this.length=m.length,M!==0)this.words[this.length]=M,this.length++;else if(m!==this)for(;E<m.length;E++)this.words[E]=m.words[E];return this},s.prototype.add=function(p){var d;return p.negative!==0&&this.negative===0?(p.negative=0,d=this.sub(p),p.negative^=1,d):p.negative===0&&this.negative!==0?(this.negative=0,d=p.sub(this),this.negative=1,d):this.length>p.length?this.clone().iadd(p):p.clone().iadd(this)},s.prototype.isub=function(p){if(p.negative!==0){p.negative=0;var d=this.iadd(p);return p.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(p),this.negative=1,this._normSign();var m=this.cmp(p);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,M;m>0?(x=this,M=p):(x=p,M=this);for(var E=0,O=0;O<M.length;O++)d=(x.words[O]|0)-(M.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;for(;E!==0&&O<x.length;O++)d=(x.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;if(E===0&&O<x.length&&x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this.length=Math.max(this.length,O),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function P($,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,M=p.words[0]|0,E=x*M,O=E&67108863,C=E/67108864|0;d.words[0]=O;for(var g=1;g<m;g++){for(var v=C>>>26,j=C&67108863,ee=Math.min(g,p.length-1),se=Math.max(0,g-$.length+1);se<=ee;se++){var ye=g-se|0;x=$.words[ye]|0,M=p.words[se]|0,E=x*M+j,v+=E/67108864|0,j=E&67108863}d.words[g]=j|0,C=v|0}return C!==0?d.words[g]=C|0:d.length--,d._strip()}var N=function(p,d,m){var x=p.words,M=d.words,E=m.words,O=0,C,g,v,j=x[0]|0,ee=j&8191,se=j>>>13,ye=x[1]|0,pe=ye&8191,Ee=ye>>>13,Se=x[2]|0,Je=Se&8191,Ue=Se>>>13,lt=x[3]|0,ht=lt&8191,$e=lt>>>13,mt=x[4]|0,_e=mt&8191,ge=mt>>>13,Ae=x[5]|0,Ge=Ae&8191,De=Ae>>>13,Oe=x[6]|0,Ie=Oe&8191,Le=Oe>>>13,ft=x[7]|0,dt=ft&8191,We=ft>>>13,jt=x[8]|0,St=jt&8191,et=jt>>>13,At=x[9]|0,$t=At&8191,nt=At>>>13,Et=M[0]|0,Ot=Et&8191,st=Et>>>13,kt=M[1]|0,It=kt&8191,it=kt>>>13,wt=M[2]|0,Mt=wt&8191,Ye=wt>>>13,gt=M[3]|0,Pt=gt&8191,ot=gt>>>13,_t=M[4]|0,Ut=_t&8191,k=_t>>>13,S=M[5]|0,T=S&8191,B=S>>>13,K=M[6]|0,Z=K&8191,re=K>>>13,Be=M[7]|0,rt=Be&8191,Re=Be>>>13,z=M[8]|0,oe=z&8191,he=z>>>13,ke=M[9]|0,He=ke&8191,Ne=ke>>>13;m.negative=p.negative^d.negative,m.length=19,C=Math.imul(ee,Ot),g=Math.imul(ee,st),g=g+Math.imul(se,Ot)|0,v=Math.imul(se,st);var ze=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ze>>>26)|0,ze&=67108863,C=Math.imul(pe,Ot),g=Math.imul(pe,st),g=g+Math.imul(Ee,Ot)|0,v=Math.imul(Ee,st),C=C+Math.imul(ee,It)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(se,It)|0,v=v+Math.imul(se,it)|0;var ut=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ut>>>26)|0,ut&=67108863,C=Math.imul(Je,Ot),g=Math.imul(Je,st),g=g+Math.imul(Ue,Ot)|0,v=Math.imul(Ue,st),C=C+Math.imul(pe,It)|0,g=g+Math.imul(pe,it)|0,g=g+Math.imul(Ee,It)|0,v=v+Math.imul(Ee,it)|0,C=C+Math.imul(ee,Mt)|0,g=g+Math.imul(ee,Ye)|0,g=g+Math.imul(se,Mt)|0,v=v+Math.imul(se,Ye)|0;var Jt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,C=Math.imul(ht,Ot),g=Math.imul(ht,st),g=g+Math.imul($e,Ot)|0,v=Math.imul($e,st),C=C+Math.imul(Je,It)|0,g=g+Math.imul(Je,it)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,it)|0,C=C+Math.imul(pe,Mt)|0,g=g+Math.imul(pe,Ye)|0,g=g+Math.imul(Ee,Mt)|0,v=v+Math.imul(Ee,Ye)|0,C=C+Math.imul(ee,Pt)|0,g=g+Math.imul(ee,ot)|0,g=g+Math.imul(se,Pt)|0,v=v+Math.imul(se,ot)|0;var Nt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,C=Math.imul(_e,Ot),g=Math.imul(_e,st),g=g+Math.imul(ge,Ot)|0,v=Math.imul(ge,st),C=C+Math.imul(ht,It)|0,g=g+Math.imul(ht,it)|0,g=g+Math.imul($e,It)|0,v=v+Math.imul($e,it)|0,C=C+Math.imul(Je,Mt)|0,g=g+Math.imul(Je,Ye)|0,g=g+Math.imul(Ue,Mt)|0,v=v+Math.imul(Ue,Ye)|0,C=C+Math.imul(pe,Pt)|0,g=g+Math.imul(pe,ot)|0,g=g+Math.imul(Ee,Pt)|0,v=v+Math.imul(Ee,ot)|0,C=C+Math.imul(ee,Ut)|0,g=g+Math.imul(ee,k)|0,g=g+Math.imul(se,Ut)|0,v=v+Math.imul(se,k)|0;var Bt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,C=Math.imul(Ge,Ot),g=Math.imul(Ge,st),g=g+Math.imul(De,Ot)|0,v=Math.imul(De,st),C=C+Math.imul(_e,It)|0,g=g+Math.imul(_e,it)|0,g=g+Math.imul(ge,It)|0,v=v+Math.imul(ge,it)|0,C=C+Math.imul(ht,Mt)|0,g=g+Math.imul(ht,Ye)|0,g=g+Math.imul($e,Mt)|0,v=v+Math.imul($e,Ye)|0,C=C+Math.imul(Je,Pt)|0,g=g+Math.imul(Je,ot)|0,g=g+Math.imul(Ue,Pt)|0,v=v+Math.imul(Ue,ot)|0,C=C+Math.imul(pe,Ut)|0,g=g+Math.imul(pe,k)|0,g=g+Math.imul(Ee,Ut)|0,v=v+Math.imul(Ee,k)|0,C=C+Math.imul(ee,T)|0,g=g+Math.imul(ee,B)|0,g=g+Math.imul(se,T)|0,v=v+Math.imul(se,B)|0;var ir=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ir>>>26)|0,ir&=67108863,C=Math.imul(Ie,Ot),g=Math.imul(Ie,st),g=g+Math.imul(Le,Ot)|0,v=Math.imul(Le,st),C=C+Math.imul(Ge,It)|0,g=g+Math.imul(Ge,it)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,it)|0,C=C+Math.imul(_e,Mt)|0,g=g+Math.imul(_e,Ye)|0,g=g+Math.imul(ge,Mt)|0,v=v+Math.imul(ge,Ye)|0,C=C+Math.imul(ht,Pt)|0,g=g+Math.imul(ht,ot)|0,g=g+Math.imul($e,Pt)|0,v=v+Math.imul($e,ot)|0,C=C+Math.imul(Je,Ut)|0,g=g+Math.imul(Je,k)|0,g=g+Math.imul(Ue,Ut)|0,v=v+Math.imul(Ue,k)|0,C=C+Math.imul(pe,T)|0,g=g+Math.imul(pe,B)|0,g=g+Math.imul(Ee,T)|0,v=v+Math.imul(Ee,B)|0,C=C+Math.imul(ee,Z)|0,g=g+Math.imul(ee,re)|0,g=g+Math.imul(se,Z)|0,v=v+Math.imul(se,re)|0;var Sr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,C=Math.imul(dt,Ot),g=Math.imul(dt,st),g=g+Math.imul(We,Ot)|0,v=Math.imul(We,st),C=C+Math.imul(Ie,It)|0,g=g+Math.imul(Ie,it)|0,g=g+Math.imul(Le,It)|0,v=v+Math.imul(Le,it)|0,C=C+Math.imul(Ge,Mt)|0,g=g+Math.imul(Ge,Ye)|0,g=g+Math.imul(De,Mt)|0,v=v+Math.imul(De,Ye)|0,C=C+Math.imul(_e,Pt)|0,g=g+Math.imul(_e,ot)|0,g=g+Math.imul(ge,Pt)|0,v=v+Math.imul(ge,ot)|0,C=C+Math.imul(ht,Ut)|0,g=g+Math.imul(ht,k)|0,g=g+Math.imul($e,Ut)|0,v=v+Math.imul($e,k)|0,C=C+Math.imul(Je,T)|0,g=g+Math.imul(Je,B)|0,g=g+Math.imul(Ue,T)|0,v=v+Math.imul(Ue,B)|0,C=C+Math.imul(pe,Z)|0,g=g+Math.imul(pe,re)|0,g=g+Math.imul(Ee,Z)|0,v=v+Math.imul(Ee,re)|0,C=C+Math.imul(ee,rt)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(se,rt)|0,v=v+Math.imul(se,Re)|0;var or=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(or>>>26)|0,or&=67108863,C=Math.imul(St,Ot),g=Math.imul(St,st),g=g+Math.imul(et,Ot)|0,v=Math.imul(et,st),C=C+Math.imul(dt,It)|0,g=g+Math.imul(dt,it)|0,g=g+Math.imul(We,It)|0,v=v+Math.imul(We,it)|0,C=C+Math.imul(Ie,Mt)|0,g=g+Math.imul(Ie,Ye)|0,g=g+Math.imul(Le,Mt)|0,v=v+Math.imul(Le,Ye)|0,C=C+Math.imul(Ge,Pt)|0,g=g+Math.imul(Ge,ot)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,ot)|0,C=C+Math.imul(_e,Ut)|0,g=g+Math.imul(_e,k)|0,g=g+Math.imul(ge,Ut)|0,v=v+Math.imul(ge,k)|0,C=C+Math.imul(ht,T)|0,g=g+Math.imul(ht,B)|0,g=g+Math.imul($e,T)|0,v=v+Math.imul($e,B)|0,C=C+Math.imul(Je,Z)|0,g=g+Math.imul(Je,re)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,re)|0,C=C+Math.imul(pe,rt)|0,g=g+Math.imul(pe,Re)|0,g=g+Math.imul(Ee,rt)|0,v=v+Math.imul(Ee,Re)|0,C=C+Math.imul(ee,oe)|0,g=g+Math.imul(ee,he)|0,g=g+Math.imul(se,oe)|0,v=v+Math.imul(se,he)|0;var Yt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,C=Math.imul($t,Ot),g=Math.imul($t,st),g=g+Math.imul(nt,Ot)|0,v=Math.imul(nt,st),C=C+Math.imul(St,It)|0,g=g+Math.imul(St,it)|0,g=g+Math.imul(et,It)|0,v=v+Math.imul(et,it)|0,C=C+Math.imul(dt,Mt)|0,g=g+Math.imul(dt,Ye)|0,g=g+Math.imul(We,Mt)|0,v=v+Math.imul(We,Ye)|0,C=C+Math.imul(Ie,Pt)|0,g=g+Math.imul(Ie,ot)|0,g=g+Math.imul(Le,Pt)|0,v=v+Math.imul(Le,ot)|0,C=C+Math.imul(Ge,Ut)|0,g=g+Math.imul(Ge,k)|0,g=g+Math.imul(De,Ut)|0,v=v+Math.imul(De,k)|0,C=C+Math.imul(_e,T)|0,g=g+Math.imul(_e,B)|0,g=g+Math.imul(ge,T)|0,v=v+Math.imul(ge,B)|0,C=C+Math.imul(ht,Z)|0,g=g+Math.imul(ht,re)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,re)|0,C=C+Math.imul(Je,rt)|0,g=g+Math.imul(Je,Re)|0,g=g+Math.imul(Ue,rt)|0,v=v+Math.imul(Ue,Re)|0,C=C+Math.imul(pe,oe)|0,g=g+Math.imul(pe,he)|0,g=g+Math.imul(Ee,oe)|0,v=v+Math.imul(Ee,he)|0,C=C+Math.imul(ee,He)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(se,He)|0,v=v+Math.imul(se,Ne)|0;var vr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(vr>>>26)|0,vr&=67108863,C=Math.imul($t,It),g=Math.imul($t,it),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,it),C=C+Math.imul(St,Mt)|0,g=g+Math.imul(St,Ye)|0,g=g+Math.imul(et,Mt)|0,v=v+Math.imul(et,Ye)|0,C=C+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,ot)|0,g=g+Math.imul(We,Pt)|0,v=v+Math.imul(We,ot)|0,C=C+Math.imul(Ie,Ut)|0,g=g+Math.imul(Ie,k)|0,g=g+Math.imul(Le,Ut)|0,v=v+Math.imul(Le,k)|0,C=C+Math.imul(Ge,T)|0,g=g+Math.imul(Ge,B)|0,g=g+Math.imul(De,T)|0,v=v+Math.imul(De,B)|0,C=C+Math.imul(_e,Z)|0,g=g+Math.imul(_e,re)|0,g=g+Math.imul(ge,Z)|0,v=v+Math.imul(ge,re)|0,C=C+Math.imul(ht,rt)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,rt)|0,v=v+Math.imul($e,Re)|0,C=C+Math.imul(Je,oe)|0,g=g+Math.imul(Je,he)|0,g=g+Math.imul(Ue,oe)|0,v=v+Math.imul(Ue,he)|0,C=C+Math.imul(pe,He)|0,g=g+Math.imul(pe,Ne)|0,g=g+Math.imul(Ee,He)|0,v=v+Math.imul(Ee,Ne)|0;var Nn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,C=Math.imul($t,Mt),g=Math.imul($t,Ye),g=g+Math.imul(nt,Mt)|0,v=Math.imul(nt,Ye),C=C+Math.imul(St,Pt)|0,g=g+Math.imul(St,ot)|0,g=g+Math.imul(et,Pt)|0,v=v+Math.imul(et,ot)|0,C=C+Math.imul(dt,Ut)|0,g=g+Math.imul(dt,k)|0,g=g+Math.imul(We,Ut)|0,v=v+Math.imul(We,k)|0,C=C+Math.imul(Ie,T)|0,g=g+Math.imul(Ie,B)|0,g=g+Math.imul(Le,T)|0,v=v+Math.imul(Le,B)|0,C=C+Math.imul(Ge,Z)|0,g=g+Math.imul(Ge,re)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,re)|0,C=C+Math.imul(_e,rt)|0,g=g+Math.imul(_e,Re)|0,g=g+Math.imul(ge,rt)|0,v=v+Math.imul(ge,Re)|0,C=C+Math.imul(ht,oe)|0,g=g+Math.imul(ht,he)|0,g=g+Math.imul($e,oe)|0,v=v+Math.imul($e,he)|0,C=C+Math.imul(Je,He)|0,g=g+Math.imul(Je,Ne)|0,g=g+Math.imul(Ue,He)|0,v=v+Math.imul(Ue,Ne)|0;var Vr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,C=Math.imul($t,Pt),g=Math.imul($t,ot),g=g+Math.imul(nt,Pt)|0,v=Math.imul(nt,ot),C=C+Math.imul(St,Ut)|0,g=g+Math.imul(St,k)|0,g=g+Math.imul(et,Ut)|0,v=v+Math.imul(et,k)|0,C=C+Math.imul(dt,T)|0,g=g+Math.imul(dt,B)|0,g=g+Math.imul(We,T)|0,v=v+Math.imul(We,B)|0,C=C+Math.imul(Ie,Z)|0,g=g+Math.imul(Ie,re)|0,g=g+Math.imul(Le,Z)|0,v=v+Math.imul(Le,re)|0,C=C+Math.imul(Ge,rt)|0,g=g+Math.imul(Ge,Re)|0,g=g+Math.imul(De,rt)|0,v=v+Math.imul(De,Re)|0,C=C+Math.imul(_e,oe)|0,g=g+Math.imul(_e,he)|0,g=g+Math.imul(ge,oe)|0,v=v+Math.imul(ge,he)|0,C=C+Math.imul(ht,He)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,He)|0,v=v+Math.imul($e,Ne)|0;var Rn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,C=Math.imul($t,Ut),g=Math.imul($t,k),g=g+Math.imul(nt,Ut)|0,v=Math.imul(nt,k),C=C+Math.imul(St,T)|0,g=g+Math.imul(St,B)|0,g=g+Math.imul(et,T)|0,v=v+Math.imul(et,B)|0,C=C+Math.imul(dt,Z)|0,g=g+Math.imul(dt,re)|0,g=g+Math.imul(We,Z)|0,v=v+Math.imul(We,re)|0,C=C+Math.imul(Ie,rt)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Le,rt)|0,v=v+Math.imul(Le,Re)|0,C=C+Math.imul(Ge,oe)|0,g=g+Math.imul(Ge,he)|0,g=g+Math.imul(De,oe)|0,v=v+Math.imul(De,he)|0,C=C+Math.imul(_e,He)|0,g=g+Math.imul(_e,Ne)|0,g=g+Math.imul(ge,He)|0,v=v+Math.imul(ge,Ne)|0;var Li=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Li>>>26)|0,Li&=67108863,C=Math.imul($t,T),g=Math.imul($t,B),g=g+Math.imul(nt,T)|0,v=Math.imul(nt,B),C=C+Math.imul(St,Z)|0,g=g+Math.imul(St,re)|0,g=g+Math.imul(et,Z)|0,v=v+Math.imul(et,re)|0,C=C+Math.imul(dt,rt)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(We,rt)|0,v=v+Math.imul(We,Re)|0,C=C+Math.imul(Ie,oe)|0,g=g+Math.imul(Ie,he)|0,g=g+Math.imul(Le,oe)|0,v=v+Math.imul(Le,he)|0,C=C+Math.imul(Ge,He)|0,g=g+Math.imul(Ge,Ne)|0,g=g+Math.imul(De,He)|0,v=v+Math.imul(De,Ne)|0;var Fi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,C=Math.imul($t,Z),g=Math.imul($t,re),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,re),C=C+Math.imul(St,rt)|0,g=g+Math.imul(St,Re)|0,g=g+Math.imul(et,rt)|0,v=v+Math.imul(et,Re)|0,C=C+Math.imul(dt,oe)|0,g=g+Math.imul(dt,he)|0,g=g+Math.imul(We,oe)|0,v=v+Math.imul(We,he)|0,C=C+Math.imul(Ie,He)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Le,He)|0,v=v+Math.imul(Le,Ne)|0;var Dn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,C=Math.imul($t,rt),g=Math.imul($t,Re),g=g+Math.imul(nt,rt)|0,v=Math.imul(nt,Re),C=C+Math.imul(St,oe)|0,g=g+Math.imul(St,he)|0,g=g+Math.imul(et,oe)|0,v=v+Math.imul(et,he)|0,C=C+Math.imul(dt,He)|0,g=g+Math.imul(dt,Ne)|0,g=g+Math.imul(We,He)|0,v=v+Math.imul(We,Ne)|0;var Ui=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,C=Math.imul($t,oe),g=Math.imul($t,he),g=g+Math.imul(nt,oe)|0,v=Math.imul(nt,he),C=C+Math.imul(St,He)|0,g=g+Math.imul(St,Ne)|0,g=g+Math.imul(et,He)|0,v=v+Math.imul(et,Ne)|0;var zi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(zi>>>26)|0,zi&=67108863,C=Math.imul($t,He),g=Math.imul($t,Ne),g=g+Math.imul(nt,He)|0,v=Math.imul(nt,Ne);var D=(O+C|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+(D>>>26)|0,D&=67108863,E[0]=ze,E[1]=ut,E[2]=Jt,E[3]=Nt,E[4]=Bt,E[5]=ir,E[6]=Sr,E[7]=or,E[8]=Yt,E[9]=vr,E[10]=Nn,E[11]=Vr,E[12]=Rn,E[13]=Li,E[14]=Fi,E[15]=Dn,E[16]=Ui,E[17]=zi,E[18]=D,O!==0&&(E[19]=O,m.length++),m};Math.imul||(N=P);function R($,p,d){d.negative=p.negative^$.negative,d.length=$.length+p.length;for(var m=0,x=0,M=0;M<d.length-1;M++){var E=x;x=0;for(var O=m&67108863,C=Math.min(M,p.length-1),g=Math.max(0,M-$.length+1);g<=C;g++){var v=M-g,j=$.words[v]|0,ee=p.words[g]|0,se=j*ee,ye=se&67108863;E=E+(se/67108864|0)|0,ye=ye+O|0,O=ye&67108863,E=E+(ye>>>26)|0,x+=E>>>26,E&=67108863}d.words[M]=O,m=E,E=x}return m!==0?d.words[M]=m:d.length--,d._strip()}function F($,p,d){return R($,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=N(this,p,d):x<63?m=P(this,p,d):x<1024?m=R(this,p,d):m=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 M=(this.words[x]|0)*p,E=(M&67108863)+(m&67108863);m>>=26,m+=M/67108864|0,m+=E>>>26,this.words[x]=E&67108863}return m!==0&&(this.words[x]=m,this.length++),d?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var d=A(p);if(d.length===0)return new s(1);for(var m=this,x=0;x<d.length&&d[x]===0;x++,m=m.sqr());if(++x<d.length)for(var M=m.sqr();x<d.length;x++,M=M.sqr())d[x]!==0&&(m=m.mul(M));return m},s.prototype.iushln=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=67108863>>>26-d<<26-d,M;if(d!==0){var E=0;for(M=0;M<this.length;M++){var O=this.words[M]&x,C=(this.words[M]|0)-O<<d;this.words[M]=C|E,E=O>>>26-d}E&&(this.words[M]=E,this.length++)}if(m!==0){for(M=this.length-1;M>=0;M--)this.words[M+m]=this.words[M];for(M=0;M<m;M++)this.words[M]=0;this.length+=m}return this._strip()},s.prototype.ishln=function(p){return n(this.negative===0),this.iushln(p)},s.prototype.iushrn=function(p,d,m){n(typeof p=="number"&&p>=0);var x;d?x=(d-d%26)/26:x=0;var M=p%26,E=Math.min((p-M)/26,this.length),O=67108863^67108863>>>M<<M,C=m;if(x-=E,x=Math.max(0,x),C){for(var g=0;g<E;g++)C.words[g]=this.words[g];C.length=E}if(E!==0)if(this.length>E)for(this.length-=E,g=0;g<this.length;g++)this.words[g]=this.words[g+E];else this.words[0]=0,this.length=1;var v=0;for(g=this.length-1;g>=0&&(v!==0||g>=x);g--){var j=this.words[g]|0;this.words[g]=v<<26-M|j>>>M,v=j&O}return C&&v!==0&&(C.words[C.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(p,d,m){return n(this.negative===0),this.iushrn(p,d,m)},s.prototype.shln=function(p){return this.clone().ishln(p)},s.prototype.ushln=function(p){return this.clone().iushln(p)},s.prototype.shrn=function(p){return this.clone().ishrn(p)},s.prototype.ushrn=function(p){return this.clone().iushrn(p)},s.prototype.testn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return!1;var M=this.words[m];return!!(M&x)},s.prototype.imaskn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(d!==0&&m++,this.length=Math.min(m,this.length),d!==0){var x=67108863^67108863>>>d<<d;this.words[this.length-1]&=x}return this._strip()},s.prototype.maskn=function(p){return this.clone().imaskn(p)},s.prototype.iaddn=function(p){return n(typeof p=="number"),n(p<67108864),p<0?this.isubn(-p):this.negative!==0?this.length===1&&(this.words[0]|0)<=p?(this.words[0]=p-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(p),this.negative=1,this):this._iaddn(p)},s.prototype._iaddn=function(p){this.words[0]+=p;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(p){if(n(typeof p=="number"),n(p<67108864),p<0)return this.iaddn(-p);if(this.negative!==0)return this.negative=0,this.iaddn(p),this.negative=1,this;if(this.words[0]-=p,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(p){return this.clone().iaddn(p)},s.prototype.subn=function(p){return this.clone().isubn(p)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(p,d,m){var x=p.length+m,M;this._expand(x);var E,O=0;for(M=0;M<p.length;M++){E=(this.words[M+m]|0)+O;var C=(p.words[M]|0)*d;E-=C&67108863,O=(E>>26)-(C/67108864|0),this.words[M+m]=E&67108863}for(;M<this.length-m;M++)E=(this.words[M+m]|0)+O,O=E>>26,this.words[M+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,M=0;M<this.length;M++)E=-(this.words[M]|0)+O,O=E>>26,this.words[M]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),M=p,E=M.words[M.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(M=M.ushln(m),x.iushln(m),E=M.words[M.length-1]|0);var C=x.length-M.length,g;if(d!=="mod"){g=new s(null),g.length=C+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var j=x.clone()._ishlnsubmul(M,1,C);j.negative===0&&(x=j,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var se=(x.words[M.length+ee]|0)*67108864+(x.words[M.length+ee-1]|0);for(se=Math.min(se/E|0,67108863),x._ishlnsubmul(M,se,ee);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(M,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=se)}return g&&g._strip(),x._strip(),d!=="div"&&m!==0&&x.iushrn(m),{div:g||null,mod:x}},s.prototype.divmod=function(p,d,m){if(n(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,M,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(M=E.mod.neg(),m&&M.negative!==0&&M.iadd(p)),{div:x,mod:M}):this.negative===0&&p.negative!==0?(E=this.divmod(p.neg(),d),d!=="mod"&&(x=E.div.neg()),{div:x,mod:E.mod}):this.negative&p.negative?(E=this.neg().divmod(p.neg(),d),d!=="div"&&(M=E.mod.neg(),m&&M.negative!==0&&M.isub(p)),{div:E.div,mod:M}):p.length>this.length||this.cmp(p)<0?{div:new s(0),mod:this}:p.length===1?d==="div"?{div:this.divn(p.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(p.words[0]))}:{div:this.divn(p.words[0]),mod:new s(this.modrn(p.words[0]))}:this._wordDiv(p,d)},s.prototype.div=function(p){return this.divmod(p,"div",!1).div},s.prototype.mod=function(p){return this.divmod(p,"mod",!1).mod},s.prototype.umod=function(p){return this.divmod(p,"mod",!0).mod},s.prototype.divRound=function(p){var d=this.divmod(p);if(d.mod.isZero())return d.div;var m=d.div.negative!==0?d.mod.isub(p):d.mod,x=p.ushrn(1),M=p.andln(1),E=m.cmp(x);return E<0||M===1&&E===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=(1<<26)%p,x=0,M=this.length-1;M>=0;M--)x=(m*x+(this.words[M]|0))%p;return d?-x:x},s.prototype.modn=function(p){return this.modrn(p)},s.prototype.idivn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=0,x=this.length-1;x>=0;x--){var M=(this.words[x]|0)+m*67108864;this.words[x]=M/p|0,m=M%p}return this._strip(),d?this.ineg():this},s.prototype.divn=function(p){return this.clone().idivn(p)},s.prototype.egcd=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),M=new s(0),E=new s(0),O=new s(1),C=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++C;for(var g=m.clone(),v=d.clone();!d.isZero();){for(var j=0,ee=1;!(d.words[0]&ee)&&j<26;++j,ee<<=1);if(j>0)for(d.iushrn(j);j-- >0;)(x.isOdd()||M.isOdd())&&(x.iadd(g),M.isub(v)),x.iushrn(1),M.iushrn(1);for(var se=0,ye=1;!(m.words[0]&ye)&&se<26;++se,ye<<=1);if(se>0)for(m.iushrn(se);se-- >0;)(E.isOdd()||O.isOdd())&&(E.iadd(g),O.isub(v)),E.iushrn(1),O.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(E),M.isub(O)):(m.isub(d),E.isub(x),O.isub(M))}return{a:E,b:O,gcd:m.iushln(C)}},s.prototype._invmp=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),M=new s(0),E=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var O=0,C=1;!(d.words[0]&C)&&O<26;++O,C<<=1);if(O>0)for(d.iushrn(O);O-- >0;)x.isOdd()&&x.iadd(E),x.iushrn(1);for(var g=0,v=1;!(m.words[0]&v)&&g<26;++g,v<<=1);if(g>0)for(m.iushrn(g);g-- >0;)M.isOdd()&&M.iadd(E),M.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(M)):(m.isub(d),M.isub(x))}var j;return d.cmpn(1)===0?j=x:j=M,j.cmpn(0)<0&&j.iadd(p),j},s.prototype.gcd=function(p){if(this.isZero())return p.abs();if(p.isZero())return this.abs();var d=this.clone(),m=p.clone();d.negative=0,m.negative=0;for(var x=0;d.isEven()&&m.isEven();x++)d.iushrn(1),m.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;m.isEven();)m.iushrn(1);var M=d.cmp(m);if(M<0){var E=d;d=m,m=E}else if(M===0||m.cmpn(1)===0)break;d.isub(m)}while(!0);return m.iushln(x)},s.prototype.invm=function(p){return this.egcd(p).a.umod(p)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(p){return this.words[0]&p},s.prototype.bincn=function(p){n(typeof p=="number");var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return this._expand(m+1),this.words[m]|=x,this;for(var M=x,E=m;M!==0&&E<this.length;E++){var O=this.words[E]|0;O+=M,M=O>>>26,O&=67108863,this.words[E]=O}return M!==0&&(this.words[E]=M,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(p){var d=p<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var m;if(this.length>1)m=1;else{d&&(p=-p),n(p<=67108863,"Number is too big");var x=this.words[0]|0;m=x===p?0:x<p?-1:1}return this.negative!==0?-m|0:m},s.prototype.cmp=function(p){if(this.negative!==0&&p.negative===0)return-1;if(this.negative===0&&p.negative!==0)return 1;var d=this.ucmp(p);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(p){if(this.length>p.length)return 1;if(this.length<p.length)return-1;for(var d=0,m=this.length-1;m>=0;m--){var x=this.words[m]|0,M=p.words[m]|0;if(x!==M){x<M?d=-1:x>M&&(d=1);break}}return d},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new ce(p)},s.prototype.toRed=function(p){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return n(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return n(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var L={k256:null,p224:null,p192:null,p25519:null};function W($,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()}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),M=0;M<x;M++)d.words[M]=p.words[M];if(d.length=x,p.length<=9){p.words[0]=0,p.length=1;return}var E=p.words[9];for(d.words[d.length++]=E&m,M=10;M<p.length;M++){var O=p.words[M]|0;p.words[M-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[M-10]=E,E===0&&p.length>10?p.length-=10:p.length-=9},q.prototype.imulK=function(p){p.words[p.length]=0,p.words[p.length+1]=0,p.length+=2;for(var d=0,m=0;m<p.length;m++){var x=p.words[m]|0;d+=x*977,p.words[m]=d&67108863,d=x*64+(d/67108864|0)}return p.words[p.length-1]===0&&(p.length--,p.words[p.length-1]===0&&p.length--),p};function X(){W.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(X,W);function ie(){W.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ie,W);function ae(){W.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ae,W),ae.prototype.imulK=function(p){for(var d=0,m=0;m<p.length;m++){var x=(p.words[m]|0)*19+d,M=x&67108863;x>>>=26,p.words[m]=M,d=x}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(L[p])return L[p];var d;if(p==="k256")d=new q;else if(p==="p224")d=new X;else if(p==="p192")d=new ie;else if(p==="p25519")d=new ae;else throw new Error("Unknown prime "+p);return L[p]=d,d};function ce($){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}ce.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},ce.prototype._verify2=function(p,d){n((p.negative|d.negative)===0,"red works only with positives"),n(p.red&&p.red===d.red,"red works only with red numbers")},ce.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},ce.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},ce.prototype.add=function(p,d){this._verify2(p,d);var m=p.add(d);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ce.prototype.iadd=function(p,d){this._verify2(p,d);var m=p.iadd(d);return m.cmp(this.m)>=0&&m.isub(this.m),m},ce.prototype.sub=function(p,d){this._verify2(p,d);var m=p.sub(d);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ce.prototype.isub=function(p,d){this._verify2(p,d);var m=p.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},ce.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},ce.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},ce.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},ce.prototype.isqr=function(p){return this.imul(p,p.clone())},ce.prototype.sqr=function(p){return this.mul(p,p)},ce.prototype.sqrt=function(p){if(p.isZero())return p.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(p,m)}for(var x=this.m.subn(1),M=0;!x.isZero()&&x.andln(1)===0;)M++,x.iushrn(1);n(!x.isZero());var E=new s(1).toRed(this),O=E.redNeg(),C=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,C).cmp(O)!==0;)g.redIAdd(O);for(var v=this.pow(g,x),j=this.pow(p,x.addn(1).iushrn(1)),ee=this.pow(p,x),se=M;ee.cmp(E)!==0;){for(var ye=ee,pe=0;ye.cmp(E)!==0;pe++)ye=ye.redSqr();n(pe<se);var Ee=this.pow(v,new s(1).iushln(se-pe-1));j=j.redMul(Ee),v=Ee.redSqr(),ee=ee.redMul(v),se=pe}return j},ce.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},ce.prototype.pow=function(p,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return p.clone();var m=4,x=new Array(1<<m);x[0]=new s(1).toRed(this),x[1]=p;for(var M=2;M<x.length;M++)x[M]=this.mul(x[M-1],p);var E=x[0],O=0,C=0,g=d.bitLength()%26;for(g===0&&(g=26),M=d.length-1;M>=0;M--){for(var v=d.words[M],j=g-1;j>=0;j--){var ee=v>>j&1;if(E!==x[0]&&(E=this.sqr(E)),ee===0&&O===0){C=0;continue}O<<=1,O|=ee,C++,!(C!==m&&(M!==0||j!==0))&&(E=this.mul(E,x[O]),C=0,O=0)}g=26}return E},ce.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},ce.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new V(p)};function V($){ce.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,ce),V.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},V.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},V.prototype.imul=function(p,d){if(p.isZero()||d.isZero())return p.words[0]=0,p.length=1,p;var m=p.imul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.prototype.mul=function(p,d){if(p.isZero()||d.isZero())return new s(0)._forceRed(this);var m=p.mul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,jr)}(hh);var g2=hh.exports;const v2=fa(g2);var M7=jr&&jr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nn,"__esModule",{value:!0}),nn.parseAccumulatorUpdateData=nn.sliceAccumulatorUpdateData=nn.parseTwapMessage=nn.parsePriceFeedMessage=nn.isAccumulatorUpdateData=void 0;const sn=M7(g2),T7="504e4155",A7=1,O7=0,ph=20,I7=0,P7=1;function mh(e){return e.toString("hex").slice(0,8)===T7&&e[4]===A7&&e[5]===O7}nn.isAccumulatorUpdateData=mh;function j7(e){let t=0;if(e.readUInt8(t)!==I7)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new sn.default(e.subarray(t,t+8),"be");t+=8;const s=new sn.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new sn.default(e.subarray(t,t+8),"be");t+=8;const c=new sn.default(e.subarray(t,t+8),"be");t+=8;const u=new sn.default(e.subarray(t,t+8),"be");t+=8;const l=new sn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,price:i,confidence:s,exponent:o,publishTime:a,prevPublishTime:c,emaPrice:u,emaConf:l}}nn.parsePriceFeedMessage=j7;function k7(e){let t=0;if(e.readUInt8(t)!==P7)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new sn.default(e.subarray(t,t+16),"be");t+=16;const s=new sn.default(e.subarray(t,t+16),"be");t+=16;const o=new sn.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new sn.default(e.subarray(t,t+8),"be");t+=8;const u=new sn.default(e.subarray(t,t+8),"be");t+=8;const l=new sn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,cumulativePrice:i,cumulativeConf:s,numDownSlots:o,exponent:a,publishTime:c,prevPublishTime:u,publishSlot:l}}nn.parseTwapMessage=k7;function N7(e,t,r){if(!mh(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+=ph*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 dh.concat([e.subarray(0,o),dh.from([u.length]),...a.slice(t,r)])}nn.sliceAccumulatorUpdateData=N7;function R7(e){if(!mh(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+ph))),t+=ph;o.push({message:u,proof:f})}if(t!==e.length)throw new Error("Didn't reach the end of the message");return{vaa:i,updates:o}}nn.parseAccumulatorUpdateData=R7,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.PriceFeedMetadata=e.Price=e.parseTwapMessage=e.parsePriceFeedMessage=e.parseAccumulatorUpdateData=e.sliceAccumulatorUpdateData=e.isAccumulatorUpdateData=void 0;const t=mu;var r=nn;Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"sliceAccumulatorUpdateData",{enumerable:!0,get:function(){return r.sliceAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}}),Object.defineProperty(e,"parsePriceFeedMessage",{enumerable:!0,get:function(){return r.parsePriceFeedMessage}}),Object.defineProperty(e,"parseTwapMessage",{enumerable:!0,get:function(){return r.parseTwapMessage}});class n{constructor(a){vt(this,"conf");vt(this,"expo");vt(this,"price");vt(this,"publishTime");this.conf=a.conf,this.expo=a.expo,this.price=a.price,this.publishTime=a.publishTime}getPriceAsNumberUnchecked(){return Number(this.price)*10**this.expo}getConfAsNumberUnchecked(){return Number(this.conf)*10**this.expo}static fromJson(a){const c=t.Convert.toPrice(a);return new n({conf:c.conf,expo:c.expo,price:c.price,publishTime:c.publish_time})}toJson(){const a={conf:this.conf,expo:this.expo,price:this.price,publish_time:this.publishTime};return t.Convert.priceToJson(a)}}e.Price=n;class i{constructor(a){vt(this,"attestationTime");vt(this,"emitterChain");vt(this,"priceServiceReceiveTime");vt(this,"sequenceNumber");vt(this,"slot");vt(this,"prevPublishTime");this.attestationTime=a.attestationTime,this.emitterChain=a.emitterChain,this.priceServiceReceiveTime=a.receiveTime,this.sequenceNumber=a.sequenceNumber,this.slot=a.slot,this.prevPublishTime=a.prevPublishTime}static fromJson(a){if(a===void 0)return;const c=t.Convert.toPriceFeedMetadata(a);return new i({attestationTime:c.attestation_time,emitterChain:c.emitter_chain,receiveTime:c.price_service_receive_time,sequenceNumber:c.sequence_number,slot:c.slot,prevPublishTime:c.prev_publish_time})}toJson(){const a={attestation_time:this.attestationTime,emitter_chain:this.emitterChain,price_service_receive_time:this.priceServiceReceiveTime,sequence_number:this.sequenceNumber,slot:this.slot,prev_publish_time:this.prevPublishTime};return t.Convert.priceFeedMetadataToJson(a)}}e.PriceFeedMetadata=i;let s=class N3{constructor(a){vt(this,"emaPrice");vt(this,"id");vt(this,"metadata");vt(this,"vaa");vt(this,"price");this.emaPrice=a.emaPrice,this.id=a.id,this.metadata=a.metadata,this.vaa=a.vaa,this.price=a.price}static fromJson(a){const c=t.Convert.toPriceFeed(a);return new N3({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}(ah);function y2(e,t){return function(){return e.apply(t,arguments)}}const{toString:D7}=Object.prototype,{getPrototypeOf:gh}=Object,vu=(e=>t=>{const r=D7.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Sn=e=>(e=e.toLowerCase(),t=>vu(t)===e),yu=e=>t=>typeof t===e,{isArray:Mo}=Array,Ha=yu("undefined");function $7(e){return e!==null&&!Ha(e)&&e.constructor!==null&&!Ha(e.constructor)&&Wr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const b2=Sn("ArrayBuffer");function B7(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&b2(e.buffer),t}const L7=yu("string"),Wr=yu("function"),w2=yu("number"),bu=e=>e!==null&&typeof e=="object",F7=e=>e===!0||e===!1,wu=e=>{if(vu(e)!=="object")return!1;const t=gh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},U7=Sn("Date"),z7=Sn("File"),V7=Sn("Blob"),q7=Sn("FileList"),G7=e=>bu(e)&&Wr(e.pipe),W7=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Wr(e.append)&&((t=vu(e))==="formdata"||t==="object"&&Wr(e.toString)&&e.toString()==="[object FormData]"))},H7=Sn("URLSearchParams"),[K7,X7,J7,Y7]=["ReadableStream","Request","Response","Headers"].map(Sn),Z7=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ka(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Mo(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 _2(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 Bs=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:jr)(),x2=e=>!Ha(e)&&e!==Bs;function vh(){const{caseless:e}=x2(this)&&this||{},t={},r=(n,i)=>{const s=e&&_2(t,i)||i;wu(t[s])&&wu(n)?t[s]=vh(t[s],n):wu(n)?t[s]=vh({},n):Mo(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Ka(arguments[n],r);return t}const Q7=(e,t,r,{allOwnKeys:n}={})=>(Ka(t,(i,s)=>{r&&Wr(i)?e[s]=y2(i,r):e[s]=i},{allOwnKeys:n}),e),ej=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),tj=(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)},rj=(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&&gh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},nj=(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},ij=e=>{if(!e)return null;if(Mo(e))return e;let t=e.length;if(!w2(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},sj=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gh(Uint8Array)),oj=(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])}},aj=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},cj=Sn("HTMLFormElement"),uj=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),S2=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),lj=Sn("RegExp"),E2=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ka(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},fj=e=>{E2(e,(t,r)=>{if(Wr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Wr(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+"'")})}})},dj=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Mo(e)?n(e):n(String(e).split(t)),r},hj=()=>{},pj=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,yh="abcdefghijklmnopqrstuvwxyz",C2="0123456789",M2={DIGIT:C2,ALPHA:yh,ALPHA_DIGIT:yh+yh.toUpperCase()+C2},mj=(e=16,t=M2.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function gj(e){return!!(e&&Wr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const vj=e=>{const t=new Array(10),r=(n,i)=>{if(bu(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Mo(n)?[]:{};return Ka(n,(o,a)=>{const c=r(o,i+1);!Ha(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},yj=Sn("AsyncFunction"),bj=e=>e&&(bu(e)||Wr(e))&&Wr(e.then)&&Wr(e.catch),T2=((e,t)=>e?setImmediate:t?((r,n)=>(Bs.addEventListener("message",({source:i,data:s})=>{i===Bs&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Bs.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Wr(Bs.postMessage)),wj=typeof queueMicrotask<"u"?queueMicrotask.bind(Bs):typeof hn<"u"&&hn.nextTick||T2;var fe={isArray:Mo,isArrayBuffer:b2,isBuffer:$7,isFormData:W7,isArrayBufferView:B7,isString:L7,isNumber:w2,isBoolean:F7,isObject:bu,isPlainObject:wu,isReadableStream:K7,isRequest:X7,isResponse:J7,isHeaders:Y7,isUndefined:Ha,isDate:U7,isFile:z7,isBlob:V7,isRegExp:lj,isFunction:Wr,isStream:G7,isURLSearchParams:H7,isTypedArray:sj,isFileList:q7,forEach:Ka,merge:vh,extend:Q7,trim:Z7,stripBOM:ej,inherits:tj,toFlatObject:rj,kindOf:vu,kindOfTest:Sn,endsWith:nj,toArray:ij,forEachEntry:oj,matchAll:aj,isHTMLForm:cj,hasOwnProperty:S2,hasOwnProp:S2,reduceDescriptors:E2,freezeMethods:fj,toObjectSet:dj,toCamelCase:uj,noop:hj,toFiniteNumber:pj,findKey:_2,global:Bs,isContextDefined:x2,ALPHABET:M2,generateString:mj,isSpecCompliantForm:gj,toJSONObject:vj,isAsyncFn:yj,isThenable:bj,setImmediate:T2,asap:wj};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 A2=pt.prototype,O2={};["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=>{O2[e]={value:e}}),Object.defineProperties(pt,O2),Object.defineProperty(A2,"isAxiosError",{value:!0}),pt.from=(e,t,r,n,i,s)=>{const o=Object.create(A2);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 _j=null;function bh(e){return fe.isPlainObject(e)||fe.isArray(e)}function I2(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function P2(e,t,r){return e?e.concat(t).map(function(i,s){return i=I2(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function xj(e){return fe.isArray(e)&&!e.some(bh)}const Sj=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function _u(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(_,A){return!fe.isUndefined(A[_])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,o=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(t);if(!fe.isFunction(i))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(fe.isDate(b))return b.toISOString();if(!c&&fe.isBlob(b))throw new pt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(b)||fe.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):dh.from(b):b}function l(b,_,A){let P=b;if(b&&!A&&typeof b=="object"){if(fe.endsWith(_,"{}"))_=n?_:_.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&xj(b)||(fe.isFileList(b)||fe.endsWith(_,"[]"))&&(P=fe.toArray(b)))return _=I2(_),P.forEach(function(R,F){!(fe.isUndefined(R)||R===null)&&t.append(o===!0?P2([_],F,s):o===null?_:_+"[]",u(R))}),!1}return bh(b)?!0:(t.append(P2(A,_,s),u(b)),!1)}const f=[],h=Object.assign(Sj,{defaultVisitor:l,convertValue:u,isVisitable:bh});function y(b,_){if(!fe.isUndefined(b)){if(f.indexOf(b)!==-1)throw Error("Circular reference detected in "+_.join("."));f.push(b),fe.forEach(b,function(P,N){(!(fe.isUndefined(P)||P===null)&&i.call(t,P,fe.isString(N)?N.trim():N,_,h))===!0&&y(P,_?_.concat(N):[N])}),f.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return y(e),t}function j2(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function wh(e,t){this._pairs=[],e&&_u(e,this,t)}const k2=wh.prototype;k2.append=function(t,r){this._pairs.push([t,r])},k2.toString=function(t){const r=t?function(n){return t.call(this,n,j2)}:j2;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Ej(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function N2(e,t,r){if(!t)return e;const n=r&&r.encode||Ej;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 wh(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Cj{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 R2=Cj,D2={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mj=typeof URLSearchParams<"u"?URLSearchParams:wh,Tj=typeof FormData<"u"?FormData:null,Aj=typeof Blob<"u"?Blob:null,Oj={isBrowser:!0,classes:{URLSearchParams:Mj,FormData:Tj,Blob:Aj},protocols:["http","https","file","blob","url","data"]};const _h=typeof window<"u"&&typeof document<"u",xh=typeof navigator=="object"&&navigator||void 0,Ij=_h&&(!xh||["ReactNative","NativeScript","NS"].indexOf(xh.product)<0),Pj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),jj=_h&&window.location.href||"http://localhost";var kj=Object.freeze({__proto__:null,hasBrowserEnv:_h,hasStandardBrowserWebWorkerEnv:Pj,hasStandardBrowserEnv:Ij,navigator:xh,origin:jj}),Tr={...kj,...Oj};function Nj(e,t){return _u(e,new Tr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Tr.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Rj(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Dj(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 $2(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]=Dj(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(Rj(n),i,r,0)}),r}return null}function $j(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 Sh={transitional:D2,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($2(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 Nj(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return _u(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),$j(t)):t}],transformResponse:[function(t){const r=this.transitional||Sh.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(fe.isResponse(t)||fe.isReadableStream(t))return t;if(t&&fe.isString(t)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?pt.from(a,pt.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tr.classes.FormData,Blob:Tr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],e=>{Sh.headers[e]={}});var Eh=Sh;const Bj=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 Lj=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]&&Bj[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const B2=Symbol("internals");function Xa(e){return e&&String(e).trim().toLowerCase()}function xu(e){return e===!1||e==null?e:fe.isArray(e)?e.map(xu):String(e)}function Fj(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 Uj=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ch(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 zj(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Vj(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 Su{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=Xa(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]=xu(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())&&!Uj(t))o(Lj(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=Xa(t),t){const n=fe.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return Fj(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=Xa(t),t){const n=fe.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ch(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=Xa(o),o){const a=fe.findKey(n,o);a&&(!r||Ch(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||Ch(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]=xu(i),delete r[s];return}const a=t?zj(s):String(s).trim();a!==s&&delete r[s],r[a]=xu(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return fe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&fe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
35
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[B2]=this[B2]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Xa(o);n[a]||(Vj(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}Su.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Su.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),fe.freezeMethods(Su);var En=Su;function Mh(e,t){const r=this||Eh,n=t||r,i=En.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 L2(e){return!!(e&&e.__CANCEL__)}function To(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(To,pt,{__CANCEL__:!0});function F2(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 qj(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Gj(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 Wj(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 Eu=(e,t,r=3)=>{let n=0;const i=Gj(50,250);return Wj(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)},U2=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},z2=e=>(...t)=>fe.asap(()=>e(...t));var Hj=Tr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Tr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Tr.origin),Tr.navigator&&/(msie|trident)/i.test(Tr.navigator.userAgent)):()=>!0,Kj=Tr.hasStandardBrowserEnv?{write(e,t,r,n,i,s){const o=[e+"="+encodeURIComponent(t)];fe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),fe.isString(n)&&o.push("path="+n),fe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Xj(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Jj(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function V2(e,t){return e&&!Xj(t)?Jj(e,t):t}const q2=e=>e instanceof En?{...e}:e;function Ls(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(q2(u),q2(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 G2=e=>{const t=Ls({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=En.from(o),t.url=N2(V2(t.baseURL,t.url),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(fe.isFormData(r)){if(Tr.hasStandardBrowserEnv||Tr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...l]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Tr.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&Hj(t.url))){const u=i&&s&&Kj.read(s);u&&o.set(i,u)}return t},Yj=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=G2(e);let s=i.data;const o=En.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,f,h,y,b;function _(){y&&y(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let A=new XMLHttpRequest;A.open(i.method.toUpperCase(),i.url,!0),A.timeout=i.timeout;function P(){if(!A)return;const R=En.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:R,config:e,request:A};F2(function(q){r(q),_()},function(q){n(q),_()},L),A=null}"onloadend"in A?A.onloadend=P:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(P)},A.onabort=function(){A&&(n(new pt("Request aborted",pt.ECONNABORTED,e,A)),A=null)},A.onerror=function(){n(new pt("Network Error",pt.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||D2;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new pt(F,L.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,e,A)),A=null},s===void 0&&o.setContentType(null),"setRequestHeader"in A&&fe.forEach(o.toJSON(),function(F,L){A.setRequestHeader(L,F)}),fe.isUndefined(i.withCredentials)||(A.withCredentials=!!i.withCredentials),a&&a!=="json"&&(A.responseType=i.responseType),u&&([h,b]=Eu(u,!0),A.addEventListener("progress",h)),c&&A.upload&&([f,y]=Eu(c),A.upload.addEventListener("progress",f),A.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=R=>{A&&(n(!R||R.type?new To(null,e,A):R),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const N=qj(i.url);if(N&&Tr.protocols.indexOf(N)===-1){n(new pt("Unsupported protocol "+N+":",pt.ERR_BAD_REQUEST,e));return}A.send(s||null)})},Zj=(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 To(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,s(new pt(`timeout ${t} of ms exceeded`,pt.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>fe.asap(a),c}};const Qj=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},ek=async function*(e,t){for await(const r of tk(e))yield*Qj(r,t)},tk=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()}},W2=(e,t,r,n)=>{const i=ek(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})},Cu=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",H2=Cu&&typeof ReadableStream=="function",rk=Cu&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),K2=(e,...t)=>{try{return!!e(...t)}catch{return!1}},nk=H2&&K2(()=>{let e=!1;const t=new Request(Tr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),X2=64*1024,Th=H2&&K2(()=>fe.isReadableStream(new Response("").body)),Mu={stream:Th&&(e=>e.body)};Cu&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Mu[t]&&(Mu[t]=fe.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new pt(`Response type '${t}' is not supported`,pt.ERR_NOT_SUPPORT,n)})})})(new Response);const ik=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Tr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(e)||fe.isArrayBuffer(e))return e.byteLength;if(fe.isURLSearchParams(e)&&(e=e+""),fe.isString(e))return(await rk(e)).byteLength},sk=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??ik(t)};var ok=Cu&&(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}=G2(e);u=u?(u+"").toLowerCase():"text";let y=Zj([i,s&&s.toAbortSignal()],o),b;const _=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let A;try{if(c&&nk&&r!=="get"&&r!=="head"&&(A=await sk(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),W;if(fe.isFormData(n)&&(W=L.headers.get("content-type"))&&l.setContentType(W),L.body){const[q,X]=U2(A,Eu(z2(c)));n=W2(L.body,X2,q,X)}}fe.isString(f)||(f=f?"include":"omit");const P="credentials"in Request.prototype;b=new Request(t,{...h,signal:y,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:P?f:void 0});let N=await fetch(b);const R=Th&&(u==="stream"||u==="response");if(Th&&(a||R&&_)){const L={};["status","statusText","headers"].forEach(ie=>{L[ie]=N[ie]});const W=fe.toFiniteNumber(N.headers.get("content-length")),[q,X]=a&&U2(W,Eu(z2(a),!0))||[];N=new Response(W2(N.body,X2,q,()=>{X&&X(),_&&_()}),L)}u=u||"text";let F=await Mu[fe.findKey(Mu,u)||"text"](N,e);return!R&&_&&_(),await new Promise((L,W)=>{F2(L,W,{data:F,headers:En.from(N.headers),status:N.status,statusText:N.statusText,config:e,request:b})})}catch(P){throw _&&_(),P&&P.name==="TypeError"&&/fetch/i.test(P.message)?Object.assign(new pt("Network Error",pt.ERR_NETWORK,e,b),{cause:P.cause||P}):pt.from(P,P&&P.code,e,b)}});const Ah={http:_j,xhr:Yj,fetch:ok};fe.forEach(Ah,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const J2=e=>`- ${e}`,ak=e=>fe.isFunction(e)||e===null||e===!1;var Y2={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,!ak(r)&&(n=Ah[(o=String(r)).toLowerCase()],n===void 0))throw new pt(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+s]=n}if(!n){const s=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
36
|
+
`+s.map(J2).join(`
|
|
37
|
+
`):" "+J2(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:Ah};function Oh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new To(null,e)}function Z2(e){return Oh(e),e.headers=En.from(e.headers),e.data=Mh.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Y2.getAdapter(e.adapter||Eh.adapter)(e).then(function(n){return Oh(e),n.data=Mh.call(e,e.transformResponse,n),n.headers=En.from(n.headers),n},function(n){return L2(n)||(Oh(e),n&&n.response&&(n.response.data=Mh.call(e,e.transformResponse,n.response),n.response.headers=En.from(n.response.headers))),Promise.reject(n)})}const Q2="1.7.9",Tu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Tu[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const e_={};Tu.transitional=function(t,r,n){function i(s,o){return"[Axios v"+Q2+"] 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&&!e_[o]&&(e_[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}},Tu.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function ck(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 Au={assertOptions:ck,validators:Tu};const Zn=Au.validators;class Ou{constructor(t){this.defaults=t,this.interceptors={request:new R2,response:new R2}}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=Ls(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&Au.assertOptions(n,{silentJSONParsing:Zn.transitional(Zn.boolean),forcedJSONParsing:Zn.transitional(Zn.boolean),clarifyTimeoutError:Zn.transitional(Zn.boolean)},!1),i!=null&&(fe.isFunction(i)?r.paramsSerializer={serialize:i}:Au.assertOptions(i,{encode:Zn.function,serialize:Zn.function},!0)),Au.assertOptions(r,{baseUrl:Zn.spelling("baseURL"),withXsrfToken:Zn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),r.headers=En.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(r)===!1||(c=c&&_.synchronous,a.unshift(_.fulfilled,_.rejected))});const u=[];this.interceptors.response.forEach(function(_){u.push(_.fulfilled,_.rejected)});let l,f=0,h;if(!c){const b=[Z2.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++],_=a[f++];try{y=b(y)}catch(A){_.call(this,A);break}}try{l=Z2.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=Ls(this.defaults,t);const r=V2(t.baseURL,t.url);return N2(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){Ou.prototype[t]=function(r,n){return this.request(Ls(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(Ls(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Ou.prototype[t]=r(),Ou.prototype[t+"Form"]=r(!0)});var Iu=Ou;class Ih{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 To(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 Ih(function(i){t=i}),cancel:t}}}var uk=Ih;function lk(e){return function(r){return e.apply(null,r)}}function fk(e){return fe.isObject(e)&&e.isAxiosError===!0}const Ph={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(Ph).forEach(([e,t])=>{Ph[t]=e});var dk=Ph;function t_(e){const t=new Iu(e),r=y2(Iu.prototype.request,t);return fe.extend(r,Iu.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return t_(Ls(e,i))},r}const ur=t_(Eh);ur.Axios=Iu,ur.CanceledError=To,ur.CancelToken=uk,ur.isCancel=L2,ur.VERSION=Q2,ur.toFormData=_u,ur.AxiosError=pt,ur.Cancel=ur.CanceledError,ur.all=function(t){return Promise.all(t)},ur.spread=lk,ur.isAxiosError=fk,ur.mergeConfig=Ls,ur.AxiosHeaders=En,ur.formToJSON=e=>$2(fe.isHTMLForm(e)?new FormData(e):e),ur.getAdapter=Y2.getAdapter,ur.HttpStatusCode=dk,ur.default=ur;var r_=ur,jh={exports:{}},Hr={},n_={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})(n_);var hk=n_.exports,kh={exports:{}},Nh={exports:{}},i_;function Pu(){return i_||(i_=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}(Nh)),Nh.exports}var s_;function pk(){return s_||(s_=1,function(e){var t=Pu().default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},s=Object.prototype,o=s.hasOwnProperty,a=Object.defineProperty||function(E,O,C){E[O]=C.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function h(E,O,C){return Object.defineProperty(E,O,{value:C,enumerable:!0,configurable:!0,writable:!0}),E[O]}try{h({},"")}catch{h=function(C,g,v){return C[g]=v}}function y(E,O,C,g){var v=O&&O.prototype instanceof F?O:F,j=Object.create(v.prototype),ee=new x(g||[]);return a(j,"_invoke",{value:$(E,C,ee)}),j}function b(E,O,C){try{return{type:"normal",arg:E.call(O,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=y;var _="suspendedStart",A="suspendedYield",P="executing",N="completed",R={};function F(){}function L(){}function W(){}var q={};h(q,u,function(){return this});var X=Object.getPrototypeOf,ie=X&&X(X(M([])));ie&&ie!==s&&o.call(ie,u)&&(q=ie);var ae=W.prototype=F.prototype=Object.create(q);function ce(E){["next","throw","return"].forEach(function(O){h(E,O,function(C){return this._invoke(O,C)})})}function V(E,O){function C(v,j,ee,se){var ye=b(E[v],E,j);if(ye.type!=="throw"){var pe=ye.arg,Ee=pe.value;return Ee&&t(Ee)=="object"&&o.call(Ee,"__await")?O.resolve(Ee.__await).then(function(Se){C("next",Se,ee,se)},function(Se){C("throw",Se,ee,se)}):O.resolve(Ee).then(function(Se){pe.value=Se,ee(pe)},function(Se){return C("throw",Se,ee,se)})}se(ye.arg)}var g;a(this,"_invoke",{value:function(j,ee){function se(){return new O(function(ye,pe){C(j,ee,ye,pe)})}return g=g?g.then(se,se):se()}})}function $(E,O,C){var g=_;return function(v,j){if(g===P)throw Error("Generator is already running");if(g===N){if(v==="throw")throw j;return{value:n,done:!0}}for(C.method=v,C.arg=j;;){var ee=C.delegate;if(ee){var se=p(ee,C);if(se){if(se===R)continue;return se}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===_)throw g=N,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=P;var ye=b(E,O,C);if(ye.type==="normal"){if(g=C.done?N:A,ye.arg===R)continue;return{value:ye.arg,done:C.done}}ye.type==="throw"&&(g=N,C.method="throw",C.arg=ye.arg)}}}function p(E,O){var C=O.method,g=E.iterator[C];if(g===n)return O.delegate=null,C==="throw"&&E.iterator.return&&(O.method="return",O.arg=n,p(E,O),O.method==="throw")||C!=="return"&&(O.method="throw",O.arg=new TypeError("The iterator does not provide a '"+C+"' method")),R;var v=b(g,E.iterator,O.arg);if(v.type==="throw")return O.method="throw",O.arg=v.arg,O.delegate=null,R;var j=v.arg;return j?j.done?(O[E.resultName]=j.value,O.next=E.nextLoc,O.method!=="return"&&(O.method="next",O.arg=n),O.delegate=null,R):j:(O.method="throw",O.arg=new TypeError("iterator result is not an object"),O.delegate=null,R)}function d(E){var O={tryLoc:E[0]};1 in E&&(O.catchLoc=E[1]),2 in E&&(O.finallyLoc=E[2],O.afterLoc=E[3]),this.tryEntries.push(O)}function m(E){var O=E.completion||{};O.type="normal",delete O.arg,E.completion=O}function x(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(d,this),this.reset(!0)}function M(E){if(E||E===""){var O=E[u];if(O)return O.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var C=-1,g=function v(){for(;++C<E.length;)if(o.call(E,C))return v.value=E[C],v.done=!1,v;return v.value=n,v.done=!0,v};return g.next=g}}throw new TypeError(t(E)+" is not iterable")}return L.prototype=W,a(ae,"constructor",{value:W,configurable:!0}),a(W,"constructor",{value:L,configurable:!0}),L.displayName=h(W,f,"GeneratorFunction"),i.isGeneratorFunction=function(E){var O=typeof E=="function"&&E.constructor;return!!O&&(O===L||(O.displayName||O.name)==="GeneratorFunction")},i.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,W):(E.__proto__=W,h(E,f,"GeneratorFunction")),E.prototype=Object.create(ae),E},i.awrap=function(E){return{__await:E}},ce(V.prototype),h(V.prototype,l,function(){return this}),i.AsyncIterator=V,i.async=function(E,O,C,g,v){v===void 0&&(v=Promise);var j=new V(y(E,O,C,g),v);return i.isGeneratorFunction(O)?j:j.next().then(function(ee){return ee.done?ee.value:j.next()})},ce(ae),h(ae,f,"Generator"),h(ae,u,function(){return this}),h(ae,"toString",function(){return"[object Generator]"}),i.keys=function(E){var O=Object(E),C=[];for(var g in O)C.push(g);return C.reverse(),function v(){for(;C.length;){var j=C.pop();if(j in O)return v.value=j,v.done=!1,v}return v.done=!0,v}},i.values=M,x.prototype={constructor:x,reset:function(O){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(m),!O)for(var C in this)C.charAt(0)==="t"&&o.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=n)},stop:function(){this.done=!0;var O=this.tryEntries[0].completion;if(O.type==="throw")throw O.arg;return this.rval},dispatchException:function(O){if(this.done)throw O;var C=this;function g(pe,Ee){return ee.type="throw",ee.arg=O,C.next=pe,Ee&&(C.method="next",C.arg=n),!!Ee}for(var v=this.tryEntries.length-1;v>=0;--v){var j=this.tryEntries[v],ee=j.completion;if(j.tryLoc==="root")return g("end");if(j.tryLoc<=this.prev){var se=o.call(j,"catchLoc"),ye=o.call(j,"finallyLoc");if(se&&ye){if(this.prev<j.catchLoc)return g(j.catchLoc,!0);if(this.prev<j.finallyLoc)return g(j.finallyLoc)}else if(se){if(this.prev<j.catchLoc)return g(j.catchLoc,!0)}else{if(!ye)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return g(j.finallyLoc)}}}},abrupt:function(O,C){for(var g=this.tryEntries.length-1;g>=0;--g){var v=this.tryEntries[g];if(v.tryLoc<=this.prev&&o.call(v,"finallyLoc")&&this.prev<v.finallyLoc){var j=v;break}}j&&(O==="break"||O==="continue")&&j.tryLoc<=C&&C<=j.finallyLoc&&(j=null);var ee=j?j.completion:{};return ee.type=O,ee.arg=C,j?(this.method="next",this.next=j.finallyLoc,R):this.complete(ee)},complete:function(O,C){if(O.type==="throw")throw O.arg;return O.type==="break"||O.type==="continue"?this.next=O.arg:O.type==="return"?(this.rval=this.arg=O.arg,this.method="return",this.next="end"):O.type==="normal"&&C&&(this.next=C),R},finish:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.finallyLoc===O)return this.complete(g.completion,g.afterLoc),m(g),R}},catch:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc===O){var v=g.completion;if(v.type==="throw"){var j=v.arg;m(g)}return j}}throw Error("illegal catch attempt")},delegateYield:function(O,C,g){return this.delegate={iterator:M(O),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),R}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(kh)),kh.exports}var Rh,o_;function mk(){if(o_)return Rh;o_=1;var e=pk()();Rh=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Rh}var Dh={exports:{}},a_;function gk(){return a_||(a_=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}(Dh)),Dh.exports}var $h={exports:{}},Bh={exports:{}},Lh={exports:{}},c_;function vk(){return c_||(c_=1,function(e){var t=Pu().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}(Lh)),Lh.exports}var u_;function yk(){return u_||(u_=1,function(e){var t=Pu().default,r=vk();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}(Bh)),Bh.exports}var l_;function bk(){return l_||(l_=1,function(e){var t=yk();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}($h)),$h.exports}var Fh,f_;function wk(){if(f_)return Fh;f_=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 Fh=t=>!e.has(t&&t.code),Fh}var Ja=hk;Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.isNetworkError=Vh,Hr.isRetryableError=ku,Hr.isSafeRequestError=m_,Hr.isIdempotentRequestError=qh,Hr.isNetworkOrIdempotentRequestError=Gh,Hr.exponentialDelay=g_,Hr.default=Fs,Hr.DEFAULT_OPTIONS=Hr.namespace=void 0;var ju=Ja(mk()),_k=Ja(Pu()),d_=Ja(gk()),xk=Ja(bk()),Sk=Ja(wk());function h_(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 Uh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?h_(Object(r),!0).forEach(function(n){(0,xk.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var zh="axios-retry";Hr.namespace=zh;function Vh(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,Sk.default)(e)}var p_=["get","head","options"],Ek=p_.concat(["put","delete"]);function ku(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function m_(e){return e.config?ku(e)&&p_.indexOf(e.config.method)!==-1:!1}function qh(e){return e.config?ku(e)&&Ek.indexOf(e.config.method)!==-1:!1}function Gh(e){return Vh(e)||qh(e)}function Ck(){return 0}function g_(){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 v_={retries:3,retryCondition:Gh,retryDelay:Ck,shouldResetTimeout:!1,onRetry:function(){}};Hr.DEFAULT_OPTIONS=v_;function Mk(e,t){return Uh(Uh(Uh({},v_),t),e[zh])}function y_(e,t){var r=Mk(e,t);return r.retryCount=r.retryCount||0,e[zh]=r,r}function Tk(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 Ak(e,t){return Wh.apply(this,arguments)}function Wh(){return Wh=(0,d_.default)(ju.default.mark(function e(t,r){var n,i,s,o;return ju.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(n=t.retries,i=t.retryCondition,s=t.retryCount<n&&i(r),(0,_k.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]])})),Wh.apply(this,arguments)}function Fs(e,t){var r=e.interceptors.request.use(function(i){var s=y_(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,d_.default)(ju.default.mark(function s(o){var a,c,u,l,f,h,y,b;return ju.default.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(a=o.config,a){A.next=3;break}return A.abrupt("return",Promise.reject(o));case 3:return c=y_(a,t),A.next=6,Ak(c,o);case 6:if(!A.sent){A.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),Tk(e,a),!(!l&&a.timeout&&c.lastRequestTime)){A.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){A.next=16;break}return A.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(P){return P}],A.next=20,f(c.retryCount,o,a);case 20:return A.abrupt("return",new Promise(function(P){return setTimeout(function(){return P(e(a))},h)}));case 21:return A.abrupt("return",Promise.reject(o));case 22:case"end":return A.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}Fs.isNetworkError=Vh,Fs.isSafeRequestError=m_,Fs.isIdempotentRequestError=qh,Fs.isNetworkOrIdempotentRequestError=Gh,Fs.exponentialDelay=g_,Fs.isRetryableError=ku;const b_=Hr.default;jh.exports=b_,jh.exports.default=b_;var Ok=jh.exports,Nu={},Ao=null;typeof WebSocket<"u"?Ao=WebSocket:typeof MozWebSocket<"u"?Ao=MozWebSocket:typeof jr<"u"?Ao=jr.WebSocket||jr.MozWebSocket:typeof window<"u"?Ao=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Ao=self.WebSocket||self.MozWebSocket);var Ik=Ao,Pk=jr&&jr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.ResilientWebSocket=void 0;const jk=Pk(Ik),kk=3e4+3e3;class Nk{constructor(t,r){vt(this,"endpoint");vt(this,"wsClient");vt(this,"wsUserClosed");vt(this,"wsFailedAttempts");vt(this,"pingTimeout");vt(this,"logger");vt(this,"onError");vt(this,"onMessage");vt(this,"onReconnect");this.endpoint=t,this.logger=r,this.wsFailedAttempts=0,this.onError=n=>{var i;(i=this.logger)==null||i.error(n)},this.wsUserClosed=!0,this.onMessage=()=>{},this.onReconnect=()=>{}}async send(t){var r,n,i;(r=this.logger)==null||r.info(`Sending ${t}`),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0?(n=this.logger)==null||n.error("Couldn't connect to the websocket server. Error callback is called."):(i=this.wsClient)==null||i.send(t)}async startWebSocket(){var t;this.wsClient===void 0&&((t=this.logger)==null||t.info("Creating Web Socket client"),this.wsClient=new jk.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=Rk(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await w_(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()},kk)}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 w_(10)}async restartUnexpectedClosedWebsocket(){var t;if(this.wsUserClosed!==!0){if(await this.startWebSocket(),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0){(t=this.logger)==null||t.error("Couldn't reconnect to websocket. Error callback is called.");return}this.onReconnect()}}closeWebSocket(){if(this.wsClient!==void 0){const t=this.wsClient;this.wsClient=void 0,t.close()}this.wsUserClosed=!0}}Nu.ResilientWebSocket=Nk;async function w_(e){return new Promise(t=>setTimeout(t,e))}function Rk(e){return 2**e*100}var Oo={};Object.defineProperty(Oo,"__esModule",{value:!0}),Oo.removeLeading0xIfExists=Oo.makeWebsocketUrl=void 0;function Dk(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}Oo.makeWebsocketUrl=Dk;function $k(e){return e.startsWith("0x")?e.substring(2):e}Oo.removeLeading0xIfExists=$k;var __=jr&&jr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pu,"__esModule",{value:!0}),pu.PriceServiceConnection=void 0;const Hh=ah,Bk=__(r_),x_=__(Ok),Lk=Nu,Kh=Oo;class Fk{constructor(t,r){vt(this,"httpClient");vt(this,"priceFeedCallbacks");vt(this,"wsClient");vt(this,"wsEndpoint");vt(this,"logger");vt(this,"priceFeedRequestConfig");vt(this,"onWsError");var n,i,s;this.httpClient=Bk.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,x_.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:x_.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 hn<"u"&&typeof hn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),hn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Kh.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=>Hh.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 Hh.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,Kh.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,Kh.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 Lk.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=Hh.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()}}pu.PriceServiceConnection=Fk,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=pu;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=ah;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}})}(oh),Object.defineProperty(hu,"__esModule",{value:!0}),hu.SuiPriceServiceConnection=void 0;const Uk=oh,zk=gu();class Vk extends Uk.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>zk.Buffer.from(n,"base64"))}}hu.SuiPriceServiceConnection=Vk;var Ru={};Object.defineProperty(Ru,"__esModule",{value:!0}),Ru.SuiPythClient=void 0;const Du=Ey,Io=Gn,qk=gu(),Xh=16*1024;class Gk{constructor(t,r,n){vt(this,"provider");vt(this,"pythStateId");vt(this,"wormholeStateId");vt(this,"pythPackageId");vt(this,"wormholePackageId");vt(this,"priceTableInfo");vt(this,"priceFeedObjectIdCache",new Map);vt(this,"baseUpdateFee");this.provider=t,this.pythStateId=r,this.wormholeStateId=n,this.pythPackageId=void 0,this.wormholePackageId=void 0}async getBaseUpdateFee(){if(this.baseUpdateFee===void 0){const t=await this.provider.getObject({id:this.pythStateId,options:{showContent:!0}});if(!t.data||!t.data.content||t.data.content.dataType!=="moveObject")throw new Error("Unable to fetch pyth state object");this.baseUpdateFee=t.data.content.fields.base_update_fee}return this.baseUpdateFee}async getPackageId(t){const r=await this.provider.getObject({id:t,options:{showContent:!0}}).then(n=>{var i,s,o;if(((s=(i=n.data)==null?void 0:i.content)==null?void 0:s.dataType)=="moveObject")return n.data.content.fields;throw console.log((o=n.data)==null?void 0:o.content),new Error(`Cannot fetch package id for object ${t}`)});if("upgrade_cap"in r)return r.upgrade_cap.fields.package;throw new Error("upgrade_cap not found")}async verifyVaas(t,r){const n=await this.getWormholePackageId(),i=[];for(const s of t){const[o]=r.moveCall({target:`${n}::vaa::parse_and_verify`,arguments:[r.object(this.wormholeStateId),r.pure(Io.bcs.vector(Io.bcs.U8).serialize(Array.from(s),{maxSize:Xh}).toBytes()),r.object(Du.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(Io.bcs.vector(Io.bcs.U8).serialize(Array.from(r[0]),{maxSize:Xh}).toBytes()),a[0],t.object(Du.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(Du.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(Io.bcs.vector(Io.bcs.U8).serialize(Array.from(r[0]),{maxSize:Xh}).toBytes()),s[0],t.object(Du.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(qk.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)}}Ru.SuiPythClient=Gk,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=hu;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=Ru;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=oh;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})}(p2);var S_=fM,Jh=Ey,Wk=Eo,$u=p2,Hk=Object.create,Yh=Object.defineProperty,Kk=Object.defineProperties,Xk=Object.getOwnPropertyDescriptor,Jk=Object.getOwnPropertyDescriptors,E_=Object.getOwnPropertyNames,C_=Object.getOwnPropertySymbols,Yk=Object.getPrototypeOf,M_=Object.prototype.hasOwnProperty,Zk=Object.prototype.propertyIsEnumerable,T_=(e,t,r)=>t in e?Yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Qk=(e,t)=>{for(var r in t||(t={}))M_.call(t,r)&&T_(e,r,t[r]);if(C_)for(var r of C_(t))Zk.call(t,r)&&T_(e,r,t[r]);return e},e9=(e,t)=>Kk(e,Jk(t)),t9=(e=>typeof Fn<"u"?Fn:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Fn<"u"?Fn:t)[r]}):e)(function(e){if(typeof Fn<"u")return Fn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),r9=(e,t)=>function(){return t||(0,e[E_(e)[0]])((t={exports:{}}).exports,t),t.exports},n9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of E_(t))!M_.call(e,i)&&i!==r&&Yh(e,i,{get:()=>t[i],enumerable:!(n=Xk(t,i))||n.enumerable});return e},Po=(e,t,r)=>(r=e!=null?Hk(Yk(e)):{},n9(!e||!e.__esModule?Yh(r,"default",{value:e,enumerable:!0}):r,e)),xt=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{a(r.next(c))}catch(u){i(u)}},o=c=>{try{a(r.throw(c))}catch(u){i(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,o);a((r=r.apply(e,t)).next())}),jo=r9({"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=t9("buffer").Buffer}catch{}o.isBN=function(d){return d instanceof o?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===o.wordSize&&Array.isArray(d.words)},o.max=function(d,m){return d.cmp(m)>0?d:m},o.min=function(d,m){return d.cmp(m)<0?d:m},o.prototype._init=function(d,m,x){if(typeof d=="number")return this._initNumber(d,m,x);if(typeof d=="object")return this._initArray(d,m,x);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),d=d.toString().replace(/\s+/g,"");var M=0;d[0]==="-"&&(M++,this.negative=1),M<d.length&&(m===16?this._parseHex(d,M,x):(this._parseBase(d,m,M),x==="le"&&this._initArray(this.toArray(),m,x)))},o.prototype._initNumber=function(d,m,x){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(i(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),m,x)},o.prototype._initArray=function(d,m,x){if(i(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var E,O,C=0;if(x==="be")for(M=d.length-1,E=0;M>=0;M-=3)O=d[M]|d[M-1]<<8|d[M-2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);else if(x==="le")for(M=0,E=0;M<d.length;M+=3)O=d[M]|d[M+1]<<8|d[M+2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);return this._strip()};function c(p,d){var m=p.charCodeAt(d);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;i(!1,"Invalid character in "+p)}function u(p,d,m){var x=c(p,m);return m-1>=d&&(x|=c(p,m-1)<<4),x}o.prototype._parseHex=function(d,m,x){this.length=Math.ceil((d.length-m)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var E=0,O=0,C;if(x==="be")for(M=d.length-1;M>=m;M-=2)C=u(d,m,M)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8;else{var g=d.length-m;for(M=g%2===0?m+1:m;M<d.length;M+=2)C=u(d,m,M)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8}this._strip()};function l(p,d,m,x){for(var M=0,E=0,O=Math.min(p.length,m),C=d;C<O;C++){var g=p.charCodeAt(C)-48;M*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),M+=E}return M}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var M=0,E=1;E<=67108863;E*=m)M++;M--,E=E/m|0;for(var O=d.length-x,C=O%M,g=Math.min(O,O-C)+x,v=0,j=x;j<g;j+=M)v=l(d,j,j+M,m),this.imuln(E),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(C!==0){var ee=1;for(v=l(d,j,d.length,m),j=0;j<C;j++)ee*=m;this.imuln(ee),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},o.prototype.copy=function(d){d.words=new Array(this.length);for(var m=0;m<this.length;m++)d.words[m]=this.words[m];d.length=this.length,d.negative=this.negative,d.red=this.red};function f(p,d){p.words=d.words,p.length=d.length,p.negative=d.negative,p.red=d.red}if(o.prototype._move=function(d){f(d,this)},o.prototype.clone=function(){var d=new o(null);return this.copy(d),d},o.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],b=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(d,m){d=d||10,m=m|0||1;var x;if(d===16||d==="hex"){x="";for(var M=0,E=0,O=0;O<this.length;O++){var C=this.words[O],g=((C<<M|E)&16777215).toString(16);E=C>>>24-M&16777215,M+=2,M>=26&&(M-=26,O--),E!==0||O!==this.length-1?x=y[6-g.length]+g+x:x=g+x}for(E!==0&&(x=E.toString(16)+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(d===(d|0)&&d>=2&&d<=36){var v=b[d],j=_[d];x="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var se=ee.modrn(j).toString(d);ee=ee.idivn(j),ee.isZero()?x=se+x:x=y[v-se.length]+se+x}for(this.isZero()&&(x="0"+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(d,m){return this.toArrayLike(a,d,m)}),o.prototype.toArray=function(d,m){return this.toArrayLike(Array,d,m)};var A=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var M=this.byteLength(),E=x||Math.max(1,M);i(M<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=A(d,E),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](O,M),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;d[x++]=C&255,x<d.length&&(d[x++]=C>>8&255),x<d.length&&(d[x++]=C>>16&255),O===6?(x<d.length&&(d[x++]=C>>24&255),M=0,O=0):(M=C>>>24,O+=2)}if(x<d.length)for(d[x++]=M;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;d[x--]=C&255,x>=0&&(d[x--]=C>>8&255),x>=0&&(d[x--]=C>>16&255),O===6?(x>=0&&(d[x--]=C>>24&255),M=0,O=0):(M=C>>>24,O+=2)}if(x>=0)for(d[x--]=M;x>=0;)d[x--]=0},Math.clz32?o.prototype._countBits=function(d){return 32-Math.clz32(d)}:o.prototype._countBits=function(d){var m=d,x=0;return m>=4096&&(x+=13,m>>>=13),m>=64&&(x+=7,m>>>=7),m>=8&&(x+=4,m>>>=4),m>=2&&(x+=2,m>>>=2),x+m},o.prototype._zeroBits=function(d){if(d===0)return 26;var m=d,x=0;return m&8191||(x+=13,m>>>=13),m&127||(x+=7,m>>>=7),m&15||(x+=4,m>>>=4),m&3||(x+=2,m>>>=2),m&1||x++,x},o.prototype.bitLength=function(){var d=this.words[this.length-1],m=this._countBits(d);return(this.length-1)*26+m};function P(p){for(var d=new Array(p.bitLength()),m=0;m<d.length;m++){var x=m/26|0,M=m%26;d[m]=p.words[x]>>>M&1}return d}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,m=0;m<this.length;m++){var x=this._zeroBits(this.words[m]);if(d+=x,x!==26)break}return d},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},o.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]|d.words[m];return this._strip()},o.prototype.ior=function(d){return i((this.negative|d.negative)===0),this.iuor(d)},o.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},o.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},o.prototype.iuand=function(d){var m;this.length>d.length?m=d:m=this;for(var x=0;x<m.length;x++)this.words[x]=this.words[x]&d.words[x];return this.length=m.length,this._strip()},o.prototype.iand=function(d){return i((this.negative|d.negative)===0),this.iuand(d)},o.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},o.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},o.prototype.iuxor=function(d){var m,x;this.length>d.length?(m=this,x=d):(m=d,x=this);for(var M=0;M<x.length;M++)this.words[M]=m.words[M]^x.words[M];if(this!==m)for(;M<m.length;M++)this.words[M]=m.words[M];return this.length=m.length,this._strip()},o.prototype.ixor=function(d){return i((this.negative|d.negative)===0),this.iuxor(d)},o.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},o.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},o.prototype.inotn=function(d){i(typeof d=="number"&&d>=0);var m=Math.ceil(d/26)|0,x=d%26;this._expand(m),x>0&&m--;for(var M=0;M<m;M++)this.words[M]=~this.words[M]&67108863;return x>0&&(this.words[M]=~this.words[M]&67108863>>26-x),this._strip()},o.prototype.notn=function(d){return this.clone().inotn(d)},o.prototype.setn=function(d,m){i(typeof d=="number"&&d>=0);var x=d/26|0,M=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<M:this.words[x]=this.words[x]&~(1<<M),this._strip()},o.prototype.iadd=function(d){var m;if(this.negative!==0&&d.negative===0)return this.negative=0,m=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,m=this.isub(d),d.negative=1,m._normSign();var x,M;this.length>d.length?(x=this,M=d):(x=d,M=this);for(var E=0,O=0;O<M.length;O++)m=(x.words[O]|0)+(M.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;for(;E!==0&&O<x.length;O++)m=(x.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;if(this.length=x.length,E!==0)this.words[this.length]=E,this.length++;else if(x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this},o.prototype.add=function(d){var m;return d.negative!==0&&this.negative===0?(d.negative=0,m=this.sub(d),d.negative^=1,m):d.negative===0&&this.negative!==0?(this.negative=0,m=d.sub(this),this.negative=1,m):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},o.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var m=this.iadd(d);return d.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var x=this.cmp(d);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,E;x>0?(M=this,E=d):(M=d,E=this);for(var O=0,C=0;C<E.length;C++)m=(M.words[C]|0)-(E.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;for(;O!==0&&C<M.length;C++)m=(M.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;if(O===0&&C<M.length&&M!==this)for(;C<M.length;C++)this.words[C]=M.words[C];return this.length=Math.max(this.length,C),M!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(d){return this.clone().isub(d)};function N(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var M=p.words[0]|0,E=d.words[0]|0,O=M*E,C=O&67108863,g=O/67108864|0;m.words[0]=C;for(var v=1;v<x;v++){for(var j=g>>>26,ee=g&67108863,se=Math.min(v,d.length-1),ye=Math.max(0,v-p.length+1);ye<=se;ye++){var pe=v-ye|0;M=p.words[pe]|0,E=d.words[ye]|0,O=M*E+ee,j+=O/67108864|0,ee=O&67108863}m.words[v]=ee|0,g=j|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var R=function(d,m,x){var M=d.words,E=m.words,O=x.words,C=0,g,v,j,ee=M[0]|0,se=ee&8191,ye=ee>>>13,pe=M[1]|0,Ee=pe&8191,Se=pe>>>13,Je=M[2]|0,Ue=Je&8191,lt=Je>>>13,ht=M[3]|0,$e=ht&8191,mt=ht>>>13,_e=M[4]|0,ge=_e&8191,Ae=_e>>>13,Ge=M[5]|0,De=Ge&8191,Oe=Ge>>>13,Ie=M[6]|0,Le=Ie&8191,ft=Ie>>>13,dt=M[7]|0,We=dt&8191,jt=dt>>>13,St=M[8]|0,et=St&8191,At=St>>>13,$t=M[9]|0,nt=$t&8191,Et=$t>>>13,Ot=E[0]|0,st=Ot&8191,kt=Ot>>>13,It=E[1]|0,it=It&8191,wt=It>>>13,Mt=E[2]|0,Ye=Mt&8191,gt=Mt>>>13,Pt=E[3]|0,ot=Pt&8191,_t=Pt>>>13,Ut=E[4]|0,k=Ut&8191,S=Ut>>>13,T=E[5]|0,B=T&8191,K=T>>>13,Z=E[6]|0,re=Z&8191,Be=Z>>>13,rt=E[7]|0,Re=rt&8191,z=rt>>>13,oe=E[8]|0,he=oe&8191,ke=oe>>>13,He=E[9]|0,Ne=He&8191,ze=He>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(se,st),v=Math.imul(se,kt),v=v+Math.imul(ye,st)|0,j=Math.imul(ye,kt);var ut=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ut>>>26)|0,ut&=67108863,g=Math.imul(Ee,st),v=Math.imul(Ee,kt),v=v+Math.imul(Se,st)|0,j=Math.imul(Se,kt),g=g+Math.imul(se,it)|0,v=v+Math.imul(se,wt)|0,v=v+Math.imul(ye,it)|0,j=j+Math.imul(ye,wt)|0;var Jt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,kt),v=v+Math.imul(lt,st)|0,j=Math.imul(lt,kt),g=g+Math.imul(Ee,it)|0,v=v+Math.imul(Ee,wt)|0,v=v+Math.imul(Se,it)|0,j=j+Math.imul(Se,wt)|0,g=g+Math.imul(se,Ye)|0,v=v+Math.imul(se,gt)|0,v=v+Math.imul(ye,Ye)|0,j=j+Math.imul(ye,gt)|0;var Nt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,g=Math.imul($e,st),v=Math.imul($e,kt),v=v+Math.imul(mt,st)|0,j=Math.imul(mt,kt),g=g+Math.imul(Ue,it)|0,v=v+Math.imul(Ue,wt)|0,v=v+Math.imul(lt,it)|0,j=j+Math.imul(lt,wt)|0,g=g+Math.imul(Ee,Ye)|0,v=v+Math.imul(Ee,gt)|0,v=v+Math.imul(Se,Ye)|0,j=j+Math.imul(Se,gt)|0,g=g+Math.imul(se,ot)|0,v=v+Math.imul(se,_t)|0,v=v+Math.imul(ye,ot)|0,j=j+Math.imul(ye,_t)|0;var Bt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,g=Math.imul(ge,st),v=Math.imul(ge,kt),v=v+Math.imul(Ae,st)|0,j=Math.imul(Ae,kt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,wt)|0,v=v+Math.imul(mt,it)|0,j=j+Math.imul(mt,wt)|0,g=g+Math.imul(Ue,Ye)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(lt,Ye)|0,j=j+Math.imul(lt,gt)|0,g=g+Math.imul(Ee,ot)|0,v=v+Math.imul(Ee,_t)|0,v=v+Math.imul(Se,ot)|0,j=j+Math.imul(Se,_t)|0,g=g+Math.imul(se,k)|0,v=v+Math.imul(se,S)|0,v=v+Math.imul(ye,k)|0,j=j+Math.imul(ye,S)|0;var ir=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(De,st),v=Math.imul(De,kt),v=v+Math.imul(Oe,st)|0,j=Math.imul(Oe,kt),g=g+Math.imul(ge,it)|0,v=v+Math.imul(ge,wt)|0,v=v+Math.imul(Ae,it)|0,j=j+Math.imul(Ae,wt)|0,g=g+Math.imul($e,Ye)|0,v=v+Math.imul($e,gt)|0,v=v+Math.imul(mt,Ye)|0,j=j+Math.imul(mt,gt)|0,g=g+Math.imul(Ue,ot)|0,v=v+Math.imul(Ue,_t)|0,v=v+Math.imul(lt,ot)|0,j=j+Math.imul(lt,_t)|0,g=g+Math.imul(Ee,k)|0,v=v+Math.imul(Ee,S)|0,v=v+Math.imul(Se,k)|0,j=j+Math.imul(Se,S)|0,g=g+Math.imul(se,B)|0,v=v+Math.imul(se,K)|0,v=v+Math.imul(ye,B)|0,j=j+Math.imul(ye,K)|0;var Sr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,g=Math.imul(Le,st),v=Math.imul(Le,kt),v=v+Math.imul(ft,st)|0,j=Math.imul(ft,kt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(Oe,it)|0,j=j+Math.imul(Oe,wt)|0,g=g+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,gt)|0,v=v+Math.imul(Ae,Ye)|0,j=j+Math.imul(Ae,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,_t)|0,v=v+Math.imul(mt,ot)|0,j=j+Math.imul(mt,_t)|0,g=g+Math.imul(Ue,k)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(lt,k)|0,j=j+Math.imul(lt,S)|0,g=g+Math.imul(Ee,B)|0,v=v+Math.imul(Ee,K)|0,v=v+Math.imul(Se,B)|0,j=j+Math.imul(Se,K)|0,g=g+Math.imul(se,re)|0,v=v+Math.imul(se,Be)|0,v=v+Math.imul(ye,re)|0,j=j+Math.imul(ye,Be)|0;var or=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(or>>>26)|0,or&=67108863,g=Math.imul(We,st),v=Math.imul(We,kt),v=v+Math.imul(jt,st)|0,j=Math.imul(jt,kt),g=g+Math.imul(Le,it)|0,v=v+Math.imul(Le,wt)|0,v=v+Math.imul(ft,it)|0,j=j+Math.imul(ft,wt)|0,g=g+Math.imul(De,Ye)|0,v=v+Math.imul(De,gt)|0,v=v+Math.imul(Oe,Ye)|0,j=j+Math.imul(Oe,gt)|0,g=g+Math.imul(ge,ot)|0,v=v+Math.imul(ge,_t)|0,v=v+Math.imul(Ae,ot)|0,j=j+Math.imul(Ae,_t)|0,g=g+Math.imul($e,k)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,k)|0,j=j+Math.imul(mt,S)|0,g=g+Math.imul(Ue,B)|0,v=v+Math.imul(Ue,K)|0,v=v+Math.imul(lt,B)|0,j=j+Math.imul(lt,K)|0,g=g+Math.imul(Ee,re)|0,v=v+Math.imul(Ee,Be)|0,v=v+Math.imul(Se,re)|0,j=j+Math.imul(Se,Be)|0,g=g+Math.imul(se,Re)|0,v=v+Math.imul(se,z)|0,v=v+Math.imul(ye,Re)|0,j=j+Math.imul(ye,z)|0;var Yt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(et,st),v=Math.imul(et,kt),v=v+Math.imul(At,st)|0,j=Math.imul(At,kt),g=g+Math.imul(We,it)|0,v=v+Math.imul(We,wt)|0,v=v+Math.imul(jt,it)|0,j=j+Math.imul(jt,wt)|0,g=g+Math.imul(Le,Ye)|0,v=v+Math.imul(Le,gt)|0,v=v+Math.imul(ft,Ye)|0,j=j+Math.imul(ft,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,_t)|0,v=v+Math.imul(Oe,ot)|0,j=j+Math.imul(Oe,_t)|0,g=g+Math.imul(ge,k)|0,v=v+Math.imul(ge,S)|0,v=v+Math.imul(Ae,k)|0,j=j+Math.imul(Ae,S)|0,g=g+Math.imul($e,B)|0,v=v+Math.imul($e,K)|0,v=v+Math.imul(mt,B)|0,j=j+Math.imul(mt,K)|0,g=g+Math.imul(Ue,re)|0,v=v+Math.imul(Ue,Be)|0,v=v+Math.imul(lt,re)|0,j=j+Math.imul(lt,Be)|0,g=g+Math.imul(Ee,Re)|0,v=v+Math.imul(Ee,z)|0,v=v+Math.imul(Se,Re)|0,j=j+Math.imul(Se,z)|0,g=g+Math.imul(se,he)|0,v=v+Math.imul(se,ke)|0,v=v+Math.imul(ye,he)|0,j=j+Math.imul(ye,ke)|0;var vr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(vr>>>26)|0,vr&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,kt),v=v+Math.imul(Et,st)|0,j=Math.imul(Et,kt),g=g+Math.imul(et,it)|0,v=v+Math.imul(et,wt)|0,v=v+Math.imul(At,it)|0,j=j+Math.imul(At,wt)|0,g=g+Math.imul(We,Ye)|0,v=v+Math.imul(We,gt)|0,v=v+Math.imul(jt,Ye)|0,j=j+Math.imul(jt,gt)|0,g=g+Math.imul(Le,ot)|0,v=v+Math.imul(Le,_t)|0,v=v+Math.imul(ft,ot)|0,j=j+Math.imul(ft,_t)|0,g=g+Math.imul(De,k)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,k)|0,j=j+Math.imul(Oe,S)|0,g=g+Math.imul(ge,B)|0,v=v+Math.imul(ge,K)|0,v=v+Math.imul(Ae,B)|0,j=j+Math.imul(Ae,K)|0,g=g+Math.imul($e,re)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(mt,re)|0,j=j+Math.imul(mt,Be)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,z)|0,v=v+Math.imul(lt,Re)|0,j=j+Math.imul(lt,z)|0,g=g+Math.imul(Ee,he)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Se,he)|0,j=j+Math.imul(Se,ke)|0,g=g+Math.imul(se,Ne)|0,v=v+Math.imul(se,ze)|0,v=v+Math.imul(ye,Ne)|0,j=j+Math.imul(ye,ze)|0;var Nn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,wt),v=v+Math.imul(Et,it)|0,j=Math.imul(Et,wt),g=g+Math.imul(et,Ye)|0,v=v+Math.imul(et,gt)|0,v=v+Math.imul(At,Ye)|0,j=j+Math.imul(At,gt)|0,g=g+Math.imul(We,ot)|0,v=v+Math.imul(We,_t)|0,v=v+Math.imul(jt,ot)|0,j=j+Math.imul(jt,_t)|0,g=g+Math.imul(Le,k)|0,v=v+Math.imul(Le,S)|0,v=v+Math.imul(ft,k)|0,j=j+Math.imul(ft,S)|0,g=g+Math.imul(De,B)|0,v=v+Math.imul(De,K)|0,v=v+Math.imul(Oe,B)|0,j=j+Math.imul(Oe,K)|0,g=g+Math.imul(ge,re)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(Ae,re)|0,j=j+Math.imul(Ae,Be)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,z)|0,v=v+Math.imul(mt,Re)|0,j=j+Math.imul(mt,z)|0,g=g+Math.imul(Ue,he)|0,v=v+Math.imul(Ue,ke)|0,v=v+Math.imul(lt,he)|0,j=j+Math.imul(lt,ke)|0,g=g+Math.imul(Ee,Ne)|0,v=v+Math.imul(Ee,ze)|0,v=v+Math.imul(Se,Ne)|0,j=j+Math.imul(Se,ze)|0;var Vr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,g=Math.imul(nt,Ye),v=Math.imul(nt,gt),v=v+Math.imul(Et,Ye)|0,j=Math.imul(Et,gt),g=g+Math.imul(et,ot)|0,v=v+Math.imul(et,_t)|0,v=v+Math.imul(At,ot)|0,j=j+Math.imul(At,_t)|0,g=g+Math.imul(We,k)|0,v=v+Math.imul(We,S)|0,v=v+Math.imul(jt,k)|0,j=j+Math.imul(jt,S)|0,g=g+Math.imul(Le,B)|0,v=v+Math.imul(Le,K)|0,v=v+Math.imul(ft,B)|0,j=j+Math.imul(ft,K)|0,g=g+Math.imul(De,re)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(Oe,re)|0,j=j+Math.imul(Oe,Be)|0,g=g+Math.imul(ge,Re)|0,v=v+Math.imul(ge,z)|0,v=v+Math.imul(Ae,Re)|0,j=j+Math.imul(Ae,z)|0,g=g+Math.imul($e,he)|0,v=v+Math.imul($e,ke)|0,v=v+Math.imul(mt,he)|0,j=j+Math.imul(mt,ke)|0,g=g+Math.imul(Ue,Ne)|0,v=v+Math.imul(Ue,ze)|0,v=v+Math.imul(lt,Ne)|0,j=j+Math.imul(lt,ze)|0;var Rn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,_t),v=v+Math.imul(Et,ot)|0,j=Math.imul(Et,_t),g=g+Math.imul(et,k)|0,v=v+Math.imul(et,S)|0,v=v+Math.imul(At,k)|0,j=j+Math.imul(At,S)|0,g=g+Math.imul(We,B)|0,v=v+Math.imul(We,K)|0,v=v+Math.imul(jt,B)|0,j=j+Math.imul(jt,K)|0,g=g+Math.imul(Le,re)|0,v=v+Math.imul(Le,Be)|0,v=v+Math.imul(ft,re)|0,j=j+Math.imul(ft,Be)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,z)|0,v=v+Math.imul(Oe,Re)|0,j=j+Math.imul(Oe,z)|0,g=g+Math.imul(ge,he)|0,v=v+Math.imul(ge,ke)|0,v=v+Math.imul(Ae,he)|0,j=j+Math.imul(Ae,ke)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,ze)|0,v=v+Math.imul(mt,Ne)|0,j=j+Math.imul(mt,ze)|0;var Li=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Li>>>26)|0,Li&=67108863,g=Math.imul(nt,k),v=Math.imul(nt,S),v=v+Math.imul(Et,k)|0,j=Math.imul(Et,S),g=g+Math.imul(et,B)|0,v=v+Math.imul(et,K)|0,v=v+Math.imul(At,B)|0,j=j+Math.imul(At,K)|0,g=g+Math.imul(We,re)|0,v=v+Math.imul(We,Be)|0,v=v+Math.imul(jt,re)|0,j=j+Math.imul(jt,Be)|0,g=g+Math.imul(Le,Re)|0,v=v+Math.imul(Le,z)|0,v=v+Math.imul(ft,Re)|0,j=j+Math.imul(ft,z)|0,g=g+Math.imul(De,he)|0,v=v+Math.imul(De,ke)|0,v=v+Math.imul(Oe,he)|0,j=j+Math.imul(Oe,ke)|0,g=g+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,ze)|0,v=v+Math.imul(Ae,Ne)|0,j=j+Math.imul(Ae,ze)|0;var Fi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(Et,B)|0,j=Math.imul(Et,K),g=g+Math.imul(et,re)|0,v=v+Math.imul(et,Be)|0,v=v+Math.imul(At,re)|0,j=j+Math.imul(At,Be)|0,g=g+Math.imul(We,Re)|0,v=v+Math.imul(We,z)|0,v=v+Math.imul(jt,Re)|0,j=j+Math.imul(jt,z)|0,g=g+Math.imul(Le,he)|0,v=v+Math.imul(Le,ke)|0,v=v+Math.imul(ft,he)|0,j=j+Math.imul(ft,ke)|0,g=g+Math.imul(De,Ne)|0,v=v+Math.imul(De,ze)|0,v=v+Math.imul(Oe,Ne)|0,j=j+Math.imul(Oe,ze)|0;var Dn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,g=Math.imul(nt,re),v=Math.imul(nt,Be),v=v+Math.imul(Et,re)|0,j=Math.imul(Et,Be),g=g+Math.imul(et,Re)|0,v=v+Math.imul(et,z)|0,v=v+Math.imul(At,Re)|0,j=j+Math.imul(At,z)|0,g=g+Math.imul(We,he)|0,v=v+Math.imul(We,ke)|0,v=v+Math.imul(jt,he)|0,j=j+Math.imul(jt,ke)|0,g=g+Math.imul(Le,Ne)|0,v=v+Math.imul(Le,ze)|0,v=v+Math.imul(ft,Ne)|0,j=j+Math.imul(ft,ze)|0;var Ui=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,z),v=v+Math.imul(Et,Re)|0,j=Math.imul(Et,z),g=g+Math.imul(et,he)|0,v=v+Math.imul(et,ke)|0,v=v+Math.imul(At,he)|0,j=j+Math.imul(At,ke)|0,g=g+Math.imul(We,Ne)|0,v=v+Math.imul(We,ze)|0,v=v+Math.imul(jt,Ne)|0,j=j+Math.imul(jt,ze)|0;var zi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(zi>>>26)|0,zi&=67108863,g=Math.imul(nt,he),v=Math.imul(nt,ke),v=v+Math.imul(Et,he)|0,j=Math.imul(Et,ke),g=g+Math.imul(et,Ne)|0,v=v+Math.imul(et,ze)|0,v=v+Math.imul(At,Ne)|0,j=j+Math.imul(At,ze)|0;var D=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(D>>>26)|0,D&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,ze),v=v+Math.imul(Et,Ne)|0,j=Math.imul(Et,ze);var H=(C+g|0)+((v&8191)<<13)|0;return C=(j+(v>>>13)|0)+(H>>>26)|0,H&=67108863,O[0]=ut,O[1]=Jt,O[2]=Nt,O[3]=Bt,O[4]=ir,O[5]=Sr,O[6]=or,O[7]=Yt,O[8]=vr,O[9]=Nn,O[10]=Vr,O[11]=Rn,O[12]=Li,O[13]=Fi,O[14]=Dn,O[15]=Ui,O[16]=zi,O[17]=D,O[18]=H,C!==0&&(O[19]=C,x.length++),x};Math.imul||(R=N);function F(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,M=0,E=0;E<m.length-1;E++){var O=M;M=0;for(var C=x&67108863,g=Math.min(E,d.length-1),v=Math.max(0,E-p.length+1);v<=g;v++){var j=E-v,ee=p.words[j]|0,se=d.words[v]|0,ye=ee*se,pe=ye&67108863;O=O+(ye/67108864|0)|0,pe=pe+C|0,C=pe&67108863,O=O+(pe>>>26)|0,M+=O>>>26,O&=67108863}m.words[E]=C,x=O,O=M}return x!==0?m.words[E]=x:m.length--,m._strip()}function L(p,d,m){return F(p,d,m)}o.prototype.mulTo=function(d,m){var x,M=this.length+d.length;return this.length===10&&d.length===10?x=R(this,d,m):M<63?x=N(this,d,m):M<1024?x=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,M=0;M<this.length;M++){var E=(this.words[M]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[M]=O&67108863}return x!==0&&(this.words[M]=x,this.length++),m?this.ineg():this},o.prototype.muln=function(d){return this.clone().imuln(d)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(d){var m=P(d);if(m.length===0)return new o(1);for(var x=this,M=0;M<m.length&&m[M]===0;M++,x=x.sqr());if(++M<m.length)for(var E=x.sqr();M<m.length;M++,E=E.sqr())m[M]!==0&&(x=x.mul(E));return x},o.prototype.iushln=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,M=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var C=this.words[E]&M,g=(this.words[E]|0)-C<<m;this.words[E]=g|O,O=C>>>26-m}O&&(this.words[E]=O,this.length++)}if(x!==0){for(E=this.length-1;E>=0;E--)this.words[E+x]=this.words[E];for(E=0;E<x;E++)this.words[E]=0;this.length+=x}return this._strip()},o.prototype.ishln=function(d){return i(this.negative===0),this.iushln(d)},o.prototype.iushrn=function(d,m,x){i(typeof d=="number"&&d>=0);var M;m?M=(m-m%26)/26:M=0;var E=d%26,O=Math.min((d-E)/26,this.length),C=67108863^67108863>>>E<<E,g=x;if(M-=O,M=Math.max(0,M),g){for(var v=0;v<O;v++)g.words[v]=this.words[v];g.length=O}if(O!==0)if(this.length>O)for(this.length-=O,v=0;v<this.length;v++)this.words[v]=this.words[v+O];else this.words[0]=0,this.length=1;var j=0;for(v=this.length-1;v>=0&&(j!==0||v>=M);v--){var ee=this.words[v]|0;this.words[v]=j<<26-E|ee>>>E,j=ee&C}return g&&j!==0&&(g.words[g.length++]=j),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(d,m,x){return i(this.negative===0),this.iushrn(d,m,x)},o.prototype.shln=function(d){return this.clone().ishln(d)},o.prototype.ushln=function(d){return this.clone().iushln(d)},o.prototype.shrn=function(d){return this.clone().ishrn(d)},o.prototype.ushrn=function(d){return this.clone().iushrn(d)},o.prototype.testn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,M=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&M)},o.prototype.imaskn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(m!==0&&x++,this.length=Math.min(x,this.length),m!==0){var M=67108863^67108863>>>m<<m;this.words[this.length-1]&=M}return this._strip()},o.prototype.maskn=function(d){return this.clone().imaskn(d)},o.prototype.iaddn=function(d){return i(typeof d=="number"),i(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<=d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},o.prototype._iaddn=function(d){this.words[0]+=d;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(d){if(i(typeof d=="number"),i(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this._strip()},o.prototype.addn=function(d){return this.clone().iaddn(d)},o.prototype.subn=function(d){return this.clone().isubn(d)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(d,m,x){var M=d.length+x,E;this._expand(M);var O,C=0;for(E=0;E<d.length;E++){O=(this.words[E+x]|0)+C;var g=(d.words[E]|0)*m;O-=g&67108863,C=(O>>26)-(g/67108864|0),this.words[E+x]=O&67108863}for(;E<this.length-x;E++)O=(this.words[E+x]|0)+C,C=O>>26,this.words[E+x]=O&67108863;if(C===0)return this._strip();for(i(C===-1),C=0,E=0;E<this.length;E++)O=-(this.words[E]|0)+C,C=O>>26,this.words[E]=O&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,m){var x=this.length-d.length,M=this.clone(),E=d,O=E.words[E.length-1]|0,C=this._countBits(O);x=26-C,x!==0&&(E=E.ushln(x),M.iushln(x),O=E.words[E.length-1]|0);var g=M.length-E.length,v;if(m!=="mod"){v=new o(null),v.length=g+1,v.words=new Array(v.length);for(var j=0;j<v.length;j++)v.words[j]=0}var ee=M.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(M=ee,v&&(v.words[g]=1));for(var se=g-1;se>=0;se--){var ye=(M.words[E.length+se]|0)*67108864+(M.words[E.length+se-1]|0);for(ye=Math.min(ye/O|0,67108863),M._ishlnsubmul(E,ye,se);M.negative!==0;)ye--,M.negative=0,M._ishlnsubmul(E,1,se),M.isZero()||(M.negative^=1);v&&(v.words[se]=ye)}return v&&v._strip(),M._strip(),m!=="div"&&x!==0&&M.iushrn(x),{div:v||null,mod:M}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var M,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(M=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:M,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(M=O.div.neg()),{div:M,mod:O.mod}):this.negative&d.negative?(O=this.neg().divmod(d.neg(),m),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.isub(d)),{div:O.div,mod:E}):d.length>this.length||this.cmp(d)<0?{div:new o(0),mod:this}:d.length===1?m==="div"?{div:this.divn(d.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new o(this.modrn(d.words[0]))}:this._wordDiv(d,m)},o.prototype.div=function(d){return this.divmod(d,"div",!1).div},o.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},o.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},o.prototype.divRound=function(d){var m=this.divmod(d);if(m.mod.isZero())return m.div;var x=m.div.negative!==0?m.mod.isub(d):m.mod,M=d.ushrn(1),E=d.andln(1),O=x.cmp(M);return O<0||E===1&&O===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=(1<<26)%d,M=0,E=this.length-1;E>=0;E--)M=(x*M+(this.words[E]|0))%d;return m?-M:M},o.prototype.modn=function(d){return this.modrn(d)},o.prototype.idivn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=0,M=this.length-1;M>=0;M--){var E=(this.words[M]|0)+x*67108864;this.words[M]=E/d|0,x=E%d}return this._strip(),m?this.ineg():this},o.prototype.divn=function(d){return this.clone().idivn(d)},o.prototype.egcd=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var M=new o(1),E=new o(0),O=new o(0),C=new o(1),g=0;m.isEven()&&x.isEven();)m.iushrn(1),x.iushrn(1),++g;for(var v=x.clone(),j=m.clone();!m.isZero();){for(var ee=0,se=1;!(m.words[0]&se)&&ee<26;++ee,se<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(M.isOdd()||E.isOdd())&&(M.iadd(v),E.isub(j)),M.iushrn(1),E.iushrn(1);for(var ye=0,pe=1;!(x.words[0]&pe)&&ye<26;++ye,pe<<=1);if(ye>0)for(x.iushrn(ye);ye-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(v),C.isub(j)),O.iushrn(1),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),M.isub(O),E.isub(C)):(x.isub(m),O.isub(M),C.isub(E))}return{a:O,b:C,gcd:x.iushln(g)}},o.prototype._invmp=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var M=new o(1),E=new o(0),O=x.clone();m.cmpn(1)>0&&x.cmpn(1)>0;){for(var C=0,g=1;!(m.words[0]&g)&&C<26;++C,g<<=1);if(C>0)for(m.iushrn(C);C-- >0;)M.isOdd()&&M.iadd(O),M.iushrn(1);for(var v=0,j=1;!(x.words[0]&j)&&v<26;++v,j<<=1);if(v>0)for(x.iushrn(v);v-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);m.cmp(x)>=0?(m.isub(x),M.isub(E)):(x.isub(m),E.isub(M))}var ee;return m.cmpn(1)===0?ee=M:ee=E,ee.cmpn(0)<0&&ee.iadd(d),ee},o.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var m=this.clone(),x=d.clone();m.negative=0,x.negative=0;for(var M=0;m.isEven()&&x.isEven();M++)m.iushrn(1),x.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;x.isEven();)x.iushrn(1);var E=m.cmp(x);if(E<0){var O=m;m=x,x=O}else if(E===0||x.cmpn(1)===0)break;m.isub(x)}while(!0);return x.iushln(M)},o.prototype.invm=function(d){return this.egcd(d).a.umod(d)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(d){return this.words[0]&d},o.prototype.bincn=function(d){i(typeof d=="number");var m=d%26,x=(d-m)/26,M=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=M,this;for(var E=M,O=x;E!==0&&O<this.length;O++){var C=this.words[O]|0;C+=E,E=C>>>26,C&=67108863,this.words[O]=C}return E!==0&&(this.words[O]=E,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(d){var m=d<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var x;if(this.length>1)x=1;else{m&&(d=-d),i(d<=67108863,"Number is too big");var M=this.words[0]|0;x=M===d?0:M<d?-1:1}return this.negative!==0?-x|0:x},o.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var m=this.ucmp(d);return this.negative!==0?-m|0:m},o.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var m=0,x=this.length-1;x>=0;x--){var M=this.words[x]|0,E=d.words[x]|0;if(M!==E){M<E?m=-1:M>E&&(m=1);break}}return m},o.prototype.gtn=function(d){return this.cmpn(d)===1},o.prototype.gt=function(d){return this.cmp(d)===1},o.prototype.gten=function(d){return this.cmpn(d)>=0},o.prototype.gte=function(d){return this.cmp(d)>=0},o.prototype.ltn=function(d){return this.cmpn(d)===-1},o.prototype.lt=function(d){return this.cmp(d)===-1},o.prototype.lten=function(d){return this.cmpn(d)<=0},o.prototype.lte=function(d){return this.cmp(d)<=0},o.prototype.eqn=function(d){return this.cmpn(d)===0},o.prototype.eq=function(d){return this.cmp(d)===0},o.red=function(d){return new V(d)},o.prototype.toRed=function(d){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(d){return this.red=d,this},o.prototype.forceRed=function(d){return i(!this.red,"Already a number in reduction context"),this._forceRed(d)},o.prototype.redAdd=function(d){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},o.prototype.redIAdd=function(d){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},o.prototype.redSub=function(d){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},o.prototype.redISub=function(d){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},o.prototype.redShl=function(d){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},o.prototype.redMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},o.prototype.redIMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(d){return i(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var 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 M=x<this.n?-1:m.ucmp(this.p);return M===0?(m.words[0]=0,m.length=1):M>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},q.prototype.split=function(d,m){d.iushrn(this.n,0,m)},q.prototype.imulK=function(d){return d.imul(this.k)};function X(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(X,q),X.prototype.split=function(d,m){for(var x=4194303,M=Math.min(d.length,9),E=0;E<M;E++)m.words[E]=d.words[E];if(m.length=M,d.length<=9){d.words[0]=0,d.length=1;return}var O=d.words[9];for(m.words[m.length++]=O&x,E=10;E<d.length;E++){var C=d.words[E]|0;d.words[E-10]=(C&x)<<4|O>>>22,O=C}O>>>=22,d.words[E-10]=O,O===0&&d.length>10?d.length-=10:d.length-=9},X.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var m=0,x=0;x<d.length;x++){var M=d.words[x]|0;m+=M*977,d.words[x]=m&67108863,m=M*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function ie(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ie,q);function ae(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(ae,q);function ce(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(ce,q),ce.prototype.imulK=function(d){for(var m=0,x=0;x<d.length;x++){var M=(d.words[x]|0)*19+m,E=M&67108863;M>>>=26,d.words[x]=E,m=M}return m!==0&&(d.words[d.length++]=m),d},o._prime=function(d){if(W[d])return W[d];var m;if(d==="k256")m=new X;else if(d==="p224")m=new ie;else if(d==="p192")m=new ae;else if(d==="p25519")m=new ce;else throw new Error("Unknown prime "+d);return W[d]=m,m};function V(p){if(typeof p=="string"){var d=o._prime(p);this.m=d.p,this.prime=d}else i(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}V.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},V.prototype._verify2=function(d,m){i((d.negative|m.negative)===0,"red works only with positives"),i(d.red&&d.red===m.red,"red works only with red numbers")},V.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},V.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},V.prototype.add=function(d,m){this._verify2(d,m);var x=d.add(m);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},V.prototype.iadd=function(d,m){this._verify2(d,m);var x=d.iadd(m);return x.cmp(this.m)>=0&&x.isub(this.m),x},V.prototype.sub=function(d,m){this._verify2(d,m);var x=d.sub(m);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},V.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},V.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},V.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},V.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},V.prototype.isqr=function(d){return this.imul(d,d.clone())},V.prototype.sqr=function(d){return this.mul(d,d)},V.prototype.sqrt=function(d){if(d.isZero())return d.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var x=this.m.add(new o(1)).iushrn(2);return this.pow(d,x)}for(var M=this.m.subn(1),E=0;!M.isZero()&&M.andln(1)===0;)E++,M.iushrn(1);i(!M.isZero());var O=new o(1).toRed(this),C=O.redNeg(),g=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new o(2*v*v).toRed(this);this.pow(v,g).cmp(C)!==0;)v.redIAdd(C);for(var j=this.pow(v,M),ee=this.pow(d,M.addn(1).iushrn(1)),se=this.pow(d,M),ye=E;se.cmp(O)!==0;){for(var pe=se,Ee=0;pe.cmp(O)!==0;Ee++)pe=pe.redSqr();i(Ee<ye);var Se=this.pow(j,new o(1).iushln(ye-Ee-1));ee=ee.redMul(Se),j=Se.redSqr(),se=se.redMul(j),ye=Ee}return ee},V.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},V.prototype.pow=function(d,m){if(m.isZero())return new o(1).toRed(this);if(m.cmpn(1)===0)return d.clone();var x=4,M=new Array(1<<x);M[0]=new o(1).toRed(this),M[1]=d;for(var E=2;E<M.length;E++)M[E]=this.mul(M[E-1],d);var O=M[0],C=0,g=0,v=m.bitLength()%26;for(v===0&&(v=26),E=m.length-1;E>=0;E--){for(var j=m.words[E],ee=v-1;ee>=0;ee--){var se=j>>ee&1;if(O!==M[0]&&(O=this.sqr(O)),se===0&&C===0){g=0;continue}C<<=1,C|=se,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,M[C]),g=0,C=0)}v=26}return O},V.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},V.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new $(d)};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),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},$.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},$.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),ko=9e15,Qi=1e9,Zh="0123456789abcdef",Bu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Lu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Qh={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ko,maxE:ko,crypto:!1},A_,Ai,at=!0,Fu="[DecimalError] ",es=Fu+"Invalid argument: ",O_=Fu+"Precision limit exceeded",I_=Fu+"crypto unavailable",P_="[object Decimal]",Ar=Math.floor,pr=Math.pow,i9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,s9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,o9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,j_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Cn=1e7,Ze=7,a9=9007199254740991,c9=Bu.length-1,ep=Lu.length-1,be={toStringTag:P_};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(es+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},be.comparedTo=be.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},be.cosine=be.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ze,n.rounding=1,r=u9(n,B_(n,r)),n.precision=e,n.rounding=t,Ke(Ai==2||Ai==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},be.cubeRoot=be.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(at=!1,s=l.s*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=yr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Ar((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=qt(u.plus(l).times(a),u.plus(c),o+2,1),yr(a.d).slice(0,o)===(r=yr(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 at=!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-Ar(this.e/Ze))*Ze,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},be.dividedBy=be.div=function(e){return qt(this,new this.constructor(e))},be.dividedToIntegerBy=be.divToInt=function(e){var t=this,r=t.constructor;return 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/qu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=No(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=No(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/qu(5,e)),i=No(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()?Mn(r,i,s):new r(0):new r(NaN):t.isZero()?Mn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Mn(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},be.inverseHyperbolicCosine=be.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},be.inverseHyperbolicSine=be.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln())},be.inverseHyperbolicTangent=be.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?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=Mn(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<=ep)return o=Mn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=ep)return o=Mn(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/Ze+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(at=!1,t=Math.ceil(a/Ze),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),at=!0,Ke(o,l.precision=f,l.rounding=h,!0)},be.isFinite=function(){return!!this.d},be.isInteger=be.isInt=function(){return!!this.d&&Ar(this.e/Ze)>this.d.length-2},be.isNaN=function(){return!this.s},be.isNegative=be.isNeg=function(){return this.s<0},be.isPositive=be.isPos=function(){return this.s>0},be.isZero=function(){return!!this.d&&this.d[0]===0},be.lessThan=be.lt=function(e){return this.cmp(e)<0},be.lessThanOrEqualTo=be.lte=function(e){return this.cmp(e)<1},be.logarithm=be.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(at=!1,a=f+y,o=rs(u,a),n=t?Vu(l,a+10):rs(e,a),c=qt(o,n,a,1),Ya(c.d,i=f,h))do if(a+=10,o=rs(u,a),n=t?Vu(l,a+10):rs(e,a),c=qt(o,n,a,1),!s){+yr(c.d).slice(i+1,i+15)+1==1e14&&(c=Ke(c,f+1,0));break}while(Ya(c.d,i+=10,h));return at=!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 at?Ke(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]=Cn-1;--u[i],u[n]+=Cn}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=zu(u,r),at?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):(at=!1,n.modulo==9?(t=qt(r,e.abs(),0,3,1),t.s*=e.s):t=qt(r,e,0,n.modulo,1),t=t.times(e),at=!0,r.minus(t))},be.naturalExponential=be.exp=function(){return tp(this)},be.naturalLogarithm=be.ln=function(){return rs(this)},be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,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)),at?Ke(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)/Cn|0,u[i]%=Cn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=zu(u,n),at?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(es+e);return r.d?(t=k_(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())+Ze,n.rounding=1,r=f9(n,B_(n,r)),n.precision=e,n.rounding=t,Ke(Ai>2?r.neg():r,e,t,!0)):new n(NaN)},be.squareRoot=be.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(at=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=yr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ar((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(s=n,n=s.plus(qt(o,s,r+2,1)).times(.5),yr(s.d).slice(0,r)===(t=yr(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 at=!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(Ai==2||Ai==4?r.neg():r,e,t,!0)):new n(NaN)},be.times=be.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Ar(l.e/Ze)+Ar(e.e/Ze),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%Cn|0,t=a/Cn|0;s[i]=(s[i]+t)%Cn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=zu(s,r),at?Ke(e,f.precision,f.rounding):e},be.toBinary=function(e,t){return np(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:(Fr(e,0,Qi),t===void 0?t=n.rounding:Fr(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=Qn(n,!0):(Fr(e,0,Qi),t===void 0?t=i.rounding:Fr(t,0,8),n=Ke(new i(n),e+1,t),r=Qn(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=Qn(i):(Fr(e,0,Qi),t===void 0?t=s.rounding:Fr(t,0,8),n=Ke(new s(i),e+i.e+1,t),r=Qn(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,_=y.constructor;if(!b)return new _(y);if(u=r=new _(1),n=c=new _(0),t=new _(n),s=t.e=k_(b)-y.e-1,o=s%Ze,t.d[0]=pr(10,o<0?Ze+o:o),e==null)e=s>0?t:u;else{if(a=new _(e),!a.isInt()||a.lt(u))throw Error(es+a);e=a.gt(t)?s>0?t:u:a}for(at=!1,a=new _(yr(b)),l=_.precision,_.precision=s=b.length*Ze*2;f=qt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=qt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=qt(u,n,s,1).minus(y).abs().cmp(qt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],_.precision=l,at=!0,h},be.toHexadecimal=be.toHex=function(e,t){return np(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: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]?(at=!1,r=qt(r,e,0,t,1).times(e),at=!0,Ke(r)):(e.s=r.s,r=e),r},be.toNumber=function(){return+this},be.toOctal=function(e,t){return np(this,8,e,t)},be.toPower=be.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(pr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Ke(a,n,s);if(t=Ar(e.e/Ze),t>=e.d.length-1&&(r=u<0?-u:u)<=a9)return i=N_(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=pr(+a,u),t=r==0||!isFinite(r)?Ar(u*(Math.log("0."+yr(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(at=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=tp(e.times(rs(a,n+r)),n),i.d&&(i=Ke(i,n+5,1),Ya(i.d,n,s)&&(t=n+10,i=Ke(tp(e.times(rs(a,t+r)),t),t+5,1),+yr(i.d).slice(n+1,n+15)+1==1e14&&(i=Ke(i,n+1,0)))),i.s=o,at=!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=Qn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Fr(e,1,Qi),t===void 0?t=i.rounding:Fr(t,0,8),n=Ke(new i(n),e,t),r=Qn(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):(Fr(e,1,Qi),t===void 0?t=n.rounding:Fr(t,0,8)),Ke(new n(r),e,t)},be.toString=function(){var e=this,t=e.constructor,r=Qn(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=Qn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function yr(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Ze-n.length,r&&(s+=ts(r)),s+=n;o=e[t],n=o+"",r=Ze-n.length,r&&(s+=ts(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Fr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(es+e)}function Ya(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Ze,i=0):(i=Math.ceil((t+1)/Ze),t%=Ze),s=pr(10,Ze-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==pr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==pr(10,t-3)-1,o}function Uu(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]+=Zh.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 u9(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/qu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=No(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,_,A,P,N,R,F,L,W,q,X,ie,ae,ce,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=Cn,y=Ze,l=Ar(n.e/y)-Ar(i.e/y)),ce=m.length,ie=d.length,P=new $(p),N=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(W=s=$.precision,o=$.rounding):a?W=s+(n.e-i.e)+1:W=s,W<0)N.push(1),b=!0;else{if(W=W/y+2|0,f=0,ce==1){for(h=0,m=m[0],W++;(f<ie||h)&&W--;f++)q=h*c+(d[f]||0),N[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,R=d.slice(0,ce),F=R.length;F<ce;)R[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,R,ce,F),u<0?(L=R[0],ce!=F&&(L=L*c+(R[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),_=e(m,h,c),A=_.length,F=R.length,u=t(_,R,A,F),u==1&&(h--,r(_,ce<A?V:m,A,c))):(h==0&&(u=h=1),_=m.slice()),A=_.length,A<F&&_.unshift(0),r(R,_,F,c),u==-1&&(F=R.length,u=t(m,R,ce,F),u<1&&(h++,r(R,ce<F?V:m,F,c))),F=R.length):u===0&&(h++,R=[0]),N[f++]=h,u&&R[0]?R[F++]=d[X]||0:(R=[d[X]],F=1);while((X++<ie||R[0]!==void 0)&&W--);b=R[0]!==void 0}N[0]||N.shift()}if(y==1)P.e=l,A_=b;else{for(f=1,h=N[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+=Ze,o=t,l=f[h=0],c=l/pr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Ze),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Ze,o=s-Ze+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Ze,o=s-Ze+i,c=o<0?0:l/pr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%pr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/pr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=pr(10,(Ze-t%Ze)%Ze),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=pr(10,Ze-s),f[h]=o>0?(l/pr(10,i-o)%pr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==Cn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=Cn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return at&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function Qn(e,t,r){if(!e.isFinite())return $_(e);var n,i=e.e,s=yr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+ts(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+ts(-i-1)+s,r&&(n=r-o)>0&&(s+=ts(n))):i>=o?(s+=ts(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+ts(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=ts(n))),s}function zu(e,t){var r=e[0];for(t*=Ze;r>=10;r/=10)t++;return t}function Vu(e,t,r){if(t>c9)throw at=!0,r&&(e.precision=r),Error(O_);return Ke(new e(Bu),t,1,!0)}function Mn(e,t,r){if(t>ep)throw Error(O_);return Ke(new e(Lu),t,r,!0)}function k_(e){var t=e.length-1,r=t*Ze+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function ts(e){for(var t="";e--;)t+="0";return t}function N_(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Ze+4);for(at=!1;;){if(r%2&&(s=s.times(t),L_(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),L_(t.d,o)}return at=!0,s}function R_(e){return e.d[e.d.length-1]&1}function D_(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 tp(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(at=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(pr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Ke(s.times(e),c,1),r=r.times(++l),a=o.plus(qt(s,r,c,1)),yr(a.d).slice(0,c)===yr(o.d).slice(0,c)){for(i=f;i--;)o=Ke(o.times(o),c,1);if(t==null)if(u<3&&Ya(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,at=!0);else return h.precision=b,o}o=a}}function rs(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,_=e,A=_.d,P=_.constructor,N=P.rounding,R=P.precision;if(_.s<0||!A||!A[0]||!_.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:_.s!=1?NaN:A?0:_);if(t==null?(at=!1,l=R):l=t,P.precision=l+=b,r=yr(A),n=r.charAt(0),Math.abs(s=_.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)_=_.times(e),r=yr(_.d),n=r.charAt(0),y++;s=_.e,n>1?(_=new P("0."+r),s++):_=new P(n+"."+r.slice(1))}else return u=Vu(P,l+2,R).times(s+""),_=rs(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=R,t==null?Ke(_,R,N,at=!0):_;for(f=_,c=o=_=qt(_.minus(1),_.plus(1),l,1),h=Ke(_.times(_),l,1),i=3;;){if(o=Ke(o.times(h),l,1),u=c.plus(qt(o,new P(i),l,1)),yr(u.d).slice(0,l)===yr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Vu(P,l+2,R).times(s+""))),c=qt(c,new P(y),l,1),t==null)if(Ya(c.d,l-b,N,a))P.precision=l+=b,u=o=_=qt(f.minus(1),f.plus(1),l,1),h=Ke(_.times(_),l,1),i=a=1;else return Ke(c,P.precision=R,N,at=!0);else return P.precision=R,c;c=u,i+=2}}function $_(e){return String(e.s*e.s/0)}function rp(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ze,r<0&&(n+=Ze),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ze;n<i;)e.d.push(+t.slice(n,n+=Ze));t=t.slice(n),n=Ze-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),at&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function l9(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),j_.test(t))return rp(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(s9.test(t))r=16,t=t.toLowerCase();else if(i9.test(t))r=2;else if(o9.test(t))r=8;else throw Error(es+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=N_(n,new n(r),s,s*2)),u=Uu(t,r,Cn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=zu(u,l),e.d=u,at=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?pr(2,c):Za.pow(2,c))),at=!0,e)}function f9(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:No(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/qu(5,r)),t=No(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 No(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Ze);for(at=!1,c=r.times(r),a=new e(n);;){if(o=qt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=qt(o.times(c),new e(t++*t++),u,1),o=a.plus(n),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return at=!0,o.d.length=l+1,o}function qu(e,t){for(var r=e;--t;)r*=e;return r}function B_(e,t){var r,n=t.s<0,i=Mn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Ai=n?4:1,t;if(r=t.divToInt(i),r.isZero())Ai=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Ai=R_(r)?n?2:3:n?4:1,t;Ai=R_(r)?n?1:4:n?3:2}return t.minus(i).abs()}function np(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,Qi),n===void 0?n=y.rounding:Fr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=$_(e);else{for(l=Qn(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=Uu(Qn(h),10,i),h.e=h.d.length),f=Uu(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=A_),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+=Zh.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=Uu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Zh.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 L_(e,t){if(e.length>t)return e.length=t,!0}function d9(e){return new this(e).abs()}function h9(e){return new this(e).acos()}function p9(e){return new this(e).acosh()}function m9(e,t){return new this(e).plus(t)}function g9(e){return new this(e).asin()}function v9(e){return new this(e).asinh()}function y9(e){return new this(e).atan()}function b9(e){return new this(e).atanh()}function w9(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=Mn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Mn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Mn(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=Mn(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 _9(e){return new this(e).cbrt()}function x9(e){return Ke(e=new this(e),e.e+1,2)}function S9(e,t,r){return new this(e).clamp(t,r)}function E9(e){if(!e||typeof e!="object")throw Error(Fu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,Qi,"rounding",0,8,"toExpNeg",-ko,0,"toExpPos",0,ko,"maxE",0,ko,"minE",-ko,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Qh[r]),(n=e[r])!==void 0)if(Ar(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(es+r+": "+n);if(r="crypto",i&&(this[r]=Qh[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(I_);else this[r]=!1;else throw Error(es+r+": "+n);return this}function C9(e){return new this(e).cos()}function M9(e){return new this(e).cosh()}function F_(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,U_(s)){u.s=s.s,at?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;at?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return rp(u,s.toString())}else if(c!=="string")throw Error(es+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),j_.test(s)?rp(u,s):l9(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=E9,i.clone=F_,i.isDecimal=U_,i.abs=d9,i.acos=h9,i.acosh=p9,i.add=m9,i.asin=g9,i.asinh=v9,i.atan=y9,i.atanh=b9,i.atan2=w9,i.cbrt=_9,i.ceil=x9,i.clamp=S9,i.cos=C9,i.cosh=M9,i.div=T9,i.exp=A9,i.floor=O9,i.hypot=I9,i.ln=P9,i.log=j9,i.log10=N9,i.log2=k9,i.max=R9,i.min=D9,i.mod=$9,i.mul=B9,i.pow=L9,i.random=F9,i.round=U9,i.sign=z9,i.sin=V9,i.sinh=q9,i.sqrt=G9,i.sub=W9,i.sum=H9,i.tan=K9,i.tanh=X9,i.trunc=J9,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 T9(e,t){return new this(e).div(t)}function A9(e){return new this(e).exp()}function O9(e){return Ke(e=new this(e),e.e+1,3)}function I9(){var e,t,r=new this(0);for(at=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return at=!0,new this(1/0);r=t}return at=!0,r.sqrt()}function U_(e){return e instanceof Za||e&&e.toStringTag===P_||!1}function P9(e){return new this(e).ln()}function j9(e,t){return new this(e).log(t)}function k9(e){return new this(e).log(2)}function N9(e){return new this(e).log(10)}function R9(){return D_(this,arguments,"lt")}function D9(){return D_(this,arguments,"gt")}function $9(e,t){return new this(e).mod(t)}function B9(e,t){return new this(e).mul(t)}function L9(e,t){return new this(e).pow(t)}function F9(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Fr(e,1,Qi),n=Math.ceil(e/Ze),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(I_);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Ze,n&&e&&(i=pr(10,Ze-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ze)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ze&&(r-=Ze-n)}return o.e=r,o.d=a,o}function U9(e){return Ke(e=new this(e),e.e+1,this.rounding)}function z9(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function V9(e){return new this(e).sin()}function q9(e){return new this(e).sinh()}function G9(e){return new this(e).sqrt()}function W9(e,t){return new this(e).sub(t)}function H9(){var e=0,t=arguments,r=new this(t[e]);for(at=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return at=!0,Ke(r,this.precision,this.rounding)}function K9(e){return new this(e).tan()}function X9(e){return new this(e).tanh()}function J9(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 Za=be.constructor=F_(Qh);Bu=new Za(Bu),Lu=new Za(Lu);var Gu=Za,ns=Po(jo()),ip=Po(jo()),Y9=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 ip.default(e).mul(new ip.default(this.slippage)).div(new ip.default("1000000000000000000")).toString()}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.aftermathLpSupplyType==null)throw new Error("LP supply type not supported");const l=[t.object(r.id),t.object(this.poolRegistry),t.object(this.protocolFeeVault),t.object(this.treasury),t.object(this.insuranceFund),t.object(this.referrealVault),t.pure.u64(this.amountLimit(r.amountOut)),t.pure.u64(this.slippage),n];return t.moveCall({target:`${e.publishedAt()}::aftermath::${a}`,typeArguments:[c,u,r.extendedDetails.aftermathLpSupplyType],arguments:l})})}},z_="0x000000000000000000000000000000000000000000000000000000000000dee9",Z9=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return xt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:z_,module:"custodian_v2"}}});if(i!=null&&i.data!=null){if(i.data.length!==0)return i.data[0].data.objectId;if(i.data.length<50)break}else break}return null})}getOrCreateAccountCap(e,t,r){return xt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${z_}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=yield this.getOrCreateAccountCap(t,e.client,e.signer),f=[t.object(r.id),n,l.accountCap,t.object(ei)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},Q9=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n];return t.moveCall({target:`${e.publishedAt()}::kriya_amm::${a}`,typeArguments:[c,u],arguments:l})})}},eN=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n,t.object(this.version),t.object(ei)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},tN=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.container),n];return t.moveCall({target:`${e.publishedAt()}::flowx_amm::${a}`,typeArguments:[c,u],arguments:l})})}},rN=class{constructor(e){if(e!==0)throw new Error("Flowx clmm only supported on mainnet");this.versioned="0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",this.poolRegistry="0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(ei)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},nN=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.turbosFeeType==null)throw new Error("Turbos fee type not supported");const l=[t.object(r.id),n,t.object(ei),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},V_=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(ei)],h=t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:f});return{targetCoin:h[0],flashReceipt:h[1],payAmount:h[2]}}repay_flash_swap(e,t,r,n,i){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["repay_flash_swap_a2b",o,a]:["repay_flash_swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i];return t.moveCall({target:`${e.publishedAt()}::cetus::${c}`,typeArguments:[u,l],arguments:f})[0]}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(ei)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function q_(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 iN(e){return e.split("::")[0]}function Us(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=Us(r),u=e9(Qk({},c),{type_arguments:i.map(l=>Us(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>zs.isSuiCoin(l)?l:Us(l).source_address),u.source_address=q_(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===W_||r===aN?"0x2":Jh.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=q_(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function G_(e){return Us(e).source_address}var sN="0x2::coin::Coin",oN=/^0x2::coin::Coin<(.+)>$/,W_="0x2::sui::SUI",aN="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",zs=class bs{static getCoinTypeArg(t){const r=t.type.match(oN);return r?r[1]:null}static isSUI(t){const r=bs.getCoinTypeArg(t);return r?bs.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`${sN}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{G_(i.coinAddress)===G_(t)&&n.push(i)}),n}static isSuiCoin(t){return Us(t).full_address===W_}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=bs.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=bs.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=bs.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:bs.sortByBalance(a),remainingCoins:bs.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 sp(e){switch(e){case 1e4:return"Calculate error";case 10001:return"Input number too large can not fit in target type";case 10002:return"No router";case 10003:return"Insufficient Liquidity";case 10004:return"Target token is detected as a HoneyPot scam";default:return"Unknown error"}}function is(e){const t=e.indexOf("::");if(t===-1)return e;const r=e.substring(0,t),n=e.substring(t);if(!r.startsWith("0x"))return e;const i=r.substring(2);return i.length>64?e:`0x${i.padStart(64,"0")}${n}`}function cN(e,t){e=is(e),t=is(t);const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]>t[n])return!0;if(e[n]<t[n])return!1}return!0}function H_(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function op(e,t,r,n){const i=zs.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:H_(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(zs.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(zs.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=zs.sortByBalance(i);o.slice(0,3).reduce((f,h)=>f+h.balance,BigInt(0))<BigInt(r)&&(o=zs.sortByBalanceDes(i));let c=zs.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 uN(e,t=!0){return xt(this,null,function*(){console.log("inputs",e.getData().inputs),e.getData().commands.forEach((r,n)=>{t&&console.log(`transaction ${n}: `,JSON.stringify(r,null,2))})})}function lN(e){return!(!e.startsWith("0x")||e.length!==66)}var Ro=Po(jo()),ss=Po(jo()),Qa=Po(jo()),Oi=new Qa.default(0);new Qa.default(1);var fN=new Qa.default(2);fN.pow(new Qa.default(128));var dN=new Qa.default("18446744073709551615"),on=1e9;function hN(e,t,r){let n=Oi;return t?n=e.mul(new ss.default(on-r*on)).div(new ss.default(on)):n=e.mul(new ss.default(on+r*on)).div(new ss.default(on)),Number(n.toString())}function pN(e,t,r){let n=Oi;return t?n=e.mul(new ss.default(on-r*on)).div(new ss.default(on)):n=e.mul(new ss.default(on+r*on)).div(new ss.default(on)),n}function mN(e,t,r){return new Gu(e).mul(Gu.pow(2,-64)).pow(2).mul(Gu.pow(10,t-r))}function gN(e,t,r,n){return xt(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,b=is(u),_=is(l),A=new Wk.Transaction,P=cN(b,_),N=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",R=P?b:_,F=P?_:b,L=[R,F];console.log("typeArguments",L,N);for(let C=0;C<y.length;C++){const g=[A.object(y[C]),A.pure.bool(P),A.pure.bool(h),A.pure.u64(f.toString())];A.moveCall({target:`${N}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!lN(r))throw new AggregateError("Aggregator package not set","InvalidWallet");uN(A);const W=yield e.devInspectTransactionBlock({transactionBlock:A,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(C=>C.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==y.length)throw new AggregateError("Simulate event result error","simulateEventError");let X=h?Oi:dN,ie=0;for(let C=0;C<q.length;C+=1)if(!q[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new Ro.BN(q[C].parsedJson.data.amount_out);g.gt(X)&&(ie=C,X=g)}else{const g=new Ro.BN(q[C].parsedJson.data.amount_out);g.lt(X)&&(ie=C,X=g)}const ae=q[ie].parsedJson.data;console.log("event",JSON.stringify(ae,null,2));const ce=ae.step_results[0].current_sqrt_price,[V,$]=yield Promise.all([e.getCoinMetadata({coinType:R}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:F}).then(C=>C==null?void 0:C.decimals)]);if(V==null||$==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=mN(ce,V,$),d=Number(ae.fee_rate)/1e6,m=new Ro.BN((s=ae.amount_in)!=null?s:0),x=new Ro.BN((o=ae.fee_amount)!=null?o:0),M=m.add(x),E={amountIn:M,amountOut:new Ro.BN((a=ae.amount_out)!=null?a:0),routes:[{path:[{id:y[ie],direction:P,provider:"CETUS",from:b,target:_,feeRate:d,amountIn:ae.amount_in,amountOut:ae.amount_out,extendedDetails:{afterSqrtPrice:ae.after_sqrt_price}}],amountIn:M,amountOut:new Ro.BN((c=ae.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:ae.is_exceed,routeData:E}})}var vN=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Haedal not support b2a swap");const s="swap_a2b",o=[t.object(r.id),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::haedal::${s}`,typeArguments:[],arguments:o})})}},yN=class{constructor(e){if(e!==0)throw new Error("Afsui only supported on mainnet");this.stakedSuiVault="0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d",this.safe="0xeb685899830dd5837b47007809c76d91a098d52aabbf61e8ac467c59e5cc4610",this.referVault="0x4ce9a19b594599536c53edb25d22532f82f18038dc8ef618afd00fbbfb9845ef",this.validator="0xd30018ec3f5ff1a3c75656abf927a87d7f0529e6dc89c7ddd1bd27ecb05e3db2"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Afsui not support b2a swap");const s="swap_a2b",o=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n];return t.moveCall({target:`${e.publishedAt()}::afsui::${s}`,typeArguments:[],arguments:o})})}},bN=class{constructor(e){if(e!==0)throw new Error("Volo only supported on mainnet");this.nativePool="0x7fa2faa111b8c65bea48a23049bfd81ca8f971a262d981dcd9a17c3825cb5baf",this.metadata="0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Volo not support b2a swap");const s="swap_a2b",o=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::volo::${s}`,typeArguments:[],arguments:o})})}},wN=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.dexInfo),n];return t.moveCall({target:`${e.publishedAt()}::bluemove::${a}`,typeArguments:[c,u],arguments:l})})}},_N=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return xt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];let f;i?f=i:f=H_(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(ei)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},xN=class{constructor(e){if(e!==0)throw new Error("Scallop only supported on mainnet");this.version=e===0?"0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7":"0x0",this.market=e===0?"0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9":"0x0"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",s,o];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.scallopScoinTreasury==null)throw new Error("Scallop coin treasury not supported");const l=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(ei)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},SN=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.liquid_staking_pool=e===0?"0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b":"0x0",this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c]=i?["swap_a2b",o]:["swap_b2a",s],u=[t.object(this.liquid_staking_pool),t.object(this.sui_system_state),n];return t.moveCall({target:`${e.publishedAtV2()}::suilend::${a}`,typeArguments:[c],arguments:u})})}},EN=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),n,t.object(ei)];return t.moveCall({target:`${e.publishedAtV2()}::bluefin::${a}`,typeArguments:[c,u],arguments:l})})}},CN=class{constructor(e,t){if(e===1){this.connection=new $u.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new $u.SuiPythClient(t,n,r)}else{this.connection=new $u.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new $u.SuiPythClient(t,n,r)}}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];let l,f;if(r.extendedDetails==null)throw new Error("Extended details not supported haedal pmm");if(!r.extendedDetails.haedalPmmBasePriceSeed||!r.extendedDetails.haedalPmmQuotePriceSeed)throw new Error("Base price seed or quote price seed not supported");l=r.extendedDetails.haedalPmmBasePriceSeed,f=r.extendedDetails.haedalPmmQuotePriceSeed;const h=[l,f],y=yield this.connection.getPriceFeedsUpdateData(h),b=yield this.pythClient.updatePriceFeeds(t,y,h),_=[t.object(r.id),t.object(b[0]),t.object(b[1]),n,t.object(ei)];return t.moveCall({target:`${e.publishedAtV2()}::haedalpmm::${a}`,typeArguments:[c,u],arguments:_})})}},K_="CETUS",MN="DEEPBOOK",TN="KRIYA",AN="FLOWX",ON="FLOWXV3",IN="KRIYAV3",X_="TURBOS",ap="AFTERMATH",PN="HAEDAL",jN="VOLO",kN="AFSUI",NN="BLUEMOVE",J_="DEEPBOOKV3",Y_="SCALLOP",RN="SUILEND",DN="BLUEFIN",Z_="HAEDALPMM",$N="https://api-sui.cetus.zone/router_v2",BN=class{constructor(e,t,r,n){this.endpoint=e?FN(e):$N,this.client=r||new S_.SuiClient({url:S_.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return xt(this,null,function*(){if(this.signer==="")throw new Error("Signer is required, but not provided.");let r=null,n=50;if(!t){const s=this.allCoins.get(e);if(s)return s}const i=[];for(;;){const s=yield this.client.getCoins({owner:this.signer,coinType:e,cursor:r,limit:n});for(const o of s.data)i.push({coinAddress:Us(o.coinType).source_address,coinObjectId:o.coinObjectId,balance:BigInt(o.balance)});if(s.data.length<n)break;r=s.data[n-1].coinObjectId}return this.allCoins.set(e,i),i})}findRouters(e){return xt(this,null,function*(){return UN(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return xt(this,null,function*(){if(r.length===0)throw new Error("No router found");const o=r.map(h=>h.amountIn.toString()),a=r[0].path[0].from,c=r[0].path[r[0].path.length-1].target,u=e.splitCoins(t,o),l=[];for(let h=0;h<r.length;h++){if(r[h].path.length===0)throw new Error("Empty path");let y=u[h];for(const b of r[h].path)y=yield this.newDex(b.provider,i).swap(this,e,b,y,s);l.push(y)}return this.transferOrDestoryCoin(e,t,a),this.checkCoinThresholdAndMergeCoin(e,l,c,n)})}expectOutputSwap(e,t,r,n){return xt(this,null,function*(){const i=[],s=[],o=[],a=new V_(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:`${Jh.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r[0].path[r[0].path.length-1].target],arguments:[o[0],u]})}return o[0]})}swapInPools(e){return xt(this,null,function*(){let t;try{t=yield gN(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return xt(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,byAmountIn:i,txb:s,partner:o,deepbookv3DeepFee:a}=e,c=t.reduce((y,b)=>y.add(b.amountIn),new ns.default(0)),u=t.reduce((y,b)=>y.add(b.amountOut),new ns.default(0)),l=pN(i?u:c,i,n);if(i)return yield this.expectInputSwap(s,r,t,l,o,a);const f=s.splitCoins(r,[l.toString()]);return this.transferOrDestoryCoin(s,r,t[0].path[0].from),yield this.expectOutputSwap(s,f[0],t,o)})}fastRouterSwap(e){return xt(this,null,function*(){const{routers:t,byAmountIn:r,slippage:n,txb:i,partner:s,isMergeTragetCoin:o,refreshAllCoins:a,payDeepFeeAmount:c}=e,u=t[0].path[0].from;let l=yield this.getCoins(u,a);const f=t[0].path[t[0].path.length-1].target,h=t.reduce((R,F)=>R.add(F.amountIn),new ns.default(0)),y=t.reduce((R,F)=>R.add(F.amountOut),new ns.default(0)),b=hN(r?y:h,r,n),A=op(i,l,BigInt((r?h:b).toString()),u);let P;if(c&&c>0){let R=yield this.getCoins(this.deepbookv3DeepFeeType());P=op(i,R,BigInt(c),this.deepbookv3DeepFeeType()).targetCoin}const N=yield this.routerSwap({routers:t,inputCoin:A.targetCoin,slippage:n,byAmountIn:r,txb:i,partner:s,deepbookv3DeepFee:P});if(o){let R=yield this.getCoins(f,a);const F=op(i,R,BigInt(0),f);i.mergeCoins(F.targetCoin,[N]),F.isMintZeroCoin&&this.transferOrDestoryCoin(i,F.targetCoin,f)}else this.transferOrDestoryCoin(i,N,f)})}publishedAt(){return this.env===0?"0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2(){return this.env===0?"0x347dd58bbd11cd82c8b386b344729717c04a998da73386e82a239cc196d5706b":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(e,t,r){e.moveCall({target:`${this.publishedAt()}::utils::transfer_or_destroy_coin`,typeArguments:[r],arguments:[t]})}checkCoinThresholdAndMergeCoin(e,t,r,n){let i=t[0];if(t.length>1){let s=e.makeMoveVec({elements:t.slice(1)});e.moveCall({target:`${Jh.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 K_:return new V_(this.env,t);case MN:return new Z9(this.env);case J_:return new _N(this.env);case TN:return new Q9(this.env);case IN:return new eN(this.env);case AN:return new tN(this.env);case ON:return new rN(this.env);case X_:return new nN(this.env);case ap:return new Y9(this.env);case PN:return new vN(this.env);case kN:return new yN(this.env);case jN:return new bN(this.env);case NN:return new wN(this.env);case Y_:return new xN(this.env);case RN:return new SN(this.env);case DN:return new EN(this.env);case Z_:return new CN(this.env,this.client);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return xt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return xt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return xt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return xt(this,null,function*(){const e=yield qN(this.endpoint);return e?e.data:null})}};function LN(e){let t=0;for(const n of e.routes)for(const i of n.path)i.extended_details&&i.extended_details.deepbookv3_deep_fee&&(t+=Number(i.extended_details.deepbookv3_deep_fee));return{amountIn:new ns.default(e.amount_in.toString()),amountOut:new ns.default(e.amount_out.toString()),insufficientLiquidity:!1,routes:e.routes.map(n=>({path:n.path.map(i=>{var s,o,a,c,u,l,f;let h;i.provider===ap&&(h=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let y;return(i.provider===X_||i.provider===ap||i.provider===K_||i.provider===J_||i.provider===Y_||i.provider===Z_)&&(y={aftermathLpSupplyType:(s=i.extended_details)==null?void 0:s.aftermath_lp_supply_type,turbosFeeType:(o=i.extended_details)==null?void 0:o.turbos_fee_type,afterSqrtPrice:(a=i.extended_details)==null?void 0:a.after_sqrt_price,deepbookv3DeepFee:(c=i.extended_details)==null?void 0:c.deepbookv3_deep_fee,scallopScoinTreasury:(u=i.extended_details)==null?void 0:u.scallop_scoin_treasury,haedalPmmBasePriceSeed:(l=i.extended_details)==null?void 0:l.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(f=i.extended_details)==null?void 0:f.haedal_pmm_quote_price_seed}),{id:i.id,direction:i.direction,provider:i.provider,from:i.from,target:i.target,feeRate:i.fee_rate,amountIn:i.amount_in,amountOut:i.amount_out,extendedDetails:y,version:h}}),amountIn:new ns.default(n.amount_in.toString()),amountOut:new ns.default(n.amount_out.toString()),initialPrice:new Gu(n.initial_price.toString())})),totalDeepFee:t}}var ei="0x0000000000000000000000000000000000000000000000000000000000000006";Po(jo());function FN(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function UN(e,t){return xt(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield VN(e,t):r=yield zN(e,t),!r)return null;if(!r.ok)return{amountIn:Oi,amountOut:Oi,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:sp(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:Oi,amountOut:Oi,routes:[],insufficientLiquidity:i,error:{code:10004,msg:sp(10004)}}:n.data!=null?LN(n.data):{amountIn:Oi,amountOut:Oi,routes:[],insufficientLiquidity:i,error:{code:10003,msg:sp(10003)}}})}function zN(e,t){return xt(this,null,function*(){try{const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l}=t,f=is(r),h=is(n);let y=`${e}/find_routes?from=${f}&target=${h}&amount=${i.toString()}&by_amount_in=${s}`;return o&&(y+=`&depth=${o}`),a&&(y+=`&split_algorithm=${a}`),c&&(y+=`&split_factor=${c}`),u&&(y+=`&split_count=${u}`),l&&l.length>0&&(y+=`&providers=${l.join(",")}`),y+="&v=1000316",yield fetch(y)}catch(r){return console.error(r),null}})}function VN(e,t){return xt(this,null,function*(){const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l,liquidityChanges:f}=t,h=is(r),y=is(n),b=`${e}/find_routes`,_=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:_,liquidity_changes:f.map(P=>({pool:P.poolID,tick_lower:P.ticklower,tick_upper:P.tickUpper,delta_liquidity:P.deltaLiquidity}))};try{return yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}catch(P){return console.error("Error:",P),null}})}function qN(e){return xt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var Q_=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(Q_||{}),ex=BN,GN=Q_,tx=iN,ec=Us;/*!
|
|
34
39
|
* decimal.js v10.4.3
|
|
35
40
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
36
41
|
* https://github.com/MikeMcl/decimal.js
|
|
37
42
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
38
43
|
* MIT Licence
|
|
39
|
-
*/var _o=9e15,Yi=1e9,Xd="0123456789abcdef",cu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",uu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Yd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-_o,maxE:_o,crypto:!1},Qw,wi,ct=!0,lu="[DecimalError] ",Ji=lu+"Invalid argument: ",e2=lu+"Precision limit exceeded",t2=lu+"crypto unavailable",r2="[object Decimal]",Ar=Math.floor,pr=Math.pow,J9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Z9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Q9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,n2=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,yn=1e7,Qe=7,ek=9007199254740991,tk=cu.length-1,Jd=uu.length-1,ye={toStringTag:r2};ye.absoluteValue=ye.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)},ye.ceil=function(){return Xe(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())+Qe,n.rounding=1,r=rk(n,u2(n,r)),n.precision=e,n.rounding=t,Xe(wi==2||wi==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*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=yr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Ar((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=qt(u.plus(l).times(a),u.plus(c),o+2,1),yr(a.d).slice(0,o)===(r=yr(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)},ye.decimalPlaces=ye.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ar(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},ye.dividedBy=ye.div=function(e){return qt(this,new this.constructor(e))},ye.dividedToIntegerBy=ye.divToInt=function(e){var t=this,r=t.constructor;return Xe(qt(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 Xe(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/pu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=xo(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)},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=xo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/pu(5,e)),i=xo(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)},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,qt(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()?bn(r,i,s):new r(0):new r(NaN):t.isZero()?bn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=bn(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?Xe(new s(i),e,t,!0):(s.precision=r=n-i.e,i=qt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},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=bn(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<=Jd)return o=bn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=Jd)return o=bn(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)},ye.isFinite=function(){return!!this.d},ye.isInteger=ye.isInt=function(){return!!this.d&&Ar(this.e/Qe)>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=Qi(u,a),n=t?hu(l,a+10):Qi(e,a),c=qt(o,n,a,1),Ba(c.d,i=f,h))do if(a+=10,o=Qi(u,a),n=t?hu(l,a+10):Qi(e,a),c=qt(o,n,a,1),!s){+yr(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)},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 ct?Xe(e,a,c):e}if(r=Ar(e.e/Qe),l=Ar(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]=yn-1;--u[i],u[n]+=yn}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=du(u,r),ct?Xe(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]?Xe(new n(r),n.precision,n.rounding):(ct=!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),ct=!0,r.minus(t))},ye.naturalExponential=ye.exp=function(){return Zd(this)},ye.naturalLogarithm=ye.ln=function(){return Qi(this)},ye.negated=ye.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(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?Xe(e,a,c):e;if(s=Ar(f.e/Qe),n=Ar(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)/yn|0,u[i]%=yn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=du(u,n),ct?Xe(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=i2(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},ye.round=function(){var e=this,t=e.constructor;return Xe(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())+Qe,n.rounding=1,r=ik(n,u2(n,r)),n.precision=e,n.rounding=t,Xe(wi>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=yr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ar((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(s=n,n=s.plus(qt(o,s,r+2,1)).times(.5),yr(s.d).slice(0,r)===(t=yr(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)},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=qt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(wi==2||wi==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/Qe)+Ar(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%yn|0,t=a/yn|0;s[i]=(s[i]+t)%yn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=du(s,r),ct?Xe(e,f.precision,f.rounding):e},ye.toBinary=function(e,t){return eh(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,Yi),t===void 0?t=n.rounding:Lr(t,0,8),Xe(r,e+r.e+1,t))},ye.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=qn(n,!0):(Lr(e,0,Yi),t===void 0?t=i.rounding:Lr(t,0,8),n=Xe(new i(n),e+1,t),r=qn(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=qn(i):(Lr(e,0,Yi),t===void 0?t=s.rounding:Lr(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=qn(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=i2(_)-y.e-1,o=s%Qe,t.d[0]=pr(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(Ji+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new w(yr(_)),l=w.precision,w.precision=s=_.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,ct=!0,h},ye.toHexadecimal=ye.toHex=function(e,t){return eh(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]?(ct=!1,r=qt(r,e,0,t,1).times(e),ct=!0,Xe(r)):(e.s=r.s,r=e),r},ye.toNumber=function(){return+this},ye.toOctal=function(e,t){return eh(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(pr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Xe(a,n,s);if(t=Ar(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=ek)return i=s2(c,a,r,n),e.s<0?new c(1).div(i):Xe(i,n,s);if(o=a.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=pr(+a,u),t=r==0||!isFinite(r)?Ar(u*(Math.log("0."+yr(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(Qi(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),Ba(i.d,n,s)&&(t=n+10,i=Xe(Zd(e.times(Qi(a,t+r)),t),t+5,1),+yr(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))},ye.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=qn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Lr(e,1,Yi),t===void 0?t=i.rounding:Lr(t,0,8),n=Xe(new i(n),e,t),r=qn(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,Yi),t===void 0?t=n.rounding:Lr(t,0,8)),Xe(new n(r),e,t)},ye.toString=function(){var e=this,t=e.constructor,r=qn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},ye.truncated=ye.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)},ye.valueOf=ye.toJSON=function(){var e=this,t=e.constructor,r=qn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function yr(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+=Zi(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=Zi(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(Ji+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=pr(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)==pr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==pr(10,t-3)-1,o}function fu(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]+=Xd.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 rk(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/pu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=xo(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,_,w,A,I,P,R,F,L,H,q,X,ne,ce,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=yn,y=Qe,l=Ar(n.e/y)-Ar(i.e/y)),oe=m.length,ne=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<ne||h)&&H--;f++)q=h*c+(d[f]||0),P[f]=q/m|0,h=q%m|0;_=h||f<ne}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),oe=m.length,ne=d.length),X=oe,R=d.slice(0,oe),F=R.length;F<oe;)R[F++]=0;V=m.slice(),V.unshift(0),ce=m[0],m[1]>=c/2&&++ce;do h=0,u=t(m,R,oe,F),u<0?(L=R[0],oe!=F&&(L=L*c+(R[1]||0)),h=L/ce|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=R.length,u=t(w,R,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(R,w,F,c),u==-1&&(F=R.length,u=t(m,R,oe,F),u<1&&(h++,r(R,oe<F?V:m,F,c))),F=R.length):u===0&&(h++,R=[0]),P[f++]=h,u&&R[0]?R[F++]=d[X]||0:(R=[d[X]],F=1);while((X++<ne||R[0]!==void 0)&&H--);_=R[0]!==void 0}P[0]||P.shift()}if(y==1)I.e=l,Qw=_;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/pr(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/pr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%pr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/pr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=pr(10,(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=pr(10,Qe-s),f[h]=o>0?(l/pr(10,i-o)%pr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==yn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=yn)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 qn(e,t,r){if(!e.isFinite())return c2(e);var n,i=e.e,s=yr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+Zi(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Zi(-i-1)+s,r&&(n=r-o)>0&&(s+=Zi(n))):i>=o?(s+=Zi(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Zi(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Zi(n))),s}function du(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function hu(e,t,r){if(t>tk)throw ct=!0,r&&(e.precision=r),Error(e2);return Xe(new e(cu),t,1,!0)}function bn(e,t,r){if(t>Jd)throw Error(e2);return Xe(new e(uu),t,r,!0)}function i2(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 Zi(e){for(var t="";e--;)t+="0";return t}function s2(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),l2(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),l2(t.d,o)}return ct=!0,s}function o2(e){return e.d[e.d.length-1]&1}function a2(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,_=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(pr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Xe(s.times(e),c,1),r=r.times(++l),a=o.plus(qt(s,r,c,1)),yr(a.d).slice(0,c)===yr(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 Qi(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,R=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=R):l=t,I.precision=l+=_,r=yr(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=yr(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=hu(I,l+2,R).times(s+""),w=Qi(new I(n+"."+r.slice(1)),l-_).plus(u),I.precision=R,t==null?Xe(w,R,P,ct=!0):w;for(f=w,c=o=w=qt(w.minus(1),w.plus(1),l,1),h=Xe(w.times(w),l,1),i=3;;){if(o=Xe(o.times(h),l,1),u=c.plus(qt(o,new I(i),l,1)),yr(u.d).slice(0,l)===yr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(hu(I,l+2,R).times(s+""))),c=qt(c,new I(y),l,1),t==null)if(Ba(c.d,l-_,P,a))I.precision=l+=_,u=o=w=qt(f.minus(1),f.plus(1),l,1),h=Xe(w.times(w),l,1),i=a=1;else return Xe(c,I.precision=R,P,ct=!0);else return I.precision=R,c;c=u,i+=2}}function c2(e){return String(e.s*e.s/0)}function Qd(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 nk(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),n2.test(t))return Qd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Z9.test(t))r=16,t=t.toLowerCase();else if(J9.test(t))r=2;else if(Q9.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=s2(n,new n(r),s,s*2)),u=fu(t,r,yn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=du(u,l),e.d=u,ct=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?pr(2,c):en.pow(2,c))),ct=!0,e)}function ik(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:xo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/pu(5,r)),t=xo(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 xo(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=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 ct=!0,o.d.length=l+1,o}function pu(e,t){for(var r=e;--t;)r*=e;return r}function u2(e,t){var r,n=t.s<0,i=bn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return wi=n?4:1,t;if(r=t.divToInt(i),r.isZero())wi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return wi=o2(r)?n?2:3:n?4:1,t;wi=o2(r)?n?1:4:n?3:2}return t.minus(i).abs()}function eh(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,_=r!==void 0;if(_?(Lr(r,1,Yi),n===void 0?n=y.rounding:Lr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=c2(e);else{for(l=qn(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=fu(qn(h),10,i),h.e=h.d.length),f=fu(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=qt(e,h,r,n,0,i),f=e.d,s=e.e,u=Qw),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+=Xd.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=fu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Xd.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 l2(e,t){if(e.length>t)return e.length=t,!0}function sk(e){return new this(e).abs()}function ok(e){return new this(e).acos()}function ak(e){return new this(e).acosh()}function ck(e,t){return new this(e).plus(t)}function uk(e){return new this(e).asin()}function lk(e){return new this(e).asinh()}function fk(e){return new this(e).atan()}function dk(e){return new this(e).atanh()}function hk(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=bn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?bn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=bn(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=bn(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 pk(e){return new this(e).cbrt()}function mk(e){return Xe(e=new this(e),e.e+1,2)}function gk(e,t,r){return new this(e).clamp(t,r)}function vk(e){if(!e||typeof e!="object")throw Error(lu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,Yi,"rounding",0,8,"toExpNeg",-_o,0,"toExpPos",0,_o,"maxE",0,_o,"minE",-_o,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Yd[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]=Yd[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(t2);else this[r]=!1;else throw Error(Ji+r+": "+n);return this}function yk(e){return new this(e).cos()}function bk(e){return new this(e).cosh()}function f2(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,d2(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 Qd(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),n2.test(s)?Qd(u,s):nk(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=vk,i.clone=f2,i.isDecimal=d2,i.abs=sk,i.acos=ok,i.acosh=ak,i.add=ck,i.asin=uk,i.asinh=lk,i.atan=fk,i.atanh=dk,i.atan2=hk,i.cbrt=pk,i.ceil=mk,i.clamp=gk,i.cos=yk,i.cosh=bk,i.div=wk,i.exp=_k,i.floor=xk,i.hypot=Sk,i.ln=Ek,i.log=Mk,i.log10=Ak,i.log2=Ck,i.max=Tk,i.min=Ok,i.mod=Ik,i.mul=kk,i.pow=jk,i.random=Pk,i.round=Nk,i.sign=Rk,i.sin=Dk,i.sinh=$k,i.sqrt=Bk,i.sub=Lk,i.sum=Uk,i.tan=Fk,i.tanh=zk,i.trunc=Vk,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 wk(e,t){return new this(e).div(t)}function _k(e){return new this(e).exp()}function xk(e){return Xe(e=new this(e),e.e+1,3)}function Sk(){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 d2(e){return e instanceof en||e&&e.toStringTag===r2||!1}function Ek(e){return new this(e).ln()}function Mk(e,t){return new this(e).log(t)}function Ck(e){return new this(e).log(2)}function Ak(e){return new this(e).log(10)}function Tk(){return a2(this,arguments,"lt")}function Ok(){return a2(this,arguments,"gt")}function Ik(e,t){return new this(e).mod(t)}function kk(e,t){return new this(e).mul(t)}function jk(e,t){return new this(e).pow(t)}function Pk(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Lr(e,1,Yi),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(t2);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=pr(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 Nk(e){return Xe(e=new this(e),e.e+1,this.rounding)}function Rk(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Dk(e){return new this(e).sin()}function $k(e){return new this(e).sinh()}function Bk(e){return new this(e).sqrt()}function Lk(e,t){return new this(e).sub(t)}function Uk(){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 Fk(e){return new this(e).tan()}function zk(e){return new this(e).tanh()}function Vk(e){return Xe(e=new this(e),e.e+1,1)}ye[Symbol.for("nodejs.util.inspect.custom")]=ye.toString,ye[Symbol.toStringTag]="Decimal";var en=ye.constructor=f2(Yd);cu=new en(cu),uu=new en(uu),en.config({precision:256,rounding:en.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const tn=(e,t,r,n=en.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||ze(e).equals(0))return"0";if(t!==void 0){const u=Os(e,t,n);if(!ze(u).equals(0))return r?u:So(u)}const i=ze(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(ze(o).gt(0))!a||ze(o.length).gte(9)?c=Os(i,0,n):ze(o.length).gte(4)?c=Os(i,2,n):c=Os(i,4,n);else{Os(i,6,n);const u=Kk(a);if(u<6)c=Os(i,u+6,n);else{if(u>30)return"0";c=Os(i,9+(u-6),n)}}return r||ze(o).lt(1)?c:So(c)},qk=(e,t=2)=>{if(typeof e>"u"||e==="undefined"||e!==0&&!e)return"--";if(ze(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=Wk(e,t);return Number(r)>0?`+${r}%`:`${r}%`},h2=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=tn(e,t,!0,en.ROUND_DOWN).toString();if(ze(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:So(i).toString();return o.includes("e")&&(o=n?i:So(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"$--"}},Gk=(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}`},ze=e=>en.isDecimal(e)?e:new en(typeof e>"u"||e==="undefined"||!e?0:e);function Hk(e,t){return t===void 0?"":ze(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const Os=(e,t,r)=>ze(e).toDP(t,r).toString(),Wk=(e,t)=>{try{return ze(e).toDP(t,en.ROUND_DOWN).toString()}catch{return String(e)}},So=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 Kk(e){let t=0;if(e)for(;t<e.length;){if(ze(e[t]).gt(0))return t+1;t++}return 0}function Xk(e,t){const r=p2(ze(t));return Number(ze(e).mul(r))}function Yk(e,t){const r=p2(ze(t));return Number(ze(e).div(r))}function p2(e){return ze(10).pow(ze(e).abs())}function th(e,t){const r=Yk(e,t);return Jk(r.toString(),Number(t))}function Jk(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return Gk(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 mu(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Is=(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):"",rh=(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(!rh(e[i],t[i]))return!1;return!0};function m2(e){return!e||Object.keys(e).length===0}function g2(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const v2=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function Zk(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=ze(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=$a(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===nf;let f=c.amount;l&&(f=r?f:ze(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function y2(e,t){if(t){const r=e[$a(t.coin_type).full_address];if(r)return th(ze(r.amount).abs().toFixed(0),t.decimals)}}function Lt(e){return`https://archive.cetus.zone/assets/terminal${e}`}const Gn=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&ze(t).gt(0)?`${e.slice(0,t)}...`:e,b2="0x2::sui::SUI",Qk="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function w2(e){return Tr(e).full_address===b2}function _2(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 Tr(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={...Tr(r),type_arguments:i.map(l=>Tr(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>w2(l)?l:Tr(l).source_address),u.source_address=_2(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===b2||r===Qk?"0x2":ai(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=_2(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function ej(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const nh=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=ai(n);return t&&(i=ej(i)),`${i}::${r.join("::")}`},tj=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}},rj=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}},ih="tokenMap",x2="trustedTokenList",S2="collectTokenMap",E2="importTokenList";var M2={exports:{}};/*!
|
|
44
|
+
*/var Do=9e15,os=1e9,cp="0123456789abcdef",Wu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Hu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",up={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Do,maxE:Do,crypto:!1},rx,Ii,ct=!0,Ku="[DecimalError] ",as=Ku+"Invalid argument: ",nx=Ku+"Precision limit exceeded",ix=Ku+"crypto unavailable",sx="[object Decimal]",Or=Math.floor,mr=Math.pow,WN=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,HN=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,KN=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,ox=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Tn=1e7,Qe=7,XN=9007199254740991,JN=Wu.length-1,lp=Hu.length-1,we={toStringTag:sx};we.absoluteValue=we.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)},we.ceil=function(){return Xe(new this.constructor(this),this.e+1,2)},we.clampedTo=we.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(as+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},we.comparedTo=we.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},we.cosine=we.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=YN(n,dx(n,r)),n.precision=e,n.rounding=t,Xe(Ii==2||Ii==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},we.cubeRoot=we.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(ct=!1,s=l.s*mr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=br(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=mr(r,1/3),e=Or((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=Gt(u.plus(l).times(a),u.plus(c),o+2,1),br(a.d).slice(0,o)===(r=br(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Xe(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Xe(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ct=!0,Xe(n,e,f.rounding,t)},we.decimalPlaces=we.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Or(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},we.dividedBy=we.div=function(e){return Gt(this,new this.constructor(e))},we.dividedToIntegerBy=we.divToInt=function(e){var t=this,r=t.constructor;return Xe(Gt(t,new r(e),0,1,1),r.precision,r.rounding)},we.equals=we.eq=function(e){return this.cmp(e)===0},we.floor=function(){return Xe(new this.constructor(this),this.e+1,3)},we.greaterThan=we.gt=function(e){return this.cmp(e)>0},we.greaterThanOrEqualTo=we.gte=function(e){var t=this.cmp(e);return t==1||t===0},we.hyperbolicCosine=we.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/Zu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=$o(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)},we.hyperbolicSine=we.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=$o(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=$o(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)},we.hyperbolicTangent=we.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Gt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},we.inverseCosine=we.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?An(r,i,s):new r(0):new r(NaN):t.isZero()?An(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=An(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},we.inverseHyperbolicCosine=we.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,ct=!1,r=r.times(r).minus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},we.inverseHyperbolicSine=we.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,ct=!1,r=r.times(r).plus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln())},we.inverseHyperbolicTangent=we.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Xe(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Gt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},we.inverseSine=we.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=An(s,r+4,n).times(.5),e.s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},we.inverseTangent=we.atan=function(){var e,t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=lp)return o=An(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=lp)return o=An(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/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)},we.isFinite=function(){return!!this.d},we.isInteger=we.isInt=function(){return!!this.d&&Or(this.e/Qe)>this.d.length-2},we.isNaN=function(){return!this.s},we.isNegative=we.isNeg=function(){return this.s<0},we.isPositive=we.isPos=function(){return this.s>0},we.isZero=function(){return!!this.d&&this.d[0]===0},we.lessThan=we.lt=function(e){return this.cmp(e)<0},we.lessThanOrEqualTo=we.lte=function(e){return this.cmp(e)<1},we.logarithm=we.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(ct=!1,a=f+y,o=us(u,a),n=t?Yu(l,a+10):us(e,a),c=Gt(o,n,a,1),tc(c.d,i=f,h))do if(a+=10,o=us(u,a),n=t?Yu(l,a+10):us(e,a),c=Gt(o,n,a,1),!s){+br(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(tc(c.d,i+=10,h));return ct=!0,Xe(c,f,h)},we.minus=we.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return ct?Xe(e,a,c):e}if(r=Or(e.e/Qe),l=Or(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]=Tn-1;--u[i],u[n]+=Tn}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Ju(u,r),ct?Xe(e,a,c):e):new b(c===3?-0:0)},we.modulo=we.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Xe(new n(r),n.precision,n.rounding):(ct=!1,n.modulo==9?(t=Gt(r,e.abs(),0,3,1),t.s*=e.s):t=Gt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))},we.naturalExponential=we.exp=function(){return fp(this)},we.naturalLogarithm=we.ln=function(){return us(this)},we.negated=we.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(e)},we.plus=we.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),ct?Xe(e,a,c):e;if(s=Or(f.e/Qe),n=Or(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)/Tn|0,u[i]%=Tn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Ju(u,n),ct?Xe(e,a,c):e},we.precision=we.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(as+e);return r.d?(t=ax(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},we.round=function(){var e=this,t=e.constructor;return Xe(new t(e),e.e+1,t.rounding)},we.sine=we.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=QN(n,dx(n,r)),n.precision=e,n.rounding=t,Xe(Ii>2?r.neg():r,e,t,!0)):new n(NaN)},we.squareRoot=we.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(ct=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=br(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Or((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(Gt(o,s,r+2,1)).times(.5),br(s.d).slice(0,r)===(t=br(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Xe(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Xe(n,c+1,1),e=!n.times(n).eq(o));break}return ct=!0,Xe(n,c,l.rounding,e)},we.tangent=we.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Gt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(Ii==2||Ii==4?r.neg():r,e,t,!0)):new n(NaN)},we.times=we.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Or(l.e/Qe)+Or(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%Tn|0,t=a/Tn|0;s[i]=(s[i]+t)%Tn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Ju(s,r),ct?Xe(e,f.precision,f.rounding):e},we.toBinary=function(e,t){return hp(this,2,e,t)},we.toDecimalPlaces=we.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Ur(e,0,os),t===void 0?t=n.rounding:Ur(t,0,8),Xe(r,e+r.e+1,t))},we.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ti(n,!0):(Ur(e,0,os),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e+1,t),r=ti(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=ti(i):(Ur(e,0,os),t===void 0?t=s.rounding:Ur(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=ti(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},we.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,_=y.constructor;if(!b)return new _(y);if(u=r=new _(1),n=c=new _(0),t=new _(n),s=t.e=ax(b)-y.e-1,o=s%Qe,t.d[0]=mr(10,o<0?Qe+o:o),e==null)e=s>0?t:u;else{if(a=new _(e),!a.isInt()||a.lt(u))throw Error(as+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new _(br(b)),l=_.precision,_.precision=s=b.length*Qe*2;f=Gt(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=Gt(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=Gt(u,n,s,1).minus(y).abs().cmp(Gt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],_.precision=l,ct=!0,h},we.toHexadecimal=we.toHex=function(e,t){return hp(this,16,e,t)},we.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding: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]?(ct=!1,r=Gt(r,e,0,t,1).times(e),ct=!0,Xe(r)):(e.s=r.s,r=e),r},we.toNumber=function(){return+this},we.toOctal=function(e,t){return hp(this,8,e,t)},we.toPower=we.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(mr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Xe(a,n,s);if(t=Or(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=XN)return i=cx(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=mr(+a,u),t=r==0||!isFinite(r)?Or(u*(Math.log("0."+br(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(ct=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=fp(e.times(us(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),tc(i.d,n,s)&&(t=n+10,i=Xe(fp(e.times(us(a,t+r)),t),t+5,1),+br(i.d).slice(n+1,n+15)+1==1e14&&(i=Xe(i,n+1,0)))),i.s=o,ct=!0,c.rounding=s,Xe(i,n,s))},we.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ti(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ur(e,1,os),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e,t),r=ti(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toSignificantDigits=we.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Ur(e,1,os),t===void 0?t=n.rounding:Ur(t,0,8)),Xe(new n(r),e,t)},we.toString=function(){var e=this,t=e.constructor,r=ti(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},we.truncated=we.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)},we.valueOf=we.toJSON=function(){var e=this,t=e.constructor,r=ti(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function br(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Qe-n.length,r&&(s+=cs(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=cs(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Ur(e,t,r){if(e!==~~e||e<t||e>r)throw Error(as+e)}function tc(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Qe,i=0):(i=Math.ceil((t+1)/Qe),t%=Qe),s=mr(10,Qe-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==mr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==mr(10,t-3)-1,o}function Xu(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]+=cp.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 YN(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=$o(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 Gt=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,_,A,P,N,R,F,L,W,q,X,ie,ae,ce,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=Tn,y=Qe,l=Or(n.e/y)-Or(i.e/y)),ce=m.length,ie=d.length,P=new $(p),N=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(W=s=$.precision,o=$.rounding):a?W=s+(n.e-i.e)+1:W=s,W<0)N.push(1),b=!0;else{if(W=W/y+2|0,f=0,ce==1){for(h=0,m=m[0],W++;(f<ie||h)&&W--;f++)q=h*c+(d[f]||0),N[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,R=d.slice(0,ce),F=R.length;F<ce;)R[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,R,ce,F),u<0?(L=R[0],ce!=F&&(L=L*c+(R[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),_=e(m,h,c),A=_.length,F=R.length,u=t(_,R,A,F),u==1&&(h--,r(_,ce<A?V:m,A,c))):(h==0&&(u=h=1),_=m.slice()),A=_.length,A<F&&_.unshift(0),r(R,_,F,c),u==-1&&(F=R.length,u=t(m,R,ce,F),u<1&&(h++,r(R,ce<F?V:m,F,c))),F=R.length):u===0&&(h++,R=[0]),N[f++]=h,u&&R[0]?R[F++]=d[X]||0:(R=[d[X]],F=1);while((X++<ie||R[0]!==void 0)&&W--);b=R[0]!==void 0}N[0]||N.shift()}if(y==1)P.e=l,rx=b;else{for(f=1,h=N[0];h>=10;h/=10)f++;P.e=f+l*y-1,Xe(P,a?s+P.e+1:s,o,b)}return P}}();function Xe(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,a=f[0];a>=10;a/=10)i++;if(s=t-i,s<0)s+=Qe,o=t,l=f[h=0],c=l/mr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Qe),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Qe,o=s-Qe+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Qe,o=s-Qe+i,c=o<0?0:l/mr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%mr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/mr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=mr(10,(Qe-t%Qe)%Qe),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=mr(10,Qe-s),f[h]=o>0?(l/mr(10,i-o)%mr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==Tn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=Tn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return ct&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ti(e,t,r){if(!e.isFinite())return fx(e);var n,i=e.e,s=br(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+cs(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+cs(-i-1)+s,r&&(n=r-o)>0&&(s+=cs(n))):i>=o?(s+=cs(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+cs(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=cs(n))),s}function Ju(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function Yu(e,t,r){if(t>JN)throw ct=!0,r&&(e.precision=r),Error(nx);return Xe(new e(Wu),t,1,!0)}function An(e,t,r){if(t>lp)throw Error(nx);return Xe(new e(Hu),t,r,!0)}function ax(e){var t=e.length-1,r=t*Qe+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function cs(e){for(var t="";e--;)t+="0";return t}function cx(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),hx(s.d,o)&&(i=!0)),r=Or(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),hx(t.d,o)}return ct=!0,s}function ux(e){return e.d[e.d.length-1]&1}function lx(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 fp(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ct=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(mr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Xe(s.times(e),c,1),r=r.times(++l),a=o.plus(Gt(s,r,c,1)),br(a.d).slice(0,c)===br(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&tc(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Xe(o,h.precision=b,y,ct=!0);else return h.precision=b,o}o=a}}function us(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,_=e,A=_.d,P=_.constructor,N=P.rounding,R=P.precision;if(_.s<0||!A||!A[0]||!_.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:_.s!=1?NaN:A?0:_);if(t==null?(ct=!1,l=R):l=t,P.precision=l+=b,r=br(A),n=r.charAt(0),Math.abs(s=_.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)_=_.times(e),r=br(_.d),n=r.charAt(0),y++;s=_.e,n>1?(_=new P("0."+r),s++):_=new P(n+"."+r.slice(1))}else return u=Yu(P,l+2,R).times(s+""),_=us(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=R,t==null?Xe(_,R,N,ct=!0):_;for(f=_,c=o=_=Gt(_.minus(1),_.plus(1),l,1),h=Xe(_.times(_),l,1),i=3;;){if(o=Xe(o.times(h),l,1),u=c.plus(Gt(o,new P(i),l,1)),br(u.d).slice(0,l)===br(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Yu(P,l+2,R).times(s+""))),c=Gt(c,new P(y),l,1),t==null)if(tc(c.d,l-b,N,a))P.precision=l+=b,u=o=_=Gt(f.minus(1),f.plus(1),l,1),h=Xe(_.times(_),l,1),i=a=1;else return Xe(c,P.precision=R,N,ct=!0);else return P.precision=R,c;c=u,i+=2}}function fx(e){return String(e.s*e.s/0)}function dp(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 ZN(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),ox.test(t))return dp(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(HN.test(t))r=16,t=t.toLowerCase();else if(WN.test(t))r=2;else if(KN.test(t))r=8;else throw Error(as+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=cx(n,new n(r),s,s*2)),u=Xu(t,r,Tn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Ju(u,l),e.d=u,ct=!1,o&&(e=Gt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?mr(2,c):an.pow(2,c))),ct=!0,e)}function QN(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:$o(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Zu(5,r)),t=$o(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 $o(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=Gt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Gt(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 Zu(e,t){for(var r=e;--t;)r*=e;return r}function dx(e,t){var r,n=t.s<0,i=An(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Ii=n?4:1,t;if(r=t.divToInt(i),r.isZero())Ii=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Ii=ux(r)?n?2:3:n?4:1,t;Ii=ux(r)?n?1:4:n?3:2}return t.minus(i).abs()}function hp(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=fx(e);else{for(l=ti(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=Xu(ti(h),10,i),h.e=h.d.length),f=Xu(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=Gt(e,h,r,n,0,i),f=e.d,s=e.e,u=rx),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+=cp.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=Xu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=cp.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 hx(e,t){if(e.length>t)return e.length=t,!0}function eR(e){return new this(e).abs()}function tR(e){return new this(e).acos()}function rR(e){return new this(e).acosh()}function nR(e,t){return new this(e).plus(t)}function iR(e){return new this(e).asin()}function sR(e){return new this(e).asinh()}function oR(e){return new this(e).atan()}function aR(e){return new this(e).atanh()}function cR(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=An(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?An(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=An(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Gt(e,t,s,1)),t=An(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Gt(e,t,s,1)),r}function uR(e){return new this(e).cbrt()}function lR(e){return Xe(e=new this(e),e.e+1,2)}function fR(e,t,r){return new this(e).clamp(t,r)}function dR(e){if(!e||typeof e!="object")throw Error(Ku+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,os,"rounding",0,8,"toExpNeg",-Do,0,"toExpPos",0,Do,"maxE",0,Do,"minE",-Do,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=up[r]),(n=e[r])!==void 0)if(Or(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(as+r+": "+n);if(r="crypto",i&&(this[r]=up[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(ix);else this[r]=!1;else throw Error(as+r+": "+n);return this}function hR(e){return new this(e).cos()}function pR(e){return new this(e).cosh()}function px(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,mx(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 dp(u,s.toString())}else if(c!=="string")throw Error(as+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),ox.test(s)?dp(u,s):ZN(u,s)}if(i.prototype=we,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=dR,i.clone=px,i.isDecimal=mx,i.abs=eR,i.acos=tR,i.acosh=rR,i.add=nR,i.asin=iR,i.asinh=sR,i.atan=oR,i.atanh=aR,i.atan2=cR,i.cbrt=uR,i.ceil=lR,i.clamp=fR,i.cos=hR,i.cosh=pR,i.div=mR,i.exp=gR,i.floor=vR,i.hypot=yR,i.ln=bR,i.log=wR,i.log10=xR,i.log2=_R,i.max=SR,i.min=ER,i.mod=CR,i.mul=MR,i.pow=TR,i.random=AR,i.round=OR,i.sign=IR,i.sin=PR,i.sinh=jR,i.sqrt=kR,i.sub=NR,i.sum=RR,i.tan=DR,i.tanh=$R,i.trunc=BR,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 mR(e,t){return new this(e).div(t)}function gR(e){return new this(e).exp()}function vR(e){return Xe(e=new this(e),e.e+1,3)}function yR(){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 mx(e){return e instanceof an||e&&e.toStringTag===sx||!1}function bR(e){return new this(e).ln()}function wR(e,t){return new this(e).log(t)}function _R(e){return new this(e).log(2)}function xR(e){return new this(e).log(10)}function SR(){return lx(this,arguments,"lt")}function ER(){return lx(this,arguments,"gt")}function CR(e,t){return new this(e).mod(t)}function MR(e,t){return new this(e).mul(t)}function TR(e,t){return new this(e).pow(t)}function AR(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(ix);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=mr(10,Qe-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Qe)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Qe&&(r-=Qe-n)}return o.e=r,o.d=a,o}function OR(e){return Xe(e=new this(e),e.e+1,this.rounding)}function IR(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function PR(e){return new this(e).sin()}function jR(e){return new this(e).sinh()}function kR(e){return new this(e).sqrt()}function NR(e,t){return new this(e).sub(t)}function RR(){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 DR(e){return new this(e).tan()}function $R(e){return new this(e).tanh()}function BR(e){return Xe(e=new this(e),e.e+1,1)}we[Symbol.for("nodejs.util.inspect.custom")]=we.toString,we[Symbol.toStringTag]="Decimal";var an=we.constructor=px(up);Wu=new an(Wu),Hu=new an(Hu),an.config({precision:256,rounding:an.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const cn=(e,t,r,n=an.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Fe(e).equals(0))return"0";if(t!==void 0){const u=Vs(e,t,n);if(!Fe(u).equals(0))return r?u:Bo(u)}const i=Fe(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(Fe(o).gt(0))!a||Fe(o.length).gte(9)?c=Vs(i,0,n):Fe(o.length).gte(4)?c=Vs(i,2,n):c=Vs(i,4,n);else{Vs(i,6,n);const u=VR(a);if(u<6)c=Vs(i,u+6,n);else{if(u>30)return"0";c=Vs(i,9+(u-6),n)}}return r||Fe(o).lt(1)?c:Bo(c)},LR=(e,t=2)=>{if(typeof e>"u"||e==="undefined"||e!==0&&!e)return"--";if(Fe(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=zR(e,t);return Number(r)>0?`+${r}%`:`${r}%`},gx=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=cn(e,t,!0,an.ROUND_DOWN).toString();if(Fe(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Bo(i).toString();return o.includes("e")&&(o=n?i:Bo(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"$--"}},FR=(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 _=u[b]||"0";h+=_}o=c+h+y}else{let b="0";for(let _=0;_<f;_+=1)h=(c[c.length-_-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}`},Fe=e=>an.isDecimal(e)?e:new an(typeof e>"u"||e==="undefined"||!e?0:e);function UR(e,t){return t===void 0?"":Fe(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const Vs=(e,t,r)=>Fe(e).toDP(t,r).toString(),zR=(e,t)=>{try{return Fe(e).toDP(t,an.ROUND_DOWN).toString()}catch{return String(e)}},Bo=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 VR(e){let t=0;if(e)for(;t<e.length;){if(Fe(e[t]).gt(0))return t+1;t++}return 0}function qR(e,t){const r=vx(Fe(t));return Number(Fe(e).mul(r))}function GR(e,t){const r=vx(Fe(t));return Number(Fe(e).div(r))}function vx(e){return Fe(10).pow(Fe(e).abs())}function pp(e,t){const r=GR(e,t);return WR(r.toString(),Number(t))}function WR(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return FR(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 qs=(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):"",mp=(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(!mp(e[i],t[i]))return!1;return!0};function yx(e){return!e||Object.keys(e).length===0}function bx(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const wx=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function HR(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=Fe(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=ec(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===Af;let f=c.amount;l&&(f=r?f:Fe(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function _x(e,t){if(t){const r=e[ec(t.coin_type).full_address];if(r)return pp(Fe(r.amount).abs().toFixed(0),t.decimals)}}function Ft(e){return`https://archive.cetus.zone/assets/terminal${e}`}const On=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Fe(t).gt(0)?`${e.slice(0,t)}...`:e,xx="0x2::sui::SUI",KR="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function Sx(e){return Ir(e).full_address===xx}function Ex(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 Ir(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={...Ir(r),type_arguments:i.map(l=>Ir(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>Sx(l)?l:Ir(l).source_address),u.source_address=Ex(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===xx||r===KR?"0x2":gi(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=Ex(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function XR(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const gp=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=gi(n);return t&&(i=XR(i)),`${i}::${r.join("::")}`},JR=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}},YR=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}},vp="tokenMap",Cx="trustedTokenList",Mx="collectTokenMap",Tx="importTokenList";var Ax={exports:{}};/*!
|
|
40
45
|
localForage -- Offline Storage, Improved
|
|
41
46
|
Version 1.10.0
|
|
42
47
|
https://localforage.github.io/localForage
|
|
43
48
|
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
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 jn=="function"&&jn;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 jn=="function"&&jn,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 Hs<"u"?Hs: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(ne){return a.reject(L,ne)}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 ne=-1,ce=L.queue.length;++ne<ce;)L.queue[ne].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 ne(V){q||(q=!0,a.resolve(L,V))}function ce(){H(ne,X)}var oe=A(ce);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=R;function R(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 ne=new Array(q),ce=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){ne[d]=x,++ce===q&&!X&&(X=!0,a.resolve(V,ne))}}}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 ne=-1,ce=new this(o);++ne<q;)oe(L[ne]);return ce;function oe(V){H.resolve(V).then(function($){X||(X=!0,a.resolve(ce,$))},function($){X||(X=!0,a.reject(ce,$))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof Hs<"u"?Hs: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={},R=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 ne(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 ce(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)ne(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),ce(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){ne(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 Ve=0;Ve<Ee.length;Ve++){var vt=Ee[Ve];vt!==W&&(vt._dbInfo.db=U.db,vt._dbInfo.version=U.version)}})}function N(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 Ve=Ee.result;if(Ve){var vt=Ve.value;E(vt)&&(vt=x(vt));var Bt=D(vt,Ve.key,Ae++);Bt!==void 0?Q(Bt):Ve.continue()}else Q()},Ee.onerror=function(){Y(Ee.error)}}catch(Ve){Y(Ve)}})}).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,R.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 Ve=Ae.objectStore(J._dbInfo.storeName);Se===null&&(Se=void 0);var vt=Ve.put(Se,D);Ae.oncomplete=function(){Se===void 0&&(Se=null),Y(Se)},Ae.onabort=Ae.onerror=function(){var Bt=vt.error?vt.error:vt.transaction.error;pe(Bt)}}catch(Bt){pe(Bt)}})}).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 Ve=Ae.result;if(!Ve){Q(null);return}D===0||Ee?Q(Ve.key):(Ee=!0,Ve.advance(D))},Ae.onerror=function(){Y(Ae.error)}}catch(Ve){Y(Ve)}})}).catch(Y)});return h(J,W),J}function Ye(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;ne(D);var Ee=P[D.name],Ae=Ee.forages;_e.close();for(var Ve=0;Ve<Ae.length;Ve++){var vt=Ae[Ve];vt._dbInfo.db=null,vt._dbInfo.version=Se}var Bt=new f(function(Ft,ur){var or=c.open(D.name,Se);or.onerror=function(on){var vc=or.result;vc.close(),ur(on)},or.onupgradeneeded=function(){var on=or.result;on.deleteObjectStore(D.storeName)},or.onsuccess=function(){var on=or.result;on.close(),Ft(on)}});return Bt.then(function(Ft){Ee.db=Ft;for(var ur=0;ur<Ae.length;ur++){var or=Ae[ur];or._dbInfo.db=Ft,ce(or._dbInfo)}}).catch(function(Ft){throw(oe(D,Ft)||f.resolve()).catch(function(){}),Ft})}}):Q=pe.then(function(_e){ne(D);var Se=P[D.name],Ee=Se.forages;_e.close();for(var Ae=0;Ae<Ee.length;Ae++){var Ve=Ee[Ae];Ve._dbInfo.db=null}var vt=new f(function(Bt,Ft){var ur=c.deleteDatabase(D.name);ur.onerror=function(){var or=ur.result;or&&or.close(),Ft(ur.error)},ur.onblocked=function(){console.warn('dropInstance blocked for database "'+D.name+'" until all open connections are closed')},ur.onsuccess=function(){var or=ur.result;or&&or.close(),Bt(or)}});return vt.then(function(Bt){Se.db=Bt;for(var Ft=0;Ft<Ee.length;Ft++){var ur=Ee[Ft];ce(ur._dbInfo)}}).catch(function(Bt){throw(oe(D,Bt)||f.resolve()).catch(function(){}),Bt})})}return h(Q,W),Q}var lt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:se,getItem:N,setItem:ue,removeItem:xe,clear:be,length:Ce,key:Me,keys:Ye,dropInstance:Ue};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",we=/^~~local_forage_type~([^~]+)~/,me="__lfsc__:",Te=me.length,Ge="arbf",De="blob",Oe="si08",Ie="ui08",Le="uic8",ft="si16",dt="si32",He="ur16",kt="ui32",_t="fl32",et="fl64",At=Te+Ge.length,Dt=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 Tt(D,W){var U="";if(D&&(U=Dt.call(D)),D&&(U==="[object ArrayBuffer]"||D.buffer&&Dt.call(D.buffer)==="[object ArrayBuffer]")){var J,Q=me;D instanceof ArrayBuffer?(J=D,Q+=Ge):(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+=et: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(At),U=D.substring(Te,At),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 Ge: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 et:return new Float64Array(Y);default:throw new Error("Unkown type: "+U)}}var jt={serialize:Tt,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 bt(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 Et(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){bt(_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){bt(_e,pe,"SELECT * FROM "+pe.storeName,[],function(Se,Ee){for(var Ae=Ee.rows,Ve=Ae.length,vt=0;vt<Ve;vt++){var Bt=Ae.item(vt),Ft=Bt.value;if(Ft&&(Ft=pe.serializer.deserialize(Ft)),Ft=D(Ft,Bt.key,vt+1),Ft!==void 0){Q(Ft);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,Ve){Ve?_e(Ve):Ee.db.transaction(function(vt){bt(vt,Ee,"INSERT OR REPLACE INTO "+Ee.storeName+" (key, value) VALUES (?, ?)",[D,Ae],function(){pe(Se)},function(Bt,Ft){_e(Ft)})},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){bt(_e,pe,"DELETE FROM "+pe.storeName+" WHERE key = ?",[D],function(){Q()},function(Se,Ee){Y(Ee)})})}).catch(Y)});return h(J,W),J}function wt(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){var Y=W._dbInfo;Y.db.transaction(function(pe){bt(pe,Y,"DELETE FROM "+Y.storeName,[],function(){J()},function(_e,Se){Q(Se)})})}).catch(Q)});return h(U,D),U}function Ut(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){var Y=W._dbInfo;Y.db.transaction(function(pe){bt(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){bt(_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){bt(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(Bt){return new f(function(Ft,ur){Se.executeSql("DROP TABLE IF EXISTS "+Bt,[],function(){Ft()},function(or,on){ur(on)})})}for(var Ae=[],Ve=0,vt=Y.storeNames.length;Ve<vt;Ve++)Ae.push(Ee(Y.storeNames[Ve]));f.all(Ae).then(function(){pe()}).catch(function(Bt){_e(Bt)})},function(Se){_e(Se)})})}):Q=f.reject("Invalid arguments"),h(Q,W),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Je,getItem:Et,setItem:It,removeItem:ot,clear:wt,length:Ut,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 rt(){return!Be()||localStorage.length>0}function Re(D){var W=this,U={};if(D)for(var J in D)U[J]=D[J];return U.keyPrefix=ee(D,W._defaultConfig),rt()?(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 ie(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 Ve=localStorage.getItem(Ae);if(Ve&&(Ve=Q.serializer.deserialize(Ve)),Ve=D(Ve,Ae.substring(pe),Se++),Ve!==void 0)return Ve}}});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 Ne(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 ut(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(Ve){(Ve.name==="QuotaExceededError"||Ve.name==="NS_ERROR_DOM_QUOTA_REACHED")&&_e(Ve),_e(Ve)}})})});return h(Q,U),Q}function Xt(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:Re,_support:Z(),iterate:he,getItem:ie,setItem:ut,removeItem:Fe,clear:z,length:Ne,key:Pe,keys:We,dropInstance:Xt},$t=function(W,U){return W===U||typeof W=="number"&&typeof U=="number"&&isNaN(W)&&isNaN(U)},nr=function(W,U){for(var J=W.length,Q=0;Q<J;){if($t(W[Q],U))return!0;Q++}return!1},xr=Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"},sr={},Yt={},gr={INDEXEDDB:lt,WEBSQL:K,LOCALSTORAGE:Pt},Cn=[gr.INDEXEDDB._driver,gr.WEBSQL._driver,gr.LOCALSTORAGE._driver],Fr=["dropInstance"],An=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Fr),Oi={description:"",driver:Cn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Ii(D,W){D[W]=function(){var U=arguments;return D.ready().then(function(){return D[W].apply(D,U)})}}function Tn(){for(var D=1;D<arguments.length;D++){var W=arguments[D];if(W)for(var U in W)W.hasOwnProperty(U)&&(xr(W[U])?arguments[0][U]=W[U].slice():arguments[0][U]=W[U])}return arguments[0]}var ki=function(){function D(W){o(this,D);for(var U in gr)if(gr.hasOwnProperty(U)){var J=gr[U],Q=J._driver;this[U]=Q,sr[Q]||this.defineDriver(J)}this._defaultConfig=Tn({},Oi),this._config=Tn({},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"),Ve=0,vt=Ae.length;Ve<vt;Ve++){var Bt=Ae[Ve],Ft=!nr(Fr,Bt);if((Ft||U[Bt])&&typeof U[Bt]!="function"){_e(Ee);return}}var ur=function(){for(var vc=function(QH){return function(){var eW=new Error("Method "+QH+" is not implemented by the current driver"),h3=f.reject(eW);return h(h3,arguments[arguments.length-1]),h3}},Y0=0,ZH=Fr.length;Y0<ZH;Y0++){var J0=Fr[Y0];U[J0]||(U[J0]=vc(J0))}};ur();var or=function(vc){sr[Se]&&console.info("Redefining LocalForage driver: "+Se),sr[Se]=U,Yt[Se]=vc,pe()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(or,_e):or(!!U._support):or(!0)}catch(on){_e(on)}});return y(Y,J,Q),Y},D.prototype.driver=function(){return this._driver||null},D.prototype.getDriver=function(U,J,Q){var Y=sr[U]?f.resolve(sr[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;xr(U)||(U=[U]);var pe=this._getSupportedDrivers(U);function _e(){Y._config.driver=Y.driver()}function Se(Ve){return Y._extend(Ve),_e(),Y._ready=Y._initStorage(Y._config),Y._ready}function Ee(Ve){return function(){var vt=0;function Bt(){for(;vt<Ve.length;){var Ft=Ve[vt];return vt++,Y._dbInfo=null,Y._ready=null,Y.getDriver(Ft).then(Se).catch(Bt)}_e();var ur=new Error("No available storage method found.");return Y._driverSet=f.reject(ur),Y._driverSet}return Bt()}}var Ae=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Ae.then(function(){var Ve=pe[0];return Y._dbInfo=null,Y._ready=null,Y.getDriver(Ve).then(function(vt){Y._driver=vt._driver,_e(),Y._wrapLibraryMethodsWithReady(),Y._initDriver=Ee(pe)})}).catch(function(){_e();var Ve=new Error("No available storage method found.");return Y._driverSet=f.reject(Ve),Y._driverSet}),y(this._driverSet,J,Q),this._driverSet},D.prototype.supports=function(U){return!!Yt[U]},D.prototype._extend=function(U){Tn(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++)Ii(this,An[U])},D.prototype.createInstance=function(U){return new D(U)},D}(),ji=new ki;n.exports=ji},{3:3}]},{},[4])(4)})})(M2);var nj=M2.exports;const La=Zo(nj);La.config({name:"CetusSite",storeName:"tokens"});class _i{static async setItem(t,r){try{await La.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await La.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await La.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await La.clear()}catch(t){console.error("Failed to clear storage",t)}}}const gu=[{name:"SuiVision",link:"https://suivision.xyz",img:Lt("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:Lt("/images/logo_suiscan@2x.png"),isCustom:!1}],vu=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],ij=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],yu={mainnet:{env:"mainnet",fullRpcUrl:"https://fullnode.mainnet.sui.io",simulationAccount:"0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb",api:"https://api-sui.cetus.zone",aggregatorUrl:"https://api-sui.cetus.zone/router_v2"}}["mainnet"],sj=Lt("/images/birdeye-logo.png"),oj=Lt("/images/img-logo@2x.png"),aj=Lt("/images/logo_CoinGecko@2x.png"),cj=Lt("/images/logo_pyth.png");var Ua=(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))(Ua||{});const C2={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},uj={pyth:cj,coingecko:aj,birdeye:sj,Cetus:oj},br={CETUS:Lt("/images/aggregator-source/cetus.png"),KRIYA:Lt("/images/aggregator-source/kriya.png"),FLOWX:Lt("/images/aggregator-source/flowx.png"),AFTERMATH:Lt("/images/aggregator-source/aftermath.png"),TURBOS:Lt("/images/aggregator-source/turbos.png"),HAEDAL:Lt("/images/aggregator-source/haedal.png"),VOLO:Lt("/images/aggregator-source/volo.png"),AFSUI:Lt("/images/aggregator-source/aftermath.png"),BLUEMOVE:Lt("/images/aggregator-source/bluemove.png"),KRIYAV3:Lt("/images/aggregator-source/kriya.png"),FLOWXV3:Lt("/images/aggregator-source/flowx.png"),DEEPBOOKV3:Lt("/images/aggregator-source/deepbook.png"),SCALLOP:Lt("/images/aggregator-source/scallop.png"),SUILEND:Lt("/images/aggregator-source/suilend.png"),BLUEFIN:Lt("/images/aggregator-source/bluefin.png"),HAEDALPMM:Lt("/images/aggregator-source/haedal.png")},A2={CETUS:{name:"Cetus",id:"CETUS",logo:br.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:br.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:br.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:br.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:br.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:br.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:br.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:br.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:br.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:br.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:br.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:br.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:br.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:br.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:br.SCALLOP,type:"other",sort:70},SUILEND:{name:"SpringSui",id:"SUILEND",logo:br.SUILEND,type:"other",sort:60}},T2=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},lj=e=>e?T2(e):T2,fj=e=>e;function dj(e,t=fj){const r=te.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return te.useDebugValue(r),r}const O2=e=>{const t=lj(e),r=n=>dj(t,n);return Object.assign(r,t),r},xi=e=>e?O2(e):O2;function hj(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 sh=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return sh(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sh(n)(r)}}}},qr=xi(((e,t)=>(r,n,i)=>{let s={storage:hj(()=>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 R;return P((R=n())!=null?R:h)});const I=((A=s.onRehydrateStorage)==null?void 0:A.call(s,(w=n())!=null?w:h))||void 0;return sh(u.getItem.bind(u))(s.name).then(P=>{if(P)if(typeof P.version=="number"&&P.version!==s.version){if(s.migrate){const R=s.migrate(P.state,P.version);return R instanceof Promise?R.then(F=>[!0,F]):[!0,R]}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 R;const[F,L]=P;if(y=s.merge(L,(R=n())!=null?R: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})((e,t)=>({currentExplorer:gu[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:vu,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:vu[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(Ua),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}))}}),{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 Eo(){const{currentExplorer:e}=qr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${mj(n)}/${r}`:s=`${i}/${pj(n)}/${r}`,s}}}const pj=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"}},mj=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 I2(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 k2={exports:{}};/*!
|
|
49
|
+
*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,s){function o(u,l){if(!i[u]){if(!n[u]){var f=typeof Fn=="function"&&Fn;if(!l&&f)return f(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var y=i[u]={exports:{}};n[u][0].call(y.exports,function(b){var _=n[u][1][b];return o(_||b)},y,y.exports,r,n,i,s)}return i[u].exports}for(var a=typeof Fn=="function"&&Fn,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(r,n,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var c=0,u=new o(b),l=s.document.createTextNode("");u.observe(l,{characterData:!0}),a=function(){l.data=c=++c%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var A=s.document.createElement("script");A.onreadystatechange=function(){b(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},s.document.documentElement.appendChild(A)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var A,P,N=y.length;N;){for(P=y,y=[],A=-1;++A<N;)P[A]();N=y.length}h=!1}n.exports=_;function _(A){y.push(A)===1&&!h&&a()}}).call(this,typeof jr<"u"?jr: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&&_(this,L)}f.prototype.catch=function(L){return this.then(null,L)},f.prototype.then=function(L,W){if(typeof L!="function"&&this.state===u||typeof W!="function"&&this.state===c)return this;var q=new this.constructor(o);if(this.state!==l){var X=this.state===u?L:W;y(q,X,this.outcome)}else this.queue.push(new h(q,L,W));return q};function h(L,W,q){this.promise=L,typeof W=="function"&&(this.onFulfilled=W,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,W,q){s(function(){var X;try{X=W(q)}catch(ie){return a.reject(L,ie)}X===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,X)})}a.resolve=function(L,W){var q=A(b,W);if(q.status==="error")return a.reject(L,q.value);var X=q.value;if(X)_(L,X);else{L.state=u,L.outcome=W;for(var ie=-1,ae=L.queue.length;++ie<ae;)L.queue[ie].callFulfilled(W)}return L},a.reject=function(L,W){L.state=c,L.outcome=W;for(var q=-1,X=L.queue.length;++q<X;)L.queue[q].callRejected(W);return L};function b(L){var W=L&&L.then;if(L&&(typeof L=="object"||typeof L=="function")&&typeof W=="function")return function(){W.apply(L,arguments)}}function _(L,W){var q=!1;function X(V){q||(q=!0,a.reject(L,V))}function ie(V){q||(q=!0,a.resolve(L,V))}function ae(){W(ie,X)}var ce=A(ae);ce.status==="error"&&X(ce.value)}function A(L,W){var q={};try{q.value=L(W),q.status="success"}catch(X){q.status="error",q.value=X}return q}f.resolve=P;function P(L){return L instanceof this?L:a.resolve(new this(o),L)}f.reject=N;function N(L){var W=new this(o);return a.reject(W,L)}f.all=R;function R(L){var W=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=new Array(q),ae=0,ce=-1,V=new this(o);++ce<q;)$(L[ce],ce);return V;function $(p,d){W.resolve(p).then(m,function(x){X||(X=!0,a.reject(V,x))});function m(x){ie[d]=x,++ae===q&&!X&&(X=!0,a.resolve(V,ie))}}}f.race=F;function F(L){var W=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=-1,ae=new this(o);++ie<q;)ce(L[ie]);return ae;function ce(V){W.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 jr<"u"?jr: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,H){if(!(D instanceof H))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var c=a();function u(){try{if(!c||!c.open)return!1;var D=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),H=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!D||H)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(D,H){D=D||[],H=H||{};try{return new Blob(D,H)}catch(J){if(J.name!=="TypeError")throw J;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,Y=new U,Q=0;Q<D.length;Q+=1)Y.append(D[Q]);return Y.getBlob(H.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h(D,H){H&&D.then(function(U){H(null,U)},function(U){H(U)})}function y(D,H,U){typeof H=="function"&&D.then(H),typeof U=="function"&&D.catch(U)}function b(D){return typeof D!="string"&&(console.warn(D+" used as a key, but it is not a string."),D=String(D)),D}function _(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",P=void 0,N={},R=Object.prototype.toString,F="readonly",L="readwrite";function W(D){for(var H=D.length,U=new ArrayBuffer(H),Y=new Uint8Array(U),Q=0;Q<H;Q++)Y[Q]=D.charCodeAt(Q);return U}function q(D){return new f(function(H){var U=D.transaction(A,L),Y=l([""]);U.objectStore(A).put(Y,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),H(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),J=navigator.userAgent.match(/Edge\//);H(J||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function X(D){return typeof P=="boolean"?f.resolve(P):q(D).then(function(H){return P=H,P})}function ie(D){var H=N[D.name],U={};U.promise=new f(function(Y,Q){U.resolve=Y,U.reject=Q}),H.deferredOperations.push(U),H.dbReady?H.dbReady=H.dbReady.then(function(){return U.promise}):H.dbReady=U.promise}function ae(D){var H=N[D.name],U=H.deferredOperations.pop();if(U)return U.resolve(),U.promise}function ce(D,H){var U=N[D.name],Y=U.deferredOperations.pop();if(Y)return Y.reject(H),Y.promise}function V(D,H){return new f(function(U,Y){if(N[D.name]=N[D.name]||g(),D.db)if(H)ie(D),D.db.close();else return U(D.db);var Q=[D.name];H&&Q.push(D.version);var J=c.open.apply(c,Q);H&&(J.onupgradeneeded=function(me){var xe=J.result;try{xe.createObjectStore(D.storeName),me.oldVersion<=1&&xe.createObjectStore(A)}catch(Ce){if(Ce.name==="ConstraintError")console.warn('The database "'+D.name+'" has been upgraded from version '+me.oldVersion+" to version "+me.newVersion+', but the storage "'+D.storeName+'" already exists.');else throw Ce}}),J.onerror=function(me){me.preventDefault(),Y(J.error)},J.onsuccess=function(){var me=J.result;me.onversionchange=function(xe){xe.target.close()},U(me),ae(D)}})}function $(D){return V(D,!1)}function p(D){return V(D,!0)}function d(D,H){if(!D.db)return!0;var U=!D.db.objectStoreNames.contains(D.storeName),Y=D.version<D.db.version,Q=D.version>D.db.version;if(Y&&(D.version!==H&&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 J=D.db.version+1;J>D.version&&(D.version=J)}return!0}return!1}function m(D){return new f(function(H,U){var Y=new FileReader;Y.onerror=U,Y.onloadend=function(Q){var J=btoa(Q.target.result||"");H({__local_forage_encoded_blob:!0,data:J,type:D.type})},Y.readAsBinaryString(D)})}function x(D){var H=W(atob(D.data));return l([H],{type:D.type})}function M(D){return D&&D.__local_forage_encoded_blob}function E(D){var H=this,U=H._initReady().then(function(){var Y=N[H._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(U,D,D),U}function O(D){ie(D);for(var H=N[D.name],U=H.forages,Y=0;Y<U.length;Y++){var Q=U[Y];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return D.db=null,$(D).then(function(J){return D.db=J,d(D)?p(D):J}).then(function(J){D.db=H.db=J;for(var me=0;me<U.length;me++)U[me]._dbInfo.db=J}).catch(function(J){throw ce(D,J),J})}function C(D,H,U,Y){Y===void 0&&(Y=1);try{var Q=D.db.transaction(D.storeName,H);U(null,Q)}catch(J){if(Y>0&&(!D.db||J.name==="InvalidStateError"||J.name==="NotFoundError"))return f.resolve().then(function(){if(!D.db||J.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 O(D).then(function(){C(D,H,U,Y-1)})}).catch(U);U(J)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v(D){var H=this,U={db:null};if(D)for(var Y in D)U[Y]=D[Y];var Q=N[U.name];Q||(Q=g(),N[U.name]=Q),Q.forages.push(H),H._initReady||(H._initReady=H.ready,H.ready=E);var J=[];function me(){return f.resolve()}for(var xe=0;xe<Q.forages.length;xe++){var Ce=Q.forages[xe];Ce!==H&&J.push(Ce._initReady().catch(me))}var Me=Q.forages.slice(0);return f.all(J).then(function(){return U.db=Q.db,$(U)}).then(function(Te){return U.db=Te,d(U,H._defaultConfig.version)?p(U):Te}).then(function(Te){U.db=Q.db=Te,H._dbInfo=U;for(var Ve=0;Ve<Me.length;Ve++){var yt=Me[Ve];yt!==H&&(yt._dbInfo.db=U.db,yt._dbInfo.version=U.version)}})}function j(D,H){var U=this;D=b(D);var Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.get(D);Me.onsuccess=function(){var Te=Me.result;Te===void 0&&(Te=null),M(Te)&&(Te=x(Te)),Q(Te)},Me.onerror=function(){J(Me.error)}}catch(Te){J(Te)}})}).catch(J)});return h(Y,H),Y}function ee(D,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.openCursor(),Te=1;Me.onsuccess=function(){var Ve=Me.result;if(Ve){var yt=Ve.value;M(yt)&&(yt=x(yt));var Lt=D(yt,Ve.key,Te++);Lt!==void 0?Q(Lt):Ve.continue()}else Q()},Me.onerror=function(){J(Me.error)}}catch(Ve){J(Ve)}})}).catch(J)});return h(Y,H),Y}function se(D,H,U){var Y=this;D=b(D);var Q=new f(function(J,me){var xe;Y.ready().then(function(){return xe=Y._dbInfo,R.call(H)==="[object Blob]"?X(xe.db).then(function(Ce){return Ce?H:m(H)}):H}).then(function(Ce){C(Y._dbInfo,L,function(Me,Te){if(Me)return me(Me);try{var Ve=Te.objectStore(Y._dbInfo.storeName);Ce===null&&(Ce=void 0);var yt=Ve.put(Ce,D);Te.oncomplete=function(){Ce===void 0&&(Ce=null),J(Ce)},Te.onabort=Te.onerror=function(){var Lt=yt.error?yt.error:yt.transaction.error;me(Lt)}}catch(Lt){me(Lt)}})}).catch(me)});return h(Q,U),Q}function ye(D,H){var U=this;D=b(D);var Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,L,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=Ce.delete(D);xe.oncomplete=function(){Q()},xe.onerror=function(){J(Me.error)},xe.onabort=function(){var Te=Me.error?Me.error:Me.transaction.error;J(Te)}}catch(Te){J(Te)}})}).catch(J)});return h(Y,H),Y}function pe(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,L,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.clear();me.oncomplete=function(){Y()},me.onabort=me.onerror=function(){var Me=Ce.error?Ce.error:Ce.transaction.error;Q(Me)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,D),U}function Ee(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.count();Ce.onsuccess=function(){Y(Ce.result)},Ce.onerror=function(){Q(Ce.error)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,D),U}function Se(D,H){var U=this,Y=new f(function(Q,J){if(D<0){Q(null);return}U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Me=!1,Te=Ce.openKeyCursor();Te.onsuccess=function(){var Ve=Te.result;if(!Ve){Q(null);return}D===0||Me?Q(Ve.key):(Me=!0,Ve.advance(D))},Te.onerror=function(){J(Te.error)}}catch(Ve){J(Ve)}})}).catch(J)});return h(Y,H),Y}function Je(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.openKeyCursor(),Me=[];Ce.onsuccess=function(){var Te=Ce.result;if(!Te){Y(Me);return}Me.push(Te.key),Te.continue()},Ce.onerror=function(){Q(Ce.error)}}catch(Te){Q(Te)}})}).catch(Q)});return h(U,D),U}function Ue(D,H){H=_.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 Y=this,Q;if(!D.name)Q=f.reject("Invalid arguments");else{var J=D.name===U.name&&Y._dbInfo.db,me=J?f.resolve(Y._dbInfo.db):$(D).then(function(xe){var Ce=N[D.name],Me=Ce.forages;Ce.db=xe;for(var Te=0;Te<Me.length;Te++)Me[Te]._dbInfo.db=xe;return xe});D.storeName?Q=me.then(function(xe){if(xe.objectStoreNames.contains(D.storeName)){var Ce=xe.version+1;ie(D);var Me=N[D.name],Te=Me.forages;xe.close();for(var Ve=0;Ve<Te.length;Ve++){var yt=Te[Ve];yt._dbInfo.db=null,yt._dbInfo.version=Ce}var Lt=new f(function(zt,lr){var ar=c.open(D.name,Ce);ar.onerror=function(dn){var Pc=ar.result;Pc.close(),lr(dn)},ar.onupgradeneeded=function(){var dn=ar.result;dn.deleteObjectStore(D.storeName)},ar.onsuccess=function(){var dn=ar.result;dn.close(),zt(dn)}});return Lt.then(function(zt){Me.db=zt;for(var lr=0;lr<Te.length;lr++){var ar=Te[lr];ar._dbInfo.db=zt,ae(ar._dbInfo)}}).catch(function(zt){throw(ce(D,zt)||f.resolve()).catch(function(){}),zt})}}):Q=me.then(function(xe){ie(D);var Ce=N[D.name],Me=Ce.forages;xe.close();for(var Te=0;Te<Me.length;Te++){var Ve=Me[Te];Ve._dbInfo.db=null}var yt=new f(function(Lt,zt){var lr=c.deleteDatabase(D.name);lr.onerror=function(){var ar=lr.result;ar&&ar.close(),zt(lr.error)},lr.onblocked=function(){console.warn('dropInstance blocked for database "'+D.name+'" until all open connections are closed')},lr.onsuccess=function(){var ar=lr.result;ar&&ar.close(),Lt(ar)}});return yt.then(function(Lt){Ce.db=Lt;for(var zt=0;zt<Me.length;zt++){var lr=Me[zt];ae(lr._dbInfo)}}).catch(function(Lt){throw(ce(D,Lt)||f.resolve()).catch(function(){}),Lt})})}return h(Q,H),Q}var lt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:j,setItem:se,removeItem:ye,clear:pe,length:Ee,key:Se,keys:Je,dropInstance:Ue};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",_e=/^~~local_forage_type~([^~]+)~/,ge="__lfsc__:",Ae=ge.length,Ge="arbf",De="blob",Oe="si08",Ie="ui08",Le="uic8",ft="si16",dt="si32",We="ur16",jt="ui32",St="fl32",et="fl64",At=Ae+Ge.length,$t=Object.prototype.toString;function nt(D){var H=D.length*.75,U=D.length,Y,Q=0,J,me,xe,Ce;D[D.length-1]==="="&&(H--,D[D.length-2]==="="&&H--);var Me=new ArrayBuffer(H),Te=new Uint8Array(Me);for(Y=0;Y<U;Y+=4)J=$e.indexOf(D[Y]),me=$e.indexOf(D[Y+1]),xe=$e.indexOf(D[Y+2]),Ce=$e.indexOf(D[Y+3]),Te[Q++]=J<<2|me>>4,Te[Q++]=(me&15)<<4|xe>>2,Te[Q++]=(xe&3)<<6|Ce&63;return Me}function Et(D){var H=new Uint8Array(D),U="",Y;for(Y=0;Y<H.length;Y+=3)U+=$e[H[Y]>>2],U+=$e[(H[Y]&3)<<4|H[Y+1]>>4],U+=$e[(H[Y+1]&15)<<2|H[Y+2]>>6],U+=$e[H[Y+2]&63];return H.length%3===2?U=U.substring(0,U.length-1)+"=":H.length%3===1&&(U=U.substring(0,U.length-2)+"=="),U}function Ot(D,H){var U="";if(D&&(U=$t.call(D)),D&&(U==="[object ArrayBuffer]"||D.buffer&&$t.call(D.buffer)==="[object ArrayBuffer]")){var Y,Q=ge;D instanceof ArrayBuffer?(Y=D,Q+=Ge):(Y=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+=We:U==="[object Int32Array]"?Q+=dt:U==="[object Uint32Array]"?Q+=jt:U==="[object Float32Array]"?Q+=St:U==="[object Float64Array]"?Q+=et:H(new Error("Failed to get type for BinaryArray"))),H(Q+Et(Y))}else if(U==="[object Blob]"){var J=new FileReader;J.onload=function(){var me=mt+D.type+"~"+Et(this.result);H(ge+De+me)},J.readAsArrayBuffer(D)}else try{H(JSON.stringify(D))}catch(me){console.error("Couldn't convert value into a JSON string: ",D),H(null,me)}}function st(D){if(D.substring(0,Ae)!==ge)return JSON.parse(D);var H=D.substring(At),U=D.substring(Ae,At),Y;if(U===De&&_e.test(H)){var Q=H.match(_e);Y=Q[1],H=H.substring(Q[0].length)}var J=nt(H);switch(U){case Ge:return J;case De:return l([J],{type:Y});case Oe:return new Int8Array(J);case Ie:return new Uint8Array(J);case Le:return new Uint8ClampedArray(J);case ft:return new Int16Array(J);case We:return new Uint16Array(J);case dt:return new Int32Array(J);case jt:return new Uint32Array(J);case St:return new Float32Array(J);case et:return new Float64Array(J);default:throw new Error("Unkown type: "+U)}}var kt={serialize:Ot,deserialize:st,stringToBuffer:nt,bufferToString:Et};function It(D,H,U,Y){D.executeSql("CREATE TABLE IF NOT EXISTS "+H.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,Y)}function it(D){var H=this,U={db:null};if(D)for(var Y in D)U[Y]=typeof D[Y]!="string"?D[Y].toString():D[Y];var Q=new f(function(J,me){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(xe){return me(xe)}U.db.transaction(function(xe){It(xe,U,function(){H._dbInfo=U,J()},function(Ce,Me){me(Me)})},me)});return U.serializer=kt,Q}function wt(D,H,U,Y,Q,J){D.executeSql(U,Y,Q,function(me,xe){xe.code===xe.SYNTAX_ERR?me.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[H.storeName],function(Ce,Me){Me.rows.length?J(Ce,xe):It(Ce,H,function(){Ce.executeSql(U,Y,Q,J)},J)},J):J(me,xe)},J)}function Mt(D,H){var U=this;D=b(D);var Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT * FROM "+me.storeName+" WHERE key = ? LIMIT 1",[D],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).value:null;Te&&(Te=me.serializer.deserialize(Te)),Q(Te)},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function Ye(D,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT * FROM "+me.storeName,[],function(Ce,Me){for(var Te=Me.rows,Ve=Te.length,yt=0;yt<Ve;yt++){var Lt=Te.item(yt),zt=Lt.value;if(zt&&(zt=me.serializer.deserialize(zt)),zt=D(zt,Lt.key,yt+1),zt!==void 0){Q(zt);return}}Q()},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function gt(D,H,U,Y){var Q=this;D=b(D);var J=new f(function(me,xe){Q.ready().then(function(){H===void 0&&(H=null);var Ce=H,Me=Q._dbInfo;Me.serializer.serialize(H,function(Te,Ve){Ve?xe(Ve):Me.db.transaction(function(yt){wt(yt,Me,"INSERT OR REPLACE INTO "+Me.storeName+" (key, value) VALUES (?, ?)",[D,Te],function(){me(Ce)},function(Lt,zt){xe(zt)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){me(gt.apply(Q,[D,Ce,U,Y-1]));return}xe(yt)}})})}).catch(xe)});return h(J,U),J}function Pt(D,H,U){return gt.apply(this,[D,H,U,1])}function ot(D,H){var U=this;D=b(D);var Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"DELETE FROM "+me.storeName+" WHERE key = ?",[D],function(){Q()},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function _t(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"DELETE FROM "+J.storeName,[],function(){Y()},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function Ut(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"SELECT COUNT(key) as c FROM "+J.storeName,[],function(xe,Ce){var Me=Ce.rows.item(0).c;Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function k(D,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT key FROM "+me.storeName+" WHERE id = ? LIMIT 1",[D+1],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).key:null;Q(Te)},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function S(D){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"SELECT key FROM "+J.storeName,[],function(xe,Ce){for(var Me=[],Te=0;Te<Ce.rows.length;Te++)Me.push(Ce.rows.item(Te).key);Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,D),U}function T(D){return new f(function(H,U){D.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,J){for(var me=[],xe=0;xe<J.rows.length;xe++)me.push(J.rows.item(xe).name);H({db:D,storeNames:me})},function(Q,J){U(J)})},function(Y){U(Y)})})}function B(D,H){H=_.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 Y=this,Q;return D.name?Q=new f(function(J){var me;D.name===U.name?me=Y._dbInfo.db:me=openDatabase(D.name,"","",0),D.storeName?J({db:me,storeNames:[D.storeName]}):J(T(me))}).then(function(J){return new f(function(me,xe){J.db.transaction(function(Ce){function Me(Lt){return new f(function(zt,lr){Ce.executeSql("DROP TABLE IF EXISTS "+Lt,[],function(){zt()},function(ar,dn){lr(dn)})})}for(var Te=[],Ve=0,yt=J.storeNames.length;Ve<yt;Ve++)Te.push(Me(J.storeNames[Ve]));f.all(Te).then(function(){me()}).catch(function(Lt){xe(Lt)})},function(Ce){xe(Ce)})})}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Ye,getItem:Mt,setItem:Pt,removeItem:ot,clear:_t,length:Ut,key:k,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function re(D,H){var U=D.name+"/";return D.storeName!==H.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 rt(){return!Be()||localStorage.length>0}function Re(D){var H=this,U={};if(D)for(var Y in D)U[Y]=D[Y];return U.keyPrefix=re(D,H._defaultConfig),rt()?(H._dbInfo=U,U.serializer=kt,f.resolve()):f.reject()}function z(D){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var J=localStorage.key(Q);J.indexOf(Y)===0&&localStorage.removeItem(J)}});return h(U,D),U}function oe(D,H){var U=this;D=b(D);var Y=U.ready().then(function(){var Q=U._dbInfo,J=localStorage.getItem(Q.keyPrefix+D);return J&&(J=Q.serializer.deserialize(J)),J});return h(Y,H),Y}function he(D,H){var U=this,Y=U.ready().then(function(){for(var Q=U._dbInfo,J=Q.keyPrefix,me=J.length,xe=localStorage.length,Ce=1,Me=0;Me<xe;Me++){var Te=localStorage.key(Me);if(Te.indexOf(J)===0){var Ve=localStorage.getItem(Te);if(Ve&&(Ve=Q.serializer.deserialize(Ve)),Ve=D(Ve,Te.substring(me),Ce++),Ve!==void 0)return Ve}}});return h(Y,H),Y}function ke(D,H){var U=this,Y=U.ready().then(function(){var Q=U._dbInfo,J;try{J=localStorage.key(D)}catch{J=null}return J&&(J=J.substring(Q.keyPrefix.length)),J});return h(Y,H),Y}function He(D){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo,Q=localStorage.length,J=[],me=0;me<Q;me++){var xe=localStorage.key(me);xe.indexOf(Y.keyPrefix)===0&&J.push(xe.substring(Y.keyPrefix.length))}return J});return h(U,D),U}function Ne(D){var H=this,U=H.keys().then(function(Y){return Y.length});return h(U,D),U}function ze(D,H){var U=this;D=b(D);var Y=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+D)});return h(Y,H),Y}function ut(D,H,U){var Y=this;D=b(D);var Q=Y.ready().then(function(){H===void 0&&(H=null);var J=H;return new f(function(me,xe){var Ce=Y._dbInfo;Ce.serializer.serialize(H,function(Me,Te){if(Te)xe(Te);else try{localStorage.setItem(Ce.keyPrefix+D,Me),me(J)}catch(Ve){(Ve.name==="QuotaExceededError"||Ve.name==="NS_ERROR_DOM_QUOTA_REACHED")&&xe(Ve),xe(Ve)}})})});return h(Q,U),Q}function Jt(D,H){if(H=_.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 Y=this,Q;return D.name?Q=new f(function(J){D.storeName?J(re(D,Y._defaultConfig)):J(D.name+"/")}).then(function(J){for(var me=localStorage.length-1;me>=0;me--){var xe=localStorage.key(me);xe.indexOf(J)===0&&localStorage.removeItem(xe)}}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var Nt={_driver:"localStorageWrapper",_initStorage:Re,_support:Z(),iterate:he,getItem:oe,setItem:ut,removeItem:ze,clear:z,length:Ne,key:ke,keys:He,dropInstance:Jt},Bt=function(H,U){return H===U||typeof H=="number"&&typeof U=="number"&&isNaN(H)&&isNaN(U)},ir=function(H,U){for(var Y=H.length,Q=0;Q<Y;){if(Bt(H[Q],U))return!0;Q++}return!1},Sr=Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"},or={},Yt={},vr={INDEXEDDB:lt,WEBSQL:K,LOCALSTORAGE:Nt},Nn=[vr.INDEXEDDB._driver,vr.WEBSQL._driver,vr.LOCALSTORAGE._driver],Vr=["dropInstance"],Rn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Vr),Li={description:"",driver:Nn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Fi(D,H){D[H]=function(){var U=arguments;return D.ready().then(function(){return D[H].apply(D,U)})}}function Dn(){for(var D=1;D<arguments.length;D++){var H=arguments[D];if(H)for(var U in H)H.hasOwnProperty(U)&&(Sr(H[U])?arguments[0][U]=H[U].slice():arguments[0][U]=H[U])}return arguments[0]}var Ui=function(){function D(H){o(this,D);for(var U in vr)if(vr.hasOwnProperty(U)){var Y=vr[U],Q=Y._driver;this[U]=Q,or[Q]||this.defineDriver(Y)}this._defaultConfig=Dn({},Li),this._config=Dn({},this._defaultConfig,H),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return 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 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},D.prototype.defineDriver=function(U,Y,Q){var J=new f(function(me,xe){try{var Ce=U._driver,Me=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){xe(Me);return}for(var Te=Rn.concat("_initStorage"),Ve=0,yt=Te.length;Ve<yt;Ve++){var Lt=Te[Ve],zt=!ir(Vr,Lt);if((zt||U[Lt])&&typeof U[Lt]!="function"){xe(Me);return}}var lr=function(){for(var Pc=function(pX){return function(){var mX=new Error("Method "+pX+" is not implemented by the current driver"),j3=f.reject(mX);return h(j3,arguments[arguments.length-1]),j3}},H0=0,hX=Vr.length;H0<hX;H0++){var K0=Vr[H0];U[K0]||(U[K0]=Pc(K0))}};lr();var ar=function(Pc){or[Ce]&&console.info("Redefining LocalForage driver: "+Ce),or[Ce]=U,Yt[Ce]=Pc,me()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(ar,xe):ar(!!U._support):ar(!0)}catch(dn){xe(dn)}});return y(J,Y,Q),J},D.prototype.driver=function(){return this._driver||null},D.prototype.getDriver=function(U,Y,Q){var J=or[U]?f.resolve(or[U]):f.reject(new Error("Driver not found."));return y(J,Y,Q),J},D.prototype.getSerializer=function(U){var Y=f.resolve(kt);return y(Y,U),Y},D.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},D.prototype.setDriver=function(U,Y,Q){var J=this;Sr(U)||(U=[U]);var me=this._getSupportedDrivers(U);function xe(){J._config.driver=J.driver()}function Ce(Ve){return J._extend(Ve),xe(),J._ready=J._initStorage(J._config),J._ready}function Me(Ve){return function(){var yt=0;function Lt(){for(;yt<Ve.length;){var zt=Ve[yt];return yt++,J._dbInfo=null,J._ready=null,J.getDriver(zt).then(Ce).catch(Lt)}xe();var lr=new Error("No available storage method found.");return J._driverSet=f.reject(lr),J._driverSet}return Lt()}}var Te=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Te.then(function(){var Ve=me[0];return J._dbInfo=null,J._ready=null,J.getDriver(Ve).then(function(yt){J._driver=yt._driver,xe(),J._wrapLibraryMethodsWithReady(),J._initDriver=Me(me)})}).catch(function(){xe();var Ve=new Error("No available storage method found.");return J._driverSet=f.reject(Ve),J._driverSet}),y(this._driverSet,Y,Q),this._driverSet},D.prototype.supports=function(U){return!!Yt[U]},D.prototype._extend=function(U){Dn(this,U)},D.prototype._getSupportedDrivers=function(U){for(var Y=[],Q=0,J=U.length;Q<J;Q++){var me=U[Q];this.supports(me)&&Y.push(me)}return Y},D.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,Y=Rn.length;U<Y;U++)Fi(this,Rn[U])},D.prototype.createInstance=function(U){return new D(U)},D}(),zi=new Ui;n.exports=zi},{3:3}]},{},[4])(4)})})(Ax);var ZR=Ax.exports;const rc=fa(ZR);rc.config({name:"CetusSite",storeName:"tokens"});class Pi{static async setItem(t,r){try{await rc.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await rc.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await rc.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await rc.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}],tl=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],QR=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],rl={mainnet:{env:"mainnet",fullRpcUrl:"https://fullnode.mainnet.sui.io",simulationAccount:"0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb",api:"https://api-sui.cetus.zone",aggregatorUrl:"https://api-sui.cetus.zone/router_v2"}}["mainnet"],eD=Ft("/images/birdeye-logo.png"),tD=Ft("/images/img-logo@2x.png"),rD=Ft("/images/logo_CoinGecko@2x.png"),nD=Ft("/images/logo_pyth.png");var nc=(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))(nc||{});const Ox={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},iD={pyth:nD,coingecko:rD,birdeye:eD,Cetus:tD},wr={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")},Ix={CETUS:{name:"Cetus",id:"CETUS",logo:wr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:wr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:wr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:wr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:wr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:wr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:wr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:wr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:wr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:wr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:wr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:wr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:wr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:wr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:wr.SCALLOP,type:"other",sort:70},SUILEND:{name:"SpringSui",id:"SUILEND",logo:wr.SUILEND,type:"other",sort:60}},Px=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},sD=e=>e?Px(e):Px,oD=e=>e;function aD(e,t=oD){const r=te.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return te.useDebugValue(r),r}const jx=e=>{const t=sD(e),r=n=>aD(t,n);return Object.assign(r,t),r},ji=e=>e?jx(e):jx;function cD(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 yp=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return yp(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return yp(n)(r)}}}},Kr=ji(((e,t)=>(r,n,i)=>{let s={storage:cD(()=>localStorage),partialize:_=>_,version:0,merge:(_,A)=>({...A,..._}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((..._)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(..._)},n,i);const l=()=>{const _=s.partialize({...n()});return u.setItem(s.name,{state:_,version:s.version})},f=i.setState;i.setState=(_,A)=>{f(_,A),l()};const h=e((..._)=>{r(..._),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var _,A;if(!u)return;o=!1,a.forEach(N=>{var R;return N((R=n())!=null?R:h)});const P=((A=s.onRehydrateStorage)==null?void 0:A.call(s,(_=n())!=null?_:h))||void 0;return yp(u.getItem.bind(u))(s.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==s.version){if(s.migrate){const R=s.migrate(N.state,N.version);return R instanceof Promise?R.then(F=>[!0,F]):[!0,R]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var R;const[F,L]=N;if(y=s.merge(L,(R=n())!=null?R:h),r(y,!0),F)return l()}).then(()=>{P==null||P(y,void 0),y=n(),o=!0,c.forEach(N=>N(y))}).catch(N=>{P==null||P(void 0,N)})};return i.persist={setOptions:_=>{s={...s,..._},_.storage&&(u=_.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:_=>(a.add(_),()=>{a.delete(_)}),onFinishHydration:_=>(c.add(_),()=>{c.delete(_)})},s.skipHydration||b(),y||h})((e,t)=>({currentExplorer:el[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:tl,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:tl[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(nc),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}))}}),{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 Lo(){const{currentExplorer:e}=Kr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${lD(n)}/${r}`:s=`${i}/${uD(n)}/${r}`,s}}}const uD=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"}},lD=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 kx(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 w.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const f=r.includes(u);return w.jsx("span",{style:{lineHeight:"20px",fontSize:s,color:f?i:o,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var Nx={exports:{}};/*!
|
|
45
50
|
Copyright (c) 2018 Jed Watson.
|
|
46
51
|
Licensed under the MIT License (MIT), see
|
|
47
52
|
http://jedwatson.github.io/classnames
|
|
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})()})(k2);var gj=k2.exports;const Wt=Zo(gj);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 vj(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function bu(...e){return t=>e.forEach(r=>vj(r,t))}function Zt(...e){return O.useCallback(bu(...e),e)}function Mo(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,yj(i,...t)]}function yj(...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 Si=O.forwardRef((e,t)=>{const{children:r,...n}=e,i=O.Children.toArray(r),s=i.find(bj);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(oh,{...n,ref:t,children:O.isValidElement(o)?O.cloneElement(o,void 0,a):null})}return b.jsx(oh,{...n,ref:t,children:r})});Si.displayName="Slot";var oh=O.forwardRef((e,t)=>{const{children:r,...n}=e;if(O.isValidElement(r)){const i=_j(r);return O.cloneElement(r,{...wj(n,r.props),ref:t?bu(t,i):i})}return O.Children.count(r)>1?O.Children.only(null):null});oh.displayName="SlotClone";var Co=({children:e})=>b.jsx(b.Fragment,{children:e});function bj(e){return O.isValidElement(e)&&e.type===Co}function wj(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 _j(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 xj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gt=xj.reduce((e,t)=>{const r=O.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?Si: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 j2(e,t){e&&ep.flushSync(()=>e.dispatchEvent(t))}function mr(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 Sj(e,t=globalThis==null?void 0:globalThis.document){const r=mr(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 Ej="DismissableLayer",ah="dismissableLayer.update",Mj="dismissableLayer.pointerDownOutside",Cj="dismissableLayer.focusOutside",P2,N2=O.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ch=O.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=O.useContext(N2),[l,f]=O.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=O.useState({}),_=Zt(t,q=>f(q)),w=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),I=w.indexOf(A),P=l?w.indexOf(l):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,F=P>=I,L=Oj(q=>{const X=q.target,ne=[...u.branches].some(ce=>ce.contains(X));!F||ne||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),H=Ij(q=>{const X=q.target;[...u.branches].some(ce=>ce.contains(X))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return Sj(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&&(P2=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),R2(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=P2)}},[l,h,r,u]),O.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),R2())},[l,u]),O.useEffect(()=>{const q=()=>y({});return document.addEventListener(ah,q),()=>document.removeEventListener(ah,q)},[]),b.jsx(Gt.div,{...c,ref:_,style:{pointerEvents:R?F?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,H.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,H.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,L.onPointerDownCapture)})});ch.displayName=Ej;var Aj="DismissableLayerBranch",Tj=O.forwardRef((e,t)=>{const r=O.useContext(N2),n=O.useRef(null),i=Zt(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})});Tj.displayName=Aj;function Oj(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=O.useRef(!1),i=O.useRef(()=>{});return O.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){D2(Mj,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 Ij(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=O.useRef(!1);return O.useEffect(()=>{const i=s=>{s.target&&!n.current&&D2(Cj,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 R2(){const e=new CustomEvent(ah);document.dispatchEvent(e)}function D2(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?j2(i,s):i.dispatchEvent(s)}var es=globalThis!=null&&globalThis.document?O.useLayoutEffect:()=>{},kj=O["useId".toString()]||(()=>{}),jj=0;function Fa(e){const[t,r]=O.useState(kj());return es(()=>{e||r(n=>n??String(jj++))},[e]),e||(t?`radix-${t}`:"")}const Pj=["top","right","bottom","left"],ts=Math.min,Gr=Math.max,wu=Math.round,_u=Math.floor,Hn=e=>({x:e,y:e}),Nj={left:"right",right:"left",bottom:"top",top:"bottom"},Rj={start:"end",end:"start"};function uh(e,t,r){return Gr(e,ts(t,r))}function Ei(e,t){return typeof e=="function"?e(t):e}function Mi(e){return e.split("-")[0]}function Ao(e){return e.split("-")[1]}function lh(e){return e==="x"?"y":"x"}function fh(e){return e==="y"?"height":"width"}function rs(e){return["top","bottom"].includes(Mi(e))?"y":"x"}function dh(e){return lh(rs(e))}function Dj(e,t,r){r===void 0&&(r=!1);const n=Ao(e),i=dh(e),s=fh(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=xu(o)),[o,xu(o)]}function $j(e){const t=xu(e);return[hh(e),t,hh(t)]}function hh(e){return e.replace(/start|end/g,t=>Rj[t])}function Bj(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 Lj(e,t,r,n){const i=Ao(e);let s=Bj(Mi(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(hh)))),s}function xu(e){return e.replace(/left|right|bottom|top/g,t=>Nj[t])}function Uj(e){return{top:0,right:0,bottom:0,left:0,...e}}function $2(e){return typeof e!="number"?Uj(e):{top:e,right:e,bottom:e,left:e}}function Su(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 B2(e,t,r){let{reference:n,floating:i}=e;const s=rs(t),o=dh(t),a=fh(o),c=Mi(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(Ao(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const Fj=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}=B2(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:R,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=R??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}=B2(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function za(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}=Ei(t,e),_=$2(y),A=a[h?f==="floating"?"reference":"floating":f],I=Su(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,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),F=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},L=Su(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:P,offsetParent:R,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 zj=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}=Ei(e,t)||{};if(u==null)return{};const f=$2(l),h={x:r,y:n},y=dh(i),_=fh(y),w=await o.getDimensions(u),A=y==="y",I=A?"top":"left",P=A?"bottom":"right",R=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[R]:0;(!q||!await(o.isElement==null?void 0:o.isElement(H)))&&(q=a.floating[R]||s.floating[_]);const X=F/2-L/2,ne=q/2-w[_]/2-1,ce=ts(f[I],ne),oe=ts(f[P],ne),V=ce,$=q-w[_]-oe,p=q/2-w[_]/2+X,d=uh(V,p,$),m=!c.arrow&&Ao(i)!=null&&p!==d&&s.reference[_]/2-(p<V?ce: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}}}),Vj=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}=Ei(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const I=Mi(i),P=rs(a),R=Mi(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(R||!w?[xu(a)]:$j(a)),H=_!=="none";!h&&H&&L.push(...Lj(a,w,_,F));const q=[a,...L],X=await za(t,A),ne=[];let ce=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&ne.push(X[I]),f){const p=Dj(i,o,F);ne.push(X[p[0]],X[p[1]])}if(ce=[...ce,{placement:i,overflows:ne}],!ne.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:ce},reset:{placement:d}};let m=(V=ce.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=($=ce.filter(E=>{if(H){const C=rs(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 L2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function U2(e){return Pj.some(t=>e[t]>=0)}const qj=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ei(e,t);switch(n){case"referenceHidden":{const s=await za(t,{...i,elementContext:"reference"}),o=L2(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:U2(o)}}}case"escaped":{const s=await za(t,{...i,altBoundary:!0}),o=L2(s,r.floating);return{data:{escapedOffsets:o,escaped:U2(o)}}}default:return{}}}}};async function Gj(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Mi(r),a=Ao(r),c=rs(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Ei(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 Hj=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 Gj(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}}}}},Wj=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}=Ei(e,t),u={x:r,y:n},l=await za(t,c),f=rs(Mi(i)),h=lh(f);let y=u[h],_=u[f];if(s){const A=h==="y"?"top":"left",I=h==="y"?"bottom":"right",P=y+l[A],R=y-l[I];y=uh(P,y,R)}if(o){const A=f==="y"?"top":"left",I=f==="y"?"bottom":"right",P=_+l[A],R=_-l[I];_=uh(P,_,R)}const w=a.fn({...t,[h]:y,[f]:_});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[h]:s,[f]:o}}}}}},Kj=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}=Ei(e,t),l={x:r,y:n},f=rs(i),h=lh(f);let y=l[h],_=l[f];const w=Ei(a,t),A=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const R=h==="y"?"height":"width",F=s.reference[h]-s.floating[R]+A.mainAxis,L=s.reference[h]+s.reference[R]-A.mainAxis;y<F?y=F:y>L&&(y=L)}if(u){var I,P;const R=h==="y"?"width":"height",F=["top","left"].includes(Mi(i)),L=s.reference[f]-s.floating[R]+(F&&((I=o.offset)==null?void 0:I[f])||0)+(F?0:A.crossAxis),H=s.reference[f]+s.reference[R]+(F?0:((P=o.offset)==null?void 0:P[f])||0)-(F?A.crossAxis:0);_<L?_=L:_>H&&(_=H)}return{[h]:y,[f]:_}}}},Xj=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}=Ei(e,t),l=await za(t,u),f=Mi(i),h=Ao(i),y=rs(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,R=_-l.left-l.right,F=ts(w-l[A],P),L=ts(_-l[I],R),H=!t.middlewareData.shift;let q=F,X=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(X=R),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=P),H&&!h){const ce=Gr(l.left,0),oe=Gr(l.right,0),V=Gr(l.top,0),$=Gr(l.bottom,0);y?X=_-2*(ce!==0||oe!==0?ce+oe:Gr(l.left,l.right)):q=w-2*(V!==0||$!==0?V+$:Gr(l.top,l.bottom))}await c({...t,availableWidth:X,availableHeight:q});const ne=await o.getDimensions(a.floating);return _!==ne.width||w!==ne.height?{reset:{rects:!0}}:{}}}};function Eu(){return typeof window<"u"}function To(e){return F2(e)?(e.nodeName||"").toLowerCase():"#document"}function Hr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wn(e){var t;return(t=(F2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function F2(e){return Eu()?e instanceof Node||e instanceof Hr(e).Node:!1}function wn(e){return Eu()?e instanceof Element||e instanceof Hr(e).Element:!1}function Kn(e){return Eu()?e instanceof HTMLElement||e instanceof Hr(e).HTMLElement:!1}function z2(e){return!Eu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hr(e).ShadowRoot}function Va(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=_n(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function Yj(e){return["table","td","th"].includes(To(e))}function Mu(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ph(e){const t=mh(),r=wn(e)?_n(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 Jj(e){let t=ns(e);for(;Kn(t)&&!Oo(t);){if(ph(t))return t;if(Mu(t))return null;t=ns(t)}return null}function mh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Oo(e){return["html","body","#document"].includes(To(e))}function _n(e){return Hr(e).getComputedStyle(e)}function Cu(e){return wn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ns(e){if(To(e)==="html")return e;const t=e.assignedSlot||e.parentNode||z2(e)&&e.host||Wn(e);return z2(t)?t.host:t}function V2(e){const t=ns(e);return Oo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kn(t)&&Va(t)?t:V2(t)}function qa(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=V2(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Hr(i);if(s){const a=gh(o);return t.concat(o,o.visualViewport||[],Va(i)?i:[],a&&r?qa(a):[])}return t.concat(i,qa(i,[],r))}function gh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function q2(e){const t=_n(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=wu(r)!==s||wu(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function vh(e){return wn(e)?e:e.contextElement}function Io(e){const t=vh(e);if(!Kn(t))return Hn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=q2(t);let o=(s?wu(r.width):r.width)/n,a=(s?wu(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Zj=Hn(0);function G2(e){const t=Hr(e);return!mh()||!t.visualViewport?Zj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qj(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Hr(e)?!1:t}function ks(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=vh(e);let o=Hn(1);t&&(n?wn(n)&&(o=Io(n)):o=Io(e));const a=Qj(s,r,n)?G2(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&&wn(n)?Hr(n):n;let _=h,w=gh(_);for(;w&&n&&y!==_;){const A=Io(w),I=w.getBoundingClientRect(),P=_n(w),R=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+=R,u+=F,_=Hr(w),w=gh(_)}}return Su({width:l,height:f,x:c,y:u})}function yh(e,t){const r=Cu(e).scrollLeft;return t?t.left+r:ks(Wn(e)).left+r}function H2(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:yh(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function eP(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=Wn(n),a=t?Mu(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Hn(1);const l=Hn(0),f=Kn(n);if((f||!f&&!s)&&((To(n)!=="body"||Va(o))&&(c=Cu(n)),Kn(n))){const y=ks(n);u=Io(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?H2(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 tP(e){return Array.from(e.getClientRects())}function rP(e){const t=Wn(e),r=Cu(e),n=e.ownerDocument.body,i=Gr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Gr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+yh(e);const a=-r.scrollTop;return _n(n).direction==="rtl"&&(o+=Gr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function nP(e,t){const r=Hr(e),n=Wn(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=mh();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function iP(e,t){const r=ks(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=Kn(e)?Io(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 W2(e,t,r){let n;if(t==="viewport")n=nP(e,r);else if(t==="document")n=rP(Wn(e));else if(wn(t))n=iP(t,r);else{const i=G2(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Su(n)}function K2(e,t){const r=ns(e);return r===t||!wn(r)||Oo(r)?!1:_n(r).position==="fixed"||K2(r,t)}function sP(e,t){const r=t.get(e);if(r)return r;let n=qa(e,[],!1).filter(a=>wn(a)&&To(a)!=="body"),i=null;const s=_n(e).position==="fixed";let o=s?ns(e):e;for(;wn(o)&&!Oo(o);){const a=_n(o),c=ph(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Va(o)&&!c&&K2(e,o))?n=n.filter(l=>l!==o):i=a,o=ns(o)}return t.set(e,n),n}function oP(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?Mu(t)?[]:sP(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=W2(t,l,i);return u.top=Gr(f.top,u.top),u.right=ts(f.right,u.right),u.bottom=ts(f.bottom,u.bottom),u.left=Gr(f.left,u.left),u},W2(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function aP(e){const{width:t,height:r}=q2(e);return{width:t,height:r}}function cP(e,t,r){const n=Kn(t),i=Wn(t),s=r==="fixed",o=ks(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Hn(0);if(n||!n&&!s)if((To(t)!=="body"||Va(i))&&(a=Cu(t)),n){const h=ks(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=yh(i));const u=i&&!n&&!s?H2(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 bh(e){return _n(e).position==="static"}function X2(e,t){if(!Kn(e)||_n(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Wn(e)===r&&(r=r.ownerDocument.body),r}function Y2(e,t){const r=Hr(e);if(Mu(e))return r;if(!Kn(e)){let i=ns(e);for(;i&&!Oo(i);){if(wn(i)&&!bh(i))return i;i=ns(i)}return r}let n=X2(e,t);for(;n&&Yj(n)&&bh(n);)n=X2(n,t);return n&&Oo(n)&&bh(n)&&!ph(n)?r:n||Jj(e)||r}const uP=async function(e){const t=this.getOffsetParent||Y2,r=this.getDimensions,n=await r(e.floating);return{reference:cP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function lP(e){return _n(e).direction==="rtl"}const fP={convertOffsetParentRelativeRectToViewportRelativeRect:eP,getDocumentElement:Wn,getClippingRect:oP,getOffsetParent:Y2,getElementRects:uP,getClientRects:tP,getDimensions:aP,getScale:Io,isElement:wn,isRTL:lP};function dP(e,t){let r=null,n;const i=Wn(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=_u(l),_=_u(i.clientWidth-(u+f)),w=_u(i.clientHeight-(l+h)),A=_u(u),P={rootMargin:-y+"px "+-_+"px "+-w+"px "+-A+"px",threshold:Gr(0,ts(1,c))||1};let R=!0;function F(L){const H=L[0].intersectionRatio;if(H!==c){if(!R)return o();H?o(!1,H):n=setTimeout(()=>{o(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(F,{...P,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,P)}r.observe(e)}return o(!0),s}function hP(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=vh(e),l=i||s?[...u?qa(u):[],...qa(t)]:[];l.forEach(I=>{i&&I.addEventListener("scroll",r,{passive:!0}),s&&I.addEventListener("resize",r)});const f=u&&a?dP(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 R;(R=y)==null||R.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let _,w=c?ks(e):null;c&&A();function A(){const I=ks(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 pP=Hj,mP=Wj,gP=Vj,vP=Xj,yP=qj,J2=zj,bP=Kj,wP=(e,t,r)=>{const n=new Map,i={platform:fP,...r},s={...i.platform,_c:n};return Fj(e,t,{...i,platform:s})};var Au=typeof document<"u"?te.useLayoutEffect:te.useEffect;function Tu(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(!Tu(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)&&!Tu(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Z2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Q2(e,t){const r=Z2(e);return Math.round(t*r)/r}function wh(e){const t=O.useRef(e);return Au(()=>{t.current=e}),t}function _P(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);Tu(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))},[]),R=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),ne=c!=null,ce=wh(c),oe=wh(i),V=wh(u),$=O.useCallback(()=>{if(!H.current||!q.current)return;const E={placement:t,strategy:r,middleware:h};oe.current&&(E.platform=oe.current),wP(H.current,q.current,E).then(C=>{const k={...C,isPositioned:V.current!==!1};p.current&&!Tu(X.current,k)&&(X.current=k,ep.flushSync(()=>{f(k)}))})},[h,t,r,oe,V]);Au(()=>{u===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,f(E=>({...E,isPositioned:!1})))},[u]);const p=O.useRef(!1);Au(()=>(p.current=!0,()=>{p.current=!1}),[]),Au(()=>{if(F&&(H.current=F),L&&(q.current=L),F&&L){if(ce.current)return ce.current(F,L,$);$()}},[F,L,$,ce,ne]);const d=O.useMemo(()=>({reference:H,floating:q,setReference:P,setFloating:R}),[P,R]),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=Q2(m.floating,l.x),k=Q2(m.floating,l.y);return a?{...E,transform:"translate("+C+"px, "+k+"px)",...Z2(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 xP=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?J2({element:n.current,padding:i}).fn(r):{}:n?J2({element:n,padding:i}).fn(r):{}}}},SP=(e,t)=>({...pP(e),options:[e,t]}),EP=(e,t)=>({...mP(e),options:[e,t]}),MP=(e,t)=>({...bP(e),options:[e,t]}),CP=(e,t)=>({...gP(e),options:[e,t]}),AP=(e,t)=>({...vP(e),options:[e,t]}),TP=(e,t)=>({...yP(e),options:[e,t]}),OP=(e,t)=>({...xP(e),options:[e,t]});var IP="Arrow",e_=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"})})});e_.displayName=IP;var kP=e_;function jP(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,PP(i,...t)]}function PP(...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 _h(e){const[t,r]=O.useState(void 0);return es(()=>{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 xh="Popper",[t_,Ou]=jP(xh),[NP,r_]=t_(xh),n_=e=>{const{__scopePopper:t,children:r}=e,[n,i]=O.useState(null);return b.jsx(NP,{scope:t,anchor:n,onAnchorChange:i,children:r})};n_.displayName=xh;var i_="PopperAnchor",s_=O.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=r_(i_,r),o=O.useRef(null),a=Zt(t,o);return O.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:b.jsx(Gt.div,{...i,ref:a})});s_.displayName=i_;var Sh="PopperContent",[RP,DP]=t_(Sh),o_=O.forwardRef((e,t)=>{var xe,be,Ce,Me,Ye,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=r_(Sh,r),[I,P]=O.useState(null),R=Zt(t,lt=>P(lt)),[F,L]=O.useState(null),H=_h(F),q=(H==null?void 0:H.width)??0,X=(H==null?void 0:H.height)??0,ne=n+(s!=="center"?"-"+s:""),ce=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},oe=Array.isArray(u)?u:[u],V=oe.length>0,$={padding:ce,boundary:oe.filter(BP),altBoundary:V},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:E}=_P({strategy:"fixed",placement:ne,whileElementsMounted:(...lt)=>hP(...lt,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[SP({mainAxis:i+X,alignmentAxis:o}),c&&EP({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?MP():void 0,...$}),c&&CP({...$}),AP({...$,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&&OP({element:F,padding:a}),LP({arrowWidth:q,arrowHeight:X}),h&&TP({strategy:"referenceHidden",...$})]}),[C,k]=u_(m),T=mr(_);es(()=>{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,N=((Ce=E.arrow)==null?void 0:Ce.centerOffset)!==0,[se,ue]=O.useState();return es(()=>{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,(Ye=E.transformOrigin)==null?void 0:Ye.y].join(" "),...((Ue=E.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:b.jsx(RP,{scope:r,placedSide:C,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:N,children:b.jsx(Gt.div,{"data-side":C,"data-align":k,...w,ref:R,style:{...w.style,animation:x?void 0:"none"}})})})});o_.displayName=Sh;var a_="PopperArrow",$P={top:"bottom",right:"left",bottom:"top",left:"right"},c_=O.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=DP(a_,n),o=$P[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"}})})});c_.displayName=a_;function BP(e){return e!==null}var LP=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]=u_(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 u_(e){const[t,r="center"]=e.split("-");return[t,r]}var l_=n_,f_=s_,d_=o_,h_=c_,UP="Portal",p_=O.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=O.useState(!1);es(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?On.createPortal(b.jsx(Gt.div,{...n,ref:t}),o):null});p_.displayName=UP;function FP(e,t){return O.useReducer((r,n)=>t[r][n]??r,e)}var xn=e=>{const{present:t,children:r}=e,n=zP(t),i=typeof r=="function"?r({present:n.isPresent}):O.Children.only(r),s=Zt(n.ref,VP(i));return typeof r=="function"||n.isPresent?O.cloneElement(i,{ref:s}):null};xn.displayName="Presence";function zP(e){const[t,r]=O.useState(),n=O.useRef({}),i=O.useRef(e),s=O.useRef("none"),o=e?"mounted":"unmounted",[a,c]=FP(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return O.useEffect(()=>{const u=Iu(n.current);s.current=a==="mounted"?u:"none"},[a]),es(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=Iu(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]),es(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=Iu(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=Iu(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 Iu(e){return(e==null?void 0:e.animationName)||"none"}function VP(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 Ga({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=qP({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=mr(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 qP({defaultProp:e,onChange:t}){const r=O.useState(e),[n]=r,i=O.useRef(n),s=mr(t);return O.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var GP="VisuallyHidden",m_=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}}));m_.displayName=GP;var HP=m_,[ku,SW]=Mo("Tooltip",[Ou]),Eh=Ou(),g_="TooltipProvider",WP=700,v_="tooltip.open",[KP,y_]=ku(g_),b_=e=>{const{__scopeTooltip:t,delayDuration:r=WP,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(KP,{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})};b_.displayName=g_;var w_="Tooltip",[EW,ju]=ku(w_),Mh="TooltipTrigger",XP=O.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=ju(Mh,r),s=y_(Mh,r),o=Eh(r),a=O.useRef(null),c=Zt(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(f_,{asChild:!0,...o,children:b.jsx(Gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:tt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:tt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:tt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:tt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:tt(e.onBlur,i.onClose),onClick:tt(e.onClick,i.onClose)})})});XP.displayName=Mh;var YP="TooltipPortal",[MW,JP]=ku(YP,{forceMount:void 0}),ko="TooltipContent",ZP=O.forwardRef((e,t)=>{const r=JP(ko,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=ju(ko,e.__scopeTooltip);return b.jsx(xn,{present:n||o.open,children:o.disableHoverableContent?b.jsx(__,{side:i,...s,ref:t}):b.jsx(QP,{side:i,...s,ref:t})})}),QP=O.forwardRef((e,t)=>{const r=ju(ko,e.__scopeTooltip),n=y_(ko,e.__scopeTooltip),i=O.useRef(null),s=Zt(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=nN(I,A.getBoundingClientRect()),R=iN(I,P),F=sN(w.getBoundingClientRect()),L=aN([...R,...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)),R=!oN(I,o);P?h():R&&(h(),u())};return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[c,l,o,u,h]),b.jsx(__,{...e,ref:s})}),[eN,tN]=ku(w_,{isInside:!1}),__=O.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=ju(ko,r),u=Eh(r),{onClose:l}=c;return O.useEffect(()=>(document.addEventListener(v_,l),()=>document.removeEventListener(v_,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(ch,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:b.jsxs(d_,{"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(Co,{children:n}),b.jsx(eN,{scope:r,isInside:!0,children:b.jsx(HP,{id:c.contentId,role:"tooltip",children:i||n})})]})})});ZP.displayName=ko;var x_="TooltipArrow",rN=O.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Eh(r);return tN(x_,r).isInside?null:b.jsx(h_,{...i,...n,ref:t})});rN.displayName=x_;function nN(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 iN(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 sN(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 oN(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 aN(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),cN(t)}function cN(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 uN=b_,S_=O.createContext(void 0),lN=e=>{const{dir:t,children:r}=e;return b.jsx(S_.Provider,{value:t,children:r})};function Ch(e){const t=O.useContext(S_);return e||t||"ltr"}const fN=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],dN=["sky","mint","lime","yellow","amber"],hN=["gold","bronze"],pN=[...fN,...dN,...hN],mN=["gray",...["mauve","slate","sage","olive","sand"]];function gN(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 vN=["inherit","light","dark"],yN=[...pN,"gray"],bN=[...mN,"auto"],Nr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:vN,default:"inherit"},accentColor:{type:"enum",values:yN,default:"indigo"},grayColor:{type:"enum",values:bN,default:"auto"},panelBackground:{type:"enum",values:["solid","translucent"],default:"translucent"},radius:{type:"enum",values:["none","small","medium","large","full"],default:"medium"},scaling:{type:"enum",values:["90%","95%","100%","105%","110%"],default:"100%"}};function E_(e){return e==="gray"?"gray":gN(e)}const jo=()=>{},Pu=O.createContext(void 0);function wN(){const e=O.useContext(Pu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const Nu=O.forwardRef((e,t)=>O.useContext(Pu)===void 0?O.createElement(uN,null,O.createElement(lN,{dir:"ltr"},O.createElement(M_,{...e,ref:t}))):O.createElement(Ah,{...e,ref:t}));Nu.displayName="Theme";const M_=O.forwardRef((e,t)=>{const{appearance:r=Nr.appearance.default,accentColor:n=Nr.accentColor.default,grayColor:i=Nr.grayColor.default,panelBackground:s=Nr.panelBackground.default,radius:o=Nr.radius.default,scaling:a=Nr.scaling.default,hasBackground:c=Nr.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,R]=O.useState(o);O.useEffect(()=>R(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(()=>_N(r),[r]);const q=_==="auto"?E_(h):_;return O.createElement(O.Fragment,null,l!=="inherit"&&O.createElement(H,{appearance:l}),c&&O.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
53
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,n(a)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return r.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(Nx);var fD=Nx.exports;const Kt=fa(fD);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 dD(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function nl(...e){return t=>e.forEach(r=>dD(r,t))}function Qt(...e){return I.useCallback(nl(...e),e)}function Fo(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,_=((P=h==null?void 0:h[e])==null?void 0:P[c])||a,A=I.useMemo(()=>b,Object.values(b));return w.jsx(_.Provider,{value:A,children:y})};u.displayName=s+"Provider";function l(f,h){var _;const y=((_=h==null?void 0:h[e])==null?void 0:_[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,hD(i,...t)]}function hD(...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 ki=I.forwardRef((e,t)=>{const{children:r,...n}=e,i=I.Children.toArray(r),s=i.find(pD);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 w.jsx(bp,{...n,ref:t,children:I.isValidElement(o)?I.cloneElement(o,void 0,a):null})}return w.jsx(bp,{...n,ref:t,children:r})});ki.displayName="Slot";var bp=I.forwardRef((e,t)=>{const{children:r,...n}=e;if(I.isValidElement(r)){const i=gD(r);return I.cloneElement(r,{...mD(n,r.props),ref:t?nl(t,i):i})}return I.Children.count(r)>1?I.Children.only(null):null});bp.displayName="SlotClone";var Uo=({children:e})=>w.jsx(w.Fragment,{children:e});function pD(e){return I.isValidElement(e)&&e.type===Uo}function mD(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 gD(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 vD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Wt=vD.reduce((e,t)=>{const r=I.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?ki:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rx(e,t){e&&Y0.flushSync(()=>e.dispatchEvent(t))}function gr(e){const t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function yD(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e);I.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var bD="DismissableLayer",wp="dismissableLayer.update",wD="dismissableLayer.pointerDownOutside",_D="dismissableLayer.focusOutside",Dx,$x=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_p=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=I.useContext($x),[l,f]=I.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=I.useState({}),b=Qt(t,q=>f(q)),_=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),P=_.indexOf(A),N=l?_.indexOf(l):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,F=N>=P,L=ED(q=>{const X=q.target,ie=[...u.branches].some(ae=>ae.contains(X));!F||ie||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),W=CD(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 yD(q=>{N===u.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&a&&(q.preventDefault(),a()))},h),I.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Dx=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),Bx(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Dx)}},[l,h,r,u]),I.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),Bx())},[l,u]),I.useEffect(()=>{const q=()=>y({});return document.addEventListener(wp,q),()=>document.removeEventListener(wp,q)},[]),w.jsx(Wt.div,{...c,ref:b,style:{pointerEvents:R?F?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,W.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,W.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,L.onPointerDownCapture)})});_p.displayName=bD;var xD="DismissableLayerBranch",SD=I.forwardRef((e,t)=>{const r=I.useContext($x),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),w.jsx(Wt.div,{...e,ref:i})});SD.displayName=xD;function ED(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e),n=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){Lx(wD,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 CD(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e),n=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!n.current&&Lx(_D,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 Bx(){const e=new CustomEvent(wp);document.dispatchEvent(e)}function Lx(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?Rx(i,s):i.dispatchEvent(s)}var ls=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},MD=I["useId".toString()]||(()=>{}),TD=0;function ic(e){const[t,r]=I.useState(MD());return ls(()=>{e||r(n=>n??String(TD++))},[e]),e||(t?`radix-${t}`:"")}const AD=["top","right","bottom","left"],fs=Math.min,Xr=Math.max,il=Math.round,sl=Math.floor,ri=e=>({x:e,y:e}),OD={left:"right",right:"left",bottom:"top",top:"bottom"},ID={start:"end",end:"start"};function xp(e,t,r){return Xr(e,fs(t,r))}function Ni(e,t){return typeof e=="function"?e(t):e}function Ri(e){return e.split("-")[0]}function zo(e){return e.split("-")[1]}function Sp(e){return e==="x"?"y":"x"}function Ep(e){return e==="y"?"height":"width"}function ds(e){return["top","bottom"].includes(Ri(e))?"y":"x"}function Cp(e){return Sp(ds(e))}function PD(e,t,r){r===void 0&&(r=!1);const n=zo(e),i=Cp(e),s=Ep(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ol(o)),[o,ol(o)]}function jD(e){const t=ol(e);return[Mp(e),t,Mp(t)]}function Mp(e){return e.replace(/start|end/g,t=>ID[t])}function kD(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 ND(e,t,r,n){const i=zo(e);let s=kD(Ri(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Mp)))),s}function ol(e){return e.replace(/left|right|bottom|top/g,t=>OD[t])}function RD(e){return{top:0,right:0,bottom:0,left:0,...e}}function Fx(e){return typeof e!="number"?RD(e):{top:e,right:e,bottom:e,left:e}}function al(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 Ux(e,t,r){let{reference:n,floating:i}=e;const s=ds(t),o=Cp(t),a=Ep(o),c=Ri(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(zo(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const DD=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}=Ux(u,n,c),h=n,y={},b=0;for(let _=0;_<a.length;_++){const{name:A,fn:P}=a[_],{x:N,y:R,data:F,reset:L}=await P({x:l,y:f,initialPlacement:n,placement:h,strategy:i,middlewareData:y,rects:u,platform:o,elements:{reference:e,floating:t}});l=N??l,f=R??f,y={...y,[A]:{...y[A],...F}},L&&b<=50&&(b++,typeof L=="object"&&(L.placement&&(h=L.placement),L.rects&&(u=L.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:l,y:f}=Ux(u,h,c)),_=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function sc(e,t){var r;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:h=!1,padding:y=0}=Ni(t,e),b=Fx(y),A=a[h?f==="floating"?"reference":"floating":f],P=al(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(A)))==null||r?A:A.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),N=f==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),F=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},L=al(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:N,offsetParent:R,strategy:c}):N);return{top:(P.top-L.top+b.top)/F.y,bottom:(L.bottom-P.bottom+b.bottom)/F.y,left:(P.left-L.left+b.left)/F.x,right:(L.right-P.right+b.right)/F.x}}const $D=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:l=0}=Ni(e,t)||{};if(u==null)return{};const f=Fx(l),h={x:r,y:n},y=Cp(i),b=Ep(y),_=await o.getDimensions(u),A=y==="y",P=A?"top":"left",N=A?"bottom":"right",R=A?"clientHeight":"clientWidth",F=s.reference[b]+s.reference[y]-h[y]-s.floating[b],L=h[y]-s.reference[y],W=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let q=W?W[R]:0;(!q||!await(o.isElement==null?void 0:o.isElement(W)))&&(q=a.floating[R]||s.floating[b]);const X=F/2-L/2,ie=q/2-_[b]/2-1,ae=fs(f[P],ie),ce=fs(f[N],ie),V=ae,$=q-_[b]-ce,p=q/2-_[b]/2+X,d=xp(V,p,$),m=!c.arrow&&zo(i)!=null&&p!==d&&s.reference[b]/2-(p<V?ae:ce)-_[b]/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}}}),BD=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:_=!0,...A}=Ni(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const P=Ri(i),N=ds(a),R=Ri(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(R||!_?[ol(a)]:jD(a)),W=b!=="none";!h&&W&&L.push(...ND(a,_,b,F));const q=[a,...L],X=await sc(t,A),ie=[];let ae=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&ie.push(X[P]),f){const p=PD(i,o,F);ie.push(X[p[0]],X[p[1]])}if(ae=[...ae,{placement:i,overflows:ie}],!ie.every(p=>p<=0)){var ce,V;const p=(((ce=s.flip)==null?void 0:ce.index)||0)+1,d=q[p];if(d)return{data:{index:p,overflows:ae},reset:{placement:d}};let m=(V=ae.filter(x=>x.overflows[0]<=0).sort((x,M)=>x.overflows[1]-M.overflows[1])[0])==null?void 0:V.placement;if(!m)switch(y){case"bestFit":{var $;const x=($=ae.filter(M=>{if(W){const E=ds(M.placement);return E===N||E==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((M,E)=>M[1]-E[1])[0])==null?void 0:$[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function zx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Vx(e){return AD.some(t=>e[t]>=0)}const LD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ni(e,t);switch(n){case"referenceHidden":{const s=await sc(t,{...i,elementContext:"reference"}),o=zx(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Vx(o)}}}case"escaped":{const s=await sc(t,{...i,altBoundary:!0}),o=zx(s,r.floating);return{data:{escapedOffsets:o,escaped:Vx(o)}}}default:return{}}}}};async function FD(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Ri(r),a=zo(r),c=ds(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Ni(t,e);let{mainAxis:h,crossAxis:y,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(y=a==="end"?b*-1:b),c?{x:y*l,y:h*u}:{x:h*u,y:y*l}}const UD=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=t,c=await FD(t,e);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},zD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:A=>{let{x:P,y:N}=A;return{x:P,y:N}}},...c}=Ni(e,t),u={x:r,y:n},l=await sc(t,c),f=ds(Ri(i)),h=Sp(f);let y=u[h],b=u[f];if(s){const A=h==="y"?"top":"left",P=h==="y"?"bottom":"right",N=y+l[A],R=y-l[P];y=xp(N,y,R)}if(o){const A=f==="y"?"top":"left",P=f==="y"?"bottom":"right",N=b+l[A],R=b-l[P];b=xp(N,b,R)}const _=a.fn({...t,[h]:y,[f]:b});return{..._,data:{x:_.x-r,y:_.y-n,enabled:{[h]:s,[f]:o}}}}}},VD=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ni(e,t),l={x:r,y:n},f=ds(i),h=Sp(f);let y=l[h],b=l[f];const _=Ni(a,t),A=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(c){const R=h==="y"?"height":"width",F=s.reference[h]-s.floating[R]+A.mainAxis,L=s.reference[h]+s.reference[R]-A.mainAxis;y<F?y=F:y>L&&(y=L)}if(u){var P,N;const R=h==="y"?"width":"height",F=["top","left"].includes(Ri(i)),L=s.reference[f]-s.floating[R]+(F&&((P=o.offset)==null?void 0:P[f])||0)+(F?0:A.crossAxis),W=s.reference[f]+s.reference[R]+(F?0:((N=o.offset)==null?void 0:N[f])||0)-(F?A.crossAxis:0);b<L?b=L:b>W&&(b=W)}return{[h]:y,[f]:b}}}},qD=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:c=()=>{},...u}=Ni(e,t),l=await sc(t,u),f=Ri(i),h=zo(i),y=ds(i)==="y",{width:b,height:_}=s.floating;let A,P;f==="top"||f==="bottom"?(A=f,P=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(P=f,A=h==="end"?"top":"bottom");const N=_-l.top-l.bottom,R=b-l.left-l.right,F=fs(_-l[A],N),L=fs(b-l[P],R),W=!t.middlewareData.shift;let q=F,X=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(X=R),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=N),W&&!h){const ae=Xr(l.left,0),ce=Xr(l.right,0),V=Xr(l.top,0),$=Xr(l.bottom,0);y?X=b-2*(ae!==0||ce!==0?ae+ce:Xr(l.left,l.right)):q=_-2*(V!==0||$!==0?V+$:Xr(l.top,l.bottom))}await c({...t,availableWidth:X,availableHeight:q});const ie=await o.getDimensions(a.floating);return b!==ie.width||_!==ie.height?{reset:{rects:!0}}:{}}}};function cl(){return typeof window<"u"}function Vo(e){return qx(e)?(e.nodeName||"").toLowerCase():"#document"}function Jr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ni(e){var t;return(t=(qx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qx(e){return cl()?e instanceof Node||e instanceof Jr(e).Node:!1}function In(e){return cl()?e instanceof Element||e instanceof Jr(e).Element:!1}function ii(e){return cl()?e instanceof HTMLElement||e instanceof Jr(e).HTMLElement:!1}function Gx(e){return!cl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jr(e).ShadowRoot}function oc(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=Pn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function GD(e){return["table","td","th"].includes(Vo(e))}function ul(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Tp(e){const t=Ap(),r=In(e)?Pn(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 WD(e){let t=hs(e);for(;ii(t)&&!qo(t);){if(Tp(t))return t;if(ul(t))return null;t=hs(t)}return null}function Ap(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function qo(e){return["html","body","#document"].includes(Vo(e))}function Pn(e){return Jr(e).getComputedStyle(e)}function ll(e){return In(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hs(e){if(Vo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Gx(e)&&e.host||ni(e);return Gx(t)?t.host:t}function Wx(e){const t=hs(e);return qo(t)?e.ownerDocument?e.ownerDocument.body:e.body:ii(t)&&oc(t)?t:Wx(t)}function ac(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=Wx(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Jr(i);if(s){const a=Op(o);return t.concat(o,o.visualViewport||[],oc(i)?i:[],a&&r?ac(a):[])}return t.concat(i,ac(i,[],r))}function Op(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Hx(e){const t=Pn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ii(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=il(r)!==s||il(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function Ip(e){return In(e)?e:e.contextElement}function Go(e){const t=Ip(e);if(!ii(t))return ri(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=Hx(t);let o=(s?il(r.width):r.width)/n,a=(s?il(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const HD=ri(0);function Kx(e){const t=Jr(e);return!Ap()||!t.visualViewport?HD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function KD(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Jr(e)?!1:t}function Gs(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=Ip(e);let o=ri(1);t&&(n?In(n)&&(o=Go(n)):o=Go(e));const a=KD(s,r,n)?Kx(s):ri(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=Jr(s),y=n&&In(n)?Jr(n):n;let b=h,_=Op(b);for(;_&&n&&y!==b;){const A=Go(_),P=_.getBoundingClientRect(),N=Pn(_),R=P.left+(_.clientLeft+parseFloat(N.paddingLeft))*A.x,F=P.top+(_.clientTop+parseFloat(N.paddingTop))*A.y;c*=A.x,u*=A.y,l*=A.x,f*=A.y,c+=R,u+=F,b=Jr(_),_=Op(b)}}return al({width:l,height:f,x:c,y:u})}function Pp(e,t){const r=ll(e).scrollLeft;return t?t.left+r:Gs(ni(e)).left+r}function Xx(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:Pp(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function XD(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=ni(n),a=t?ul(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=ri(1);const l=ri(0),f=ii(n);if((f||!f&&!s)&&((Vo(n)!=="body"||oc(o))&&(c=ll(n)),ii(n))){const y=Gs(n);u=Go(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?Xx(o,c,!0):ri(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 JD(e){return Array.from(e.getClientRects())}function YD(e){const t=ni(e),r=ll(e),n=e.ownerDocument.body,i=Xr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Xr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+Pp(e);const a=-r.scrollTop;return Pn(n).direction==="rtl"&&(o+=Xr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function ZD(e,t){const r=Jr(e),n=ni(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=Ap();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function QD(e,t){const r=Gs(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=ii(e)?Go(e):ri(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 Jx(e,t,r){let n;if(t==="viewport")n=ZD(e,r);else if(t==="document")n=YD(ni(e));else if(In(t))n=QD(t,r);else{const i=Kx(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return al(n)}function Yx(e,t){const r=hs(e);return r===t||!In(r)||qo(r)?!1:Pn(r).position==="fixed"||Yx(r,t)}function e$(e,t){const r=t.get(e);if(r)return r;let n=ac(e,[],!1).filter(a=>In(a)&&Vo(a)!=="body"),i=null;const s=Pn(e).position==="fixed";let o=s?hs(e):e;for(;In(o)&&!qo(o);){const a=Pn(o),c=Tp(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||oc(o)&&!c&&Yx(e,o))?n=n.filter(l=>l!==o):i=a,o=hs(o)}return t.set(e,n),n}function t$(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?ul(t)?[]:e$(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=Jx(t,l,i);return u.top=Xr(f.top,u.top),u.right=fs(f.right,u.right),u.bottom=fs(f.bottom,u.bottom),u.left=Xr(f.left,u.left),u},Jx(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function r$(e){const{width:t,height:r}=Hx(e);return{width:t,height:r}}function n$(e,t,r){const n=ii(t),i=ni(t),s=r==="fixed",o=Gs(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=ri(0);if(n||!n&&!s)if((Vo(t)!=="body"||oc(i))&&(a=ll(t)),n){const h=Gs(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=Pp(i));const u=i&&!n&&!s?Xx(i,a):ri(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 jp(e){return Pn(e).position==="static"}function Zx(e,t){if(!ii(e)||Pn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ni(e)===r&&(r=r.ownerDocument.body),r}function Qx(e,t){const r=Jr(e);if(ul(e))return r;if(!ii(e)){let i=hs(e);for(;i&&!qo(i);){if(In(i)&&!jp(i))return i;i=hs(i)}return r}let n=Zx(e,t);for(;n&&GD(n)&&jp(n);)n=Zx(n,t);return n&&qo(n)&&jp(n)&&!Tp(n)?r:n||WD(e)||r}const i$=async function(e){const t=this.getOffsetParent||Qx,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 s$(e){return Pn(e).direction==="rtl"}const o$={convertOffsetParentRelativeRectToViewportRelativeRect:XD,getDocumentElement:ni,getClippingRect:t$,getOffsetParent:Qx,getElementRects:i$,getClientRects:JD,getDimensions:r$,getScale:Go,isElement:In,isRTL:s$};function a$(e,t){let r=null,n;const i=ni(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=sl(l),b=sl(i.clientWidth-(u+f)),_=sl(i.clientHeight-(l+h)),A=sl(u),N={rootMargin:-y+"px "+-b+"px "+-_+"px "+-A+"px",threshold:Xr(0,fs(1,c))||1};let R=!0;function F(L){const W=L[0].intersectionRatio;if(W!==c){if(!R)return o();W?o(!1,W):n=setTimeout(()=>{o(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(F,{...N,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,N)}r.observe(e)}return o(!0),s}function c$(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=Ip(e),l=i||s?[...u?ac(u):[],...ac(t)]:[];l.forEach(P=>{i&&P.addEventListener("scroll",r,{passive:!0}),s&&P.addEventListener("resize",r)});const f=u&&a?a$(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(P=>{let[N]=P;N&&N.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,_=c?Gs(e):null;c&&A();function A(){const P=Gs(e);_&&(P.x!==_.x||P.y!==_.y||P.width!==_.width||P.height!==_.height)&&r(),_=P,b=requestAnimationFrame(A)}return r(),()=>{var P;l.forEach(N=>{i&&N.removeEventListener("scroll",r),s&&N.removeEventListener("resize",r)}),f==null||f(),(P=y)==null||P.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const u$=UD,l$=zD,f$=BD,d$=qD,h$=LD,e4=$D,p$=VD,m$=(e,t,r)=>{const n=new Map,i={platform:o$,...r},s={...i.platform,_c:n};return DD(e,t,{...i,platform:s})};var fl=typeof document<"u"?te.useLayoutEffect:te.useEffect;function dl(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(!dl(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)&&!dl(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function t4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function r4(e,t){const r=t4(e);return Math.round(t*r)/r}function kp(e){const t=I.useRef(e);return fl(()=>{t.current=e}),t}function g$(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);dl(h,n)||y(n);const[b,_]=I.useState(null),[A,P]=I.useState(null),N=I.useCallback(M=>{M!==W.current&&(W.current=M,_(M))},[]),R=I.useCallback(M=>{M!==q.current&&(q.current=M,P(M))},[]),F=s||b,L=o||A,W=I.useRef(null),q=I.useRef(null),X=I.useRef(l),ie=c!=null,ae=kp(c),ce=kp(i),V=kp(u),$=I.useCallback(()=>{if(!W.current||!q.current)return;const M={placement:t,strategy:r,middleware:h};ce.current&&(M.platform=ce.current),m$(W.current,q.current,M).then(E=>{const O={...E,isPositioned:V.current!==!1};p.current&&!dl(X.current,O)&&(X.current=O,Y0.flushSync(()=>{f(O)}))})},[h,t,r,ce,V]);fl(()=>{u===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[u]);const p=I.useRef(!1);fl(()=>(p.current=!0,()=>{p.current=!1}),[]),fl(()=>{if(F&&(W.current=F),L&&(q.current=L),F&&L){if(ae.current)return ae.current(F,L,$);$()}},[F,L,$,ae,ie]);const d=I.useMemo(()=>({reference:W,floating:q,setReference:N,setFloating:R}),[N,R]),m=I.useMemo(()=>({reference:F,floating:L}),[F,L]),x=I.useMemo(()=>{const M={position:r,left:0,top:0};if(!m.floating)return M;const E=r4(m.floating,l.x),O=r4(m.floating,l.y);return a?{...M,transform:"translate("+E+"px, "+O+"px)",...t4(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:$,refs:d,elements:m,floatingStyles:x}),[l,$,d,m,x])}const v$=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?e4({element:n.current,padding:i}).fn(r):{}:n?e4({element:n,padding:i}).fn(r):{}}}},y$=(e,t)=>({...u$(e),options:[e,t]}),b$=(e,t)=>({...l$(e),options:[e,t]}),w$=(e,t)=>({...p$(e),options:[e,t]}),_$=(e,t)=>({...f$(e),options:[e,t]}),x$=(e,t)=>({...d$(e),options:[e,t]}),S$=(e,t)=>({...h$(e),options:[e,t]}),E$=(e,t)=>({...v$(e),options:[e,t]});var C$="Arrow",n4=I.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...s}=e;return w.jsx(Wt.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});n4.displayName=C$;var M$=n4;function T$(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,_=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return w.jsx(_.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,A$(i,...t)]}function A$(...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 Np(e){const[t,r]=I.useState(void 0);return ls(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;r({width:o,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Rp="Popper",[i4,hl]=T$(Rp),[O$,s4]=i4(Rp),o4=e=>{const{__scopePopper:t,children:r}=e,[n,i]=I.useState(null);return w.jsx(O$,{scope:t,anchor:n,onAnchorChange:i,children:r})};o4.displayName=Rp;var a4="PopperAnchor",c4=I.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=s4(a4,r),o=I.useRef(null),a=Qt(t,o);return I.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:w.jsx(Wt.div,{...i,ref:a})});c4.displayName=a4;var Dp="PopperContent",[I$,P$]=i4(Dp),u4=I.forwardRef((e,t)=>{var ye,pe,Ee,Se,Je,Ue;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:l=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:y="optimized",onPlaced:b,..._}=e,A=s4(Dp,r),[P,N]=I.useState(null),R=Qt(t,lt=>N(lt)),[F,L]=I.useState(null),W=Np(F),q=(W==null?void 0:W.width)??0,X=(W==null?void 0:W.height)??0,ie=n+(s!=="center"?"-"+s:""),ae=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ce=Array.isArray(u)?u:[u],V=ce.length>0,$={padding:ae,boundary:ce.filter(k$),altBoundary:V},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:M}=g$({strategy:"fixed",placement:ie,whileElementsMounted:(...lt)=>c$(...lt,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[y$({mainAxis:i+X,alignmentAxis:o}),c&&b$({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?w$():void 0,...$}),c&&_$({...$}),x$({...$,apply:({elements:lt,rects:ht,availableWidth:$e,availableHeight:mt})=>{const{width:_e,height:ge}=ht.reference,Ae=lt.floating.style;Ae.setProperty("--radix-popper-available-width",`${$e}px`),Ae.setProperty("--radix-popper-available-height",`${mt}px`),Ae.setProperty("--radix-popper-anchor-width",`${_e}px`),Ae.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),F&&E$({element:F,padding:a}),N$({arrowWidth:q,arrowHeight:X}),h&&S$({strategy:"referenceHidden",...$})]}),[E,O]=d4(m),C=gr(b);ls(()=>{x&&(C==null||C())},[x,C]);const g=(ye=M.arrow)==null?void 0:ye.x,v=(pe=M.arrow)==null?void 0:pe.y,j=((Ee=M.arrow)==null?void 0:Ee.centerOffset)!==0,[ee,se]=I.useState();return ls(()=>{P&&se(window.getComputedStyle(P).zIndex)},[P]),w.jsx("div",{ref:p.setFloating,"data-radix-popper-content-wrapper":"",style:{...d,transform:x?d.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(Se=M.transformOrigin)==null?void 0:Se.x,(Je=M.transformOrigin)==null?void 0:Je.y].join(" "),...((Ue=M.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:w.jsx(I$,{scope:r,placedSide:E,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:j,children:w.jsx(Wt.div,{"data-side":E,"data-align":O,..._,ref:R,style:{..._.style,animation:x?void 0:"none"}})})})});u4.displayName=Dp;var l4="PopperArrow",j$={top:"bottom",right:"left",bottom:"top",left:"right"},f4=I.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=P$(l4,n),o=j$[s.placedSide];return w.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:w.jsx(M$,{...i,ref:r,style:{...i.style,display:"block"}})})});f4.displayName=l4;function k$(e){return e!==null}var N$=e=>({name:"transformOrigin",options:e,fn(t){var A,P,N;const{placement:r,rects:n,middlewareData:i}=t,o=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=d4(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((P=i.arrow)==null?void 0:P.x)??0)+a/2,y=(((N=i.arrow)==null?void 0:N.y)??0)+c/2;let b="",_="";return u==="bottom"?(b=o?f:`${h}px`,_=`${-c}px`):u==="top"?(b=o?f:`${h}px`,_=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,_=o?f:`${y}px`):u==="left"&&(b=`${n.floating.width+c}px`,_=o?f:`${y}px`),{data:{x:b,y:_}}}});function d4(e){const[t,r="center"]=e.split("-");return[t,r]}var h4=o4,p4=c4,m4=u4,g4=f4,R$="Portal",v4=I.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=I.useState(!1);ls(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?$n.createPortal(w.jsx(Wt.div,{...n,ref:t}),o):null});v4.displayName=R$;function D$(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var jn=e=>{const{present:t,children:r}=e,n=$$(t),i=typeof r=="function"?r({present:n.isPresent}):I.Children.only(r),s=Qt(n.ref,B$(i));return typeof r=="function"||n.isPresent?I.cloneElement(i,{ref:s}):null};jn.displayName="Presence";function $$(e){const[t,r]=I.useState(),n=I.useRef({}),i=I.useRef(e),s=I.useRef("none"),o=e?"mounted":"unmounted",[a,c]=D$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const u=pl(n.current);s.current=a==="mounted"?u:"none"},[a]),ls(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=pl(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(l&&h!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),ls(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const _=pl(n.current).includes(y.animationName);if(y.target===t&&_&&(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=pl(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 pl(e){return(e==null?void 0:e.animationName)||"none"}function B$(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 cc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=L$({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=gr(r),c=I.useCallback(u=>{if(s){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else i(u)},[s,e,i,a]);return[o,c]}function L$({defaultProp:e,onChange:t}){const r=I.useState(e),[n]=r,i=I.useRef(n),s=gr(t);return I.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var F$="VisuallyHidden",y4=I.forwardRef((e,t)=>w.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}}));y4.displayName=F$;var U$=y4,[ml,FX]=Fo("Tooltip",[hl]),$p=hl(),b4="TooltipProvider",z$=700,w4="tooltip.open",[V$,_4]=ml(b4),x4=e=>{const{__scopeTooltip:t,delayDuration:r=z$,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)},[]),w.jsx(V$,{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})};x4.displayName=b4;var S4="Tooltip",[UX,gl]=ml(S4),Bp="TooltipTrigger",q$=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=gl(Bp,r),s=_4(Bp,r),o=$p(r),a=I.useRef(null),c=Qt(t,a,i.onTriggerChange),u=I.useRef(!1),l=I.useRef(!1),f=I.useCallback(()=>u.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),w.jsx(p4,{asChild:!0,...o,children:w.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)})})});q$.displayName=Bp;var G$="TooltipPortal",[zX,W$]=ml(G$,{forceMount:void 0}),Wo="TooltipContent",H$=I.forwardRef((e,t)=>{const r=W$(Wo,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=gl(Wo,e.__scopeTooltip);return w.jsx(jn,{present:n||o.open,children:o.disableHoverableContent?w.jsx(E4,{side:i,...s,ref:t}):w.jsx(K$,{side:i,...s,ref:t})})}),K$=I.forwardRef((e,t)=>{const r=gl(Wo,e.__scopeTooltip),n=_4(Wo,e.__scopeTooltip),i=I.useRef(null),s=Qt(t,i),[o,a]=I.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:f}=n,h=I.useCallback(()=>{a(null),f(!1)},[f]),y=I.useCallback((b,_)=>{const A=b.currentTarget,P={x:b.clientX,y:b.clientY},N=Z$(P,A.getBoundingClientRect()),R=Q$(P,N),F=eB(_.getBoundingClientRect()),L=rB([...R,...F]);a(L),f(!0)},[f]);return I.useEffect(()=>()=>h(),[h]),I.useEffect(()=>{if(c&&l){const b=A=>y(A,l),_=A=>y(A,c);return c.addEventListener("pointerleave",b),l.addEventListener("pointerleave",_),()=>{c.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",_)}}},[c,l,y,h]),I.useEffect(()=>{if(o){const b=_=>{const A=_.target,P={x:_.clientX,y:_.clientY},N=(c==null?void 0:c.contains(A))||(l==null?void 0:l.contains(A)),R=!tB(P,o);N?h():R&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),w.jsx(E4,{...e,ref:s})}),[X$,J$]=ml(S4,{isInside:!1}),E4=I.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=gl(Wo,r),u=$p(r),{onClose:l}=c;return I.useEffect(()=>(document.addEventListener(w4,l),()=>document.removeEventListener(w4,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]),w.jsx(_p,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:w.jsxs(m4,{"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:[w.jsx(Uo,{children:n}),w.jsx(X$,{scope:r,isInside:!0,children:w.jsx(U$,{id:c.contentId,role:"tooltip",children:i||n})})]})})});H$.displayName=Wo;var C4="TooltipArrow",Y$=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=$p(r);return J$(C4,r).isInside?null:w.jsx(g4,{...i,...n,ref:t})});Y$.displayName=C4;function Z$(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 Q$(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 eB(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 tB(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 rB(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),nB(t)}function nB(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 iB=x4,M4=I.createContext(void 0),sB=e=>{const{dir:t,children:r}=e;return w.jsx(M4.Provider,{value:t,children:r})};function Lp(e){const t=I.useContext(M4);return e||t||"ltr"}const oB=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],aB=["sky","mint","lime","yellow","amber"],cB=["gold","bronze"],uB=[...oB,...aB,...cB],lB=["gray",...["mauve","slate","sage","olive","sand"]];function fB(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 dB=["inherit","light","dark"],hB=[...uB,"gray"],pB=[...lB,"auto"],Dr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:dB,default:"inherit"},accentColor:{type:"enum",values:hB,default:"indigo"},grayColor:{type:"enum",values:pB,default:"auto"},panelBackground:{type:"enum",values:["solid","translucent"],default:"translucent"},radius:{type:"enum",values:["none","small","medium","large","full"],default:"medium"},scaling:{type:"enum",values:["90%","95%","100%","105%","110%"],default:"100%"}};function T4(e){return e==="gray"?"gray":fB(e)}const Ho=()=>{},vl=I.createContext(void 0);function mB(){const e=I.useContext(vl);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const yl=I.forwardRef((e,t)=>I.useContext(vl)===void 0?I.createElement(iB,null,I.createElement(sB,{dir:"ltr"},I.createElement(A4,{...e,ref:t}))):I.createElement(Fp,{...e,ref:t}));yl.displayName="Theme";const A4=I.forwardRef((e,t)=>{const{appearance:r=Dr.appearance.default,accentColor:n=Dr.accentColor.default,grayColor:i=Dr.grayColor.default,panelBackground:s=Dr.panelBackground.default,radius:o=Dr.radius.default,scaling:a=Dr.scaling.default,hasBackground:c=Dr.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,_]=I.useState(i);I.useEffect(()=>_(i),[i]);const[A,P]=I.useState(s);I.useEffect(()=>P(s),[s]);const[N,R]=I.useState(o);I.useEffect(()=>R(o),[o]);const[F,L]=I.useState(a);I.useEffect(()=>L(a),[a]);const W=I.memo(({appearance:X})=>I.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${X}';c.add('${X}');}catch(e){}})();`}}),()=>!0);W.displayName="ExplicitRootAppearanceScript",I.useEffect(()=>gB(r),[r]);const q=b==="auto"?T4(h):b;return I.createElement(I.Fragment,null,l!=="inherit"&&I.createElement(W,{appearance:l}),c&&I.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
49
54
|
:root, .light, .light-theme { --color-page-background: white; }
|
|
50
55
|
.dark, .dark-theme { --color-page-background: var(--${q}-1); }
|
|
51
56
|
body { background-color: var(--color-page-background); }
|
|
52
|
-
`}}),O.createElement(Ah,{...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:R,onScalingChange:L}))});M_.displayName="ThemeRoot";const Ah=O.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=O.useContext(Pu),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:Nr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:Nr.accentColor.default,grayColor:_=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:Nr.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:Nr.panelBackground.default,radius:A=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:Nr.radius.default,scaling:I=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:Nr.scaling.default,onAppearanceChange:P=jo,onAccentColorChange:R=jo,onGrayColorChange:F=jo,onPanelBackgroundChange:L=jo,onRadiusChange:H=jo,onScalingChange:q=jo,...X}=e,ne=u?Si:"div",ce=_==="auto"?E_(y):_,oe=e.appearance!==void 0&&e.appearance!=="inherit",V=e.grayColor!==void 0,$=!l&&(f===!0||f!==!1&&(oe||V));return O.createElement(Pu.Provider,{value:O.useMemo(()=>({appearance:h,accentColor:y,grayColor:_,resolvedGrayColor:ce,panelBackground:w,radius:A,scaling:I,onAppearanceChange:P,onAccentColorChange:R,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:H,onScalingChange:q}),[h,y,_,ce,w,A,I,P,R,F,L,H,q])},O.createElement(ne,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ce,"data-has-background":$?"true":"false","data-panel-background":w,"data-radius":A,"data-scaling":I,ref:t,...X,className:Wt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},X.className)}))});Ah.displayName="ThemeImpl";function _N(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 Ha={type:"enum",values:Nr.accentColor.values,default:void 0},Ru={type:"boolean",default:void 0};function yt(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 js=["0","1","2","3","4","5","6","7","8","9"],xN={p:{type:"enum",values:js,default:void 0,responsive:!0},px:{type:"enum",values:js,default:void 0,responsive:!0},py:{type:"enum",values:js,default:void 0,responsive:!0},pt:{type:"enum",values:js,default:void 0,responsive:!0},pr:{type:"enum",values:js,default:void 0,responsive:!0},pb:{type:"enum",values:js,default:void 0,responsive:!0},pl:{type:"enum",values:js,default:void 0,responsive:!0}};function SN(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 EN(e){return[yt(e.p,"rt-r-p"),yt(e.px,"rt-r-px"),yt(e.py,"rt-r-py"),yt(e.pt,"rt-r-pt"),yt(e.pr,"rt-r-pr"),yt(e.pb,"rt-r-pb"),yt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const MN=["static","relative","absolute","fixed","sticky"],Wa=["auto","0","50%","100%"],C_=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],wr={...xN,position:{type:"enum",values:MN,default:void 0,responsive:!0},inset:{type:"enum",values:Wa,default:void 0,responsive:!0},top:{type:"enum",values:Wa,default:void 0,responsive:!0},right:{type:"enum",values:Wa,default:void 0,responsive:!0},bottom:{type:"enum",values:Wa,default:void 0,responsive:!0},left:{type:"enum",values:Wa,default:void 0,responsive:!0},width:{type:"enum",values:C_,default:void 0,responsive:!0},height:{type:"enum",values:C_,default:void 0,responsive:!0},shrink:{type:"enum",values:["0","1"],default:void 0,responsive:!0},grow:{type:"enum",values:["0","1"],default:void 0,responsive:!0}};function CN(e){const{rest:t,...r}=SN(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 AN(e){return[EN(e),yt(e.position,"rt-r-position"),yt(e.shrink,"rt-r-fs"),yt(e.grow,"rt-r-fg"),yt(e.width,"rt-r-w"),yt(e.height,"rt-r-h"),yt(e.inset,"rt-r-inset"),yt(e.top,"rt-r-top"),yt(e.bottom,"rt-r-bottom"),yt(e.left,"rt-r-left"),yt(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"],Ns={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 Po(e){const{m:t=Ns.m.default,mx:r=Ns.mx.default,my:n=Ns.my.default,mt:i=Ns.mt.default,mr:s=Ns.mr.default,mb:o=Ns.mb.default,ml:a=Ns.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function No(e){return[yt(e.m,"rt-r-m"),yt(e.mx,"rt-r-mx"),yt(e.my,"rt-r-my"),yt(e.mt,"rt-r-mt"),yt(e.mr,"rt-r-mr"),yt(e.mb,"rt-r-mb"),yt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const Th={type:"enum",values:Nr.radius.values,default:void 0},Ro={display:{type:"enum",values:["none","inline-flex","flex"],default:"flex",responsive:!0},direction:{type:"enum",values:["row","column","row-reverse","column-reverse"],default:void 0,responsive:!0},align:{type:"enum",values:["start","center","end","baseline","stretch"],default:void 0,responsive:!0},justify:{type:"enum",values:["start","center","end","between"],default:"start",responsive:!0},wrap:{type:"enum",values:["nowrap","wrap","wrap-reverse"],default:void 0,responsive:!0},gap:{type:"enum",values:["0","1","2","3","4","5","6","7","8","9"],default:void 0,responsive:!0}},A_=O.forwardRef((e,t)=>{const{rest:r,...n}=Po(e),{rest:i,...s}=CN(r),{className:o,asChild:a,display:c=Ro.display.default,direction:u=Ro.direction.default,align:l=Ro.align.default,justify:f=Ro.justify.default,wrap:h=Ro.wrap.default,gap:y=Ro.gap.default,..._}=i,w=a?Si:"div";return O.createElement(w,{..._,ref:t,className:Wt("rt-Flex",o,yt(c,"rt-r-display"),yt(u,"rt-r-fd"),yt(l,"rt-r-ai"),yt(f,"rt-r-jc",{between:"space-between"}),yt(h,"rt-r-fw"),yt(y,"rt-r-gap"),AN(s),No(n))})});A_.displayName="Flex";function T_(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 Oh="Checkbox",[TN,LW]=Mo(Oh),[ON,IN]=TN(Oh),O_=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),_=Zt(t,F=>y(F)),w=O.useRef(!1),A=h?l||!!h.closest("form"):!0,[I=!1,P]=Ga({prop:i,defaultProp:s,onChange:u}),R=O.useRef(I);return O.useEffect(()=>{const F=h==null?void 0:h.form;if(F){const L=()=>P(R.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[h,P]),b.jsxs(ON,{scope:r,state:I,disabled:a,children:[b.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":is(I)?"mixed":I,"aria-required":o,"data-state":j_(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:_,onKeyDown:tt(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:tt(e.onClick,F=>{P(L=>is(L)?!0:!L),A&&(w.current=F.isPropagationStopped(),w.current||F.stopPropagation())})}),A&&b.jsx(kN,{control:h,bubbles:!w.current,name:n,value:c,checked:I,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:is(s)?!1:s})]})});O_.displayName=Oh;var I_="CheckboxIndicator",k_=O.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=IN(I_,r);return b.jsx(xn,{present:n||is(s.state)||s.state===!0,children:b.jsx(Gt.span,{"data-state":j_(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});k_.displayName=I_;var kN=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=O.useRef(null),a=T_(r),c=_h(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=is(r),y.call(l,is(r)?!1:r),l.dispatchEvent(_)}},[a,r,n]);const u=O.useRef(is(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 is(e){return e==="indeterminate"}function j_(e){return is(e)?"indeterminate":e?"checked":"unchecked"}var jN=O_,PN=k_;const Du={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:Ha,highContrast:Ru},$u=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"})));$u.displayName="ThickCheckIcon";const NN=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"})));NN.displayName="ChevronDownIcon";const P_=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"})));P_.displayName="ThickChevronRightIcon";const RN=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"})));RN.displayName="InfoCircledIcon";const Bu=O.forwardRef((e,t)=>{const{rest:r,...n}=Po(e),{className:i,style:s,size:o=Du.size.default,variant:a=Du.variant.default,color:c=Du.color.default,highContrast:u=Du.highContrast.default,...l}=r;return O.createElement("span",{className:Wt("rt-CheckboxRoot",i,yt(o,"rt-r-size"),No(n)),style:s},O.createElement(jN,{"data-accent-color":c,...l,ref:t,className:Wt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},O.createElement(PN,{className:"rt-CheckboxIndicator"},O.createElement($u,{className:"rt-CheckboxIndicatorIcon"}))))});Bu.displayName="Checkbox";function DN(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,$N(i,...t)]}function $N(...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 N_(e){const t=e+"CollectionProvider",[r,n]=DN(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:_,children:w}=y,A=te.useRef(null),I=te.useRef(new Map).current;return b.jsx(i,{scope:_,itemMap:I,collectionRef:A,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=te.forwardRef((y,_)=>{const{scope:w,children:A}=y,I=s(a,w),P=Zt(_,I.collectionRef);return b.jsx(Si,{ref:P,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=te.forwardRef((y,_)=>{const{scope:w,children:A,...I}=y,P=te.useRef(null),R=Zt(_,P),F=s(u,w);return te.useEffect(()=>(F.itemMap.set(P,{ref:P,...I}),()=>void F.itemMap.delete(P))),b.jsx(Si,{[l]:"",ref:R,children:A})});f.displayName=u;function h(y){const _=s(e+"CollectionConsumer",y);return te.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 BN(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,LN(i,...t)]}function LN(...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 Ih="rovingFocusGroup.onEntryFocus",UN={bubbles:!1,cancelable:!0},Lu="RovingFocusGroup",[kh,R_,FN]=N_(Lu),[zN,D_]=BN(Lu,[FN]),[VN,qN]=zN(Lu),$_=O.forwardRef((e,t)=>b.jsx(kh.Provider,{scope:e.__scopeRovingFocusGroup,children:b.jsx(kh.Slot,{scope:e.__scopeRovingFocusGroup,children:b.jsx(GN,{...e,ref:t})})}));$_.displayName=Lu;var GN=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=Zt(t,h),_=Ch(s),[w=null,A]=Ga({prop:o,defaultProp:a,onChange:c}),[I,P]=O.useState(!1),R=mr(u),F=R_(r),L=O.useRef(!1),[H,q]=O.useState(0);return O.useEffect(()=>{const X=h.current;if(X)return X.addEventListener(Ih,R),()=>X.removeEventListener(Ih,R)},[R]),b.jsx(VN,{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:tt(e.onMouseDown,()=>{L.current=!0}),onFocus:tt(e.onFocus,X=>{const ne=!L.current;if(X.target===X.currentTarget&&ne&&!I){const ce=new CustomEvent(Ih,UN);if(X.currentTarget.dispatchEvent(ce),!ce.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);U_(d,l)}}L.current=!1}),onBlur:tt(e.onBlur,()=>P(!1))})})}),B_="RovingFocusGroupItem",L_=O.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=Fa(),c=s||a,u=qN(B_,r),l=u.currentTabStopId===c,f=R_(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return O.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),b.jsx(kh.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:tt(e.onMouseDown,_=>{n?u.onItemFocus(c):_.preventDefault()}),onFocus:tt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:tt(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){u.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const w=KN(_,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?XN(I,P+1):I.slice(P+1)}setTimeout(()=>U_(I))}})})})});L_.displayName=B_;var HN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WN(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function KN(e,t,r){const n=WN(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return HN[n]}function U_(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function XN(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var YN=$_,JN=L_;function ZN(e,[t,r]){return Math.min(r,Math.max(t,e))}var jh=0;function QN(){O.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??F_()),document.body.insertAdjacentElement("beforeend",e[1]??F_()),jh++,()=>{jh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),jh--}},[])}function F_(){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 Ph="focusScope.autoFocusOnMount",Nh="focusScope.autoFocusOnUnmount",z_={bubbles:!1,cancelable:!0},eR="FocusScope",V_=O.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=O.useState(null),u=mr(i),l=mr(s),f=O.useRef(null),h=Zt(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(R){if(y.paused||!a)return;const F=R.target;a.contains(F)?f.current=F:ss(f.current,{select:!0})},A=function(R){if(y.paused||!a)return;const F=R.relatedTarget;F!==null&&(a.contains(F)||ss(f.current,{select:!0}))},I=function(R){if(document.activeElement===document.body)for(const L of R)L.removedNodes.length>0&&ss(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){H_.add(y);const w=document.activeElement;if(!a.contains(w)){const I=new CustomEvent(Ph,z_);a.addEventListener(Ph,u),a.dispatchEvent(I),I.defaultPrevented||(tR(oR(q_(a)),{select:!0}),document.activeElement===w&&ss(a))}return()=>{a.removeEventListener(Ph,u),setTimeout(()=>{const I=new CustomEvent(Nh,z_);a.addEventListener(Nh,l),a.dispatchEvent(I),I.defaultPrevented||ss(w??document.body,{select:!0}),a.removeEventListener(Nh,l),H_.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,[R,F]=rR(P);R&&F?!w.shiftKey&&I===F?(w.preventDefault(),r&&ss(R,{select:!0})):w.shiftKey&&I===R&&(w.preventDefault(),r&&ss(F,{select:!0})):I===P&&w.preventDefault()}},[r,n,y.paused]);return b.jsx(Gt.div,{tabIndex:-1,...o,ref:h,onKeyDown:_})});V_.displayName=eR;function tR(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ss(n,{select:t}),document.activeElement!==r)return}function rR(e){const t=q_(e),r=G_(t,e),n=G_(t.reverse(),e);return[r,n]}function q_(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 G_(e,t){for(const r of e)if(!nR(r,{upTo:t}))return r}function nR(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 iR(e){return e instanceof HTMLInputElement&&"select"in e}function ss(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&iR(e)&&t&&e.select()}}var H_=sR();function sR(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=W_(e,t),e.unshift(t)},remove(t){var r;e=W_(e,t),(r=e[0])==null||r.resume()}}}function W_(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function oR(e){return e.filter(t=>t.tagName!=="A")}var aR=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Do=new WeakMap,Uu=new WeakMap,Fu={},Rh=0,K_=function(e){return e&&(e.host||K_(e.parentNode))},cR=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=K_(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})},uR=function(e,t,r,n){var i=cR(t,Array.isArray(e)?e:[e]);Fu[r]||(Fu[r]=new WeakMap);var s=Fu[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=(Do.get(h)||0)+1,A=(s.get(h)||0)+1;Do.set(h,w),s.set(h,A),o.push(h),w===1&&_&&Uu.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(),Rh++,function(){o.forEach(function(f){var h=Do.get(f)-1,y=s.get(f)-1;Do.set(f,h),s.set(f,y),h||(Uu.has(f)||f.removeAttribute(n),Uu.delete(f)),y||f.removeAttribute(r)}),Rh--,Rh||(Do=new WeakMap,Do=new WeakMap,Uu=new WeakMap,Fu={})}},lR=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||aR(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),uR(n,i,r,"aria-hidden")):function(){return null}},Xn=function(){return Xn=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},Xn.apply(this,arguments)};function X_(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 fR(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var zu="right-scroll-bar-position",Vu="width-before-scroll-bar",dR="with-scroll-bars-hidden",hR="--removed-body-scroll-bar-size";function Dh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pR(e,t){var r=te.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var mR=typeof window<"u"?O.useLayoutEffect:O.useEffect,Y_=new WeakMap;function gR(e,t){var r=pR(t||null,function(n){return e.forEach(function(i){return Dh(i,n)})});return mR(function(){var n=Y_.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||Dh(a,null)}),s.forEach(function(a){i.has(a)||Dh(a,o)})}Y_.set(r,e)},[e]),r}function vR(e){return e}function yR(e,t){t===void 0&&(t=vR);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 bR(e){e===void 0&&(e={});var t=yR(null);return t.options=Xn({async:!0,ssr:!1},e),t}var J_=function(e){var t=e.sideCar,r=X_(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,Xn({},r))};J_.isSideCarExport=!0;function wR(e,t){return e.useMedium(t),J_}var Z_=bR(),$h=function(){},qu=O.forwardRef(function(e,t){var r=O.useRef(null),n=O.useState({onScrollCapture:$h,onWheelCapture:$h,onTouchMoveCapture:$h}),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,R=X_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=h,L=gR([r,t]),H=Xn(Xn({},R),i);return O.createElement(O.Fragment,null,l&&O.createElement(F,{sideCar:Z_,removeScrollBar:u,shards:f,noIsolation:y,inert:_,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:P}),o?O.cloneElement(O.Children.only(a),Xn(Xn({},H),{ref:L})):O.createElement(I,Xn({},H,{className:c,ref:L}),a))});qu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},qu.classNames={fullWidth:Vu,zeroRight:zu};var Q_,_R=function(){if(Q_)return Q_;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function xR(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=_R();return t&&e.setAttribute("nonce",t),e}function SR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ER(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var MR=function(){var e=0,t=null;return{add:function(r){e==0&&(t=xR())&&(SR(t,r),ER(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},CR=function(){var e=MR();return function(t,r){O.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},e4=function(){var e=CR(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},AR={left:0,top:0,right:0,gap:0},Bh=function(e){return parseInt(e||"",10)||0},TR=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[Bh(r),Bh(n),Bh(i)]},OR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return AR;var t=TR(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])}},IR=e4(),$o="data-scroll-locked",kR=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(
|
|
57
|
+
`}}),I.createElement(Fp,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:A,radius:N,scaling:F,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:_,onPanelBackgroundChange:P,onRadiusChange:R,onScalingChange:L}))});A4.displayName="ThemeRoot";const Fp=I.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=I.useContext(vl),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:Dr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:Dr.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:Dr.grayColor.default,panelBackground:_=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:Dr.panelBackground.default,radius:A=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:Dr.radius.default,scaling:P=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:Dr.scaling.default,onAppearanceChange:N=Ho,onAccentColorChange:R=Ho,onGrayColorChange:F=Ho,onPanelBackgroundChange:L=Ho,onRadiusChange:W=Ho,onScalingChange:q=Ho,...X}=e,ie=u?ki:"div",ae=b==="auto"?T4(y):b,ce=e.appearance!==void 0&&e.appearance!=="inherit",V=e.grayColor!==void 0,$=!l&&(f===!0||f!==!1&&(ce||V));return I.createElement(vl.Provider,{value:I.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:ae,panelBackground:_,radius:A,scaling:P,onAppearanceChange:N,onAccentColorChange:R,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:W,onScalingChange:q}),[h,y,b,ae,_,A,P,N,R,F,L,W,q])},I.createElement(ie,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ae,"data-has-background":$?"true":"false","data-panel-background":_,"data-radius":A,"data-scaling":P,ref:t,...X,className:Kt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},X.className)}))});Fp.displayName="ThemeImpl";function gB(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 uc={type:"enum",values:Dr.accentColor.values,default:void 0},bl={type:"boolean",default:void 0};function bt(e,t="",r){var n,i,s,o;const a=[];if(typeof e=="object"){for(const c of Object.keys(e))if(c in e){const u=(n=e[c])===null||n===void 0?void 0:n.toString(),l=u==null?void 0:u.startsWith("-"),f=t===""?"":"-",h=l?`-${t}`:t,y=l?u==null?void 0:u.substring(1):u;if(y===void 0)continue;const b=(i=r==null?void 0:r[y])!==null&&i!==void 0?i:y,_=c==="initial"?`${h}${f}${b}`:`${c}:${h}${f}${b}`;a.push(_)}}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 Ws=["0","1","2","3","4","5","6","7","8","9"],vB={p:{type:"enum",values:Ws,default:void 0,responsive:!0},px:{type:"enum",values:Ws,default:void 0,responsive:!0},py:{type:"enum",values:Ws,default:void 0,responsive:!0},pt:{type:"enum",values:Ws,default:void 0,responsive:!0},pr:{type:"enum",values:Ws,default:void 0,responsive:!0},pb:{type:"enum",values:Ws,default:void 0,responsive:!0},pl:{type:"enum",values:Ws,default:void 0,responsive:!0}};function yB(e){const{p:t=_r.p.default,px:r=_r.px.default,py:n=_r.py.default,pt:i=_r.pt.default,pr:s=_r.pr.default,pb:o=_r.pb.default,pl:a=_r.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function bB(e){return[bt(e.p,"rt-r-p"),bt(e.px,"rt-r-px"),bt(e.py,"rt-r-py"),bt(e.pt,"rt-r-pt"),bt(e.pr,"rt-r-pr"),bt(e.pb,"rt-r-pb"),bt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const wB=["static","relative","absolute","fixed","sticky"],lc=["auto","0","50%","100%"],O4=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],_r={...vB,position:{type:"enum",values:wB,default:void 0,responsive:!0},inset:{type:"enum",values:lc,default:void 0,responsive:!0},top:{type:"enum",values:lc,default:void 0,responsive:!0},right:{type:"enum",values:lc,default:void 0,responsive:!0},bottom:{type:"enum",values:lc,default:void 0,responsive:!0},left:{type:"enum",values:lc,default:void 0,responsive:!0},width:{type:"enum",values:O4,default:void 0,responsive:!0},height:{type:"enum",values:O4,default:void 0,responsive:!0},shrink:{type:"enum",values:["0","1"],default:void 0,responsive:!0},grow:{type:"enum",values:["0","1"],default:void 0,responsive:!0}};function _B(e){const{rest:t,...r}=yB(e),{position:n=_r.position.default,width:i=_r.width.default,height:s=_r.height.default,inset:o=_r.inset.default,top:a=_r.top.default,bottom:c=_r.bottom.default,left:u=_r.left.default,right:l=_r.right.default,shrink:f=_r.shrink.default,grow:h=_r.grow.default,...y}=t;return{...r,position:n,width:i,height:s,inset:o,top:a,bottom:c,left:u,right:l,shrink:f,grow:h,rest:y}}function xB(e){return[bB(e),bt(e.position,"rt-r-position"),bt(e.shrink,"rt-r-fs"),bt(e.grow,"rt-r-fg"),bt(e.width,"rt-r-w"),bt(e.height,"rt-r-h"),bt(e.inset,"rt-r-inset"),bt(e.top,"rt-r-top"),bt(e.bottom,"rt-r-bottom"),bt(e.left,"rt-r-left"),bt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Hs=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Ks={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 Ko(e){const{m:t=Ks.m.default,mx:r=Ks.mx.default,my:n=Ks.my.default,mt:i=Ks.mt.default,mr:s=Ks.mr.default,mb:o=Ks.mb.default,ml:a=Ks.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function Xo(e){return[bt(e.m,"rt-r-m"),bt(e.mx,"rt-r-mx"),bt(e.my,"rt-r-my"),bt(e.mt,"rt-r-mt"),bt(e.mr,"rt-r-mr"),bt(e.mb,"rt-r-mb"),bt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const Up={type:"enum",values:Dr.radius.values,default:void 0},Jo={display:{type:"enum",values:["none","inline-flex","flex"],default:"flex",responsive:!0},direction:{type:"enum",values:["row","column","row-reverse","column-reverse"],default:void 0,responsive:!0},align:{type:"enum",values:["start","center","end","baseline","stretch"],default:void 0,responsive:!0},justify:{type:"enum",values:["start","center","end","between"],default:"start",responsive:!0},wrap:{type:"enum",values:["nowrap","wrap","wrap-reverse"],default:void 0,responsive:!0},gap:{type:"enum",values:["0","1","2","3","4","5","6","7","8","9"],default:void 0,responsive:!0}},I4=I.forwardRef((e,t)=>{const{rest:r,...n}=Ko(e),{rest:i,...s}=_B(r),{className:o,asChild:a,display:c=Jo.display.default,direction:u=Jo.direction.default,align:l=Jo.align.default,justify:f=Jo.justify.default,wrap:h=Jo.wrap.default,gap:y=Jo.gap.default,...b}=i,_=a?ki:"div";return I.createElement(_,{...b,ref:t,className:Kt("rt-Flex",o,bt(c,"rt-r-display"),bt(u,"rt-r-fd"),bt(l,"rt-r-ai"),bt(f,"rt-r-jc",{between:"space-between"}),bt(h,"rt-r-fw"),bt(y,"rt-r-gap"),xB(s),Xo(n))})});I4.displayName="Flex";function P4(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 zp="Checkbox",[SB,rJ]=Fo(zp),[EB,CB]=SB(zp),j4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,F=>y(F)),_=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,N]=cc({prop:i,defaultProp:s,onChange:u}),R=I.useRef(P);return I.useEffect(()=>{const F=h==null?void 0:h.form;if(F){const L=()=>N(R.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[h,N]),w.jsxs(EB,{scope:r,state:P,disabled:a,children:[w.jsx(Wt.button,{type:"button",role:"checkbox","aria-checked":ps(P)?"mixed":P,"aria-required":o,"data-state":R4(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:tt(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:tt(e.onClick,F=>{N(L=>ps(L)?!0:!L),A&&(_.current=F.isPropagationStopped(),_.current||F.stopPropagation())})}),A&&w.jsx(MB,{control:h,bubbles:!_.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:ps(s)?!1:s})]})});j4.displayName=zp;var k4="CheckboxIndicator",N4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=CB(k4,r);return w.jsx(jn,{present:n||ps(s.state)||s.state===!0,children:w.jsx(Wt.span,{"data-state":R4(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});N4.displayName=k4;var MB=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=I.useRef(null),a=P4(r),c=Np(t);I.useEffect(()=>{const l=o.current,f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==r&&y){const b=new Event("click",{bubbles:n});l.indeterminate=ps(r),y.call(l,ps(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=I.useRef(ps(r)?!1:r);return w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...s,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ps(e){return e==="indeterminate"}function R4(e){return ps(e)?"indeterminate":e?"checked":"unchecked"}var TB=j4,AB=N4;const wl={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:uc,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 OB=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"})));OB.displayName="ChevronDownIcon";const D4=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"})));D4.displayName="ThickChevronRightIcon";const IB=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"})));IB.displayName="InfoCircledIcon";const xl=I.forwardRef((e,t)=>{const{rest:r,...n}=Ko(e),{className:i,style:s,size:o=wl.size.default,variant:a=wl.variant.default,color:c=wl.color.default,highContrast:u=wl.highContrast.default,...l}=r;return I.createElement("span",{className:Kt("rt-CheckboxRoot",i,bt(o,"rt-r-size"),Xo(n)),style:s},I.createElement(TB,{"data-accent-color":c,...l,ref:t,className:Kt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},I.createElement(AB,{className:"rt-CheckboxIndicator"},I.createElement(_l,{className:"rt-CheckboxIndicatorIcon"}))))});xl.displayName="Checkbox";function PB(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,_=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return w.jsx(_.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,jB(i,...t)]}function jB(...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 $4(e){const t=e+"CollectionProvider",[r,n]=PB(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:_}=y,A=te.useRef(null),P=te.useRef(new Map).current;return w.jsx(i,{scope:b,itemMap:P,collectionRef:A,children:_})};o.displayName=t;const a=e+"CollectionSlot",c=te.forwardRef((y,b)=>{const{scope:_,children:A}=y,P=s(a,_),N=Qt(b,P.collectionRef);return w.jsx(ki,{ref:N,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=te.forwardRef((y,b)=>{const{scope:_,children:A,...P}=y,N=te.useRef(null),R=Qt(b,N),F=s(u,_);return te.useEffect(()=>(F.itemMap.set(N,{ref:N,...P}),()=>void F.itemMap.delete(N))),w.jsx(ki,{[l]:"",ref:R,children:A})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return te.useCallback(()=>{const A=b.collectionRef.current;if(!A)return[];const P=Array.from(A.querySelectorAll(`[${l}]`));return Array.from(b.itemMap.values()).sort((F,L)=>P.indexOf(F.ref.current)-P.indexOf(L.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,n]}function kB(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,_=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return w.jsx(_.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,NB(i,...t)]}function NB(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Vp="rovingFocusGroup.onEntryFocus",RB={bubbles:!1,cancelable:!0},Sl="RovingFocusGroup",[qp,B4,DB]=$4(Sl),[$B,L4]=kB(Sl,[DB]),[BB,LB]=$B(Sl),F4=I.forwardRef((e,t)=>w.jsx(qp.Provider,{scope:e.__scopeRovingFocusGroup,children:w.jsx(qp.Slot,{scope:e.__scopeRovingFocusGroup,children:w.jsx(FB,{...e,ref:t})})}));F4.displayName=Sl;var FB=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:l=!1,...f}=e,h=I.useRef(null),y=Qt(t,h),b=Lp(s),[_=null,A]=cc({prop:o,defaultProp:a,onChange:c}),[P,N]=I.useState(!1),R=gr(u),F=B4(r),L=I.useRef(!1),[W,q]=I.useState(0);return I.useEffect(()=>{const X=h.current;if(X)return X.addEventListener(Vp,R),()=>X.removeEventListener(Vp,R)},[R]),w.jsx(BB,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:_,onItemFocus:I.useCallback(X=>A(X),[A]),onItemShiftTab:I.useCallback(()=>N(!0),[]),onFocusableItemAdd:I.useCallback(()=>q(X=>X+1),[]),onFocusableItemRemove:I.useCallback(()=>q(X=>X-1),[]),children:w.jsx(Wt.div,{tabIndex:P||W===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:tt(e.onMouseDown,()=>{L.current=!0}),onFocus:tt(e.onFocus,X=>{const ie=!L.current;if(X.target===X.currentTarget&&ie&&!P){const ae=new CustomEvent(Vp,RB);if(X.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const ce=F().filter(m=>m.focusable),V=ce.find(m=>m.active),$=ce.find(m=>m.id===_),d=[V,$,...ce].filter(Boolean).map(m=>m.ref.current);V4(d,l)}}L.current=!1}),onBlur:tt(e.onBlur,()=>N(!1))})})}),U4="RovingFocusGroupItem",z4=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=ic(),c=s||a,u=LB(U4,r),l=u.currentTabStopId===c,f=B4(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return I.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),w.jsx(qp.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:w.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 _=VB(b,u.orientation,u.dir);if(_!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let P=f().filter(N=>N.focusable).map(N=>N.ref.current);if(_==="last")P.reverse();else if(_==="prev"||_==="next"){_==="prev"&&P.reverse();const N=P.indexOf(b.currentTarget);P=u.loop?qB(P,N+1):P.slice(N+1)}setTimeout(()=>V4(P))}})})})});z4.displayName=U4;var UB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function zB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function VB(e,t,r){const n=zB(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return UB[n]}function V4(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function qB(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var GB=F4,WB=z4;function HB(e,[t,r]){return Math.min(r,Math.max(t,e))}var Gp=0;function KB(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??q4()),document.body.insertAdjacentElement("beforeend",e[1]??q4()),Gp++,()=>{Gp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Gp--}},[])}function q4(){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 Wp="focusScope.autoFocusOnMount",Hp="focusScope.autoFocusOnUnmount",G4={bubbles:!1,cancelable:!0},XB="FocusScope",W4=I.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=I.useState(null),u=gr(i),l=gr(s),f=I.useRef(null),h=Qt(t,_=>c(_)),y=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(n){let _=function(R){if(y.paused||!a)return;const F=R.target;a.contains(F)?f.current=F:ms(f.current,{select:!0})},A=function(R){if(y.paused||!a)return;const F=R.relatedTarget;F!==null&&(a.contains(F)||ms(f.current,{select:!0}))},P=function(R){if(document.activeElement===document.body)for(const L of R)L.removedNodes.length>0&&ms(a)};document.addEventListener("focusin",_),document.addEventListener("focusout",A);const N=new MutationObserver(P);return a&&N.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",A),N.disconnect()}}},[n,a,y.paused]),I.useEffect(()=>{if(a){X4.add(y);const _=document.activeElement;if(!a.contains(_)){const P=new CustomEvent(Wp,G4);a.addEventListener(Wp,u),a.dispatchEvent(P),P.defaultPrevented||(JB(tL(H4(a)),{select:!0}),document.activeElement===_&&ms(a))}return()=>{a.removeEventListener(Wp,u),setTimeout(()=>{const P=new CustomEvent(Hp,G4);a.addEventListener(Hp,l),a.dispatchEvent(P),P.defaultPrevented||ms(_??document.body,{select:!0}),a.removeEventListener(Hp,l),X4.remove(y)},0)}}},[a,u,l,y]);const b=I.useCallback(_=>{if(!r&&!n||y.paused)return;const A=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,P=document.activeElement;if(A&&P){const N=_.currentTarget,[R,F]=YB(N);R&&F?!_.shiftKey&&P===F?(_.preventDefault(),r&&ms(R,{select:!0})):_.shiftKey&&P===R&&(_.preventDefault(),r&&ms(F,{select:!0})):P===N&&_.preventDefault()}},[r,n,y.paused]);return w.jsx(Wt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});W4.displayName=XB;function JB(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ms(n,{select:t}),document.activeElement!==r)return}function YB(e){const t=H4(e),r=K4(t,e),n=K4(t.reverse(),e);return[r,n]}function H4(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 K4(e,t){for(const r of e)if(!ZB(r,{upTo:t}))return r}function ZB(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 QB(e){return e instanceof HTMLInputElement&&"select"in e}function ms(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&QB(e)&&t&&e.select()}}var X4=eL();function eL(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=J4(e,t),e.unshift(t)},remove(t){var r;e=J4(e,t),(r=e[0])==null||r.resume()}}}function J4(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function tL(e){return e.filter(t=>t.tagName!=="A")}var rL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yo=new WeakMap,El=new WeakMap,Cl={},Kp=0,Y4=function(e){return e&&(e.host||Y4(e.parentNode))},nL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Y4(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})},iL=function(e,t,r,n){var i=nL(t,Array.isArray(e)?e:[e]);Cl[r]||(Cl[r]=new WeakMap);var s=Cl[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",_=(Yo.get(h)||0)+1,A=(s.get(h)||0)+1;Yo.set(h,_),s.set(h,A),o.push(h),_===1&&b&&El.set(h,!0),A===1&&h.setAttribute(r,"true"),b||h.setAttribute(n,"true")}catch(P){console.error("aria-hidden: cannot operate on ",h,P)}})};return l(t),a.clear(),Kp++,function(){o.forEach(function(f){var h=Yo.get(f)-1,y=s.get(f)-1;Yo.set(f,h),s.set(f,y),h||(El.has(f)||f.removeAttribute(n),El.delete(f)),y||f.removeAttribute(r)}),Kp--,Kp||(Yo=new WeakMap,Yo=new WeakMap,El=new WeakMap,Cl={})}},sL=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||rL(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),iL(n,i,r,"aria-hidden")):function(){return null}},si=function(){return si=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},si.apply(this,arguments)};function Z4(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 oL(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Ml="right-scroll-bar-position",Tl="width-before-scroll-bar",aL="with-scroll-bars-hidden",cL="--removed-body-scroll-bar-size";function Xp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function uL(e,t){var r=te.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var lL=typeof window<"u"?I.useLayoutEffect:I.useEffect,Q4=new WeakMap;function fL(e,t){var r=uL(t||null,function(n){return e.forEach(function(i){return Xp(i,n)})});return lL(function(){var n=Q4.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||Xp(a,null)}),s.forEach(function(a){i.has(a)||Xp(a,o)})}Q4.set(r,e)},[e]),r}function dL(e){return e}function hL(e,t){t===void 0&&(t=dL);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 pL(e){e===void 0&&(e={});var t=hL(null);return t.options=si({async:!0,ssr:!1},e),t}var e6=function(e){var t=e.sideCar,r=Z4(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,si({},r))};e6.isSideCarExport=!0;function mL(e,t){return e.useMedium(t),e6}var t6=pL(),Jp=function(){},Al=I.forwardRef(function(e,t){var r=I.useRef(null),n=I.useState({onScrollCapture:Jp,onWheelCapture:Jp,onTouchMoveCapture:Jp}),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,_=e.allowPinchZoom,A=e.as,P=A===void 0?"div":A,N=e.gapMode,R=Z4(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=h,L=fL([r,t]),W=si(si({},R),i);return I.createElement(I.Fragment,null,l&&I.createElement(F,{sideCar:t6,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!_,lockRef:r,gapMode:N}),o?I.cloneElement(I.Children.only(a),si(si({},W),{ref:L})):I.createElement(P,si({},W,{className:c,ref:L}),a))});Al.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Al.classNames={fullWidth:Tl,zeroRight:Ml};var r6,gL=function(){if(r6)return r6;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vL(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=gL();return t&&e.setAttribute("nonce",t),e}function yL(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function bL(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var wL=function(){var e=0,t=null;return{add:function(r){e==0&&(t=vL())&&(yL(t,r),bL(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_L=function(){var e=wL();return function(t,r){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},n6=function(){var e=_L(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},xL={left:0,top:0,right:0,gap:0},Yp=function(e){return parseInt(e||"",10)||0},SL=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[Yp(r),Yp(n),Yp(i)]},EL=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return xL;var t=SL(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])}},CL=n6(),Zo="data-scroll-locked",ML=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(aL,` {
|
|
54
59
|
overflow: hidden `).concat(n,`;
|
|
55
60
|
padding-right: `).concat(a,"px ").concat(n,`;
|
|
56
61
|
}
|
|
57
|
-
body[`).concat(
|
|
62
|
+
body[`).concat(Zo,`] {
|
|
58
63
|
overflow: hidden `).concat(n,`;
|
|
59
64
|
overscroll-behavior: contain;
|
|
60
65
|
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
@@ -67,34 +72,29 @@ body { background-color: var(--color-page-background); }
|
|
|
67
72
|
`),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
68
73
|
}
|
|
69
74
|
|
|
70
|
-
.`).concat(
|
|
75
|
+
.`).concat(Ml,` {
|
|
71
76
|
right: `).concat(a,"px ").concat(n,`;
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
.`).concat(
|
|
79
|
+
.`).concat(Tl,` {
|
|
75
80
|
margin-right: `).concat(a,"px ").concat(n,`;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
.`).concat(
|
|
83
|
+
.`).concat(Ml," .").concat(Ml,` {
|
|
79
84
|
right: 0 `).concat(n,`;
|
|
80
85
|
}
|
|
81
86
|
|
|
82
|
-
.`).concat(
|
|
87
|
+
.`).concat(Tl," .").concat(Tl,` {
|
|
83
88
|
margin-right: 0 `).concat(n,`;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
body[`).concat(
|
|
87
|
-
`).concat(
|
|
91
|
+
body[`).concat(Zo,`] {
|
|
92
|
+
`).concat(cL,": ").concat(a,`px;
|
|
88
93
|
}
|
|
89
|
-
`)},
|
|
94
|
+
`)},i6=function(){var e=parseInt(document.body.getAttribute(Zo)||"0",10);return isFinite(e)?e:0},TL=function(){I.useEffect(function(){return document.body.setAttribute(Zo,(i6()+1).toString()),function(){var e=i6()-1;e<=0?document.body.removeAttribute(Zo):document.body.setAttribute(Zo,e.toString())}},[])},AL=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;TL();var s=I.useMemo(function(){return EL(i)},[i]);return I.createElement(CL,{styles:ML(s,!t,i,r?"":"!important")})},Zp=!1;if(typeof window<"u")try{var Ol=Object.defineProperty({},"passive",{get:function(){return Zp=!0,!0}});window.addEventListener("test",Ol,Ol),window.removeEventListener("test",Ol,Ol)}catch{Zp=!1}var Qo=Zp?{passive:!1}:!1,OL=function(e){return e.tagName==="TEXTAREA"},s6=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!OL(e)&&r[t]==="visible")},IL=function(e){return s6(e,"overflowY")},PL=function(e){return s6(e,"overflowX")},o6=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=a6(e,n);if(i){var s=c6(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},jL=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},kL=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},a6=function(e,t){return e==="v"?IL(t):PL(t)},c6=function(e,t){return e==="v"?jL(t):kL(t)},NL=function(e,t){return e==="h"&&t==="rtl"?-1:1},RL=function(e,t,r,n,i){var s=NL(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=c6(e,a),b=y[0],_=y[1],A=y[2],P=_-A-s*b;(b||P)&&a6(e,a)&&(f+=P,h+=b),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(l&&(i&&Math.abs(f)<1||!i&&o>f)||!l&&(i&&Math.abs(h)<1||!i&&-o>h))&&(u=!0),u},Il=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},u6=function(e){return[e.deltaX,e.deltaY]},l6=function(e){return e&&"current"in e?e.current:e},DL=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$L=function(e){return`
|
|
90
95
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
91
96
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
92
|
-
`)},VR=0,Lo=[];function qR(e){var t=O.useRef([]),r=O.useRef([0,0]),n=O.useRef(),i=O.useState(VR++)[0],s=O.useState(e4)[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=fR([e.lockRef.current],(e.shards||[]).map(a4),!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=Hu(w),P=r.current,R="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(R)>Math.abs(F)?"h":"v";if("touches"in w&&q==="h"&&H.type==="range")return!1;var X=n4(q,H);if(!X)return!0;if(X?L=q:(L=q==="v"?"h":"v",X=n4(q,H)),!X)return!1;if(!n.current&&"changedTouches"in w&&(R||F)&&(n.current=L),!L)return!0;var ne=n.current||L;return UR(ne,A,w,ne==="h"?R:F,!0)},[]),c=O.useCallback(function(w){var A=w;if(!(!Lo.length||Lo[Lo.length-1]!==s)){var I="deltaY"in A?o4(A):Hu(A),P=t.current.filter(function(L){return L.name===A.type&&(L.target===A.target||A.target===L.shadowParent)&&FR(L.delta,I)})[0];if(P&&P.should){A.cancelable&&A.preventDefault();return}if(!P){var R=(o.current.shards||[]).map(a4).filter(Boolean).filter(function(L){return L.contains(A.target)}),F=R.length>0?a(A,R[0]):!o.current.noIsolation;F&&A.cancelable&&A.preventDefault()}}},[]),u=O.useCallback(function(w,A,I,P){var R={name:w,delta:A,target:I,should:P,shadowParent:GR(I)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(F){return F!==R})},1)},[]),l=O.useCallback(function(w){r.current=Hu(w),n.current=void 0},[]),f=O.useCallback(function(w){u(w.type,o4(w),w.target,a(w,e.lockRef.current))},[]),h=O.useCallback(function(w){u(w.type,Hu(w),w.target,a(w,e.lockRef.current))},[]);O.useEffect(function(){return Lo.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Bo),document.addEventListener("touchmove",c,Bo),document.addEventListener("touchstart",l,Bo),function(){Lo=Lo.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,Bo),document.removeEventListener("touchmove",c,Bo),document.removeEventListener("touchstart",l,Bo)}},[]);var y=e.removeScrollBar,_=e.inert;return O.createElement(O.Fragment,null,_?O.createElement(s,{styles:zR(i)}):null,y?O.createElement(PR,{gapMode:e.gapMode}):null)}function GR(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const HR=wR(Z_,qR);var c4=O.forwardRef(function(e,t){return O.createElement(qu,Xn({},e,{ref:t,sideCar:HR}))});c4.classNames=qu.classNames;const WR=c4;function KR(e,t){return O.useReducer((r,n)=>t[r][n]??r,e)}var Uh="ScrollArea",[u4,zW]=Mo(Uh),[XR,rn]=u4(Uh),l4=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),[R,F]=O.useState(0),[L,H]=O.useState(!1),[q,X]=O.useState(!1),ne=Zt(t,oe=>c(oe)),ce=Ch(i);return b.jsx(XR,{scope:r,type:n,dir:ce,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:ce,...o,ref:ne,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":R+"px",...e.style}})})});l4.displayName=Uh;var f4="ScrollAreaViewport",d4=O.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=rn(f4,r),a=O.useRef(null),c=Zt(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})})]})});d4.displayName=f4;var Yn="ScrollAreaScrollbar",h4=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=rn(Yn,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(YR,{...n,ref:t,forceMount:r}):i.type==="scroll"?b.jsx(JR,{...n,ref:t,forceMount:r}):i.type==="auto"?b.jsx(p4,{...n,ref:t,forceMount:r}):i.type==="always"?b.jsx(Fh,{...n,ref:t}):null});h4.displayName=Yn;var YR=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=rn(Yn,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(xn,{present:r||s,children:b.jsx(p4,{"data-state":s?"visible":"hidden",...n,ref:t})})}),JR=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=rn(Yn,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Yu(()=>c("SCROLL_END"),100),[a,c]=KR("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(xn,{present:r||a!=="hidden",children:b.jsx(Fh,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),p4=O.forwardRef((e,t)=>{const r=rn(Yn,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=O.useState(!1),a=e.orientation==="horizontal",c=Yu(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return Uo(r.viewport,c),Uo(r.content,c),b.jsx(xn,{present:n||s,children:b.jsx(Fh,{"data-state":s?"visible":"hidden",...i,ref:t})})}),Fh=O.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=rn(Yn,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=b4(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(ZR,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=w4(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(QR,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=w4(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}),ZR=O.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=rn(Yn,e.__scopeScrollArea),[o,a]=O.useState(),c=O.useRef(null),u=Zt(t,c,s.onScrollbarXChange);return O.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(g4,{"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":Xu(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),x4(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:Ku(o.paddingLeft),paddingEnd:Ku(o.paddingRight)}})}})}),QR=O.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=rn(Yn,e.__scopeScrollArea),[o,a]=O.useState(),c=O.useRef(null),u=Zt(t,c,s.onScrollbarYChange);return O.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(g4,{"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":Xu(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),x4(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:Ku(o.paddingTop),paddingEnd:Ku(o.paddingBottom)}})}})}),[eD,m4]=u4(Yn),g4=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=rn(Yn,r),[_,w]=O.useState(null),A=Zt(t,ne=>w(ne)),I=O.useRef(null),P=O.useRef(""),R=y.viewport,F=n.content-n.viewport,L=mr(l),H=mr(c),q=Yu(f,10);function X(ne){if(I.current){const ce=ne.clientX-I.current.left,oe=ne.clientY-I.current.top;u({x:ce,y:oe})}}return O.useEffect(()=>{const ne=ce=>{const oe=ce.target;(_==null?void 0:_.contains(oe))&&L(ce,F)};return document.addEventListener("wheel",ne,{passive:!1}),()=>document.removeEventListener("wheel",ne,{passive:!1})},[R,_,F,L]),O.useEffect(H,[n,H]),Uo(_,q),Uo(y.content,q),b.jsx(eD,{scope:r,scrollbar:_,hasThumb:i,onThumbChange:mr(s),onThumbPointerUp:mr(o),onThumbPositionChange:H,onThumbPointerDown:mr(a),children:b.jsx(Gt.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:tt(e.onPointerDown,ne=>{ne.button===0&&(ne.target.setPointerCapture(ne.pointerId),I.current=_.getBoundingClientRect(),P.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),X(ne))}),onPointerMove:tt(e.onPointerMove,X),onPointerUp:tt(e.onPointerUp,ne=>{const ce=ne.target;ce.hasPointerCapture(ne.pointerId)&&ce.releasePointerCapture(ne.pointerId),document.body.style.webkitUserSelect=P.current,y.viewport&&(y.viewport.style.scrollBehavior=""),I.current=null})})})}),Wu="ScrollAreaThumb",v4=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=m4(Wu,e.__scopeScrollArea);return b.jsx(xn,{present:r||i.hasThumb,children:b.jsx(tD,{ref:t,...n})})}),tD=O.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=rn(Wu,r),o=m4(Wu,r),{onThumbPositionChange:a}=o,c=Zt(t,f=>o.onThumbChange(f)),u=O.useRef(),l=Yu(()=>{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=iD(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:tt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),_=f.clientX-y.left,w=f.clientY-y.top;o.onThumbPointerDown({x:_,y:w})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});v4.displayName=Wu;var zh="ScrollAreaCorner",y4=O.forwardRef((e,t)=>{const r=rn(zh,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?b.jsx(rD,{...e,ref:t}):null});y4.displayName=zh;var rD=O.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=rn(zh,r),[s,o]=O.useState(0),[a,c]=O.useState(0),u=!!(s&&a);return Uo(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),Uo(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 Ku(e){return e?parseInt(e,10):0}function b4(e,t){const r=e/t;return isNaN(r)?0:r}function Xu(e){const t=b4(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=Xu(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 _4([c,u],f)(e)}function w4(e,t,r="ltr"){const n=Xu(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=ZN(e,c);return _4([0,o],[0,a])(u)}function _4(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 x4(e,t){return e>0&&e<t}var iD=(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 Yu(e,t){const r=mr(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 Uo(e,t){const r=mr(t);es(()=>{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 sD=l4,oD=d4,S4=h4,E4=v4,aD=y4,Vh="Switch",[cD,VW]=Mo(Vh),[uD,lD]=cD(Vh),M4=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),_=Zt(t,R=>y(R)),w=O.useRef(!1),A=h?l||!!h.closest("form"):!0,[I=!1,P]=Ga({prop:i,defaultProp:s,onChange:u});return b.jsxs(uD,{scope:r,checked:I,disabled:a,children:[b.jsx(Gt.button,{type:"button",role:"switch","aria-checked":I,"aria-required":o,"data-state":T4(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:_,onClick:tt(e.onClick,R=>{P(F=>!F),A&&(w.current=R.isPropagationStopped(),w.current||R.stopPropagation())})}),A&&b.jsx(fD,{control:h,bubbles:!w.current,name:n,value:c,checked:I,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});M4.displayName=Vh;var C4="SwitchThumb",A4=O.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=lD(C4,r);return b.jsx(Gt.span,{"data-state":T4(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});A4.displayName=C4;var fD=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=O.useRef(null),o=T_(r),a=_h(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 T4(e){return e?"checked":"unchecked"}var dD=M4,hD=A4;const Ka={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:Ha,highContrast:Ru,radius:Th},O4=O.forwardRef((e,t)=>{const{rest:r,...n}=Po(e),{className:i,style:s,size:o=Ka.size.default,variant:a=Ka.variant.default,color:c=Ka.color.default,highContrast:u=Ka.highContrast.default,radius:l=Ka.radius.default,...f}=r;return O.createElement("span",{"data-radius":l,className:Wt("rt-SwitchRoot",i,yt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},No(n)),style:s},O.createElement(dD,{"data-accent-color":c,...f,ref:t,className:Wt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},O.createElement(hD,{className:Wt("rt-SwitchThumb",{"rt-high-contrast":u})})))});O4.displayName="Switch";var qh=["Enter"," "],pD=["ArrowDown","PageUp","Home"],I4=["ArrowUp","PageDown","End"],mD=[...pD,...I4],gD={ltr:[...qh,"ArrowRight"],rtl:[...qh,"ArrowLeft"]},vD={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Xa="Menu",[Ya,yD,bD]=N_(Xa),[Rs,k4]=Mo(Xa,[bD,Ou,D_]),Ja=Ou(),j4=D_(),[P4,os]=Rs(Xa),[wD,Za]=Rs(Xa),N4=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=Ja(t),[c,u]=O.useState(null),l=O.useRef(!1),f=mr(s),h=Ch(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(l_,{...a,children:b.jsx(P4,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:b.jsx(wD,{scope:t,onClose:O.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};N4.displayName=Xa;var _D="MenuAnchor",Gh=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Ja(r);return b.jsx(f_,{...i,...n,ref:t})});Gh.displayName=_D;var Hh="MenuPortal",[xD,R4]=Rs(Hh,{forceMount:void 0}),D4=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=os(Hh,t);return b.jsx(xD,{scope:t,forceMount:r,children:b.jsx(xn,{present:r||s.open,children:b.jsx(p_,{asChild:!0,container:i,children:n})})})};D4.displayName=Hh;var nn="MenuContent",[SD,Wh]=Rs(nn),$4=O.forwardRef((e,t)=>{const r=R4(nn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=os(nn,e.__scopeMenu),o=Za(nn,e.__scopeMenu);return b.jsx(Ya.Provider,{scope:e.__scopeMenu,children:b.jsx(xn,{present:n||s.open,children:b.jsx(Ya.Slot,{scope:e.__scopeMenu,children:o.modal?b.jsx(ED,{...i,ref:t}):b.jsx(MD,{...i,ref:t})})})})}),ED=O.forwardRef((e,t)=>{const r=os(nn,e.__scopeMenu),n=O.useRef(null),i=Zt(t,n);return O.useEffect(()=>{const s=n.current;if(s)return lR(s)},[]),b.jsx(Kh,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),MD=O.forwardRef((e,t)=>{const r=os(nn,e.__scopeMenu);return b.jsx(Kh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Kh=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=os(nn,r),I=Za(nn,r),P=Ja(r),R=j4(r),F=yD(r),[L,H]=O.useState(null),q=O.useRef(null),X=Zt(t,q,A.onContentChange),ne=O.useRef(0),ce=O.useRef(""),oe=O.useRef(0),V=O.useRef(null),$=O.useRef("right"),p=O.useRef(0),d=_?WR:O.Fragment,m=_?{as:Si,allowPinchZoom:!0}:void 0,x=C=>{var xe,be;const k=ce.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,N=T.map(Ce=>Ce.textValue),se=$D(N,k,v),ue=(be=T.find(Ce=>Ce.textValue===se))==null?void 0:be.ref.current;(function Ce(Me){ce.current=Me,window.clearTimeout(ne.current),Me!==""&&(ne.current=window.setTimeout(()=>Ce(""),1e3))})(k),ue&&setTimeout(()=>ue.focus())};O.useEffect(()=>()=>window.clearTimeout(ne.current),[]),QN();const E=O.useCallback(C=>{var T,g;return $.current===((T=V.current)==null?void 0:T.side)&&LD(C,(g=V.current)==null?void 0:g.area)},[]);return b.jsx(SD,{scope:r,searchRef:ce,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(V_,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,C=>{var k;C.preventDefault(),(k=q.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:b.jsx(ch,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:b.jsx(YN,{asChild:!0,...R,dir:I.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:H,onEntryFocus:tt(c,C=>{I.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:b.jsx(d_,{role:"menu","aria-orientation":"vertical","data-state":tx(A.open),"data-radix-menu-content":"",dir:I.dir,...P,...w,ref:X,style:{outline:"none",...w.style},onKeyDown:tt(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 N=q.current;if(C.target!==N||!mD.includes(C.key))return;C.preventDefault();const ue=F().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);I4.includes(C.key)&&ue.reverse(),RD(ue)}),onBlur:tt(e.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(ne.current),ce.current="")}),onPointerMove:tt(e.onPointerMove,ec(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}}))})})})})})})});$4.displayName=nn;var CD="MenuGroup",Xh=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Gt.div,{role:"group",...n,ref:t})});Xh.displayName=CD;var AD="MenuLabel",B4=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Gt.div,{...n,ref:t})});B4.displayName=AD;var Ju="MenuItem",L4="menu.itemSelect",Zu=O.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=O.useRef(null),o=Za(Ju,e.__scopeMenu),a=Wh(Ju,e.__scopeMenu),c=Zt(t,s),u=O.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(L4,{bubbles:!0,cancelable:!0});f.addEventListener(L4,y=>n==null?void 0:n(y),{once:!0}),j2(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return b.jsx(U4,{...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===" "||qh.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Zu.displayName=Ju;var U4=O.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=Wh(Ju,r),a=j4(r),c=O.useRef(null),u=Zt(t,c),[l,f]=O.useState(!1),[h,y]=O.useState("");return O.useEffect(()=>{const _=c.current;_&&y((_.textContent??"").trim())},[s.children]),b.jsx(Ya.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:b.jsx(JN,{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:tt(e.onPointerMove,ec(_=>{n?o.onItemLeave(_):(o.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,ec(_=>o.onItemLeave(_))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),TD="MenuCheckboxItem",F4=O.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return b.jsx(H4,{scope:e.__scopeMenu,checked:r,children:b.jsx(Zu,{role:"menuitemcheckbox","aria-checked":Qu(r)?"mixed":r,...i,ref:t,"data-state":Zh(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(Qu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});F4.displayName=TD;var z4="MenuRadioGroup",[OD,ID]=Rs(z4,{value:void 0,onValueChange:()=>{}}),V4=O.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=mr(n);return b.jsx(OD,{scope:e.__scopeMenu,value:r,onValueChange:s,children:b.jsx(Xh,{...i,ref:t})})});V4.displayName=z4;var q4="MenuRadioItem",G4=O.forwardRef((e,t)=>{const{value:r,...n}=e,i=ID(q4,e.__scopeMenu),s=r===i.value;return b.jsx(H4,{scope:e.__scopeMenu,checked:s,children:b.jsx(Zu,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":Zh(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});G4.displayName=q4;var Yh="MenuItemIndicator",[H4,kD]=Rs(Yh,{checked:!1}),W4=O.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=kD(Yh,r);return b.jsx(xn,{present:n||Qu(s.checked)||s.checked===!0,children:b.jsx(Gt.span,{...i,ref:t,"data-state":Zh(s.checked)})})});W4.displayName=Yh;var jD="MenuSeparator",K4=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Gt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});K4.displayName=jD;var PD="MenuArrow",X4=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Ja(r);return b.jsx(h_,{...i,...n,ref:t})});X4.displayName=PD;var Jh="MenuSub",[ND,Y4]=Rs(Jh),J4=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=os(Jh,t),o=Ja(t),[a,c]=O.useState(null),[u,l]=O.useState(null),f=mr(i);return O.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),b.jsx(l_,{...o,children:b.jsx(P4,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:b.jsx(ND,{scope:t,contentId:Fa(),triggerId:Fa(),trigger:a,onTriggerChange:c,children:r})})})};J4.displayName=Jh;var Qa="MenuSubTrigger",Z4=O.forwardRef((e,t)=>{const r=os(Qa,e.__scopeMenu),n=Za(Qa,e.__scopeMenu),i=Y4(Qa,e.__scopeMenu),s=Wh(Qa,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(Gh,{asChild:!0,...u,children:b.jsx(U4,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":tx(r.open),...e,ref:bu(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,ec(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,ec(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"],R=h[A?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+I,y:f.clientY},{x:P,y:h.top},{x:R,y:h.top},{x:R,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:tt(e.onKeyDown,f=>{var y;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||gD[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});Z4.displayName=Qa;var Q4="MenuSubContent",ex=O.forwardRef((e,t)=>{const r=R4(nn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=os(nn,e.__scopeMenu),o=Za(nn,e.__scopeMenu),a=Y4(Q4,e.__scopeMenu),c=O.useRef(null),u=Zt(t,c);return b.jsx(Ya.Provider,{scope:e.__scopeMenu,children:b.jsx(xn,{present:n||s.open,children:b.jsx(Ya.Slot,{scope:e.__scopeMenu,children:b.jsx(Kh,{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=vD[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});ex.displayName=Q4;function tx(e){return e?"open":"closed"}function Qu(e){return e==="indeterminate"}function Zh(e){return Qu(e)?"indeterminate":e?"checked":"unchecked"}function RD(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function DD(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function $D(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=DD(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 BD(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 LD(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return BD(r,t)}function ec(e){return t=>t.pointerType==="mouse"?e(t):void 0}var UD=N4,FD=Gh,zD=D4,VD=$4,qD=Xh,GD=B4,HD=Zu,WD=F4,KD=V4,XD=G4,YD=W4,JD=K4,ZD=X4,QD=J4,e$=Z4,t$=ex,Qh="DropdownMenu",[r$,HW]=Mo(Qh,[k4]),Or=k4(),[n$,rx]=r$(Qh),nx=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]=Ga({prop:i,defaultProp:s,onChange:o});return b.jsx(n$,{scope:t,triggerId:Fa(),triggerRef:u,contentId:Fa(),open:l,onOpenChange:f,onOpenToggle:O.useCallback(()=>f(h=>!h),[f]),modal:a,children:b.jsx(UD,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};nx.displayName=Qh;var ix="DropdownMenuTrigger",sx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=rx(ix,r),o=Or(r);return b.jsx(FD,{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:bu(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())})})})});sx.displayName=ix;var i$="DropdownMenuPortal",ox=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Or(t);return b.jsx(zD,{...n,...r})};ox.displayName=i$;var ax="DropdownMenuContent",cx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=rx(ax,r),s=Or(r),o=O.useRef(!1);return b.jsx(VD,{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)"}})});cx.displayName=ax;var s$="DropdownMenuGroup",ux=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(qD,{...i,...n,ref:t})});ux.displayName=s$;var o$="DropdownMenuLabel",lx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(GD,{...i,...n,ref:t})});lx.displayName=o$;var a$="DropdownMenuItem",fx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(HD,{...i,...n,ref:t})});fx.displayName=a$;var c$="DropdownMenuCheckboxItem",dx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(WD,{...i,...n,ref:t})});dx.displayName=c$;var u$="DropdownMenuRadioGroup",hx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(KD,{...i,...n,ref:t})});hx.displayName=u$;var l$="DropdownMenuRadioItem",px=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(XD,{...i,...n,ref:t})});px.displayName=l$;var f$="DropdownMenuItemIndicator",mx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(YD,{...i,...n,ref:t})});mx.displayName=f$;var d$="DropdownMenuSeparator",gx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(JD,{...i,...n,ref:t})});gx.displayName=d$;var h$="DropdownMenuArrow",p$=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(ZD,{...i,...n,ref:t})});p$.displayName=h$;var m$=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Or(t),[a=!1,c]=Ga({prop:n,defaultProp:s,onChange:i});return b.jsx(QD,{...o,open:a,onOpenChange:c,children:r})},g$="DropdownMenuSubTrigger",vx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(e$,{...i,...n,ref:t})});vx.displayName=g$;var v$="DropdownMenuSubContent",yx=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(t$,{...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)"}})});yx.displayName=v$;var y$=nx,b$=sx,bx=ox,w$=cx,_$=ux,x$=lx,S$=fx,E$=dx,M$=hx,C$=px,wx=mx,A$=gx,T$=m$,O$=vx,I$=yx;const e0={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Th,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},t0=O.forwardRef((e,t)=>{const{rest:r,...n}=Po(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=e0.size.default,radius:l=e0.radius.default,scrollbars:f=e0.scrollbars.default,...h}=r;return O.createElement(sD,{type:o,scrollHideDelay:a,className:Wt("rt-ScrollAreaRoot",i,No(n)),style:s},O.createElement(oD,{...h,ref:t,className:"rt-ScrollAreaViewport"}),O.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?O.createElement(S4,{"data-radius":l,orientation:"horizontal",className:Wt("rt-ScrollAreaScrollbar",yt(u,"rt-r-size"))},O.createElement(E4,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?O.createElement(S4,{"data-radius":l,orientation:"vertical",className:Wt("rt-ScrollAreaScrollbar",yt(u,"rt-r-size"))},O.createElement(E4,{className:"rt-ScrollAreaThumb"})):null,f==="both"?O.createElement(aD,{className:"rt-ScrollAreaCorner"}):null)});t0.displayName="ScrollArea";const r0={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:Ha,highContrast:Ru},_x={color:Ha,shortcut:{type:"string",default:void 0}},xx=e=>O.createElement(y$,{...e});xx.displayName="DropdownMenuRoot";const Sx=O.forwardRef((e,t)=>O.createElement(b$,{...e,ref:t,asChild:!0}));Sx.displayName="DropdownMenuTrigger";const Ex=O.createContext({}),Mx=O.forwardRef((e,t)=>{const r=wN(),{className:n,children:i,size:s=r0.size.default,variant:o=r0.variant.default,highContrast:a=r0.highContrast.default,color:c=_x.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return O.createElement(bx,{container:u,forceMount:l},O.createElement(Nu,{asChild:!0},O.createElement(w$,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Wt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,yt(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},O.createElement(t0,{type:"auto"},O.createElement("div",{className:Wt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},O.createElement(Ex.Provider,{value:O.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});Mx.displayName="DropdownMenuContent";const Cx=O.forwardRef((e,t)=>O.createElement(x$,{...e,ref:t,className:Wt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));Cx.displayName="DropdownMenuLabel";const Ax=O.forwardRef((e,t)=>{const{className:r,children:n,color:i=_x.color.default,shortcut:s,...o}=e;return O.createElement(S$,{"data-accent-color":i,...o,ref:t,className:Wt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},O.createElement(Co,null,n),s&&O.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});Ax.displayName="DropdownMenuItem";const Tx=O.forwardRef((e,t)=>O.createElement(_$,{...e,ref:t,className:Wt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));Tx.displayName="DropdownMenuGroup";const Ox=O.forwardRef((e,t)=>O.createElement(M$,{...e,ref:t,className:Wt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));Ox.displayName="DropdownMenuRadioGroup";const Ix=O.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return O.createElement(C$,{...i,ref:t,className:Wt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},O.createElement(Co,null,r),O.createElement(wx,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},O.createElement($u,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Ix.displayName="DropdownMenuRadioItem";const kx=O.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return O.createElement(E$,{...s,ref:t,className:Wt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},O.createElement(Co,null,r),O.createElement(wx,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},O.createElement($u,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&O.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});kx.displayName="DropdownMenuCheckboxItem";const jx=e=>O.createElement(T$,{...e});jx.displayName="DropdownMenuSub";const Px=O.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return O.createElement(O$,{...i,ref:t,className:Wt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},O.createElement(Co,null,n),O.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},O.createElement(P_,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});Px.displayName="DropdownMenuSubTrigger";const Nx=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(Ex);return O.createElement(bx,{container:i,forceMount:s},O.createElement(Nu,{asChild:!0},O.createElement(I$,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Wt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,yt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},O.createElement(t0,{type:"auto"},O.createElement("div",{className:Wt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});Nx.displayName="DropdownMenuSubContent";const Rx=O.forwardRef((e,t)=>O.createElement(A$,{...e,ref:t,className:Wt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));Rx.displayName="DropdownMenuSeparator";const Ci=Object.assign({},{Root:xx,Trigger:Sx,Content:Mx,Label:Cx,Item:Ax,Group:Tx,RadioGroup:Ox,RadioItem:Ix,CheckboxItem:kx,Sub:jx,SubTrigger:Px,SubContent:Nx,Separator:Rx}),tc={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:Ha,highContrast:Ru,radius:Th},Dx=O.forwardRef((e,t)=>{const{rest:r,...n}=Po(e),{className:i,asChild:s=!1,size:o=tc.size.default,variant:a=tc.variant.default,color:c=tc.color.default,highContrast:u=tc.highContrast.default,radius:l=tc.radius.default,...f}=r,h=s?Si:"button";return O.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Wt("rt-reset","rt-BaseButton",i,yt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},No(n))})});Dx.displayName="BaseButton";const $x=O.forwardRef((e,t)=>O.createElement(Dx,{...e,ref:t,className:Wt("rt-Button",e.className)}));$x.displayName="Button";const k$={loading:{type:"boolean",default:!0}},Fo=O.forwardRef((e,t)=>{const{rest:r,...n}=Po(e),{className:i,children:s,loading:o=k$.loading.default,...a}=r;if(!o)return O.createElement(O.Fragment,null,s);const c=O.isValidElement(s)?Si:"span";return O.createElement(c,{ref:t,"aria-hidden":!0,className:Wt("rt-Skeleton",i,No(n)),"data-inline-skeleton":O.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});Fo.displayName="Skeleton";const j$=Lt("/images/ghost_loading.png"),P$={primary:Lt("/images/primary_loading.png"),ghost:j$};function N$({size:e="24px",variant:t="primary",wrapStyle:r={}}){return b.jsx(A_,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:b.jsx("img",{src:P$[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const R$="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==",n0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABGUUKwAAAQcklEQVR4Ac07C3BUVZb33vfp7nQSgiEhYYYgESEj40oZjERH/MxAnFEGQQYUZILRGix1y3V3q3bZqd2trZpZqram1rJ2tMZZiUGFAURQ4romiALjmlkFB2eGEVyMEAQSEiSQ9O+9fvfuOfe923Q66aQ7dDS3q/vcd9+553fPOffzXlMyxqX4hc1Vls9p4Iao5nm8Mp5HSoSfmsIUGjcJRfbMIoJa1CFRbhlh2k3CrJ3F6EG/rTWee3DlkbEUUQqQawYTX3ppVTxInoxN4rPjVxAfAf0kDwG/WEM4RKGUEiEEQYgF0ITxJY2ZPfSwHiJPnV+9etMQ3S6rKWcGmPTcq+XWxOhzVhlfGJ8oQGkoSlnFJcUAAlSk8EHoort1bPMaXGN5lzoao5O1muf9a3vW3nvGRbq8XyXaqKlMebG5IpTXtzF6JZ/PfYINSyjFADDUoCA0eiN+SVvXINIuKKF3qQzKLMr9x9n+YLig/vSPF3UMy3OEm6M2ALgqLd6y5fnwVXyNCJChFZcKU2GcoyGtlx6FuD7MYuQDjemHhNC7mLggR5HTCeWUxic7JD6HG6QGDDmbTxSzrCtEELRPKyOLEB74jDWdu+++hyFslJlGUHng7bTEB6INvPrGC6/O65tmt1iTeKGKWxfDGy7OhL+Tduq9ZLMZ9j19uuGekwMpZHY1pfG1qVZe7Il4EV8ZLSNlYGZgIK3qEXDrZje5GOgw67oevPd3mVG+hJW1AUpf3vpI+GrxjAOj7qmrIpZQhwr/CdbG+sz67tWLj11ic/m1kpden8ELrI2RabyWaIO9QkNv+D/9sbMPLPtVNtyyMsDkra809s8iawjjXj9lAhjxk+TTYLdY1bFm+cFsBMgWt6JpW3WomG6KVpCZhCg5XCqUMBE8Qpq6VvyoIVO6GRmg+oAwvji9sy00zalWKrsMBPF1sW69kzzU9eNlzZkyzQXelM2vLbImORtik3mJoqeCw39CO1gxZUntwbnUVvfSwRENgMp39OzoiJWJsgFZG5JO8BjdfWbpkrp0xL+K9sk7drZEruILYDZxZ0/PCj7IQRXFSytGMsLQ2TtJ8tOnX2+zy2kZo5CBgAdCZjNR8Alb/3Urj2J2wQAUHNHWs7gGczBmSfxlxC6jZadA9iRVhqwOa4CpW3c1RqeRalRcKg+E9X5m5x81lp1acc9Ph6T4NTSiLPlH2TI9BEMDJlDyxipI9dStzY3DiZQ2BK78TfMjfVXiWYHUvKKHme1v1+Z0PPCDP6u28QQrXn7zmmilcyieB6sJKFJwUAA85NHj99815OwwpAfM2PLmvHCleAbmeHR86VK6o4n8z/X7xqvyqDDKhjKirDIc0HOhhKc7z6BOiJNaBhkAV3jhUtEiTMZcV5ImEAXt+vr2Vd/fkUpgvF2jjCgrGEAagaED+xiTOmGiTCmDGiq3v7khdBVpkHjeOj3vBG39/J7v5yTbz9y2pyZO4/cIH68RGisV1PEJjerUZr3MEqepTd+JGUUvnlp647kUWbO6nL7rv1vC3+QLZRzgzAAl2E4b25f94CH3yv0dYICq37Rd2VfZ+5ljgNdjQeP10O4TC+4sddFH94tTae/J1v+0J4il9kRRgHbFkroXSuyLOBG+bnbcd8H4+6Mr7tjmYmf/O233W2djk0SJUpLGCJ/YUTD98PLvdChqA0IgHux/QRiUuRMJ/moi0E0HWEx1zBRevW33yp7w7guRaaTeLiIFFBwTJ2z5wRjFD0L4qqkWJKDWZDK972p7y1Vv7P4thmWm/JLxUHYIBJnHZS6HsI75IxuTcRKEv/Xq/vL+qdEvhA7B42H4z7Kjn935varkDtnUZ2/f+9cXKuxfEH1oBbw1S2K3m0obhUOcwBn6x2N3LfiL1PuZXF/91ttHwiV8lsJlccLzv/B/85N755/BtoQHCM1+juhgepnzYfS5JvIuslWqY7Zw1ta9t/dNc35BNfR0dy7BnS3W5Q4XR9yrJzzOa8PEJZOXB2EneO23tu/5WbYyIL4fdGACZgVcwCE/g8El6OqVhAGsK8hC5YoI8zq1tj8uv2NUGxt0WV4qXgd+lKEFgB5+UQAFk+uJ+x4u9pFf7IF1+MRK2d8oobOBqAPqInl44WaDroqGNMC1r7y3igeZLyEc7OeDjlmvkLKF1726/x/sQoz3S/GtaCPUYESCZ/S2CZ/7/nLSZ+bcwuPaT/292peEo0uC4wNMrmMbDwr/ddvfW56tLIjvt7QHkSfSQWM6Qeq79pV90rt1RIDT2ielc4KzYsz5e1nnR4tvGvV+PjaBPCGVl2kes72XaoA4A+MWHGf1Hy+/5SXk7RX0tH+dtWffWasIsrbKTIAv6ygUFJg6lwDIelb4eOktn1a17uu0ilm5O9OAQfPok0Brk/SAeFDMxpjDDI3QF9ZfRoajKTVv/2+xU0QnSWvLpQjGM9JF21OS36ntTFE+wSZw3vgXxFOeI3uAPAjx42gkkcwSnTKs+EJsM+YepIPQBp2xK6vefqDKKdB8ig06qBHW/yNDuoPQ7Ivxh3HIL9FT4sOkaml81qKb07qxYeu70BM176PqCGVd6P2DGGbYYEZ9T+O0rsKAg86oOxOG1QCjLnMk+r+vn4U+vL/mZIZ0B6E5wfxfFp7QH8w/pW0PnGPHjQizlQK+C/TYKxQegKQpIo/f7I4QIKD7w0gpKHMHZ6fSdB2xGXUy+2kIB0Z6GAdgOA260Fk1k5GPvAQxI9rREakNg/CHuutCcLvJ+0rM2uYDVZbD7xe287FsSPNj+cXPpHAw3ljQj2BGkRCMKLSY9m9pumbUjLo5QQ6nWi59WPNU67DyqyTczTJyrozTP2VELQuktkVz8fHWPw/XZe6uD/89VMwrKYehUVkQvQCFBeg/T08eWHbD74ejMdI9nWuHIQNUKzyui0omfLRERSlaH7aSHyqErwreuPPAP0ZK+V8BfxmK0k1lunIj1rA1J9hv/PBy5dFs9gHqqkKSmFqJDkskHzapAiIcUvWvAtb810cbw6V8NSjtPtrA0XcdUoYkCCzyusnj7y29ftjwyURWqZsAD1PIBjV1ouHy1ysQb36f2aUuxxLiarHmrY/ejxTzeaiwikulPPLW4owHv6SPv7/4+iFPc7KVD3ULEczBrsaCMU2nGuiPqwNsBuubNC43CbJhDH/mtfz+gFVMr8cHWirmVcJDqEdppKBPq9t393W/zZUYqFtykoVzCKpj4kOGsiiYK45p6Nz8xh/+KTTRcZXH0fDYq4QX6NU+KY36bty1uKovDYlRN8NaAAzudsddtq7B4yzHSwIogBXVy+H2qJfBmUhm5Yu/w5GQkqDRPYnAE/D8YdP/3HXt6kzoZIuDulEShwnV7QkPuCAK4hT0dz/SPQxtcraEs8G/tfmTRTzA8uQuD4yQgFDP+5K1jJXyKCMF3dwlPww18NMc5jDmUAsb5VeGA5+TjUJZ4zJxp4x7GAU5JXnQtDWrvG723VnTy6KDcPgceeokp0IIhjixdCPOuh2Bz+HBQvDljN6QBc2sUSHpTlErT+yssr8ZoYeGWyZnzWiIDtSgNW4SdG/qFu1msPBp12Dk8St3gxr99hB9c9hE8y+FnAo95K3hEnpMC+yEZrte5+qqC61d17h2kApxB3LG0eAmHfWWMxPpNc4+CPSTShcXfQ4zEmRjTrN+uSETfsk43NRmUbkQcqcBqfvC5s+r+kvif5ZPVyU2FfkX6bTWuhmj3hEmMx0v9YUtx6b2F/ATcpTdmUfk9xjXsNZF04+YMRZTbgnOAZMRe2K8CJ4rOVAn1E3paVoshrrLIzHDZocdgyd2SY5JVgLjv80Vc0Xn7uaeb0Ty+xJr+ksB4GIELO3h5rqK1xR+LiHqJDdZEHH4cp5hk8NIH3aHcAji6E956UhOTXaAlv3w3ZMz8F4uC2fRYNwniuM+Ir+2V0eIXzgLxUVYzgvqYvnhHQdQ3D0Wg2M/x3wKGUkDvFE3dZNhURkGOE3gCVGc8425lqQACMqZBgRBYSQvD8qFiStOrtkSC3RJuD8EAaw5YqgzMpIGwIrfYq3JAsX8tPaultOJsECcyy4+d/GT7sEIYdpls0glgDrYAVarpj+EvhhtVXgJA5j+wFo4O4fXrnBssBmSoc6llRRyLiCuAlUiSoW5oJ9KQ+qAp2rg2cgbpmFu8sBahZcwwI75JWf8UbbftZTrnpaPzry35dQihXz50Jd40qP4KIgCqofSl8/HpYCyW342UxkaBxZ13HFnSWLLnzAAdvH7J9aDD3DVAb0garINuRII0q2Me3c0UBzwNsw53ifXISBlT4w+GJhrHHVM1sddEiW1LNl9dkPY7zRgEwSBPCvIg/yw87uT65LQRl39kRBpAz2Xe4Ele7paIj6ReAaIAgcirHHngtKHkoUfZAA8qlq8r7vX1gS8BwyzBsQNPOEUeRG2fvv3Jo2bN8OSlUitL3u75+chP193aXULD4UdevH1W0uKcJmXjD8gBPAGIgRsrQ4e6cN7GuieYAU4R4yYfN2Kd3qWJncej3WUMWqKdTiVQyaTwQWvFnPUKVV5lH+QAbBx64Li3wUd/TGNum9byVgFN4jpbMuqt/uuQZzxWFA2lBFHEZWXD9YpE/mO+RjqNJTMQxoAEbfcfsWvIPabXC9w05QD/2CJmM6h8egJK945vzRsxA/BatJQSRZlRx223F6U9lR5UA5ItdLydy8ciGnePgGxMSdAbsxztPWbbyscFzlh5d6LPw8zZx2Kliw//IHl4LZbJ8xNbkutp/UAhVh0W2Gtj7NOdClpWeQB8RXWxLqVe/taFN7XBVEGlAWHRYYqyIfQz7XOovmFtSPJNcBi6ZB/IoTRv7+/LUrEwKUxuILBRXfAMR9q+q6/OV3/sWhfs+fioohGNsCj5xJFHyMfj/gDVDsYvCWv9tc0B6/LK+IIH9jb3xhjdA3HA3VZcEYBzwC+JiefGpyu2nhHcFTvFbn0Rv6tfydU7TC6KcbETJyyB/TA0OS06cXbgg0D2oe5GEhgGER1a827oUcijDwjX+fBcPCOtLz7wk9oW4Hhr3/2JprTZwuPvi9m9NmRjVFCwK09xV37SxEglnlAkMeabg+mTXhKh2SYtQGw88PvWfMijtNiC1KYbADwBLlwwreMDSE6dUI3BwK+p5+toaM6Xnv0AzE1EoE/TRGyEly9LHXE0d3R7eFU52JA0+qe/4455FSXrHBqfVQGQCIoTMN+6/kYERASQ68nJDNYWIEhQhoRR+H57580h3zo9xuHoE9XXpDITUk4RMpjlEymUXsOvAd0A4TYtx1CZ8UJHNenunmSBvBUk8PuoqlxvvnV/m0uSQbyxGFR0X8uvjFGyHzO4eB5mKJGDKEsKRGEM436N+lQZJTHg4fhHwL2Fxbr9U/Pph1D4WbaNmoPSGXwk/2inAvnOYuLhfAA2of3lcCeuoMzhooZhLIDYKo2t2XArw7vSxqEtsLjtLW/nk+l9wxAGMVFzgyQzPvRNrHKtvmTNiezwZV96dx4JAPBcgPCR8R0Sg6bJnvq2Vqa+wOaZMHHov74+6LKiZMGSGTVEPeV4P0lkMNNgBrMJHIAIG7gRRV4c0EQS6OkG1rbIbEd1HTS+Mub6JGxkEvR/H/1GixGG+ou8QAAAABJRU5ErkJggg==";function Wr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=te.useState(n0),c=u=>{a(n0)};return te.useEffect(()=>{a(e||n0)},[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:R$})]})}function D$({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=Eo(),a=te.useMemo(()=>{if(n&&r)return n(r)},[r]),c=te.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return 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(N$,{})}),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(I2,{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"}),gu.map(u=>b.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:b.jsx(Wr,{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 $$=xi((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}=$$(),i=(a,c="success")=>{const l={id:Date.now(),status:c,buildShowInfo:()=>({toastTitleText:a})};r(l)},s=a=>{const c=Date.now();return a.id=c,r(a),c},o=te.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),On.createPortal(b.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>b.jsx(D$,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}},eK="";function B$(){const{mevProtect:e,setMevProtect:t}=qr();return b.jsxs(Ci.Root,{children:[b.jsx(Ci.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(Ci.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:Lt("/images/icon_mev@2x.png")}),b.jsx("span",{children:"MEV Protect"})]}),b.jsx(O4,{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 L$({onClick:e}){const[t,r]=te.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"})})})}const tK="",rK="";function i0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return b.jsx($x,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function U$(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=qr();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(F$,{onClose:()=>e(!1)})]})}function F$({onClose:e}){const{slippage:t,setSlippage:r}=qr(),[n,i]=te.useState(t),s=u=>{i(u.display)},o=u=>{const l=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");u.target.value=u.target.value.replace(l,"$1"),i(u.target.value)},a=()=>{n&&r(n),e()},c=te.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return 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:ij.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 z$({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(U$,{}),b.jsx(B$,{}),b.jsx(L$,{onClick:e})]})]})})}const nK="",iK="";function V$(){const[e,t]=te.useState(!1);return b.jsxs(Ci.Root,{open:e,onOpenChange:t,children:[b.jsx(Ci.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(Ci.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(q$,{}),b.jsx(H$,{onClose:()=>{t(!1)}})]})})]})}function q$(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=qr(),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:gu.map(s=>b.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[b.jsx(Bu,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),b.jsx("img",{src:s.img}),b.jsx("span",{children:s.name})]}))})]})}const G$=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function H$({onClose:e}){const{addTxToast:t}=zo(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=qr(),[a,c]=te.useState(i),[u,l]=te.useState(r),f=w=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${w}`})})},h=w=>{l(w),w.isCustom||(n(w),f(w.link),e())},y=w=>{c(w.target.value)},_=()=>{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(Bu,{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:G$(a),text:"Save",onClick:_})]})]})]})}const sK="",Sn=xi((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 W$=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()}},K$=W$,Bx={"text/plain":"Text","text/html":"Url",default:"Text"},X$="Copy to clipboard: #{key}, Enter";function Y$(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function J$(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=K$(),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=Bx[t.format]||Bx.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=Y$("message"in t?t.message:X$),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var Z$=J$;const Lx=Zo(Z$);function Q$({currentAccount:e}){const{mutate:t}=Rr.useSwitchAccount(),r=Rr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Sn(),s=()=>{i(!n)};te.useEffect(()=>()=>{i(!1)},[]);const o=te.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);te.useEffect(()=>{},[o]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return b.jsxs("div",{className:"cs-account-switch",children:[b.jsxs("div",{className:"account",onClick:s,children:[b.jsx("span",{children:Is(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:Is(c==null?void 0:c.address)})]}),b.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}function eB({connect:e}){const t=Rr.useCurrentAccount();return te.useEffect(()=>{},[t]),b.jsx("div",{children:t?b.jsx(tB,{}):b.jsx(i0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})}function tB(){const{mutate:e}=Rr.useDisconnectWallet(),t=Rr.useCurrentAccount(),{currentWallet:r}=Rr.useCurrentWallet(),{addCommonToast:n}=zo(),{getExplorerUrl:i}=Eo(),s=()=>{t&&(Lx(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return te.useEffect(()=>{},[r]),b.jsxs(Ci.Root,{children:[b.jsx(Ci.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:Is(t==null?void 0:t.address)})]})}),b.jsx(Ci.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(Q$,{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 rB(){Rr.useCurrentAccount(),Rr.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Sn();return Rr.useWallets(),b.jsx(b.Fragment,{children:b.jsx(Rr.ConnectModal,{trigger:b.jsx(eB,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function nB({independentWallet:e,customWallet:t}){return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"widget-header",children:[b.jsx("img",{src:Lt("/images/logo@2x.png"),className:"cetus-logo"}),b.jsxs("div",{className:"right",children:[e&&b.jsx(rB,{}),b.jsx(V$,{})]})]}),b.jsx("div",{style:{marginTop:"20px"}})]})}const oK="",Ux=()=>{const e=te.useRef(null);te.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"#75C8FF",boxShadow:"0px 0px 20px 2px #75C8FF",borderRadius:"50%"};return 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 iB({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=te.useMemo(()=>{if(n&&r)return n(r)},[r]);return b.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&b.jsx(sB,{info:s,status:r}),(r==="success"||r==="rejected")&&b.jsx(oB,{info:s,status:r,tx:i,onClose:e})]})}function sB({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(Ux,{})}),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 oB({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Eo();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"}),gu.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 el(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await tj(`${i||yu.api}${t}`,n):await rj(`${i||yu.api}${t}`,n)}catch(s){throw s}}}}function aB(){const{fetchByApi:e}=el(),{setProviders:t}=qr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function cB({interval:e,callback:t}){const r=te.useRef(),n=te.useRef(null);te.useEffect(()=>{r.current=t},[t]);const i=te.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=te.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return te.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Ds=xi((e,t)=>({suiClient:new la({url:yu.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new Kw,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),rc=xi((e,t)=>({requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=new Map(n);s.set(Tr(r.coin_type).full_address,r);const o=i.filter(a=>a!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...o]})),_i.setItem(ih,s)},tokenMap:new Map,setTokenMap:(r,n=!1)=>{e(()=>({tokenMap:r})),n||_i.setItem(ih,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||_i.setItem(x2,r)}}));_i.getItem(ih).then(e=>{e!==null&&rc.getState().setTokenMap(e,!0)}),_i.getItem(x2).then(e=>{e!==null&&rc.getState().setTrustedTokenList(e,!0)});function uB(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 $s(){const{suiClient:e}=Ds(),{fetchByApi:t}=el(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=rc(),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:Tr(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){w2(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const _=uB(y,f);return i(_),_}}catch{}},l=te.useCallback(f=>{if(f)return n.get(Tr(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function tl(e){const{suiClient:t}=Ds(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Sn(),{fetchTokenInfo:s}=$s(),[o,a]=te.useState([]),{tokenMap:c}=rc(),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({})};te.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=Hk(A.totalBalance,I==null?void 0:I.decimals),R=tn(P,4);_[Tr(A.coinType).full_address]={...A,displayBalance:R,totalBalanceFormat:P}}catch{continue}n(_)},h=te.useMemo(()=>{if(e&&r)return i[e]||i[Tr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const sn=xi((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}))}})),lB={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"}},fB={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"}},Fx=lB,zx=fB;function dB(e,t){const{fetchTokenInfo:r}=$s(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=sn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=qr(),u=te.useRef({}),l=async(h,y)=>{const _=h?await r(h):Fx,w=y?await r(y):zx;n(_),i(w),s(_,w)},f=(h,y)=>{const _=[vu[0]];let w=vu[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 te.useEffect(()=>{if(!rh(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 hB(){const{currentRpc:e}=qr(),{setSuiClient:t,setAggregatorSDK:r}=Ds(),{currentAccount:n}=Sn();te.useEffect(()=>{if(e){const i=new la({url:e.link});t(i)}},[e]),te.useEffect(()=>{if(e){const i=new Kw(yu.aggregatorUrl,(n==null?void 0:n.address)||void 0,new la({url:e.link}),X9.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const Vx=xi((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Tr(i).full_address]}),e({coinPriceObj:{...n}})}}));function rl(){const{fetchByApi:e}=el(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=Vx(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>nh(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Tr(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=te.useCallback(a=>{if(!a)return;const c=t[Tr(a).full_address];if(c)return c},[t]),o=te.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return ze(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const s0=xi((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),_r=[];for(let e=0;e<256;++e)_r.push((e+256).toString(16).slice(1));function pB(e,t=0){return(_r[e[t+0]]+_r[e[t+1]]+_r[e[t+2]]+_r[e[t+3]]+"-"+_r[e[t+4]]+_r[e[t+5]]+"-"+_r[e[t+6]]+_r[e[t+7]]+"-"+_r[e[t+8]]+_r[e[t+9]]+"-"+_r[e[t+10]]+_r[e[t+11]]+_r[e[t+12]]+_r[e[t+13]]+_r[e[t+14]]+_r[e[t+15]]).toLowerCase()}let o0;const mB=new Uint8Array(16);function gB(){if(!o0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");o0=crypto.getRandomValues.bind(crypto)}return o0(mB)}const qx={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Gx(e,t,r){if(qx.randomUUID&&!t&&!e)return qx.randomUUID();e=e||{};const n=e.random||(e.rng||gB)();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 pB(n)}var nl=(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))(nl||{});const vB=new la({url:mp("mainnet")}),yB=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],bB=["deny_list","DenyList","DenyCap","create_regulated_currency"],wB={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},_B=async e=>{let t=!1;if(yB.includes(e))return t;const r=e.split("::"),n=r[0]&&Dr(r[0]),i=r[1],s=await vB.getObject({id:n,options:wB}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(bB.join("|"),"i").test(o)&&(t=!0),t},xB=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>nh(i,!1)))==null?void 0:n.join(",")};function SB(){const{fetchByApi:e}=el(),t=async n=>{try{const i={...n},s=xB(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=Lt("/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(_=>$a(_).source_address);f=l==null?void 0:l.filter(_=>{var I,P;const w=$a((I=_==null?void 0:_.coin_a)==null?void 0:I.address).source_address,A=$a((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 EB(e=!0){const{poolApiMap:t,setPoolApiMap:r}=qr(),{getPoolList:n,getLocalJsonPoolList:i}=SB();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 MB(e){const{routerData:t}=sn();return{priceAcceptRouterData:te.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!ze(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!ze(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function Hx(e,t){return{amountLimit:te.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?ze(s).mul(ze(1).sub(ze(e).div(100))).toString():ze(i).mul(ze(1).add(ze(e).div(100))).toString()}},[e,t])}}function CB(e){const{getTokenInfo:t,fetchTokenInfo:r}=$s();return{formatSwapRouter:te.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=ze(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=ze(1).sub(c).toFixed(2):h.percentage=ze(y).div(s).toFixed(2),c=ze(c).add(h.percentage);const _=[];l.path.forEach(w=>{i.includes(w.provider)||i.push(w.provider);const A=Tr(w.from).full_address,I=Tr(w.target).full_address,P=t(A),R=t(I);P||a.includes(A)&&a.push(A),R||a.includes(I)&&a.push(I);const F=w.provider===Ua.SCALLOP||w.provider===Ua.FLOWX||w.provider===Ua.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 AB(){const{fromCoin:e,toCoin:t}=sn(),{getPoolListByCoinType:r}=EB();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function Wx(e,t,r){return te.useMemo(()=>t&&r&&+t&&+r?e?ze(r).div(t).toString():ze(t).div(r).toString():"0",[t,r,e])}function Kx(e){const[t,r]=te.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await _B(i.coin_type)}catch{}return!1};return te.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function TB(){const{defaultFromCoin:e,defaultToCoin:t}=sn();return{isCustomMode:te.useMemo(()=>(e==null?void 0:e.coin_type)!==Fx.coin_type||(t==null?void 0:t.coin_type)!==zx.coin_type,[e,t])}}function OB(){const{aggregatorSDK:e}=Ds(),{getSwapPoolAddress:t}=AB(),r=s=>s&&s.error?s.error.code===nl.InsufficientLiquidity||nl.HoneyPot||nl.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 Zw(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 Zw(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=th(f.amountIn.toString(),u.decimals).toString(),y=th(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 Vo(e){const t=te.useRef(e);return te.useEffect(()=>{t.current=e},[e]),t}function IB(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function kB(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function jB(e){return!!String(e).includes("Could not find the referenced transaction")}function PB(e){return IB(e)?"User rejected the request":kB(e)?"Exceeded price slippage":jB(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var a0={},NB=Jw();const RB=Zo(NB);function Xx(e,t){return function(){return e.apply(t,arguments)}}const{toString:DB}=Object.prototype,{getPrototypeOf:c0}=Object,il=(e=>t=>{const r=DB.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),En=e=>(e=e.toLowerCase(),t=>il(t)===e),sl=e=>t=>typeof t===e,{isArray:qo}=Array,nc=sl("undefined");function $B(e){return e!==null&&!nc(e)&&e.constructor!==null&&!nc(e.constructor)&&Kr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yx=En("ArrayBuffer");function BB(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yx(e.buffer),t}const LB=sl("string"),Kr=sl("function"),Jx=sl("number"),ol=e=>e!==null&&typeof e=="object",UB=e=>e===!0||e===!1,al=e=>{if(il(e)!=="object")return!1;const t=c0(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},FB=En("Date"),zB=En("File"),VB=En("Blob"),qB=En("FileList"),GB=e=>ol(e)&&Kr(e.pipe),HB=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Kr(e.append)&&((t=il(e))==="formdata"||t==="object"&&Kr(e.toString)&&e.toString()==="[object FormData]"))},WB=En("URLSearchParams"),[KB,XB,YB,JB]=["ReadableStream","Request","Response","Headers"].map(En),ZB=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ic(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),qo(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 Zx(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 Bs=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Hs)(),Qx=e=>!nc(e)&&e!==Bs;function u0(){const{caseless:e}=Qx(this)&&this||{},t={},r=(n,i)=>{const s=e&&Zx(t,i)||i;al(t[s])&&al(n)?t[s]=u0(t[s],n):al(n)?t[s]=u0({},n):qo(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&ic(arguments[n],r);return t}const QB=(e,t,r,{allOwnKeys:n}={})=>(ic(t,(i,s)=>{r&&Kr(i)?e[s]=Xx(i,r):e[s]=i},{allOwnKeys:n}),e),eL=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),tL=(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)},rL=(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&&c0(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},nL=(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},iL=e=>{if(!e)return null;if(qo(e))return e;let t=e.length;if(!Jx(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},sL=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&c0(Uint8Array)),oL=(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])}},aL=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},cL=En("HTMLFormElement"),uL=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),e6=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),lL=En("RegExp"),t6=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};ic(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},fL=e=>{t6(e,(t,r)=>{if(Kr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Kr(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},dL=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return qo(e)?n(e):n(String(e).split(t)),r},hL=()=>{},pL=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,l0="abcdefghijklmnopqrstuvwxyz",r6="0123456789",n6={DIGIT:r6,ALPHA:l0,ALPHA_DIGIT:l0+l0.toUpperCase()+r6},mL=(e=16,t=n6.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function gL(e){return!!(e&&Kr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const vL=e=>{const t=new Array(10),r=(n,i)=>{if(ol(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=qo(n)?[]:{};return ic(n,(o,a)=>{const c=r(o,i+1);!nc(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},yL=En("AsyncFunction"),bL=e=>e&&(ol(e)||Kr(e))&&Kr(e.then)&&Kr(e.catch),i6=((e,t)=>e?setImmediate:t?((r,n)=>(Bs.addEventListener("message",({source:i,data:s})=>{i===Bs&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Bs.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Kr(Bs.postMessage)),wL=typeof queueMicrotask<"u"?queueMicrotask.bind(Bs):typeof Pi<"u"&&Pi.nextTick||i6;var fe={isArray:qo,isArrayBuffer:Yx,isBuffer:$B,isFormData:HB,isArrayBufferView:BB,isString:LB,isNumber:Jx,isBoolean:UB,isObject:ol,isPlainObject:al,isReadableStream:KB,isRequest:XB,isResponse:YB,isHeaders:JB,isUndefined:nc,isDate:FB,isFile:zB,isBlob:VB,isRegExp:lL,isFunction:Kr,isStream:GB,isURLSearchParams:WB,isTypedArray:sL,isFileList:qB,forEach:ic,merge:u0,extend:QB,trim:ZB,stripBOM:eL,inherits:tL,toFlatObject:rL,kindOf:il,kindOfTest:En,endsWith:nL,toArray:iL,forEachEntry:oL,matchAll:aL,isHTMLForm:cL,hasOwnProperty:e6,hasOwnProp:e6,reduceDescriptors:t6,freezeMethods:fL,toObjectSet:dL,toCamelCase:uL,noop:hL,toFiniteNumber:pL,findKey:Zx,global:Bs,isContextDefined:Qx,ALPHABET:n6,generateString:mL,isSpecCompliantForm:gL,toJSONObject:vL,isAsyncFn:yL,isThenable:bL,setImmediate:i6,asap:wL};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 s6=pt.prototype,o6={};["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=>{o6[e]={value:e}}),Object.defineProperties(pt,o6),Object.defineProperty(s6,"isAxiosError",{value:!0}),pt.from=(e,t,r,n,i,s)=>{const o=Object.create(s6);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 _L=null;function f0(e){return fe.isPlainObject(e)||fe.isArray(e)}function a6(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function c6(e,t,r){return e?e.concat(t).map(function(i,s){return i=a6(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function xL(e){return fe.isArray(e)&&!e.some(f0)}const SL=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function cl(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([_]):RB.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(_)&&xL(_)||(fe.isFileList(_)||fe.endsWith(w,"[]"))&&(I=fe.toArray(_)))return w=a6(w),I.forEach(function(R,F){!(fe.isUndefined(R)||R===null)&&t.append(o===!0?c6([w],F,s):o===null?w:w+"[]",u(R))}),!1}return f0(_)?!0:(t.append(c6(A,w,s),u(_)),!1)}const f=[],h=Object.assign(SL,{defaultVisitor:l,convertValue:u,isVisitable:f0});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 u6(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function d0(e,t){this._pairs=[],e&&cl(e,this,t)}const l6=d0.prototype;l6.append=function(t,r){this._pairs.push([t,r])},l6.toString=function(t){const r=t?function(n){return t.call(this,n,u6)}:u6;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function EL(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function f6(e,t,r){if(!t)return e;const n=r&&r.encode||EL;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 d0(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class ML{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 d6=ML,h6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CL=typeof URLSearchParams<"u"?URLSearchParams:d0,AL=typeof FormData<"u"?FormData:null,TL=typeof Blob<"u"?Blob:null,OL={isBrowser:!0,classes:{URLSearchParams:CL,FormData:AL,Blob:TL},protocols:["http","https","file","blob","url","data"]};const h0=typeof window<"u"&&typeof document<"u",p0=typeof navigator=="object"&&navigator||void 0,IL=h0&&(!p0||["ReactNative","NativeScript","NS"].indexOf(p0.product)<0),kL=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),jL=h0&&window.location.href||"http://localhost";var PL=Object.freeze({__proto__:null,hasBrowserEnv:h0,hasStandardBrowserWebWorkerEnv:kL,hasStandardBrowserEnv:IL,navigator:p0,origin:jL}),Ir={...PL,...OL};function NL(e,t){return cl(e,new Ir.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Ir.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function RL(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function DL(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 p6(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]=DL(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(RL(n),i,r,0)}),r}return null}function $L(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 m0={transitional:h6,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(p6(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 NL(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return cl(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),$L(t)):t}],transformResponse:[function(t){const r=this.transitional||m0.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:Ir.classes.FormData,Blob:Ir.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=>{m0.headers[e]={}});var g0=m0;const BL=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 LL=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]&&BL[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const m6=Symbol("internals");function sc(e){return e&&String(e).trim().toLowerCase()}function ul(e){return e===!1||e==null?e:fe.isArray(e)?e.map(ul):String(e)}function UL(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 FL=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function v0(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 zL(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function VL(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 ll{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=sc(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]=ul(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())&&!FL(t))o(LL(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=sc(t),t){const n=fe.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return UL(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=sc(t),t){const n=fe.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||v0(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=sc(o),o){const a=fe.findKey(n,o);a&&(!r||v0(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||v0(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]=ul(i),delete r[s];return}const a=t?zL(s):String(s).trim();a!==s&&delete r[s],r[a]=ul(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[m6]=this[m6]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=sc(o);n[a]||(VL(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}ll.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(ll.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),fe.freezeMethods(ll);var Mn=ll;function y0(e,t){const r=this||g0,n=t||r,i=Mn.from(n.headers);let s=n.data;return fe.forEach(e,function(a){s=a.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function g6(e){return!!(e&&e.__CANCEL__)}function Go(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(Go,pt,{__CANCEL__:!0});function v6(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 qL(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function GL(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 HL(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 fl=(e,t,r=3)=>{let n=0;const i=GL(50,250);return HL(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)},y6=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},b6=e=>(...t)=>fe.asap(()=>e(...t));var WL=Ir.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Ir.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Ir.origin),Ir.navigator&&/(msie|trident)/i.test(Ir.navigator.userAgent)):()=>!0,KL=Ir.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 XL(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function YL(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function w6(e,t){return e&&!XL(t)?YL(e,t):t}const _6=e=>e instanceof Mn?{...e}:e;function Ls(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(_6(u),_6(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 x6=e=>{const t=Ls({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=Mn.from(o),t.url=f6(w6(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(Ir.hasStandardBrowserEnv||Ir.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(Ir.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&WL(t.url))){const u=i&&s&&KL.read(s);u&&o.set(i,u)}return t},JL=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=x6(e);let s=i.data;const o=Mn.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 R=Mn.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:R,config:e,request:A};v6(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||h6;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,_]=fl(u,!0),A.addEventListener("progress",h)),c&&A.upload&&([f,y]=fl(c),A.upload.addEventListener("progress",f),A.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=R=>{A&&(n(!R||R.type?new Go(null,e,A):R),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const P=qL(i.url);if(P&&Ir.protocols.indexOf(P)===-1){n(new pt("Unsupported protocol "+P+":",pt.ERR_BAD_REQUEST,e));return}A.send(s||null)})},ZL=(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 Go(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,s(new pt(`timeout ${t} of ms exceeded`,pt.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>fe.asap(a),c}};const QL=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},eU=async function*(e,t){for await(const r of tU(e))yield*QL(r,t)},tU=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()}},S6=(e,t,r,n)=>{const i=eU(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})},dl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",E6=dl&&typeof ReadableStream=="function",rU=dl&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),M6=(e,...t)=>{try{return!!e(...t)}catch{return!1}},nU=E6&&M6(()=>{let e=!1;const t=new Request(Ir.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),C6=64*1024,b0=E6&&M6(()=>fe.isReadableStream(new Response("").body)),hl={stream:b0&&(e=>e.body)};dl&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!hl[t]&&(hl[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 iU=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Ir.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 rU(e)).byteLength},sU=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??iU(t)};var oU=dl&&(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}=x6(e);u=u?(u+"").toLowerCase():"text";let y=ZL([i,s&&s.toAbortSignal()],o),_;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let A;try{if(c&&nU&&r!=="get"&&r!=="head"&&(A=await sU(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]=y6(A,fl(b6(c)));n=S6(L.body,C6,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 R=b0&&(u==="stream"||u==="response");if(b0&&(a||R&&w)){const L={};["status","statusText","headers"].forEach(ne=>{L[ne]=P[ne]});const H=fe.toFiniteNumber(P.headers.get("content-length")),[q,X]=a&&y6(H,fl(b6(a),!0))||[];P=new Response(S6(P.body,C6,q,()=>{X&&X(),w&&w()}),L)}u=u||"text";let F=await hl[fe.findKey(hl,u)||"text"](P,e);return!R&&w&&w(),await new Promise((L,H)=>{v6(L,H,{data:F,headers:Mn.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 w0={http:_L,xhr:JL,fetch:oU};fe.forEach(w0,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const A6=e=>`- ${e}`,aU=e=>fe.isFunction(e)||e===null||e===!1;var T6={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,!aU(r)&&(n=w0[(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(A6).join(`
|
|
96
|
-
`):" "+A6(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:w0};function _0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Go(null,e)}function O6(e){return _0(e),e.headers=Mn.from(e.headers),e.data=y0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),T6.getAdapter(e.adapter||g0.adapter)(e).then(function(n){return _0(e),n.data=y0.call(e,e.transformResponse,n),n.headers=Mn.from(n.headers),n},function(n){return g6(n)||(_0(e),n&&n.response&&(n.response.data=y0.call(e,e.transformResponse,n.response),n.response.headers=Mn.from(n.response.headers))),Promise.reject(n)})}const I6="1.7.9",pl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pl[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const k6={};pl.transitional=function(t,r,n){function i(s,o){return"[Axios v"+I6+"] 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&&!k6[o]&&(k6[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}},pl.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function cU(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 ml={assertOptions:cU,validators:pl};const Jn=ml.validators;class gl{constructor(t){this.defaults=t,this.interceptors={request:new d6,response:new d6}}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=Ls(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&ml.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}:ml.assertOptions(i,{encode:Jn.function,serialize:Jn.function},!0)),ml.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=Mn.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(r)===!1||(c=c&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let l,f=0,h;if(!c){const _=[O6.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=O6.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=Ls(this.defaults,t);const r=w6(t.baseURL,t.url);return f6(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){gl.prototype[t]=function(r,n){return this.request(Ls(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(Ls(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}gl.prototype[t]=r(),gl.prototype[t+"Form"]=r(!0)});var vl=gl;class x0{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 Go(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 x0(function(i){t=i}),cancel:t}}}var uU=x0;function lU(e){return function(r){return e.apply(null,r)}}function fU(e){return fe.isObject(e)&&e.isAxiosError===!0}const S0={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(S0).forEach(([e,t])=>{S0[t]=e});var dU=S0;function j6(e){const t=new vl(e),r=Xx(vl.prototype.request,t);return fe.extend(r,vl.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return j6(Ls(e,i))},r}const cr=j6(g0);cr.Axios=vl,cr.CanceledError=Go,cr.CancelToken=uU,cr.isCancel=g6,cr.VERSION=I6,cr.toFormData=cl,cr.AxiosError=pt,cr.Cancel=cr.CanceledError,cr.all=function(t){return Promise.all(t)},cr.spread=lU,cr.isAxiosError=fU,cr.mergeConfig=Ls,cr.AxiosHeaders=Mn,cr.formToJSON=e=>p6(fe.isHTMLForm(e)?new FormData(e):e),cr.getAdapter=T6.getAdapter,cr.HttpStatusCode=dU,cr.default=cr;var hU=cr;Object.defineProperty(a0,"__esModule",{value:!0});var pU=a0.executeAuction=P6,mU=hU,gU="https://rpc.getshio.com",vU=500,yU=300;function P6(e,t,r){r===void 0&&(r=vU);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),mU.default.post(gU,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,yU)}).catch(s)})}a0.default={executeAuction:P6};function bU(){const{suiClient:e}=Ds(),{currentAccount:t}=Sn(),{mutateAsync:r}=Rr.useSignTransaction(),{mutate:n}=Rr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=te.useMemo(()=>t==null?void 0:t.chains[0],[t]),s=async(c,u,l=!1)=>{var h,y;if(l){const _=await e.devInspectTransactionBlock({transactionBlock:ho.Transaction.from(cn(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=ho.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=ho.Transaction.from(c)),typeof c=="string"&&(c=ho.Transaction.from(cn(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 wU(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=bU(),{currentAccount:n}=Sn(),{suiClient:i}=Ds(),{setTransactionData:s}=s0(),{addTxToast:o,removeToast:a}=zo(),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 v2(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 R;_.status="confirmation",s(_);try{let H;if(P==="signTransactionBlock"){const X=await e(y),{bytes:ne,signature:ce}=X;if(I)try{const oe=await pU(ne,ce,500)}catch{}H=await t(ne,ce,A)}else H=await r(y,A);_.status="submitted",s({..._}),_.tx=H.digest,R=o(_),await v2(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=Zk(q,n==null?void 0:n.address,!1);if(_.buildShowInfo){const ne=_.buildShowInfo("success",X);_.buildShowInfo=ce=>ne}a(R),_.status="success",s({..._})}return q}catch(H){h(_,H)}},h=(y,_)=>{const w=PB(_);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 N6(e,t=1e3){const r=te.useRef(),n=te.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return te.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function _U(){const{aggregatorSDK:e}=Ds(),{findBestRouters:t}=OB(),{getTokenAmountValue:r,fetchTokenPrices:n}=rl(),{providers:i,slippage:s,mevProtect:o}=qr(),{signAndExecuteTransaction:a}=wU(),{setTransactionData:c}=s0(),{addTxToast:u}=zo(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:_,fromAmount:w,toAmount:A,setFromAmount:I,setFindRouterLoading:P,setRouterData:R,setByAmountIn:F,byAmountIn:L}=sn(),[H,q]=te.useState(""),X=Vo(H),ne=Vo(L),ce=Vo(w),oe=Vo(A),V=Vo(l),$=Vo(f),{balanceInfo:p,getOwnerCoinBalances:d}=tl(l==null?void 0:l.coin_type),{balanceInfo:m}=tl(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=N6(async(Me,Ye,Ue)=>{if(V.current&&$.current&&+Me){(+ce.current||+oe.current)&&P(!0);const lt=Xk(Me,Ye?V.current.decimals:$.current.decimals),ht=await t({fromToken:V.current,toToken:$.current,amount:lt.toString(),providersKeys:i,by_amount_in:Ye,uuid:Ue});P(!1),X.current===Ue&&(Ye?+ce.current?(_(ht.toAmountUi||""),R(ht)):_(""):+oe.current?(I(ht.fromAmountUi||"ß"),R(ht)):I(""))}else v(!Ye)},500),T=(Me,Ye,Ue=!1)=>{if(F(Ye),Ye?(I(Me),Ue&&_("")):(_(Me),Ue&&I("")),+Me){const lt=Gx();q(lt),k(Me,Ye,lt)}else P(!1),R(void 0),v(!Ye)},g=(Me,Ye=!0)=>{v(),Ye?((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),R(void 0)},N=()=>{const Me=ne.current?ce.current:oe.current;if(+Me){const Ye=Gx();q(Ye),k(Me,ne.current,Ye)}},se=async(Me,Ye)=>{const{routerData:Ue,byAmountIn:lt,fromAmountUi:ht,toAmountUi:$e}=Me,mt=new ho.Transaction,we={routers:Ue.routes,byAmountIn:lt,slippage:Number(s),txb:mt};Ye&&(we.partner=Ye);try{await e.fastRouterSwap(we);const me={status:"confirmation",buildShowInfo:(Ge,De)=>{const Oe=`Swap ${tn(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${tn($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(Ge==="success"){let Le=ht,ft=$e;De&&(Le=y2(De,l)||ht,ft=y2(De,f)||$e);const dt=`Swapped ${tn(Le,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${tn(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()):N()}catch(me){String(me).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Te,Ge){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};te.useEffect(()=>{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}=Kx(l),{isScamsCoin:be}=Kx(f),Ce=te.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:N,refreshMarketPrice:ue,scamsText:Ce}}function xU(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=sn(),{currentAccount:o}=Sn(),a=te.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&&ze(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 R6({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:`
|
|
97
|
+
`)},BL=0,ea=[];function LL(e){var t=I.useRef([]),r=I.useRef([0,0]),n=I.useRef(),i=I.useState(BL++)[0],s=I.useState(n6)[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 _=oL([e.lockRef.current],(e.shards||[]).map(l6),!0).filter(Boolean);return _.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(_,A){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!o.current.allowPinchZoom;var P=Il(_),N=r.current,R="deltaX"in _?_.deltaX:N[0]-P[0],F="deltaY"in _?_.deltaY:N[1]-P[1],L,W=_.target,q=Math.abs(R)>Math.abs(F)?"h":"v";if("touches"in _&&q==="h"&&W.type==="range")return!1;var X=o6(q,W);if(!X)return!0;if(X?L=q:(L=q==="v"?"h":"v",X=o6(q,W)),!X)return!1;if(!n.current&&"changedTouches"in _&&(R||F)&&(n.current=L),!L)return!0;var ie=n.current||L;return RL(ie,A,_,ie==="h"?R:F,!0)},[]),c=I.useCallback(function(_){var A=_;if(!(!ea.length||ea[ea.length-1]!==s)){var P="deltaY"in A?u6(A):Il(A),N=t.current.filter(function(L){return L.name===A.type&&(L.target===A.target||A.target===L.shadowParent)&&DL(L.delta,P)})[0];if(N&&N.should){A.cancelable&&A.preventDefault();return}if(!N){var R=(o.current.shards||[]).map(l6).filter(Boolean).filter(function(L){return L.contains(A.target)}),F=R.length>0?a(A,R[0]):!o.current.noIsolation;F&&A.cancelable&&A.preventDefault()}}},[]),u=I.useCallback(function(_,A,P,N){var R={name:_,delta:A,target:P,should:N,shadowParent:FL(P)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(F){return F!==R})},1)},[]),l=I.useCallback(function(_){r.current=Il(_),n.current=void 0},[]),f=I.useCallback(function(_){u(_.type,u6(_),_.target,a(_,e.lockRef.current))},[]),h=I.useCallback(function(_){u(_.type,Il(_),_.target,a(_,e.lockRef.current))},[]);I.useEffect(function(){return ea.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Qo),document.addEventListener("touchmove",c,Qo),document.addEventListener("touchstart",l,Qo),function(){ea=ea.filter(function(_){return _!==s}),document.removeEventListener("wheel",c,Qo),document.removeEventListener("touchmove",c,Qo),document.removeEventListener("touchstart",l,Qo)}},[]);var y=e.removeScrollBar,b=e.inert;return I.createElement(I.Fragment,null,b?I.createElement(s,{styles:$L(i)}):null,y?I.createElement(AL,{gapMode:e.gapMode}):null)}function FL(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const UL=mL(t6,LL);var f6=I.forwardRef(function(e,t){return I.createElement(Al,si({},e,{ref:t,sideCar:UL}))});f6.classNames=Al.classNames;const zL=f6;function VL(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var Qp="ScrollArea",[d6,sJ]=Fo(Qp),[qL,un]=d6(Qp),h6=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),[_,A]=I.useState(null),[P,N]=I.useState(0),[R,F]=I.useState(0),[L,W]=I.useState(!1),[q,X]=I.useState(!1),ie=Qt(t,ce=>c(ce)),ae=Lp(i);return w.jsx(qL,{scope:r,type:n,dir:ae,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:h,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:L,onScrollbarXEnabledChange:W,scrollbarY:_,onScrollbarYChange:A,scrollbarYEnabled:q,onScrollbarYEnabledChange:X,onCornerWidthChange:N,onCornerHeightChange:F,children:w.jsx(Wt.div,{dir:ae,...o,ref:ie,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":R+"px",...e.style}})})});h6.displayName=Qp;var p6="ScrollAreaViewport",m6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=un(p6,r),a=I.useRef(null),c=Qt(t,a,o.onViewportChange);return w.jsxs(w.Fragment,{children:[w.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}),w.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:w.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});m6.displayName=p6;var oi="ScrollAreaScrollbar",g6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=un(oi,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"?w.jsx(GL,{...n,ref:t,forceMount:r}):i.type==="scroll"?w.jsx(WL,{...n,ref:t,forceMount:r}):i.type==="auto"?w.jsx(v6,{...n,ref:t,forceMount:r}):i.type==="always"?w.jsx(e0,{...n,ref:t}):null});g6.displayName=oi;var GL=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=un(oi,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]),w.jsx(jn,{present:r||s,children:w.jsx(v6,{"data-state":s?"visible":"hidden",...n,ref:t})})}),WL=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=un(oi,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Nl(()=>c("SCROLL_END"),100),[a,c]=VL("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]),w.jsx(jn,{present:r||a!=="hidden",children:w.jsx(e0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),v6=I.forwardRef((e,t)=>{const r=un(oi,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=I.useState(!1),a=e.orientation==="horizontal",c=Nl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return ta(r.viewport,c),ta(r.content,c),w.jsx(jn,{present:n||s,children:w.jsx(e0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),e0=I.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=un(oi,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=x6(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 ZL(h,o.current,a,y)}return r==="horizontal"?w.jsx(HL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=S6(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"?w.jsx(KL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=S6(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}),HL=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=un(oi,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarXChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx(b6,{"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":kl(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),C6(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:jl(o.paddingLeft),paddingEnd:jl(o.paddingRight)}})}})}),KL=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=un(oi,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarYChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx(b6,{"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":kl(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),C6(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:jl(o.paddingTop),paddingEnd:jl(o.paddingBottom)}})}})}),[XL,y6]=d6(oi),b6=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=un(oi,r),[b,_]=I.useState(null),A=Qt(t,ie=>_(ie)),P=I.useRef(null),N=I.useRef(""),R=y.viewport,F=n.content-n.viewport,L=gr(l),W=gr(c),q=Nl(f,10);function X(ie){if(P.current){const ae=ie.clientX-P.current.left,ce=ie.clientY-P.current.top;u({x:ae,y:ce})}}return I.useEffect(()=>{const ie=ae=>{const ce=ae.target;(b==null?void 0:b.contains(ce))&&L(ae,F)};return document.addEventListener("wheel",ie,{passive:!1}),()=>document.removeEventListener("wheel",ie,{passive:!1})},[R,b,F,L]),I.useEffect(W,[n,W]),ta(b,q),ta(y.content,q),w.jsx(XL,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:gr(s),onThumbPointerUp:gr(o),onThumbPositionChange:W,onThumbPointerDown:gr(a),children:w.jsx(Wt.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:tt(e.onPointerDown,ie=>{ie.button===0&&(ie.target.setPointerCapture(ie.pointerId),P.current=b.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),X(ie))}),onPointerMove:tt(e.onPointerMove,X),onPointerUp:tt(e.onPointerUp,ie=>{const ae=ie.target;ae.hasPointerCapture(ie.pointerId)&&ae.releasePointerCapture(ie.pointerId),document.body.style.webkitUserSelect=N.current,y.viewport&&(y.viewport.style.scrollBehavior=""),P.current=null})})})}),Pl="ScrollAreaThumb",w6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=y6(Pl,e.__scopeScrollArea);return w.jsx(jn,{present:r||i.hasThumb,children:w.jsx(JL,{ref:t,...n})})}),JL=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=un(Pl,r),o=y6(Pl,r),{onThumbPositionChange:a}=o,c=Qt(t,f=>o.onThumbChange(f)),u=I.useRef(),l=Nl(()=>{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=QL(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,l,a]),w.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,_=f.clientY-y.top;o.onThumbPointerDown({x:b,y:_})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});w6.displayName=Pl;var t0="ScrollAreaCorner",_6=I.forwardRef((e,t)=>{const r=un(t0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?w.jsx(YL,{...e,ref:t}):null});_6.displayName=t0;var YL=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=un(t0,r),[s,o]=I.useState(0),[a,c]=I.useState(0),u=!!(s&&a);return ta(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),ta(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?w.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 jl(e){return e?parseInt(e,10):0}function x6(e,t){const r=e/t;return isNaN(r)?0:r}function kl(e){const t=x6(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function ZL(e,t,r,n="ltr"){const i=kl(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 E6([c,u],f)(e)}function S6(e,t,r="ltr"){const n=kl(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=HB(e,c);return E6([0,o],[0,a])(u)}function E6(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 C6(e,t){return e>0&&e<t}var QL=(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 Nl(e,t){const r=gr(e),n=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(n.current),[]),I.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function ta(e,t){const r=gr(t);ls(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var eF=h6,tF=m6,M6=g6,T6=w6,rF=_6,r0="Switch",[nF,oJ]=Fo(r0),[iF,sF]=nF(r0),A6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,R=>y(R)),_=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,N]=cc({prop:i,defaultProp:s,onChange:u});return w.jsxs(iF,{scope:r,checked:P,disabled:a,children:[w.jsx(Wt.button,{type:"button",role:"switch","aria-checked":P,"aria-required":o,"data-state":P6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:tt(e.onClick,R=>{N(F=>!F),A&&(_.current=R.isPropagationStopped(),_.current||R.stopPropagation())})}),A&&w.jsx(oF,{control:h,bubbles:!_.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});A6.displayName=r0;var O6="SwitchThumb",I6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=sF(O6,r);return w.jsx(Wt.span,{"data-state":P6(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});I6.displayName=O6;var oF=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=I.useRef(null),o=P4(r),a=Np(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]),w.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 P6(e){return e?"checked":"unchecked"}var aF=A6,cF=I6;const fc={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:uc,highContrast:bl,radius:Up},j6=I.forwardRef((e,t)=>{const{rest:r,...n}=Ko(e),{className:i,style:s,size:o=fc.size.default,variant:a=fc.variant.default,color:c=fc.color.default,highContrast:u=fc.highContrast.default,radius:l=fc.radius.default,...f}=r;return I.createElement("span",{"data-radius":l,className:Kt("rt-SwitchRoot",i,bt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Xo(n)),style:s},I.createElement(aF,{"data-accent-color":c,...f,ref:t,className:Kt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},I.createElement(cF,{className:Kt("rt-SwitchThumb",{"rt-high-contrast":u})})))});j6.displayName="Switch";var n0=["Enter"," "],uF=["ArrowDown","PageUp","Home"],k6=["ArrowUp","PageDown","End"],lF=[...uF,...k6],fF={ltr:[...n0,"ArrowRight"],rtl:[...n0,"ArrowLeft"]},dF={ltr:["ArrowLeft"],rtl:["ArrowRight"]},dc="Menu",[hc,hF,pF]=$4(dc),[Xs,N6]=Fo(dc,[pF,hl,L4]),pc=hl(),R6=L4(),[D6,gs]=Xs(dc),[mF,mc]=Xs(dc),$6=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=pc(t),[c,u]=I.useState(null),l=I.useRef(!1),f=gr(s),h=Lp(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})}},[]),w.jsx(h4,{...a,children:w.jsx(D6,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:w.jsx(mF,{scope:t,onClose:I.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};$6.displayName=dc;var gF="MenuAnchor",i0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=pc(r);return w.jsx(p4,{...i,...n,ref:t})});i0.displayName=gF;var s0="MenuPortal",[vF,B6]=Xs(s0,{forceMount:void 0}),L6=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=gs(s0,t);return w.jsx(vF,{scope:t,forceMount:r,children:w.jsx(jn,{present:r||s.open,children:w.jsx(v4,{asChild:!0,container:i,children:n})})})};L6.displayName=s0;var ln="MenuContent",[yF,o0]=Xs(ln),F6=I.forwardRef((e,t)=>{const r=B6(ln,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=gs(ln,e.__scopeMenu),o=mc(ln,e.__scopeMenu);return w.jsx(hc.Provider,{scope:e.__scopeMenu,children:w.jsx(jn,{present:n||s.open,children:w.jsx(hc.Slot,{scope:e.__scopeMenu,children:o.modal?w.jsx(bF,{...i,ref:t}):w.jsx(wF,{...i,ref:t})})})})}),bF=I.forwardRef((e,t)=>{const r=gs(ln,e.__scopeMenu),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return sL(s)},[]),w.jsx(a0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),wF=I.forwardRef((e,t)=>{const r=gs(ln,e.__scopeMenu);return w.jsx(a0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),a0=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,..._}=e,A=gs(ln,r),P=mc(ln,r),N=pc(r),R=R6(r),F=hF(r),[L,W]=I.useState(null),q=I.useRef(null),X=Qt(t,q,A.onContentChange),ie=I.useRef(0),ae=I.useRef(""),ce=I.useRef(0),V=I.useRef(null),$=I.useRef("right"),p=I.useRef(0),d=b?zL:I.Fragment,m=b?{as:ki,allowPinchZoom:!0}:void 0,x=E=>{var ye,pe;const O=ae.current+E,C=F().filter(Ee=>!Ee.disabled),g=document.activeElement,v=(ye=C.find(Ee=>Ee.ref.current===g))==null?void 0:ye.textValue,j=C.map(Ee=>Ee.textValue),ee=jF(j,O,v),se=(pe=C.find(Ee=>Ee.textValue===ee))==null?void 0:pe.ref.current;(function Ee(Se){ae.current=Se,window.clearTimeout(ie.current),Se!==""&&(ie.current=window.setTimeout(()=>Ee(""),1e3))})(O),se&&setTimeout(()=>se.focus())};I.useEffect(()=>()=>window.clearTimeout(ie.current),[]),KB();const M=I.useCallback(E=>{var C,g;return $.current===((C=V.current)==null?void 0:C.side)&&NF(E,(g=V.current)==null?void 0:g.area)},[]);return w.jsx(yF,{scope:r,searchRef:ae,onItemEnter:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),onItemLeave:I.useCallback(E=>{var O;M(E)||((O=q.current)==null||O.focus(),W(null))},[M]),onTriggerLeave:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:I.useCallback(E=>{V.current=E},[]),children:w.jsx(d,{...m,children:w.jsx(W4,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:w.jsx(_p,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:w.jsx(GB,{asChild:!0,...R,dir:P.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:W,onEntryFocus:tt(c,E=>{P.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(m4,{role:"menu","aria-orientation":"vertical","data-state":iS(A.open),"data-radix-menu-content":"",dir:P.dir,...N,..._,ref:X,style:{outline:"none",..._.style},onKeyDown:tt(_.onKeyDown,E=>{const C=E.target.closest("[data-radix-menu-content]")===E.currentTarget,g=E.ctrlKey||E.altKey||E.metaKey,v=E.key.length===1;C&&(E.key==="Tab"&&E.preventDefault(),!g&&v&&x(E.key));const j=q.current;if(E.target!==j||!lF.includes(E.key))return;E.preventDefault();const se=F().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);k6.includes(E.key)&&se.reverse(),IF(se)}),onBlur:tt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(ie.current),ae.current="")}),onPointerMove:tt(e.onPointerMove,vc(E=>{const O=E.target,C=p.current!==E.clientX;if(E.currentTarget.contains(O)&&C){const g=E.clientX>p.current?"right":"left";$.current=g,p.current=E.clientX}}))})})})})})})});F6.displayName=ln;var _F="MenuGroup",c0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Wt.div,{role:"group",...n,ref:t})});c0.displayName=_F;var xF="MenuLabel",U6=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Wt.div,{...n,ref:t})});U6.displayName=xF;var Rl="MenuItem",z6="menu.itemSelect",Dl=I.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=I.useRef(null),o=mc(Rl,e.__scopeMenu),a=o0(Rl,e.__scopeMenu),c=Qt(t,s),u=I.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(z6,{bubbles:!0,cancelable:!0});f.addEventListener(z6,y=>n==null?void 0:n(y),{once:!0}),Rx(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return w.jsx(V6,{...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===" "||n0.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Dl.displayName=Rl;var V6=I.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=o0(Rl,r),a=R6(r),c=I.useRef(null),u=Qt(t,c),[l,f]=I.useState(!1),[h,y]=I.useState("");return I.useEffect(()=>{const b=c.current;b&&y((b.textContent??"").trim())},[s.children]),w.jsx(hc.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:w.jsx(WB,{asChild:!0,...a,focusable:!n,children:w.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,vc(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,vc(b=>o.onItemLeave(b))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),SF="MenuCheckboxItem",q6=I.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return w.jsx(X6,{scope:e.__scopeMenu,checked:r,children:w.jsx(Dl,{role:"menuitemcheckbox","aria-checked":$l(r)?"mixed":r,...i,ref:t,"data-state":f0(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n($l(r)?!0:!r),{checkForDefaultPrevented:!1})})})});q6.displayName=SF;var G6="MenuRadioGroup",[EF,CF]=Xs(G6,{value:void 0,onValueChange:()=>{}}),W6=I.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=gr(n);return w.jsx(EF,{scope:e.__scopeMenu,value:r,onValueChange:s,children:w.jsx(c0,{...i,ref:t})})});W6.displayName=G6;var H6="MenuRadioItem",K6=I.forwardRef((e,t)=>{const{value:r,...n}=e,i=CF(H6,e.__scopeMenu),s=r===i.value;return w.jsx(X6,{scope:e.__scopeMenu,checked:s,children:w.jsx(Dl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":f0(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});K6.displayName=H6;var u0="MenuItemIndicator",[X6,MF]=Xs(u0,{checked:!1}),J6=I.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=MF(u0,r);return w.jsx(jn,{present:n||$l(s.checked)||s.checked===!0,children:w.jsx(Wt.span,{...i,ref:t,"data-state":f0(s.checked)})})});J6.displayName=u0;var TF="MenuSeparator",Y6=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Wt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});Y6.displayName=TF;var AF="MenuArrow",Z6=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=pc(r);return w.jsx(g4,{...i,...n,ref:t})});Z6.displayName=AF;var l0="MenuSub",[OF,Q6]=Xs(l0),eS=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=gs(l0,t),o=pc(t),[a,c]=I.useState(null),[u,l]=I.useState(null),f=gr(i);return I.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),w.jsx(h4,{...o,children:w.jsx(D6,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:w.jsx(OF,{scope:t,contentId:ic(),triggerId:ic(),trigger:a,onTriggerChange:c,children:r})})})};eS.displayName=l0;var gc="MenuSubTrigger",tS=I.forwardRef((e,t)=>{const r=gs(gc,e.__scopeMenu),n=mc(gc,e.__scopeMenu),i=Q6(gc,e.__scopeMenu),s=o0(gc,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]),w.jsx(i0,{asChild:!0,...u,children:w.jsx(V6,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":iS(r.open),...e,ref:nl(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,vc(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,vc(f=>{var y,b;l();const h=(y=r.content)==null?void 0:y.getBoundingClientRect();if(h){const _=(b=r.content)==null?void 0:b.dataset.side,A=_==="right",P=A?-5:5,N=h[A?"left":"right"],R=h[A?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+P,y:f.clientY},{x:N,y:h.top},{x:R,y:h.top},{x:R,y:h.bottom},{x:N,y:h.bottom}],side:_}),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===" "||fF[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});tS.displayName=gc;var rS="MenuSubContent",nS=I.forwardRef((e,t)=>{const r=B6(ln,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=gs(ln,e.__scopeMenu),o=mc(ln,e.__scopeMenu),a=Q6(rS,e.__scopeMenu),c=I.useRef(null),u=Qt(t,c);return w.jsx(hc.Provider,{scope:e.__scopeMenu,children:w.jsx(jn,{present:n||s.open,children:w.jsx(hc.Slot,{scope:e.__scopeMenu,children:w.jsx(a0,{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=dF[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});nS.displayName=rS;function iS(e){return e?"open":"closed"}function $l(e){return e==="indeterminate"}function f0(e){return $l(e)?"indeterminate":e?"checked":"unchecked"}function IF(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function PF(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function jF(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=PF(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 kF(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 NF(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return kF(r,t)}function vc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var RF=$6,DF=i0,$F=L6,BF=F6,LF=c0,FF=U6,UF=Dl,zF=q6,VF=W6,qF=K6,GF=J6,WF=Y6,HF=Z6,KF=eS,XF=tS,JF=nS,d0="DropdownMenu",[YF,uJ]=Fo(d0,[N6]),Pr=N6(),[ZF,sS]=YF(d0),oS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Pr(t),u=I.useRef(null),[l=!1,f]=cc({prop:i,defaultProp:s,onChange:o});return w.jsx(ZF,{scope:t,triggerId:ic(),triggerRef:u,contentId:ic(),open:l,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(h=>!h),[f]),modal:a,children:w.jsx(RF,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};oS.displayName=d0;var aS="DropdownMenuTrigger",cS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=sS(aS,r),o=Pr(r);return w.jsx(DF,{asChild:!0,...o,children:w.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:nl(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())})})})});cS.displayName=aS;var QF="DropdownMenuPortal",uS=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Pr(t);return w.jsx($F,{...n,...r})};uS.displayName=QF;var lS="DropdownMenuContent",fS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=sS(lS,r),s=Pr(r),o=I.useRef(!1);return w.jsx(BF,{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)"}})});fS.displayName=lS;var eU="DropdownMenuGroup",dS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(LF,{...i,...n,ref:t})});dS.displayName=eU;var tU="DropdownMenuLabel",hS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(FF,{...i,...n,ref:t})});hS.displayName=tU;var rU="DropdownMenuItem",pS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(UF,{...i,...n,ref:t})});pS.displayName=rU;var nU="DropdownMenuCheckboxItem",mS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(zF,{...i,...n,ref:t})});mS.displayName=nU;var iU="DropdownMenuRadioGroup",gS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(VF,{...i,...n,ref:t})});gS.displayName=iU;var sU="DropdownMenuRadioItem",vS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(qF,{...i,...n,ref:t})});vS.displayName=sU;var oU="DropdownMenuItemIndicator",yS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(GF,{...i,...n,ref:t})});yS.displayName=oU;var aU="DropdownMenuSeparator",bS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(WF,{...i,...n,ref:t})});bS.displayName=aU;var cU="DropdownMenuArrow",uU=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(HF,{...i,...n,ref:t})});uU.displayName=cU;var lU=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Pr(t),[a=!1,c]=cc({prop:n,defaultProp:s,onChange:i});return w.jsx(KF,{...o,open:a,onOpenChange:c,children:r})},fU="DropdownMenuSubTrigger",wS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(XF,{...i,...n,ref:t})});wS.displayName=fU;var dU="DropdownMenuSubContent",_S=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return w.jsx(JF,{...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)"}})});_S.displayName=dU;var hU=oS,pU=cS,xS=uS,mU=fS,gU=dS,vU=hS,yU=pS,bU=mS,wU=gS,_U=vS,SS=yS,xU=bS,SU=lU,EU=wS,CU=_S;const h0={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Up,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},p0=I.forwardRef((e,t)=>{const{rest:r,...n}=Ko(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=h0.size.default,radius:l=h0.radius.default,scrollbars:f=h0.scrollbars.default,...h}=r;return I.createElement(eF,{type:o,scrollHideDelay:a,className:Kt("rt-ScrollAreaRoot",i,Xo(n)),style:s},I.createElement(tF,{...h,ref:t,className:"rt-ScrollAreaViewport"}),I.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?I.createElement(M6,{"data-radius":l,orientation:"horizontal",className:Kt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},I.createElement(T6,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?I.createElement(M6,{"data-radius":l,orientation:"vertical",className:Kt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},I.createElement(T6,{className:"rt-ScrollAreaThumb"})):null,f==="both"?I.createElement(rF,{className:"rt-ScrollAreaCorner"}):null)});p0.displayName="ScrollArea";const m0={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:uc,highContrast:bl},ES={color:uc,shortcut:{type:"string",default:void 0}},CS=e=>I.createElement(hU,{...e});CS.displayName="DropdownMenuRoot";const MS=I.forwardRef((e,t)=>I.createElement(pU,{...e,ref:t,asChild:!0}));MS.displayName="DropdownMenuTrigger";const TS=I.createContext({}),AS=I.forwardRef((e,t)=>{const r=mB(),{className:n,children:i,size:s=m0.size.default,variant:o=m0.variant.default,highContrast:a=m0.highContrast.default,color:c=ES.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return I.createElement(xS,{container:u,forceMount:l},I.createElement(yl,{asChild:!0},I.createElement(mU,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,bt(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},I.createElement(p0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},I.createElement(TS.Provider,{value:I.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});AS.displayName="DropdownMenuContent";const OS=I.forwardRef((e,t)=>I.createElement(vU,{...e,ref:t,className:Kt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));OS.displayName="DropdownMenuLabel";const IS=I.forwardRef((e,t)=>{const{className:r,children:n,color:i=ES.color.default,shortcut:s,...o}=e;return I.createElement(yU,{"data-accent-color":i,...o,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},I.createElement(Uo,null,n),s&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});IS.displayName="DropdownMenuItem";const PS=I.forwardRef((e,t)=>I.createElement(gU,{...e,ref:t,className:Kt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));PS.displayName="DropdownMenuGroup";const jS=I.forwardRef((e,t)=>I.createElement(wU,{...e,ref:t,className:Kt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));jS.displayName="DropdownMenuRadioGroup";const kS=I.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return I.createElement(_U,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},I.createElement(Uo,null,r),I.createElement(SS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(_l,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});kS.displayName="DropdownMenuRadioItem";const NS=I.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return I.createElement(bU,{...s,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},I.createElement(Uo,null,r),I.createElement(SS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(_l,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});NS.displayName="DropdownMenuCheckboxItem";const RS=e=>I.createElement(SU,{...e});RS.displayName="DropdownMenuSub";const DS=I.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return I.createElement(EU,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},I.createElement(Uo,null,n),I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},I.createElement(D4,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});DS.displayName="DropdownMenuSubTrigger";const $S=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(TS);return I.createElement(xS,{container:i,forceMount:s},I.createElement(yl,{asChild:!0},I.createElement(CU,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,bt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},I.createElement(p0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});$S.displayName="DropdownMenuSubContent";const BS=I.forwardRef((e,t)=>I.createElement(xU,{...e,ref:t,className:Kt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));BS.displayName="DropdownMenuSeparator";const Di=Object.assign({},{Root:CS,Trigger:MS,Content:AS,Label:OS,Item:IS,Group:PS,RadioGroup:jS,RadioItem:kS,CheckboxItem:NS,Sub:RS,SubTrigger:DS,SubContent:$S,Separator:BS}),yc={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:uc,highContrast:bl,radius:Up},LS=I.forwardRef((e,t)=>{const{rest:r,...n}=Ko(e),{className:i,asChild:s=!1,size:o=yc.size.default,variant:a=yc.variant.default,color:c=yc.color.default,highContrast:u=yc.highContrast.default,radius:l=yc.radius.default,...f}=r,h=s?ki:"button";return I.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Kt("rt-reset","rt-BaseButton",i,bt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Xo(n))})});LS.displayName="BaseButton";const FS=I.forwardRef((e,t)=>I.createElement(LS,{...e,ref:t,className:Kt("rt-Button",e.className)}));FS.displayName="Button";const MU={loading:{type:"boolean",default:!0}},ra=I.forwardRef((e,t)=>{const{rest:r,...n}=Ko(e),{className:i,children:s,loading:o=MU.loading.default,...a}=r;if(!o)return I.createElement(I.Fragment,null,s);const c=I.isValidElement(s)?ki:"span";return I.createElement(c,{ref:t,"aria-hidden":!0,className:Kt("rt-Skeleton",i,Xo(n)),"data-inline-skeleton":I.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});ra.displayName="Skeleton";const TU=Ft("/images/ghost_loading.png"),AU={primary:Ft("/images/primary_loading.png"),ghost:TU};function OU({size:e="24px",variant:t="primary",wrapStyle:r={}}){return w.jsx(I4,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:w.jsx("img",{src:AU[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const IU="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==",g0="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 Yr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=te.useState(g0),c=u=>{a(g0)};return te.useEffect(()=>{a(e||g0)},[e]),w.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[w.jsx("img",{src:o,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...s}),i&&w.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:IU})]})}function PU({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=Lo(),a=te.useMemo(()=>{if(n&&r)return n(r)},[r]),c=te.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return w.jsxs("div",{className:"cs-toast",children:[w.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[w.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&w.jsx("div",{children:w.jsx(OU,{})}),w.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&w.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&w.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&w.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&w.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&w.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&w.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():w.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&w.jsx(kx,{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"&&w.jsxs(w.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():w.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&w.jsx("span",{children:"Something went wrong"})]}),r==="success"&&w.jsx(w.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():w.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&w.jsxs("div",{className:"view-transaction",children:[w.jsx("span",{children:"View Transaction"}),el.map(u=>w.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:w.jsx(Yr,{src:u.img})},u.link))]})]}),w.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:w.jsx("use",{xlinkHref:"#icon-close"})})]})}const jU=ji((e,t)=>({toasts:[],setToasts:r=>{e(n=>({toasts:[...n.toasts,r]})),setTimeout(()=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r.id)}))},3e3)},removeToast:r=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r)}))}})),na=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=jU(),i=(a,c="success")=>{const l={id:Date.now(),status:c,buildShowInfo:()=>({toastTitleText:a})};r(l)},s=a=>{const c=Date.now();return a.id=c,r(a),c},o=te.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),$n.createPortal(w.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>w.jsx(PU,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}},vJ="";function kU(){const{mevProtect:e,setMevProtect:t}=Kr();return w.jsxs(Di.Root,{children:[w.jsx(Di.Trigger,{children:w.jsx("div",{className:"cs-settings-btn",children:w.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:w.jsx("use",{xlinkHref:"#icon-mev"})})})}),w.jsx(Di.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:w.jsxs("div",{className:"mev-settings-box",children:[w.jsxs("div",{className:"mev-setting-title",children:[w.jsxs("div",{className:"name",children:[w.jsx("img",{src:Ft("/images/icon_mev@2x.png")}),w.jsx("span",{children:"MEV Protect"})]}),w.jsx(j6,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),w.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 NU({onClick:e}){const[t,r]=te.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return w.jsx("div",{className:"refresh-button",children:w.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:w.jsx("use",{xlinkHref:"#icon-refresh"})})})}const yJ="",bJ="";function v0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return w.jsx(FS,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function RU(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Kr();return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})}),w.jsxs("span",{children:[r,"%"]})]}),t&&w.jsx(DU,{onClose:()=>e(!1)})]})}function DU({onClose:e}){const{slippage:t,setSlippage:r}=Kr(),[n,i]=te.useState(t),s=u=>{i(u.display)},o=u=>{const l=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");u.target.value=u.target.value.replace(l,"$1"),i(u.target.value)},a=()=>{n&&r(n),e()},c=te.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),w.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:w.jsxs("div",{className:"slippage-settings",children:[w.jsxs("div",{className:"slippage-settings-header",children:[w.jsx("div",{className:"title",children:"Settings"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})}),w.jsx("span",{children:"Slippage Tolerance"})]}),w.jsxs("div",{className:"form-box",children:[w.jsx("div",{className:"slippage-tab-list",children:QR.map(u=>w.jsxs("span",{className:u.display===n?"active":"",onClick:()=>s(u),children:[u.display,"%"]}))}),w.jsxs("div",{className:"input-box",children:[w.jsx("span",{children:"Custom"}),w.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:o}),w.jsx("i",{children:"%"})]})]}),Number(n)<=.05&&w.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&w.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&w.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),w.jsx(v0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function $U({handleRefresh:e}){return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"swap-header",children:[w.jsx("h3",{className:"swap-title",children:"Swap"}),w.jsxs("div",{className:"right",children:[w.jsx(RU,{}),w.jsx(kU,{}),w.jsx(NU,{onClick:e})]})]})})}const wJ="",_J="";function BU(){const[e,t]=te.useState(!1);return w.jsxs(Di.Root,{open:e,onOpenChange:t,children:[w.jsx(Di.Trigger,{children:w.jsx("div",{className:"cs-settings-btn",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-settings"})})})}),w.jsx(Di.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:w.jsxs("div",{className:"cs-settings-box",children:[w.jsx("h3",{children:"Settings"}),w.jsx(LU,{}),w.jsx(UU,{onClose:()=>{t(!1)}})]})})]})}function LU(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Kr(),i=s=>{t(s)};return w.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-plorer"})}),w.jsx("span",{children:"Preferred Explorer"})]}),w.jsx("div",{className:"explorer-checkbox-group",children:el.map(s=>w.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[w.jsx(xl,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),w.jsx("img",{src:s.img}),w.jsx("span",{children:s.name})]}))})]})}const FU=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function UU({onClose:e}){const{addTxToast:t}=na(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Kr(),[a,c]=te.useState(i),[u,l]=te.useState(r),f=_=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${_}`})})},h=_=>{l(_),_.isCustom||(n(_),f(_.link),e())},y=_=>{c(_.target.value)},b=()=>{if(a){const _={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(_),f(a),e()}};return w.jsxs("div",{className:"settings-card rpc-settings-card",children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-settings"})}),w.jsx("span",{children:"RPC Node"})]}),w.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(_=>w.jsxs("div",{className:"rpc-item",onClick:()=>h(_),children:[w.jsx(xl,{color:"indigo",checked:u.name===_.name,variant:"soft",className:"cs-checkbox"}),w.jsx("span",{children:_.name})]})),u.isCustom&&w.jsxs("div",{className:"custom-rpc-input-box",children:[w.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),w.jsx(v0,{btnIsDisabled:FU(a),text:"Save",onClick:b})]})]})]})}const xJ="",kn=ji((e,t)=>({accounts:[],currentAccount:void 0,isOpenWalletModal:!1,saveCurrentAccount:r=>{e({currentAccount:r})},saveAccounts:r=>{e({accounts:r})},onWalletModal:r=>{e({isOpenWalletModal:r})},isOpenAccountList:!1,setIsOpenAccountList:r=>{e(()=>({isOpenAccountList:r}))},tokenBalanceObj:{},setTokenBalanceObj:r=>{e(()=>({tokenBalanceObj:r}))}}));var zU=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()}},VU=zU,US={"text/plain":"Text","text/html":"Url",default:"Text"},qU="Copy to clipboard: #{key}, Enter";function GU(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function WU(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=VU(),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=US[t.format]||US.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=GU("message"in t?t.message:qU),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var HU=WU;const zS=fa(HU);function KU({currentAccount:e}){const{mutate:t}=$r.useSwitchAccount(),r=$r.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=kn(),s=()=>{i(!n)};te.useEffect(()=>()=>{i(!1)},[]);const o=te.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);te.useEffect(()=>{},[o]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return w.jsxs("div",{className:"cs-account-switch",children:[w.jsxs("div",{className:"account",onClick:s,children:[w.jsx("span",{children:qs(e)}),(o==null?void 0:o.length)>0&&w.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})})]}),w.jsx("div",{className:`account-list ${n?"open":"close"}`,children:o.map(c=>w.jsxs("div",{className:"account-item",children:[w.jsxs("div",{className:"left",children:[w.jsx("div",{className:"label",children:c==null?void 0:c.label}),w.jsx("div",{className:"address",children:qs(c==null?void 0:c.address)})]}),w.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}function XU({connect:e}){const t=$r.useCurrentAccount();return te.useEffect(()=>{},[t]),w.jsx("div",{children:t?w.jsx(JU,{}):w.jsx(v0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})}function JU(){const{mutate:e}=$r.useDisconnectWallet(),t=$r.useCurrentAccount(),{currentWallet:r}=$r.useCurrentWallet(),{addCommonToast:n}=na(),{getExplorerUrl:i}=Lo(),s=()=>{t&&(zS(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return te.useEffect(()=>{},[r]),w.jsxs(Di.Root,{children:[w.jsx(Di.Trigger,{children:w.jsxs("div",{className:"cs-connected-button",children:[w.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),w.jsx("span",{children:qs(t==null?void 0:t.address)})]})}),w.jsx(Di.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:w.jsxs("div",{className:"account-op-box",children:[w.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),w.jsx(KU,{currentAccount:t==null?void 0:t.address}),w.jsxs("div",{className:"account-op-item",onClick:s,style:{marginTop:"12px"},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-copy"})}),w.jsx("span",{children:"Copy address"})]}),w.jsxs("div",{className:"account-op-item",onClick:o,children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-link"})}),w.jsx("span",{children:"Open explorer"})]}),w.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-disconnect"})}),w.jsx("span",{children:"Disconnect"})]})]})})]})}function YU(){$r.useCurrentAccount(),$r.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=kn();return $r.useWallets(),w.jsx(w.Fragment,{children:w.jsx($r.ConnectModal,{trigger:w.jsx(XU,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function ZU({independentWallet:e,customWallet:t}){return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"widget-header",children:[w.jsx("img",{src:Ft("/images/logo@2x.png"),className:"cetus-logo"}),w.jsxs("div",{className:"right",children:[e&&w.jsx(YU,{}),w.jsx(BU,{})]})]}),w.jsx("div",{style:{marginTop:"20px"}})]})}const SJ="",VS=()=>{const e=te.useRef(null);te.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"#75C8FF",boxShadow:"0px 0px 20px 2px #75C8FF",borderRadius:"50%"};return w.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:w.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)=>w.jsx("div",{style:t(i),children:w.jsx("div",{style:r})},i))})})};function QU({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=te.useMemo(()=>{if(n&&r)return n(r)},[r]);return w.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&w.jsx(ez,{info:s,status:r}),(r==="success"||r==="rejected")&&w.jsx(tz,{info:s,status:r,tx:i,onClose:e})]})}function ez({info:e,status:t}){return w.jsxs("div",{className:"progress-dialog",children:[w.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),w.jsx("div",{className:"loading-box",children:w.jsx(VS,{})}),w.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),w.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function tz({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Lo();return w.jsxs("div",{className:"finally-status-dialog",children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[w.jsx("div",{className:"status-icon-box",children:w.jsx("div",{className:"status-icon",children:w.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?w.jsx("use",{xlinkHref:"#icon-sel"}):w.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?w.jsx("span",{children:"Swap Success"}):w.jsx("span",{children:"Swap failed"})]}),w.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&w.jsxs("div",{className:"view-transaction",children:[w.jsx("span",{children:"View Transaction"}),el.map(s=>w.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:w.jsx("img",{src:s.img})},s.link))]})]}),w.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?w.jsx("span",{children:" Swap More"}):w.jsx("span",{children:"Retry"})})]})}function Bl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await JR(`${i||rl.api}${t}`,n):await YR(`${i||rl.api}${t}`,n)}catch(s){throw s}}}}function rz(){const{fetchByApi:e}=Bl(),{setProviders:t}=Kr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function nz({interval:e,callback:t}){const r=te.useRef(),n=te.useRef(null);te.useEffect(()=>{r.current=t},[t]);const i=te.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=te.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return te.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Js=ji((e,t)=>({suiClient:new Sa({url:rl.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new ex,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),bc=ji((e,t)=>({requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=new Map(n);s.set(Ir(r.coin_type).full_address,r);const o=i.filter(a=>a!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...o]})),Pi.setItem(vp,s)},tokenMap:new Map,setTokenMap:(r,n=!1)=>{e(()=>({tokenMap:r})),n||Pi.setItem(vp,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||Pi.setItem(Cx,r)}}));Pi.getItem(vp).then(e=>{e!==null&&bc.getState().setTokenMap(e,!0)}),Pi.getItem(Cx).then(e=>{e!==null&&bc.getState().setTrustedTokenList(e,!0)});function iz(e,t){return{id:e.id||void 0,logo_url:e.iconUrl||void 0,coin_type:t,decimals:e.decimals,description:e.description,name:e.name,symbol:e.symbol}}function Ys(){const{suiClient:e}=Js(),{fetchByApi:t}=Bl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=bc(),c=async()=>{var b;const f=await t("/v2/sui/coins_info","GET"),h=[],y=(b=f==null?void 0:f.list)==null?void 0:b.reduce((_,A)=>(_.set(A.coin_type,A),A.is_trusted&&h.push({...A,coin_type:Ir(A.coin_type).full_address}),_),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){Sx(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=iz(y,f);return i(b),b}}catch{}},l=te.useCallback(f=>{if(f)return n.get(Ir(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Ll(e){const{suiClient:t}=Js(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=kn(),{fetchTokenInfo:s}=Ys(),[o,a]=te.useState([]),{tokenMap:c}=bc(),u=async(y=(r==null?void 0:r.address)||"",b)=>{try{if(!y){l();return}let _=[];b?_=[await t.getBalance({owner:y,coinType:b})]:_=[...await t.getAllBalances({owner:y})],a(_)}catch{a([])}},l=()=>{n({})};te.useEffect(()=>{(o==null?void 0:o.length)>0&&(c!=null&&c.size)&&f(o)},[o,c]);const f=async y=>{const b={};for(let _=0;_<(y==null?void 0:y.length);_++)try{const A=y[_],P=await s(A.coinType),N=UR(A.totalBalance,P==null?void 0:P.decimals),R=cn(N,4);b[Ir(A.coinType).full_address]={...A,displayBalance:R,totalBalanceFormat:N}}catch{continue}n(b)},h=te.useMemo(()=>{if(e&&r)return i[e]||i[Ir(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const fn=ji((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}))}})),sz={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"}},oz={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"}},qS=sz,GS=oz;function az(e,t){const{fetchTokenInfo:r}=Ys(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=fn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Kr(),u=te.useRef({}),l=async(h,y)=>{const b=h?await r(h):qS,_=y?await r(y):GS;n(b),i(_),s(b,_)},f=(h,y)=>{const b=[tl[0]];let _=tl[0];h.forEach(A=>{const P={name:A,link:A,isCustom:!1};b.push(P),A===y&&(_=P)}),a([...b,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(_)};return te.useEffect(()=>{if(!mp(e,u.current)){const{defaultFromToken:h,defaultToToken:y,defaultSlippage:b,customRpcList:_,defaultRpc:A}=e;l(h,y),b&&o(b),(_==null?void 0:_.length)>0&&f(_,A),u.current=e}},[e]),{handleSetDefaultPair:l}}function cz(){const{currentRpc:e}=Kr(),{setSuiClient:t,setAggregatorSDK:r}=Js(),{currentAccount:n}=kn();te.useEffect(()=>{if(e){const i=new Sa({url:e.link});t(i)}},[e]),te.useEffect(()=>{if(e){const i=new ex(rl.aggregatorUrl,(n==null?void 0:n.address)||void 0,new Sa({url:e.link}),GN.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const WS=ji((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Ir(i).full_address]}),e({coinPriceObj:{...n}})}}));function Fl(){const{fetchByApi:e}=Bl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=WS(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>gp(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Ir(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=te.useCallback(a=>{if(!a)return;const c=t[Ir(a).full_address];if(c)return c},[t]),o=te.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Fe(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const y0=ji((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),xr=[];for(let e=0;e<256;++e)xr.push((e+256).toString(16).slice(1));function uz(e,t=0){return(xr[e[t+0]]+xr[e[t+1]]+xr[e[t+2]]+xr[e[t+3]]+"-"+xr[e[t+4]]+xr[e[t+5]]+"-"+xr[e[t+6]]+xr[e[t+7]]+"-"+xr[e[t+8]]+xr[e[t+9]]+"-"+xr[e[t+10]]+xr[e[t+11]]+xr[e[t+12]]+xr[e[t+13]]+xr[e[t+14]]+xr[e[t+15]]).toLowerCase()}let b0;const lz=new Uint8Array(16);function fz(){if(!b0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");b0=crypto.getRandomValues.bind(crypto)}return b0(lz)}const HS={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function KS(e,t,r){if(HS.randomUUID&&!t&&!e)return HS.randomUUID();e=e||{};const n=e.random||(e.rng||fz)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return uz(n)}var Ul=(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))(Ul||{});const dz=new Sa({url:dm("mainnet")}),hz=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],pz=["deny_list","DenyList","DenyCap","create_regulated_currency"],mz={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},gz=async e=>{let t=!1;if(hz.includes(e))return t;const r=e.split("::"),n=r[0]&&Br(r[0]),i=r[1],s=await dz.getObject({id:n,options:mz}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(pz.join("|"),"i").test(o)&&(t=!0),t},vz=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>gp(i,!1)))==null?void 0:n.join(",")};function yz(){const{fetchByApi:e}=Bl(),t=async n=>{try{const i={...n},s=vz(n==null?void 0:n.coin_type);s&&(i.coin_type=s);const o=await e("/v2/sui/stats_pools","GET",i);if(o!=null&&o.lp_list)return{list:(o==null?void 0:o.lp_list)||[],total:o==null?void 0:o.total}}catch(i){return console.error("getPoolList ~ Error:",i),await r(n)}return{list:[],total:0}},r=async n=>{var i,s,o,a;try{const c=Ft("/data/pools.json"),u=await fetch(c).then(l=>l.json());if((i=u==null?void 0:u.data)!=null&&i.lp_list){const l=(s=u==null?void 0:u.data)==null?void 0:s.lp_list;let f=l;if(n!=null&&n.coin_type){const y=(a=(o=n==null?void 0:n.coin_type)==null?void 0:o.split(","))==null?void 0:a.map(b=>ec(b).source_address);f=l==null?void 0:l.filter(b=>{var P,N;const _=ec((P=b==null?void 0:b.coin_a)==null?void 0:P.address).source_address,A=ec((N=b==null?void 0:b.coin_b)==null?void 0:N.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(_)&&y.includes(A)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(_)||y.includes(A)))})}n!=null&&n.is_vaults&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.is_vaults)),n!=null&&n.has_farming&&!(n!=null&&n.is_vaults)&&!(n!=null&&n.has_mining)&&!(n!=null&&n.no_incentives)&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.has_farming));const h=f;return{list:h,total:(h==null?void 0:h.length)||0}}}catch(c){console.error("getLocalJsonPoolList Error:",c)}return{list:[],total:0}};return{getPoolList:t,getLocalJsonPoolList:r}}function bz(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Kr(),{getPoolList:n,getLocalJsonPoolList:i}=yz();return{getPoolListByCoinType:async(o,a)=>{if(o&&a){const c=[o,a].sort(),u=`${c[0]}_${c[1]}`,l=t[u];if(l)return l;const f={coin_type:`${o},${a}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let h=e?await i(f):void 0;(h===void 0||h.list.length===0)&&(h=await n(f));const y=h.list;if(y.length>0)return t[u]=y,r(u,y),y}return[]}}}function wz(e){const{routerData:t}=fn();return{priceAcceptRouterData:te.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Fe(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Fe(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function XS(e,t){return{amountLimit:te.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Fe(s).mul(Fe(1).sub(Fe(e).div(100))).toString():Fe(i).mul(Fe(1).add(Fe(e).div(100))).toString()}},[e,t])}}function _z(e){const{getTokenInfo:t,fetchTokenInfo:r}=Ys();return{formatSwapRouter:te.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Fe(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=Fe(1).sub(c).toFixed(2):h.percentage=Fe(y).div(s).toFixed(2),c=Fe(c).add(h.percentage);const b=[];l.path.forEach(_=>{i.includes(_.provider)||i.push(_.provider);const A=Ir(_.from).full_address,P=Ir(_.target).full_address,N=t(A),R=t(P);N||a.includes(A)&&a.push(A),R||a.includes(P)&&a.push(P);const F=_.provider===nc.SCALLOP||_.provider===nc.FLOWX||_.provider===nc.FLOWXV3;b.push({from_type:A,to_type:P,pool_address:F?"":_.id,fee_rate:_.feeRate,provider:_.provider})}),h.paths=b,o.push(h)}),a.length>0)for(const l in a)r(l);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:o}}},[e])}}function xz(){const{fromCoin:e,toCoin:t}=fn(),{getPoolListByCoinType:r}=bz();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function JS(e,t,r){return te.useMemo(()=>t&&r&&+t&&+r?e?Fe(r).div(t).toString():Fe(t).div(r).toString():"0",[t,r,e])}function YS(e){const[t,r]=te.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await gz(i.coin_type)}catch{}return!1};return te.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function Sz(e,t){const{defaultFromCoin:r,defaultToCoin:n}=fn(),i=te.useMemo(()=>(r==null?void 0:r.coin_type)!==qS.coin_type||(n==null?void 0:n.coin_type)!==GS.coin_type,[r,n]),s=te.useCallback(a=>(r==null?void 0:r.coin_type)!==(a==null?void 0:a.coin_type)||(n==null?void 0:n.coin_type)!==(a==null?void 0:a.coin_type),[r,n]),o=te.useMemo(()=>{const a=[];return i&&((e==null?void 0:e.is_trusted)===!1&&s(e)&&a.push({...e}),(t==null?void 0:t.is_trusted)===!1&&s(t)&&a.push({...t})),a},[e==null?void 0:e.coin_type,t==null?void 0:t.coin_type,i]);return{isCustomMode:i,customWarnTokenList:o}}function Ez(){const{aggregatorSDK:e}=Js(),{getSwapPoolAddress:t}=xz(),r=s=>s&&s.error?s.error.code===Ul.InsufficientLiquidity||Ul.HoneyPot||Ul.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 v2(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 b=await t(),_={from:o.coin_type,target:a.coin_type,amount:new v2(c),byAmountIn:l,pools:b};try{const A=await e.swapInPools(_);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=pp(f.amountIn.toString(),u.decimals).toString(),y=pp(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 ia(e){const t=te.useRef(e);return te.useEffect(()=>{t.current=e},[e]),t}function Cz(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function Mz(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function Tz(e){return!!String(e).includes("Could not find the referenced transaction")}function Az(e){return Cz(e)?"User rejected the request":Mz(e)?"Exceeded price slippage":Tz(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var w0={};Object.defineProperty(w0,"__esModule",{value:!0});var Oz=w0.executeAuction=ZS,Iz=r_,Pz="https://rpc.getshio.com",jz=500,kz=300;function ZS(e,t,r){r===void 0&&(r=jz);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),Iz.default.post(Pz,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,kz)}).catch(s)})}w0.default={executeAuction:ZS};function Nz(){const{suiClient:e}=Js(),{currentAccount:t}=kn(),{mutateAsync:r}=$r.useSignTransaction(),{mutate:n}=$r.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=te.useMemo(()=>t==null?void 0:t.chains[0],[t]),s=async(c,u,l=!1)=>{var h,y;if(l){const b=await e.devInspectTransactionBlock({transactionBlock:Eo.Transaction.from(mn(c)),sender:t.address});if(!b||((h=b.effects)==null?void 0:h.status.status)==="failure")throw Error((y=b.effects)==null?void 0:y.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:u,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,u=!1)=>{var f,h;let l;if(typeof c=="string"?l=Eo.Transaction.from(c):l=c,u){const y=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!y||((f=y.effects)==null?void 0:f.status.status)==="failure")throw Error((h=y.effects)==null?void 0:h.status.error)}return l.setGasBudget(1e8),new Promise((y,b)=>{n({transaction:l,chain:i},{onSuccess:_=>{y(_)},onError:_=>{console.error("signAndExecuteTransactionBlock transaction failed",_),b(_)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=Eo.Transaction.from(c)),typeof c=="string"&&(c=Eo.Transaction.from(mn(c))),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:f=>{u(f)},onError:f=>{console.error("signTransactionBlock failed",f),l(f)},onSettled:(f,h,y,b)=>{console.error("signTransactionBlock onSettled",{data:f,error:h,variables:y})}})})),executeTransactionBlock:s}}function Rz(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=Nz(),{currentAccount:n}=kn(),{suiClient:i}=Js(),{setTransactionData:s}=y0(),{addTxToast:o,removeToast:a}=na(),c=5,u=2e3;async function l(y,b=1){try{let _;try{_=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{_=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0}})}if(_)return _;throw new Error("Empty response")}catch(_){if(console.error(`Attempt ${b} failed:`,_),b>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await wx(u),l(y,b+1)}}const f=async(y,b,_={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:A=!1,useMev:P,txAction:N="signTransactionBlock"}=_;let R;b.status="confirmation",s(b);try{let W;if(N==="signTransactionBlock"){const X=await e(y),{bytes:ie,signature:ae}=X;if(P)try{const ce=await Oz(ie,ae,500)}catch{}W=await t(ie,ae,A)}else W=await r(y,A);b.status="submitted",s({...b}),b.tx=W.digest,R=o(b),await wx(u);const q=await l(W.digest,0);if(!q||((F=q.effects)==null?void 0:F.status.status)==="failure")h(b,(L=q.effects)==null?void 0:L.status.error);else{const X=HR(q,n==null?void 0:n.address,!1);if(b.buildShowInfo){const ie=b.buildShowInfo("success",X);b.buildShowInfo=ae=>ie}a(R),b.status="success",s({...b})}return q}catch(W){h(b,W)}},h=(y,b)=>{const _=Az(b);if(y.buildShowInfo){const A=y.buildShowInfo("confirmation");y.buildShowInfo=P=>(A.toastDescriptionContent=_,A.modalDescriptionText=_,A),y.status="rejected",s({...y})}else y.buildShowInfo=A=>{const P={};return P.toastDescriptionContent=_,P.modalDescriptionText=_,P},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function QS(e,t=1e3){const r=te.useRef(),n=te.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return te.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function Dz(){const{aggregatorSDK:e}=Js(),{findBestRouters:t}=Ez(),{getTokenAmountValue:r,fetchTokenPrices:n}=Fl(),{providers:i,slippage:s,mevProtect:o}=Kr(),{signAndExecuteTransaction:a}=Rz(),{setTransactionData:c}=y0(),{addTxToast:u}=na(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:_,toAmount:A,setFromAmount:P,setFindRouterLoading:N,setRouterData:R,setByAmountIn:F,byAmountIn:L}=fn(),[W,q]=te.useState(""),X=ia(W),ie=ia(L),ae=ia(_),ce=ia(A),V=ia(l),$=ia(f),{balanceInfo:p,getOwnerCoinBalances:d}=Ll(l==null?void 0:l.coin_type),{balanceInfo:m}=Ll(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,_),M=r(f==null?void 0:f.coin_type,A),O=QS(async(Se,Je,Ue)=>{if(V.current&&$.current&&+Se){(+ae.current||+ce.current)&&N(!0);const lt=qR(Se,Je?V.current.decimals:$.current.decimals),ht=await t({fromToken:V.current,toToken:$.current,amount:lt.toString(),providersKeys:i,by_amount_in:Je,uuid:Ue});N(!1),X.current===Ue&&(Je?+ae.current?(b(ht.toAmountUi||""),R(ht)):b(""):+ce.current?(P(ht.fromAmountUi||"ß"),R(ht)):P(""))}else v(!Je)},500),C=(Se,Je,Ue=!1)=>{if(F(Je),Je?(P(Se),Ue&&b("")):(b(Se),Ue&&P("")),+Se){const lt=KS();q(lt),O(Se,Je,lt)}else N(!1),R(void 0),v(!Je)},g=(Se,Je=!0)=>{v(),Je?((Se==null?void 0:Se.coin_type)===(f==null?void 0:f.coin_type)&&y(l),h(Se)):((Se==null?void 0:Se.coin_type)===(l==null?void 0:l.coin_type)&&h(f),y(Se))},v=Se=>{Se===void 0?(P(""),b("")):Se?P(""):b(""),N(!1),R(void 0)},j=()=>{const Se=ie.current?ae.current:ce.current;if(+Se){const Je=KS();q(Je),O(Se,ie.current,Je)}},ee=async(Se,Je)=>{const{routerData:Ue,byAmountIn:lt,fromAmountUi:ht,toAmountUi:$e}=Se,mt=new Eo.Transaction,_e={routers:Ue.routes,byAmountIn:lt,slippage:Number(s)/100,txb:mt};Je&&(_e.partner=Je);try{await e.fastRouterSwap(_e);const ge={status:"confirmation",buildShowInfo:(Ge,De)=>{const Oe=`Swap ${cn(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${cn($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(Ge==="success"){let Le=ht,ft=$e;De&&(Le=_x(De,l)||ht,ft=_x(De,f)||$e);const dt=`Swapped ${cn(Le,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${cn(ft,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Ie.toastTitleText=dt,Ie.modalDescriptionText=dt}return Ie},id:0};c(ge),await a(mt,ge,{useMev:o})?(v(),d()):j()}catch(ge){String(ge).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Ae,Ge){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};te.useEffect(()=>{se(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const se=()=>{const Se=[];l&&Se.push(l.coin_type),f&&Se.push(f.coin_type),Se.length>0&&n(Se)},{isScamsCoin:ye}=YS(l),{isScamsCoin:pe}=YS(f),Ee=te.useMemo(()=>{if(!(!ye&&!pe)){if(ye&&pe)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(ye)return`${l==null?void 0:l.symbol} token is `;if(pe)return`${f==null?void 0:f.symbol} token is `}},[ye,pe]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:M,doSwapAction:ee,reCalculateRouteData:j,refreshMarketPrice:se,scamsText:Ee}}function $z(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=fn(),{currentAccount:o}=kn(),a=te.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&&Fe(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 e8({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 w.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[w.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:n,strokeWidth:t}),w.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"}}),w.jsx("style",{children:`
|
|
98
98
|
@keyframes dash {
|
|
99
99
|
0% {
|
|
100
100
|
stroke-dashoffset: 0; /* 从起点开始 */
|
|
@@ -103,7 +103,7 @@ body { background-color: var(--color-page-background); }
|
|
|
103
103
|
stroke-dashoffset: -${o}; /* 一圈 */
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
`})]})}function E0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=te.useState(!0),a=Wx(s,r,n);return b.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[b.jsx(Wr,{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"," ",Gn(s?e.symbol:t.symbol)," ","="," ",i?b.jsx(Fo,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):tn(a,t.decimals)," ",Gn(s?t.symbol:e.symbol)]}),b.jsx(Wr,{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 D6(e,t,r,n){const{getTokenPrice:i}=rl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=Wx(!0,r,n),c=te.useMemo(()=>{if(o&&s)return ze(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=te.useMemo(()=>{if(c&&+a)return ze(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=te.useMemo(()=>{const y=[];return s&&y.push(s.market),o&&!y.includes(o.market)&&y.push(o.market),y},[s==null?void 0:s.market,o==null?void 0:o.market]),f=te.useMemo(()=>u&&ze(u).lt(0)?ze(u).abs().gt(5):!1,[u]),h=te.useMemo(()=>u&&ze(u).lt(0)?ze(u).abs().gt(10):!1,[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h}}function oc({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=te.useState(!1),[o,a]=te.useState(!1),c=te.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};te.useEffect(()=>()=>{i||c.current&&(clearTimeout(c.current),c.current=null)},[i]);const l=()=>{c.current=setTimeout(()=>{o||(s(!1),c.current&&(clearTimeout(c.current),c.current=null))},0)},f=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},h=te.useRef(null),[y,_]=te.useState({left:void 0,top:void 0});return te.useEffect(()=>{var w;if(i&&h.current){const A=(w=h.current)==null?void 0:w.getBoundingClientRect();let 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&&On.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 $6({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=sn(),{priceImpact:a,sources:c,marketPrice:u}=D6(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi),l=te.useMemo(()=>{if(a){if(ze(a).gt(0))return"green";const f=ze(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&&ze(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(oc,{content:b.jsx(SU,{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(Fo,{style:{width:"80px",height:"20px"}}),!e&&b.jsxs("div",{className:"right",children:[b.jsx("span",{className:l,children:a?qk(a,2):"Incalculable"}),b.jsx("div",{className:"platforms",children:c.map(f=>b.jsx(oc,{content:b.jsx("span",{style:{fontSize:"12px"},children:C2[f]}),position:"top",delay:300,children:b.jsx(Wr,{src:uj[f]})},f))})]})]})]})]})}function SU({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(E0,{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=>C2[s]+" ").join("")})]})]})}function B6({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(Fo,{style:{height:"18px",width:"80px"}}):b.jsxs("div",{className:"right",children:[tn(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,en.ROUND_DOWN)," ",Gn(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function EU({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(I2,{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 MU({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 M0({title:e,backClick:t}){return b.jsxs("div",{className:"cs-have-back-header",children:[b.jsx(MU,{onClick:t}),b.jsx("span",{className:"title",children:e})]})}const yl=globalThis||void 0||self;var CU=typeof yl=="object"&&yl&&yl.Object===Object&&yl;const L6=CU;var AU=typeof self=="object"&&self&&self.Object===Object&&self,TU=L6||AU||Function("return this")();const Zn=TU;var OU=Zn.Symbol;const Qn=OU;var U6=Object.prototype,IU=U6.hasOwnProperty,kU=U6.toString,ac=Qn?Qn.toStringTag:void 0;function jU(e){var t=IU.call(e,ac),r=e[ac];try{e[ac]=void 0;var n=!0}catch{}var i=kU.call(e);return n&&(t?e[ac]=r:delete e[ac]),i}var PU=Object.prototype,NU=PU.toString;function RU(e){return NU.call(e)}var DU="[object Null]",$U="[object Undefined]",F6=Qn?Qn.toStringTag:void 0;function Ho(e){return e==null?e===void 0?$U:DU:F6&&F6 in Object(e)?jU(e):RU(e)}function as(e){return e!=null&&typeof e=="object"}var BU="[object Symbol]";function cc(e){return typeof e=="symbol"||as(e)&&Ho(e)==BU}function bl(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 LU=Array.isArray;const Ur=LU;var UU=1/0,z6=Qn?Qn.prototype:void 0,V6=z6?z6.toString:void 0;function q6(e){if(typeof e=="string")return e;if(Ur(e))return bl(e,q6)+"";if(cc(e))return V6?V6.call(e):"";var t=e+"";return t=="0"&&1/e==-UU?"-0":t}function Wo(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function G6(e){return e}var FU="[object AsyncFunction]",zU="[object Function]",VU="[object GeneratorFunction]",qU="[object Proxy]";function H6(e){if(!Wo(e))return!1;var t=Ho(e);return t==zU||t==VU||t==FU||t==qU}var GU=Zn["__core-js_shared__"];const C0=GU;var W6=function(){var e=/[^.]+$/.exec(C0&&C0.keys&&C0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function HU(e){return!!W6&&W6 in e}var WU=Function.prototype,KU=WU.toString;function Us(e){if(e!=null){try{return KU.call(e)}catch{}try{return e+""}catch{}}return""}var XU=/[\\^$.*+?()[\]{}|]/g,YU=/^\[object .+?Constructor\]$/,JU=Function.prototype,ZU=Object.prototype,QU=JU.toString,eF=ZU.hasOwnProperty,tF=RegExp("^"+QU.call(eF).replace(XU,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function rF(e){if(!Wo(e)||HU(e))return!1;var t=H6(e)?tF:YU;return t.test(Us(e))}function nF(e,t){return e==null?void 0:e[t]}function Fs(e,t){var r=nF(e,t);return rF(r)?r:void 0}var iF=Fs(Zn,"WeakMap");const A0=iF;var K6=Object.create,sF=function(){function e(){}return function(t){if(!Wo(t))return{};if(K6)return K6(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const oF=sF;function aF(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var cF=function(){try{var e=Fs(Object,"defineProperty");return e({},"",{}),e}catch{}}();const X6=cF;function uF(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var lF=9007199254740991,fF=/^(?:0|[1-9]\d*)$/;function Y6(e,t){var r=typeof e;return t=t??lF,!!t&&(r=="number"||r!="symbol"&&fF.test(e))&&e>-1&&e%1==0&&e<t}function J6(e,t,r){t=="__proto__"&&X6?X6(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function T0(e,t){return e===t||e!==e&&t!==t}var dF=Object.prototype,hF=dF.hasOwnProperty;function Z6(e,t,r){var n=e[t];(!(hF.call(e,t)&&T0(n,r))||r===void 0&&!(t in e))&&J6(e,t,r)}function wl(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?J6(r,a,c):Z6(r,a,c)}return r}var pF=9007199254740991;function O0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=pF}function _l(e){return e!=null&&O0(e.length)&&!H6(e)}var mF=Object.prototype;function I0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||mF;return e===r}function gF(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var vF="[object Arguments]";function Q6(e){return as(e)&&Ho(e)==vF}var e8=Object.prototype,yF=e8.hasOwnProperty,bF=e8.propertyIsEnumerable,wF=Q6(function(){return arguments}())?Q6:function(e){return as(e)&&yF.call(e,"callee")&&!bF.call(e,"callee")};const t8=wF;function _F(){return!1}var r8=typeof zt=="object"&&zt&&!zt.nodeType&&zt,n8=r8&&typeof module=="object"&&module&&!module.nodeType&&module,xF=n8&&n8.exports===r8,i8=xF?Zn.Buffer:void 0,SF=i8?i8.isBuffer:void 0,EF=SF||_F;const xl=EF;var MF="[object Arguments]",CF="[object Array]",AF="[object Boolean]",TF="[object Date]",OF="[object Error]",IF="[object Function]",kF="[object Map]",jF="[object Number]",PF="[object Object]",NF="[object RegExp]",RF="[object Set]",DF="[object String]",$F="[object WeakMap]",BF="[object ArrayBuffer]",LF="[object DataView]",UF="[object Float32Array]",FF="[object Float64Array]",zF="[object Int8Array]",VF="[object Int16Array]",qF="[object Int32Array]",GF="[object Uint8Array]",HF="[object Uint8ClampedArray]",WF="[object Uint16Array]",KF="[object Uint32Array]",Kt={};Kt[UF]=Kt[FF]=Kt[zF]=Kt[VF]=Kt[qF]=Kt[GF]=Kt[HF]=Kt[WF]=Kt[KF]=!0,Kt[MF]=Kt[CF]=Kt[BF]=Kt[AF]=Kt[LF]=Kt[TF]=Kt[OF]=Kt[IF]=Kt[kF]=Kt[jF]=Kt[PF]=Kt[NF]=Kt[RF]=Kt[DF]=Kt[$F]=!1;function XF(e){return as(e)&&O0(e.length)&&!!Kt[Ho(e)]}function Sl(e){return function(t){return e(t)}}var s8=typeof zt=="object"&&zt&&!zt.nodeType&&zt,uc=s8&&typeof module=="object"&&module&&!module.nodeType&&module,YF=uc&&uc.exports===s8,k0=YF&&L6.process,JF=function(){try{var e=uc&&uc.require&&uc.require("util").types;return e||k0&&k0.binding&&k0.binding("util")}catch{}}();const Ko=JF;var o8=Ko&&Ko.isTypedArray,ZF=o8?Sl(o8):XF;const a8=ZF;var QF=Object.prototype,ez=QF.hasOwnProperty;function c8(e,t){var r=Ur(e),n=!r&&t8(e),i=!r&&!n&&xl(e),s=!r&&!n&&!i&&a8(e),o=r||n||i||s,a=o?gF(e.length,String):[],c=a.length;for(var u in e)(t||ez.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Y6(u,c)))&&a.push(u);return a}function u8(e,t){return function(r){return e(t(r))}}var tz=u8(Object.keys,Object);const rz=tz;var nz=Object.prototype,iz=nz.hasOwnProperty;function sz(e){if(!I0(e))return rz(e);var t=[];for(var r in Object(e))iz.call(e,r)&&r!="constructor"&&t.push(r);return t}function lc(e){return _l(e)?c8(e):sz(e)}function oz(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var az=Object.prototype,cz=az.hasOwnProperty;function uz(e){if(!Wo(e))return oz(e);var t=I0(e),r=[];for(var n in e)n=="constructor"&&(t||!cz.call(e,n))||r.push(n);return r}function j0(e){return _l(e)?c8(e,!0):uz(e)}var lz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fz=/^\w*$/;function P0(e,t){if(Ur(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||cc(e)?!0:fz.test(e)||!lz.test(e)||t!=null&&e in Object(t)}var dz=Fs(Object,"create");const fc=dz;function hz(){this.__data__=fc?fc(null):{},this.size=0}function pz(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var mz="__lodash_hash_undefined__",gz=Object.prototype,vz=gz.hasOwnProperty;function yz(e){var t=this.__data__;if(fc){var r=t[e];return r===mz?void 0:r}return vz.call(t,e)?t[e]:void 0}var bz=Object.prototype,wz=bz.hasOwnProperty;function _z(e){var t=this.__data__;return fc?t[e]!==void 0:wz.call(t,e)}var xz="__lodash_hash_undefined__";function Sz(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=fc&&t===void 0?xz:t,this}function zs(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])}}zs.prototype.clear=hz,zs.prototype.delete=pz,zs.prototype.get=yz,zs.prototype.has=_z,zs.prototype.set=Sz;function Ez(){this.__data__=[],this.size=0}function El(e,t){for(var r=e.length;r--;)if(T0(e[r][0],t))return r;return-1}var Mz=Array.prototype,Cz=Mz.splice;function Az(e){var t=this.__data__,r=El(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Cz.call(t,r,1),--this.size,!0}function Tz(e){var t=this.__data__,r=El(t,e);return r<0?void 0:t[r][1]}function Oz(e){return El(this.__data__,e)>-1}function Iz(e,t){var r=this.__data__,n=El(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Ai(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])}}Ai.prototype.clear=Ez,Ai.prototype.delete=Az,Ai.prototype.get=Tz,Ai.prototype.has=Oz,Ai.prototype.set=Iz;var kz=Fs(Zn,"Map");const dc=kz;function jz(){this.size=0,this.__data__={hash:new zs,map:new(dc||Ai),string:new zs}}function Pz(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ml(e,t){var r=e.__data__;return Pz(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Nz(e){var t=Ml(this,e).delete(e);return this.size-=t?1:0,t}function Rz(e){return Ml(this,e).get(e)}function Dz(e){return Ml(this,e).has(e)}function $z(e,t){var r=Ml(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,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=jz,Ti.prototype.delete=Nz,Ti.prototype.get=Rz,Ti.prototype.has=Dz,Ti.prototype.set=$z;var Bz="Expected a function";function N0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Bz);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(N0.Cache||Ti),r}N0.Cache=Ti;var Lz=500;function Uz(e){var t=N0(e,function(n){return r.size===Lz&&r.clear(),n}),r=t.cache;return t}var Fz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zz=/\\(\\)?/g,Vz=Uz(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Fz,function(r,n,i,s){t.push(i?s.replace(zz,"$1"):n||r)}),t});const qz=Vz;function Gz(e){return e==null?"":q6(e)}function l8(e,t){return Ur(e)?e:P0(e,t)?[e]:qz(Gz(e))}var Hz=1/0;function Cl(e){if(typeof e=="string"||cc(e))return e;var t=e+"";return t=="0"&&1/e==-Hz?"-0":t}function R0(e,t){t=l8(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Cl(t[r++])];return r&&r==n?e:void 0}function Wz(e,t,r){var n=e==null?void 0:R0(e,t);return n===void 0?r:n}function f8(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Kz=u8(Object.getPrototypeOf,Object);const d8=Kz;function Xz(){this.__data__=new Ai,this.size=0}function Yz(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Jz(e){return this.__data__.get(e)}function Zz(e){return this.__data__.has(e)}var Qz=200;function eV(e,t){var r=this.__data__;if(r instanceof Ai){var n=r.__data__;if(!dc||n.length<Qz-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ti(n)}return r.set(e,t),this.size=r.size,this}function ei(e){var t=this.__data__=new Ai(e);this.size=t.size}ei.prototype.clear=Xz,ei.prototype.delete=Yz,ei.prototype.get=Jz,ei.prototype.has=Zz,ei.prototype.set=eV;function tV(e,t){return e&&wl(t,lc(t),e)}function rV(e,t){return e&&wl(t,j0(t),e)}var h8=typeof zt=="object"&&zt&&!zt.nodeType&&zt,p8=h8&&typeof module=="object"&&module&&!module.nodeType&&module,nV=p8&&p8.exports===h8,m8=nV?Zn.Buffer:void 0,g8=m8?m8.allocUnsafe:void 0;function iV(e,t){if(t)return e.slice();var r=e.length,n=g8?g8(r):new e.constructor(r);return e.copy(n),n}function v8(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 y8(){return[]}var sV=Object.prototype,oV=sV.propertyIsEnumerable,b8=Object.getOwnPropertySymbols,aV=b8?function(e){return e==null?[]:(e=Object(e),v8(b8(e),function(t){return oV.call(e,t)}))}:y8;const D0=aV;function cV(e,t){return wl(e,D0(e),t)}var uV=Object.getOwnPropertySymbols,lV=uV?function(e){for(var t=[];e;)f8(t,D0(e)),e=d8(e);return t}:y8;const w8=lV;function fV(e,t){return wl(e,w8(e),t)}function _8(e,t,r){var n=t(e);return Ur(e)?n:f8(n,r(e))}function $0(e){return _8(e,lc,D0)}function dV(e){return _8(e,j0,w8)}var hV=Fs(Zn,"DataView");const B0=hV;var pV=Fs(Zn,"Promise");const L0=pV;var mV=Fs(Zn,"Set");const U0=mV;var x8="[object Map]",gV="[object Object]",S8="[object Promise]",E8="[object Set]",M8="[object WeakMap]",C8="[object DataView]",vV=Us(B0),yV=Us(dc),bV=Us(L0),wV=Us(U0),_V=Us(A0),Vs=Ho;(B0&&Vs(new B0(new ArrayBuffer(1)))!=C8||dc&&Vs(new dc)!=x8||L0&&Vs(L0.resolve())!=S8||U0&&Vs(new U0)!=E8||A0&&Vs(new A0)!=M8)&&(Vs=function(e){var t=Ho(e),r=t==gV?e.constructor:void 0,n=r?Us(r):"";if(n)switch(n){case vV:return C8;case yV:return x8;case bV:return S8;case wV:return E8;case _V:return M8}return t});const hc=Vs;var xV=Object.prototype,SV=xV.hasOwnProperty;function EV(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&SV.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var MV=Zn.Uint8Array;const Al=MV;function F0(e){var t=new e.constructor(e.byteLength);return new Al(t).set(new Al(e)),t}function CV(e,t){var r=t?F0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var AV=/\w*$/;function TV(e){var t=new e.constructor(e.source,AV.exec(e));return t.lastIndex=e.lastIndex,t}var A8=Qn?Qn.prototype:void 0,T8=A8?A8.valueOf:void 0;function OV(e){return T8?Object(T8.call(e)):{}}function IV(e,t){var r=t?F0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var kV="[object Boolean]",jV="[object Date]",PV="[object Map]",NV="[object Number]",RV="[object RegExp]",DV="[object Set]",$V="[object String]",BV="[object Symbol]",LV="[object ArrayBuffer]",UV="[object DataView]",FV="[object Float32Array]",zV="[object Float64Array]",VV="[object Int8Array]",qV="[object Int16Array]",GV="[object Int32Array]",HV="[object Uint8Array]",WV="[object Uint8ClampedArray]",KV="[object Uint16Array]",XV="[object Uint32Array]";function YV(e,t,r){var n=e.constructor;switch(t){case LV:return F0(e);case kV:case jV:return new n(+e);case UV:return CV(e,r);case FV:case zV:case VV:case qV:case GV:case HV:case WV:case KV:case XV:return IV(e,r);case PV:return new n;case NV:case $V:return new n(e);case RV:return TV(e);case DV:return new n;case BV:return OV(e)}}function JV(e){return typeof e.constructor=="function"&&!I0(e)?oF(d8(e)):{}}var ZV="[object Map]";function QV(e){return as(e)&&hc(e)==ZV}var O8=Ko&&Ko.isMap,eq=O8?Sl(O8):QV;const tq=eq;var rq="[object Set]";function nq(e){return as(e)&&hc(e)==rq}var I8=Ko&&Ko.isSet,iq=I8?Sl(I8):nq;const sq=iq;var oq=1,aq=2,cq=4,k8="[object Arguments]",uq="[object Array]",lq="[object Boolean]",fq="[object Date]",dq="[object Error]",j8="[object Function]",hq="[object GeneratorFunction]",pq="[object Map]",mq="[object Number]",P8="[object Object]",gq="[object RegExp]",vq="[object Set]",yq="[object String]",bq="[object Symbol]",wq="[object WeakMap]",_q="[object ArrayBuffer]",xq="[object DataView]",Sq="[object Float32Array]",Eq="[object Float64Array]",Mq="[object Int8Array]",Cq="[object Int16Array]",Aq="[object Int32Array]",Tq="[object Uint8Array]",Oq="[object Uint8ClampedArray]",Iq="[object Uint16Array]",kq="[object Uint32Array]",Ht={};Ht[k8]=Ht[uq]=Ht[_q]=Ht[xq]=Ht[lq]=Ht[fq]=Ht[Sq]=Ht[Eq]=Ht[Mq]=Ht[Cq]=Ht[Aq]=Ht[pq]=Ht[mq]=Ht[P8]=Ht[gq]=Ht[vq]=Ht[yq]=Ht[bq]=Ht[Tq]=Ht[Oq]=Ht[Iq]=Ht[kq]=!0,Ht[dq]=Ht[j8]=Ht[wq]=!1;function Tl(e,t,r,n,i,s){var o,a=t&oq,c=t&aq,u=t&cq;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!Wo(e))return e;var l=Ur(e);if(l){if(o=EV(e),!a)return aF(e,o)}else{var f=hc(e),h=f==j8||f==hq;if(xl(e))return iV(e,a);if(f==P8||f==k8||h&&!i){if(o=c||h?{}:JV(e),!a)return c?fV(e,rV(o,e)):cV(e,tV(o,e))}else{if(!Ht[f])return i?e:{};o=YV(e,f,a)}}s||(s=new ei);var y=s.get(e);if(y)return y;s.set(e,o),sq(e)?e.forEach(function(A){o.add(Tl(A,t,r,A,e,s))}):tq(e)&&e.forEach(function(A,I){o.set(I,Tl(A,t,r,I,e,s))});var _=u?c?dV:$0:c?j0:lc,w=l?void 0:_(e);return uF(w||e,function(A,I){w&&(I=A,A=e[I]),Z6(o,I,Tl(A,t,r,I,e,s))}),o}var jq=1,Pq=4;function Nq(e){return Tl(e,jq|Pq)}var Rq="__lodash_hash_undefined__";function Dq(e){return this.__data__.set(e,Rq),this}function $q(e){return this.__data__.has(e)}function Ol(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ti;++t<r;)this.add(e[t])}Ol.prototype.add=Ol.prototype.push=Dq,Ol.prototype.has=$q;function Bq(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 Lq(e,t){return e.has(t)}var Uq=1,Fq=2;function N8(e,t,r,n,i,s){var o=r&Uq,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&Fq?new Ol: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(!Bq(t,function(I,P){if(!Lq(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 zq(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function Vq(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var qq=1,Gq=2,Hq="[object Boolean]",Wq="[object Date]",Kq="[object Error]",Xq="[object Map]",Yq="[object Number]",Jq="[object RegExp]",Zq="[object Set]",Qq="[object String]",eG="[object Symbol]",tG="[object ArrayBuffer]",rG="[object DataView]",R8=Qn?Qn.prototype:void 0,z0=R8?R8.valueOf:void 0;function nG(e,t,r,n,i,s,o){switch(r){case rG:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case tG:return!(e.byteLength!=t.byteLength||!s(new Al(e),new Al(t)));case Hq:case Wq:case Yq:return T0(+e,+t);case Kq:return e.name==t.name&&e.message==t.message;case Jq:case Qq:return e==t+"";case Xq:var a=zq;case Zq:var c=n&qq;if(a||(a=Vq),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=Gq,o.set(e,t);var l=N8(a(e),a(t),n,i,s,o);return o.delete(e),l;case eG:if(z0)return z0.call(e)==z0.call(t)}return!1}var iG=1,sG=Object.prototype,oG=sG.hasOwnProperty;function aG(e,t,r,n,i,s){var o=r&iG,a=$0(e),c=a.length,u=$0(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:oG.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 R=o?n(P,I,h,t,e,s):n(I,P,h,e,t,s);if(!(R===void 0?I===P||i(I,P,r,n,s):R)){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 cG=1,D8="[object Arguments]",$8="[object Array]",Il="[object Object]",uG=Object.prototype,B8=uG.hasOwnProperty;function lG(e,t,r,n,i,s){var o=Ur(e),a=Ur(t),c=o?$8:hc(e),u=a?$8:hc(t);c=c==D8?Il:c,u=u==D8?Il:u;var l=c==Il,f=u==Il,h=c==u;if(h&&xl(e)){if(!xl(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new ei),o||a8(e)?N8(e,t,r,n,i,s):nG(e,t,c,r,n,i,s);if(!(r&cG)){var y=l&&B8.call(e,"__wrapped__"),_=f&&B8.call(t,"__wrapped__");if(y||_){var w=y?e.value():e,A=_?t.value():t;return s||(s=new ei),i(w,A,r,n,s)}}return h?(s||(s=new ei),aG(e,t,r,n,i,s)):!1}function kl(e,t,r,n,i){return e===t?!0:e==null||t==null||!as(e)&&!as(t)?e!==e&&t!==t:lG(e,t,r,n,kl,i)}var fG=1,dG=2;function hG(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 ei;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?kl(l,u,fG|dG,n,f):h))return!1}}return!0}function L8(e){return e===e&&!Wo(e)}function pG(e){for(var t=lc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,L8(i)]}return t}function U8(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function mG(e){var t=pG(e);return t.length==1&&t[0][2]?U8(t[0][0],t[0][1]):function(r){return r===e||hG(r,e,t)}}function gG(e,t){return e!=null&&t in Object(e)}function vG(e,t,r){t=l8(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Cl(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&O0(i)&&Y6(o,i)&&(Ur(e)||t8(e)))}function yG(e,t){return e!=null&&vG(e,t,gG)}var bG=1,wG=2;function _G(e,t){return P0(e)&&L8(t)?U8(Cl(e),t):function(r){var n=Wz(r,e);return n===void 0&&n===t?yG(r,e):kl(t,n,bG|wG)}}function xG(e){return function(t){return t==null?void 0:t[e]}}function SG(e){return function(t){return R0(t,e)}}function EG(e){return P0(e)?xG(Cl(e)):SG(e)}function F8(e){return typeof e=="function"?e:e==null?G6:typeof e=="object"?Ur(e)?_G(e[0],e[1]):mG(e):EG(e)}function MG(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 CG=MG();const AG=CG;function TG(e,t){return e&&AG(e,t,lc)}function OG(e,t){return function(r,n){if(r==null)return r;if(!_l(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 IG=OG(TG);const z8=IG;function kG(e,t){var r=[];return z8(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function jG(e,t){var r=Ur(e)?v8:kG;return r(e,F8(t))}function PG(e,t){var r=-1,n=_l(e)?Array(e.length):[];return z8(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function NG(e,t){return kl(e,t)}function RG(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function DG(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=cc(e),o=t!==void 0,a=t===null,c=t===t,u=cc(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 $G(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=DG(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 BG(e,t,r){t.length?t=bl(t,function(s){return Ur(s)?function(o){return R0(o,s.length===1?s[0]:s)}:s}):t=[G6];var n=-1;t=bl(t,Sl(F8));var i=PG(e,function(s,o,a){var c=bl(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return RG(i,function(s,o){return $G(s,o,r)})}function LG(e,t,r,n){return e==null?[]:(Ur(t)||(t=t==null?[]:[t]),r=n?void 0:r,Ur(r)||(r=r==null?[]:[r]),BG(e,t,r))}function UG({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=sn(),s=te.useRef(!1),{slippage:o}=qr(),[a,c]=te.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=Hx(o,a),{showPriceImpactTips:y,showPriceImpactWarn:_}=D6(n,i,u,l),{priceAcceptRouterData:w}=MB(a),[A,I]=te.useState(!1),[P,R]=te.useState(!1);te.useMemo(()=>f?i:n,[f]);const F=te.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=Nq(w);c(q),setTimeout(()=>{s.current=!1},300)}},H=te.useMemo(()=>A?!1:!!_,[A,_]);return b.jsxs("div",{className:"secondary-dialog",children:[b.jsx(M0,{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:So(u||"")}),b.jsx("img",{src:n==null?void 0:n.logo_url}),b.jsx("span",{className:"symbol",children:Gn((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:So(l||"")}),b.jsx("img",{src:i==null?void 0:i.logo_url}),b.jsx("span",{className:"symbol",children:Gn((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(E0,{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(B6,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),b.jsx($6,{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||(R(!0),t(a))},children:P?b.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:b.jsx(R6,{})}):"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 jl(e){const{text:t}=e,[r,n]=te.useState(!1),{addCommonToast:i}=zo(),s=o=>{r||(mu(o),Lx(t,{debug:!1,message:"message"}),i("Copied"),n(!r))};return te.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 FG({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=sn(),{getTokenInfo:a}=$s(),c=te.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(f=>({...f,fromToken:a(f.from_type),toToken:a(f.to_type)}))}))},[t]);return b.jsxs("div",{className:"route-dialog",children:[b.jsx(M0,{title:"Route",backClick:e}),b.jsxs("div",{className:"route-dialog-content",children:[b.jsx("div",{className:"simple-router-box",children:b.jsx(q8,{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(Wr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),b.jsx("span",{className:"amount",children:tn(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:[ze(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(oc,{position:"bottom",content:b.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[b.jsx(VG,{poolAddress:f.pool_address}),b.jsx(V8,{token:f.fromToken}),b.jsx(V8,{token:f.toToken})]}),children:b.jsx(zG,{path:f})})},f.to_type))})]},l))})}),b.jsxs("div",{className:"center",style:{gap:"4px"},children:[b.jsx(Wr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),b.jsx("span",{className:"amount",children:tn(o,i==null?void 0:i.decimals)}),b.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function zG({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(Wr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),b.jsx(Wr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),b.jsxs("span",{className:"provider",children:[(n=A2[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&b.jsxs("div",{className:"fee-tier",children:[" ",ze(e.fee_rate).mul(100).toString(),"%"]})]})}function V8({token:e}){const{getExplorerUrl:t}=Eo();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(Wr,{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:mu,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:Is(e==null?void 0:e.coin_type)}),b.jsx(jl,{text:(e==null?void 0:e.coin_type)||""})]})]})}function VG({poolAddress:e}){const{getExplorerUrl:t}=Eo();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:mu,href:t(e,"poolAddress"),target:"_blank",children:Is(e)}),b.jsx(jl,{text:e})]})]}),e&&b.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function q8({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var a,c,u;const[n,i]=te.useState(!1),{getTokenInfo:s}=$s(),o=te.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(Fo,{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(oc,{content:b.jsx("div",{children:A2[l].name}),position:"top",delay:300,children:b.jsx(Wr,{src:br[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(FG,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const hK="",pc=xi((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||_i.setItem(S2,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=Xw(r.coin_type);o=i.filter(c=>Xw(c.coin_type)!==a)}return s(o),_i.setItem(E2,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}))}}));_i.getItem(S2).then(e=>{e!==null&&pc.getState().setCollectTokenMap(e,!0)}),_i.getItem(E2).then(e=>{e&&pc.getState().setImportTokenList(e)});function G8(){const{setCollectTokenMap:e,collectTokenMap:t}=pc(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=te.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function qG(e){const{trustedTokenList:t}=rc(),{tokenBalanceObj:r,currentAccount:n}=Sn(),{coinPriceObj:i}=Vx(),{getTokenAmountValue:s}=rl(),{fetchTokenInfo:o}=$s(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:_,setImportTokenIsLoading:w,currentImportTokenData:A,searchInput:I,setSearchInput:P,importTokenIsLoading:R,showTokenListIsLoading:F,setCurrentTypeTab:L}=pc(),[H,q]=te.useState(!1);te.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[X,ne]=te.useState(!1);te.useEffect(()=>{m2(i)||ne(!0)},[i]);const ce=te.useRef({}),[oe,V]=te.useState(!1);te.useEffect(()=>{(!m2(r)||!rh(ce.current,r))&&(ce.current=r,V(!0))},[r]);const $=(v,N)=>{const se=N&&N.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 Ye=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&&!N&&(Me=12,Ce=1e3,Ye=1e4),{...be,mark:Ce,sort:Me,coin_priority_sort:Ye,rateNumber:Number((be==null?void 0:be.rate)||"0"),balanceNumber:Number((be==null?void 0:be.balance)||"0")}});return LG(ue,[be=>!N&&e===be.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},p=(v,N=!1)=>{const se=N?v.trim():v.toLowerCase().trim(),ue=["symbol","name","coin_type"];return jG(se.length===0?l:[...l,...f],be=>ue.some(Ce=>{const Me=be[Ce];return typeof Me=="string"?(N?Me:Me.toLowerCase()).includes(se):!1}))},d=v=>{v||_(void 0);const N=p(v);if((N==null?void 0:N.length)===0){m(v);return}else if(v===I){const se=$(N,v);u(se)}},m=async v=>{var N;w(!0);try{if(g2(v)){const se=v.trim(),ue=Tr(se).full_address,xe=await o(ue);if(!xe){u([]);return}const be=((N=r==null?void 0:r[se])==null?void 0:N.totalBalanceFormat)||"0",Ce=ze(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 N=$(f,I);u(N)}},E=()=>{if(A){const v=y(A,!0),N=$(v,I);u(N),_(void 0),P("")}},C=v=>{const N=y(v,!1),se=$(N,I);u(se)},k=v=>{const N=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=$(N,I);u(se)};te.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 N of t){N!=null&&N.coin_type.includes("sui");const se=r==null?void 0:r[N==null?void 0:N.coin_type],ue=(se==null?void 0:se.totalBalanceFormat)||"0",xe=(se==null?void 0:se.displayBalance)||"0",be=ze(ue).gt("0")?s(N==null?void 0:N.coin_type,ue):"0";v.push({...N,balance:xe,rate:tn(be,4,!0)})}h(v)}},[H,X,oe,n==null?void 0:n.address]);const T=te.useRef([]);te.useEffect(()=>{if((l==null?void 0:l.length)>0&&!NG(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=te.useMemo(()=>{if(a==="Default"){if(!F&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!R)return!0;return!1},[I,c,A,R,F]);return{showTokenList:c,handleSearch:d,handleChangePlatform:k,currentImportTokenData:A,handleChangeType:x,handleImportClick:E,handleDeleteImportClick:C,isNoData:g}}function GG({tokenList:e,onHandleTokenAction:t}){return b.jsx("div",{className:"token-collect-list",children:e.map(r=>b.jsx(HG,{token:r,onHandleTokenAction:t},r.coin_type))})}function HG({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 WG=Lt("/images/img_no_data@2x.png");function KG(e){const{img:t=WG,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 XG({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 H8=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function YG(e,t){return!!(e===t||H8(e)&&H8(t))}function JG(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!YG(e[r],t[r]))return!1;return!0}function ZG(e,t){t===void 0&&(t=JG);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function V0(){return V0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},V0.apply(null,arguments)}function W8(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q0(e,t){return q0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},q0(e,t)}function QG(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,q0(e,t)}var K8=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function eH(e,t){return!!(e===t||K8(e)&&K8(t))}function tH(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!eH(e[r],t[r]))return!1;return!0}function G0(e,t){t===void 0&&(t=tH);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 X8(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 rH=typeof performance=="object"&&typeof performance.now=="function",Y8=rH?function(){return performance.now()}:function(){return Date.now()};function J8(e){cancelAnimationFrame(e.id)}function nH(e,t){var r=Y8();function n(){Y8()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var H0=-1;function Z8(e){if(e===void 0&&(e=!1),H0===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),H0=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return H0}var Xo=null;function Q8(e){if(e===void 0&&(e=!1),Xo===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?Xo="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Xo="negative":Xo="positive-ascending"),document.body.removeChild(t),Xo}return Xo}Pi.env.NODE_ENV;var iH=150,sH=function(t,r){return t},Pl=null,Nl=null;Pi.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Pl=new WeakSet,Nl=new WeakSet);function oH(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){QG(h,f);function h(_){var w;return w=f.call(this,_)||this,w._instanceProps=c(w.props,W8(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:W8(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=G0(function(A,I,P,R){return w.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:I,visibleStartIndex:P,visibleStopIndex:R})}),w._callOnScroll=void 0,w._callOnScroll=G0(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,R=I.itemSize,F=I.layout,L=w._getItemStyleCache(u&&R,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),ne=P==="horizontal"||F==="horizontal",ce=P==="rtl",oe=ne?q:0;L[A]=H={position:"absolute",left:ce?void 0:oe,right:ce?oe:void 0,top:ne?0:q,height:ne?"100%":X,width:ne?X:"100%"}}return H},w._getItemStyleCache=void 0,w._getItemStyleCache=G0(function(A,I,P){return{}}),w._onScrollHorizontal=function(A){var I=A.currentTarget,P=I.clientWidth,R=I.scrollLeft,F=I.scrollWidth;w.setState(function(L){if(L.scrollOffset===R)return null;var H=w.props.direction,q=R;if(H==="rtl")switch(Q8()){case"negative":q=-R;break;case"positive-descending":q=F-P-R;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,R=I.scrollHeight,F=I.scrollTop;w.setState(function(L){if(L.scrollOffset===F)return null;var H=Math.max(0,Math.min(F,R-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&&J8(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=nH(w._resetIsScrolling,iH)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,A){return aH(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,R=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;R==="vertical"?L=H.scrollWidth>H.clientWidth?Z8():0:L=H.scrollHeight>H.clientHeight?Z8():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 R=this._outerRef;A==="horizontal"||P==="horizontal"?R.scrollLeft=I:R.scrollTop=I}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,A=w.direction,I=w.layout,P=this.state,R=P.scrollOffset,F=P.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(A==="horizontal"||I==="horizontal")if(A==="rtl")switch(Q8()){case"negative":L.scrollLeft=-R;break;case"positive-ascending":L.scrollLeft=R;break;default:var H=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-H-R;break}else L.scrollLeft=R;else L.scrollTop=R}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&J8(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,A=w.children,I=w.className,P=w.direction,R=w.height,F=w.innerRef,L=w.innerElementType,H=w.innerTagName,q=w.itemCount,X=w.itemData,ne=w.itemKey,ce=ne===void 0?sH:ne,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 N=T;N<=g;N++)v.push(te.createElement(A,{data:X,key:ce(N,X),index:N,isScrolling:d?x:void 0,style:this._getItemStyle(N)}));var se=n(this.props,this._instanceProps);return te.createElement(V||$||"div",{className:I,onScroll:C,ref:this._outerRefSetter,style:V0({position:"relative",height:R,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:P},p)},te.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],R=A[2],F=A[3];this._callOnItemsRendered(I,P,R,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,R=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=!R||F==="backward"?Math.max(1,I):1,ne=!R||F==="forward"?Math.max(1,I):1;return[Math.max(0,H-X),Math.max(0,Math.min(A-1,q+ne)),H,q]},h}(te.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var aH=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(Pi.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Nl&&!Nl.has(l)&&(Nl.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":Pl&&!Pl.has(l)&&(Pl.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.'))}},cH=oH({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(Pi.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 e3(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 uH=["style"],lH=["style"];function fH(e,t){var r=e.style,n=X8(e,uH),i=t.style,s=X8(t,lH);return!e3(r,i)&&!e3(n,s)}const dH=te.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(mH,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},fH),hH=ZG((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function pH({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=te.useRef(null);te.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=hH(e,t,r,n);return b.jsx("div",{className:"token-list",children:b.jsx(cH,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:280,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:dH})})}function mH({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=G8(),{getExplorerUrl:s}=Eo();return b.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[b.jsx(Wr,{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:Gn(e.symbol)})}),b.jsx("p",{className:"token-name",children:Gn(e==null?void 0:e.name,20)}),b.jsxs("div",{className:"copy",children:[b.jsx("a",{onClick:mu,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Is(e==null?void 0:e.coin_type)}),b.jsx(jl,{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?h2(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 gH({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 vH({onClose:e,token:t,onSureClick:r}){const[n,i]=te.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(Wr,{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:Is(t.coin_type)}),b.jsx(jl,{text:t.coin_type})]})]})]}),b.jsxs("div",{className:"risk-checkbox",children:[b.jsx(Bu,{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 yH({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=qG(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:R,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:H}=pc(),{isCustomMode:q}=TB(),[X,ne]=te.useState(void 0);te.useEffect(()=>()=>{P(""),_("All"),h("Default"),H(void 0),ne(void 0)},[]);const{handleCollectToken:ce,collectTokenMap:oe}=G8(),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=N6(C=>{g2(C)?s(nh(C,!1)):s(C)},300),x=(C,k)=>{if(k==="delete_import"){u(C);return}if(k==="collect_token"||k==="un_collect"){ce(C);return}k==="select_token"&&(q&&!C.is_trusted?(ne(C),I(!0)):(t(C),e()))},E=te.useMemo(()=>Array.from(oe.values()),[oe]);return b.jsxs("div",{className:"token-select-modal",children:[b.jsx(M0,{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:R,onChange:C=>d(C.target.value),style:{paddingRight:"40px"}}),R.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(GG,{tokenList:E,onHandleTokenAction:x}),R.length===0&&b.jsx(gH,{currentType:f,changeTab:V}),R.length===0&&f==="Default"&&b.jsx(XG,{tabList:w,currentTab:y,changeTab:$})]}),i&&b.jsx(bH,{searchInputLength:R.length}),F&&b.jsx(Ux,{}),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(pH,{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(vH,{onClose:()=>{ne(void 0)},token:X,onSureClick:()=>{t(X),e()}})]})]})}function bH({searchInputLength:e}){return b.jsx("div",{style:{height:"360px"},children:b.jsx(KG,{text:e>0?"No tokens found":"No Imported Tokens",subItem:e>0?b.jsx("div",{children:b.jsx(oc,{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})})}const pK="";function t3(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 mc;(function(e){e.event="event",e.props="prop"})(mc||(mc={}));function cs(){}function wH(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 gc(e){return!!(e||"").match(/\d/)}function Yo(e){return e==null}function _H(e){return typeof e=="number"&&isNaN(e)}function r3(e){return Yo(e)||_H(e)||typeof e=="number"&&!isFinite(e)}function n3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function xH(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 SH(e,t,r){var n=xH(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 EH(e){var t=te.useRef(e);t.current=e;var r=te.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function W0(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 MH(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 i3(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function s3(e,t){return Array(t+1).join(e)}function o3(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."+s3("0",Math.abs(o))+i:o>=a?i=i+s3("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function a3(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=W0(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=i3(l[1]||"",t,r),y=a?"-":"",_=n?".":"";return""+y+f+_+h}function qs(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 c3=wH(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}}}),CH=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function AH(e,t,r){return Math.min(Math.max(e,t),r)}function K0(e){return Math.max(e.selectionStart,e.selectionEnd)}function TH(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function OH(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function IH(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function kH(e,t,r,n,i,s,o){o===void 0&&(o=IH);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 R=I===-1||h[I]===-1?0:h[I]+1;return R>P?P:n-R<P-n?R:P}function u3(e,t,r,n){var i=e.length;if(t=AH(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 jH(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(gc(e[r])||gc(e[r-1]));return t}function l3(e,t,r,n,i,s){s===void 0&&(s=cs);var o=EH(function(_,w){var A,I;return r3(_)?(I="",A=""):typeof _=="number"||w?(I=typeof _=="number"?o3(_):_,A=n(I)):(I=i(_,void 0),A=n(I)),{formattedValue:A,numAsString:I}}),a=te.useState(function(){return o(Yo(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;Yo(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return te.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function PH(e){return e.replace(/[^0-9]/g,"")}function NH(e){return e}function RH(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=NH);var a=e.removeFormatting;a===void 0&&(a=PH);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=cs);var y=e.onKeyDown;y===void 0&&(y=cs);var _=e.onMouseUp;_===void 0&&(_=cs);var w=e.onFocus;w===void 0&&(w=cs);var A=e.onBlur;A===void 0&&(A=cs);var I=e.value,P=e.getCaretBoundary;P===void 0&&(P=jH);var R=e.isValidInputCharacter;R===void 0&&(R=gc);var F=e.isCharacterSame,L=t3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=l3(I,c,!!u,o,a,l),q=H[0],X=q.formattedValue,ne=q.numAsString,ce=H[1],oe=te.useRef(),V=te.useRef({formattedValue:X,numAsString:ne}),$=function(we,me){V.current={formattedValue:we.formattedValue,numAsString:we.value},ce(we,me)},p=te.useState(!1),d=p[0],m=p[1],x=te.useRef(null),E=te.useRef({setCaretTimeout:null,focusTimeout:null});te.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||(qs(we,me),E.current.setCaretTimeout=setTimeout(function(){we.value===Te&&we.selectionStart!==me&&qs(we,me)},0))},g=function(we,me,Te){return u3(we,me,P(we),Te)},v=function(we,me,Te){var Ge=P(me),De=kH(me,X,we,Te,Ge,R,F);return De=u3(me,De,Ge),De},N=function(we){var me=we.formattedValue;me===void 0&&(me="");var Te=we.input,Ge=we.source,De=we.event,Oe=we.numAsString,Ie;if(Te){var Le=we.inputValue||Te.value,ft=K0(Te);Te.value=me,Ie=v(Le,me,ft),Ie!==void 0&&T(Te,Ie,me)}me!==X&&$(k(me,Oe),{event:De,source:Ge})};te.useEffect(function(){var we=V.current,me=we.formattedValue,Te=we.numAsString;(X!==me||ne!==Te)&&$(k(X,ne),{event:void 0,source:mc.props})},[X,ne]);var se=x.current?K0(x.current):void 0,ue=typeof window<"u"?te.useLayoutEffect:te.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 Ge=me.target,De=oe.current?CH(oe.current,Ge.selectionEnd):c3(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=K0(ft),He=v(we,X,dt);return ft.value=X,T(ft,He,X),!1}return N({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,Ge=we.selectionEnd;oe.current={selectionStart:Te,selectionEnd:Ge+me}},Ce=function(we){var me=we.target,Te=me.value,Ge=xe(Te,we,mc.event);Ge&&h(we),oe.current=void 0},Me=function(we){var me=we.target,Te=we.key,Ge=me.selectionStart,De=me.selectionEnd,Oe=me.value;Oe===void 0&&(Oe="");var Ie;Te==="ArrowLeft"||Te==="Backspace"?Ie=Math.max(Ge-1,0):Te==="ArrowRight"?Ie=Math.min(Ge+1,Oe.length):Te==="Delete"&&(Ie=Ge);var Le=0;Te==="Delete"&&Ge===De&&(Le=1);var ft=Te==="ArrowLeft"||Te==="ArrowRight";if(Ie===void 0||Ge!==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"&&!R(Oe[Ie])?dt=g(Oe,Ie,"right"):Te==="Backspace"&&!R(Oe[Ie])&&(dt=g(Oe,Ie,"left"));dt!==Ie&&T(me,dt,Oe),y(we),be(me,Le)},Ye=function(we){var me=we.target,Te=function(){var Ge=me.selectionStart,De=me.selectionEnd,Oe=me.value;if(Oe===void 0&&(Oe=""),Ge===De){var Ie=g(Oe,Ge);Ie!==Ge&&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 Ge=me.selectionStart,De=me.selectionEnd,Oe=me.value;Oe===void 0&&(Oe="");var Ie=g(Oe,Ge);Ie!==Ge&&!(Ge===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&&TH()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:X,onChange:Ce,onKeyDown:Me,onMouseUp:Ye,onFocus:Ue,onBlur:lt});if(r==="text")return i?te.createElement(te.Fragment,null,i(X,L)||null):te.createElement("span",Object.assign({},L,{ref:s}),X);if(n){var mt=n;return te.createElement(mt,Object.assign({},$e,{ref:s}))}return te.createElement("input",Object.assign({},$e,{ref:s}))}function f3(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=W0(e,o),y=h.beforeDecimal,_=h.afterDecimal,w=h.addNegation;return r!==void 0&&(_=i3(_,r,!!n)),u&&(y=SH(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 DH(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 $H(e,t){return new RegExp("(^-)|[0-9]|"+n3(e),t?"g":void 0)}function BH(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function LH(e,t,r){var n;t===void 0&&(t=OH(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(gc(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),R=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 ne=0;e.startsWith(s)?ne+=s.length:l<s.length&&(ne=l),e=e.substring(ne),f-=ne;var ce=e.length,oe=e.length-o.length;e.endsWith(o)?ce=oe:(f>oe||f>e.length-o.length)&&(ce=f),e=e.substring(0,ce),e=DH(R?"-"+e:e,i),e=(e.match($H(_,!0))||[]).join("");var V=e.indexOf(_);e=e.replace(new RegExp(n3(_),"g"),function(x,E){return E===V?".":""});var $=W0(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 UH(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 FH(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(`
|
|
106
|
+
`})]})}function _0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=te.useState(!0),a=JS(s,r,n);return w.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[w.jsx(Yr,{src:s?e.logo_url:t.logo_url}),w.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",On(s?e.symbol:t.symbol)," ","="," ",i?w.jsx(ra,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):cn(a,t.decimals)," ",On(s?t.symbol:e.symbol)]}),w.jsx(Yr,{src:s?t.logo_url:e.logo_url}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-swap"})})]})}function t8(e,t,r,n){const{getTokenPrice:i}=Fl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=JS(!0,r,n),c=te.useMemo(()=>{if(o&&s)return Fe(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=te.useMemo(()=>{if(c&&+a)return Fe(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=te.useMemo(()=>{const y=[];return s&&y.push(s.market),o&&!y.includes(o.market)&&y.push(o.market),y},[s==null?void 0:s.market,o==null?void 0:o.market]),f=te.useMemo(()=>u&&Fe(u).lt(0)?Fe(u).abs().gt(5):!1,[u]),h=te.useMemo(()=>u&&Fe(u).lt(0)?Fe(u).abs().gt(10):!1,[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h}}function wc({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=te.useState(!1),[o,a]=te.useState(!1),c=te.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};te.useEffect(()=>()=>{i||c.current&&(clearTimeout(c.current),c.current=null)},[i]);const l=()=>{c.current=setTimeout(()=>{o||(s(!1),c.current&&(clearTimeout(c.current),c.current=null))},0)},f=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},h=te.useRef(null),[y,b]=te.useState({left:void 0,top:void 0});return te.useEffect(()=>{var _;if(i&&h.current){const A=(_=h.current)==null?void 0:_.getBoundingClientRect();let P,N;r==="top"?(P=`${window.scrollX+A.left+A.width/2}px`,N=`${window.scrollY+A.top-2*A.height-8}px`):r==="bottom"?(P=`${window.scrollX+A.left+A.width/2}px`,N=`${window.scrollY+A.bottom}px`):r==="left"?(P=`${window.scrollX+A.left-8}px`,N=`${window.scrollY+A.top+A.height/2}px`):r==="right"?(P=`${window.scrollX+A.right+8}px`,N=`${window.scrollY+A.top+A.height/2}px`):(P=`${window.scrollX+A.left+A.width/2}px`,N=`${window.scrollY+A.top+A.height/2}px`),b({left:P,top:N})}},[i]),w.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&$n.createPortal(w.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 r8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=fn(),{priceImpact:a,sources:c,marketPrice:u}=t8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi),l=te.useMemo(()=>{if(a){if(Fe(a).gt(0))return"green";const f=Fe(a).abs();return f.gt(1)&&f.lt(10)?"yellow":f.gte(10)?"red":"green"}return"yellow"},[a]);return w.jsxs(w.Fragment,{children:[!r&&Fe(a).lte(-30)&&w.jsx("div",{className:"price-impact-tips red",children:"Price Impact Alert. Be cautious before submitting your order."}),w.jsxs("div",{className:"price-impact-block",children:[w.jsxs("div",{className:"left",children:[w.jsx("span",{children:"Price Impact"}),w.jsx(wc,{content:w.jsx(Bz,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),position:"bottom",delay:300,children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsxs("div",{children:[e&&w.jsx(ra,{style:{width:"80px",height:"20px"}}),!e&&w.jsxs("div",{className:"right",children:[w.jsx("span",{className:l,children:a?LR(a,2):"Incalculable"}),w.jsx("div",{className:"platforms",children:c.map(f=>w.jsx(wc,{content:w.jsx("span",{style:{fontSize:"12px"},children:Ox[f]}),position:"top",delay:300,children:w.jsx(Yr,{src:iD[f]})},f))})]})]})]})]})}function Bz({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){return w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[w.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."}),w.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[w.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?w.jsx(_0,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):w.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[w.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),w.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(s=>Ox[s]+" ").join("")})]})]})}function n8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=fn();return w.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[w.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?w.jsx(ra,{style:{height:"18px",width:"80px"}}):w.jsxs("div",{className:"right",children:[cn(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,an.ROUND_DOWN)," ",On(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function Lz({scamsText:e}){return w.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[w.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),w.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:w.jsx(kx,{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 Fz({onClick:e}){return w.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-back"})}),w.jsx("span",{children:"Back"})]})}function x0({title:e,backClick:t}){return w.jsxs("div",{className:"cs-have-back-header",children:[w.jsx(Fz,{onClick:t}),w.jsx("span",{className:"title",children:e})]})}const zl=globalThis||void 0||self;var Uz=typeof zl=="object"&&zl&&zl.Object===Object&&zl;const i8=Uz;var zz=typeof self=="object"&&self&&self.Object===Object&&self,Vz=i8||zz||Function("return this")();const ai=Vz;var qz=ai.Symbol;const ci=qz;var s8=Object.prototype,Gz=s8.hasOwnProperty,Wz=s8.toString,_c=ci?ci.toStringTag:void 0;function Hz(e){var t=Gz.call(e,_c),r=e[_c];try{e[_c]=void 0;var n=!0}catch{}var i=Wz.call(e);return n&&(t?e[_c]=r:delete e[_c]),i}var Kz=Object.prototype,Xz=Kz.toString;function Jz(e){return Xz.call(e)}var Yz="[object Null]",Zz="[object Undefined]",o8=ci?ci.toStringTag:void 0;function sa(e){return e==null?e===void 0?Zz:Yz:o8&&o8 in Object(e)?Hz(e):Jz(e)}function vs(e){return e!=null&&typeof e=="object"}var Qz="[object Symbol]";function xc(e){return typeof e=="symbol"||vs(e)&&sa(e)==Qz}function Vl(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var eV=Array.isArray;const zr=eV;var tV=1/0,a8=ci?ci.prototype:void 0,c8=a8?a8.toString:void 0;function u8(e){if(typeof e=="string")return e;if(zr(e))return Vl(e,u8)+"";if(xc(e))return c8?c8.call(e):"";var t=e+"";return t=="0"&&1/e==-tV?"-0":t}function oa(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function l8(e){return e}var rV="[object AsyncFunction]",nV="[object Function]",iV="[object GeneratorFunction]",sV="[object Proxy]";function f8(e){if(!oa(e))return!1;var t=sa(e);return t==nV||t==iV||t==rV||t==sV}var oV=ai["__core-js_shared__"];const S0=oV;var d8=function(){var e=/[^.]+$/.exec(S0&&S0.keys&&S0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function aV(e){return!!d8&&d8 in e}var cV=Function.prototype,uV=cV.toString;function Zs(e){if(e!=null){try{return uV.call(e)}catch{}try{return e+""}catch{}}return""}var lV=/[\\^$.*+?()[\]{}|]/g,fV=/^\[object .+?Constructor\]$/,dV=Function.prototype,hV=Object.prototype,pV=dV.toString,mV=hV.hasOwnProperty,gV=RegExp("^"+pV.call(mV).replace(lV,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vV(e){if(!oa(e)||aV(e))return!1;var t=f8(e)?gV:fV;return t.test(Zs(e))}function yV(e,t){return e==null?void 0:e[t]}function Qs(e,t){var r=yV(e,t);return vV(r)?r:void 0}var bV=Qs(ai,"WeakMap");const E0=bV;var h8=Object.create,wV=function(){function e(){}return function(t){if(!oa(t))return{};if(h8)return h8(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const _V=wV;function xV(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var SV=function(){try{var e=Qs(Object,"defineProperty");return e({},"",{}),e}catch{}}();const p8=SV;function EV(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var CV=9007199254740991,MV=/^(?:0|[1-9]\d*)$/;function m8(e,t){var r=typeof e;return t=t??CV,!!t&&(r=="number"||r!="symbol"&&MV.test(e))&&e>-1&&e%1==0&&e<t}function g8(e,t,r){t=="__proto__"&&p8?p8(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function C0(e,t){return e===t||e!==e&&t!==t}var TV=Object.prototype,AV=TV.hasOwnProperty;function v8(e,t,r){var n=e[t];(!(AV.call(e,t)&&C0(n,r))||r===void 0&&!(t in e))&&g8(e,t,r)}function ql(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?g8(r,a,c):v8(r,a,c)}return r}var OV=9007199254740991;function M0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=OV}function Gl(e){return e!=null&&M0(e.length)&&!f8(e)}var IV=Object.prototype;function T0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||IV;return e===r}function PV(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var jV="[object Arguments]";function y8(e){return vs(e)&&sa(e)==jV}var b8=Object.prototype,kV=b8.hasOwnProperty,NV=b8.propertyIsEnumerable,RV=y8(function(){return arguments}())?y8:function(e){return vs(e)&&kV.call(e,"callee")&&!NV.call(e,"callee")};const w8=RV;function DV(){return!1}var _8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,x8=_8&&typeof module=="object"&&module&&!module.nodeType&&module,$V=x8&&x8.exports===_8,S8=$V?ai.Buffer:void 0,BV=S8?S8.isBuffer:void 0,LV=BV||DV;const Wl=LV;var FV="[object Arguments]",UV="[object Array]",zV="[object Boolean]",VV="[object Date]",qV="[object Error]",GV="[object Function]",WV="[object Map]",HV="[object Number]",KV="[object Object]",XV="[object RegExp]",JV="[object Set]",YV="[object String]",ZV="[object WeakMap]",QV="[object ArrayBuffer]",eq="[object DataView]",tq="[object Float32Array]",rq="[object Float64Array]",nq="[object Int8Array]",iq="[object Int16Array]",sq="[object Int32Array]",oq="[object Uint8Array]",aq="[object Uint8ClampedArray]",cq="[object Uint16Array]",uq="[object Uint32Array]",Xt={};Xt[tq]=Xt[rq]=Xt[nq]=Xt[iq]=Xt[sq]=Xt[oq]=Xt[aq]=Xt[cq]=Xt[uq]=!0,Xt[FV]=Xt[UV]=Xt[QV]=Xt[zV]=Xt[eq]=Xt[VV]=Xt[qV]=Xt[GV]=Xt[WV]=Xt[HV]=Xt[KV]=Xt[XV]=Xt[JV]=Xt[YV]=Xt[ZV]=!1;function lq(e){return vs(e)&&M0(e.length)&&!!Xt[sa(e)]}function Hl(e){return function(t){return e(t)}}var E8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,Sc=E8&&typeof module=="object"&&module&&!module.nodeType&&module,fq=Sc&&Sc.exports===E8,A0=fq&&i8.process,dq=function(){try{var e=Sc&&Sc.require&&Sc.require("util").types;return e||A0&&A0.binding&&A0.binding("util")}catch{}}();const aa=dq;var C8=aa&&aa.isTypedArray,hq=C8?Hl(C8):lq;const M8=hq;var pq=Object.prototype,mq=pq.hasOwnProperty;function T8(e,t){var r=zr(e),n=!r&&w8(e),i=!r&&!n&&Wl(e),s=!r&&!n&&!i&&M8(e),o=r||n||i||s,a=o?PV(e.length,String):[],c=a.length;for(var u in e)(t||mq.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||m8(u,c)))&&a.push(u);return a}function A8(e,t){return function(r){return e(t(r))}}var gq=A8(Object.keys,Object);const vq=gq;var yq=Object.prototype,bq=yq.hasOwnProperty;function wq(e){if(!T0(e))return vq(e);var t=[];for(var r in Object(e))bq.call(e,r)&&r!="constructor"&&t.push(r);return t}function Ec(e){return Gl(e)?T8(e):wq(e)}function _q(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var xq=Object.prototype,Sq=xq.hasOwnProperty;function Eq(e){if(!oa(e))return _q(e);var t=T0(e),r=[];for(var n in e)n=="constructor"&&(t||!Sq.call(e,n))||r.push(n);return r}function O0(e){return Gl(e)?T8(e,!0):Eq(e)}var Cq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mq=/^\w*$/;function I0(e,t){if(zr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||xc(e)?!0:Mq.test(e)||!Cq.test(e)||t!=null&&e in Object(t)}var Tq=Qs(Object,"create");const Cc=Tq;function Aq(){this.__data__=Cc?Cc(null):{},this.size=0}function Oq(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Iq="__lodash_hash_undefined__",Pq=Object.prototype,jq=Pq.hasOwnProperty;function kq(e){var t=this.__data__;if(Cc){var r=t[e];return r===Iq?void 0:r}return jq.call(t,e)?t[e]:void 0}var Nq=Object.prototype,Rq=Nq.hasOwnProperty;function Dq(e){var t=this.__data__;return Cc?t[e]!==void 0:Rq.call(t,e)}var $q="__lodash_hash_undefined__";function Bq(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Cc&&t===void 0?$q:t,this}function eo(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])}}eo.prototype.clear=Aq,eo.prototype.delete=Oq,eo.prototype.get=kq,eo.prototype.has=Dq,eo.prototype.set=Bq;function Lq(){this.__data__=[],this.size=0}function Kl(e,t){for(var r=e.length;r--;)if(C0(e[r][0],t))return r;return-1}var Fq=Array.prototype,Uq=Fq.splice;function zq(e){var t=this.__data__,r=Kl(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Uq.call(t,r,1),--this.size,!0}function Vq(e){var t=this.__data__,r=Kl(t,e);return r<0?void 0:t[r][1]}function qq(e){return Kl(this.__data__,e)>-1}function Gq(e,t){var r=this.__data__,n=Kl(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function $i(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$i.prototype.clear=Lq,$i.prototype.delete=zq,$i.prototype.get=Vq,$i.prototype.has=qq,$i.prototype.set=Gq;var Wq=Qs(ai,"Map");const Mc=Wq;function Hq(){this.size=0,this.__data__={hash:new eo,map:new(Mc||$i),string:new eo}}function Kq(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Xl(e,t){var r=e.__data__;return Kq(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Xq(e){var t=Xl(this,e).delete(e);return this.size-=t?1:0,t}function Jq(e){return Xl(this,e).get(e)}function Yq(e){return Xl(this,e).has(e)}function Zq(e,t){var r=Xl(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Bi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Bi.prototype.clear=Hq,Bi.prototype.delete=Xq,Bi.prototype.get=Jq,Bi.prototype.has=Yq,Bi.prototype.set=Zq;var Qq="Expected a function";function P0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Qq);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(P0.Cache||Bi),r}P0.Cache=Bi;var eG=500;function tG(e){var t=P0(e,function(n){return r.size===eG&&r.clear(),n}),r=t.cache;return t}var rG=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nG=/\\(\\)?/g,iG=tG(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(rG,function(r,n,i,s){t.push(i?s.replace(nG,"$1"):n||r)}),t});const sG=iG;function oG(e){return e==null?"":u8(e)}function O8(e,t){return zr(e)?e:I0(e,t)?[e]:sG(oG(e))}var aG=1/0;function Jl(e){if(typeof e=="string"||xc(e))return e;var t=e+"";return t=="0"&&1/e==-aG?"-0":t}function j0(e,t){t=O8(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Jl(t[r++])];return r&&r==n?e:void 0}function cG(e,t,r){var n=e==null?void 0:j0(e,t);return n===void 0?r:n}function I8(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var uG=A8(Object.getPrototypeOf,Object);const P8=uG;function lG(){this.__data__=new $i,this.size=0}function fG(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function dG(e){return this.__data__.get(e)}function hG(e){return this.__data__.has(e)}var pG=200;function mG(e,t){var r=this.__data__;if(r instanceof $i){var n=r.__data__;if(!Mc||n.length<pG-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Bi(n)}return r.set(e,t),this.size=r.size,this}function ui(e){var t=this.__data__=new $i(e);this.size=t.size}ui.prototype.clear=lG,ui.prototype.delete=fG,ui.prototype.get=dG,ui.prototype.has=hG,ui.prototype.set=mG;function gG(e,t){return e&&ql(t,Ec(t),e)}function vG(e,t){return e&&ql(t,O0(t),e)}var j8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,k8=j8&&typeof module=="object"&&module&&!module.nodeType&&module,yG=k8&&k8.exports===j8,N8=yG?ai.Buffer:void 0,R8=N8?N8.allocUnsafe:void 0;function bG(e,t){if(t)return e.slice();var r=e.length,n=R8?R8(r):new e.constructor(r);return e.copy(n),n}function D8(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 $8(){return[]}var wG=Object.prototype,_G=wG.propertyIsEnumerable,B8=Object.getOwnPropertySymbols,xG=B8?function(e){return e==null?[]:(e=Object(e),D8(B8(e),function(t){return _G.call(e,t)}))}:$8;const k0=xG;function SG(e,t){return ql(e,k0(e),t)}var EG=Object.getOwnPropertySymbols,CG=EG?function(e){for(var t=[];e;)I8(t,k0(e)),e=P8(e);return t}:$8;const L8=CG;function MG(e,t){return ql(e,L8(e),t)}function F8(e,t,r){var n=t(e);return zr(e)?n:I8(n,r(e))}function N0(e){return F8(e,Ec,k0)}function TG(e){return F8(e,O0,L8)}var AG=Qs(ai,"DataView");const R0=AG;var OG=Qs(ai,"Promise");const D0=OG;var IG=Qs(ai,"Set");const $0=IG;var U8="[object Map]",PG="[object Object]",z8="[object Promise]",V8="[object Set]",q8="[object WeakMap]",G8="[object DataView]",jG=Zs(R0),kG=Zs(Mc),NG=Zs(D0),RG=Zs($0),DG=Zs(E0),to=sa;(R0&&to(new R0(new ArrayBuffer(1)))!=G8||Mc&&to(new Mc)!=U8||D0&&to(D0.resolve())!=z8||$0&&to(new $0)!=V8||E0&&to(new E0)!=q8)&&(to=function(e){var t=sa(e),r=t==PG?e.constructor:void 0,n=r?Zs(r):"";if(n)switch(n){case jG:return G8;case kG:return U8;case NG:return z8;case RG:return V8;case DG:return q8}return t});const Tc=to;var $G=Object.prototype,BG=$G.hasOwnProperty;function LG(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&BG.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var FG=ai.Uint8Array;const Yl=FG;function B0(e){var t=new e.constructor(e.byteLength);return new Yl(t).set(new Yl(e)),t}function UG(e,t){var r=t?B0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var zG=/\w*$/;function VG(e){var t=new e.constructor(e.source,zG.exec(e));return t.lastIndex=e.lastIndex,t}var W8=ci?ci.prototype:void 0,H8=W8?W8.valueOf:void 0;function qG(e){return H8?Object(H8.call(e)):{}}function GG(e,t){var r=t?B0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var WG="[object Boolean]",HG="[object Date]",KG="[object Map]",XG="[object Number]",JG="[object RegExp]",YG="[object Set]",ZG="[object String]",QG="[object Symbol]",eW="[object ArrayBuffer]",tW="[object DataView]",rW="[object Float32Array]",nW="[object Float64Array]",iW="[object Int8Array]",sW="[object Int16Array]",oW="[object Int32Array]",aW="[object Uint8Array]",cW="[object Uint8ClampedArray]",uW="[object Uint16Array]",lW="[object Uint32Array]";function fW(e,t,r){var n=e.constructor;switch(t){case eW:return B0(e);case WG:case HG:return new n(+e);case tW:return UG(e,r);case rW:case nW:case iW:case sW:case oW:case aW:case cW:case uW:case lW:return GG(e,r);case KG:return new n;case XG:case ZG:return new n(e);case JG:return VG(e);case YG:return new n;case QG:return qG(e)}}function dW(e){return typeof e.constructor=="function"&&!T0(e)?_V(P8(e)):{}}var hW="[object Map]";function pW(e){return vs(e)&&Tc(e)==hW}var K8=aa&&aa.isMap,mW=K8?Hl(K8):pW;const gW=mW;var vW="[object Set]";function yW(e){return vs(e)&&Tc(e)==vW}var X8=aa&&aa.isSet,bW=X8?Hl(X8):yW;const wW=bW;var _W=1,xW=2,SW=4,J8="[object Arguments]",EW="[object Array]",CW="[object Boolean]",MW="[object Date]",TW="[object Error]",Y8="[object Function]",AW="[object GeneratorFunction]",OW="[object Map]",IW="[object Number]",Z8="[object Object]",PW="[object RegExp]",jW="[object Set]",kW="[object String]",NW="[object Symbol]",RW="[object WeakMap]",DW="[object ArrayBuffer]",$W="[object DataView]",BW="[object Float32Array]",LW="[object Float64Array]",FW="[object Int8Array]",UW="[object Int16Array]",zW="[object Int32Array]",VW="[object Uint8Array]",qW="[object Uint8ClampedArray]",GW="[object Uint16Array]",WW="[object Uint32Array]",Ht={};Ht[J8]=Ht[EW]=Ht[DW]=Ht[$W]=Ht[CW]=Ht[MW]=Ht[BW]=Ht[LW]=Ht[FW]=Ht[UW]=Ht[zW]=Ht[OW]=Ht[IW]=Ht[Z8]=Ht[PW]=Ht[jW]=Ht[kW]=Ht[NW]=Ht[VW]=Ht[qW]=Ht[GW]=Ht[WW]=!0,Ht[TW]=Ht[Y8]=Ht[RW]=!1;function Zl(e,t,r,n,i,s){var o,a=t&_W,c=t&xW,u=t&SW;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!oa(e))return e;var l=zr(e);if(l){if(o=LG(e),!a)return xV(e,o)}else{var f=Tc(e),h=f==Y8||f==AW;if(Wl(e))return bG(e,a);if(f==Z8||f==J8||h&&!i){if(o=c||h?{}:dW(e),!a)return c?MG(e,vG(o,e)):SG(e,gG(o,e))}else{if(!Ht[f])return i?e:{};o=fW(e,f,a)}}s||(s=new ui);var y=s.get(e);if(y)return y;s.set(e,o),wW(e)?e.forEach(function(A){o.add(Zl(A,t,r,A,e,s))}):gW(e)&&e.forEach(function(A,P){o.set(P,Zl(A,t,r,P,e,s))});var b=u?c?TG:N0:c?O0:Ec,_=l?void 0:b(e);return EV(_||e,function(A,P){_&&(P=A,A=e[P]),v8(o,P,Zl(A,t,r,P,e,s))}),o}var HW=1,KW=4;function XW(e){return Zl(e,HW|KW)}var JW="__lodash_hash_undefined__";function YW(e){return this.__data__.set(e,JW),this}function ZW(e){return this.__data__.has(e)}function Ql(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Bi;++t<r;)this.add(e[t])}Ql.prototype.add=Ql.prototype.push=YW,Ql.prototype.has=ZW;function QW(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function eH(e,t){return e.has(t)}var tH=1,rH=2;function Q8(e,t,r,n,i,s){var o=r&tH,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(e),l=s.get(t);if(u&&l)return u==t&&l==e;var f=-1,h=!0,y=r&rH?new Ql:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],_=t[f];if(n)var A=o?n(_,b,f,t,e,s):n(b,_,f,e,t,s);if(A!==void 0){if(A)continue;h=!1;break}if(y){if(!QW(t,function(P,N){if(!eH(y,N)&&(b===P||i(b,P,r,n,s)))return y.push(N)})){h=!1;break}}else if(!(b===_||i(b,_,r,n,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function nH(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function iH(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var sH=1,oH=2,aH="[object Boolean]",cH="[object Date]",uH="[object Error]",lH="[object Map]",fH="[object Number]",dH="[object RegExp]",hH="[object Set]",pH="[object String]",mH="[object Symbol]",gH="[object ArrayBuffer]",vH="[object DataView]",e3=ci?ci.prototype:void 0,L0=e3?e3.valueOf:void 0;function yH(e,t,r,n,i,s,o){switch(r){case vH:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case gH:return!(e.byteLength!=t.byteLength||!s(new Yl(e),new Yl(t)));case aH:case cH:case fH:return C0(+e,+t);case uH:return e.name==t.name&&e.message==t.message;case dH:case pH:return e==t+"";case lH:var a=nH;case hH:var c=n&sH;if(a||(a=iH),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=oH,o.set(e,t);var l=Q8(a(e),a(t),n,i,s,o);return o.delete(e),l;case mH:if(L0)return L0.call(e)==L0.call(t)}return!1}var bH=1,wH=Object.prototype,_H=wH.hasOwnProperty;function xH(e,t,r,n,i,s){var o=r&bH,a=N0(e),c=a.length,u=N0(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:_H.call(t,h)))return!1}var y=s.get(e),b=s.get(t);if(y&&b)return y==t&&b==e;var _=!0;s.set(e,t),s.set(t,e);for(var A=o;++f<c;){h=a[f];var P=e[h],N=t[h];if(n)var R=o?n(N,P,h,t,e,s):n(P,N,h,e,t,s);if(!(R===void 0?P===N||i(P,N,r,n,s):R)){_=!1;break}A||(A=h=="constructor")}if(_&&!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)&&(_=!1)}return s.delete(e),s.delete(t),_}var SH=1,t3="[object Arguments]",r3="[object Array]",ef="[object Object]",EH=Object.prototype,n3=EH.hasOwnProperty;function CH(e,t,r,n,i,s){var o=zr(e),a=zr(t),c=o?r3:Tc(e),u=a?r3:Tc(t);c=c==t3?ef:c,u=u==t3?ef:u;var l=c==ef,f=u==ef,h=c==u;if(h&&Wl(e)){if(!Wl(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new ui),o||M8(e)?Q8(e,t,r,n,i,s):yH(e,t,c,r,n,i,s);if(!(r&SH)){var y=l&&n3.call(e,"__wrapped__"),b=f&&n3.call(t,"__wrapped__");if(y||b){var _=y?e.value():e,A=b?t.value():t;return s||(s=new ui),i(_,A,r,n,s)}}return h?(s||(s=new ui),xH(e,t,r,n,i,s)):!1}function tf(e,t,r,n,i){return e===t?!0:e==null||t==null||!vs(e)&&!vs(t)?e!==e&&t!==t:CH(e,t,r,n,tf,i)}var MH=1,TH=2;function AH(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],u=e[c],l=a[1];if(o&&a[2]){if(u===void 0&&!(c in e))return!1}else{var f=new ui;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?tf(l,u,MH|TH,n,f):h))return!1}}return!0}function i3(e){return e===e&&!oa(e)}function OH(e){for(var t=Ec(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,i3(i)]}return t}function s3(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function IH(e){var t=OH(e);return t.length==1&&t[0][2]?s3(t[0][0],t[0][1]):function(r){return r===e||AH(r,e,t)}}function PH(e,t){return e!=null&&t in Object(e)}function jH(e,t,r){t=O8(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Jl(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&&M0(i)&&m8(o,i)&&(zr(e)||w8(e)))}function kH(e,t){return e!=null&&jH(e,t,PH)}var NH=1,RH=2;function DH(e,t){return I0(e)&&i3(t)?s3(Jl(e),t):function(r){var n=cG(r,e);return n===void 0&&n===t?kH(r,e):tf(t,n,NH|RH)}}function $H(e){return function(t){return t==null?void 0:t[e]}}function BH(e){return function(t){return j0(t,e)}}function LH(e){return I0(e)?$H(Jl(e)):BH(e)}function o3(e){return typeof e=="function"?e:e==null?l8:typeof e=="object"?zr(e)?DH(e[0],e[1]):IH(e):LH(e)}function FH(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 UH=FH();const zH=UH;function VH(e,t){return e&&zH(e,t,Ec)}function qH(e,t){return function(r,n){if(r==null)return r;if(!Gl(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 GH=qH(VH);const a3=GH;function WH(e,t){var r=[];return a3(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function HH(e,t){var r=zr(e)?D8:WH;return r(e,o3(t))}function KH(e,t){var r=-1,n=Gl(e)?Array(e.length):[];return a3(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function XH(e,t){return tf(e,t)}function JH(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function YH(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=xc(e),o=t!==void 0,a=t===null,c=t===t,u=xc(t);if(!a&&!u&&!s&&e>t||s&&o&&c&&!a&&!u||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!u&&e<t||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function ZH(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=YH(i[n],s[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function QH(e,t,r){t.length?t=Vl(t,function(s){return zr(s)?function(o){return j0(o,s.length===1?s[0]:s)}:s}):t=[l8];var n=-1;t=Vl(t,Hl(o3));var i=KH(e,function(s,o,a){var c=Vl(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return JH(i,function(s,o){return ZH(s,o,r)})}function eK(e,t,r,n){return e==null?[]:(zr(t)||(t=t==null?[]:[t]),r=n?void 0:r,zr(r)||(r=r==null?[]:[r]),QH(e,t,r))}function tK({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=fn(),s=te.useRef(!1),{slippage:o}=Kr(),[a,c]=te.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=XS(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=t8(n,i,u,l),{priceAcceptRouterData:_}=wz(a),[A,P]=te.useState(!1),[N,R]=te.useState(!1);te.useMemo(()=>f?i:n,[f]);const F=te.useMemo(()=>_!==void 0,[_]),L=()=>{if(_){if(s.current)return;s.current=!0;const q=XW(_);c(q),setTimeout(()=>{s.current=!1},300)}},W=te.useMemo(()=>A?!1:!!b,[A,b]);return w.jsxs("div",{className:"secondary-dialog",children:[w.jsx(x0,{title:"Review your order",backClick:e}),w.jsxs("div",{className:"secondary-content",children:[w.jsxs("div",{className:"trade-info",children:[w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:Bo(u||"")}),w.jsx("img",{src:n==null?void 0:n.logo_url}),w.jsx("span",{className:"symbol",children:On((n==null?void 0:n.symbol)||"")})]}),w.jsx("div",{className:"dividing-line",children:w.jsx("div",{className:"swap-icon",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-trade"})})})}),w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:Bo(l||"")}),w.jsx("img",{src:i==null?void 0:i.logo_url}),w.jsx("span",{className:"symbol",children:On((i==null?void 0:i.symbol)||"")})]})]}),w.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[w.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:w.jsx(_0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&w.jsx("div",{style:{paddingBottom:"10px"},children:"Price Impact Alert. Be cautious before submitting your order."})]}),w.jsxs("div",{className:"swap-info-between",children:[w.jsx("div",{className:"left",children:"Slippage Tolerance"}),w.jsxs("div",{className:"right",children:[o,"%"]})]}),w.jsx(n8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),w.jsx(r8,{isLoading:!1,routerData:a,noTips:!0}),b&&w.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[w.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"#ff5073"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),w.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[w.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:A?"#72c1f7":"#7F98A7"},onClick:()=>{P(!0)},children:"Yes, please continue."}),w.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&&w.jsx("button",{disabled:W||N,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{N||(R(!0),t(a))},children:N?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(e8,{})}):"Confirm Swap"}),F&&w.jsxs("div",{className:"price-update",children:[w.jsxs("div",{className:"left",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{children:"Price update"})]}),w.jsx("div",{className:"right",children:w.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function rf(e){const{text:t,type:r}=e,[n,i]=te.useState(!1),{addCommonToast:s}=na(),o=a=>{n||(Qu(a),zS(t,{debug:!1,message:"message"}),s("Copied"),i(!n))};return te.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),w.jsx(w.Fragment,{children:r==="btn"?w.jsxs("div",{className:"copy-btn",onClick:o,children:[w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),w.jsx("span",{children:"Copy"})]}):w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:o,children:w.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function rK({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=fn(),{getTokenInfo:a}=Ys(),c=te.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(f=>({...f,fromToken:a(f.from_type),toToken:a(f.to_type)}))}))},[t]);return w.jsxs("div",{className:"route-dialog",children:[w.jsx(x0,{title:"Route",backClick:e}),w.jsxs("div",{className:"route-dialog-content",children:[w.jsx("div",{className:"simple-router-box",children:w.jsx(u3,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),w.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[w.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[w.jsx(Yr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",children:cn(s,n==null?void 0:n.decimals)}),w.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),w.jsx("div",{className:"route-box-h5 center",children:w.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((u,l)=>w.jsxs("div",{className:"route-item-box-h5",children:[w.jsxs("div",{className:"percent",children:[Fe(u.percentage).mul(100).toString(),"%"]}),w.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=>w.jsx("div",{className:"route-path-item",children:w.jsx(wc,{position:"bottom",content:w.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[w.jsx(iK,{poolAddress:f.pool_address}),w.jsx(c3,{token:f.fromToken}),w.jsx(c3,{token:f.toToken})]}),children:w.jsx(nK,{path:f})})},f.to_type))})]},l))})}),w.jsxs("div",{className:"center",style:{gap:"4px"},children:[w.jsx(Yr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",children:cn(o,i==null?void 0:i.decimals)}),w.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function nK({path:e}){var t,r,n;return w.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[w.jsx(Yr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),w.jsx(Yr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),w.jsxs("span",{className:"provider",children:[(n=Ix[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&w.jsxs("div",{className:"fee-tier",children:[" ",Fe(e.fee_rate).mul(100).toString(),"%"]})]})}function c3({token:e}){const{getExplorerUrl:t}=Lo();return w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[w.jsx(Yr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),w.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:On((e==null?void 0:e.symbol)||"")})]}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{onClick:Qu,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:qs(e==null?void 0:e.coin_type)}),w.jsx(rf,{text:(e==null?void 0:e.coin_type)||""})]})]})}function iK({poolAddress:e}){const{getExplorerUrl:t}=Lo();return w.jsxs(w.Fragment,{children:[e&&w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[w.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:Qu,href:t(e,"poolAddress"),target:"_blank",children:qs(e)}),w.jsx(rf,{text:e})]})]}),e&&w.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function u3({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var a,c,u;const[n,i]=te.useState(!1),{getTokenInfo:s}=Ys(),o=te.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]);return w.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[w.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?w.jsx(ra,{style:{width:"80px",height:"18px"}}):w.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[w.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}),w.jsx("div",{className:"providers",children:(u=r==null?void 0:r.providers)==null?void 0:u.map((l,f)=>w.jsx(wc,{content:w.jsx("div",{children:Ix[l].name}),position:"top",delay:300,children:w.jsx(Yr,{src:wr[l],style:{width:"16px",height:"16px"}})},l))}),e&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:w.jsx("use",{xlinkHref:"#icon-spread"})})]}),n&&e&&w.jsx(rK,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const AJ="",Ac=ji((e,t)=>({currentTypeTab:"Default",setCurrentTypeTab:r=>{e(()=>({currentTypeTab:r}))},currentPlatformTab:"All",setCurrentPlatformTab:r=>{e(()=>({currentPlatformTab:r}))},platformList:["All","Wormhole"],setPlatformList:r=>{e(()=>({platformList:r}))},isOpenImportDialog:!1,setIsOpenImportDialog:r=>{e(()=>({isOpenImportDialog:r}))},collectTokenMap:new Map,setCollectTokenMap:(r,n=!1)=>{e(()=>({collectTokenMap:r})),n||Pi.setItem(Mx,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=tx(r.coin_type);o=i.filter(c=>tx(c.coin_type)!==a)}return s(o),Pi.setItem(Tx,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}))}}));Pi.getItem(Mx).then(e=>{e!==null&&Ac.getState().setCollectTokenMap(e,!0)}),Pi.getItem(Tx).then(e=>{e&&Ac.getState().setImportTokenList(e)});function l3(){const{setCollectTokenMap:e,collectTokenMap:t}=Ac(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=te.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function sK(e){const{trustedTokenList:t}=bc(),{tokenBalanceObj:r,currentAccount:n}=kn(),{coinPriceObj:i}=WS(),{getTokenAmountValue:s}=Fl(),{fetchTokenInfo:o}=Ys(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:_,currentImportTokenData:A,searchInput:P,setSearchInput:N,importTokenIsLoading:R,showTokenListIsLoading:F,setCurrentTypeTab:L}=Ac(),[W,q]=te.useState(!1);te.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[X,ie]=te.useState(!1);te.useEffect(()=>{yx(i)||ie(!0)},[i]);const ae=te.useRef({}),[ce,V]=te.useState(!1);te.useEffect(()=>{(!yx(r)||!mp(ae.current,r))&&(ae.current=r,V(!0))},[r]);const $=(v,j)=>{const ee=j&&j.toLocaleLowerCase().trim(),se=v.map(pe=>{let Ee=0,Se=0;pe.symbol.toLowerCase()===ee||pe.name.toLowerCase()===ee||pe.coin_type.toLowerCase()===ee?(Ee=1e3,Se=2):pe.symbol.toLowerCase().indexOf(ee)>-1?(Ee=100,Se=0):pe.name.toLowerCase().indexOf(ee)>-1?(Ee=10,Se=0):pe.coin_type.toLowerCase().indexOf(ee)>-1?(Ee=1,Se=0):pe.coin_type.toLowerCase()=="0x2::sui::sui"&&(Se=1);let Je=Array.isArray(pe==null?void 0:pe.coin_priority)?Number(pe.coin_priority[0])||0:Number(pe==null?void 0:pe.coin_priority)||0;return e===pe.coin_type&&!j&&(Se=12,Ee=1e3,Je=1e4),{...pe,mark:Ee,sort:Se,coin_priority_sort:Je,rateNumber:Number((pe==null?void 0:pe.rate)||"0"),balanceNumber:Number((pe==null?void 0:pe.balance)||"0")}});return eK(se,[pe=>!j&&e===pe.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},p=(v,j=!1)=>{const ee=j?v.trim():v.toLowerCase().trim(),se=["symbol","name","coin_type"];return HH(ee.length===0?l:[...l,...f],pe=>se.some(Ee=>{const Se=pe[Ee];return typeof Se=="string"?(j?Se:Se.toLowerCase()).includes(ee):!1}))},d=v=>{v||b(void 0);const j=p(v);if((j==null?void 0:j.length)===0){m(v);return}else{const ee=$(j,v);u(ee)}},m=async v=>{var j;_(!0);try{if(bx(v)){const ee=v.trim(),se=Ir(ee).full_address,ye=await o(se);if(!ye){u([]);return}const pe=((j=r==null?void 0:r[ee])==null?void 0:j.totalBalanceFormat)||"0",Ee=Fe(pe).gt("0")?s(ee,pe):"0",Se={...ye,balance:pe,rate:Ee};u([Se]),b(Se)}else{u([]);return}}catch{b(void 0),u([]);return}finally{_(!1)}},x=v=>{if(v==="Default")O("All");else{const j=$(f,P);u(j)}},M=()=>{if(A){const v=y(A,!0),j=$(v,P);u(j),b(void 0),N("")}},E=v=>{const j=y(v,!1),ee=$(j,P);u(ee)},O=v=>{const j=v==="All"?[...l]:l.filter(se=>v=="Native"?!se.labels||se.labels.length==0||se.labels=="Native":se.labels&&se.labels.length>0&&se.labels[0].toLowerCase()==v.toLowerCase()),ee=$(j,P);u(ee)};te.useEffect(()=>{if(!W||!(t!=null&&t.length)){h([]);return}if(!(n!=null&&n.address))h(t);else if(n!=null&&n.address&&X){const v=[];for(const j of t){j!=null&&j.coin_type.includes("sui");const ee=r==null?void 0:r[j==null?void 0:j.coin_type],se=(ee==null?void 0:ee.totalBalanceFormat)||"0",ye=(ee==null?void 0:ee.displayBalance)||"0",pe=Fe(se).gt("0")?s(j==null?void 0:j.coin_type,se):"0";v.push({...j,balance:ye,rate:cn(pe,4,!0)})}h(v)}},[W,X,ce,n==null?void 0:n.address]);const C=te.useRef([]);te.useEffect(()=>{if((l==null?void 0:l.length)>0&&!XH(C.current,l)){C.current=l;const v=$(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),x("Imported")):u(v)}},[l,e]);const g=te.useMemo(()=>{if(a==="Default"){if(!F&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!R)return!0;return!1},[P,c,A,R,F]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:A,handleChangeType:x,handleImportClick:M,handleDeleteImportClick:E,isNoData:g}}function oK({tokenList:e,onHandleTokenAction:t}){return w.jsx("div",{className:"token-collect-list",children:e.map(r=>w.jsx(aK,{token:r,onHandleTokenAction:t},r.coin_type))})}function aK({token:e,onHandleTokenAction:t}){return w.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[w.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),w.jsx("span",{children:e.symbol}),w.jsx("i",{children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:w.jsx("use",{xlinkHref:"#icon-close"})})})]})}const cK=Ft("/images/img_no_data@2x.png");function uK(e){const{img:t=cK,text:r,width:n="100%",height:i="auto",padding:s="20px",subItem:o}=e;return w.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&w.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&w.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),o&&o]})}function lK({tabList:e,currentTab:t,changeTab:r}){return w.jsx("div",{className:"platform-tabs",children:e.map(n=>w.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var f3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function fK(e,t){return!!(e===t||f3(e)&&f3(t))}function dK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!fK(e[r],t[r]))return!1;return!0}function hK(e,t){t===void 0&&(t=dK);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function F0(){return F0=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},F0.apply(null,arguments)}function d3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function U0(e,t){return U0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},U0(e,t)}function pK(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,U0(e,t)}var h3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function mK(e,t){return!!(e===t||h3(e)&&h3(t))}function gK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!mK(e[r],t[r]))return!1;return!0}function z0(e,t){t===void 0&&(t=gK);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function p3(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}var vK=typeof performance=="object"&&typeof performance.now=="function",m3=vK?function(){return performance.now()}:function(){return Date.now()};function g3(e){cancelAnimationFrame(e.id)}function yK(e,t){var r=m3();function n(){m3()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var V0=-1;function v3(e){if(e===void 0&&(e=!1),V0===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),V0=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return V0}var ca=null;function y3(e){if(e===void 0&&(e=!1),ca===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?ca="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ca="negative":ca="positive-ascending"),document.body.removeChild(t),ca}return ca}hn.env.NODE_ENV;var bK=150,wK=function(t,r){return t},nf=null,sf=null;hn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(nf=new WeakSet,sf=new WeakSet);function _K(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(f){pK(h,f);function h(b){var _;return _=f.call(this,b)||this,_._instanceProps=c(_.props,d3(_)),_._outerRef=void 0,_._resetIsScrollingTimeoutId=null,_.state={instance:d3(_),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof _.props.initialScrollOffset=="number"?_.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},_._callOnItemsRendered=void 0,_._callOnItemsRendered=z0(function(A,P,N,R){return _.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:P,visibleStartIndex:N,visibleStopIndex:R})}),_._callOnScroll=void 0,_._callOnScroll=z0(function(A,P,N){return _.props.onScroll({scrollDirection:A,scrollOffset:P,scrollUpdateWasRequested:N})}),_._getItemStyle=void 0,_._getItemStyle=function(A){var P=_.props,N=P.direction,R=P.itemSize,F=P.layout,L=_._getItemStyleCache(u&&R,u&&F,u&&N),W;if(L.hasOwnProperty(A))W=L[A];else{var q=r(_.props,A,_._instanceProps),X=i(_.props,A,_._instanceProps),ie=N==="horizontal"||F==="horizontal",ae=N==="rtl",ce=ie?q:0;L[A]=W={position:"absolute",left:ae?void 0:ce,right:ae?ce:void 0,top:ie?0:q,height:ie?"100%":X,width:ie?X:"100%"}}return W},_._getItemStyleCache=void 0,_._getItemStyleCache=z0(function(A,P,N){return{}}),_._onScrollHorizontal=function(A){var P=A.currentTarget,N=P.clientWidth,R=P.scrollLeft,F=P.scrollWidth;_.setState(function(L){if(L.scrollOffset===R)return null;var W=_.props.direction,q=R;if(W==="rtl")switch(y3()){case"negative":q=-R;break;case"positive-descending":q=F-N-R;break}return q=Math.max(0,Math.min(q,F-N)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},_._resetIsScrollingDebounced)},_._onScrollVertical=function(A){var P=A.currentTarget,N=P.clientHeight,R=P.scrollHeight,F=P.scrollTop;_.setState(function(L){if(L.scrollOffset===F)return null;var W=Math.max(0,Math.min(F,R-N));return{isScrolling:!0,scrollDirection:L.scrollOffset<W?"forward":"backward",scrollOffset:W,scrollUpdateWasRequested:!1}},_._resetIsScrollingDebounced)},_._outerRefSetter=function(A){var P=_.props.outerRef;_._outerRef=A,typeof P=="function"?P(A):P!=null&&typeof P=="object"&&P.hasOwnProperty("current")&&(P.current=A)},_._resetIsScrollingDebounced=function(){_._resetIsScrollingTimeoutId!==null&&g3(_._resetIsScrollingTimeoutId),_._resetIsScrollingTimeoutId=yK(_._resetIsScrolling,bK)},_._resetIsScrolling=function(){_._resetIsScrollingTimeoutId=null,_.setState({isScrolling:!1},function(){_._getItemStyleCache(-1,null)})},_}h.getDerivedStateFromProps=function(_,A){return xK(_,A),l(_),null};var y=h.prototype;return y.scrollTo=function(_){_=Math.max(0,_),this.setState(function(A){return A.scrollOffset===_?null:{scrollDirection:A.scrollOffset<_?"forward":"backward",scrollOffset:_,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(_,A){A===void 0&&(A="auto");var P=this.props,N=P.itemCount,R=P.layout,F=this.state.scrollOffset;_=Math.max(0,Math.min(_,N-1));var L=0;if(this._outerRef){var W=this._outerRef;R==="vertical"?L=W.scrollWidth>W.clientWidth?v3():0:L=W.scrollHeight>W.clientHeight?v3():0}this.scrollTo(s(this.props,_,A,F,this._instanceProps,L))},y.componentDidMount=function(){var _=this.props,A=_.direction,P=_.initialScrollOffset,N=_.layout;if(typeof P=="number"&&this._outerRef!=null){var R=this._outerRef;A==="horizontal"||N==="horizontal"?R.scrollLeft=P:R.scrollTop=P}this._callPropsCallbacks()},y.componentDidUpdate=function(){var _=this.props,A=_.direction,P=_.layout,N=this.state,R=N.scrollOffset,F=N.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(A==="horizontal"||P==="horizontal")if(A==="rtl")switch(y3()){case"negative":L.scrollLeft=-R;break;case"positive-ascending":L.scrollLeft=R;break;default:var W=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-W-R;break}else L.scrollLeft=R;else L.scrollTop=R}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&g3(this._resetIsScrollingTimeoutId)},y.render=function(){var _=this.props,A=_.children,P=_.className,N=_.direction,R=_.height,F=_.innerRef,L=_.innerElementType,W=_.innerTagName,q=_.itemCount,X=_.itemData,ie=_.itemKey,ae=ie===void 0?wK:ie,ce=_.layout,V=_.outerElementType,$=_.outerTagName,p=_.style,d=_.useIsScrolling,m=_.width,x=this.state.isScrolling,M=N==="horizontal"||ce==="horizontal",E=M?this._onScrollHorizontal:this._onScrollVertical,O=this._getRangeToRender(),C=O[0],g=O[1],v=[];if(q>0)for(var j=C;j<=g;j++)v.push(te.createElement(A,{data:X,key:ae(j,X),index:j,isScrolling:d?x:void 0,style:this._getItemStyle(j)}));var ee=n(this.props,this._instanceProps);return te.createElement(V||$||"div",{className:P,onScroll:E,ref:this._outerRefSetter,style:F0({position:"relative",height:R,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:N},p)},te.createElement(L||W||"div",{children:v,ref:F,style:{height:M?"100%":ee,pointerEvents:x?"none":void 0,width:M?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var _=this.props.itemCount;if(_>0){var A=this._getRangeToRender(),P=A[0],N=A[1],R=A[2],F=A[3];this._callOnItemsRendered(P,N,R,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,W=L.scrollDirection,q=L.scrollOffset,X=L.scrollUpdateWasRequested;this._callOnScroll(W,q,X)}},y._getRangeToRender=function(){var _=this.props,A=_.itemCount,P=_.overscanCount,N=this.state,R=N.isScrolling,F=N.scrollDirection,L=N.scrollOffset;if(A===0)return[0,0,0,0];var W=o(this.props,L,this._instanceProps),q=a(this.props,W,L,this._instanceProps),X=!R||F==="backward"?Math.max(1,P):1,ie=!R||F==="forward"?Math.max(1,P):1;return[Math.max(0,W-X),Math.max(0,Math.min(A-1,q+ie)),W,q]},h}(te.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var xK=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(hn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&sf&&!sf.has(l)&&(sf.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":nf&&!nf.has(l)&&(nf.add(l),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},SK=_K({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,f=t.layout,h=t.width,y=a==="horizontal"||f==="horizontal",b=y?h:c,_=Math.max(0,u*l-b),A=Math.min(_,r*l),P=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=P-b&&i<=A+b?n="auto":n="center"),n){case"start":return A;case"end":return P;case"center":{var N=Math.round(P+(A-P)/2);return N<Math.ceil(b/2)?0:N>_+Math.floor(b/2)?_:N}case"auto":default:return i>=P&&i<=A?i:i<P?P:A}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",f=r*a,h=l?u:s,y=Math.ceil((h+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(hn.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 b3(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var EK=["style"],CK=["style"];function MK(e,t){var r=e.style,n=p3(e,EK),i=t.style,s=p3(t,CK);return!b3(r,i)&&!b3(n,s)}const TK=te.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return w.jsx("div",{style:r,children:w.jsx(IK,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},MK),AK=hK((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function OK({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=te.useRef(null);te.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=AK(e,t,r,n);return w.jsx("div",{className:"token-list",children:w.jsx(SK,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:TK})})}function IK({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=l3(),{getExplorerUrl:s}=Lo();return w.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[w.jsx(Yr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),w.jsxs("div",{className:"token-info",children:[w.jsx("h4",{className:"token-symbol",children:w.jsx("span",{children:On(e.symbol)})}),w.jsx("p",{className:"token-name",children:On(e==null?void 0:e.name,20)}),w.jsxs("div",{className:"copy",children:[w.jsx("a",{onClick:Qu,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:qs(e==null?void 0:e.coin_type)}),w.jsx(rf,{text:e==null?void 0:e.coin_type})]})]}),w.jsxs("div",{className:"token-balance",children:[w.jsxs("div",{className:"balance",children:[w.jsx("h4",{children:e==null?void 0:e.balance}),w.jsx("p",{children:e!=null&&e.rate?gx(e==null?void 0:e.rate,2):""})]}),r&&w.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&w.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function PK({currentType:e,changeTab:t}){const r=["Default","Imported"];return w.jsx("div",{className:"type-tabs",children:r.map(n=>w.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function jK({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=sK(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:_,isOpenImportDialog:A,setIsOpenImportDialog:P,setSearchInput:N,searchInput:R,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:W}=Ac();te.useEffect(()=>()=>{N(""),b("All"),h("Default"),W(void 0)},[]);const{handleCollectToken:q,collectTokenMap:X}=l3(),ie=m=>{h(m),a(m)},ae=m=>{b(m),o(m)},ce=()=>{c(),P(!1)},V=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();N(x),x?$(x):($(""),ie("Default"))},$=QS(m=>{bx(m)?s(gp(m,!1)):s(m)},300),p=(m,x)=>{if(x==="delete_import"){u(m);return}if(x==="collect_token"||x==="un_collect"){q(m);return}x==="select_token"&&(t(m),e())},d=te.useMemo(()=>Array.from(X.values()),[X]);return w.jsxs("div",{className:"token-select-modal",children:[w.jsx(x0,{backClick:e,title:"Select Token"}),w.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:"search-input",style:{position:"relative"},children:[w.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:R,onChange:m=>V(m.target.value),style:{paddingRight:"40px"}}),R.length>0&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{V("")},children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&w.jsx(oK,{tokenList:d,onHandleTokenAction:p}),R.length===0&&w.jsx(PK,{currentType:f,changeTab:ie}),R.length===0&&f==="Default"&&w.jsx(lK,{tabList:_,currentTab:y,changeTab:ae})]}),i&&w.jsx(kK,{searchInputLength:R.length}),F&&w.jsx(VS,{}),L&&w.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&&w.jsxs("div",{style:{position:"relative"},children:[w.jsx(OK,{showTokenList:n,showCollect:!L,showDelete:!L&&f==="Imported",onHandleTokenAction:p}),L&&w.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:w.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ce(),p(L,"select_token")},children:"Import"})})]})]})]})}function kK({searchInputLength:e}){return w.jsx("div",{style:{height:"360px"},children:w.jsx(uK,{text:e>0?"No tokens found":"No Imported Tokens",subItem:e>0?w.jsx("div",{children:w.jsx(wc,{position:"bottom",content:w.jsx("div",{children:"The unique id of coin"}),children:w.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function NK({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=te.useState(!1);return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",onClick:e}),w.jsxs("div",{className:"import-dialog",children:[w.jsxs("div",{className:"cs-dialog-header",children:[w.jsx("div",{className:"title",children:"Tips"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"import-content",children:[w.jsx("div",{className:"tip-text-box",children:w.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(s=>w.jsxs("div",{className:"import-token-info",children:[w.jsx(Yr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:s.logo_url}),w.jsxs("div",{className:"info",children:[w.jsx("div",{className:"name",children:w.jsxs("span",{children:[" ",s.symbol," "]})}),w.jsxs("div",{className:"address",children:[w.jsx("span",{children:qs(s.coin_type)}),w.jsx(rf,{text:s.coin_type})]})]})]},s.coin_type)),w.jsxs("div",{className:"risk-checkbox",children:[w.jsx(xl,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),w.jsx("span",{children:"I acknowledge the risk"})]}),w.jsxs("div",{className:"button-block",children:[w.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),w.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:r,children:"Confirm"})]})]})]})]})}const OJ="";function w3(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 Oc;(function(e){e.event="event",e.props="prop"})(Oc||(Oc={}));function ys(){}function RK(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function Ic(e){return!!(e||"").match(/\d/)}function ua(e){return e==null}function DK(e){return typeof e=="number"&&isNaN(e)}function _3(e){return ua(e)||DK(e)||typeof e=="number"&&!isFinite(e)}function x3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function $K(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function BK(e,t,r){var n=$K(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function LK(e){var t=te.useRef(e);t.current=e;var r=te.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function q0(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 FK(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 S3(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function E3(e,t){return Array(t+1).join(e)}function C3(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."+E3("0",Math.abs(o))+i:o>=a?i=i+E3("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function M3(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=q0(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(_,A,P){return _.length>P?(Number(_[0])+Number(A)).toString()+_.substring(1,_.length):A+_},l[0]));var h=S3(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function ro(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 T3=RK(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),UK=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function zK(e,t,r){return Math.min(Math.max(e,t),r)}function G0(e){return Math.max(e.selectionStart,e.selectionEnd)}function VK(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function qK(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function GK(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function WK(e,t,r,n,i,s,o){o===void 0&&(o=GK);var a=i.findIndex(function(F){return F}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,f={},h=new Array(u),y=0;y<u;y++){h[y]=-1;for(var b=0,_=l;b<_;b++){var A=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(A&&f[b]!==!0){h[y]=b,f[b]=!0;break}}}for(var P=n;P<u&&(h[P]===-1||!s(r[P]));)P++;var N=P===u||h[P]===-1?l:h[P];for(P=n-1;P>0&&h[P]===-1;)P--;var R=P===-1||h[P]===-1?0:h[P]+1;return R>N?N:n-R<N-n?R:N}function A3(e,t,r,n){var i=e.length;if(t=zK(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function HK(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Ic(e[r])||Ic(e[r-1]));return t}function O3(e,t,r,n,i,s){s===void 0&&(s=ys);var o=LK(function(b,_){var A,P;return _3(b)?(P="",A=""):typeof b=="number"||_?(P=typeof b=="number"?C3(b):b,A=n(P)):(P=i(b,void 0),A=n(P)),{formattedValue:A,numAsString:P}}),a=te.useState(function(){return o(ua(e)?t:e,r)}),c=a[0],u=a[1],l=function(b,_){b.formattedValue!==c.formattedValue&&u({formattedValue:b.formattedValue,numAsString:b.value}),s(b,_)},f=e,h=r;ua(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return te.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function KK(e){return e.replace(/[^0-9]/g,"")}function XK(e){return e}function JK(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,s=e.getInputRef,o=e.format;o===void 0&&(o=XK);var a=e.removeFormatting;a===void 0&&(a=KK);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=ys);var y=e.onKeyDown;y===void 0&&(y=ys);var b=e.onMouseUp;b===void 0&&(b=ys);var _=e.onFocus;_===void 0&&(_=ys);var A=e.onBlur;A===void 0&&(A=ys);var P=e.value,N=e.getCaretBoundary;N===void 0&&(N=HK);var R=e.isValidInputCharacter;R===void 0&&(R=Ic);var F=e.isCharacterSame,L=w3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),W=O3(P,c,!!u,o,a,l),q=W[0],X=q.formattedValue,ie=q.numAsString,ae=W[1],ce=te.useRef(),V=te.useRef({formattedValue:X,numAsString:ie}),$=function(_e,ge){V.current={formattedValue:_e.formattedValue,numAsString:_e.value},ae(_e,ge)},p=te.useState(!1),d=p[0],m=p[1],x=te.useRef(null),M=te.useRef({setCaretTimeout:null,focusTimeout:null});te.useEffect(function(){return m(!0),function(){clearTimeout(M.current.setCaretTimeout),clearTimeout(M.current.focusTimeout)}},[]);var E=o,O=function(_e,ge){var Ae=parseFloat(ge);return{formattedValue:_e,value:ge,floatValue:isNaN(Ae)?void 0:Ae}},C=function(_e,ge,Ae){_e.selectionStart===0&&_e.selectionEnd===_e.value.length||(ro(_e,ge),M.current.setCaretTimeout=setTimeout(function(){_e.value===Ae&&_e.selectionStart!==ge&&ro(_e,ge)},0))},g=function(_e,ge,Ae){return A3(_e,ge,N(_e),Ae)},v=function(_e,ge,Ae){var Ge=N(ge),De=WK(ge,X,_e,Ae,Ge,R,F);return De=A3(ge,De,Ge),De},j=function(_e){var ge=_e.formattedValue;ge===void 0&&(ge="");var Ae=_e.input,Ge=_e.source,De=_e.event,Oe=_e.numAsString,Ie;if(Ae){var Le=_e.inputValue||Ae.value,ft=G0(Ae);Ae.value=ge,Ie=v(Le,ge,ft),Ie!==void 0&&C(Ae,Ie,ge)}ge!==X&&$(O(ge,Oe),{event:De,source:Ge})};te.useEffect(function(){var _e=V.current,ge=_e.formattedValue,Ae=_e.numAsString;(X!==ge||ie!==Ae)&&$(O(X,ie),{event:void 0,source:Oc.props})},[X,ie]);var ee=x.current?G0(x.current):void 0,se=typeof window<"u"?te.useLayoutEffect:te.useEffect;se(function(){var _e=x.current;if(X!==V.current.formattedValue&&_e){var ge=v(V.current.formattedValue,X,ee);_e.value=X,C(_e,ge,X)}},[X]);var ye=function(_e,ge,Ae){var Ge=ge.target,De=ce.current?UK(ce.current,Ge.selectionEnd):T3(X,_e),Oe=Object.assign(Object.assign({},De),{lastValue:X}),Ie=a(_e,Oe),Le=E(Ie);if(Ie=a(Le,void 0),f&&!f(O(Le,Ie))){var ft=ge.target,dt=G0(ft),We=v(_e,X,dt);return ft.value=X,C(ft,We,X),!1}return j({formattedValue:Le,numAsString:Ie,inputValue:_e,event:ge,source:Ae,input:ge.target}),!0},pe=function(_e,ge){ge===void 0&&(ge=0);var Ae=_e.selectionStart,Ge=_e.selectionEnd;ce.current={selectionStart:Ae,selectionEnd:Ge+ge}},Ee=function(_e){var ge=_e.target,Ae=ge.value,Ge=ye(Ae,_e,Oc.event);Ge&&h(_e),ce.current=void 0},Se=function(_e){var ge=_e.target,Ae=_e.key,Ge=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie;Ae==="ArrowLeft"||Ae==="Backspace"?Ie=Math.max(Ge-1,0):Ae==="ArrowRight"?Ie=Math.min(Ge+1,Oe.length):Ae==="Delete"&&(Ie=Ge);var Le=0;Ae==="Delete"&&Ge===De&&(Le=1);var ft=Ae==="ArrowLeft"||Ae==="ArrowRight";if(Ie===void 0||Ge!==De&&!ft){y(_e),pe(ge,Le);return}var dt=Ie;if(ft){var We=Ae==="ArrowLeft"?"left":"right";dt=g(Oe,Ie,We),dt!==Ie&&_e.preventDefault()}else Ae==="Delete"&&!R(Oe[Ie])?dt=g(Oe,Ie,"right"):Ae==="Backspace"&&!R(Oe[Ie])&&(dt=g(Oe,Ie,"left"));dt!==Ie&&C(ge,dt,Oe),y(_e),pe(ge,Le)},Je=function(_e){var ge=_e.target,Ae=function(){var Ge=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;if(Oe===void 0&&(Oe=""),Ge===De){var Ie=g(Oe,Ge);Ie!==Ge&&C(ge,Ie,Oe)}};Ae(),requestAnimationFrame(function(){Ae()}),b(_e),pe(ge)},Ue=function(_e){_e.persist&&_e.persist();var ge=_e.target,Ae=_e.currentTarget;x.current=ge,M.current.focusTimeout=setTimeout(function(){var Ge=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie=g(Oe,Ge);Ie!==Ge&&!(Ge===0&&De===Oe.length)&&C(ge,Ie,Oe),_(Object.assign(Object.assign({},_e),{currentTarget:Ae}))},0)},lt=function(_e){x.current=null,clearTimeout(M.current.focusTimeout),clearTimeout(M.current.setCaretTimeout),A(_e)},ht=d&&VK()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:X,onChange:Ee,onKeyDown:Se,onMouseUp:Je,onFocus:Ue,onBlur:lt});if(r==="text")return i?te.createElement(te.Fragment,null,i(X,L)||null):te.createElement("span",Object.assign({},L,{ref:s}),X);if(n){var mt=n;return te.createElement(mt,Object.assign({},$e,{ref:s}))}return te.createElement("input",Object.assign({},$e,{ref:s}))}function I3(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=of(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=q0(e,o),y=h.beforeDecimal,b=h.afterDecimal,_=h.addNegation;return r!==void 0&&(b=S3(b,r,!!n)),u&&(y=BK(y,u,a)),i&&(y=i+y),s&&(b=b+s),_&&(y="-"+y),e=y+(f&&l||"")+b,e}function of(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function YK(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function ZK(e,t){return new RegExp("(^-)|[0-9]|"+x3(e),t?"g":void 0)}function QK(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function eX(e,t,r){var n;t===void 0&&(t=qK(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,f=u.end,h=of(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,_=e[f]===b;if(Ic(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var A=a===0?"":b;e=e.substring(0,l)+A+e.substring(l+1,e.length)}var P=function(x,M,E){var O=!1,C=!1;s.startsWith("-")?O=!1:x.startsWith("--")?(O=!1,C=!0):o.startsWith("-")&&x.length===o.length?O=!1:x[0]==="-"&&(O=!0);var g=O?1:0;return C&&(g=2),g&&(x=x.substring(g),M-=g,E-=g),{value:x,start:M,end:E,hasNegation:O}},N=P(e,l,f),R=N.hasNegation;n=N,e=n.value,l=n.start,f=n.end;var F=P(t.lastValue,c.start,c.end),L=F.start,W=F.end,q=F.value,X=e.substring(l,f);e.length&&q.length&&(L>q.length-o.length||W<s.length)&&!(X&&o.startsWith(X))&&(e=q);var ie=0;e.startsWith(s)?ie+=s.length:l<s.length&&(ie=l),e=e.substring(ie),f-=ie;var ae=e.length,ce=e.length-o.length;e.endsWith(o)?ae=ce:(f>ce||f>e.length-o.length)&&(ae=f),e=e.substring(0,ae),e=YK(R?"-"+e:e,i),e=(e.match(ZK(b,!0))||[]).join("");var V=e.indexOf(b);e=e.replace(new RegExp(x3(b),"g"),function(x,M){return M===V?".":""});var $=q0(e,i),p=$.beforeDecimal,d=$.afterDecimal,m=$.addNegation;return u.end-u.start<c.end-c.start&&p===""&&_&&!parseFloat(d)&&(e=m?"-":""),e}function tX(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function rX(e){var t=of(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 zH(e){e=FH(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=cs);var s=e.onBlur;s===void 0&&(s=cs);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,_=t3(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 f3(m,e)},R=function(m,x){return LH(m,x,e)},F=Yo(f)?l:f,L=h??BH(F,u,t);Yo(f)?Yo(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var H=function(m){return r3(m)?m:(typeof m=="number"&&(m=o3(m)),L&&typeof a=="number"?a3(m,a,!!c):m)},q=l3(H(f),H(l),!!L,P,R,y),X=q[0],ne=X.numAsString,ce=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&&qs(x,1),a&&c&&(E==="Backspace"&&T[C-1]===A?(qs(x,C-1),m.preventDefault()):E==="Delete"&&T[C]===A&&m.preventDefault()),I!=null&&I.includes(E)&&T[C]===A&&qs(x,C+1);var g=o===!0?",":o;E==="Backspace"&&T[C-1]===g&&qs(x,C-1),E==="Delete"&&T[C]===g&&qs(x,C+1),i(m)},$=function(m){var x=ne;if(x.match(/\d/g)||(x=""),n||(x=MH(x)),c&&a&&(x=a3(x,a,c)),x!==ne){var E=f3(x,e);oe({formattedValue:E,value:x,floatValue:parseFloat(x)},{event:m,source:mc.event})}s(m)},p=function(m){return m===A?!0:gc(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],N=c3(E,x),se=N.to,ue=function(xe){return R(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:ce,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:oe,format:P,removeFormatting:R,getCaretBoundary:function(m){return UH(m,e)},onKeyDown:V,onBlur:$})}function VH(e){var t=zH(e);return te.createElement(RH,Object.assign({},t))}function qH(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&&ze(A).gt(o)?A=o.toString():a!==void 0&&ze(A).lt(a)&&(A=a.toString()),s(String(A))}else s("")};return b.jsx(VH,{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 GH(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(Wr,{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 d3({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]=te.useState(!1),{currentAccount:y}=Sn(),_=()=>{const A=ze((n==null?void 0:n.totalBalanceFormat)||"0").div(2),I=tn(A.toString(),o==null?void 0:o.decimals,!0).toString();t&&ze(I).eq(t)||i(I)},w=()=>{const A=ze((n==null?void 0:n.totalBalanceFormat)||0),I=Tr((o==null?void 0:o.coin_type)||"").full_address===nf,P=.05;let R=A;I&&ze(A).gt(P)&&(R=R.sub(P)),!(t&&ze(R).eq(t))&&ze(R).gte(0)&&i(R.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(Fo,{style:{width:"200px",height:"28px",flex:1}})," "]}):b.jsx(qH,{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(GH,{token:o,handleTokenSelectClick:s})]}),b.jsxs("div",{className:"info-box",children:[b.jsx("div",{className:"input-rate",children:!a&&r&&+r?h2(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 HH({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Sn(),{getOwnerCoinBalances:s}=tl(),{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:R,toAmountValue:F,doSwapAction:L,reCalculateRouteData:H,refreshMarketPrice:q,scamsText:X}=_U(),{slippage:ne}=qr(),{amountLimit:ce}=Hx(ne,h),{formatSwapRouter:oe}=CB(h),[V,$]=te.useState(!1),{btnText:p,btnDisabled:d}=xU(I==null?void 0:I.totalBalanceFormat),[m,x]=te.useState(!1),[E,C]=te.useState(!1);te.useEffect(()=>{y?e>=5&&k():e>=20&&k()},[e]);const k=()=>{H(),n&&s(),q()},T=()=>({...h}),g=async()=>{a&&A(a,!0)},v=te.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(d3,{loading:!f&&l,balance:I,amountValue:R,handleTokenSelectClick:()=>{C(!0),x(!0)},onInputChange:N=>{w(N,!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(d3,{loading:f&&l,balance:P,showHalf:!1,showMax:!1,amountValue:F,handleTokenSelectClick:()=>{C(!1),x(!0)},onInputChange:N=>{w(N,!1)},inputAllowed:!1,amount:u,token:a})]}),X&&b.jsx(EU,{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(R6,{})}):p}),c&&u&&+c&&+u&&b.jsxs("div",{className:"content",children:[b.jsxs("div",{className:"price-related-info",children:[h&&b.jsx(E0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),b.jsx($6,{isLoading:l,routerData:h})]}),b.jsx(B6,{isLoading:l,amountLimit:ce}),b.jsx(q8,{hasSubMenu:!0,formatSwapRouter:oe,isLoading:l})]})]}),y&&b.jsx(UG,{data:T(),toBack:()=>_(!1),onSubmitClick:async N=>{try{await L(N,r==null?void 0:r.partner)}finally{_(!1)}}}),m&&b.jsx(yH,{currToken:E?o:a,backClick:()=>x(!1),onSelectToken:N=>{A(N,E),x(!1)}})]})}function WH({initProps:e={},customWallet:t}){hB();const{ToastContainer:r}=zo(),{fetchRouterConfig:n}=aB(),{getTokens:i}=$s(),{fetchTokenPrices:s}=rl(),{transactionData:o,setTransactionData:a}=s0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=sn(),[y,_]=te.useState(0),w=te.useRef(y);dB(e),te.useEffect(()=>{i(),s([]),n()},[]),te.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),cB({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(nB,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),b.jsx(z$,{handleRefresh:A}),b.jsx(HH,{refreshCount:y,customWallet:t,initProps:e}),o&&b.jsx(iB,{transactionData:o,onClose:()=>{a(void 0)}}),b.jsx(r,{})]})})}function X0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=tl(),n=Rr.useCurrentAccount(),{saveCurrentAccount:i}=Sn(),{mutate:s}=Rr.useConnectWallet();return te.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),te.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),b.jsx(WH,{initProps:e,customWallet:t})}function KH({initProps:e,customWallet:t}){const[r,n]=te.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(X0,{initProps:e,customWallet:t})}),b.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function XH({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=te.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:Lt("/images/img-logo@2x.png")})}),i&&b.jsx("div",{className:`widget-modal ${t} ${e}`,children:b.jsx(X0,{initProps:r,customWallet:n})})]})}function YH({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return b.jsxs(Nu,{appearance:"dark",children:[r==="Integrated"&&b.jsx(X0,{initProps:e,customWallet:t}),r==="Widget"&&b.jsx(XH,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&b.jsx(KH,{initProps:e,customWallet:t})]})}const JH=YH;zt.CetusSwap=JH,Object.defineProperty(zt,Symbol.toStringTag,{value:"Module"})});
|
|
114
|
+
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function nX(e){e=rX(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=ys);var s=e.onBlur;s===void 0&&(s=ys);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=w3(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),_=of(e),A=_.decimalSeparator,P=_.allowedDecimalSeparators,N=function(m){return I3(m,e)},R=function(m,x){return eX(m,x,e)},F=ua(f)?l:f,L=h??QK(F,u,t);ua(f)?ua(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var W=function(m){return _3(m)?m:(typeof m=="number"&&(m=C3(m)),L&&typeof a=="number"?M3(m,a,!!c):m)},q=O3(W(f),W(l),!!L,N,R,y),X=q[0],ie=X.numAsString,ae=X.formattedValue,ce=q[1],V=function(m){var x=m.target,M=m.key,E=x.selectionStart,O=x.selectionEnd,C=x.value;if(C===void 0&&(C=""),(M==="Backspace"||M==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}M==="Backspace"&&C[0]==="-"&&E===u.length+1&&r&&ro(x,1),a&&c&&(M==="Backspace"&&C[E-1]===A?(ro(x,E-1),m.preventDefault()):M==="Delete"&&C[E]===A&&m.preventDefault()),P!=null&&P.includes(M)&&C[E]===A&&ro(x,E+1);var g=o===!0?",":o;M==="Backspace"&&C[E-1]===g&&ro(x,E-1),M==="Delete"&&C[E]===g&&ro(x,E+1),i(m)},$=function(m){var x=ie;if(x.match(/\d/g)||(x=""),n||(x=FK(x)),c&&a&&(x=M3(x,a,c)),x!==ie){var M=I3(x,e);ce({formattedValue:M,value:x,floatValue:parseFloat(x)},{event:m,source:Oc.event})}s(m)},p=function(m){return m===A?!0:Ic(m)},d=function(m){var x=m.currentValue,M=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,C=m.formattedValueIndex,g=x[O],v=E[C],j=T3(M,x),ee=j.to,se=function(ye){return R(ye).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===A&&se(x)<O&&se(E)>C?!1:O>=ee.start&&O<ee.end&&P&&P.includes(g)&&v===A?!0:g===v};return Object.assign(Object.assign({},b),{value:ae,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:ce,format:N,removeFormatting:R,getCaretBoundary:function(m){return tX(m,e)},onKeyDown:V,onBlur:$})}function iX(e){var t=nX(e);return te.createElement(JK,Object.assign({},t))}function sX(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 _;const y=((_=h==null?void 0:h.target)==null?void 0:_.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 A=String(b).replace(/,/g,"");if(A.startsWith("-")){s("");return}u&&(A=A.replace(u,"")),o!==void 0&&Fe(A).gt(o)?A=o.toString():a!==void 0&&Fe(A).lt(a)&&(A=a.toString()),s(String(A))}else s("")};return w.jsx(iX,{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 oX(e){const{token:t,handleTokenSelectClick:r}=e;return w.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[w.jsx("div",{className:"token-img-box",children:w.jsx(Yr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),w.jsx("div",{className:"name",children:w.jsxs("h4",{className:"truncate-text",children:[" ",t==null?void 0:t.symbol]})}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function P3({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:s,token:o,loading:a=!1,showMax:c=!0,showHalf:u=!0,inputAllowed:l=!0,marginTop:f}){const[h,y]=te.useState(!1),{currentAccount:b}=kn(),_=()=>{const P=Fe((n==null?void 0:n.totalBalanceFormat)||"0").div(2),N=cn(P.toString(),o==null?void 0:o.decimals,!0).toString();t&&Fe(N).eq(t)||i(N)},A=()=>{const P=Fe((n==null?void 0:n.totalBalanceFormat)||0),N=Ir((o==null?void 0:o.coin_type)||"").full_address===Af,R=.05;let F=P;N&&Fe(P).gt(R)&&(F=F.sub(R)),!(t&&Fe(F).eq(t))&&Fe(F).gte(0)&&i(F.toString())};return w.jsxs("div",{className:h?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:f},children:[w.jsxs("div",{className:"title",children:[" ",e," "]}),w.jsxs("div",{className:"token-input",children:[a?w.jsxs("div",{style:{flex:1},children:[" ",w.jsx(ra,{style:{width:"200px",height:"28px",flex:1}})," "]}):w.jsx(sX,{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:()=>y(!0),onBlur:()=>y(!1)}),w.jsx(oX,{token:o,handleTokenSelectClick:s})]}),w.jsxs("div",{className:"info-box",children:[!a&&r&&Fe(r).gt(0)?w.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:gx(r,2)}):w.jsx("div",{}),b&&w.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[w.jsxs("div",{className:"token-balance",children:[w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-wallet"})}),w.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),w.jsxs("div",{className:"btn-box",children:[u&&w.jsx("button",{className:"cs-outline-btn",onClick:_,children:"HALF"}),c&&w.jsx("button",{className:"cs-outline-btn",onClick:A,children:"MAX"})]})]})]})]})}function aX({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=kn(),{getOwnerCoinBalances:s}=Ll(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:b}=fn(),{handleAmountChange:_,handleSelectToken:A,fromBalanceInfo:P,toBalanceInfo:N,fromAmountValue:R,toAmountValue:F,doSwapAction:L,reCalculateRouteData:W,refreshMarketPrice:q,scamsText:X}=Dz(),{slippage:ie}=Kr(),{isCustomMode:ae,customWarnTokenList:ce}=Sz(o,a),{amountLimit:V}=XS(ie,h),{formatSwapRouter:$}=_z(h),[p,d]=te.useState(!1),{btnText:m,btnDisabled:x}=$z(P==null?void 0:P.totalBalanceFormat),[M,E]=te.useState(!1),[O,C]=te.useState(!1),[g,v]=te.useState(!1);te.useEffect(()=>{y?e>=5&&j():e>=20&&j()},[e]);const j=()=>{W(),n&&s(),q()},ee=()=>({...h}),se=async()=>{a&&A(a,!0)},ye=te.useMemo(()=>!(M||y),[M,y]);return w.jsxs("div",{className:"swap-trade-box",children:[w.jsxs("div",{className:"trade-form",style:{flexDirection:"column",display:"flex"},children:[w.jsx(P3,{loading:!f&&l,balance:P,amountValue:R,handleTokenSelectClick:()=>{C(!0),E(!0)},onInputChange:pe=>{_(pe,!0)},amount:c,token:o}),w.jsx("div",{onClick:se,className:"swap-icon",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{cursor:"pointer"},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:p?"rotate(90deg)":"none",width:p?"16px":"14px",height:p?"16px":"14px"},children:w.jsx("use",{xlinkHref:p?"#icon-swap":"#icon-trade"})})}),w.jsx(P3,{marginTop:"-20px",loading:f&&l,balance:N,showHalf:!1,showMax:!1,amountValue:F,handleTokenSelectClick:()=>{C(!1),E(!0)},onInputChange:pe=>{_(pe,!1)},inputAllowed:!1,amount:u,token:a})]}),X&&w.jsx(Lz,{scamsText:X}),w.jsxs("div",{className:"swap-bottom-block",style:{border:x?"0px solid #2a3238":"1px solid #2a3238"},children:[w.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:x||l,onClick:()=>{n?ae&&ce.length>0?v(!0):b(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(e8,{})}):m}),c&&u&&+c&&+u&&w.jsxs("div",{className:"content",children:[w.jsxs("div",{className:"price-related-info",children:[h&&w.jsx(_0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),w.jsx(r8,{isLoading:l,routerData:h})]}),w.jsx(n8,{isLoading:l,amountLimit:V}),w.jsx(u3,{hasSubMenu:!0,formatSwapRouter:$,isLoading:l})]})]}),y&&w.jsx(tK,{data:ee(),toBack:()=>b(!1),onSubmitClick:async pe=>{try{await L(pe,r==null?void 0:r.partner)}finally{b(!1)}}}),M&&w.jsx(jK,{currToken:O?o:a,backClick:()=>E(!1),onSelectToken:pe=>{A(pe,O),E(!1)}}),g&&ce.length>0&&w.jsx(NK,{onClose:()=>{v(!1)},tokenList:ce,onSureClick:()=>{v(!1),b(!0)}})]})}function cX({initProps:e={},customWallet:t}){cz();const{ToastContainer:r}=na(),{fetchRouterConfig:n}=rz(),{getTokens:i}=Ys(),{fetchTokenPrices:s}=Fl(),{transactionData:o,setTransactionData:a}=y0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=fn(),[y,b]=te.useState(0),_=te.useRef(y);az(e),te.useEffect(()=>{i(),s([]),n()},[]),te.useEffect(()=>{_.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),nz({interval:1e3,callback:()=>{_.current=_.current+1,c?_.current>=5&&A():_.current>=20&&A()}});const A=()=>{_.current=20,b(20),setTimeout(()=>{_.current=0,b(0)},20)};return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"swap-container",id:"cs-swap-widget",children:[w.jsx(ZU,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),w.jsx($U,{handleRefresh:A}),w.jsx(aX,{refreshCount:y,customWallet:t,initProps:e}),o&&w.jsx(QU,{transactionData:o,onClose:()=>{a(void 0)}}),w.jsx(r,{})]})})}function W0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Ll(),n=$r.useCurrentAccount(),{saveCurrentAccount:i}=kn(),{mutate:s}=$r.useConnectWallet();return te.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),te.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),w.jsx(cX,{initProps:e,customWallet:t})}function uX({initProps:e,customWallet:t}){const[r,n]=te.useState(!0);return w.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&w.jsx("div",{className:"swap-modal-box",children:w.jsx(W0,{initProps:e,customWallet:t})}),w.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function lX({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=te.useState(!1),o=()=>{s(!i)};return w.jsxs("div",{className:"widget-btn-box",children:[w.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})}):w.jsx("img",{src:Ft("/images/img-logo@2x.png")})}),i&&w.jsx("div",{className:`widget-modal ${t} ${e}`,children:w.jsx(W0,{initProps:r,customWallet:n})})]})}function fX({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return w.jsxs(yl,{appearance:"dark",children:[r==="Integrated"&&w.jsx(W0,{initProps:e,customWallet:t}),r==="Widget"&&w.jsx(lX,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&w.jsx(uX,{initProps:e,customWallet:t})]})}const dX=fX;Vt.CetusSwap=dX,Object.defineProperty(Vt,Symbol.toStringTag,{value:"Module"})});
|