@cetusprotocol/terminal 0.0.0-experimental-1737427725035
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/README.md +39 -0
- package/dist/App.d.ts +2 -0
- package/dist/Com.d.ts +4 -0
- package/dist/_redirects +2 -0
- package/dist/cetus-swap.cjs.js +114 -0
- package/dist/cetus-swap.cjs.js.gz +0 -0
- package/dist/cetus-swap.es.js +36047 -0
- package/dist/cetus-swap.es.js.gz +0 -0
- package/dist/cetus-swap.umd.js +114 -0
- package/dist/cetus-swap.umd.js.gz +0 -0
- package/dist/components/common/BackButton.d.ts +3 -0
- package/dist/components/common/Button.d.ts +8 -0
- package/dist/components/common/CopyButton.d.ts +4 -0
- package/dist/components/common/HaveBackHeader.d.ts +4 -0
- package/dist/components/common/HighlightText.d.ts +10 -0
- package/dist/components/common/Loading.d.ts +2 -0
- package/dist/components/common/MevButton.d.ts +1 -0
- package/dist/components/common/NumericFormatInput.d.ts +15 -0
- package/dist/components/common/RefreshButton.d.ts +3 -0
- package/dist/components/common/SettingsButton.d.ts +5 -0
- package/dist/components/common/SlippageButton.d.ts +4 -0
- package/dist/components/common/Spinner.d.ts +8 -0
- package/dist/components/common/SpinnerWithGap.d.ts +7 -0
- package/dist/components/common/Toast.d.ts +7 -0
- package/dist/components/common/TokenImage.d.ts +7 -0
- package/dist/components/common/Tooltip.d.ts +9 -0
- package/dist/components/common/TooltipV2.d.ts +9 -0
- package/dist/components/common/TsStatusDialog.d.ts +7 -0
- package/dist/components/common/wallet/AccountSwitch.d.ts +3 -0
- package/dist/components/common/wallet/ConnectButton.d.ts +1 -0
- package/dist/components/common/wallet/TriggerButton.d.ts +4 -0
- package/dist/components/demo/CodeBlocks.d.ts +1 -0
- package/dist/components/demo/DemoFooter.d.ts +1 -0
- package/dist/components/demo/DisplayModeBlock.d.ts +1 -0
- package/dist/components/demo/DisplayModeTab.d.ts +6 -0
- package/dist/components/demo/NavMenu.d.ts +1 -0
- package/dist/components/demo/SetingMenu.d.ts +1 -0
- package/dist/components/demo/SimulateDappWallet.d.ts +1 -0
- package/dist/components/demo/SwapPanel.d.ts +1 -0
- package/dist/components/demo/TerminalModalButton.d.ts +5 -0
- package/dist/components/demo/WidgetBlock.d.ts +7 -0
- package/dist/components/demo/WidgetBtn.d.ts +7 -0
- package/dist/components/demo/index.d.ts +1 -0
- package/dist/components/export/ExportModal.d.ts +4 -0
- package/dist/components/export/ExportWidgetBtn.d.ts +7 -0
- package/dist/components/swap/CurrentPriceBlock.d.ts +10 -0
- package/dist/components/swap/PriceImpact.d.ts +8 -0
- package/dist/components/swap/ReceivedBlock.d.ts +8 -0
- package/dist/components/swap/RouteDialog.d.ts +11 -0
- package/dist/components/swap/ScamsAlert.d.ts +5 -0
- package/dist/components/swap/SecondaryDialog.d.ts +8 -0
- package/dist/components/swap/SimpleRouter.d.ts +8 -0
- package/dist/components/swap/SwapHeader.d.ts +5 -0
- package/dist/components/swap/SwapTrade.d.ts +7 -0
- package/dist/components/swap/SwapWidget.d.ts +4 -0
- package/dist/components/swap/TestToast.d.ts +1 -0
- package/dist/components/swap/TokenSelect.d.ts +7 -0
- package/dist/components/swap/TokenSelectModal/CollectTokenBlock.d.ts +6 -0
- package/dist/components/swap/TokenSelectModal/NoData.d.ts +11 -0
- package/dist/components/swap/TokenSelectModal/PlatformTabs.d.ts +5 -0
- package/dist/components/swap/TokenSelectModal/PopularTokens.d.ts +1 -0
- package/dist/components/swap/TokenSelectModal/TokenList.d.ts +13 -0
- package/dist/components/swap/TokenSelectModal/TypeTabs.d.ts +4 -0
- package/dist/components/swap/TokenSelectModal/WarnTokenDialog.d.ts +6 -0
- package/dist/components/swap/TokenSelectModal/index.d.ts +6 -0
- package/dist/components/swap/TradeInput.d.ts +17 -0
- package/dist/components/swap/WidgetHeader.d.ts +4 -0
- package/dist/config/explorer.d.ts +2 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/config/provider.d.ts +36 -0
- package/dist/config/rpc.d.ts +2 -0
- package/dist/config/token.d.ts +3 -0
- package/dist/data/pools.json +40563 -0
- package/dist/data/pools.json.gz +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/hooks/common/useExplorer.d.ts +4 -0
- package/dist/hooks/common/useFetch.d.ts +3 -0
- package/dist/hooks/common/useFindBestRouting.d.ts +11 -0
- package/dist/hooks/common/useGetPoolListByCoinType.d.ts +3 -0
- package/dist/hooks/common/useGetRouterConfig.d.ts +3 -0
- package/dist/hooks/common/useInterval.d.ts +9 -0
- package/dist/hooks/common/useSigner.d.ts +8 -0
- package/dist/hooks/common/useSyncedRef.d.ts +1 -0
- package/dist/hooks/common/useTransaction.d.ts +5 -0
- package/dist/hooks/common/useWindowWidth.d.ts +4 -0
- package/dist/hooks/demo/useDisplayMode.d.ts +15 -0
- package/dist/hooks/demo/useRpcConfiguration.d.ts +10 -0
- package/dist/hooks/demo/useSeting.d.ts +0 -0
- package/dist/hooks/swap/usePriceImpact.d.ts +13 -0
- package/dist/hooks/swap/useSwap.d.ts +13 -0
- package/dist/hooks/swap/useSwapButtonStatus.d.ts +4 -0
- package/dist/hooks/swap/useSwapHelper.d.ts +49 -0
- package/dist/hooks/useDebounce.d.ts +4 -0
- package/dist/hooks/useGetPoolList.d.ts +22 -0
- package/dist/hooks/useGetTokenBalance.d.ts +5 -0
- package/dist/hooks/useInitWidget.d.ts +3 -0
- package/dist/hooks/useSuiClient.d.ts +1 -0
- package/dist/hooks/useToast.d.ts +7 -0
- package/dist/hooks/useTokenCollect.d.ts +6 -0
- package/dist/hooks/useTokenPrice.d.ts +6 -0
- package/dist/hooks/useTokenSelect.d.ts +11 -0
- package/dist/hooks/useTokens.d.ts +8 -0
- package/dist/images/aggregator-source/aftermath.png +0 -0
- package/dist/images/aggregator-source/bluefin.png +0 -0
- package/dist/images/aggregator-source/bluemove.png +0 -0
- package/dist/images/aggregator-source/cetus.png +0 -0
- package/dist/images/aggregator-source/deepbook.png +0 -0
- package/dist/images/aggregator-source/flowx.png +0 -0
- package/dist/images/aggregator-source/haedal.png +0 -0
- package/dist/images/aggregator-source/kriya.png +0 -0
- package/dist/images/aggregator-source/scallop.png +0 -0
- package/dist/images/aggregator-source/suilend.png +0 -0
- package/dist/images/aggregator-source/turbos.png +0 -0
- package/dist/images/aggregator-source/volo.png +0 -0
- package/dist/images/birdeye-logo.png +0 -0
- package/dist/images/ghost_loading.png +0 -0
- package/dist/images/icon_mev@2x.png +0 -0
- package/dist/images/img-logo@2x.png +0 -0
- package/dist/images/img_no_data@2x.png +0 -0
- package/dist/images/logo@2x.png +0 -0
- package/dist/images/logo_CoinGecko@2x.png +0 -0
- package/dist/images/logo_pyth.png +0 -0
- package/dist/images/logo_suiscan@2x.png +0 -0
- package/dist/images/logo_suivision@2x.png +0 -0
- package/dist/images/placeholder-token@2x.png +0 -0
- package/dist/images/primary_loading.png +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/main.d.ts +0 -0
- package/dist/stores/account.d.ts +16 -0
- package/dist/stores/client.d.ts +10 -0
- package/dist/stores/common.d.ts +8 -0
- package/dist/stores/demo.d.ts +27 -0
- package/dist/stores/global.d.ts +52 -0
- package/dist/stores/price.d.ts +8 -0
- package/dist/stores/swap.d.ts +26 -0
- package/dist/stores/token.d.ts +13 -0
- package/dist/stores/tokenSelect.d.ts +30 -0
- package/dist/stores/transaction.d.ts +7 -0
- package/dist/style.css +1 -0
- package/dist/style.css.gz +0 -0
- package/dist/types/common.d.ts +91 -0
- package/dist/types/config.d.ts +13 -0
- package/dist/types/demo.d.ts +5 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/sui.d.ts +33 -0
- package/dist/utils/common.d.ts +13 -0
- package/dist/utils/contract.d.ts +10 -0
- package/dist/utils/decimal.d.ts +2 -0
- package/dist/utils/error.d.ts +9 -0
- package/dist/utils/fetch.d.ts +8 -0
- package/dist/utils/formatter.d.ts +12 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/localforage-key.d.ts +4 -0
- package/dist/utils/localforage-service.d.ts +6 -0
- package/dist/utils/number.d.ts +20 -0
- package/dist/vite-env.d.ts +1 -0
- package/dist/widget.d.ts +0 -0
- package/package.json +72 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";var mS=Object.defineProperty;var gS=(e,t,r)=>t in e?mS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var vt=(e,t,r)=>(gS(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("react"),tl=require("react-dom"),Vr=require("@mysten/dapp-kit");function Uv(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 P=Uv(se),zv=Uv(tl);function vS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vv={exports:{}},sr=Vv.exports={},Vn,qn;function pd(){throw new Error("setTimeout has not been defined")}function md(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Vn=setTimeout:Vn=pd}catch{Vn=pd}try{typeof clearTimeout=="function"?qn=clearTimeout:qn=md}catch{qn=md}})();function qv(e){if(Vn===setTimeout)return setTimeout(e,0);if((Vn===pd||!Vn)&&setTimeout)return Vn=setTimeout,setTimeout(e,0);try{return Vn(e,0)}catch{try{return Vn.call(null,e,0)}catch{return Vn.call(this,e,0)}}}function yS(e){if(qn===clearTimeout)return clearTimeout(e);if((qn===md||!qn)&&clearTimeout)return qn=clearTimeout,clearTimeout(e);try{return qn(e)}catch{try{return qn.call(null,e)}catch{return qn.call(this,e)}}}var _i=[],xo=!1,Rs,Hc=-1;function bS(){!xo||!Rs||(xo=!1,Rs.length?_i=Rs.concat(_i):Hc=-1,_i.length&&Hv())}function Hv(){if(!xo){var e=qv(bS);xo=!0;for(var t=_i.length;t;){for(Rs=_i,_i=[];++Hc<t;)Rs&&Rs[Hc].run();Hc=-1,t=_i.length}Rs=null,xo=!1,yS(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];_i.push(new Wv(e,t)),_i.length===1&&!xo&&qv(Hv)};function Wv(e,t){this.fun=e,this.array=t}Wv.prototype.run=function(){this.fun.apply(null,this.array)};sr.title="browser";sr.browser=!0;sr.env={};sr.argv=[];sr.version="";sr.versions={};function Pi(){}sr.on=Pi;sr.addListener=Pi;sr.once=Pi;sr.off=Pi;sr.removeListener=Pi;sr.removeAllListeners=Pi;sr.emit=Pi;sr.prependListener=Pi;sr.prependOnceListener=Pi;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 wS=Vv.exports;const Cn=vS(wS);var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Gv(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 gd={exports:{}},ca={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var W0;function _S(){if(W0)return ca;W0=1;var e=se,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 ca.Fragment=r,ca.jsx=o,ca.jsxs=o,ca}var ua={},G0;function xS(){return G0||(G0=1,Cn.env.NODE_ENV!=="production"&&function(){var e=se,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),b=Symbol.iterator,w="@@iterator";function T(V){if(V===null||typeof V!="object")return null;var ae=b&&V[b]||V[w];return typeof ae=="function"?ae:null}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(V){{for(var ae=arguments.length,he=new Array(ae>1?ae-1:0),ke=1;ke<ae;ke++)he[ke-1]=arguments[ke];N("error",V,he)}}function N(V,ae,he){{var ke=I.ReactDebugCurrentFrame,Ge=ke.getStackAddendum();Ge!==""&&(ae+="%s",he=he.concat([Ge]));var je=he.map(function(Ue){return String(Ue)});je.unshift("Warning: "+ae),Function.prototype.apply.call(console[V],console,je)}}var U=!1,L=!1,W=!1,q=!1,X=!1,re;re=Symbol.for("react.module.reference");function oe(V){return!!(typeof V=="string"||typeof V=="function"||V===n||V===s||X||V===i||V===u||V===l||q||V===y||U||L||W||typeof V=="object"&&V!==null&&(V.$$typeof===h||V.$$typeof===f||V.$$typeof===o||V.$$typeof===a||V.$$typeof===c||V.$$typeof===re||V.getModuleId!==void 0))}function H(V,ae,he){var ke=V.displayName;if(ke)return ke;var Ge=ae.displayName||ae.name||"";return Ge!==""?he+"("+Ge+")":he}function F(V){return V.displayName||"Context"}function D(V){if(V==null)return null;if(typeof V.tag=="number"&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof V=="function")return V.displayName||V.name||null;if(typeof V=="string")return V;switch(V){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 V=="object")switch(V.$$typeof){case a:var ae=V;return F(ae)+".Consumer";case o:var he=V;return F(he._context)+".Provider";case c:return H(V,V.render,"ForwardRef");case f:var ke=V.displayName||null;return ke!==null?ke:D(V.type)||"Memo";case h:{var Ge=V,je=Ge._payload,Ue=Ge._init;try{return D(Ue(je))}catch{return null}}}return null}var p=Object.assign,d=0,m,x,A,E,O,C,g;function v(){}v.__reactDisabledLog=!0;function j(){{if(d===0){m=console.log,x=console.info,A=console.warn,E=console.error,O=console.group,C=console.groupCollapsed,g=console.groupEnd;var V={configurable:!0,enumerable:!0,value:v,writable:!0};Object.defineProperties(console,{info:V,log:V,warn:V,error:V,group:V,groupCollapsed:V,groupEnd:V})}d++}}function ee(){{if(d--,d===0){var V={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:p({},V,{value:m}),info:p({},V,{value:x}),warn:p({},V,{value:A}),error:p({},V,{value:E}),group:p({},V,{value:O}),groupCollapsed:p({},V,{value:C}),groupEnd:p({},V,{value:g})})}d<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=I.ReactCurrentDispatcher,fe;function ve(V,ae,he){{if(fe===void 0)try{throw Error()}catch(Ge){var ke=Ge.stack.trim().match(/\n( *(at )?)/);fe=ke&&ke[1]||""}return`
|
|
10
|
+
`+fe+V}}var Se=!1,xe;{var He=typeof WeakMap=="function"?WeakMap:Map;xe=new He}function Fe(V,ae){if(!V||Se)return"";{var he=xe.get(V);if(he!==void 0)return he}var ke;Se=!0;var Ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var je;je=ie.current,ie.current=null,j();try{if(ae){var Ue=function(){throw Error()};if(Object.defineProperty(Ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ue,[])}catch(Kt){ke=Kt}Reflect.construct(V,[],Ue)}else{try{Ue.call()}catch(Kt){ke=Kt}V.call(Ue.prototype)}}else{try{throw Error()}catch(Kt){ke=Kt}V()}}catch(Kt){if(Kt&&ke&&typeof Kt.stack=="string"){for(var ot=Kt.stack.split(`
|
|
11
|
+
`),Gt=ke.stack.split(`
|
|
12
|
+
`),Rt=ot.length-1,Dt=Gt.length-1;Rt>=1&&Dt>=0&&ot[Rt]!==Gt[Dt];)Dt--;for(;Rt>=1&&Dt>=0;Rt--,Dt--)if(ot[Rt]!==Gt[Dt]){if(Rt!==1||Dt!==1)do if(Rt--,Dt--,Dt<0||ot[Rt]!==Gt[Dt]){var Qt=`
|
|
13
|
+
`+ot[Rt].replace(" at new "," at ");return V.displayName&&Qt.includes("<anonymous>")&&(Qt=Qt.replace("<anonymous>",V.displayName)),typeof V=="function"&&xe.set(V,Qt),Qt}while(Rt>=1&&Dt>=0);break}}}finally{Se=!1,ie.current=je,ee(),Error.prepareStackTrace=Ge}var yr=V?V.displayName||V.name:"",nr=yr?ve(yr):"";return typeof V=="function"&&xe.set(V,nr),nr}function dt(V,ae,he){return Fe(V,!1)}function ht(V){var ae=V.prototype;return!!(ae&&ae.isReactComponent)}function De(V,ae,he){if(V==null)return"";if(typeof V=="function")return Fe(V,ht(V));if(typeof V=="string")return ve(V);switch(V){case u:return ve("Suspense");case l:return ve("SuspenseList")}if(typeof V=="object")switch(V.$$typeof){case c:return dt(V.render);case f:return De(V.type,ae,he);case h:{var ke=V,Ge=ke._payload,je=ke._init;try{return De(je(Ge),ae,he)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,_e={},me=I.ReactDebugCurrentFrame;function Me(V){if(V){var ae=V._owner,he=De(V.type,V._source,ae?ae.type:null);me.setExtraStackFrame(he)}else me.setExtraStackFrame(null)}function Ve(V,ae,he,ke,Ge){{var je=Function.call.bind(mt);for(var Ue in V)if(je(V,Ue)){var ot=void 0;try{if(typeof V[Ue]!="function"){var Gt=Error((ke||"React class")+": "+he+" type `"+Ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof V[Ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Gt.name="Invariant Violation",Gt}ot=V[Ue](ae,Ue,ke,he,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Rt){ot=Rt}ot&&!(ot instanceof Error)&&(Me(Ge),k("%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,Ue,typeof ot),Me(null)),ot instanceof Error&&!(ot.message in _e)&&(_e[ot.message]=!0,Me(Ge),k("Failed %s type: %s",he,ot.message),Me(null))}}}var Ne=Array.isArray;function Te(V){return Ne(V)}function Oe(V){{var ae=typeof Symbol=="function"&&Symbol.toStringTag,he=ae&&V[Symbol.toStringTag]||V.constructor.name||"Object";return he}}function Le(V){try{return ut(V),!1}catch{return!0}}function ut(V){return""+V}function lt(V){if(Le(V))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Oe(V)),ut(V)}var We=I.ReactCurrentOwner,kt={key:!0,ref:!0,__self:!0,__source:!0},St,Ye,Mt;Mt={};function Nt(V){if(mt.call(V,"ref")){var ae=Object.getOwnPropertyDescriptor(V,"ref").get;if(ae&&ae.isReactWarning)return!1}return V.ref!==void 0}function rt(V){if(mt.call(V,"key")){var ae=Object.getOwnPropertyDescriptor(V,"key").get;if(ae&&ae.isReactWarning)return!1}return V.key!==void 0}function Et(V,ae){if(typeof V.ref=="string"&&We.current&&ae&&We.current.stateNode!==ae){var he=D(We.current.type);Mt[he]||(k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(We.current.type),V.ref),Mt[he]=!0)}}function Tt(V,ae){{var he=function(){St||(St=!0,k("%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)",ae))};he.isReactWarning=!0,Object.defineProperty(V,"key",{get:he,configurable:!0})}}function it(V,ae){{var he=function(){Ye||(Ye=!0,k("%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)",ae))};he.isReactWarning=!0,Object.defineProperty(V,"ref",{get:he,configurable:!0})}}var jt=function(V,ae,he,ke,Ge,je,Ue){var ot={$$typeof:t,type:V,key:ae,ref:he,props:Ue,_owner:je};return ot._store={},Object.defineProperty(ot._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ot,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.defineProperty(ot,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ge}),Object.freeze&&(Object.freeze(ot.props),Object.freeze(ot)),ot};function It(V,ae,he,ke,Ge){{var je,Ue={},ot=null,Gt=null;he!==void 0&&(lt(he),ot=""+he),rt(ae)&&(lt(ae.key),ot=""+ae.key),Nt(ae)&&(Gt=ae.ref,Et(ae,Ge));for(je in ae)mt.call(ae,je)&&!kt.hasOwnProperty(je)&&(Ue[je]=ae[je]);if(V&&V.defaultProps){var Rt=V.defaultProps;for(je in Rt)Ue[je]===void 0&&(Ue[je]=Rt[je])}if(ot||Gt){var Dt=typeof V=="function"?V.displayName||V.name||"Unknown":V;ot&&Tt(Ue,Dt),Gt&&it(Ue,Dt)}return jt(V,ot,Gt,Ge,ke,We.current,Ue)}}var nt=I.ReactCurrentOwner,bt=I.ReactDebugCurrentFrame;function Ct(V){if(V){var ae=V._owner,he=De(V.type,V._source,ae?ae.type:null);bt.setExtraStackFrame(he)}else bt.setExtraStackFrame(null)}var Je;Je=!1;function gt(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function Pt(){{if(nt.current){var V=D(nt.current.type);if(V)return`
|
|
14
|
+
|
|
15
|
+
Check the render method of \``+V+"`."}return""}}function st(V){{if(V!==void 0){var ae=V.fileName.replace(/^.*[\\\/]/,""),he=V.lineNumber;return`
|
|
16
|
+
|
|
17
|
+
Check your code at `+ae+":"+he+"."}return""}}var wt={};function Ut(V){{var ae=Pt();if(!ae){var he=typeof V=="string"?V:V.displayName||V.name;he&&(ae=`
|
|
18
|
+
|
|
19
|
+
Check the top-level render call using <`+he+">.")}return ae}}function R(V,ae){{if(!V._store||V._store.validated||V.key!=null)return;V._store.validated=!0;var he=Ut(ae);if(wt[he])return;wt[he]=!0;var ke="";V&&V._owner&&V._owner!==nt.current&&(ke=" It was passed a child from "+D(V._owner.type)+"."),Ct(V),k('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),Ct(null)}}function S(V,ae){{if(typeof V!="object")return;if(Te(V))for(var he=0;he<V.length;he++){var ke=V[he];gt(ke)&&R(ke,ae)}else if(gt(V))V._store&&(V._store.validated=!0);else if(V){var Ge=T(V);if(typeof Ge=="function"&&Ge!==V.entries)for(var je=Ge.call(V),Ue;!(Ue=je.next()).done;)gt(Ue.value)&&R(Ue.value,ae)}}}function M(V){{var ae=V.type;if(ae==null||typeof ae=="string")return;var he;if(typeof ae=="function")he=ae.propTypes;else if(typeof ae=="object"&&(ae.$$typeof===c||ae.$$typeof===f))he=ae.propTypes;else return;if(he){var ke=D(ae);Ve(he,V.props,"prop",ke,V)}else if(ae.PropTypes!==void 0&&!Je){Je=!0;var Ge=D(ae);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ge||"Unknown")}typeof ae.getDefaultProps=="function"&&!ae.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function B(V){{for(var ae=Object.keys(V.props),he=0;he<ae.length;he++){var ke=ae[he];if(ke!=="children"&&ke!=="key"){Ct(V),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),Ct(null);break}}V.ref!==null&&(Ct(V),k("Invalid attribute `ref` supplied to `React.Fragment`."),Ct(null))}}var K={};function Z(V,ae,he,ke,Ge,je){{var Ue=oe(V);if(!Ue){var ot="";(V===void 0||typeof V=="object"&&V!==null&&Object.keys(V).length===0)&&(ot+=" 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 Gt=st(Ge);Gt?ot+=Gt:ot+=Pt();var Rt;V===null?Rt="null":Te(V)?Rt="array":V!==void 0&&V.$$typeof===t?(Rt="<"+(D(V.type)||"Unknown")+" />",ot=" Did you accidentally export a JSX literal instead of a component?"):Rt=typeof V,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Rt,ot)}var Dt=It(V,ae,he,Ge,je);if(Dt==null)return Dt;if(Ue){var Qt=ae.children;if(Qt!==void 0)if(ke)if(Te(Qt)){for(var yr=0;yr<Qt.length;yr++)S(Qt[yr],V);Object.freeze&&Object.freeze(Qt)}else k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else S(Qt,V)}if(mt.call(ae,"key")){var nr=D(V),Kt=Object.keys(ae).filter(function(Fr){return Fr!=="key"}),gr=Kt.length>0?"{key: someKey, "+Kt.join(": ..., ")+": ...}":"{key: someKey}";if(!K[nr+gr]){var hn=Kt.length>0?"{"+Kt.join(": ..., ")+": ...}":"{}";k(`A props object containing a "key" prop is being spread into JSX:
|
|
20
|
+
let props = %s;
|
|
21
|
+
<%s {...props} />
|
|
22
|
+
React keys must be passed directly to JSX without using spread:
|
|
23
|
+
let props = %s;
|
|
24
|
+
<%s key={someKey} {...props} />`,gr,nr,hn,nr),K[nr+gr]=!0}}return V===n?B(Dt):M(Dt),Dt}}function te(V,ae,he){return Z(V,ae,he,!0)}function $e(V,ae,he){return Z(V,ae,he,!1)}var et=$e,Re=te;ua.Fragment=n,ua.jsx=et,ua.jsxs=Re}()),ua}Cn.env.NODE_ENV==="production"?gd.exports=_S():gd.exports=xS();var _=gd.exports;window._iconfont_svg_string_4776227='<svg><symbol id="icon-link2" viewBox="0 0 1024 1024"><path d="M642.7648 217.6a166.5024 166.5024 0 0 1 166.5024 166.5024v256.256a166.5024 166.5024 0 0 1-166.5024 166.5024H386.5088a92.16 92.16 0 0 1-64.9728-157.5936L506.88 465.2032H429.2096a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h170.8544l1.4336 0.0512c0.8704 0 1.6896 0.1024 2.56 0.1536l-3.9936-0.2048a38.656 38.656 0 0 1 27.2384 11.3664l1.792 1.9456 1.536 1.8944-3.328-3.84a38.6048 38.6048 0 0 1 11.1616 27.0336v170.8544a38.4 38.4 0 0 1-76.8 0l-0.0512-78.592-185.9584 184.6784a15.36 15.36 0 0 0 7.3216 25.9072l3.584 0.4096h256.2048c49.5616 0 89.7024-40.1408 89.7024-89.7024V384.1024c0-49.5104-40.1408-89.7024-89.7024-89.7024H386.5088c-49.5616 0-89.7024 40.192-89.7024 89.7024V563.2a38.4 38.4 0 0 1-76.8 0V384.1024A166.5024 166.5024 0 0 1 386.5088 217.6h256.256z" ></path></symbol><symbol id="icon-more" viewBox="0 0 1024 1024"><path d="M499.2 217.6m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 524.8m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 832m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path></symbol><symbol id="icon-docs" viewBox="0 0 1024 1024"><path d="M665.6 41.728c65.9456 0 121.2928 45.312 136.6016 106.496 5.0688-2.6624 10.8544-4.096 16.9984-4.096a140.8 140.8 0 0 1 140.8 140.8v563.2a140.8 140.8 0 0 1-140.8 140.8H358.4a140.8512 140.8512 0 0 1-135.4752-102.4H204.8a140.8 140.8 0 0 1-140.8-140.8v-563.2A140.8 140.8 0 0 1 204.8 41.728h460.8z m140.8 177.0496v526.9504a140.8 140.8 0 0 1-140.8 140.8l-358.4 0.1024c11.7248 15.5136 30.3104 25.4976 51.2 25.4976h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64a38.3488 38.3488 0 0 1-12.8-2.1504zM665.6 118.528H204.8c-35.328 0-64 28.672-64 64v563.2c0 35.328 28.672 64 64 64h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64z m-153.6 281.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h256z m102.4-153.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h358.4z" ></path></symbol><symbol id="icon-link1" viewBox="0 0 1024 1024"><path d="M719.872 268.8l3.738 0.205 0.768 0.051-4.506-0.256a38.502 38.502 0 0 1 28.416 12.544l0.973 1.126a38.554 38.554 0 0 1 1.74 2.253l-2.713-3.379a38.605 38.605 0 0 1 9.984 25.549V563.2a38.4 38.4 0 1 1-76.8 0V394.086L281.856 758.221a38.4 38.4 0 0 1-51.712-56.832L620.646 345.6H463.872a38.4 38.4 0 0 1-38.042-33.178l-0.358-5.222a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-icon-kfckfc" viewBox="0 0 1024 1024"><path d="M53.504 102.912c-0.41 0.563 30.208 42.086 67.84 92.006L299.008 430.9 408.32 576l-7.014 7.885c-3.943 4.352-84.327 90.521-178.432 191.488C128.717 876.595 51.354 960 51.2 960.87c-0.358 0.922 16.077 1.69 39.731 1.536l40.243-0.204 13.21-14.49A217385.626 217385.626 0 0 0 440.32 629.914l4.71-5.479 37.837 50.33L610.048 843.93l89.6 118.63H836.71c114.023 0 136.858-0.358 136.141-2.458-0.563-1.484-35.328-48.025-77.312-103.782-41.984-55.603-90.01-119.398-106.65-141.568-16.793-22.17-66.15-88.064-110.028-146.074-43.879-58.163-79.821-106.598-79.821-107.366 0-1.331 231.782-251.187 310.58-334.746l22.527-23.808h-41.42l-41.217 0.154-48.179 51.814a48197.632 48197.632 0 0 1-144.23 154.88l-95.847 102.912L445.03 258.202 328.55 103.68l-137.062-0.922c-75.418-0.563-137.626-0.41-137.984 0.154z m324.762 166.4c44.8 59.7 113.97 151.5 153.65 204.288 39.732 52.531 127.796 169.677 195.892 259.994 68.045 90.47 124.365 165.376 125.286 166.707 1.178 1.69-12.288 2.253-61.235 2.253h-62.566L605.286 737.69c-286.208-379.802-430.592-571.7-432.332-574.516-1.127-1.69 11.724-2.252 61.081-2.252h62.567l81.664 108.39z" ></path></symbol><symbol id="icon-icon_telegram" viewBox="0 0 1024 1024"><path d="M824.87808 503.6032c55.8592 0 100.096 12.544 133.4272 37.5296 34.2016 26.7264 55.9104 66.7136 64.2048 120.9344h-94.208c-5.8368-27.4944-17.5104-47.5136-34.2016-60.8768-17.5104-13.312-40.8576-19.968-69.2224-19.968-35.0208 0-62.5664 12.4928-82.5856 39.168-19.968 25.856-30.0032 62.5152-30.0032 109.2608 0 47.5136 9.216 85.0432 29.184 111.7184 18.3296 25.856 45.8752 39.2192 82.5856 39.2192 63.3856 0 98.4064-31.6928 105.8816-94.208H1024.19968c-9.984 58.368-32.512 101.7344-66.7136 130.048-33.3824 27.5456-78.3872 41.728-134.2976 41.728-66.7136 0-118.4256-21.7088-155.136-65.024-35.84-41.728-53.3504-95.9488-53.3504-162.6624 0-65.024 17.5104-118.4256 52.5312-159.2832 37.5296-45.056 90.112-67.584 157.6448-67.584z m75.7248-333.6704l-53.76 245.4528a353.792 353.792 0 0 0-12.6464-0.256c-164.096 0-316.3648 113.7664-357.0176 266.752L381.63968 771.9424c-11.6224 10.9056-20.7872 20.1216-41.5744 20.1216l14.1824-205.2608 385.1776-336.7424c16.896-14.5408-3.6352-21.6576-26.112-8.3968L237.76768 532.2752 32.35328 470.1696c-44.288-13.1584-44.544-42.7008 10.0352-64l800.3072-298.9568c36.5568-15.9744 71.8336 8.5504 57.856 62.72z" ></path></symbol><symbol id="icon-icon_medium" viewBox="0 0 1024 1024"><path d="M576.819712 497.6128c-0.7168 169.6768-139.5712 294.7584-293.376 292.3008C127.795712 787.4048-0.357888 656.1792 0.000512 495.2064 0.358912 334.9504 130.611712 204.032 288.819712 204.8c159.9488 0.768 288.2048 131.1744 288 292.8128m27.904-1.536c0.9216-72.9088 12.3904-143.3088 50.1248-207.0528 7.168-12.1856 15.872-23.8592 25.6512-33.9968 44.4928-46.08 99.4816-44.0832 141.312 4.5056 28.8768 33.5872 45.8752 73.216 56.064 115.8656 24.576 102.5536 21.2992 203.5712-19.968 301.6704-11.9808 28.416-28.5184 54.2208-52.9408 73.728-36.2496 29.1328-76.8 29.3888-112.5376-0.3072-39.2704-32.6656-59.4944-77.5168-70.7584-125.696-9.8304-41.984-14.2848-85.248-21.0944-128l4.1472-0.7168M1024.000512 470.5792c-3.1744 93.952-4.9152 159.8976-22.1696 224.0512-3.0208 11.264-6.656 22.7328-12.4928 32.6656-3.8912 6.656-11.776 14.3872-18.3296 14.8992-5.3248 0.4096-14.08-8.192-16.6912-14.6944-7.5776-18.7392-14.848-38.0928-18.6368-57.9584-16.384-86.3744-18.4832-173.7216-10.496-261.0176 3.584-39.424 11.9296-78.4896 19.1488-117.5552 1.792-9.728 6.7584-19.2512 11.776-27.9552 9.728-16.4864 22.3744-16.896 30.9248 0 7.68 15.2576 15.0528 31.744 17.408 48.4864 8.8064 62.0544 15.4112 124.416 19.5584 159.0784" ></path></symbol><symbol id="icon-icon_discord" viewBox="0 0 1024 1024"><path d="M831.8976 213.6064A748.032 748.032 0 0 0 641.7408 153.6c-8.192 14.848-17.7664 34.8672-24.3712 50.7904a694.8864 694.8864 0 0 0-210.688 0c-6.6048-15.872-16.384-35.8912-24.6272-50.7904a745.5744 745.5744 0 0 0-190.3104 60.16C71.424 396.4928 38.8096 574.6176 55.0912 750.2848a758.784 758.784 0 0 0 233.216 120.064c18.7904-26.0096 35.5328-53.6064 49.92-82.688a490.0864 490.0864 0 0 1-78.6432-38.4c6.656-4.9664 13.056-10.0864 19.3024-15.36 151.6544 71.2704 316.416 71.2704 466.2272 0 6.2976 5.2736 12.8 10.3936 19.3024 15.36a488.8576 488.8576 0 0 1-78.848 38.5024c14.4384 28.9792 31.1296 56.6784 49.9712 82.6368a757.2992 757.2992 0 0 0 233.3184-120.1152c19.1488-203.6224-32.6656-380.16-136.96-536.6784zM358.912 642.2528c-45.568 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0.1024 52.0192-36.5056 94.72-82.8416 94.72z m306.176 0c-45.5168 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0 52.0192-36.5056 94.72-82.8416 94.72z" ></path></symbol><symbol id="icon-icon_del" viewBox="0 0 1024 1024"><path d="M512 64a243.2512 243.2512 0 0 1 240.1792 204.8h-1.3312a140.8 140.8 0 0 1 139.1104 162.4576l-63.6928 409.6a140.8 140.8 0 0 1-139.1616 119.1424H336.896a140.8 140.8 0 0 1-139.1616-119.1424l-63.6928-409.6A140.8 140.8 0 0 1 271.8208 268.8a243.2 243.2 0 0 1 240.1792-204.8z m238.848 281.6h-477.696A64 64 0 0 0 209.92 419.4304l63.6928 409.6A64 64 0 0 0 336.896 883.2h350.208a64 64 0 0 0 63.2832-54.1696l63.6928-409.6a64 64 0 0 0-63.232-73.8304zM409.6 473.6a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8A38.4 38.4 0 0 1 409.6 473.6z m204.8 0a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8a38.4 38.4 0 0 1 38.4-38.4z m-102.4-332.8a166.4512 166.4512 0 0 0-160.0512 120.7296l-1.8944 7.2704h323.84l-1.8432-7.2704a166.5024 166.5024 0 0 0-150.6304-120.4736L512 140.8z" ></path></symbol><symbol id="icon-plorer" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0zM726.886 324.3L577.741 764.11c-11.776 34.713-60.826 34.816-72.704 0.051L440.73 575.59l-197.94-71.987c-31.744-11.622-33.536-54.63-5.427-69.785l5.632-2.458 434.586-155.546a38.4 38.4 0 0 1 49.305 48.487z m-98.252 50.586L369.05 467.763l115.2 41.984a38.4 38.4 0 0 1 20.992 18.381l2.252 5.325 33.792 98.97 87.348-257.537z" ></path></symbol><symbol id="icon-disconnect" viewBox="0 0 1024 1024"><path d="M575.357 738.274a38.4 38.4 0 0 1 0 54.306l-72.408 72.408A243.2 243.2 0 1 1 159.012 521.05l72.408-72.408a38.4 38.4 0 1 1 54.306 54.306l-72.408 72.408a166.4 166.4 0 0 0 235.325 235.325l72.408-72.408a38.4 38.4 0 0 1 54.306 0z m-108.612-181.02a38.4 38.4 0 0 1 0 54.307L358.134 720.172a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0zM756.376 702.07a38.4 38.4 0 1 1-54.306 54.306L267.624 321.93a38.4 38.4 0 1 1 54.306-54.306L756.376 702.07z m-36.204-398.242a38.4 38.4 0 0 1 0 54.306L611.561 466.745a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0z m144.816-144.816a243.2 243.2 0 0 1 0 343.937l-72.408 72.408a38.4 38.4 0 1 1-54.306-54.306l72.408-72.408a166.4 166.4 0 0 0-235.325-235.325l-72.408 72.408a38.4 38.4 0 0 1-54.306-54.306l72.408-72.408a243.2 243.2 0 0 1 343.937 0z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M665.6 396.8a140.8 140.8 0 0 1 140.8 140.8v128a140.8 140.8 0 0 1-140.8 140.8h-128a140.8 140.8 0 0 1-140.8-140.8v-128a140.8 140.8 0 0 1 140.8-140.8h128z m0 76.8h-128c-35.328 0-64 28.672-64 64v128c0 35.328 28.672 64 64 64h128c35.328 0 64-28.672 64-64v-128c0-35.328-28.672-64-64-64z" ></path><path d="M537.6 217.6c49.46 0 89.6 40.14 89.6 89.6v25.6a38.4 38.4 0 0 1-76.8 0v-25.6a12.8 12.8 0 0 0-12.8-12.8H307.2a12.8 12.8 0 0 0-12.8 12.8v230.4c0 7.066 5.734 12.8 12.8 12.8h25.6a38.4 38.4 0 0 1 0 76.8h-25.6a89.6 89.6 0 0 1-89.6-89.6V307.2c0-49.46 40.14-89.6 89.6-89.6h230.4z" ></path></symbol><symbol id="icon-link" viewBox="0 0 1024 1024"><path d="M436.992 281.6a38.4 38.4 0 0 1 0 76.8 217.6 217.6 0 1 0 217.6 217.6 38.4 38.4 0 1 1 76.8 0 294.4 294.4 0 1 1-294.4-294.4z m385.28-102.4l3.8912 0.2048 0.6144 0.0512-4.5056-0.256a38.2464 38.2464 0 0 1 28.416 12.544l0.8704 1.024a38.5536 38.5536 0 0 1 2.0992 2.7136l-2.9696-3.7376a38.656 38.656 0 0 1 9.984 25.5488V473.6a38.4 38.4 0 1 1-76.8 0V304.4864l-399.616 364.1344a38.4 38.4 0 0 1-51.712-56.832L723.0464 256H566.272a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-unfold" viewBox="0 0 2048 1024"><path d="M565.248 78.131a76.8 76.8 0 0 1 108.544 0l362.086 361.984a25.6 25.6 0 0 0 36.25 0l361.984-361.984a76.8 76.8 0 0 1 108.544 108.544l-361.984 362.189a179.2 179.2 0 0 1-253.44 0L565.248 186.675a76.8 76.8 0 0 1 0-108.544z" ></path></symbol><symbol id="icon-rpc" viewBox="0 0 1024 1024"><path d="M204.8 678.4a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m168.96-573.44a268.8 268.8 0 0 1 207.872 439.245l38.144 38.144a192 192 0 1 1-55.603 53.094l-39.27-39.373A268.8 268.8 0 1 1 373.76 104.96zM204.8 755.2a64 64 0 1 0 0 128 64 64 0 0 0 0-128z m517.12-125.44a115.2 115.2 0 1 0 0 230.4 115.2 115.2 0 0 0 0-230.4z m-348.16-448a192 192 0 1 0 0 384 192 192 0 0 0 0-384zM819.2 64a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m0 76.8a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" ></path></symbol><symbol id="icon-mev" viewBox="0 0 1024 1024"><path d="M651.162 95.488c53.401 56.422 131.84 113.818 235.212 171.674a38.4 38.4 0 0 1 19.456 29.9c12.032 129.024-12.544 251.75-73.625 367.156-60.211 113.817-158.976 226.457-295.936 338.33a38.4 38.4 0 0 1-48.589 0C356.608 895.436 259.328 782.181 196.045 662.681c-64.103-121.19-90.266-243.405-77.824-365.876a38.4 38.4 0 0 1 20.531-30.259C239.923 214.323 319.846 156.98 378.624 94.925c104.96-110.95 169.37-108.442 272.538 0.512z m126.464 196.506l-1.178 0.819a41.933 41.933 0 0 1-10.035 3.84c-4.25 1.024-5.427 1.28-14.695 3.328a122.368 122.368 0 0 0-16.896 4.403c-43.878 16.384-71.168 47.411-83.097 96.666-2.304 9.625-3.328 20.838-3.687 38.4l-0.204 13.516v15.872l0.05 9.728v2.048l0.052 3.482c0.256 35.328 0.154 51.2-1.024 71.424-4.506 79.36-42.291 140.39-108.954 178.483-29.542 16.896-61.9 23.962-99.328 23.91h-8.704a9243.136 9243.136 0 0 0-29.286-0.153h-17.46l-10.034-0.051h-22.938c40.448 50.841 88.371 100.71 143.77 149.504l17.97 15.513 17.511-14.899c101.018-88.064 176.077-175.513 225.28-262.144l9.523-17.408c50.893-96.205 73.063-197.273 66.56-303.974l-3.584-2.407a1479.786 1479.786 0 0 1-49.664-29.9z m-171.52 5.12h-1.127c-15.155 0.102-30.054 3.584-45.107 10.598-46.285 21.504-77.056 71.373-76.39 128.051 0.307 25.703 0.256 51.354 0 87.603l-0.103 10.445c-0.102 14.49-0.512 24.371-1.74 34.816-4.865 42.803-19.661 79.77-43.674 110.285l-1.792 2.15 1.331 0.052h1.331c24.832 0 44.288-4.199 61.03-13.824 44.033-25.19 67.38-62.72 70.4-116.122 1.025-18.022 1.127-32.768 0.871-66.56v-5.478l-0.051-5.223v-21.504c0-5.12 0.051-9.728 0.153-14.49 0.512-22.681 1.895-38.604 5.837-54.937a225.075 225.075 0 0 1 35.687-79.514l4.71-6.246h-11.366z m1.484-136.295l-12.236-12.544c-73.728-77.926-87.245-78.438-160.973-0.563-60.467 63.898-139.674 122.112-237.466 174.95l-3.942 2.048-0.768 17.562c-2.407 88.064 18.176 176.384 61.952 265.42l9.779 19.047c9.267 17.51 19.354 34.919 30.26 52.224l-0.871 0.154c2.406-0.512 2.406-0.512 6.144-0.973 15.104-1.536 29.593-6.86 43.776-15.974 36.454-23.552 56.883-56.576 62.105-102.247 0.82-7.168 1.127-14.848 1.23-26.726l0.102-10.343c0.256-35.84 0.307-61.132 0-86.22-1.024-86.58 46.899-164.199 120.78-198.554a183.552 183.552 0 0 1 77.312-17.766h1.536l53.044 0.256h16.076a775.117 775.117 0 0 1-67.84-59.75z" ></path></symbol><symbol id="icon-caution" viewBox="0 0 1024 1024"><path d="M512 682.666667c-47.146667 0-85.333333-42.112-85.333333-94.037334V94.037333C426.666667 42.112 464.853333 0 512 0s85.333333 42.112 85.333333 94.037333v494.592C597.333333 640.554667 559.146667 682.666667 512 682.666667zM512 1024c-47.146667 0-85.333333-35.2-85.333333-78.592v-98.816C426.666667 803.2 464.853333 768 512 768s85.333333 35.2 85.333333 78.592v98.816C597.333333 988.8 559.146667 1024 512 1024z" ></path></symbol><symbol id="icon-settings" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0z m104.858 211.762a89.6 89.6 0 0 1 77.568 44.8l47.257 81.818a89.6 89.6 0 0 1 0 89.6l-47.257 81.818a89.6 89.6 0 0 1-77.568 44.8h-94.516a89.6 89.6 0 0 1-77.568-44.8L339.917 556.8a89.6 89.6 0 0 1 0-89.6l47.257-81.818a89.6 89.6 0 0 1 77.568-44.8h94.516z m0 76.8h-94.516a12.8 12.8 0 0 0-11.059 6.4L406.426 505.6a12.8 12.8 0 0 0 0 12.8l47.257 81.818a12.8 12.8 0 0 0 11.06 6.4h94.515a12.8 12.8 0 0 0 11.059-6.4l47.257-81.818a12.8 12.8 0 0 0 0-12.8l-47.257-81.818a12.8 12.8 0 0 0-11.06-6.4z" ></path></symbol><symbol id="icon-back" viewBox="0 0 1024 1024"><path d="M67.738 495.616l36.3 32.358 220.468 194.868c13.926 12.236 14.438 33.792 1.024 46.796l-0.41 0.41a31.898 31.898 0 0 1-44.288 0L20.736 518.554a31.744 31.744 0 0 1 0-45.773l260.096-251.597a31.898 31.898 0 0 1 44.288 0l0.46 0.41a31.846 31.846 0 0 1-1.023 46.848l-220.57 194.816-36.352 32.358z" ></path></symbol><symbol id="icon-wallet" viewBox="0 0 1024 1024"><path d="M825.6 115.2A134.4 134.4 0 0 1 960 249.6v384c0 60.877-40.448 112.282-95.949 128.82L864 785.868a140.8 140.8 0 0 1-179.456 135.373l-467.2-133.479A140.8 140.8 0 0 1 115.2 652.288V249.6a134.4 134.4 0 0 1 134.4-134.4h576zM256 225.331c-35.328 0-64 28.672-64 64V652.34c0 28.57 18.944 53.709 46.438 61.543l467.2 133.478a64 64 0 0 0 81.562-61.491v-47.616a38.502 38.502 0 0 1 0-17.306V422.861a64 64 0 0 0-46.438-61.543l-467.2-133.478A64 64 0 0 0 256 225.28zM825.6 192H427.827l334.029 95.437A140.8 140.8 0 0 1 864 422.86v253.645c11.776-10.548 19.2-25.856 19.2-42.906v-384c0-31.795-25.805-57.6-57.6-57.6z m-192 259.226a38.4 38.4 0 0 1 38.4 38.4V633.6a38.4 38.4 0 1 1-76.8 0V489.574a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-star" viewBox="0 0 1024 1024"><path d="M474.778 72.653a84.992 84.992 0 0 1 113.1 37.683l90.727 179.712c1.024 2.15 3.277 3.686 5.939 4.096l202.906 29.082c18.278 2.56 35.174 11.059 48.128 24.064a83.302 83.302 0 0 1-1.23 119.09l-148.12 142.542a6.605 6.605 0 0 0-2.049 5.939l34.765 195.584c3.277 18.483 0.154 37.58-8.806 54.17a85.043 85.043 0 0 1-114.176 34.457L515.84 804.659a8.55 8.55 0 0 0-7.885 0l-179.968 94.31c-16.589 8.705-35.635 11.674-54.118 8.5a83.968 83.968 0 0 1-68.813-97.28l34.97-195.328a6.605 6.605 0 0 0-2.048-5.94L89.702 466.484a83.61 83.61 0 0 1-24.832-48.128 83.968 83.968 0 0 1 71.732-95.078l204.339-29.184a7.834 7.834 0 0 0 5.939-4.096l89.395-179.251c8.192-16.59 21.76-29.952 38.503-38.093z m36.198 68.25l-2.56 0.767a7.475 7.475 0 0 0-3.43 3.328l-89.344 179.303c-12.39 24.832-36.301 41.933-63.847 45.875l-204.339 29.133c-4.352 0.614-7.168 4.198-6.605 7.885a6.81 6.81 0 0 0 2.048 3.89l148.275 142.49c20.173 19.354 29.338 47.36 24.423 74.804l-34.919 195.379c-0.665 3.584 1.946 7.27 6.247 8.038 1.894 0.307 3.789 0 5.427-0.819l179.968-94.31a85.35 85.35 0 0 1 79.155 0l180.173 94.361c3.994 2.1 9.011 0.615 10.957-3.02a6.4 6.4 0 0 0 0.717-4.199l-34.714-195.533a83.354 83.354 0 0 1 24.371-74.65l148.122-142.591a6.502 6.502 0 0 0 0.102-9.524 8.14 8.14 0 0 0-4.608-2.252l-202.957-29.082c-27.392-3.942-51.2-20.89-63.59-45.517l-90.726-179.712c-1.844-3.635-6.81-5.273-10.906-3.277l2.56-0.768z" ></path></symbol><symbol id="icon-trade" viewBox="0 0 1024 1024"><path d="M1002.93153 563.627l-433.237 432.64a67.243 67.243 0 0 1-29.696 21.93c-0.853 0.171-1.45 0.342-1.963 0.342a61.27 61.27 0 0 1-22.442 4.608c-1.11 0-2.304 0.853-3.414 0.853-2.048 0-3.84-1.365-5.973-1.365a54.87 54.87 0 0 1-13.653-2.987 77.312 77.312 0 0 1-15.275-6.144c-2.987-1.621-5.803-3.67-8.533-5.803-2.56-1.962-5.718-2.816-7.936-5.461L21.34153 563.627a71.68 71.68 0 0 1 0-102.059 72.704 72.704 0 0 1 102.57 0l316.16 315.477V73.472C440.07353 33.109 472.92753 0 513.29053 0a73.387 73.387 0 0 1 73.216 73.472v701.355L900.53153 461.653a72.363 72.363 0 0 1 102.4 102.059z" ></path></symbol><symbol id="icon-verticalslider" viewBox="0 0 1024 1024"><path d="M310.426 441.6a166.4 166.4 0 0 1 38.4 328.346V870.4a38.4 38.4 0 1 1-76.8 0V769.946a166.451 166.451 0 0 1 38.4-328.346z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z m403.2-403.2a38.4 38.4 0 0 1 38.4 38.4v55.654a166.451 166.451 0 0 1-38.4 328.346 166.4 166.4 0 0 1-38.4-328.346V153.6a38.4 38.4 0 0 1 38.4-38.4z m0 166.4a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2zM310.323 115.2a38.4 38.4 0 0 1 38.4 38.4v146.534a38.4 38.4 0 0 1-76.8 0V153.6a38.4 38.4 0 0 1 38.4-38.4z m403.2 525.26a38.4 38.4 0 0 1 38.4 38.4V870.4a38.4 38.4 0 1 1-76.8 0V678.86a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-swap" viewBox="0 0 1024 1024"><path d="M321.434 116.224a51.2 51.2 0 0 1 69.888 74.752c-47.77 44.646-87.04 81.818-117.658 111.462l-1.997 1.844h289.229a51.2 51.2 0 0 1 50.842 45.26l0.358 5.94a51.2 51.2 0 0 1-51.2 51.2H154.47a51.763 51.763 0 0 1-52.07-52.839c0.205-11.52 3.123-19.097 7.782-27.136 3.226-5.53 7.22-10.752 12.8-17.203 8.192-9.626 20.992-23.04 38.656-40.704a7171.584 7171.584 0 0 1 159.744-152.576z m509.593 188.058a51.2 51.2 0 0 1 0 102.4h-93.593a51.2 51.2 0 0 1 0-102.4h93.593zM663.194 853.709a51.2 51.2 0 0 1-69.888-74.803c47.77-44.647 87.04-81.818 117.657-111.412l2.048-1.894H153.6a51.2 51.2 0 0 1-50.842-45.21l-0.358-5.99a51.2 51.2 0 0 1 51.2-51.2h676.557c27.904 0 52.582 22.272 52.07 52.838a51.456 51.456 0 0 1-7.782 27.136c-3.226 5.53-7.22 10.752-12.8 17.204-8.192 9.625-20.992 23.04-38.656 40.704a7171.584 7171.584 0 0 1-159.744 152.627z" ></path></symbol><symbol id="icon-star_sel" viewBox="0 0 1024 1024"><path d="M470.63 127.846L381.286 307.2a46.182 46.182 0 0 1-34.918 24.986l-204.34 29.184a45.568 45.568 0 0 0-39.167 51.456 45.344 45.344 0 0 0 13.465 26.01l148.276 142.438c10.905 10.496 15.872 25.6 13.21 40.448l-34.97 195.328a45.568 45.568 0 0 0 37.58 52.633 46.95 46.95 0 0 0 29.748-4.659l179.968-94.31a46.95 46.95 0 0 1 43.52 0l180.121 94.361c22.528 11.827 50.586 3.43 62.618-18.688a44.8 44.8 0 0 0 4.71-29.184L746.394 621.62a45.005 45.005 0 0 1 13.21-40.294l148.12-142.592a44.902 44.902 0 0 0 0.666-64.256 46.54 46.54 0 0 0-26.368-13.21l-202.956-29.081a46.182 46.182 0 0 1-34.765-24.781l-90.727-179.712a46.592 46.592 0 0 0-82.944 0.205z" ></path></symbol><symbol id="icon-tips" viewBox="0 0 1024 1024"><path d="M512 166.4a345.6 345.6 0 1 1 0 691.2 345.6 345.6 0 0 1 0-691.2z m0 76.8a268.8 268.8 0 1 0 0 537.6 268.8 268.8 0 0 0 0-537.6z m0 196.3a38.4 38.4 0 0 1 38.4 38.4v219.29a38.4 38.4 0 1 1-76.8 0V477.9a38.4 38.4 0 0 1 38.4-38.4z m0-153.087a38.4 38.4 0 0 1 38.4 38.4v45.414a38.4 38.4 0 1 1-76.8 0v-45.363a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-sel" viewBox="0 0 1024 1024"><path d="M783.36 281.2416a51.2 51.2 0 0 1 71.68 73.0624l-407.9616 400.384a51.2 51.2 0 0 1-67.8912 3.4304l-206.3872-165.376a51.2 51.2 0 1 1 64-79.9232l170.9568 137.0112 375.6032-368.64z" ></path></symbol><symbol id="icon-spread" viewBox="0 0 1024 1024"><path d="M143.36 678.4a38.4 38.4 0 0 1 38.4 38.4v112.64c0 7.066 5.734 12.8 12.8 12.8H307.2a38.4 38.4 0 1 1 0 76.8H194.56a89.6 89.6 0 0 1-89.6-89.6V716.8a38.4 38.4 0 0 1 38.4-38.4z m327.68-573.44a38.4 38.4 0 0 1 0 76.8H234.342L842.24 790.477v-242.33a38.4 38.4 0 1 1 76.8 0V829.44a89.6 89.6 0 0 1-89.6 89.6H552.96a38.4 38.4 0 1 1 0-76.8l232.346-0.051L181.76 237.773V471.04a38.4 38.4 0 0 1-76.8 0V194.56c0-49.46 40.14-89.6 89.6-89.6h276.48z m358.4 0c49.46 0 89.6 40.14 89.6 89.6V307.2a38.4 38.4 0 1 1-76.8 0V194.56a12.8 12.8 0 0 0-12.8-12.8H716.8a38.4 38.4 0 1 1 0-76.8h112.64z" ></path></symbol><symbol id="icon-refresh" viewBox="0 0 1024 1024"><path d="M601.446 178.176a344.576 344.576 0 0 1 124.621 62.413 38.4 38.4 0 0 1 5.12 55.45l-94.566 107.878a38.4 38.4 0 1 1-57.754-50.586l65.741-75.11-4.915-2.816a268.646 268.646 0 0 0-43.008-18.535l-15.104-4.505A268.8 268.8 0 1 0 771.635 581.58a38.4 38.4 0 1 1 74.189 19.865 345.6 345.6 0 1 1-244.378-423.27z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M763.392 256.512a51.2 51.2 0 0 1 0 72.3968L582.2464 509.952l183.1424 183.1424a51.2 51.2 0 0 1-72.3968 72.3968l-183.1424-183.1424-180.992 181.0432a51.2 51.2 0 0 1-72.3968-72.3968L437.504 509.952 258.56 330.9568A51.2 51.2 0 0 1 330.9568 258.56L509.952 437.504l181.0432-180.992a51.2 51.2 0 0 1 72.3968 0z" ></path></symbol><symbol id="icon-alert" viewBox="0 0 1024 1024"><path d="M558.08 125.0816c12.6464 7.5776 23.1936 18.1248 30.72 30.72L959.232 773.12a89.6 89.6 0 0 1-76.8 135.68H141.6192a89.6 89.6 0 0 1-76.8-135.68L435.1488 155.8016a89.6 89.6 0 0 1 122.9312-30.72zM501.0432 195.328L130.6624 812.5952a12.8 12.8 0 0 0 10.9568 19.4048h740.7616a12.8 12.8 0 0 0 10.9568-19.4048L522.9568 195.328a12.8 12.8 0 0 0-21.9136 0zM512 524.8a38.4 38.4 0 0 1 38.4 38.4v153.6a38.4 38.4 0 1 1-76.8 0v-153.6a38.4 38.4 0 0 1 38.4-38.4z m0-204.8a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 1 1-76.8 0V358.4a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M572.33 707.67l220.673-220.673a85.333 85.333 0 0 0-60.331-145.664H291.328a85.333 85.333 0 0 0-60.33 145.664L451.668 707.67a85.333 85.333 0 0 0 120.662 0z" ></path></symbol></svg>',(e=>{var t=(r=(r=document.getElementsByTagName("script"))[r.length-1]).getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,s,o,a,c=function(f,h){h.parentNode.insertBefore(f,h)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch{}}n=function(){var f,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_4776227,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(f=document.body).firstChild?c(h,f.firstChild):f.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(s=n,o=e.document,a=!1,l(),o.onreadystatechange=function(){o.readyState=="complete"&&(o.onreadystatechange=null,u())})}function u(){a||(a=!0,s())}function l(){try{o.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);function Hn(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 SS="1.18.0",ES="1.40.0",CS={"-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 Sh extends Error{}class Eh extends Sh{constructor(t,r){super(t),this.code=r,this.type=CS[r]??"ServerError"}}class Kv extends Sh{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var Xv=e=>{throw TypeError(e)},Ch=(e,t,r)=>t.has(e)||Xv("Cannot "+r),er=(e,t,r)=>(Ch(e,t,"read from private field"),r?r.call(e):t.get(e)),ms=(e,t,r)=>t.has(e)?Xv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),So=(e,t,r,n)=>(Ch(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Jv=(e,t,r)=>(Ch(e,t,"access private method"),r),AS=(e,t,r,n)=>({set _(i){So(e,t,i,r)},get _(){return er(e,t,n)}}),Ss,Ta,vi,Ns,Fa,Eo,vu,Yv,Zv;function MS(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const TS={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class OS{constructor(t,r={}){if(ms(this,vu),ms(this,Ss,0),ms(this,Ta,0),ms(this,vi,null),ms(this,Ns,null),ms(this,Fa,new Set),ms(this,Eo,new Map),this.endpoint=t,this.options={...TS,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=MS(this.endpoint))}async makeRequest(t,r){const n=await Jv(this,vu,Yv).call(this);return new Promise((i,s)=>{So(this,Ss,er(this,Ss)+1),er(this,Eo).set(er(this,Ss),{resolve:i,reject:s,timeout:setTimeout(()=>{er(this,Eo).delete(er(this,Ss)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:er(this,Ss),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new Eh(i.message,i.code);return s})}async subscribe(t){const r=new IS(t);return er(this,Fa).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}Ss=new WeakMap;Ta=new WeakMap;vi=new WeakMap;Ns=new WeakMap;Fa=new WeakMap;Eo=new WeakMap;vu=new WeakSet;Yv=function(){return er(this,Ns)?er(this,Ns):(So(this,Ns,new Promise(e=>{var t;(t=er(this,vi))==null||t.close(),So(this,vi,new this.options.WebSocketConstructor(this.endpoint)),er(this,vi).addEventListener("open",()=>{So(this,Ta,0),e(er(this,vi))}),er(this,vi).addEventListener("close",()=>{AS(this,Ta)._++,er(this,Ta)<=this.options.maxReconnects&&setTimeout(()=>{Jv(this,vu,Zv).call(this)},this.options.reconnectTimeout)}),er(this,vi).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,Eo).has(n.id)){const{resolve:i,timeout:s}=er(this,Eo).get(n.id);clearTimeout(s),i(n)}else if("params"in n){const{params:i}=n;er(this,Fa).forEach(s=>{s.subscriptionId===i.subscription&&i.subscription===s.subscriptionId&&s.onMessage(i.result)})}})})),er(this,Ns))};Zv=async function(){var e;return(e=er(this,vi))==null||e.close(),So(this,Ns,null),Promise.allSettled([...er(this,Fa)].map(t=>t.subscribe(this)))};class IS{constructor(t){this.subscriptionId=null,this.subscribed=!1,this.input=t}onMessage(t){this.subscribed&&this.input.onMessage(t)}async unsubscribe(t){const{subscriptionId:r}=this;return this.subscribed=!1,r==null?!1:(this.subscriptionId=null,t.makeRequest(this.input.unsubscribe,[r]))}async subscribe(t){this.subscriptionId=null,this.subscribed=!0;const r=await t.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=r)}}var Qv=e=>{throw TypeError(e)},Ah=(e,t,r)=>t.has(e)||Qv("Cannot "+r),rn=(e,t,r)=>(Ah(e,t,"read from private field"),r?r.call(e):t.get(e)),Mc=(e,t,r)=>t.has(e)?Qv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),vd=(e,t,r,n)=>(Ah(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),PS=(e,t,r)=>(Ah(e,t,"access private method"),r),xa,bn,Oa,yd,e1;class t1{constructor(t){Mc(this,yd),Mc(this,xa,0),Mc(this,bn),Mc(this,Oa),vd(this,bn,t)}fetch(t,r){const n=rn(this,bn).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;vd(this,xa,rn(this,xa)+1);const r=await this.fetch(((i=rn(this,bn).rpc)==null?void 0:i.url)??rn(this,bn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":SS,"Client-Target-Api-Version":ES,"Client-Request-Method":t.method,...(s=rn(this,bn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:rn(this,xa),method:t.method,params:t.params})});if(!r.ok)throw new Kv(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new Eh(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await PS(this,yd,e1).call(this).subscribe(t);return async()=>!!await r()}}xa=new WeakMap;bn=new WeakMap;Oa=new WeakMap;yd=new WeakSet;e1=function(){var e;if(!rn(this,Oa)){const t=rn(this,bn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");vd(this,Oa,new OS(((e=rn(this,bn).websocket)==null?void 0:e.url)??rn(this,bn).url,{WebSocketConstructor:t,...rn(this,bn).websocket}))}return rn(this,Oa)};function r1(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 kS(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<e.length;u++){const l=e.charAt(u),f=l.charCodeAt(0);if(t[f]!==255)throw new TypeError(l+" is ambiguous");t[f]=u}const r=e.length,n=e.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let l=0,f=0,h=0;const y=u.length;for(;h!==y&&u[h]===0;)h++,l++;const b=(y-h)*s+1>>>0,w=new Uint8Array(b);for(;h!==y;){let k=u[h],N=0;for(let U=b-1;(k!==0||N<f)&&U!==-1;U--,N++)k+=256*w[U]>>>0,w[U]=k%r>>>0,k=k/r>>>0;if(k!==0)throw new Error("Non-zero carry");f=N,h++}let T=b-f;for(;T!==b&&w[T]===0;)T++;let I=n.repeat(l);for(;T<b;++T)I+=e.charAt(w[T]);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,b=new Uint8Array(y);for(;u[l];){let k=t[u.charCodeAt(l)];if(k===255)return;let N=0;for(let U=y-1;(k!==0||N<h)&&U!==-1;U--,N++)k+=r*b[U]>>>0,b[U]=k%256>>>0,k=k/256>>>0;if(k!==0)throw new Error("Non-zero carry");h=N,l++}let w=y-h;for(;w!==y&&b[w]===0;)w++;const T=new Uint8Array(f+(y-w));let I=f;for(;w!==y;)T[I++]=b[w++];return T}function c(u){const l=a(u);if(l)return l;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var jS="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const n1=kS(jS),rl=e=>n1.encode(e),Fo=e=>n1.decode(e),RS=rl,NS=Fo;function nl(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const ff=8192;function Gi(e){if(e.length<ff)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=ff){const n=e.slice(r,r+ff);t+=String.fromCharCode(...n)}return btoa(t)}const DS=Gi,$S=nl;function il(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 uc(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const BS=uc,LS=il;function Mh(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 FS(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 i1{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}=FS(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 s1(e,t){switch(t){case"base58":return rl(e);case"base64":return Gi(e);case"hex":return uc(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function US(e,t){switch(t){case"base58":return Fo(e);case"base64":return nl(e);case"hex":return il(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function zS(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 o1{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 df(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return df(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return df(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return Mh(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 s1(this.toBytes(),t)}}function df(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 a1=e=>{throw TypeError(e)},c1=(e,t,r)=>t.has(e)||a1("Cannot "+r),wn=(e,t,r)=>(c1(e,t,"read from private field"),r?r.call(e):t.get(e)),yu=(e,t,r)=>t.has(e)?a1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),bu=(e,t,r,n)=>(c1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),lo,Sa,Wc,Li;const VS=class u1{constructor(t){yu(this,lo),yu(this,Sa),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),bu(this,lo,t.write),bu(this,Sa,t.serialize??((r,n)=>{const i=new o1({initialSize:this.serializedSize(r)??void 0,...n});return wn(this,lo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),wn(this,lo).call(this,t,r)}serialize(t,r){return this.validate(t),new f1(this,wn(this,Sa).call(this,t,r))}parse(t){const r=new i1(t);return this.read(r)}fromHex(t){return this.parse(il(t))}fromBase58(t){return this.parse(Fo(t))}fromBase64(t){return this.parse(nl(t))}transform({name:t,input:r,output:n,validate:i}){return new u1({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>wn(this,lo).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>wn(this,Sa).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};lo=new WeakMap;Sa=new WeakMap;let Wn=VS;const l1=Symbol.for("@mysten/serialized-bcs");function qS(e){return!!e&&typeof e=="object"&&e[l1]===!0}class f1{constructor(t,r){yu(this,Wc),yu(this,Li),bu(this,Wc,t),bu(this,Li,r)}get[l1](){return!0}toBytes(){return wn(this,Li)}toHex(){return uc(wn(this,Li))}toBase64(){return Gi(wn(this,Li))}toBase58(){return rl(wn(this,Li))}parse(){return wn(this,Wc).parse(wn(this,Li))}}Wc=new WeakMap;Li=new WeakMap;function wu({size:e,...t}){return new Wn({...t,serializedSize:()=>e})}function hf({readMethod:e,writeMethod:t,...r}){return wu({...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 pf({readMethod:e,writeMethod:t,...r}){return wu({...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 HS({serialize:e,...t}){const r=new Wn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function WS({toBytes:e,fromBytes:t,...r}){return new Wn({...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=Mh(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 GS(e){let t=null;function r(){return t||(t=e()),t}return new Wn({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 Gc={u8(e){return hf({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return hf({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return hf({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return pf({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return pf({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return pf({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return wu({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 HS({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(Mh(t)),...e})},bytes(e,t){return wu({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 WS({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Wn({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 Gc.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 Wn({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 Wn({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 Wn({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 Wn({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 Gc.vector(Gc.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 GS(e)}},KS=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:i1,BcsType:Wn,BcsWriter:o1,SerializedBcs:f1,bcs:Gc,decodeStr:US,encodeStr:s1,fromB58:NS,fromB64:$S,fromBase58:Fo,fromBase64:nl,fromHEX:LS,fromHex:il,isSerializedBcs:qS,splitGenericParameters:zS,toB58:RS,toB64:DS,toBase58:rl,toBase64:Gi,toHEX:BS,toHex:uc},Symbol.toStringTag,{value:"Module"})),XS=32;function K0(e){try{return Fo(e).length===XS}catch{return!1}}const d1=32;function Es(e){return JS(e)&&YS(e)===d1}function Tc(e){return Es(e)}function Cs(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(d1*2,"0")}`}function Oc(e,t=!1){return Cs(e,t)}function JS(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function YS(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const ZS=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,QS=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i;function eE(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!ZS.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!QS.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 zs={},Io={},kn={};Object.defineProperty(kn,"__esModule",{value:!0});kn.anumber=Ua;kn.number=Ua;kn.abytes=sl;kn.bytes=sl;kn.ahash=h1;kn.aexists=p1;kn.aoutput=m1;function Ua(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function tE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function sl(e,...t){if(!tE(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 h1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ua(e.outputLen),Ua(e.blockLen)}function p1(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 m1(e,t){sl(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const rE={number:Ua,bytes:sl,hash:h1,exists:p1,output:m1};kn.default=rE;var Th={},ol={};Object.defineProperty(ol,"__esModule",{value:!0});ol.crypto=void 0;ol.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=n,e.byteSwap32=l,e.bytesToHex=h,e.hexToBytes=w,e.asyncLoop=I,e.utf8ToBytes=k,e.toBytes=N,e.concatBytes=U,e.checkOpts=W,e.wrapConstructor=q,e.wrapConstructorWithOpts=X,e.wrapXOFConstructorWithOpts=re,e.randomBytes=oe;const t=ol,r=kn;function n(H){return H instanceof Uint8Array||ArrayBuffer.isView(H)&&H.constructor.name==="Uint8Array"}const i=H=>new Uint8Array(H.buffer,H.byteOffset,H.byteLength);e.u8=i;const s=H=>new Uint32Array(H.buffer,H.byteOffset,Math.floor(H.byteLength/4));e.u32=s;const o=H=>new DataView(H.buffer,H.byteOffset,H.byteLength);e.createView=o;const a=(H,F)=>H<<32-F|H>>>F;e.rotr=a;const c=(H,F)=>H<<F|H>>>32-F>>>0;e.rotl=c,e.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();const u=H=>H<<24&4278190080|H<<8&16711680|H>>>8&65280|H>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?H=>H:H=>(0,e.byteSwap)(H);function l(H){for(let F=0;F<H.length;F++)H[F]=(0,e.byteSwap)(H[F])}const f=Array.from({length:256},(H,F)=>F.toString(16).padStart(2,"0"));function h(H){(0,r.abytes)(H);let F="";for(let D=0;D<H.length;D++)F+=f[H[D]];return F}const y={_0:48,_9:57,A:65,F:70,a:97,f:102};function b(H){if(H>=y._0&&H<=y._9)return H-y._0;if(H>=y.A&&H<=y.F)return H-(y.A-10);if(H>=y.a&&H<=y.f)return H-(y.a-10)}function w(H){if(typeof H!="string")throw new Error("hex string expected, got "+typeof H);const F=H.length,D=F/2;if(F%2)throw new Error("hex string expected, got unpadded hex of length "+F);const p=new Uint8Array(D);for(let d=0,m=0;d<D;d++,m+=2){const x=b(H.charCodeAt(m)),A=b(H.charCodeAt(m+1));if(x===void 0||A===void 0){const E=H[m]+H[m+1];throw new Error('hex string expected, got non-hex character "'+E+'" at index '+m)}p[d]=x*16+A}return p}const T=async()=>{};e.nextTick=T;async function I(H,F,D){let p=Date.now();for(let d=0;d<H;d++){D(d);const m=Date.now()-p;m>=0&&m<F||(await(0,e.nextTick)(),p+=m)}}function k(H){if(typeof H!="string")throw new Error("utf8ToBytes expected string, got "+typeof H);return new Uint8Array(new TextEncoder().encode(H))}function N(H){return typeof H=="string"&&(H=k(H)),(0,r.abytes)(H),H}function U(...H){let F=0;for(let p=0;p<H.length;p++){const d=H[p];(0,r.abytes)(d),F+=d.length}const D=new Uint8Array(F);for(let p=0,d=0;p<H.length;p++){const m=H[p];D.set(m,d),d+=m.length}return D}class L{clone(){return this._cloneInto()}}e.Hash=L;function W(H,F){if(F!==void 0&&{}.toString.call(F)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(H,F)}function q(H){const F=p=>H().update(N(p)).digest(),D=H();return F.outputLen=D.outputLen,F.blockLen=D.blockLen,F.create=()=>H(),F}function X(H){const F=(p,d)=>H(d).update(N(p)).digest(),D=H({});return F.outputLen=D.outputLen,F.blockLen=D.blockLen,F.create=p=>H(p),F}function re(H){const F=(p,d)=>H(d).update(N(p)).digest(),D=H({});return F.outputLen=D.outputLen,F.blockLen=D.blockLen,F.create=p=>H(p),F}function oe(H=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(H));if(t.crypto&&typeof t.crypto.randomBytes=="function")return t.crypto.randomBytes(H);throw new Error("crypto.getRandomValues must be defined")}})(Th);Object.defineProperty(Io,"__esModule",{value:!0});Io.BLAKE=Io.SIGMA=void 0;const Qs=kn,br=Th;Io.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class nE extends br.Hash{constructor(t,r,n={},i,s,o){if(super(),this.blockLen=t,this.outputLen=r,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,(0,Qs.anumber)(t),(0,Qs.anumber)(r),(0,Qs.anumber)(i),r<0||r>i)throw new Error("outputLen bigger than keyLen");if(n.key!==void 0&&(n.key.length<1||n.key.length>i))throw new Error("key length must be undefined or 1.."+i);if(n.salt!==void 0&&n.salt.length!==s)throw new Error("salt must be undefined or "+s);if(n.personalization!==void 0&&n.personalization.length!==o)throw new Error("personalization must be undefined or "+o);this.buffer=new Uint8Array(t),this.buffer32=(0,br.u32)(this.buffer)}update(t){(0,Qs.aexists)(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=(0,br.toBytes)(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(br.isLE||(0,br.byteSwap32)(i),this.compress(i,0,!1),br.isLE||(0,br.byteSwap32)(i),this.pos=0);const u=Math.min(r-this.pos,s-c),l=o+c;if(u===r&&!(l%4)&&c+u<s){const f=new Uint32Array(a,l,Math.floor((s-c)/4));br.isLE||(0,br.byteSwap32)(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);br.isLE||(0,br.byteSwap32)(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){(0,Qs.aexists)(this),(0,Qs.aoutput)(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),br.isLE||(0,br.byteSwap32)(n),this.compress(n,0,!0),br.isLE||(0,br.byteSwap32)(n);const i=(0,br.u32)(t);this.get().forEach((s,o)=>i[o]=(0,br.byteSwapIfBE)(s))}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){const{buffer:r,length:n,finished:i,destroyed:s,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.length=n,t.finished=i,t.destroyed=s,t.outputLen=o,t.buffer.set(r),t.pos=a,t}}Io.BLAKE=nE;var ft={};Object.defineProperty(ft,"__esModule",{value:!0});ft.add5L=ft.add5H=ft.add4H=ft.add4L=ft.add3H=ft.add3L=ft.rotlBL=ft.rotlBH=ft.rotlSL=ft.rotlSH=ft.rotr32L=ft.rotr32H=ft.rotrBL=ft.rotrBH=ft.rotrSL=ft.rotrSH=ft.shrSL=ft.shrSH=ft.toBig=void 0;ft.fromBig=Oh;ft.split=g1;ft.add=I1;const Ic=BigInt(2**32-1),bd=BigInt(32);function Oh(e,t=!1){return t?{h:Number(e&Ic),l:Number(e>>bd&Ic)}:{h:Number(e>>bd&Ic)|0,l:Number(e&Ic)|0}}function g1(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}=Oh(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const v1=(e,t)=>BigInt(e>>>0)<<bd|BigInt(t>>>0);ft.toBig=v1;const y1=(e,t,r)=>e>>>r;ft.shrSH=y1;const b1=(e,t,r)=>e<<32-r|t>>>r;ft.shrSL=b1;const w1=(e,t,r)=>e>>>r|t<<32-r;ft.rotrSH=w1;const _1=(e,t,r)=>e<<32-r|t>>>r;ft.rotrSL=_1;const x1=(e,t,r)=>e<<64-r|t>>>r-32;ft.rotrBH=x1;const S1=(e,t,r)=>e>>>r-32|t<<64-r;ft.rotrBL=S1;const E1=(e,t)=>t;ft.rotr32H=E1;const C1=(e,t)=>e;ft.rotr32L=C1;const A1=(e,t,r)=>e<<r|t>>>32-r;ft.rotlSH=A1;const M1=(e,t,r)=>t<<r|e>>>32-r;ft.rotlSL=M1;const T1=(e,t,r)=>t<<r-32|e>>>64-r;ft.rotlBH=T1;const O1=(e,t,r)=>e<<r-32|t>>>64-r;ft.rotlBL=O1;function I1(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const P1=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);ft.add3L=P1;const k1=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;ft.add3H=k1;const j1=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);ft.add4L=j1;const R1=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;ft.add4H=R1;const N1=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ft.add5L=N1;const D1=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;ft.add5H=D1;const iE={fromBig:Oh,split:g1,toBig:v1,shrSH:y1,shrSL:b1,rotrSH:w1,rotrSL:_1,rotrBH:x1,rotrBL:S1,rotr32H:E1,rotr32L:C1,rotlSH:A1,rotlSL:M1,rotlBH:T1,rotlBL:O1,add:I1,add3L:P1,add3H:k1,add4L:j1,add4H:R1,add5H:D1,add5L:N1};ft.default=iE;Object.defineProperty(zs,"__esModule",{value:!0});zs.blake2b=zs.BLAKE2b=void 0;const X0=Io,jr=ft,Ur=Th,ur=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Ie=new Uint32Array(32);function Di(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],f=Ie[2*t+1],h=Ie[2*r],y=Ie[2*r+1],b=Ie[2*n],w=Ie[2*n+1],T=jr.default.add3L(c,l,o);u=jr.default.add3H(T,u,f,a),c=T|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:jr.default.rotr32H(w,b),Dl:jr.default.rotr32L(w,b)},{h:y,l:h}=jr.default.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:jr.default.rotrSH(f,l,24),Bl:jr.default.rotrSL(f,l,24)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=f,Ie[2*r]=h,Ie[2*r+1]=y,Ie[2*n]=b,Ie[2*n+1]=w}function $i(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],f=Ie[2*t+1],h=Ie[2*r],y=Ie[2*r+1],b=Ie[2*n],w=Ie[2*n+1],T=jr.default.add3L(c,l,o);u=jr.default.add3H(T,u,f,a),c=T|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:jr.default.rotrSH(w,b,16),Dl:jr.default.rotrSL(w,b,16)},{h:y,l:h}=jr.default.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:jr.default.rotrBH(f,l,63),Bl:jr.default.rotrBL(f,l,63)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=f,Ie[2*r]=h,Ie[2*r+1]=y,Ie[2*n]=b,Ie[2*n+1]=w}class $1 extends X0.BLAKE{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=ur[0]|0,this.v0h=ur[1]|0,this.v1l=ur[2]|0,this.v1h=ur[3]|0,this.v2l=ur[4]|0,this.v2h=ur[5]|0,this.v3l=ur[6]|0,this.v3h=ur[7]|0,this.v4l=ur[8]|0,this.v4h=ur[9]|0,this.v5l=ur[10]|0,this.v5h=ur[11]|0,this.v6l=ur[12]|0,this.v6h=ur[13]|0,this.v7l=ur[14]|0,this.v7h=ur[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=(0,Ur.u32)((0,Ur.toBytes)(t.salt));this.v4l^=(0,Ur.byteSwapIfBE)(n[0]),this.v4h^=(0,Ur.byteSwapIfBE)(n[1]),this.v5l^=(0,Ur.byteSwapIfBE)(n[2]),this.v5h^=(0,Ur.byteSwapIfBE)(n[3])}if(t.personalization){const n=(0,Ur.u32)((0,Ur.toBytes)(t.personalization));this.v6l^=(0,Ur.byteSwapIfBE)(n[0]),this.v6h^=(0,Ur.byteSwapIfBE)(n[1]),this.v7l^=(0,Ur.byteSwapIfBE)(n[2]),this.v7h^=(0,Ur.byteSwapIfBE)(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set((0,Ur.toBytes)(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:s,v2h:o,v3l:a,v3h:c,v4l:u,v4h:l,v5l:f,v5h:h,v6l:y,v6h:b,v7l:w,v7h:T}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,T]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,T){this.v0l=t|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=f|0,this.v5h=h|0,this.v6l=y|0,this.v6h=b|0,this.v7l=w|0,this.v7h=T|0}compress(t,r,n){this.get().forEach((c,u)=>Ie[u]=c),Ie.set(ur,16);let{h:i,l:s}=jr.default.fromBig(BigInt(this.length));Ie[24]=ur[8]^s,Ie[25]=ur[9]^i,n&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]);let o=0;const a=X0.SIGMA;for(let c=0;c<12;c++)Di(0,4,8,12,t,r+2*a[o++]),$i(0,4,8,12,t,r+2*a[o++]),Di(1,5,9,13,t,r+2*a[o++]),$i(1,5,9,13,t,r+2*a[o++]),Di(2,6,10,14,t,r+2*a[o++]),$i(2,6,10,14,t,r+2*a[o++]),Di(3,7,11,15,t,r+2*a[o++]),$i(3,7,11,15,t,r+2*a[o++]),Di(0,5,10,15,t,r+2*a[o++]),$i(0,5,10,15,t,r+2*a[o++]),Di(1,6,11,12,t,r+2*a[o++]),$i(1,6,11,12,t,r+2*a[o++]),Di(2,7,8,13,t,r+2*a[o++]),$i(2,7,8,13,t,r+2*a[o++]),Di(3,4,9,14,t,r+2*a[o++]),$i(3,4,9,14,t,r+2*a[o++]);this.v0l^=Ie[0]^Ie[16],this.v0h^=Ie[1]^Ie[17],this.v1l^=Ie[2]^Ie[18],this.v1h^=Ie[3]^Ie[19],this.v2l^=Ie[4]^Ie[20],this.v2h^=Ie[5]^Ie[21],this.v3l^=Ie[6]^Ie[22],this.v3h^=Ie[7]^Ie[23],this.v4l^=Ie[8]^Ie[24],this.v4h^=Ie[9]^Ie[25],this.v5l^=Ie[10]^Ie[26],this.v5h^=Ie[11]^Ie[27],this.v6l^=Ie[12]^Ie[28],this.v6h^=Ie[13]^Ie[29],this.v7l^=Ie[14]^Ie[30],this.v7h^=Ie[15]^Ie[31],Ie.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}zs.BLAKE2b=$1;zs.blake2b=(0,Ur.wrapConstructorWithOpts)(e=>new $1(e));var Ih=Object.defineProperty,sE=Object.getOwnPropertyDescriptor,oE=Object.getOwnPropertyNames,aE=Object.prototype.hasOwnProperty,cE=(e,t)=>{for(var r in t)Ih(e,r,{get:t[r],enumerable:!0})},uE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oE(t))!aE.call(e,i)&&i!==r&&Ih(e,i,{get:()=>t[i],enumerable:!(n=sE(t,i))||n.enumerable});return e},lE=e=>uE(Ih({},"__esModule",{value:!0}),e),B1={};cE(B1,{BIC_REGEX:()=>F1,CUID2_REGEX:()=>U1,DECIMAL_REGEX:()=>z1,EMAIL_REGEX:()=>V1,EMOJI_REGEX:()=>q1,HEXADECIMAL_REGEX:()=>H1,HEX_COLOR_REGEX:()=>W1,IMEI_REGEX:()=>G1,IPV4_REGEX:()=>K1,IPV6_REGEX:()=>X1,IP_REGEX:()=>J1,ISO_DATE_REGEX:()=>Y1,ISO_DATE_TIME_REGEX:()=>Z1,ISO_TIMESTAMP_REGEX:()=>ty,ISO_TIME_REGEX:()=>Q1,ISO_TIME_SECOND_REGEX:()=>ey,ISO_WEEK_REGEX:()=>ry,MAC48_REGEX:()=>ny,MAC64_REGEX:()=>iy,MAC_REGEX:()=>sy,OCTAL_REGEX:()=>oy,ULID_REGEX:()=>ay,UUID_REGEX:()=>cy,ValiError:()=>al,_addIssue:()=>ue,_isLuhnAlgo:()=>Ph,_isValidObjectKey:()=>Gs,_stringify:()=>Br,any:()=>zb,array:()=>Vb,arrayAsync:()=>qb,awaitAsync:()=>L1,bic:()=>hy,bigint:()=>Hb,blob:()=>Wb,boolean:()=>Gb,brand:()=>py,bytes:()=>my,check:()=>gy,checkAsync:()=>vy,checkItems:()=>yy,config:()=>TE,creditCard:()=>by,cuid2:()=>wy,custom:()=>Kb,customAsync:()=>Xb,date:()=>Jb,decimal:()=>_y,deleteGlobalConfig:()=>dE,deleteGlobalMessage:()=>pE,deleteSchemaMessage:()=>gE,deleteSpecificMessage:()=>yE,email:()=>xy,emoji:()=>Sy,empty:()=>Ey,endsWith:()=>Cy,entriesFromList:()=>wE,enum:()=>Ed,enum_:()=>Ed,everyItem:()=>Ay,excludes:()=>My,fallback:()=>OE,fallbackAsync:()=>IE,file:()=>Yb,filterItems:()=>Ty,findItem:()=>Oy,finite:()=>Iy,flatten:()=>PE,forward:()=>kE,forwardAsync:()=>jE,function:()=>Cd,function_:()=>Cd,getDefault:()=>ki,getDefaults:()=>wd,getDefaultsAsync:()=>_d,getDotPath:()=>dy,getFallback:()=>fc,getFallbacks:()=>xd,getFallbacksAsync:()=>Sd,getGlobalConfig:()=>lc,getGlobalMessage:()=>uy,getSchemaMessage:()=>ly,getSpecificMessage:()=>fy,hash:()=>Py,hexColor:()=>jy,hexadecimal:()=>ky,imei:()=>Ry,includes:()=>Ny,instance:()=>Zb,integer:()=>Dy,intersect:()=>Qb,intersectAsync:()=>ew,ip:()=>$y,ipv4:()=>By,ipv6:()=>Ly,is:()=>RE,isOfKind:()=>_E,isOfType:()=>xE,isValiError:()=>SE,isoDate:()=>Fy,isoDateTime:()=>Uy,isoTime:()=>zy,isoTimeSecond:()=>Vy,isoTimestamp:()=>qy,isoWeek:()=>Hy,keyof:()=>NE,lazy:()=>tw,lazyAsync:()=>rw,length:()=>Wy,literal:()=>nw,looseObject:()=>iw,looseObjectAsync:()=>sw,looseTuple:()=>ow,looseTupleAsync:()=>aw,mac:()=>Gy,mac48:()=>Ky,mac64:()=>Xy,map:()=>cw,mapAsync:()=>uw,mapItems:()=>Jy,maxBytes:()=>Yy,maxLength:()=>Zy,maxSize:()=>Qy,maxValue:()=>eb,mimeType:()=>tb,minBytes:()=>rb,minLength:()=>nb,minSize:()=>ib,minValue:()=>sb,multipleOf:()=>ob,nan:()=>lw,never:()=>fw,nonEmpty:()=>ab,nonNullable:()=>dw,nonNullableAsync:()=>hw,nonNullish:()=>pw,nonNullishAsync:()=>mw,nonOptional:()=>kh,nonOptionalAsync:()=>jh,normalize:()=>cb,notBytes:()=>ub,notLength:()=>lb,notSize:()=>fb,notValue:()=>db,null:()=>Ad,null_:()=>Ad,nullable:()=>gw,nullableAsync:()=>vw,nullish:()=>yw,nullishAsync:()=>bw,number:()=>ww,object:()=>_w,objectAsync:()=>xw,objectWithRest:()=>Sw,objectWithRestAsync:()=>Ew,octal:()=>hb,omit:()=>DE,optional:()=>Rh,optionalAsync:()=>Nh,parse:()=>Hw,parseAsync:()=>Ww,parser:()=>$E,parserAsync:()=>BE,partial:()=>LE,partialAsync:()=>FE,partialCheck:()=>mb,partialCheckAsync:()=>gb,pick:()=>UE,picklist:()=>Dh,pipe:()=>zE,pipeAsync:()=>VE,promise:()=>Cw,rawCheck:()=>vb,rawCheckAsync:()=>yb,rawTransform:()=>bb,rawTransformAsync:()=>wb,readonly:()=>_b,record:()=>Aw,recordAsync:()=>Mw,reduceItems:()=>xb,regex:()=>Sb,required:()=>qE,requiredAsync:()=>HE,safeInteger:()=>Eb,safeParse:()=>Gw,safeParseAsync:()=>Kw,safeParser:()=>WE,safeParserAsync:()=>GE,set:()=>Tw,setAsync:()=>Ow,setGlobalConfig:()=>fE,setGlobalMessage:()=>hE,setSchemaMessage:()=>mE,setSpecificMessage:()=>vE,size:()=>Cb,someItem:()=>Ab,sortItems:()=>Mb,startsWith:()=>Tb,strictObject:()=>Iw,strictObjectAsync:()=>Pw,strictTuple:()=>kw,strictTupleAsync:()=>jw,string:()=>Rw,symbol:()=>Nw,toLowerCase:()=>Ob,toMaxValue:()=>Ib,toMinValue:()=>Pb,toUpperCase:()=>kb,transform:()=>jb,transformAsync:()=>Rb,trim:()=>Nb,trimEnd:()=>Db,trimStart:()=>$b,tuple:()=>Dw,tupleAsync:()=>$w,tupleWithRest:()=>Bw,tupleWithRestAsync:()=>Lw,ulid:()=>Bb,undefined:()=>Md,undefined_:()=>Md,union:()=>Fw,unionAsync:()=>Uw,unknown:()=>zw,unwrap:()=>KE,url:()=>Lb,uuid:()=>Fb,value:()=>Ub,variant:()=>Vw,variantAsync:()=>qw,void:()=>Td,void_:()=>Td});var ls=lE(B1);function L1(){return{kind:"transformation",type:"await",reference:L1,async:!0,async _run(e){return e.value=await e.value,e}}}var F1=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,U1=/^[a-z][\da-z]*$/u,z1=/^\d+$/u,V1=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,q1=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,H1=/^(?:0h|0x)?[\da-f]+$/iu,W1=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,G1=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,K1=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,X1=/^(?:(?:[\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,J1=/^(?:(?:[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,Y1=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,Z1=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3]):[0-5]\d$/u,Q1=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,ey=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,ty=/^\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,ry=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,ny=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,iy=/^(?:[\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,sy=/^(?:[\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,oy=/^(?:0o)?[0-7]+$/iu,ay=/^[\da-hjkmnp-tv-z]{26}$/iu,cy=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,en;function fE(e){en={...en,...e}}function lc(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 dE(){en=void 0}var Ei;function hE(e,t){Ei||(Ei=new Map),Ei.set(t,e)}function uy(e){return Ei==null?void 0:Ei.get(e)}function pE(e){Ei==null||Ei.delete(e)}var Ci;function mE(e,t){Ci||(Ci=new Map),Ci.set(t,e)}function ly(e){return Ci==null?void 0:Ci.get(e)}function gE(e){Ci==null||Ci.delete(e)}var xn;function vE(e,t,r){xn||(xn=new Map),xn.get(e)||xn.set(e,new Map),xn.get(e).set(r,t)}function fy(e,t){var r;return(r=xn==null?void 0:xn.get(e))==null?void 0:r.get(t)}function yE(e,t){var r;(r=xn==null?void 0:xn.get(e))==null||r.delete(t)}function Br(e){var r,n;const t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&((n=(r=Object.getPrototypeOf(e))==null?void 0:r.constructor)==null?void 0:n.name))??"null":t}function ue(e,t,r,n,i){const s=i&&"input"in i?i.input:r.value,o=(i==null?void 0:i.expected)??e.expects??null,a=(i==null?void 0:i.received)??Br(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??fy(e.reference,c.lang)??(u?ly(c.lang):null)??n.message??uy(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 bE=/\D/gu;function Ph(e){const t=e.replace(bE,"");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 Gs(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function wE(e,t){const r={};for(const n of e)r[n]=t;return r}function dy(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 _E(e,t){return t.kind===e}function xE(e,t){return t.type===e}function SE(e){return e instanceof al}var al=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function hy(e){return{kind:"validation",type:"bic",reference:hy,async:!1,expects:null,requirement:F1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"BIC",t,r),t}}}function py(e){return{kind:"transformation",type:"brand",reference:py,async:!1,name:e,_run(t){return t}}}function my(e,t){return{kind:"validation",type:"bytes",reference:my,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i!==this.requirement&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function gy(e,t){return{kind:"validation",type:"check",reference:gy,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&ue(this,"input",r,n),r}}}function vy(e,t){return{kind:"validation",type:"check",reference:vy,async:!0,expects:null,requirement:e,message:t,async _run(r,n){return r.typed&&!await this.requirement(r.value)&&ue(this,"input",r,n),r}}}function yy(e,t){return{kind:"validation",type:"check_items",reference:yy,async:!1,expects:null,requirement:e,message:t,_run(r,n){if(r.typed)for(let i=0;i<r.value.length;i++){const s=r.value[i];this.requirement(s,i,r.value)||ue(this,"item",r,n,{input:s,path:[{type:"array",origin:"value",input:r.value,key:i,value:s}]})}return r}}}var EE=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,CE=/[- ]/gu,AE=[/^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 by(e){return{kind:"validation",type:"credit_card",reference:by,async:!1,expects:null,requirement(t){let r;return EE.test(t)&&(r=t.replace(CE,""))&&AE.some(n=>n.test(r))&&Ph(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"credit card",t,r),t}}}function wy(e){return{kind:"validation",type:"cuid2",reference:wy,async:!1,expects:null,requirement:U1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"Cuid2",t,r),t}}}function _y(e){return{kind:"validation",type:"decimal",reference:_y,async:!1,expects:null,requirement:z1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"decimal",t,r),t}}}function xy(e){return{kind:"validation",type:"email",reference:xy,expects:null,async:!1,requirement:V1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"email",t,r),t}}}function Sy(e){return{kind:"validation",type:"emoji",reference:Sy,async:!1,expects:null,requirement:q1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"emoji",t,r),t}}}function Ey(e){return{kind:"validation",type:"empty",reference:Ey,async:!1,expects:"0",message:e,_run(t,r){return t.typed&&t.value.length>0&&ue(this,"length",t,r,{received:`${t.value.length}`}),t}}}function Cy(e,t){return{kind:"validation",type:"ends_with",reference:Cy,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.endsWith(this.requirement)&&ue(this,"end",r,n,{received:`"${r.value.slice(-this.requirement.length)}"`}),r}}}function Ay(e,t){return{kind:"validation",type:"every_item",reference:Ay,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.every(this.requirement)&&ue(this,"item",r,n),r}}}function My(e,t){const r=Br(e);return{kind:"validation",type:"excludes",reference:My,async:!1,expects:`!${r}`,requirement:e,message:t,_run(n,i){return n.typed&&n.value.includes(this.requirement)&&ue(this,"content",n,i,{received:r}),n}}}function Ty(e){return{kind:"transformation",type:"filter_items",reference:Ty,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function Oy(e){return{kind:"transformation",type:"find_item",reference:Oy,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function Iy(e){return{kind:"validation",type:"finite",reference:Iy,async:!1,expects:null,requirement:Number.isFinite,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"finite",t,r),t}}}var ME={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 Py(e,t){return{kind:"validation",type:"hash",reference:Py,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${ME[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&ue(this,"hash",r,n),r}}}function ky(e){return{kind:"validation",type:"hexadecimal",reference:ky,async:!1,expects:null,requirement:H1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"hexadecimal",t,r),t}}}function jy(e){return{kind:"validation",type:"hex_color",reference:jy,async:!1,expects:null,requirement:W1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"hex color",t,r),t}}}function Ry(e){return{kind:"validation",type:"imei",reference:Ry,async:!1,expects:null,requirement(t){return G1.test(t)&&Ph(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"IMEI",t,r),t}}}function Ny(e,t){const r=Br(e);return{kind:"validation",type:"includes",reference:Ny,async:!1,expects:r,requirement:e,message:t,_run(n,i){return n.typed&&!n.value.includes(this.requirement)&&ue(this,"content",n,i,{received:`!${r}`}),n}}}function Dy(e){return{kind:"validation",type:"integer",reference:Dy,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"integer",t,r),t}}}function $y(e){return{kind:"validation",type:"ip",reference:$y,async:!1,expects:null,requirement:J1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"IP",t,r),t}}}function By(e){return{kind:"validation",type:"ipv4",reference:By,async:!1,expects:null,requirement:K1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"IPv4",t,r),t}}}function Ly(e){return{kind:"validation",type:"ipv6",reference:Ly,async:!1,expects:null,requirement:X1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"IPv6",t,r),t}}}function Fy(e){return{kind:"validation",type:"iso_date",reference:Fy,async:!1,expects:null,requirement:Y1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"date",t,r),t}}}function Uy(e){return{kind:"validation",type:"iso_date_time",reference:Uy,async:!1,expects:null,requirement:Z1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"date-time",t,r),t}}}function zy(e){return{kind:"validation",type:"iso_time",reference:zy,async:!1,expects:null,requirement:Q1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"time",t,r),t}}}function Vy(e){return{kind:"validation",type:"iso_time_second",reference:Vy,async:!1,expects:null,requirement:ey,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"time-second",t,r),t}}}function qy(e){return{kind:"validation",type:"iso_timestamp",reference:qy,async:!1,expects:null,requirement:ty,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"timestamp",t,r),t}}}function Hy(e){return{kind:"validation",type:"iso_week",reference:Hy,async:!1,expects:null,requirement:ry,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"week",t,r),t}}}function Wy(e,t){return{kind:"validation",type:"length",reference:Wy,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length!==this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Gy(e){return{kind:"validation",type:"mac",reference:Gy,async:!1,expects:null,requirement:sy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"MAC",t,r),t}}}function Ky(e){return{kind:"validation",type:"mac48",reference:Ky,async:!1,expects:null,requirement:ny,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"48-bit MAC",t,r),t}}}function Xy(e){return{kind:"validation",type:"mac64",reference:Xy,async:!1,expects:null,requirement:iy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"64-bit MAC",t,r),t}}}function Jy(e){return{kind:"transformation",type:"map_items",reference:Jy,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function Yy(e,t){return{kind:"validation",type:"max_bytes",reference:Yy,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i>this.requirement&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function Zy(e,t){return{kind:"validation",type:"max_length",reference:Zy,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length>this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Qy(e,t){return{kind:"validation",type:"max_size",reference:Qy,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size>this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function eb(e,t){return{kind:"validation",type:"max_value",reference:eb,async:!1,expects:`<=${e instanceof Date?e.toJSON():Br(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value>this.requirement&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Br(r.value)}),r}}}function tb(e,t){return{kind:"validation",type:"mime_type",reference:tb,async:!1,expects:e.map(r=>`"${r}"`).join(" | ")||"never",requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.includes(r.value.type)&&ue(this,"MIME type",r,n,{received:`"${r.value.type}"`}),r}}}function rb(e,t){return{kind:"validation",type:"min_bytes",reference:rb,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i<this.requirement&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function nb(e,t){return{kind:"validation",type:"min_length",reference:nb,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length<this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function ib(e,t){return{kind:"validation",type:"min_size",reference:ib,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size<this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function sb(e,t){return{kind:"validation",type:"min_value",reference:sb,async:!1,expects:`>=${e instanceof Date?e.toJSON():Br(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value<this.requirement&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Br(r.value)}),r}}}function ob(e,t){return{kind:"validation",type:"multiple_of",reference:ob,async:!1,expects:`%${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value%this.requirement!==0&&ue(this,"multiple",r,n),r}}}function ab(e){return{kind:"validation",type:"non_empty",reference:ab,async:!1,expects:"!0",message:e,_run(t,r){return t.typed&&t.value.length===0&&ue(this,"length",t,r,{received:"0"}),t}}}function cb(e){return{kind:"transformation",type:"normalize",reference:cb,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function ub(e,t){return{kind:"validation",type:"not_bytes",reference:ub,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i===this.requirement&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function lb(e,t){return{kind:"validation",type:"not_length",reference:lb,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length===this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function fb(e,t){return{kind:"validation",type:"not_size",reference:fb,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size===this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function db(e,t){return{kind:"validation",type:"not_value",reference:db,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Br(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&this.requirement<=r.value&&this.requirement>=r.value&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Br(r.value)}),r}}}function hb(e){return{kind:"validation",type:"octal",reference:hb,async:!1,expects:null,requirement:oy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"octal",t,r),t}}}function pb(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 mb(e,t,r){return{kind:"validation",type:"partial_check",reference:mb,async:!1,expects:null,requirement:t,message:r,_run(n,i){return pb(n,e)&&!this.requirement(n.value)&&ue(this,"input",n,i),n}}}function gb(e,t,r){return{kind:"validation",type:"partial_check",reference:gb,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return pb(n,e)&&!await this.requirement(n.value)&&ue(this,"input",n,i),n}}}function vb(e){return{kind:"validation",type:"raw_check",reference:vb,async:!1,expects:null,_run(t,r){return e({dataset:t,config:r,addIssue:n=>ue(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function yb(e){return{kind:"validation",type:"raw_check",reference:yb,async:!0,expects:null,async _run(t,r){return await e({dataset:t,config:r,addIssue:n=>ue(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function bb(e){return{kind:"transformation",type:"raw_transform",reference:bb,async:!1,_run(t,r){const n=e({dataset:t,config:r,addIssue:i=>ue(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function wb(e){return{kind:"transformation",type:"raw_transform",reference:wb,async:!0,async _run(t,r){const n=await e({dataset:t,config:r,addIssue:i=>ue(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function _b(){return{kind:"transformation",type:"readonly",reference:_b,async:!1,_run(e){return e}}}function xb(e,t){return{kind:"transformation",type:"reduce_items",reference:xb,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function Sb(e,t){return{kind:"validation",type:"regex",reference:Sb,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&ue(this,"format",r,n),r}}}function Eb(e){return{kind:"validation",type:"safe_integer",reference:Eb,async:!1,expects:null,requirement:Number.isSafeInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"safe integer",t,r),t}}}function Cb(e,t){return{kind:"validation",type:"size",reference:Cb,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size!==this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Ab(e,t){return{kind:"validation",type:"some_item",reference:Ab,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.some(this.requirement)&&ue(this,"item",r,n),r}}}function Mb(e){return{kind:"transformation",type:"sort_items",reference:Mb,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function Tb(e,t){return{kind:"validation",type:"starts_with",reference:Tb,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.startsWith(this.requirement)&&ue(this,"start",r,n,{received:`"${r.value.slice(0,this.requirement.length)}"`}),r}}}function Ob(){return{kind:"transformation",type:"to_lower_case",reference:Ob,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function Ib(e){return{kind:"transformation",type:"to_max_value",reference:Ib,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function Pb(e){return{kind:"transformation",type:"to_min_value",reference:Pb,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function kb(){return{kind:"transformation",type:"to_upper_case",reference:kb,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function jb(e){return{kind:"transformation",type:"transform",reference:jb,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function Rb(e){return{kind:"transformation",type:"transform",reference:Rb,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function Nb(){return{kind:"transformation",type:"trim",reference:Nb,async:!1,_run(e){return e.value=e.value.trim(),e}}}function Db(){return{kind:"transformation",type:"trim_end",reference:Db,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function $b(){return{kind:"transformation",type:"trim_start",reference:$b,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function Bb(e){return{kind:"validation",type:"ulid",reference:Bb,async:!1,expects:null,requirement:ay,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"ULID",t,r),t}}}function Lb(e){return{kind:"validation",type:"url",reference:Lb,async:!1,expects:null,requirement(t){try{return new URL(t),!0}catch{return!1}},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"URL",t,r),t}}}function Fb(e){return{kind:"validation",type:"uuid",reference:Fb,async:!1,expects:null,requirement:cy,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"UUID",t,r),t}}}function Ub(e,t){return{kind:"validation",type:"value",reference:Ub,async:!1,expects:e instanceof Date?e.toJSON():Br(e),requirement:e,message:t,_run(r,n){return r.typed&&!(this.requirement<=r.value&&this.requirement>=r.value)&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Br(r.value)}),r}}}function TE(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function fc(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function OE(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:fc(this,r,n)}:r}}}function IE(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await fc(this,r,n)}:r}}}function PE(e){const t={};for(const r of e)if(r.path){const n=dy(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 kE(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 jE(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 ki(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function wd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=wd(e.entries[r]);return t}return"items"in e?e.items.map(wd):ki(e)}async function _d(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await _d(r)]))):"items"in e?Promise.all(e.items.map(_d)):ki(e)}function xd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=xd(e.entries[r]);return t}return"items"in e?e.items.map(xd):fc(e)}async function Sd(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Sd(r)]))):"items"in e?Promise.all(e.items.map(Sd)):fc(e)}function RE(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function zb(){return{kind:"schema",type:"any",reference:zb,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function Vb(e,t){return{kind:"schema",type:"array",reference:Vb,expects:"Array",async:!1,item:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<i.length;o++){const a=i[o],c=this.item._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else ue(this,"type",r,n);return r}}}function qb(e,t){return{kind:"schema",type:"array",reference:qb,expects:"Array",async:!0,item:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(i.map(a=>this.item._run({typed:!1,value:a},n)));for(let a=0;a<o.length;a++){const c=o[a];if(c.issues){const u={type:"array",origin:"value",input:i,key:a,value:i[a]};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else ue(this,"type",r,n);return r}}}function Hb(e){return{kind:"schema",type:"bigint",reference:Hb,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:ue(this,"type",t,r),t}}}function Wb(e){return{kind:"schema",type:"blob",reference:Wb,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:ue(this,"type",t,r),t}}}function Gb(e){return{kind:"schema",type:"boolean",reference:Gb,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:ue(this,"type",t,r),t}}}function Kb(e,t){return{kind:"schema",type:"custom",reference:Kb,expects:"unknown",async:!1,check:e,message:t,_run(r,n){return this.check(r.value)?r.typed=!0:ue(this,"type",r,n),r}}}function Xb(e,t){return{kind:"schema",type:"custom",reference:Xb,expects:"unknown",async:!0,check:e,message:t,async _run(r,n){return await this.check(r.value)?r.typed=!0:ue(this,"type",r,n),r}}}function Jb(e){return{kind:"schema",type:"date",reference:Jb,expects:"Date",async:!1,message:e,_run(t,r){return t.value instanceof Date?isNaN(t.value)?ue(this,"type",t,r,{received:'"Invalid Date"'}):t.typed=!0:ue(this,"type",t,r),t}}}function Ed(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:Ed,expects:r.map(Br).join(" | ")||"never",async:!1,enum:e,options:r,message:t,_run(n,i){return this.options.includes(n.value)?n.typed=!0:ue(this,"type",n,i),n}}}function Yb(e){return{kind:"schema",type:"file",reference:Yb,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:ue(this,"type",t,r),t}}}function Cd(e){return{kind:"schema",type:"function",reference:Cd,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:ue(this,"type",t,r),t}}}function Zb(e,t){return{kind:"schema",type:"instance",reference:Zb,expects:e.name,async:!1,class:e,message:t,_run(r,n){return r.value instanceof this.class?r.typed=!0:ue(this,"type",r,n),r}}}function _u(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=_u(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=_u(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function Qb(e,t){return{kind:"schema",type:"intersect",reference:Qb,expects:[...new Set(e.map(r=>r.expects))].join(" & ")||"never",async:!1,options:e,message:t,_run(r,n){if(this.options.length){const i=r.value;let s;r.typed=!0;for(const o of this.options){const a=o._run({typed:!1,value:i},n);if(a.issues&&(r.issues?r.issues.push(...a.issues):r.issues=a.issues,n.abortEarly)){r.typed=!1;break}a.typed||(r.typed=!1),r.typed&&(s?s.push(a.value):s=[a.value])}if(r.typed){r.value=s[0];for(let o=1;o<s.length;o++){const a=_u(r.value,s[o]);if(a.issue){ue(this,"type",r,n,{received:"unknown"});break}r.value=a.value}}}else ue(this,"type",r,n);return r}}}function ew(e,t){return{kind:"schema",type:"intersect",reference:ew,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=_u(r.value,s[a]);if(c.issue){ue(this,"type",r,n,{received:"unknown"});break}r.value=c.value}}}else ue(this,"type",r,n);return r}}}function tw(e){return{kind:"schema",type:"lazy",reference:tw,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function rw(e){return{kind:"schema",type:"lazy",reference:rw,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function nw(e,t){return{kind:"schema",type:"literal",reference:nw,expects:Br(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:ue(this,"type",r,n),r}}}function iw(e,t){return{kind:"schema",type:"loose_object",reference:iw,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)Gs(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else ue(this,"type",r,n);return r}}}function sw(e,t){return{kind:"schema",type:"loose_object",reference:sw,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)Gs(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else ue(this,"type",r,n);return r}}}function ow(e,t){return{kind:"schema",type:"loose_tuple",reference:ow,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}if(!r.issues||!n.abortEarly)for(let o=this.items.length;o<i.length;o++)r.value.push(i[o])}else ue(this,"type",r,n);return r}}}function aw(e,t){return{kind:"schema",type:"loose_tuple",reference:aw,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!r.issues||!n.abortEarly)for(let a=this.items.length;a<i.length;a++)r.value.push(i[a])}else ue(this,"type",r,n);return r}}}function cw(e,t,r){return{kind:"schema",type:"map",reference:cw,expects:"Map",async:!1,key:e,value:t,message:r,_run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;for(const[c,u]of s){const l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"map",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path?y.path.unshift(h):y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"map",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),n.value.set(l.value,f.value)}}else ue(this,"type",n,i);return n}}}function uw(e,t,r){return{kind:"schema",type:"map",reference:uw,expects:"Map",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;const c=await Promise.all([...s].map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"map",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"map",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),n.value.set(f.value,h.value)}}else ue(this,"type",n,i);return n}}}function lw(e){return{kind:"schema",type:"nan",reference:lw,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:ue(this,"type",t,r),t}}}function fw(e){return{kind:"schema",type:"never",reference:fw,expects:"never",async:!1,message:e,_run(t,r){return ue(this,"type",t,r),t}}}function dw(e,t){return{kind:"schema",type:"non_nullable",reference:dw,expects:"!null",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function hw(e,t){return{kind:"schema",type:"non_nullable",reference:hw,expects:"!null",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function pw(e,t){return{kind:"schema",type:"non_nullish",reference:pw,expects:"!null & !undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null||r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function mw(e,t){return{kind:"schema",type:"non_nullish",reference:mw,expects:"!null & !undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null||r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function kh(e,t){return{kind:"schema",type:"non_optional",reference:kh,expects:"!undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function jh(e,t){return{kind:"schema",type:"non_optional",reference:jh,expects:"!undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function Ad(e){return{kind:"schema",type:"null",reference:Ad,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:ue(this,"type",t,r),t}}}function gw(e,...t){const r={kind:"schema",type:"nullable",reference:gw,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=ki(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 vw(e,...t){const r={kind:"schema",type:"nullable",reference:vw,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await ki(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 yw(e,...t){const r={kind:"schema",type:"nullish",reference:yw,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=ki(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 bw(e,...t){const r={kind:"schema",type:"nullish",reference:bw,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 ki(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 ww(e){return{kind:"schema",type:"number",reference:ww,expects:"number",async:!1,message:e,_run(t,r){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:ue(this,"type",t,r),t}}}function _w(e,t){return{kind:"schema",type:"object",reference:_w,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}}else ue(this,"type",r,n);return r}}}function xw(e,t){return{kind:"schema",type:"object",reference:xw,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}}else ue(this,"type",r,n);return r}}}function Sw(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Sw,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(Gs(s,c)&&!(c in this.entries)){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"object",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value[c]=l.value}}}else ue(this,"type",n,i);return n}}}function Ew(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Ew,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])=>Gs(s,l)&&!(l in this.entries)).map(async([l,f])=>[l,f,await this.rest._run({typed:!1,value:f},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),(h.value!==void 0||l in s)&&(n.value[l]=h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value[l]=h.value}}else ue(this,"type",n,i);return n}}}function Rh(e,...t){const r={kind:"schema",type:"optional",reference:Rh,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=ki(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 Nh(e,...t){const r={kind:"schema",type:"optional",reference:Nh,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await ki(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 Dh(e,t){return{kind:"schema",type:"picklist",reference:Dh,expects:e.map(Br).join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){return this.options.includes(r.value)?r.typed=!0:ue(this,"type",r,n),r}}}function Cw(e){return{kind:"schema",type:"promise",reference:Cw,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:ue(this,"type",t,r),t}}}function Aw(e,t,r){return{kind:"schema",type:"record",reference:Aw,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(Gs(s,c)){const u=s[c],l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"object",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"object",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),l.typed&&(n.value[l.value]=f.value)}}else ue(this,"type",n,i);return n}}}function Mw(e,t,r){return{kind:"schema",type:"record",reference:Mw,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])=>Gs(s,u)).map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"object",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"object",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),f.typed&&(n.value[f.value]=h.value)}}else ue(this,"type",n,i);return n}}}function Tw(e,t){return{kind:"schema",type:"set",reference:Tw,expects:"Set",async:!1,value:e,message:t,_run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;for(const o of i){const a=this.value._run({typed:!1,value:o},n);if(a.issues){const c={type:"set",origin:"value",input:i,key:null,value:o};for(const u of a.issues)u.path?u.path.unshift(c):u.path=[c],(s=r.issues)==null||s.push(u);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}a.typed||(r.typed=!1),r.value.add(a.value)}}else ue(this,"type",r,n);return r}}}function Ow(e,t){return{kind:"schema",type:"set",reference:Ow,expects:"Set",async:!0,value:e,message:t,async _run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;const o=await Promise.all([...i].map(async a=>[a,await this.value._run({typed:!1,value:a},n)]));for(const[a,c]of o){if(c.issues){const u={type:"set",origin:"value",input:i,key:null,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.add(c.value)}}else ue(this,"type",r,n);return r}}}function Iw(e,t){return{kind:"schema",type:"strict_object",reference:Iw,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}if(!r.issues||!n.abortEarly){for(const o in i)if(!(o in this.entries)){const a=i[o];ue(this,"type",r,n,{input:a,expected:"never",path:[{type:"object",origin:"value",input:i,key:o,value:a}]});break}}}else ue(this,"type",r,n);return r}}}function Pw(e,t){return{kind:"schema",type:"strict_object",reference:Pw,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}if(!r.issues||!n.abortEarly){for(const a in i)if(!(a in this.entries)){const c=i[a];ue(this,"type",r,n,{input:c,expected:"never",path:[{type:"object",origin:"value",input:i,key:a,value:c}]});break}}}else ue(this,"type",r,n);return r}}}function kw(e,t){return{kind:"schema",type:"strict_tuple",reference:kw,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const o=i[e.length];ue(this,"type",r,n,{input:o,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:o}]})}}else ue(this,"type",r,n);return r}}}function jw(e,t){return{kind:"schema",type:"strict_tuple",reference:jw,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const a=i[e.length];ue(this,"type",r,n,{input:a,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:a}]})}}else ue(this,"type",r,n);return r}}}function Rw(e){return{kind:"schema",type:"string",reference:Rw,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:ue(this,"type",t,r),t}}}function Nw(e){return{kind:"schema",type:"symbol",reference:Nw,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:ue(this,"type",t,r),t}}}function Dw(e,t){return{kind:"schema",type:"tuple",reference:Dw,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else ue(this,"type",r,n);return r}}}function $w(e,t){return{kind:"schema",type:"tuple",reference:$w,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}}else ue(this,"type",r,n);return r}}}function Bw(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:Bw,expects:"Array",async:!1,items:e,rest:t,message:r,_run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let c=0;c<this.items.length;c++){const u=s[c],l=this.items[c]._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}if(!n.issues||!i.abortEarly)for(let c=this.items.length;c<s.length;c++){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else ue(this,"type",n,i);return n}}}function Lw(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:Lw,expects:"Array",async:!0,items:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];const[c,u]=await Promise.all([Promise.all(this.items.map(async(l,f)=>{const h=s[f];return[f,h,await l._run({typed:!1,value:h},i)]})),Promise.all(s.slice(this.items.length).map(async(l,f)=>[f+this.items.length,l,await this.rest._run({typed:!1,value:l},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}}else ue(this,"type",n,i);return n}}}function Md(e){return{kind:"schema",type:"undefined",reference:Md,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:ue(this,"type",t,r),t}}}function xu(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function Fw(e,t){return{kind:"schema",type:"union",reference:Fw,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){let i,s,o;for(const a of this.options){const c=a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];ue(this,"type",r,n,{issues:xu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];ue(this,"type",r,n,{issues:xu(o)})}return r}}}function Uw(e,t){return{kind:"schema",type:"union",reference:Uw,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!0,options:e,message:t,async _run(r,n){let i,s,o;for(const a of this.options){const c=await a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];ue(this,"type",r,n,{issues:xu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];ue(this,"type",r,n,{issues:xu(o)})}return r}}}function zw(){return{kind:"schema",type:"unknown",reference:zw,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function $h(e,t,r=new Set){for(const n of t)n.type==="variant"?$h(e,n.options,r):r.add(n.entries[e].expects);return r}function Vw(e,t,r){let n;return{kind:"schema",type:"variant",reference:Vw,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=[...$h(this.key,this.options)].join(" | ")||"never"),ue(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else ue(this,"type",i,s);return i}}}function qw(e,t,r){let n;return{kind:"schema",type:"variant",reference:qw,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=[...$h(this.key,this.options)].join(" | ")||"never"),ue(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else ue(this,"type",i,s);return i}}}function Td(e){return{kind:"schema",type:"void",reference:Td,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:ue(this,"type",t,r),t}}}function NE(e,t){return Dh(Object.keys(e.entries),t)}function DE(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function Hw(e,t,r){const n=e._run({typed:!1,value:t},lc(r));if(n.issues)throw new al(n.issues);return n.value}async function Ww(e,t,r){const n=await e._run({typed:!1,value:t},lc(r));if(n.issues)throw new al(n.issues);return n.value}function $E(e,t){const r=n=>Hw(e,n,t);return r.schema=e,r.config=t,r}function BE(e,t){const r=n=>Ww(e,n,t);return r.schema=e,r.config=t,r}function LE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Rh(e.entries[n]):e.entries[n];return{...e,entries:r}}function FE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Nh(e.entries[n]):e.entries[n];return{...e,entries:r}}function UE(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function zE(...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 VE(...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 qE(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)?kh(e.entries[o],i):e.entries[o];return{...e,entries:s}}function HE(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)?jh(e.entries[o],i):e.entries[o];return{...e,entries:s}}function Gw(e,t,r){const n=e._run({typed:!1,value:t},lc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function Kw(e,t,r){const n=await e._run({typed:!1,value:t},lc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function WE(e,t){const r=n=>Gw(e,n,t);return r.schema=e,r.config=t,r}function GE(e,t){const r=n=>Kw(e,n,t);return r.schema=e,r.config=t,r}function KE(e){return e.wrapped}const XE=Symbol.for("@mysten/transaction");function JE(e){return!!e&&typeof e=="object"&&e[XE]===!0}const Xw=Symbol.for("@mysten/SuiClient");function YE(e){return typeof e=="object"&&e!==null&&e[Xw]===!0}class za{get[Xw](){return!0}constructor(t){this.transport=t.transport??new t1({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!Es(Cs(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||!Es(Cs(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||!Es(Cs(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||!Es(Cs(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||!Es(Cs(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||!Tc(Oc(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||!Tc(Oc(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(!K0(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(!K0(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:Gi(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||!Es(Cs(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||!Tc(Oc(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(JE(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=Gi(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=Gi(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:Gi(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!Tc(Oc(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=Fo(t.digest);return uc(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=>eE(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 ZE=Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:Eh,SuiClient:za,SuiHTTPStatusError:Kv,SuiHTTPTransport:t1,SuiHTTPTransportError:Sh,getFullnodeUrl:r1,isSuiClient:YE},Symbol.toStringTag,{value:"Module"})),QE=Gv(ZE);var Bh=Object.defineProperty,eC=Object.getOwnPropertyDescriptor,tC=Object.getOwnPropertyNames,rC=Object.prototype.hasOwnProperty,nC=(e,t)=>{for(var r in t)Bh(e,r,{get:t[r],enumerable:!0})},iC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tC(t))!rC.call(e,i)&&i!==r&&Bh(e,i,{get:()=>t[i],enumerable:!(n=eC(t,i))||n.enumerable});return e},sC=e=>iC(Bh({},"__esModule",{value:!0}),e),Jw={};nC(Jw,{formatAddress:()=>aC,formatDigest:()=>cC});var oC=sC(Jw);const Yw="…";function aC(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${Yw}${e.slice(-4)}`}function cC(e){return`${e.slice(0,10)}${Yw}`}const Pr=Gv(KS);var Lh=Object.defineProperty,uC=Object.getOwnPropertyDescriptor,lC=Object.getOwnPropertyNames,fC=Object.prototype.hasOwnProperty,dC=(e,t)=>{for(var r in t)Lh(e,r,{get:t[r],enumerable:!0})},hC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lC(t))!fC.call(e,i)&&i!==r&&Lh(e,i,{get:()=>t[i],enumerable:!(n=uC(t,i))||n.enumerable});return e},pC=e=>hC(Lh({},"__esModule",{value:!0}),e),Zw={};dC(Zw,{SUI_ADDRESS_LENGTH:()=>Fh,isValidSuiAddress:()=>e2,isValidSuiObjectId:()=>vC,isValidTransactionDigest:()=>gC,normalizeStructTag:()=>t2,normalizeSuiAddress:()=>zh,normalizeSuiObjectId:()=>bC,parseStructTag:()=>Uh});var Zr=pC(Zw),Qw=Pr;const mC=32;function gC(e){try{return(0,Qw.fromBase58)(e).length===mC}catch{return!1}}const Fh=32;function e2(e){return wC(e)&&_C(e)===Fh}function vC(e){return e2(e)}function yC(e){return e.includes("::")?Uh(e):e}function Uh(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,s=n.includes("<")?(0,Qw.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>yC(o.trim())):[];return{address:zh(t),module:r,name:i,typeParams:s}}function t2(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Uh(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:t2(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function zh(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Fh*2,"0")}`}function bC(e,t=!1){return zh(e,t)}function wC(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function _C(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Vh=Object.defineProperty,xC=Object.getOwnPropertyDescriptor,SC=Object.getOwnPropertyNames,EC=Object.prototype.hasOwnProperty,CC=(e,t)=>{for(var r in t)Vh(e,r,{get:t[r],enumerable:!0})},AC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of SC(t))!EC.call(e,i)&&i!==r&&Vh(e,i,{get:()=>t[i],enumerable:!(n=xC(t,i))||n.enumerable});return e},MC=e=>AC(Vh({},"__esModule",{value:!0}),e),r2={};CC(r2,{isValidSuiNSName:()=>OC,normalizeSuiNSName:()=>IC});var n2=MC(r2);const i2=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,s2=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,TC=235;function OC(e){return e.length>TC?!1:e.includes("@")?i2.test(e):s2.test(e)}function IC(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!i2.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!s2.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 qh=Object.defineProperty,PC=Object.getOwnPropertyDescriptor,kC=Object.getOwnPropertyNames,jC=Object.prototype.hasOwnProperty,RC=(e,t)=>{for(var r in t)qh(e,r,{get:t[r],enumerable:!0})},NC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kC(t))!jC.call(e,i)&&i!==r&&qh(e,i,{get:()=>t[i],enumerable:!(n=PC(t,i))||n.enumerable});return e},DC=e=>NC(qh({},"__esModule",{value:!0}),e),o2={};RC(o2,{MIST_PER_SUI:()=>LC,MOVE_STDLIB_ADDRESS:()=>FC,SUI_CLOCK_OBJECT_ID:()=>zC,SUI_DECIMALS:()=>BC,SUI_FRAMEWORK_ADDRESS:()=>c2,SUI_SYSTEM_ADDRESS:()=>UC,SUI_SYSTEM_MODULE_NAME:()=>VC,SUI_SYSTEM_STATE_OBJECT_ID:()=>HC,SUI_TYPE_ARG:()=>qC});var $C=DC(o2),a2=Zr;const BC=9,LC=BigInt(1e9),FC="0x1",c2="0x2",UC="0x3",zC=(0,a2.normalizeSuiObjectId)("0x6"),VC="sui_system",qC=`${c2}::sui::SUI`,HC=(0,a2.normalizeSuiObjectId)("0x5");var Hh=Object.defineProperty,WC=Object.getOwnPropertyDescriptor,GC=Object.getOwnPropertyNames,KC=Object.prototype.hasOwnProperty,XC=(e,t)=>{for(var r in t)Hh(e,r,{get:t[r],enumerable:!0})},JC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GC(t))!KC.call(e,i)&&i!==r&&Hh(e,i,{get:()=>t[i],enumerable:!(n=WC(t,i))||n.enumerable});return e},YC=e=>JC(Hh({},"__esModule",{value:!0}),e),u2={};XC(u2,{isValidNamedPackage:()=>d2,isValidNamedType:()=>rA});var l2=YC(u2),ZC=n2;const QC=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,eA=/^\d+$/,tA=64,f2="/",d2=e=>{const t=e.split(f2);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!eA.test(i)||!(0,ZC.isValidSuiNSName)(r)?!1:QC.test(n)&&n.length<tA},rA=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(f2)&&!d2(r))return!1;return!0};var Wh=Object.defineProperty,nA=Object.getOwnPropertyDescriptor,iA=Object.getOwnPropertyNames,sA=Object.prototype.hasOwnProperty,oA=(e,t)=>{for(var r in t)Wh(e,r,{get:t[r],enumerable:!0})},aA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of iA(t))!sA.call(e,i)&&i!==r&&Wh(e,i,{get:()=>t[i],enumerable:!(n=nA(t,i))||n.enumerable});return e},cA=e=>aA(Wh({},"__esModule",{value:!0}),e),h2={};oA(h2,{TypeTagSerializer:()=>Is});var p2=cA(h2),uA=Pr,lA=Zr;const fA=/^vector<(.+)>$/,dA=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Is{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(fA);if(n)return{vector:Is.parseFromStr(n[1],r)};const i=t.match(dA);if(i)return{struct:{address:r?(0,lA.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Is.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,uA.splitGenericParameters)(t).map(n=>Is.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<${Is.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Is.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Gh=Object.defineProperty,hA=Object.getOwnPropertyDescriptor,pA=Object.getOwnPropertyNames,mA=Object.prototype.hasOwnProperty,gA=(e,t)=>{for(var r in t)Gh(e,r,{get:t[r],enumerable:!0})},vA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pA(t))!mA.call(e,i)&&i!==r&&Gh(e,i,{get:()=>t[i],enumerable:!(n=hA(t,i))||n.enumerable});return e},yA=e=>vA(Gh({},"__esModule",{value:!0}),e),m2={};gA(m2,{Address:()=>Kn,AppId:()=>k2,Argument:()=>Un,CallArg:()=>w2,Command:()=>x2,CompressedSignature:()=>N2,GasData:()=>M2,Intent:()=>j2,IntentMessage:()=>R2,IntentScope:()=>I2,IntentVersion:()=>P2,MultiSig:()=>_A,MultiSigPkMap:()=>$2,MultiSigPublicKey:()=>B2,ObjectArg:()=>b2,ObjectDigest:()=>v2,PasskeyAuthenticator:()=>SA,ProgrammableMoveCall:()=>_2,ProgrammableTransaction:()=>S2,PublicKey:()=>D2,SenderSignedData:()=>xA,SenderSignedTransaction:()=>F2,SharedObjectRef:()=>y2,StructTag:()=>A2,SuiObjectRef:()=>Su,TransactionData:()=>O2,TransactionDataV1:()=>T2,TransactionExpiration:()=>C2,TransactionKind:()=>E2,TypeTag:()=>Xh,base64String:()=>L2});var g2=yA(m2),de=Pr,la=Zr,J0=p2;function bA(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function wA(e){return de.bcs.enum("Option",{None:null,Some:e})}const Kn=de.bcs.bytes(la.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,la.isValidSuiAddress)((0,la.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,la.normalizeSuiAddress)(e)):e,output:e=>(0,la.normalizeSuiAddress)((0,de.toHex)(e))}),v2=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")}}),Su=de.bcs.struct("SuiObjectRef",{objectId:Kn,version:de.bcs.u64(),digest:v2}),y2=de.bcs.struct("SharedObjectRef",{objectId:Kn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),b2=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:Su,SharedObject:y2,Receiving:Su}),w2=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:b2}),Kh=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>Kh),struct:de.bcs.lazy(()=>A2),u16:null,u32:null,u256:null}),Xh=Kh.transform({input:e=>typeof e=="string"?J0.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>J0.TypeTagSerializer.tagToString(e)}),Un=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),_2=de.bcs.struct("ProgrammableMoveCall",{package:Kn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(Xh),arguments:de.bcs.vector(Un)}),x2=de.bcs.enum("Command",{MoveCall:_2,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Un),address:Un}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Un,amounts:de.bcs.vector(Un)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Un,sources:de.bcs.vector(Un)}),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(Kn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:wA(Xh).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Un)}),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(Kn),package:Kn,ticket:Un})}),S2=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(w2),commands:de.bcs.vector(x2)}),E2=de.bcs.enum("TransactionKind",{ProgrammableTransaction:S2,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),C2=de.bcs.enum("TransactionExpiration",{None:null,Epoch:bA()}),A2=de.bcs.struct("StructTag",{address:Kn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(Kh)}),M2=de.bcs.struct("GasData",{payment:de.bcs.vector(Su),owner:Kn,price:de.bcs.u64(),budget:de.bcs.u64()}),T2=de.bcs.struct("TransactionDataV1",{kind:E2,sender:Kn,gasData:M2,expiration:C2}),O2=de.bcs.enum("TransactionData",{V1:T2}),I2=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),P2=de.bcs.enum("IntentVersion",{V0:null}),k2=de.bcs.enum("AppId",{Sui:null}),j2=de.bcs.struct("Intent",{scope:I2,version:P2,appId:k2});function R2(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:j2,value:e})}const N2=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())}),D2=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())}),$2=de.bcs.struct("MultiSigPkMap",{pubKey:D2,weight:de.bcs.u8()}),B2=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector($2),threshold:de.bcs.u16()}),_A=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(N2),bitmap:de.bcs.u16(),multisig_pk:B2}),L2=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))}),F2=de.bcs.struct("SenderSignedTransaction",{intentMessage:R2(O2),txSignatures:de.bcs.vector(L2)}),xA=de.bcs.vector(F2,{name:"SenderSignedData"}),SA=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var Jh=Object.defineProperty,EA=Object.getOwnPropertyDescriptor,CA=Object.getOwnPropertyNames,AA=Object.prototype.hasOwnProperty,MA=(e,t)=>{for(var r in t)Jh(e,r,{get:t[r],enumerable:!0})},TA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of CA(t))!AA.call(e,i)&&i!==r&&Jh(e,i,{get:()=>t[i],enumerable:!(n=EA(t,i))||n.enumerable});return e},OA=e=>TA(Jh({},"__esModule",{value:!0}),e),U2={};MA(U2,{TransactionEffects:()=>VA});var IA=OA(U2),ge=Pr,Ft=g2;const PA=ge.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ge.bcs.struct("UnableToFetchPackage",{packageId:Ft.Address}),NotAPackage:ge.bcs.struct("NotAPackage",{objectId:Ft.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:Ft.Address,ticketId:Ft.Address})}),kA=ge.bcs.struct("ModuleId",{address:Ft.Address,name:ge.bcs.string()}),Y0=ge.bcs.struct("MoveLocation",{module:kA,function:ge.bcs.u16(),instruction:ge.bcs.u16(),functionName:ge.bcs.option(ge.bcs.string())}),jA=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}),RA=ge.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),NA=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:Ft.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ge.bcs.option(Y0),MoveAbort:ge.bcs.tuple([Y0,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:jA}),TypeArgumentError:ge.bcs.struct("TypeArgumentError",{argumentIdx:ge.bcs.u16(),kind:RA}),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:PA}),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(Ft.Address)}),AddressDeniedForCoin:ge.bcs.struct("AddressDeniedForCoin",{address:Ft.Address,coinType:ge.bcs.string()}),CoinTypeGlobalPause:ge.bcs.struct("CoinTypeGlobalPause",{coinType:ge.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),z2=ge.bcs.enum("ExecutionStatus",{Success:null,Failed:ge.bcs.struct("ExecutionFailed",{error:NA,command:ge.bcs.option(ge.bcs.u64())})}),V2=ge.bcs.struct("GasCostSummary",{computationCost:ge.bcs.u64(),storageCost:ge.bcs.u64(),storageRebate:ge.bcs.u64(),nonRefundableStorageFee:ge.bcs.u64()}),mo=ge.bcs.enum("Owner",{AddressOwner:Ft.Address,ObjectOwner:Ft.Address,Shared:ge.bcs.struct("Shared",{initialSharedVersion:ge.bcs.u64()}),Immutable:null}),DA=ge.bcs.struct("TransactionEffectsV1",{status:z2,executedEpoch:ge.bcs.u64(),gasUsed:V2,modifiedAtVersions:ge.bcs.vector(ge.bcs.tuple([Ft.Address,ge.bcs.u64()])),sharedObjects:ge.bcs.vector(Ft.SuiObjectRef),transactionDigest:Ft.ObjectDigest,created:ge.bcs.vector(ge.bcs.tuple([Ft.SuiObjectRef,mo])),mutated:ge.bcs.vector(ge.bcs.tuple([Ft.SuiObjectRef,mo])),unwrapped:ge.bcs.vector(ge.bcs.tuple([Ft.SuiObjectRef,mo])),deleted:ge.bcs.vector(Ft.SuiObjectRef),unwrappedThenDeleted:ge.bcs.vector(Ft.SuiObjectRef),wrapped:ge.bcs.vector(Ft.SuiObjectRef),gasObject:ge.bcs.tuple([Ft.SuiObjectRef,mo]),eventsDigest:ge.bcs.option(Ft.ObjectDigest),dependencies:ge.bcs.vector(Ft.ObjectDigest)}),Yh=ge.bcs.tuple([ge.bcs.u64(),Ft.ObjectDigest]),$A=ge.bcs.enum("ObjectIn",{NotExist:null,Exist:ge.bcs.tuple([Yh,mo])}),BA=ge.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ge.bcs.tuple([Ft.ObjectDigest,mo]),PackageWrite:Yh}),LA=ge.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),FA=ge.bcs.struct("EffectsObjectChange",{inputState:$A,outputState:BA,idOperation:LA}),UA=ge.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:Yh,MutateDeleted:ge.bcs.u64(),ReadDeleted:ge.bcs.u64(),Cancelled:ge.bcs.u64(),PerEpochConfig:null}),zA=ge.bcs.struct("TransactionEffectsV2",{status:z2,executedEpoch:ge.bcs.u64(),gasUsed:V2,transactionDigest:Ft.ObjectDigest,gasObjectIndex:ge.bcs.option(ge.bcs.u32()),eventsDigest:ge.bcs.option(Ft.ObjectDigest),dependencies:ge.bcs.vector(Ft.ObjectDigest),lamportVersion:ge.bcs.u64(),changedObjects:ge.bcs.vector(ge.bcs.tuple([Ft.Address,FA])),unchangedSharedObjects:ge.bcs.vector(ge.bcs.tuple([Ft.Address,UA])),auxDataDigest:ge.bcs.option(Ft.ObjectDigest)}),VA=ge.bcs.enum("TransactionEffects",{V1:DA,V2:zA});var Zh=Object.defineProperty,qA=Object.getOwnPropertyDescriptor,HA=Object.getOwnPropertyNames,WA=Object.prototype.hasOwnProperty,GA=(e,t)=>{for(var r in t)Zh(e,r,{get:t[r],enumerable:!0})},KA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HA(t))!WA.call(e,i)&&i!==r&&Zh(e,i,{get:()=>t[i],enumerable:!(n=qA(t,i))||n.enumerable});return e},XA=e=>KA(Zh({},"__esModule",{value:!0}),e),q2={};GA(q2,{BcsType:()=>ZA.BcsType,TypeTagSerializer:()=>YA.TypeTagSerializer,bcs:()=>QA});var ii=XA(q2),Dn=Pr,Bt=g2,JA=IA,YA=p2,ZA=Pr;const QA={...Dn.bcs,U8:Dn.bcs.u8(),U16:Dn.bcs.u16(),U32:Dn.bcs.u32(),U64:Dn.bcs.u64(),U128:Dn.bcs.u128(),U256:Dn.bcs.u256(),ULEB128:Dn.bcs.uleb128(),Bool:Dn.bcs.bool(),String:Dn.bcs.string(),Address:Bt.Address,AppId:Bt.AppId,Argument:Bt.Argument,CallArg:Bt.CallArg,CompressedSignature:Bt.CompressedSignature,GasData:Bt.GasData,Intent:Bt.Intent,IntentMessage:Bt.IntentMessage,IntentScope:Bt.IntentScope,IntentVersion:Bt.IntentVersion,MultiSig:Bt.MultiSig,MultiSigPkMap:Bt.MultiSigPkMap,MultiSigPublicKey:Bt.MultiSigPublicKey,ObjectArg:Bt.ObjectArg,ObjectDigest:Bt.ObjectDigest,ProgrammableMoveCall:Bt.ProgrammableMoveCall,ProgrammableTransaction:Bt.ProgrammableTransaction,PublicKey:Bt.PublicKey,SenderSignedData:Bt.SenderSignedData,SenderSignedTransaction:Bt.SenderSignedTransaction,SharedObjectRef:Bt.SharedObjectRef,StructTag:Bt.StructTag,SuiObjectRef:Bt.SuiObjectRef,Command:Bt.Command,TransactionData:Bt.TransactionData,TransactionDataV1:Bt.TransactionDataV1,TransactionExpiration:Bt.TransactionExpiration,TransactionKind:Bt.TransactionKind,TypeTag:Bt.TypeTag,TransactionEffects:JA.TransactionEffects,PasskeyAuthenticator:Bt.PasskeyAuthenticator};var Qh=Object.defineProperty,eM=Object.getOwnPropertyDescriptor,tM=Object.getOwnPropertyNames,rM=Object.prototype.hasOwnProperty,nM=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},iM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tM(t))!rM.call(e,i)&&i!==r&&Qh(e,i,{get:()=>t[i],enumerable:!(n=eM(t,i))||n.enumerable});return e},sM=e=>iM(Qh({},"__esModule",{value:!0}),e),H2={};nM(H2,{deriveDynamicFieldID:()=>uM});var oM=sM(H2),aM=Pr,cM=zs,mf=ii;function uM(e,t,r){const n=mf.bcs.Address.serialize(e).toBytes(),i=mf.bcs.TypeTag.serialize(t).toBytes(),s=mf.bcs.u64().serialize(r.length).toBytes(),o=cM.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,aM.toHex)(o.digest().slice(0,32))}`}var ep=Object.defineProperty,lM=Object.getOwnPropertyDescriptor,fM=Object.getOwnPropertyNames,dM=Object.prototype.hasOwnProperty,hM=(e,t)=>{for(var r in t)ep(e,r,{get:t[r],enumerable:!0})},pM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fM(t))!dM.call(e,i)&&i!==r&&ep(e,i,{get:()=>t[i],enumerable:!(n=lM(t,i))||n.enumerable});return e},mM=e=>pM(ep({},"__esModule",{value:!0}),e),W2={};hM(W2,{MIST_PER_SUI:()=>di.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>di.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Bi.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>di.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>di.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>di.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>di.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>di.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>di.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>di.SUI_TYPE_ARG,deriveDynamicFieldID:()=>gM.deriveDynamicFieldID,formatAddress:()=>Z0.formatAddress,formatDigest:()=>Z0.formatDigest,fromB64:()=>$n.fromB64,fromBase58:()=>$n.fromBase58,fromBase64:()=>$n.fromBase64,fromHEX:()=>$n.fromHEX,fromHex:()=>$n.fromHex,isValidNamedPackage:()=>em.isValidNamedPackage,isValidNamedType:()=>em.isValidNamedType,isValidSuiAddress:()=>Bi.isValidSuiAddress,isValidSuiNSName:()=>Q0.isValidSuiNSName,isValidSuiObjectId:()=>Bi.isValidSuiObjectId,isValidTransactionDigest:()=>Bi.isValidTransactionDigest,normalizeStructTag:()=>Bi.normalizeStructTag,normalizeSuiAddress:()=>Bi.normalizeSuiAddress,normalizeSuiNSName:()=>Q0.normalizeSuiNSName,normalizeSuiObjectId:()=>Bi.normalizeSuiObjectId,parseStructTag:()=>Bi.parseStructTag,toB64:()=>$n.toB64,toBase58:()=>$n.toBase58,toBase64:()=>$n.toBase64,toHEX:()=>$n.toHEX,toHex:()=>$n.toHex});var On=mM(W2),Z0=oC,Bi=Zr,$n=Pr,Q0=n2,di=$C,em=l2,gM=oM,tp=Object.defineProperty,vM=Object.getOwnPropertyDescriptor,yM=Object.getOwnPropertyNames,bM=Object.prototype.hasOwnProperty,wM=(e,t)=>{for(var r in t)tp(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&&tp(e,i,{get:()=>t[i],enumerable:!(n=vM(t,i))||n.enumerable});return e},xM=e=>_M(tp({},"__esModule",{value:!0}),e),G2={};wM(G2,{getPureBcsSchema:()=>Od,isTxContext:()=>PM,normalizedTypeToMoveTypeSignature:()=>kM,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>X2});var K2=xM(G2),Yt=ii,tm=On,Ia=Zr;const SM="object",EM="ID",CM="ascii",AM="String",MM="string",TM="String",OM="option",IM="Option";function PM(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Ia.normalizeSuiAddress)(t.package)===(0,Ia.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function Od(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Yt.bcs.vector(Yt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=Od(e.vector);return t?Yt.bcs.vector(t):null}if("datatype"in e){const t=(0,Ia.normalizeSuiAddress)(e.datatype.package);if(t===(0,Ia.normalizeSuiAddress)(tm.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===CM&&e.datatype.type===AM||e.datatype.module===MM&&e.datatype.type===TM)return Yt.bcs.String;if(e.datatype.module===OM&&e.datatype.type===IM){const r=Od(e.datatype.typeParameters[0]);return r?Yt.bcs.vector(r):null}}if(t===(0,Ia.normalizeSuiAddress)(tm.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===SM&&e.datatype.type===EM)return Yt.bcs.Address}return null}function kM(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Pa(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Pa(e.MutableReference)}:{ref:null,body:Pa(e)}}function Pa(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:Pa(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(Pa)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function X2(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Yt.bcs.vector(X2(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var rp=Object.defineProperty,jM=Object.getOwnPropertyDescriptor,RM=Object.getOwnPropertyNames,NM=Object.prototype.hasOwnProperty,DM=(e,t)=>{for(var r in t)rp(e,r,{get:t[r],enumerable:!0})},$M=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RM(t))!NM.call(e,i)&&i!==r&&rp(e,i,{get:()=>t[i],enumerable:!(n=jM(t,i))||n.enumerable});return e},BM=e=>$M(rp({},"__esModule",{value:!0}),e),J2={};DM(J2,{Inputs:()=>UM});var cl=BM(J2),LM=Pr,gf=Zr;function FM(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,LM.toBase64)(e):e.toBase64()}}}const UM={Pure:FM,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 np=Object.defineProperty,zM=Object.getOwnPropertyDescriptor,VM=Object.getOwnPropertyNames,qM=Object.prototype.hasOwnProperty,HM=(e,t)=>{for(var r in t)np(e,r,{get:t[r],enumerable:!0})},WM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of VM(t))!qM.call(e,i)&&i!==r&&np(e,i,{get:()=>t[i],enumerable:!(n=zM(t,i))||n.enumerable});return e},GM=e=>WM(np({},"__esModule",{value:!0}),e),Y2={};HM(Y2,{$Intent:()=>e_,Argument:()=>tn,BCSBytes:()=>Va,Command:()=>t_,GasData:()=>Z2,JsonU64:()=>ts,NormalizedCallArg:()=>YM,ObjectArg:()=>ip,ObjectID:()=>Bs,ObjectRef:()=>Eu,OpenMoveTypeSignature:()=>Q2,OpenMoveTypeSignatureBody:()=>Cu,StructTag:()=>KM,SuiAddress:()=>dc,TransactionData:()=>ZM,TransactionExpiration:()=>r_,safeEnum:()=>zo});var Uo=GM(Y2),ce=ls,rm=Zr;function zo(e){const t=Object.entries(e).map(([r,n])=>(0,ce.object)({[r]:n}));return(0,ce.pipe)((0,ce.union)(t),(0,ce.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const dc=(0,ce.pipe)((0,ce.string)(),(0,ce.transform)(e=>(0,rm.normalizeSuiAddress)(e)),(0,ce.check)(rm.isValidSuiAddress)),Bs=dc,Va=(0,ce.string)(),ts=(0,ce.pipe)((0,ce.union)([(0,ce.string)(),(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())]),(0,ce.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Eu=(0,ce.object)({objectId:dc,version:ts,digest:(0,ce.string)()}),tn=(0,ce.pipe)((0,ce.union)([(0,ce.object)({GasCoin:(0,ce.literal)(!0)}),(0,ce.object)({Input:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),type:(0,ce.optional)((0,ce.literal)("pure"))}),(0,ce.object)({Input:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),type:(0,ce.optional)((0,ce.literal)("object"))}),(0,ce.object)({Result:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())}),(0,ce.object)({NestedResult:(0,ce.tuple)([(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())])})]),(0,ce.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),Z2=(0,ce.object)({budget:(0,ce.nullable)(ts),price:(0,ce.nullable)(ts),owner:(0,ce.nullable)(dc),payment:(0,ce.nullable)((0,ce.array)(Eu))}),KM=(0,ce.object)({address:(0,ce.string)(),module:(0,ce.string)(),name:(0,ce.string)(),typeParams:(0,ce.array)((0,ce.string)())}),Cu=(0,ce.union)([(0,ce.literal)("address"),(0,ce.literal)("bool"),(0,ce.literal)("u8"),(0,ce.literal)("u16"),(0,ce.literal)("u32"),(0,ce.literal)("u64"),(0,ce.literal)("u128"),(0,ce.literal)("u256"),(0,ce.object)({vector:(0,ce.lazy)(()=>Cu)}),(0,ce.object)({datatype:(0,ce.object)({package:(0,ce.string)(),module:(0,ce.string)(),type:(0,ce.string)(),typeParameters:(0,ce.array)((0,ce.lazy)(()=>Cu))})}),(0,ce.object)({typeParameter:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())})]),Q2=(0,ce.object)({ref:(0,ce.nullable)((0,ce.union)([(0,ce.literal)("&"),(0,ce.literal)("&mut")])),body:Cu}),XM=(0,ce.object)({package:Bs,module:(0,ce.string)(),function:(0,ce.string)(),typeArguments:(0,ce.array)((0,ce.string)()),arguments:(0,ce.array)(tn),_argumentTypes:(0,ce.optional)((0,ce.nullable)((0,ce.array)(Q2)))}),e_=(0,ce.object)({name:(0,ce.string)(),inputs:(0,ce.record)((0,ce.string)(),(0,ce.union)([tn,(0,ce.array)(tn)])),data:(0,ce.record)((0,ce.string)(),(0,ce.unknown)())}),t_=zo({MoveCall:XM,TransferObjects:(0,ce.object)({objects:(0,ce.array)(tn),address:tn}),SplitCoins:(0,ce.object)({coin:tn,amounts:(0,ce.array)(tn)}),MergeCoins:(0,ce.object)({destination:tn,sources:(0,ce.array)(tn)}),Publish:(0,ce.object)({modules:(0,ce.array)(Va),dependencies:(0,ce.array)(Bs)}),MakeMoveVec:(0,ce.object)({type:(0,ce.nullable)((0,ce.string)()),elements:(0,ce.array)(tn)}),Upgrade:(0,ce.object)({modules:(0,ce.array)(Va),dependencies:(0,ce.array)(Bs),package:Bs,ticket:tn}),$Intent:e_}),ip=zo({ImmOrOwnedObject:Eu,SharedObject:(0,ce.object)({objectId:Bs,initialSharedVersion:ts,mutable:(0,ce.boolean)()}),Receiving:Eu}),JM=zo({Object:ip,Pure:(0,ce.object)({bytes:Va}),UnresolvedPure:(0,ce.object)({value:(0,ce.unknown)()}),UnresolvedObject:(0,ce.object)({objectId:Bs,version:(0,ce.optional)((0,ce.nullable)(ts)),digest:(0,ce.optional)((0,ce.nullable)((0,ce.string)())),initialSharedVersion:(0,ce.optional)((0,ce.nullable)(ts))})}),YM=zo({Object:ip,Pure:(0,ce.object)({bytes:Va})}),r_=zo({None:(0,ce.literal)(!0),Epoch:ts}),ZM=(0,ce.object)({version:(0,ce.literal)(2),sender:(0,ce.nullish)(dc),expiration:(0,ce.nullish)(r_),gasData:Z2,inputs:(0,ce.array)(JM),commands:(0,ce.array)(t_)});var sp=Object.defineProperty,QM=Object.getOwnPropertyDescriptor,e5=Object.getOwnPropertyNames,t5=Object.prototype.hasOwnProperty,r5=(e,t)=>{for(var r in t)sp(e,r,{get:t[r],enumerable:!0})},n5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of e5(t))!t5.call(e,i)&&i!==r&&sp(e,i,{get:()=>t[i],enumerable:!(n=QM(t,i))||n.enumerable});return e},i5=e=>n5(sp({},"__esModule",{value:!0}),e),n_={};r5(n_,{Commands:()=>s5,UpgradePolicy:()=>i_});var op=i5(n_),nm=Pr,Bn=ls,im=Zr,Ln=Uo,i_=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(i_||{});const s5={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,Bn.parse)(Ln.Argument,r)),address:(0,Bn.parse)(Ln.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Bn.parse)(Ln.Argument,e),amounts:t.map(r=>(0,Bn.parse)(Ln.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Bn.parse)(Ln.Argument,e),sources:t.map(r=>(0,Bn.parse)(Ln.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,nm.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,im.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,nm.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,im.normalizeSuiObjectId)(i)),package:r,ticket:(0,Bn.parse)(Ln.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Bn.parse)(Ln.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,Bn.parse)(Ln.Argument,s)):(0,Bn.parse)(Ln.Argument,i)])),data:r}}}};var ap=Object.defineProperty,o5=Object.getOwnPropertyDescriptor,a5=Object.getOwnPropertyNames,c5=Object.prototype.hasOwnProperty,u5=(e,t)=>{for(var r in t)ap(e,r,{get:t[r],enumerable:!0})},l5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a5(t))!c5.call(e,i)&&i!==r&&ap(e,i,{get:()=>t[i],enumerable:!(n=o5(t,i))||n.enumerable});return e},f5=e=>l5(ap({},"__esModule",{value:!0}),e),s_={};u5(s_,{NormalizedCallArg:()=>Id,ObjectRef:()=>Au,SerializedTransactionDataV1:()=>C5,StructTag:()=>u_,TransactionArgument:()=>Zn,TypeTag:()=>ul,serializeV1TransactionData:()=>A5,transactionDataFromV1:()=>M5});var o_=f5(s_),Co=Pr,ne=ls,a_=ii,ka=Uo;const Au=(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)()])}),d5=(0,ka.safeEnum)({ImmOrOwned:Au,Shared:(0,ne.object)({objectId:ka.ObjectID,initialSharedVersion:ka.JsonU64,mutable:(0,ne.boolean)()}),Receiving:Au}),Id=(0,ka.safeEnum)({Object:d5,Pure:(0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))}),c_=(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")})]),h5=(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))})]),sm=(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}})),ul=(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)(()=>ul)}),(0,ne.object)({struct:(0,ne.lazy)(()=>u_)}),(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))})]),u_=(0,ne.object)({address:(0,ne.string)(),module:(0,ne.string)(),name:(0,ne.string)(),typeParams:(0,ne.array)(ul)}),p5=(0,ne.object)({budget:(0,ne.optional)(sm),price:(0,ne.optional)(sm),payment:(0,ne.optional)((0,ne.array)(Au)),owner:(0,ne.optional)((0,ne.string)())}),m5=[c_,(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)())})],Zn=(0,ne.union)([...m5]),g5=(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)(Zn)}),v5=(0,ne.object)({kind:(0,ne.literal)("TransferObjects"),objects:(0,ne.array)(Zn),address:Zn}),y5=(0,ne.object)({kind:(0,ne.literal)("SplitCoins"),coin:Zn,amounts:(0,ne.array)(Zn)}),b5=(0,ne.object)({kind:(0,ne.literal)("MergeCoins"),destination:Zn,sources:(0,ne.array)(Zn)}),w5=(0,ne.object)({kind:(0,ne.literal)("MakeMoveVec"),type:(0,ne.union)([(0,ne.object)({Some:ul}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),objects:(0,ne.array)(Zn)}),_5=(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)())}),x5=(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:Zn}),S5=[g5,v5,y5,b5,_5,x5,w5],E5=(0,ne.union)([...S5]),C5=(0,ne.object)({version:(0,ne.literal)(1),sender:(0,ne.optional)((0,ne.string)()),expiration:(0,ne.nullish)(h5),gasConfig:p5,inputs:(0,ne.array)(c_),transactions:(0,ne.array)(E5)});function A5(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,Co.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:a_.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>hi(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:hi(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>hi(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=>hi(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,Co.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:hi(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>hi(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>hi(i,t)),address:hi(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,Co.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:hi(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function hi(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 M5(e){var t,r,n;return(0,ne.parse)(ka.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)(Id,i.value)){const s=(0,ne.parse)(Id,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,Co.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?a_.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>pi(s))}};case"MergeCoins":return{MergeCoins:{destination:pi(i.destination),sources:i.sources.map(s=>pi(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=>pi(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,Co.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:pi(i.coin),amounts:i.amounts.map(s=>pi(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>pi(s)),address:pi(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,Co.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:pi(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function pi(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 cp=Object.defineProperty,T5=Object.getOwnPropertyDescriptor,O5=Object.getOwnPropertyNames,I5=Object.prototype.hasOwnProperty,P5=(e,t)=>{for(var r in t)cp(e,r,{get:t[r],enumerable:!0})},k5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of O5(t))!I5.call(e,i)&&i!==r&&cp(e,i,{get:()=>t[i],enumerable:!(n=T5(t,i))||n.enumerable});return e},j5=e=>k5(cp({},"__esModule",{value:!0}),e),l_={};P5(l_,{SerializedTransactionDataV2:()=>z5});var R5=j5(l_),Pe=ls,ar=Uo;function hc(e){return(0,Pe.union)(Object.entries(e).map(([t,r])=>(0,Pe.object)({[t]:r})))}const vn=hc({GasCoin:(0,Pe.literal)(!0),Input:(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)()),Result:(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)()),NestedResult:(0,Pe.tuple)([(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)()),(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)())])}),N5=(0,Pe.object)({budget:(0,Pe.nullable)(ar.JsonU64),price:(0,Pe.nullable)(ar.JsonU64),owner:(0,Pe.nullable)(ar.SuiAddress),payment:(0,Pe.nullable)((0,Pe.array)(ar.ObjectRef))}),D5=(0,Pe.object)({package:ar.ObjectID,module:(0,Pe.string)(),function:(0,Pe.string)(),typeArguments:(0,Pe.array)((0,Pe.string)()),arguments:(0,Pe.array)(vn)}),$5=(0,Pe.object)({name:(0,Pe.string)(),inputs:(0,Pe.record)((0,Pe.string)(),(0,Pe.union)([vn,(0,Pe.array)(vn)])),data:(0,Pe.record)((0,Pe.string)(),(0,Pe.unknown)())}),B5=hc({MoveCall:D5,TransferObjects:(0,Pe.object)({objects:(0,Pe.array)(vn),address:vn}),SplitCoins:(0,Pe.object)({coin:vn,amounts:(0,Pe.array)(vn)}),MergeCoins:(0,Pe.object)({destination:vn,sources:(0,Pe.array)(vn)}),Publish:(0,Pe.object)({modules:(0,Pe.array)(ar.BCSBytes),dependencies:(0,Pe.array)(ar.ObjectID)}),MakeMoveVec:(0,Pe.object)({type:(0,Pe.nullable)((0,Pe.string)()),elements:(0,Pe.array)(vn)}),Upgrade:(0,Pe.object)({modules:(0,Pe.array)(ar.BCSBytes),dependencies:(0,Pe.array)(ar.ObjectID),package:ar.ObjectID,ticket:vn}),$Intent:$5}),L5=hc({ImmOrOwnedObject:ar.ObjectRef,SharedObject:(0,Pe.object)({objectId:ar.ObjectID,initialSharedVersion:ar.JsonU64,mutable:(0,Pe.boolean)()}),Receiving:ar.ObjectRef}),F5=hc({Object:L5,Pure:(0,Pe.object)({bytes:ar.BCSBytes}),UnresolvedPure:(0,Pe.object)({value:(0,Pe.unknown)()}),UnresolvedObject:(0,Pe.object)({objectId:ar.ObjectID,version:(0,Pe.optional)((0,Pe.nullable)(ar.JsonU64)),digest:(0,Pe.optional)((0,Pe.nullable)((0,Pe.string)())),initialSharedVersion:(0,Pe.optional)((0,Pe.nullable)(ar.JsonU64))})}),U5=hc({None:(0,Pe.literal)(!0),Epoch:ar.JsonU64}),z5=(0,Pe.object)({version:(0,Pe.literal)(2),sender:(0,Pe.nullish)(ar.SuiAddress),expiration:(0,Pe.nullish)(U5),gasData:N5,inputs:(0,Pe.array)(F5),commands:(0,Pe.array)(B5)});var up=Object.defineProperty,V5=Object.getOwnPropertyDescriptor,q5=Object.getOwnPropertyNames,H5=Object.prototype.hasOwnProperty,W5=(e,t)=>{for(var r in t)up(e,r,{get:t[r],enumerable:!0})},G5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of q5(t))!H5.call(e,i)&&i!==r&&up(e,i,{get:()=>t[i],enumerable:!(n=V5(t,i))||n.enumerable});return e},K5=e=>G5(up({},"__esModule",{value:!0}),e),f_={};W5(f_,{getClient:()=>Vo,resolveTransactionData:()=>eT});var d_=K5(f_),X5=ls,om=ii,Pd=On,J5=Uo,ja=cl,vf=K2;const Y5=50,Z5=1000n,Q5=5e10;async function eT(e,t,r){return await sT(e,t),await iT(e,t),t.onlyTransactionKind||(await tT(e,t),await rT(e,t),await nT(e,t)),await oT(e),await r()}async function tT(e,t){e.gasConfig.price||(e.gasConfig.price=String(await Vo(t).getReferenceGasPrice()))}async function rT(e,t){if(e.gasConfig.budget)return;const r=await Vo(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(Q5),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=Z5*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 nT(e,t){if(!e.gasConfig.payment){const n=(await Vo(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Pd.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,X5.parse)(J5.ObjectRef,i))}}async function iT(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,Pd.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?lT(n,Y5):[],s=(await Promise.all(i.map(l=>Vo(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,Pd.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=ja.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:aT(e,l)}):cT(e,l)&&(h=ja.Inputs.ReceivingRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})),e.inputs[e.inputs.indexOf(f)]=h??ja.Inputs.ObjectRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})}}async function sT(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=>{am(c,om.bcs.U64,e)});break;case"TransferObjects":am(a.TransferObjects.address,om.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=Vo(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,vf.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,vf.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 k,N;const y=c.arguments[h];if(y.$kind!=="Input")return;const b=r[y.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const w=((k=b.UnresolvedPure)==null?void 0:k.value)??((N=b.UnresolvedObject)==null?void 0:N.objectId),T=(0,vf.getPureBcsSchema)(f.body);if(T){y.type="pure",r[r.indexOf(b)]=ja.Inputs.Pure(T.serialize(w));return}if(typeof w!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(w,null,2)}`);y.type="object";const I=b.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:w}}:b;r[y.Input]=I})}})}function oT(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 am(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=ja.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function aT(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 cT(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=uT(i.MoveCall._argumentTypes[s])||r}}),r}function uT(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 Vo(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 lT(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var lp=Object.defineProperty,fT=Object.getOwnPropertyDescriptor,dT=Object.getOwnPropertyNames,hT=Object.prototype.hasOwnProperty,pT=(e,t)=>{for(var r in t)lp(e,r,{get:t[r],enumerable:!0})},mT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dT(t))!hT.call(e,i)&&i!==r&&lp(e,i,{get:()=>t[i],enumerable:!(n=fT(t,i))||n.enumerable});return e},gT=e=>mT(lp({},"__esModule",{value:!0}),e),h_={};pT(h_,{createObjectMethods:()=>vT});var p_=gT(h_);function vT(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 fp=Object.defineProperty,yT=Object.getOwnPropertyDescriptor,bT=Object.getOwnPropertyNames,wT=Object.prototype.hasOwnProperty,_T=(e,t)=>{for(var r in t)fp(e,r,{get:t[r],enumerable:!0})},xT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bT(t))!wT.call(e,i)&&i!==r&&fp(e,i,{get:()=>t[i],enumerable:!(n=yT(t,i))||n.enumerable});return e},ST=e=>xT(fp({},"__esModule",{value:!0}),e),m_={};_T(m_,{createPure:()=>CT});var g_=ST(m_),ET=Pr,rr=ii;function CT(e){function t(r,n){if(typeof r=="string")return e(Ra(r).serialize(n));if(r instanceof Uint8Array||(0,ET.isSerializedBcs)(r))return e(r);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return t.u8=r=>e(rr.bcs.U8.serialize(r)),t.u16=r=>e(rr.bcs.U16.serialize(r)),t.u32=r=>e(rr.bcs.U32.serialize(r)),t.u64=r=>e(rr.bcs.U64.serialize(r)),t.u128=r=>e(rr.bcs.U128.serialize(r)),t.u256=r=>e(rr.bcs.U256.serialize(r)),t.bool=r=>e(rr.bcs.Bool.serialize(r)),t.string=r=>e(rr.bcs.String.serialize(r)),t.address=r=>e(rr.bcs.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(rr.bcs.vector(Ra(r)).serialize(n)),t.option=(r,n)=>e(rr.bcs.option(Ra(r)).serialize(n)),t}function Ra(e){switch(e){case"u8":return rr.bcs.u8();case"u16":return rr.bcs.u16();case"u32":return rr.bcs.u32();case"u64":return rr.bcs.u64();case"u128":return rr.bcs.u128();case"u256":return rr.bcs.u256();case"bool":return rr.bcs.bool();case"string":return rr.bcs.string();case"id":case"address":return rr.bcs.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?rr.bcs.vector(Ra(n)):rr.bcs.option(Ra(n))}throw new Error(`Invalid Pure type name: ${e}`)}var dp=Object.defineProperty,AT=Object.getOwnPropertyDescriptor,MT=Object.getOwnPropertyNames,TT=Object.prototype.hasOwnProperty,OT=(e,t)=>{for(var r in t)dp(e,r,{get:t[r],enumerable:!0})},IT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MT(t))!TT.call(e,i)&&i!==r&&dp(e,i,{get:()=>t[i],enumerable:!(n=AT(t,i))||n.enumerable});return e},PT=e=>IT(dp({},"__esModule",{value:!0}),e),v_={};OT(v_,{hashTypedData:()=>RT});var kT=PT(v_),jT=zs;function RT(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,jT.blake2b)(n,{dkLen:32})}var hp=Object.defineProperty,NT=Object.getOwnPropertyDescriptor,DT=Object.getOwnPropertyNames,$T=Object.prototype.hasOwnProperty,BT=(e,t)=>{for(var r in t)hp(e,r,{get:t[r],enumerable:!0})},LT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DT(t))!$T.call(e,i)&&i!==r&&hp(e,i,{get:()=>t[i],enumerable:!(n=NT(t,i))||n.enumerable});return e},FT=e=>LT(hp({},"__esModule",{value:!0}),e),y_={};BT(y_,{TransactionDataBuilder:()=>Ps});var pp=FT(y_),UT=Pr,yf=ls,Pc=ii,zT=Zr,bf=Uo,VT=o_,qT=kT;function cm(e){return(0,zT.normalizeSuiAddress)(e).replace("0x","")}class Ps{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=Pc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Ps.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=Pc.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 Ps.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 Ps((0,yf.parse)(bf.TransactionData,t)):new Ps((0,yf.parse)(bf.TransactionData,(0,VT.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,qT.hashTypedData)("TransactionData",t);return(0,UT.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 Pc.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:cm(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:cm(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return Pc.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 Ps.getDigestFromBytes(t)}snapshot(){return(0,yf.parse)(bf.TransactionData,this)}}var mp=Object.defineProperty,HT=Object.getOwnPropertyDescriptor,WT=Object.getOwnPropertyNames,GT=Object.prototype.hasOwnProperty,KT=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},XT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of WT(t))!GT.call(e,i)&&i!==r&&mp(e,i,{get:()=>t[i],enumerable:!(n=HT(t,i))||n.enumerable});return e},JT=e=>XT(mp({},"__esModule",{value:!0}),e),b_={};KT(b_,{extractMutableReference:()=>w_,extractReference:()=>__,extractStructTag:()=>ZT,getIdFromCallArg:()=>QT});var YT=JT(b_),fa=Zr;function w_(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function __(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function ZT(e){if(typeof e=="object"&&"Struct"in e)return e;const t=__(e),r=w_(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function QT(e){if(typeof e=="string")return(0,fa.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,fa.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,fa.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,fa.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,fa.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var gp=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,tO=Object.getOwnPropertyNames,rO=Object.prototype.hasOwnProperty,x_=e=>{throw TypeError(e)},nO=(e,t)=>{for(var r in t)gp(e,r,{get:t[r],enumerable:!0})},iO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tO(t))!rO.call(e,i)&&i!==r&&gp(e,i,{get:()=>t[i],enumerable:!(n=eO(t,i))||n.enumerable});return e},sO=e=>iO(gp({},"__esModule",{value:!0}),e),vp=(e,t,r)=>t.has(e)||x_("Cannot "+r),At=(e,t,r)=>(vp(e,t,"read from private field"),r?r.call(e):t.get(e)),da=(e,t,r)=>t.has(e)?x_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),gs=(e,t,r,n)=>(vp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),gi=(e,t,r)=>(vp(e,t,"access private method"),r),S_={};nO(S_,{Transaction:()=>dO,isTransaction:()=>C_});var ll=sO(S_),Kc=Pr,Vi=ls,oO=Zr,vs=op,ks=Uo,um=o_,aO=R5,kc=cl,cO=d_,uO=p_,lO=g_,ha=pp,lm=YT,Ea,Na,As,Ot,yn,Xc,yp,kd,bp;function fm(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 E_=Symbol.for("@mysten/transaction");function C_(e){return!!e&&typeof e=="object"&&e[E_]===!0}const dm={buildPlugins:new Map,serializationPlugins:new Map},wf=Symbol.for("@mysten/transaction/registry");function pa(){try{const e=globalThis;return e[wf]||(e[wf]=dm),e[wf]}catch{return dm}}const fO=class jd{constructor(){da(this,yn),da(this,Ea),da(this,Na),da(this,As,new Map),da(this,Ot),this.object=(0,uO.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Vi.is)(ks.Argument,r))return r;const n=(0,lm.getIdFromCallArg)(r),i=At(this,Ot).inputs.find(a=>n===(0,lm.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:At(this,Ot).inputs.indexOf(i),type:"object"}:At(this,Ot).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,oO.normalizeSuiAddress)(r)}}:r)});const t=pa();gs(this,Ot,new ha.TransactionDataBuilder),gs(this,Na,[...t.buildPlugins.values()]),gs(this,Ea,[...t.serializationPlugins.values()])}static fromKind(t){const r=new jd;return gs(r,Ot,ha.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,Kc.fromBase64)(t):t)),r}static from(t){const r=new jd;return C_(t)?gs(r,Ot,new ha.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?gs(r,Ot,ha.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,Kc.fromBase64)(t):t)):gs(r,Ot,ha.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){pa().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){pa().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){pa().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){pa().buildPlugins.delete(t)}addSerializationPlugin(t){At(this,Ea).push(t)}addBuildPlugin(t){At(this,Na).push(t)}addIntentResolver(t,r){if(At(this,As).has(t)&&At(this,As).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);At(this,As).set(t,r)}setSender(t){At(this,Ot).sender=t}setSenderIfNotSet(t){At(this,Ot).sender||(At(this,Ot).sender=t)}setExpiration(t){At(this,Ot).expiration=t?(0,Vi.parse)(ks.TransactionExpiration,t):null}setGasPrice(t){At(this,Ot).gasConfig.price=String(t)}setGasBudget(t){At(this,Ot).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){At(this,Ot).gasData.budget==null&&(At(this,Ot).gasConfig.budget=String(t))}setGasOwner(t){At(this,Ot).gasConfig.owner=t}setGasPayment(t){At(this,Ot).gasConfig.payment=t.map(r=>(0,Vi.parse)(ks.ObjectRef,r))}get blockData(){return(0,um.serializeV1TransactionData)(At(this,Ot).snapshot())}getData(){return At(this,Ot).snapshot()}get[E_](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,lO.createPure)(t=>(0,Kc.isSerializedBcs)(t)?At(this,Ot).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):At(this,Ot).addInput("pure",(0,Vi.is)(ks.NormalizedCallArg,t)?(0,Vi.parse)(ks.NormalizedCallArg,t):t instanceof Uint8Array?kc.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(kc.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(kc.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(kc.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=At(this,Ot).commands.push(t);return fm(r-1)}splitCoins(t,r){const n=vs.Commands.SplitCoins(typeof t=="string"?this.object(t):gi(this,yn,yp).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):gi(this,yn,Xc).call(this,s))),i=At(this,Ot).commands.push(n);return fm(i-1,r.length)}mergeCoins(t,r){return this.add(vs.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(vs.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(vs.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(vs.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>gi(this,yn,Xc).call(this,n))}))}transferObjects(t,r){return this.add(vs.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):gi(this,yn,Xc).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(vs.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,um.serializeV1TransactionData)(At(this,Ot).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Vi.parse)(aO.SerializedTransactionDataV2,At(this,Ot).snapshot()),(r,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(t){const{signer:r,...n}=t,i=await this.build(n);return r.signTransaction(i)}async build(t={}){return await this.prepareForSerialization(t),await gi(this,yn,kd).call(this,t),At(this,Ot).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await gi(this,yn,kd).call(this,t),At(this,Ot).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of At(this,Ot).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...At(this,Ea)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!At(this,As).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(At(this,As).get(s))}await gi(this,yn,bp).call(this,n,t)}};Ea=new WeakMap;Na=new WeakMap;As=new WeakMap;Ot=new WeakMap;yn=new WeakSet;Xc=function(e){return(0,Kc.isSerializedBcs)(e)?this.pure(e):gi(this,yn,yp).call(this,e)};yp=function(e){return typeof e=="function"?(0,Vi.parse)(ks.Argument,e(this)):(0,Vi.parse)(ks.Argument,e)};kd=async function(e){if(!e.onlyTransactionKind&&!At(this,Ot).sender)throw new Error("Missing transaction sender");await gi(this,yn,bp).call(this,[...At(this,Na),cO.resolveTransactionData],e)};bp=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(At(this,Ot),t,async()=>{if(o)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);o=!0,await s(),a=!0}),!o)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await r(0)()};let dO=fO;var wp=Object.defineProperty,hO=Object.getOwnPropertyDescriptor,pO=Object.getOwnPropertyNames,mO=Object.prototype.hasOwnProperty,A_=e=>{throw TypeError(e)},gO=(e,t)=>{for(var r in t)wp(e,r,{get:t[r],enumerable:!0})},vO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pO(t))!mO.call(e,i)&&i!==r&&wp(e,i,{get:()=>t[i],enumerable:!(n=hO(t,i))||n.enumerable});return e},yO=e=>vO(wp({},"__esModule",{value:!0}),e),M_=(e,t,r)=>t.has(e)||A_("Cannot "+r),dr=(e,t,r)=>(M_(e,t,"read from private field"),r?r.call(e):t.get(e)),Rd=(e,t,r)=>t.has(e)?A_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),hm=(e,t,r,n)=>(M_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),T_={};gO(T_,{AsyncCache:()=>I_,InMemoryCache:()=>P_,ObjectCache:()=>bO});var O_=yO(T_),_f=Zr,Ms,Cr,Jc;class I_{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,_f.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,_f.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,_f.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 P_ extends I_{constructor(){super(...arguments),Rd(this,Ms,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return dr(this,Ms)[t].get(r)??null}async set(t,r,n){dr(this,Ms)[t].set(r,n)}async delete(t,r){dr(this,Ms)[t].delete(r)}async clear(t){if(t)dr(this,Ms)[t].clear();else for(const r of Object.values(dr(this,Ms)))r.clear()}}Ms=new WeakMap;class bO{constructor({cache:t=new P_,onEffects:r}){Rd(this,Cr),Rd(this,Jc),hm(this,Cr,t),hm(this,Jc,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,Jc))==null?void 0:r.call(this,t)])}}Cr=new WeakMap;Jc=new WeakMap;var _p=Object.defineProperty,wO=Object.getOwnPropertyDescriptor,_O=Object.getOwnPropertyNames,xO=Object.prototype.hasOwnProperty,k_=e=>{throw TypeError(e)},SO=(e,t)=>{for(var r in t)_p(e,r,{get:t[r],enumerable:!0})},EO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _O(t))!xO.call(e,i)&&i!==r&&_p(e,i,{get:()=>t[i],enumerable:!(n=wO(t,i))||n.enumerable});return e},CO=e=>EO(_p({},"__esModule",{value:!0}),e),j_=(e,t,r)=>t.has(e)||k_("Cannot "+r),ma=(e,t,r)=>(j_(e,t,"read from private field"),r?r.call(e):t.get(e)),pm=(e,t,r)=>t.has(e)?k_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xf=(e,t,r,n)=>(j_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),R_={};SO(R_,{CachingTransactionExecutor:()=>OO});var N_=CO(R_),AO=ii,MO=O_,TO=ll,fo,ho;class OO{constructor({client:t,...r}){pm(this,fo),pm(this,ho,null),xf(this,fo,t),this.cache=new MO.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:ma(this,fo),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,TO.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await ma(this,fo).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=AO.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;xf(this,ho,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){ma(this,ho)&&(await ma(this,fo).waitForTransaction({digest:ma(this,ho)}),xf(this,ho,null))}}fo=new WeakMap;ho=new WeakMap;var xp=Object.defineProperty,IO=Object.getOwnPropertyDescriptor,PO=Object.getOwnPropertyNames,kO=Object.prototype.hasOwnProperty,D_=e=>{throw TypeError(e)},jO=(e,t)=>{for(var r in t)xp(e,r,{get:t[r],enumerable:!0})},RO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of PO(t))!kO.call(e,i)&&i!==r&&xp(e,i,{get:()=>t[i],enumerable:!(n=IO(t,i))||n.enumerable});return e},NO=e=>RO(xp({},"__esModule",{value:!0}),e),DO=(e,t,r)=>t.has(e)||D_("Cannot "+r),_n=(e,t,r)=>(DO(e,t,"read from private field"),r?r.call(e):t.get(e)),$_=(e,t,r)=>t.has(e)?D_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),B_={};jO(B_,{ParallelQueue:()=>BO,SerialQueue:()=>$O});var L_=NO(B_),Fi,Ts;class $O{constructor(){$_(this,Fi,[])}async runTask(t){return new Promise((r,n)=>{_n(this,Fi).push(()=>{t().finally(()=>{_n(this,Fi).shift(),_n(this,Fi).length>0&&_n(this,Fi)[0]()}).then(r,n)}),_n(this,Fi).length===1&&_n(this,Fi)[0]()})}}Fi=new WeakMap;class BO{constructor(t){$_(this,Ts,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{_n(this,Ts).length>0?_n(this,Ts).shift()():this.activeTasks--}).then(r,n)):_n(this,Ts).push(()=>{t().finally(()=>{_n(this,Ts).length>0?_n(this,Ts).shift()():this.activeTasks--}).then(r,n)})})}}Ts=new WeakMap;var Sp=Object.defineProperty,LO=Object.getOwnPropertyDescriptor,FO=Object.getOwnPropertyNames,UO=Object.prototype.hasOwnProperty,F_=e=>{throw TypeError(e)},zO=(e,t)=>{for(var r in t)Sp(e,r,{get:t[r],enumerable:!0})},VO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FO(t))!UO.call(e,i)&&i!==r&&Sp(e,i,{get:()=>t[i],enumerable:!(n=LO(t,i))||n.enumerable});return e},qO=e=>VO(Sp({},"__esModule",{value:!0}),e),U_=(e,t,r)=>t.has(e)||F_("Cannot "+r),Er=(e,t,r)=>(U_(e,t,"read from private field"),r?r.call(e):t.get(e)),eo=(e,t,r)=>t.has(e)?F_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Sf=(e,t,r,n)=>(U_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),z_={};zO(z_,{SerialTransactionExecutor:()=>KO,getGasCoinFromEffects:()=>q_});var V_=qO(z_),HO=Pr,mm=ll,WO=N_,GO=L_,Yc,Ca,gn,Zc,Nd,Qc;class KO{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){eo(this,Yc,new GO.SerialQueue),eo(this,Ca),eo(this,gn),eo(this,Zc),eo(this,Nd,async i=>{if(!i.V2)return;const s=q_(i).ref;s?Er(this,gn).cache.setCustom("gasCoin",s):Er(this,gn).cache.deleteCustom("gasCoin")}),eo(this,Qc,async i=>{const s=await Er(this,gn).cache.getCustom("gasCoin"),o=mm.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Er(this,Zc)),o.setSenderIfNotSet(Er(this,Ca).toSuiAddress()),Er(this,gn).buildTransaction({transaction:o})}),Sf(this,Ca,t),Sf(this,Zc,r),Sf(this,gn,new WO.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Er(this,Nd).call(this,i)}))}async applyEffects(t){return Er(this,gn).applyEffects(t)}async buildTransaction(t){return Er(this,Yc).runTask(()=>Er(this,Qc).call(this,t))}resetCache(){return Er(this,gn).reset()}waitForLastTransaction(){return Er(this,gn).waitForLastTransaction()}executeTransaction(t,r){return Er(this,Yc).runTask(async()=>{const n=(0,mm.isTransaction)(t)?await Er(this,Qc).call(this,t):t,{signature:i}=await Er(this,Ca).signTransaction(n),s=await Er(this,gn).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,HO.toBase64)(o),data:s}})}}Yc=new WeakMap;Ca=new WeakMap;gn=new WeakMap;Zc=new WeakMap;Nd=new WeakMap;Qc=new WeakMap;function q_(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 Ep=Object.defineProperty,XO=Object.getOwnPropertyDescriptor,JO=Object.getOwnPropertyNames,YO=Object.prototype.hasOwnProperty,H_=e=>{throw TypeError(e)},ZO=(e,t)=>{for(var r in t)Ep(e,r,{get:t[r],enumerable:!0})},QO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JO(t))!YO.call(e,i)&&i!==r&&Ep(e,i,{get:()=>t[i],enumerable:!(n=XO(t,i))||n.enumerable});return e},eI=e=>QO(Ep({},"__esModule",{value:!0}),e),Cp=(e,t,r)=>t.has(e)||H_("Cannot "+r),qe=(e,t,r)=>(Cp(e,t,"read from private field"),r?r.call(e):t.get(e)),lr=(e,t,r)=>t.has(e)?H_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),tr=(e,t,r,n)=>(Cp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),on=(e,t,r)=>(Cp(e,t,"access private method"),r),gm=(e,t,r,n)=>({set _(i){tr(e,t,i,r)},get _(){return qe(e,t,n)}}),W_={};ZO(W_,{ParallelTransactionExecutor:()=>oI});var tI=eI(W_),rI=Pr,G_=ii,nI=ll,iI=pp,sI=N_,vm=L_,K_=V_,Zi,Xn,Mu,qa,Da,Ha,Tu,Ao,Nr,Qi,Ls,Ds,Ap,eu,Wa,go,Po,yi,zr,X_,J_,Ga,Mp,Y_,Dd,Z_;const ga={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class oI{constructor(t){lr(this,zr),lr(this,Zi),lr(this,Xn),lr(this,Mu),lr(this,qa),lr(this,Da),lr(this,Ha),lr(this,Tu),lr(this,Ao),lr(this,Nr),lr(this,Qi,[]),lr(this,Ls),lr(this,Ds,new Map),lr(this,Ap,new vm.SerialQueue),lr(this,eu),lr(this,Wa,null),lr(this,go,null),lr(this,Po,0),lr(this,yi,null),tr(this,Zi,t.signer),tr(this,Xn,t.client),tr(this,Mu,t.coinBatchSize??ga.coinBatchSize),tr(this,qa,t.initialCoinBalance??ga.initialCoinBalance),tr(this,Da,t.minimumCoinBalance??ga.minimumCoinBalance),tr(this,Tu,t.defaultGasBudget??qe(this,Da)),tr(this,Ha,t.epochBoundaryWindow??ga.epochBoundaryWindow),tr(this,Ao,t.maxPoolSize??ga.maxPoolSize),tr(this,Ls,new sI.CachingTransactionExecutor({client:t.client,cache:t.cache})),tr(this,eu,new vm.ParallelQueue(qe(this,Ao))),tr(this,Nr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return tr(this,yi,null),on(this,zr,Ga).call(this,()=>qe(this,Ls).reset())}async waitForLastTransaction(){await on(this,zr,Ga).call(this,()=>on(this,zr,Mp).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=aI(),o=await on(this,zr,X_).call(this,t),a=()=>{qe(this,eu).runTask(()=>on(this,zr,J_).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}}Zi=new WeakMap;Xn=new WeakMap;Mu=new WeakMap;qa=new WeakMap;Da=new WeakMap;Ha=new WeakMap;Tu=new WeakMap;Ao=new WeakMap;Nr=new WeakMap;Qi=new WeakMap;Ls=new WeakMap;Ds=new WeakMap;Ap=new WeakMap;eu=new WeakMap;Wa=new WeakMap;go=new WeakMap;Po=new WeakMap;yi=new WeakMap;zr=new WeakSet;X_=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,Xn)}),t};J_=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(qe(this,Zi).toSuiAddress()),await qe(this,Ap).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await on(this,zr,Dd).call(this)),e.setGasBudgetIfNotSet(qe(this,Tu)),await on(this,zr,Ga).call(this),n=await on(this,zr,Y_).call(this),gm(this,Po)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await qe(this,Ls).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:qe(this,Xn)}),{signature:o}=await qe(this,Zi).signTransaction(s),a=await qe(this,Ls).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=G_.bcs.TransactionEffects.parse(c),l=(0,K_.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 iI.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=qe(this,Da)?qe(this,Qi).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(qe(this,Nr)||tr(this,Nr,new Map),qe(this,Nr).set(l.ref.objectId,l.ref))}return tr(this,Wa,a.digest),{digest:a.digest,effects:(0,rI.toBase64)(c),data:a}}catch(s){throw n&&(qe(this,Nr)||tr(this,Nr,new Map),qe(this,Nr).set(n.id,null)),await on(this,zr,Ga).call(this,async()=>{await Promise.all([qe(this,Ls).cache.deleteObjects([...t]),on(this,zr,Mp).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)}),gm(this,Po)._--}};Ga=async function(e){qe(this,go)&&await qe(this,go),tr(this,go,(e==null?void 0:e().then(()=>{tr(this,go,null)},()=>{}))??null)};Mp=async function(){const e=qe(this,Wa);e&&(tr(this,Wa,null),await qe(this,Xn).waitForTransaction({digest:e}))};Y_=async function(){if(qe(this,Qi).length===0&&qe(this,Po)<=qe(this,Ao)&&await on(this,zr,Z_).call(this),qe(this,Qi).length===0)throw new Error("No coins available");return qe(this,Qi).shift()};Dd=async function(){if((qe(this,yi)?qe(this,yi).expiration-qe(this,Ha)-Date.now():0)>0)return qe(this,yi).price;if(qe(this,yi)){const r=Math.max(qe(this,yi).expiration+qe(this,Ha)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await qe(this,Xn).getLatestSuiSystemState();return tr(this,yi,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),on(this,zr,Dd).call(this)};Z_=async function(){var u;const e=Math.min(qe(this,Mu),qe(this,Ao)-(qe(this,Qi).length+qe(this,Po))+1);if(e===0)return;const t=new nI.Transaction,r=qe(this,Zi).toSuiAddress();if(t.setSender(r),qe(this,Nr)){const l=[],f=[];for(const[h,y]of qe(this,Nr))y?l.push(y):f.push(h);if(f.length>0){const h=await qe(this,Xn).multiGetObjects({ids:f});l.push(...h.filter(y=>y.data!==null).map(({data:y})=>({objectId:y.objectId,version:y.version,digest:y.digest})))}t.setGasPayment(l),tr(this,Nr,new Map)}const n=new Array(e).fill(qe(this,qa)),i=t.splitCoins(t.gas,n),s=[];for(let l=0;l<n.length;l++)s.push(i[l]);t.transferObjects(s,r),await this.waitForLastTransaction();const o=await qe(this,Xn).signAndExecuteTransaction({transaction:t,signer:qe(this,Zi),options:{showRawEffects:!0}}),a=G_.bcs.TransactionEffects.parse(Uint8Array.from(o.rawEffects));(u=a.V2)==null||u.changedObjects.forEach(([l,{outputState:f}],h)=>{var y;h===((y=a.V2)==null?void 0:y.gasObjectIndex)||!f.ObjectWrite||qe(this,Qi).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(qe(this,qa))})}),qe(this,Nr)||tr(this,Nr,new Map);const c=(0,K_.getGasCoinFromEffects)(a).ref;qe(this,Nr).set(c.objectId,c),await qe(this,Xn).waitForTransaction({digest:o.digest})};function aI(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var Tp=Object.defineProperty,cI=Object.getOwnPropertyDescriptor,uI=Object.getOwnPropertyNames,lI=Object.prototype.hasOwnProperty,fI=(e,t)=>{for(var r in t)Tp(e,r,{get:t[r],enumerable:!0})},dI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uI(t))!lI.call(e,i)&&i!==r&&Tp(e,i,{get:()=>t[i],enumerable:!(n=cI(t,i))||n.enumerable});return e},hI=e=>dI(Tp({},"__esModule",{value:!0}),e),Q_={};fI(Q_,{coinWithBalance:()=>vI});var pI=hI(Q_),tu=ls,mI=ii,e4=Zr,ru=op,ym=cl,gI=d_;const Ou="CoinWithBalance",bm=(0,e4.normalizeStructTag)("0x2::sui::SUI");function vI({type:e=bm,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(Ou,bI);const i=e==="gas"?e:(0,e4.normalizeStructTag)(e);return n.add(ru.Commands.Intent({name:Ou,inputs:{},data:{type:i===bm&&r?"gas":i,balance:BigInt(t)}}))}}const yI=(0,tu.object)({type:(0,tu.string)(),balance:(0,tu.bigint)()});async function bI(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===Ou){const{type:h,balance:y}=(0,tu.parse)(yI,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,gI.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await wI({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!==Ou)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,ru.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[T,...I]=o.get(y).map(k=>e.addInput("object",ym.Inputs.ObjectRef({objectId:k.coinObjectId,digest:k.digest,version:k.version})));I.length>0&&w.push(ru.Commands.MergeCoins(T,I)),c.set(y,T)}w.push(ru.Commands.SplitCoins(c.get(y),[e.addInput("pure",ym.Inputs.Pure(mI.bcs.u64().serialize(b)))])),e.replaceCommand(f,w),e.mapArguments(T=>T.$kind==="Result"&&T.Result===f?{$kind:"NestedResult",NestedResult:[f+w.length-1,0]}:T)}return r()}async function wI({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 Op=Object.defineProperty,_I=Object.getOwnPropertyDescriptor,xI=Object.getOwnPropertyNames,SI=Object.prototype.hasOwnProperty,EI=(e,t)=>{for(var r in t)Op(e,r,{get:t[r],enumerable:!0})},CI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xI(t))!SI.call(e,i)&&i!==r&&Op(e,i,{get:()=>t[i],enumerable:!(n=_I(t,i))||n.enumerable});return e},AI=e=>CI(Op({},"__esModule",{value:!0}),e),t4={};EI(t4,{Arguments:()=>II});var MI=AI(t4),TI=p_,OI=g_;const II={pure:(0,OI.createPure)(e=>t=>t.pure(e)),object:(0,TI.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 Ip=Object.defineProperty,PI=Object.getOwnPropertyDescriptor,kI=Object.getOwnPropertyNames,jI=Object.prototype.hasOwnProperty,RI=(e,t)=>{for(var r in t)Ip(e,r,{get:t[r],enumerable:!0})},NI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kI(t))!jI.call(e,i)&&i!==r&&Ip(e,i,{get:()=>t[i],enumerable:!(n=PI(t,i))||n.enumerable});return e},DI=e=>NI(Ip({},"__esModule",{value:!0}),e),r4={};RI(r4,{findTransactionBlockNames:()=>BI,listToRequests:()=>FI,replaceNames:()=>LI});var $I=DI(r4),n4=l2;const vo="/",BI=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){wm([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(vo)){if(!(0,n4.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}wm(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function wm(e){const t=new Set;for(const r of e)if(r.includes(vo)){if(!(0,n4.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const LI=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(vo))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(vo)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(vo)&&(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(vo)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},FI=(e,t)=>{const r=[],n=_m(e.packages),i=_m(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 UI(r,t)},_m=e=>[...new Set(e)],UI=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var Pp=Object.defineProperty,zI=Object.getOwnPropertyDescriptor,VI=Object.getOwnPropertyNames,qI=Object.prototype.hasOwnProperty,HI=(e,t)=>{for(var r in t)Pp(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&&Pp(e,i,{get:()=>t[i],enumerable:!(n=zI(t,i))||n.enumerable});return e},GI=e=>WI(Pp({},"__esModule",{value:!0}),e),i4={};HI(i4,{namedPackagesPlugin:()=>XI});var KI=GI(i4),Ef=$I;const XI=({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,Ef.findTransactionBlockNames)(s),u=(0,Ef.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,Ef.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`${xm(l.id)}: ${f}(name:"${l.name}") {
|
|
26
|
+
${h}
|
|
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=xm(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}},xm=e=>`key_${e}`;var kp=Object.defineProperty,JI=Object.getOwnPropertyDescriptor,YI=Object.getOwnPropertyNames,ZI=Object.prototype.hasOwnProperty,QI=(e,t)=>{for(var r in t)kp(e,r,{get:t[r],enumerable:!0})},eP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YI(t))!ZI.call(e,i)&&i!==r&&kp(e,i,{get:()=>t[i],enumerable:!(n=JI(t,i))||n.enumerable});return e},tP=e=>eP(kp({},"__esModule",{value:!0}),e),s4={};QI(s4,{Arguments:()=>aP.Arguments,AsyncCache:()=>Am.AsyncCache,Commands:()=>Em.Commands,Inputs:()=>rP.Inputs,ObjectCache:()=>Am.ObjectCache,ParallelTransactionExecutor:()=>sP.ParallelTransactionExecutor,SerialTransactionExecutor:()=>iP.SerialTransactionExecutor,Transaction:()=>Cm.Transaction,TransactionDataBuilder:()=>nP.TransactionDataBuilder,UpgradePolicy:()=>Em.UpgradePolicy,coinWithBalance:()=>oP.coinWithBalance,getPureBcsSchema:()=>Sm.getPureBcsSchema,isTransaction:()=>Cm.isTransaction,namedPackagesPlugin:()=>cP.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>Sm.normalizedTypeToMoveTypeSignature});var yo=tP(s4),Sm=K2,rP=cl,Em=op,Cm=ll,nP=pp,Am=O_,iP=V_,sP=tI,oP=pI,aP=MI,cP=KI,o4={},fl={},jp={},dl={},Rp={},hl={};Object.defineProperty(hl,"__esModule",{value:!0});hl.Convert=void 0;class uP{static toPriceFeed(t){return Cf(t,bi("PriceFeed"))}static priceFeedToJson(t){return Af(t,bi("PriceFeed"))}static toPrice(t){return Cf(t,bi("Price"))}static priceToJson(t){return Af(t,bi("Price"))}static toPriceFeedMetadata(t){return Cf(t,bi("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return Af(t,bi("PriceFeedMetadata"))}}hl.Convert=uP;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 lP(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 fP(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 bo(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 bo(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=>bo(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 w=l[b],T=Object.prototype.hasOwnProperty.call(h,b)?h[b]:void 0;y[w.key]=bo(T,w.typ,r,w.key)}),Object.getOwnPropertyNames(h).forEach(b=>{Object.prototype.hasOwnProperty.call(l,b)||(y[b]=bo(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=dP[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 Cf(e,t){return bo(e,t,lP)}function Af(e,t){return bo(e,t,fP)}function ys(...e){return{unionMembers:e}}function Mf(e,t){return{props:e,additional:t}}function bi(e){return{ref:e}}const dP={PriceFeed:Mf([{json:"ema_price",js:"ema_price",typ:bi("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:ys(void 0,bi("PriceFeedMetadata"))},{json:"price",js:"price",typ:bi("Price")},{json:"vaa",js:"vaa",typ:ys(void 0,"")}],"any"),Price:Mf([{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:Mf([{json:"attestation_time",js:"attestation_time",typ:ys(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:ys(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:ys(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:ys(void 0,0)},{json:"slot",js:"slot",typ:ys(void 0,0)}],"any")};var pc={};(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(k){var N=k.length;if(N%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var U=k.indexOf("=");U===-1&&(U=N);var L=U===N?0:4-U%4;return[U,L]}function l(k){var N=u(k),U=N[0],L=N[1];return(U+L)*3/4-L}function f(k,N,U){return(N+U)*3/4-U}function h(k){var N,U=u(k),L=U[0],W=U[1],q=new s(f(k,L,W)),X=0,re=W>0?L-4:L,oe;for(oe=0;oe<re;oe+=4)N=i[k.charCodeAt(oe)]<<18|i[k.charCodeAt(oe+1)]<<12|i[k.charCodeAt(oe+2)]<<6|i[k.charCodeAt(oe+3)],q[X++]=N>>16&255,q[X++]=N>>8&255,q[X++]=N&255;return W===2&&(N=i[k.charCodeAt(oe)]<<2|i[k.charCodeAt(oe+1)]>>4,q[X++]=N&255),W===1&&(N=i[k.charCodeAt(oe)]<<10|i[k.charCodeAt(oe+1)]<<4|i[k.charCodeAt(oe+2)]>>2,q[X++]=N>>8&255,q[X++]=N&255),q}function y(k){return n[k>>18&63]+n[k>>12&63]+n[k>>6&63]+n[k&63]}function b(k,N,U){for(var L,W=[],q=N;q<U;q+=3)L=(k[q]<<16&16711680)+(k[q+1]<<8&65280)+(k[q+2]&255),W.push(y(L));return W.join("")}function w(k){for(var N,U=k.length,L=U%3,W=[],q=16383,X=0,re=U-L;X<re;X+=q)W.push(b(k,X,X+q>re?re:X+q));return L===1?(N=k[U-1],W.push(n[N>>2]+n[N<<4&63]+"==")):L===2&&(N=(k[U-2]<<8)+k[U-1],W.push(n[N>>10]+n[N>>4&63]+n[N<<2&63]+"=")),W.join("")}var T={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */T.read=function(k,N,U,L,W){var q,X,re=W*8-L-1,oe=(1<<re)-1,H=oe>>1,F=-7,D=U?W-1:0,p=U?-1:1,d=k[N+D];for(D+=p,q=d&(1<<-F)-1,d>>=-F,F+=re;F>0;q=q*256+k[N+D],D+=p,F-=8);for(X=q&(1<<-F)-1,q>>=-F,F+=L;F>0;X=X*256+k[N+D],D+=p,F-=8);if(q===0)q=1-H;else{if(q===oe)return X?NaN:(d?-1:1)*(1/0);X=X+Math.pow(2,L),q=q-H}return(d?-1:1)*X*Math.pow(2,q-L)},T.write=function(k,N,U,L,W,q){var X,re,oe,H=q*8-W-1,F=(1<<H)-1,D=F>>1,p=W===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=L?0:q-1,m=L?1:-1,x=N<0||N===0&&1/N<0?1:0;for(N=Math.abs(N),isNaN(N)||N===1/0?(re=isNaN(N)?1:0,X=F):(X=Math.floor(Math.log(N)/Math.LN2),N*(oe=Math.pow(2,-X))<1&&(X--,oe*=2),X+D>=1?N+=p/oe:N+=p*Math.pow(2,1-D),N*oe>=2&&(X++,oe/=2),X+D>=F?(re=0,X=F):X+D>=1?(re=(N*oe-1)*Math.pow(2,W),X=X+D):(re=N*Math.pow(2,D-1)*Math.pow(2,W),X=0));W>=8;k[U+d]=re&255,d+=m,re/=256,W-=8);for(X=X<<W|re,H+=W;H>0;k[U+d]=X&255,d+=m,X/=256,H-=8);k[U+d-m]|=x*128};/*!
|
|
29
|
+
* The buffer module from node.js, for the browser.
|
|
30
|
+
*
|
|
31
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
32
|
+
* @license MIT
|
|
33
|
+
*/(function(k){const N=r,U=T,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;k.Buffer=F,k.SlowBuffer=v,k.INSPECT_MAX_BYTES=50;const W=2147483647;k.kMaxLength=W;const{Uint8Array:q,ArrayBuffer:X,SharedArrayBuffer:re}=globalThis;F.TYPED_ARRAY_SUPPORT=oe(),!F.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 oe(){try{const R=new q(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,q.prototype),Object.setPrototypeOf(R,S),R.foo()===42}catch{return!1}}Object.defineProperty(F.prototype,"parent",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.buffer}}),Object.defineProperty(F.prototype,"offset",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.byteOffset}});function H(R){if(R>W)throw new RangeError('The value "'+R+'" is invalid for option "size"');const S=new q(R);return Object.setPrototypeOf(S,F.prototype),S}function F(R,S,M){if(typeof R=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(R)}return D(R,S,M)}F.poolSize=8192;function D(R,S,M){if(typeof R=="string")return x(R,S);if(X.isView(R))return E(R);if(R==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof R);if(gt(R,X)||R&>(R.buffer,X)||typeof re<"u"&&(gt(R,re)||R&>(R.buffer,re)))return O(R,S,M);if(typeof R=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=R.valueOf&&R.valueOf();if(B!=null&&B!==R)return F.from(B,S,M);const K=C(R);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof R[Symbol.toPrimitive]=="function")return F.from(R[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 R)}F.from=function(R,S,M){return D(R,S,M)},Object.setPrototypeOf(F.prototype,q.prototype),Object.setPrototypeOf(F,q);function p(R){if(typeof R!="number")throw new TypeError('"size" argument must be of type number');if(R<0)throw new RangeError('The value "'+R+'" is invalid for option "size"')}function d(R,S,M){return p(R),R<=0?H(R):S!==void 0?typeof M=="string"?H(R).fill(S,M):H(R).fill(S):H(R)}F.alloc=function(R,S,M){return d(R,S,M)};function m(R){return p(R),H(R<0?0:g(R)|0)}F.allocUnsafe=function(R){return m(R)},F.allocUnsafeSlow=function(R){return m(R)};function x(R,S){if((typeof S!="string"||S==="")&&(S="utf8"),!F.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const M=j(R,S)|0;let B=H(M);const K=B.write(R,S);return K!==M&&(B=B.slice(0,K)),B}function A(R){const S=R.length<0?0:g(R.length)|0,M=H(S);for(let B=0;B<S;B+=1)M[B]=R[B]&255;return M}function E(R){if(gt(R,q)){const S=new q(R);return O(S.buffer,S.byteOffset,S.byteLength)}return A(R)}function O(R,S,M){if(S<0||R.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(R.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(R):M===void 0?B=new q(R,S):B=new q(R,S,M),Object.setPrototypeOf(B,F.prototype),B}function C(R){if(F.isBuffer(R)){const S=g(R.length)|0,M=H(S);return M.length===0||R.copy(M,0,0,S),M}if(R.length!==void 0)return typeof R.length!="number"||Pt(R.length)?H(0):A(R);if(R.type==="Buffer"&&Array.isArray(R.data))return A(R.data)}function g(R){if(R>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return R|0}function v(R){return+R!=R&&(R=0),F.alloc(+R)}F.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==F.prototype},F.compare=function(S,M){if(gt(S,q)&&(S=F.from(S,S.offset,S.byteLength)),gt(M,q)&&(M=F.from(M,M.offset,M.byteLength)),!F.isBuffer(S)||!F.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,te=Math.min(B,K);Z<te;++Z)if(S[Z]!==M[Z]){B=S[Z],K=M[Z];break}return B<K?-1:K<B?1:0},F.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}},F.concat=function(S,M){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return F.alloc(0);let B;if(M===void 0)for(M=0,B=0;B<S.length;++B)M+=S[B].length;const K=F.allocUnsafe(M);let Z=0;for(B=0;B<S.length;++B){let te=S[B];if(gt(te,q))Z+te.length>K.length?(F.isBuffer(te)||(te=F.from(te)),te.copy(K,Z)):q.prototype.set.call(K,te,Z);else if(F.isBuffer(te))te.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=te.length}return K};function j(R,S){if(F.isBuffer(R))return R.length;if(X.isView(R)||gt(R,X))return R.byteLength;if(typeof R!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof R);const M=R.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&M===0)return 0;let K=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return M;case"utf8":case"utf-8":return It(R).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M*2;case"hex":return M>>>1;case"base64":return Ct(R).length;default:if(K)return B?-1:It(R).length;S=(""+S).toLowerCase(),K=!0}}F.byteLength=j;function ee(R,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(R||(R="utf8");;)switch(R){case"hex":return Ve(this,S,M);case"utf8":case"utf-8":return De(this,S,M);case"ascii":return me(this,S,M);case"latin1":case"binary":return Me(this,S,M);case"base64":return ht(this,S,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ne(this,S,M);default:if(B)throw new TypeError("Unknown encoding: "+R);R=(R+"").toLowerCase(),B=!0}}F.prototype._isBuffer=!0;function ie(R,S,M){const B=R[S];R[S]=R[M],R[M]=B}F.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)ie(this,M,M+1);return this},F.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)ie(this,M,M+3),ie(this,M+1,M+2);return this},F.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)ie(this,M,M+7),ie(this,M+1,M+6),ie(this,M+2,M+5),ie(this,M+3,M+4);return this},F.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?De(this,0,S):ee.apply(this,arguments)},F.prototype.toLocaleString=F.prototype.toString,F.prototype.equals=function(S){if(!F.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:F.compare(this,S)===0},F.prototype.inspect=function(){let S="";const M=k.INSPECT_MAX_BYTES;return S=this.toString("hex",0,M).replace(/(.{2})/g,"$1 ").trim(),this.length>M&&(S+=" ... "),"<Buffer "+S+">"},L&&(F.prototype[L]=F.prototype.inspect),F.prototype.compare=function(S,M,B,K,Z){if(gt(S,q)&&(S=F.from(S,S.offset,S.byteLength)),!F.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 te=Z-K,$e=B-M;const et=Math.min(te,$e),Re=this.slice(K,Z),V=S.slice(M,B);for(let ae=0;ae<et;++ae)if(Re[ae]!==V[ae]){te=Re[ae],$e=V[ae];break}return te<$e?-1:$e<te?1:0};function fe(R,S,M,B,K){if(R.length===0)return-1;if(typeof M=="string"?(B=M,M=0):M>2147483647?M=2147483647:M<-2147483648&&(M=-2147483648),M=+M,Pt(M)&&(M=K?0:R.length-1),M<0&&(M=R.length+M),M>=R.length){if(K)return-1;M=R.length-1}else if(M<0)if(K)M=0;else return-1;if(typeof S=="string"&&(S=F.from(S,B)),F.isBuffer(S))return S.length===0?-1:ve(R,S,M,B,K);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(R,S,M):q.prototype.lastIndexOf.call(R,S,M):ve(R,[S],M,B,K);throw new TypeError("val must be string, number or Buffer")}function ve(R,S,M,B,K){let Z=1,te=R.length,$e=S.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(R.length<2||S.length<2)return-1;Z=2,te/=2,$e/=2,M/=2}function et(V,ae){return Z===1?V[ae]:V.readUInt16BE(ae*Z)}let Re;if(K){let V=-1;for(Re=M;Re<te;Re++)if(et(R,Re)===et(S,V===-1?0:Re-V)){if(V===-1&&(V=Re),Re-V+1===$e)return V*Z}else V!==-1&&(Re-=Re-V),V=-1}else for(M+$e>te&&(M=te-$e),Re=M;Re>=0;Re--){let V=!0;for(let ae=0;ae<$e;ae++)if(et(R,Re+ae)!==et(S,ae)){V=!1;break}if(V)return Re}return-1}F.prototype.includes=function(S,M,B){return this.indexOf(S,M,B)!==-1},F.prototype.indexOf=function(S,M,B){return fe(this,S,M,B,!0)},F.prototype.lastIndexOf=function(S,M,B){return fe(this,S,M,B,!1)};function Se(R,S,M,B){M=Number(M)||0;const K=R.length-M;B?(B=Number(B),B>K&&(B=K)):B=K;const Z=S.length;B>Z/2&&(B=Z/2);let te;for(te=0;te<B;++te){const $e=parseInt(S.substr(te*2,2),16);if(Pt($e))return te;R[M+te]=$e}return te}function xe(R,S,M,B){return Je(It(S,R.length-M),R,M,B)}function He(R,S,M,B){return Je(nt(S),R,M,B)}function Fe(R,S,M,B){return Je(Ct(S),R,M,B)}function dt(R,S,M,B){return Je(bt(S,R.length-M),R,M,B)}F.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 te=!1;for(;;)switch(K){case"hex":return Se(this,S,M,B);case"utf8":case"utf-8":return xe(this,S,M,B);case"ascii":case"latin1":case"binary":return He(this,S,M,B);case"base64":return Fe(this,S,M,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dt(this,S,M,B);default:if(te)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),te=!0}},F.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(R,S,M){return S===0&&M===R.length?N.fromByteArray(R):N.fromByteArray(R.slice(S,M))}function De(R,S,M){M=Math.min(R.length,M);const B=[];let K=S;for(;K<M;){const Z=R[K];let te=null,$e=Z>239?4:Z>223?3:Z>191?2:1;if(K+$e<=M){let et,Re,V,ae;switch($e){case 1:Z<128&&(te=Z);break;case 2:et=R[K+1],(et&192)===128&&(ae=(Z&31)<<6|et&63,ae>127&&(te=ae));break;case 3:et=R[K+1],Re=R[K+2],(et&192)===128&&(Re&192)===128&&(ae=(Z&15)<<12|(et&63)<<6|Re&63,ae>2047&&(ae<55296||ae>57343)&&(te=ae));break;case 4:et=R[K+1],Re=R[K+2],V=R[K+3],(et&192)===128&&(Re&192)===128&&(V&192)===128&&(ae=(Z&15)<<18|(et&63)<<12|(Re&63)<<6|V&63,ae>65535&&ae<1114112&&(te=ae))}}te===null?(te=65533,$e=1):te>65535&&(te-=65536,B.push(te>>>10&1023|55296),te=56320|te&1023),B.push(te),K+=$e}return _e(B)}const mt=4096;function _e(R){const S=R.length;if(S<=mt)return String.fromCharCode.apply(String,R);let M="",B=0;for(;B<S;)M+=String.fromCharCode.apply(String,R.slice(B,B+=mt));return M}function me(R,S,M){let B="";M=Math.min(R.length,M);for(let K=S;K<M;++K)B+=String.fromCharCode(R[K]&127);return B}function Me(R,S,M){let B="";M=Math.min(R.length,M);for(let K=S;K<M;++K)B+=String.fromCharCode(R[K]);return B}function Ve(R,S,M){const B=R.length;(!S||S<0)&&(S=0),(!M||M<0||M>B)&&(M=B);let K="";for(let Z=S;Z<M;++Z)K+=st[R[Z]];return K}function Ne(R,S,M){const B=R.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}F.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,F.prototype),K};function Te(R,S,M){if(R%1!==0||R<0)throw new RangeError("offset is not uint");if(R+S>M)throw new RangeError("Trying to access beyond buffer length")}F.prototype.readUintLE=F.prototype.readUIntLE=function(S,M,B){S=S>>>0,M=M>>>0,B||Te(S,M,this.length);let K=this[S],Z=1,te=0;for(;++te<M&&(Z*=256);)K+=this[S+te]*Z;return K},F.prototype.readUintBE=F.prototype.readUIntBE=function(S,M,B){S=S>>>0,M=M>>>0,B||Te(S,M,this.length);let K=this[S+--M],Z=1;for(;M>0&&(Z*=256);)K+=this[S+--M]*Z;return K},F.prototype.readUint8=F.prototype.readUInt8=function(S,M){return S=S>>>0,M||Te(S,1,this.length),this[S]},F.prototype.readUint16LE=F.prototype.readUInt16LE=function(S,M){return S=S>>>0,M||Te(S,2,this.length),this[S]|this[S+1]<<8},F.prototype.readUint16BE=F.prototype.readUInt16BE=function(S,M){return S=S>>>0,M||Te(S,2,this.length),this[S]<<8|this[S+1]},F.prototype.readUint32LE=F.prototype.readUInt32LE=function(S,M){return S=S>>>0,M||Te(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},F.prototype.readUint32BE=F.prototype.readUInt32BE=function(S,M){return S=S>>>0,M||Te(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},F.prototype.readBigUInt64LE=wt(function(S){S=S>>>0,Et(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))}),F.prototype.readBigUInt64BE=wt(function(S){S=S>>>0,Et(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)}),F.prototype.readIntLE=function(S,M,B){S=S>>>0,M=M>>>0,B||Te(S,M,this.length);let K=this[S],Z=1,te=0;for(;++te<M&&(Z*=256);)K+=this[S+te]*Z;return Z*=128,K>=Z&&(K-=Math.pow(2,8*M)),K},F.prototype.readIntBE=function(S,M,B){S=S>>>0,M=M>>>0,B||Te(S,M,this.length);let K=M,Z=1,te=this[S+--K];for(;K>0&&(Z*=256);)te+=this[S+--K]*Z;return Z*=128,te>=Z&&(te-=Math.pow(2,8*M)),te},F.prototype.readInt8=function(S,M){return S=S>>>0,M||Te(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},F.prototype.readInt16LE=function(S,M){S=S>>>0,M||Te(S,2,this.length);const B=this[S]|this[S+1]<<8;return B&32768?B|4294901760:B},F.prototype.readInt16BE=function(S,M){S=S>>>0,M||Te(S,2,this.length);const B=this[S+1]|this[S]<<8;return B&32768?B|4294901760:B},F.prototype.readInt32LE=function(S,M){return S=S>>>0,M||Te(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},F.prototype.readInt32BE=function(S,M){return S=S>>>0,M||Te(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},F.prototype.readBigInt64LE=wt(function(S){S=S>>>0,Et(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)}),F.prototype.readBigInt64BE=wt(function(S){S=S>>>0,Et(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)}),F.prototype.readFloatLE=function(S,M){return S=S>>>0,M||Te(S,4,this.length),U.read(this,S,!0,23,4)},F.prototype.readFloatBE=function(S,M){return S=S>>>0,M||Te(S,4,this.length),U.read(this,S,!1,23,4)},F.prototype.readDoubleLE=function(S,M){return S=S>>>0,M||Te(S,8,this.length),U.read(this,S,!0,52,8)},F.prototype.readDoubleBE=function(S,M){return S=S>>>0,M||Te(S,8,this.length),U.read(this,S,!1,52,8)};function Oe(R,S,M,B,K,Z){if(!F.isBuffer(R))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>R.length)throw new RangeError("Index out of range")}F.prototype.writeUintLE=F.prototype.writeUIntLE=function(S,M,B,K){if(S=+S,M=M>>>0,B=B>>>0,!K){const $e=Math.pow(2,8*B)-1;Oe(this,S,M,B,$e,0)}let Z=1,te=0;for(this[M]=S&255;++te<B&&(Z*=256);)this[M+te]=S/Z&255;return M+B},F.prototype.writeUintBE=F.prototype.writeUIntBE=function(S,M,B,K){if(S=+S,M=M>>>0,B=B>>>0,!K){const $e=Math.pow(2,8*B)-1;Oe(this,S,M,B,$e,0)}let Z=B-1,te=1;for(this[M+Z]=S&255;--Z>=0&&(te*=256);)this[M+Z]=S/te&255;return M+B},F.prototype.writeUint8=F.prototype.writeUInt8=function(S,M,B){return S=+S,M=M>>>0,B||Oe(this,S,M,1,255,0),this[M]=S&255,M+1},F.prototype.writeUint16LE=F.prototype.writeUInt16LE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(this,S,M,2,65535,0),this[M]=S&255,this[M+1]=S>>>8,M+2},F.prototype.writeUint16BE=F.prototype.writeUInt16BE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(this,S,M,2,65535,0),this[M]=S>>>8,this[M+1]=S&255,M+2},F.prototype.writeUint32LE=F.prototype.writeUInt32LE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(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},F.prototype.writeUint32BE=F.prototype.writeUInt32BE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(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(R,S,M,B,K){rt(S,B,K,R,M,7);let Z=Number(S&BigInt(4294967295));R[M++]=Z,Z=Z>>8,R[M++]=Z,Z=Z>>8,R[M++]=Z,Z=Z>>8,R[M++]=Z;let te=Number(S>>BigInt(32)&BigInt(4294967295));return R[M++]=te,te=te>>8,R[M++]=te,te=te>>8,R[M++]=te,te=te>>8,R[M++]=te,M}function ut(R,S,M,B,K){rt(S,B,K,R,M,7);let Z=Number(S&BigInt(4294967295));R[M+7]=Z,Z=Z>>8,R[M+6]=Z,Z=Z>>8,R[M+5]=Z,Z=Z>>8,R[M+4]=Z;let te=Number(S>>BigInt(32)&BigInt(4294967295));return R[M+3]=te,te=te>>8,R[M+2]=te,te=te>>8,R[M+1]=te,te=te>>8,R[M]=te,M+8}F.prototype.writeBigUInt64LE=wt(function(S,M=0){return Le(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),F.prototype.writeBigUInt64BE=wt(function(S,M=0){return ut(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),F.prototype.writeIntLE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const et=Math.pow(2,8*B-1);Oe(this,S,M,B,et-1,-et)}let Z=0,te=1,$e=0;for(this[M]=S&255;++Z<B&&(te*=256);)S<0&&$e===0&&this[M+Z-1]!==0&&($e=1),this[M+Z]=(S/te>>0)-$e&255;return M+B},F.prototype.writeIntBE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const et=Math.pow(2,8*B-1);Oe(this,S,M,B,et-1,-et)}let Z=B-1,te=1,$e=0;for(this[M+Z]=S&255;--Z>=0&&(te*=256);)S<0&&$e===0&&this[M+Z+1]!==0&&($e=1),this[M+Z]=(S/te>>0)-$e&255;return M+B},F.prototype.writeInt8=function(S,M,B){return S=+S,M=M>>>0,B||Oe(this,S,M,1,127,-128),S<0&&(S=255+S+1),this[M]=S&255,M+1},F.prototype.writeInt16LE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(this,S,M,2,32767,-32768),this[M]=S&255,this[M+1]=S>>>8,M+2},F.prototype.writeInt16BE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(this,S,M,2,32767,-32768),this[M]=S>>>8,this[M+1]=S&255,M+2},F.prototype.writeInt32LE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(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},F.prototype.writeInt32BE=function(S,M,B){return S=+S,M=M>>>0,B||Oe(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},F.prototype.writeBigInt64LE=wt(function(S,M=0){return Le(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),F.prototype.writeBigInt64BE=wt(function(S,M=0){return ut(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lt(R,S,M,B,K,Z){if(M+B>R.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("Index out of range")}function We(R,S,M,B,K){return S=+S,M=M>>>0,K||lt(R,S,M,4),U.write(R,S,M,B,23,4),M+4}F.prototype.writeFloatLE=function(S,M,B){return We(this,S,M,!0,B)},F.prototype.writeFloatBE=function(S,M,B){return We(this,S,M,!1,B)};function kt(R,S,M,B,K){return S=+S,M=M>>>0,K||lt(R,S,M,8),U.write(R,S,M,B,52,8),M+8}F.prototype.writeDoubleLE=function(S,M,B){return kt(this,S,M,!0,B)},F.prototype.writeDoubleBE=function(S,M,B){return kt(this,S,M,!1,B)},F.prototype.copy=function(S,M,B,K){if(!F.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},F.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"&&!F.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(S.length===1){const te=S.charCodeAt(0);(K==="utf8"&&te<128||K==="latin1")&&(S=te)}}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 te=F.isBuffer(S)?S:F.from(S,K),$e=te.length;if($e===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<B-M;++Z)this[Z+M]=te[Z%$e]}return this};const St={};function Ye(R,S,M){St[R]=class extends M{constructor(){super(),Object.defineProperty(this,"message",{value:S.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${R}]`,this.stack,delete this.name}get code(){return R}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${R}]: ${this.message}`}}}Ye("ERR_BUFFER_OUT_OF_BOUNDS",function(R){return R?`${R} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ye("ERR_INVALID_ARG_TYPE",function(R,S){return`The "${R}" argument must be of type number. Received type ${typeof S}`},TypeError),Ye("ERR_OUT_OF_RANGE",function(R,S,M){let B=`The value of "${R}" is out of range.`,K=M;return Number.isInteger(M)&&Math.abs(M)>2**32?K=Mt(String(M)):typeof M=="bigint"&&(K=String(M),(M>BigInt(2)**BigInt(32)||M<-(BigInt(2)**BigInt(32)))&&(K=Mt(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function Mt(R){let S="",M=R.length;const B=R[0]==="-"?1:0;for(;M>=B+4;M-=3)S=`_${R.slice(M-3,M)}${S}`;return`${R.slice(0,M)}${S}`}function Nt(R,S,M){Et(S,"offset"),(R[S]===void 0||R[S+M]===void 0)&&Tt(S,R.length-(M+1))}function rt(R,S,M,B,K,Z){if(R>M||R<S){const te=typeof S=="bigint"?"n":"";let $e;throw Z>3?S===0||S===BigInt(0)?$e=`>= 0${te} and < 2${te} ** ${(Z+1)*8}${te}`:$e=`>= -(2${te} ** ${(Z+1)*8-1}${te}) and < 2 ** ${(Z+1)*8-1}${te}`:$e=`>= ${S}${te} and <= ${M}${te}`,new St.ERR_OUT_OF_RANGE("value",$e,R)}Nt(B,K,Z)}function Et(R,S){if(typeof R!="number")throw new St.ERR_INVALID_ARG_TYPE(S,"number",R)}function Tt(R,S,M){throw Math.floor(R)!==R?(Et(R,M),new St.ERR_OUT_OF_RANGE(M||"offset","an integer",R)):S<0?new St.ERR_BUFFER_OUT_OF_BOUNDS:new St.ERR_OUT_OF_RANGE(M||"offset",`>= ${M?1:0} and <= ${S}`,R)}const it=/[^+/0-9A-Za-z-_]/g;function jt(R){if(R=R.split("=")[0],R=R.trim().replace(it,""),R.length<2)return"";for(;R.length%4!==0;)R=R+"=";return R}function It(R,S){S=S||1/0;let M;const B=R.length;let K=null;const Z=[];for(let te=0;te<B;++te){if(M=R.charCodeAt(te),M>55295&&M<57344){if(!K){if(M>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(te+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 nt(R){const S=[];for(let M=0;M<R.length;++M)S.push(R.charCodeAt(M)&255);return S}function bt(R,S){let M,B,K;const Z=[];for(let te=0;te<R.length&&!((S-=2)<0);++te)M=R.charCodeAt(te),B=M>>8,K=M%256,Z.push(K),Z.push(B);return Z}function Ct(R){return N.toByteArray(jt(R))}function Je(R,S,M,B){let K;for(K=0;K<B&&!(K+M>=S.length||K>=R.length);++K)S[K+M]=R[K];return K}function gt(R,S){return R instanceof S||R!=null&&R.constructor!=null&&R.constructor.name!=null&&R.constructor.name===S.name}function Pt(R){return R!==R}const st=function(){const R="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]=R[M]+R[K]}return S}();function wt(R){return typeof BigInt>"u"?Ut:R}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})(pc);const $d=cc(pc);var an={},Np={exports:{}};Np.exports;(function(e){(function(t,r){function n(D,p){if(!D)throw new Error(p||"Assertion failed")}function i(D,p){D.super_=p;var d=function(){};d.prototype=p.prototype,D.prototype=new d,D.prototype.constructor=D}function s(D,p,d){if(s.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init(D||0,p||10,d||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=pc.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 A,E,O=0;if(m==="be")for(x=p.length-1,A=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[A]|=E<<O&67108863,this.words[A+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,A++);else if(m==="le")for(x=0,A=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[A]|=E<<O&67108863,this.words[A+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,A++);return this._strip()};function a(D,p){var d=D.charCodeAt(p);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;n(!1,"Invalid character in "+D)}function c(D,p,d){var m=a(D,d);return d-1>=p&&(m|=a(D,d-1)<<4),m}s.prototype._parseHex=function(p,d,m){this.length=Math.ceil((p.length-d)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var A=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<A,this.words[E]|=O&67108863,A>=18?(A-=18,E+=1,this.words[E]|=O>>>26):A+=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)<<A,this.words[E]|=O&67108863,A>=18?(A-=18,E+=1,this.words[E]|=O>>>26):A+=8}this._strip()};function u(D,p,d,m){for(var x=0,A=0,E=Math.min(D.length,d),O=p;O<E;O++){var C=D.charCodeAt(O)-48;x*=m,C>=49?A=C-49+10:C>=17?A=C-17+10:A=C,n(C>=0&&A<m,"Invalid character"),x+=A}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,A=1;A<=67108863;A*=d)x++;x--,A=A/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(A),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(O!==0){var j=1;for(g=u(p,v,p.length,d),v=0;v<O;v++)j*=d;this.imuln(j),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var d=0;d<this.length;d++)p.words[d]=this.words[d];p.length=this.length,p.negative=this.negative,p.red=this.red};function l(D,p){D.words=p.words,D.length=p.length,D.negative=p.negative,D.red=p.red}if(s.prototype._move=function(p){l(p,this)},s.prototype.clone=function(){var p=new s(null);return this.copy(p),p},s.prototype._expand=function(p){for(;this.length<p;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{s.prototype.inspect=f}else s.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],b=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(p,d){p=p||10,d=d|0||1;var m;if(p===16||p==="hex"){m="";for(var x=0,A=0,E=0;E<this.length;E++){var O=this.words[E],C=((O<<x|A)&16777215).toString(16);A=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),A!==0||E!==this.length-1?m=h[6-C.length]+C+m:m=C+m}for(A!==0&&(m=A.toString(16)+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(p===(p|0)&&p>=2&&p<=36){var g=y[p],v=b[p];m="";var j=this.clone();for(j.negative=0;!j.isZero();){var ee=j.modrn(v).toString(p);j=j.idivn(v),j.isZero()?m=ee+m:m=h[g-ee.length]+ee+m}for(this.isZero()&&(m="0"+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(p,d){return this.toArrayLike(o,p,d)}),s.prototype.toArray=function(p,d){return this.toArrayLike(Array,p,d)};var w=function(p,d){return p.allocUnsafe?p.allocUnsafe(d):new p(d)};s.prototype.toArrayLike=function(p,d,m){this._strip();var x=this.byteLength(),A=m||Math.max(1,x);n(x<=A,"byte array longer than desired length"),n(A>0,"Requested array length <= 0");var E=w(p,A),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,A=0,E=0;A<this.length;A++){var O=this.words[A]<<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,A=0,E=0;A<this.length;A++){var O=this.words[A]<<E|x;p[m--]=O&255,m>=0&&(p[m--]=O>>8&255),m>=0&&(p[m--]=O>>16&255),E===6?(m>=0&&(p[m--]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m>=0)for(p[m--]=x;m>=0;)p[m--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var d=p,m=0;return d>=4096&&(m+=13,d>>>=13),d>=64&&(m+=7,d>>>=7),d>=8&&(m+=4,d>>>=4),d>=2&&(m+=2,d>>>=2),m+d},s.prototype._zeroBits=function(p){if(p===0)return 26;var d=p,m=0;return d&8191||(m+=13,d>>>=13),d&127||(m+=7,d>>>=7),d&15||(m+=4,d>>>=4),d&3||(m+=2,d>>>=2),d&1||m++,m},s.prototype.bitLength=function(){var p=this.words[this.length-1],d=this._countBits(p);return(this.length-1)*26+d};function T(D){for(var p=new Array(D.bitLength()),d=0;d<p.length;d++){var m=d/26|0,x=d%26;p[d]=D.words[m]>>>x&1}return p}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var p=0,d=0;d<this.length;d++){var m=this._zeroBits(this.words[d]);if(p+=m,m!==26)break}return p},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(p){return this.negative!==0?this.abs().inotn(p).iaddn(1):this.clone()},s.prototype.fromTwos=function(p){return this.testn(p-1)?this.notn(p).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(p){for(;this.length<p.length;)this.words[this.length++]=0;for(var d=0;d<p.length;d++)this.words[d]=this.words[d]|p.words[d];return this._strip()},s.prototype.ior=function(p){return n((this.negative|p.negative)===0),this.iuor(p)},s.prototype.or=function(p){return this.length>p.length?this.clone().ior(p):p.clone().ior(this)},s.prototype.uor=function(p){return this.length>p.length?this.clone().iuor(p):p.clone().iuor(this)},s.prototype.iuand=function(p){var d;this.length>p.length?d=p:d=this;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]&p.words[m];return this.length=d.length,this._strip()},s.prototype.iand=function(p){return n((this.negative|p.negative)===0),this.iuand(p)},s.prototype.and=function(p){return this.length>p.length?this.clone().iand(p):p.clone().iand(this)},s.prototype.uand=function(p){return this.length>p.length?this.clone().iuand(p):p.clone().iuand(this)},s.prototype.iuxor=function(p){var d,m;this.length>p.length?(d=this,m=p):(d=p,m=this);for(var x=0;x<m.length;x++)this.words[x]=d.words[x]^m.words[x];if(this!==d)for(;x<d.length;x++)this.words[x]=d.words[x];return this.length=d.length,this._strip()},s.prototype.ixor=function(p){return n((this.negative|p.negative)===0),this.iuxor(p)},s.prototype.xor=function(p){return this.length>p.length?this.clone().ixor(p):p.clone().ixor(this)},s.prototype.uxor=function(p){return this.length>p.length?this.clone().iuxor(p):p.clone().iuxor(this)},s.prototype.inotn=function(p){n(typeof p=="number"&&p>=0);var d=Math.ceil(p/26)|0,m=p%26;this._expand(d),m>0&&d--;for(var x=0;x<d;x++)this.words[x]=~this.words[x]&67108863;return m>0&&(this.words[x]=~this.words[x]&67108863>>26-m),this._strip()},s.prototype.notn=function(p){return this.clone().inotn(p)},s.prototype.setn=function(p,d){n(typeof p=="number"&&p>=0);var m=p/26|0,x=p%26;return this._expand(m+1),d?this.words[m]=this.words[m]|1<<x:this.words[m]=this.words[m]&~(1<<x),this._strip()},s.prototype.iadd=function(p){var d;if(this.negative!==0&&p.negative===0)return this.negative=0,d=this.isub(p),this.negative^=1,this._normSign();if(this.negative===0&&p.negative!==0)return p.negative=0,d=this.isub(p),p.negative=1,d._normSign();var m,x;this.length>p.length?(m=this,x=p):(m=p,x=this);for(var A=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+A,this.words[E]=d&67108863,A=d>>>26;for(;A!==0&&E<m.length;E++)d=(m.words[E]|0)+A,this.words[E]=d&67108863,A=d>>>26;if(this.length=m.length,A!==0)this.words[this.length]=A,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,A;m>0?(x=this,A=p):(x=p,A=this);for(var E=0,O=0;O<A.length;O++)d=(x.words[O]|0)-(A.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 I(D,p,d){d.negative=p.negative^D.negative;var m=D.length+p.length|0;d.length=m,m=m-1|0;var x=D.words[0]|0,A=p.words[0]|0,E=x*A,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),ie=Math.max(0,g-D.length+1);ie<=ee;ie++){var fe=g-ie|0;x=D.words[fe]|0,A=p.words[ie]|0,E=x*A+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 k=function(p,d,m){var x=p.words,A=d.words,E=m.words,O=0,C,g,v,j=x[0]|0,ee=j&8191,ie=j>>>13,fe=x[1]|0,ve=fe&8191,Se=fe>>>13,xe=x[2]|0,He=xe&8191,Fe=xe>>>13,dt=x[3]|0,ht=dt&8191,De=dt>>>13,mt=x[4]|0,_e=mt&8191,me=mt>>>13,Me=x[5]|0,Ve=Me&8191,Ne=Me>>>13,Te=x[6]|0,Oe=Te&8191,Le=Te>>>13,ut=x[7]|0,lt=ut&8191,We=ut>>>13,kt=x[8]|0,St=kt&8191,Ye=kt>>>13,Mt=x[9]|0,Nt=Mt&8191,rt=Mt>>>13,Et=A[0]|0,Tt=Et&8191,it=Et>>>13,jt=A[1]|0,It=jt&8191,nt=jt>>>13,bt=A[2]|0,Ct=bt&8191,Je=bt>>>13,gt=A[3]|0,Pt=gt&8191,st=gt>>>13,wt=A[4]|0,Ut=wt&8191,R=wt>>>13,S=A[5]|0,M=S&8191,B=S>>>13,K=A[6]|0,Z=K&8191,te=K>>>13,$e=A[7]|0,et=$e&8191,Re=$e>>>13,V=A[8]|0,ae=V&8191,he=V>>>13,ke=A[9]|0,Ge=ke&8191,je=ke>>>13;m.negative=p.negative^d.negative,m.length=19,C=Math.imul(ee,Tt),g=Math.imul(ee,it),g=g+Math.imul(ie,Tt)|0,v=Math.imul(ie,it);var Ue=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,C=Math.imul(ve,Tt),g=Math.imul(ve,it),g=g+Math.imul(Se,Tt)|0,v=Math.imul(Se,it),C=C+Math.imul(ee,It)|0,g=g+Math.imul(ee,nt)|0,g=g+Math.imul(ie,It)|0,v=v+Math.imul(ie,nt)|0;var ot=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ot>>>26)|0,ot&=67108863,C=Math.imul(He,Tt),g=Math.imul(He,it),g=g+Math.imul(Fe,Tt)|0,v=Math.imul(Fe,it),C=C+Math.imul(ve,It)|0,g=g+Math.imul(ve,nt)|0,g=g+Math.imul(Se,It)|0,v=v+Math.imul(Se,nt)|0,C=C+Math.imul(ee,Ct)|0,g=g+Math.imul(ee,Je)|0,g=g+Math.imul(ie,Ct)|0,v=v+Math.imul(ie,Je)|0;var Gt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,C=Math.imul(ht,Tt),g=Math.imul(ht,it),g=g+Math.imul(De,Tt)|0,v=Math.imul(De,it),C=C+Math.imul(He,It)|0,g=g+Math.imul(He,nt)|0,g=g+Math.imul(Fe,It)|0,v=v+Math.imul(Fe,nt)|0,C=C+Math.imul(ve,Ct)|0,g=g+Math.imul(ve,Je)|0,g=g+Math.imul(Se,Ct)|0,v=v+Math.imul(Se,Je)|0,C=C+Math.imul(ee,Pt)|0,g=g+Math.imul(ee,st)|0,g=g+Math.imul(ie,Pt)|0,v=v+Math.imul(ie,st)|0;var Rt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,C=Math.imul(_e,Tt),g=Math.imul(_e,it),g=g+Math.imul(me,Tt)|0,v=Math.imul(me,it),C=C+Math.imul(ht,It)|0,g=g+Math.imul(ht,nt)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,nt)|0,C=C+Math.imul(He,Ct)|0,g=g+Math.imul(He,Je)|0,g=g+Math.imul(Fe,Ct)|0,v=v+Math.imul(Fe,Je)|0,C=C+Math.imul(ve,Pt)|0,g=g+Math.imul(ve,st)|0,g=g+Math.imul(Se,Pt)|0,v=v+Math.imul(Se,st)|0,C=C+Math.imul(ee,Ut)|0,g=g+Math.imul(ee,R)|0,g=g+Math.imul(ie,Ut)|0,v=v+Math.imul(ie,R)|0;var Dt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,C=Math.imul(Ve,Tt),g=Math.imul(Ve,it),g=g+Math.imul(Ne,Tt)|0,v=Math.imul(Ne,it),C=C+Math.imul(_e,It)|0,g=g+Math.imul(_e,nt)|0,g=g+Math.imul(me,It)|0,v=v+Math.imul(me,nt)|0,C=C+Math.imul(ht,Ct)|0,g=g+Math.imul(ht,Je)|0,g=g+Math.imul(De,Ct)|0,v=v+Math.imul(De,Je)|0,C=C+Math.imul(He,Pt)|0,g=g+Math.imul(He,st)|0,g=g+Math.imul(Fe,Pt)|0,v=v+Math.imul(Fe,st)|0,C=C+Math.imul(ve,Ut)|0,g=g+Math.imul(ve,R)|0,g=g+Math.imul(Se,Ut)|0,v=v+Math.imul(Se,R)|0,C=C+Math.imul(ee,M)|0,g=g+Math.imul(ee,B)|0,g=g+Math.imul(ie,M)|0,v=v+Math.imul(ie,B)|0;var Qt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,C=Math.imul(Oe,Tt),g=Math.imul(Oe,it),g=g+Math.imul(Le,Tt)|0,v=Math.imul(Le,it),C=C+Math.imul(Ve,It)|0,g=g+Math.imul(Ve,nt)|0,g=g+Math.imul(Ne,It)|0,v=v+Math.imul(Ne,nt)|0,C=C+Math.imul(_e,Ct)|0,g=g+Math.imul(_e,Je)|0,g=g+Math.imul(me,Ct)|0,v=v+Math.imul(me,Je)|0,C=C+Math.imul(ht,Pt)|0,g=g+Math.imul(ht,st)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,st)|0,C=C+Math.imul(He,Ut)|0,g=g+Math.imul(He,R)|0,g=g+Math.imul(Fe,Ut)|0,v=v+Math.imul(Fe,R)|0,C=C+Math.imul(ve,M)|0,g=g+Math.imul(ve,B)|0,g=g+Math.imul(Se,M)|0,v=v+Math.imul(Se,B)|0,C=C+Math.imul(ee,Z)|0,g=g+Math.imul(ee,te)|0,g=g+Math.imul(ie,Z)|0,v=v+Math.imul(ie,te)|0;var yr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(yr>>>26)|0,yr&=67108863,C=Math.imul(lt,Tt),g=Math.imul(lt,it),g=g+Math.imul(We,Tt)|0,v=Math.imul(We,it),C=C+Math.imul(Oe,It)|0,g=g+Math.imul(Oe,nt)|0,g=g+Math.imul(Le,It)|0,v=v+Math.imul(Le,nt)|0,C=C+Math.imul(Ve,Ct)|0,g=g+Math.imul(Ve,Je)|0,g=g+Math.imul(Ne,Ct)|0,v=v+Math.imul(Ne,Je)|0,C=C+Math.imul(_e,Pt)|0,g=g+Math.imul(_e,st)|0,g=g+Math.imul(me,Pt)|0,v=v+Math.imul(me,st)|0,C=C+Math.imul(ht,Ut)|0,g=g+Math.imul(ht,R)|0,g=g+Math.imul(De,Ut)|0,v=v+Math.imul(De,R)|0,C=C+Math.imul(He,M)|0,g=g+Math.imul(He,B)|0,g=g+Math.imul(Fe,M)|0,v=v+Math.imul(Fe,B)|0,C=C+Math.imul(ve,Z)|0,g=g+Math.imul(ve,te)|0,g=g+Math.imul(Se,Z)|0,v=v+Math.imul(Se,te)|0,C=C+Math.imul(ee,et)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(ie,et)|0,v=v+Math.imul(ie,Re)|0;var nr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(nr>>>26)|0,nr&=67108863,C=Math.imul(St,Tt),g=Math.imul(St,it),g=g+Math.imul(Ye,Tt)|0,v=Math.imul(Ye,it),C=C+Math.imul(lt,It)|0,g=g+Math.imul(lt,nt)|0,g=g+Math.imul(We,It)|0,v=v+Math.imul(We,nt)|0,C=C+Math.imul(Oe,Ct)|0,g=g+Math.imul(Oe,Je)|0,g=g+Math.imul(Le,Ct)|0,v=v+Math.imul(Le,Je)|0,C=C+Math.imul(Ve,Pt)|0,g=g+Math.imul(Ve,st)|0,g=g+Math.imul(Ne,Pt)|0,v=v+Math.imul(Ne,st)|0,C=C+Math.imul(_e,Ut)|0,g=g+Math.imul(_e,R)|0,g=g+Math.imul(me,Ut)|0,v=v+Math.imul(me,R)|0,C=C+Math.imul(ht,M)|0,g=g+Math.imul(ht,B)|0,g=g+Math.imul(De,M)|0,v=v+Math.imul(De,B)|0,C=C+Math.imul(He,Z)|0,g=g+Math.imul(He,te)|0,g=g+Math.imul(Fe,Z)|0,v=v+Math.imul(Fe,te)|0,C=C+Math.imul(ve,et)|0,g=g+Math.imul(ve,Re)|0,g=g+Math.imul(Se,et)|0,v=v+Math.imul(Se,Re)|0,C=C+Math.imul(ee,ae)|0,g=g+Math.imul(ee,he)|0,g=g+Math.imul(ie,ae)|0,v=v+Math.imul(ie,he)|0;var Kt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,C=Math.imul(Nt,Tt),g=Math.imul(Nt,it),g=g+Math.imul(rt,Tt)|0,v=Math.imul(rt,it),C=C+Math.imul(St,It)|0,g=g+Math.imul(St,nt)|0,g=g+Math.imul(Ye,It)|0,v=v+Math.imul(Ye,nt)|0,C=C+Math.imul(lt,Ct)|0,g=g+Math.imul(lt,Je)|0,g=g+Math.imul(We,Ct)|0,v=v+Math.imul(We,Je)|0,C=C+Math.imul(Oe,Pt)|0,g=g+Math.imul(Oe,st)|0,g=g+Math.imul(Le,Pt)|0,v=v+Math.imul(Le,st)|0,C=C+Math.imul(Ve,Ut)|0,g=g+Math.imul(Ve,R)|0,g=g+Math.imul(Ne,Ut)|0,v=v+Math.imul(Ne,R)|0,C=C+Math.imul(_e,M)|0,g=g+Math.imul(_e,B)|0,g=g+Math.imul(me,M)|0,v=v+Math.imul(me,B)|0,C=C+Math.imul(ht,Z)|0,g=g+Math.imul(ht,te)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,te)|0,C=C+Math.imul(He,et)|0,g=g+Math.imul(He,Re)|0,g=g+Math.imul(Fe,et)|0,v=v+Math.imul(Fe,Re)|0,C=C+Math.imul(ve,ae)|0,g=g+Math.imul(ve,he)|0,g=g+Math.imul(Se,ae)|0,v=v+Math.imul(Se,he)|0,C=C+Math.imul(ee,Ge)|0,g=g+Math.imul(ee,je)|0,g=g+Math.imul(ie,Ge)|0,v=v+Math.imul(ie,je)|0;var gr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(gr>>>26)|0,gr&=67108863,C=Math.imul(Nt,It),g=Math.imul(Nt,nt),g=g+Math.imul(rt,It)|0,v=Math.imul(rt,nt),C=C+Math.imul(St,Ct)|0,g=g+Math.imul(St,Je)|0,g=g+Math.imul(Ye,Ct)|0,v=v+Math.imul(Ye,Je)|0,C=C+Math.imul(lt,Pt)|0,g=g+Math.imul(lt,st)|0,g=g+Math.imul(We,Pt)|0,v=v+Math.imul(We,st)|0,C=C+Math.imul(Oe,Ut)|0,g=g+Math.imul(Oe,R)|0,g=g+Math.imul(Le,Ut)|0,v=v+Math.imul(Le,R)|0,C=C+Math.imul(Ve,M)|0,g=g+Math.imul(Ve,B)|0,g=g+Math.imul(Ne,M)|0,v=v+Math.imul(Ne,B)|0,C=C+Math.imul(_e,Z)|0,g=g+Math.imul(_e,te)|0,g=g+Math.imul(me,Z)|0,v=v+Math.imul(me,te)|0,C=C+Math.imul(ht,et)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul(De,et)|0,v=v+Math.imul(De,Re)|0,C=C+Math.imul(He,ae)|0,g=g+Math.imul(He,he)|0,g=g+Math.imul(Fe,ae)|0,v=v+Math.imul(Fe,he)|0,C=C+Math.imul(ve,Ge)|0,g=g+Math.imul(ve,je)|0,g=g+Math.imul(Se,Ge)|0,v=v+Math.imul(Se,je)|0;var hn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(hn>>>26)|0,hn&=67108863,C=Math.imul(Nt,Ct),g=Math.imul(Nt,Je),g=g+Math.imul(rt,Ct)|0,v=Math.imul(rt,Je),C=C+Math.imul(St,Pt)|0,g=g+Math.imul(St,st)|0,g=g+Math.imul(Ye,Pt)|0,v=v+Math.imul(Ye,st)|0,C=C+Math.imul(lt,Ut)|0,g=g+Math.imul(lt,R)|0,g=g+Math.imul(We,Ut)|0,v=v+Math.imul(We,R)|0,C=C+Math.imul(Oe,M)|0,g=g+Math.imul(Oe,B)|0,g=g+Math.imul(Le,M)|0,v=v+Math.imul(Le,B)|0,C=C+Math.imul(Ve,Z)|0,g=g+Math.imul(Ve,te)|0,g=g+Math.imul(Ne,Z)|0,v=v+Math.imul(Ne,te)|0,C=C+Math.imul(_e,et)|0,g=g+Math.imul(_e,Re)|0,g=g+Math.imul(me,et)|0,v=v+Math.imul(me,Re)|0,C=C+Math.imul(ht,ae)|0,g=g+Math.imul(ht,he)|0,g=g+Math.imul(De,ae)|0,v=v+Math.imul(De,he)|0,C=C+Math.imul(He,Ge)|0,g=g+Math.imul(He,je)|0,g=g+Math.imul(Fe,Ge)|0,v=v+Math.imul(Fe,je)|0;var Fr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,C=Math.imul(Nt,Pt),g=Math.imul(Nt,st),g=g+Math.imul(rt,Pt)|0,v=Math.imul(rt,st),C=C+Math.imul(St,Ut)|0,g=g+Math.imul(St,R)|0,g=g+Math.imul(Ye,Ut)|0,v=v+Math.imul(Ye,R)|0,C=C+Math.imul(lt,M)|0,g=g+Math.imul(lt,B)|0,g=g+Math.imul(We,M)|0,v=v+Math.imul(We,B)|0,C=C+Math.imul(Oe,Z)|0,g=g+Math.imul(Oe,te)|0,g=g+Math.imul(Le,Z)|0,v=v+Math.imul(Le,te)|0,C=C+Math.imul(Ve,et)|0,g=g+Math.imul(Ve,Re)|0,g=g+Math.imul(Ne,et)|0,v=v+Math.imul(Ne,Re)|0,C=C+Math.imul(_e,ae)|0,g=g+Math.imul(_e,he)|0,g=g+Math.imul(me,ae)|0,v=v+Math.imul(me,he)|0,C=C+Math.imul(ht,Ge)|0,g=g+Math.imul(ht,je)|0,g=g+Math.imul(De,Ge)|0,v=v+Math.imul(De,je)|0;var pn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(pn>>>26)|0,pn&=67108863,C=Math.imul(Nt,Ut),g=Math.imul(Nt,R),g=g+Math.imul(rt,Ut)|0,v=Math.imul(rt,R),C=C+Math.imul(St,M)|0,g=g+Math.imul(St,B)|0,g=g+Math.imul(Ye,M)|0,v=v+Math.imul(Ye,B)|0,C=C+Math.imul(lt,Z)|0,g=g+Math.imul(lt,te)|0,g=g+Math.imul(We,Z)|0,v=v+Math.imul(We,te)|0,C=C+Math.imul(Oe,et)|0,g=g+Math.imul(Oe,Re)|0,g=g+Math.imul(Le,et)|0,v=v+Math.imul(Le,Re)|0,C=C+Math.imul(Ve,ae)|0,g=g+Math.imul(Ve,he)|0,g=g+Math.imul(Ne,ae)|0,v=v+Math.imul(Ne,he)|0,C=C+Math.imul(_e,Ge)|0,g=g+Math.imul(_e,je)|0,g=g+Math.imul(me,Ge)|0,v=v+Math.imul(me,je)|0;var ci=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ci>>>26)|0,ci&=67108863,C=Math.imul(Nt,M),g=Math.imul(Nt,B),g=g+Math.imul(rt,M)|0,v=Math.imul(rt,B),C=C+Math.imul(St,Z)|0,g=g+Math.imul(St,te)|0,g=g+Math.imul(Ye,Z)|0,v=v+Math.imul(Ye,te)|0,C=C+Math.imul(lt,et)|0,g=g+Math.imul(lt,Re)|0,g=g+Math.imul(We,et)|0,v=v+Math.imul(We,Re)|0,C=C+Math.imul(Oe,ae)|0,g=g+Math.imul(Oe,he)|0,g=g+Math.imul(Le,ae)|0,v=v+Math.imul(Le,he)|0,C=C+Math.imul(Ve,Ge)|0,g=g+Math.imul(Ve,je)|0,g=g+Math.imul(Ne,Ge)|0,v=v+Math.imul(Ne,je)|0;var ui=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ui>>>26)|0,ui&=67108863,C=Math.imul(Nt,Z),g=Math.imul(Nt,te),g=g+Math.imul(rt,Z)|0,v=Math.imul(rt,te),C=C+Math.imul(St,et)|0,g=g+Math.imul(St,Re)|0,g=g+Math.imul(Ye,et)|0,v=v+Math.imul(Ye,Re)|0,C=C+Math.imul(lt,ae)|0,g=g+Math.imul(lt,he)|0,g=g+Math.imul(We,ae)|0,v=v+Math.imul(We,he)|0,C=C+Math.imul(Oe,Ge)|0,g=g+Math.imul(Oe,je)|0,g=g+Math.imul(Le,Ge)|0,v=v+Math.imul(Le,je)|0;var mn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(mn>>>26)|0,mn&=67108863,C=Math.imul(Nt,et),g=Math.imul(Nt,Re),g=g+Math.imul(rt,et)|0,v=Math.imul(rt,Re),C=C+Math.imul(St,ae)|0,g=g+Math.imul(St,he)|0,g=g+Math.imul(Ye,ae)|0,v=v+Math.imul(Ye,he)|0,C=C+Math.imul(lt,Ge)|0,g=g+Math.imul(lt,je)|0,g=g+Math.imul(We,Ge)|0,v=v+Math.imul(We,je)|0;var li=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(li>>>26)|0,li&=67108863,C=Math.imul(Nt,ae),g=Math.imul(Nt,he),g=g+Math.imul(rt,ae)|0,v=Math.imul(rt,he),C=C+Math.imul(St,Ge)|0,g=g+Math.imul(St,je)|0,g=g+Math.imul(Ye,Ge)|0,v=v+Math.imul(Ye,je)|0;var fi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(fi>>>26)|0,fi&=67108863,C=Math.imul(Nt,Ge),g=Math.imul(Nt,je),g=g+Math.imul(rt,Ge)|0,v=Math.imul(rt,je);var $=(O+C|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+($>>>26)|0,$&=67108863,E[0]=Ue,E[1]=ot,E[2]=Gt,E[3]=Rt,E[4]=Dt,E[5]=Qt,E[6]=yr,E[7]=nr,E[8]=Kt,E[9]=gr,E[10]=hn,E[11]=Fr,E[12]=pn,E[13]=ci,E[14]=ui,E[15]=mn,E[16]=li,E[17]=fi,E[18]=$,O!==0&&(E[19]=O,m.length++),m};Math.imul||(k=I);function N(D,p,d){d.negative=p.negative^D.negative,d.length=D.length+p.length;for(var m=0,x=0,A=0;A<d.length-1;A++){var E=x;x=0;for(var O=m&67108863,C=Math.min(A,p.length-1),g=Math.max(0,A-D.length+1);g<=C;g++){var v=A-g,j=D.words[v]|0,ee=p.words[g]|0,ie=j*ee,fe=ie&67108863;E=E+(ie/67108864|0)|0,fe=fe+O|0,O=fe&67108863,E=E+(fe>>>26)|0,x+=E>>>26,E&=67108863}d.words[A]=O,m=E,E=x}return m!==0?d.words[A]=m:d.length--,d._strip()}function U(D,p,d){return N(D,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=k(this,p,d):x<63?m=I(this,p,d):x<1024?m=N(this,p,d):m=U(this,p,d),m},s.prototype.mul=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),this.mulTo(p,d)},s.prototype.mulf=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),U(this,p,d)},s.prototype.imul=function(p){return this.clone().mulTo(p,this)},s.prototype.imuln=function(p){var d=p<0;d&&(p=-p),n(typeof p=="number"),n(p<67108864);for(var m=0,x=0;x<this.length;x++){var A=(this.words[x]|0)*p,E=(A&67108863)+(m&67108863);m>>=26,m+=A/67108864|0,m+=E>>>26,this.words[x]=E&67108863}return m!==0&&(this.words[x]=m,this.length++),d?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var d=T(p);if(d.length===0)return new s(1);for(var m=this,x=0;x<d.length&&d[x]===0;x++,m=m.sqr());if(++x<d.length)for(var A=m.sqr();x<d.length;x++,A=A.sqr())d[x]!==0&&(m=m.mul(A));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,A;if(d!==0){var E=0;for(A=0;A<this.length;A++){var O=this.words[A]&x,C=(this.words[A]|0)-O<<d;this.words[A]=C|E,E=O>>>26-d}E&&(this.words[A]=E,this.length++)}if(m!==0){for(A=this.length-1;A>=0;A--)this.words[A+m]=this.words[A];for(A=0;A<m;A++)this.words[A]=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 A=p%26,E=Math.min((p-A)/26,this.length),O=67108863^67108863>>>A<<A,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-A|j>>>A,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 A=this.words[m];return!!(A&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,A;this._expand(x);var E,O=0;for(A=0;A<p.length;A++){E=(this.words[A+m]|0)+O;var C=(p.words[A]|0)*d;E-=C&67108863,O=(E>>26)-(C/67108864|0),this.words[A+m]=E&67108863}for(;A<this.length-m;A++)E=(this.words[A+m]|0)+O,O=E>>26,this.words[A+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,A=0;A<this.length;A++)E=-(this.words[A]|0)+O,O=E>>26,this.words[A]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),A=p,E=A.words[A.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(A=A.ushln(m),x.iushln(m),E=A.words[A.length-1]|0);var C=x.length-A.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(A,1,C);j.negative===0&&(x=j,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var ie=(x.words[A.length+ee]|0)*67108864+(x.words[A.length+ee-1]|0);for(ie=Math.min(ie/E|0,67108863),x._ishlnsubmul(A,ie,ee);x.negative!==0;)ie--,x.negative=0,x._ishlnsubmul(A,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=ie)}return g&&g._strip(),x._strip(),d!=="div"&&m!==0&&x.iushrn(m),{div:g||null,mod:x}},s.prototype.divmod=function(p,d,m){if(n(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,A,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(A=E.mod.neg(),m&&A.negative!==0&&A.iadd(p)),{div:x,mod:A}):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"&&(A=E.mod.neg(),m&&A.negative!==0&&A.isub(p)),{div:E.div,mod:A}):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),A=p.andln(1),E=m.cmp(x);return E<0||A===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,A=this.length-1;A>=0;A--)x=(m*x+(this.words[A]|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 A=(this.words[x]|0)+m*67108864;this.words[x]=A/p|0,m=A%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),A=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()||A.isOdd())&&(x.iadd(g),A.isub(v)),x.iushrn(1),A.iushrn(1);for(var ie=0,fe=1;!(m.words[0]&fe)&&ie<26;++ie,fe<<=1);if(ie>0)for(m.iushrn(ie);ie-- >0;)(E.isOdd()||O.isOdd())&&(E.iadd(g),O.isub(v)),E.iushrn(1),O.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(E),A.isub(O)):(m.isub(d),E.isub(x),O.isub(A))}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),A=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;)A.isOdd()&&A.iadd(E),A.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(A)):(m.isub(d),A.isub(x))}var j;return d.cmpn(1)===0?j=x:j=A,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 A=d.cmp(m);if(A<0){var E=d;d=m,m=E}else if(A===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 A=x,E=m;A!==0&&E<this.length;E++){var O=this.words[E]|0;O+=A,A=O>>>26,O&=67108863,this.words[E]=O}return A!==0&&(this.words[E]=A,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,A=p.words[m]|0;if(x!==A){x<A?d=-1:x>A&&(d=1);break}}return d},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new H(p)},s.prototype.toRed=function(p){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return n(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return n(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var L={k256:null,p224:null,p192:null,p25519:null};function W(D,p){this.name=D,this.p=new s(p,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}W.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},W.prototype.ireduce=function(p){var d=p,m;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),m=d.bitLength();while(m>this.n);var x=m<this.n?-1:d.ucmp(this.p);return x===0?(d.words[0]=0,d.length=1):x>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},W.prototype.split=function(p,d){p.iushrn(this.n,0,d)},W.prototype.imulK=function(p){return p.imul(this.k)};function q(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,W),q.prototype.split=function(p,d){for(var m=4194303,x=Math.min(p.length,9),A=0;A<x;A++)d.words[A]=p.words[A];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,A=10;A<p.length;A++){var O=p.words[A]|0;p.words[A-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[A-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 re(){W.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(re,W);function oe(){W.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(oe,W),oe.prototype.imulK=function(p){for(var d=0,m=0;m<p.length;m++){var x=(p.words[m]|0)*19+d,A=x&67108863;x>>>=26,p.words[m]=A,d=x}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(L[p])return L[p];var d;if(p==="k256")d=new q;else if(p==="p224")d=new X;else if(p==="p192")d=new re;else if(p==="p25519")d=new oe;else throw new Error("Unknown prime "+p);return L[p]=d,d};function H(D){if(typeof D=="string"){var p=s._prime(D);this.m=p.p,this.prime=p}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}H.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},H.prototype._verify2=function(p,d){n((p.negative|d.negative)===0,"red works only with positives"),n(p.red&&p.red===d.red,"red works only with red numbers")},H.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},H.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},H.prototype.add=function(p,d){this._verify2(p,d);var m=p.add(d);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},H.prototype.iadd=function(p,d){this._verify2(p,d);var m=p.iadd(d);return m.cmp(this.m)>=0&&m.isub(this.m),m},H.prototype.sub=function(p,d){this._verify2(p,d);var m=p.sub(d);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},H.prototype.isub=function(p,d){this._verify2(p,d);var m=p.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},H.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},H.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},H.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},H.prototype.isqr=function(p){return this.imul(p,p.clone())},H.prototype.sqr=function(p){return this.mul(p,p)},H.prototype.sqrt=function(p){if(p.isZero())return p.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(p,m)}for(var x=this.m.subn(1),A=0;!x.isZero()&&x.andln(1)===0;)A++,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),ie=A;ee.cmp(E)!==0;){for(var fe=ee,ve=0;fe.cmp(E)!==0;ve++)fe=fe.redSqr();n(ve<ie);var Se=this.pow(v,new s(1).iushln(ie-ve-1));j=j.redMul(Se),v=Se.redSqr(),ee=ee.redMul(v),ie=ve}return j},H.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},H.prototype.pow=function(p,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return p.clone();var m=4,x=new Array(1<<m);x[0]=new s(1).toRed(this),x[1]=p;for(var A=2;A<x.length;A++)x[A]=this.mul(x[A-1],p);var E=x[0],O=0,C=0,g=d.bitLength()%26;for(g===0&&(g=26),A=d.length-1;A>=0;A--){for(var v=d.words[A],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&&(A!==0||j!==0))&&(E=this.mul(E,x[O]),C=0,O=0)}g=26}return E},H.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},H.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new F(p)};function F(D){H.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(F,H),F.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},F.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},F.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),A=m.isub(x).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},F.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),A=m.isub(x).iushrn(this.shift),E=A;return A.cmp(this.m)>=0?E=A.isub(this.m):A.cmpn(0)<0&&(E=A.iadd(this.m)),E._forceRed(this)},F.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,Dr)})(Np);var a4=Np.exports;const Mm=cc(a4);var hP=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(an,"__esModule",{value:!0});an.parseAccumulatorUpdateData=an.sliceAccumulatorUpdateData=an.parseTwapMessage=an.parsePriceFeedMessage=an.isAccumulatorUpdateData=void 0;const nn=hP(a4),pP="504e4155",mP=1,gP=0,Bd=20,vP=0,yP=1;function Dp(e){return e.toString("hex").slice(0,8)===pP&&e[4]===mP&&e[5]===gP}an.isAccumulatorUpdateData=Dp;function bP(e){let t=0;if(e.readUInt8(t)!==vP)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new nn.default(e.subarray(t,t+8),"be");t+=8;const s=new nn.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new nn.default(e.subarray(t,t+8),"be");t+=8;const c=new nn.default(e.subarray(t,t+8),"be");t+=8;const u=new nn.default(e.subarray(t,t+8),"be");t+=8;const l=new nn.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}}an.parsePriceFeedMessage=bP;function wP(e){let t=0;if(e.readUInt8(t)!==yP)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new nn.default(e.subarray(t,t+16),"be");t+=16;const s=new nn.default(e.subarray(t,t+16),"be");t+=16;const o=new nn.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new nn.default(e.subarray(t,t+8),"be");t+=8;const u=new nn.default(e.subarray(t,t+8),"be");t+=8;const l=new nn.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}}an.parseTwapMessage=wP;function _P(e,t,r){if(!Dp(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+=Bd*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 $d.concat([e.subarray(0,o),$d.from([u.length]),...a.slice(t,r)])}an.sliceAccumulatorUpdateData=_P;function xP(e){if(!Dp(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+Bd))),t+=Bd;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}}an.parseAccumulatorUpdateData=xP;(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=hl;var r=an;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 c4{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 c4({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})(Rp);function u4(e,t){return function(){return e.apply(t,arguments)}}const{toString:SP}=Object.prototype,{getPrototypeOf:$p}=Object,pl=(e=>t=>{const r=SP.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),jn=e=>(e=e.toLowerCase(),t=>pl(t)===e),ml=e=>t=>typeof t===e,{isArray:qo}=Array,Ka=ml("undefined");function EP(e){return e!==null&&!Ka(e)&&e.constructor!==null&&!Ka(e.constructor)&&Xr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const l4=jn("ArrayBuffer");function CP(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&l4(e.buffer),t}const AP=ml("string"),Xr=ml("function"),f4=ml("number"),gl=e=>e!==null&&typeof e=="object",MP=e=>e===!0||e===!1,nu=e=>{if(pl(e)!=="object")return!1;const t=$p(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},TP=jn("Date"),OP=jn("File"),IP=jn("Blob"),PP=jn("FileList"),kP=e=>gl(e)&&Xr(e.pipe),jP=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Xr(e.append)&&((t=pl(e))==="formdata"||t==="object"&&Xr(e.toString)&&e.toString()==="[object FormData]"))},RP=jn("URLSearchParams"),[NP,DP,$P,BP]=["ReadableStream","Request","Response","Headers"].map(jn),LP=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function mc(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 d4(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 $s=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Dr)(),h4=e=>!Ka(e)&&e!==$s;function Ld(){const{caseless:e}=h4(this)&&this||{},t={},r=(n,i)=>{const s=e&&d4(t,i)||i;nu(t[s])&&nu(n)?t[s]=Ld(t[s],n):nu(n)?t[s]=Ld({},n):qo(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&mc(arguments[n],r);return t}const FP=(e,t,r,{allOwnKeys:n}={})=>(mc(t,(i,s)=>{r&&Xr(i)?e[s]=u4(i,r):e[s]=i},{allOwnKeys:n}),e),UP=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zP=(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)},VP=(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&&$p(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},qP=(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},HP=e=>{if(!e)return null;if(qo(e))return e;let t=e.length;if(!f4(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},WP=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&$p(Uint8Array)),GP=(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])}},KP=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},XP=jn("HTMLFormElement"),JP=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),Tm=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),YP=jn("RegExp"),p4=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};mc(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},ZP=e=>{p4(e,(t,r)=>{if(Xr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Xr(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+"'")})}})},QP=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return qo(e)?n(e):n(String(e).split(t)),r},e7=()=>{},t7=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Tf="abcdefghijklmnopqrstuvwxyz",Om="0123456789",m4={DIGIT:Om,ALPHA:Tf,ALPHA_DIGIT:Tf+Tf.toUpperCase()+Om},r7=(e=16,t=m4.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function n7(e){return!!(e&&Xr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const i7=e=>{const t=new Array(10),r=(n,i)=>{if(gl(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=qo(n)?[]:{};return mc(n,(o,a)=>{const c=r(o,i+1);!Ka(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},s7=jn("AsyncFunction"),o7=e=>e&&(gl(e)||Xr(e))&&Xr(e.then)&&Xr(e.catch),g4=((e,t)=>e?setImmediate:t?((r,n)=>($s.addEventListener("message",({source:i,data:s})=>{i===$s&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),$s.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Xr($s.postMessage)),a7=typeof queueMicrotask<"u"?queueMicrotask.bind($s):typeof Cn<"u"&&Cn.nextTick||g4;var le={isArray:qo,isArrayBuffer:l4,isBuffer:EP,isFormData:jP,isArrayBufferView:CP,isString:AP,isNumber:f4,isBoolean:MP,isObject:gl,isPlainObject:nu,isReadableStream:NP,isRequest:DP,isResponse:$P,isHeaders:BP,isUndefined:Ka,isDate:TP,isFile:OP,isBlob:IP,isRegExp:YP,isFunction:Xr,isStream:kP,isURLSearchParams:RP,isTypedArray:WP,isFileList:PP,forEach:mc,merge:Ld,extend:FP,trim:LP,stripBOM:UP,inherits:zP,toFlatObject:VP,kindOf:pl,kindOfTest:jn,endsWith:qP,toArray:HP,forEachEntry:GP,matchAll:KP,isHTMLForm:XP,hasOwnProperty:Tm,hasOwnProp:Tm,reduceDescriptors:p4,freezeMethods:ZP,toObjectSet:QP,toCamelCase:JP,noop:e7,toFiniteNumber:t7,findKey:d4,global:$s,isContextDefined:h4,ALPHABET:m4,generateString:r7,isSpecCompliantForm:n7,toJSONObject:i7,isAsyncFn:s7,isThenable:o7,setImmediate:g4,asap:a7};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)}le.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:le.toJSONObject(this.config),code:this.code,status:this.status}}});const v4=pt.prototype,y4={};["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=>{y4[e]={value:e}});Object.defineProperties(pt,y4);Object.defineProperty(v4,"isAxiosError",{value:!0});pt.from=(e,t,r,n,i,s)=>{const o=Object.create(v4);return le.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 c7=null;function Fd(e){return le.isPlainObject(e)||le.isArray(e)}function b4(e){return le.endsWith(e,"[]")?e.slice(0,-2):e}function Im(e,t,r){return e?e.concat(t).map(function(i,s){return i=b4(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function u7(e){return le.isArray(e)&&!e.some(Fd)}const l7=le.toFlatObject(le,{},null,function(t){return/^is[A-Z]/.test(t)});function vl(e,t,r){if(!le.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=le.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,T){return!le.isUndefined(T[w])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,o=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&le.isSpecCompliantForm(t);if(!le.isFunction(i))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(le.isDate(b))return b.toISOString();if(!c&&le.isBlob(b))throw new pt("Blob is not supported. Use a Buffer instead.");return le.isArrayBuffer(b)||le.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):$d.from(b):b}function l(b,w,T){let I=b;if(b&&!T&&typeof b=="object"){if(le.endsWith(w,"{}"))w=n?w:w.slice(0,-2),b=JSON.stringify(b);else if(le.isArray(b)&&u7(b)||(le.isFileList(b)||le.endsWith(w,"[]"))&&(I=le.toArray(b)))return w=b4(w),I.forEach(function(N,U){!(le.isUndefined(N)||N===null)&&t.append(o===!0?Im([w],U,s):o===null?w:w+"[]",u(N))}),!1}return Fd(b)?!0:(t.append(Im(T,w,s),u(b)),!1)}const f=[],h=Object.assign(l7,{defaultVisitor:l,convertValue:u,isVisitable:Fd});function y(b,w){if(!le.isUndefined(b)){if(f.indexOf(b)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(b),le.forEach(b,function(I,k){(!(le.isUndefined(I)||I===null)&&i.call(t,I,le.isString(k)?k.trim():k,w,h))===!0&&y(I,w?w.concat(k):[k])}),f.pop()}}if(!le.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Pm(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Bp(e,t){this._pairs=[],e&&vl(e,this,t)}const w4=Bp.prototype;w4.append=function(t,r){this._pairs.push([t,r])};w4.toString=function(t){const r=t?function(n){return t.call(this,n,Pm)}:Pm;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function f7(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function _4(e,t,r){if(!t)return e;const n=r&&r.encode||f7;le.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(t,r):s=le.isURLSearchParams(t)?t.toString():new Bp(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class d7{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){le.forEach(this.handlers,function(n){n!==null&&t(n)})}}var km=d7,x4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},h7=typeof URLSearchParams<"u"?URLSearchParams:Bp,p7=typeof FormData<"u"?FormData:null,m7=typeof Blob<"u"?Blob:null,g7={isBrowser:!0,classes:{URLSearchParams:h7,FormData:p7,Blob:m7},protocols:["http","https","file","blob","url","data"]};const Lp=typeof window<"u"&&typeof document<"u",Ud=typeof navigator=="object"&&navigator||void 0,v7=Lp&&(!Ud||["ReactNative","NativeScript","NS"].indexOf(Ud.product)<0),y7=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),b7=Lp&&window.location.href||"http://localhost";var w7=Object.freeze({__proto__:null,hasBrowserEnv:Lp,hasStandardBrowserWebWorkerEnv:y7,hasStandardBrowserEnv:v7,navigator:Ud,origin:b7}),Ar={...w7,...g7};function _7(e,t){return vl(e,new Ar.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Ar.isNode&&le.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function x7(e){return le.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function S7(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 S4(e){function t(r,n,i,s){let o=r[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=s>=r.length;return o=!o&&le.isArray(i)?i.length:o,c?(le.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!le.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],s)&&le.isArray(i[o])&&(i[o]=S7(i[o])),!a)}if(le.isFormData(e)&&le.isFunction(e.entries)){const r={};return le.forEachEntry(e,(n,i)=>{t(x7(n),i,r,0)}),r}return null}function E7(e,t,r){if(le.isString(e))try{return(t||JSON.parse)(e),le.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Fp={transitional:x4,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=le.isObject(t);if(s&&le.isHTMLForm(t)&&(t=new FormData(t)),le.isFormData(t))return i?JSON.stringify(S4(t)):t;if(le.isArrayBuffer(t)||le.isBuffer(t)||le.isStream(t)||le.isFile(t)||le.isBlob(t)||le.isReadableStream(t))return t;if(le.isArrayBufferView(t))return t.buffer;if(le.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return _7(t,this.formSerializer).toString();if((a=le.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return vl(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),E7(t)):t}],transformResponse:[function(t){const r=this.transitional||Fp.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(le.isResponse(t)||le.isReadableStream(t))return t;if(t&&le.isString(t)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?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:Ar.classes.FormData,Blob:Ar.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};le.forEach(["delete","get","head","post","put","patch"],e=>{Fp.headers[e]={}});var Up=Fp;const C7=le.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var A7=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]&&C7[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const jm=Symbol("internals");function va(e){return e&&String(e).trim().toLowerCase()}function iu(e){return e===!1||e==null?e:le.isArray(e)?e.map(iu):String(e)}function M7(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 T7=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Of(e,t,r,n,i){if(le.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!le.isString(t)){if(le.isString(n))return t.indexOf(n)!==-1;if(le.isRegExp(n))return n.test(t)}}function O7(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function I7(e,t){const r=le.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,s,o){return this[n].call(this,t,i,s,o)},configurable:!0})})}class yl{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=va(c);if(!l)throw new Error("header name must be a non-empty string");const f=le.findKey(i,l);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=iu(a))}const o=(a,c)=>le.forEach(a,(u,l)=>s(u,l,c));if(le.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(le.isString(t)&&(t=t.trim())&&!T7(t))o(A7(t),r);else if(le.isHeaders(t))for(const[a,c]of t.entries())s(c,a,n);else t!=null&&s(r,t,n);return this}get(t,r){if(t=va(t),t){const n=le.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return M7(i);if(le.isFunction(r))return r.call(this,i,n);if(le.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=va(t),t){const n=le.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Of(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=va(o),o){const a=le.findKey(n,o);a&&(!r||Of(n,n[a],a,r))&&(delete n[a],i=!0)}}return le.isArray(t)?t.forEach(s):s(t),i}clear(t){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!t||Of(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const r=this,n={};return le.forEach(this,(i,s)=>{const o=le.findKey(n,s);if(o){r[o]=iu(i),delete r[s];return}const a=t?O7(s):String(s).trim();a!==s&&delete r[s],r[a]=iu(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return le.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&le.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
35
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[jm]=this[jm]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=va(o);n[a]||(I7(i,o),n[a]=!0)}return le.isArray(t)?t.forEach(s):s(t),this}}yl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);le.reduceDescriptors(yl.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});le.freezeMethods(yl);var An=yl;function If(e,t){const r=this||Up,n=t||r,i=An.from(n.headers);let s=n.data;return le.forEach(e,function(a){s=a.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function E4(e){return!!(e&&e.__CANCEL__)}function Ho(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}le.inherits(Ho,pt,{__CANCEL__:!0});function C4(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 P7(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function k7(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 j7(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 Iu=(e,t,r=3)=>{let n=0;const i=k7(50,250);return j7(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)},Rm=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Nm=e=>(...t)=>le.asap(()=>e(...t));var R7=Ar.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Ar.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Ar.origin),Ar.navigator&&/(msie|trident)/i.test(Ar.navigator.userAgent)):()=>!0,N7=Ar.hasStandardBrowserEnv?{write(e,t,r,n,i,s){const o=[e+"="+encodeURIComponent(t)];le.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),le.isString(n)&&o.push("path="+n),le.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function D7(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function $7(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function A4(e,t){return e&&!D7(t)?$7(e,t):t}const Dm=e=>e instanceof An?{...e}:e;function Vs(e,t){t=t||{};const r={};function n(u,l,f,h){return le.isPlainObject(u)&&le.isPlainObject(l)?le.merge.call({caseless:h},u,l):le.isPlainObject(l)?le.merge({},l):le.isArray(l)?l.slice():l}function i(u,l,f,h){if(le.isUndefined(l)){if(!le.isUndefined(u))return n(void 0,u,f,h)}else return n(u,l,f,h)}function s(u,l){if(!le.isUndefined(l))return n(void 0,l)}function o(u,l){if(le.isUndefined(l)){if(!le.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,f){if(f in t)return n(u,l);if(f in e)return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,l,f)=>i(Dm(u),Dm(l),f,!0)};return le.forEach(Object.keys(Object.assign({},e,t)),function(l){const f=c[l]||i,h=f(e[l],t[l],l);le.isUndefined(h)&&f!==a||(r[l]=h)}),r}var M4=e=>{const t=Vs({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=An.from(o),t.url=_4(A4(t.baseURL,t.url),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(le.isFormData(r)){if(Ar.hasStandardBrowserEnv||Ar.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(Ar.hasStandardBrowserEnv&&(n&&le.isFunction(n)&&(n=n(t)),n||n!==!1&&R7(t.url))){const u=i&&s&&N7.read(s);u&&o.set(i,u)}return t};const B7=typeof XMLHttpRequest<"u";var L7=B7&&function(e){return new Promise(function(r,n){const i=M4(e);let s=i.data;const o=An.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,f,h,y,b;function w(){y&&y(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function I(){if(!T)return;const N=An.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:N,config:e,request:T};C4(function(q){r(q),w()},function(q){n(q),w()},L),T=null}"onloadend"in T?T.onloadend=I:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(I)},T.onabort=function(){T&&(n(new pt("Request aborted",pt.ECONNABORTED,e,T)),T=null)},T.onerror=function(){n(new pt("Network Error",pt.ERR_NETWORK,e,T)),T=null},T.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||x4;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new pt(U,L.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,e,T)),T=null},s===void 0&&o.setContentType(null),"setRequestHeader"in T&&le.forEach(o.toJSON(),function(U,L){T.setRequestHeader(L,U)}),le.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),a&&a!=="json"&&(T.responseType=i.responseType),u&&([h,b]=Iu(u,!0),T.addEventListener("progress",h)),c&&T.upload&&([f,y]=Iu(c),T.upload.addEventListener("progress",f),T.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=N=>{T&&(n(!N||N.type?new Ho(null,e,T):N),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const k=P7(i.url);if(k&&Ar.protocols.indexOf(k)===-1){n(new pt("Unsupported protocol "+k+":",pt.ERR_BAD_REQUEST,e));return}T.send(s||null)})};const F7=(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 Ho(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=()=>le.asap(a),c}};var U7=F7;const z7=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},V7=async function*(e,t){for await(const r of q7(e))yield*z7(r,t)},q7=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()}},$m=(e,t,r,n)=>{const i=V7(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})},bl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",T4=bl&&typeof ReadableStream=="function",H7=bl&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),O4=(e,...t)=>{try{return!!e(...t)}catch{return!1}},W7=T4&&O4(()=>{let e=!1;const t=new Request(Ar.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Bm=64*1024,zd=T4&&O4(()=>le.isReadableStream(new Response("").body)),Pu={stream:zd&&(e=>e.body)};bl&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Pu[t]&&(Pu[t]=le.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 G7=async e=>{if(e==null)return 0;if(le.isBlob(e))return e.size;if(le.isSpecCompliantForm(e))return(await new Request(Ar.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(le.isArrayBufferView(e)||le.isArrayBuffer(e))return e.byteLength;if(le.isURLSearchParams(e)&&(e=e+""),le.isString(e))return(await H7(e)).byteLength},K7=async(e,t)=>{const r=le.toFiniteNumber(e.getContentLength());return r??G7(t)};var X7=bl&&(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}=M4(e);u=u?(u+"").toLowerCase():"text";let y=U7([i,s&&s.toAbortSignal()],o),b;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let T;try{if(c&&W7&&r!=="get"&&r!=="head"&&(T=await K7(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),W;if(le.isFormData(n)&&(W=L.headers.get("content-type"))&&l.setContentType(W),L.body){const[q,X]=Rm(T,Iu(Nm(c)));n=$m(L.body,Bm,q,X)}}le.isString(f)||(f=f?"include":"omit");const I="credentials"in Request.prototype;b=new Request(t,{...h,signal:y,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:I?f:void 0});let k=await fetch(b);const N=zd&&(u==="stream"||u==="response");if(zd&&(a||N&&w)){const L={};["status","statusText","headers"].forEach(re=>{L[re]=k[re]});const W=le.toFiniteNumber(k.headers.get("content-length")),[q,X]=a&&Rm(W,Iu(Nm(a),!0))||[];k=new Response($m(k.body,Bm,q,()=>{X&&X(),w&&w()}),L)}u=u||"text";let U=await Pu[le.findKey(Pu,u)||"text"](k,e);return!N&&w&&w(),await new Promise((L,W)=>{C4(L,W,{data:U,headers:An.from(k.headers),status:k.status,statusText:k.statusText,config:e,request:b})})}catch(I){throw w&&w(),I&&I.name==="TypeError"&&/fetch/i.test(I.message)?Object.assign(new pt("Network Error",pt.ERR_NETWORK,e,b),{cause:I.cause||I}):pt.from(I,I&&I.code,e,b)}});const Vd={http:c7,xhr:L7,fetch:X7};le.forEach(Vd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Lm=e=>`- ${e}`,J7=e=>le.isFunction(e)||e===null||e===!1;var I4={getAdapter:e=>{e=le.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let s=0;s<t;s++){r=e[s];let o;if(n=r,!J7(r)&&(n=Vd[(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(Lm).join(`
|
|
37
|
+
`):" "+Lm(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:Vd};function Pf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ho(null,e)}function Fm(e){return Pf(e),e.headers=An.from(e.headers),e.data=If.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),I4.getAdapter(e.adapter||Up.adapter)(e).then(function(n){return Pf(e),n.data=If.call(e,e.transformResponse,n),n.headers=An.from(n.headers),n},function(n){return E4(n)||(Pf(e),n&&n.response&&(n.response.data=If.call(e,e.transformResponse,n.response),n.response.headers=An.from(n.response.headers))),Promise.reject(n)})}const P4="1.7.9",wl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wl[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Um={};wl.transitional=function(t,r,n){function i(s,o){return"[Axios v"+P4+"] 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&&!Um[o]&&(Um[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}};wl.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Y7(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 su={assertOptions:Y7,validators:wl};const Fn=su.validators;class ku{constructor(t){this.defaults=t,this.interceptors={request:new km,response:new km}}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=Vs(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&su.assertOptions(n,{silentJSONParsing:Fn.transitional(Fn.boolean),forcedJSONParsing:Fn.transitional(Fn.boolean),clarifyTimeoutError:Fn.transitional(Fn.boolean)},!1),i!=null&&(le.isFunction(i)?r.paramsSerializer={serialize:i}:su.assertOptions(i,{encode:Fn.function,serialize:Fn.function},!0)),su.assertOptions(r,{baseUrl:Fn.spelling("baseURL"),withXsrfToken:Fn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&le.merge(s.common,s[r.method]);s&&le.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),r.headers=An.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(r)===!1||(c=c&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let l,f=0,h;if(!c){const b=[Fm.bind(this),void 0];for(b.unshift.apply(b,a),b.push.apply(b,u),h=b.length,l=Promise.resolve(r);f<h;)l=l.then(b[f++],b[f++]);return l}h=a.length;let y=r;for(f=0;f<h;){const b=a[f++],w=a[f++];try{y=b(y)}catch(T){w.call(this,T);break}}try{l=Fm.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=Vs(this.defaults,t);const r=A4(t.baseURL,t.url);return _4(r,t.params,t.paramsSerializer)}}le.forEach(["delete","get","head","options"],function(t){ku.prototype[t]=function(r,n){return this.request(Vs(n||{},{method:t,url:r,data:(n||{}).data}))}});le.forEach(["post","put","patch"],function(t){function r(n){return function(s,o,a){return this.request(Vs(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ku.prototype[t]=r(),ku.prototype[t+"Form"]=r(!0)});var ou=ku;class zp{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 Ho(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 zp(function(i){t=i}),cancel:t}}}var Z7=zp;function Q7(e){return function(r){return e.apply(null,r)}}function e9(e){return le.isObject(e)&&e.isAxiosError===!0}const qd={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(qd).forEach(([e,t])=>{qd[t]=e});var t9=qd;function k4(e){const t=new ou(e),r=u4(ou.prototype.request,t);return le.extend(r,ou.prototype,t,{allOwnKeys:!0}),le.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return k4(Vs(e,i))},r}const cr=k4(Up);cr.Axios=ou;cr.CanceledError=Ho;cr.CancelToken=Z7;cr.isCancel=E4;cr.VERSION=P4;cr.toFormData=vl;cr.AxiosError=pt;cr.Cancel=cr.CanceledError;cr.all=function(t){return Promise.all(t)};cr.spread=Q7;cr.isAxiosError=e9;cr.mergeConfig=Vs;cr.AxiosHeaders=An;cr.formToJSON=e=>S4(le.isHTMLForm(e)?new FormData(e):e);cr.getAdapter=I4.getAdapter;cr.HttpStatusCode=t9;cr.default=cr;var j4=cr,Vp={exports:{}},Yr={},R4={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})(R4);var r9=R4.exports,kf={exports:{}},jf={exports:{}},zm;function _l(){return zm||(zm=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}(jf)),jf.exports}var Vm;function n9(){return Vm||(Vm=1,function(e){var t=_l().default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},s=Object.prototype,o=s.hasOwnProperty,a=Object.defineProperty||function(E,O,C){E[O]=C.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function h(E,O,C){return Object.defineProperty(E,O,{value:C,enumerable:!0,configurable:!0,writable:!0}),E[O]}try{h({},"")}catch{h=function(C,g,v){return C[g]=v}}function y(E,O,C,g){var v=O&&O.prototype instanceof U?O:U,j=Object.create(v.prototype),ee=new x(g||[]);return a(j,"_invoke",{value:D(E,C,ee)}),j}function b(E,O,C){try{return{type:"normal",arg:E.call(O,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=y;var w="suspendedStart",T="suspendedYield",I="executing",k="completed",N={};function U(){}function L(){}function W(){}var q={};h(q,u,function(){return this});var X=Object.getPrototypeOf,re=X&&X(X(A([])));re&&re!==s&&o.call(re,u)&&(q=re);var oe=W.prototype=U.prototype=Object.create(q);function H(E){["next","throw","return"].forEach(function(O){h(E,O,function(C){return this._invoke(O,C)})})}function F(E,O){function C(v,j,ee,ie){var fe=b(E[v],E,j);if(fe.type!=="throw"){var ve=fe.arg,Se=ve.value;return Se&&t(Se)=="object"&&o.call(Se,"__await")?O.resolve(Se.__await).then(function(xe){C("next",xe,ee,ie)},function(xe){C("throw",xe,ee,ie)}):O.resolve(Se).then(function(xe){ve.value=xe,ee(ve)},function(xe){return C("throw",xe,ee,ie)})}ie(fe.arg)}var g;a(this,"_invoke",{value:function(j,ee){function ie(){return new O(function(fe,ve){C(j,ee,fe,ve)})}return g=g?g.then(ie,ie):ie()}})}function D(E,O,C){var g=w;return function(v,j){if(g===I)throw Error("Generator is already running");if(g===k){if(v==="throw")throw j;return{value:n,done:!0}}for(C.method=v,C.arg=j;;){var ee=C.delegate;if(ee){var ie=p(ee,C);if(ie){if(ie===N)continue;return ie}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===w)throw g=k,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=I;var fe=b(E,O,C);if(fe.type==="normal"){if(g=C.done?k:T,fe.arg===N)continue;return{value:fe.arg,done:C.done}}fe.type==="throw"&&(g=k,C.method="throw",C.arg=fe.arg)}}}function p(E,O){var C=O.method,g=E.iterator[C];if(g===n)return O.delegate=null,C==="throw"&&E.iterator.return&&(O.method="return",O.arg=n,p(E,O),O.method==="throw")||C!=="return"&&(O.method="throw",O.arg=new TypeError("The iterator does not provide a '"+C+"' method")),N;var v=b(g,E.iterator,O.arg);if(v.type==="throw")return O.method="throw",O.arg=v.arg,O.delegate=null,N;var 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,N):j:(O.method="throw",O.arg=new TypeError("iterator result is not an object"),O.delegate=null,N)}function d(E){var O={tryLoc:E[0]};1 in E&&(O.catchLoc=E[1]),2 in E&&(O.finallyLoc=E[2],O.afterLoc=E[3]),this.tryEntries.push(O)}function m(E){var O=E.completion||{};O.type="normal",delete O.arg,E.completion=O}function x(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(d,this),this.reset(!0)}function A(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(oe,"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(oe),E},i.awrap=function(E){return{__await:E}},H(F.prototype),h(F.prototype,l,function(){return this}),i.AsyncIterator=F,i.async=function(E,O,C,g,v){v===void 0&&(v=Promise);var j=new F(y(E,O,C,g),v);return i.isGeneratorFunction(O)?j:j.next().then(function(ee){return ee.done?ee.value:j.next()})},H(oe),h(oe,f,"Generator"),h(oe,u,function(){return this}),h(oe,"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=A,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(ve,Se){return ee.type="throw",ee.arg=O,C.next=ve,Se&&(C.method="next",C.arg=n),!!Se}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 ie=o.call(j,"catchLoc"),fe=o.call(j,"finallyLoc");if(ie&&fe){if(this.prev<j.catchLoc)return g(j.catchLoc,!0);if(this.prev<j.finallyLoc)return g(j.finallyLoc)}else if(ie){if(this.prev<j.catchLoc)return g(j.catchLoc,!0)}else{if(!fe)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,N):this.complete(ee)},complete:function(O,C){if(O.type==="throw")throw O.arg;return O.type==="break"||O.type==="continue"?this.next=O.arg:O.type==="return"?(this.rval=this.arg=O.arg,this.method="return",this.next="end"):O.type==="normal"&&C&&(this.next=C),N},finish:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.finallyLoc===O)return this.complete(g.completion,g.afterLoc),m(g),N}},catch:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc===O){var v=g.completion;if(v.type==="throw"){var j=v.arg;m(g)}return j}}throw Error("illegal catch attempt")},delegateYield:function(O,C,g){return this.delegate={iterator:A(O),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),N}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(kf)),kf.exports}var Rf,qm;function i9(){if(qm)return Rf;qm=1;var e=n9()();Rf=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Rf}var Nf={exports:{}},Hm;function s9(){return Hm||(Hm=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}(Nf)),Nf.exports}var Df={exports:{}},$f={exports:{}},Bf={exports:{}},Wm;function o9(){return Wm||(Wm=1,function(e){var t=_l().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}(Bf)),Bf.exports}var Gm;function a9(){return Gm||(Gm=1,function(e){var t=_l().default,r=o9();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}($f)),$f.exports}var Km;function c9(){return Km||(Km=1,function(e){var t=a9();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}(Df)),Df.exports}var Lf,Xm;function u9(){if(Xm)return Lf;Xm=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 Lf=t=>!e.has(t&&t.code),Lf}var gc=r9;Object.defineProperty(Yr,"__esModule",{value:!0});Yr.isNetworkError=Hp;Yr.isRetryableError=xl;Yr.isSafeRequestError=$4;Yr.isIdempotentRequestError=Wp;Yr.isNetworkOrIdempotentRequestError=Gp;Yr.exponentialDelay=B4;Yr.default=Ks;Yr.DEFAULT_OPTIONS=Yr.namespace=void 0;var ju=gc(i9()),l9=gc(_l()),N4=gc(s9()),f9=gc(c9()),d9=gc(u9());function Jm(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 Ff(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jm(Object(r),!0).forEach(function(n){(0,f9.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var qp="axios-retry";Yr.namespace=qp;function Hp(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,d9.default)(e)}var D4=["get","head","options"],h9=D4.concat(["put","delete"]);function xl(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function $4(e){return e.config?xl(e)&&D4.indexOf(e.config.method)!==-1:!1}function Wp(e){return e.config?xl(e)&&h9.indexOf(e.config.method)!==-1:!1}function Gp(e){return Hp(e)||Wp(e)}function p9(){return 0}function B4(){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 L4={retries:3,retryCondition:Gp,retryDelay:p9,shouldResetTimeout:!1,onRetry:function(){}};Yr.DEFAULT_OPTIONS=L4;function m9(e,t){return Ff(Ff(Ff({},L4),t),e[qp])}function Ym(e,t){var r=m9(e,t);return r.retryCount=r.retryCount||0,e[qp]=r,r}function g9(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 v9(e,t){return Hd.apply(this,arguments)}function Hd(){return Hd=(0,N4.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,l9.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]])})),Hd.apply(this,arguments)}function Ks(e,t){var r=e.interceptors.request.use(function(i){var s=Ym(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,N4.default)(ju.default.mark(function s(o){var a,c,u,l,f,h,y,b;return ju.default.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(a=o.config,a){T.next=3;break}return T.abrupt("return",Promise.reject(o));case 3:return c=Ym(a,t),T.next=6,v9(c,o);case 6:if(!T.sent){T.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),g9(e,a),!(!l&&a.timeout&&c.lastRequestTime)){T.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){T.next=16;break}return T.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(I){return I}],T.next=20,f(c.retryCount,o,a);case 20:return T.abrupt("return",new Promise(function(I){return setTimeout(function(){return I(e(a))},h)}));case 21:return T.abrupt("return",Promise.reject(o));case 22:case"end":return T.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}Ks.isNetworkError=Hp;Ks.isSafeRequestError=$4;Ks.isIdempotentRequestError=Wp;Ks.isNetworkOrIdempotentRequestError=Gp;Ks.exponentialDelay=B4;Ks.isRetryableError=xl;const F4=Yr.default;Vp.exports=F4;Vp.exports.default=F4;var y9=Vp.exports,Sl={},po=null;typeof WebSocket<"u"?po=WebSocket:typeof MozWebSocket<"u"?po=MozWebSocket:typeof Dr<"u"?po=Dr.WebSocket||Dr.MozWebSocket:typeof window<"u"?po=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(po=self.WebSocket||self.MozWebSocket);var b9=po,w9=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.ResilientWebSocket=void 0;const _9=w9(b9),x9=3e4+3e3;class S9{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 _9.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=E9(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await Zm(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()},x9)}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 Zm(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}}Sl.ResilientWebSocket=S9;async function Zm(e){return new Promise(t=>setTimeout(t,e))}function E9(e){return 2**e*100}var ko={};Object.defineProperty(ko,"__esModule",{value:!0});ko.removeLeading0xIfExists=ko.makeWebsocketUrl=void 0;function C9(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}ko.makeWebsocketUrl=C9;function A9(e){return e.startsWith("0x")?e.substring(2):e}ko.removeLeading0xIfExists=A9;var U4=Dr&&Dr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(dl,"__esModule",{value:!0});dl.PriceServiceConnection=void 0;const Uf=Rp,M9=U4(j4),Qm=U4(y9),T9=Sl,zf=ko;class O9{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=M9.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,Qm.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:Qm.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 Cn<"u"&&typeof Cn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),Cn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,zf.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=>Uf.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 Uf.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,zf.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,zf.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 T9.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=Uf.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()}}dl.PriceServiceConnection=O9;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=dl;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=Rp;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}})})(jp);Object.defineProperty(fl,"__esModule",{value:!0});fl.SuiPriceServiceConnection=void 0;const I9=jp,P9=pc;class k9 extends I9.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>P9.Buffer.from(n,"base64"))}}fl.SuiPriceServiceConnection=k9;var El={};Object.defineProperty(El,"__esModule",{value:!0});El.SuiPythClient=void 0;const jc=On,to=ii,j9=pc,Vf=16*1024;class R9{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(to.bcs.vector(to.bcs.U8).serialize(Array.from(s),{maxSize:Vf}).toBytes()),r.object(jc.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(to.bcs.vector(to.bcs.U8).serialize(Array.from(r[0]),{maxSize:Vf}).toBytes()),a[0],t.object(jc.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(jc.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(to.bcs.vector(to.bcs.U8).serialize(Array.from(r[0]),{maxSize:Vf}).toBytes()),s[0],t.object(jc.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(j9.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)}}El.SuiPythClient=R9;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=fl;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=El;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=jp;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})})(o4);var eg=QE,Wd=On,N9=yo,Rc=o4,D9=Object.create,Kp=Object.defineProperty,$9=Object.defineProperties,B9=Object.getOwnPropertyDescriptor,L9=Object.getOwnPropertyDescriptors,z4=Object.getOwnPropertyNames,tg=Object.getOwnPropertySymbols,F9=Object.getPrototypeOf,V4=Object.prototype.hasOwnProperty,U9=Object.prototype.propertyIsEnumerable,rg=(e,t,r)=>t in e?Kp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,z9=(e,t)=>{for(var r in t||(t={}))V4.call(t,r)&&rg(e,r,t[r]);if(tg)for(var r of tg(t))U9.call(t,r)&&rg(e,r,t[r]);return e},V9=(e,t)=>$9(e,L9(t)),q9=(e=>typeof Hn<"u"?Hn:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Hn<"u"?Hn:t)[r]}):e)(function(e){if(typeof Hn<"u")return Hn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),H9=(e,t)=>function(){return t||(0,e[z4(e)[0]])((t={exports:{}}).exports,t),t.exports},W9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of z4(t))!V4.call(e,i)&&i!==r&&Kp(e,i,{get:()=>t[i],enumerable:!(n=B9(t,i))||n.enumerable});return e},Wo=(e,t,r)=>(r=e!=null?D9(F9(e)):{},W9(!e||!e.__esModule?Kp(r,"default",{value:e,enumerable:!0}):r,e)),_t=(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())}),Go=H9({"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=q9("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 A=0;d[0]==="-"&&(A++,this.negative=1),A<d.length&&(m===16?this._parseHex(d,A,x):(this._parseBase(d,m,A),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 A=0;A<this.length;A++)this.words[A]=0;var E,O,C=0;if(x==="be")for(A=d.length-1,E=0;A>=0;A-=3)O=d[A]|d[A-1]<<8|d[A-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(A=0,E=0;A<d.length;A+=3)O=d[A]|d[A+1]<<8|d[A+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 A=0;A<this.length;A++)this.words[A]=0;var E=0,O=0,C;if(x==="be")for(A=d.length-1;A>=m;A-=2)C=u(d,m,A)<<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(A=g%2===0?m+1:m;A<d.length;A+=2)C=u(d,m,A)<<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 A=0,E=0,O=Math.min(p.length,m),C=d;C<O;C++){var g=p.charCodeAt(C)-48;A*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),A+=E}return A}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var A=0,E=1;E<=67108863;E*=m)A++;A--,E=E/m|0;for(var O=d.length-x,C=O%A,g=Math.min(O,O-C)+x,v=0,j=x;j<g;j+=A)v=l(d,j,j+A,m),this.imuln(E),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(C!==0){var ee=1;for(v=l(d,j,d.length,m),j=0;j<C;j++)ee*=m;this.imuln(ee),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},o.prototype.copy=function(d){d.words=new Array(this.length);for(var m=0;m<this.length;m++)d.words[m]=this.words[m];d.length=this.length,d.negative=this.negative,d.red=this.red};function f(p,d){p.words=d.words,p.length=d.length,p.negative=d.negative,p.red=d.red}if(o.prototype._move=function(d){f(d,this)},o.prototype.clone=function(){var d=new o(null);return this.copy(d),d},o.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],b=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(d,m){d=d||10,m=m|0||1;var x;if(d===16||d==="hex"){x="";for(var A=0,E=0,O=0;O<this.length;O++){var C=this.words[O],g=((C<<A|E)&16777215).toString(16);E=C>>>24-A&16777215,A+=2,A>=26&&(A-=26,O--),E!==0||O!==this.length-1?x=y[6-g.length]+g+x:x=g+x}for(E!==0&&(x=E.toString(16)+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(d===(d|0)&&d>=2&&d<=36){var v=b[d],j=w[d];x="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var ie=ee.modrn(j).toString(d);ee=ee.idivn(j),ee.isZero()?x=ie+x:x=y[v-ie.length]+ie+x}for(this.isZero()&&(x="0"+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(d,m){return this.toArrayLike(a,d,m)}),o.prototype.toArray=function(d,m){return this.toArrayLike(Array,d,m)};var T=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var A=this.byteLength(),E=x||Math.max(1,A);i(A<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=T(d,E),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](O,A),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,A=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|A;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),A=0,O=0):(A=C>>>24,O+=2)}if(x<d.length)for(d[x++]=A;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,A=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|A;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),A=0,O=0):(A=C>>>24,O+=2)}if(x>=0)for(d[x--]=A;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,A=m%26;d[m]=p.words[x]>>>A&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 A=0;A<x.length;A++)this.words[A]=m.words[A]^x.words[A];if(this!==m)for(;A<m.length;A++)this.words[A]=m.words[A];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 A=0;A<m;A++)this.words[A]=~this.words[A]&67108863;return x>0&&(this.words[A]=~this.words[A]&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,A=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<A:this.words[x]=this.words[x]&~(1<<A),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,A;this.length>d.length?(x=this,A=d):(x=d,A=this);for(var E=0,O=0;O<A.length;O++)m=(x.words[O]|0)+(A.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 A,E;x>0?(A=this,E=d):(A=d,E=this);for(var O=0,C=0;C<E.length;C++)m=(A.words[C]|0)-(E.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;for(;O!==0&&C<A.length;C++)m=(A.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;if(O===0&&C<A.length&&A!==this)for(;C<A.length;C++)this.words[C]=A.words[C];return this.length=Math.max(this.length,C),A!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(d){return this.clone().isub(d)};function k(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var A=p.words[0]|0,E=d.words[0]|0,O=A*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,ie=Math.min(v,d.length-1),fe=Math.max(0,v-p.length+1);fe<=ie;fe++){var ve=v-fe|0;A=p.words[ve]|0,E=d.words[fe]|0,O=A*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 N=function(d,m,x){var A=d.words,E=m.words,O=x.words,C=0,g,v,j,ee=A[0]|0,ie=ee&8191,fe=ee>>>13,ve=A[1]|0,Se=ve&8191,xe=ve>>>13,He=A[2]|0,Fe=He&8191,dt=He>>>13,ht=A[3]|0,De=ht&8191,mt=ht>>>13,_e=A[4]|0,me=_e&8191,Me=_e>>>13,Ve=A[5]|0,Ne=Ve&8191,Te=Ve>>>13,Oe=A[6]|0,Le=Oe&8191,ut=Oe>>>13,lt=A[7]|0,We=lt&8191,kt=lt>>>13,St=A[8]|0,Ye=St&8191,Mt=St>>>13,Nt=A[9]|0,rt=Nt&8191,Et=Nt>>>13,Tt=E[0]|0,it=Tt&8191,jt=Tt>>>13,It=E[1]|0,nt=It&8191,bt=It>>>13,Ct=E[2]|0,Je=Ct&8191,gt=Ct>>>13,Pt=E[3]|0,st=Pt&8191,wt=Pt>>>13,Ut=E[4]|0,R=Ut&8191,S=Ut>>>13,M=E[5]|0,B=M&8191,K=M>>>13,Z=E[6]|0,te=Z&8191,$e=Z>>>13,et=E[7]|0,Re=et&8191,V=et>>>13,ae=E[8]|0,he=ae&8191,ke=ae>>>13,Ge=E[9]|0,je=Ge&8191,Ue=Ge>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(ie,it),v=Math.imul(ie,jt),v=v+Math.imul(fe,it)|0,j=Math.imul(fe,jt);var ot=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ot>>>26)|0,ot&=67108863,g=Math.imul(Se,it),v=Math.imul(Se,jt),v=v+Math.imul(xe,it)|0,j=Math.imul(xe,jt),g=g+Math.imul(ie,nt)|0,v=v+Math.imul(ie,bt)|0,v=v+Math.imul(fe,nt)|0,j=j+Math.imul(fe,bt)|0;var Gt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(Fe,it),v=Math.imul(Fe,jt),v=v+Math.imul(dt,it)|0,j=Math.imul(dt,jt),g=g+Math.imul(Se,nt)|0,v=v+Math.imul(Se,bt)|0,v=v+Math.imul(xe,nt)|0,j=j+Math.imul(xe,bt)|0,g=g+Math.imul(ie,Je)|0,v=v+Math.imul(ie,gt)|0,v=v+Math.imul(fe,Je)|0,j=j+Math.imul(fe,gt)|0;var Rt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(De,it),v=Math.imul(De,jt),v=v+Math.imul(mt,it)|0,j=Math.imul(mt,jt),g=g+Math.imul(Fe,nt)|0,v=v+Math.imul(Fe,bt)|0,v=v+Math.imul(dt,nt)|0,j=j+Math.imul(dt,bt)|0,g=g+Math.imul(Se,Je)|0,v=v+Math.imul(Se,gt)|0,v=v+Math.imul(xe,Je)|0,j=j+Math.imul(xe,gt)|0,g=g+Math.imul(ie,st)|0,v=v+Math.imul(ie,wt)|0,v=v+Math.imul(fe,st)|0,j=j+Math.imul(fe,wt)|0;var Dt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,g=Math.imul(me,it),v=Math.imul(me,jt),v=v+Math.imul(Me,it)|0,j=Math.imul(Me,jt),g=g+Math.imul(De,nt)|0,v=v+Math.imul(De,bt)|0,v=v+Math.imul(mt,nt)|0,j=j+Math.imul(mt,bt)|0,g=g+Math.imul(Fe,Je)|0,v=v+Math.imul(Fe,gt)|0,v=v+Math.imul(dt,Je)|0,j=j+Math.imul(dt,gt)|0,g=g+Math.imul(Se,st)|0,v=v+Math.imul(Se,wt)|0,v=v+Math.imul(xe,st)|0,j=j+Math.imul(xe,wt)|0,g=g+Math.imul(ie,R)|0,v=v+Math.imul(ie,S)|0,v=v+Math.imul(fe,R)|0,j=j+Math.imul(fe,S)|0;var Qt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(Ne,it),v=Math.imul(Ne,jt),v=v+Math.imul(Te,it)|0,j=Math.imul(Te,jt),g=g+Math.imul(me,nt)|0,v=v+Math.imul(me,bt)|0,v=v+Math.imul(Me,nt)|0,j=j+Math.imul(Me,bt)|0,g=g+Math.imul(De,Je)|0,v=v+Math.imul(De,gt)|0,v=v+Math.imul(mt,Je)|0,j=j+Math.imul(mt,gt)|0,g=g+Math.imul(Fe,st)|0,v=v+Math.imul(Fe,wt)|0,v=v+Math.imul(dt,st)|0,j=j+Math.imul(dt,wt)|0,g=g+Math.imul(Se,R)|0,v=v+Math.imul(Se,S)|0,v=v+Math.imul(xe,R)|0,j=j+Math.imul(xe,S)|0,g=g+Math.imul(ie,B)|0,v=v+Math.imul(ie,K)|0,v=v+Math.imul(fe,B)|0,j=j+Math.imul(fe,K)|0;var yr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(yr>>>26)|0,yr&=67108863,g=Math.imul(Le,it),v=Math.imul(Le,jt),v=v+Math.imul(ut,it)|0,j=Math.imul(ut,jt),g=g+Math.imul(Ne,nt)|0,v=v+Math.imul(Ne,bt)|0,v=v+Math.imul(Te,nt)|0,j=j+Math.imul(Te,bt)|0,g=g+Math.imul(me,Je)|0,v=v+Math.imul(me,gt)|0,v=v+Math.imul(Me,Je)|0,j=j+Math.imul(Me,gt)|0,g=g+Math.imul(De,st)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(mt,st)|0,j=j+Math.imul(mt,wt)|0,g=g+Math.imul(Fe,R)|0,v=v+Math.imul(Fe,S)|0,v=v+Math.imul(dt,R)|0,j=j+Math.imul(dt,S)|0,g=g+Math.imul(Se,B)|0,v=v+Math.imul(Se,K)|0,v=v+Math.imul(xe,B)|0,j=j+Math.imul(xe,K)|0,g=g+Math.imul(ie,te)|0,v=v+Math.imul(ie,$e)|0,v=v+Math.imul(fe,te)|0,j=j+Math.imul(fe,$e)|0;var nr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(We,it),v=Math.imul(We,jt),v=v+Math.imul(kt,it)|0,j=Math.imul(kt,jt),g=g+Math.imul(Le,nt)|0,v=v+Math.imul(Le,bt)|0,v=v+Math.imul(ut,nt)|0,j=j+Math.imul(ut,bt)|0,g=g+Math.imul(Ne,Je)|0,v=v+Math.imul(Ne,gt)|0,v=v+Math.imul(Te,Je)|0,j=j+Math.imul(Te,gt)|0,g=g+Math.imul(me,st)|0,v=v+Math.imul(me,wt)|0,v=v+Math.imul(Me,st)|0,j=j+Math.imul(Me,wt)|0,g=g+Math.imul(De,R)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(mt,R)|0,j=j+Math.imul(mt,S)|0,g=g+Math.imul(Fe,B)|0,v=v+Math.imul(Fe,K)|0,v=v+Math.imul(dt,B)|0,j=j+Math.imul(dt,K)|0,g=g+Math.imul(Se,te)|0,v=v+Math.imul(Se,$e)|0,v=v+Math.imul(xe,te)|0,j=j+Math.imul(xe,$e)|0,g=g+Math.imul(ie,Re)|0,v=v+Math.imul(ie,V)|0,v=v+Math.imul(fe,Re)|0,j=j+Math.imul(fe,V)|0;var Kt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(Ye,it),v=Math.imul(Ye,jt),v=v+Math.imul(Mt,it)|0,j=Math.imul(Mt,jt),g=g+Math.imul(We,nt)|0,v=v+Math.imul(We,bt)|0,v=v+Math.imul(kt,nt)|0,j=j+Math.imul(kt,bt)|0,g=g+Math.imul(Le,Je)|0,v=v+Math.imul(Le,gt)|0,v=v+Math.imul(ut,Je)|0,j=j+Math.imul(ut,gt)|0,g=g+Math.imul(Ne,st)|0,v=v+Math.imul(Ne,wt)|0,v=v+Math.imul(Te,st)|0,j=j+Math.imul(Te,wt)|0,g=g+Math.imul(me,R)|0,v=v+Math.imul(me,S)|0,v=v+Math.imul(Me,R)|0,j=j+Math.imul(Me,S)|0,g=g+Math.imul(De,B)|0,v=v+Math.imul(De,K)|0,v=v+Math.imul(mt,B)|0,j=j+Math.imul(mt,K)|0,g=g+Math.imul(Fe,te)|0,v=v+Math.imul(Fe,$e)|0,v=v+Math.imul(dt,te)|0,j=j+Math.imul(dt,$e)|0,g=g+Math.imul(Se,Re)|0,v=v+Math.imul(Se,V)|0,v=v+Math.imul(xe,Re)|0,j=j+Math.imul(xe,V)|0,g=g+Math.imul(ie,he)|0,v=v+Math.imul(ie,ke)|0,v=v+Math.imul(fe,he)|0,j=j+Math.imul(fe,ke)|0;var gr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(gr>>>26)|0,gr&=67108863,g=Math.imul(rt,it),v=Math.imul(rt,jt),v=v+Math.imul(Et,it)|0,j=Math.imul(Et,jt),g=g+Math.imul(Ye,nt)|0,v=v+Math.imul(Ye,bt)|0,v=v+Math.imul(Mt,nt)|0,j=j+Math.imul(Mt,bt)|0,g=g+Math.imul(We,Je)|0,v=v+Math.imul(We,gt)|0,v=v+Math.imul(kt,Je)|0,j=j+Math.imul(kt,gt)|0,g=g+Math.imul(Le,st)|0,v=v+Math.imul(Le,wt)|0,v=v+Math.imul(ut,st)|0,j=j+Math.imul(ut,wt)|0,g=g+Math.imul(Ne,R)|0,v=v+Math.imul(Ne,S)|0,v=v+Math.imul(Te,R)|0,j=j+Math.imul(Te,S)|0,g=g+Math.imul(me,B)|0,v=v+Math.imul(me,K)|0,v=v+Math.imul(Me,B)|0,j=j+Math.imul(Me,K)|0,g=g+Math.imul(De,te)|0,v=v+Math.imul(De,$e)|0,v=v+Math.imul(mt,te)|0,j=j+Math.imul(mt,$e)|0,g=g+Math.imul(Fe,Re)|0,v=v+Math.imul(Fe,V)|0,v=v+Math.imul(dt,Re)|0,j=j+Math.imul(dt,V)|0,g=g+Math.imul(Se,he)|0,v=v+Math.imul(Se,ke)|0,v=v+Math.imul(xe,he)|0,j=j+Math.imul(xe,ke)|0,g=g+Math.imul(ie,je)|0,v=v+Math.imul(ie,Ue)|0,v=v+Math.imul(fe,je)|0,j=j+Math.imul(fe,Ue)|0;var hn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(hn>>>26)|0,hn&=67108863,g=Math.imul(rt,nt),v=Math.imul(rt,bt),v=v+Math.imul(Et,nt)|0,j=Math.imul(Et,bt),g=g+Math.imul(Ye,Je)|0,v=v+Math.imul(Ye,gt)|0,v=v+Math.imul(Mt,Je)|0,j=j+Math.imul(Mt,gt)|0,g=g+Math.imul(We,st)|0,v=v+Math.imul(We,wt)|0,v=v+Math.imul(kt,st)|0,j=j+Math.imul(kt,wt)|0,g=g+Math.imul(Le,R)|0,v=v+Math.imul(Le,S)|0,v=v+Math.imul(ut,R)|0,j=j+Math.imul(ut,S)|0,g=g+Math.imul(Ne,B)|0,v=v+Math.imul(Ne,K)|0,v=v+Math.imul(Te,B)|0,j=j+Math.imul(Te,K)|0,g=g+Math.imul(me,te)|0,v=v+Math.imul(me,$e)|0,v=v+Math.imul(Me,te)|0,j=j+Math.imul(Me,$e)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,V)|0,v=v+Math.imul(mt,Re)|0,j=j+Math.imul(mt,V)|0,g=g+Math.imul(Fe,he)|0,v=v+Math.imul(Fe,ke)|0,v=v+Math.imul(dt,he)|0,j=j+Math.imul(dt,ke)|0,g=g+Math.imul(Se,je)|0,v=v+Math.imul(Se,Ue)|0,v=v+Math.imul(xe,je)|0,j=j+Math.imul(xe,Ue)|0;var Fr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,g=Math.imul(rt,Je),v=Math.imul(rt,gt),v=v+Math.imul(Et,Je)|0,j=Math.imul(Et,gt),g=g+Math.imul(Ye,st)|0,v=v+Math.imul(Ye,wt)|0,v=v+Math.imul(Mt,st)|0,j=j+Math.imul(Mt,wt)|0,g=g+Math.imul(We,R)|0,v=v+Math.imul(We,S)|0,v=v+Math.imul(kt,R)|0,j=j+Math.imul(kt,S)|0,g=g+Math.imul(Le,B)|0,v=v+Math.imul(Le,K)|0,v=v+Math.imul(ut,B)|0,j=j+Math.imul(ut,K)|0,g=g+Math.imul(Ne,te)|0,v=v+Math.imul(Ne,$e)|0,v=v+Math.imul(Te,te)|0,j=j+Math.imul(Te,$e)|0,g=g+Math.imul(me,Re)|0,v=v+Math.imul(me,V)|0,v=v+Math.imul(Me,Re)|0,j=j+Math.imul(Me,V)|0,g=g+Math.imul(De,he)|0,v=v+Math.imul(De,ke)|0,v=v+Math.imul(mt,he)|0,j=j+Math.imul(mt,ke)|0,g=g+Math.imul(Fe,je)|0,v=v+Math.imul(Fe,Ue)|0,v=v+Math.imul(dt,je)|0,j=j+Math.imul(dt,Ue)|0;var pn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(pn>>>26)|0,pn&=67108863,g=Math.imul(rt,st),v=Math.imul(rt,wt),v=v+Math.imul(Et,st)|0,j=Math.imul(Et,wt),g=g+Math.imul(Ye,R)|0,v=v+Math.imul(Ye,S)|0,v=v+Math.imul(Mt,R)|0,j=j+Math.imul(Mt,S)|0,g=g+Math.imul(We,B)|0,v=v+Math.imul(We,K)|0,v=v+Math.imul(kt,B)|0,j=j+Math.imul(kt,K)|0,g=g+Math.imul(Le,te)|0,v=v+Math.imul(Le,$e)|0,v=v+Math.imul(ut,te)|0,j=j+Math.imul(ut,$e)|0,g=g+Math.imul(Ne,Re)|0,v=v+Math.imul(Ne,V)|0,v=v+Math.imul(Te,Re)|0,j=j+Math.imul(Te,V)|0,g=g+Math.imul(me,he)|0,v=v+Math.imul(me,ke)|0,v=v+Math.imul(Me,he)|0,j=j+Math.imul(Me,ke)|0,g=g+Math.imul(De,je)|0,v=v+Math.imul(De,Ue)|0,v=v+Math.imul(mt,je)|0,j=j+Math.imul(mt,Ue)|0;var ci=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ci>>>26)|0,ci&=67108863,g=Math.imul(rt,R),v=Math.imul(rt,S),v=v+Math.imul(Et,R)|0,j=Math.imul(Et,S),g=g+Math.imul(Ye,B)|0,v=v+Math.imul(Ye,K)|0,v=v+Math.imul(Mt,B)|0,j=j+Math.imul(Mt,K)|0,g=g+Math.imul(We,te)|0,v=v+Math.imul(We,$e)|0,v=v+Math.imul(kt,te)|0,j=j+Math.imul(kt,$e)|0,g=g+Math.imul(Le,Re)|0,v=v+Math.imul(Le,V)|0,v=v+Math.imul(ut,Re)|0,j=j+Math.imul(ut,V)|0,g=g+Math.imul(Ne,he)|0,v=v+Math.imul(Ne,ke)|0,v=v+Math.imul(Te,he)|0,j=j+Math.imul(Te,ke)|0,g=g+Math.imul(me,je)|0,v=v+Math.imul(me,Ue)|0,v=v+Math.imul(Me,je)|0,j=j+Math.imul(Me,Ue)|0;var ui=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ui>>>26)|0,ui&=67108863,g=Math.imul(rt,B),v=Math.imul(rt,K),v=v+Math.imul(Et,B)|0,j=Math.imul(Et,K),g=g+Math.imul(Ye,te)|0,v=v+Math.imul(Ye,$e)|0,v=v+Math.imul(Mt,te)|0,j=j+Math.imul(Mt,$e)|0,g=g+Math.imul(We,Re)|0,v=v+Math.imul(We,V)|0,v=v+Math.imul(kt,Re)|0,j=j+Math.imul(kt,V)|0,g=g+Math.imul(Le,he)|0,v=v+Math.imul(Le,ke)|0,v=v+Math.imul(ut,he)|0,j=j+Math.imul(ut,ke)|0,g=g+Math.imul(Ne,je)|0,v=v+Math.imul(Ne,Ue)|0,v=v+Math.imul(Te,je)|0,j=j+Math.imul(Te,Ue)|0;var mn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(mn>>>26)|0,mn&=67108863,g=Math.imul(rt,te),v=Math.imul(rt,$e),v=v+Math.imul(Et,te)|0,j=Math.imul(Et,$e),g=g+Math.imul(Ye,Re)|0,v=v+Math.imul(Ye,V)|0,v=v+Math.imul(Mt,Re)|0,j=j+Math.imul(Mt,V)|0,g=g+Math.imul(We,he)|0,v=v+Math.imul(We,ke)|0,v=v+Math.imul(kt,he)|0,j=j+Math.imul(kt,ke)|0,g=g+Math.imul(Le,je)|0,v=v+Math.imul(Le,Ue)|0,v=v+Math.imul(ut,je)|0,j=j+Math.imul(ut,Ue)|0;var li=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(li>>>26)|0,li&=67108863,g=Math.imul(rt,Re),v=Math.imul(rt,V),v=v+Math.imul(Et,Re)|0,j=Math.imul(Et,V),g=g+Math.imul(Ye,he)|0,v=v+Math.imul(Ye,ke)|0,v=v+Math.imul(Mt,he)|0,j=j+Math.imul(Mt,ke)|0,g=g+Math.imul(We,je)|0,v=v+Math.imul(We,Ue)|0,v=v+Math.imul(kt,je)|0,j=j+Math.imul(kt,Ue)|0;var fi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(fi>>>26)|0,fi&=67108863,g=Math.imul(rt,he),v=Math.imul(rt,ke),v=v+Math.imul(Et,he)|0,j=Math.imul(Et,ke),g=g+Math.imul(Ye,je)|0,v=v+Math.imul(Ye,Ue)|0,v=v+Math.imul(Mt,je)|0,j=j+Math.imul(Mt,Ue)|0;var $=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+($>>>26)|0,$&=67108863,g=Math.imul(rt,je),v=Math.imul(rt,Ue),v=v+Math.imul(Et,je)|0,j=Math.imul(Et,Ue);var G=(C+g|0)+((v&8191)<<13)|0;return C=(j+(v>>>13)|0)+(G>>>26)|0,G&=67108863,O[0]=ot,O[1]=Gt,O[2]=Rt,O[3]=Dt,O[4]=Qt,O[5]=yr,O[6]=nr,O[7]=Kt,O[8]=gr,O[9]=hn,O[10]=Fr,O[11]=pn,O[12]=ci,O[13]=ui,O[14]=mn,O[15]=li,O[16]=fi,O[17]=$,O[18]=G,C!==0&&(O[19]=C,x.length++),x};Math.imul||(N=k);function U(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,A=0,E=0;E<m.length-1;E++){var O=A;A=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,ie=d.words[v]|0,fe=ee*ie,ve=fe&67108863;O=O+(fe/67108864|0)|0,ve=ve+C|0,C=ve&67108863,O=O+(ve>>>26)|0,A+=O>>>26,O&=67108863}m.words[E]=C,x=O,O=A}return x!==0?m.words[E]=x:m.length--,m._strip()}function L(p,d,m){return U(p,d,m)}o.prototype.mulTo=function(d,m){var x,A=this.length+d.length;return this.length===10&&d.length===10?x=N(this,d,m):A<63?x=k(this,d,m):A<1024?x=U(this,d,m):x=L(this,d,m),x},o.prototype.mul=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),this.mulTo(d,m)},o.prototype.mulf=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),L(this,d,m)},o.prototype.imul=function(d){return this.clone().mulTo(d,this)},o.prototype.imuln=function(d){var m=d<0;m&&(d=-d),i(typeof d=="number"),i(d<67108864);for(var x=0,A=0;A<this.length;A++){var E=(this.words[A]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[A]=O&67108863}return x!==0&&(this.words[A]=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,A=0;A<m.length&&m[A]===0;A++,x=x.sqr());if(++A<m.length)for(var E=x.sqr();A<m.length;A++,E=E.sqr())m[A]!==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,A=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var C=this.words[E]&A,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 A;m?A=(m-m%26)/26:A=0;var E=d%26,O=Math.min((d-E)/26,this.length),C=67108863^67108863>>>E<<E,g=x;if(A-=O,A=Math.max(0,A),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>=A);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,A=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&A)},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 A=67108863^67108863>>>m<<m;this.words[this.length-1]&=A}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 A=d.length+x,E;this._expand(A);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,A=this.clone(),E=d,O=E.words[E.length-1]|0,C=this._countBits(O);x=26-C,x!==0&&(E=E.ushln(x),A.iushln(x),O=E.words[E.length-1]|0);var g=A.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=A.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(A=ee,v&&(v.words[g]=1));for(var ie=g-1;ie>=0;ie--){var fe=(A.words[E.length+ie]|0)*67108864+(A.words[E.length+ie-1]|0);for(fe=Math.min(fe/O|0,67108863),A._ishlnsubmul(E,fe,ie);A.negative!==0;)fe--,A.negative=0,A._ishlnsubmul(E,1,ie),A.isZero()||(A.negative^=1);v&&(v.words[ie]=fe)}return v&&v._strip(),A._strip(),m!=="div"&&x!==0&&A.iushrn(x),{div:v||null,mod:A}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var A,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(A=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:A,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(A=O.div.neg()),{div:A,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,A=d.ushrn(1),E=d.andln(1),O=x.cmp(A);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,A=0,E=this.length-1;E>=0;E--)A=(x*A+(this.words[E]|0))%d;return m?-A:A},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,A=this.length-1;A>=0;A--){var E=(this.words[A]|0)+x*67108864;this.words[A]=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 A=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,ie=1;!(m.words[0]&ie)&&ee<26;++ee,ie<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(A.isOdd()||E.isOdd())&&(A.iadd(v),E.isub(j)),A.iushrn(1),E.iushrn(1);for(var fe=0,ve=1;!(x.words[0]&ve)&&fe<26;++fe,ve<<=1);if(fe>0)for(x.iushrn(fe);fe-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(v),C.isub(j)),O.iushrn(1),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),A.isub(O),E.isub(C)):(x.isub(m),O.isub(A),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 A=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;)A.isOdd()&&A.iadd(O),A.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),A.isub(E)):(x.isub(m),E.isub(A))}var ee;return m.cmpn(1)===0?ee=A: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 A=0;m.isEven()&&x.isEven();A++)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(A)},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,A=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=A,this;for(var E=A,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 A=this.words[0]|0;x=A===d?0:A<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 A=this.words[x]|0,E=d.words[x]|0;if(A!==E){A<E?m=-1:A>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 F(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 A=x<this.n?-1:m.ucmp(this.p);return A===0?(m.words[0]=0,m.length=1):A>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,A=Math.min(d.length,9),E=0;E<A;E++)m.words[E]=d.words[E];if(m.length=A,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 A=d.words[x]|0;m+=A*977,d.words[x]=m&67108863,m=A*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function re(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(re,q);function oe(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(oe,q);function H(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(H,q),H.prototype.imulK=function(d){for(var m=0,x=0;x<d.length;x++){var A=(d.words[x]|0)*19+m,E=A&67108863;A>>>=26,d.words[x]=E,m=A}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 re;else if(d==="p192")m=new oe;else if(d==="p25519")m=new H;else throw new Error("Unknown prime "+d);return W[d]=m,m};function F(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}F.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},F.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")},F.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},F.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},F.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)},F.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},F.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)},F.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},F.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},F.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},F.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},F.prototype.isqr=function(d){return this.imul(d,d.clone())},F.prototype.sqr=function(d){return this.mul(d,d)},F.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 A=this.m.subn(1),E=0;!A.isZero()&&A.andln(1)===0;)E++,A.iushrn(1);i(!A.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,A),ee=this.pow(d,A.addn(1).iushrn(1)),ie=this.pow(d,A),fe=E;ie.cmp(O)!==0;){for(var ve=ie,Se=0;ve.cmp(O)!==0;Se++)ve=ve.redSqr();i(Se<fe);var xe=this.pow(j,new o(1).iushln(fe-Se-1));ee=ee.redMul(xe),j=xe.redSqr(),ie=ie.redMul(j),fe=Se}return ee},F.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},F.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,A=new Array(1<<x);A[0]=new o(1).toRed(this),A[1]=d;for(var E=2;E<A.length;E++)A[E]=this.mul(A[E-1],d);var O=A[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 ie=j>>ee&1;if(O!==A[0]&&(O=this.sqr(O)),ie===0&&C===0){g=0;continue}C<<=1,C|=ie,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,A[C]),g=0,C=0)}v=26}return O},F.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},F.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new D(d)};function D(p){F.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(D,F),D.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},D.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},D.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var x=d.imul(m),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(A).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(A).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),wo=9e15,fs=1e9,Gd="0123456789abcdef",Ru="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Nu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Kd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-wo,maxE:wo,crypto:!1},q4,xi,at=!0,Cl="[DecimalError] ",rs=Cl+"Invalid argument: ",H4=Cl+"Precision limit exceeded",W4=Cl+"crypto unavailable",G4="[object Decimal]",Or=Math.floor,hr=Math.pow,G9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,K9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,X9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,K4=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Mn=1e7,Ze=7,J9=9007199254740991,Y9=Ru.length-1,Xd=Nu.length-1,ye={toStringTag:G4};ye.absoluteValue=ye.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ke(e)};ye.ceil=function(){return Ke(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(rs+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};ye.comparedTo=ye.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1};ye.cosine=ye.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ze,n.rounding=1,r=Z9(n,Q4(n,r)),n.precision=e,n.rounding=t,Ke(xi==2||xi==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(at=!1,s=l.s*hr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=xr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=hr(r,1/3),e=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=Vt(u.plus(l).times(a),u.plus(c),o+2,1),xr(a.d).slice(0,o)===(r=xr(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ke(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Ke(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return at=!0,Ke(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-Or(this.e/Ze))*Ze,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};ye.dividedBy=ye.div=function(e){return Vt(this,new this.constructor(e))};ye.dividedToIntegerBy=ye.divToInt=function(e){var t=this,r=t.constructor;return Ke(Vt(t,new r(e),0,1,1),r.precision,r.rounding)};ye.equals=ye.eq=function(e){return this.cmp(e)===0};ye.floor=function(){return Ke(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/Ml(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=jo(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)};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=jo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Ml(5,e)),i=jo(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)};ye.hyperbolicTangent=ye.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Vt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};ye.inverseCosine=ye.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?Sn(r,i,s):new r(0):new r(NaN):t.isZero()?Sn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Sn(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,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!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,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!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?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)};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=Sn(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<=Xd)return o=Sn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=Xd)return o=Sn(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)};ye.isFinite=function(){return!!this.d};ye.isInteger=ye.isInt=function(){return!!this.d&&Or(this.e/Ze)>this.d.length-2};ye.isNaN=function(){return!this.s};ye.isNegative=ye.isNeg=function(){return this.s<0};ye.isPositive=ye.isPos=function(){return this.s>0};ye.isZero=function(){return!!this.d&&this.d[0]===0};ye.lessThan=ye.lt=function(e){return this.cmp(e)<0};ye.lessThanOrEqualTo=ye.lte=function(e){return this.cmp(e)<1};ye.logarithm=ye.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(at=!1,a=f+y,o=Ki(u,a),n=t?Du(l,a+10):Ki(e,a),c=Vt(o,n,a,1),Xa(c.d,i=f,h))do if(a+=10,o=Ki(u,a),n=t?Du(l,a+10):Ki(e,a),c=Vt(o,n,a,1),!s){+xr(c.d).slice(i+1,i+15)+1==1e14&&(c=Ke(c,f+1,0));break}while(Xa(c.d,i+=10,h));return at=!0,Ke(c,f,h)};ye.minus=ye.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return at?Ke(e,a,c):e}if(r=Or(e.e/Ze),l=Or(y.e/Ze),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Ze),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=Mn-1;--u[i],u[n]+=Mn}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Al(u,r),at?Ke(e,a,c):e):new b(c===3?-0:0)};ye.modulo=ye.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?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))};ye.naturalExponential=ye.exp=function(){return Jd(this)};ye.naturalLogarithm=ye.ln=function(){return Ki(this)};ye.negated=ye.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Ke(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)),at?Ke(e,a,c):e;if(s=Or(f.e/Ze),n=Or(e.e/Ze),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Ze),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/Mn|0,u[i]%=Mn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Al(u,n),at?Ke(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(rs+e);return r.d?(t=X4(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};ye.round=function(){var e=this,t=e.constructor;return Ke(new t(e),e.e+1,t.rounding)};ye.sine=ye.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ze,n.rounding=1,r=ek(n,Q4(n,r)),n.precision=e,n.rounding=t,Ke(xi>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(at=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=xr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=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(Vt(o,s,r+2,1)).times(.5),xr(s.d).slice(0,r)===(t=xr(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Ke(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Ke(n,c+1,1),e=!n.times(n).eq(o));break}return at=!0,Ke(n,c,l.rounding,e)};ye.tangent=ye.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Vt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Ke(xi==2||xi==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=Or(l.e/Ze)+Or(e.e/Ze),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%Mn|0,t=a/Mn|0;s[i]=(s[i]+t)%Mn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Al(s,r),at?Ke(e,f.precision,f.rounding):e};ye.toBinary=function(e,t){return Xp(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:(qr(e,0,fs),t===void 0?t=n.rounding:qr(t,0,8),Ke(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):(qr(e,0,fs),t===void 0?t=i.rounding:qr(t,0,8),n=Ke(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):(qr(e,0,fs),t===void 0?t=s.rounding:qr(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};ye.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=X4(b)-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(rs+a);e=a.gt(t)?s>0?t:u:a}for(at=!1,a=new w(xr(b)),l=w.precision,w.precision=s=b.length*Ze*2;f=Vt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=Vt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=Vt(u,n,s,1).minus(y).abs().cmp(Vt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,at=!0,h};ye.toHexadecimal=ye.toHex=function(e,t){return Xp(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:qr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(at=!1,r=Vt(r,e,0,t,1).times(e),at=!0,Ke(r)):(e.s=r.s,r=e),r};ye.toNumber=function(){return+this};ye.toOctal=function(e,t){return Xp(this,8,e,t)};ye.toPower=ye.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(hr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Ke(a,n,s);if(t=Or(e.e/Ze),t>=e.d.length-1&&(r=u<0?-u:u)<=J9)return i=J4(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)?Or(u*(Math.log("0."+xr(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(at=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=Jd(e.times(Ki(a,n+r)),n),i.d&&(i=Ke(i,n+5,1),Xa(i.d,n,s)&&(t=n+10,i=Ke(Jd(e.times(Ki(a,t+r)),t),t+5,1),+xr(i.d).slice(n+1,n+15)+1==1e14&&(i=Ke(i,n+1,0)))),i.s=o,at=!0,c.rounding=s,Ke(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):(qr(e,1,fs),t===void 0?t=i.rounding:qr(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};ye.toSignificantDigits=ye.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(qr(e,1,fs),t===void 0?t=n.rounding:qr(t,0,8)),Ke(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 Ke(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 xr(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Ze-n.length,r&&(s+=qi(r)),s+=n;o=e[t],n=o+"",r=Ze-n.length,r&&(s+=qi(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function qr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(rs+e)}function Xa(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 au(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]+=Gd.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 Z9(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Ml(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=jo(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var Vt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,T,I,k,N,U,L,W,q,X,re,oe,H,F,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=Mn,y=Ze,l=Or(n.e/y)-Or(i.e/y)),H=m.length,re=d.length,I=new D(p),k=I.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(W=s=D.precision,o=D.rounding):a?W=s+(n.e-i.e)+1:W=s,W<0)k.push(1),b=!0;else{if(W=W/y+2|0,f=0,H==1){for(h=0,m=m[0],W++;(f<re||h)&&W--;f++)q=h*c+(d[f]||0),k[f]=q/m|0,h=q%m|0;b=h||f<re}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),H=m.length,re=d.length),X=H,N=d.slice(0,H),U=N.length;U<H;)N[U++]=0;F=m.slice(),F.unshift(0),oe=m[0],m[1]>=c/2&&++oe;do h=0,u=t(m,N,H,U),u<0?(L=N[0],H!=U&&(L=L*c+(N[1]||0)),h=L/oe|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),T=w.length,U=N.length,u=t(w,N,T,U),u==1&&(h--,r(w,H<T?F:m,T,c))):(h==0&&(u=h=1),w=m.slice()),T=w.length,T<U&&w.unshift(0),r(N,w,U,c),u==-1&&(U=N.length,u=t(m,N,H,U),u<1&&(h++,r(N,H<U?F:m,U,c))),U=N.length):u===0&&(h++,N=[0]),k[f++]=h,u&&N[0]?N[U++]=d[X]||0:(N=[d[X]],U=1);while((X++<re||N[0]!==void 0)&&W--);b=N[0]!==void 0}k[0]||k.shift()}if(y==1)I.e=l,q4=b;else{for(f=1,h=k[0];h>=10;h/=10)f++;I.e=f+l*y-1,Ke(I,a?s+I.e+1:s,o,b)}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]==Mn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=Mn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return at&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function Qn(e,t,r){if(!e.isFinite())return Z4(e);var n,i=e.e,s=xr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+qi(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+qi(-i-1)+s,r&&(n=r-o)>0&&(s+=qi(n))):i>=o?(s+=qi(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+qi(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=qi(n))),s}function Al(e,t){var r=e[0];for(t*=Ze;r>=10;r/=10)t++;return t}function Du(e,t,r){if(t>Y9)throw at=!0,r&&(e.precision=r),Error(H4);return Ke(new e(Ru),t,1,!0)}function Sn(e,t,r){if(t>Xd)throw Error(H4);return Ke(new e(Nu),t,r,!0)}function X4(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 qi(e){for(var t="";e--;)t+="0";return t}function J4(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),ig(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),ig(t.d,o)}return at=!0,s}function ng(e){return e.d[e.d.length-1]&1}function Y4(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 Jd(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(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)),xr(a.d).slice(0,c)===xr(o.d).slice(0,c)){for(i=f;i--;)o=Ke(o.times(o),c,1);if(t==null)if(u<3&&Xa(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 Ki(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,T=w.d,I=w.constructor,k=I.rounding,N=I.precision;if(w.s<0||!T||!T[0]||!w.e&&T[0]==1&&T.length==1)return new I(T&&!T[0]?-1/0:w.s!=1?NaN:T?0:w);if(t==null?(at=!1,l=N):l=t,I.precision=l+=b,r=xr(T),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=xr(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new I("0."+r),s++):w=new I(n+"."+r.slice(1))}else return u=Du(I,l+2,N).times(s+""),w=Ki(new I(n+"."+r.slice(1)),l-b).plus(u),I.precision=N,t==null?Ke(w,N,k,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)),xr(u.d).slice(0,l)===xr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Du(I,l+2,N).times(s+""))),c=Vt(c,new I(y),l,1),t==null)if(Xa(c.d,l-b,k,a))I.precision=l+=b,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=N,k,at=!0);else return I.precision=N,c;c=u,i+=2}}function Z4(e){return String(e.s*e.s/0)}function Yd(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 Q9(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),K4.test(t))return Yd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(K9.test(t))r=16,t=t.toLowerCase();else if(G9.test(t))r=2;else if(X9.test(t))r=8;else throw Error(rs+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=J4(n,new n(r),s,s*2)),u=au(t,r,Mn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Al(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):vc.pow(2,c))),at=!0,e)}function ek(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:jo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Ml(5,r)),t=jo(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 jo(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 Ml(e,t){for(var r=e;--t;)r*=e;return r}function Q4(e,t){var r,n=t.s<0,i=Sn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return xi=n?4:1,t;if(r=t.divToInt(i),r.isZero())xi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return xi=ng(r)?n?2:3:n?4:1,t;xi=ng(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Xp(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(qr(r,1,fs),n===void 0?n=y.rounding:qr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=Z4(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=au(Qn(h),10,i),h.e=h.d.length),f=au(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=Vt(e,h,r,n,0,i),f=e.d,s=e.e,u=q4),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+=Gd.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=au(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Gd.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 ig(e,t){if(e.length>t)return e.length=t,!0}function tk(e){return new this(e).abs()}function rk(e){return new this(e).acos()}function nk(e){return new this(e).acosh()}function ik(e,t){return new this(e).plus(t)}function sk(e){return new this(e).asin()}function ok(e){return new this(e).asinh()}function ak(e){return new this(e).atan()}function ck(e){return new this(e).atanh()}function uk(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=Sn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?Sn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=Sn(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=Sn(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 lk(e){return new this(e).cbrt()}function fk(e){return Ke(e=new this(e),e.e+1,2)}function dk(e,t,r){return new this(e).clamp(t,r)}function hk(e){if(!e||typeof e!="object")throw Error(Cl+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,fs,"rounding",0,8,"toExpNeg",-wo,0,"toExpPos",0,wo,"maxE",0,wo,"minE",-wo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Kd[r]),(n=e[r])!==void 0)if(Or(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(rs+r+": "+n);if(r="crypto",i&&(this[r]=Kd[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(W4);else this[r]=!1;else throw Error(rs+r+": "+n);return this}function pk(e){return new this(e).cos()}function mk(e){return new this(e).cosh()}function ex(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,sg(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 Yd(u,s.toString())}else if(c!=="string")throw Error(rs+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),K4.test(s)?Yd(u,s):Q9(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=hk,i.clone=ex,i.isDecimal=sg,i.abs=tk,i.acos=rk,i.acosh=nk,i.add=ik,i.asin=sk,i.asinh=ok,i.atan=ak,i.atanh=ck,i.atan2=uk,i.cbrt=lk,i.ceil=fk,i.clamp=dk,i.cos=pk,i.cosh=mk,i.div=gk,i.exp=vk,i.floor=yk,i.hypot=bk,i.ln=wk,i.log=_k,i.log10=Sk,i.log2=xk,i.max=Ek,i.min=Ck,i.mod=Ak,i.mul=Mk,i.pow=Tk,i.random=Ok,i.round=Ik,i.sign=Pk,i.sin=kk,i.sinh=jk,i.sqrt=Rk,i.sub=Nk,i.sum=Dk,i.tan=$k,i.tanh=Bk,i.trunc=Lk,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 gk(e,t){return new this(e).div(t)}function vk(e){return new this(e).exp()}function yk(e){return Ke(e=new this(e),e.e+1,3)}function bk(){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 sg(e){return e instanceof vc||e&&e.toStringTag===G4||!1}function wk(e){return new this(e).ln()}function _k(e,t){return new this(e).log(t)}function xk(e){return new this(e).log(2)}function Sk(e){return new this(e).log(10)}function Ek(){return Y4(this,arguments,"lt")}function Ck(){return Y4(this,arguments,"gt")}function Ak(e,t){return new this(e).mod(t)}function Mk(e,t){return new this(e).mul(t)}function Tk(e,t){return new this(e).pow(t)}function Ok(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:qr(e,1,fs),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(W4);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 Ik(e){return Ke(e=new this(e),e.e+1,this.rounding)}function Pk(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function kk(e){return new this(e).sin()}function jk(e){return new this(e).sinh()}function Rk(e){return new this(e).sqrt()}function Nk(e,t){return new this(e).sub(t)}function Dk(){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 $k(e){return new this(e).tan()}function Bk(e){return new this(e).tanh()}function Lk(e){return Ke(e=new this(e),e.e+1,1)}ye[Symbol.for("nodejs.util.inspect.custom")]=ye.toString;ye[Symbol.toStringTag]="Decimal";var vc=ye.constructor=ex(Kd);Ru=new vc(Ru);Nu=new vc(Nu);var cu=vc,Xi=Wo(Go()),qf=Wo(Go()),Fk=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 qf.default(e).mul(new qf.default(this.slippage)).div(new qf.default("1000000000000000000")).toString()}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];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 f=[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],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::aftermath::${c}`,typeArguments:[u,l,r.extendedDetails.aftermathLpSupplyType],arguments:f})})}},og="0x000000000000000000000000000000000000000000000000000000000000dee9",Uk=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return _t(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:og,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 _t(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${og}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=yield this.getOrCreateAccountCap(t,e.client,e.signer),h=[t.object(r.id),n,f.accountCap,t.object(ei)],y=vr(e.publishedAtV2(),i),b=t.moveCall({target:`${y}::deepbook::${c}`,typeArguments:[u,l],arguments:h});return f.isCreate&&t.transferObjects([f.accountCap],e.signer),b})}},zk=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(r.id),n],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::kriya_amm::${c}`,typeArguments:[u,l],arguments:f})})}},Vk=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(r.id),n,t.object(this.version),t.object(ei)],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::kriya_clmm::${c}`,typeArguments:[u,l],arguments:f})})}},qk=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.container),n],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::flowx_amm::${c}`,typeArguments:[u,l],arguments:f})})}},Hk=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,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(ei)],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::flowx_clmm::${c}`,typeArguments:[u,l],arguments:f})})}},Wk=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];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 f=[t.object(r.id),n,t.object(ei),t.object(this.versioned)],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::turbos::${c}`,typeArguments:[u,l,r.extendedDetails.turbosFeeType],arguments:f})})}},ag=class{constructor(e,t){this.globalConfig=e===0?"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f":"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",this.partner=t??(e===0?"0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b":"0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")}flash_swap(e,t,r,n,i){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["flash_swap_a2b",o,a]:["flash_swap_b2a",a,o];let f=n?r.amountIn:r.amountOut;const h=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(f),t.pure.bool(n),t.object(ei)],y=vr(e.publishedAtV2(),i),b=t.moveCall({target:`${y}::cetus::${c}`,typeArguments:[u,l],arguments:h});return{targetCoin:b[0],flashReceipt:b[1],payAmount:b[2]}}repay_flash_swap(e,t,r,n,i,s){const{direction:o,from:a,target:c}=r,[u,l,f]=o?["repay_flash_swap_a2b",a,c]:["repay_flash_swap_b2a",c,a],h=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i],y=vr(e.publishedAtV2(),s);return t.moveCall({target:`${y}::cetus::${u}`,typeArguments:[l,f],arguments:h})[0]}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(ei)],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::cetus::${c}`,typeArguments:[u,l],arguments:f})})}};function cg(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 Gk(e){return e.split("::")[0]}function Fs(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=Fs(r),u=V9(z9({},c),{type_arguments:i.map(l=>Fs(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>zn.isSuiCoin(l)?l:Fs(l).source_address),u.source_address=cg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===tx||r===Jk?"0x2":Wd.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=cg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function ug(e){return Fs(e).source_address}var Kk="0x2::coin::Coin",Xk=/^0x2::coin::Coin<(.+)>$/,tx="0x2::sui::SUI",Jk="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",zn=class Ui{static getCoinTypeArg(t){const r=t.type.match(Xk);return r?r[1]:null}static isSUI(t){const r=Ui.getCoinTypeArg(t);return r?Ui.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`${Kk}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{ug(i.coinAddress)===ug(t)&&n.push(i)}),n}static isSuiCoin(t){return Fs(t).full_address===tx}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=Ui.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=Ui.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=Ui.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:Ui.sortByBalance(a),remainingCoins:Ui.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 Hf(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 ns(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 Yk(e,t){e=ns(e),t=ns(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 rx(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function Wf(e,t,r,n){const i=zn.getCoinAssets(n,t);if(r===BigInt(0))return zn.isSuiCoin(n)||i.length===0&&!zn.isSuiCoin(n)?{targetCoin:rx(e,n),isMintZeroCoin:!0,targetCoinAmount:0}:{targetCoin:e.object(i[0].coinObjectId),isMintZeroCoin:!1,targetCoinAmount:Number(i[0].balance.toString())};if(zn.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(zn.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=zn.sortByBalance(i);o.slice(0,3).reduce((h,y)=>h+y.balance,BigInt(0))<BigInt(r)&&(o=zn.sortByBalanceDes(i));let c=zn.selectCoinObjectIdGreaterThanOrEqual(o,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(h=>e.object(h))),{targetCoin:e.splitCoins(e.object(u),[e.pure.u64(r.toString())]),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function Zk(e,t=!0){return _t(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 Qk(e){return!(!e.startsWith("0x")||e.length!==66)}var ro=Wo(Go()),Ji=Wo(Go()),yc=Wo(Go()),wi=new yc.default(0);new yc.default(1);var ej=new yc.default(2);ej.pow(new yc.default(128));var tj=new yc.default("18446744073709551615"),sn=1e9;function rj(e,t,r){let n=wi;return t?n=e.mul(new Ji.default(sn-r*sn)).div(new Ji.default(sn)):n=e.mul(new Ji.default(sn+r*sn)).div(new Ji.default(sn)),Number(n.toString())}function nj(e,t,r){let n=wi;return t?n=e.mul(new Ji.default(sn-r*sn)).div(new Ji.default(sn)):n=e.mul(new Ji.default(sn+r*sn)).div(new Ji.default(sn)),n}function ij(e,t,r){return new cu(e).mul(cu.pow(2,-64)).pow(2).mul(cu.pow(10,t-r))}function sj(e,t,r,n){return _t(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,b=ns(u),w=ns(l),T=new N9.Transaction,I=Yk(b,w),k=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",N=I?b:w,U=I?w:b,L=[N,U];console.log("typeArguments",L,k);for(let C=0;C<y.length;C++){const g=[T.object(y[C]),T.pure.bool(I),T.pure.bool(h),T.pure.u64(f.toString())];T.moveCall({target:`${k}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!Qk(r))throw new AggregateError("Aggregator package not set","InvalidWallet");Zk(T);const W=yield e.devInspectTransactionBlock({transactionBlock:T,sender:r});if(W.error!=null)throw console.log("simulateRes.error",W.error),new AggregateError("Aggregator package not set","SimulateError");const q=(i=W.events)==null?void 0:i.filter(C=>C.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==y.length)throw new AggregateError("Simulate event result error","simulateEventError");let X=h?wi:tj,re=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)&&(re=C,X=g)}else{const g=new ro.BN(q[C].parsedJson.data.amount_out);g.lt(X)&&(re=C,X=g)}const oe=q[re].parsedJson.data;console.log("event",JSON.stringify(oe,null,2));const H=oe.step_results[0].current_sqrt_price,[F,D]=yield Promise.all([e.getCoinMetadata({coinType:N}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:U}).then(C=>C==null?void 0:C.decimals)]);if(F==null||D==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=ij(H,F,D),d=Number(oe.fee_rate)/1e6,m=new ro.BN((s=oe.amount_in)!=null?s:0),x=new ro.BN((o=oe.fee_amount)!=null?o:0),A=m.add(x),E={amountIn:A,amountOut:new ro.BN((a=oe.amount_out)!=null?a:0),routes:[{path:[{id:y[re],direction:I,provider:"CETUS",from:b,target:w,feeRate:d,amountIn:oe.amount_in,amountOut:oe.amount_out,extendedDetails:{afterSqrtPrice:oe.after_sqrt_price}}],amountIn:A,amountOut:new ro.BN((c=oe.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1,byAmountIn:t.byAmountIn};return{isExceed:oe.is_exceed,routeData:E}})}var oj=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s}=r;if(!s)throw new Error("Haedal not support b2a swap");const o="swap_a2b",a=[t.object(r.id),t.object("0x5"),n],c=vr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::haedal::${o}`,typeArguments:[],arguments:a})})}},aj=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,i){return _t(this,null,function*(){const{direction:s}=r;if(!s)throw new Error("Afsui not support b2a swap");const o="swap_a2b",a=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n],c=vr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::afsui::${o}`,typeArguments:[],arguments:a})})}},cj=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,i){return _t(this,null,function*(){const{direction:s}=r;if(!s)throw new Error("Volo not support b2a swap");const o="swap_a2b",a=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n],c=vr(e.publishedAtV2(),i);return t.moveCall({target:`${c}::volo::${o}`,typeArguments:[],arguments:a})})}},uj=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.dexInfo),n],h=vr(e.publishedAtV2(),i);return t.moveCall({target:`${h}::bluemove::${c}`,typeArguments:[u,l],arguments:f})})}},lj=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i,s){return _t(this,null,function*(){const{direction:o,from:a,target:c}=r,[u,l,f]=o?["swap_a2b",a,c]:["swap_b2a",c,a];let h;s?h=s:h=rx(t,e.deepbookv3DeepFeeType());const y=[t.object(this.deepbookV3Config),t.object(r.id),n,h,t.object(ei)],b=Ko(e.publishedAtV2Extend(),i);return t.moveCall({target:`${b}::deepbookv3::${u}`,typeArguments:[l,f],arguments:y})})}},fj=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,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",o,a];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 f=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(ei)],h=Ko(e.publishedAtV2Extend(),i);return t.moveCall({target:`${h}::scallop::${c}`,typeArguments:[u,l],arguments:f})})}},lg=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u]=s?["swap_a2b",a]:["swap_b2a",o],l=[t.object(r.id),t.object(this.sui_system_state),n],f=Ko(e.publishedAtV2Extend(),i);return t.moveCall({target:`${f}::suilend::${c}`,typeArguments:[u],arguments:l})})}},dj=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),n,t.object(ei)],h=Ko(e.publishedAtV2Extend(),i);return t.moveCall({target:`${h}::bluefin::${c}`,typeArguments:[u,l],arguments:f})})}},hj=class{constructor(e,t){if(e===1){this.connection=new Rc.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new Rc.SuiPythClient(t,n,r)}else{this.connection=new Rc.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new Rc.SuiPythClient(t,n,r)}}swap(e,t,r,n,i){return _t(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,h;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");f=r.extendedDetails.haedalPmmBasePriceSeed,h=r.extendedDetails.haedalPmmQuotePriceSeed;const y=[f,h],b=yield this.connection.getPriceFeedsUpdateData(y),w=yield this.pythClient.updatePriceFeeds(t,b,y),T=[t.object(r.id),t.object(w[0]),t.object(w[1]),n,t.object(ei)],I=Ko(e.publishedAtV2Extend(),i);return t.moveCall({target:`${I}::haedalpmm::${c}`,typeArguments:[u,l],arguments:T})})}},pj=class{constructor(e){if(e!==0)throw new Error("Alphafi only supported on mainnet");this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n,i){return _t(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u]=s?["swap_a2b",a]:["swap_b2a",o],l=[t.object(r.id),t.object(this.sui_system_state),n],f=Ko(e.publishedAtV2Extend(),i);return t.moveCall({target:`${f}::alphafi::${c}`,typeArguments:[u],arguments:l})})}},nx="CETUS",mj="DEEPBOOK",gj="KRIYA",vj="FLOWX",yj="FLOWXV3",bj="KRIYAV3",ix="TURBOS",Zd="AFTERMATH",wj="HAEDAL",_j="VOLO",xj="AFSUI",Sj="BLUEMOVE",sx="DEEPBOOKV3",ox="SCALLOP",Ej="SUILEND",Cj="BLUEFIN",ax="HAEDALPMM",Aj="ALPHAFI",Mj="SPRINGSUI",Tj="https://api-sui.cetus.zone/router_v2";function fg(e){return Array.isArray(e.routers)}function Gf(e){return Array.isArray(e.routers)}var Oj=class{constructor(e,t,r,n){this.endpoint=e?jj(e):Tj,this.client=r||new eg.SuiClient({url:eg.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return _t(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:Fs(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 _t(this,null,function*(){return Rj(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s,o){return _t(this,null,function*(){if(r.length===0)throw new Error("No router found");const a=r.map(b=>b.amountIn.toString()),c=r[0].path[0].from,u=r[0].path[r[0].path.length-1].target,l=e.splitCoins(t,a),f=[];for(let b=0;b<r.length;b++){if(r[b].path.length===0)throw new Error("Empty path");let w=l[b];for(const T of r[b].path)w=yield this.newDex(T.provider,i).swap(this,e,T,w,o,s);f.push(w)}const h=vr(this.publishedAtV2(),o);return this.transferOrDestoryCoin(e,t,c,this.publishedAtV2()),this.checkCoinThresholdAndMergeCoin(e,f,u,n,h)})}expectOutputSwap(e,t,r,n,i){return _t(this,null,function*(){const s=[],o=[],a=[],c=new ag(this.env,n),u=vr(this.publishedAtV2(),i);for(let f=0;f<r.length;f++){const h=r[f];for(let b=h.path.length-1;b>=0;b--){const w=h.path[b],T=c.flash_swap(this,e,w,!1);s.unshift(T.targetCoin),o.unshift(T.flashReceipt)}let y=t;for(let b=0;b<h.path.length;b++){const w=h.path[b],T=c.repay_flash_swap(this,e,w,y,o[b]);y=s[b],b===0?t=T:this.transferOrDestoryCoin(e,T,w.from,u),b===h.path.length-1&&a.push(y)}}const l=r[0].path[0].from;if(this.transferOrDestoryCoin(e,t,l,u),a.length>1){const f=e.makeMoveVec({elements:a.slice(1)});e.moveCall({target:`${Wd.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r[0].path[r[0].path.length-1].target],arguments:[a[0],f]})}return a[0]})}swapInPools(e){return _t(this,null,function*(){let t;try{t=yield sj(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return _t(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,txb:i,partner:s,deepbookv3DeepFee:o}=e,a=Array.isArray(t)?t:t.routes,c=fg(e)?e.byAmountIn:e.routers.byAmountIn,u=a.reduce((T,I)=>T.add(I.amountIn),new Xi.default(0)),l=a.reduce((T,I)=>T.add(I.amountOut),new Xi.default(0)),f=nj(c?l:u,c,n),h=fg(e)?void 0:e.routers.packages;console.log("packages11",h);const y=vr(this.publishedAtV2(),h);if(c)return yield this.expectInputSwap(i,r,a,f,s,o,h);const b=i.splitCoins(r,[f.toString()]);return this.transferOrDestoryCoin(i,r,a[0].path[0].from,y),yield this.expectOutputSwap(i,b[0],a,s)})}fastRouterSwap(e){return _t(this,null,function*(){const{routers:t,slippage:r,txb:n,partner:i,refreshAllCoins:s,payDeepFeeAmount:o}=e,a=Array.isArray(t)?t:t.routes,c=a[0].path[0].from;let u=yield this.getCoins(c,s);const l=a[0].path[a[0].path.length-1].target,f=a.reduce((U,L)=>U.add(L.amountIn),new Xi.default(0)),h=a.reduce((U,L)=>U.add(L.amountOut),new Xi.default(0)),y=Gf(e)?e.byAmountIn:e.routers.byAmountIn,b=rj(y?h:f,y,r),T=Wf(n,u,BigInt((y?f:b).toString()),c);let I;if(o&&o>0){let U=yield this.getCoins(this.deepbookv3DeepFeeType());I=Wf(n,U,BigInt(o),this.deepbookv3DeepFeeType()).targetCoin}const k=Gf(e)?{routers:a,inputCoin:T.targetCoin,slippage:r,byAmountIn:y,txb:n,partner:i,deepbookv3DeepFee:I}:{routers:e.routers,inputCoin:T.targetCoin,slippage:r,byAmountIn:y,txb:n,partner:i,deepbookv3DeepFee:I},N=yield this.routerSwap(k);if(zn.isSuiCoin(l))n.mergeCoins(n.gas,[N]);else{let U=yield this.getCoins(l,s);const L=Wf(n,U,BigInt(0),l),W=Gf(e)?void 0:e.routers.packages,q=vr(this.publishedAtV2(),W);n.mergeCoins(L.targetCoin,[N]),L.isMintZeroCoin&&this.transferOrDestoryCoin(n,L.targetCoin,l,q)}})}publishedAtV2(){return this.env===0?"0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2Extend(){return this.env===0?"0xf2fcea41dc217385019828375764fa06d9bd25e8e4726ba1962680849fb8d613":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(e,t,r,n){e.moveCall({target:`${n}::utils::transfer_or_destroy_coin`,typeArguments:[r],arguments:[t]})}checkCoinThresholdAndMergeCoin(e,t,r,n,i){let s=t[0];if(t.length>1){let o=e.makeMoveVec({elements:t.slice(1)});e.moveCall({target:`${Wd.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r],arguments:[t[0],o]}),s=t[0]}return e.moveCall({target:`${i}::utils::check_coin_threshold`,typeArguments:[r],arguments:[s,e.pure.u64(n.toString())]}),s}newDex(e,t){switch(e){case nx:return new ag(this.env,t);case mj:return new Uk(this.env);case sx:return new lj(this.env);case gj:return new zk(this.env);case bj:return new Vk(this.env);case vj:return new qk(this.env);case yj:return new Hk(this.env);case ix:return new Wk(this.env);case Zd:return new Fk(this.env);case wj:return new oj(this.env);case xj:return new aj(this.env);case _j:return new cj(this.env);case Sj:return new uj(this.env);case ox:return new fj(this.env);case Ej:return new lg(this.env);case Mj:return new lg(this.env);case Cj:return new dj(this.env);case ax:return new hj(this.env,this.client);case Aj:return new pj(this.env);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return _t(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return _t(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return _t(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return _t(this,null,function*(){const e=yield $j(this.endpoint);return e?e.data:null})}};function Ij(e,t){let r=0;for(const s of e.routes)for(const o of s.path)o.extended_details&&o.extended_details.deepbookv3_deep_fee&&(r+=Number(o.extended_details.deepbookv3_deep_fee));let n;if(e.packages!=null){n=new Map;for(const[s,o]of Object.entries(e.packages))n.set(s,o)}return{amountIn:new Xi.default(e.amount_in.toString()),amountOut:new Xi.default(e.amount_out.toString()),byAmountIn:t,insufficientLiquidity:!1,routes:e.routes.map(s=>({path:s.path.map(o=>{var a,c,u,l,f,h,y;let b;o.provider===Zd&&(b=o.extended_details.aftermath_pool_flatness===0?"v2":"v3");let w;return(o.provider===ix||o.provider===Zd||o.provider===nx||o.provider===sx||o.provider===ox||o.provider===ax)&&(w={aftermathLpSupplyType:(a=o.extended_details)==null?void 0:a.aftermath_lp_supply_type,turbosFeeType:(c=o.extended_details)==null?void 0:c.turbos_fee_type,afterSqrtPrice:(u=o.extended_details)==null?void 0:u.after_sqrt_price,deepbookv3DeepFee:(l=o.extended_details)==null?void 0:l.deepbookv3_deep_fee,scallopScoinTreasury:(f=o.extended_details)==null?void 0:f.scallop_scoin_treasury,haedalPmmBasePriceSeed:(h=o.extended_details)==null?void 0:h.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(y=o.extended_details)==null?void 0:y.haedal_pmm_quote_price_seed}),{id:o.id,direction:o.direction,provider:o.provider,from:o.from,target:o.target,feeRate:o.fee_rate,amountIn:o.amount_in,amountOut:o.amount_out,extendedDetails:w,version:b}}),amountIn:new Xi.default(s.amount_in.toString()),amountOut:new Xi.default(s.amount_out.toString()),initialPrice:new cu(s.initial_price.toString())})),totalDeepFee:r,packages:n}}var ei="0x0000000000000000000000000000000000000000000000000000000000000006",Pj="aggregator_v2",kj="aggregator_v2_extend";function vr(e,t){var r;return t instanceof Map&&(r=t.get(Pj))!=null?r:e}function Ko(e,t){var r;return t instanceof Map&&(r=t.get(kj))!=null?r:e}Wo(Go());function jj(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function Rj(e,t){return _t(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield Dj(e,t):r=yield Nj(e,t),!r)return null;if(!r.ok)return{amountIn:wi,amountOut:wi,routes:[],byAmountIn:t.byAmountIn,insufficientLiquidity:!1,error:{code:10001,msg:Hf(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:wi,amountOut:wi,routes:[],byAmountIn:t.byAmountIn,insufficientLiquidity:i,error:{code:10004,msg:Hf(10004)}}:n.data!=null?Ij(n.data,t.byAmountIn):{amountIn:wi,amountOut:wi,routes:[],insufficientLiquidity:i,byAmountIn:t.byAmountIn,error:{code:10003,msg:Hf(10003)}}})}function Nj(e,t){return _t(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=ns(r),h=ns(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=1000319",yield fetch(y)}catch(r){return console.error(r),null}})}function Dj(e,t){return _t(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=ns(r),y=ns(n),b=`${e}/find_routes`,w=l==null?void 0:l.join(","),T={from:h,target:y,amount:Number(i.toString()),by_amount_in:s,depth:o,split_algorithm:a,split_factor:c,split_count:u,providers:w,liquidity_changes:f.map(I=>({pool:I.poolID,tick_lower:I.ticklower,tick_upper:I.tickUpper,delta_liquidity:I.deltaLiquidity}))};try{return yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}catch(I){return console.error("Error:",I),null}})}function $j(e){return _t(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var cx=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(cx||{}),ux=Oj,Bj=cx,dg=Gk,$a=Fs;const lx="0x2::sui::SUI",Lj="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function fx(e){return Tr(e).full_address===lx}function hg(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=>fx(l)?l:Tr(l).source_address),u.source_address=hg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===lx||r===Lj?"0x2":On.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=hg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function Fj(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const Mi=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=On.normalizeSuiObjectId(n);return t&&(i=Fj(i)),`${i}::${r.join("::")}`};/*!
|
|
39
|
+
* decimal.js v10.4.3
|
|
40
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
|
41
|
+
* https://github.com/MikeMcl/decimal.js
|
|
42
|
+
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
43
|
+
* MIT Licence
|
|
44
|
+
*/var _o=9e15,ds=1e9,Qd="0123456789abcdef",$u="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Bu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",eh={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-_o,maxE:_o,crypto:!1},dx,Si,ct=!0,Tl="[DecimalError] ",is=Tl+"Invalid argument: ",hx=Tl+"Precision limit exceeded",px=Tl+"crypto unavailable",mx="[object Decimal]",Ir=Math.floor,pr=Math.pow,Uj=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,zj=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Vj=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,gx=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Tn=1e7,Qe=7,qj=9007199254740991,Hj=$u.length-1,th=Bu.length-1,be={toStringTag:mx};be.absoluteValue=be.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)};be.ceil=function(){return Xe(new this.constructor(this),this.e+1,2)};be.clampedTo=be.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(is+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};be.comparedTo=be.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1};be.cosine=be.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=Wj(n,_x(n,r)),n.precision=e,n.rounding=t,Xe(Si==2||Si==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(ct=!1,s=l.s*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=Sr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Ir((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=qt(u.plus(l).times(a),u.plus(c),o+2,1),Sr(a.d).slice(0,o)===(r=Sr(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)};be.decimalPlaces=be.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ir(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};be.dividedBy=be.div=function(e){return qt(this,new this.constructor(e))};be.dividedToIntegerBy=be.divToInt=function(e){var t=this,r=t.constructor;return Xe(qt(t,new r(e),0,1,1),r.precision,r.rounding)};be.equals=be.eq=function(e){return this.cmp(e)===0};be.floor=function(){return Xe(new this.constructor(this),this.e+1,3)};be.greaterThan=be.gt=function(e){return this.cmp(e)>0};be.greaterThanOrEqualTo=be.gte=function(e){var t=this.cmp(e);return t==1||t===0};be.hyperbolicCosine=be.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/Il(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Ro(o,1,s.times(t),new o(1),!0);for(var c,u=e,l=new o(8);u--;)c=s.times(s),s=a.minus(c.times(l.minus(c.times(l))));return Xe(s,o.precision=r,o.rounding=n,!0)};be.hyperbolicSine=be.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Ro(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Il(5,e)),i=Ro(s,2,i,i,!0);for(var o,a=new s(5),c=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(a.plus(o.times(c.times(o).plus(u))))}return s.precision=t,s.rounding=r,Xe(i,t,r,!0)};be.hyperbolicTangent=be.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,qt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};be.inverseCosine=be.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?En(r,i,s):new r(0):new r(NaN):t.isZero()?En(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=En(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,ct=!1,r=r.times(r).minus(1).sqrt().plus(r),ct=!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,ct=!1,r=r.times(r).plus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln())};be.inverseHyperbolicTangent=be.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Xe(new s(i),e,t,!0):(s.precision=r=n-i.e,i=qt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)};be.inverseSine=be.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=En(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<=th)return o=En(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=th)return o=En(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)};be.isFinite=function(){return!!this.d};be.isInteger=be.isInt=function(){return!!this.d&&Ir(this.e/Qe)>this.d.length-2};be.isNaN=function(){return!this.s};be.isNegative=be.isNeg=function(){return this.s<0};be.isPositive=be.isPos=function(){return this.s>0};be.isZero=function(){return!!this.d&&this.d[0]===0};be.lessThan=be.lt=function(e){return this.cmp(e)<0};be.lessThanOrEqualTo=be.lte=function(e){return this.cmp(e)<1};be.logarithm=be.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(ct=!1,a=f+y,o=Yi(u,a),n=t?Lu(l,a+10):Yi(e,a),c=qt(o,n,a,1),Ja(c.d,i=f,h))do if(a+=10,o=Yi(u,a),n=t?Lu(l,a+10):Yi(e,a),c=qt(o,n,a,1),!s){+Sr(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(Ja(c.d,i+=10,h));return ct=!0,Xe(c,f,h)};be.minus=be.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return ct?Xe(e,a,c):e}if(r=Ir(e.e/Qe),l=Ir(y.e/Qe),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Qe),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=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=Ol(u,r),ct?Xe(e,a,c):e):new b(c===3?-0:0)};be.modulo=be.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Xe(new n(r),n.precision,n.rounding):(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))};be.naturalExponential=be.exp=function(){return rh(this)};be.naturalLogarithm=be.ln=function(){return Yi(this)};be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(e)};be.plus=be.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),ct?Xe(e,a,c):e;if(s=Ir(f.e/Qe),n=Ir(e.e/Qe),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Qe),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/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=Ol(u,n),ct?Xe(e,a,c):e};be.precision=be.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(is+e);return r.d?(t=vx(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};be.round=function(){var e=this,t=e.constructor;return Xe(new t(e),e.e+1,t.rounding)};be.sine=be.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=Kj(n,_x(n,r)),n.precision=e,n.rounding=t,Xe(Si>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(ct=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=Sr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ir((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(s=n,n=s.plus(qt(o,s,r+2,1)).times(.5),Sr(s.d).slice(0,r)===(t=Sr(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)};be.tangent=be.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=qt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(Si==2||Si==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=Ir(l.e/Qe)+Ir(e.e/Qe),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%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=Ol(s,r),ct?Xe(e,f.precision,f.rounding):e};be.toBinary=function(e,t){return Jp(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:(Hr(e,0,ds),t===void 0?t=n.rounding:Hr(t,0,8),Xe(r,e+r.e+1,t))};be.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ti(n,!0):(Hr(e,0,ds),t===void 0?t=i.rounding:Hr(t,0,8),n=Xe(new i(n),e+1,t),r=ti(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=ti(i):(Hr(e,0,ds),t===void 0?t=s.rounding:Hr(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};be.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=vx(b)-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(is+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new w(Sr(b)),l=w.precision,w.precision=s=b.length*Qe*2;f=qt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=qt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=qt(u,n,s,1).minus(y).abs().cmp(qt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h};be.toHexadecimal=be.toHex=function(e,t){return Jp(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:Hr(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};be.toNumber=function(){return+this};be.toOctal=function(e,t){return Jp(this,8,e,t)};be.toPower=be.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(pr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Xe(a,n,s);if(t=Ir(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=qj)return i=yx(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)?Ir(u*(Math.log("0."+Sr(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=rh(e.times(Yi(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),Ja(i.d,n,s)&&(t=n+10,i=Xe(rh(e.times(Yi(a,t+r)),t),t+5,1),+Sr(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))};be.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):(Hr(e,1,ds),t===void 0?t=i.rounding:Hr(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};be.toSignificantDigits=be.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Hr(e,1,ds),t===void 0?t=n.rounding:Hr(t,0,8)),Xe(new n(r),e,t)};be.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};be.truncated=be.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)};be.valueOf=be.toJSON=function(){var e=this,t=e.constructor,r=ti(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function Sr(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+=Hi(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=Hi(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Hr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(is+e)}function Ja(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 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]+=Qd.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 Wj(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Il(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Ro(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var qt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,T,I,k,N,U,L,W,q,X,re,oe,H,F,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=Tn,y=Qe,l=Ir(n.e/y)-Ir(i.e/y)),H=m.length,re=d.length,I=new D(p),k=I.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(W=s=D.precision,o=D.rounding):a?W=s+(n.e-i.e)+1:W=s,W<0)k.push(1),b=!0;else{if(W=W/y+2|0,f=0,H==1){for(h=0,m=m[0],W++;(f<re||h)&&W--;f++)q=h*c+(d[f]||0),k[f]=q/m|0,h=q%m|0;b=h||f<re}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),H=m.length,re=d.length),X=H,N=d.slice(0,H),U=N.length;U<H;)N[U++]=0;F=m.slice(),F.unshift(0),oe=m[0],m[1]>=c/2&&++oe;do h=0,u=t(m,N,H,U),u<0?(L=N[0],H!=U&&(L=L*c+(N[1]||0)),h=L/oe|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),T=w.length,U=N.length,u=t(w,N,T,U),u==1&&(h--,r(w,H<T?F:m,T,c))):(h==0&&(u=h=1),w=m.slice()),T=w.length,T<U&&w.unshift(0),r(N,w,U,c),u==-1&&(U=N.length,u=t(m,N,H,U),u<1&&(h++,r(N,H<U?F:m,U,c))),U=N.length):u===0&&(h++,N=[0]),k[f++]=h,u&&N[0]?N[U++]=d[X]||0:(N=[d[X]],U=1);while((X++<re||N[0]!==void 0)&&W--);b=N[0]!==void 0}k[0]||k.shift()}if(y==1)I.e=l,dx=b;else{for(f=1,h=k[0];h>=10;h/=10)f++;I.e=f+l*y-1,Xe(I,a?s+I.e+1:s,o,b)}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]==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 wx(e);var n,i=e.e,s=Sr(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 Ol(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function Lu(e,t,r){if(t>Hj)throw ct=!0,r&&(e.precision=r),Error(hx);return Xe(new e($u),t,1,!0)}function En(e,t,r){if(t>th)throw Error(hx);return Xe(new e(Bu),t,r,!0)}function vx(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 Hi(e){for(var t="";e--;)t+="0";return t}function yx(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),mg(s.d,o)&&(i=!0)),r=Ir(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),mg(t.d,o)}return ct=!0,s}function pg(e){return e.d[e.d.length-1]&1}function bx(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 rh(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(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)),Sr(a.d).slice(0,c)===Sr(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&Ja(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 Yi(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,T=w.d,I=w.constructor,k=I.rounding,N=I.precision;if(w.s<0||!T||!T[0]||!w.e&&T[0]==1&&T.length==1)return new I(T&&!T[0]?-1/0:w.s!=1?NaN:T?0:w);if(t==null?(ct=!1,l=N):l=t,I.precision=l+=b,r=Sr(T),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=Sr(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=Lu(I,l+2,N).times(s+""),w=Yi(new I(n+"."+r.slice(1)),l-b).plus(u),I.precision=N,t==null?Xe(w,N,k,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)),Sr(u.d).slice(0,l)===Sr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Lu(I,l+2,N).times(s+""))),c=qt(c,new I(y),l,1),t==null)if(Ja(c.d,l-b,k,a))I.precision=l+=b,u=o=w=qt(f.minus(1),f.plus(1),l,1),h=Xe(w.times(w),l,1),i=a=1;else return Xe(c,I.precision=N,k,ct=!0);else return I.precision=N,c;c=u,i+=2}}function wx(e){return String(e.s*e.s/0)}function nh(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 Gj(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),gx.test(t))return nh(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(zj.test(t))r=16,t=t.toLowerCase();else if(Uj.test(t))r=2;else if(Vj.test(t))r=8;else throw Error(is+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=yx(n,new n(r),s,s*2)),u=uu(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=Ol(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):$r.pow(2,c))),ct=!0,e)}function Kj(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Ro(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Il(5,r)),t=Ro(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 Ro(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 Il(e,t){for(var r=e;--t;)r*=e;return r}function _x(e,t){var r,n=t.s<0,i=En(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Si=n?4:1,t;if(r=t.divToInt(i),r.isZero())Si=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Si=pg(r)?n?2:3:n?4:1,t;Si=pg(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Jp(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Hr(r,1,ds),n===void 0?n=y.rounding:Hr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=wx(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=uu(ti(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=dx),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+=Qd.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+=Qd.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 mg(e,t){if(e.length>t)return e.length=t,!0}function Xj(e){return new this(e).abs()}function Jj(e){return new this(e).acos()}function Yj(e){return new this(e).acosh()}function Zj(e,t){return new this(e).plus(t)}function Qj(e){return new this(e).asin()}function eR(e){return new this(e).asinh()}function tR(e){return new this(e).atan()}function rR(e){return new this(e).atanh()}function nR(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=En(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?En(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=En(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=En(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 iR(e){return new this(e).cbrt()}function sR(e){return Xe(e=new this(e),e.e+1,2)}function oR(e,t,r){return new this(e).clamp(t,r)}function aR(e){if(!e||typeof e!="object")throw Error(Tl+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,ds,"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]=eh[r]),(n=e[r])!==void 0)if(Ir(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(is+r+": "+n);if(r="crypto",i&&(this[r]=eh[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(px);else this[r]=!1;else throw Error(is+r+": "+n);return this}function cR(e){return new this(e).cos()}function uR(e){return new this(e).cosh()}function xx(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,gg(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 nh(u,s.toString())}else if(c!=="string")throw Error(is+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),gx.test(s)?nh(u,s):Gj(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=aR,i.clone=xx,i.isDecimal=gg,i.abs=Xj,i.acos=Jj,i.acosh=Yj,i.add=Zj,i.asin=Qj,i.asinh=eR,i.atan=tR,i.atanh=rR,i.atan2=nR,i.cbrt=iR,i.ceil=sR,i.clamp=oR,i.cos=cR,i.cosh=uR,i.div=lR,i.exp=fR,i.floor=dR,i.hypot=hR,i.ln=pR,i.log=mR,i.log10=vR,i.log2=gR,i.max=yR,i.min=bR,i.mod=wR,i.mul=_R,i.pow=xR,i.random=SR,i.round=ER,i.sign=CR,i.sin=AR,i.sinh=MR,i.sqrt=TR,i.sub=OR,i.sum=IR,i.tan=PR,i.tanh=kR,i.trunc=jR,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 lR(e,t){return new this(e).div(t)}function fR(e){return new this(e).exp()}function dR(e){return Xe(e=new this(e),e.e+1,3)}function hR(){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 gg(e){return e instanceof $r||e&&e.toStringTag===mx||!1}function pR(e){return new this(e).ln()}function mR(e,t){return new this(e).log(t)}function gR(e){return new this(e).log(2)}function vR(e){return new this(e).log(10)}function yR(){return bx(this,arguments,"lt")}function bR(){return bx(this,arguments,"gt")}function wR(e,t){return new this(e).mod(t)}function _R(e,t){return new this(e).mul(t)}function xR(e,t){return new this(e).pow(t)}function SR(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Hr(e,1,ds),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(px);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 ER(e){return Xe(e=new this(e),e.e+1,this.rounding)}function CR(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function AR(e){return new this(e).sin()}function MR(e){return new this(e).sinh()}function TR(e){return new this(e).sqrt()}function OR(e,t){return new this(e).sub(t)}function IR(){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 PR(e){return new this(e).tan()}function kR(e){return new this(e).tanh()}function jR(e){return Xe(e=new this(e),e.e+1,1)}be[Symbol.for("nodejs.util.inspect.custom")]=be.toString;be[Symbol.toStringTag]="Decimal";var $r=be.constructor=xx(eh);$u=new $r($u);Bu=new $r(Bu);$r.config({precision:256,rounding:$r.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const Mr=(e,t,r,n=$r.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Be(e).equals(0))return"0";if(t!==void 0){const u=bs(e,t,n);if(!Be(u).equals(0))return r?u:No(u)}const i=Be(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(Be(o).gt(0))!a||Be(o.length).gte(9)?c=bs(i,0,n):Be(o.length).gte(4)?c=bs(i,2,n):c=bs(i,4,n);else{bs(i,6,n);const u=DR(a);if(u<6)c=bs(i,u+6,n);else{if(u>30)return"0";c=bs(i,9+(u-6),n)}}return r||Be(o).lt(1)?c:No(c)},Sx=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=Mr(e,t,!0,$r.ROUND_DOWN).toString();if(Be(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:No(i).toString();return o.includes("e")&&(o=n?i:No(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"$--"}},RR=(e,t,r=!0)=>{if(`${e}`=="0")return!parseFloat(t)||!r?"0":"0.".padEnd(t+2,"0");if(!e)return"--";const n=parseFloat(e),i=e.toString(),s=n<0;let o=i;if(i.toLowerCase().includes("e")){const a=i.match(/(\d+?)(?:\.(\d*))?e([+-])(\d+)/),c=a[1],u=a[2],l=a[3],f=a[4];let h="",y=u?u.substr(f):"";if(y&&(y=`.${y}`),l!=="-"){for(let b=0;b<f;b+=1){const w=u[b]||"0";h+=w}o=c+h+y}else{let b="0";for(let w=0;w<f;w+=1)h=(c[c.length-w-1]||"0")+h;c.length>f&&(b=c.substr(0,c.length-f)),o=`${b}.${h}${u}`}}if(t&&r){let a=`${o.split(".")[0]}.`;const c=o.split(".")[1]||"";for(let u=0;u<t;u+=1)a+=c[u]||"0";o=a}if(o.length>14){const a=o.split(".");a[0].length>14?o=`${a[0].slice(0,14)}+`:(o=o.slice(0,13),o.indexOf(".")===12&&(o=o.slice(0,12)))}return`${s?"-":""}${o}`},Be=e=>$r.isDecimal(e)?e:new $r(typeof e>"u"||e==="undefined"||!e?0:e);function NR(e,t){return t===void 0?"":Be(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const bs=(e,t,r)=>Be(e).toDP(t,r).toString(),No=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 DR(e){let t=0;if(e)for(;t<e.length;){if(Be(e[t]).gt(0))return t+1;t++}return 0}function $R(e,t){const r=Ex(Be(t));return Number(Be(e).mul(r))}function BR(e,t){const r=Ex(Be(t));return Number(Be(e).div(r))}function Ex(e){return Be(10).pow(Be(e).abs())}function ih(e,t){const r=BR(e,t);return LR(r.toString(),Number(t))}function LR(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return RR(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 Pl(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):"",Yp=(e,t)=>{if(e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r)if(!Yp(e[i],t[i]))return!1;return!0};function vg(e){return!e||Object.keys(e).length===0}function Cx(e){var t;return((t=e.split("::"))==null?void 0:t.length)===3}const yg=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function FR(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=Be(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===On.SUI_TYPE_ARG;let f=c.amount;l&&(f=r?f:Be(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function bg(e,t){if(t){const r=e[$a(t.coin_type).full_address];if(r)return ih(Be(r.amount).abs().toFixed(0),t.decimals)}}function Lt(e){return`https://archive.cetus.zone/assets/terminal${e}`}const cn=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Be(t).gt(0)?`${e.slice(0,t)}...`:e,Nc=(e,t)=>Mi(e||"")===Mi(t||""),UR=async function(e,t,r=3e4){const n=[];let i="";if(t){for(const c in t){const u=`${c}=${t[c]}`;n.push(u)}const a=n.join("&");i=`${e}?${a}`}else i=e;const s=new AbortController,o=setTimeout(()=>{s.abort()},r);try{const a=await fetch(i,{signal:s.signal});if(clearTimeout(o),!a.ok)throw new Error("Request failed");const c=await a.json();return(c==null?void 0:c.data)||c}catch(a){throw clearTimeout(o),a.name==="AbortError"?new Error("request time out"):a}},zR=async function(e,t,r=3e4){const n=new AbortController,i=setTimeout(()=>{n.abort()},r);try{const s=await fetch(e,{body:JSON.stringify(t),method:"POST",signal:n.signal});if(clearTimeout(i),!s.ok)throw new Error("Request failed");return s.json()}catch(s){throw clearTimeout(i),s.name==="AbortError"?new Error("request time out"):s}},sh="tokenMap",Ax="trustedTokenList",Mx="collectTokenMap",Tx="importTokenList";var Ox={exports:{}};/*!
|
|
45
|
+
localForage -- Offline Storage, Improved
|
|
46
|
+
Version 1.10.0
|
|
47
|
+
https://localforage.github.io/localForage
|
|
48
|
+
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
49
|
+
*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,s){function o(u,l){if(!i[u]){if(!n[u]){var f=typeof Hn=="function"&&Hn;if(!l&&f)return f(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var y=i[u]={exports:{}};n[u][0].call(y.exports,function(b){var w=n[u][1][b];return o(w||b)},y,y.exports,r,n,i,s)}return i[u].exports}for(var a=typeof Hn=="function"&&Hn,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(r,n,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var c=0,u=new o(b),l=s.document.createTextNode("");u.observe(l,{characterData:!0}),a=function(){l.data=c=++c%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var T=s.document.createElement("script");T.onreadystatechange=function(){b(),T.onreadystatechange=null,T.parentNode.removeChild(T),T=null},s.document.documentElement.appendChild(T)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var T,I,k=y.length;k;){for(I=y,y=[],T=-1;++T<k;)I[T]();k=y.length}h=!1}n.exports=w;function w(T){y.push(T)===1&&!h&&a()}}).call(this,typeof Dr<"u"?Dr: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,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(re){return a.reject(L,re)}X===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,X)})}a.resolve=function(L,W){var q=T(b,W);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=W;for(var re=-1,oe=L.queue.length;++re<oe;)L.queue[re].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 w(L,W){var q=!1;function X(F){q||(q=!0,a.reject(L,F))}function re(F){q||(q=!0,a.resolve(L,F))}function oe(){W(re,X)}var H=T(oe);H.status==="error"&&X(H.value)}function T(L,W){var q={};try{q.value=L(W),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=k;function k(L){var W=new this(o);return a.reject(W,L)}f.all=N;function N(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 re=new Array(q),oe=0,H=-1,F=new this(o);++H<q;)D(L[H],H);return F;function D(p,d){W.resolve(p).then(m,function(x){X||(X=!0,a.reject(F,x))});function m(x){re[d]=x,++oe===q&&!X&&(X=!0,a.resolve(F,re))}}}f.race=U;function U(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 re=-1,oe=new this(o);++re<q;)H(L[re]);return oe;function H(F){W.resolve(F).then(function(D){X||(X=!0,a.resolve(oe,D))},function(D){X||(X=!0,a.reject(oe,D))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof Dr<"u"?Dr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $};function o($,G){if(!($ instanceof G))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var c=a();function u(){try{if(!c||!c.open)return!1;var $=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),G=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!$||G)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l($,G){$=$||[],G=G||{};try{return new Blob($,G)}catch(J){if(J.name!=="TypeError")throw J;for(var z=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,Y=new z,Q=0;Q<$.length;Q+=1)Y.append($[Q]);return Y.getBlob(G.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h($,G){G&&$.then(function(z){G(null,z)},function(z){G(z)})}function y($,G,z){typeof G=="function"&&$.then(G),typeof z=="function"&&$.catch(z)}function b($){return typeof $!="string"&&(console.warn($+" used as a key, but it is not a string."),$=String($)),$}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var T="local-forage-detect-blob-support",I=void 0,k={},N=Object.prototype.toString,U="readonly",L="readwrite";function W($){for(var G=$.length,z=new ArrayBuffer(G),Y=new Uint8Array(z),Q=0;Q<G;Q++)Y[Q]=$.charCodeAt(Q);return z}function q($){return new f(function(G){var z=$.transaction(T,L),Y=l([""]);z.objectStore(T).put(Y,"key"),z.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),G(!1)},z.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),J=navigator.userAgent.match(/Edge\//);G(J||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function X($){return typeof I=="boolean"?f.resolve(I):q($).then(function(G){return I=G,I})}function re($){var G=k[$.name],z={};z.promise=new f(function(Y,Q){z.resolve=Y,z.reject=Q}),G.deferredOperations.push(z),G.dbReady?G.dbReady=G.dbReady.then(function(){return z.promise}):G.dbReady=z.promise}function oe($){var G=k[$.name],z=G.deferredOperations.pop();if(z)return z.resolve(),z.promise}function H($,G){var z=k[$.name],Y=z.deferredOperations.pop();if(Y)return Y.reject(G),Y.promise}function F($,G){return new f(function(z,Y){if(k[$.name]=k[$.name]||g(),$.db)if(G)re($),$.db.close();else return z($.db);var Q=[$.name];G&&Q.push($.version);var J=c.open.apply(c,Q);G&&(J.onupgradeneeded=function(pe){var we=J.result;try{we.createObjectStore($.storeName),pe.oldVersion<=1&&we.createObjectStore(T)}catch(Ee){if(Ee.name==="ConstraintError")console.warn('The database "'+$.name+'" has been upgraded from version '+pe.oldVersion+" to version "+pe.newVersion+', but the storage "'+$.storeName+'" already exists.');else throw Ee}}),J.onerror=function(pe){pe.preventDefault(),Y(J.error)},J.onsuccess=function(){var pe=J.result;pe.onversionchange=function(we){we.target.close()},z(pe),oe($)}})}function D($){return F($,!1)}function p($){return F($,!0)}function d($,G){if(!$.db)return!0;var z=!$.db.objectStoreNames.contains($.storeName),Y=$.version<$.db.version,Q=$.version>$.db.version;if(Y&&($.version!==G&&console.warn('The database "'+$.name+`" can't be downgraded from version `+$.db.version+" to version "+$.version+"."),$.version=$.db.version),Q||z){if(z){var J=$.db.version+1;J>$.version&&($.version=J)}return!0}return!1}function m($){return new f(function(G,z){var Y=new FileReader;Y.onerror=z,Y.onloadend=function(Q){var J=btoa(Q.target.result||"");G({__local_forage_encoded_blob:!0,data:J,type:$.type})},Y.readAsBinaryString($)})}function x($){var G=W(atob($.data));return l([G],{type:$.type})}function A($){return $&&$.__local_forage_encoded_blob}function E($){var G=this,z=G._initReady().then(function(){var Y=k[G._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(z,$,$),z}function O($){re($);for(var G=k[$.name],z=G.forages,Y=0;Y<z.length;Y++){var Q=z[Y];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return $.db=null,D($).then(function(J){return $.db=J,d($)?p($):J}).then(function(J){$.db=G.db=J;for(var pe=0;pe<z.length;pe++)z[pe]._dbInfo.db=J}).catch(function(J){throw H($,J),J})}function C($,G,z,Y){Y===void 0&&(Y=1);try{var Q=$.db.transaction($.storeName,G);z(null,Q)}catch(J){if(Y>0&&(!$.db||J.name==="InvalidStateError"||J.name==="NotFoundError"))return f.resolve().then(function(){if(!$.db||J.name==="NotFoundError"&&!$.db.objectStoreNames.contains($.storeName)&&$.version<=$.db.version)return $.db&&($.version=$.db.version+1),p($)}).then(function(){return O($).then(function(){C($,G,z,Y-1)})}).catch(z);z(J)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v($){var G=this,z={db:null};if($)for(var Y in $)z[Y]=$[Y];var Q=k[z.name];Q||(Q=g(),k[z.name]=Q),Q.forages.push(G),G._initReady||(G._initReady=G.ready,G.ready=E);var J=[];function pe(){return f.resolve()}for(var we=0;we<Q.forages.length;we++){var Ee=Q.forages[we];Ee!==G&&J.push(Ee._initReady().catch(pe))}var Ce=Q.forages.slice(0);return f.all(J).then(function(){return z.db=Q.db,D(z)}).then(function(Ae){return z.db=Ae,d(z,G._defaultConfig.version)?p(z):Ae}).then(function(Ae){z.db=Q.db=Ae,G._dbInfo=z;for(var ze=0;ze<Ce.length;ze++){var yt=Ce[ze];yt!==G&&(yt._dbInfo.db=z.db,yt._dbInfo.version=z.version)}})}function j($,G){var z=this;$=b($);var Y=new f(function(Q,J){z.ready().then(function(){C(z._dbInfo,U,function(pe,we){if(pe)return J(pe);try{var Ee=we.objectStore(z._dbInfo.storeName),Ce=Ee.get($);Ce.onsuccess=function(){var Ae=Ce.result;Ae===void 0&&(Ae=null),A(Ae)&&(Ae=x(Ae)),Q(Ae)},Ce.onerror=function(){J(Ce.error)}}catch(Ae){J(Ae)}})}).catch(J)});return h(Y,G),Y}function ee($,G){var z=this,Y=new f(function(Q,J){z.ready().then(function(){C(z._dbInfo,U,function(pe,we){if(pe)return J(pe);try{var Ee=we.objectStore(z._dbInfo.storeName),Ce=Ee.openCursor(),Ae=1;Ce.onsuccess=function(){var ze=Ce.result;if(ze){var yt=ze.value;A(yt)&&(yt=x(yt));var $t=$(yt,ze.key,Ae++);$t!==void 0?Q($t):ze.continue()}else Q()},Ce.onerror=function(){J(Ce.error)}}catch(ze){J(ze)}})}).catch(J)});return h(Y,G),Y}function ie($,G,z){var Y=this;$=b($);var Q=new f(function(J,pe){var we;Y.ready().then(function(){return we=Y._dbInfo,N.call(G)==="[object Blob]"?X(we.db).then(function(Ee){return Ee?G:m(G)}):G}).then(function(Ee){C(Y._dbInfo,L,function(Ce,Ae){if(Ce)return pe(Ce);try{var ze=Ae.objectStore(Y._dbInfo.storeName);Ee===null&&(Ee=void 0);var yt=ze.put(Ee,$);Ae.oncomplete=function(){Ee===void 0&&(Ee=null),J(Ee)},Ae.onabort=Ae.onerror=function(){var $t=yt.error?yt.error:yt.transaction.error;pe($t)}}catch($t){pe($t)}})}).catch(pe)});return h(Q,z),Q}function fe($,G){var z=this;$=b($);var Y=new f(function(Q,J){z.ready().then(function(){C(z._dbInfo,L,function(pe,we){if(pe)return J(pe);try{var Ee=we.objectStore(z._dbInfo.storeName),Ce=Ee.delete($);we.oncomplete=function(){Q()},we.onerror=function(){J(Ce.error)},we.onabort=function(){var Ae=Ce.error?Ce.error:Ce.transaction.error;J(Ae)}}catch(Ae){J(Ae)}})}).catch(J)});return h(Y,G),Y}function ve($){var G=this,z=new f(function(Y,Q){G.ready().then(function(){C(G._dbInfo,L,function(J,pe){if(J)return Q(J);try{var we=pe.objectStore(G._dbInfo.storeName),Ee=we.clear();pe.oncomplete=function(){Y()},pe.onabort=pe.onerror=function(){var Ce=Ee.error?Ee.error:Ee.transaction.error;Q(Ce)}}catch(Ce){Q(Ce)}})}).catch(Q)});return h(z,$),z}function Se($){var G=this,z=new f(function(Y,Q){G.ready().then(function(){C(G._dbInfo,U,function(J,pe){if(J)return Q(J);try{var we=pe.objectStore(G._dbInfo.storeName),Ee=we.count();Ee.onsuccess=function(){Y(Ee.result)},Ee.onerror=function(){Q(Ee.error)}}catch(Ce){Q(Ce)}})}).catch(Q)});return h(z,$),z}function xe($,G){var z=this,Y=new f(function(Q,J){if($<0){Q(null);return}z.ready().then(function(){C(z._dbInfo,U,function(pe,we){if(pe)return J(pe);try{var Ee=we.objectStore(z._dbInfo.storeName),Ce=!1,Ae=Ee.openKeyCursor();Ae.onsuccess=function(){var ze=Ae.result;if(!ze){Q(null);return}$===0||Ce?Q(ze.key):(Ce=!0,ze.advance($))},Ae.onerror=function(){J(Ae.error)}}catch(ze){J(ze)}})}).catch(J)});return h(Y,G),Y}function He($){var G=this,z=new f(function(Y,Q){G.ready().then(function(){C(G._dbInfo,U,function(J,pe){if(J)return Q(J);try{var we=pe.objectStore(G._dbInfo.storeName),Ee=we.openKeyCursor(),Ce=[];Ee.onsuccess=function(){var Ae=Ee.result;if(!Ae){Y(Ce);return}Ce.push(Ae.key),Ae.continue()},Ee.onerror=function(){Q(Ee.error)}}catch(Ae){Q(Ae)}})}).catch(Q)});return h(z,$),z}function Fe($,G){G=w.apply(this,arguments);var z=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||z.name,$.storeName=$.storeName||z.storeName);var Y=this,Q;if(!$.name)Q=f.reject("Invalid arguments");else{var J=$.name===z.name&&Y._dbInfo.db,pe=J?f.resolve(Y._dbInfo.db):D($).then(function(we){var Ee=k[$.name],Ce=Ee.forages;Ee.db=we;for(var Ae=0;Ae<Ce.length;Ae++)Ce[Ae]._dbInfo.db=we;return we});$.storeName?Q=pe.then(function(we){if(we.objectStoreNames.contains($.storeName)){var Ee=we.version+1;re($);var Ce=k[$.name],Ae=Ce.forages;we.close();for(var ze=0;ze<Ae.length;ze++){var yt=Ae[ze];yt._dbInfo.db=null,yt._dbInfo.version=Ee}var $t=new f(function(zt,or){var ir=c.open($.name,Ee);ir.onerror=function(Qr){var aa=ir.result;aa.close(),or(Qr)},ir.onupgradeneeded=function(){var Qr=ir.result;Qr.deleteObjectStore($.storeName)},ir.onsuccess=function(){var Qr=ir.result;Qr.close(),zt(Qr)}});return $t.then(function(zt){Ce.db=zt;for(var or=0;or<Ae.length;or++){var ir=Ae[or];ir._dbInfo.db=zt,oe(ir._dbInfo)}}).catch(function(zt){throw(H($,zt)||f.resolve()).catch(function(){}),zt})}}):Q=pe.then(function(we){re($);var Ee=k[$.name],Ce=Ee.forages;we.close();for(var Ae=0;Ae<Ce.length;Ae++){var ze=Ce[Ae];ze._dbInfo.db=null}var yt=new f(function($t,zt){var or=c.deleteDatabase($.name);or.onerror=function(){var ir=or.result;ir&&ir.close(),zt(or.error)},or.onblocked=function(){console.warn('dropInstance blocked for database "'+$.name+'" until all open connections are closed')},or.onsuccess=function(){var ir=or.result;ir&&ir.close(),$t(ir)}});return yt.then(function($t){Ee.db=$t;for(var zt=0;zt<Ce.length;zt++){var or=Ce[zt];oe(or._dbInfo)}}).catch(function($t){throw(H($,$t)||f.resolve()).catch(function(){}),$t})})}return h(Q,G),Q}var dt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:j,setItem:ie,removeItem:fe,clear:ve,length:Se,key:xe,keys:He,dropInstance:Fe};function ht(){return typeof openDatabase=="function"}var De="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",_e=/^~~local_forage_type~([^~]+)~/,me="__lfsc__:",Me=me.length,Ve="arbf",Ne="blob",Te="si08",Oe="ui08",Le="uic8",ut="si16",lt="si32",We="ur16",kt="ui32",St="fl32",Ye="fl64",Mt=Me+Ve.length,Nt=Object.prototype.toString;function rt($){var G=$.length*.75,z=$.length,Y,Q=0,J,pe,we,Ee;$[$.length-1]==="="&&(G--,$[$.length-2]==="="&&G--);var Ce=new ArrayBuffer(G),Ae=new Uint8Array(Ce);for(Y=0;Y<z;Y+=4)J=De.indexOf($[Y]),pe=De.indexOf($[Y+1]),we=De.indexOf($[Y+2]),Ee=De.indexOf($[Y+3]),Ae[Q++]=J<<2|pe>>4,Ae[Q++]=(pe&15)<<4|we>>2,Ae[Q++]=(we&3)<<6|Ee&63;return Ce}function Et($){var G=new Uint8Array($),z="",Y;for(Y=0;Y<G.length;Y+=3)z+=De[G[Y]>>2],z+=De[(G[Y]&3)<<4|G[Y+1]>>4],z+=De[(G[Y+1]&15)<<2|G[Y+2]>>6],z+=De[G[Y+2]&63];return G.length%3===2?z=z.substring(0,z.length-1)+"=":G.length%3===1&&(z=z.substring(0,z.length-2)+"=="),z}function Tt($,G){var z="";if($&&(z=Nt.call($)),$&&(z==="[object ArrayBuffer]"||$.buffer&&Nt.call($.buffer)==="[object ArrayBuffer]")){var Y,Q=me;$ instanceof ArrayBuffer?(Y=$,Q+=Ve):(Y=$.buffer,z==="[object Int8Array]"?Q+=Te:z==="[object Uint8Array]"?Q+=Oe:z==="[object Uint8ClampedArray]"?Q+=Le:z==="[object Int16Array]"?Q+=ut:z==="[object Uint16Array]"?Q+=We:z==="[object Int32Array]"?Q+=lt:z==="[object Uint32Array]"?Q+=kt:z==="[object Float32Array]"?Q+=St:z==="[object Float64Array]"?Q+=Ye:G(new Error("Failed to get type for BinaryArray"))),G(Q+Et(Y))}else if(z==="[object Blob]"){var J=new FileReader;J.onload=function(){var pe=mt+$.type+"~"+Et(this.result);G(me+Ne+pe)},J.readAsArrayBuffer($)}else try{G(JSON.stringify($))}catch(pe){console.error("Couldn't convert value into a JSON string: ",$),G(null,pe)}}function it($){if($.substring(0,Me)!==me)return JSON.parse($);var G=$.substring(Mt),z=$.substring(Me,Mt),Y;if(z===Ne&&_e.test(G)){var Q=G.match(_e);Y=Q[1],G=G.substring(Q[0].length)}var J=rt(G);switch(z){case Ve:return J;case Ne:return l([J],{type:Y});case Te:return new Int8Array(J);case Oe:return new Uint8Array(J);case Le:return new Uint8ClampedArray(J);case ut:return new Int16Array(J);case We:return new Uint16Array(J);case lt:return new Int32Array(J);case kt:return new Uint32Array(J);case St:return new Float32Array(J);case Ye:return new Float64Array(J);default:throw new Error("Unkown type: "+z)}}var jt={serialize:Tt,deserialize:it,stringToBuffer:rt,bufferToString:Et};function It($,G,z,Y){$.executeSql("CREATE TABLE IF NOT EXISTS "+G.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],z,Y)}function nt($){var G=this,z={db:null};if($)for(var Y in $)z[Y]=typeof $[Y]!="string"?$[Y].toString():$[Y];var Q=new f(function(J,pe){try{z.db=openDatabase(z.name,String(z.version),z.description,z.size)}catch(we){return pe(we)}z.db.transaction(function(we){It(we,z,function(){G._dbInfo=z,J()},function(Ee,Ce){pe(Ce)})},pe)});return z.serializer=jt,Q}function bt($,G,z,Y,Q,J){$.executeSql(z,Y,Q,function(pe,we){we.code===we.SYNTAX_ERR?pe.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[G.storeName],function(Ee,Ce){Ce.rows.length?J(Ee,we):It(Ee,G,function(){Ee.executeSql(z,Y,Q,J)},J)},J):J(pe,we)},J)}function Ct($,G){var z=this;$=b($);var Y=new f(function(Q,J){z.ready().then(function(){var pe=z._dbInfo;pe.db.transaction(function(we){bt(we,pe,"SELECT * FROM "+pe.storeName+" WHERE key = ? LIMIT 1",[$],function(Ee,Ce){var Ae=Ce.rows.length?Ce.rows.item(0).value:null;Ae&&(Ae=pe.serializer.deserialize(Ae)),Q(Ae)},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function Je($,G){var z=this,Y=new f(function(Q,J){z.ready().then(function(){var pe=z._dbInfo;pe.db.transaction(function(we){bt(we,pe,"SELECT * FROM "+pe.storeName,[],function(Ee,Ce){for(var Ae=Ce.rows,ze=Ae.length,yt=0;yt<ze;yt++){var $t=Ae.item(yt),zt=$t.value;if(zt&&(zt=pe.serializer.deserialize(zt)),zt=$(zt,$t.key,yt+1),zt!==void 0){Q(zt);return}}Q()},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function gt($,G,z,Y){var Q=this;$=b($);var J=new f(function(pe,we){Q.ready().then(function(){G===void 0&&(G=null);var Ee=G,Ce=Q._dbInfo;Ce.serializer.serialize(G,function(Ae,ze){ze?we(ze):Ce.db.transaction(function(yt){bt(yt,Ce,"INSERT OR REPLACE INTO "+Ce.storeName+" (key, value) VALUES (?, ?)",[$,Ae],function(){pe(Ee)},function($t,zt){we(zt)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){pe(gt.apply(Q,[$,Ee,z,Y-1]));return}we(yt)}})})}).catch(we)});return h(J,z),J}function Pt($,G,z){return gt.apply(this,[$,G,z,1])}function st($,G){var z=this;$=b($);var Y=new f(function(Q,J){z.ready().then(function(){var pe=z._dbInfo;pe.db.transaction(function(we){bt(we,pe,"DELETE FROM "+pe.storeName+" WHERE key = ?",[$],function(){Q()},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function wt($){var G=this,z=new f(function(Y,Q){G.ready().then(function(){var J=G._dbInfo;J.db.transaction(function(pe){bt(pe,J,"DELETE FROM "+J.storeName,[],function(){Y()},function(we,Ee){Q(Ee)})})}).catch(Q)});return h(z,$),z}function Ut($){var G=this,z=new f(function(Y,Q){G.ready().then(function(){var J=G._dbInfo;J.db.transaction(function(pe){bt(pe,J,"SELECT COUNT(key) as c FROM "+J.storeName,[],function(we,Ee){var Ce=Ee.rows.item(0).c;Y(Ce)},function(we,Ee){Q(Ee)})})}).catch(Q)});return h(z,$),z}function R($,G){var z=this,Y=new f(function(Q,J){z.ready().then(function(){var pe=z._dbInfo;pe.db.transaction(function(we){bt(we,pe,"SELECT key FROM "+pe.storeName+" WHERE id = ? LIMIT 1",[$+1],function(Ee,Ce){var Ae=Ce.rows.length?Ce.rows.item(0).key:null;Q(Ae)},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function S($){var G=this,z=new f(function(Y,Q){G.ready().then(function(){var J=G._dbInfo;J.db.transaction(function(pe){bt(pe,J,"SELECT key FROM "+J.storeName,[],function(we,Ee){for(var Ce=[],Ae=0;Ae<Ee.rows.length;Ae++)Ce.push(Ee.rows.item(Ae).key);Y(Ce)},function(we,Ee){Q(Ee)})})}).catch(Q)});return h(z,$),z}function M($){return new f(function(G,z){$.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,J){for(var pe=[],we=0;we<J.rows.length;we++)pe.push(J.rows.item(we).name);G({db:$,storeNames:pe})},function(Q,J){z(J)})},function(Y){z(Y)})})}function B($,G){G=w.apply(this,arguments);var z=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||z.name,$.storeName=$.storeName||z.storeName);var Y=this,Q;return $.name?Q=new f(function(J){var pe;$.name===z.name?pe=Y._dbInfo.db:pe=openDatabase($.name,"","",0),$.storeName?J({db:pe,storeNames:[$.storeName]}):J(M(pe))}).then(function(J){return new f(function(pe,we){J.db.transaction(function(Ee){function Ce($t){return new f(function(zt,or){Ee.executeSql("DROP TABLE IF EXISTS "+$t,[],function(){zt()},function(ir,Qr){or(Qr)})})}for(var Ae=[],ze=0,yt=J.storeNames.length;ze<yt;ze++)Ae.push(Ce(J.storeNames[ze]));f.all(Ae).then(function(){pe()}).catch(function($t){we($t)})},function(Ee){we(Ee)})})}):Q=f.reject("Invalid arguments"),h(Q,G),Q}var K={_driver:"webSQLStorage",_initStorage:nt,_support:ht(),iterate:Je,getItem:Ct,setItem:Pt,removeItem:st,clear:wt,length:Ut,key:R,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function te($,G){var z=$.name+"/";return $.storeName!==G.storeName&&(z+=$.storeName+"/"),z}function $e(){var $="_localforage_support_test";try{return localStorage.setItem($,!0),localStorage.removeItem($),!1}catch{return!0}}function et(){return!$e()||localStorage.length>0}function Re($){var G=this,z={};if($)for(var Y in $)z[Y]=$[Y];return z.keyPrefix=te($,G._defaultConfig),et()?(G._dbInfo=z,z.serializer=jt,f.resolve()):f.reject()}function V($){var G=this,z=G.ready().then(function(){for(var Y=G._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var J=localStorage.key(Q);J.indexOf(Y)===0&&localStorage.removeItem(J)}});return h(z,$),z}function ae($,G){var z=this;$=b($);var Y=z.ready().then(function(){var Q=z._dbInfo,J=localStorage.getItem(Q.keyPrefix+$);return J&&(J=Q.serializer.deserialize(J)),J});return h(Y,G),Y}function he($,G){var z=this,Y=z.ready().then(function(){for(var Q=z._dbInfo,J=Q.keyPrefix,pe=J.length,we=localStorage.length,Ee=1,Ce=0;Ce<we;Ce++){var Ae=localStorage.key(Ce);if(Ae.indexOf(J)===0){var ze=localStorage.getItem(Ae);if(ze&&(ze=Q.serializer.deserialize(ze)),ze=$(ze,Ae.substring(pe),Ee++),ze!==void 0)return ze}}});return h(Y,G),Y}function ke($,G){var z=this,Y=z.ready().then(function(){var Q=z._dbInfo,J;try{J=localStorage.key($)}catch{J=null}return J&&(J=J.substring(Q.keyPrefix.length)),J});return h(Y,G),Y}function Ge($){var G=this,z=G.ready().then(function(){for(var Y=G._dbInfo,Q=localStorage.length,J=[],pe=0;pe<Q;pe++){var we=localStorage.key(pe);we.indexOf(Y.keyPrefix)===0&&J.push(we.substring(Y.keyPrefix.length))}return J});return h(z,$),z}function je($){var G=this,z=G.keys().then(function(Y){return Y.length});return h(z,$),z}function Ue($,G){var z=this;$=b($);var Y=z.ready().then(function(){var Q=z._dbInfo;localStorage.removeItem(Q.keyPrefix+$)});return h(Y,G),Y}function ot($,G,z){var Y=this;$=b($);var Q=Y.ready().then(function(){G===void 0&&(G=null);var J=G;return new f(function(pe,we){var Ee=Y._dbInfo;Ee.serializer.serialize(G,function(Ce,Ae){if(Ae)we(Ae);else try{localStorage.setItem(Ee.keyPrefix+$,Ce),pe(J)}catch(ze){(ze.name==="QuotaExceededError"||ze.name==="NS_ERROR_DOM_QUOTA_REACHED")&&we(ze),we(ze)}})})});return h(Q,z),Q}function Gt($,G){if(G=w.apply(this,arguments),$=typeof $!="function"&&$||{},!$.name){var z=this.config();$.name=$.name||z.name,$.storeName=$.storeName||z.storeName}var Y=this,Q;return $.name?Q=new f(function(J){$.storeName?J(te($,Y._defaultConfig)):J($.name+"/")}).then(function(J){for(var pe=localStorage.length-1;pe>=0;pe--){var we=localStorage.key(pe);we.indexOf(J)===0&&localStorage.removeItem(we)}}):Q=f.reject("Invalid arguments"),h(Q,G),Q}var Rt={_driver:"localStorageWrapper",_initStorage:Re,_support:Z(),iterate:he,getItem:ae,setItem:ot,removeItem:Ue,clear:V,length:je,key:ke,keys:Ge,dropInstance:Gt},Dt=function(G,z){return G===z||typeof G=="number"&&typeof z=="number"&&isNaN(G)&&isNaN(z)},Qt=function(G,z){for(var Y=G.length,Q=0;Q<Y;){if(Dt(G[Q],z))return!0;Q++}return!1},yr=Array.isArray||function($){return Object.prototype.toString.call($)==="[object Array]"},nr={},Kt={},gr={INDEXEDDB:dt,WEBSQL:K,LOCALSTORAGE:Rt},hn=[gr.INDEXEDDB._driver,gr.WEBSQL._driver,gr.LOCALSTORAGE._driver],Fr=["dropInstance"],pn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Fr),ci={description:"",driver:hn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ui($,G){$[G]=function(){var z=arguments;return $.ready().then(function(){return $[G].apply($,z)})}}function mn(){for(var $=1;$<arguments.length;$++){var G=arguments[$];if(G)for(var z in G)G.hasOwnProperty(z)&&(yr(G[z])?arguments[0][z]=G[z].slice():arguments[0][z]=G[z])}return arguments[0]}var li=function(){function $(G){o(this,$);for(var z in gr)if(gr.hasOwnProperty(z)){var Y=gr[z],Q=Y._driver;this[z]=Q,nr[Q]||this.defineDriver(Y)}this._defaultConfig=mn({},ci),this._config=mn({},this._defaultConfig,G),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return $.prototype.config=function(z){if((typeof z>"u"?"undefined":s(z))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var Y in z){if(Y==="storeName"&&(z[Y]=z[Y].replace(/\W/g,"_")),Y==="version"&&typeof z[Y]!="number")return new Error("Database version must be a number.");this._config[Y]=z[Y]}return"driver"in z&&z.driver?this.setDriver(this._config.driver):!0}else return typeof z=="string"?this._config[z]:this._config},$.prototype.defineDriver=function(z,Y,Q){var J=new f(function(pe,we){try{var Ee=z._driver,Ce=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!z._driver){we(Ce);return}for(var Ae=pn.concat("_initStorage"),ze=0,yt=Ae.length;ze<yt;ze++){var $t=Ae[ze],zt=!Qt(Fr,$t);if((zt||z[$t])&&typeof z[$t]!="function"){we(Ce);return}}var or=function(){for(var aa=function(hS){return function(){var pS=new Error("Method "+hS+" is not implemented by the current driver"),H0=f.reject(pS);return h(H0,arguments[arguments.length-1]),H0}},uf=0,dS=Fr.length;uf<dS;uf++){var lf=Fr[uf];z[lf]||(z[lf]=aa(lf))}};or();var ir=function(aa){nr[Ee]&&console.info("Redefining LocalForage driver: "+Ee),nr[Ee]=z,Kt[Ee]=aa,pe()};"_support"in z?z._support&&typeof z._support=="function"?z._support().then(ir,we):ir(!!z._support):ir(!0)}catch(Qr){we(Qr)}});return y(J,Y,Q),J},$.prototype.driver=function(){return this._driver||null},$.prototype.getDriver=function(z,Y,Q){var J=nr[z]?f.resolve(nr[z]):f.reject(new Error("Driver not found."));return y(J,Y,Q),J},$.prototype.getSerializer=function(z){var Y=f.resolve(jt);return y(Y,z),Y},$.prototype.ready=function(z){var Y=this,Q=Y._driverSet.then(function(){return Y._ready===null&&(Y._ready=Y._initDriver()),Y._ready});return y(Q,z,z),Q},$.prototype.setDriver=function(z,Y,Q){var J=this;yr(z)||(z=[z]);var pe=this._getSupportedDrivers(z);function we(){J._config.driver=J.driver()}function Ee(ze){return J._extend(ze),we(),J._ready=J._initStorage(J._config),J._ready}function Ce(ze){return function(){var yt=0;function $t(){for(;yt<ze.length;){var zt=ze[yt];return yt++,J._dbInfo=null,J._ready=null,J.getDriver(zt).then(Ee).catch($t)}we();var or=new Error("No available storage method found.");return J._driverSet=f.reject(or),J._driverSet}return $t()}}var Ae=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Ae.then(function(){var ze=pe[0];return J._dbInfo=null,J._ready=null,J.getDriver(ze).then(function(yt){J._driver=yt._driver,we(),J._wrapLibraryMethodsWithReady(),J._initDriver=Ce(pe)})}).catch(function(){we();var ze=new Error("No available storage method found.");return J._driverSet=f.reject(ze),J._driverSet}),y(this._driverSet,Y,Q),this._driverSet},$.prototype.supports=function(z){return!!Kt[z]},$.prototype._extend=function(z){mn(this,z)},$.prototype._getSupportedDrivers=function(z){for(var Y=[],Q=0,J=z.length;Q<J;Q++){var pe=z[Q];this.supports(pe)&&Y.push(pe)}return Y},$.prototype._wrapLibraryMethodsWithReady=function(){for(var z=0,Y=pn.length;z<Y;z++)ui(this,pn[z])},$.prototype.createInstance=function(z){return new $(z)},$}(),fi=new li;n.exports=fi},{3:3}]},{},[4])(4)})})(Ox);var VR=Ox.exports;const Aa=cc(VR);Aa.config({name:"CetusSite",storeName:"tokens"});class Ai{static async setItem(t,r){try{await Aa.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await Aa.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await Aa.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await Aa.clear()}catch(t){console.error("Failed to clear storage",t)}}}const kl=[{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}],Fu=[{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"}],HR="mainnet",WR={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"}},Uu=WR[HR],GR="0x45f3c0814d7be4aa5fbd32d7e3c40f3c062a2b63eaf5ec4f8c1539b5987b11af",KR=Lt("/images/birdeye-logo.png"),XR=Lt("/images/img-logo@2x.png"),JR=Lt("/images/logo_CoinGecko@2x.png"),YR=Lt("/images/logo_pyth.png");var Ba=(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.SPRINGSUI="SPRINGSUI",e.BLUEFIN="BLUEFIN",e.HAEDALPMM="HAEDALPMM",e.ALPHAFI="ALPHAFI",e))(Ba||{});const Ix={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},ZR={pyth:YR,coingecko:JR,birdeye:KR,Cetus:XR},fr={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"),SPRINGSUI:Lt("/images/aggregator-source/suilend.png"),BLUEFIN:Lt("/images/aggregator-source/bluefin.png"),HAEDALPMM:Lt("/images/aggregator-source/haedal.png"),ALPHAFI:Lt("/images/aggregator-source/stSui.png")},Px={CETUS:{name:"Cetus",id:"CETUS",logo:fr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:fr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:fr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:fr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:fr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:fr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:fr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:fr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:fr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:fr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:fr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:fr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:fr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:fr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:fr.SCALLOP,type:"other",sort:70},SPRINGSUI:{name:"SpringSui",id:"SPRINGSUI",logo:fr.SPRINGSUI,type:"other",sort:60},ALPHAFI:{name:"stSUI",id:"ALPHAFI",logo:fr.ALPHAFI,type:"other",sort:50}},wg=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},QR=e=>e?wg(e):wg,eN=e=>e;function tN(e,t=eN){const r=se.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return se.useDebugValue(r),r}const _g=e=>{const t=QR(e),r=n=>tN(t,n);return Object.assign(r,t),r},ji=e=>e?_g(e):_g;function rN(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 oh=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return oh(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return oh(n)(r)}}}},nN=(e,t)=>(r,n,i)=>{let s={storage:rN(()=>localStorage),partialize:w=>w,version:0,merge:(w,T)=>({...T,...w}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...w)},n,i);const l=()=>{const w=s.partialize({...n()});return u.setItem(s.name,{state:w,version:s.version})},f=i.setState;i.setState=(w,T)=>{f(w,T),l()};const h=e((...w)=>{r(...w),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var w,T;if(!u)return;o=!1,a.forEach(k=>{var N;return k((N=n())!=null?N:h)});const I=((T=s.onRehydrateStorage)==null?void 0:T.call(s,(w=n())!=null?w:h))||void 0;return oh(u.getItem.bind(u))(s.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==s.version){if(s.migrate){const N=s.migrate(k.state,k.version);return N instanceof Promise?N.then(U=>[!0,U]):[!0,N]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var N;const[U,L]=k;if(y=s.merge(L,(N=n())!=null?N:h),r(y,!0),U)return l()}).then(()=>{I==null||I(y,void 0),y=n(),o=!0,c.forEach(k=>k(y))}).catch(k=>{I==null||I(void 0,k)})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(u=w.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:w=>(a.add(w),()=>{a.delete(w)}),onFinishHydration:w=>(c.add(w),()=>{c.delete(w)})},s.skipHydration||b(),y||h},iN=nN,sN=(e,t)=>({ignoreWarnTokenMap:{},currentExplorer:kl[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:Fu,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:Fu[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(Ba),setProviders:r=>{e(()=>({providers:r}))},poolApiMap:{},setPoolApiMap:(r,n)=>{const i=t().poolApiMap;i[r]=n,e(()=>({poolApiMap:{...i}}))},mevProtect:!0,setMevProtect:r=>{e(()=>({mevProtect:r}))},setIgnoreWarnToken:r=>{const n=t().ignoreWarnTokenMap;n[Mi(r)]=!0,e(()=>({ignoreWarnTokenMap:{...n}}))}}),Lr=ji(iN(sN,{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}}}));function Xo(){const{currentExplorer:e}=Lr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${aN(n)}/${r}`:s=`${i}/${oN(n)}/${r}`,s}}}const oN=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"}},aN=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 _.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const f=r.includes(u);return _.jsx("span",{style:{lineHeight:"20px",fontSize:s,color:f?i:o,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var jx={exports:{}};/*!
|
|
50
|
+
Copyright (c) 2018 Jed Watson.
|
|
51
|
+
Licensed under the MIT License (MIT), see
|
|
52
|
+
http://jedwatson.github.io/classnames
|
|
53
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,n(a)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return r.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})(jx);var cN=jx.exports;const Jt=cc(cN);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 uN(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function jl(...e){return t=>e.forEach(r=>uN(r,t))}function Zt(...e){return P.useCallback(jl(...e),e)}function Jo(e,t=[]){let r=[];function n(s,o){const a=P.createContext(o),c=r.length;r=[...r,o];const u=f=>{var I;const{scope:h,children:y,...b}=f,w=((I=h==null?void 0:h[e])==null?void 0:I[c])||a,T=P.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})};u.displayName=s+"Provider";function l(f,h){var w;const y=((w=h==null?void 0:h[e])==null?void 0:w[c])||a,b=P.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=>P.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return P.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 P.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Ti=P.forwardRef((e,t)=>{const{children:r,...n}=e,i=P.Children.toArray(r),s=i.find(fN);if(s){const o=s.props.children,a=i.map(c=>c===s?P.Children.count(o)>1?P.Children.only(null):P.isValidElement(o)?o.props.children:null:c);return _.jsx(ah,{...n,ref:t,children:P.isValidElement(o)?P.cloneElement(o,void 0,a):null})}return _.jsx(ah,{...n,ref:t,children:r})});Ti.displayName="Slot";var ah=P.forwardRef((e,t)=>{const{children:r,...n}=e;if(P.isValidElement(r)){const i=hN(r);return P.cloneElement(r,{...dN(n,r.props),ref:t?jl(t,i):i})}return P.Children.count(r)>1?P.Children.only(null):null});ah.displayName="SlotClone";var Yo=({children:e})=>_.jsx(_.Fragment,{children:e});function fN(e){return P.isValidElement(e)&&e.type===Yo}function dN(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 hN(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 pN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Wt=pN.reduce((e,t)=>{const r=P.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?Ti:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rx(e,t){e&&zv.flushSync(()=>e.dispatchEvent(t))}function mr(e){const t=P.useRef(e);return P.useEffect(()=>{t.current=e}),P.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function mN(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e);P.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 gN="DismissableLayer",ch="dismissableLayer.update",vN="dismissableLayer.pointerDownOutside",yN="dismissableLayer.focusOutside",xg,Nx=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zp=P.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=P.useContext(Nx),[l,f]=P.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=P.useState({}),b=Zt(t,q=>f(q)),w=Array.from(u.layers),[T]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),I=w.indexOf(T),k=l?w.indexOf(l):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,U=k>=I,L=_N(q=>{const X=q.target,re=[...u.branches].some(oe=>oe.contains(X));!U||re||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),W=xN(q=>{const X=q.target;[...u.branches].some(oe=>oe.contains(X))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return mN(q=>{k===u.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&a&&(q.preventDefault(),a()))},h),P.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(xg=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),Sg(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=xg)}},[l,h,r,u]),P.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),Sg())},[l,u]),P.useEffect(()=>{const q=()=>y({});return document.addEventListener(ch,q),()=>document.removeEventListener(ch,q)},[]),_.jsx(Wt.div,{...c,ref:b,style:{pointerEvents:N?U?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,W.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,W.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,L.onPointerDownCapture)})});Zp.displayName=gN;var bN="DismissableLayerBranch",wN=P.forwardRef((e,t)=>{const r=P.useContext(Nx),n=P.useRef(null),i=Zt(t,n);return P.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),_.jsx(Wt.div,{...e,ref:i})});wN.displayName=bN;function _N(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){Dx(vN,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 xN(e,t=globalThis==null?void 0:globalThis.document){const r=mr(e),n=P.useRef(!1);return P.useEffect(()=>{const i=s=>{s.target&&!n.current&&Dx(yN,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 Sg(){const e=new CustomEvent(ch);document.dispatchEvent(e)}function Dx(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 ss=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},SN=P["useId".toString()]||(()=>{}),EN=0;function Ya(e){const[t,r]=P.useState(SN());return ss(()=>{e||r(n=>n??String(EN++))},[e]),e||(t?`radix-${t}`:"")}const CN=["top","right","bottom","left"],os=Math.min,Kr=Math.max,zu=Math.round,Dc=Math.floor,Jn=e=>({x:e,y:e}),AN={left:"right",right:"left",bottom:"top",top:"bottom"},MN={start:"end",end:"start"};function uh(e,t,r){return Kr(e,os(t,r))}function Oi(e,t){return typeof e=="function"?e(t):e}function Ii(e){return e.split("-")[0]}function Zo(e){return e.split("-")[1]}function Qp(e){return e==="x"?"y":"x"}function e0(e){return e==="y"?"height":"width"}function as(e){return["top","bottom"].includes(Ii(e))?"y":"x"}function t0(e){return Qp(as(e))}function TN(e,t,r){r===void 0&&(r=!1);const n=Zo(e),i=t0(e),s=e0(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Vu(o)),[o,Vu(o)]}function ON(e){const t=Vu(e);return[lh(e),t,lh(t)]}function lh(e){return e.replace(/start|end/g,t=>MN[t])}function IN(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 PN(e,t,r,n){const i=Zo(e);let s=IN(Ii(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(lh)))),s}function Vu(e){return e.replace(/left|right|bottom|top/g,t=>AN[t])}function kN(e){return{top:0,right:0,bottom:0,left:0,...e}}function $x(e){return typeof e!="number"?kN(e):{top:e,right:e,bottom:e,left:e}}function qu(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 Eg(e,t,r){let{reference:n,floating:i}=e;const s=as(t),o=t0(t),a=e0(o),c=Ii(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 jN=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}=Eg(u,n,c),h=n,y={},b=0;for(let w=0;w<a.length;w++){const{name:T,fn:I}=a[w],{x:k,y:N,data:U,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=k??l,f=N??f,y={...y,[T]:{...y[T],...U}},L&&b<=50&&(b++,typeof L=="object"&&(L.placement&&(h=L.placement),L.rects&&(u=L.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:l,y:f}=Eg(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}=Oi(t,e),b=$x(y),T=a[h?f==="floating"?"reference":"floating":f],I=qu(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(T)))==null||r?T:T.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),k=f==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),U=await(s.isElement==null?void 0:s.isElement(N))?await(s.getScale==null?void 0:s.getScale(N))||{x:1,y:1}:{x:1,y:1},L=qu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:k,offsetParent:N,strategy:c}):k);return{top:(I.top-L.top+b.top)/U.y,bottom:(L.bottom-I.bottom+b.bottom)/U.y,left:(I.left-L.left+b.left)/U.x,right:(L.right-I.right+b.right)/U.x}}const RN=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}=Oi(e,t)||{};if(u==null)return{};const f=$x(l),h={x:r,y:n},y=t0(i),b=e0(y),w=await o.getDimensions(u),T=y==="y",I=T?"top":"left",k=T?"bottom":"right",N=T?"clientHeight":"clientWidth",U=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[N]:0;(!q||!await(o.isElement==null?void 0:o.isElement(W)))&&(q=a.floating[N]||s.floating[b]);const X=U/2-L/2,re=q/2-w[b]/2-1,oe=os(f[I],re),H=os(f[k],re),F=oe,D=q-w[b]-H,p=q/2-w[b]/2+X,d=uh(F,p,D),m=!c.arrow&&Zo(i)!=null&&p!==d&&s.reference[b]/2-(p<F?oe:H)-w[b]/2<0,x=m?p<F?p-F:p-D:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),NN=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...T}=Oi(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const I=Ii(i),k=as(a),N=Ii(a)===a,U=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(N||!w?[Vu(a)]:ON(a)),W=b!=="none";!h&&W&&L.push(...PN(a,w,b,U));const q=[a,...L],X=await Za(t,T),re=[];let oe=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&re.push(X[I]),f){const p=TN(i,o,U);re.push(X[p[0]],X[p[1]])}if(oe=[...oe,{placement:i,overflows:re}],!re.every(p=>p<=0)){var H,F;const p=(((H=s.flip)==null?void 0:H.index)||0)+1,d=q[p];if(d)return{data:{index:p,overflows:oe},reset:{placement:d}};let m=(F=oe.filter(x=>x.overflows[0]<=0).sort((x,A)=>x.overflows[1]-A.overflows[1])[0])==null?void 0:F.placement;if(!m)switch(y){case"bestFit":{var D;const x=(D=oe.filter(A=>{if(W){const E=as(A.placement);return E===k||E==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((A,E)=>A[1]-E[1])[0])==null?void 0:D[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function Cg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ag(e){return CN.some(t=>e[t]>=0)}const DN=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Oi(e,t);switch(n){case"referenceHidden":{const s=await Za(t,{...i,elementContext:"reference"}),o=Cg(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Ag(o)}}}case"escaped":{const s=await Za(t,{...i,altBoundary:!0}),o=Cg(s,r.floating);return{data:{escapedOffsets:o,escaped:Ag(o)}}}default:return{}}}}};async function $N(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Ii(r),a=Zo(r),c=as(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Oi(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 BN=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=t,c=await $N(t,e);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},LN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:T=>{let{x:I,y:k}=T;return{x:I,y:k}}},...c}=Oi(e,t),u={x:r,y:n},l=await Za(t,c),f=as(Ii(i)),h=Qp(f);let y=u[h],b=u[f];if(s){const T=h==="y"?"top":"left",I=h==="y"?"bottom":"right",k=y+l[T],N=y-l[I];y=uh(k,y,N)}if(o){const T=f==="y"?"top":"left",I=f==="y"?"bottom":"right",k=b+l[T],N=b-l[I];b=uh(k,b,N)}const w=a.fn({...t,[h]:y,[f]:b});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[h]:s,[f]:o}}}}}},FN=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}=Oi(e,t),l={x:r,y:n},f=as(i),h=Qp(f);let y=l[h],b=l[f];const w=Oi(a,t),T=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const N=h==="y"?"height":"width",U=s.reference[h]-s.floating[N]+T.mainAxis,L=s.reference[h]+s.reference[N]-T.mainAxis;y<U?y=U:y>L&&(y=L)}if(u){var I,k;const N=h==="y"?"width":"height",U=["top","left"].includes(Ii(i)),L=s.reference[f]-s.floating[N]+(U&&((I=o.offset)==null?void 0:I[f])||0)+(U?0:T.crossAxis),W=s.reference[f]+s.reference[N]+(U?0:((k=o.offset)==null?void 0:k[f])||0)-(U?T.crossAxis:0);b<L?b=L:b>W&&(b=W)}return{[h]:y,[f]:b}}}},UN=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}=Oi(e,t),l=await Za(t,u),f=Ii(i),h=Zo(i),y=as(i)==="y",{width:b,height:w}=s.floating;let T,I;f==="top"||f==="bottom"?(T=f,I=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(I=f,T=h==="end"?"top":"bottom");const k=w-l.top-l.bottom,N=b-l.left-l.right,U=os(w-l[T],k),L=os(b-l[I],N),W=!t.middlewareData.shift;let q=U,X=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(X=N),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=k),W&&!h){const oe=Kr(l.left,0),H=Kr(l.right,0),F=Kr(l.top,0),D=Kr(l.bottom,0);y?X=b-2*(oe!==0||H!==0?oe+H:Kr(l.left,l.right)):q=w-2*(F!==0||D!==0?F+D:Kr(l.top,l.bottom))}await c({...t,availableWidth:X,availableHeight:q});const re=await o.getDimensions(a.floating);return b!==re.width||w!==re.height?{reset:{rects:!0}}:{}}}};function Rl(){return typeof window<"u"}function Qo(e){return Bx(e)?(e.nodeName||"").toLowerCase():"#document"}function Jr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function si(e){var t;return(t=(Bx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bx(e){return Rl()?e instanceof Node||e instanceof Jr(e).Node:!1}function In(e){return Rl()?e instanceof Element||e instanceof Jr(e).Element:!1}function ri(e){return Rl()?e instanceof HTMLElement||e instanceof Jr(e).HTMLElement:!1}function Mg(e){return!Rl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jr(e).ShadowRoot}function bc(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 zN(e){return["table","td","th"].includes(Qo(e))}function Nl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function r0(e){const t=n0(),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 VN(e){let t=cs(e);for(;ri(t)&&!Do(t);){if(r0(t))return t;if(Nl(t))return null;t=cs(t)}return null}function n0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Do(e){return["html","body","#document"].includes(Qo(e))}function Pn(e){return Jr(e).getComputedStyle(e)}function Dl(e){return In(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cs(e){if(Qo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Mg(e)&&e.host||si(e);return Mg(t)?t.host:t}function Lx(e){const t=cs(e);return Do(t)?e.ownerDocument?e.ownerDocument.body:e.body:ri(t)&&bc(t)?t:Lx(t)}function Qa(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=Lx(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Jr(i);if(s){const a=fh(o);return t.concat(o,o.visualViewport||[],bc(i)?i:[],a&&r?Qa(a):[])}return t.concat(i,Qa(i,[],r))}function fh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fx(e){const t=Pn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ri(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=zu(r)!==s||zu(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function i0(e){return In(e)?e:e.contextElement}function Mo(e){const t=i0(e);if(!ri(t))return Jn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=Fx(t);let o=(s?zu(r.width):r.width)/n,a=(s?zu(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const qN=Jn(0);function Ux(e){const t=Jr(e);return!n0()||!t.visualViewport?qN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function HN(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Jr(e)?!1:t}function Hs(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=i0(e);let o=Jn(1);t&&(n?In(n)&&(o=Mo(n)):o=Mo(e));const a=HN(s,r,n)?Ux(s):Jn(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,w=fh(b);for(;w&&n&&y!==b;){const T=Mo(w),I=w.getBoundingClientRect(),k=Pn(w),N=I.left+(w.clientLeft+parseFloat(k.paddingLeft))*T.x,U=I.top+(w.clientTop+parseFloat(k.paddingTop))*T.y;c*=T.x,u*=T.y,l*=T.x,f*=T.y,c+=N,u+=U,b=Jr(w),w=fh(b)}}return qu({width:l,height:f,x:c,y:u})}function s0(e,t){const r=Dl(e).scrollLeft;return t?t.left+r:Hs(si(e)).left+r}function zx(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:s0(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function WN(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=si(n),a=t?Nl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Jn(1);const l=Jn(0),f=ri(n);if((f||!f&&!s)&&((Qo(n)!=="body"||bc(o))&&(c=Dl(n)),ri(n))){const y=Hs(n);u=Mo(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?zx(o,c,!0):Jn(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 GN(e){return Array.from(e.getClientRects())}function KN(e){const t=si(e),r=Dl(e),n=e.ownerDocument.body,i=Kr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Kr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+s0(e);const a=-r.scrollTop;return Pn(n).direction==="rtl"&&(o+=Kr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function XN(e,t){const r=Jr(e),n=si(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=n0();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function JN(e,t){const r=Hs(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=ri(e)?Mo(e):Jn(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 Tg(e,t,r){let n;if(t==="viewport")n=XN(e,r);else if(t==="document")n=KN(si(e));else if(In(t))n=JN(t,r);else{const i=Ux(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return qu(n)}function Vx(e,t){const r=cs(e);return r===t||!In(r)||Do(r)?!1:Pn(r).position==="fixed"||Vx(r,t)}function YN(e,t){const r=t.get(e);if(r)return r;let n=Qa(e,[],!1).filter(a=>In(a)&&Qo(a)!=="body"),i=null;const s=Pn(e).position==="fixed";let o=s?cs(e):e;for(;In(o)&&!Do(o);){const a=Pn(o),c=r0(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||bc(o)&&!c&&Vx(e,o))?n=n.filter(l=>l!==o):i=a,o=cs(o)}return t.set(e,n),n}function ZN(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?Nl(t)?[]:YN(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=Tg(t,l,i);return u.top=Kr(f.top,u.top),u.right=os(f.right,u.right),u.bottom=os(f.bottom,u.bottom),u.left=Kr(f.left,u.left),u},Tg(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function QN(e){const{width:t,height:r}=Fx(e);return{width:t,height:r}}function eD(e,t,r){const n=ri(t),i=si(t),s=r==="fixed",o=Hs(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Jn(0);if(n||!n&&!s)if((Qo(t)!=="body"||bc(i))&&(a=Dl(t)),n){const h=Hs(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=s0(i));const u=i&&!n&&!s?zx(i,a):Jn(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 Kf(e){return Pn(e).position==="static"}function Og(e,t){if(!ri(e)||Pn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return si(e)===r&&(r=r.ownerDocument.body),r}function qx(e,t){const r=Jr(e);if(Nl(e))return r;if(!ri(e)){let i=cs(e);for(;i&&!Do(i);){if(In(i)&&!Kf(i))return i;i=cs(i)}return r}let n=Og(e,t);for(;n&&zN(n)&&Kf(n);)n=Og(n,t);return n&&Do(n)&&Kf(n)&&!r0(n)?r:n||VN(e)||r}const tD=async function(e){const t=this.getOffsetParent||qx,r=this.getDimensions,n=await r(e.floating);return{reference:eD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function rD(e){return Pn(e).direction==="rtl"}const nD={convertOffsetParentRelativeRectToViewportRelativeRect:WN,getDocumentElement:si,getClippingRect:ZN,getOffsetParent:qx,getElementRects:tD,getClientRects:GN,getDimensions:QN,getScale:Mo,isElement:In,isRTL:rD};function iD(e,t){let r=null,n;const i=si(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=Dc(l),b=Dc(i.clientWidth-(u+f)),w=Dc(i.clientHeight-(l+h)),T=Dc(u),k={rootMargin:-y+"px "+-b+"px "+-w+"px "+-T+"px",threshold:Kr(0,os(1,c))||1};let N=!0;function U(L){const W=L[0].intersectionRatio;if(W!==c){if(!N)return o();W?o(!1,W):n=setTimeout(()=>{o(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(U,{...k,root:i.ownerDocument})}catch{r=new IntersectionObserver(U,k)}r.observe(e)}return o(!0),s}function sD(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=i0(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?iD(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(I=>{let[k]=I;k&&k.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,w=c?Hs(e):null;c&&T();function T(){const I=Hs(e);w&&(I.x!==w.x||I.y!==w.y||I.width!==w.width||I.height!==w.height)&&r(),w=I,b=requestAnimationFrame(T)}return r(),()=>{var I;l.forEach(k=>{i&&k.removeEventListener("scroll",r),s&&k.removeEventListener("resize",r)}),f==null||f(),(I=y)==null||I.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const oD=BN,aD=LN,cD=NN,uD=UN,lD=DN,Ig=RN,fD=FN,dD=(e,t,r)=>{const n=new Map,i={platform:nD,...r},s={...i.platform,_c:n};return jN(e,t,{...i,platform:s})};var lu=typeof document<"u"?se.useLayoutEffect:se.useEffect;function Hu(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(!Hu(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)&&!Hu(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Hx(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pg(e,t){const r=Hx(e);return Math.round(t*r)/r}function Xf(e){const t=P.useRef(e);return lu(()=>{t.current=e}),t}function hD(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]=P.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,y]=P.useState(n);Hu(h,n)||y(n);const[b,w]=P.useState(null),[T,I]=P.useState(null),k=P.useCallback(A=>{A!==W.current&&(W.current=A,w(A))},[]),N=P.useCallback(A=>{A!==q.current&&(q.current=A,I(A))},[]),U=s||b,L=o||T,W=P.useRef(null),q=P.useRef(null),X=P.useRef(l),re=c!=null,oe=Xf(c),H=Xf(i),F=Xf(u),D=P.useCallback(()=>{if(!W.current||!q.current)return;const A={placement:t,strategy:r,middleware:h};H.current&&(A.platform=H.current),dD(W.current,q.current,A).then(E=>{const O={...E,isPositioned:F.current!==!1};p.current&&!Hu(X.current,O)&&(X.current=O,zv.flushSync(()=>{f(O)}))})},[h,t,r,H,F]);lu(()=>{u===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,f(A=>({...A,isPositioned:!1})))},[u]);const p=P.useRef(!1);lu(()=>(p.current=!0,()=>{p.current=!1}),[]),lu(()=>{if(U&&(W.current=U),L&&(q.current=L),U&&L){if(oe.current)return oe.current(U,L,D);D()}},[U,L,D,oe,re]);const d=P.useMemo(()=>({reference:W,floating:q,setReference:k,setFloating:N}),[k,N]),m=P.useMemo(()=>({reference:U,floating:L}),[U,L]),x=P.useMemo(()=>{const A={position:r,left:0,top:0};if(!m.floating)return A;const E=Pg(m.floating,l.x),O=Pg(m.floating,l.y);return a?{...A,transform:"translate("+E+"px, "+O+"px)",...Hx(m.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:E,top:O}},[r,a,m.floating,l.x,l.y]);return P.useMemo(()=>({...l,update:D,refs:d,elements:m,floatingStyles:x}),[l,D,d,m,x])}const pD=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?Ig({element:n.current,padding:i}).fn(r):{}:n?Ig({element:n,padding:i}).fn(r):{}}}},mD=(e,t)=>({...oD(e),options:[e,t]}),gD=(e,t)=>({...aD(e),options:[e,t]}),vD=(e,t)=>({...fD(e),options:[e,t]}),yD=(e,t)=>({...cD(e),options:[e,t]}),bD=(e,t)=>({...uD(e),options:[e,t]}),wD=(e,t)=>({...lD(e),options:[e,t]}),_D=(e,t)=>({...pD(e),options:[e,t]});var xD="Arrow",Wx=P.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...s}=e;return _.jsx(Wt.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:_.jsx("polygon",{points:"0,0 30,0 15,10"})})});Wx.displayName=xD;var SD=Wx;function ED(e,t=[]){let r=[];function n(s,o){const a=P.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,T=P.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=P.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=>P.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,CD(i,...t)]}function CD(...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 P.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function o0(e){const[t,r]=P.useState(void 0);return ss(()=>{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 a0="Popper",[Gx,$l]=ED(a0),[AD,Kx]=Gx(a0),Xx=e=>{const{__scopePopper:t,children:r}=e,[n,i]=P.useState(null);return _.jsx(AD,{scope:t,anchor:n,onAnchorChange:i,children:r})};Xx.displayName=a0;var Jx="PopperAnchor",Yx=P.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=Kx(Jx,r),o=P.useRef(null),a=Zt(t,o);return P.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:_.jsx(Wt.div,{...i,ref:a})});Yx.displayName=Jx;var c0="PopperContent",[MD,TD]=Gx(c0),Zx=P.forwardRef((e,t)=>{var fe,ve,Se,xe,He,Fe;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:l=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:y="optimized",onPlaced:b,...w}=e,T=Kx(c0,r),[I,k]=P.useState(null),N=Zt(t,dt=>k(dt)),[U,L]=P.useState(null),W=o0(U),q=(W==null?void 0:W.width)??0,X=(W==null?void 0:W.height)??0,re=n+(s!=="center"?"-"+s:""),oe=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},H=Array.isArray(u)?u:[u],F=H.length>0,D={padding:oe,boundary:H.filter(ID),altBoundary:F},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:A}=hD({strategy:"fixed",placement:re,whileElementsMounted:(...dt)=>sD(...dt,{animationFrame:y==="always"}),elements:{reference:T.anchor},middleware:[mD({mainAxis:i+X,alignmentAxis:o}),c&&gD({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?vD():void 0,...D}),c&&yD({...D}),bD({...D,apply:({elements:dt,rects:ht,availableWidth:De,availableHeight:mt})=>{const{width:_e,height:me}=ht.reference,Me=dt.floating.style;Me.setProperty("--radix-popper-available-width",`${De}px`),Me.setProperty("--radix-popper-available-height",`${mt}px`),Me.setProperty("--radix-popper-anchor-width",`${_e}px`),Me.setProperty("--radix-popper-anchor-height",`${me}px`)}}),U&&_D({element:U,padding:a}),PD({arrowWidth:q,arrowHeight:X}),h&&wD({strategy:"referenceHidden",...D})]}),[E,O]=t6(m),C=mr(b);ss(()=>{x&&(C==null||C())},[x,C]);const g=(fe=A.arrow)==null?void 0:fe.x,v=(ve=A.arrow)==null?void 0:ve.y,j=((Se=A.arrow)==null?void 0:Se.centerOffset)!==0,[ee,ie]=P.useState();return ss(()=>{I&&ie(window.getComputedStyle(I).zIndex)},[I]),_.jsx("div",{ref:p.setFloating,"data-radix-popper-content-wrapper":"",style:{...d,transform:x?d.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(xe=A.transformOrigin)==null?void 0:xe.x,(He=A.transformOrigin)==null?void 0:He.y].join(" "),...((Fe=A.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:_.jsx(MD,{scope:r,placedSide:E,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:j,children:_.jsx(Wt.div,{"data-side":E,"data-align":O,...w,ref:N,style:{...w.style,animation:x?void 0:"none"}})})})});Zx.displayName=c0;var Qx="PopperArrow",OD={top:"bottom",right:"left",bottom:"top",left:"right"},e6=P.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=TD(Qx,n),o=OD[s.placedSide];return _.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:_.jsx(SD,{...i,ref:r,style:{...i.style,display:"block"}})})});e6.displayName=Qx;function ID(e){return e!==null}var PD=e=>({name:"transformOrigin",options:e,fn(t){var T,I,k;const{placement:r,rects:n,middlewareData:i}=t,o=((T=i.arrow)==null?void 0:T.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=t6(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((I=i.arrow)==null?void 0:I.x)??0)+a/2,y=(((k=i.arrow)==null?void 0:k.y)??0)+c/2;let b="",w="";return u==="bottom"?(b=o?f:`${h}px`,w=`${-c}px`):u==="top"?(b=o?f:`${h}px`,w=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,w=o?f:`${y}px`):u==="left"&&(b=`${n.floating.width+c}px`,w=o?f:`${y}px`),{data:{x:b,y:w}}}});function t6(e){const[t,r="center"]=e.split("-");return[t,r]}var r6=Xx,n6=Yx,i6=Zx,s6=e6,kD="Portal",o6=P.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=P.useState(!1);ss(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?tl.createPortal(_.jsx(Wt.div,{...n,ref:t}),o):null});o6.displayName=kD;function jD(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var Rn=e=>{const{present:t,children:r}=e,n=RD(t),i=typeof r=="function"?r({present:n.isPresent}):P.Children.only(r),s=Zt(n.ref,ND(i));return typeof r=="function"||n.isPresent?P.cloneElement(i,{ref:s}):null};Rn.displayName="Presence";function RD(e){const[t,r]=P.useState(),n=P.useRef({}),i=P.useRef(e),s=P.useRef("none"),o=e?"mounted":"unmounted",[a,c]=jD(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const u=$c(n.current);s.current=a==="mounted"?u:"none"},[a]),ss(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=$c(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]),ss(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=$c(n.current).includes(y.animationName);if(y.target===t&&w&&(c("ANIMATION_END"),!i.current)){const T=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=T)})}},h=y=>{y.target===t&&(s.current=$c(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:P.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function $c(e){return(e==null?void 0:e.animationName)||"none"}function ND(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 wc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=DD({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=mr(r),c=P.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 DD({defaultProp:e,onChange:t}){const r=P.useState(e),[n]=r,i=P.useRef(n),s=mr(t);return P.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var $D="VisuallyHidden",a6=P.forwardRef((e,t)=>_.jsx(Wt.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));a6.displayName=$D;var BD=a6,[Bl,UK]=Jo("Tooltip",[$l]),u0=$l(),c6="TooltipProvider",LD=700,kg="tooltip.open",[FD,u6]=Bl(c6),l6=e=>{const{__scopeTooltip:t,delayDuration:r=LD,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:s}=e,[o,a]=P.useState(!0),c=P.useRef(!1),u=P.useRef(0);return P.useEffect(()=>{const l=u.current;return()=>window.clearTimeout(l)},[]),_.jsx(FD,{scope:t,isOpenDelayed:o,delayDuration:r,onOpen:P.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:P.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:P.useCallback(l=>{c.current=l},[]),disableHoverableContent:i,children:s})};l6.displayName=c6;var f6="Tooltip",[zK,Ll]=Bl(f6),dh="TooltipTrigger",UD=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Ll(dh,r),s=u6(dh,r),o=u0(r),a=P.useRef(null),c=Zt(t,a,i.onTriggerChange),u=P.useRef(!1),l=P.useRef(!1),f=P.useCallback(()=>u.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),_.jsx(n6,{asChild:!0,...o,children:_.jsx(Wt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:tt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:tt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:tt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:tt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:tt(e.onBlur,i.onClose),onClick:tt(e.onClick,i.onClose)})})});UD.displayName=dh;var zD="TooltipPortal",[VK,VD]=Bl(zD,{forceMount:void 0}),$o="TooltipContent",qD=P.forwardRef((e,t)=>{const r=VD($o,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=Ll($o,e.__scopeTooltip);return _.jsx(Rn,{present:n||o.open,children:o.disableHoverableContent?_.jsx(d6,{side:i,...s,ref:t}):_.jsx(HD,{side:i,...s,ref:t})})}),HD=P.forwardRef((e,t)=>{const r=Ll($o,e.__scopeTooltip),n=u6($o,e.__scopeTooltip),i=P.useRef(null),s=Zt(t,i),[o,a]=P.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:f}=n,h=P.useCallback(()=>{a(null),f(!1)},[f]),y=P.useCallback((b,w)=>{const T=b.currentTarget,I={x:b.clientX,y:b.clientY},k=XD(I,T.getBoundingClientRect()),N=JD(I,k),U=YD(w.getBoundingClientRect()),L=QD([...N,...U]);a(L),f(!0)},[f]);return P.useEffect(()=>()=>h(),[h]),P.useEffect(()=>{if(c&&l){const b=T=>y(T,l),w=T=>y(T,c);return c.addEventListener("pointerleave",b),l.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",w)}}},[c,l,y,h]),P.useEffect(()=>{if(o){const b=w=>{const T=w.target,I={x:w.clientX,y:w.clientY},k=(c==null?void 0:c.contains(T))||(l==null?void 0:l.contains(T)),N=!ZD(I,o);k?h():N&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),_.jsx(d6,{...e,ref:s})}),[WD,GD]=Bl(f6,{isInside:!1}),d6=P.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=Ll($o,r),u=u0(r),{onClose:l}=c;return P.useEffect(()=>(document.addEventListener(kg,l),()=>document.removeEventListener(kg,l)),[l]),P.useEffect(()=>{if(c.trigger){const f=h=>{const y=h.target;y!=null&&y.contains(c.trigger)&&l()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,l]),_.jsx(Zp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:_.jsxs(i6,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[_.jsx(Yo,{children:n}),_.jsx(WD,{scope:r,isInside:!0,children:_.jsx(BD,{id:c.contentId,role:"tooltip",children:i||n})})]})})});qD.displayName=$o;var h6="TooltipArrow",KD=P.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=u0(r);return GD(h6,r).isInside?null:_.jsx(s6,{...i,...n,ref:t})});KD.displayName=h6;function XD(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 JD(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 YD(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 ZD(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 QD(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),e$(t)}function e$(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 t$=l6,p6=P.createContext(void 0),r$=e=>{const{dir:t,children:r}=e;return _.jsx(p6.Provider,{value:t,children:r})};function l0(e){const t=P.useContext(p6);return e||t||"ltr"}const n$=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],i$=["sky","mint","lime","yellow","amber"],s$=["gold","bronze"],o$=[...n$,...i$,...s$],a$="gray",c$=["mauve","slate","sage","olive","sand"],u$=[a$,...c$];function l$(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 f$=["inherit","light","dark"],d$=[...o$,"gray"],h$=[...u$,"auto"],p$=["solid","translucent"],m$=["none","small","medium","large","full"],g$=["90%","95%","100%","105%","110%"],Rr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:f$,default:"inherit"},accentColor:{type:"enum",values:d$,default:"indigo"},grayColor:{type:"enum",values:h$,default:"auto"},panelBackground:{type:"enum",values:p$,default:"translucent"},radius:{type:"enum",values:m$,default:"medium"},scaling:{type:"enum",values:g$,default:"100%"}};function m6(e){return e==="gray"?"gray":l$(e)}const no=()=>{},Wu=P.createContext(void 0);function v$(){const e=P.useContext(Wu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const Fl=P.forwardRef((e,t)=>P.useContext(Wu)===void 0?P.createElement(t$,null,P.createElement(r$,{dir:"ltr"},P.createElement(g6,{...e,ref:t}))):P.createElement(f0,{...e,ref:t}));Fl.displayName="Theme";const g6=P.forwardRef((e,t)=>{const{appearance:r=Rr.appearance.default,accentColor:n=Rr.accentColor.default,grayColor:i=Rr.grayColor.default,panelBackground:s=Rr.panelBackground.default,radius:o=Rr.radius.default,scaling:a=Rr.scaling.default,hasBackground:c=Rr.hasBackground.default,...u}=e,[l,f]=P.useState(r);P.useEffect(()=>f(r),[r]);const[h,y]=P.useState(n);P.useEffect(()=>y(n),[n]);const[b,w]=P.useState(i);P.useEffect(()=>w(i),[i]);const[T,I]=P.useState(s);P.useEffect(()=>I(s),[s]);const[k,N]=P.useState(o);P.useEffect(()=>N(o),[o]);const[U,L]=P.useState(a);P.useEffect(()=>L(a),[a]);const W=P.memo(({appearance:X})=>P.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",P.useEffect(()=>y$(r),[r]);const q=b==="auto"?m6(h):b;return P.createElement(P.Fragment,null,l!=="inherit"&&P.createElement(W,{appearance:l}),c&&P.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
54
|
+
:root, .light, .light-theme { --color-page-background: white; }
|
|
55
|
+
.dark, .dark-theme { --color-page-background: var(--${q}-1); }
|
|
56
|
+
body { background-color: var(--color-page-background); }
|
|
57
|
+
`}}),P.createElement(f0,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:T,radius:k,scaling:U,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:I,onRadiusChange:N,onScalingChange:L}))});g6.displayName="ThemeRoot";const f0=P.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=P.useContext(Wu),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:Rr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:Rr.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:Rr.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:Rr.panelBackground.default,radius:T=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:Rr.radius.default,scaling:I=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:Rr.scaling.default,onAppearanceChange:k=no,onAccentColorChange:N=no,onGrayColorChange:U=no,onPanelBackgroundChange:L=no,onRadiusChange:W=no,onScalingChange:q=no,...X}=e,re=u?Ti:"div",oe=b==="auto"?m6(y):b,H=e.appearance!==void 0&&e.appearance!=="inherit",F=e.grayColor!==void 0,D=!l&&(f===!0||f!==!1&&(H||F));return P.createElement(Wu.Provider,{value:P.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:oe,panelBackground:w,radius:T,scaling:I,onAppearanceChange:k,onAccentColorChange:N,onGrayColorChange:U,onPanelBackgroundChange:L,onRadiusChange:W,onScalingChange:q}),[h,y,b,oe,w,T,I,k,N,U,L,W,q])},P.createElement(re,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":oe,"data-has-background":D?"true":"false","data-panel-background":w,"data-radius":T,"data-scaling":I,ref:t,...X,className:Jt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},X.className)}))});f0.displayName="ThemeImpl";function y$(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 _c={type:"enum",values:Rr.accentColor.values,default:void 0},Ul={type:"boolean",default:void 0};function xt(e,t="",r){var n,i,s,o;const a=[];if(typeof e=="object"){for(const c of Object.keys(e))if(c in e){const u=(n=e[c])===null||n===void 0?void 0:n.toString(),l=u==null?void 0:u.startsWith("-"),f=t===""?"":"-",h=l?`-${t}`:t,y=l?u==null?void 0:u.substring(1):u;if(y===void 0)continue;const b=(i=r==null?void 0:r[y])!==null&&i!==void 0?i:y,w=c==="initial"?`${h}${f}${b}`:`${c}:${h}${f}${b}`;a.push(w)}}if(typeof e=="string"){const c=e.startsWith("-"),u=t===""?"":"-",l=c?`-${t}`:t,f=c?e.substring(1):e,h=(s=r==null?void 0:r[f])!==null&&s!==void 0?s:f;a.push(`${l}${u}${h}`)}if(typeof e=="boolean"){const c=t===""?"":"-",u=e.toString(),l=(o=r==null?void 0:r[u])!==null&&o!==void 0?o:u;a.push(`${t}${c}${l}`)}return a.join(" ")}const ws=["0","1","2","3","4","5","6","7","8","9"],b$={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 w$(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 _$(e){return[xt(e.p,"rt-r-p"),xt(e.px,"rt-r-px"),xt(e.py,"rt-r-py"),xt(e.pt,"rt-r-pt"),xt(e.pr,"rt-r-pr"),xt(e.pb,"rt-r-pb"),xt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const x$=["static","relative","absolute","fixed","sticky"],ya=["auto","0","50%","100%"],jg=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],S$=["0","1"],E$=["0","1"],_r={...b$,position:{type:"enum",values:x$,default:void 0,responsive:!0},inset:{type:"enum",values:ya,default:void 0,responsive:!0},top:{type:"enum",values:ya,default:void 0,responsive:!0},right:{type:"enum",values:ya,default:void 0,responsive:!0},bottom:{type:"enum",values:ya,default:void 0,responsive:!0},left:{type:"enum",values:ya,default:void 0,responsive:!0},width:{type:"enum",values:jg,default:void 0,responsive:!0},height:{type:"enum",values:jg,default:void 0,responsive:!0},shrink:{type:"enum",values:S$,default:void 0,responsive:!0},grow:{type:"enum",values:E$,default:void 0,responsive:!0}};function C$(e){const{rest:t,...r}=w$(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 A$(e){return[_$(e),xt(e.position,"rt-r-position"),xt(e.shrink,"rt-r-fs"),xt(e.grow,"rt-r-fg"),xt(e.width,"rt-r-w"),xt(e.height,"rt-r-h"),xt(e.inset,"rt-r-inset"),xt(e.top,"rt-r-top"),xt(e.bottom,"rt-r-bottom"),xt(e.left,"rt-r-left"),xt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const _s=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],xs={m:{type:"enum",values:_s,default:void 0,responsive:!0},mx:{type:"enum",values:_s,default:void 0,responsive:!0},my:{type:"enum",values:_s,default:void 0,responsive:!0},mt:{type:"enum",values:_s,default:void 0,responsive:!0},mr:{type:"enum",values:_s,default:void 0,responsive:!0},mb:{type:"enum",values:_s,default:void 0,responsive:!0},ml:{type:"enum",values:_s,default:void 0,responsive:!0}};function ea(e){const{m:t=xs.m.default,mx:r=xs.mx.default,my:n=xs.my.default,mt:i=xs.mt.default,mr:s=xs.mr.default,mb:o=xs.mb.default,ml:a=xs.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function ta(e){return[xt(e.m,"rt-r-m"),xt(e.mx,"rt-r-mx"),xt(e.my,"rt-r-my"),xt(e.mt,"rt-r-mt"),xt(e.mr,"rt-r-mr"),xt(e.mb,"rt-r-mb"),xt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const d0={type:"enum",values:Rr.radius.values,default:void 0},M$=["none","inline-flex","flex"],T$=["row","column","row-reverse","column-reverse"],O$=["start","center","end","baseline","stretch"],I$=["start","center","end","between"],P$=["nowrap","wrap","wrap-reverse"],k$=["0","1","2","3","4","5","6","7","8","9"],io={display:{type:"enum",values:M$,default:"flex",responsive:!0},direction:{type:"enum",values:T$,default:void 0,responsive:!0},align:{type:"enum",values:O$,default:void 0,responsive:!0},justify:{type:"enum",values:I$,default:"start",responsive:!0},wrap:{type:"enum",values:P$,default:void 0,responsive:!0},gap:{type:"enum",values:k$,default:void 0,responsive:!0}},v6=P.forwardRef((e,t)=>{const{rest:r,...n}=ea(e),{rest:i,...s}=C$(r),{className:o,asChild:a,display:c=io.display.default,direction:u=io.direction.default,align:l=io.align.default,justify:f=io.justify.default,wrap:h=io.wrap.default,gap:y=io.gap.default,...b}=i,w=a?Ti:"div";return P.createElement(w,{...b,ref:t,className:Jt("rt-Flex",o,xt(c,"rt-r-display"),xt(u,"rt-r-fd"),xt(l,"rt-r-ai"),xt(f,"rt-r-jc",{between:"space-between"}),xt(h,"rt-r-fw"),xt(y,"rt-r-gap"),A$(s),ta(n))})});v6.displayName="Flex";function y6(e){const t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var h0="Checkbox",[j$,qK]=Jo(h0),[R$,N$]=j$(h0),b6=P.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]=P.useState(null),b=Zt(t,U=>y(U)),w=P.useRef(!1),T=h?l||!!h.closest("form"):!0,[I=!1,k]=wc({prop:i,defaultProp:s,onChange:u}),N=P.useRef(I);return P.useEffect(()=>{const U=h==null?void 0:h.form;if(U){const L=()=>k(N.current);return U.addEventListener("reset",L),()=>U.removeEventListener("reset",L)}},[h,k]),_.jsxs(R$,{scope:r,state:I,disabled:a,children:[_.jsx(Wt.button,{type:"button",role:"checkbox","aria-checked":es(I)?"mixed":I,"aria-required":o,"data-state":x6(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:tt(e.onKeyDown,U=>{U.key==="Enter"&&U.preventDefault()}),onClick:tt(e.onClick,U=>{k(L=>es(L)?!0:!L),T&&(w.current=U.isPropagationStopped(),w.current||U.stopPropagation())})}),T&&_.jsx(D$,{control:h,bubbles:!w.current,name:n,value:c,checked:I,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:es(s)?!1:s})]})});b6.displayName=h0;var w6="CheckboxIndicator",_6=P.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=N$(w6,r);return _.jsx(Rn,{present:n||es(s.state)||s.state===!0,children:_.jsx(Wt.span,{"data-state":x6(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});_6.displayName=w6;var D$=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=P.useRef(null),a=y6(r),c=o0(t);P.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=es(r),y.call(l,es(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=P.useRef(es(r)?!1:r);return _.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...s,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function es(e){return e==="indeterminate"}function x6(e){return es(e)?"indeterminate":e?"checked":"unchecked"}var $$=b6,B$=_6;const L$=["1","2","3"],F$=["classic","surface","soft"],Bc={size:{type:"enum",values:L$,default:"2",responsive:!0},variant:{type:"enum",values:F$,default:"surface"},color:_c,highContrast:Ul},zl=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.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"})));zl.displayName="ThickCheckIcon";const U$=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.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"})));U$.displayName="ChevronDownIcon";const S6=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.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"})));S6.displayName="ThickChevronRightIcon";const z$=P.forwardRef(({color:e="currentColor",...t},r)=>P.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,ref:r},P.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"})));z$.displayName="InfoCircledIcon";const Vl=P.forwardRef((e,t)=>{const{rest:r,...n}=ea(e),{className:i,style:s,size:o=Bc.size.default,variant:a=Bc.variant.default,color:c=Bc.color.default,highContrast:u=Bc.highContrast.default,...l}=r;return P.createElement("span",{className:Jt("rt-CheckboxRoot",i,xt(o,"rt-r-size"),ta(n)),style:s},P.createElement($$,{"data-accent-color":c,...l,ref:t,className:Jt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},P.createElement(B$,{className:"rt-CheckboxIndicator"},P.createElement(zl,{className:"rt-CheckboxIndicatorIcon"}))))});Vl.displayName="Checkbox";function V$(e,t=[]){let r=[];function n(s,o){const a=P.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,T=P.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=P.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=>P.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,q$(i,...t)]}function q$(...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 P.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function E6(e){const t=e+"CollectionProvider",[r,n]=V$(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,T=se.useRef(null),I=se.useRef(new Map).current;return _.jsx(i,{scope:b,itemMap:I,collectionRef:T,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=se.forwardRef((y,b)=>{const{scope:w,children:T}=y,I=s(a,w),k=Zt(b,I.collectionRef);return _.jsx(Ti,{ref:k,children:T})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=se.forwardRef((y,b)=>{const{scope:w,children:T,...I}=y,k=se.useRef(null),N=Zt(b,k),U=s(u,w);return se.useEffect(()=>(U.itemMap.set(k,{ref:k,...I}),()=>void U.itemMap.delete(k))),_.jsx(Ti,{[l]:"",ref:N,children:T})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return se.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const I=Array.from(T.querySelectorAll(`[${l}]`));return Array.from(b.itemMap.values()).sort((U,L)=>I.indexOf(U.ref.current)-I.indexOf(L.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,n]}function H$(e,t=[]){let r=[];function n(s,o){const a=P.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,T=P.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=P.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=>P.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,W$(i,...t)]}function W$(...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 P.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Jf="rovingFocusGroup.onEntryFocus",G$={bubbles:!1,cancelable:!0},ql="RovingFocusGroup",[hh,C6,K$]=E6(ql),[X$,A6]=H$(ql,[K$]),[J$,Y$]=X$(ql),M6=P.forwardRef((e,t)=>_.jsx(hh.Provider,{scope:e.__scopeRovingFocusGroup,children:_.jsx(hh.Slot,{scope:e.__scopeRovingFocusGroup,children:_.jsx(Z$,{...e,ref:t})})}));M6.displayName=ql;var Z$=P.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=P.useRef(null),y=Zt(t,h),b=l0(s),[w=null,T]=wc({prop:o,defaultProp:a,onChange:c}),[I,k]=P.useState(!1),N=mr(u),U=C6(r),L=P.useRef(!1),[W,q]=P.useState(0);return P.useEffect(()=>{const X=h.current;if(X)return X.addEventListener(Jf,N),()=>X.removeEventListener(Jf,N)},[N]),_.jsx(J$,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:w,onItemFocus:P.useCallback(X=>T(X),[T]),onItemShiftTab:P.useCallback(()=>k(!0),[]),onFocusableItemAdd:P.useCallback(()=>q(X=>X+1),[]),onFocusableItemRemove:P.useCallback(()=>q(X=>X-1),[]),children:_.jsx(Wt.div,{tabIndex:I||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 re=!L.current;if(X.target===X.currentTarget&&re&&!I){const oe=new CustomEvent(Jf,G$);if(X.currentTarget.dispatchEvent(oe),!oe.defaultPrevented){const H=U().filter(m=>m.focusable),F=H.find(m=>m.active),D=H.find(m=>m.id===w),d=[F,D,...H].filter(Boolean).map(m=>m.ref.current);I6(d,l)}}L.current=!1}),onBlur:tt(e.onBlur,()=>k(!1))})})}),T6="RovingFocusGroupItem",O6=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=Ya(),c=s||a,u=Y$(T6,r),l=u.currentTabStopId===c,f=C6(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return P.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),_.jsx(hh.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:_.jsx(Wt.span,{tabIndex:l?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:tt(e.onMouseDown,b=>{n?u.onItemFocus(c):b.preventDefault()}),onFocus:tt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:tt(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=tB(b,u.orientation,u.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let I=f().filter(k=>k.focusable).map(k=>k.ref.current);if(w==="last")I.reverse();else if(w==="prev"||w==="next"){w==="prev"&&I.reverse();const k=I.indexOf(b.currentTarget);I=u.loop?rB(I,k+1):I.slice(k+1)}setTimeout(()=>I6(I))}})})})});O6.displayName=T6;var Q$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function eB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function tB(e,t,r){const n=eB(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Q$[n]}function I6(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function rB(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var nB=M6,iB=O6;function sB(e,[t,r]){return Math.min(r,Math.max(t,e))}var Yf=0;function oB(){P.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Rg()),document.body.insertAdjacentElement("beforeend",e[1]??Rg()),Yf++,()=>{Yf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Yf--}},[])}function Rg(){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 Zf="focusScope.autoFocusOnMount",Qf="focusScope.autoFocusOnUnmount",Ng={bubbles:!1,cancelable:!0},aB="FocusScope",P6=P.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=P.useState(null),u=mr(i),l=mr(s),f=P.useRef(null),h=Zt(t,w=>c(w)),y=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(n){let w=function(N){if(y.paused||!a)return;const U=N.target;a.contains(U)?f.current=U:zi(f.current,{select:!0})},T=function(N){if(y.paused||!a)return;const U=N.relatedTarget;U!==null&&(a.contains(U)||zi(f.current,{select:!0}))},I=function(N){if(document.activeElement===document.body)for(const L of N)L.removedNodes.length>0&&zi(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",T);const k=new MutationObserver(I);return a&&k.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",T),k.disconnect()}}},[n,a,y.paused]),P.useEffect(()=>{if(a){$g.add(y);const w=document.activeElement;if(!a.contains(w)){const I=new CustomEvent(Zf,Ng);a.addEventListener(Zf,u),a.dispatchEvent(I),I.defaultPrevented||(cB(hB(k6(a)),{select:!0}),document.activeElement===w&&zi(a))}return()=>{a.removeEventListener(Zf,u),setTimeout(()=>{const I=new CustomEvent(Qf,Ng);a.addEventListener(Qf,l),a.dispatchEvent(I),I.defaultPrevented||zi(w??document.body,{select:!0}),a.removeEventListener(Qf,l),$g.remove(y)},0)}}},[a,u,l,y]);const b=P.useCallback(w=>{if(!r&&!n||y.paused)return;const T=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,I=document.activeElement;if(T&&I){const k=w.currentTarget,[N,U]=uB(k);N&&U?!w.shiftKey&&I===U?(w.preventDefault(),r&&zi(N,{select:!0})):w.shiftKey&&I===N&&(w.preventDefault(),r&&zi(U,{select:!0})):I===k&&w.preventDefault()}},[r,n,y.paused]);return _.jsx(Wt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});P6.displayName=aB;function cB(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(zi(n,{select:t}),document.activeElement!==r)return}function uB(e){const t=k6(e),r=Dg(t,e),n=Dg(t.reverse(),e);return[r,n]}function k6(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 Dg(e,t){for(const r of e)if(!lB(r,{upTo:t}))return r}function lB(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 fB(e){return e instanceof HTMLInputElement&&"select"in e}function zi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&fB(e)&&t&&e.select()}}var $g=dB();function dB(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Bg(e,t),e.unshift(t)},remove(t){var r;e=Bg(e,t),(r=e[0])==null||r.resume()}}}function Bg(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function hB(e){return e.filter(t=>t.tagName!=="A")}var pB=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},so=new WeakMap,Lc=new WeakMap,Fc={},ed=0,j6=function(e){return e&&(e.host||j6(e.parentNode))},mB=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=j6(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})},gB=function(e,t,r,n){var i=mB(t,Array.isArray(e)?e:[e]);Fc[r]||(Fc[r]=new WeakMap);var s=Fc[r],o=[],a=new Set,c=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var l=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))l(h);else try{var y=h.getAttribute(n),b=y!==null&&y!=="false",w=(so.get(h)||0)+1,T=(s.get(h)||0)+1;so.set(h,w),s.set(h,T),o.push(h),w===1&&b&&Lc.set(h,!0),T===1&&h.setAttribute(r,"true"),b||h.setAttribute(n,"true")}catch(I){console.error("aria-hidden: cannot operate on ",h,I)}})};return l(t),a.clear(),ed++,function(){o.forEach(function(f){var h=so.get(f)-1,y=s.get(f)-1;so.set(f,h),s.set(f,y),h||(Lc.has(f)||f.removeAttribute(n),Lc.delete(f)),y||f.removeAttribute(r)}),ed--,ed||(so=new WeakMap,so=new WeakMap,Lc=new WeakMap,Fc={})}},vB=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||pB(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),gB(n,i,r,"aria-hidden")):function(){return null}},Gn=function(){return Gn=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},Gn.apply(this,arguments)};function R6(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 yB(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var fu="right-scroll-bar-position",du="width-before-scroll-bar",bB="with-scroll-bars-hidden",wB="--removed-body-scroll-bar-size";function td(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function _B(e,t){var r=se.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 xB=typeof window<"u"?P.useLayoutEffect:P.useEffect,Lg=new WeakMap;function SB(e,t){var r=_B(t||null,function(n){return e.forEach(function(i){return td(i,n)})});return xB(function(){var n=Lg.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||td(a,null)}),s.forEach(function(a){i.has(a)||td(a,o)})}Lg.set(r,e)},[e]),r}function EB(e){return e}function CB(e,t){t===void 0&&(t=EB);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 AB(e){e===void 0&&(e={});var t=CB(null);return t.options=Gn({async:!0,ssr:!1},e),t}var N6=function(e){var t=e.sideCar,r=R6(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 P.createElement(n,Gn({},r))};N6.isSideCarExport=!0;function MB(e,t){return e.useMedium(t),N6}var D6=AB(),rd=function(){},Hl=P.forwardRef(function(e,t){var r=P.useRef(null),n=P.useState({onScrollCapture:rd,onWheelCapture:rd,onTouchMoveCapture:rd}),i=n[0],s=n[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,l=e.enabled,f=e.shards,h=e.sideCar,y=e.noIsolation,b=e.inert,w=e.allowPinchZoom,T=e.as,I=T===void 0?"div":T,k=e.gapMode,N=R6(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),U=h,L=SB([r,t]),W=Gn(Gn({},N),i);return P.createElement(P.Fragment,null,l&&P.createElement(U,{sideCar:D6,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:k}),o?P.cloneElement(P.Children.only(a),Gn(Gn({},W),{ref:L})):P.createElement(I,Gn({},W,{className:c,ref:L}),a))});Hl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hl.classNames={fullWidth:du,zeroRight:fu};var Fg,TB=function(){if(Fg)return Fg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function OB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=TB();return t&&e.setAttribute("nonce",t),e}function IB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function PB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var kB=function(){var e=0,t=null;return{add:function(r){e==0&&(t=OB())&&(IB(t,r),PB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},jB=function(){var e=kB();return function(t,r){P.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},$6=function(){var e=jB(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},RB={left:0,top:0,right:0,gap:0},nd=function(e){return parseInt(e||"",10)||0},NB=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[nd(r),nd(n),nd(i)]},DB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return RB;var t=NB(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])}},$B=$6(),To="data-scroll-locked",BB=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(bB,` {
|
|
59
|
+
overflow: hidden `).concat(n,`;
|
|
60
|
+
padding-right: `).concat(a,"px ").concat(n,`;
|
|
61
|
+
}
|
|
62
|
+
body[`).concat(To,`] {
|
|
63
|
+
overflow: hidden `).concat(n,`;
|
|
64
|
+
overscroll-behavior: contain;
|
|
65
|
+
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
66
|
+
padding-left: `.concat(i,`px;
|
|
67
|
+
padding-top: `).concat(s,`px;
|
|
68
|
+
padding-right: `).concat(o,`px;
|
|
69
|
+
margin-left:0;
|
|
70
|
+
margin-top:0;
|
|
71
|
+
margin-right: `).concat(a,"px ").concat(n,`;
|
|
72
|
+
`),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.`).concat(fu,` {
|
|
76
|
+
right: `).concat(a,"px ").concat(n,`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.`).concat(du,` {
|
|
80
|
+
margin-right: `).concat(a,"px ").concat(n,`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.`).concat(fu," .").concat(fu,` {
|
|
84
|
+
right: 0 `).concat(n,`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.`).concat(du," .").concat(du,` {
|
|
88
|
+
margin-right: 0 `).concat(n,`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
body[`).concat(To,`] {
|
|
92
|
+
`).concat(wB,": ").concat(a,`px;
|
|
93
|
+
}
|
|
94
|
+
`)},Ug=function(){var e=parseInt(document.body.getAttribute(To)||"0",10);return isFinite(e)?e:0},LB=function(){P.useEffect(function(){return document.body.setAttribute(To,(Ug()+1).toString()),function(){var e=Ug()-1;e<=0?document.body.removeAttribute(To):document.body.setAttribute(To,e.toString())}},[])},FB=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;LB();var s=P.useMemo(function(){return DB(i)},[i]);return P.createElement($B,{styles:BB(s,!t,i,r?"":"!important")})},ph=!1;if(typeof window<"u")try{var Uc=Object.defineProperty({},"passive",{get:function(){return ph=!0,!0}});window.addEventListener("test",Uc,Uc),window.removeEventListener("test",Uc,Uc)}catch{ph=!1}var oo=ph?{passive:!1}:!1,UB=function(e){return e.tagName==="TEXTAREA"},B6=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!UB(e)&&r[t]==="visible")},zB=function(e){return B6(e,"overflowY")},VB=function(e){return B6(e,"overflowX")},zg=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=L6(e,n);if(i){var s=F6(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},qB=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},HB=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},L6=function(e,t){return e==="v"?zB(t):VB(t)},F6=function(e,t){return e==="v"?qB(t):HB(t)},WB=function(e,t){return e==="h"&&t==="rtl"?-1:1},GB=function(e,t,r,n,i){var s=WB(e,window.getComputedStyle(t).direction),o=s*n,a=r.target,c=t.contains(a),u=!1,l=o>0,f=0,h=0;do{var y=F6(e,a),b=y[0],w=y[1],T=y[2],I=w-T-s*b;(b||I)&&L6(e,a)&&(f+=I,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},zc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vg=function(e){return[e.deltaX,e.deltaY]},qg=function(e){return e&&"current"in e?e.current:e},KB=function(e,t){return e[0]===t[0]&&e[1]===t[1]},XB=function(e){return`
|
|
95
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
96
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
97
|
+
`)},JB=0,ao=[];function YB(e){var t=P.useRef([]),r=P.useRef([0,0]),n=P.useRef(),i=P.useState(JB++)[0],s=P.useState($6)[0],o=P.useRef(e);P.useEffect(function(){o.current=e},[e]),P.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=yB([e.lockRef.current],(e.shards||[]).map(qg),!0).filter(Boolean);return w.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=P.useCallback(function(w,T){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var I=zc(w),k=r.current,N="deltaX"in w?w.deltaX:k[0]-I[0],U="deltaY"in w?w.deltaY:k[1]-I[1],L,W=w.target,q=Math.abs(N)>Math.abs(U)?"h":"v";if("touches"in w&&q==="h"&&W.type==="range")return!1;var X=zg(q,W);if(!X)return!0;if(X?L=q:(L=q==="v"?"h":"v",X=zg(q,W)),!X)return!1;if(!n.current&&"changedTouches"in w&&(N||U)&&(n.current=L),!L)return!0;var re=n.current||L;return GB(re,T,w,re==="h"?N:U,!0)},[]),c=P.useCallback(function(w){var T=w;if(!(!ao.length||ao[ao.length-1]!==s)){var I="deltaY"in T?Vg(T):zc(T),k=t.current.filter(function(L){return L.name===T.type&&(L.target===T.target||T.target===L.shadowParent)&&KB(L.delta,I)})[0];if(k&&k.should){T.cancelable&&T.preventDefault();return}if(!k){var N=(o.current.shards||[]).map(qg).filter(Boolean).filter(function(L){return L.contains(T.target)}),U=N.length>0?a(T,N[0]):!o.current.noIsolation;U&&T.cancelable&&T.preventDefault()}}},[]),u=P.useCallback(function(w,T,I,k){var N={name:w,delta:T,target:I,should:k,shadowParent:ZB(I)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(U){return U!==N})},1)},[]),l=P.useCallback(function(w){r.current=zc(w),n.current=void 0},[]),f=P.useCallback(function(w){u(w.type,Vg(w),w.target,a(w,e.lockRef.current))},[]),h=P.useCallback(function(w){u(w.type,zc(w),w.target,a(w,e.lockRef.current))},[]);P.useEffect(function(){return ao.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,oo),document.addEventListener("touchmove",c,oo),document.addEventListener("touchstart",l,oo),function(){ao=ao.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,oo),document.removeEventListener("touchmove",c,oo),document.removeEventListener("touchstart",l,oo)}},[]);var y=e.removeScrollBar,b=e.inert;return P.createElement(P.Fragment,null,b?P.createElement(s,{styles:XB(i)}):null,y?P.createElement(FB,{gapMode:e.gapMode}):null)}function ZB(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const QB=MB(D6,YB);var U6=P.forwardRef(function(e,t){return P.createElement(Hl,Gn({},e,{ref:t,sideCar:QB}))});U6.classNames=Hl.classNames;const eL=U6;function tL(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var p0="ScrollArea",[z6,HK]=Jo(p0),[rL,fn]=z6(p0),V6=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=P.useState(null),[u,l]=P.useState(null),[f,h]=P.useState(null),[y,b]=P.useState(null),[w,T]=P.useState(null),[I,k]=P.useState(0),[N,U]=P.useState(0),[L,W]=P.useState(!1),[q,X]=P.useState(!1),re=Zt(t,H=>c(H)),oe=l0(i);return _.jsx(rL,{scope:r,type:n,dir:oe,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:h,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:L,onScrollbarXEnabledChange:W,scrollbarY:w,onScrollbarYChange:T,scrollbarYEnabled:q,onScrollbarYEnabledChange:X,onCornerWidthChange:k,onCornerHeightChange:U,children:_.jsx(Wt.div,{dir:oe,...o,ref:re,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});V6.displayName=p0;var q6="ScrollAreaViewport",H6=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=fn(q6,r),a=P.useRef(null),c=Zt(t,a,o.onViewportChange);return _.jsxs(_.Fragment,{children:[_.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),_.jsx(Wt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:_.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});H6.displayName=q6;var oi="ScrollAreaScrollbar",W6=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(oi,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return P.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(nL,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(iL,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(G6,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(m0,{...n,ref:t}):null});W6.displayName=oi;var nL=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(oi,e.__scopeScrollArea),[s,o]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},l=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",l),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",l)}}},[i.scrollArea,i.scrollHideDelay]),_.jsx(Rn,{present:r||s,children:_.jsx(G6,{"data-state":s?"visible":"hidden",...n,ref:t})})}),iL=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=fn(oi,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Gl(()=>c("SCROLL_END"),100),[a,c]=tL("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 P.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),P.useEffect(()=>{const u=i.viewport,l=s?"scrollLeft":"scrollTop";if(u){let f=u[l];const h=()=>{const y=u[l];f!==y&&(c("SCROLL"),o()),f=y};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,s,c,o]),_.jsx(Rn,{present:r||a!=="hidden",children:_.jsx(m0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),G6=P.forwardRef((e,t)=>{const r=fn(oi,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=P.useState(!1),a=e.orientation==="horizontal",c=Gl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return Bo(r.viewport,c),Bo(r.content,c),_.jsx(Rn,{present:n||s,children:_.jsx(m0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),m0=P.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=fn(oi,e.__scopeScrollArea),s=P.useRef(null),o=P.useRef(0),[a,c]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Z6(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 lL(h,o.current,a,y)}return r==="horizontal"?_.jsx(sL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=Hg(h,a,i.dir);s.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):r==="vertical"?_.jsx(oL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=Hg(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}),sL=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=fn(oi,e.__scopeScrollArea),[o,a]=P.useState(),c=P.useRef(null),u=Zt(t,c,s.onScrollbarXChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(X6,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wl(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),e8(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)}})}})}),oL=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=fn(oi,e.__scopeScrollArea),[o,a]=P.useState(),c=P.useRef(null),u=Zt(t,c,s.onScrollbarYChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(X6,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wl(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),e8(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)}})}})}),[aL,K6]=z6(oi),X6=P.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=fn(oi,r),[b,w]=P.useState(null),T=Zt(t,re=>w(re)),I=P.useRef(null),k=P.useRef(""),N=y.viewport,U=n.content-n.viewport,L=mr(l),W=mr(c),q=Gl(f,10);function X(re){if(I.current){const oe=re.clientX-I.current.left,H=re.clientY-I.current.top;u({x:oe,y:H})}}return P.useEffect(()=>{const re=oe=>{const H=oe.target;(b==null?void 0:b.contains(H))&&L(oe,U)};return document.addEventListener("wheel",re,{passive:!1}),()=>document.removeEventListener("wheel",re,{passive:!1})},[N,b,U,L]),P.useEffect(W,[n,W]),Bo(b,q),Bo(y.content,q),_.jsx(aL,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:mr(s),onThumbPointerUp:mr(o),onThumbPositionChange:W,onThumbPointerDown:mr(a),children:_.jsx(Wt.div,{...h,ref:T,style:{position:"absolute",...h.style},onPointerDown:tt(e.onPointerDown,re=>{re.button===0&&(re.target.setPointerCapture(re.pointerId),I.current=b.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),X(re))}),onPointerMove:tt(e.onPointerMove,X),onPointerUp:tt(e.onPointerUp,re=>{const oe=re.target;oe.hasPointerCapture(re.pointerId)&&oe.releasePointerCapture(re.pointerId),document.body.style.webkitUserSelect=k.current,y.viewport&&(y.viewport.style.scrollBehavior=""),I.current=null})})})}),Gu="ScrollAreaThumb",J6=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=K6(Gu,e.__scopeScrollArea);return _.jsx(Rn,{present:r||i.hasThumb,children:_.jsx(cL,{ref:t,...n})})}),cL=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=fn(Gu,r),o=K6(Gu,r),{onThumbPositionChange:a}=o,c=Zt(t,f=>o.onThumbChange(f)),u=P.useRef(),l=Gl(()=>{u.current&&(u.current(),u.current=void 0)},100);return P.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(l(),!u.current){const y=fL(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,l,a]),_.jsx(Wt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:tt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),b=f.clientX-y.left,w=f.clientY-y.top;o.onThumbPointerDown({x:b,y:w})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});J6.displayName=Gu;var g0="ScrollAreaCorner",Y6=P.forwardRef((e,t)=>{const r=fn(g0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(uL,{...e,ref:t}):null});Y6.displayName=g0;var uL=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=fn(g0,r),[s,o]=P.useState(0),[a,c]=P.useState(0),u=!!(s&&a);return Bo(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),Bo(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?_.jsx(Wt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Ku(e){return e?parseInt(e,10):0}function Z6(e,t){const r=e/t;return isNaN(r)?0:r}function Wl(e){const t=Z6(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function lL(e,t,r,n="ltr"){const i=Wl(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,f=n==="ltr"?[0,l]:[l*-1,0];return Q6([c,u],f)(e)}function Hg(e,t,r="ltr"){const n=Wl(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=sB(e,c);return Q6([0,o],[0,a])(u)}function Q6(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function e8(e,t){return e>0&&e<t}var fL=(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 Gl(e,t){const r=mr(e),n=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(n.current),[]),P.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Bo(e,t){const r=mr(t);ss(()=>{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 dL=V6,hL=H6,Wg=W6,Gg=J6,pL=Y6,v0="Switch",[mL,WK]=Jo(v0),[gL,vL]=mL(v0),t8=P.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]=P.useState(null),b=Zt(t,N=>y(N)),w=P.useRef(!1),T=h?l||!!h.closest("form"):!0,[I=!1,k]=wc({prop:i,defaultProp:s,onChange:u});return _.jsxs(gL,{scope:r,checked:I,disabled:a,children:[_.jsx(Wt.button,{type:"button",role:"switch","aria-checked":I,"aria-required":o,"data-state":i8(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:tt(e.onClick,N=>{k(U=>!U),T&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),T&&_.jsx(yL,{control:h,bubbles:!w.current,name:n,value:c,checked:I,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});t8.displayName=v0;var r8="SwitchThumb",n8=P.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=vL(r8,r);return _.jsx(Wt.span,{"data-state":i8(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});n8.displayName=r8;var yL=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=P.useRef(null),o=y6(r),a=o0(t);return P.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==r&&f){const h=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(h)}},[o,r,n]),_.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function i8(e){return e?"checked":"unchecked"}var bL=t8,wL=n8;const _L=["1","2","3"],xL=["classic","surface","soft"],ba={size:{type:"enum",values:_L,default:"2",responsive:!0},variant:{type:"enum",values:xL,default:"surface"},color:_c,highContrast:Ul,radius:d0},s8=P.forwardRef((e,t)=>{const{rest:r,...n}=ea(e),{className:i,style:s,size:o=ba.size.default,variant:a=ba.variant.default,color:c=ba.color.default,highContrast:u=ba.highContrast.default,radius:l=ba.radius.default,...f}=r;return P.createElement("span",{"data-radius":l,className:Jt("rt-SwitchRoot",i,xt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},ta(n)),style:s},P.createElement(bL,{"data-accent-color":c,...f,ref:t,className:Jt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},P.createElement(wL,{className:Jt("rt-SwitchThumb",{"rt-high-contrast":u})})))});s8.displayName="Switch";var mh=["Enter"," "],SL=["ArrowDown","PageUp","Home"],o8=["ArrowUp","PageDown","End"],EL=[...SL,...o8],CL={ltr:[...mh,"ArrowRight"],rtl:[...mh,"ArrowLeft"]},AL={ltr:["ArrowLeft"],rtl:["ArrowRight"]},xc="Menu",[ec,ML,TL]=E6(xc),[Xs,a8]=Jo(xc,[TL,$l,A6]),Sc=$l(),c8=A6(),[u8,hs]=Xs(xc),[OL,Ec]=Xs(xc),l8=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=Sc(t),[c,u]=P.useState(null),l=P.useRef(!1),f=mr(s),h=l0(i);return P.useEffect(()=>{const y=()=>{l.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>l.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),_.jsx(r6,{...a,children:_.jsx(u8,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(OL,{scope:t,onClose:P.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};l8.displayName=xc;var IL="MenuAnchor",y0=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Sc(r);return _.jsx(n6,{...i,...n,ref:t})});y0.displayName=IL;var b0="MenuPortal",[PL,f8]=Xs(b0,{forceMount:void 0}),d8=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=hs(b0,t);return _.jsx(PL,{scope:t,forceMount:r,children:_.jsx(Rn,{present:r||s.open,children:_.jsx(o6,{asChild:!0,container:i,children:n})})})};d8.displayName=b0;var un="MenuContent",[kL,w0]=Xs(un),h8=P.forwardRef((e,t)=>{const r=f8(un,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=hs(un,e.__scopeMenu),o=Ec(un,e.__scopeMenu);return _.jsx(ec.Provider,{scope:e.__scopeMenu,children:_.jsx(Rn,{present:n||s.open,children:_.jsx(ec.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(jL,{...i,ref:t}):_.jsx(RL,{...i,ref:t})})})})}),jL=P.forwardRef((e,t)=>{const r=hs(un,e.__scopeMenu),n=P.useRef(null),i=Zt(t,n);return P.useEffect(()=>{const s=n.current;if(s)return vB(s)},[]),_.jsx(_0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),RL=P.forwardRef((e,t)=>{const r=hs(un,e.__scopeMenu);return _.jsx(_0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),_0=P.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,disableOutsideScroll:b,...w}=e,T=hs(un,r),I=Ec(un,r),k=Sc(r),N=c8(r),U=ML(r),[L,W]=P.useState(null),q=P.useRef(null),X=Zt(t,q,T.onContentChange),re=P.useRef(0),oe=P.useRef(""),H=P.useRef(0),F=P.useRef(null),D=P.useRef("right"),p=P.useRef(0),d=b?eL:P.Fragment,m=b?{as:Ti,allowPinchZoom:!0}:void 0,x=E=>{var fe,ve;const O=oe.current+E,C=U().filter(Se=>!Se.disabled),g=document.activeElement,v=(fe=C.find(Se=>Se.ref.current===g))==null?void 0:fe.textValue,j=C.map(Se=>Se.textValue),ee=WL(j,O,v),ie=(ve=C.find(Se=>Se.textValue===ee))==null?void 0:ve.ref.current;(function Se(xe){oe.current=xe,window.clearTimeout(re.current),xe!==""&&(re.current=window.setTimeout(()=>Se(""),1e3))})(O),ie&&setTimeout(()=>ie.focus())};P.useEffect(()=>()=>window.clearTimeout(re.current),[]),oB();const A=P.useCallback(E=>{var C,g;return D.current===((C=F.current)==null?void 0:C.side)&&KL(E,(g=F.current)==null?void 0:g.area)},[]);return _.jsx(kL,{scope:r,searchRef:oe,onItemEnter:P.useCallback(E=>{A(E)&&E.preventDefault()},[A]),onItemLeave:P.useCallback(E=>{var O;A(E)||((O=q.current)==null||O.focus(),W(null))},[A]),onTriggerLeave:P.useCallback(E=>{A(E)&&E.preventDefault()},[A]),pointerGraceTimerRef:H,onPointerGraceIntentChange:P.useCallback(E=>{F.current=E},[]),children:_.jsx(d,{...m,children:_.jsx(P6,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(Zp,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:_.jsx(nB,{asChild:!0,...N,dir:I.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:W,onEntryFocus:tt(c,E=>{I.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(i6,{role:"menu","aria-orientation":"vertical","data-state":I8(T.open),"data-radix-menu-content":"",dir:I.dir,...k,...w,ref:X,style:{outline:"none",...w.style},onKeyDown:tt(w.onKeyDown,E=>{const C=E.target.closest("[data-radix-menu-content]")===E.currentTarget,g=E.ctrlKey||E.altKey||E.metaKey,v=E.key.length===1;C&&(E.key==="Tab"&&E.preventDefault(),!g&&v&&x(E.key));const j=q.current;if(E.target!==j||!EL.includes(E.key))return;E.preventDefault();const ie=U().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);o8.includes(E.key)&&ie.reverse(),qL(ie)}),onBlur:tt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(re.current),oe.current="")}),onPointerMove:tt(e.onPointerMove,tc(E=>{const O=E.target,C=p.current!==E.clientX;if(E.currentTarget.contains(O)&&C){const g=E.clientX>p.current?"right":"left";D.current=g,p.current=E.clientX}}))})})})})})})});h8.displayName=un;var NL="MenuGroup",x0=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Wt.div,{role:"group",...n,ref:t})});x0.displayName=NL;var DL="MenuLabel",p8=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Wt.div,{...n,ref:t})});p8.displayName=DL;var Xu="MenuItem",Kg="menu.itemSelect",Kl=P.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=P.useRef(null),o=Ec(Xu,e.__scopeMenu),a=w0(Xu,e.__scopeMenu),c=Zt(t,s),u=P.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(Kg,{bubbles:!0,cancelable:!0});f.addEventListener(Kg,y=>n==null?void 0:n(y),{once:!0}),Rx(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(m8,{...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===" "||mh.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Kl.displayName=Xu;var m8=P.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=w0(Xu,r),a=c8(r),c=P.useRef(null),u=Zt(t,c),[l,f]=P.useState(!1),[h,y]=P.useState("");return P.useEffect(()=>{const b=c.current;b&&y((b.textContent??"").trim())},[s.children]),_.jsx(ec.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:_.jsx(iB,{asChild:!0,...a,focusable:!n,children:_.jsx(Wt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:tt(e.onPointerMove,tc(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,tc(b=>o.onItemLeave(b))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),$L="MenuCheckboxItem",g8=P.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(_8,{scope:e.__scopeMenu,checked:r,children:_.jsx(Kl,{role:"menuitemcheckbox","aria-checked":Ju(r)?"mixed":r,...i,ref:t,"data-state":C0(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(Ju(r)?!0:!r),{checkForDefaultPrevented:!1})})})});g8.displayName=$L;var v8="MenuRadioGroup",[BL,LL]=Xs(v8,{value:void 0,onValueChange:()=>{}}),y8=P.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=mr(n);return _.jsx(BL,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(x0,{...i,ref:t})})});y8.displayName=v8;var b8="MenuRadioItem",w8=P.forwardRef((e,t)=>{const{value:r,...n}=e,i=LL(b8,e.__scopeMenu),s=r===i.value;return _.jsx(_8,{scope:e.__scopeMenu,checked:s,children:_.jsx(Kl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":C0(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});w8.displayName=b8;var S0="MenuItemIndicator",[_8,FL]=Xs(S0,{checked:!1}),x8=P.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=FL(S0,r);return _.jsx(Rn,{present:n||Ju(s.checked)||s.checked===!0,children:_.jsx(Wt.span,{...i,ref:t,"data-state":C0(s.checked)})})});x8.displayName=S0;var UL="MenuSeparator",S8=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Wt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});S8.displayName=UL;var zL="MenuArrow",E8=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Sc(r);return _.jsx(s6,{...i,...n,ref:t})});E8.displayName=zL;var E0="MenuSub",[VL,C8]=Xs(E0),A8=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=hs(E0,t),o=Sc(t),[a,c]=P.useState(null),[u,l]=P.useState(null),f=mr(i);return P.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(r6,{...o,children:_.jsx(u8,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(VL,{scope:t,contentId:Ya(),triggerId:Ya(),trigger:a,onTriggerChange:c,children:r})})})};A8.displayName=E0;var Ma="MenuSubTrigger",M8=P.forwardRef((e,t)=>{const r=hs(Ma,e.__scopeMenu),n=Ec(Ma,e.__scopeMenu),i=C8(Ma,e.__scopeMenu),s=w0(Ma,e.__scopeMenu),o=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=P.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return P.useEffect(()=>l,[l]),P.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(y0,{asChild:!0,...u,children:_.jsx(m8,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":I8(r.open),...e,ref:jl(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,tc(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,tc(f=>{var y,b;l();const h=(y=r.content)==null?void 0:y.getBoundingClientRect();if(h){const w=(b=r.content)==null?void 0:b.dataset.side,T=w==="right",I=T?-5:5,k=h[T?"left":"right"],N=h[T?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+I,y:f.clientY},{x:k,y:h.top},{x:N,y:h.top},{x:N,y:h.bottom},{x:k,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===" "||CL[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});M8.displayName=Ma;var T8="MenuSubContent",O8=P.forwardRef((e,t)=>{const r=f8(un,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=hs(un,e.__scopeMenu),o=Ec(un,e.__scopeMenu),a=C8(T8,e.__scopeMenu),c=P.useRef(null),u=Zt(t,c);return _.jsx(ec.Provider,{scope:e.__scopeMenu,children:_.jsx(Rn,{present:n||s.open,children:_.jsx(ec.Slot,{scope:e.__scopeMenu,children:_.jsx(_0,{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=AL[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});O8.displayName=T8;function I8(e){return e?"open":"closed"}function Ju(e){return e==="indeterminate"}function C0(e){return Ju(e)?"indeterminate":e?"checked":"unchecked"}function qL(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function HL(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function WL(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=HL(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 GL(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,c=t[s].y,u=t[o].x,l=t[o].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function KL(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return GL(r,t)}function tc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var XL=l8,JL=y0,YL=d8,ZL=h8,QL=x0,eF=p8,tF=Kl,rF=g8,nF=y8,iF=w8,sF=x8,oF=S8,aF=E8,cF=A8,uF=M8,lF=O8,A0="DropdownMenu",[fF,GK]=Jo(A0,[a8]),kr=a8(),[dF,P8]=fF(A0),k8=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=kr(t),u=P.useRef(null),[l=!1,f]=wc({prop:i,defaultProp:s,onChange:o});return _.jsx(dF,{scope:t,triggerId:Ya(),triggerRef:u,contentId:Ya(),open:l,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(h=>!h),[f]),modal:a,children:_.jsx(XL,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};k8.displayName=A0;var j8="DropdownMenuTrigger",R8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=P8(j8,r),o=kr(r);return _.jsx(JL,{asChild:!0,...o,children:_.jsx(Wt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:jl(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())})})})});R8.displayName=j8;var hF="DropdownMenuPortal",N8=e=>{const{__scopeDropdownMenu:t,...r}=e,n=kr(t);return _.jsx(YL,{...n,...r})};N8.displayName=hF;var D8="DropdownMenuContent",$8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=P8(D8,r),s=kr(r),o=P.useRef(!1);return _.jsx(ZL,{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)"}})});$8.displayName=D8;var pF="DropdownMenuGroup",B8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(QL,{...i,...n,ref:t})});B8.displayName=pF;var mF="DropdownMenuLabel",L8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(eF,{...i,...n,ref:t})});L8.displayName=mF;var gF="DropdownMenuItem",F8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(tF,{...i,...n,ref:t})});F8.displayName=gF;var vF="DropdownMenuCheckboxItem",U8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(rF,{...i,...n,ref:t})});U8.displayName=vF;var yF="DropdownMenuRadioGroup",z8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(nF,{...i,...n,ref:t})});z8.displayName=yF;var bF="DropdownMenuRadioItem",V8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(iF,{...i,...n,ref:t})});V8.displayName=bF;var wF="DropdownMenuItemIndicator",q8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(sF,{...i,...n,ref:t})});q8.displayName=wF;var _F="DropdownMenuSeparator",H8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(oF,{...i,...n,ref:t})});H8.displayName=_F;var xF="DropdownMenuArrow",SF=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(aF,{...i,...n,ref:t})});SF.displayName=xF;var EF=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=kr(t),[a=!1,c]=wc({prop:n,defaultProp:s,onChange:i});return _.jsx(cF,{...o,open:a,onOpenChange:c,children:r})},CF="DropdownMenuSubTrigger",W8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(uF,{...i,...n,ref:t})});W8.displayName=CF;var AF="DropdownMenuSubContent",G8=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=kr(r);return _.jsx(lF,{...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)"}})});G8.displayName=AF;var MF=k8,TF=R8,K8=N8,OF=$8,IF=B8,PF=L8,kF=F8,jF=U8,RF=z8,NF=V8,X8=q8,DF=H8,$F=EF,BF=W8,LF=G8;const FF=["1","2","3"],UF=["vertical","horizontal","both"],id={size:{type:"enum",values:FF,default:"1",responsive:!0},radius:d0,scrollbars:{type:"enum",values:UF,default:"both"}},M0=P.forwardRef((e,t)=>{const{rest:r,...n}=ea(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=id.size.default,radius:l=id.radius.default,scrollbars:f=id.scrollbars.default,...h}=r;return P.createElement(dL,{type:o,scrollHideDelay:a,className:Jt("rt-ScrollAreaRoot",i,ta(n)),style:s},P.createElement(hL,{...h,ref:t,className:"rt-ScrollAreaViewport"}),P.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?P.createElement(Wg,{"data-radius":l,orientation:"horizontal",className:Jt("rt-ScrollAreaScrollbar",xt(u,"rt-r-size"))},P.createElement(Gg,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?P.createElement(Wg,{"data-radius":l,orientation:"vertical",className:Jt("rt-ScrollAreaScrollbar",xt(u,"rt-r-size"))},P.createElement(Gg,{className:"rt-ScrollAreaThumb"})):null,f==="both"?P.createElement(pL,{className:"rt-ScrollAreaCorner"}):null)});M0.displayName="ScrollArea";const zF=["1","2"],VF=["solid","soft"],sd={size:{type:"enum",values:zF,default:"2",responsive:!0},variant:{type:"enum",values:VF,default:"solid"},color:_c,highContrast:Ul},J8={color:_c,shortcut:{type:"string",default:void 0}},Y8=e=>P.createElement(MF,{...e});Y8.displayName="DropdownMenuRoot";const Z8=P.forwardRef((e,t)=>P.createElement(TF,{...e,ref:t,asChild:!0}));Z8.displayName="DropdownMenuTrigger";const Q8=P.createContext({}),e3=P.forwardRef((e,t)=>{const r=v$(),{className:n,children:i,size:s=sd.size.default,variant:o=sd.variant.default,highContrast:a=sd.highContrast.default,color:c=J8.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return P.createElement(K8,{container:u,forceMount:l},P.createElement(Fl,{asChild:!0},P.createElement(OF,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Jt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,xt(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},P.createElement(M0,{type:"auto"},P.createElement("div",{className:Jt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P.createElement(Q8.Provider,{value:P.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});e3.displayName="DropdownMenuContent";const t3=P.forwardRef((e,t)=>P.createElement(PF,{...e,ref:t,className:Jt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));t3.displayName="DropdownMenuLabel";const r3=P.forwardRef((e,t)=>{const{className:r,children:n,color:i=J8.color.default,shortcut:s,...o}=e;return P.createElement(kF,{"data-accent-color":i,...o,ref:t,className:Jt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},P.createElement(Yo,null,n),s&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});r3.displayName="DropdownMenuItem";const n3=P.forwardRef((e,t)=>P.createElement(IF,{...e,ref:t,className:Jt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));n3.displayName="DropdownMenuGroup";const i3=P.forwardRef((e,t)=>P.createElement(RF,{...e,ref:t,className:Jt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));i3.displayName="DropdownMenuRadioGroup";const s3=P.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return P.createElement(NF,{...i,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},P.createElement(Yo,null,r),P.createElement(X8,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(zl,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});s3.displayName="DropdownMenuRadioItem";const o3=P.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return P.createElement(jF,{...s,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},P.createElement(Yo,null,r),P.createElement(X8,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(zl,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});o3.displayName="DropdownMenuCheckboxItem";const a3=e=>P.createElement($F,{...e});a3.displayName="DropdownMenuSub";const c3=P.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return P.createElement(BF,{...i,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},P.createElement(Yo,null,n),P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},P.createElement(S6,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});c3.displayName="DropdownMenuSubTrigger";const u3=P.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=P.useContext(Q8);return P.createElement(K8,{container:i,forceMount:s},P.createElement(Fl,{asChild:!0},P.createElement(LF,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Jt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,xt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},P.createElement(M0,{type:"auto"},P.createElement("div",{className:Jt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});u3.displayName="DropdownMenuSubContent";const l3=P.forwardRef((e,t)=>P.createElement(DF,{...e,ref:t,className:Jt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));l3.displayName="DropdownMenuSeparator";const ln=Object.assign({},{Root:Y8,Trigger:Z8,Content:e3,Label:t3,Item:r3,Group:n3,RadioGroup:i3,RadioItem:s3,CheckboxItem:o3,Sub:a3,SubTrigger:c3,SubContent:u3,Separator:l3}),qF=["1","2","3","4"],HF=["classic","solid","soft","surface","outline","ghost"],wa={size:{type:"enum",values:qF,default:"2",responsive:!0},variant:{type:"enum",values:HF,default:"solid"},color:_c,highContrast:Ul,radius:d0},f3=P.forwardRef((e,t)=>{const{rest:r,...n}=ea(e),{className:i,asChild:s=!1,size:o=wa.size.default,variant:a=wa.variant.default,color:c=wa.color.default,highContrast:u=wa.highContrast.default,radius:l=wa.radius.default,...f}=r,h=s?Ti:"button";return P.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Jt("rt-reset","rt-BaseButton",i,xt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},ta(n))})});f3.displayName="BaseButton";const d3=P.forwardRef((e,t)=>P.createElement(f3,{...e,ref:t,className:Jt("rt-Button",e.className)}));d3.displayName="Button";const WF={loading:{type:"boolean",default:!0}},ra=P.forwardRef((e,t)=>{const{rest:r,...n}=ea(e),{className:i,children:s,loading:o=WF.loading.default,...a}=r;if(!o)return P.createElement(P.Fragment,null,s);const c=P.isValidElement(s)?Ti:"span";return P.createElement(c,{ref:t,"aria-hidden":!0,className:Jt("rt-Skeleton",i,ta(n)),"data-inline-skeleton":P.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});ra.displayName="Skeleton";const GF=Lt("/images/ghost_loading.png"),KF=Lt("/images/primary_loading.png"),XF={primary:KF,ghost:GF};function JF({size:e="24px",variant:t="primary",wrapStyle:r={}}){return _.jsx(v6,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:_.jsx("img",{src:XF[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const YF="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==",od="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]=se.useState(od),c=u=>{a(od)};return se.useEffect(()=>{a(e||od)},[e]),_.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[_.jsx("img",{src:o,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...s}),i&&_.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:YF})]})}function ZF({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=Xo(),a=se.useMemo(()=>{if(n&&r)return n(r)},[r]),c=se.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return _.jsxs("div",{className:"cs-toast",children:[_.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[_.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&_.jsx("div",{children:_.jsx(JF,{})}),_.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&_.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&_.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&_.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&_.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&_.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&_.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&_.jsx(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"&&_.jsxs(_.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&_.jsx("span",{children:"Something went wrong"})]}),r==="success"&&_.jsx(_.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),kl.map(u=>_.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:_.jsx(Wr,{src:u.img})},u.link))]})]}),_.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:_.jsx("use",{xlinkHref:"#icon-close"})})]})}const QF=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}=QF(),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=se.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),tl.createPortal(_.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>_.jsx(ZF,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}};function eU(){const{mevProtect:e,setMevProtect:t}=Lr();return _.jsxs(ln.Root,{children:[_.jsx(ln.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:_.jsx("use",{xlinkHref:"#icon-mev"})})})}),_.jsx(ln.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:_.jsxs("div",{className:"mev-settings-box",children:[_.jsxs("div",{className:"mev-setting-title",children:[_.jsxs("div",{className:"name",children:[_.jsx("img",{src:Lt("/images/icon_mev@2x.png")}),_.jsx("span",{children:"MEV Protect"})]}),_.jsx(s8,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),_.jsx("p",{className:"mev-tips",children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."})]})})]})}function tU({onClick:e}){const[t,r]=se.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return _.jsx("div",{className:"refresh-button",children:_.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:_.jsx("use",{xlinkHref:"#icon-refresh"})})})}function T0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(d3,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function rU(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Lr();return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsxs("span",{children:[r,"%"]})]}),t&&_.jsx(nU,{onClose:()=>e(!1)})]})}function nU({onClose:e}){const{slippage:t,setSlippage:r}=Lr(),[n,i]=se.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=se.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),_.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:_.jsxs("div",{className:"slippage-settings",children:[_.jsxs("div",{className:"slippage-settings-header",children:[_.jsx("div",{className:"title",children:"Slippage Settings"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsx("span",{children:"Slippage Tolerance"})]}),_.jsxs("div",{className:"form-box",children:[_.jsx("div",{className:"slippage-tab-list",children:qR.map(u=>_.jsxs("span",{className:u.display===n?"active":"",onClick:()=>s(u),children:[u.display," %"]}))}),_.jsxs("div",{className:"input-box",children:[_.jsx("span",{children:"Custom"}),_.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:o}),_.jsx("div",{style:{fontSize:"14px",color:"#fff"},children:"%"})]})]}),Number(n)<=.05&&_.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&_.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&_.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),_.jsx(T0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function iU({handleRefresh:e}){return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-header",children:[_.jsx("h3",{className:"swap-title",children:"Swap"}),_.jsxs("div",{className:"right",children:[_.jsx(rU,{}),_.jsx(eU,{}),_.jsx(tU,{onClick:e})]})]})})}function sU(){const[e,t]=se.useState(!1);return _.jsxs(ln.Root,{open:e,onOpenChange:t,children:[_.jsx(ln.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(ln.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"cs-settings-box",children:[_.jsx("h3",{children:"Settings"}),_.jsx(oU,{}),_.jsx(cU,{onClose:()=>{t(!1)}})]})})]})}function oU(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Lr(),i=s=>{t(s)};return _.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-plorer"})}),_.jsx("span",{children:"Preferred Explorer"})]}),_.jsx("div",{className:"explorer-checkbox-group",children:kl.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(Vl,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]}))})]})}const aU=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function cU({onClose:e}){const{addTxToast:t}=na(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Lr(),[a,c]=se.useState(i),[u,l]=se.useState(r),f=w=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${w}`})})},h=w=>{l(w),w.isCustom||(n(w),f(w.link),e())},y=w=>{c(w.target.value)},b=()=>{if(a){const w={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(w),f(a),e()}};return _.jsxs("div",{className:"settings-card rpc-settings-card",children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})}),_.jsx("span",{children:"RPC Node"})]}),_.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(w=>_.jsxs("div",{className:"rpc-item",onClick:()=>h(w),children:[_.jsx(Vl,{color:"indigo",checked:u.name===w.name,variant:"soft",className:"cs-checkbox"}),_.jsx("span",{children:w.name})]})),u.isCustom&&_.jsxs("div",{className:"custom-rpc-input-box",children:[_.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),_.jsx(T0,{btnIsDisabled:aU(a),text:"Save",onClick:b})]})]})]})}const Nn=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 uU=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()}},lU=uU,Xg={"text/plain":"Text","text/html":"Url",default:"Text"},fU="Copy to clipboard: #{key}, Enter";function dU(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function hU(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=lU(),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=Xg[t.format]||Xg.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=dU("message"in t?t.message:fU),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var pU=hU;const h3=cc(pU);function mU({currentAccount:e}){const{mutate:t}=Vr.useSwitchAccount(),r=Vr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Nn(),s=()=>{i(!n)};se.useEffect(()=>()=>{i(!1)},[]);const o=se.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);se.useEffect(()=>{},[o]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return _.jsxs("div",{className:"cs-account-switch",children:[_.jsxs("div",{className:"account",onClick:s,children:[_.jsx("span",{children:qs(e)}),(o==null?void 0:o.length)>0&&_.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})})]}),_.jsx("div",{className:`account-list ${n?"open":"close"}`,children:o.map(c=>_.jsxs("div",{className:"account-item",children:[_.jsxs("div",{className:"left",children:[_.jsx("div",{className:"label",children:c==null?void 0:c.label}),_.jsx("div",{className:"address",children:qs(c==null?void 0:c.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}const gU=se.forwardRef(({connect:e})=>{const t=Vr.useCurrentAccount();return _.jsx("div",{children:t?_.jsx(vU,{}):_.jsx(T0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function vU(){const{mutate:e}=Vr.useDisconnectWallet(),t=Vr.useCurrentAccount(),{currentWallet:r}=Vr.useCurrentWallet(),{addCommonToast:n}=na(),{getExplorerUrl:i}=Xo(),s=()=>{t&&(h3(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return se.useEffect(()=>{},[r]),_.jsxs(ln.Root,{children:[_.jsx(ln.Trigger,{children:_.jsxs("div",{className:"cs-connected-button",children:[_.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),_.jsx("span",{children:qs(t==null?void 0:t.address)})]})}),_.jsx(ln.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"account-op-box",children:[_.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),_.jsx(mU,{currentAccount:t==null?void 0:t.address}),_.jsxs("div",{className:"account-op-item",onClick:s,style:{marginTop:"12px"},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-copy"})}),_.jsx("span",{children:"Copy address"})]}),_.jsxs("div",{className:"account-op-item",onClick:o,children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-link"})}),_.jsx("span",{children:"Open explorer"})]}),_.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-disconnect"})}),_.jsx("span",{children:"Disconnect"})]})]})})]})}function yU(){Vr.useCurrentAccount(),Vr.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Nn();return Vr.useWallets(),_.jsx(_.Fragment,{children:_.jsx(Vr.ConnectModal,{trigger:_.jsx(gU,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function bU({independentWallet:e,customWallet:t}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:Lt("/images/logo@2x.png"),className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(yU,{}),_.jsx(sU,{})]})]}),_.jsx("div",{style:{marginTop:"20px"}})]})}const p3=()=>{const e=se.useRef(null);se.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"#75C8FF",boxShadow:"0px 0px 20px 2px #75C8FF",borderRadius:"50%"};return _.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:_.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>_.jsx("div",{style:t(i),children:_.jsx("div",{style:r})},i))})})};function wU({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=se.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(_U,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(xU,{info:s,status:r,tx:i,onClose:e})]})}function _U({info:e,status:t}){return _.jsxs("div",{className:"progress-dialog",children:[_.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),_.jsx("div",{className:"loading-box",children:_.jsx(p3,{})}),_.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),_.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function xU({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Xo();return _.jsxs("div",{className:"finally-status-dialog",children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[_.jsx("div",{className:"status-icon-box",children:_.jsx("div",{className:"status-icon",children:_.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?_.jsx("use",{xlinkHref:"#icon-sel"}):_.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?_.jsx("span",{children:"Swap Success"}):_.jsx("span",{children:"Swap failed"})]}),_.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),kl.map(s=>_.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:_.jsx("img",{src:s.img})},s.link))]})]}),_.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function Xl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await UR(`${i||Uu.api}${t}`,n):await zR(`${i||Uu.api}${t}`,n)}catch(s){throw s}}}}function SU(){const{fetchByApi:e}=Xl(),{setProviders:t}=Lr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function EU({interval:e,callback:t}){const r=se.useRef(),n=se.useRef(null);se.useEffect(()=>{r.current=t},[t]);const i=se.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=se.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return se.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Js=ji((e,t)=>({suiClient:new za({url:Uu.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new ux,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),CU=(e,t)=>({tokenMapIsInit:!1,requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=Tr(r.coin_type).full_address;if(!n.has(s)){const o=new Map(n);o.set(s,r);const a=i.filter(c=>c!==r.coin_type);e(()=>({tokenMap:o,requestTokenList:[...a]})),Ai.setItem(sh,o)}},tokenMap:new Map,setTokenMap:(r,n=!1)=>{r.size>0?e(()=>({tokenMap:r,tokenMapIsInit:!0})):e(()=>({tokenMap:r})),n||Ai.setItem(sh,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||Ai.setItem(Ax,r)}}),ia=ji(CU);Ai.getItem(sh).then(e=>{e!==null&&ia.getState().setTokenMap(e,!0)});Ai.getItem(Ax).then(e=>{e!==null&&ia.getState().setTrustedTokenList(e,!0)});function AU(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 ps(){const{suiClient:e}=Js(),{fetchByApi:t}=Xl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=ia(),c=async()=>{var b;const f=await t("/v2/sui/coins_info","GET"),h=[],y=(b=f==null?void 0:f.list)==null?void 0:b.reduce((w,T)=>(w.set(T.coin_type,T),T.is_trusted&&h.push({...T,coin_type:Tr(T.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){fx(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=AU(y,f);return i(b),b}}catch{}},l=se.useCallback(f=>{if(f)return n.get(Tr(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Yu(e){const{suiClient:t}=Js(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Nn(),{fetchTokenInfo:s}=ps(),[o,a]=se.useState([]),{tokenMap:c}=ia(),u=async(y=(r==null?void 0:r.address)||"",b)=>{try{if(!y){l();return}let w=[];b?w=[await t.getBalance({owner:y,coinType:b})]:w=[...await t.getAllBalances({owner:y})],a(w)}catch{a([])}},l=()=>{n({})};se.useEffect(()=>{(o==null?void 0:o.length)>0&&(c!=null&&c.size)&&f(o)},[o,c]);const f=async y=>{const b={};for(let w=0;w<(y==null?void 0:y.length);w++)try{const T=y[w],I=await s(T.coinType),k=NR(T.totalBalance,I==null?void 0:I.decimals),N=Mr(k,4);b[Tr(T.coinType).full_address]={...T,displayBalance:N,totalBalanceFormat:k}}catch{continue}n(b)},h=se.useMemo(()=>{if(e&&r)return i[e]||i[Tr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const MU=(e,t)=>({isOpenTokensDialog:!1,defaultFromCoinType:void 0,defaultToCoinCoinType:void 0,isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,setDefaultCoin:(r,n)=>{e(()=>({defaultFromCoinType:r,defaultToCoinCoinType:n}))},setFromCoin:r=>{e(()=>({fromCoin:r}))},setToCoin:r=>{e(()=>({toCoin:r}))},setFromAmount:r=>{e(()=>({fromAmount:r}))},setToAmount:r=>{e(()=>({toAmount:r}))},setRouterData:r=>{e(()=>({routerData:r}))},setFindRouterLoading:r=>{e(()=>({findRouterLoading:r}))},setByAmountIn:r=>{e(()=>({byAmountIn:r}))},setIsOpenSecondary:r=>{e(()=>({isOpenSecondary:r}))},setIsOpenTokensDialog:r=>{e(()=>({isOpenTokensDialog:r}))}}),dn=ji(MU),TU={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"}},OU={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"}},m3=OU,g3=TU;function IU(e,t){const{fetchTokenInfo:r}=ps(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=dn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Lr(),{tokenMapIsInit:u}=ia(),l=se.useRef({}),f=async(y,b)=>{const w=y?await r(y):m3,T=b?await r(b):g3;n(w),i(T),s(w==null?void 0:w.coin_type,T==null?void 0:T.coin_type)},h=(y,b)=>{const w=[Fu[0]];let T=Fu[0];y.forEach(I=>{const k={name:I,link:I,isCustom:!1};w.push(k),I===b&&(T=k)}),a([...w,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(T)};return se.useEffect(()=>{if(u&&!Yp(e,l.current)){const{defaultFromToken:y,defaultToToken:b,defaultSlippage:w,customRpcList:T,defaultRpc:I}=e;f(y,b),w&&o(w),(T==null?void 0:T.length)>0&&h(T,I),l.current=e}},[e,u]),{handleSetDefaultPair:f}}function PU(){const{currentRpc:e}=Lr(),{setSuiClient:t,setAggregatorSDK:r}=Js(),{currentAccount:n}=Nn();se.useEffect(()=>{if(e){const i=new za({url:e.link});t(i)}},[e]),se.useEffect(()=>{if(e){const i=new ux(Uu.aggregatorUrl,(n==null?void 0:n.address)||void 0,new za({url:e.link}),Bj.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const kU=(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}})}}),v3=ji(kU);function Jl(){const{fetchByApi:e}=Xl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=v3(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>Mi(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=se.useCallback(a=>{if(!a)return;const c=t[Tr(a).full_address];if(c)return c},[t]),o=se.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Be(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const O0=ji((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),wr=[];for(let e=0;e<256;++e)wr.push((e+256).toString(16).slice(1));function jU(e,t=0){return(wr[e[t+0]]+wr[e[t+1]]+wr[e[t+2]]+wr[e[t+3]]+"-"+wr[e[t+4]]+wr[e[t+5]]+"-"+wr[e[t+6]]+wr[e[t+7]]+"-"+wr[e[t+8]]+wr[e[t+9]]+"-"+wr[e[t+10]]+wr[e[t+11]]+wr[e[t+12]]+wr[e[t+13]]+wr[e[t+14]]+wr[e[t+15]]).toLowerCase()}let ad;const RU=new Uint8Array(16);function NU(){if(!ad){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ad=crypto.getRandomValues.bind(crypto)}return ad(RU)}const DU=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jg={randomUUID:DU};function Yg(e,t,r){if(Jg.randomUUID&&!t&&!e)return Jg.randomUUID();e=e||{};const n=e.random||(e.rng||NU)();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 jU(n)}var Us=(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))(Us||{});const $U=new za({url:r1("mainnet")}),BU=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],LU=["deny_list","DenyList","DenyCap","create_regulated_currency"],FU={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},UU=async e=>{let t=!1;if(BU.includes(e))return t;const r=e.split("::"),n=r[0]&&On.normalizeSuiAddress(r[0]),i=r[1],s=await $U.getObject({id:n,options:FU}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(LU.join("|"),"i").test(o)&&(t=!0),t},zU=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>Mi(i,!1)))==null?void 0:n.join(",")};function VU(){const{fetchByApi:e}=Xl(),t=async n=>{try{const i={...n},s=zU(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(b=>$a(b).source_address);f=l==null?void 0:l.filter(b=>{var I,k;const w=$a((I=b==null?void 0:b.coin_a)==null?void 0:I.address).source_address,T=$a((k=b==null?void 0:b.coin_b)==null?void 0:k.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(w)&&y.includes(T)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(w)||y.includes(T)))})}n!=null&&n.is_vaults&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.is_vaults)),n!=null&&n.has_farming&&!(n!=null&&n.is_vaults)&&!(n!=null&&n.has_mining)&&!(n!=null&&n.no_incentives)&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.has_farming));const h=f;return{list:h,total:(h==null?void 0:h.length)||0}}}catch(c){console.error("getLocalJsonPoolList Error:",c)}return{list:[],total:0}};return{getPoolList:t,getLocalJsonPoolList:r}}function qU(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Lr(),{getPoolList:n,getLocalJsonPoolList:i}=VU();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 HU(e){const{routerData:t}=dn();return{priceAcceptRouterData:se.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Be(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Be(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function y3(e,t){return{amountLimit:se.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Be(s).mul(Be(1).sub(Be(e).div(100))).toString():Be(i).mul(Be(1).add(Be(e).div(100))).toString()}},[e,t])}}function WU(e){const{getTokenInfo:t,fetchTokenInfo:r}=ps();return{formatSwapRouter:se.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Be(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=Be(1).sub(c).toFixed(2):h.percentage=Be(y).div(s).toFixed(2),c=Be(c).add(h.percentage);const b=[];l.path.forEach(w=>{i.includes(w.provider)||i.push(w.provider);const T=Tr(w.from).full_address,I=Tr(w.target).full_address,k=t(T),N=t(I);k||a.includes(T)&&a.push(T),N||a.includes(I)&&a.push(I);const U=w.provider===Ba.SCALLOP||w.provider===Ba.FLOWX||w.provider===Ba.FLOWXV3;b.push({from_type:T,to_type:I,pool_address:U?"":w.id,fee_rate:w.feeRate,provider:w.provider})}),h.paths=b,o.push(h)}),a.length>0)for(const l in a)r(l);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:o}}},[e])}}function GU(){const{fromCoin:e,toCoin:t}=dn(),{getPoolListByCoinType:r}=qU();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function b3(e,t,r){return se.useMemo(()=>t&&r&&+t&&+r?e?Be(r).div(t).toString():Be(t).div(r).toString():"0",[t,r,e])}function Zg(e){const[t,r]=se.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await UU(i.coin_type)}catch{}return!1};return se.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function KU(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=dn(),{getTokenInfo:i}=ps(),{ignoreWarnTokenMap:s}=Lr(),o=i(e),a=i(t),c=se.useMemo(()=>!Nc(r,m3.coin_type)||!Nc(n,g3.coin_type),[r,n]),u=se.useCallback(f=>f&&!s[Mi(f.coin_type)]&&(Nc(r,f.coin_type)||Nc(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),l=se.useMemo(()=>{const f=[];return c&&(o&&u(o)&&f.push({...o}),a&&u(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:l}}function XU(){const{aggregatorSDK:e}=Js(),{getSwapPoolAddress:t}=GU(),r=s=>s&&s.error?s.error.code===Us.InsufficientLiquidity||Us.HoneyPot||Us.NumberTooLarge:!1,n=async s=>{const{fromToken:o,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:f}=s;try{const h={from:o.coin_type,target:a.coin_type,amount:new Mm(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u},y=await e.findRouters(h);if(y&&r(y))return i(!1,l,f,o,a,y);if(!y||y.routes.length===0)throw Error("not find router");return i(!1,l,f,o,a,y)}catch{const y=await t(),b={from:o.coin_type,target:a.coin_type,amount:new Mm(c),byAmountIn:l,pools:y};try{const w=await e.swapInPools(b);return!w||!w.routeData?i(!0,l,f,o,a):i(!0,l,f,o,a,w.routeData)}catch{return{uuid:f,byAmountIn:l,isDegrade:!0}}}},i=(s,o,a,c,u,l)=>{var f;if(l){const h=l.error!==void 0,y=ih(l.amountIn.toString(),c.decimals).toString(),b=ih(l.amountOut.toString(),u.decimals).toString();return{routerData:h?void 0:l,fromAmountUi:h?o?y:"":y,toAmountUi:h&&o?"":b,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=l.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function co(e){const t=se.useRef(e);return se.useEffect(()=>{t.current=e},[e]),t}function JU(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function YU(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function ZU(e){return!!String(e).includes("Could not find the referenced transaction")}function QU(e){return JU(e)?"User rejected the request":YU(e)?"Exceeded price slippage":ZU(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var I0={};Object.defineProperty(I0,"__esModule",{value:!0});var ez=I0.executeAuction=w3,tz=j4,rz="https://rpc.getshio.com",nz=500,iz=300;function w3(e,t,r){r===void 0&&(r=nz);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),tz.default.post(rz,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,iz)}).catch(s)})}I0.default={executeAuction:w3};function sz(){const{suiClient:e}=Js(),{currentAccount:t}=Nn(),{mutateAsync:r}=Vr.useSignTransaction(),{mutate:n}=Vr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=se.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:yo.Transaction.from(On.fromBase64(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=yo.Transaction.from(c):l=c,u){const y=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!y||((f=y.effects)==null?void 0:f.status.status)==="failure")throw Error((h=y.effects)==null?void 0:h.status.error)}return l.setGasBudget(1e8),new Promise((y,b)=>{n({transaction:l,chain:i},{onSuccess:w=>{y(w)},onError:w=>{console.error("signAndExecuteTransactionBlock transaction failed",w),b(w)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=yo.Transaction.from(c)),typeof c=="string"&&(c=yo.Transaction.from(On.fromBase64(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 oz(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=sz(),{currentAccount:n}=Nn(),{suiClient:i}=Js(),{setTransactionData:s}=O0(),{addTxToast:o,removeToast:a}=na(),c=5,u=2e3;async function l(y,b=1){try{let w;try{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0}})}if(w)return w;throw new Error("Empty response")}catch(w){if(console.error(`Attempt ${b} failed:`,w),b>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await yg(u),l(y,b+1)}}const f=async(y,b,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var U,L;const{useDevInspect:T=!1,useMev:I,txAction:k="signTransactionBlock"}=w;let N;b.status="confirmation",s(b);try{let W;if(k==="signTransactionBlock"){const X=await e(y),{bytes:re,signature:oe}=X;if(I)try{const H=await ez(re,oe,500)}catch{}W=await t(re,oe,T)}else W=await r(y,T);b.status="submitted",s({...b}),b.tx=W.digest,N=o(b),await yg(u);const q=await l(W.digest,0);if(!q||((U=q.effects)==null?void 0:U.status.status)==="failure")h(b,(L=q.effects)==null?void 0:L.status.error);else{const X=FR(q,n==null?void 0:n.address,!1);if(b.buildShowInfo){const re=b.buildShowInfo("success",X);b.buildShowInfo=oe=>re}a(N),b.status="success",s({...b})}return q}catch(W){h(b,W)}},h=(y,b)=>{const w=QU(b);if(y.buildShowInfo){const T=y.buildShowInfo("confirmation");y.buildShowInfo=I=>(T.toastDescriptionContent=w,T.modalDescriptionText=w,T),y.status="rejected",s({...y})}else y.buildShowInfo=T=>{const I={};return I.toastDescriptionContent=w,I.modalDescriptionText=w,I},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function P0(e,t=1e3){const r=se.useRef(),n=se.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return se.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function az(){const{aggregatorSDK:e}=Js(),{findBestRouters:t}=XU(),{getTokenAmountValue:r,fetchTokenPrices:n}=Jl(),{providers:i,slippage:s,mevProtect:o}=Lr(),{signAndExecuteTransaction:a}=oz(),{setTransactionData:c}=O0(),{addTxToast:u}=na(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:w,toAmount:T,setFromAmount:I,setFindRouterLoading:k,setRouterData:N,setByAmountIn:U,byAmountIn:L}=dn(),[W,q]=se.useState(""),X=co(W),re=co(L),oe=co(w),H=co(T),F=co(l),D=co(f),{balanceInfo:p,getOwnerCoinBalances:d}=Yu(l==null?void 0:l.coin_type),{balanceInfo:m}=Yu(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),A=r(f==null?void 0:f.coin_type,T),O=P0(async(xe,He,Fe)=>{if(F.current&&D.current&&+xe){(+oe.current||+H.current)&&k(!0);const dt=$R(xe,He?F.current.decimals:D.current.decimals),ht=await t({fromToken:F.current,toToken:D.current,amount:dt.toString(),providersKeys:i,by_amount_in:He,uuid:Fe});k(!1),X.current===Fe&&(He?+oe.current?(b(ht.toAmountUi||""),N(ht)):b(""):+H.current?(I(ht.fromAmountUi||"ß"),N(ht)):I(""))}else v(!He)},500),C=(xe,He,Fe=!1)=>{if(U(He),He?(I(xe),Fe&&b("")):(b(xe),Fe&&I("")),+xe){const dt=Yg();q(dt),O(xe,He,dt)}else k(!1),N(void 0),v(!He)},g=(xe,He=!0)=>{v(),He?((xe==null?void 0:xe.coin_type)===(f==null?void 0:f.coin_type)&&y(l),h(xe)):((xe==null?void 0:xe.coin_type)===(l==null?void 0:l.coin_type)&&h(f),y(xe))},v=xe=>{xe===void 0?(I(""),b("")):xe?I(""):b(""),k(!1),N(void 0)},j=()=>{const xe=re.current?oe.current:H.current;if(+xe){const He=Yg();q(He),O(xe,re.current,He)}},ee=async(xe,He)=>{const{routerData:Fe,byAmountIn:dt,fromAmountUi:ht,toAmountUi:De}=xe,mt=new yo.Transaction,_e={routers:Fe,slippage:Number(s)/100,txb:mt,partner:He||GR};try{await e.fastRouterSwap(_e);const me={status:"confirmation",buildShowInfo:(Ve,Ne)=>{const Te=`Swap ${Mr(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${Mr(De,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Oe={modalDescriptionText:Te,toastTitleText:Te};if(Ve==="success"){let Le=ht,ut=De;Ne&&(Le=bg(Ne,l)||ht,ut=bg(Ne,f)||De);const lt=`Swapped ${Mr(Le,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${Mr(ut,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Oe.toastTitleText=lt,Oe.modalDescriptionText=lt}return Oe},id:0};c(me),await a(mt,me,{useMev:o})?(v(),d()):j()}catch(me){String(me).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Me,Ve){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};se.useEffect(()=>{ie(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const ie=()=>{const xe=[];l&&xe.push(l.coin_type),f&&xe.push(f.coin_type),xe.length>0&&n(xe)},{isScamsCoin:fe}=Zg(l),{isScamsCoin:ve}=Zg(f),Se=se.useMemo(()=>{if(!(!fe&&!ve)){if(fe&&ve)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(fe)return`${l==null?void 0:l.symbol} token is `;if(ve)return`${f==null?void 0:f.symbol} token is `}},[fe,ve]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:A,doSwapAction:ee,reCalculateRouteData:j,refreshMarketPrice:ie,scamsText:Se}}function cz(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=dn(),{currentAccount:o}=Nn(),a=se.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(s&&s.errorCode){if(s.errorCode===Us.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Us.NoRouter||s.errorCode===Us.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Be(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${cn(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function _3({size:e="24px",strokeWidth:t="10",color:r="#909ca4",emptyColor:n="transparent",gapPercentage:i=.5}){const s=50-parseFloat(t),o=2*Math.PI*s,a=o*i,c=o-a;return _.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:n,strokeWidth:t}),_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:r,strokeWidth:t,strokeDasharray:`${c} ${a}`,strokeDashoffset:"0",strokeLinecap:"round",style:{animation:"dash 0.5s linear infinite"}}),_.jsx("style",{children:`
|
|
98
|
+
@keyframes dash {
|
|
99
|
+
0% {
|
|
100
|
+
stroke-dashoffset: 0; /* 从起点开始 */
|
|
101
|
+
}
|
|
102
|
+
100% {
|
|
103
|
+
stroke-dashoffset: -${o}; /* 一圈 */
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
`})]})}function k0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=se.useState(!0),a=b3(s,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[_.jsx(Wr,{src:s?e.logo_url:t.logo_url}),_.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",cn(s?e.symbol:t.symbol)," ","="," ",i?_.jsx(ra,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):Mr(a,t.decimals)," ",cn(s?t.symbol:e.symbol)]}),_.jsx(Wr,{src:s?t.logo_url:e.logo_url}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function Yl(){const[e,t]=se.useState(window.innerWidth),r=P0(()=>{t(window.innerWidth)},300);se.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=se.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function x3(e,t,r,n){const{getTokenPrice:i}=Jl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=b3(!0,r,n),c=se.useMemo(()=>{if(o&&s)return Be(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=se.useMemo(()=>{if(c&&+a)return Be(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=se.useMemo(()=>{const b=[];return s&&b.push(s.market),o&&!b.includes(o.market)&&b.push(o.market),b},[s==null?void 0:s.market,o==null?void 0:o.market]),f=se.useMemo(()=>u&&Be(u).lt(0)?Be(u).abs().gt(5):!1,[u]),h=se.useMemo(()=>u&&Be(u).lt(0)?Be(u).abs().gt(10):!1,[u]),y=se.useMemo(()=>{let b,w="yellow";if(u)if(Be(u).gt(0))w="green",Be(u).lt(.1)?b="< 0.1% cheaper than":b=`${Mr(u,2,!0,$r.ROUND_UP)}% cheaper than`;else if(Be(u).eq(0))b="0%",w="green";else{const T=Be(u).abs();T.lte(5)?(w="green",b=`Within ${Mr(T.toString(),2,!0,$r.ROUND_UP)}%`):T.lte(10)?(w="yellow",b=`${Mr(T.toString(),2,!0,$r.ROUND_UP)}% more than`):T.lte(100)?(w="red",b=`${Mr(T.toString(),2,!0,$r.ROUND_UP)}% more than`):(w="red",b="> 100% more than")}return{priceImpactText:b,textColor:w}},[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h,priceImpactTextInfo:y}}function Zl({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=se.useState(!1),[o,a]=se.useState(!1),c=se.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};se.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=se.useRef(null),[y,b]=se.useState({left:void 0,top:void 0});return se.useEffect(()=>{var w;if(i&&h.current){const T=(w=h.current)==null?void 0:w.getBoundingClientRect();let I,k;r==="top"?(I=`${window.scrollX+T.left+T.width/2}px`,k=`${window.scrollY+T.top-2*T.height-8}px`):r==="bottom"?(I=`${window.scrollX+T.left+T.width/2}px`,k=`${window.scrollY+T.bottom}px`):r==="left"?(I=`${window.scrollX+T.left-8}px`,k=`${window.scrollY+T.top+T.height/2}px`):r==="right"?(I=`${window.scrollX+T.right+8}px`,k=`${window.scrollY+T.top+T.height/2}px`):(I=`${window.scrollX+T.left+T.width/2}px`,k=`${window.scrollY+T.top+T.height/2}px`),b({left:I,top:k})}},[i]),_.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&tl.createPortal(_.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:i?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...f(),...y},onMouseEnter:()=>a(!0),onMouseLeave:()=>{c.current&&(clearTimeout(c.current),c.current=null),a(!1),s(!1)},children:e}),document.body)]})}function S3({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=Yl();return i&&n?_.jsxs(ln.Root,{children:[_.jsx(ln.Trigger,{children:_.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),_.jsx(ln.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):_.jsx(Zl,{content:e,position:r,children:t})}function E3({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=dn();Yl();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l}=x3(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return _.jsxs(_.Fragment,{children:[!r&&Be(a).lte(-30)&&_.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),_.jsxs("div",{className:"price-impact-block",children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{style:{color:"var(--cs-text-con)"},children:"Price Difference"}),_.jsx(S3,{autoSwitchTooltip:!0,position:"top",content:_.jsx(uz,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{children:[e&&_.jsx(ra,{style:{width:"80px",height:"20px"}}),!e&&_.jsxs("div",{className:"right",children:[_.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText?l==null?void 0:l.priceImpactText:"Incalculable"}),_.jsx("div",{className:"platforms",children:c.map(f=>_.jsx(Zl,{content:_.jsx("span",{style:{fontSize:"12px"},children:Ix[f]}),position:"top",delay:300,children:_.jsx(Wr,{src:ZR[f]})},f))})]})]})]})]})}function uz({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:s}=Yl();return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:s?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),_.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[_.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?_.jsx(k0,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):_.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(o=>Ix[o]+" ").join("")})]})]})}function C3({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=dn();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?_.jsx(ra,{style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[Mr(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,$r.ROUND_DOWN)," ",cn(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function lz({scamsText:e}){return _.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[_.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),_.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:_.jsx(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 _.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-back"})}),_.jsx("span",{children:"Back"})]})}function j0({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(fz,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Vc=globalThis||void 0||self;var dz=typeof Vc=="object"&&Vc&&Vc.Object===Object&&Vc;const A3=dz;var hz=typeof self=="object"&&self&&self.Object===Object&&self,pz=A3||hz||Function("return this")();const ai=pz;var mz=ai.Symbol;const ni=mz;var M3=Object.prototype,gz=M3.hasOwnProperty,vz=M3.toString,_a=ni?ni.toStringTag:void 0;function yz(e){var t=gz.call(e,_a),r=e[_a];try{e[_a]=void 0;var n=!0}catch{}var i=vz.call(e);return n&&(t?e[_a]=r:delete e[_a]),i}var bz=Object.prototype,wz=bz.toString;function _z(e){return wz.call(e)}var xz="[object Null]",Sz="[object Undefined]",Qg=ni?ni.toStringTag:void 0;function sa(e){return e==null?e===void 0?Sz:xz:Qg&&Qg in Object(e)?yz(e):_z(e)}function us(e){return e!=null&&typeof e=="object"}var Ez="[object Symbol]";function rc(e){return typeof e=="symbol"||us(e)&&sa(e)==Ez}function hu(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 Cz=Array.isArray;const Gr=Cz;var Az=1/0,ev=ni?ni.prototype:void 0,tv=ev?ev.toString:void 0;function T3(e){if(typeof e=="string")return e;if(Gr(e))return hu(e,T3)+"";if(rc(e))return tv?tv.call(e):"";var t=e+"";return t=="0"&&1/e==-Az?"-0":t}function oa(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function O3(e){return e}var Mz="[object AsyncFunction]",Tz="[object Function]",Oz="[object GeneratorFunction]",Iz="[object Proxy]";function I3(e){if(!oa(e))return!1;var t=sa(e);return t==Tz||t==Oz||t==Mz||t==Iz}var Pz=ai["__core-js_shared__"];const cd=Pz;var rv=function(){var e=/[^.]+$/.exec(cd&&cd.keys&&cd.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function kz(e){return!!rv&&rv in e}var jz=Function.prototype,Rz=jz.toString;function Ys(e){if(e!=null){try{return Rz.call(e)}catch{}try{return e+""}catch{}}return""}var Nz=/[\\^$.*+?()[\]{}|]/g,Dz=/^\[object .+?Constructor\]$/,$z=Function.prototype,Bz=Object.prototype,Lz=$z.toString,Fz=Bz.hasOwnProperty,Uz=RegExp("^"+Lz.call(Fz).replace(Nz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zz(e){if(!oa(e)||kz(e))return!1;var t=I3(e)?Uz:Dz;return t.test(Ys(e))}function Vz(e,t){return e==null?void 0:e[t]}function Zs(e,t){var r=Vz(e,t);return zz(r)?r:void 0}var qz=Zs(ai,"WeakMap");const gh=qz;var nv=Object.create,Hz=function(){function e(){}return function(t){if(!oa(t))return{};if(nv)return nv(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const Wz=Hz;function Gz(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Kz=function(){try{var e=Zs(Object,"defineProperty");return e({},"",{}),e}catch{}}();const iv=Kz;function Xz(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var Jz=9007199254740991,Yz=/^(?:0|[1-9]\d*)$/;function P3(e,t){var r=typeof e;return t=t??Jz,!!t&&(r=="number"||r!="symbol"&&Yz.test(e))&&e>-1&&e%1==0&&e<t}function k3(e,t,r){t=="__proto__"&&iv?iv(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function R0(e,t){return e===t||e!==e&&t!==t}var Zz=Object.prototype,Qz=Zz.hasOwnProperty;function j3(e,t,r){var n=e[t];(!(Qz.call(e,t)&&R0(n,r))||r===void 0&&!(t in e))&&k3(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?k3(r,a,c):j3(r,a,c)}return r}var eV=9007199254740991;function N0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=eV}function ef(e){return e!=null&&N0(e.length)&&!I3(e)}var tV=Object.prototype;function D0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||tV;return e===r}function rV(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var nV="[object Arguments]";function sv(e){return us(e)&&sa(e)==nV}var R3=Object.prototype,iV=R3.hasOwnProperty,sV=R3.propertyIsEnumerable,oV=sv(function(){return arguments}())?sv:function(e){return us(e)&&iV.call(e,"callee")&&!sV.call(e,"callee")};const N3=oV;function aV(){return!1}var D3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ov=D3&&typeof module=="object"&&module&&!module.nodeType&&module,cV=ov&&ov.exports===D3,av=cV?ai.Buffer:void 0,uV=av?av.isBuffer:void 0,lV=uV||aV;const Zu=lV;var fV="[object Arguments]",dV="[object Array]",hV="[object Boolean]",pV="[object Date]",mV="[object Error]",gV="[object Function]",vV="[object Map]",yV="[object Number]",bV="[object Object]",wV="[object RegExp]",_V="[object Set]",xV="[object String]",SV="[object WeakMap]",EV="[object ArrayBuffer]",CV="[object DataView]",AV="[object Float32Array]",MV="[object Float64Array]",TV="[object Int8Array]",OV="[object Int16Array]",IV="[object Int32Array]",PV="[object Uint8Array]",kV="[object Uint8ClampedArray]",jV="[object Uint16Array]",RV="[object Uint32Array]",Xt={};Xt[AV]=Xt[MV]=Xt[TV]=Xt[OV]=Xt[IV]=Xt[PV]=Xt[kV]=Xt[jV]=Xt[RV]=!0;Xt[fV]=Xt[dV]=Xt[EV]=Xt[hV]=Xt[CV]=Xt[pV]=Xt[mV]=Xt[gV]=Xt[vV]=Xt[yV]=Xt[bV]=Xt[wV]=Xt[_V]=Xt[xV]=Xt[SV]=!1;function NV(e){return us(e)&&N0(e.length)&&!!Xt[sa(e)]}function tf(e){return function(t){return e(t)}}var $3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,La=$3&&typeof module=="object"&&module&&!module.nodeType&&module,DV=La&&La.exports===$3,ud=DV&&A3.process,$V=function(){try{var e=La&&La.require&&La.require("util").types;return e||ud&&ud.binding&&ud.binding("util")}catch{}}();const Lo=$V;var cv=Lo&&Lo.isTypedArray,BV=cv?tf(cv):NV;const B3=BV;var LV=Object.prototype,FV=LV.hasOwnProperty;function L3(e,t){var r=Gr(e),n=!r&&N3(e),i=!r&&!n&&Zu(e),s=!r&&!n&&!i&&B3(e),o=r||n||i||s,a=o?rV(e.length,String):[],c=a.length;for(var u in e)(t||FV.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||P3(u,c)))&&a.push(u);return a}function F3(e,t){return function(r){return e(t(r))}}var UV=F3(Object.keys,Object);const zV=UV;var VV=Object.prototype,qV=VV.hasOwnProperty;function HV(e){if(!D0(e))return zV(e);var t=[];for(var r in Object(e))qV.call(e,r)&&r!="constructor"&&t.push(r);return t}function Cc(e){return ef(e)?L3(e):HV(e)}function WV(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var GV=Object.prototype,KV=GV.hasOwnProperty;function XV(e){if(!oa(e))return WV(e);var t=D0(e),r=[];for(var n in e)n=="constructor"&&(t||!KV.call(e,n))||r.push(n);return r}function $0(e){return ef(e)?L3(e,!0):XV(e)}var JV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,YV=/^\w*$/;function B0(e,t){if(Gr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||rc(e)?!0:YV.test(e)||!JV.test(e)||t!=null&&e in Object(t)}var ZV=Zs(Object,"create");const nc=ZV;function QV(){this.__data__=nc?nc(null):{},this.size=0}function eq(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var tq="__lodash_hash_undefined__",rq=Object.prototype,nq=rq.hasOwnProperty;function iq(e){var t=this.__data__;if(nc){var r=t[e];return r===tq?void 0:r}return nq.call(t,e)?t[e]:void 0}var sq=Object.prototype,oq=sq.hasOwnProperty;function aq(e){var t=this.__data__;return nc?t[e]!==void 0:oq.call(t,e)}var cq="__lodash_hash_undefined__";function uq(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nc&&t===void 0?cq:t,this}function Ws(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])}}Ws.prototype.clear=QV;Ws.prototype.delete=eq;Ws.prototype.get=iq;Ws.prototype.has=aq;Ws.prototype.set=uq;function lq(){this.__data__=[],this.size=0}function rf(e,t){for(var r=e.length;r--;)if(R0(e[r][0],t))return r;return-1}var fq=Array.prototype,dq=fq.splice;function hq(e){var t=this.__data__,r=rf(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():dq.call(t,r,1),--this.size,!0}function pq(e){var t=this.__data__,r=rf(t,e);return r<0?void 0:t[r][1]}function mq(e){return rf(this.__data__,e)>-1}function gq(e,t){var r=this.__data__,n=rf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Ri(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])}}Ri.prototype.clear=lq;Ri.prototype.delete=hq;Ri.prototype.get=pq;Ri.prototype.has=mq;Ri.prototype.set=gq;var vq=Zs(ai,"Map");const ic=vq;function yq(){this.size=0,this.__data__={hash:new Ws,map:new(ic||Ri),string:new Ws}}function bq(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function nf(e,t){var r=e.__data__;return bq(t)?r[typeof t=="string"?"string":"hash"]:r.map}function wq(e){var t=nf(this,e).delete(e);return this.size-=t?1:0,t}function _q(e){return nf(this,e).get(e)}function xq(e){return nf(this,e).has(e)}function Sq(e,t){var r=nf(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ni(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])}}Ni.prototype.clear=yq;Ni.prototype.delete=wq;Ni.prototype.get=_q;Ni.prototype.has=xq;Ni.prototype.set=Sq;var Eq="Expected a function";function L0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Eq);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(L0.Cache||Ni),r}L0.Cache=Ni;var Cq=500;function Aq(e){var t=L0(e,function(n){return r.size===Cq&&r.clear(),n}),r=t.cache;return t}var Mq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tq=/\\(\\)?/g,Oq=Aq(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Mq,function(r,n,i,s){t.push(i?s.replace(Tq,"$1"):n||r)}),t});const Iq=Oq;function Pq(e){return e==null?"":T3(e)}function U3(e,t){return Gr(e)?e:B0(e,t)?[e]:Iq(Pq(e))}var kq=1/0;function sf(e){if(typeof e=="string"||rc(e))return e;var t=e+"";return t=="0"&&1/e==-kq?"-0":t}function F0(e,t){t=U3(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[sf(t[r++])];return r&&r==n?e:void 0}function jq(e,t,r){var n=e==null?void 0:F0(e,t);return n===void 0?r:n}function z3(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Rq=F3(Object.getPrototypeOf,Object);const V3=Rq;function Nq(){this.__data__=new Ri,this.size=0}function Dq(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function $q(e){return this.__data__.get(e)}function Bq(e){return this.__data__.has(e)}var Lq=200;function Fq(e,t){var r=this.__data__;if(r instanceof Ri){var n=r.__data__;if(!ic||n.length<Lq-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ni(n)}return r.set(e,t),this.size=r.size,this}function Yn(e){var t=this.__data__=new Ri(e);this.size=t.size}Yn.prototype.clear=Nq;Yn.prototype.delete=Dq;Yn.prototype.get=$q;Yn.prototype.has=Bq;Yn.prototype.set=Fq;function Uq(e,t){return e&&Ql(t,Cc(t),e)}function zq(e,t){return e&&Ql(t,$0(t),e)}var q3=typeof exports=="object"&&exports&&!exports.nodeType&&exports,uv=q3&&typeof module=="object"&&module&&!module.nodeType&&module,Vq=uv&&uv.exports===q3,lv=Vq?ai.Buffer:void 0,fv=lv?lv.allocUnsafe:void 0;function qq(e,t){if(t)return e.slice();var r=e.length,n=fv?fv(r):new e.constructor(r);return e.copy(n),n}function H3(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 W3(){return[]}var Hq=Object.prototype,Wq=Hq.propertyIsEnumerable,dv=Object.getOwnPropertySymbols,Gq=dv?function(e){return e==null?[]:(e=Object(e),H3(dv(e),function(t){return Wq.call(e,t)}))}:W3;const U0=Gq;function Kq(e,t){return Ql(e,U0(e),t)}var Xq=Object.getOwnPropertySymbols,Jq=Xq?function(e){for(var t=[];e;)z3(t,U0(e)),e=V3(e);return t}:W3;const G3=Jq;function Yq(e,t){return Ql(e,G3(e),t)}function K3(e,t,r){var n=t(e);return Gr(e)?n:z3(n,r(e))}function vh(e){return K3(e,Cc,U0)}function Zq(e){return K3(e,$0,G3)}var Qq=Zs(ai,"DataView");const yh=Qq;var eH=Zs(ai,"Promise");const bh=eH;var tH=Zs(ai,"Set");const wh=tH;var hv="[object Map]",rH="[object Object]",pv="[object Promise]",mv="[object Set]",gv="[object WeakMap]",vv="[object DataView]",nH=Ys(yh),iH=Ys(ic),sH=Ys(bh),oH=Ys(wh),aH=Ys(gh),Os=sa;(yh&&Os(new yh(new ArrayBuffer(1)))!=vv||ic&&Os(new ic)!=hv||bh&&Os(bh.resolve())!=pv||wh&&Os(new wh)!=mv||gh&&Os(new gh)!=gv)&&(Os=function(e){var t=sa(e),r=t==rH?e.constructor:void 0,n=r?Ys(r):"";if(n)switch(n){case nH:return vv;case iH:return hv;case sH:return pv;case oH:return mv;case aH:return gv}return t});const sc=Os;var cH=Object.prototype,uH=cH.hasOwnProperty;function lH(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&uH.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var fH=ai.Uint8Array;const Qu=fH;function z0(e){var t=new e.constructor(e.byteLength);return new Qu(t).set(new Qu(e)),t}function dH(e,t){var r=t?z0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var hH=/\w*$/;function pH(e){var t=new e.constructor(e.source,hH.exec(e));return t.lastIndex=e.lastIndex,t}var yv=ni?ni.prototype:void 0,bv=yv?yv.valueOf:void 0;function mH(e){return bv?Object(bv.call(e)):{}}function gH(e,t){var r=t?z0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var vH="[object Boolean]",yH="[object Date]",bH="[object Map]",wH="[object Number]",_H="[object RegExp]",xH="[object Set]",SH="[object String]",EH="[object Symbol]",CH="[object ArrayBuffer]",AH="[object DataView]",MH="[object Float32Array]",TH="[object Float64Array]",OH="[object Int8Array]",IH="[object Int16Array]",PH="[object Int32Array]",kH="[object Uint8Array]",jH="[object Uint8ClampedArray]",RH="[object Uint16Array]",NH="[object Uint32Array]";function DH(e,t,r){var n=e.constructor;switch(t){case CH:return z0(e);case vH:case yH:return new n(+e);case AH:return dH(e,r);case MH:case TH:case OH:case IH:case PH:case kH:case jH:case RH:case NH:return gH(e,r);case bH:return new n;case wH:case SH:return new n(e);case _H:return pH(e);case xH:return new n;case EH:return mH(e)}}function $H(e){return typeof e.constructor=="function"&&!D0(e)?Wz(V3(e)):{}}var BH="[object Map]";function LH(e){return us(e)&&sc(e)==BH}var wv=Lo&&Lo.isMap,FH=wv?tf(wv):LH;const UH=FH;var zH="[object Set]";function VH(e){return us(e)&&sc(e)==zH}var _v=Lo&&Lo.isSet,qH=_v?tf(_v):VH;const HH=qH;var WH=1,GH=2,KH=4,X3="[object Arguments]",XH="[object Array]",JH="[object Boolean]",YH="[object Date]",ZH="[object Error]",J3="[object Function]",QH="[object GeneratorFunction]",eW="[object Map]",tW="[object Number]",Y3="[object Object]",rW="[object RegExp]",nW="[object Set]",iW="[object String]",sW="[object Symbol]",oW="[object WeakMap]",aW="[object ArrayBuffer]",cW="[object DataView]",uW="[object Float32Array]",lW="[object Float64Array]",fW="[object Int8Array]",dW="[object Int16Array]",hW="[object Int32Array]",pW="[object Uint8Array]",mW="[object Uint8ClampedArray]",gW="[object Uint16Array]",vW="[object Uint32Array]",Ht={};Ht[X3]=Ht[XH]=Ht[aW]=Ht[cW]=Ht[JH]=Ht[YH]=Ht[uW]=Ht[lW]=Ht[fW]=Ht[dW]=Ht[hW]=Ht[eW]=Ht[tW]=Ht[Y3]=Ht[rW]=Ht[nW]=Ht[iW]=Ht[sW]=Ht[pW]=Ht[mW]=Ht[gW]=Ht[vW]=!0;Ht[ZH]=Ht[J3]=Ht[oW]=!1;function pu(e,t,r,n,i,s){var o,a=t&WH,c=t&GH,u=t&KH;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!oa(e))return e;var l=Gr(e);if(l){if(o=lH(e),!a)return Gz(e,o)}else{var f=sc(e),h=f==J3||f==QH;if(Zu(e))return qq(e,a);if(f==Y3||f==X3||h&&!i){if(o=c||h?{}:$H(e),!a)return c?Yq(e,zq(o,e)):Kq(e,Uq(o,e))}else{if(!Ht[f])return i?e:{};o=DH(e,f,a)}}s||(s=new Yn);var y=s.get(e);if(y)return y;s.set(e,o),HH(e)?e.forEach(function(T){o.add(pu(T,t,r,T,e,s))}):UH(e)&&e.forEach(function(T,I){o.set(I,pu(T,t,r,I,e,s))});var b=u?c?Zq:vh:c?$0:Cc,w=l?void 0:b(e);return Xz(w||e,function(T,I){w&&(I=T,T=e[I]),j3(o,I,pu(T,t,r,I,e,s))}),o}var yW=1,bW=4;function wW(e){return pu(e,yW|bW)}var _W="__lodash_hash_undefined__";function xW(e){return this.__data__.set(e,_W),this}function SW(e){return this.__data__.has(e)}function el(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ni;++t<r;)this.add(e[t])}el.prototype.add=el.prototype.push=xW;el.prototype.has=SW;function EW(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 CW(e,t){return e.has(t)}var AW=1,MW=2;function Z3(e,t,r,n,i,s){var o=r&AW,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&MW?new el:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],w=t[f];if(n)var T=o?n(w,b,f,t,e,s):n(b,w,f,e,t,s);if(T!==void 0){if(T)continue;h=!1;break}if(y){if(!EW(t,function(I,k){if(!CW(y,k)&&(b===I||i(b,I,r,n,s)))return y.push(k)})){h=!1;break}}else if(!(b===w||i(b,w,r,n,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function TW(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function OW(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var IW=1,PW=2,kW="[object Boolean]",jW="[object Date]",RW="[object Error]",NW="[object Map]",DW="[object Number]",$W="[object RegExp]",BW="[object Set]",LW="[object String]",FW="[object Symbol]",UW="[object ArrayBuffer]",zW="[object DataView]",xv=ni?ni.prototype:void 0,ld=xv?xv.valueOf:void 0;function VW(e,t,r,n,i,s,o){switch(r){case zW:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case UW:return!(e.byteLength!=t.byteLength||!s(new Qu(e),new Qu(t)));case kW:case jW:case DW:return R0(+e,+t);case RW:return e.name==t.name&&e.message==t.message;case $W:case LW:return e==t+"";case NW:var a=TW;case BW:var c=n&IW;if(a||(a=OW),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=PW,o.set(e,t);var l=Z3(a(e),a(t),n,i,s,o);return o.delete(e),l;case FW:if(ld)return ld.call(e)==ld.call(t)}return!1}var qW=1,HW=Object.prototype,WW=HW.hasOwnProperty;function GW(e,t,r,n,i,s){var o=r&qW,a=vh(e),c=a.length,u=vh(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:WW.call(t,h)))return!1}var y=s.get(e),b=s.get(t);if(y&&b)return y==t&&b==e;var w=!0;s.set(e,t),s.set(t,e);for(var T=o;++f<c;){h=a[f];var I=e[h],k=t[h];if(n)var N=o?n(k,I,h,t,e,s):n(I,k,h,e,t,s);if(!(N===void 0?I===k||i(I,k,r,n,s):N)){w=!1;break}T||(T=h=="constructor")}if(w&&!T){var U=e.constructor,L=t.constructor;U!=L&&"constructor"in e&&"constructor"in t&&!(typeof U=="function"&&U instanceof U&&typeof L=="function"&&L instanceof L)&&(w=!1)}return s.delete(e),s.delete(t),w}var KW=1,Sv="[object Arguments]",Ev="[object Array]",qc="[object Object]",XW=Object.prototype,Cv=XW.hasOwnProperty;function JW(e,t,r,n,i,s){var o=Gr(e),a=Gr(t),c=o?Ev:sc(e),u=a?Ev:sc(t);c=c==Sv?qc:c,u=u==Sv?qc:u;var l=c==qc,f=u==qc,h=c==u;if(h&&Zu(e)){if(!Zu(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new Yn),o||B3(e)?Z3(e,t,r,n,i,s):VW(e,t,c,r,n,i,s);if(!(r&KW)){var y=l&&Cv.call(e,"__wrapped__"),b=f&&Cv.call(t,"__wrapped__");if(y||b){var w=y?e.value():e,T=b?t.value():t;return s||(s=new Yn),i(w,T,r,n,s)}}return h?(s||(s=new Yn),GW(e,t,r,n,i,s)):!1}function of(e,t,r,n,i){return e===t?!0:e==null||t==null||!us(e)&&!us(t)?e!==e&&t!==t:JW(e,t,r,n,of,i)}var YW=1,ZW=2;function QW(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 Yn;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?of(l,u,YW|ZW,n,f):h))return!1}}return!0}function Q3(e){return e===e&&!oa(e)}function eG(e){for(var t=Cc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Q3(i)]}return t}function eS(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function tG(e){var t=eG(e);return t.length==1&&t[0][2]?eS(t[0][0],t[0][1]):function(r){return r===e||QW(r,e,t)}}function rG(e,t){return e!=null&&t in Object(e)}function nG(e,t,r){t=U3(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=sf(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&&N0(i)&&P3(o,i)&&(Gr(e)||N3(e)))}function iG(e,t){return e!=null&&nG(e,t,rG)}var sG=1,oG=2;function aG(e,t){return B0(e)&&Q3(t)?eS(sf(e),t):function(r){var n=jq(r,e);return n===void 0&&n===t?iG(r,e):of(t,n,sG|oG)}}function cG(e){return function(t){return t==null?void 0:t[e]}}function uG(e){return function(t){return F0(t,e)}}function lG(e){return B0(e)?cG(sf(e)):uG(e)}function tS(e){return typeof e=="function"?e:e==null?O3:typeof e=="object"?Gr(e)?aG(e[0],e[1]):tG(e):lG(e)}function fG(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 dG=fG();const hG=dG;function pG(e,t){return e&&hG(e,t,Cc)}function mG(e,t){return function(r,n){if(r==null)return r;if(!ef(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 gG=mG(pG);const rS=gG;function vG(e,t){var r=[];return rS(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function yG(e,t){var r=Gr(e)?H3:vG;return r(e,tS(t))}function bG(e,t){var r=-1,n=ef(e)?Array(e.length):[];return rS(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function wG(e,t){return of(e,t)}function _G(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function xG(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=rc(e),o=t!==void 0,a=t===null,c=t===t,u=rc(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 SG(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=xG(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 EG(e,t,r){t.length?t=hu(t,function(s){return Gr(s)?function(o){return F0(o,s.length===1?s[0]:s)}:s}):t=[O3];var n=-1;t=hu(t,tf(tS));var i=bG(e,function(s,o,a){var c=hu(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return _G(i,function(s,o){return SG(s,o,r)})}function CG(e,t,r,n){return e==null?[]:(Gr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Gr(r)||(r=r==null?[]:[r]),EG(e,t,r))}function AG({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=dn(),s=se.useRef(!1),{slippage:o}=Lr(),[a,c]=se.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=y3(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=x3(n,i,u,l),{priceAcceptRouterData:w}=HU(a),[T,I]=se.useState(!1),[k,N]=se.useState(!1);se.useMemo(()=>f?i:n,[f]);const U=se.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=wW(w);c(q),setTimeout(()=>{s.current=!1},300)}},W=se.useMemo(()=>T?!1:!!b,[T,b]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(j0,{title:"Review your order",backClick:e}),_.jsxs("div",{className:"secondary-content",children:[_.jsxs("div",{className:"trade-info",children:[_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:No(u||"")}),_.jsx("img",{src:n==null?void 0:n.logo_url}),_.jsx("span",{className:"symbol",children:cn((n==null?void 0:n.symbol)||"")})]}),_.jsx("div",{className:"dividing-line",children:_.jsx("div",{className:"swap-icon",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-trade"})})})}),_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:No(l||"")}),_.jsx("img",{src:i==null?void 0:i.logo_url}),_.jsx("span",{className:"symbol",children:cn((i==null?void 0:i.symbol)||"")})]})]}),_.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[_.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:_.jsx(k0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&_.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),_.jsxs("div",{className:"swap-info-between",children:[_.jsx("div",{className:"left",children:"Slippage Tolerance"}),_.jsxs("div",{className:"right",children:[o,"%"]})]}),_.jsx(C3,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),_.jsx(E3,{isLoading:!1,routerData:a,noTips:!0}),b&&_.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[_.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"#ff5073"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),_.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:T?"#72c1f7":"#7F98A7"},onClick:()=>{I(!0)},children:"Yes, please continue."}),_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"#7F98A7",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!U&&_.jsx("button",{disabled:W||k,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{k||(N(!0),t(a))},children:k?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(_3,{})}):"Confirm Swap"}),U&&_.jsxs("div",{className:"price-update",children:[_.jsxs("div",{className:"left",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{children:"Price update"})]}),_.jsx("div",{className:"right",children:_.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function af(e){const{text:t,type:r}=e,[n,i]=se.useState(!1),{addCommonToast:s}=na(),o=a=>{n||(Pl(a),h3(t,{debug:!1,message:"message"}),s("Copied"),i(!n))};return se.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),_.jsx(_.Fragment,{children:r==="btn"?_.jsxs("div",{className:"copy-btn",onClick:o,children:[_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),_.jsx("span",{children:"Copy"})]}):_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:o,children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function MG({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=dn(),{getTokenInfo:a}=ps(),c=se.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(f=>({...f,fromToken:a(f.from_type),toToken:a(f.to_type)}))}))},[t]);return _.jsxs("div",{className:"route-dialog",children:[_.jsx(j0,{title:"Route",backClick:e}),_.jsxs("div",{className:"route-dialog-content",children:[_.jsx("div",{className:"simple-router-box",children:_.jsx(nS,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),_.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[_.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[_.jsx(Wr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:Mr(s,n==null?void 0:n.decimals)}),_.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),_.jsx("div",{className:"route-box-h5 center",children:_.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((u,l)=>_.jsxs("div",{className:"route-item-box-h5",children:[_.jsxs("div",{className:"percent",children:[Be(u.percentage).mul(100).toString(),"%"]}),_.jsx("div",{className:u.paths.length>1?"route-two-h5":"",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:u.paths.map(f=>_.jsx("div",{className:"route-path-item",children:_.jsx(S3,{autoSwitchTooltip:!0,position:"bottom",content:_.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[_.jsx(OG,{poolAddress:f.pool_address}),_.jsx(Av,{token:f.fromToken}),_.jsx(Av,{token:f.toToken})]}),children:_.jsx(TG,{path:f})})},f.to_type))})]},l))})}),_.jsxs("div",{className:"center",style:{gap:"4px"},children:[_.jsx(Wr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:Mr(o,i==null?void 0:i.decimals)}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function TG({path:e}){var t,r,n;return _.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[_.jsx(Wr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx(Wr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),_.jsxs("span",{className:"provider",children:[(n=Px[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&_.jsxs("div",{className:"fee-tier",children:[" ",Be(e.fee_rate).mul(100).toString(),"%"]})]})}function Av({token:e}){const{getExplorerUrl:t}=Xo();return _.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[_.jsx(Wr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:cn((e==null?void 0:e.symbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:Pl,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)}),_.jsx(af,{text:(e==null?void 0:e.coin_type)||""})]})]})}function OG({poolAddress:e}){const{getExplorerUrl:t}=Xo();return _.jsxs(_.Fragment,{children:[e&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[_.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:Pl,href:t(e,"poolAddress"),target:"_blank",children:qs(e)}),_.jsx(af,{text:e})]})]}),e&&_.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function nS({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var f;const[n,i]=se.useState(!1),{isApp:s}=Yl(),{fetchTokenInfo:o}=ps(),a=se.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]),[c,u]=se.useState(""),l=async()=>{var w,T;const h=[],y=((T=(w=r==null?void 0:r.routers)==null?void 0:w[0])==null?void 0:T.paths)||[];for(let I=0;I<y.length;I++){const k=y[I],N=await o(k==null?void 0:k.to_type);if(I===0){const U=await o(k==null?void 0:k.from_type);h.push(`${U==null?void 0:U.symbol} > ${N==null?void 0:N.symbol}`)}else h.push(N==null?void 0:N.symbol)}const b=h.join(" > ");u(b)};return se.useEffect(()=>{a&&l()},[a]),_.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[_.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?_.jsx(ra,{style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[_.jsx("span",{style:{textAlign:"right",color:"#fff"},children:a?c:r==null?void 0:r.router_summery}),_.jsxs("div",{className:"providers",children:[(f=r==null?void 0:r.providers)==null?void 0:f.map((h,y)=>{var b;return s?_.jsx(Wr,{src:fr[h],style:{width:"16px",height:"16px"}}):_.jsx(Zl,{content:_.jsx("div",{children:((b=Px[h])==null?void 0:b.name)||h}),position:"top",delay:300,children:_.jsx(Wr,{src:fr[h],style:{width:"16px",height:"16px"}})},h)}),e&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:_.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&_.jsx(MG,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const 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||Ai.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=dg(r.coin_type);o=i.filter(c=>dg(c.coin_type)!==a)}return s(o),Ai.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}))}}));Ai.getItem(Mx).then(e=>{e!==null&&Ac.getState().setCollectTokenMap(e,!0)});Ai.getItem(Tx).then(e=>{e&&Ac.getState().setImportTokenList(e)});function iS(){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=se.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function IG(e){const{trustedTokenList:t}=ia(),{tokenBalanceObj:r,currentAccount:n}=Nn(),{coinPriceObj:i}=v3(),{getTokenAmountValue:s}=Jl(),{fetchTokenInfo:o}=ps(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:w,currentImportTokenData:T,searchInput:I,setSearchInput:k,importTokenIsLoading:N,showTokenListIsLoading:U,setCurrentTypeTab:L}=Ac(),[W,q]=se.useState(!1);se.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[X,re]=se.useState(!1);se.useEffect(()=>{vg(i)||re(!0)},[i]);const oe=se.useRef({}),[H,F]=se.useState(!1);se.useEffect(()=>{(!vg(r)||!Yp(oe.current,r))&&(oe.current=r,F(!0))},[r]);const D=(v,j)=>{const ee=j&&j.toLocaleLowerCase().trim(),ie=v.map(ve=>{let Se=0,xe=0;ve.symbol.toLowerCase()===ee||ve.name.toLowerCase()===ee||ve.coin_type.toLowerCase()===ee?(Se=1e3,xe=2):ve.symbol.toLowerCase().indexOf(ee)>-1?(Se=100,xe=0):ve.name.toLowerCase().indexOf(ee)>-1?(Se=10,xe=0):ve.coin_type.toLowerCase().indexOf(ee)>-1?(Se=1,xe=0):ve.coin_type.toLowerCase()=="0x2::sui::sui"&&(xe=1);let He=Array.isArray(ve==null?void 0:ve.coin_priority)?Number(ve.coin_priority[0])||0:Number(ve==null?void 0:ve.coin_priority)||0;return e===ve.coin_type&&!j&&(xe=12,Se=1e3,He=1e4),{...ve,mark:Se,sort:xe,coin_priority_sort:He,rateNumber:Number((ve==null?void 0:ve.rate)||"0"),balanceNumber:Number((ve==null?void 0:ve.balance)||"0")}});return CG(ie,[ve=>!j&&e===ve.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(),ie=["symbol","name","coin_type"];return yG(ee.length===0?l:[...l,...f],ve=>ie.some(Se=>{const xe=ve[Se];if(typeof xe=="string"){const He=j?xe:xe.toLowerCase();return Se==="coin_type"?He.includes(ee)||Mi(He,!0).includes(Mi(ee,!0)):He.includes(ee)}return!1}))},d=v=>{v||b(void 0);const j=p(v);if((j==null?void 0:j.length)===0){m(v);return}else{const ee=D(j,v);u(ee)}},m=async v=>{var j;w(!0);try{if(Cx(v)){const ee=v.trim(),ie=Tr(ee).full_address,fe=await o(ie);if(!fe){u([]);return}const ve=((j=r==null?void 0:r[ee])==null?void 0:j.totalBalanceFormat)||"0",Se=Be(ve).gt("0")?s(ee,ve):"0",xe={...fe,balance:ve,rate:Se};u([xe]),b(xe)}else{u([]);return}}catch{b(void 0),u([]);return}finally{w(!1)}},x=v=>{if(v==="Default")O("All");else{const j=D(f,I);u(j)}},A=()=>{if(T){const v=y(T,!0),j=D(v,I);u(j),b(void 0),k("")}},E=v=>{const j=y(v,!1),ee=D(j,I);u(ee)},O=v=>{const j=v==="All"?[...l]:l.filter(ie=>v=="Native"?!ie.labels||ie.labels.length==0||ie.labels=="Native":ie.labels&&ie.labels.length>0&&ie.labels[0].toLowerCase()==v.toLowerCase()),ee=D(j,I);u(ee)};se.useEffect(()=>{if(!W||!(t!=null&&t.length)){h([]);return}if(!(n!=null&&n.address))h(t);else if(n!=null&&n.address){const v=[];for(const j of t){const ee=r==null?void 0:r[j==null?void 0:j.coin_type],ie=(ee==null?void 0:ee.totalBalanceFormat)||"0",fe=(ee==null?void 0:ee.displayBalance)||"0",ve=Be(ie).gt("0")?s(j==null?void 0:j.coin_type,ie):"0";v.push({...j,balance:fe,rate:Mr(ve,4,!0)})}h(v)}},[W,X,H,n==null?void 0:n.address]);const C=se.useRef([]);se.useEffect(()=>{if((l==null?void 0:l.length)>0&&!wG(C.current,l)){C.current=l;const v=D(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),x("Imported")):u(v)}},[l,e]);const g=se.useMemo(()=>{if(a==="Default"){if(!U&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!N)return!0;return!1},[I,c,T,N,U]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:T,handleChangeType:x,handleImportClick:A,handleDeleteImportClick:E,isNoData:g}}function PG({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(kG,{token:r,onHandleTokenAction:t},r.coin_type))})}function kG({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),_.jsx("span",{children:e.symbol}),_.jsx("i",{children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:_.jsx("use",{xlinkHref:"#icon-close"})})})]})}const jG=Lt("/images/img_no_data@2x.png");function RG(e){const{img:t=jG,text:r,width:n="100%",height:i="auto",padding:s="20px",subItem:o}=e;return _.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&_.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&_.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),o&&o]})}function NG({tabList:e,currentTab:t,changeTab:r}){return _.jsx("div",{className:"platform-tabs",children:e.map(n=>_.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var Mv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function DG(e,t){return!!(e===t||Mv(e)&&Mv(t))}function $G(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!DG(e[r],t[r]))return!1;return!0}function BG(e,t){t===void 0&&(t=$G);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 _h(){return _h=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},_h.apply(null,arguments)}function Tv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xh(e,t){return xh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},xh(e,t)}function LG(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xh(e,t)}var Ov=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function FG(e,t){return!!(e===t||Ov(e)&&Ov(t))}function UG(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!FG(e[r],t[r]))return!1;return!0}function fd(e,t){t===void 0&&(t=UG);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 Iv(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 zG=typeof performance=="object"&&typeof performance.now=="function",Pv=zG?function(){return performance.now()}:function(){return Date.now()};function kv(e){cancelAnimationFrame(e.id)}function VG(e,t){var r=Pv();function n(){Pv()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var dd=-1;function jv(e){if(e===void 0&&(e=!1),dd===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),dd=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return dd}var uo=null;function Rv(e){if(e===void 0&&(e=!1),uo===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?uo="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?uo="negative":uo="positive-ascending"),document.body.removeChild(t),uo}return uo}Cn.env.NODE_ENV;var qG=150,HG=function(t,r){return t},mu=null,gu=null;Cn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(mu=new WeakSet,gu=new WeakSet);function WG(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){LG(h,f);function h(b){var w;return w=f.call(this,b)||this,w._instanceProps=c(w.props,Tv(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:Tv(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=fd(function(T,I,k,N){return w.props.onItemsRendered({overscanStartIndex:T,overscanStopIndex:I,visibleStartIndex:k,visibleStopIndex:N})}),w._callOnScroll=void 0,w._callOnScroll=fd(function(T,I,k){return w.props.onScroll({scrollDirection:T,scrollOffset:I,scrollUpdateWasRequested:k})}),w._getItemStyle=void 0,w._getItemStyle=function(T){var I=w.props,k=I.direction,N=I.itemSize,U=I.layout,L=w._getItemStyleCache(u&&N,u&&U,u&&k),W;if(L.hasOwnProperty(T))W=L[T];else{var q=r(w.props,T,w._instanceProps),X=i(w.props,T,w._instanceProps),re=k==="horizontal"||U==="horizontal",oe=k==="rtl",H=re?q:0;L[T]=W={position:"absolute",left:oe?void 0:H,right:oe?H:void 0,top:re?0:q,height:re?"100%":X,width:re?X:"100%"}}return W},w._getItemStyleCache=void 0,w._getItemStyleCache=fd(function(T,I,k){return{}}),w._onScrollHorizontal=function(T){var I=T.currentTarget,k=I.clientWidth,N=I.scrollLeft,U=I.scrollWidth;w.setState(function(L){if(L.scrollOffset===N)return null;var W=w.props.direction,q=N;if(W==="rtl")switch(Rv()){case"negative":q=-N;break;case"positive-descending":q=U-k-N;break}return q=Math.max(0,Math.min(q,U-k)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(T){var I=T.currentTarget,k=I.clientHeight,N=I.scrollHeight,U=I.scrollTop;w.setState(function(L){if(L.scrollOffset===U)return null;var W=Math.max(0,Math.min(U,N-k));return{isScrolling:!0,scrollDirection:L.scrollOffset<W?"forward":"backward",scrollOffset:W,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(T){var I=w.props.outerRef;w._outerRef=T,typeof I=="function"?I(T):I!=null&&typeof I=="object"&&I.hasOwnProperty("current")&&(I.current=T)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&kv(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=VG(w._resetIsScrolling,qG)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,T){return GG(w,T),l(w),null};var y=h.prototype;return y.scrollTo=function(w){w=Math.max(0,w),this.setState(function(T){return T.scrollOffset===w?null:{scrollDirection:T.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(w,T){T===void 0&&(T="auto");var I=this.props,k=I.itemCount,N=I.layout,U=this.state.scrollOffset;w=Math.max(0,Math.min(w,k-1));var L=0;if(this._outerRef){var W=this._outerRef;N==="vertical"?L=W.scrollWidth>W.clientWidth?jv():0:L=W.scrollHeight>W.clientHeight?jv():0}this.scrollTo(s(this.props,w,T,U,this._instanceProps,L))},y.componentDidMount=function(){var w=this.props,T=w.direction,I=w.initialScrollOffset,k=w.layout;if(typeof I=="number"&&this._outerRef!=null){var N=this._outerRef;T==="horizontal"||k==="horizontal"?N.scrollLeft=I:N.scrollTop=I}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,T=w.direction,I=w.layout,k=this.state,N=k.scrollOffset,U=k.scrollUpdateWasRequested;if(U&&this._outerRef!=null){var L=this._outerRef;if(T==="horizontal"||I==="horizontal")if(T==="rtl")switch(Rv()){case"negative":L.scrollLeft=-N;break;case"positive-ascending":L.scrollLeft=N;break;default:var W=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-W-N;break}else L.scrollLeft=N;else L.scrollTop=N}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&kv(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,T=w.children,I=w.className,k=w.direction,N=w.height,U=w.innerRef,L=w.innerElementType,W=w.innerTagName,q=w.itemCount,X=w.itemData,re=w.itemKey,oe=re===void 0?HG:re,H=w.layout,F=w.outerElementType,D=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,A=k==="horizontal"||H==="horizontal",E=A?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(se.createElement(T,{data:X,key:oe(j,X),index:j,isScrolling:d?x:void 0,style:this._getItemStyle(j)}));var ee=n(this.props,this._instanceProps);return se.createElement(F||D||"div",{className:I,onScroll:E,ref:this._outerRefSetter,style:_h({position:"relative",height:N,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:k},p)},se.createElement(L||W||"div",{children:v,ref:U,style:{height:A?"100%":ee,pointerEvents:x?"none":void 0,width:A?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var T=this._getRangeToRender(),I=T[0],k=T[1],N=T[2],U=T[3];this._callOnItemsRendered(I,k,N,U)}}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 w=this.props,T=w.itemCount,I=w.overscanCount,k=this.state,N=k.isScrolling,U=k.scrollDirection,L=k.scrollOffset;if(T===0)return[0,0,0,0];var W=o(this.props,L,this._instanceProps),q=a(this.props,W,L,this._instanceProps),X=!N||U==="backward"?Math.max(1,I):1,re=!N||U==="forward"?Math.max(1,I):1;return[Math.max(0,W-X),Math.max(0,Math.min(T-1,q+re)),W,q]},h}(se.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var GG=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(Cn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&gu&&!gu.has(l)&&(gu.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":mu&&!mu.has(l)&&(mu.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.'))}},KG=WG({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,f=t.layout,h=t.width,y=a==="horizontal"||f==="horizontal",b=y?h:c,w=Math.max(0,u*l-b),T=Math.min(w,r*l),I=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=I-b&&i<=T+b?n="auto":n="center"),n){case"start":return T;case"end":return I;case"center":{var k=Math.round(I+(T-I)/2);return k<Math.ceil(b/2)?0:k>w+Math.floor(b/2)?w:k}case"auto":default:return i>=I&&i<=T?i:i<I?I:T}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",f=r*a,h=l?u:s,y=Math.ceil((h+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(Cn.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 Nv(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 XG=["style"],JG=["style"];function YG(e,t){var r=e.style,n=Iv(e,XG),i=t.style,s=Iv(t,JG);return!Nv(r,i)&&!Nv(n,s)}const ZG=se.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return _.jsx("div",{style:r,children:_.jsx(tK,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},YG),QG=BG((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function eK({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=se.useRef(null);se.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=QG(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(KG,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:ZG})})}function tK({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=iS(),{getExplorerUrl:s}=Xo();return _.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Wr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),_.jsxs("div",{className:"token-info",children:[_.jsx("h4",{className:"token-symbol",children:_.jsx("span",{children:cn(e.symbol)})}),_.jsx("p",{className:"token-name",children:cn(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:Pl,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:qs(e==null?void 0:e.coin_type)}),_.jsx(af,{text:e==null?void 0:e.coin_type})]})]}),_.jsxs("div",{className:"token-balance",children:[_.jsxs("div",{className:"balance",children:[_.jsx("h4",{children:e==null?void 0:e.balance}),_.jsx("p",{children:e!=null&&e.rate?Sx(e==null?void 0:e.rate,2):""})]}),r&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function rK({currentType:e,changeTab:t}){const r=["Default","Imported"];return _.jsx("div",{className:"type-tabs",children:r.map(n=>_.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function nK({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=IG(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:w,isOpenImportDialog:T,setIsOpenImportDialog:I,setSearchInput:k,searchInput:N,importTokenIsLoading:U,currentImportTokenData:L,setCurrentImportTokenData:W}=Ac();se.useEffect(()=>()=>{k(""),b("All"),h("Default"),W(void 0)},[]);const{handleCollectToken:q,collectTokenMap:X}=iS(),re=m=>{h(m),a(m)},oe=m=>{b(m),o(m)},H=()=>{c(),I(!1)},F=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();k(x),x?D(x):(D(""),re("Default"))},D=P0(m=>{Cx(m)?s(Mi(m,!0)):s(m)},300),p=(m,x)=>{if(x==="delete_import"){u(m);return}if(x==="collect_token"||x==="un_collect"){q(m);return}x==="select_token"&&(t(m),e())},d=se.useMemo(()=>Array.from(X.values()),[X]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(j0,{backClick:e,title:"Select Token"}),_.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:"search-input",style:{position:"relative"},children:[_.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:N,onChange:m=>F(m.target.value),style:{paddingRight:"40px"}}),N.length>0&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{F("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(PG,{tokenList:d,onHandleTokenAction:p}),N.length===0&&_.jsx(rK,{currentType:f,changeTab:re}),N.length===0&&f==="Default"&&_.jsx(NG,{tabList:w,currentTab:y,changeTab:oe})]}),i&&_.jsx(iK,{showTooltip:N.length>0,text:N.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),U&&_.jsx(p3,{}),L&&_.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&_.jsxs("div",{style:{position:"relative"},children:[_.jsx(eK,{showTokenList:n,showCollect:!L,showDelete:!L&&f==="Imported",onHandleTokenAction:p}),L&&_.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:_.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{H(),p(L,"select_token")},children:"Import"})})]})]})]})}function iK({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(RG,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Zl,{position:"bottom",content:_.jsx("div",{children:"The unique id of coin"}),children:_.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function sK({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=se.useState(!1),{setIgnoreWarnToken:s}=Lr();return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",onClick:e}),_.jsxs("div",{className:"import-dialog",children:[_.jsxs("div",{className:"cs-dialog-header",children:[_.jsx("div",{className:"title",children:"Tips"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"import-content",children:[_.jsx("div",{className:"tip-text-box",children:_.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(o=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(Wr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:o.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",o.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:qs(o.coin_type)}),_.jsx(af,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox",children:[_.jsx(Vl,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),_.jsx("span",{children:"I acknowledge the risk"})]}),_.jsxs("div",{className:"button-block",children:[_.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),_.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}function sS(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 Wi(){}function oK(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 ac(e){return!!(e||"").match(/\d/)}function Oo(e){return e==null}function aK(e){return typeof e=="number"&&isNaN(e)}function oS(e){return Oo(e)||aK(e)||typeof e=="number"&&!isFinite(e)}function aS(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function cK(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 uK(e,t,r){var n=cK(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=se.useRef(e);t.current=e;var r=se.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function V0(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 cS(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Dv(e,t){return Array(t+1).join(e)}function uS(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."+Dv("0",Math.abs(o))+i:o>=a?i=i+Dv("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function $v(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=V0(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),u=o.length<=t?"0."+o:c.toFixed(t),l=u.split("."),f=s;s&&Number(l[0])&&(f=s.split("").reverse().reduce(function(w,T,I){return w.length>I?(Number(w[0])+Number(T)).toString()+w.substring(1,w.length):T+w},l[0]));var h=cS(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function js(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 lS=oK(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}}}),dK=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function hK(e,t,r){return Math.min(Math.max(e,t),r)}function hd(e){return Math.max(e.selectionStart,e.selectionEnd)}function pK(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function mK(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 vK(e,t,r,n,i,s,o){o===void 0&&(o=gK);var a=i.findIndex(function(U){return U}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,f={},h=new Array(u),y=0;y<u;y++){h[y]=-1;for(var b=0,w=l;b<w;b++){var T=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(T&&f[b]!==!0){h[y]=b,f[b]=!0;break}}}for(var I=n;I<u&&(h[I]===-1||!s(r[I]));)I++;var k=I===u||h[I]===-1?l:h[I];for(I=n-1;I>0&&h[I]===-1;)I--;var N=I===-1||h[I]===-1?0:h[I]+1;return N>k?k:n-N<k-n?N:k}function Bv(e,t,r,n){var i=e.length;if(t=hK(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 yK(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ac(e[r])||ac(e[r-1]));return t}function fS(e,t,r,n,i,s){s===void 0&&(s=Wi);var o=lK(function(b,w){var T,I;return oS(b)?(I="",T=""):typeof b=="number"||w?(I=typeof b=="number"?uS(b):b,T=n(I)):(I=i(b,void 0),T=n(I)),{formattedValue:T,numAsString:I}}),a=se.useState(function(){return o(Oo(e)?t:e,r)}),c=a[0],u=a[1],l=function(b,w){b.formattedValue!==c.formattedValue&&u({formattedValue:b.formattedValue,numAsString:b.value}),s(b,w)},f=e,h=r;Oo(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return se.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function bK(e){return e.replace(/[^0-9]/g,"")}function wK(e){return e}function _K(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=wK);var a=e.removeFormatting;a===void 0&&(a=bK);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=Wi);var y=e.onKeyDown;y===void 0&&(y=Wi);var b=e.onMouseUp;b===void 0&&(b=Wi);var w=e.onFocus;w===void 0&&(w=Wi);var T=e.onBlur;T===void 0&&(T=Wi);var I=e.value,k=e.getCaretBoundary;k===void 0&&(k=yK);var N=e.isValidInputCharacter;N===void 0&&(N=ac);var U=e.isCharacterSame,L=sS(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),W=fS(I,c,!!u,o,a,l),q=W[0],X=q.formattedValue,re=q.numAsString,oe=W[1],H=se.useRef(),F=se.useRef({formattedValue:X,numAsString:re}),D=function(_e,me){F.current={formattedValue:_e.formattedValue,numAsString:_e.value},oe(_e,me)},p=se.useState(!1),d=p[0],m=p[1],x=se.useRef(null),A=se.useRef({setCaretTimeout:null,focusTimeout:null});se.useEffect(function(){return m(!0),function(){clearTimeout(A.current.setCaretTimeout),clearTimeout(A.current.focusTimeout)}},[]);var E=o,O=function(_e,me){var Me=parseFloat(me);return{formattedValue:_e,value:me,floatValue:isNaN(Me)?void 0:Me}},C=function(_e,me,Me){_e.selectionStart===0&&_e.selectionEnd===_e.value.length||(js(_e,me),A.current.setCaretTimeout=setTimeout(function(){_e.value===Me&&_e.selectionStart!==me&&js(_e,me)},0))},g=function(_e,me,Me){return Bv(_e,me,k(_e),Me)},v=function(_e,me,Me){var Ve=k(me),Ne=vK(me,X,_e,Me,Ve,N,U);return Ne=Bv(me,Ne,Ve),Ne},j=function(_e){var me=_e.formattedValue;me===void 0&&(me="");var Me=_e.input,Ve=_e.source,Ne=_e.event,Te=_e.numAsString,Oe;if(Me){var Le=_e.inputValue||Me.value,ut=hd(Me);Me.value=me,Oe=v(Le,me,ut),Oe!==void 0&&C(Me,Oe,me)}me!==X&&D(O(me,Te),{event:Ne,source:Ve})};se.useEffect(function(){var _e=F.current,me=_e.formattedValue,Me=_e.numAsString;(X!==me||re!==Me)&&D(O(X,re),{event:void 0,source:oc.props})},[X,re]);var ee=x.current?hd(x.current):void 0,ie=typeof window<"u"?se.useLayoutEffect:se.useEffect;ie(function(){var _e=x.current;if(X!==F.current.formattedValue&&_e){var me=v(F.current.formattedValue,X,ee);_e.value=X,C(_e,me,X)}},[X]);var fe=function(_e,me,Me){var Ve=me.target,Ne=H.current?dK(H.current,Ve.selectionEnd):lS(X,_e),Te=Object.assign(Object.assign({},Ne),{lastValue:X}),Oe=a(_e,Te),Le=E(Oe);if(Oe=a(Le,void 0),f&&!f(O(Le,Oe))){var ut=me.target,lt=hd(ut),We=v(_e,X,lt);return ut.value=X,C(ut,We,X),!1}return j({formattedValue:Le,numAsString:Oe,inputValue:_e,event:me,source:Me,input:me.target}),!0},ve=function(_e,me){me===void 0&&(me=0);var Me=_e.selectionStart,Ve=_e.selectionEnd;H.current={selectionStart:Me,selectionEnd:Ve+me}},Se=function(_e){var me=_e.target,Me=me.value,Ve=fe(Me,_e,oc.event);Ve&&h(_e),H.current=void 0},xe=function(_e){var me=_e.target,Me=_e.key,Ve=me.selectionStart,Ne=me.selectionEnd,Te=me.value;Te===void 0&&(Te="");var Oe;Me==="ArrowLeft"||Me==="Backspace"?Oe=Math.max(Ve-1,0):Me==="ArrowRight"?Oe=Math.min(Ve+1,Te.length):Me==="Delete"&&(Oe=Ve);var Le=0;Me==="Delete"&&Ve===Ne&&(Le=1);var ut=Me==="ArrowLeft"||Me==="ArrowRight";if(Oe===void 0||Ve!==Ne&&!ut){y(_e),ve(me,Le);return}var lt=Oe;if(ut){var We=Me==="ArrowLeft"?"left":"right";lt=g(Te,Oe,We),lt!==Oe&&_e.preventDefault()}else Me==="Delete"&&!N(Te[Oe])?lt=g(Te,Oe,"right"):Me==="Backspace"&&!N(Te[Oe])&&(lt=g(Te,Oe,"left"));lt!==Oe&&C(me,lt,Te),y(_e),ve(me,Le)},He=function(_e){var me=_e.target,Me=function(){var Ve=me.selectionStart,Ne=me.selectionEnd,Te=me.value;if(Te===void 0&&(Te=""),Ve===Ne){var Oe=g(Te,Ve);Oe!==Ve&&C(me,Oe,Te)}};Me(),requestAnimationFrame(function(){Me()}),b(_e),ve(me)},Fe=function(_e){_e.persist&&_e.persist();var me=_e.target,Me=_e.currentTarget;x.current=me,A.current.focusTimeout=setTimeout(function(){var Ve=me.selectionStart,Ne=me.selectionEnd,Te=me.value;Te===void 0&&(Te="");var Oe=g(Te,Ve);Oe!==Ve&&!(Ve===0&&Ne===Te.length)&&C(me,Oe,Te),w(Object.assign(Object.assign({},_e),{currentTarget:Me}))},0)},dt=function(_e){x.current=null,clearTimeout(A.current.focusTimeout),clearTimeout(A.current.setCaretTimeout),T(_e)},ht=d&&pK()?"numeric":void 0,De=Object.assign({inputMode:ht},L,{type:t,value:X,onChange:Se,onKeyDown:xe,onMouseUp:He,onFocus:Fe,onBlur:dt});if(r==="text")return i?se.createElement(se.Fragment,null,i(X,L)||null):se.createElement("span",Object.assign({},L,{ref:s}),X);if(n){var mt=n;return se.createElement(mt,Object.assign({},De,{ref:s}))}return se.createElement("input",Object.assign({},De,{ref:s}))}function Lv(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=cf(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=V0(e,o),y=h.beforeDecimal,b=h.afterDecimal,w=h.addNegation;return r!==void 0&&(b=cS(b,r,!!n)),u&&(y=uK(y,u,a)),i&&(y=i+y),s&&(b=b+s),w&&(y="-"+y),e=y+(f&&l||"")+b,e}function cf(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 xK(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 SK(e,t){return new RegExp("(^-)|[0-9]|"+aS(e),t?"g":void 0)}function EK(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function CK(e,t,r){var n;t===void 0&&(t=mK(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=cf(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,w=e[f]===b;if(ac(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var T=a===0?"":b;e=e.substring(0,l)+T+e.substring(l+1,e.length)}var I=function(x,A,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),A-=g,E-=g),{value:x,start:A,end:E,hasNegation:O}},k=I(e,l,f),N=k.hasNegation;n=k,e=n.value,l=n.start,f=n.end;var U=I(t.lastValue,c.start,c.end),L=U.start,W=U.end,q=U.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 re=0;e.startsWith(s)?re+=s.length:l<s.length&&(re=l),e=e.substring(re),f-=re;var oe=e.length,H=e.length-o.length;e.endsWith(o)?oe=H:(f>H||f>e.length-o.length)&&(oe=f),e=e.substring(0,oe),e=xK(N?"-"+e:e,i),e=(e.match(SK(b,!0))||[]).join("");var F=e.indexOf(b);e=e.replace(new RegExp(aS(b),"g"),function(x,A){return A===F?".":""});var D=V0(e,i),p=D.beforeDecimal,d=D.afterDecimal,m=D.addNegation;return u.end-u.start<c.end-c.start&&p===""&&w&&!parseFloat(d)&&(e=m?"-":""),e}function AK(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 MK(e){var t=cf(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
|
+
Decimal separator can't be same as thousand separator.
|
|
108
|
+
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
109
|
+
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
|
110
|
+
`);return i.startsWith("-")&&s&&(console.error(`
|
|
111
|
+
Prefix can't start with '-' when allowNegative is true.
|
|
112
|
+
prefix: `+i+`
|
|
113
|
+
allowNegative: `+s+`
|
|
114
|
+
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function TK(e){e=MK(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=Wi);var s=e.onBlur;s===void 0&&(s=Wi);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=sS(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=cf(e),T=w.decimalSeparator,I=w.allowedDecimalSeparators,k=function(m){return Lv(m,e)},N=function(m,x){return CK(m,x,e)},U=Oo(f)?l:f,L=h??EK(U,u,t);Oo(f)?Oo(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var W=function(m){return oS(m)?m:(typeof m=="number"&&(m=uS(m)),L&&typeof a=="number"?$v(m,a,!!c):m)},q=fS(W(f),W(l),!!L,k,N,y),X=q[0],re=X.numAsString,oe=X.formattedValue,H=q[1],F=function(m){var x=m.target,A=m.key,E=x.selectionStart,O=x.selectionEnd,C=x.value;if(C===void 0&&(C=""),(A==="Backspace"||A==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}A==="Backspace"&&C[0]==="-"&&E===u.length+1&&r&&js(x,1),a&&c&&(A==="Backspace"&&C[E-1]===T?(js(x,E-1),m.preventDefault()):A==="Delete"&&C[E]===T&&m.preventDefault()),I!=null&&I.includes(A)&&C[E]===T&&js(x,E+1);var g=o===!0?",":o;A==="Backspace"&&C[E-1]===g&&js(x,E-1),A==="Delete"&&C[E]===g&&js(x,E+1),i(m)},D=function(m){var x=re;if(x.match(/\d/g)||(x=""),n||(x=fK(x)),c&&a&&(x=$v(x,a,c)),x!==re){var A=Lv(x,e);H({formattedValue:A,value:x,floatValue:parseFloat(x)},{event:m,source:oc.event})}s(m)},p=function(m){return m===T?!0:ac(m)},d=function(m){var x=m.currentValue,A=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,C=m.formattedValueIndex,g=x[O],v=E[C],j=lS(A,x),ee=j.to,ie=function(fe){return N(fe).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===T&&ie(x)<O&&ie(E)>C?!1:O>=ee.start&&O<ee.end&&I&&I.includes(g)&&v===T?!0:g===v};return Object.assign(Object.assign({},b),{value:oe,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:H,format:k,removeFormatting:N,getCaretBoundary:function(m){return AK(m,e)},onKeyDown:F,onBlur:D})}function OK(e){var t=TK(e);return se.createElement(_K,Object.assign({},t))}function IK(e){const{className:t,value:r,decimals:n,placeholder:i,style:s,onChange:o,maxValue:a,minValue:c=0,inputAllowed:u=!0,prefix:l,...f}=e,h=y=>{var T;const b=((T=y==null?void 0:y.target)==null?void 0:T.value)||"";let w=b;if(b.startsWith("0")&&b!=="0"&&!b.startsWith("0.")&&(w=b.replace(/^0+/,"")),w){if(w.startsWith(".")){o(w.slice(1,w.length));return}let I=String(w).replace(/,/g,"");if(I.startsWith("-")){o("");return}l&&(I=I.replace(l,"")),a!==void 0&&Be(I).gt(a)?I=a.toString():c!==void 0&&Be(I).lt(c)&&(I=c.toString()),o(String(I))}else o("")};return _.jsx(OK,{className:t,value:r,disabled:!u,placeholder:i,decimalScale:n,prefix:l,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:y=>!y.value.startsWith("-"),onChange:h,...f,style:{...s,cursor:u?"pointer":"not-allowed",fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",fontFeatureSettings:"tnum",fontVariant:"tabular-nums"}})}function PK(e){const{token:t,handleTokenSelectClick:r}=e;return _.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[_.jsx("div",{className:"token-img-box",children:_.jsx(Wr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),_.jsx("div",{className:"name",children:_.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function Fv({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]=se.useState(!1),{currentAccount:b}=Nn(),w=()=>{const I=Be((n==null?void 0:n.totalBalanceFormat)||"0").div(2),k=Mr(I.toString(),o==null?void 0:o.decimals,!0).toString();t&&Be(k).eq(t)||i(k)},T=()=>{const I=Be((n==null?void 0:n.totalBalanceFormat)||0),k=Tr((o==null?void 0:o.coin_type)||"").full_address===On.SUI_TYPE_ARG,N=.05;let U=I;k&&Be(I).gt(N)&&(U=U.sub(N)),!(t&&Be(U).eq(t))&&Be(U).gte(0)&&i(U.toString())};return _.jsxs("div",{className:h?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:f},children:[_.jsxs("div",{className:"title",children:[" ",e," "]}),_.jsxs("div",{className:"token-input",children:[a?_.jsxs("div",{style:{flex:1},children:[" ",_.jsx(ra,{style:{width:"200px",height:"28px",flex:1}})," "]}):_.jsx(IK,{inputAllowed:l,value:t,decimals:(o==null?void 0:o.decimals)||9,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),_.jsx(PK,{token:o,handleTokenSelectClick:s})]}),_.jsxs("div",{className:"info-box",children:[!a&&r&&Be(r).gt(0)?_.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:Sx(r,2)}):_.jsx("div",{}),b&&o&&_.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[_.jsxs("div",{className:"token-balance",children:[_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-wallet"})}),_.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),_.jsxs("div",{className:"btn-box",children:[u&&_.jsx("button",{className:"cs-outline-btn",onClick:w,children:"HALF"}),c&&_.jsx("button",{className:"cs-outline-btn",onClick:T,children:"MAX"})]})]})]})]})}function kK({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Nn(),{getOwnerCoinBalances:s}=Yu(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:b,isOpenTokensDialog:w,setIsOpenTokensDialog:T}=dn(),{handleAmountChange:I,handleSelectToken:k,fromBalanceInfo:N,toBalanceInfo:U,fromAmountValue:L,toAmountValue:W,doSwapAction:q,reCalculateRouteData:X,refreshMarketPrice:re,scamsText:oe}=az(),{slippage:H}=Lr(),{isCustomMode:F,customWarnTokenList:D}=KU(o==null?void 0:o.coin_type,a==null?void 0:a.coin_type),{amountLimit:p}=y3(H,h),{formatSwapRouter:d}=WU(h),[m,x]=se.useState(!1),{btnText:A,btnDisabled:E}=cz(N==null?void 0:N.totalBalanceFormat),[O,C]=se.useState(!1),[g,v]=se.useState(!1);se.useEffect(()=>{y?e>=5&&j():e>=20&&j()},[e]);const j=()=>{X(),n&&s(),re()},ee=()=>({...h}),ie=async()=>{a&&k(a,!0)};return _.jsxs("div",{className:"swap-trade-box",children:[_.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[_.jsx(Fv,{loading:!f&&l,balance:N,amountValue:L,handleTokenSelectClick:()=>{C(!0),T(!0)},onInputChange:fe=>{I(fe,!0)},amount:c,token:o}),_.jsx("div",{onClick:ie,className:"swap-icon",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{cursor:"pointer"},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:_.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),_.jsx(Fv,{marginTop:"-20px",loading:f&&l,balance:U,showHalf:!1,showMax:!1,amountValue:W,handleTokenSelectClick:()=>{C(!1),T(!0)},onInputChange:fe=>{I(fe,!1)},inputAllowed:!1,amount:u,token:a})]}),oe&&_.jsx(lz,{scamsText:oe}),_.jsxs("div",{className:"swap-bottom-block",style:{border:E?"0px solid #2a3238":"1px solid #2a3238"},children:[_.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:E||l,onClick:()=>{n?F&&D.length>0?v(!0):b(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(_3,{})}):A}),c&&u&&Be(c).gt(0)&&Be(u).gt(0)&&_.jsxs("div",{className:"content",children:[_.jsxs("div",{className:"price-related-info",children:[h&&!(h!=null&&h.errorCode)&&_.jsx(k0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),_.jsx(E3,{isLoading:l,routerData:h})]}),_.jsx(C3,{isLoading:l,amountLimit:p}),_.jsx(nS,{hasSubMenu:!0,formatSwapRouter:d,isLoading:l})]})]}),y&&_.jsx(AG,{data:ee(),toBack:()=>b(!1),onSubmitClick:async fe=>{try{await q(fe,r==null?void 0:r.partner)}finally{b(!1)}}}),w&&_.jsx(nK,{currToken:O?o:a,backClick:()=>T(!1),onSelectToken:fe=>{k(fe,O),T(!1)}}),g&&D.length>0&&_.jsx(sK,{onClose:()=>{v(!1)},tokenList:D,onSureClick:()=>{v(!1),b(!0)}})]})}function jK({initProps:e={},customWallet:t}){PU();const{ToastContainer:r}=na(),{fetchRouterConfig:n}=SU(),{getTokens:i}=ps(),{fetchTokenPrices:s}=Jl(),{transactionData:o,setTransactionData:a}=O0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=dn(),[y,b]=se.useState(0),w=se.useRef(y);IU(e),se.useEffect(()=>{i(),s([]),n()},[]),se.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),EU({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&T():w.current>=20&&T()}});const T=()=>{w.current=20,b(20),setTimeout(()=>{w.current=0,b(0)},20)};return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-container",id:"cs-swap-widget",children:[_.jsx(bU,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),_.jsx(iU,{handleRefresh:T}),_.jsx(kK,{refreshCount:y,customWallet:t,initProps:e}),o&&_.jsx(wU,{transactionData:o,onClose:()=>{a(void 0)}}),_.jsx(r,{})]})})}function q0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Yu(),n=Vr.useCurrentAccount(),{saveCurrentAccount:i}=Nn(),{mutate:s}=Vr.useConnectWallet();return se.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),se.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),_.jsx(jK,{initProps:e,customWallet:t})}function RK({initProps:e,customWallet:t}){const[r,n]=se.useState(!0);return _.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&_.jsx("div",{className:"swap-modal-box",children:_.jsx(q0,{initProps:e,customWallet:t})}),_.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function NK({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=se.useState(!1),o=()=>{s(!i)};return _.jsxs("div",{className:"widget-btn-box",children:[_.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})}):_.jsx("img",{src:Lt("/images/img-logo@2x.png")})}),i&&_.jsx("div",{className:`widget-modal ${t} ${e}`,children:_.jsx(q0,{initProps:r,customWallet:n})})]})}function DK({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return _.jsxs(Fl,{appearance:"dark",children:[r==="Integrated"&&_.jsx(q0,{initProps:e,customWallet:t}),r==="Widget"&&_.jsx(NK,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&_.jsx(RK,{initProps:e,customWallet:t})]})}const $K=DK;exports.CetusSwap=$K;
|