9 lines
114 KiB
JavaScript
9 lines
114 KiB
JavaScript
import{a as Zn,b as oo,c as io,h as uo,i as qt,k as Eo,l as Ao,o as Oo,p as wo,q as Po,r as Ro,s as ko,u as Vo,v as Bo}from"./chunk-FVJO2JSC.js";import{a as Lr,h as ft}from"./chunk-S6TZRL6J.js";import{b as No,e as Co}from"./chunk-CZLLWOTV.js";import{c as So}from"./chunk-NWVG2MAV.js";import{a as bo,b as yo,c as Br,d as Mr,e as Gt,f as Io,i as A,j as Do,k as w,n as Lo}from"./chunk-FWA7C7Y4.js";import{a as me}from"./chunk-QPJLI3SF.js";import{b as so}from"./chunk-6FDARXB6.js";import{a as co,d as kr,j as lo}from"./chunk-JWQKG6DL.js";import{a as To}from"./chunk-UCUZGEE5.js";import{a as xo}from"./chunk-4NS73UGB.js";import{c as G}from"./chunk-UJIS6BFS.js";import{l as N,m as Se,n as b}from"./chunk-GRAP3YP7.js";import{d as Vr,g as fo}from"./chunk-46YG4TCM.js";import{c as Ut,d as to}from"./chunk-GDM6S2OD.js";import{a as he}from"./chunk-XC6ELVTG.js";import{a as ho,b as po,c as mo,d as _o,e as vo,f as Wt,g as go}from"./chunk-YFP4Y2VE.js";import{a as ao}from"./chunk-Z3DVZYQL.js";import{a as K,c as Rr,e as Re,g as oe,h as dt,j as jt,k as ro,u as pe,w as no}from"./chunk-TVUCEIYF.js";import{Aa as Mt,Ba as lt,Da as le,Ea as Pe,Eb as de,Fa as He,G as ct,Gb as jn,Ic as Hn,J as ut,K as kn,Kc as zn,La as Dr,Mb as fe,Nc as Yn,Pc as Xn,R as Cr,S as wr,Sc as Jn,T as Vn,U as Ln,W as Bn,Zb as Wn,_b as qn,ea as Ir,fa as xr,ia as ue,id as Qn,jc as Gn,la as Mn,ma as Fn,md as E,p as J,r as Rn,rb as Pr,rc as $n,sb as x,sc as Kn,tb as P,vb as Un}from"./chunk-MYNBMTR4.js";import{b as eo,c as Ft}from"./chunk-FY3DWHT4.js";import{D as Nr,G as B,Q as Bt,S as Dn,b as In,ba as Pn,ca as k,f as kt,g as Vt,j as U,k as xn,l as Lt,m as Ke}from"./chunk-TQQZZJXW.js";import{a as Ar}from"./chunk-62FSCPM5.js";import{a as Or}from"./chunk-J5JOI62E.js";import{G as $e,H as ne,a as Ea,o as wn}from"./chunk-GQZAGQSC.js";import{C as An,D as On,H as Nn,K as Cn,L as st,f as Tn,ga as Rt,j as O,ma as Tr,ra as De,w as Er}from"./chunk-GSIHKWLV.js";import{fa as q}from"./chunk-RC6UR2LL.js";import{b as X}from"./chunk-BF2V36QE.js";import{f as D,h as c,o as f,q as h}from"./chunk-QTLWQ5AJ.js";f();h();var Ie=D(X()),Pt=D(Ar());f();h();f();h();var yr=D(X());f();h();f();h();De();f();h();De();f();h();f();h();var cc=D(X());f();h();var $t=D(X());f();h();var Mo=D(X()),wc=(0,Mo.createContext)({initialProps:{},getInitialProps:()=>Promise.reject(Error("You may forget to use InitialPropsProvider"))});f();h();var Gc=D(X());f();h();f();h();function S(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];if(!1)var o;throw new Error(typeof n=="number"?"[MobX] minified error nr: "+n+(t.length?" "+t.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+n)}var Aa={};function ei(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:Aa}var ti=Object.assign,Yt=Object.getOwnPropertyDescriptor,ie=Object.defineProperty,nr=Object.prototype,Gr=[];Object.freeze(Gr);var ri={};Object.freeze(ri);var Oa=typeof Proxy<"u",Na=Object.toString();function ni(){Oa||S("Proxy not available")}function oi(n){var e=!1;return function(){if(!e)return e=!0,n.apply(this,arguments)}}var Ye=function(){};function re(n){return typeof n=="function"}function Ve(n){var e=typeof n;switch(e){case"string":case"symbol":case"number":return!0}return!1}function or(n){return n!==null&&typeof n=="object"}function ve(n){if(!or(n))return!1;var e=Object.getPrototypeOf(n);if(e==null)return!0;var t=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t.toString()===Na}function ii(n){var e=n?.constructor;return e?e.name==="GeneratorFunction"||e.displayName==="GeneratorFunction":!1}function ir(n,e,t){ie(n,e,{enumerable:!1,writable:!0,configurable:!0,value:t})}function ai(n,e,t){ie(n,e,{enumerable:!1,writable:!1,configurable:!0,value:t})}function Be(n,e){var t="isMobX"+n;return e.prototype[t]=!0,function(r){return or(r)&&r[t]===!0}}function nt(n){return n instanceof Map}function St(n){return n instanceof Set}var si=typeof Object.getOwnPropertySymbols<"u";function Ca(n){var e=Object.keys(n);if(!si)return e;var t=Object.getOwnPropertySymbols(n);return t.length?[].concat(e,t.filter(function(r){return nr.propertyIsEnumerable.call(n,r)})):e}var pt=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:si?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames;function ci(n){return n===null?null:typeof n=="object"?""+n:n}function Te(n,e){return nr.hasOwnProperty.call(n,e)}var wa=Object.getOwnPropertyDescriptors||function(e){var t={};return pt(e).forEach(function(r){t[r]=Yt(e,r)}),t};function Fo(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,Da(r.key),r)}}function Jr(n,e,t){return e&&Fo(n.prototype,e),t&&Fo(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function mt(){return mt=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},mt.apply(this,arguments)}function ui(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,$r(n,e)}function $r(n,e){return $r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},$r(n,e)}function Fr(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Ia(n,e){if(!!n){if(typeof n=="string")return Uo(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Uo(n,e)}}function Uo(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Xe(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t)return(t=t.call(n)).next.bind(t);if(Array.isArray(n)||(t=Ia(n))||e&&n&&typeof n.length=="number"){t&&(n=t);var r=0;return function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xa(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Da(n){var e=xa(n,"string");return typeof e=="symbol"?e:String(e)}var Je=Symbol("mobx-stored-annotations");function ae(n){function e(t,r){Et(t,r,n)}return Object.assign(e,n)}function Et(n,e,t){if(Te(n,Je)||ir(n,Je,mt({},n[Je])),!1)var r;Pa(n,t,e),Ua(t)||(n[Je][e]=t)}function Pa(n,e,t){if(!1)var r,o,i}var g=Symbol("mobx administration"),Tt=function(){function n(t){t===void 0&&(t="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=y.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=t}var e=n.prototype;return e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},e.reportObserved=function(){return wi(this)},e.reportChanged=function(){H(),Ii(this),z()},e.toString=function(){return this.name_},n}(),Qr=Be("Atom",Tt);function li(n,e,t){e===void 0&&(e=Ye),t===void 0&&(t=Ye);var r=new Tt(n);return e!==Ye&&Us(r,e),t!==Ye&&Li(r,t),r}function Ra(n,e){return n===e}function ka(n,e){return on(n,e)}function Va(n,e){return on(n,e,1)}function La(n,e){return Object.is?Object.is(n,e):n===e?n!==0||1/n===1/e:n!==n&&e!==e}var Xt={identity:Ra,structural:ka,default:La,shallow:Va};function et(n,e,t){return Ui(n)?n:Array.isArray(n)?M.array(n,{name:t}):ve(n)?M.object(n,void 0,{name:t}):nt(n)?M.map(n,{name:t}):St(n)?M.set(n,{name:t}):typeof n=="function"&&!tn(n)&&!er(n)?ii(n)?gt(n):vt(t,n):n}function Ba(n,e,t){if(n==null||bt(n)||lr(n)||Me(n)||it(n))return n;if(Array.isArray(n))return M.array(n,{name:t,deep:!1});if(ve(n))return M.object(n,void 0,{name:t,deep:!1});if(nt(n))return M.map(n,{name:t,deep:!1});if(St(n))return M.set(n,{name:t,deep:!1})}function ar(n){return n}function Ma(n,e){return on(n,e)?e:n}var Fa="override";function Ua(n){return n.annotationType_===Fa}function At(n,e){return{annotationType_:n,options_:e,make_:ja,extend_:Wa}}function ja(n,e,t,r){var o;if((o=this.options_)!=null&&o.bound)return this.extend_(n,e,t,!1)===null?0:1;if(r===n.target_)return this.extend_(n,e,t,!1)===null?0:2;if(tn(t.value))return 1;var i=di(n,this,e,t,!1);return ie(r,e,i),2}function Wa(n,e,t,r){var o=di(n,this,e,t);return n.defineProperty_(e,o,r)}function qa(n,e,t,r){var o=e.annotationType_,i=r.value}function di(n,e,t,r,o){var i,a,s,u,l,d,m;o===void 0&&(o=p.safeDescriptors),qa(n,e,t,r);var _=r.value;if((i=e.options_)!=null&&i.bound){var T;_=_.bind((T=n.proxy_)!=null?T:n.target_)}return{value:tt((a=(s=e.options_)==null?void 0:s.name)!=null?a:t.toString(),_,(u=(l=e.options_)==null?void 0:l.autoAction)!=null?u:!1,(d=e.options_)!=null&&d.bound?(m=n.proxy_)!=null?m:n.target_:void 0),configurable:o?n.isPlainObject_:!0,enumerable:!1,writable:!o}}function fi(n,e){return{annotationType_:n,options_:e,make_:Ga,extend_:$a}}function Ga(n,e,t,r){var o;if(r===n.target_)return this.extend_(n,e,t,!1)===null?0:2;if((o=this.options_)!=null&&o.bound&&(!Te(n.target_,e)||!er(n.target_[e]))&&this.extend_(n,e,t,!1)===null)return 0;if(er(t.value))return 1;var i=hi(n,this,e,t,!1,!1);return ie(r,e,i),2}function $a(n,e,t,r){var o,i=hi(n,this,e,t,(o=this.options_)==null?void 0:o.bound);return n.defineProperty_(e,i,r)}function Ka(n,e,t,r){var o=e.annotationType_,i=r.value}function hi(n,e,t,r,o,i){i===void 0&&(i=p.safeDescriptors),Ka(n,e,t,r);var a=r.value;if(er(a)||(a=gt(a)),o){var s;a=a.bind((s=n.proxy_)!=null?s:n.target_),a.isMobXFlow=!0}return{value:a,configurable:i?n.isPlainObject_:!0,enumerable:!1,writable:!i}}function Zr(n,e){return{annotationType_:n,options_:e,make_:Ha,extend_:za}}function Ha(n,e,t){return this.extend_(n,e,t,!1)===null?0:1}function za(n,e,t,r){return Ya(n,this,e,t),n.defineComputedProperty_(e,mt({},this.options_,{get:t.get,set:t.set}),r)}function Ya(n,e,t,r){var o=e.annotationType_,i=r.get}function sr(n,e){return{annotationType_:n,options_:e,make_:Xa,extend_:Ja}}function Xa(n,e,t){return this.extend_(n,e,t,!1)===null?0:1}function Ja(n,e,t,r){var o,i;return Qa(n,this,e,t),n.defineObservableProperty_(e,t.value,(o=(i=this.options_)==null?void 0:i.enhancer)!=null?o:et,r)}function Qa(n,e,t,r){var o=e.annotationType_}var Za="true",es=pi();function pi(n){return{annotationType_:Za,options_:n,make_:ts,extend_:rs}}function ts(n,e,t,r){var o,i;if(t.get)return cr.make_(n,e,t,r);if(t.set){var a=tt(e.toString(),t.set);return r===n.target_?n.defineProperty_(e,{configurable:p.safeDescriptors?n.isPlainObject_:!0,set:a})===null?0:2:(ie(r,e,{configurable:!0,set:a}),2)}if(r!==n.target_&&typeof t.value=="function"){var s;if(ii(t.value)){var u,l=(u=this.options_)!=null&&u.autoBind?gt.bound:gt;return l.make_(n,e,t,r)}var d=(s=this.options_)!=null&&s.autoBind?vt.bound:vt;return d.make_(n,e,t,r)}var m=((o=this.options_)==null?void 0:o.deep)===!1?M.ref:M;if(typeof t.value=="function"&&(i=this.options_)!=null&&i.autoBind){var _;t.value=t.value.bind((_=n.proxy_)!=null?_:n.target_)}return m.make_(n,e,t,r)}function rs(n,e,t,r){var o,i;if(t.get)return cr.extend_(n,e,t,r);if(t.set)return n.defineProperty_(e,{configurable:p.safeDescriptors?n.isPlainObject_:!0,set:tt(e.toString(),t.set)},r);if(typeof t.value=="function"&&(o=this.options_)!=null&&o.autoBind){var a;t.value=t.value.bind((a=n.proxy_)!=null?a:n.target_)}var s=((i=this.options_)==null?void 0:i.deep)===!1?M.ref:M;return s.extend_(n,e,t,r)}var ns="observable",os="observable.ref",is="observable.shallow",as="observable.struct",mi={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(mi);function Kt(n){return n||mi}var _i=sr(ns),ss=sr(os,{enhancer:ar}),cs=sr(is,{enhancer:Ba}),us=sr(as,{enhancer:Ma}),vi=ae(_i);function Ht(n){return n.deep===!0?et:n.deep===!1?ar:ds(n.defaultDecorator)}function ls(n){var e;return n?(e=n.defaultDecorator)!=null?e:pi(n):void 0}function ds(n){var e,t;return n&&(e=(t=n.options_)==null?void 0:t.enhancer)!=null?e:et}function gi(n,e,t){if(Ve(e)){Et(n,e,_i);return}return Ui(n)?n:ve(n)?M.object(n,e,t):Array.isArray(n)?M.array(n,e):nt(n)?M.map(n,e):St(n)?M.set(n,e):typeof n=="object"&&n!==null?n:M.box(n,e)}ti(gi,vi);var fs={box:function(e,t){var r=Kt(t);return new Ze(e,Ht(r),r.name,!0,r.equals)},array:function(e,t){var r=Kt(t);return(p.useProxies===!1||r.proxy===!1?ic:Xs)(e,Ht(r),r.name)},map:function(e,t){var r=Kt(t);return new $i(e,Ht(r),r.name)},set:function(e,t){var r=Kt(t);return new zi(e,Ht(r),r.name)},object:function(e,t,r){return Mi(p.useProxies===!1||r?.proxy===!1?dr({},r):Hs({},r),e,t)},ref:ae(ss),shallow:ae(cs),deep:vi,struct:ae(us)},M=ti(gi,fs),bi="computed",hs="computed.struct",yi=Zr(bi),ps=Zr(hs,{equals:Xt.structural}),cr=function(e,t){if(Ve(t))return Et(e,t,yi);if(ve(e))return ae(Zr(bi,e));var r=ve(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new _t(r)};Object.assign(cr,yi);cr.struct=ae(ps);var jo,Wo,Jt=0,ms=1,_s=(jo=(Wo=Yt(function(){},"name"))==null?void 0:Wo.configurable)!=null?jo:!1,qo={value:"action",configurable:!0,writable:!1,enumerable:!1};function tt(n,e,t,r){t===void 0&&(t=!1);function o(){return vs(n,t,e,r||this,arguments)}return o.isMobxAction=!0,_s&&(qo.value=n,ie(o,"name",qo)),o}function vs(n,e,t,r,o){var i=gs(n,e,r,o);try{return t.apply(r,o)}catch(a){throw i.error_=a,a}finally{bs(i)}}function gs(n,e,t,r){var o=!1,i=0;if(!1)var a;var s=p.trackingDerivation,u=!e||!s;H();var l=p.allowStateChanges;u&&(ot(),l=Ot(!0));var d=en(!0),m={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:d,notifySpy_:o,startTime_:i,actionId_:ms++,parentActionId_:Jt};return Jt=m.actionId_,m}function bs(n){Jt!==n.actionId_&&S(30),Jt=n.parentActionId_,n.error_!==void 0&&(p.suppressReactionErrors=!0),Nt(n.prevAllowStateChanges_),ht(n.prevAllowStateReads_),z(),n.runAsAction_&&Oe(n.prevDerivation_),p.suppressReactionErrors=!1}function ys(n,e){var t=Ot(n);try{return e()}finally{Nt(t)}}function Ot(n){var e=p.allowStateChanges;return p.allowStateChanges=n,e}function Nt(n){p.allowStateChanges=n}var Si;Si=Symbol.toPrimitive;var Ze=function(n){ui(e,n);function e(r,o,i,a,s){var u;return i===void 0&&(i="ObservableValue"),a===void 0&&(a=!0),s===void 0&&(s=Xt.default),u=n.call(this,i)||this,u.enhancer=void 0,u.name_=void 0,u.equals=void 0,u.hasUnreportedChange_=!1,u.interceptors_=void 0,u.changeListeners_=void 0,u.value_=void 0,u.dehancer=void 0,u.enhancer=o,u.name_=i,u.equals=s,u.value_=o(r,void 0,i),u}var t=e.prototype;return t.dehanceValue=function(o){return this.dehancer!==void 0?this.dehancer(o):o},t.set=function(o){var i=this.value_;if(o=this.prepareNewValue_(o),o!==p.UNCHANGED){var a=ke();this.setNewValue_(o)}},t.prepareNewValue_=function(o){if(rt(this),Q(this)){var i=Z(this,{object:this,type:se,newValue:o});if(!i)return p.UNCHANGED;o=i.newValue}return o=this.enhancer(o,this.value_,this.name_),this.equals(this.value_,o)?p.UNCHANGED:o},t.setNewValue_=function(o){var i=this.value_;this.value_=o,this.reportChanged(),ee(this)&&te(this,{type:se,object:this,newValue:o,oldValue:i})},t.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},t.intercept_=function(o){return Ct(this,o)},t.observe_=function(o,i){return i&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:se,newValue:this.value_,oldValue:void 0}),wt(this,o)},t.raw=function(){return this.value_},t.toJSON=function(){return this.get()},t.toString=function(){return this.name_+"["+this.value_+"]"},t.valueOf=function(){return ci(this.get())},t[Si]=function(){return this.valueOf()},e}(Tt);var Ei;Ei=Symbol.toPrimitive;var _t=function(){function n(t){this.dependenciesState_=y.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=y.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Qt(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ae.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,t.get||S(31),this.derivation=t.get,this.name_=t.name||"ComputedValue",t.set&&(this.setter_=tt("ComputedValue-setter",t.set)),this.equals_=t.equals||(t.compareStructural||t.struct?Xt.structural:Xt.default),this.scope_=t.context,this.requiresReaction_=t.requiresReaction,this.keepAlive_=!!t.keepAlive}var e=n.prototype;return e.onBecomeStale_=function(){Os(this)},e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},e.get=function(){if(this.isComputing_&&S(32,this.name_,this.derivation),p.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Kr(this)&&(this.warnAboutUntrackedRead_(),H(),this.value_=this.computeValue_(!1),z());else if(wi(this),Kr(this)){var r=p.trackingContext;this.keepAlive_&&!r&&(p.trackingContext=this),this.trackAndCompute()&&As(this),p.trackingContext=r}var o=this.value_;if(zt(o))throw o.cause;return o},e.set=function(r){if(this.setter_){this.isRunningSetter_&&S(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter_=!1}}else S(34,this.name_)},e.trackAndCompute=function(){var r=this.value_,o=this.dependenciesState_===y.NOT_TRACKING_,i=this.computeValue_(!0),a=o||zt(r)||zt(i)||!this.equals_(r,i);return a&&(this.value_=i),a},e.computeValue_=function(r){this.isComputing_=!0;var o=Ot(!1),i;if(r)i=Ti(this,this.derivation,this.scope_);else if(p.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(a){i=new Qt(a)}return Nt(o),this.isComputing_=!1,i},e.suspend_=function(){this.keepAlive_||(Hr(this),this.value_=void 0)},e.observe_=function(r,o){var i=this,a=!0,s=void 0;return Vs(function(){var u=i.get();if(!a||o){var l=ot();r({observableKind:"computed",debugObjectName:i.name_,type:se,object:i,newValue:u,oldValue:s}),Oe(l)}a=!1,s=u})},e.warnAboutUntrackedRead_=function(){},e.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},e.valueOf=function(){return ci(this.get())},e[Ei]=function(){return this.valueOf()},n}(),ur=Be("ComputedValue",_t),y;(function(n){n[n.NOT_TRACKING_=-1]="NOT_TRACKING_",n[n.UP_TO_DATE_=0]="UP_TO_DATE_",n[n.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",n[n.STALE_=2]="STALE_"})(y||(y={}));var Ae;(function(n){n[n.NONE=0]="NONE",n[n.LOG=1]="LOG",n[n.BREAK=2]="BREAK"})(Ae||(Ae={}));var Qt=function(e){this.cause=void 0,this.cause=e};function zt(n){return n instanceof Qt}function Kr(n){switch(n.dependenciesState_){case y.UP_TO_DATE_:return!1;case y.NOT_TRACKING_:case y.STALE_:return!0;case y.POSSIBLY_STALE_:{for(var e=en(!0),t=ot(),r=n.observing_,o=r.length,i=0;i<o;i++){var a=r[i];if(ur(a)){if(p.disableErrorBoundaries)a.get();else try{a.get()}catch{return Oe(t),ht(e),!0}if(n.dependenciesState_===y.STALE_)return Oe(t),ht(e),!0}}return Oi(n),Oe(t),ht(e),!1}}}function rt(n){return;var e}function Ti(n,e,t){var r=en(!0);Oi(n),n.newObserving_=new Array(n.observing_.length+100),n.unboundDepsCount_=0,n.runId_=++p.runId;var o=p.trackingDerivation;p.trackingDerivation=n,p.inBatch++;var i;if(p.disableErrorBoundaries===!0)i=e.call(t);else try{i=e.call(t)}catch(a){i=new Qt(a)}return p.inBatch--,p.trackingDerivation=o,Ss(n),ht(r),i}function Ss(n){for(var e=n.observing_,t=n.observing_=n.newObserving_,r=y.UP_TO_DATE_,o=0,i=n.unboundDepsCount_,a=0;a<i;a++){var s=t[a];s.diffValue_===0&&(s.diffValue_=1,o!==a&&(t[o]=s),o++),s.dependenciesState_>r&&(r=s.dependenciesState_)}for(t.length=o,n.newObserving_=null,i=e.length;i--;){var u=e[i];u.diffValue_===0&&Ni(u,n),u.diffValue_=0}for(;o--;){var l=t[o];l.diffValue_===1&&(l.diffValue_=0,Ts(l,n))}r!==y.UP_TO_DATE_&&(n.dependenciesState_=r,n.onBecomeStale_())}function Hr(n){var e=n.observing_;n.observing_=[];for(var t=e.length;t--;)Ni(e[t],n);n.dependenciesState_=y.NOT_TRACKING_}function Ai(n){var e=ot();try{return n()}finally{Oe(e)}}function ot(){var n=p.trackingDerivation;return p.trackingDerivation=null,n}function Oe(n){p.trackingDerivation=n}function en(n){var e=p.allowStateReads;return p.allowStateReads=n,e}function ht(n){p.allowStateReads=n}function Oi(n){if(n.dependenciesState_!==y.UP_TO_DATE_){n.dependenciesState_=y.UP_TO_DATE_;for(var e=n.observing_,t=e.length;t--;)e[t].lowestObserverState_=y.UP_TO_DATE_}}var Ur=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},jr=!0,Es=!1,p=function(){var n=ei();return n.__mobxInstanceCount>0&&!n.__mobxGlobals&&(jr=!1),n.__mobxGlobals&&n.__mobxGlobals.version!==new Ur().version&&(jr=!1),jr?n.__mobxGlobals?(n.__mobxInstanceCount+=1,n.__mobxGlobals.UNCHANGED||(n.__mobxGlobals.UNCHANGED={}),n.__mobxGlobals):(n.__mobxInstanceCount=1,n.__mobxGlobals=new Ur):(setTimeout(function(){Es||S(35)},1),new Ur)}();function Ts(n,e){n.observers_.add(e),n.lowestObserverState_>e.dependenciesState_&&(n.lowestObserverState_=e.dependenciesState_)}function Ni(n,e){n.observers_.delete(e),n.observers_.size===0&&Ci(n)}function Ci(n){n.isPendingUnobservation_===!1&&(n.isPendingUnobservation_=!0,p.pendingUnobservations.push(n))}function H(){p.inBatch++}function z(){if(--p.inBatch===0){xi();for(var n=p.pendingUnobservations,e=0;e<n.length;e++){var t=n[e];t.isPendingUnobservation_=!1,t.observers_.size===0&&(t.isBeingObserved_&&(t.isBeingObserved_=!1,t.onBUO()),t instanceof _t&&t.suspend_())}p.pendingUnobservations=[]}}function wi(n){var e=p.trackingDerivation;return e!==null?(e.runId_!==n.lastAccessedBy_&&(n.lastAccessedBy_=e.runId_,e.newObserving_[e.unboundDepsCount_++]=n,!n.isBeingObserved_&&p.trackingContext&&(n.isBeingObserved_=!0,n.onBO())),n.isBeingObserved_):(n.observers_.size===0&&p.inBatch>0&&Ci(n),!1)}function Ii(n){n.lowestObserverState_!==y.STALE_&&(n.lowestObserverState_=y.STALE_,n.observers_.forEach(function(e){e.dependenciesState_===y.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=y.STALE_}))}function As(n){n.lowestObserverState_!==y.STALE_&&(n.lowestObserverState_=y.STALE_,n.observers_.forEach(function(e){e.dependenciesState_===y.POSSIBLY_STALE_?e.dependenciesState_=y.STALE_:e.dependenciesState_===y.UP_TO_DATE_&&(n.lowestObserverState_=y.UP_TO_DATE_)}))}function Os(n){n.lowestObserverState_===y.UP_TO_DATE_&&(n.lowestObserverState_=y.POSSIBLY_STALE_,n.observers_.forEach(function(e){e.dependenciesState_===y.UP_TO_DATE_&&(e.dependenciesState_=y.POSSIBLY_STALE_,e.onBecomeStale_())}))}var zr=function(){function n(t,r,o,i){t===void 0&&(t="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=y.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ae.NONE,this.name_=t,this.onInvalidate_=r,this.errorHandler_=o,this.requiresObservable_=i}var e=n.prototype;return e.onBecomeStale_=function(){this.schedule_()},e.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,p.pendingReactions.push(this),xi())},e.isScheduled=function(){return this.isScheduled_},e.runReaction_=function(){if(!this.isDisposed_){H(),this.isScheduled_=!1;var r=p.trackingContext;if(p.trackingContext=this,Kr(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(o){this.reportExceptionInDerivation_(o)}}p.trackingContext=r,z()}},e.track=function(r){if(!this.isDisposed_){H();var o=ke(),i;this.isRunning_=!0;var a=p.trackingContext;p.trackingContext=this;var s=Ti(this,r,void 0);p.trackingContext=a,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Hr(this),zt(s)&&this.reportExceptionInDerivation_(s.cause),z()}},e.reportExceptionInDerivation_=function(r){var o=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(p.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";p.suppressReactionErrors||console.error(i,r),p.globalReactionErrorHandlers.forEach(function(a){return a(r,o)})},e.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(H(),Hr(this),z()))},e.getDisposer_=function(){var r=this.dispose.bind(this);return r[g]=this,r},e.toString=function(){return"Reaction["+this.name_+"]"},e.trace=function(r){r===void 0&&(r=!1),Gs(this,r)},n}();var Ns=100,Cs=function(e){return e()};function xi(){p.inBatch>0||p.isRunningReactions||Cs(ws)}function ws(){p.isRunningReactions=!0;for(var n=p.pendingReactions,e=0;n.length>0;){++e===Ns&&(console.error("[mobx] cycle in reaction: "+n[0]),n.splice(0));for(var t=n.splice(0),r=0,o=t.length;r<o;r++)t[r].runReaction_()}p.isRunningReactions=!1}var Zt=Be("Reaction",zr);function ke(){return!1}function Is(n){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Di="action",xs="action.bound",Pi="autoAction",Ds="autoAction.bound",Ps="<unnamed action>",Ri=At(Di),Rs=At(xs,{bound:!0}),ki=At(Pi,{autoAction:!0}),ks=At(Ds,{autoAction:!0,bound:!0});function Vi(n){var e=function(r,o){if(re(r))return tt(r.name||Ps,r,n);if(re(o))return tt(r,o,n);if(Ve(o))return Et(r,o,n?ki:Ri);if(Ve(r))return ae(At(n?Pi:Di,{name:r,autoAction:n}))};return e}var Qe=Vi(!1);Object.assign(Qe,Ri);var vt=Vi(!0);Object.assign(vt,ki);Qe.bound=ae(Rs);vt.bound=ae(ks);function tn(n){return re(n)&&n.isMobxAction===!0}function Vs(n,e){var t,r;e===void 0&&(e=ri);var o=(t=(r=e)==null?void 0:r.name)!=null?t:"Autorun",i=!e.scheduler&&!e.delay,a;if(i)a=new zr(o,function(){this.track(l)},e.onError,e.requiresObservable);else{var s=Bs(e),u=!1;a=new zr(o,function(){u||(u=!0,s(function(){u=!1,a.isDisposed_||a.track(l)}))},e.onError,e.requiresObservable)}function l(){n(a)}return a.schedule_(),a.getDisposer_()}var Ls=function(e){return e()};function Bs(n){return n.scheduler?n.scheduler:n.delay?function(e){return setTimeout(e,n.delay)}:Ls}var Ms="onBO",Fs="onBUO";function Us(n,e,t){return Bi(Ms,n,e,t)}function Li(n,e,t){return Bi(Fs,n,e,t)}function Bi(n,e,t,r){var o=typeof r=="function"?Le(e,t):Le(e),i=re(r)?r:t,a=n+"L";return o[a]?o[a].add(i):o[a]=new Set([i]),function(){var s=o[a];s&&(s.delete(i),s.size===0&&delete o[a])}}function Mi(n,e,t,r){var o=wa(e),i=dr(n,r)[g];H();try{pt(o).forEach(function(a){i.extend_(a,o[a],t&&a in t?t[a]:!0)})}finally{z()}return n}var js=0;function Fi(){this.message="FLOW_CANCELLED"}Fi.prototype=Object.create(Error.prototype);var Go=fi("flow"),Ws=fi("flow.bound",{bound:!0}),gt=Object.assign(function(e,t){if(Ve(t))return Et(e,t,Go);var r=e,o=r.name||"<unnamed flow>",i=function(){var s=this,u=arguments,l=++js,d=Qe(o+" - runid: "+l+" - init",r).apply(s,u),m,_=void 0,T=new Promise(function(V,C){var F=0;m=C;function L($){_=void 0;var ye;try{ye=Qe(o+" - runid: "+l+" - yield "+F++,d.next).call(d,$)}catch(xe){return C(xe)}at(ye)}function be($){_=void 0;var ye;try{ye=Qe(o+" - runid: "+l+" - yield "+F++,d.throw).call(d,$)}catch(xe){return C(xe)}at(ye)}function at($){if(re($?.then)){$.then(at,C);return}return $.done?V($.value):(_=Promise.resolve($.value),_.then(L,be))}L(void 0)});return T.cancel=Qe(o+" - runid: "+l+" - cancel",function(){try{_&&$o(_);var V=d.return(void 0),C=Promise.resolve(V.value);C.then(Ye,Ye),$o(C),m(new Fi)}catch(F){m(F)}}),T};return i.isMobXFlow=!0,i},Go);gt.bound=ae(Ws);function $o(n){re(n.cancel)&&n.cancel()}function er(n){return n?.isMobXFlow===!0}function qs(n,e){return n?e!==void 0?bt(n)?n[g].values_.has(e):!1:bt(n)||!!n[g]||Qr(n)||Zt(n)||ur(n):!1}function Ui(n){return qs(n)}function Gs(){S("trace() is not available in production builds");for(var n=!1,e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];typeof t[t.length-1]=="boolean"&&(n=t.pop());var o=$s(t);if(!o)return S("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");o.isTracing_===Ae.NONE&&console.log("[mobx.trace] '"+o.name_+"' tracing enabled"),o.isTracing_=n?Ae.BREAK:Ae.LOG}function $s(n){switch(n.length){case 0:return p.trackingDerivation;case 1:return Le(n[0]);case 2:return Le(n[0],n[1])}}function _e(n,e){e===void 0&&(e=void 0),H();try{return n.apply(e)}finally{z()}}function ze(n){return n[g]}var Ks={has:function(e,t){return ze(e).has_(t)},get:function(e,t){return ze(e).get_(t)},set:function(e,t,r){var o;return Ve(t)?(o=ze(e).set_(t,r,!0))!=null?o:!0:!1},deleteProperty:function(e,t){var r;return Ve(t)?(r=ze(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var o;return(o=ze(e).defineProperty_(t,r))!=null?o:!0},ownKeys:function(e){return ze(e).ownKeys_()},preventExtensions:function(e){S(13)}};function Hs(n,e){var t,r;return ni(),n=dr(n,e),(r=(t=n[g]).proxy_)!=null?r:t.proxy_=new Proxy(n,Ks)}function Q(n){return n.interceptors_!==void 0&&n.interceptors_.length>0}function Ct(n,e){var t=n.interceptors_||(n.interceptors_=[]);return t.push(e),oi(function(){var r=t.indexOf(e);r!==-1&&t.splice(r,1)})}function Z(n,e){var t=ot();try{for(var r=[].concat(n.interceptors_||[]),o=0,i=r.length;o<i&&(e=r[o](e),e&&!e.type&&S(14),!!e);o++);return e}finally{Oe(t)}}function ee(n){return n.changeListeners_!==void 0&&n.changeListeners_.length>0}function wt(n,e){var t=n.changeListeners_||(n.changeListeners_=[]);return t.push(e),oi(function(){var r=t.indexOf(e);r!==-1&&t.splice(r,1)})}function te(n,e){var t=ot(),r=n.changeListeners_;if(!!r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](e);Oe(t)}}var Wr=Symbol("mobx-keys");function ji(n,e,t){if(ve(n))return Mi(n,n,e,t);var r=dr(n,t)[g];if(!n[Wr]){var o=Object.getPrototypeOf(n),i=new Set([].concat(pt(n),pt(o)));i.delete("constructor"),i.delete(g),ir(o,Wr,i)}H();try{n[Wr].forEach(function(a){return r.make_(a,e&&a in e?e[a]:!0)})}finally{z()}return n}var Ko="splice",se="update",zs=1e4,Ys={get:function(e,t){var r=e[g];return t===g?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Te(tr,t)?tr[t]:e[t]},set:function(e,t,r){var o=e[g];return t==="length"&&o.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:o.set_(parseInt(t),r),!0},preventExtensions:function(){S(15)}},rn=function(){function n(t,r,o,i){t===void 0&&(t="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=o,this.legacyMode_=i,this.atom_=new Tt(t),this.enhancer_=function(a,s){return r(a,s,"ObservableArray[..]")}}var e=n.prototype;return e.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},e.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},e.intercept_=function(r){return Ct(this,r)},e.observe_=function(r,o){return o===void 0&&(o=!1),o&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),wt(this,r)},e.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},e.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&S("Out of range: "+r);var o=this.values_.length;if(r!==o)if(r>o){for(var i=new Array(r-o),a=0;a<r-o;a++)i[a]=void 0;this.spliceWithArray_(o,0,i)}else this.spliceWithArray_(r,o-r)},e.updateArrayLength_=function(r,o){r!==this.lastKnownLength_&&S(16),this.lastKnownLength_+=o,this.legacyMode_&&o>0&&Qi(r+o+1)},e.spliceWithArray_=function(r,o,i){var a=this;rt(this.atom_);var s=this.values_.length;if(r===void 0?r=0:r>s?r=s:r<0&&(r=Math.max(0,s+r)),arguments.length===1?o=s-r:o==null?o=0:o=Math.max(0,Math.min(o,s-r)),i===void 0&&(i=Gr),Q(this)){var u=Z(this,{object:this.proxy_,type:Ko,index:r,removedCount:o,added:i});if(!u)return Gr;o=u.removedCount,i=u.added}if(i=i.length===0?i:i.map(function(m){return a.enhancer_(m,void 0)}),this.legacyMode_){var l=i.length-o;this.updateArrayLength_(s,l)}var d=this.spliceItemsIntoValues_(r,o,i);return(o!==0||i.length!==0)&&this.notifyArraySplice_(r,i,d),this.dehanceValues_(d)},e.spliceItemsIntoValues_=function(r,o,i){if(i.length<zs){var a;return(a=this.values_).splice.apply(a,[r,o].concat(i))}else{var s=this.values_.slice(r,r+o),u=this.values_.slice(r+o);this.values_.length+=i.length-o;for(var l=0;l<i.length;l++)this.values_[r+l]=i[l];for(var d=0;d<u.length;d++)this.values_[r+i.length+d]=u[d];return s}},e.notifyArrayChildUpdate_=function(r,o,i){var a=!this.owned_&&ke(),s=ee(this),u=s||a?{observableKind:"array",object:this.proxy_,type:se,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:i}:null;this.atom_.reportChanged(),s&&te(this,u)},e.notifyArraySplice_=function(r,o,i){var a=!this.owned_&&ke(),s=ee(this),u=s||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Ko,index:r,removed:i,added:o,removedCount:i.length,addedCount:o.length}:null;this.atom_.reportChanged(),s&&te(this,u)},e.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},e.set_=function(r,o){var i=this.values_;if(this.legacyMode_&&r>i.length&&S(17,r,i.length),r<i.length){rt(this.atom_);var a=i[r];if(Q(this)){var s=Z(this,{type:se,object:this.proxy_,index:r,newValue:o});if(!s)return;o=s.newValue}o=this.enhancer_(o,a);var u=o!==a;u&&(i[r]=o,this.notifyArrayChildUpdate_(r,o,a))}else{for(var l=new Array(r+1-i.length),d=0;d<l.length-1;d++)l[d]=void 0;l[l.length-1]=o,this.spliceWithArray_(i.length,0,l)}},n}();function Xs(n,e,t,r){t===void 0&&(t="ObservableArray"),r===void 0&&(r=!1),ni();var o=new rn(t,e,r,!1);ai(o.values_,g,o);var i=new Proxy(o.values_,Ys);if(o.proxy_=i,n&&n.length){var a=Ot(!0);o.spliceWithArray_(0,0,n),Nt(a)}return i}var tr={clear:function(){return this.splice(0)},replace:function(e){var t=this[g];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=this[g];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(e);case 2:return a.spliceWithArray_(e,t)}return a.spliceWithArray_(e,t,o)},spliceWithArray:function(e,t,r){return this[g].spliceWithArray_(e,t,r)},push:function(){for(var e=this[g],t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[g].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[g],t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return p.trackingDerivation&&S(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){p.trackingDerivation&&S(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[g],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};R("concat",ge);R("flat",ge);R("includes",ge);R("indexOf",ge);R("join",ge);R("lastIndexOf",ge);R("slice",ge);R("toString",ge);R("toLocaleString",ge);R("every",Ne);R("filter",Ne);R("find",Ne);R("findIndex",Ne);R("flatMap",Ne);R("forEach",Ne);R("map",Ne);R("some",Ne);R("reduce",Wi);R("reduceRight",Wi);function R(n,e){typeof Array.prototype[n]=="function"&&(tr[n]=e(n))}function ge(n){return function(){var e=this[g];e.atom_.reportObserved();var t=e.dehanceValues_(e.values_);return t[n].apply(t,arguments)}}function Ne(n){return function(e,t){var r=this,o=this[g];o.atom_.reportObserved();var i=o.dehanceValues_(o.values_);return i[n](function(a,s){return e.call(t,a,s,r)})}}function Wi(n){return function(){var e=this,t=this[g];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_),o=arguments[0];return arguments[0]=function(i,a,s){return o(i,a,s,e)},r[n].apply(r,arguments)}}var Js=Be("ObservableArrayAdministration",rn);function lr(n){return or(n)&&Js(n[g])}var qi,Gi,Qs={},Ee="add",rr="delete";qi=Symbol.iterator;Gi=Symbol.toStringTag;var $i=function(){function n(t,r,o){var i=this;r===void 0&&(r=et),o===void 0&&(o="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[g]=Qs,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=o,re(Map)||S(18),this.keysAtom_=li("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,ys(!0,function(){i.merge(t)})}var e=n.prototype;return e.has_=function(r){return this.data_.has(r)},e.has=function(r){var o=this;if(!p.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var a=i=new Ze(this.has_(r),ar,"ObservableMap.key?",!1);this.hasMap_.set(r,a),Li(a,function(){return o.hasMap_.delete(r)})}return i.get()},e.set=function(r,o){var i=this.has_(r);if(Q(this)){var a=Z(this,{type:i?se:Ee,object:this,newValue:o,name:r});if(!a)return this;o=a.newValue}return i?this.updateValue_(r,o):this.addValue_(r,o),this},e.delete=function(r){var o=this;if(rt(this.keysAtom_),Q(this)){var i=Z(this,{type:rr,object:this,name:r});if(!i)return!1}if(this.has_(r)){var a=ke(),s=ee(this),u=s||a?{observableKind:"map",debugObjectName:this.name_,type:rr,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return _e(function(){var l;o.keysAtom_.reportChanged(),(l=o.hasMap_.get(r))==null||l.setNewValue_(!1);var d=o.data_.get(r);d.setNewValue_(void 0),o.data_.delete(r)}),s&&te(this,u),!0}return!1},e.updateValue_=function(r,o){var i=this.data_.get(r);if(o=i.prepareNewValue_(o),o!==p.UNCHANGED){var a=ke(),s=ee(this),u=s||a?{observableKind:"map",debugObjectName:this.name_,type:se,object:this,oldValue:i.value_,name:r,newValue:o}:null;i.setNewValue_(o),s&&te(this,u)}},e.addValue_=function(r,o){var i=this;rt(this.keysAtom_),_e(function(){var l,d=new Ze(o,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,d),o=d.value_,(l=i.hasMap_.get(r))==null||l.setNewValue_(!0),i.keysAtom_.reportChanged()});var a=ke(),s=ee(this),u=s||a?{observableKind:"map",debugObjectName:this.name_,type:Ee,object:this,name:r,newValue:o}:null;s&&te(this,u)},e.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},e.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},e.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},e.values=function(){var r=this,o=this.keys();return yt({next:function(){var a=o.next(),s=a.done,u=a.value;return{done:s,value:s?void 0:r.get(u)}}})},e.entries=function(){var r=this,o=this.keys();return yt({next:function(){var a=o.next(),s=a.done,u=a.value;return{done:s,value:s?void 0:[u,r.get(u)]}}})},e[qi]=function(){return this.entries()},e.forEach=function(r,o){for(var i=Xe(this),a;!(a=i()).done;){var s=a.value,u=s[0],l=s[1];r.call(o,l,u,this)}},e.merge=function(r){var o=this;return Me(r)&&(r=new Map(r)),_e(function(){ve(r)?Ca(r).forEach(function(i){return o.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var a=i[0],s=i[1];return o.set(a,s)}):nt(r)?(r.constructor!==Map&&S(19,r),r.forEach(function(i,a){return o.set(a,i)})):r!=null&&S(20,r)}),this},e.clear=function(){var r=this;_e(function(){Ai(function(){for(var o=Xe(r.keys()),i;!(i=o()).done;){var a=i.value;r.delete(a)}})})},e.replace=function(r){var o=this;return _e(function(){for(var i=Zs(r),a=new Map,s=!1,u=Xe(o.data_.keys()),l;!(l=u()).done;){var d=l.value;if(!i.has(d)){var m=o.delete(d);if(m)s=!0;else{var _=o.data_.get(d);a.set(d,_)}}}for(var T=Xe(i.entries()),V;!(V=T()).done;){var C=V.value,F=C[0],L=C[1],be=o.data_.has(F);if(o.set(F,L),o.data_.has(F)){var at=o.data_.get(F);a.set(F,at),be||(s=!0)}}if(!s)if(o.data_.size!==a.size)o.keysAtom_.reportChanged();else for(var $=o.data_.keys(),ye=a.keys(),xe=$.next(),En=ye.next();!xe.done;){if(xe.value!==En.value){o.keysAtom_.reportChanged();break}xe=$.next(),En=ye.next()}o.data_=a}),this},e.toString=function(){return"[object ObservableMap]"},e.toJSON=function(){return Array.from(this)},e.observe_=function(r,o){return wt(this,r)},e.intercept_=function(r){return Ct(this,r)},Jr(n,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Gi,get:function(){return"Map"}}]),n}(),Me=Be("ObservableMap",$i);function Zs(n){if(nt(n)||Me(n))return n;if(Array.isArray(n))return new Map(n);if(ve(n)){var e=new Map;for(var t in n)e.set(t,n[t]);return e}else return S(21,n)}var Ki,Hi,ec={};Ki=Symbol.iterator;Hi=Symbol.toStringTag;var zi=function(){function n(t,r,o){r===void 0&&(r=et),o===void 0&&(o="ObservableSet"),this.name_=void 0,this[g]=ec,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=o,re(Set)||S(22),this.atom_=li(this.name_),this.enhancer_=function(i,a){return r(i,a,o)},t&&this.replace(t)}var e=n.prototype;return e.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},e.clear=function(){var r=this;_e(function(){Ai(function(){for(var o=Xe(r.data_.values()),i;!(i=o()).done;){var a=i.value;r.delete(a)}})})},e.forEach=function(r,o){for(var i=Xe(this),a;!(a=i()).done;){var s=a.value;r.call(o,s,s,this)}},e.add=function(r){var o=this;if(rt(this.atom_),Q(this)){var i=Z(this,{type:Ee,object:this,newValue:r});if(!i)return this}if(!this.has(r)){_e(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var a=!1,s=ee(this),u=s||a?{observableKind:"set",debugObjectName:this.name_,type:Ee,object:this,newValue:r}:null;s&&te(this,u)}return this},e.delete=function(r){var o=this;if(Q(this)){var i=Z(this,{type:rr,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var a=!1,s=ee(this),u=s||a?{observableKind:"set",debugObjectName:this.name_,type:rr,object:this,oldValue:r}:null;return _e(function(){o.atom_.reportChanged(),o.data_.delete(r)}),s&&te(this,u),!0}return!1},e.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},e.entries=function(){var r=0,o=Array.from(this.keys()),i=Array.from(this.values());return yt({next:function(){var s=r;return r+=1,s<i.length?{value:[o[s],i[s]],done:!1}:{done:!0}}})},e.keys=function(){return this.values()},e.values=function(){this.atom_.reportObserved();var r=this,o=0,i=Array.from(this.data_.values());return yt({next:function(){return o<i.length?{value:r.dehanceValue_(i[o++]),done:!1}:{done:!0}}})},e.replace=function(r){var o=this;return it(r)&&(r=new Set(r)),_e(function(){Array.isArray(r)?(o.clear(),r.forEach(function(i){return o.add(i)})):St(r)?(o.clear(),r.forEach(function(i){return o.add(i)})):r!=null&&S("Cannot initialize set from "+r)}),this},e.observe_=function(r,o){return wt(this,r)},e.intercept_=function(r){return Ct(this,r)},e.toJSON=function(){return Array.from(this)},e.toString=function(){return"[object ObservableSet]"},e[Ki]=function(){return this.values()},Jr(n,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Hi,get:function(){return"Set"}}]),n}(),it=Be("ObservableSet",zi),Ho=Object.create(null),zo="remove",Yi=function(){function n(t,r,o,i){r===void 0&&(r=new Map),i===void 0&&(i=es),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=t,this.values_=r,this.name_=o,this.defaultAnnotation_=i,this.keysAtom_=new Tt("ObservableObject.keys"),this.isPlainObject_=ve(this.target_)}var e=n.prototype;return e.getObservablePropValue_=function(r){return this.values_.get(r).get()},e.setObservablePropValue_=function(r,o){var i=this.values_.get(r);if(i instanceof _t)return i.set(o),!0;if(Q(this)){var a=Z(this,{type:se,object:this.proxy_||this.target_,name:r,newValue:o});if(!a)return null;o=a.newValue}if(o=i.prepareNewValue_(o),o!==p.UNCHANGED){var s=ee(this),u=!1,l=s||u?{type:se,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:o}:null;i.setNewValue_(o),s&&te(this,l)}return!0},e.get_=function(r){return p.trackingDerivation&&!Te(this.target_,r)&&this.has_(r),this.target_[r]},e.set_=function(r,o,i){return i===void 0&&(i=!1),Te(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,o):i?Reflect.set(this.target_,r,o):(this.target_[r]=o,!0):this.extend_(r,{value:o,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},e.has_=function(r){if(!p.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var o=this.pendingKeys_.get(r);return o||(o=new Ze(r in this.target_,ar,"ObservableObject.key?",!1),this.pendingKeys_.set(r,o)),o.get()},e.make_=function(r,o){if(o===!0&&(o=this.defaultAnnotation_),o!==!1){if(Jo(this,o,r),!(r in this.target_)){var i;if((i=this.target_[Je])!=null&&i[r])return;S(1,o.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==nr;){var s=Yt(a,r);if(s){var u=o.make_(this,r,s,a);if(u===0)return;if(u===1)break}a=Object.getPrototypeOf(a)}Xo(this,o,r)}},e.extend_=function(r,o,i,a){if(a===void 0&&(a=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,o,a);Jo(this,i,r);var s=i.extend_(this,r,o,a);return s&&Xo(this,i,r),s},e.defineProperty_=function(r,o,i){i===void 0&&(i=!1);try{H();var a=this.delete_(r);if(!a)return a;if(Q(this)){var s=Z(this,{object:this.proxy_||this.target_,name:r,type:Ee,newValue:o.value});if(!s)return null;var u=s.newValue;o.value!==u&&(o=mt({},o,{value:u}))}if(i){if(!Reflect.defineProperty(this.target_,r,o))return!1}else ie(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{z()}return!0},e.defineObservableProperty_=function(r,o,i,a){a===void 0&&(a=!1);try{H();var s=this.delete_(r);if(!s)return s;if(Q(this)){var u=Z(this,{object:this.proxy_||this.target_,name:r,type:Ee,newValue:o});if(!u)return null;o=u.newValue}var l=Yo(r),d={configurable:p.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,d))return!1}else ie(this.target_,r,d);var m=new Ze(o,i,"ObservableObject.key",!1);this.values_.set(r,m),this.notifyPropertyAddition_(r,m.value_)}finally{z()}return!0},e.defineComputedProperty_=function(r,o,i){i===void 0&&(i=!1);try{H();var a=this.delete_(r);if(!a)return a;if(Q(this)){var s=Z(this,{object:this.proxy_||this.target_,name:r,type:Ee,newValue:void 0});if(!s)return null}o.name||(o.name="ObservableObject.key"),o.context=this.proxy_||this.target_;var u=Yo(r),l={configurable:p.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,r,l))return!1}else ie(this.target_,r,l);this.values_.set(r,new _t(o)),this.notifyPropertyAddition_(r,void 0)}finally{z()}return!0},e.delete_=function(r,o){if(o===void 0&&(o=!1),!Te(this.target_,r))return!0;if(Q(this)){var i=Z(this,{object:this.proxy_||this.target_,name:r,type:zo});if(!i)return null}try{var a,s;H();var u=ee(this),l=!1,d=this.values_.get(r),m=void 0;if(!d&&(u||l)){var _;m=(_=Yt(this.target_,r))==null?void 0:_.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(d&&(this.values_.delete(r),d instanceof Ze&&(m=d.value_),Ii(d)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(s=a.get(r))==null||s.set(r in this.target_),u||l){var T={type:zo,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:m,name:r};u&&te(this,T)}}finally{z()}return!0},e.observe_=function(r,o){return wt(this,r)},e.intercept_=function(r){return Ct(this,r)},e.notifyPropertyAddition_=function(r,o){var i,a,s=ee(this),u=!1;if(s||u){var l=s||u?{type:Ee,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;s&&te(this,l)}(i=this.pendingKeys_)==null||(a=i.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},e.ownKeys_=function(){return this.keysAtom_.reportObserved(),pt(this.target_)},e.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},n}();function dr(n,e){var t;if(Te(n,g))return n;var r=(t=e?.name)!=null?t:"ObservableObject",o=new Yi(n,new Map,String(r),ls(e));return ir(n,g,o),n}var tc=Be("ObservableObjectAdministration",Yi);function Yo(n){return Ho[n]||(Ho[n]={get:function(){return this[g].getObservablePropValue_(n)},set:function(t){return this[g].setObservablePropValue_(n,t)}})}function bt(n){return or(n)?tc(n[g]):!1}function Xo(n,e,t){var r;(r=n.target_[Je])==null||delete r[t]}function Jo(n,e,t){if(!1)var r,o,i}var rc=Ji(0),qr=0,Xi=function(){};function nc(n,e){Object.setPrototypeOf?Object.setPrototypeOf(n.prototype,e):n.prototype.__proto__!==void 0?n.prototype.__proto__=e:n.prototype=e}nc(Xi,Array.prototype);var nn=function(n,e,t){ui(r,n);function r(i,a,s,u){var l;s===void 0&&(s="ObservableArray"),u===void 0&&(u=!1),l=n.call(this)||this;var d=new rn(s,a,u,!0);if(d.proxy_=Fr(l),ai(Fr(l),g,d),i&&i.length){var m=Ot(!0);l.spliceWithArray(0,0,i),Nt(m)}return Object.defineProperty(Fr(l),"0",rc),l}var o=r.prototype;return o.concat=function(){this[g].atom_.reportObserved();for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return Array.prototype.concat.apply(this.slice(),s.map(function(l){return lr(l)?l.slice():l}))},o[t]=function(){var i=this,a=0;return yt({next:function(){return a<i.length?{value:i[a++],done:!1}:{done:!0,value:void 0}}})},Jr(r,[{key:"length",get:function(){return this[g].getArrayLength_()},set:function(a){this[g].setArrayLength_(a)}},{key:e,get:function(){return"Array"}}]),r}(Xi,Symbol.toStringTag,Symbol.iterator);Object.entries(tr).forEach(function(n){var e=n[0],t=n[1];e!=="concat"&&ir(nn.prototype,e,t)});function Ji(n){return{enumerable:!1,configurable:!0,get:function(){return this[g].get_(n)},set:function(t){this[g].set_(n,t)}}}function oc(n){ie(nn.prototype,""+n,Ji(n))}function Qi(n){if(n>qr){for(var e=qr;e<n+100;e++)oc(e);qr=n}}Qi(1e3);function ic(n,e,t){return new nn(n,e,t)}function Le(n,e){if(typeof n=="object"&&n!==null){if(lr(n))return e!==void 0&&S(23),n[g].atom_;if(it(n))return n.atom_;if(Me(n)){if(e===void 0)return n.keysAtom_;var t=n.data_.get(e)||n.hasMap_.get(e);return t||S(25,e,Yr(n)),t}if(bt(n)){if(!e)return S(26);var r=n[g].values_.get(e);return r||S(27,e,Yr(n)),r}if(Qr(n)||ur(n)||Zt(n))return n}else if(re(n)&&Zt(n[g]))return n[g];S(28)}function Zi(n,e){if(n||S(29),e!==void 0)return Zi(Le(n,e));if(Qr(n)||ur(n)||Zt(n)||Me(n)||it(n))return n;if(n[g])return n[g];S(24,n)}function Yr(n,e){var t;if(e!==void 0)t=Le(n,e);else{if(tn(n))return n.name;bt(n)||Me(n)||it(n)?t=Zi(n):t=Le(n)}return t.name_}var Qo=nr.toString;function on(n,e,t){return t===void 0&&(t=-1),Xr(n,e,t)}function Xr(n,e,t,r,o){if(n===e)return n!==0||1/n===1/e;if(n==null||e==null)return!1;if(n!==n)return e!==e;var i=typeof n;if(i!=="function"&&i!=="object"&&typeof e!="object")return!1;var a=Qo.call(n);if(a!==Qo.call(e))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+n==""+e;case"[object Number]":return+n!=+n?+e!=+e:+n==0?1/+n===1/e:+n==+e;case"[object Date]":case"[object Boolean]":return+n==+e;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(n)===Symbol.valueOf.call(e);case"[object Map]":case"[object Set]":t>=0&&t++;break}n=Zo(n),e=Zo(e);var s=a==="[object Array]";if(!s){if(typeof n!="object"||typeof e!="object")return!1;var u=n.constructor,l=e.constructor;if(u!==l&&!(re(u)&&u instanceof u&&re(l)&&l instanceof l)&&"constructor"in n&&"constructor"in e)return!1}if(t===0)return!1;t<0&&(t=-1),r=r||[],o=o||[];for(var d=r.length;d--;)if(r[d]===n)return o[d]===e;if(r.push(n),o.push(e),s){if(d=n.length,d!==e.length)return!1;for(;d--;)if(!Xr(n[d],e[d],t-1,r,o))return!1}else{var m=Object.keys(n),_;if(d=m.length,Object.keys(e).length!==d)return!1;for(;d--;)if(_=m[d],!(Te(e,_)&&Xr(n[_],e[_],t-1,r,o)))return!1}return r.pop(),o.pop(),!0}function Zo(n){return lr(n)?n.slice():nt(n)||Me(n)||St(n)||it(n)?Array.from(n.entries()):n}function yt(n){return n[Symbol.iterator]=ac,n}function ac(){return this}["Symbol","Map","Set"].forEach(function(n){var e=ei();typeof e[n]>"u"&&S("MobX requires global '"+n+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Is,extras:{getDebugName:Yr},$mobx:g});var an=class{constructor(e){c(this,"_context",null);c(this,"getInitialProps",(...e)=>this._context?this._context.getInitialProps(...e):Promise.reject(Error("You may forget to use InitialPropsProvider")));ji(this),this._updateContext(e)}get initialProps(){return this._context?this._context.initialProps:{}}_updateContext(e){this._context=e}},ea=an;var sn=null,sc=null;function cn(n){return sn||(sn=new ea(sc)),n.prototype.initialPropsStore=sn,n}f();h();f();h();f();h();f();h();f();h();f();h();f();h();De();De();var ra=(n,e)=>n.filter(({networks:t})=>t.findIndex(o=>o.name===e)>-1),na=(n,e)=>n.filter(({account:t})=>t[e]),oa=({recentAddrData:n,addressBookData:e,walletListData:t,chainName:r})=>{let o=[];if(n.length>0){let i=n.map(({specifiedAddress:a,...s})=>({specifiedAddress:a,...s}));o.push({group:E("swaptrade_extension_wallet_address_recent_address"),list:i})}if(e.length>0){let i=e.map(a=>({...a,specifiedAddress:a.address}));o.push({group:E("swaptrade_extension_wallet_address_connected_wallets"),list:i})}if(t.length){let i=t.map(s=>({specifiedAddress:s.account[r],group:s.keyringName,name:s.walletName,walletId:s.walletId}));Object.entries(An(i,"group")).forEach(([s,u])=>{o.push({group:s,list:u})})}return o},ta=n=>String(O(n,"isLeveraged"))==="1",ia=(n,e)=>{let t=[null,null];return ta(n)&&(t[0]=n),ta(e)&&(t[1]=e),t};var{BigNumber:j}=K,un=class{constructor(e){c(this,"defaultToken",{amount:"",prevAmount:"",balance:"",logoURI:"",coinId:"",decimals:"",usdPrice:"",tokenName:"",baseCoinId:"",tokenSymbol:"",tokenLogoUrl:"",isNativeToken:0,tokenContractAddress:"",isSafeMoonToken:"",isHoneypot:"",buyTaxes:"0",sellTaxes:"0",reverseReceiveAmount:"",chainId:""});c(this,"from",{...this.defaultToken});c(this,"to",{...this.defaultToken});c(this,"fromBalanceState",J.BALANCE_NOT_SHOW);c(this,"toBalanceState",J.BALANCE_NOT_SHOW);c(this,"fromBalanceRequestError",!1);c(this,"toBalanceRequestError",!1);c(this,"isBalanceLoading",!1);c(this,"visibleAddFunds",!1);c(this,"setFrom",e=>{this.from=e});c(this,"setTo",e=>{this.to=e});c(this,"maxDialogType",ut.enough);c(this,"setMaxDialogType",e=>{this.maxDialogType=e});c(this,"checkMaxDialogTypeIsEnough",e=>ut.enough===e);c(this,"typedValue","");c(this,"fromMax",!1);c(this,"independentField",P.FROM);c(this,"singleTypedValue","");c(this,"singleFromMax",!1);c(this,"advanceSetTypedValue",(e="",t=!1,r="")=>{(r||this.commonStore.currentTab)===fe.SWAP?(this.singleTypedValue=e,this.singleFromMax=t):this.setTypeInput(e,t)});c(this,"needCrossChainDoubleConfirm",!1);c(this,"setNeedCrossChainDoubleConfirm",e=>{this.needCrossChainDoubleConfirm=e});c(this,"updateBtcFromBalance",async()=>this.computedIsFromBtcCoin?(await this.getTokenBalanceByAccount(P.FROM,U(this.from)),!this.fromBalanceRequestError):!this.fromBalanceRequestError);c(this,"onClickMax",async()=>{fo({button_name:"max"});let{isNativeToken:e}=this.from;this.setField(P.FROM);let t="",r="";if(e===1){let[o,i]=await Promise.all([this.rootStore.quoteStore.fetchGasTokenFee(),this.updateBtcFromBalance()]);if(!i)return;let{balance:a,availableBalance:s}=this.from,u=(this.computedIsFromBtcCoin?s:a)||"0";if(o===-1)return;r=j(u).minus(o);let l=r.isNegative();this.setMaxDialogType(l?ut.insufficient:ut.enough),l&&this.setShowAddFund(!0),this.showMaxDialog(),this.setShowMaxIcon(!0),t=l?"":r.toString()}else t=this.from.balance;this.advanceSetTypedValue(t,!0)});c(this,"setTypeInput",(e,t)=>{this.typedValue=e,this.fromMax=!!t});c(this,"setField",e=>{this.independentField=e});c(this,"quoteUpdateFromTo",e=>{let{receiveAmount:t="",fromTokenPrice:r="",toTokenPrice:o="",payAmount:i="",inputToTokenPrice:a=""}=e||{};!this.computedIsExactIn&&t?(this.from.amount=i,this.to.amount=this.computedTypedValue,this.to.prevAmount=this.computedTypedValue,this.from.currentTime=new Date().getTime(),this.to.usdPrice=a):this.computedIsExactIn&&(this.from.amount=this.computedTypedValue,this.to.amount=t,this.from.prevAmount=this.computedTypedValue,this.to.currentTime=new Date().getTime(),this.to.usdPrice=o),this.to.reverseReceiveAmount=t,this.from.usdPrice=r});c(this,"checkAndGetTokenInfo",async({chainId:e,tokenContractAddress:t})=>{let[r,o]=await this.getTokenInfoAndBalance(e,t);return r?null:o.data});c(this,"getDexMultiDefaultTokenInfo",e=>{let{chainList:t}=this.commonStore,r=U(t).find(o=>Number(o.chainId)===Number(e??Pr))||{};return{fromDexMultiTokenInfoVO:{...r.dexDefaultFromToTokenShowVO?.fromDexMultiTokenInfoVO,reserveGas:r.reserveGas},toDexMultiTokenInfoVO:r.dexDefaultFromToTokenShowVO?.toDexMultiTokenInfoVO||{}}});c(this,"addressReplaceSymbol",e=>{let{fromDexMultiTokenInfoVO:t}=this.getDexMultiDefaultTokenInfo(e.chainId),{tokenSymbol:r,isNativeToken:o}=t;return o&&this.commonStore.getTokenAddress(e)===this.commonStore.getTokenAddress(t)?r:e?.tokenContractAddress});c(this,"symbolReplaceAddress",e=>this.tokenReplaceMainToken(e).tokenContractAddress);c(this,"validTokens",{});c(this,"fetchTokenInfo",async e=>{if(e.tokenContractAddress){let t=await this.checkAndGetTokenInfo(e);if(t?.tokenContractAddress){let o={...t,balance:t.amountNum,amount:e.amount||""},i=`${t.chainId}_${this.commonStore.getTokenAddress(t)}`;return this.validTokens[i]=!0,o}let r=`${e.chainId}_${this.commonStore.getTokenAddress(e)}`;return this.validTokens[r]=e.tokenContractAddress==Un,null}return null});c(this,"checkQueryToken",async(e,t=!0)=>{if(!pe(e.chainId))return null;let r=e;if(bo(this.commonStore.chainList,Number(e.chainId))){let{from:i}=this.getInitializedValue(e.chainId);if(this.commonStore.getTokenAddress(e)===this.commonStore.getTokenAddress(i)&&t){let s=`${i?.chainId}_${this.commonStore.getTokenAddress(i)}`;return this.validTokens[s]=!0,i}let a=await this.fetchTokenInfo({chainId:Number(e.chainId),tokenContractAddress:e.tokenContractAddress});t?r=a||i:r=a}else r=null;return r});c(this,"updateFrom",e=>{(!this.commonStore.equalsToken(e,this.from)||this.from.balance!==e.balance)&&(this.setShowMaxIcon(!1),this.setShowAddFund(!1)),this.from={...U(this.from),...e}});c(this,"updateFromAmount",e=>{this.from.amount=e,e||(this.from.usdPrice="0"),this.from.prevAmount||(this.from.prevAmount=e)});c(this,"updateFromUsdPriceFromWs",(e={})=>{!kr(e,this.from)||(this.from.wsPriceData=e,this.from.usdPrice=Lr({realTimeTokenPrice:e.price,amount:this.from.amount,nonRealTimeTokenValue:this.from.usdPrice}))});c(this,"updateToUsdPriceFromWs",(e={})=>{!kr(e,this.to)||(this.to.wsPriceData=e,this.to.usdPrice=Lr({realTimeTokenPrice:e.price,amount:this.to.amount,nonRealTimeTokenValue:this.to.usdPrice}))});c(this,"updateTo",e=>{this.to={...U(this.to),...e}});c(this,"hideMaxDialog",!!he.get(Ir));c(this,"hideMaxDialogLessGas",!!he.get(xr));c(this,"setStorageShowMaxDialog",e=>{if(e){let t=this.checkMaxDialogTypeIsEnough(this.maxDialogType);he.set(t?Ir:xr,"1"),t?this.hideMaxDialog=!0:this.hideMaxDialogLessGas=!0}this.visibleMaxDialog=!1});c(this,"visibleMaxDialog",!1);c(this,"showMaxDialog",()=>{let e=this.checkMaxDialogTypeIsEnough(this.maxDialogType);e&&this.hideMaxDialog||!e&&this.hideMaxDialogLessGas||(this.visibleMaxDialog=!0)});c(this,"showMaxIcon",!1);c(this,"setShowMaxIcon",e=>{this.showMaxIcon=e});c(this,"showAddFund",!1);c(this,"setShowAddFund",e=>{this.showAddFund=e});c(this,"setFromBalanceRequestError",e=>{this.fromBalanceRequestError=e});c(this,"setToBalanceRequestError",e=>{this.toBalanceRequestError=e});c(this,"resetBalanceState",()=>{this.setShowMaxIcon(!1),this.setShowAddFund(!1),[this.fromBalanceRequestError,this.toBalanceRequestError]=[this.toBalanceRequestError,this.fromBalanceRequestError]});c(this,"onSwitchFromTo",async()=>{if(!this.isBalanceLoading){this.rootStore.quoteStore.quoteScope=null;let[e,t]=[U(this.from),U(this.to)];this.resetBalanceState();let r={amount:this.computedTypedValue??"",prevAmount:this.computedTypedValue??"",usdPrice:""},o={amount:"",prevAmount:"",usdPrice:""};this.setNeedCrossChainDoubleConfirm(!0),this.setField(P.FROM),this.computedIsSingleChain?(this.setCacheTokenInfo({chainId:t.chainId,tokenContractAddress:t.tokenContractAddress,amountNum:t.balance},"switchFromTo"),this.setFrom({...t,...r})):(this.rootStore.quoteStore.setQuoteNumber(this.computedTypedValue?0:2),this.setCacheTokenInfo({chainId:t.chainId,tokenContractAddress:t.tokenContractAddress,amountNum:t.balance},"switchFromTo"),this.setFrom({...t,amount:t.amount||"",prevAmount:t.amount||"",usdPrice:""})),this.setTo({...e,...o}),this.advanceSetTypedValue(t.amount),this.rootStore.receiveAddressStore.clearReceiveAddressValue()}});c(this,"getChainInfo",e=>{let{chainList:t}=this.commonStore;return t.find(o=>Number(o.chainId)===Number(e))||{}});c(this,"getInitializedValue",(e=Pr)=>{let t=this.getChainInfo(e),{fromDexMultiTokenInfoVO:r,toDexMultiTokenInfoVO:o}=t?.dexDefaultFromToTokenShowVO||{fromDexMultiTokenInfoVO:{},toDexMultiTokenInfoVO:{}},i={...U(r),balance:"",reserveGas:t?.reserveGas},a={...U(o),balance:""};return{from:i,to:a}});c(this,"resetFromTo",async e=>{let{chainList:t,currentTab:r}=this.commonStore,o=r===fe.BRIDGE;if(Number(e)!==Number(this.from.chainId)){let i=U(t).find(d=>Number(d.chainId)===Number(e)),{fromDexMultiTokenInfoVO:a,toDexMultiTokenInfoVO:s,toCrossDexMultiTokenInfoVO:u}=i?.dexDefaultFromToTokenShowVO||{fromDexMultiTokenInfoVO:{},toDexMultiTokenInfoVO:{}};this.from={...U(a),balance:"",reserveGas:i?.reserveGas};let l=o&&u||s;this.to={...U(l),balance:""}}});c(this,"clearFromTo",()=>{this.from={},this.to={}});c(this,"updateBalanceIfNativeToken",(e,t)=>{t.isNativeToken?this.getTokenBalanceByAccount(e,t,!1).catch(Tn):(this.setFromBalanceRequestError(!1),this.setBalance(e,t.amountNum))});c(this,"getSwapTokenBalance",(e=!1)=>{this.getTokenBalanceByAccount(P.FROM,U(this.from),e).catch(()=>{}),this.getTokenBalanceByAccount(P.TO,U(this.to),e).catch(()=>{})});c(this,"getTokenInfoAndBalance",async(e,t)=>{let r=this.accountStore.getAddressByChainId(e),o={chainId:e,tokenAddress:t,userUniqueId:this.commonStore.userUniqueId,accountId:this.accountStore.computedAccountId,userWalletAddress:r,businessType:this.commonStore.computedCurrentTabIsLimit?Dr.LIMIT_ORDER:Dr.SWAP_ORDER};return B(G.get($n,{params:o}))});c(this,"needBalanceLoading",!0);c(this,"setNeedBalanceLoading",e=>{this.needBalanceLoading=e});c(this,"getTokenBalanceByAccount",async(e,t,r=!1)=>{let o=e===P.FROM,{chainId:i,tokenContractAddress:a}=t;if(pe(i)&&a&&this.accountStore.computedAccountId){this.needBalanceLoading&&(this.isBalanceLoading=!0);let s=await this.getTokenInfoAndBalance(i,a);if(this.isBalanceLoading=!1,this.setNeedBalanceLoading(!0),!this.commonStore.equalsToken(t,o?this.from:this.to))return;if(s[0]){if(r){this.fromBalanceRequestError=!1,this.toBalanceRequestError=!1;return}o?(this.fromBalanceRequestError=!0,this.fromBalanceState=J.BALANCE_REQUEST_FAILED):(this.toBalanceRequestError=!0,this.toBalanceState=J.BALANCE_REQUEST_FAILED),this.setBalance(e,"0","0","0");return}o?this.fromBalanceRequestError=!1:this.toBalanceRequestError=!1;let{amountNum:u,availableAmountNum:l,currencyAmount:d}=s[1]?.data||{};o&&this.setCacheTokenInfo({chainId:i,tokenContractAddress:a,amountNum:u},"api"),this.setBalance(e,u,l,d)}});c(this,"cacheTokenInfo",{});c(this,"setCacheTokenInfo",(e,t)=>{this.cacheTokenInfo=e,b.info(N.GET_BALANCE,{...e,tokenContractAddress:to(e.tokenContractAddress),type:t})});c(this,"setBalance",(e,t="",r="",o="")=>{let i=e===P.TO,a={balance:t,availableBalance:r,currencyAmount:o};i?this.updateTo({...this.to,...a}):this.updateFrom({...this.from,...a})});c(this,"setBalanceState",e=>{let{amount:t,address:r,from:o,to:i}=e;Boolean(r)&&Boolean(o.tokenContractAddress)?this.fromBalanceRequestError===!0?this.fromBalanceState=J.BALANCE_REQUEST_FAILED:j(o.balance||"0").lt(t||"0")?this.fromBalanceState=J.BALANCE_INSUFFICIENT:this.fromBalanceState=J.COMMON:this.fromBalanceState=J.BALANCE_NOT_SHOW,!(Boolean(r)&&Boolean(i.tokenContractAddress))||!this.computedIsToAddressEqualsCurrentToAddress&&this.computedDiffCrossChain?this.toBalanceState=J.BALANCE_NOT_SHOW:this.toBalanceRequestError===!0?this.toBalanceState=J.BALANCE_REQUEST_FAILED:this.toBalanceState=J.COMMON});c(this,"equalsTokenAndAccount",(e,t)=>this.commonStore.equalsToken(e,t)&&this.accountStore.getAddressByChainId(e.chainId)===t.address);c(this,"updateFromBalancePush",e=>{let{coinAmountOriginalDec:t,availableAmountNum:r,currencyAmount:o}=e;this.equalsTokenAndAccount(this.from,e)?(this.setCacheTokenInfo({chainId:e.chainId,tokenContractAddress:e.tokenContractAddress,amountNum:t},"ws"),this.setBalance(P.FROM,t,r,o)):this.equalsTokenAndAccount(this.to,e)&&this.setBalance(P.TO,t,r,o)});c(this,"tokenReplaceMainToken",e=>{let t=e,{fromDexMultiTokenInfoVO:r}=this.getDexMultiDefaultTokenInfo(e?.chainId),{tokenSymbol:o,chainId:i}=r;return pe(e?.chainId)&&e?.tokenContractAddress&&(this.commonStore.getTokenAddress(e)===(this.commonStore.isSensitiveChain(i)?o:Rt(o))||this.commonStore.getTokenAddress(e)===this.commonStore.getTokenAddress(r))&&(t={...r,amount:e.amount}),t});c(this,"onClickAddFunds",()=>{let{tokenSymbol:e,chainName:t}=this.from,{address:r}=this.accountStore,o={currency:e,network:t,address:r};this.getDeposit(o)});c(this,"calOrderUpdateFromTo",e=>{let{fromTokenUsd:t,toTokenUsd:r,fromAmount:o,toAmount:i}=e||{};st(o)||(this.from.amount=o),st(t)||(this.from.usdPrice=t),st(i)||(this.to.amount=i),st(r)||(this.to.usdPrice=r)});c(this,"isEvmChain",e=>pe(e)?this.commonStore.getChainByID(e)?.chainType!==Rn.NO_EVM_CHAIN:!0);c(this,"isTronChain",e=>e===x.TRON_MAINNET);c(this,"getFormatFromToToken",async({from:e,to:t},r)=>{let[o,i]=await Promise.all([this.checkQueryToken(e,r),this.checkQueryToken(t,r)]),a=o,s=i,u=l=>`${l?.chainId}-${l?.tokenContractAddress}`;if(o){let l=this.getInitializedValue(o?.chainId),d=Er(Tr([o,i,l.from,l.to],u));a=d[0],s=d[1]}else if(i){let l=this.getInitializedValue(i.chainId),d=Er(Tr([i,l.from,l.to],u));a=d[1],s=d[0]}return{token1:a,token2:s}});c(this,"orderContinueStatus",le.DEFAULT);c(this,"setOrderContinueStatus",e=>{this.orderContinueStatus=e});c(this,"fillSwapFromTo",async({apiRequestParams:e,locationParams:t})=>{let{closeModal:r}=this.rootStore.recentTransactionStore;!await this.beforeCheckAndGetTokenInfo(e,t)||(r(),this.setSwapAndLimitTypeValue(t.inputAmount))});c(this,"beforeCheckAndGetTokenInfo",async(e,t)=>{let{orderCheckContinue:r}=this.rootStore.oneMoreOrderStore;if(this.setOrderContinueStatus(le.LOADING),e&&!await r(e))return this.setOrderContinueStatus(le.ERROR),!1;let{token1:o,token2:i}=await this.getFormatFromToToken(t,!1);return!o||!i?(ne.error({title:E("swaptrade_history_toast_setup_error"),duration:Pe}),this.setOrderContinueStatus(le.ERROR),!1):(this.setOrderContinueStatus(le.READY),this.updateFromAndToInfo(o,i),!0)});c(this,"beforeCheckUrl",async e=>{this.setOrderContinueStatus(le.LOADING);let{orderCheckContinue:t}=this.rootStore.oneMoreOrderStore;return await t(e)?(this.setOrderContinueStatus(le.READY),!0):(this.setOrderContinueStatus(le.ERROR),!1)});c(this,"updateFromAndToInfo",(e,t)=>{this.updateFrom(e),this.updateTo(t)});this.rootStore=e,this.accountStore=e.accountStore,this.commonStore=e.commonStore,Vt(()=>this.initialPropsStore.initialProps.fromTo,(t={})=>{let{from:r={},to:o={}}=t;this.setFrom(r),this.setTo(o)})}static async getInitialProps(e){let t=new URLSearchParams(e.route.search),{from:{chainId:r,tokenContractAddress:o},to:{chainId:i,tokenContractAddress:a}}=lo(t);if(!yo({fromChainId:r,toChainId:i,fromTokenAddress:o,toTokenAddress:a}))return{from:{},to:{}};let s=Xn,u={chainId:r,fromTokenAddress:o,toTokenAddress:a};e.route.path.includes(Mn)&&(s=Kn,u={chainId:r,toChainId:i,fromTokenAddress:o,toTokenAddress:a}),e.route.path.includes(Fn)&&(s=Jn,u={fromChainId:r,toChainId:i,fromTokenAddress:o,toTokenAddress:a});let[m,_]=await B(G.get(s,{params:u}));return m?{from:{},to:{}}:{from:O(_,"data.fromTokenInfo")||O(_,"data.fromToken"),to:O(_,"data.toTokenInfo")||O(_,"data.toToken")}}get computedTypedValue(){return this.commonStore.currentTab===fe.SWAP?this.singleTypedValue:this.typedValue}get computedFromMax(){return this.commonStore.currentTab===fe.SWAP?this.singleFromMax:this.fromMax}get computedNeedCrossChainDoubleConfirm(){return this.computedIsSingleChain?!1:!this.needCrossChainDoubleConfirm}get dependentField(){return this.independentField===P.FROM?P.TO:P.FROM}get computedIsExactIn(){return this.independentField===P.FROM}get computedIsSingleChain(){return pe(this.from.chainId)&&pe(this.to.chainId)&&Number(this.from.chainId)===Number(this.to?.chainId)}get computedSwapAmount(){return{[this.independentField]:this.computedFromMax?dt(this.computedTypedValue,{noNeedThousandth:!0}):this.computedTypedValue,[this.dependentField]:this.computedCalAmount[this.dependentField]}}get computedCalAmount(){return{[P.FROM]:dt(this.from?.amount,{noNeedThousandth:!0})??"",[P.TO]:dt(this.to?.amount,{noNeedThousandth:!0})??""}}get computedIfQuote(){return!!(this.computedTypedValueIsValid&&this.from&&this.to)}get computedTypedValueIsValid(){return!j(this.computedTypedValue).isZero()&&!j(this.computedTypedValue).isNaN()}get computedFromAmountIsValid(){let{amount:e}=this.from;return jt(e)}get computedFromLocalCostByUsd(){let{usdPrice:e}=this.from;if(!this.computedFromAmountIsValid)return"";let{nowCurrencyUnit:t}=this.commonStore,{symbol:r,usdToThisRate:o}=t,i=j(e);if(r&&e&&o&&!i.isNaN()){let s=i.multipliedBy(o).toString();return Re(s,r,{needBillionMillionUnit:!1})}return""}get computedToLocalCostByUsd(){let{usdPrice:e}=this.to,{nowCurrencyUnit:t}=this.commonStore,{symbol:r,usdToThisRate:o}=t,i=j(e);if(r&&e&&o&&this.to.amount&&!i.isNaN()&&jt(this.from.amount)){let s=i.multipliedBy(o).toString();return Re(s,r,{needBillionMillionUnit:!1})}return""}get computedRate(){let{from:e,to:t,computedIsExactIn:r}=this,{quoteStore:o,gasDropStore:i}=this.rootStore,a=O(o,"quote.bestRoute.gasDropFromAmount",""),s=a&&i?.gasDropConfig?.gasDrop?j(e?.amount).minus(a):j(e?.amount),u=t?.reverseReceiveAmount&&r||!r&&e?.amount;return s&&u?oe(j(t?.reverseReceiveAmount).div(s).toString(10),{needBillionMillionUnit:!1}):""}get computedToFromRate(){let{from:e,to:t,computedIsExactIn:r}=this,{quoteStore:o,gasDropStore:i}=this.rootStore,a=O(o,"quote.bestRoute.gasDropFromAmount",""),s=a&&i?.gasDropConfig?.gasDrop?j(e?.amount).minus(a):j(e?.amount),u=t?.reverseReceiveAmount&&r||!r&&e?.amount;return s&&u?oe(j(s).div(t?.reverseReceiveAmount).toString(10),{needBillionMillionUnit:!1}):""}get computedIsToAddressEqualsCurrentToAddress(){let e=this.accountStore.getAddressByChainId(this.to.chainId);return e&&this.rootStore.receiveAddressStore.computedReceiveAddr===e}get computedValueDifference(){let{quoteStore:e}=this.rootStore,t=O(e,"quote.bestRoute.quoteDiffValThreshold"),r=O(e,"quote.bestRoute.quoteDiffPercentThreshold");return So({pay:this.from.usdPrice,receive:this.to.usdPrice,quoteDiffValThreshold:t,quoteDiffPercentThreshold:r})}get computedIsCrossChain(){return pe(this.from.chainId)&&pe(this.to.chainId)&&Number(this.from.chainId)!==Number(this.to?.chainId)}get computedIsBridge(){let{from:e,to:t}=this;return this.computedIsCrossChain&&e.tokenSymbol===t.tokenSymbol}getDeposit(){}get computedDiffCrossChain(){let e=!!this.accountStore.address,t=this.commonStore.getChainByID(this.from.chainId),r=this.commonStore.getChainByID(this.to.chainId),o=String(this.from.isHoneypot),i=String(this.to.isHoneypot),{computedNonsupportChain:a}=this.accountStore,s=t?.crossChainType||"",u=r?.crossChainType||"";return e&&!a&&o!=="1"&&i!=="1"&&s&&u&&s!==u}get computedMaxTipsText(){let{from:e,maxDialogType:t}=this,{cacheNativeGasFee:r}=this.rootStore.quoteStore;if(!e.isNativeToken||!r||!e.tokenSymbol)return E("wallet_swap_toast_reserve_mainnet_token");let o={value:oe(r),tokenSymbol:e.tokenSymbol};if(this.checkMaxDialogTypeIsEnough(t)){if(this.computedIsFromBtcCoin&&K.gt(this.computedUnavailableBalance,0)){let i=oe(this.computedUnavailableBalance);return E("swaptrade_dialog_pay_card_reserved_from_wallet",{symbol:o.tokenSymbol,value:o.value,unablevalue:i})}return E("swaptrade_dialog_desc_reserved_netfee",o)}return E("swaptrade_dialog_desc_please_reserve",o)}get computedShowAddFund(){let{accountStore:e,swapBtnStore:t}=this.rootStore,{from:r}=this;return!e.computedNonsupportChain&&(this.independentField===P.FROM&&j(this.computedTypedValue||0).gt(j(r.balance||0))||t.computedTooBalance)||this.showAddFund&&!this.checkMaxDialogTypeIsEnough(this.maxDialogType)}get computedIsEvmChain(){return this.isEvmChain(this.from.chainId)}get computedDefaultAutoSlippageInfo(){let e=this.commonStore.getChainByID(this.from.chainId);return{autoSlippage:e?.toleranceSlippage?.selectItem,autoTotalSlippage:e?.crossToleranceSlippage?.selectItem}}get computedIsSolanaChain(){return Wt(this.from.chainId)}get computedIsAptosChain(){return go(this.from.chainId)}get computedIsTronChain(){return po(this.from.chainId)}get computedIsSuiChain(){return mo(this.from.chainId)}get computedIsStacksChain(){return _o(this.from.chainId)}get computedIsStarknetChain(){return vo(this.from.chainId)}get computedHasToSwap(){let e=O(this.rootStore.quoteStore,"quote.bestRoute.toSwapFeeUsd");return this.computedIsCrossChain&&e>0}setSwapAndLimitTypeValue(e){let{computedCurrentTabIsLimit:t}=this.commonStore,{clearSellAndReceive:r}=this.rootStore?.limitOrderControlStore||{};t?r?.():jt(e)?(this.setField(P.FROM),this.advanceSetTypedValue(e)):this.advanceSetTypedValue("")}get computedLeverageTokenPair(){return ia(this.from,this.to)}get computedFormToTokenIsLeverageToken(){let[e,t]=this.computedLeverageTokenPair;return!!e||!!t}get computedIsFromBtcChain(){return ho(this.from.chainId)}get computedIsFromBtcCoin(){return this.computedIsFromBtcChain&&this.from.isNativeToken}get computedUnavailableBalance(){return j(this.from.balance).minus(this.from.availableBalance).toString()}get computedIsFacetToken(){let{from:e,to:t}=this;return Number(e.tokenType)===wr.FACET||Number(t.tokenType)===wr.FACET}get computedNonsupportFacetToken(){let{address:e,walletConfig:{OKXWalletType:t,walletType:r}}=this.accountStore;if(!e)return!1;let o=[Cr.MNEMONIC,Cr.PRIVATE_KEY].includes(t),i=r===Mt.METAMASK;return this.computedIsFacetToken&&!(o||i)}},aa=cn(un);var It=class extends aa{constructor(t){super(t);c(this,"getDeposit",()=>()=>{});c(this,"addFundsParams",{});c(this,"closeAddFunds",()=>{this.visibleAddFunds=!1});c(this,"onClickAddFunds",()=>{let{tokenSymbol:t,chainName:r,tokenLogoUrl:o,chainId:i,isNativeToken:a,tokenContractAddress:s}=this.from;this.visibleAddFunds=!0;let u={currency:t,network:r,iconUrl:o,chainId:i,isNativeToken:a,tokenContractAddress:a?"":s,receiveOnly:!0};this.baseAddFunds(u)});c(this,"baseAddFunds",t=>{this.visibleAddFunds=!0,this.addFundsParams={...t}});c(this,"tokenReplaceMainToken",(t,r)=>{let o=t,i=!co(t),{fromDexMultiTokenInfoVO:a}=this.getDexMultiDefaultTokenInfo(i?r:t.chainId),{tokenSymbol:s,chainId:u}=a;return!i&&(this.commonStore.getTokenAddress(t)===(this.commonStore.isSensitiveChain(u)?s:Rt(s))||this.commonStore.getTokenAddress(t)===this.commonStore.getTokenAddress(a))&&(o={...a,amount:t.amount}),o});qt(this),Vt(()=>{let{computedDiffCrossChain:r,to:o}=this;return{computedDiffCrossChain:r,toChainId:o?.chainId}},({computedDiffCrossChain:r,toChainId:o})=>{this.cacheToChainId!==o&&this.rootStore.receiveAddressStore.saveReceiveAddressValue({}),this.rootStore.receiveAddressStore.setCacheToChainId(r&&o?o:-1)},{equals:In.shallow})}};f();h();f();h();var ln=class{constructor(e){c(this,"receiveAddrStatus",ct.NORMAL);c(this,"receiveAddrObj",{});c(this,"saveReceiveAddressValue",e=>{this.receiveAddrObj=this.filterReceiveWalletInfo(e),e?.specifiedAddress||this.initCheckAddrStatus()});c(this,"clearReceiveAddressValue",()=>{this.receiveAddrObj={},this.initCheckAddrStatus(),this.walletAddrInWeb3=[],this.getLinkedWalletAddrInWeb3().catch(()=>{})});c(this,"checkReceiveAddressLoading",!1);c(this,"filterReceiveAddress",(e,t,r=!0)=>{let o=t?.specifiedAddress||this.receiveAddrObj?.specifiedAddress||"";return o?e.filter(({specifiedAddress:i})=>r?i.includes(o):i===o):e});c(this,"filterReceiveWalletInfo",e=>{if(!e.specifiedAddress||e.walletId)return e;let t=this.filterReceiveAddress(this.initWalletAddrListFromChain,e,!1);return t.length?t[0]:e});c(this,"initCheckAddrStatus",()=>{this.checkReceiveAddressLoading=!1,this.receiveAddrStatus=ct.NORMAL});c(this,"checkReceiveAddr",async e=>{if(e||this.receiveAddrObj.specifiedAddress){this.checkReceiveAddressLoading=!0;let{to:t}=this.rootStore.fromToStore,r=Symbol("requestId");this.currentRequestId=r;let[o,i]=await B(G.get(Qn,{params:{address:e||this.receiveAddrObj.specifiedAddress,chainId:t?.chainId}}));if(this.checkReceiveAddressLoading=!1,o){b.stuff(o),this.receiveAddrStatus=ct.ILLEGALITY;return}this.currentRequestId===r&&kt(()=>{this.receiveAddrStatus=i.data.status})}else this.initCheckAddrStatus()});c(this,"getSpecifiedChainWalletList",async e=>{let t=await this.getSpecifiedChainWalletListByWeb3(e),r={};return t?.forEach(o=>{let{specifiedAddress:i,walletType:a,createTime:s}=o,u=a===Mt.OKEXCHAIN;r[i]&&r[i]?.has&&u?r[i].walletInfo.createTime<s&&(r[i].walletInfo=o):(!r[i]?.has||u)&&(r[i]={walletInfo:o,has:u})}),Object.keys(r).map(o=>r[o].walletInfo)});c(this,"walletAddrInWeb3",[]);c(this,"getLinkedWalletAddrInWeb3",async()=>{let{computedDiffCrossChain:e,to:t}=this.rootStore.fromToStore,{computedAccountId:r}=this.rootStore.accountStore;if(!e)return;let[o,i]=await B(this.getSpecifiedChainWalletList({chainId:t.chainId,walletIds:[r]}));o||kt(()=>{this.walletAddrInWeb3=i})});c(this,"initWalletAddrListFromChain",[]);c(this,"initWalletAddrListInStorage",[]);c(this,"filterWalletAddrListFromChain",[]);c(this,"filterWalletAddrListInStorage",[]);c(this,"getWalletList",async()=>{let{to:e}=this.rootStore.fromToStore,t=await this.getSpecifiedChainWalletList({chainId:e.chainId});kt(()=>{this.initWalletAddrListFromChain=t,this.filterWalletAddrListFromChain=t;let r=he.get(lt);if(r){let o=r[e.chainId]||[];this.initWalletAddrListInStorage=o,this.filterWalletAddrListInStorage=o}})});c(this,"getFilteredAddrList",e=>{this.filterWalletAddrListFromChain=this.filterReceiveAddress(this.initWalletAddrListFromChain,e),this.filterWalletAddrListInStorage=this.filterReceiveAddress(this.initWalletAddrListInStorage,e)});c(this,"saveWalletAddressToStorage",e=>{this.receiveAddrObj?.specifiedAddress&&he.set(lt,{[e.chainId]:[this.receiveAddrObj]})});c(this,"formatInputValue",e=>{let{specifiedAddress:t,deriveName:r,label:o}=e;if(t.length<=9)return t;let i=Ut(e.specifiedAddress);return r&&(i=`(${i})`,o?i=`${r} - ${o} ${i}`:i=`${r} ${i}`),i});this.rootStore=e}get computedSwapHighLight(){return this.receiveAddrStatus===ct.NORMAL&&!!this.receiveAddrObj?.specifiedAddress}get computedFormatReceiveAddr(){return this.receiveAddrObj?.specifiedAddress?this.formatInputValue(this.receiveAddrObj):""}get computedReceiveAddr(){return this.receiveAddrObj?.specifiedAddress||""}async getSpecifiedChainWalletListByWeb3(){return[]}get computedWalletAddrInWeb3(){return this.walletAddrInWeb3.length?this.walletAddrInWeb3[0]:null}get isFromFilterAddress(){let e=this.filterReceiveAddress(this.initWalletAddrListFromChain,this.receiveAddrObj?.specifiedAddress,!1),t=this.filterReceiveAddress(this.initWalletAddrListInStorage,this.receiveAddrObj?.specifiedAddress,!1);return!!(e.length+t.length)&&!!this.receiveAddrObj?.specifiedAddress}},sa=ln;var dn=class extends sa{constructor(t){super(t);c(this,"formatInputValueEx",(t,r)=>{let{keyringName:o,walletName:i}=t;if(r.length<=9)return r;let a=Ut(r);return o&&(a=`(${a})`,i?a=`${o} - ${i} ${a}`:a=`${o} ${a}`),a});c(this,"cacheToChainId",-1);c(this,"setCacheToChainId",t=>{this.cacheToChainId=t});c(this,"addressListEx",[]);c(this,"getWalletListEx",()=>{let{accountStore:t,fromToStore:r}=this.rootStore,o=k.getNetWorkName(r.to.chainId),{walletList:i,addressBookList:a,keyringIdentityTypeEnum:s}=t,l=(he.get(lt)||{})[r.to.chainId]||[],d=ra(a,o),m=na(i,o);this.addressListEx=oa({recentAddrData:l,addressBookData:d,walletListData:m,chainName:o,keyringIdentityTypeEnum:s})});qt(this)}get computedFormatReceiveAddrEx(){let{accountStore:t,fromToStore:r}=this.rootStore,{walletConfig:o}=t;if(this.receiveAddrObj.specifiedAddress)return this.formatInputValueEx(this.receiveAddrObj,this.receiveAddrObj.specifiedAddress);let i=k.getNetWorkName(r.to.chainId),a=o?.account[i];return a?(this.receiveAddrObj={...o,specifiedAddress:a},this.formatInputValueEx(o,a)):""}},ca=dn;f();h();f();h();De();f();h();De();var fc=/\s/,fn=n=>!(!On(n)||fc.test(n)||n.length<10);f();h();f();h();f();h();var I=class{constructor({orderData:e,extParams:t},r){c(this,"walletNoNeedExtParams",!1);c(this,"differentiatedEnvironment",e=>ue()&&e.length>1&&!this.walletNoNeedExtParams&&!e[0].params?[{...e[0],extParams:e[1]}]:e);this.orderData=e,this.calldataType=e.calldataType,this.extParams=t||{},this.swapStore=r}get isTransferType(){return this.calldataType===kn.TRANSFER}};var Fe=class extends I{constructor(){super(...arguments);c(this,"formatContractPayload",()=>{let{orderData:t}=this;return{...JSON.parse(t?.callData?.data)}});c(this,"formatTransferPayload",()=>{});c(this,"getSendTransactionParams",async()=>{let t=this.formatContractPayload();return this.differentiatedEnvironment([{...t,extParams:this.extParams}])});c(this,"preExecution",async()=>({payload:this.formatContractPayload()}))}};c(Fe,"chainId",x.APTOS_MAINNET);f();h();var Ue=class extends I{constructor(t,r,o){super(t,r);c(this,"makeSendBtcCallParams",async t=>{let{preDataForSendBtc:r}=this.swapStore.rootStore.walletContractStore;if(!r)throw Error("preDataForSendBtc is not ready");let{satBytes:o,coinAmount:i,dustSize:a,fetchUtxoList:s,serviceCharge:u}=r,l=await s();return{...t,utxoList:l,satBytes:o,dustSize:a,coinAmount:i,serviceCharge:u}});c(this,"formatContractPayload",()=>{});c(this,"formatTransferPayload",async()=>{let{orderData:t}=this;return this.swapStore.transferBtcPayload(t.callData)});c(this,"extendExtParams",t=>({...t,extParams:this.extParams}));c(this,"getSendTransactionParams",async()=>{if(!this.token.isNativeToken)throw new Error("btc token is not native token");let t;if(this.isTransferType){let r=await this.formatTransferPayload();t=this.extendExtParams(r),ue()&&(t=await this.makeSendBtcCallParams(t))}else throw Error("Not support contract call");return this.differentiatedEnvironment([t])});c(this,"preExecution",async()=>{if(!this.token.isNativeToken)throw new Error("btc token is not native token");let t;if(this.isTransferType)t=await this.formatTransferPayload();else throw Error("Not support contract call");return{payload:t}});this.token=o}};c(Ue,"chainId",x.BTC_MAINNET);f();h();var hr=class extends I{constructor(){super(...arguments);c(this,"valueToHex",t=>K.BigNumber(t).toString(16));c(this,"formatContractPayload",t=>{let{orderData:r}=this,{priorityFee:o,maxFeePerGas:i,maxPriorityFeePerGas:a,gasPrice:s,gas:u,...l}=r?.callData||{};return t?r?.callData:l});c(this,"formatTransferPayload",()=>{let{orderData:t}=this;return t.callData});c(this,"getSendTransactionParams",async(t=!1)=>{let{payload:r}=await this.preExecution(t);return so&&r.value&&(r.value=this.valueToHex(r.value)),this.differentiatedEnvironment([r])});c(this,"preExecution",async t=>{let r;this.isTransferType?r=this.formatTransferPayload():r=this.formatContractPayload(t);let{extendEvmParams:o,extendsGas:i}=this.swapStore;return r.extParams=this.extParams,i&&(r=i(r)),r=o(r),{payload:r}})}};c(hr,"chainId",x.ETHEREUM_MAINNET);var pr=hr;f();h();var je=class extends I{constructor(...t){super(...t);c(this,"formatContractPayload",async()=>{let{orderData:t}=this;return this.txData(t.unsignedTx)});c(this,"formatTransferPayload",async()=>{let{orderData:t}=this,{unsignedTx:r}=t;return this.txData(r)});c(this,"getSendTransactionParams",async()=>{let{payload:t}=await this.preExecution();return this.differentiatedEnvironment([t,this.extParams])});c(this,"preExecution",async()=>{let t;return this.isTransferType?t=await this.formatTransferPayload():t=await this.formatContractPayload(),t});c(this,"getTxData",()=>{let{jitoData:t,jitoEnable:r=!1,unsignedTx:o}=this.orderData||{};try{if(r){let{jitoUnsignedTx:i}=t;return JSON.parse(i).array}return[JSON.parse(o)]}catch(i){throw new Error(i)}});c(this,"jitoTransaction",async()=>{let t=this.getTxData();try{return Promise.all(t.map(this.txData))}catch(r){throw new Error(r)}});let r=new wo;Object.assign(this,{...r})}};c(je,"chainId",x.SOLANA_MAINNET);f();h();var We=class extends I{constructor(){super(...arguments);c(this,"formatContractPayload",()=>{let{orderData:t}=this,{data:r,from:o}=t.callData,i=JSON.parse(r);return{...i,functionArgs:i.functionArgsEncode,txType:"contract_call",stxAddress:o}});c(this,"formatTransferPayload",()=>{});c(this,"getSendTransactionParams",async()=>this.differentiatedEnvironment([this.formatContractPayload(),this.extParams]));c(this,"preExecution",async()=>({payload:this.formatContractPayload()}))}};c(We,"chainId",x.STACKS_MAINNET);f();h();var qe=class extends I{constructor(){super(...arguments);c(this,"walletNoNeedExtParams",!0);c(this,"formatContractPayload",()=>{let{orderData:t}=this,r=JSON.parse(t.unsignedTx),{executionRequest:o}=JSON.parse(r.data);return o.calls});c(this,"formatTransferPayload",()=>{});c(this,"getSendTransactionParams",async()=>this.differentiatedEnvironment([this.formatContractPayload()]));c(this,"preExecution",()=>({payload:this.formatContractPayload()}))}};c(qe,"chainId",x.STARKNET_MAINNET);f();h();var mr=class extends I{constructor(){super(...arguments);c(this,"formatContractPayload",()=>{let{orderData:t}=this,{txBytes:r}=JSON.parse(t.unsignedTx);return{transactionBlock:r}});c(this,"getSendTransactionParams",async()=>this.differentiatedEnvironment([this.formatContractPayload(),this.extParams]));c(this,"preExecution",async()=>({payload:this.formatContractPayload()}))}};c(mr,"chainId",x.SUI_MAINNET);var hn=mr;f();h();var _r=class extends I{constructor(){super(...arguments);c(this,"walletNoNeedExtParams",!1);c(this,"formatContractPayload",()=>{let{orderData:t}=this,{params:r}=JSON.parse(t.unsignedTx);return r});c(this,"formatTransferPayload",()=>{let{orderData:t}=this,{params:r}=JSON.parse(t.unsignedTx);return r});c(this,"getSendTransactionParams",async()=>{let t=this.isTransferType?this.formatTransferPayload():this.formatContractPayload();return this.differentiatedEnvironment([t,this.extParams])});c(this,"preExecution",async()=>({payload:this.isTransferType?this.formatTransferPayload():this.formatContractPayload()}))}};c(_r,"chainId",x.TON_MAINNET);var pn=_r;f();h();var Ge=class extends I{constructor(){super(...arguments);c(this,"formatContractPayload",()=>{let{orderData:t}=this;return JSON.parse(t.unsignedTx)});c(this,"formatTransferPayload",()=>{});c(this,"getSendTransactionParams",async()=>{let t=this.formatContractPayload();return this.differentiatedEnvironment([{...t,extParams:this.extParams}])});c(this,"preExecution",async()=>({payload:this.formatContractPayload()}))}};c(Ge,"chainId",x.TRON_MAINNET);var hc={[Ue.chainId]:Ue,[pr.chainId]:pr,[je.chainId]:je,[Fe.chainId]:Fe,[hn.chainId]:hn,[Ge.chainId]:Ge,[We.chainId]:We,[qe.chainId]:qe,[pn.chainId]:pn},pc=n=>hc[n]||pr,mc=(n,e,t)=>{let{chainId:r}=n,o=pc(r);return new o(e,t,n)},vr=mc;f();h();function mn(n){return n?.message&&n?.message?.includes("User denied transaction signature")?!0:[de.USER_DENIED,de.WC2Denied,de.USER_DENIED_WC_RAINBOW,de.WC_QR_DENIED].includes(n?.code)}var xt=class{constructor(e){c(this,"defaultGasFee","--");c(this,"isWalletConfirm",!1);c(this,"setWalletConfirm",e=>{this.isWalletConfirm=e});c(this,"isConfirmLoading",!1);c(this,"txInfo",{});c(this,"resetTxInfo",()=>{this.txInfo={}});c(this,"showRecentTransactionModal",e=>{this.confirmSwapVisible=!1,this.rootStore.recentTransactionStore.showModal(e)});c(this,"saveOrderParamsExtendSlippageAndGasPrice",e=>{let t={...e},{computedQuote:r,fromToStore:o}=this,{computedIsSingleChain:i,computedDefaultAutoSlippageInfo:a}=o,{autoSlippageInfo:s}=r.bestRoute||{},u=No({isSingleChain:i,autoSlippageInfo:a}),l={autoSlippageInfo:s||{}},d=O(this,"rootStore.slippageStore");return d&&(u=d.computedRealSlippageValue,l=d.getOrderSlippageInfo()),Object.assign(t,{slippage:String(u),...Co({slippageInfo:l,isSingleChain:i})})});c(this,"saveOrderSingleChainParams",e=>{let{computedQuote:t}=this,{originDexRouterList:r,dexRouterList:o,serviceFeeInfo:i,quoteData:a}=t.bestRoute||{};return{...e,dexRouterList:o,originDexRouterList:r,serviceFeeInfo:i,quoteData:a}});c(this,"saveOrderCrossChainParams",e=>{let{computedQuote:t,fromToStore:r}=this,{receiveAddressStore:o}=this.rootStore,{to:i,computedDiffCrossChain:a}=r,{receiveAddrObj:s}=o,{fromDexRouterList:u,bridge:l,toDexRouterToList:d,originFromDexRouterList:m}=t.bestRoute||{};return{...e,toChainId:i.chainId,crossChainDexRouter:{fromDexRouterList:u,toDexRouterToList:d,bridge:l,originFromDexRouterList:m},...a?{receiveWalletAddress:s?.specifiedAddress}:{}}});c(this,"saveOrderParams",()=>{let{fromToStore:e}=this,{computedIsSingleChain:t}=e,r=this.baseSaveOrderParams();return t?this.saveOrderSingleChainParams(r):this.saveOrderCrossChainParams(r)});c(this,"calldataSign",null);c(this,"setCalldataSign",e=>{this.calldataSign=e});c(this,"extendSignParams",async e=>{let t={...e},r=O(this.quoteStore,"quote.bestRoute.permit2Data");if(r&&!this.calldataSign){let[o,i]=await this.checkPermit2();if(o)return null;this.setCalldataSign(i),t={...t,unsignedTx:r?.unsignedTx,signature:i}}else r&&this.calldataSign&&(t={...t,unsignedTx:r?.unsignedTx,signature:this.calldataSign});return t});c(this,"checkPermit2",async()=>{let e=O(this.quoteStore,"quote.bestRoute.permit2Data"),t=O(this.quoteStore,"quote.bestRoute.fromToken.chainId"),{signTransaction:r}=this.rootStore.sendTransactionStore,o=e?.unsignedTx,[i,a]=await r(o,t);return i&&(b.error(N.SIGN_PERMIT2_DATA,{error:i,unsignedTx:o,tags:Se(i)}),mn(i)||$e.error({title:E("swaptrade_trading_mode_alert_order_fail")})),[i,a]});c(this,"resetFromToAmount",()=>{this.fromToStore.updateFrom({amount:"",currentTime:"",prevAmount:"",usdPrice:""}),this.fromToStore.updateTo({amount:"",prevAmount:"",usdPrice:"",currentTime:""}),this.fromToStore.advanceSetTypedValue("")});c(this,"transferBtcPayload",e=>{let t={...e},{from:r}=this.fromToStore;return t.value=ro(t.value,r.decimals),t});c(this,"getExtParams",e=>{let{computedIsSingleChain:t,to:r,from:o,computedDiffCrossChain:i}=this.fromToStore,{receiveAddrObj:a}=this.rootStore.receiveAddressStore,s=i?a?.specifiedAddress:r.tokenContractAddress;return{txSource:3,orderId:e,toTokenAddress:s,crossChain:t?0:1,chainId:o.chainId,tokenAddress:o.tokenContractAddress,amount:o.amount,toChainId:r.chainId}});c(this,"autoShowDialog",!0);c(this,"setAutoShowDialog",e=>{this.autoShowDialog=e});c(this,"widgetSubmitTxEvent",()=>{});c(this,"confirmSwapVisible",!1);c(this,"setConfirmSwapVisible",e=>{this.confirmSwapVisible=e});c(this,"isSwapSolana",e=>!!(Wt(e)&&this.rootStore.solanaPriorityFeeStore?.jitoData));c(this,"extendSolanaCalldata",e=>{let{feeType:t,customFee:r,computedPriorityFeeList:o}=this.rootStore.solanaPriorityFeeStore||{},i=o.find(s=>s.type===t),a=r||i.fee;return{...e,tradeMode:2,priorityFee:a,customPriorityFee:!!r}});c(this,"solanaSwapParams",null);c(this,"setSolanaSwapParams",e=>{this.solanaSwapParams=e});c(this,"getSolanaCalldata",e=>(this.setSolanaSwapParams(e),B(G.post(Hn,e))));c(this,"solanaTransaction",async(e,t)=>{let{from:r}=this.fromToStore,{computedAccountId:o}=this.accountStore,a=await vr(r,{orderData:e,extParams:{}},this).jitoTransaction(),s=a.map(d=>d.payload.transaction),[u,l]=await B(this.rootStore.sendTransactionStore.signAllTransactions(s));if(u){this.onWalletFail(u,e?.orderId),this.isConfirmLoading=!1,b.removeKeep();return}await this.sendSolanaTransaction({signedTransactions:l,txArray:a,swapParams:t,walletId:o,enableJito:e.jitoEnable})});c(this,"sendSolanaTransaction",async({signedTransactions:e,txArray:t,swapParams:r,walletId:o,enableJito:i})=>{let[a,s]=await B(Oo({signedTransactions:e,txArray:t,swapParams:r,walletId:o,enableJito:i}));if(this.isConfirmLoading=!1,b.removeKeep(),!a){let u=O(s,"data.broadcastResult.data.orderId");this.afterTransaction(u,{txHash:O(s,"data.broadcastResult.data.transactionHash"),chainId:r.chainId,txType:"SWAP"})}});c(this,"walletConfirming",!1);c(this,"formatClaimPayload",(e,t)=>{let{orderId:r,toChainId:o}=t;return vr({chainId:o},{orderData:e,extParams:{txType:86,txSource:3,orderId:r,toTokenAddress:t.toTokenAddress,chainId:t.chainId||t.fromChainId,tokenAddress:t.fromTokenAddress,amount:t.fromAmount,toChainId:o}},this).getSendTransactionParams()});c(this,"fetchClaimCalldata",async(e,t)=>{let{orderId:r}=e,[o,i]=await B(G.post(Wn,{mainOrderId:r,payerWalletAddress:t}));if(o)return b.error(N.FETCH_CLAIM_CALDATA_ERROR,{error:o,tags:{orderId:r,...Se(o)}}),$e.error({title:o?.error_message||E("swaptrade_home_toast_initiation_error")}),null;let a=O(i,"data",{});return{payload:await this.formatClaimPayload(i?.data||{},e),sourceClaimPayload:a}});c(this,"updateClaimOrder",e=>{b.info(N.UPDATE_CLAIM_ORDER,{params:e,tags:{orderId:e.mainOrderId}}),G.post(qn,e)});this.rootStore=e,this.commonStore=e.commonStore,this.accountStore=e.accountStore,this.fromToStore=e.fromToStore,this.tokenModalStore=e.tokenModalStore,this.quoteStore=e.quoteStore,this.gasDropStore=e.gasDropStore}get computedEstimateGasFee(){let e=this.defaultGasFee,t=this.commonStore.nowCurrencyUnit,r=O(this.computedQuote.bestRoute,"quoteNetWorkFeeOfMoney");if(this.isSwapSolana(this.fromToStore.from.chainId)&&this.quoteStore.enableQuoteAggregates){let i=O(this.rootStore.solanaPriorityFeeStore,"computedPriorityFeeOfUsd",0);r=K.add(i,r,{returnString:!0})}let o=K.BigNumber(r).multipliedBy(O(t,"usdToThisRate"));return!Nn(t)&&!o.isNaN()&&(e=Re(o.toJSON(),t?.symbol)),e}get computedCrossChainFromFee(){let e=O(this.computedQuote.bestRoute,"fromSwapFeeUsd");if(!e||Cn(Number(e)))return"--";let{computedNowCurrencySymbol:t,currencyConversion:r}=this.commonStore,o=r(e).toString();return`${Re(o,t)}`}updateTxHash(e){this.rootStore.sendTransactionStore.updateTxHash(e)}cancelOrder(e){e&&this.rootStore.sendTransactionStore.cancelOrder(e)}baseSaveOrderParams(){let{accountStore:e,computedQuote:t,fromToStore:r,quoteStore:o,gasDropStore:i}=this,{from:a,to:s}=r,{estimateGasFee:u,minimumReceived:l,gasDropAmount:d,defiPlatformId:m,traceData:_}=t.bestRoute||{},{computedIsMevOpen:T}=this.rootStore.mevStore,V={chainId:a.chainId,fromAmount:K.BigNumber(o?.computedQuoteAmount).toString(10),fromTokenAddress:a.tokenContractAddress,fromTokenDecimal:String(a.decimals),toAmount:s.reverseReceiveAmount,toTokenAddress:s.tokenContractAddress,toTokenDecimal:String(s.decimals),userWalletAddress:e.address,estimateGasFee:u,pmm:"1",gasDropType:i?.computedGasDropSelected?1:0,gasDropAmount:d,minimumReceived:l,openMev:T,toChainId:s.chainId,traceData:_};m&&(V.defiPlatformId=m);let C=this.rootStore.outerStore.extendFeeConfig(V);return this.saveOrderParamsExtendSlippageAndGasPrice(C)}saveOrderUrl(){return Gn}onSaveOrder(e){let t={...e,...Ao()};return b.info(N.SAVE_ORDER_PARAMS,{data:t}),G.post(this.saveOrderUrl(),t)}saveOrderErr(e){let{error_code:t,error_message:r=""}=e;return b.error(N.SAVE_ORDER_ERROR,{error:e,tags:Se(e)}),t==="10014"?$e.error({title:E("swaptrade_toast_trade_not_available")}):$e.error({title:r||E("swaptrade_toast_save_order_fail")})}saveOrderError(e){this.saveOrderErr(e),this.isConfirmLoading=!1,b.removeKeep()}async onSwap(e){this.isConfirmLoading=!0,b.keepLive(),this.setCalldataSign(null);let t=this.saveOrderParams(),r=await this.extendSignParams(t);if(!r){this.isConfirmLoading=!1;return}if(this.isSwapSolana(r.chainId)){await this.onSolanaSwap(r);return}let[o,i]=await B(this.onSaveOrder(r));if(o){this.saveOrderError(o);return}b.info(N.SAVE_ORDER,{data:i?.data,tags:{orderId:i?.data.orderId}}),Vr({...ft(),order_id:i?.data.orderId,wallet_type:this.accountStore.walletConfig?.walletType});let[a]=await B(this.onChainTransaction({...i?.data,swapParams:r},e));a&&this.onWalletFail(a,i?.data?.orderId),this.isConfirmLoading=!1,b.removeKeep()}walletErrorMessage(e){let t=null;try{t=JSON.parse(e?.message)}catch{t={}}return t}walletErrToast(e,t){let r,o=this.walletErrorMessage(e);if(b.error(N.SEND_ERROR,{error:e,tags:{orderId:t,...Se(e)}}),o?.code===de.SLIPPAGE_LOW)r=E("swaptrade_home_toast_slippage_too_low");else if(o?.code===de.SEND_TX_ERROR_CODE)r=o?.message;else if(o?.code===de.NOT_TIPS)return null;return $e.error({title:r||E("swaptrade_home_toast_broadcast_failed")})}onWalletFail(e,t,r=!1){mn(e)?r||this.cancelOrder(t):e?.code!==jn.RECEIPT_ERROR&&(Mr.emit(Br.FAIL,{data:{orderId:t},status:-2,message:Nr("transaction fail")}),this.walletErrToast(e,t)),b.error(N.ON_WALLET_FAIL,{error:e,tags:{orderId:t,...Se(e)}})}extendEvmParams(e){return e}isOkxWallet(){}async getTransactionPayload({orderData:e,orderId:t}){let{from:r}=this.fromToStore;return vr(r,{orderData:e,extParams:this.getExtParams(t)},this).getSendTransactionParams()}sendTransactionEnhance(...e){return this.rootStore.sendTransactionStore.sendTransaction(...e)}getTransaction(){}logChainId(){return!0}async doubleCheckChainId(){return!0}async onChainTransaction(e,t){let{callData:r,orderId:o,swapParams:i}=e,a=await this.getTransactionPayload({orderData:e,orderId:o}),{computedIsEvmChain:s,from:u}=this.fromToStore;if(b.info(N.PAYLOAD,{payload:a,tags:{orderId:o}}),t)try{await t(...a)}catch(d){return b.error(N.BEFORE_SEND_TRANSACTION_ERROR,{error:d,tags:Se(d)}),!1}return this.logChainId({message:N.CHECK_CHAIN_ID_BEFORE_SEND_TRANSACTION,fromChainId:u.chainId,saveOrderChainId:i.chainId,orderId:o}),await this.doubleCheckChainId({saveOrderChainId:i.chainId,orderId:o})?this.sendTransactionEnhance(...a).then(({result:d,nonce:m})=>{if(!fn(d))throw new Error(`hash format is invalid: ${d}`);return this.txInfo={...r,txHash:d},K.BigNumber(m).isNaN()?(this.updateTxHash({orderId:o,transactionHash:d}),s&&this.getTransaction(d,this.fromToStore.from.chainId).then(_=>{b.info(N.UPDATE_NONCE,{nonce:_.nonce,tags:{orderId:o}}),this.updateTxHash({orderId:o,transactionHash:d,nonce:_.nonce})}).catch(_=>{b.error(N.UPDATE_NONCE_FAIL,{error:_,tags:Se(_)})})):this.updateTxHash({orderId:o,transactionHash:d,nonce:m}),this.afterTransaction(o,{txHash:d,chainId:i.chainId,txType:"SWAP"}),this.logChainId({message:N.CHECK_CHAIN_ID_AFTER_SEND_TRANSACTION,fromChainId:u.chainId,saveOrderChainId:i.chainId,orderId:o}),!0}):!1}afterTransaction(e,t){this.setWalletConfirm(!0),this.autoShowDialog&&this.showRecentTransactionModal(e),Mr.emit(Br.TXHASH,{status:0,data:U(this.txInfo),message:Nr("Transaction hash has been generated")}),this.widgetSubmitTxEvent(t)}get computedQuote(){return this.quoteStore.quote}checkRepeatOrderDetail(e){e&&this.rootStore.recentTransactionStore.showModal(e)}async onSolanaSwap(e){let t=this.extendSolanaCalldata(e),[r,o]=await this.getSolanaCalldata(t);if(r){this.saveOrderError(r);return}b.info(N.SAVE_ORDER,{data:o?.data,tags:{orderId:o?.data.orderId}}),Vr({...ft(),order_id:o?.data.orderId,wallet_type:this.accountStore.walletConfig?.walletType}),await this.solanaTransaction(o.data,t)}async onClaim(e){let{getAddressByChainId:t}=this.rootStore.accountStore,r=t(e.toChainId),o=await this.fetchClaimCalldata(e,r);if(!o||!o.payload)return!1;let{payload:i}=o;return await this.doubleCheckChainId({saveOrderChainId:e.toChainId,orderId:e.orderId})?(this.walletConfirming=!0,b.info(N.CLAIM_PAYLOAD,{payload:i,tags:{orderId:e.orderId}}),this.sendTransactionEnhance(...i).then(({result:s,nonce:u})=>{if(this.walletConfirming=!1,!fn(s))throw new Error(`hash format is invalid: ${s}`);K.BigNumber(u).isNaN()?this.updateClaimOrder({mainOrderId:e.orderId,redeemTxHash:s}):this.updateClaimOrder({mainOrderId:e.orderId,redeemTxHash:s,nonce:u})}).catch(s=>{this.walletConfirming=!1,this.onWalletFail(s,e.orderId,!0)})):!1}};f();h();var ua=oo(["isWalletConfirm","isConfirmLoading","txInfo","confirmSwapVisible","walletConfirming"],["computedEstimateGasFee","computedCrossChainFromFee","computedQuote"]);var Dt=class extends xt{constructor(t){super(t);c(this,"sendTransactionEnhance",t=>{let{from:r}=this.rootStore?.fromToStore,{walletSendParams:o}=this.rootStore.walletContractStore;return this.rootStore.sendTransactionStore.sendTransaction(r.chainId,t,o).then(i=>To(r.chainId,i))});c(this,"showRecentTransactionModal",t=>{this.isConfirmLoading=!1,this.confirmSwapVisible=!1,b.stuff(`orderId: ${t}`),k.history.go(-1);let{advanceSetTypedValue:r}=this.rootStore?.fromToStore;r?.("")});c(this,"baseSaveOrderParams",()=>{let t=super.baseSaveOrderParams(),{walletMevControl:r}=this.rootStore.mevStore;return{...t,openMev:t.openMev||r}});c(this,"extendsGas",t=>{let r={...t},{gasInfo:o}=this.rootStore.walletContractStore,{gasLimitInfo:i,isGasLimitLoading:a,gasType:s,...u}=o;return r.extParams.gasType=s,{...r,gasInfo:u}});c(this,"extendEvmParams",t=>{let r=super.extendEvmParams(t),{activityId:o}=this.rootStore.walletContractStore,i=this.rootStore.quoteStore.quote?.bestRoute?.isEnableMev;o&&(r.extParams.activityId=o);let{computedIsMevOpen:a,mevInfo:s,walletMevControl:u}=this.rootStore.mevStore;return r.extParams.isMev=a||u,r.extParams.mevInfo=s,!a&&Number(i)===Bn.ON&&(r.extParams.isShowBlockSwapMevTooltip=!0),r});c(this,"onWalletFail",(t,r)=>{this.isConfirmLoading=!1,!t?.message?.includes(k.global?.HARDWALLETERROR)&&super.onWalletFail(t,r)});c(this,"checkRepeatOrderDetail",t=>{t&&k.history.push(`${Bt}/${t}`)});c(this,"checkUtxoBeforePublish",async t=>{let{utxoList:r}=t,{preDataForSendBtc:o}=this.rootStore.walletContractStore,{checkUtxoBeforePublish:i}=o;await i(r)});c(this,"onSwap",async()=>{this.isConfirmLoading=!0;let t=await k.checkMpcAccountIfNecessary();if(this.isConfirmLoading=!1,!t)return;let{computedIsOfflineType:r}=this.rootStore.quoteStore,{computedIsFromBtcCoin:o}=this.rootStore?.fromToStore;r?await this.rootStore.intentSwapStore?.onIntentSwap():await super.onSwap(o?this.checkUtxoBeforePublish:null)});c(this,"getSaveOrderMonitorData",()=>({...ft(),...this.rootStore.walletContractStore.computedMonitorGasType}));c(this,"onClaim",t=>{k.history.push(`${Pn}?orderId=${t.orderId}&source=orderDetail`)});xn(this,ua)}isOkxWallet(){return!0}getTransaction(){}walletErrorMessage(t){return t}};f();h();var _n=class{constructor(e){c(this,"sendTransactionParams",{});c(this,"waitingHandleOrderList",[]);c(this,"needIntercept",!1);c(this,"updateHistoryOrderList",e=>{let t=ue(),r=[],o=[],i=this.rootStore.recentTransactionStore;i.pendingOrders.forEach(a=>{let s=a;a.orderId===e&&(s={...a,status:A.PendingRedeeming}),r.push(s)}),!t&&i.history?.list?.forEach(a=>{let s=a;a.orderId===e&&(s={...a,status:A.PendingRedeeming}),o.push(s)}),i.setPendingOrders(r),!t&&i.setHistory({...i.history,list:o})});c(this,"sendTransactionEnhance",async({callData:e,chainId:t,redeemOrderIdPre:r,redeemOrderId:o,bizType:i},a=()=>{})=>{let s=ue(),u=`${r}:${o}`;if(!s&&this.setWaitingHandleList(u),this.needIntercept)return;let l;if(ue()){let d=this.rootStore.swapStore.extendsGas(e);l=this.sendTransactionStore.sendTransactionEnhance(t,d,this.rootStore?.walletContractStore?.walletSendParams)}else{if(!await this.rootStore.commonStore.connectAndSwitchNetwork(t))return;l=this.sendTransactionStore.sendTransactionEnhance(e)}l.then(({result:d,hash:m,nonce:_})=>{!s&&this.setWaitingHandleList(u,!0),this.sendTransactionStore.updateTxHash({orderId:o,transactionHash:s?m:d,bizType:i,nonce:_}),ao(a),this.updateHistoryOrderList(r),s||this.sendTransactionStore.getTransaction(d,t).then(T=>{b.info(N.UPDATE_NONCE,{nonce:T.nonce,tags:{orderId:o}}),this.sendTransactionStore.updateTxHash({orderId:o,transactionHash:d,nonce:T.nonce,bizType:i})}).catch(T=>{b.error(N.UPDATE_NONCE_FAIL,{error:T,transactionHash:d,tags:{orderId:o}})})}).catch(d=>{!s&&this.setWaitingHandleList(u,!0),b.error(N.REDEEM_ORDER_ERROR,{error:d,tags:{orderId:o}})})});c(this,"walletSendRedeem",()=>{this.sendTransactionEnhance(this.sendTransactionParams,()=>{k.history?.goBack()})});c(this,"facetOrderDetail",{});this.rootStore=e,this.sendTransactionStore=e.sendTransactionStore,Lt(this,{},{autoBind:!0})}setSendTransactionParams(e){this.sendTransactionParams=e}async launchFacetSwap(e){let t=ue(),{data:r}=this.rootStore.recentTransactionStore.detail,o=e?e.orderId:r?.orderId,i=e?e.chainId:r?.fromChainId,a=e?e.toTokenAddress:r?.toTokenAddress,s=e?e.fromTokenAddress:r?.fromTokenAddress,u={orderId:o,chainId:i,userWalletAddress:this.rootStore.accountStore.getAddressByChainId(i)};if(t&&e?.goOrderDetail){k.history?.push(`${Bt}/${o}`);return}let[l,d]=await B(G.post(zn,u));if(l){b.error(N.REDEEM_ORDER_CALL_DATA_ERROR,{error:l,tags:{orderId:o}}),Number(l?.code)===100002&&this.rootStore.recentTransactionStore.removePendingOrder(o),ne.error({title:l?.msg||E("swaptrade_top_notif_data_failed")});return}let{redeemSignatureVo:m,redeemDetailInfo:_,redeemOrderId:T,bizType:V}=d?.data||{},{unsignedTx:C,...F}=m||{},L={...F,extParams:{toTokenAddress:a,crossChain:0,tokenAddress:s,amount:_.fromTokenAmount,toChainId:i,...u}},be={callData:L,chainId:i,redeemOrderIdPre:o,redeemOrderId:T,bizType:V};if(this.setSendTransactionParams(be),b.info(N.REDEEM_ORDER,{callData:L,tags:{orderId:T}}),t){this.setFacetOrderDetail({..._}),this.rootStore.walletContractStore.setTransactionPayload(L),k.history?.push({pathname:Dn,search:`needUpdate=${Vn.off}&type=${Ln.REDEEM}`});return}await this.sendTransactionEnhance(be)}setWaitingHandleList(e,t=!1){this.waitingHandleOrderList.find(o=>o===e)?t?(this.waitingHandleOrderList=this.waitingHandleOrderList.filter(o=>o!==e),this.needIntercept=!1):(ne.warn({title:E("swaptrade_history_notification_desc_wallet_confirm")}),this.needIntercept=!0):(this.waitingHandleOrderList=[...this.waitingHandleOrderList,e],this.needIntercept=!1)}getFacetExploreUrl(e){let{data:t}=this.rootStore.recentTransactionStore.detail,r=[t?.fromChildOrderDetailVo?.exploreUrl,t?.relativeTransaction?.exploreUrl];return this.computedIsFacetTradeType&&r?.[e]||""}get computedIsFacetTradeType(){let{data:{specialOrderType:e}}=this.rootStore.recentTransactionStore.detail;return e===Io.FromIsEthChainFacetCoin}get computedShowFacetTip(){return this.rootStore.recentTransactionStore.detail.data.status===A.PendingCanRedeem}setFacetOrderDetail(e){this.facetOrderDetail=e}get computedFacetOrderToFromRate(){let{price:e}=this.facetOrderDetail;return e&&!Rr(e)&&e!=="-1"?oe(e):""}get computedFacetOrderFromToRate(){let{price:e}=this.facetOrderDetail;return e&&!Rr(e)&&e!=="-1"?oe(K.BigNumber("1").div(e).toString(10),{needBillionMillionUnit:!1}):""}get computedFacetOrderTokens(){let{fromToken:e,toToken:t,fromTokenAmount:r,toTokenAmount:o}=this.facetOrderDetail;return{fromToken:{...e,amount:r},toToken:{...t,amount:o}}}get computedFacetOrderMinimumReceived(){return this.facetOrderDetail.minimumReceived}get computedFacetTipParams(){let e=this.rootStore.recentTransactionStore.detail?.data;return{amount:oe(e?.fromChildOrderDetailVo?.toAmountOut,{needBillionMillionUnit:!1}),token:e?.fromChildOrderDetailVo?.toTokenSymbol}}},la=_n;f();h();De();var vn=class{constructor(e){c(this,"orderCheckContinue",async e=>{let[t,r]=await B(G.get(Yn,{params:e}));if(t)return ne.error({title:E("swaptrade_history_toast_setup_error"),duration:Pe}),!1;let o=O(r,"data"),i=String(o?.checkCode);return i===He.SUCCESS?!0:(i===He.SINGLE_ERROR||i===He.LIMIT_SINGLE_ERROR?ne.error({title:E("swaptrade_history_toast_chain_unsupported",{chain:o?.fromChainName}),duration:Pe}):i===He.CROSS_ERRORL||i===He.LIMIT_CROSS_ERRORL?ne.error({title:E("swaptrade_history_toast_both_unsupported",{fromChain:o?.fromChainName,toChain:o?.toChainName}),duration:Pe}):ne.error({title:E("swaptrade_history_toast_setup_error"),duration:Pe}),!1)});this.rootStore=e,Lt(this,{},{autoBind:!0})}},da=vn;var gr=class{constructor(){this.receiveAddressStore=new ca(this),this.commonStore=new uo(this),this.accountStore=new io(this),this.fromToStore=new It(this),this.swapStore=new Dt(this),this.facetStore=new la(this),this.recentTransactionStore=new Do(this),this.oneMoreOrderStore=new da(this),this.sendTransactionStore=new Eo(this)}};f();h();var Ce=D(X()),va=D(Ar());f();h();var Y=D(X());f();h();var W=D(X()),ce=D(Or());f();h();var gn=D(X()),fa=D(Or());var _c=({expireTime:n,absoluteContent:e})=>gn.default.createElement("div",{className:(0,fa.default)(w.expireTime,e&&w.absoluteExpireTime)},gn.default.createElement("div",{className:w.expireTimeContent},no(n*1e3,{hideZero:!0})||"--")),br=_c;var vc=n=>{let t=w.loader,r=o=>({icon:W.default.createElement(q.Circle,{size:q.SIZE.md,type:q.TYPE.neutral,loaderClassName:t,className:w.loaderWrap}),descClassName:(0,ce.default)(w.pendDescKey),descKey:o});switch(n){case A.Pending:return r("swaptrade_order_status_pending");case A.Succeed:return{icon:W.default.createElement(me,{className:(0,ce.default)("okds-success-circle",w.successIcon),size:24}),descKey:"swaptrade_order_status_succeed"};case A.PendingWithdrawn:return{icon:W.default.createElement(me,{className:(0,ce.default)("okx-defi-marketplace-clock"),size:24}),descKey:E("swaptrade_history_cell_tag_processing")};case A.PendingCanRedeem:return{icon:W.default.createElement(me,{className:(0,ce.default)("okds-success-circle",w.pendingFacet),size:24}),descKey:E("swaptrade_history_cell_tag_pending_withdrawal")};case A.PendingRedeeming:return r("swaptrade_history_cell_tag_withdrawing");case A.Failed:return{icon:W.default.createElement(me,{className:(0,ce.default)("okds-fail-circle",w.failIcon),size:24}),descKey:"swaptrade_orders_text_details_order_failed",descClassName:w.failDesc};case A.Canceling:return{icon:W.default.createElement(q.Circle,{size:q.SIZE.md,type:q.TYPE.neutral,loaderClassName:t,className:w.loaderWrap}),descKey:"swaptrade_placeorder_title_canceling"};case A.Canceled:return{icon:W.default.createElement(me,{className:(0,ce.default)("okds-fail-circle",w.cancelIcon),size:24}),descKey:"swaptrade_placeorder_title_transaction_canceled"};case A.ReadyToClaim:case A.ClaimFailed:return{icon:W.default.createElement(me,{size:24,className:(0,ce.default)("okx-defi-dex-ready-to-claim")}),descKey:"swaptrade_bridge_cell_tag_ready_to_claim"};case A.Claiming:return{icon:W.default.createElement(q.Circle,{size:q.SIZE.md,type:q.TYPE.neutral,loaderClassName:t,className:w.loaderWrap}),descKey:"swaptrade_bridge_header_claiming"};default:return{}}};function gc({order:n,className:e="",computedPendingTimingStatus:t,expireTime:r,showExpireTime:o}){let{status:i}=n,a=[A.Waiting,A.SpeedingUp].includes(i)?A.Pending:i,s=vc(a);return W.default.createElement("div",{className:w.headerStatusWrap},W.default.createElement("div",{className:(0,ce.default)(w.status,e)},W.default.createElement("span",{className:w.headerStatusIcon},s?.icon),W.default.createElement("div",{className:(0,ce.default)("font-700 font-18 content-primary",w.desc,s?.descClassName)},E(s?.descKey)||s?.descKey)),o&&a===A.Pending&&t===Gt.ESTIMATE&&W.default.createElement(br,{expireTime:r}))}var ha=gc;f();h();var bn=D(X()),pa=D(Or());var bc=({isLimit:n,order:e,computedPendingTimingStatus:t,expireTime:r,onBack:o=()=>{},showBackButton:i})=>{let{status:a}=e||{},s=[A.Waiting,A.SpeedingUp].includes(a)?A.Pending:a;return{renderTopLeft:()=>i||n?bn.default.createElement(me,{className:(0,pa.default)("okx-defi-dex-arrow-left",w.backIcon),size:24,onClick:o}):s===A.Pending&&t===Gt.ESTIMATE?bn.default.createElement(br,{expireTime:r,absoluteContent:!0}):null,closeIconClassName:w.closeIcon,topClassName:n?"":w.topWrapper}},ma=bc;f();h();var _a={"loader-wrap":"_loader-wrap_7hvh8_1",loaderWrap:"_loader-wrap_7hvh8_1"};var yc=({orderId:n,onClose:e,visible:t})=>{let{recentTransactionStore:r,swapStore:o}=Ft(),{showModal:i}=r,{onClaim:a}=o;(0,Y.useEffect)(()=>{t&&i(n,{tab:fe.SWAP})},[n,i,t]);let{computedOrderInfo:s,expireTime:u,computedPendingTimingStatus:l}=r||{},d=(0,Y.useMemo)(()=>s?Y.default.createElement(ha,{order:s,expireTime:u,computedPendingTimingStatus:l,showExpireTime:!1}):null,[s,u,l]),m=ma({isLimit:!1,order:s,computedPendingTimingStatus:l,expireTime:u,showBackButton:!1}),_=(0,Y.useMemo)(()=>{let{status:C,toSymbol:F}=s||{},L={onConfirm:()=>{xo({fromChainId:s.chainId,toChainId:s.toChainId,bridgeRouter:s?.bridgeName}),a(s),e?.()},confirmText:E("swaptrade_bridge_btn_claim_token",{token:F})};return[A.ReadyToClaim,A.ClaimFailed].includes(C)?{confirmBtnProps:{block:!0},...L}:C===A.Claiming?{confirmBtnProps:{block:!0,loading:!0,loadingText:L.confirmText},...L}:{}},[s,a,e]),T=(0,Y.useRef)(null),V=()=>T.current;return Y.default.createElement(wn.Action,{noContentPadding:!0,visible:t,onClose:e,title:d,...m,..._,scrollBoxRef:C=>{T.current=C}},Y.default.createElement(Bo,{fallbackComponent:Y.default.createElement(q.Circle,{size:q.SIZE.md,type:q.TYPE.neutral,className:_a.loaderWrap})},Y.default.createElement(Lo,{orderId:n,onClose:e,getScrollContainer:V})))},yn=Ke(yc);var Sc=({orderId:n,onClose:e,visible:t,showToast:r,currency:o,currentWallet:i,walletInfo:a,onBack:s=()=>{},t:u,dispatch:l})=>{let d=(0,va.useHistory)();(0,Ce.useEffect)(()=>{k.setRuntimeContext({history:d,toLocale:u,dispatch:l,walletInfo:a,onBack:s})},[u,d,l,a,s]);let{commonStore:m,accountStore:_,recentTransactionStore:T}=Ft();(0,Ce.useEffect)(()=>{m.setCurrentTab(fe.SWAP),m.getUserUnit(o)},[]);let V=T?.detail?.data?.fromChainId;(0,Ce.useEffect)(()=>{i&&_.setWalletConfig(i),V&&_.setFromChainId(V)},[V,_,i]);let{computedAccountWalletAddresses:C}=_;(0,Ce.useEffect)(()=>{let L;return C&&(L=ko(C)),()=>{C&&L?.()}},[C]),(0,Ce.useEffect)(()=>{let L=Ro({isPri:!0,needLogin:!0,subscribeParams:{channel:Vo.DEX_PUSH_ENGINE},onListenData:be=>{T.onSocket(be,r)},onListenError:()=>{T.onSocketError()}});return()=>{L()}},[C,T,r]);let{initialized:F}=Po();return F?Ce.default.createElement(yn,{orderId:n,visible:t,onClose:e}):null},ga=Ke(Sc);var ba=new gr,Ec=eo(ba),Tc=({orderId:n,onClose:e,visible:t,showToast:r=!1,localeData:o,currency:i,currentWallet:a,walletInfo:s,onBack:u,t:l,dispatch:d,walletGlobalData:m,..._})=>(k.mergeGlobalData(m),yr.default.createElement(Ec.Provider,{value:ba},yr.default.createElement(Zn,{localeData:o,isDev:!0,noRemoteData:!0,customRender:T=>T},yr.default.createElement(ga,{orderId:n,onClose:e,visible:t,showToast:r,currency:i,currentWallet:a,walletInfo:s,onBack:u,t:l,dispatch:d,..._})))),Sr=Tc;f();h();var we=D(X()),Sn=D(Ar()),ya=D(Ea());var Ac=({orderId:n,onClose:e,...t})=>{let r=document.createElement("div");document.body.appendChild(r);let o=(0,ya.createRoot)(r),i=()=>{o.unmount(),r.remove(),e&&e()},a=({currentId:u})=>{let[l,d]=(0,we.useState)(!0);return we.default.createElement(Sr,{visible:l,orderId:u,onClose:()=>{d(!1),setTimeout(()=>{i()},100)},...t})};return o.render(we.default.createElement(Sn.HashRouter,null,we.default.createElement(a,{currentId:n}))),{close:i,updateOrderId:u=>{o.render(we.default.createElement(Sn.HashRouter,null,we.default.createElement(a,{currentId:u})))}}},Sa=Ac;var Oc=Ie.default.lazy(()=>import("./Advanced-OLP3WL2W.js")),Nc=Ie.default.lazy(()=>import("./MemeMode-HZJAOYKG.js")),Cc=({...n})=>Ie.default.createElement(Pt.Switch,null,Ie.default.createElement(Pt.Route,{path:"/dex-swap/meme",render:()=>Ie.default.createElement(Nc,{...n})}),Ie.default.createElement(Pt.Route,{path:"/dex-swap",render:()=>Ie.default.createElement(Oc,{...n})}));var Km=Ke(Cc);export{cn as a,It as b,ca as c,vr as d,mn as e,Dt as f,la as g,da as h,yn as i,Sa as j,Km as k};
|
|
|
|
window.inOKXExtension = true;
|
|
window.inMiniApp = false;
|
|
window.ASSETS_BUILD_TYPE = "publish";
|
|
|
|
//# sourceMappingURL=chunk-EIXSS37E.js.map
|