1var e=Object.defineProperty,t=(t,i,r)=>((t,i,r)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r)(t,"symbol"!=typeof i?i+"":i,r);!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"btse@2f4cc265"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9c2b1a89-085e-4594-a35b-99526745459e",e._sentryDebugIdIdentifier="sentry-dbid-9c2b1a89-085e-4594-a35b-99526745459e")}catch(i){}}();import{d as i,i as r}from"./CbBRI3wD.js";import{ar as a,ak as n,a9 as o,am as s,aa as l,bE as u,a8 as c,aK as d,ae as p,ab as h,af as m,ad as g,bJ as f,aW as v,bi as y,aL as b,B as S,ag as C,ah as P,a7 as k,r as T,a6 as M,aE as L,aF as w,an as D,aq as O,b0 as I,as as x,ac as _,ai as A,aU as R,al as F,b6 as E,aN as B,a_ as z,aG as $,aT as N,aX as U,aM as H,bB as V,C as W,g as q,aY as G,aB as K,a5 as Q,v as j,i as Y,bL as Z,b1 as X,b2 as J,aH as ee,aZ as te,ce as ie,b7 as re,bC as ae,bD as ne,aI as oe,aC as se,aS as le,ap as ue,b5 as ce,m as de,n as pe,aD as he,cf as me,ao as ge,aP as fe,aO as ve,aV as ye,br as be,be as Se,cg as Ce,bh as Pe,aQ as ke,a$ as Te,bQ as Me,ch as Le,ci as we,bw as De,cj as Oe,ck as Ie,a2 as xe,aA as _e,cl as Ae,cm as Re,bK as Fe}from"./B-0vxubZ.js";import{j as Ee,aL as Be,b8 as ze,az as $e,c as Ne,aC as Ue,bP as He,g3 as Ve,bS as We,bR as qe,ch as Ge,gN as Ke,gO as Qe,lb as je,lc as Ye,e as Ze,x as Xe,ce as Je,k7 as et,iI as tt,N as it,iK as rt,fj as at,dY as nt,gl as ot,jg as st,ja as lt,j9 as ut,jh as ct,cc as dt,f_ as pt,cF as ht,p as mt,ld as gt,le as ft,kF as vt,lf as yt,lg as bt,lh as St,li as Ct,lj as Pt,lk as kt,jq as Tt,ll as Mt,lm as Lt,ln as wt,lo as Dt,aD as Ot,fa as It,lp as xt,bp as _t,bi as At,U as Rt,g5 as Ft,a$ as Et,dS as Bt,am as zt,cg as $t,cj as Nt,lq as Ut,hT as Ht,fW as Vt,aH as Wt,jX as qt,gj as Gt,lr as Kt,af as Qt,jb as jt,gP as Yt,ls as Zt,gB as Xt,a6 as Jt,cm as ei,bO as ti,cw as ii,cr as ri,R as ai,j3 as ni,_ as oi,lt as si,g4 as li,lu as ui,lv as ci,dz as di,l as pi,lw as hi,cD as mi,bD as gi,lx as fi,Y as vi,b$ as yi,ca as bi,c9 as Si,ly as Ci,a5 as Pi,aW as ki,aX as Ti,ai as Mi,c1 as Li,c3 as wi,bd as Di,a0 as Oi,lz as Ii,bN as xi,lA as _i,cv as Ai,cx as Ri,gC as Fi,c2 as Ei,s as Bi,gr as zi,V as $i,g$ as Ni,X as Ui,hU as Hi,bE as Vi,cB as Wi,lB as qi,t as Gi,lC as Ki,lD as Qi,j7 as ji,j8 as Yi,lE as Zi,lF as Xi,lG as Ji,lH as er,lI as tr,j4 as ir,j5 as rr,d0 as ar,j6 as nr,hQ as or,hP as sr,hO as lr,hL as ur,dd as cr,S as dr,bW as pr,b5 as hr,b4 as mr,b6 as gr,lJ as fr,dR as vr,B as yr,lK as br,lL as Sr,cn as Cr,cs as Pr,lM as kr,bY as Tr,cz as Mr,lN as Lr,lO as wr,lP as Dr,lQ as Or,aI as Ir,lR as xr,g1 as _r,lS as Ar,cA as Rr,bX as Fr,cE as Er,lT as Br,f5 as zr,gD as $r,P as Nr,lU as Ur,K as Hr,lV as Vr,a7 as Wr,lW as qr,fG as Gr,eE as Kr,eG as Qr,fF as jr,ep as Yr,e3 as Zr,e2 as Xr,iX as Jr,lX as ea,lY as ta,fX as ia,lZ as ra,l_ as aa,l$ as na,eH as oa,m0 as sa,m1 as la,m2 as ua,m3 as ca,m4 as da,m5 as pa,m6 as ha,ho as ma,m7 as ga,m8 as fa,hM as va,cV as ya,m9 as ba,aU as Sa,ma as Ca,mb as Pa,mc as ka,bK as Ta,md as Ma,me as La,mf as wa,cu as Da,aT as Oa,o as Ia,bU as xa,mg as _a,mh as Aa,cd as Ra,mi as Fa,eD as Ea,f1 as Ba,mj as za,cl as $a,kq as Na,bJ as Ua,bI as Ha,j0 as Va,r as Wa,a as qa,jK as Ga,k as Ka,mk as Qa,f9 as ja,hJ as Ya,e4 as Za,ml as Xa,h as Ja,mm as en,T as tn,aA as rn,mn as an,mo as nn,mp as on,mq as sn,mr as ln,ms as un,mt as cn,h4 as dn,a9 as pn,aj as hn,au as mn,mu as gn,mv as fn,gR as vn,gS as yn,dZ as bn,z as Sn,b_ as Cn,c7 as Pn,mw as kn,mx as Tn,dT as Mn,my as Ln,mz as wn,fL as Dn,mA as On,mB as In,hB as xn,fJ as _n,iQ as An,mC as Rn,mD as Fn,mE as En,mF as Bn,mG as zn}from"./fTPyrBIP.js";import{_ as $n}from"./SJUTAzMa.js";import{b as Nn,c as Un,I as Hn,u as Vn,T as Wn,d as qn,e as Gn,S as Kn,g as Qn,f as jn,h as Yn,i as Zn,j as Xn,k as Jn,l as eo,m as to,n as io,o as ro,p as ao,q as no,r as oo,s as so,t as lo,v as uo,w as co,x as po,y as ho,F as mo,z as go,A as fo,B as vo}from"./DjxVUbdV.js";import{y as yo,al as bo,am as So,an as Co,u as Po,ao as ko,ap as To,aq as Mo,ar as Lo,as as wo,a1 as Do,at as Oo,au as Io,av as xo,aw as _o,ax as Ao,ay as Ro,az as Fo,aA as Eo,aB as Bo,aC as zo,aD as $o,aE as No,aF as Uo,aG as Ho,aH as Vo,aI as Wo,aJ as qo,aK as Go,C as Ko,aL as Qo,aM as jo,a0 as Yo,aN as Zo,aO as Xo,aP as Jo,aQ as es,aR as ts,aS as is,aT as rs,aU as as,r as ns}from"../../app.DI3xhnWo.js";
1import{j as os,C as ss,b as ls}from"./B4GGByMv.js";import{e as us,I as cs}from"./BphGmIDb.js";import{I as ds}from"./GaR0Evd4.js";import{c as ps}from"./chunk-sentry.DKA24Cnk.js";import{u as hs}from"./HYjqCwQk.js";import ms from"./SmGL2nNO.js";import{I as gs}from"./DP00sckV.js";import{I as fs,f as vs}from"./C_JXYWer.js";import{b as ys}from"./DiwcCmib.js";import{g as bs}from"./CEBSnBgb.js";const Ss=["id"],Cs=["mask"];const Ps={name:"UnifiedWalletUpgradeNotification",components:{IconChevronRight:$e,IconClose:ze,IconColorRefresh:$n({name:"IconColorRefresh",components:{Icon:Ee},data:()=>({id:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"20",height:"17",viewBox:"0 0 20 17"},{default:s((()=>[l("mask",{id:u.id,style:{"mask-type":"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"17"},t[0]||(t[0]=[l("rect",{y:"0.5",width:"20",height:"16",fill:"#D9D9D9"},null,-1)]),8,Ss),l("g",{mask:`url(#${u.id})`},t[1]||(t[1]=[l("path",{d:"M7.95723 14.1583C8.42551 14.0085 8.87272 13.8048 9.29886 13.5472C9.72499 13.2896 10.1207 12.9782 10.486 12.613C11.2352 11.8637 11.7573 11.0138 12.0524 10.0632C12.3474 9.11256 12.42 8.15024 12.2701 7.17622H9.68519L14.1807 2.6807L18.6762 7.17621L16.0913 7.17622C16.1381 8.10341 16.0023 9.01657 15.6839 9.91567C15.3655 10.8148 14.8503 11.6202 14.1386 12.332C13.2863 13.1843 12.3146 13.7579 11.2235 14.0529C10.1324 14.348 9.04364 14.3831 7.95723 14.1583ZM0.694162 9.42397L3.27908 9.42397C3.22289 8.48741 3.35635 7.57191 3.67946 6.67749C4.00258 5.78307 4.52003 4.97997 5.23182 4.26818C6.08409 3.41591 7.05578 2.84226 8.14688 2.54724C9.23798 2.25222 10.3314 2.22178 11.4272 2.45593C10.9589 2.60578 10.5094 2.80714 10.0785 3.06001C9.64773 3.31288 9.24969 3.62195 8.88442 3.98721C8.13517 4.73646 7.61538 5.58874 7.32504 6.54403C7.03471 7.49933 6.95978 8.45931 7.10027 9.42397H9.68519L5.18967 13.9195L0.694162 9.42397Z",fill:"#31B5FF"},null,-1)]),8,Cs)])),_:1})}]])},props:{onHideNotification:{type:Function,default:()=>{}}},methods:{...u(["setShowUnifiedWalletUpgradeDialog"]),openUpgradeUnifiedWalletPopup(){this.setShowUnifiedWalletUpgradeDialog(!0)}}},ks={class:"unified-wallet-upgrade-notification"};const Ts=$n(Ps,[["render",function(e,t,i,r,s,u){const f=a("IconColorRefresh"),v=a("IconChevronRight"),y=a("IconClose");return o(),c("div",ks,[d(f,{class:"upgrade-icon"}),p(" "+m(e.$t("wallet.upgradeUnifiedWalletBanner.title"))+" ",1),e.isDesktop?(o(),c(g,{key:0},[p(" : "+m(e.$t("wallet.upgradeUnifiedWalletBanner.description")),1)],64)):h("",!0),l("div",{class:"upgrade-text-button",onClick:t[0]||(t[0]=(...e)=>u.openUpgradeUnifiedWalletPopup&&u.openUpgradeUnifiedWalletPopup(...e))},[p(m(e.$t("t.upgradeNow"))+" ",1),e.isDesktop?(o(),n(v,{key:0})):h("",!0)]),d(y,{class:"close-button",width:"12",height:"12",onClick:i.onHideNotification},null,8,["onClick"])])}],["__scopeId","data-v-d4a675ef"]]),Ms={name:"OrderBookGrouping",components:{IconMinus:ys,IconPlus:Ue},props:{isFutures:{type:Boolean,required:!0},marketSymbol:{type:String,required:!0}},data:()=>({defaultOrderBookGroupMap:We({0:.01,1:.05,2:.1,3:.5,4:1,5:5,6:10,7:50,8:100}),orderBookGroupMap:{}}),computed:{...b(["lang","userConfig"]),...b("futures",["currentMarketSymbol"]),...y(Nn,["groupingIndex"]),groupingValue(){return this.orderBookGroupMap[this.groupingIndex]},...y(qe,{spotExchangeInfo:"exchangeInfo",isSpot:"isSpot"}),sortedKeys(){return Object.keys(this.orderBookGroupMap).map(Number).sort(((e,t)=>e-t))},min(){return this.sortedKeys[0]??0},max(){return this.sortedKeys[this.sortedKeys.length-1]??0},grouping(){const e=this.orderBookGroupMap[this.groupingIndex]||0;return S(e).toFixed()},titleStyle(){return{"--title-font-size":"ja-JP"===this.lang?"10px":"12px"}}},watch:{groupingValue:{handler(e){this.updateGroupingDecimalPlaces(void 0!==e?S(e).dp():null)},immediate:!0},$route:{handler(){this.isSpot&&this.initial()},flush:"post"},spotExchangeInfo:{handler(){!this.isFutures&&this.initial()},flush:"post"},userConfig:{deep:!0,handler(e){var t;const i=null==(t=e[He.GROUPING_SETTING])?void 0:t[this.marketSymbol];void 0!==this.orderBookGroupMap[i]&&i!==this.groupingIndex&&this.updateGroupingIndex(i)}}
1,currentMarketSymbol:{handler(e){this.isFutures&&null!==e&&this.initial()},immediate:!0}},mounted(){this.isSpot&&this.initial()},methods:{...v(["updateUserConfigByKey"]),...f(Nn,["updateGroupingIndex","updateGroupingDecimalPlaces"]),onClick(e){const t=this.sortedKeys.indexOf(this.groupingIndex)+e;if(t<0||t>=this.sortedKeys.length)return;const i=this.sortedKeys[t];this.updateGroupingIndex(i),this.debounceUserConfigGroupSetting(i)},async initial(){const e=this.isFutures?await Ve.getGroupingMap(this.currentMarketSymbol):this.spotExchangeInfo.priceGroup||this.defaultOrderBookGroupMap;this.orderBookGroupMap=We(e),void 0===this.orderBookGroupMap[this.groupingIndex]&&this.updateGroupingIndex(this.min)},debounceUserConfigGroupSetting:Ne((function(e){const t=this.userConfig[He.GROUPING_SETTING];this.updateUserConfigByKey({key:He.GROUPING_SETTING,value:{...t,[this.marketSymbol]:e}})}),300)}},Ls={class:"order-book-grouping"};const ws=$n(Ms,[["render",function(e,t,i,r,n,s){const u=a("IconMinus"),p=a("IconPlus");return s.sortedKeys.length?(o(),c("div",{key:0,class:C(["order-book-grouping-container no-select",{"is-spot":!i.isFutures}]),style:P(s.titleStyle)},[l("div",{class:C(["grouping-button",{disabled:e.groupingIndex===s.min}]),onClick:t[0]||(t[0]=e=>s.onClick(-1))},[d(u,{class:"grouping-button-icon","aria-label":"icon decrease order book grouping"})],2),l("div",Ls,m(s.grouping),1),l("div",{class:C(["grouping-button",{disabled:e.groupingIndex===s.max}]),onClick:t[1]||(t[1]=e=>s.onClick(1))},[d(p,{class:"grouping-button-icon","aria-label":"icon increase order book grouping","stroke-width":"4"})],2)],6)):h("",!0)}],["__scopeId","data-v-ff670889"]]),Ds=$n({__name:"OrderBookQuote",props:{notFirstRender:{type:Boolean,required:!0},side:{type:String,required:!0},price:{type:[Number,String],required:!0},size:{type:[Number,String],required:!0},cumulativeTotal:{type:[Number,String],required:!0},highlight:{type:Boolean,default:!1},maxOrderSize:{type:Number,required:!0},showAnimation:{type:Boolean,required:!0},priceFilter:{type:[Number,Object],default:2},sizeFilter:{type:Number,default:2},isCumulativeHighlight:{type:Boolean,default:!1},isFutures:{type:Boolean,default:!1}},emits:["mouseover","mouseout"],setup(e){const t=e,i=k(),r=Ge(),a=T(!1),n=T(!1),s=T(!1),u=T(null),d=M((()=>i.getters.isArabic)),p=M((()=>{const e=Number(t.cumulativeTotal)/t.maxOrderSize*-100;return{transform:`translateX(${d.value?-e:e}%)`}})),h=M((()=>t.isFutures?f(t.size):t.size)),g=M((()=>t.isFutures?f(t.cumulativeTotal):t.cumulativeTotal));function f(e){return r.futuresOrderBookSizeType.id===Ke.CONTRACTS||r.futuresOrderBookSizeType.id===Ke.USD?e:Qe(e)}const v="ontouchstart"in window?"touchstart":"click";function y(e){return{[v]:()=>function(e){i.dispatch("futureOrderBookShortcut",{time:new Date,type:e,price:String(Number(t.price)),size:String(Number(h.value)),total:String(Number(g.value))})}(e)}}function b(){a.value=!1,n.value=!1,s.value=!1}return L((()=>{u.value=setTimeout(b,300)})),w((()=>{clearTimeout(u.value)})),D((()=>t.size),((e,t)=>{!function(e,t){clearTimeout(u.value),b(),u.value=setTimeout(b,300),e>t?n.value=!0:e<t&&(s.value=!0)}(Number(e),Number(t))})),D((()=>t.price),(()=>{a.value=!0})),D((()=>a.value),(e=>{e&&(u.value=setTimeout(b,300))})),(t,i)=>(o(),c("div",{class:C(["order-book-quote",[`${e.side}-quote`,{"is-new":e.showAnimation&&e.notFirstRender&&a.value,"cumulative-highlight":e.isCumulativeHighlight}]]),onMouseover:i[0]||(i[0]=e=>t.$emit("mouseover",e)),onMouseout:i[1]||(i[1]=e=>t.$emit("mouseout",e))},[l("div",O({class:"order-book-cell price-cell"},I(y("price"),!0)),m(t.$filters.formatNumber(e.price,e.priceFilter)),17),l("div",O({class:["order-book-cell size-cell",{"is-up":e.showAnimation&&n.value,"is-down":e.showAnimation&&s.value,highlight:e.highlight}]},I(y("size"),!0)),m(x(je)(h.value,e.sizeFilter)),17),l("div",O({class:["order-book-cell total-cell",{highlight:e.highlight}]},I(y("total"),!0)),m(x(je)(g.value,e.sizeFilter)),17),l("div",{class:C(["bar",`bar-chart-${e.side}`]),style:P(p.value)},null,6)],34))}},[["__scopeId","data-v-fb11b489"]]),Os={class:"border-box relative info"},Is={class:"info-content"},xs=["innerHTML"];const _s=$n({name:"OrderBookLabel",props:{title:String,text:{type:String,default:null},tooltip:{type:String,default:null},i18nTooltip:{type:String,default:null},i18nSymbols:{type:Object,default:function(){return{br:"<br>"}}}}},[["render",function(e,t,i,r,n,u){const h=a("ToolTip");return o(),c("div",Os,[d(h,{disable:!i.text||!(i.tooltip||i.i18nTooltip)},{content:s((()=>[l("span",Is,[p(m(i.text)+" ",1),_(e.$slots,"default",{},void 0,!0)])])),tooltip:s((()=>[l("span",{innerHTML:i.tooltip||e.$t(i.i18nTooltip,i.i18nSymbols)},null,8,xs)])),_:3},8,["disable"])])}],["__scopeId","data-v-4da86a45"]]),As={key:0},Rs={class:"price"},Fs={class:"price"},Es={key:0},Bs={class:"price"},zs={class:"price"},$s=$n(A({name:"OrderBookTooltip",__name:"OrderBookTooltip",props:{position:{default:()=>({})},avgPrice:{default:0},totalValue:{default:0},slippage:{default:""},spread:{default:""},currency:{default:"USD"},priceFilter:{default:2},priceCurrency:{},valueCurrency:{},type:{}},setup(e){const t={"last-price":{left:-10,top:4},buy:{left:7,top:6},sell:{left:7,top:27}},i=e,r=T(),a=M((()=>{const{left:e=0,top:r=0}=i.position,a=t[i.type];return{left:`${e+a.left}px`,top:r-a.top+"px"}}));return L((()=>{r.value&&document.body.append(r.value)})),w((()=>{var e;null==(e=r.value)||e.remove()})),(e,t)=>(o(),c("div",{ref_key:"root",ref:r,class:"order-book-tooltip",style:P(a.value)},["last-price"===e.type?(o(),c("p",As,[p(m(e.$t("orderBook.spread"))+": ",1),l("span",Rs,m(e.spread)+" bps",1)])):(o(),c(g,{key:1},[l("p",null,[p(m(e.$t("t.avgPrice"))+": ",1),l("span",Fs,m(e.$filters.formatNumber(e.avgPrice,e.priceFilter)),1),p(" "+m(e.priceCurrency),1)]),e.slippage?(o(),c("p",Es,[p(m(e.$t("orderBook.slippage"))+": ",1),l("span",Bs,m(e.slippage)+" bps",1)])):h("",!0),l("p",null,[p(m(e.$t("t.totalValue"))+": ",1),l("span",zs,m(e.$filters.formatNumber(e.totalValue,e.priceFilter)),1),p(" "+m(e.valueCurrency),1)])],64)),t[0]||(t[0]=l("div",{class:"triangle-wrapper"},[l("div",{class:"triangle-left"})],-1))],4))}}),[["__scopeId","data-v-f8b87d59"]]);const Ns=$n({name:"IconOrderbookAskAndBid",components:{Icon:Ee},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:i.width,height:i.height,viewBox:"0 0 16 16"},{default:s((()=>t[0]||(t[0]=[l("rect",{x:"1",y:"1",width:"6",height:"6",rx:"1",fill:"#FF5B5A"},null,-1),l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9 1C8.44772 1 8 1.44772 8 2C8 2.55228 8.44772 3 9 3H14C14.5523 3 15 2.55228 15 2C15 1.44772 14.5523 1 14 1H9ZM9 9C8.44772 9 8 9.44771 8 10C8 10.5523 8.44772 11 9 11H14C14.5523 11 15 10.5523 15 10C15 9.44771 14.5523 9 14 9H9ZM8 6C8 5.44772 8.44772 5 9 5H14C14.5523 5 15 5.44772 15 6C15 6.55228 14.5523 7 14 7H9C8.44772 7 8 6.55228 8 6ZM9 13C8.44772 13 8 13.4477 8 14C8 14.5523 8.44772 15 9 15H14C14.5523 15 15 14.5523 15 14C15 13.4477 14.5523 13 14 13H9Z",fill:"#B1BBC5"},null,-1),l("rect",{x:"1",y:"9",width:"6",height:"6",rx:"1",fill:"#00B15D"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]);const Us=$n({name:"IconOrderbookAskOnly",components:{Icon:Ee},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:i.width,height:i.height,viewBox:"0 0 16 16"},{default:s((()=>t[0]||(t[0]=[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9 1C8.44772 1 8 1.44772 8 2C8 2.55228 8.44772 3 9 3H14C14.5523 3 15 2.55228 15 2C15 1.44772 14.5523 1 14 1H9ZM9 9C8.44772 9 8 9.44771 8 10C8 10.5523 8.44772 11 9 11H14C14.5523 11 15 10.5523 15 10C15 9.44771 14.5523 9 14 9H9ZM8 6C8 5.44772 8.44772 5 9 5H14C14.5523 5 15 5.44772 15 6C15 6.55228 14.5523 7 14 7H9C8.44772 7 8 6.55228 8 6ZM9 13C8.44772 13 8 13.4477 8 14C8 14.5523 8.44772 15 9 15H14C14.5523 15 15 14.5523 15 14C15 13.4477 14.5523 13 14 13H9Z",fill:"#B1BBC5"},null,-1),l("rect",{x:"1",y:"1",width:"6",height:"14",rx:"1",fill:"#FF5B5A"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]);const Hs=$n({name:"IconOrderbookBidOnly",components:{Icon:Ee},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:i.width,height:i.height,viewBox:"0 0 16 16"},{default:s((()=>t[0]||(t[0]=[l("rect",{x:"1",y:"1",width:"6",height:"14",rx:"1",fill:"#00B15D"},null,-1),l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9 1C8.44772 1 8 1.44772 8 2C8 2.55228 8.44772 3 9 3H14C14.5523 3 15 2.55228 15 2C15 1.44772 14.5523 1 14 1H9ZM9 9C8.44772 9 8 9.44771 8 10C8 10.5523 8.44772 11 9 11H14C14.5523 11 15 10.5523 15 10C15 9.44771 14.5523 9 14 9H9ZM8 6C8 5.44772 8.44772 5 9 5H14C14.5523 5 15 5.44772 15 6C15 6.55228 14.5523 7 14 7H9C8.44772 7 8 6.55228 8 6ZM9 13C8.44772 13 8 13.4477 8 14C8 14.5523 8.44772 15 9 15H14C14.5523 15 15 14.5523 15 14C15 13.4477 14.5523 13 14 13H9Z",fill:"#B1BBC5"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]),Vs={name:"OrderBookTypeList",props:{orderBookType:{type:String,default:Ye.BOTH}},emits:["update:orderBookType"],computed:{orderbookTypeList(){return[{value:Ye.BOTH,icon:Ns,tooltip:this.$t("trading.orderbook.t
1ype.both.tooltip")},{value:Ye.BID,icon:Hs,tooltip:this.$t("trading.orderbook.type.ask.tooltip")},{value:Ye.ASK,icon:Us,tooltip:this.$t("trading.orderbook.type.bid.tooltip")}]}}},Ws={class:"order-book-type-list"};const qs=$n(Vs,[["render",function(e,t,i,r,l,u){const d=a("ToolTip");return o(),c("div",Ws,[(o(!0),c(g,null,R(u.orderbookTypeList,(t=>(o(),n(d,{key:t.value,tooltip:t.tooltip,placement:"top"},{content:s((()=>[(o(),n(F(t.icon),{class:C(["order-icon",{active:t.value===i.orderBookType}]),onClick:i=>e.$emit("update:orderBookType",t.value)},null,8,["class","onClick"]))])),_:2},1032,["tooltip"])))),128))])}],["__scopeId","data-v-72ea2f2d"]]),Gs={name:"QuoteSelectorOptionsBlock",components:{IconStar:yo},props:{quoteList:{type:Array,default:()=>[]},currentQuoteName:{type:String,default:()=>"USD"},handleOptionClick:{type:Function,default:()=>{}},favoriteCurrenciesList:{type:Array,default:()=>[]},updateFavoriteCurrenciesList:{type:Function,required:!0},hoveredQuoteCurrency:{type:String,default:""}},emits:["update:hoveredQuoteCurrency"],computed:{...b(["currencyMap","lang"]),...y(qe,["marketCurrency"])},methods:{getCurrencyName(e){return(this.currencyMap[e]||{}).displayName||""},isInFavorite(e){const t=this.getCurrencyName(e);return this.favoriteCurrenciesList.includes(t)},toggleFavorite(e){const t=[...this.favoriteCurrenciesList];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),this.updateFavoriteCurrenciesList(t)},toggleQuoteCurrency(e){this.hoveredQuoteCurrency&&this.$emit("update:hoveredQuoteCurrency",e)}}},Ks={class:"options-block-container"},Qs={class:"option-content"};const js=$n(Gs,[["render",function(e,t,i,r,u,p){const h=a("IconStar"),f=a("RouterLink");return o(),c("div",Ks,[l("div",{class:C(["options",{"no-options":0===i.quoteList.length}])},[(o(!0),c(g,null,R(i.quoteList,(t=>(o(),n(f,{key:t,to:{name:"tradingId",params:{lang:e.lang,id:`${e.marketCurrency}-${t}`}},class:C(["option",{active:t===i.currentQuoteName,desktop:e.isLargeSize}]),onMouseover:e=>p.toggleQuoteCurrency(t),onClick:e=>i.handleOptionClick(t)},{default:s((()=>
1[l("div",Qs,[d(h,{class:C(["icon-star",{"in-favorite":p.isInFavorite(t)}]),onClick:E((e=>p.toggleFavorite(p.getCurrencyName(t))),["stop"])},null,8,["class","onClick"]),l("span",null,m(p.getCurrencyName(t)),1)])])),_:2},1032,["to","class","onMouseover","onClick"])))),128))],2)])}],["__scopeId","data-v-84315434"]]),Ys={FAV:"fav",ALL:"all",STABLE:"stable",FIAT:"fiat",CRYPTO:"crypto"},Zs={name:"QuoteSelectorTopMenu",components:{IconChevronDown:Ze},props:{toggleSelection:{type:Function,required:!0},updateQuote:{type:Function,required:!0},isExpanded:{type:Boolean,default:!1},fiatList:{type:Array,default:()=>[]},stableList:{type:Array,default:()=>[]},cryptoList:{type:Array,default:()=>[]}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},data:()=>({userFiat:"USD"}),computed:{...b(["currencyMap","userConfig","lang"]),...y(qe,["marketCurrency","marketQuoteCurrency"]),displayMarketName(){return this.convertToDisplaySymbol(this.marketCurrency)},currencyName(){return(this.currencyMap[this.marketQuoteCurrency]||{}).displayName||""},defaultSelectedQuotes(){return{stable:["USDT","USDC","TUSD","PAX","USDP"],fiat:[this.userFiat],crypto:["BTC","ETH","LTC","XMR"]}},selectQuoteList(){const{stable:e,fiat:t,crypto:i}=this.defaultSelectedQuotes;return[this.getPriorityQuote(e,this.stableList,Ys.STABLE),this.getPriorityQuote(t,this.fiatList,Ys.FIAT),this.getPriorityQuote(i,this.cryptoList,Ys.CRYPTO)].filter((e=>e))}},async created(){const e=await Xe.informationFromIp(),{currency:t,currencySupported:i}=e.data;i&&this.fiatList.includes(t)&&(this.userFiat=t)},methods:{getPriorityQuote(e,t=[],i){const r=((this.userConfig[He.SPOT_USER_QUOTE_SELECTED]||{})[this.marketCurrency]||{})[i];if(t.includes(this.marketQuoteCurrency))return this.marketQuoteCurrency;
1if(t.includes(r))return r;for(let a=0;a<e.length;a++){const i=e[a];if(t.includes(i))return i}return t[0]},handleSelect(e){this.marketQuoteCurrency!==e?(this.updateQuote(e),this.toggleSelection(!1)):this.toggleSelection(!this.isExpanded)}}},Xs={class:"quote-selector-top-menu"},Js={class:"quote-wrap"},el={key:0};const tl=$n(Zs,[["render",function(e,t,i,r,u,p){const f=a("RouterLink"),v=a("IconChevronDown");return o(),c("div",Xs,[l("div",Js,[(o(!0),c(g,null,R(p.selectQuoteList,(t=>(o(),n(f,{key:t,to:{name:"tradingId",params:{lang:e.lang,id:`${e.marketCurrency}-${t}`}},class:C([{active:e.marketQuoteCurrency===t},"quote"]),onClick:e=>p.handleSelect(t)},{default:s((()=>[e.marketQuoteCurrency===t?(o(),c("span",el,m(`${p.displayMarketName} / `),1)):h("",!0),l("span",null,m(t),1)])),_:2},1032,["to","class","onClick"])))),128))]),l("div",{class:C(["action-wrap",{active:i.isExpanded}]),onClick:t[0]||(t[0]=e=>i.toggleSelection(!i.isExpanded))},[d(v,{class:C(["icon-chevron-down",{active:i.isExpanded}]),"aria-label":"chevron down"},null,8,["class"])],2)])}],["__scopeId","data-v-2e8113c5"]]);const il={class:"quote-selector-search"},rl={class:"search-input-wrapper"},al=["placeholder"],nl={key:1,class:"trigger-icon"},ol={class:"tootip"};const sl={name:"QuoteSelectorAction",components:{IconStar:yo,IconSearch:tt,QuoteSelectorFilterItem:$n({name:"QuoteSelectorFilterItem",props:{type:{type:String,required:!0},text:{type:String,required:!0},filter:{type:String,required:!0}},emits:["handleChangeFilter"],methods:{setFilter(){this.$emit("handleChangeFilter",this.type)}}},[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["quote-filter-item",{active:i.filter===i.type}]),onClick:t[0]||(t[0]=(...e)=>n.setFilter&&n.setFilter(...e))},[l("span",null,m(i.text),1)],2)}],["__scopeId","data-v-1513c6d1"]]),QuoteSelectorSearch:$n({name:"QuoteSelectorSearch",components:{IconSearch:tt,IconPlus:Ue,IconDelete:et},props:{toggleSearchMode:{type:Function,required:!0},selectFirstQuote:{type:Function,required:!0}},emits:["update:searchKey"],data:()=>({searchKey:""}),methods:{clearSearch(){this.searchKey="",this.$emit("update:searchKey","")},handleEnter(){this.selectFirstQuote(),this.clearSearch(),this.toggleSearchMode(!1)},handleClose(){this.clearSearch(),this.toggleSearchMode(!1)}},mounted(){this.$refs.search.focus()}},[["render",function(e,t,i,r,s,u){const p=a("IconSearch"),h=a("IconDelete"),g=a("IconPlus");return o(),c("div",il,[l("div",rl,[d(p,{class:"search-icon",fill:"currentColor"}),B(l("input",{ref:"search",type:"text","onUpdate:modelValue":t[0]||(t[0]=e=>s.searchKey=e),onInput:t[1]||(t[1]=t=>e.$emit("update:searchKey",t.target.value)),onKeyup:t[2]||(t[2]=$(((...e)=>u.handleEnter&&u.handleEnter(...e)),["enter"])),placeholder:e.$t("msg.search")},null,40,al),[[z,s.searchKey]]),s.searchKey?(o(),n(h,{key:0,class:"icon-delete",onClick:u.clearSearch},null,8,["onClick"])):(o(),c("div",nl,[t[3]||(t[3]=l("span",null,"/",-1)),l("div",ol,[l("span",null,m(e.$t("trading.triggerSearch")),1)])]))]),d(g,{"aria-label":"icon close",class:"icon-close",onClick:u.handleClose},null,8,["onClick"])])}],["__scopeId","data-v-1024f19f"]])},props:{toggleSelection:{type:Function,required:!0},isSearchMode:{type:Boolean,default:!1},filter:{type:String,required:!0},selectFirstQuote:{type:Function,required:!0},fiatList:{type:Array,default:()=>[]},stableList:{type:Array,default:()=>[]},cryptoList:{type:Array,default:()=>[]},favoriteList:{type:Array,default:()=>[]}},emits:["update:filter","update:isSearchMode"],data:()=>({filterType:Ys}),mounted(){bo.register(So.OPEN_QUOTE_SEARCH_PANEL,"keydown",this.openSearchPanel,(()=>this.toggleSelection(!1)))},unmounted(){bo.unRegister(So.OPEN_QUOTE_SEARCH_PANEL)},methods:{setFilter(e){this.$emit("update:filter",e)},toggleSearchMode(e=!1){this.$emit("update:isSearchMode",e)},openSearchPanel(e){"/"===e.key&&(e.preventDefault(),this.toggleSelection(!0),this.toggleSearchMode(!0),bo.events[So.OPEN_QUOTE_SEARCH_PANEL].active=!0,bo.revoke(So.MARKET_LIST_MENU))}}},ll={class:"quote-selector-action"},ul={key:0,class:"filter-wrap"},cl={class:"filter-items"};const dl={name:"QuoteSelector",components:{QuoteSelectorOptionsBlock:js,QuoteSelectorTopMenu:tl,QuoteSelectorAction:$n(sl,[["render",function(e,t,i,r,s,u){const p=a("IconStar"),m=a("QuoteSelectorFilterItem"),g=a("IconSearch"),f=a("QuoteSelectorSearch");return o(),c("div",ll,[i.isSearchMode?(o(),n(f,O({key:1},e.$attrs,{toggleSearchMode:u.toggleSearchMode,selectFirstQuote:i.selectFirstQuote}),null,16,["toggleSearchMode","selectFirstQuote"])):(o(),c("div",ul,[l("div",cl,[l("div",{class:C(["fav-icon-wrap",{active:i.filter===s.filterType.FAV}]),onClick:t[0]||(t[0]=e=>u.setFilter(s.filterType.FAV))}
1,[d(p,{class:"fav-icon"})],2),d(m,O(e.$attrs,{filter:i.filter,type:s.filterType.ALL,text:e.$t("t.all"),onHandleChangeFilter:u.setFilter}),null,16,["filter","type","text","onHandleChangeFilter"]),i.stableList.length?(o(),n(m,O({key:0},e.$attrs,{filter:i.filter,type:s.filterType.STABLE,text:e.$t("wallets.stablecoins"),onHandleChangeFilter:u.setFilter}),null,16,["filter","type","text","onHandleChangeFilter"])):h("",!0),i.fiatList.length?(o(),n(m,O({key:1},e.$attrs,{filter:i.filter,type:s.filterType.FIAT,text:e.$t("wallets.fiat"),onHandleChangeFilter:u.setFilter}),null,16,["filter","type","text","onHandleChangeFilter"])):h("",!0),i.cryptoList.length?(o(),n(m,O({key:2},e.$attrs,{filter:i.filter,type:s.filterType.CRYPTO,text:e.$t("wallets.crypto"),onHandleChangeFilter:u.setFilter}),null,16,["filter","type","text","onHandleChangeFilter"])):h("",!0)]),l("div",{class:"search-icon-wrap",onClick:t[1]||(t[1]=e=>u.toggleSearchMode(!i.isSearchMode))},[d(g,{class:"search-icon"})])]))])}],["__scopeId","data-v-94342ead"]]),IconNoData3:fs,NoDataAvailable:it},props:{containerHeight:{type:Number,default:0},moved:{type:Boolean,default:!1},resetMoved:{type:Function,default:()=>{}}},data:()=>({isExpanded:!1,isSearchMode:!1,searchKey:"",filter:Ys.ALL,favoriteCurrenciesList:[],userQuoteSelected:{}}),computed:{...b({lang:"lang",loginState:"loginState",currencyMap:"currencyMap",multiCurrencyDisplay:"multiCurrencyDisplay",userConfig:"userConfig"}),...y(qe,{spotMarketMap:"marketMap",marketCurrency:"marketCurrency",marketQuoteCurrency:"marketQuoteCurrency"}),currencyBlocks(){let e=[];switch(this.filter){case Ys.ALL:e=[this.stableOptionList,this.cryptoOptionList,this.fiatOptionList];break;case Ys.FAV:e=[this.favoriteList];break;case Ys.STABLE:e=[this.stableOptionList];break;case Ys.FIAT:e=[this.fiatOptionList];break;case Ys.CRYPTO:e=[this.cryptoOptionList]}return e.filter((e=>e.length>0))},currentMarketData(){return this.spotMarketMap[this.marketCurrency]}
1,quoteList(){const e=this.spotMarketMap[this.marketCurrency]||{};return e.availableQuotes?e.availableQuotes:[]},fiatList(){return this.quoteList.filter((({type:e})=>e===at.FIAT)).map((e=>e.shortName)).sort(rt())},cryptoList(){return this.quoteList.filter((({type:e,isStable:t})=>e===at.CRYPTO&&!t)).map((e=>e.shortName)).sort(rt())},stableList(){return this.quoteList.filter((({type:e,isStable:t})=>e===at.CRYPTO&&t)).map((e=>e.shortName))},fiatOptionList(){return this.fiatList.filter(this.searchFilterCallback()).sort(((e,t)=>"USD"===e?-1:e.toUpperCase().localeCompare(t.toUpperCase())))},cryptoOptionList(){return this.cryptoList.filter(this.searchFilterCallback())},stableOptionList(){return this.stableList.filter(this.searchFilterCallback())},favoriteList(){const e=this.quoteList.map((({shortName:e})=>e));return this.favoriteCurrenciesList.filter((t=>e.includes(t))).sort(rt())},blockWrapperMaxHeight(){const e=this.isMobile?74:134;return this.isMobile?400-e:this.containerHeight-e}},watch:{multiCurrencyDisplay:{handler(e){this.isExpanded=e}},currentMarketData:{handler(e,t){if(e&&t&&e.symbol===t.symbol&&e.displayQuote!==t.displayQuote){const t=`/${this.lang}/trading/${this.marketCurrency}-${e.displayQuote}`;this.$route.path!==t&&this.$router.push(t)}},deep:!0},isSearchMode(e){e&&(this.filter=Ys.ALL)},favoriteList(e){e.length||(this.filter=Ys.ALL)}},created(){window.addEventListener("click",this.closeSelection,!0)},beforeUnmount(){window.removeEventListener("click",this.closeSelection,!0),bo.unRegister(So.CLOSE_QUOTE_SEARCH_PANEL)},mounted(){this.favoriteCurrenciesList=this.userConfig[He.ORDER_BOOK_FAVORITE_CURRENCIES]||[],this.userQuoteSelected=this.userConfig[He.SPOT_USER_QUOTE_SELECTED]||{},bo.register(So.CLOSE_QUOTE_SEARCH_PANEL,"keydown",this.closeSelectionByKeydown)},methods:{...v(["initialMarketList","setMultiCurrencyDisplay","updateUserConfigByKey"]),toggleSelection(e=!1){this.moved?this.resetMoved():(this.isExpanded=e,this.isExpanded||(this.filter=Ys.ALL,this.isSearchMode=!1,this.searchKey=""),this.setMultiCurrencyDisplay(this.isExpanded))},closeSelection(e){this.$refs.quoteSelection.contains(e.target)||this.toggleSelection(!1)},closeSelectionByKeydown(e){"Escape"===e.key&&this.toggleSelection(!1)},handleOptionClick(e){this.toggleSelection(!1),this.updateQuote(e)},updateQuote(e){this.moved?this.resetMoved():(this.updateUserQuoteSelected(e),e!==this.marketCurrency&&this.marketQuoteCurrency)},updateFavoriteCurrenciesList(e){this.favoriteCurrenciesList=e,this.updateUserConfigByKey({key:He.ORDER_BOOK_FAVORITE_CURRENCIES,value:e})},updateUserQuoteSelected(e){var t,i;const r=JSON.parse(JSON.stringify(this.userQuoteSelected)),a=null==(t=this.currencyMap[e])?void 0:t.stableCoin,n=null==(i=this.currencyMap[e])?void 0:i.isFiat;let o=Ys.CRYPTO;n&&(o=Ys.FIAT),a&&(o=Ys.STABLE);const s=r[this.marketCurrency]||{};s[o]=e;const l={...r,[this.marketCurrency]:s};this.userQuoteSelected=l,this.updateUserConfigByKey({key:He.SPOT_USER_QUOTE_SELECTED,value:l})},searchFilterCallback(){const e=this.searchKey.toLowerCase();return t=>t.toLowerCase().includes(e)},selectFirstQuote(){const e=[...this.stableOptionList,...this.cryptoOptionList,...this.fiatOptionList][0];e&&this.handleOptionClick(e)}}},pl={ref:"quoteSelection",class:"quote-selector-container"},hl={ref:"optionsContainer",class:"options-container"};const ml=$n(dl,[["render",function(e,t,i,r,u,p){const f=a("QuoteSelectorTopMenu"),v=a("QuoteSelectorAction"),y=a("QuoteSelectorOptionsBlock"),b=a("IconNoData3"),S=a("NoDataAvailable");return o(),c("div",pl,[d(f,{toggleSelection:p.toggleSelection,updateQuote:p.updateQuote,isExpanded:u.isExpanded,fiatList:p.fiatList,stableList:p.stableList,cryptoList:p.cryptoList},null,8,["toggleSelection","updateQuote","isExpanded","fiatList","stableList","cryptoList"]),B(l("div",hl,[d(v,{searchKey:u.searchKey,"onUpdate:searchKey":t[0]||(t[0]=e=>u.searchKey=e),filter:u.filter,"onUpdate:filter":t[1]||(t[1]=e=>u.filter=e),isSearchMode:u.isSearchMode,"onUpdate:isSearchMode":t[2]||(t[2]=e=>u.isSearchMode=e),toggleSelection:p.toggleSelection,selectFirstQuote:p.selectFirstQuote,fiatList:p.fiatList,stableList:p.stableList,cryptoList:p.cryptoList,favoriteList:p.favoriteList},null,8,["searchKey","filter","isSearchMode","toggleSelection","selectFirstQuote","fiatList","stableList","cryptoList","favoriteList"]),l("div",{class:C(["selector-options-block-wrapper",{"no-data":0===p.currencyBlocks.length}]),style:P({maxHeight:`${p.blockWrapperMaxHeight}px`})},[(o(!0),c(g,null,R(p.currencyBlocks,((t,i)=>(o(),n(y,{key:i,quoteList:t,currentQuoteName:e.marketQuoteCurrency,handleOptionClick:p.handleOptionClick,favoriteCurrenciesList:u.favoriteCurrenciesList,updateFavoriteCurrenciesList:p.updateFavoriteCurrenciesList},null,8,["quoteList","currentQuoteName","handleOptionClick","favoriteCurrenciesList","updateFavoriteCurrenciesList"])))),128)),0===p.currencyBlocks.length?(o(),n(S,{key:0,class:"no-data-block"},{"no-data-icon":s((()=>[d(b,{class:"no-data-icon"})])),"empty-text":s((()=>[l("span",null,m(e.$t("t.noResult")),1)])),_:1})):h("",!0)],6)],512),[[N,u.isExpanded]])],512)}],["__scopeId","data-v-61a46535"]]);function gl(e,t){if(!t||null==e)return"";const i=S(e).abs().div(t).times(1e4);return i.isZero()?"0":i.dp(2,S.ROUND_UP).toString()}const fl=(e,t)=>
1gl(S(e).minus(t),t),{enableOrderBookLastSpreadTooltip:vl}=mt,yl={sm:4,xs:4,default:8},bl={sm:4,xs:4,default:10},Sl={name:"OrderBookCard",components:{OrderBookGrouping:ws,OrderBookQuote:Ds,OrderBookLabel:_s,LastPrice:Co,QuoteSelector:ml,OrderBookTooltip:$s,OrderBookTypeList:qs},props:{resizeTrigger:{type:[Boolean,Number],default:!1},boxFilled:{type:Boolean,default:!1},moved:{type:Boolean,default:!1},resetMoved:{type:Function,default:()=>{}},combine:{type:Boolean,default:!1}},setup:()=>({futuresSettingStore:Ge()}),data:()=>({FUTURES_BASE_CURRENCY:ht,orderBookMaxQuote:6,orderBookType:Ye.BOTH,notFirstRender:!1,orderBookGroupChange:!1,containerHeight:0,isLoading:!1,hoverRow:null,showMenu:!1,fallbackPriceChange:0,skipNextFallbackPriceChange:!1}),computed:{...b({currencyMap:"currencyMap",isMobileChartMode:"isMobileChartMode",futuresMarketMap:e=>e.futures.marketMap,futuresOpenOrderList:e=>e.futures.openOrderList,futuresLeaderOrderList:e=>e.futures.leaderOrderList,spotOpenOrderList:e=>e.spotWsData.orderPending}),...b("futures",{futuresMarkPriceMap:"futuresMarkPriceMap",futuresMarketDetailMap:"marketDetailMap",fixedCurrency:"fixedCurrency"}),...b("orderBook",{orderBookLastPrice:"lastPrice",orderBookLastPriceChange:"lastPriceChange"}),...y(pt,["isLeaderMode"]),...y(Po,["windowIsInActive"]),...U("futures",{isFutures:"isFutures",futuresMarketData:"marketData",currentSettleInCurrency:"currentSettleInCurrency"}),...y(qe,{isSpot:"isSpot",spotMarketQuoteCurrency:"marketQuoteCurrency",spotGetExchangeInfoBySymbol:"getExchangeInfoBySymbol",spotGetMarketSymbolFromBaseCurrency:"getMarketSymbolFromBaseCurrency"}),...y(dt,{spotIndexPrice:"currentMarketIndexPrice"}),...y(Nn,["orderBook","groupingIndex","groupingDecimalPlaces","midPrice","bestAskPrice","bestBidPrice"]),...y(Ge,["futuresOrderBookSizeType","futuresOrderBookSizeCurrency","futuresOrderBookSizeFilter"]),marketSymbol(){return this.$route.params.id},marketContractSize(){return this.futuresMarketDetailMap[this.marketSymbol]?this.futuresMarketDetailMap[this.marketSymbol].contractSize:0},quoteCurrency(){return(this.isFutures?this.fixedCurrency:this.spotMarketQuoteCurrency)||""},valueCurrency(){return this.isFutures?this.currentSettleInCurrency:this.quoteCurrency},marketPriceFilter(){return this.isFutures?(this.futuresMarketMap[this.orderBook.symbol]||{}).priceFilter:this.spotGetExchangeInfoBySymbol(this.orderBook.symbol).priceDecimal},priceFormat(){return{formatKey:this.groupingDecimalPlaces??this.marketPriceFilter,currency:this.quoteCurrency}},marketPriceFormat(){return{formatKey:this.marketPriceFilter,currency:this.quoteCurrency}},sizeFilter(){return this.isFutures?this.futuresOrderBookSizeFilter:this.spotGetExchangeInfoBySymbol(this.orderBook.symbol).sizeDecimal},hasNoQuotes(){return 0===this.sellQuote.length&&0===this.buyQuote.length},isLastPriceFallback(){return void 0===this.orderBookLastPrice},fallbackPrice(){return this.isFutures?this.midPrice:this.spotIndexPrice},lastPrice(){if(!this.hasNoQuotes)return this.isLastPriceFallback?this.fallbackPrice:this.orderBookLastPrice},lastPriceChange(){return this.hasNoQuotes?0:this.isLastPriceFallback?this.fallbackPriceChange:this.orderBookLastPriceChange},markPrice(){return this.futuresMarkPriceMap[this.orderBook.symbol]||0},maxOrderSize(){let e=(this.sellQuote[0]||{}).total||"",t=(this.buyQuote[this.buyQuote.length-1]||{}).total||"";return e=Number(e),t=Number(t),Math.max(0,e,t)},markGroupingQuote(){return 0!==this.groupingIndex},openOrderList(){return this.isFutures?this.isLeaderMode?this.futuresLeaderOrderList:this.futuresOpenOrderList:this.spotOpenOrderList},isSellQuoteHover(){return this.hoverRow&&"sell"===this.hoverRow.type},isBuyQuoteHover(){return this.hoverRow&&"buy"===this.hoverRow.type},sellQuote(){let e=this.orderBook.asks||[];this.isOrderBookBidAndAsk&&(e=e.slice(-this.orderBookMaxQuote));const t=this.isFutures?ot.SELL:st.SELL;if(e.length<=0)return[];let i=0;const r=this.openOrderData.sellOrder,a=[];for(let n=e.length-1;n>=0;n--){const o=e[n],s=Number(o.price);a.unshift({...o,highlight:this.markGroupingQuote?r.some((e=>(e=Number(e),i<e&&e<=s))):this.openOrderData.priceMap[t][s]}),i=s}return a},buyQuote(){let e=this.orderBook.bids||[];const t=this.isFutures?ot.BUY:st.BUY;if(e.length<=0)return[];let i=0;const r=this.openOrderData.buyOrder;return this.isOrderBookBidAndAsk&&(e=e.slice(0,this.orderBookMaxQuote)),e.map(((e,a)=>{const n=Number(e.price);let o;return o=this.markGroupingQuote?r.some((e=>(e=Number(e),(0===a||i>e)&&e>=n))):this.openOrderData.priceMap[t][n],i=n,{...e,highlight:o}}))},openOrderData(){const e=this.isFutures?ot.SELL:st.SELL,t=this.isFutures?ot.BUY:st.BUY,i=[],r=[],a={[e]:{},[t]:{}};for(let n=0;n<this.openOrderList.length;n++){const o=this.openOrderList[n];if((this.isFutures?lt(o.marketName):`${this.spotGetMarketSymbolFromBaseCurrency(o.crypto)}-${o.displayCurrency}`)!==this.orderBook.symbol)break;const s=this.isFutures?Number(o.price):Number(o.displayPrice),{triggerOrder:l,isTriggered:u,orderType:c,orderMode:d,triggered:p}=o,h=this.isFutures?ut.LIMIT:ct.LIMIT,m=this.isFutures?u:p,g=d===e,f=g?e:t;if(c!==h||l&&!m)continue;a[f][s]=!0;(g?i:r).push(s)}return{priceMap:a,sellOrder:i,buyOrder:r}},OrderBookTooltipData(){var e,t,i,r;if("last-price"===(null==(e=this.hoverRow)?void 0:e.type))return{spread:null==this.bestAskPrice||null==this.bestBidPrice?"":(t=this.bestAskPrice,i=this.bestBidPrice,r=this.midPrice,gl(S(t).minus(i),r)),avgPrice:0,totalValue:0,slippage:""};const{index:a,type:n}=this.hoverRow||{},o="sell"===n,s=o?this.sellQuote:this.buyQuote;if(void 0===a||!s[a])return{avgPrice:0,totalValue:0,slippage:""};const l=o?this.sellQuote.slice(a):this.buyQuote.slice(0,a+1),u=o?l[0].total:l[l.length-1].total,c=this.isFutures?this.marketContractSize:1;let d=S(0),p=S(0);l.forEach((({price:e,size:t})=>{const i=S(e).times(t);d=S(d).plus(i),p=S(p).plus(i.times(c))}));const h=Number(d.div(u));return{avgPrice:h,totalValue:this.isSpot||this.futuresOrderBookSizeType.id!==Ke.USD?Number(p):Number(u),slippage:fl(h,this.midPrice)}},isOrderBookBidAndAsk(){return this.orderBookType===Ye.BOTH},isOrderBookBidOnly(){return this.orderBookType===Ye.BID},isOrderBookAskOnly(){return this.orderBookType===Ye.ASK},unitOptions(){return[{id:Ke.CRYPTO,text:`${this.$t("t.total")}(${this.futuresMarketData.baseCurrency})`,value:this.futuresMarketData.baseCurrency},{id:Ke.USD,text:`${this.$t("t.total")}(${this.currentSettleInCurrency})`,value:this.currentSettleInCurrency},{id:Ke.CONTRACTS,text:`${this.$t("t.total")}(${this.$t("futuresMain.contracts")})`,value:this.$t("futuresMain.contracts")}]}},watch:{marketSymbol(){this.fallbackPriceChange=0,this.skipNextFallbackPriceChange=!0},orderBook(e,t){this.checkSymbolChange(e,t)},fallbackPrice(e,t){this.isLastPriceFallback&&(this.skipNextFallbackPriceChange?this.skipNextFallbackPriceChange=!1:this.fallbackPriceChange=S(e).comparedTo(t)||0)},isLastPriceFallback(e){e||(this.fallbackPriceChange=0)},groupingIndex(e,t){e!==t&&this.markOrderBookGroupingChange()},$mq(){this.debounceSetMaxQuote()},isFutures(){this.debounceSetMaxQuote()},isMobileChartMode(){this.debounceSetMaxQuote()},resizeTrigger(){this.resizeOrderBookLayout()},orderBookType(){this.resizeOrderBookLayout(),this.scrollSellQuoteListToBottom()}},mounted(){this.resizeOrderBookLayout(),this.resizeObserver=new ResizeObserver(this.resizeOrderBookLayout),this.resizeObserver.observe(this.$refs.quoteList)},created:function(){window.addEventListener("click",this.closeMenu)},beforeUnmount(){this.resizeObserver.unobserve(this.$refs.quoteList),window.removeEventListener("click",this.closeMenu)},methods:{resizeOrderBookLayout(){this.$nextTick((()=>{this.orderBookMaxQuote=this.getMaxQuoteNumber(),this.debounceGetContainerHeight()}))},debounceResizeOrderBookLayout:Ne((function(){this.resizeOrderBookLayout()}),100),markOrderBookGroupingChange(){this.orderBookGroupChange=!0},setFirstRender(e,t){this.notFirstRender=e===t&&void 0!==t},throttleSetFirstRender:nt((function(e,t){this.setFirstRender(e,t)}),200),checkSymbolChange(e,t){e.symbol!==t.symbol||this.orderBookGroupChange?(this.setFirstRender(e.symbol,t.symbol),this.orderBookGroupChange=!1,this.scrollSellQuoteListToBottom()):JSON.stringify(e)!==JSON.stringify(t)&&this.throttleSetFirstRender(e.symbol,t.symbol)},getMaxQuoteNumber(){const e=this.$refs.quoteList;if(!e||this.isMobile&&!this.isMobileChartMode){const e=this.isFutures?yl:bl;return e[this.$mq]?e[this.$mq]:e.default}const t=e.getBoundingClientRect().height;return Math.floor((t-28)/21/2)},debounceSetMaxQuote:Ne((function(){this.orderBookMaxQuote=this.getMaxQuoteNumber()}),100),getContainerHeight(){return this.$refs.orderBookCard&&this.$refs.orderBookCard.clientHeight},debounceGetContainerHeight:Ne((function(){this.containerHeight=this.getContainerHeight()}),100),selectHoverRow(e,t){const i=this.$refs[`${t}QuoteRow${e}`][0].$el.getBoundingClientRect(),r=i.x+i.width,a=i.y;this.hoverRow={index:e,type:t,position:{left:r,top:a}}},selectLastPriceHover(){if(!vl)return;const e=this.$refs.lastPriceRow.$el.getBoundingClientRect();this.hoverRow={type:"last-price",position:{left:e.x+e.width,top:e.y}}},async scrollSellQuoteListToBottom(){if(this.isOrderBookAskOnly){await this.$nextTick();const e=this.$refs.sellQuoteList;e.scrollTop=e.scrollHeight}},toggleMenu(){this.isFutures&&(this.showMenu=!this.showMenu)},closeMenu(e){this.$refs.totalCell.$el.contains(e.target)||(this.showMenu=!1)},isCurrentUnit(e){return e.id===this.futuresOrderBookSizeType.id},selectUnit(e){this.futuresSettingStore.setOrderBookSizeType({id:e.id,lang:e.value})}}},Cl={class:"order-book-opration-wrapper"}
1,Pl={key:0,class:"futures-options-wrapper card-shell__header"},kl={key:0,class:"brand-card-title"},Tl={class:"order-book-column-header"},Ml={key:0,class:"size-unit"},Ll={key:0},wl={class:"size-unit"},Dl={key:0},Ol={class:"size-unit"},Il={class:"icon-arrow"},xl={class:"el-icon-arrow-up"},_l={class:"el-icon-arrow-down"},Al={key:1,class:"border-box select-items"},Rl=["onClick"],Fl={key:0,ref:"sellQuoteList",class:"quote-list"},El={key:1,class:"quote-list"};const Bl=$n(Sl,[["render",function(e,t,i,r,u,f){const v=a("OrderBookTypeList"),y=a("OrderBookGrouping"),b=a("QuoteSelector"),S=a("OrderBookLabel"),P=a("OrderBookQuote"),k=a("LastPrice"),T=a("OrderBookTooltip"),M=H("loading");return B((o(),c("div",{ref:"orderBookCard",class:C(["brand-card card-shell order-book-card",{"box-fill":i.boxFilled}])},[l("div",Cl,[e.isFutures?(o(),c("div",Pl,[i.combine?h("",!0):(o(),c("div",kl,m(e.$t("futuresMain.orderBook.title")),1)),d(v,{orderBookType:u.orderBookType,"onUpdate:orderBookType":t[0]||(t[0]=e=>u.orderBookType=e)},null,8,["orderBookType"]),d(y,{isFutures:!0,marketSymbol:f.marketSymbol},null,8,["marketSymbol"])])):h("",!0),e.isSpot?(o(),c("div",{key:1,class:C(["spot-header-wrapper card-shell__header",{mobile:e.isMobile}])},[d(b,{class:"quote-selector",containerHeight:u.containerHeight,moved:i.moved,resetMoved:i.resetMoved},null,8,["containerHeight","moved","resetMoved"]),l("div",{class:C(["grouping-wrapper",{mobile:e.isMobile}])},[d(v,{orderBookType:u.orderBookType,"onUpdate:orderBookType":t[1]||(t[1]=e=>u.orderBookType=e)},null,8,["orderBookType"]),d(y,{isFutures:!1,marketSymbol:f.marketSymbol},null,8,["marketSymbol"])],2)],2)):h("",!0)]),l("div",Tl,[d(S,{class:"order-book-cell price-cell"},{default:s((()=>[p(m(e.$t("t.price"))+" ",1),e.isFutures?(o(),c("span",Ml," ("+m(u.FUTURES_BASE_CURRENCY)+") ",1)):h("",!0)])),_:1}),d(S,{class:"order-book-cell size-cell"},{default:s((()=>[p(m(e.$t("t.size"))+" ",1),e.isFutures?(o(),c(g,{key:0},[!e.isMobile&&e.futuresOrderBookSizeCurrency.length>4?(o(),c("br",Ll)):h("",!0),l("span",wl,"("+m(e.futuresOrderBookSizeCurrency)+")",1)],64)):h("",!0)])),_:1}),d(S,{ref:"totalCell",class:C(["order-book-cell total-cell",{"cursor-pointer":e.isFutures}]),onClick:f.toggleMenu},{default:s((()=>[p(m(e.$t("t.total"))+" ",1),e.isFutures?(o(),c(g,{key:0},[e.futuresOrderBookSizeCurrency.length>4?(o(),c("br",Dl)):h("",!0),l("span",Ol,"("+m(e.futuresOrderBookSizeCurrency)+")",1),l("span",Il,[B(l("i",xl,null,512),[[N,u.showMenu]]),B(l("i",_l,null,512),[[N,!u.showMenu]])]),u.showMenu?(o(),c("div",Al,[(o(!0),c(g,null,R(f.unitOptions,(e=>(o(),c("div",{key:e.id,class:C(["item",{"is-current-item":f.isCurrentUnit(e)}]),onClick:t=>f.selectUnit(e)},m(e.text),11,Rl)))),128))])):h("",!0)],64)):h("",!0)])),_:1},8,["class","onClick"])]),l("div",{ref:"quoteList",class:C(["quote-list-wrap",{"is-both":f.isOrderBookBidAndAsk}])},[f.isOrderBookBidOnly?h("",!0):(o(),c("div",Fl,[t[5]||(t[5]=l("div",{class:"empty-fill-box"},null,-1)),(o(!0),c(g,null,R(f.sellQuote,((i,r)=>(o(),n(P,{ref_for:!0,ref:`sellQuoteRow${r}`,key:`sell-${r}`,notFirstRender:u.notFirstRender,side:"sell",price:i.price,size:i.size,cumulativeTotal:i.total,highlight:i.highlight,maxOrderSize:f.maxOrderSize,showAnimation:!e.windowIsInActive&&!u.hoverRow,priceFilter:f.priceFormat,sizeFilter:f.sizeFilter,isCumulativeHighlight:f.isSellQuoteHover&&r>u.hoverRow.index,isFutures:e.isFutures,onMouseover:e=>f.selectHoverRow(r,"sell"),onMouseout:t[2]||(t[2]=e=>u.hoverRow=null)},null,8,["notFirstRender","price","size","cumulativeTotal","highlight","maxOrderSize","showAnimation","priceFilter","sizeFilter","isCumulativeHighlight","isFutures","onMouseover"])))),128))],512)),d(k,{ref:"lastPriceRow",class:"last-price-wrap",lastPrice:f.lastPrice,markPrice:f.markPrice,lastPriceChange:f.lastPriceChange,priceFilter:f.marketPriceFormat,isFutures:e.isFutures,onMouseover:f.selectLastPriceHover,onMouseout:t[3]||(t[3]=e=>u.hoverRow=null)},null,8,["lastPrice","markPrice","lastPriceChange","priceFilter","isFutures","onMouseover"]),f.isOrderBookAskOnly?h("",!0):(o(),c("div",El,[(o(!0),c(g,null,R(f.buyQuote,((i,r)=>(o(),n(P,{ref_for:!0,ref:`buyQuoteRow${r}`,key:`buy-${r}`,notFirstRender:u.notFirstRender,side:"buy",price:i.price,size:i.size,cumulativeTotal:i.total,highlight:i.highlight,maxOrderSize:f.maxOrderSize,showAnimation:!e.windowIsInActive&&!u.hoverRow,priceFilter:f.priceFormat,sizeFilter:f.sizeFilter,isCumulativeHighlight:f.isBuyQuoteHover&&r<u.hoverRow.index,isFutures:e.isFutures,onMouseover:e=>f.selectHoverRow(r,"buy"),onMouseleave:t[4]||(t[4]=e=>u.hoverRow=null)},null,8,["notFirstRender","price","size","cumulativeTotal","highlight","maxOrderSize","showAnimation","priceFilter","sizeFilter","isCumulativeHighlight","isFutures","onMouseover"])))),128)),t[6]||(t[6]=l("div",{class:"empty-fill-box"},null,-1))]))],2),u.hoverRow&&!e.isMobile?(o(),n(T,{key:0,position:u.hoverRow.position,avgPrice:f.OrderBookTooltipData.avgPrice,totalValue:f.OrderBookTooltipData.totalValue,slippage:f.OrderBookTooltipData.slippage,spread:f.OrderBookTooltipData.spread,priceFilter:f.marketPriceFormat,priceCurrency:f.quoteCurrency,valueCurrency:f.quoteCurrency,type:u.hoverRow.type},null,8,["position","avgPrice","totalValue","slippage","spread","priceFilter","priceCurrency","valueCurrency","type"])):h("",!0)],2)),[[M,u.isLoading]])}],["__scopeId","data-v-fb917e35"]]),zl={name:"RecentTradeHistory",props:{history:{type:Object,required:!0},priceFormat:{type:[Number,Object],default:0},sizeFilter:{type:[Number,String],default:0},isFutures:{type:Boolean,default:!1}},methods:{convertContractToCurrentTypeUnit:gt,formatBigNumber:je}},$l={class:"size-cell align-right"},Nl={class:"type-cell align-left"},Ul=["title"];const Hl={name:"RecentTradesCard",components:{RecentTradeHistory:$n(zl,[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["recent-trade-history",{"flash-price-up":1===i.history.newest&&1===i.history.gain,"flash-price-down":1===i.history.newest&&-1===i.history.gain}])},[l("div",{class:C(["price-cell align-left",{"is-down":-1===i.history.gain}])},m(e.$filters.formatNumber(i.history.price,i.priceFormat)),3),l("div",$l,m(i.isFutures?n.formatBigNumber(n.convertContractToCurrentTypeUnit(i.history.amount,i.history.price),i.sizeFilter):n.formatBigNumber(i.history.amount,i.sizeFilter)),1),l("div",Nl,m(e.$t("B"===i.history.orderMode?"t.buy":"t.sell")),1),l("div",{class:"time-cell align-right",title:e.$filters.formatDate(i.history.transactionUnixtime)},m(e.$filters.formatDate(i.history.transactionUnixtime,"HH:mm:ss")),9,Ul)],2)}],["__scopeId","data-v-0c71a9ae"]])},props:{listHeight:{type:String,default:void 0},boxFilled:{type:Boolean,default:!1},combine:{type:Boolean,default:!1}},data:()=>({isLoading:!0}),computed:{...b({spotWsData:"spotWsData",futuresMarketMap:e=>e.futures.marketMap}),...b("futures",{futuresFixedCurrency:"fixedCurrency"}),...U("futures",{isFutures:"isFutures",futuresMarketData:"marketData"}
1),...y(qe,{spotExchangeInfo:"exchangeInfo",spotMarketSymbol:"marketSymbol",currentSpotMarketBaseCurrency:"currentSpotMarketBaseCurrency",spotMarketQuoteCurrency:"marketQuoteCurrency"}),...y(Ge,["sizeFilterPhase2","futuresSizeCurrency2"]),...y(ft,{futuresRecentTradeHistoryList:"recentTradeHistoryList"}),moreListStyle(){return this.listHeight?{height:this.listHeight}:null},recentTradeHistoryList(){return(this.isFutures?this.futuresRecentTradeHistoryList:this.spotWsData.tradeHistory)||[]},futuresMarketSymbol(){return(this.futuresRecentTradeHistoryList[0]||{}).symbol||this.futuresMarketData.symbol},quoteCurrency(){return this.isFutures?this.futuresFixedCurrency:this.spotMarketQuoteCurrency},priceFormat(){return{formatKey:this.isFutures?(this.futuresMarketMap[this.futuresMarketSymbol]||{}).priceFilter:this.spotExchangeInfo.priceDecimal,currency:this.quoteCurrency}},sizeFilter(){return this.isFutures?this.sizeFilterPhase2:this.spotExchangeInfo.sizeDecimal},isLargeLayout(){return 8===this.priceFormat.formatKey}},watch:{"$route.params.id"(){this.isLoading=!0},recentTradeHistoryList(){if(!this.isLoading)return;let e="",t="";const i=this.recentTradeHistoryList[0]||{};this.isFutures?(e=this.$route.params.id,t=i.symbol):(e=this.currentSpotMarketBaseCurrency,t=i.base),t!==e&&0!==this.recentTradeHistoryList.length||(this.isLoading=!1)}},methods:{getHistoryKey(e,t){return this.isFutures?`${t.marketName}-${e}`:`${this.spotMarketSymbol}-${e}`}}}
1,Vl={key:0,class:"brand-card-header card-shell__header divider"},Wl={class:"brand-card-title"},ql={class:"recent-trades-list-header"},Gl={class:"price-cell align-left"},Kl={class:"size-cell align-right"},Ql={key:0},jl={class:"size-unit"},Yl={class:"type-cell align-left"},Zl={class:"time-cell align-right"},Xl={class:"history"};const Jl=$n(Hl,[["render",function(e,t,i,r,s,u){const d=a("RecentTradeHistory"),f=H("loading");return B((o(),c("div",{class:C(["brand-card card-shell recent-trades-card",{"box-fill":i.boxFilled,"large-layout":u.isLargeLayout}])},[i.combine?h("",!0):(o(),c("div",Vl,[l("div",Wl,m(e.$t("futuresMain.recentTrades.title")),1)])),l("div",{class:"recent-trades-list",style:P(u.moreListStyle)},[l("div",ql,[l("div",Gl,m(e.$t("t.price")),1),l("div",Kl,[p(m(e.$t("t.size"))+" ",1),e.isFutures?(o(),c(g,{key:0},[!e.isMobile&&e.futuresSizeCurrency2.length>4?(o(),c("br",Ql)):h("",!0),l("span",jl,"("+m(e.futuresSizeCurrency2)+")",1)],64)):h("",!0)]),l("div",Yl,m(e.$t("t.type")),1),l("div",Zl,m(e.$t("t.time")),1)]),l("div",Xl,[(o(!0),c(g,null,R(u.recentTradeHistoryList,((t,i)=>(o(),n(d,{key:u.getHistoryKey(i,t),history:t,priceFormat:u.priceFormat,sizeFilter:u.sizeFilter,isFutures:e.isFutures},null,8,["history","priceFormat","sizeFilter","isFutures"])))),128))])],4)],2)),[[f,s.isLoading,"streamingLight"]])}],["__scopeId","data-v-d3fee162"]]),eu={name:"TypeTab",props:{value:{type:Number,required:!0},isEnableRecentTrades:{type:Boolean,default:!0}},emits:["update:value"],computed:{tabs(){return[this.$t("futuresMain.orderBook.title"),this.isEnableRecentTrades&&this.$t("futuresMain.recentTrades.title")].filter(Boolean)},isSupportGridBot:()=>!0},methods:{handleClick(e){this.$emit("update:value",e)}}},tu={class:"tabs-wrapper card-shell__header"},iu=["onClick"];const ru={name:"OrderBookRecentTradesCard",components:{OrderBookCard:Bl,RecentTradesCard:Jl,TypeTab:$n(eu,[["render",function(e,t,i,r,a,n){return o(),c("div",tu,[(o(!0),c(g,null,R(n.tabs,((t,r)=>(o(),c("div",{key:t,class:C(["tab",{active:r===i.value}]),onClick:e=>n.handleClick(r)},m(e.$t(t)),11,iu)))),128))])}],["__scopeId","data-v-d1ff93c0"]])},props:{resizeTrigger:{type:[String,Number],default:0},isEnableRecentTrades:{type:Boolean,default:!0}},data:()=>({tabIndex:0}),computed:{...b({separateRecentTrade:e=>e.userConfig.separateRecentTrade||!1})}},au={class:"container"},nu={class:"card-wrapper"};const ou=$n(ru,[["render",function(e,t,i,r,s,u){const d=a("TypeTab"),p=a("OrderBookCard"),m=a("RecentTradesCard");return o(),c("div",au,[i.isEnableRecentTrades&&!e.separateRecentTrade?(o(),n(d,{key:0,value:s.tabIndex,"onUpdate:value":t[0]||(t[0]=e=>s.tabIndex=e),isEnableRecentTrades:i.isEnableRecentTrades},null,8,["value","isEnableRecentTrades"])):h("",!0),l("div",nu,[0===s.tabIndex?(o(),n(p,{key:0,boxFilled:!0,resizeTrigger:i.resizeTrigger,combine:i.isEnableRecentTrades&&!e.separateRecentTrade},null,8,["resizeTrigger","combine"])):h("",!0),i.isEnableRecentTrades?B((o(),n(m,{key:1,boxFilled:!0,combine:!e.separateRecentTrade},null,8,["combine"])),[[N,1===s.tabIndex]]):h("",!0)])])}],["__scopeId","data-v-a8cf7b9e"]]);function su(e){return e}var lu=1e-6;function uu(e){return"translate("+e+",0)"}function cu(e){return"translate(0,"+e+")"}function du(e){return t=>+e(t)}function pu(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),i=>+e(i)+t}function hu(){return!this.__axis}function mu(e,t){var i=[],r=null,a=null,n=6,o=6,s=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,u=1===e||4===e?-1:1,c=4===e||2===e?"x":"y",d=1===e||3===e?uu:cu;function p(p){var h=null==r?t.ticks?t.ticks.apply(t,i):t.domain():r,m=null==a?t.tickFormat?t.tickFormat.apply(t,i):su:a,g=Math.max(n,0)+s,f=t.range(),v=+f[0]+l,y=+f[f.length-1]+l,b=(t.bandwidth?pu:du)(t.copy(),l),S=p.selection?p.selection():p,C=S.selectAll(".domain").data([null]),P=S.selectAll(".tick").data(h,t).order(),k=P.exit(),T=P.enter().append("g").attr("class","tick"),M=P.select("line"),L=P.select("text");C=C.merge(C.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),P=P.merge(T),M=M.merge(T.append("line").attr("stroke","currentColor").attr(c+"2",u*n)),L=L.merge
1(T.append("text").attr("fill","currentColor").attr(c,u*g).attr("dy",1===e?"0em":3===e?"0.71em":"0.32em")),p!==S&&(C=C.transition(p),P=P.transition(p),M=M.transition(p),L=L.transition(p),k=k.transition(p).attr("opacity",lu).attr("transform",(function(e){return isFinite(e=b(e))?d(e+l):this.getAttribute("transform")})),T.attr("opacity",lu).attr("transform",(function(e){var t=this.parentNode.__axis;return d((t&&isFinite(t=t(e))?t:b(e))+l)}))),k.remove(),C.attr("d",4===e||2===e?o?"M"+u*o+","+v+"H"+l+"V"+y+"H"+u*o:"M"+l+","+v+"V"+y:o?"M"+v+","+u*o+"V"+l+"H"+y+"V"+u*o:"M"+v+","+l+"H"+y),P.attr("opacity",1).attr("transform",(function(e){return d(b(e)+l)})),M.attr(c+"2",u*n),L.attr(c,u*g).text(m),S.filter(hu).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===e?"start":4===e?"end":"middle"),S.each((function(){this.__axis=b}))}return p.scale=function(e){return arguments.length?(t=e,p):t},p.ticks=function(){return i=Array.from(arguments),p},p.tickArguments=function(e){return arguments.length?(i=null==e?[]:Array.from(e),p):i.slice()},p.tickValues=function(e){return arguments.length?(r=null==e?null:Array.from(e),p):r&&r.slice()},p.tickFormat=function(e){return arguments.length?(a=e,p):a},p.tickSize=function(e){return arguments.length?(n=o=+e,p):n},p.tickSizeInner=function(e){return arguments.length?(n=+e,p):n},p.tickSizeOuter=function(e){return arguments.length?(o=+e,p):o},p.tickPadding=function(e){return arguments.length?(s=+e,p):s},p.offset=function(e){return arguments.length?(l=+e,p):l},p}function gu(e){return mu(2,e)}function fu(e){return mu(3,e)}function vu(e){return mu(4,e)}function yu(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function bu(e){return(bu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Su(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Cu(){return Cu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Cu.apply(this,arguments)}function Pu(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function ku(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return Pu(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Pu(e,t):void 0}}(e))||t){i&&(e=i);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,s=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw n}}}}function Tu(e,t){var i=[],r=[];return e.length&&function e(t,a){if(1===t.length)i.push(t[0]),r.push(t[0]);else{for(var n=Array(t.length-1),o=0;o<n.length;o++)0===o&&i.push(t[0]),o===n.length-1&&r.push(t[o+1]),n[o]=[(1-a)*t[o][0]+a*t[o+1][0],(1-a)*t[o][1]+a*t[o+1][1]];e(n,a)}}(e,t),{left:i,right:r.reverse()}}function Mu(e){var t={};return 4===e.length&&(t.x2=e[2][0],t.y2=e[2][1]),e.length>=3&&(t.x1=e[1][0],t.y1=e[1][1]),t.x=e[e.length-1][0],t.y=e[e.length-1][1],4===e.length?t.type="C":3===e.length?t.type="Q":t.type="L",t}function Lu(e,t,i){var r=[[e.x,e.y]];return null!=t.x1&&r.push([t.x1,t.y1]),null!=t.x2&&r.push([t.x2,t.y2]),r.push([t.x,t.y]),function(e,t){for(var i=[],r=e,a=1/(t=t||2),n=0;n<t-1;n++){var o=Tu(r,a/(1-a*n));i.push(o.left),r=o.right}return i.push(r),i}(r,i).map(Mu)}var wu=/[MLCSTQAHVZmlcstqahv]|-?[\d.e+-]+/g,Du={M:["x","y"],L:["x","y"],H:["x"],V:["y"],C:["x1","y1","x2","y2","x","y"],S:["x2","y2","x","y"],Q:["x1","y1","x","y"],T:["x","y"],A:["rx","ry","xAxisRotation","largeArcFlag","sweepFlag","x","y"],Z:[]};function Ou(e,t){for(var i=Array(e),r=0;r<e;r++)i[r]=t;return i}function Iu(e){return"".concat(e.type).concat(Du[e.type].map((function(t){return e[t]})).join(","))}function xu(e,t,i){var r=e.length-1,a=t.length-1,n=r/a,o=Ou(a).reduce((function(t,r,a){var o=Math.floor(n*a);if(i&&o<e.length-1&&i(e[o],e[o+1])){var s=n*a%1<.5;t[o]&&(s?o>0?o-=1:o<e.length-1&&(o+=1):o<e.length-1?o+=1:o>0&&(o-=1))}return t[o]=(t[o]||0)+1,t}),[]).reduce((function(t,i,r){if(r===e.length-1){var a=Ou(i,Cu({},e[e.length-1]));return"M"===a[0].type&&a.forEach((function(e){e.type="L"})),t.concat(a)}return t.concat(function(e,t,i){var r=[];if("L"===t.type||"Q"===t.type||"C"===t.type)r=r.concat(Lu(e,t,i));else{var a=Cu({},e);"M"===a.type&&(a.type="L"),(r=r.concat(Ou(i-1).map((function(){return a})))).push(t)}return r}(e[r],e[r+1],i))}),[]);return o.unshift(e[0]),o}function _u(e){for(var t,i,r=(e||"").match(wu)||[],a=[],n=0;n<r.length;++n)if(t=Du[r[n]]){i={type:r[n]};for(var o=0;o<t.length;++o)i[t[o]]=+r[n+o+1];n+=t.length,a.push(i)}return a}function Au(e,t,i){var r=null==e?[]:e.slice(),a=null==t?[]:t.slice(),n="object"===bu(i)?i:{excludeSegment:i,snapEndsToInput:!0},o=n.excludeSegment,s=n.snapEndsToInput;if(!r.length&&!a.length)return function(){return[]};var l=!(0!==r.length&&"Z"!==r[r.length-1].type||0!==a.length&&"Z"!==a[a.length-1].type);r.length>0&&"Z"===r[r.length-1].type&&r.pop(),a.length>0&&"Z"===a[a.length-1].type&&a.pop(),r.length?a.length||a.push(r[0]):r.push(a[0]),0!==Math.abs(a.length-r.length)&&(a.length>r.length?r=xu(r,a,o):a.length<r.length&&(a=xu(a,r,o)));var u=(r=r.map((function(e,t){return function(e,t){var i={x1:"x",y1:"y",x2:"x",y2:"y"},r=["xAxisRotation","largeArcFlag","sweepFlag"];if(e.type!==t.type&&"M"!==t.type.toUpperCase()){var a={};Object.keys(t).forEach((function(n){var o=t[n],s=e[n];void 0===s&&(r.includes(n)?s=o:(void 0===s&&i[n]&&(s=e[i[n]]),void 0===s&&(s=0))),a[n]=s})),a.type=t.type,e=a}return e}(e,a[t])}))).map((function(e){return function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
1t%2?yu(Object(i),!0).forEach((function(t){Su(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):yu(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},e)}));return l&&(u.push({type:"Z"}),r.push({type:"Z"})),function(e){if(1===e&&s)return null==t?[]:t;if(0===e)return r;for(var i=0;i<u.length;++i){var n,o=r[i],l=a[i],c=u[i],d=ku(Du[c.type]);try{for(d.s();!(n=d.n()).done;){var p=n.value;c[p]=(1-e)*o[p]+e*l[p],"largeArcFlag"!==p&&"sweepFlag"!==p||(c[p]=Math.round(c[p]))}}catch(h){d.e(h)}finally{d.f()}}return u}}Object.keys(Du).forEach((function(e){Du[e.toLowerCase()]=Du[e]}));const Ru={capture:!0,passive:!1};function Fu(e){e.preventDefault(),e.stopImmediatePropagation()}const Eu=e=>()=>e;function Bu(e,{sourceEvent:t,target:i,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function zu(e,t,i){this.k=e,this.x=t,this.y=i}zu.prototype={constructor:zu,scale:function(e){return 1===e?this:new zu(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new zu(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $u=new zu(1,0,0);function Nu(e){e.stopImmediatePropagation()}function Uu(e){e.preventDefault(),e.stopImmediatePropagation()}function Hu(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Vu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Wu(){return this.__zoom||$u}function qu(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Gu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ku(e,t,i){var r=e.invertX(t[0][0])-i[0][0],a=e.invertX(t[1][0])-i[1][0],n=e.invertY(t[0][1])-i[0][1],o=e.invertY(t[1][1])-i[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),o>n?(n+o)/2:Math.min(0,n)||Math.max(0,o))}function Qu(){var e,t,a,n=Hu,o=Vu,s=Ku,l=qu,u=Gu,c=[0,1/0],d=[[-1/0,-1/0],[1/0,1/0]],p=250,h=yt,m=i("start","zoom","end"),g=0,f=10;function v(e){e.property("__zoom",Wu).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",L).filter(u).on("touchstart.zoom",w).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new zu(t,e.x,e.y)}function b(e,t,i){var r=t[0]-i[0]*e.k,a=t[1]-i[1]*e.k;return r===e.x&&a===e.y?e:new zu(e.k,r,a)}function S(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function C(e,t,i,r){e.on("start.zoom",(function(){P(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){P(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,a=arguments,n=P(e,a).event(r),s=o.apply(e,a),l=null==i?S(s):"function"==typeof i?i.apply(e,a):i,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),c=e.__zoom,d="function"==typeof t?t.apply(e,a):t,p=h(c.invert(l).concat(u/c.k),d.invert(l).concat(u/d.k));return function(e){if(1===e)e=d;else{var t=p(e),i=u/t[2];e=new zu(i,l[0]-t[0]*i,l[1]-t[1]*i)}n.zoom(null,e)}}))}function P(e,t,i){return!i&&e.__zooming||new k(e,t)}function k(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,t),this.taps=0}function T(e,...t){if(n.apply(this,arguments)){var i=P(this,t).event(e),a=this.__zoom,o=Math.max(c[0],Math.min(c[1],a.k*Math.pow(2,l.apply(this,arguments)))),u=bt(e);if(i.wheel)i.mouse[0][0]===u[0]&&i.mouse[0][1]===u[1]||(i.mouse[1]=a.invert(i.mouse[0]=u)),clearTimeout(i.wheel);else{if(a.k===o)return;i.mouse=[u,a.invert(u)],r(this),i.start()}Uu(e),i.wheel=setTimeout((function(){i.wheel=null,i.end()}
vendor: 4,203 bytes, line 1
1),150),i.zoom("mouse",s(b(y(a,o),i.mouse[0],i.mouse[1]),i.extent,d))}}function M(e,...t){if(!a&&n.apply(this,arguments)){var i,o,l,u=e.currentTarget,c=P(this,t,!0).event(e),p=vt(e.view).on("mousemove.zoom",(function(e){if(Uu(e),!c.moved){var t=e.clientX-m,i=e.clientY-f;c.moved=t*t+i*i>g}c.event(e).zoom("mouse",s(b(c.that.__zoom,c.mouse[0]=bt(e,u),c.mouse[1]),c.extent,d))}),!0).on("mouseup.zoom",(function(e){p.on("mousemove.zoom mouseup.zoom",null),t=e.view,i=c.moved,r=t.document.documentElement,a=vt(t).on("dragstart.drag",null),i&&(a.on("click.drag",Fu,Ru),setTimeout((function(){a.on("click.drag",null)}),0)),"onselectstart"in r?a.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect),Uu(e),c.event(e).end();var t,i,r,a}),!0),h=bt(e,u),m=e.clientX,f=e.clientY;i=e.view,o=i.document.documentElement,l=vt(i).on("dragstart.drag",Fu,Ru),"onselectstart"in o?l.on("selectstart.drag",Fu,Ru):(o.__noselect=o.style.MozUserSelect,o.style.MozUserSelect="none"),Nu(e),c.mouse=[h,this.__zoom.invert(h)],r(this),c.start()}}function L(e,...t){if(n.apply(this,arguments)){var i=this.__zoom,r=bt(e.changedTouches?e.changedTouches[0]:e,this),a=i.invert(r),l=i.k*(e.shiftKey?.5:2),u=s(b(y(i,l),r,a),o.apply(this,t),d);Uu(e),p>0?vt(this).transition().duration(p).call(C,u,r,e):vt(this).call(v.transform,u,r,e)}}function w(i,...a){if(n.apply(this,arguments)){var o,s,l,u,c=i.touches,d=c.length,p=P(this,a,i.changedTouches.length===d).event(i);for(Nu(i),s=0;s<d;++s)l=c[s],u=[u=bt(l,this),this.__zoom.invert(u),l.identifier],p.touch0?p.touch1||p.touch0[2]===u[2]||(p.touch1=u,p.taps=0):(p.touch0=u,o=!0,p.taps=1+!!e);e&&(e=clearTimeout(e)),o&&(p.taps<2&&(t=u[0],e=setTimeout((function(){e=null}),500)),r(this),p.start())}}function D(e,...t){if(this.__zooming){var i,r,a,n,o=P(this,t).event(e),l=e.changedTouches,u=l.length;for(Uu(e),i=0;i<u;++i)r=l[i],a=bt(r,this),o.touch0&&o.touch0[2]===r.identifier?o.touch0[0]=a:o.touch1&&o.touch1[2]===r.identifier&&(o.touch1[0]=a);if(r=o.that.__zoom,o.touch1){var c=o.touch0[0],p=o.touch0[1],h=o.touch1[0],m=o.touch1[1],g=(g=h[0]-c[0])*g+(g=h[1]-c[1])*g,f=(f=m[0]-p[0])*f+(f=m[1]-p[1])*f;r=y(r,Math.sqrt(g/f)),a=[(c[0]+h[0])/2,(c[1]+h[1])/2],n=[(p[0]+m[0])/2,(p[1]+m[1])/2]}else{if(!o.touch0)return;a=o.touch0[0],n=o.touch0[1]}o.zoom("touch",s(b(r,a,n),o.extent,d))}}function O(e,...i){if(this.__zooming){var r,n,o=P(this,i).event(e),s=e.changedTouches,l=s.length;for(Nu(e),a&&clearTimeout(a),a=setTimeout((function(){a=null}),500),r=0;r<l;++r)n=s[r],o.touch0&&o.touch0[2]===n.identifier?delete o.touch0:o.touch1&&o.touch1[2]===n.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(n=bt(n,this),Math.hypot(t[0]-n[0],t[1]-n[1])<f)){var u=vt(this).on("dblclick.zoom");u&&u.apply(this,arguments)}}}return v.transform=function(e,t,i,r){var a=e.selection?e.selection():e;a.property("__zoom",Wu),e!==a?C(e,t,i,r):a.interrupt().each((function(){P(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},v.scaleBy=function(e,t,i,r){v.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),i,r)},v.scaleTo=function(e,t,i,r){v.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==i?S(e):"function"==typeof i?i.apply(this,arguments):i,n=r.invert(a),l="function"==typeof t?t.apply(this,arguments):t;return s(b(y(r,l),a,n),e,d)}),i,r)},v.translateBy=function(e,t,i,r){v.transform(e,(function(){return s(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof i?i.apply(this,arguments):i),o.apply(this,arguments),d)}),null,r)},v.translateTo=function(e,t,i,r,a){v.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,n=null==r?S(e):"function"==typeof r?r.apply(this,arguments):r;return s($u.translate(n[0],n[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof i?-i.apply(this,arguments):-i),e,d)}),r,a)},k.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit
1("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=vt(this.that).datum();m.call(e,this.that,new Bu(e,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:m}),t)}},v.wheelDelta=function(e){return arguments.length?(l="function"==typeof e?e:Eu(+e),v):l},v.filter=function(e){return arguments.length?(n="function"==typeof e?e:Eu(!!e),v):n},v.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Eu(!!e),v):u},v.extent=function(e){return arguments.length?(o="function"==typeof e?e:Eu([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),v):o},v.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],v):[c[0],c[1]]},v.translateExtent=function(e){return arguments.length?(d[0][0]=+e[0][0],d[1][0]=+e[1][0],d[0][1]=+e[0][1],d[1][1]=+e[1][1],v):[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},v.constrain=function(e){return arguments.length?(s=e,v):s},v.duration=function(e){return arguments.length?(p=+e,v):p},v.interpolate=function(e){return arguments.length?(h=e,v):h},v.on=function(){var e=m.on.apply(m,arguments);return e===m?v:e},v.clickDistance=function(e){return arguments.length?(g=(e=+e)*e,v):Math.sqrt(g)},v.tapDistance=function(e){return arguments.length?(f=+e,v):f},v}zu.prototype;let ju=!1,Yu=!1,Zu=!1,Xu=!1,Ju=!1,ec=!1,tc=!1,ic=!1,rc=!1,ac=!1,nc=!1,oc=!1,sc=!1,lc=!1,uc=!1,cc=!1,dc=!1,pc=!1;const hc="depth-chart-label-text",mc="depth-chart-text-label",gc="depth-chart-cross-line",fc="depth-chart-cross-line-dot",vc=St(((e,t)=>e.price-t.price)).right,yc=V(".3~s"),bc={id:"depthChart",ref:"depthChart",class:"depth-chart-container"};const Sc=$n({name:"DepthChartCard",components:{DepthChart:$n({name:"DepthChart",props:{width:{type:Number,required:!0},height:{type:Number,required:!0},buyQuote:{type:Array,required:!0},sellQuote:{type:Array,required:!0},xTicks:{type:Number,default:4},yTicks:{type:Number,default:2},maxScale:{type:Number,default:0},chartTickPadding:{type:Number,default:5},animationDuration:{type:Number,default:300},onScaleChange:{type:Function,default:()=>{}}},data:()=>({margin:10,adjustSizeTimer:!1,sizeCheckCounter:0,animation:!1,mouseX:0,isOnBuyPanel:!1,isOnSellPanel:!1,zoomTransformTimer:!1}),computed:{marginOffset(){return 4*this.margin},halfMarginOffset(){return 2*this.margin},orderBook(){return this.buyQuote.concat(this.sellQuote)},hasBuyQuote(){return this.buyQuote.length>0},hasSellQuote(){return this.sellQuote.length>0},sellQuotePriceMin(){return this.hasSellQuote?Tt(this.sellQuote[this.sellQuote.length-1].price||0):void 0},buyQuotePriceMax(){return this.hasBuyQuote?Tt(this.buyQuote[0].price||0):void 0},xMin(){return this.hasBuyQuote?Tt(this.buyQuote[this.buyQuote.length-1].price||0):this.sellQuotePriceMin},xMax(){return this.hasSellQuote?Tt(this.sellQuote[0].price||0):this.buyQuotePriceMax},yMax(){const e=this.hasBuyQuote?Tt(this.buyQuote[this.buyQuote.length-1].culmulativeTotal||0):0,t=this.hasSellQuote?Tt(this.sellQuote[0].culmulativeTotal||0):0;return Math.max(e,t)},meanPrice(){return Dt([this.buyQuotePriceMax,this.sellQuotePriceMin])},yTickStep(){return Math.ceil((this.yMax-0)/this.yTicks/this.yTicks)*this.yTicks},xMiddlePoint(){return(this.width-this.marginOffset)/2},buyX(){return wt().domain([this.xMin,this.meanPrice]).range([0,this.xMiddlePoint])},sellX(){return wt().domain([this.meanPrice,this.xMax]).range([this.xMiddlePoint,this.width-this.marginOffset])},y(){return wt().domain([0,this.yMax]).nice().range([this.height-this.halfMarginOffset,0])},buyLine(){return Lt().curve(Mt).x((e=>this.buyX(e.price))).y((e=>this.y(Tt(e.culmulativeTotal))))},sellLine(){return Lt().curve(kt).x((e=>this.sellX(e.price))).y((e=>this.y(Tt(e.culmulativeTotal))))},buyArea(){return Pt().curve(Mt).x((e=>this.buyX(e.price))).y0(this.y(0)).y1((e=>this.y(Tt(e.culmulativeTotal))))},sellArea(){return Pt().curve(kt).x((e=>this.sellX(e.price))).y0(this.y(0)).y1((e=>this.y(Tt(e.culmulativeTotal))))},zoom(){return Qu().scaleExtent([1,this.maxScale+1]).on("zoom",this.updateChart)}},watch:{width(){this.sizeCheckCounter=0,this.adjustSize()},height(){this.sizeCheckCounter=0,this.adjustSize()},orderBook(){this.animation?(Zu&&Zu.transition().duration(this.animationDuration).call(this._buyXAxis),Xu&&Xu.transition().duration(this.animationDuration).call(this._sellXAxis),Ju&&Ju.transition().duration(this.animationDuration).call(this._yAxis)):(Zu&&Zu.call(this._buyXAxis),Xu&&Xu.call(this._sellXAxis),Ju&&Ju.call(this._yAxis))},buyQuote(e){this.isOnBuyPanel&&this.setDotPosition(this.mouseX,!0),this.animation?(this.addTransition(tc,this.buyLine(e)),this.addTransition(rc,this.buyArea(e))):(tc&&tc.attr("d",this.buyLine(e)),rc&&rc.attr("d",this.buyArea(e)))},sellQuote(e){this.isOnSellPanel&&this.setDotPosition(this.mouseX,!1),this.animation?(this.addTransition(ic,this.sellLine(e)),this.addTransition(ac,this.sellArea(e))):(ic&&ic.attr("d",this.sellLine(e)),ac&&ac.attr("d",this.sellArea(e)))},maxScale(){pc&&pc.call(this.zoom)}},mounted(){setTimeout(this.initial,300)},methods:{setDeptchChartContainerAttribute(e){const t=Math.max(this.height,0);
1return e.attr("width",Math.max(this.width-this.margin,0)).attr("height",t).attr("viewBox",[-this.halfMarginOffset,-5,this.width,t])},initial(){ju=vt("#depthChart").append("svg"),this.setDeptchChartContainerAttribute(ju),ec=ju.append("line").attr("class","depth-chart-middle-point-line").attr("transform",`translate(${this.halfMarginOffset}, 0)`).attr("x1",this.xMiddlePoint).attr("y1",0).attr("x2",this.xMiddlePoint).attr("y2",this.height-this.halfMarginOffset),Yu=ju.append("g"),tc=Yu.append("path").attr("class","depth-chart-line buy-line").attr("transform",`translate(${this.halfMarginOffset+1}, 0)`).attr("d",this.buyLine(this.buyQuote)),ic=Yu.append("path").attr("class","depth-chart-line sell-line").attr("transform",`translate(${this.halfMarginOffset-1}, 0)`).attr("d",this.sellLine(this.sellQuote)),rc=Yu.append("path").attr("d",this.buyArea(this.buyQuote)).attr("fill","rgba(10, 179, 135, .2)").attr("transform",`translate(${this.halfMarginOffset}, 0)`),ac=Yu.append("path").attr("d",this.sellArea(this.sellQuote)).attr("fill","rgba(226, 30, 54, .2)").attr("transform",`translate(${this.halfMarginOffset}, 0)`),Zu=ju.append("g").call(this._buyXAxis),Xu=ju.append("g").call(this._sellXAxis),Ju=ju.append("g").call(this._yAxis);const e=ju.append("g");nc=e.append("rect").attr("rx",3),oc=e.append("text").attr("font-size",10).attr("text-anchor","middle").attr("class",hc);const t=ju.append("g");sc=t.append("rect").attr("rx",3),lc=t.append("text").attr("font-size",10).attr("text-anchor","middle").attr("class",hc),cc=ju.append("line").attr("class",gc).attr("transform",`translate(${this.halfMarginOffset}, 0)`).attr("stroke-dasharray","5, 3").attr("x1",0).attr("y1",0).attr("x2",this.width).attr("y2",0),dc=ju.append("line").attr("class",gc).attr("transform",`translate(${this.halfMarginOffset}, 0)`).attr("stroke-dasharray","5, 3").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",this.height-this.halfMarginOffset),uc=ju.append("g").attr("transform",`translate(${this.halfMarginOffset}, 0)`).append("circle").attr("class",fc).attr("r",4).style("opacity",0),pc=ju.append("rect").attr("transform",`translate(${this.halfMarginOffset-1}, 0)`).style("fill","none").style("pointer-events","all").attr("width",Math.max(this.width-this.marginOffset,0)).attr("height",Math.max(0,this.height-this.halfMarginOffset)).call(this.zoom).on("mousemove",this.setMouseDotIndicatorData).on("mouseenter",this.setMouseDotIndicatorData).on("mouseleave",this.hideMouseDotIndicator)},adjustSize(){clearTimeout(this.adjustSizeTimer),ju&&this.$refs.depthChart&&this.sizeCheckCounter<3&&(this.sizeCheckCounter=this.sizeCheckCounter+1,this.setDeptchChartContainerAttribute(ju),Zu.call(this._buyXAxis),Xu.call(this._sellXAxis),Ju.call(this._yAxis),ec.attr("x1",this.xMiddlePoint).attr("y1",0).attr("x2",this.xMiddlePoint).attr("y2",this.height-this.halfMarginOffset),tc.attr("d",this.buyLine(this.buyQuote)),ic.attr("d",this.sellLine(this.sellQuote)),rc.attr("d",this.buyArea(this.buyQuote)),ac.attr("d",this.sellArea(this.sellQuote)),pc.attr("width",this.width).attr("height",Math.max(0,this.height-this.halfMarginOffset)),cc.attr("x2",this.width),dc.attr("y2",this.height-this.halfMarginOffset),this.isOnBuyPanel&&this.setDotPosition(this.mouseX,!0),this.isOnSellPanel&&this.setDotPosition(this.mouseX,!1),this.adjustSizeTimer=setTimeout(this.adjustSize,2e3))},updateChart(e){this.animation=!0,clearTimeout(this.zoomTransformTimer),this.onScaleChange(Number(e.transform.k-1).toFixed()),this.zoomTransformTimer=setTimeout((()=>{this.animation=!1}),300)},_axisBottom(e){return fu(e).ticks(this.xTicks/2).tickSize(0).tickPadding(this.chartTickPadding)},_axisLeft(e){return vu(e).ticks(this.yTicks).tickValues(Ct(0,this.yMax+this.yTickStep,this.yTickStep)).tickSize(0).tickPadding(this.chartTickPadding).tickFormat(yc)},_buyXAxis(e){e.attr("transform",`translate(${this.halfMarginOffset}, ${this.height-this.halfMarginOffset})`).attr("class","depth-chart-axis").call(this._axisBottom(this.buyX))},_sellXAxis(e){e.attr("transform",`translate(${this.halfMarginOffset}, ${this.height-this.halfMarginOffset})`).attr("class","depth-chart-axis").call(this._axisBottom(this.sellX))},_yAxis(e){e.attr("transform",`translate(${this.halfMarginOffset}, 0)`).attr("class","depth-chart-axis").call(this._axisLeft(this.y))},addTransition(e,t){if(e)return e.transition().duration(this.animationDuration).attrTween("d",(function(){return function(e,t,i){var r=_u(e),a=_u(t),n="object"===bu(i)?i:{excludeSegment:i,snapEndsToInput:!0},o=n.excludeSegment,s=n.snapEndsToInput;if(!r.length&&!a.length)return function(){return""};var l=Au(r,a,{excludeSegment:o,snapEndsToInput:s});return function(e){if(1===e&&s)return null==t?"":t;var i,r="",a=ku(l(e));try{for(a.s();!(i=a.n()).done;)r+=Iu(i.value)}catch(n){a.e(n)}finally{a.f()}return r}}(vt(this).attr("d"),t)}))},setDotPosition(e,t){this.mouseX=e;const i=t?this.buyQuote:this.sellQuote,r=t?this.buyX:this.sellX,a=[...i].reverse(),n=r.invert(this.mouseX),o=vc(a,{price:n},0,i.length-1);let s=a[o];if(!t&&2===o&&n-a[0].price<a[o].price-n&&(s=a[1]),uc&&s){const e=r(s.price),t=this.y(Tt(s.culmulativeTotal));oc.text(s.price),lc.text(yc(Tt(s.culmulativeTotal)));const i=oc.node().getBBox(),a=lc.node().getBBox(),n=10,o=2,l=this.width-this.halfMarginOffset-i.width-n;oc.attr("x",Math.min(e,l)+i.width/2+n/2).attr("y",""+(this.height-this.margin+2)),lc.attr("x",-a.width/2+n+3).attr("y",t+i.height/2-o/2),nc.attr("x",Math.min(e,l)).attr("y",""+(this.height-this.halfMarginOffset+2)).attr("width",i.width+n).attr("height",i.height+o),sc.attr("x",-a.width+n-2).attr("y",t-i.height/2).attr("width",a.width+n).attr("height",a.height+o),cc.attr("y1",t).attr("y2",t),dc.attr("x1",e).attr("x2",e),uc.attr("cx",e).attr("cy",t)}},setMouseDotIndicatorData(e){const t=bt(e,pc.node())[0],i=t<(this.width-this.marginOffset)/2,r=i?"buy":"sell";this.isOnBuyPanel=i,this.isOnSellPanel=!i,this.isOnBuyPanel&&this.hasBuyQuote||this.isOnSellPanel&&this.hasSellQuote?(nc.attr("class",`${mc} ${r}`),oc.attr("class",`${hc} ${r}`),sc.attr("class",`${mc} ${r}`),lc.attr("class",`${hc} ${r}`),cc.attr("class",`${gc} ${r}-line`),dc.attr("class",`${gc} ${r}-line`),uc.attr("class",`${fc} ${r}`).style("opacity",1),this.setDotPosition(t,i)):this.hideMouseDotIndicator()},hideMouseDotIndicator(){this.isOnBuyPanel=!1,this.isOnSellPanel=!1,nc.attr("class",mc),oc.attr("class",hc),sc.attr("class",mc),lc.attr("class",hc),cc.attr("class",gc),dc.attr("class",gc),uc.style("opacity",0)}}},[["render",function(e,t,i,r,a,n){return o(),c("div",bc,null,512)}]]),IconPlus:Ue,IconChevronDown:Ze},props:{showDepthChart:{type:Boolean,default:!1},resizeTrigger:{type:[Boolean,String],default:!1},boxFilled:{type:Boolean,default:!1},showHeader:{type:Boolean,default:!0},toggleDepthChart:{type:Function,default:()=>{}}},setup:()=>({tradingDepthStore:Un()}),data:()=>({depthChartWidth:0,depthChartHeight:0}),computed:{...b(["isNoWebSocket"])},watch:{resizeTrigger(){this.adjustSize()}},mounted(){this.adjustSize(),window.addEventListener("resize",this.throttleAdjustSize),setTimeout(this.adjustSize,300)},beforeUnmount(){window.removeEventListener("resize",this.throttleAdjustSize)},methods:{adjustSize(){setTimeout((()=>{const e=this.$refs.depthChartCard,t=this.$refs.depthChartCardHeader;e&&t&&(this.depthChartWidth=e.clientWidth,this.depthChartHeight=e.clientHeight-t.clientHeight)}),0)},throttleAdjustSize:nt((function(){this.adjustSize()}),50,!0),onToggleClick(){this.toggleDepthChart(),this.$nextTick(this.adjustSize)}}},[["render",function(e,t,i,r,s,u){const d=a("IconChevronDown"),p=a("DepthChart"),g=a("IconPlus");return o(),c("div",{ref:"depthChartCard",class:C(["brand-card card-shell",{"box-fill":i.boxFilled}])},[l("div",{ref:"depthChartCardHeader",class:C(["brand-card-header card-s
1hell__header",{small:!i.showHeader}])},[B(l("div",{class:"brand-card-title"},m(e.$t("futuresMain.depthChart.title")),513),[[N,i.showHeader]]),t[0]||(t[0]=l("div",{class:"flex-fill"},null,-1)),e.isMobile?(o(),n(d,{key:0,class:C(["icon-chevron-down",{active:i.showDepthChart}]),"aria-label":"chevron down",onClick:u.onToggleClick},null,8,["class","onClick"])):h("",!0)],2),e.isNoWebSocket?h("",!0):(o(),n(p,{key:0,width:s.depthChartWidth,height:s.depthChartHeight,buyQuote:r.tradingDepthStore.buyDepth,sellQuote:r.tradingDepthStore.sellDepth,maxScale:8,onScaleChange:r.tradingDepthStore.updateGroupIndex},null,8,["width","height","buyQuote","sellQuote","onScaleChange"])),e.isMobile?h("",!0):(o(),n(g,{key:1,class:"icon-close","aria-label":"close",onClick:i.toggleDepthChart},null,8,["onClick"]))],2)}],["__scopeId","data-v-51968955"]]);const Cc={name:"MarketMenu",components:{MarketListPanel:ko,IconMarketList:$n({name:"IconMarketList",components:{Icon:Ee},props:{width:{type:Number,default:20},height:{type:Number,default:20}}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:i.width,height:i.height,"aria-label":"Market List Icon"},{default:s((()=>t[0]||(t[0]=[l("g",{fill:"currentColor","fill-rule":"evenodd",transform:"translate(-16 -60)"},[l("path",{d:"M9.461 -6L9.461 9.916 7.516 9.916 7.516 -6z",transform:"translate(16 60) translate(1.5 2.467) rotate(90 8.488 1.958)"}),l("path",{d:"M9.461 4.699L9.461 20.615 7.516 20.615 7.516 4.699z",transform:"translate(16 60) translate(1.5 2.467) rotate(90 8.488 12.657)"}),l("path",{d:"M12.567 2.411L12.567 12.137 10.621 12.137 10.621 2.411z",transform:"translate(16 60) translate(1.5 2.467) rotate(90 11.594 7.274)"}),l("path",{d:"M2.211 5.495L4.421 9.032 0 9.032z",transform:"translate(16 60) translate(1.5 2.467) rotate(90 2.21 7.263)"})],-1)]))),_:1,__:[0]},8,["width","height"])}]])},props:{tradingType:{type:String,required:!0}},data:()=>({isShowPanel:!1,defaultSelectedItemIndex:-1,timerId:null}),computed:{...b({futuresMarketList:e=>e.futures.marketList}),...y(qe,{spotMarketList:"marketList"}),isSpotMarketSource(){return this.tradingType===It.SPOT},marketList(){return this.isSpotMarketSource?this.spotMarketList:this.futuresMarketList},isDataReady(){return this.marketList.length>0}},mounted(){bo.register(So.MARKET_LIST_MENU,"keydown",this.openMarketListPanel,this.hideMarketList),bo.register(So.CLOSE_MARKET_PANEL,"keydown",this.closeMarketPanel)},beforeUnmount(){bo.unRegister(So.MARKET_LIST_MENU),bo.unRegister(So.CLOSE_MARKET_PANEL),document.removeEventListener("click",this.onClickOutside)},methods:{...u("trading",["setMarketMenuIsFocusSearch"]),handleMouseOver(){this.isLargeSize&&this.activeMarketList()},handleClickMenuButton(){!this.isLargeSize&&this.activeMarketList()},handleMouseLeave(){this.isLargeSize&&(this.timerId=setTimeout((()=>{this.hideMarketList()}),500))},handleMouseEnter(){this.isLargeSize&&this.cancelHideMarketList()},activeMarketList(){this.cancelHideMarketList(),this.isShowPanel=!0,Ot(!0),document.addEventListener("click",this.onClickOutside)},hideMarketList(){this.isShowPanel=!1,this.defaultSelectedItemIndex=-1,document.removeEventListener("click",this.onClickOutside),Ot(!1)},cancelHideMarketList(){clearTimeout(this.timerId)},openMarketListPanel(e){"m"!==e.key||this.isShowPanel||(e.preventDefault(),this.setMarketMenuIsFocusSearch(!0),this.defaultSelectedItemIndex=0,this.activeMarketList(),bo.events[So.MARKET_LIST_MENU].active=!0,bo.revoke(So.OPEN_QUOTE_SEARCH_PANEL))},onClickOutside(e){this.$refs.marketMenu&&!this.$refs.marketMenu.contains(e.target)&&this.hideMarketList()},closeMarketPanel(e){"Escape"===e.key&&this.hideMarketList()}}};const Pc=$n(Cc,[["render",function(e,t,i,r,n,s){const u=a("IconMarketList"),p=a("MarketListPanel");return o(),c("div",{ref:"marketMenu",class:"market-menu",onMouseleave:t[4]||(t[4]=(...e)=>s.handleMouseLeave&&s.handleMouseLeave(...e)),onMouseenter:t[5]||(t[5]=(...e)=>s.handleMouseEnter&&s.handleMouseEnter(...e))},[B(l("div",{class:C(["market-menu__button",{"is-hover":n.isShowPanel}]),onMouseover:t[0]||(t[0]=(...e)=>s.handleMouseOver&&s.handleMouseOver(...e)),onClick:t[1]||(t[1]=(...e)=>s.handleClickMenuButton&&s.handleClickMenuButton(...e))},[d(u),e.$slots.default?_(e.$slots,"default",{key:0},void 0,!0):h("",!0)],34),[[N,!e.isMobile||!n.isShowPanel]]),d(p,{showFindMarketPanel:n.isShowPanel,"onUpdate:showFindMarketPanel":t[2]||(t[2]=e=>n.isShowPanel=e),class:C(["market-menu__panel",{"is-spot":s.isSpotMarketSource&&!e.isMobile}]),hideMarketList:s.hideMarketList,defaultSelectedItemIndex:n.defaultSelectedItemIndex,onMobileClickClose:t[3]||(t[3]=e=>n.isShowPanel=!1)},null,8,["showFindMarketPanel","class","hideMarketList","defaultSelectedItemIndex"])],544)}
1],["__scopeId","data-v-b539e544"]]),kc={name:"FundingRateInfoItem",props:{marketData:{type:Object,default:()=>{}}},data:()=>({FUTURES_BASE_CURRENCY:ht,fundingCountDown:"",fundingTimer:null,isRefetching:!1}),computed:{...b(["lang"]),...U("futures",["symbol","marketDetail","currentFuturesMarkPrice","currentModePosition","hasPositions"]),fundingRate(){return this.marketData.fundingRate||0},fundingTime(){return this.marketData.fundingTime||0},fundingIntervalMinutes(){return this.marketData.fundingIntervalMinutes||0},displayCapFloor(){return`${this.formatCapFloorRate(this.marketData.fundingRateCap)} / ${this.formatCapFloorRate(this.marketData.fundingRateFloor)}`},nextFundingFee(){if(!this.hasPositions)return null;const e=this.currentFuturesMarkPrice;if(!e)return null;const{contractSize:t=1}=this.marketDetail,i=this.currentModePosition.reduce(((e,t)=>{const i=Math.abs(Number(t.totalContracts)||0);if(!i)return e;const r=t.orderModeName===xt.BUY;return e.plus(S(i).times(r?1:-1))}),S(0)).times(t).times(e).times(this.fundingRate).times(-1);return i.isZero()?0:i.toNumber()},nextFundingFeeRounded(){return null==this.nextFundingFee?null:S(this.nextFundingFee).dp(2,S.ROUND_FLOOR).toNumber()},nextFundingFeeDisplay(){return null==this.nextFundingFeeRounded?"-":this.$filters.formatNumber(this.nextFundingFeeRounded,{formatKey:2,signed:!0})},apr(){const e=this.fundingRate*(24/this.fundingIntervalHours)*365;return this.$filters.formatNumber(100*e,{formatKey:2,roundMode:S.ROUND_HALF_UP})},fundingRateDisplay(){return this.formatRate(this.fundingRate)},fundingIntervalHours(){return this.fundingIntervalMinutes/60},aprStyle(){return 0===this.apr?{}:{color:this.apr>0?"var(--app--color--accent-green-light)":"var(--app--color--accent-red)"}}},created(){this.fundingTimer=setInterval(this.handleFundingCountDown,1e3)},beforeUnmount(){clearInterval(this.fundingTimer)},methods:{...v(["initialMarketList"]),formatRate(e){return void 0===e?"-":this.$filters.formatNumber(100*e,{formatKey:5,signed:!0,postfix:"%",roundMode:S.ROUND_HALF_UP})},formatCapFloorRate(e){if(null==e)return"-";const t=S(e).times(100).dp(5,S.ROUND_HALF_UP);return this.$filters.formatNumber(t,{preserveDecimals:!0,signed:!0,postfix:"%"})},async handleFundingCountDown(){if(this.isRefetching)return;const e=this.fundingTime-(new Date).getTime();if(this.fundingTime&&e<=0)return this.isRefetching=!0,await this.initialMarketList(),void(this.isRefetching=!1);let{hours:t,minutes:i,seconds:r}=W({start:(new Date).getTime(),end:this.fundingTime});i=i<10?"0"+i:i,r=r<10?"0"+r:r,this.fundingCountDown=`${t}:${i}:${r}`}}},Tc={class:"funding-rate-info-item"},Mc={class:"data-label"},Lc={key:0},wc={class:"data-rows"},Dc={class:"data-row"},Oc={class:"label"},Ic={class:"value"},xc={class:"data-row"},_c={class:"label"},Ac={class:"value"},Rc={class:"data-row"},Fc={class:"label"},Ec={class:"value"},Bc={key:0,class:"data-row"},zc={class:"label"},$c={class:"sub"},Nc={class:"data-row"},Uc={class:"label"},Hc={class:"value"},Vc={class:"info"};const Wc=$n(kc,[["render",function(e,t,i,r,u,f){const v=a("i18n-t"),y=a("RouterLink"),b=a("Tooltip");return o(),n(b,{placement:"bottom-start",tooltipStyle:{maxWidth:"300px",padding:"12px"},delay:300},{content:s((()=>[l("div",Tc,[l("div",Mc,m(`${e.$t("futuresMain.contractInfo.fundingRate")} / ${e.$t("futuresMain.contractInfo.nextUpdate")}`),1),l("div",null,[l("span",{class:C({"brand-color-positive":f.fundingRate>0,"brand-color-negative":f.fundingRate<0})},m(f.fundingRateDisplay),3),l("span",null,"Â /Â "+m(u.fundingCountDown),1),f.fundingIntervalMinutes?(o(),c("span",Lc," Â ("+m(f.fundingIntervalHours)+"h) ",1)):h("",!0)])])])),tooltip:s((()=>[l("div",wc,[l("div",Dc,[l("div",Oc,m(e.$t("trading.fundingRate.current")),1),l("div",Ic,[l("span",{class:C({"brand-color-positive":f.fundingRate>0,"brand-color-negative":f.fundingRate<0})},m(f.fundingRateDisplay),3),t[0]||(t[0]=l("span",null,"Â /Â ",-1)),l("span",null,m(f.apr)+"%",1)])]),l("div",xc,[l("div",_c,m(e.$t("t.interval")),1),l("div",Ac,m(`${e.$t("t.every")} ${f.fundingIntervalHours}h`),1)]),l("div",Rc,[l("div",Fc,m(e.$t("t.direction")),1),l("div",Ec,[f.fundingRate?(o(),n(v,{key:1,keypath:"trading.fundingRate.pays",tag:"div"},{d1:s((()=>[l("span",{class:C({"brand-color-positive":f.fundingRate>0,"brand-color-negative":f.fundingRate<0})},m(f.fundingRate>0?e.$t("t.long"):e.$t("t.short")),3)])),d2:s((()=>[l("span",{class:C({"brand-color-positive":f.fundingRate<0,"brand-color-negative":f.fundingRate>0})},m(f.fundingRate<0?e.$t("t.long"):e.$t("t.short")),3)])),_:1})):(o(),c(g,{key:0},[p("-")],64))])]),e.hasPositions?(o(),c("div",Bc,[l("div",zc,[p(m(e.$t("trading.fundingRate.nextFee"))+" ",1),l("span",$c,"("+m(u.FUTURES_BASE_CURRENCY)+")",1)]),l("div",{class:C(["value",{"brand-color-positive":f.nextFundingFeeRounded>0,"brand-color-negative":f.nextFundingFeeRounded<0}])},m(f.nextFundingFeeDisplay),3)])):h("",!0),l("div",Nc,[l("div",Uc,m(e.$t("trading.fundingRate.capFloor")),1),l("div",Hc,m(f.displayCapFloor),
11)])]),l("div",Vc,m(e.$t("trading.tooltip.fundingRate",{hour:f.fundingIntervalHours})),1),d(y,{class:"history-btn",to:{name:"fundingHistory",params:{lang:e.lang}}},{default:s((()=>[p(m(e.$t("trading.fundingRate.viewHistory")),1)])),_:1},8,["to"])])),_:1})}],["__scopeId","data-v-9deae475"]]);const qc=$n({name:"MarketHintTooltip",computed:{...y(qe,["marketData","getExchangeInfoBySymbol","marketSymbol"]),exchangeInfo(){return this.getExchangeInfoBySymbol(this.marketSymbol)},isShowHint(){return void 0!==this.exchangeInfo.multiplier&&1!==this.exchangeInfo.multiplier},multiplierText(){return this.$filters.formatNumber(this.exchangeInfo.multiplier,0)},currencyName(){return this.$filters.digitalCurrency(this.marketData.baseCurrency)}}},[["render",function(e,t,i,r,u,c){const d=a("Tooltip");return c.isShowHint?(o(),n(d,{key:0},{content:s((()=>[_(e.$slots,"default")])),tooltip:s((()=>[l("span",null,m(e.$t("t.marketHint.hint",{baseCurrency:e.marketData.baseCurrency,multiplier:c.multiplierText,currencyName:c.currencyName})),1)])),_:3})):_(e.$slots,"default",{key:1})}]]),{enableTradingVolume:Gc,enable24hVolume:Kc}=zt,Qc={buy:{value:0},sell:{value:1}},jc={name:"MarketInfoCard",components:{MarketMenu:Pc,LastPrice:Co,FundingRateInfoItem:Wc,Icon:Rt,IconCross:At,IconMore:_t,MarketLabel:Mo,MarketHintTooltip:qc,OffHoursTag:To},inject:["tabsActionUpdate"],props:{tradeModeCallback:{type:Function,default:()=>{}},boxFilled:{type:Boolean,default:!1},resizeTrigger:{type:[Boolean,Number],default:!1},resizeHeightTrigger:{type:[Boolean,Number],default:!1}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},data:()=>({TRADING_TYPE:It,tradingViewLogoText:mt.tradingViewLogoText,containerWidth:0,isFavoriteActive:!1,showMoreMenu:!1,showMoreMenuDropdown:!1,marketInfoHeaderWidth:0,marketTitleWrapWidth:0,marketDataListWidth:0,visibleLength:0}),computed:{...b({lang:"lang",isMobileChartMode:"isMobileChartMode",currencyMap:"currencyMap",lastPrice:e=>e.orderBook.lastPrice,lastPriceChange:e=>e.orderBook.lastPriceChange,futuresIndexPriceMap:e=>e.futures.futuresIndexPriceMap,futuresLastDataMap:e=>e.futures.futuresLastDataMap,futuresMarkPriceMap:e=>e.futures.futuresMarkPriceMap}),...U("futures",{isFutures:"isFutures",futuresMarketData:"marketData",futuresMarketDetail:"marketDetail",currentSettleInCurrency:"currentSettleInCurrency",isFuturesMarketOffHours:"isMarketOffHours"}),...y(qe,{isSpot:"isSpot",spotMarketSymbol:"marketSymbol",spotMarketCurrency:"marketCurrency",spotMarketQuoteCurrency:"marketQuoteCurrency",spotMarketData:"marketData",currentSpotMarketBaseCurrency:"currentSpotMarketBaseCurrency",spotExchangeInfo:"exchangeInfo"}),...y(Bt,["marketStatsMap"]),showMarketPrice(){return this.isMobile||this.containerWidth>=472},priceFormat(){return{formatKey:(this.isFutures?this.futuresMarketData.priceFilter:this.spotExchangeInfo.priceDecimal)??2,currency:this.quote}},marketIndex(){let e;return e=this.isFutures?this.futuresLastDataMap[this.futuresMarketData.symbol]||{}:this.marketStatsMap[this.spotMarketSymbol]||{},{...Et(e),price:this.lastPrice,lastPriceChange:this.lastPriceChange}},marketDataReady(){return this.futuresMarketData.symbol||this.marketIndex.name||!1},marketName(){if(this.isSpot){const{symbol:e,displayName:t}=this.spotMarketData,i=this.convertToDisplaySymbol(e);return this.$deviceSmallerThan.xl(this.$mq)&&this.$deviceBiggerThan.sm(this.$mq)?t:`${t} (${i})`}return this.futuresMarketData.symbol},marketNameSubtitle(){return this.futuresMarketData.displayName},quote(){return this.isSpot?this.spotMarketQuoteCurrency:"USD"},marketData(){return this.isSpot?this.spotMarketData:this.futuresMarketData},spotMarketDataList(){return[{label:`${this.$t("t.24h")} ${this.$t("trading.marketInfo.highestPrice")}`,tooltip:this.$t("trading.marketInfo.high.tip"),value:this.$filters.formatNumber(this.marketIndex.high,this.priceFormat)},{label:`${this.$t("t.24h")} ${this.$t("trading.marketInfo.lowestPrice")}`,tooltip:this.$t("trading.marketInfo.low.tip"),value:this.$filters.formatNumber(this.marketIndex.low,this.priceFormat)},{label:`${this.$t("t.24h")} ${this.$t("t.vol")}`,tooltip:this.$t("futuresMain.marketInfo.vol.tipWithCoin",{coin:this.quote}),value:this.$filters.formatNumber(this.marketIndex.volume,0)+` ${this.isMobile?"":this.quote}`,isDisabled:!Gc||!Kc}].filter((e=>!e.isDisabled))},futuresMarketDataList(){const{formatNumber:e,formatDate:t}=this.$filters,{high:i,low:r,volume:a=0}=this.marketIndex,{isTimeBasedContract:n,closeTime:o}=this.futuresMarketData;return[{label:this.$t("trading.mark"),tooltip:this.$t("futuresMain.contractInfo.brandMarkPrice.tip"),value:e(this.markPrice,this.priceFormat)},{label:this.$t("futuresMain.trade.index"),tooltip:this.$t("futuresMain.contractInfo.brandIndPrice.tip",{brandName:this.$t("brand.name")}
1),value:e(this.indexPrice,this.priceFormat)},{label:`${this.$t("t.24h")} ${this.$t("t.vol")}`,tooltip:this.$t("futuresMain.marketInfo.vol.tipWithCoin",{coin:this.currentSettleInCurrency}),value:`${je(a,2,2)} ${this.currentSettleInCurrency}`,isDisabled:!Gc||!Kc},{label:`${this.$t("t.24h")} ${this.$t("trading.marketInfo.highestPrice")}`,tooltip:this.$t("futuresMain.marketInfo.high.tip"),value:e(i,this.priceFormat)},{label:`${this.$t("t.24h")} ${this.$t("trading.marketInfo.lowestPrice")}`,tooltip:this.$t("futuresMain.marketInfo.low.tip"),value:e(r,this.priceFormat)},n?{label:this.$t("futuresMain.contractInfo.expirationDate"),value:t(o,"yyyy-MM-dd HH:mm:ss")}:{isFundingRate:!0,marketData:this.futuresMarketData}].filter((e=>!e.isDisabled))},marketDataList(){return this.isFutures?this.futuresMarketDataList:this.spotMarketDataList},hiddenMarketDataList(){return this.marketDataList.slice(this.visibleLength+1)},marketDataListAvailableWidth(){return this.isMobile?this.marketInfoHeaderWidth-20:this.marketInfoHeaderWidth-this.marketTitleWrapWidth-20-16},indexPrice(){return this.futuresIndexPriceMap[this.futuresMarketData.symbol]||0},markPrice(){return this.futuresMarkPriceMap[this.futuresMarketData.symbol]||0}},watch:{marketData:{handler(e){this.isFavoriteActive=(null==e?void 0:e.isFavorite)||!1,e&&this.$nextTick((()=>{this.throttleUpdateMarketDataListLayout()}))},immediate:!0},"marketIndex.price":{handler(e){e&&this.$nextTick((()=>{setTimeout((()=>{this.throttleUpdateMarketDataListLayout()}),100)}))}},showMarketPrice:{handler(e){e&&this.$nextTick((()=>{this.updateMarketDataListLayout()}))}},isMobileChartMode:{handler(e){this.$nextTick((()=>{e&&this.updateMarketDataListLayout()}))},immediate:!0},resizeTrigger(){this.$nextTick((()=>{this.debounceGetContainerWidth(),this.throttleUpdateMarketDataListLayout()}))}},created(){window.addEventListener("resize",this.debounceGetContainerWidth),window.addEventListener("resize",this.throttleUpdateMarketDataListLayout)},mounted(){this.$nextTick((()=>{this.debounceGetContainerWidth()}))},beforeUnmount(){window.removeEventListener("resize",this.debounceGetContainerWidth),window.removeEventListener("resize",this.throttleUpdateMarketDataListLayout)},methods:{getContainerWidth(){return this.$refs.marketInfoCard&&this.$refs.marketInfoCard.clientWidth},debounceGetContainerWidth:Ne((function(){this.containerWidth=this.getContainerWidth()}),100),throttleUpdateMarketDataListLayout:nt((function(){this.updateMarketDataListLayout()}),100),updateMarketDataListLayout(){const{marketInfoHeader:e,marketTitleWrap:t,marketDataListWrap:i}=this.$refs;this.marketInfoHeaderWidth=(null==e?void 0:e.clientWidth)||0,this.marketTitleWrapWidth=(null==t?void 0:t.clientWidth)||0,this.marketDataListWrapWidth=(null==i?void 0:i.clientWidth)||0,this.updateVisibleItems()},updateVisibleItems(){const{marketDataList:e}=this.$refs;if(!e)return;let t=!1;(this.marketDataListWrapWidth<=this.marketDataListAvailableWidth||this.isMobile)&&(t=!0),this.showMoreMenu=!t;let i=0;this.visibleLength=0;let r=!1;e.forEach(((e,a)=>{if(t)e.style.visibility="visible";else if(r)e.style.visibility="hidden";else{const t=e.clientWidth+36;i+t<=this.marketDataListAvailableWidth-24?(i+=t,e.style.visibility="visible",this.visibleLength=a):(r=!0,e.style.visibility="hidden")}}))},backToTradeMode(e){this.isSpot&&this.tradeModeCallback(e),Ft(!1),this.tabsActionUpdate(Qc[e]),window.history.back()},handleClickCloseIcon(){this.backToTradeMode("buy")}}},Yc={ref:"marketInfoHeader",class:"market-info-header"},Zc={ref:"marketTitleWrap",class:"market-title-wrap"},Xc={class:"market-symbol-wrap"},Jc={class:"flex-box flex-column justify-center"},ed={class:"market-name"},td={class:"name"},id={class:"market-name-subtitle-wrap"},rd={key:0,class:"market-name-subtitle"},ad={ref:"marketDataListWrap",class:"market-data-list-wrap"},nd={key:1,class:"data-label"},od={class:"more-menu-dropdown"},sd={key:1,class:"data-label"};const ld=$n(jc,[["render",function(e,t,i,r,u,p){const f=a("Icon"),v=a("MarketLabel"),y=a("OffHoursTag"),b=a("MarketHintTooltip"),S=a("MarketMenu"),P=a("LastPrice"),k=a("IconCross"),T=a("FundingRateInfoItem"),M=a("ToolTip"),L=a("IconMore");return o(),c("div",{ref:"marketInfoCard",class:C(["brand-card card-shell market-info-card",{"is-mobile":e.isMobile,"box-fill":i.boxFilled}])},[l("div",Yc,[t[2]||(t[2]=l("div",{class:"card-shell__header"},null,-1)),l("div",Zc,[d(S,{tradingType:e.isFutures?u.TRADING_TYPE.FUTURES:u.TRADING_TYPE.SPOT},{default:s((()=>[l("div",Xc,[d(f,{name:e.isFutures?e.futuresMarketData.baseCurrency:e.currentSpotMarketBaseCurrency,showName:!1,size:"24"},null,8,["name"]),d(b,null,{default:s((()=>{var t;return[l("div",Jc,[l("div",ed,[l("div",td,m(p.marketName),1),e.isFutures&&!e.isFuturesMarketOffHours?(o(),n(v,{key:0,t
1ype:null==(t=e.futuresMarketDetail)?void 0:t.promoIcon},null,8,["type"])):h("",!0)]),l("div",id,[e.isFutures?(o(),c("div",rd,m(p.marketNameSubtitle),1)):h("",!0),e.isFuturesMarketOffHours&&!e.isMobile?(o(),n(y,{key:1})):h("",!0)])])]})),_:1})])])),_:1},8,["tradingType"]),l("div",null,[p.showMarketPrice?(o(),n(P,{key:0,class:"last-price-block futures",lastPrice:p.marketIndex.price,lastPriceChange:p.marketIndex.lastPriceChange,gains:p.marketIndex.gains,priceFilter:p.priceFormat,showPriceStatusIcon:!1,showGains:""},null,8,["lastPrice","lastPriceChange","gains","priceFilter"])):h("",!0),e.isFuturesMarketOffHours&&e.isMobile?(o(),n(y,{key:1})):h("",!0)]),e.isMobileChartMode?(o(),n(k,{key:0,class:"icon-close",onClick:p.handleClickCloseIcon},null,8,["onClick"])):h("",!0)],512),l("div",ad,[(o(!0),c(g,null,R(p.marketDataList,((e,t)=>(o(),c("div",{key:t,ref_for:!0,ref:"marketDataList",class:"market-data-list"},[e.isFundingRate?(o(),n(T,{key:0,marketData:e.marketData},null,8,["marketData"])):(o(),c(g,{key:1},[e.tooltip?(o(),n(M,{key:0,placement:"bottom-start",class:"data-label",content:e.label,tooltip:e.tooltip},null,8,["content","tooltip"])):(o(),c("div",nd,m(e.label),1)),l("div",{class:C(["data-value",e.valueClass])},m(e.value),3)],64))])))),128))],512),!e.isMobile&&u.showMoreMenu?(o(),c("div",{key:0,class:"market-data-list-more-menu",onMouseenter:t[0]||(t[0]=e=>u.showMoreMenuDropdown=!0),onMouseleave:t[1]||(t[1]=e=>u.showMoreMenuDropdown=!1)},[d(L,{class:"more-icon"}),B(l("div",od,[(o(!0),c(g,null,R(p.hiddenMarketDataList,(e=>(o(),c("div",{key:e.label},[e.isFundingRate?(o(),n(T,{key:0,marketData:e.marketData},null,8,["marketData"])):(o(),c(g,{key:1},[e.tooltip?(o(),n(M,{key:0,placement:"bottom-start",class:"data-label",content:e.label,tooltip:e.tooltip},null,8,["content","tooltip"])):(o(),c("div",sd,m(e.label),1)),l("div",{class:C(["data-value",e.valueClass])},m(e.value),3)],64))])))),128))],512),[[N,u.showMoreMenuDropdown]])],32)):h("",!0)],512)],2)}],["__scopeId","data-v-1e4e7c21"]]),{enablePrerenderWebsocket:ud}=mt;let cd=null,dd=0,pd=null,hd=null,md=null,gd=0;const fd="reinitializeTradingView",vd=new Map;function yd(e){return JSON.stringify({op:"subscribe",channel:"kline",params:[e]})}function bd(e){cd&&cd.readyState===WebSocket.OPEN&&cd.send(e)}function Sd(){if(pd&&(clearTimeout(pd),pd=null),cd&&(cd.readyState===WebSocket.OPEN||cd.readyState===WebSocket.CONNECTING))return;const e=Nt[0];cd=new WebSocket(`${e}/public-api`),cd.onopen=()=>{if(dd>0){const e=new Event(fd);window.dispatchEvent(e)}dd=0,md=setInterval((()=>{bd(JSON.stringify({op:"ping"}))}),1e4);for(const e of vd.keys())bd(e)},cd.onclose=e=>{vd.clear(),md&&clearInterval(md),function(){if(dd>=5)return;const e=Math.min(1e3*Math.pow(2,dd),3e4);dd++,pd=setTimeout((()=>{Sd()}),e)}()},cd.onerror=e=>{},cd.onmessage=e=>{const t=JSON.parse(e.data);if("pong"===t.event)return;const i=t.param,r=t.data;if(void 0===r||void 0===i)return;const a=Cd(r,!0),n=function(e){switch(e){case"1":return 6e4;case"5":return 3e5;case"15":return 9e5;case"30":return 18e5;case"60":return 36e5;case"240":return 144e5;case"360":return 216e5;case"1D":return 864e5;case"1W":return 6048e5;case"1M":return 2592e6}}(i.split("_")[1]);a.forEach((e=>{!function(e,t,i){const r=vd.get(yd(t));if(void 0===r)return;const a=function(e,t,i){if(!e)return null;if(void 0!==i&&t.time>=e.time+i)return{...t};if(t.time>=e.time)return{...e,close:t.close,high:Math.max(e.high,t.high),low:Math.min(e.low,t.low),open:t.open,volume:t.volume};return null}(r.lastDailyBar,e,i);if(!a)return;r.lastDailyBar=a,r.handlers.forEach((e=>e.callback(a)))}(e,i,n)}))}}function Cd(e,t){return e.t.map(((i,r)=>({time:1e3*i,open:Number(e.o[r]),high:Number(e.h[r]),low:Number(e.l[r]),close:Number(e.c[r]),volume:t?Number(e.v[r]):0})))}const{enableTradingVolume:Pd}=zt,kd="Spot",Td="Futures";function Md(e,t,i){return e.map((e=>{if(!e.baseCurrency||!e.quoteCurrency)return null;const r=i.getMarketSymbolFromBaseCurrency(e.baseCurrency),a=`${Ht(r)}/${e.quoteCurrency}`;return{symbol:a,ticker:`${r}-${e.quoteCurrency}`,full_name:a,description:a,exchange:t,type:kd}})).filter((e=>null!==e))}function Ld(e,t,i){return e.map((e=>{const r=i.getFuturesMarket(e.symbol);return(null==r?void 0:r.tradingViewSymbol)?{symbol:e.symbol,ticker:r.tradingViewSymbol,full_name:e.symbol,description:`${r.baseCurrency} Perpetual`,exchange:t,type:Td}:null})).filter((e=>null!==e))}let wd=0;function Dd(e){const t=new Map,i=++wd,r=e=>`${i}:${e}`;return{onReady:async t=>{const i=await Ut.getConfig();setTimeout((()=>t({...i,symbols_types:[{name:e.translate("t.all"),value:""},{name:e.translate("t.spot"),value:kd},{name:e.translate("t.futures"),value:Td}]})))},resolveSymbol:async(t,i,r)=>{try{i(function(e,t,i){const r=i.translate("brand.name").toUpperCase(),a=e.name,n=Ht(a),o={...e};
1if(a!==n&&(o.name=n,o.full_name=Ht(o.full_name),o.description=Ht(o.description)),i.hasSpotMarket(a)&&o.currency){const e=`${n}/${o.currency}`;o.name=e,o.description=e,o.type=kd}else{const e=i.getFuturesMarket(a);e&&(o.description=`${e.baseCurrency} Perpetual`,o.type=Td)}return{...o,ticker:o.ticker??t,exchange:r,listed_exchange:r}}(await Ut.getSymbolInfo(t),t,e))}catch(a){r("Cannot resolve symbol")}},searchSymbols:async(t,i,r,a)=>{var n,o;try{const{data:i}=await Lo.getGlobalSearch({key:t}),s=e.translate("brand.name").toUpperCase(),l=[...Md((null==(n=null==i?void 0:i.spot)?void 0:n.data)??[],s,e),...Ld((null==(o=null==i?void 0:i.futures)?void 0:o.data)??[],s,e)];a(r?l.filter((e=>e.type===r)):l)}catch(s){a([])}},getBars:async(e,i,r,a,n)=>{const{symbol:o}=e,s=r.firstDataRequest;try{const e={symbol:o,resolution:i,...r},n=await Ut.getBarsHistory(e);if("ok"===n.s&&n.t.length>0){const e=Cd(n,Pd);s&&t.set(o,e[e.length-1]),a(e,{noData:!1})}else a([],{noData:!0})}catch(l){n(String(l))}},subscribeBars:(e,i,a,n)=>{const{symbol:o}=e;!function(e,t,i,r,a){const n=yd(`${e}_${t}`),o={id:r,callback:i},s=vd.get(n);s?s.handlers.push(o):(vd.set(n,{subscriberUID:r,resolution:t,lastDailyBar:a,handlers:[o]}),bd(n))}(o,i,a,r(n),t.get(o))},unsubscribeBars:e=>{!function(e){for(const[t,i]of vd){const r=i.handlers.findIndex((t=>t.id===e));if(-1!==r&&(i.handlers.splice(r,1),0===i.handlers.length)){const e=JSON.parse(t);bd(JSON.stringify({op:"unsubscribe",channel:"kline",params:e.params})),vd.delete(t);break}}}(r(e))},getServerTime:async e=>{try{e(await Ut.getServerTime())}catch(t){}}}}const Od=()=>window.innerWidth<=767,{enableOcfChartAutoLogScale:Id,hideOcfChartMobileHeaderButtons:xd}=mt,_d=Id&&Od(),Ad=_d?"tradingViewOneClickFuturesMobileHideScaleButtonsCustomStyle":"tradingViewOneClickFuturesMobileCustomStyle",Rd={oneClickFutures:{chartKeyPrefix:"tvConfigOneClickFutures",forceTheme:"night",globalInterval:!0,disabledFeatures:["header_quick_search","header_chart_type","header_compare","header_indicators","header_undo_redo","header_saveload","header_interval_dialog_button","header_layouttoggle","timeframes_toolbar","legend_widget","create_volume_indicator_by_default",..._d?["axis_pressed_mouse_move_scale"]:[],...xd&&Od()?["header_settings","header_screenshot"]:[]],themeOverrides:{"paneProperties.background":Od()?"#000000":"#101010","scalesProperties.lineColor":"#596262","scalesProperties.textColor":"#95a3a4","scalesProperties.fontSize":12,"mainSeriesProperties.candleStyle.upColor":"#1FC190","mainSeriesProperties.candleStyle.borderUpColor":"#1FC190","mainSeriesProperties.candleStyle.wickUpColor":"#1FC190","mainSeriesProperties.candleStyle.downColor":"#FF5D55","mainSeriesProperties.candleStyle.borderDownColor":"#FF5D55","mainSeriesProperties.candleStyle.wickDownColor":"#FF5D55"},forceAutoLogPriceScale:_d,defaultInterval:"5",favorites:{intervals:["5","60","1D","1W"],chartTypes:["Candles"]},customCSSUrl:Od()?`/static/css/${Ad}.css?20260811`:"/static/css/tradingViewOneClickFuturesCustomStyle.css?20260417",hidePositionLines:!0}};const Fd=".intervalOverride",Ed=["paneProperties.vertGridProperties.color","paneProperties.horzGridProperties.color"];function Bd(e){return"string"==typeof e&&(e.includes("rgb")||e.includes("#"))}function zd(){const e=k(),t=M((()=>e.state.isTradingViewFullScreen));return{isTradingViewFullScreen:t,createFullScreenButton:function(i){const r=i.createButton({align:"right",useTradingViewStyle:!1});r.classList.toggle("button-2ioYhFEY-"),r.style.padding="0 5px",r.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28">\n <g fill="currentColor">\n <path d="M21 7v4h1V6h-5v1z"></path>\n <path d="M16.854 11.854l5-5-.708-.708-5 5zM7 7v4H6V6h5v1z"></path>\n <path d="M11.146 11.854l-5-5 .708-.708 5 5zM21 21v-4h1v5h-5v-1z"></path>\n <path d="M16.854 16.146l5 5-.708.708-5-5z"></path>\n <g>\n <path d="M7 21v-4H6v5h5v-1z"></path>\n <path d="M11.146 16.146l-5 5 .708.708 5-5z"></path>\n </g>\n </g>\n </svg>',r.title="Fullscreen mode",r.addEventListener("click",(()=>{var i;i=!t.value,e.commit("setTradingViewFullScreen",i)}))}}}const $d={[Gt.BUY]:{get MAIN_COLOR(){return Do("--graph-green-400-fixed",document.body)},SUB_COLOR:"#09703e"},[Gt.SELL]:{get MAIN_COLOR(){return Do("--graph-red-400",document.body)},SUB_COLOR:"#c34140"}},Nd={day:{MAIN_COLOR:Wt["--app--color--blue-grey-lighter"],SUB_COLOR:qt(Wt["--app--color--denim-darker"],.08),BUTTON_COLOR:Wt["--app--color--blue-grey-dark"]},night:{MAIN_COLOR:Wt["--app--color--blue-grey-darker"],SUB_COLOR:qt(Wt["--app--color--blue-grey-darker"],.3),BUTTON_COLOR:Wt["--app--color--white-dark"]}},Ud={get green(){return Do("--graph-green-400-fixed",document.body)},get red(){return Do("--graph-red-400",document.body)},positionLine:Wt["--app--color--blue-grey-darker"]};function Hd({widget:e,isFutures:t,isLoading:i,showOrderOnChart:r,hasOpenPosition:a,validOpenPosition:n,formatQuantity:o}){const s={},l={},u={};function c(e,t){if(!e||!t)return;const{orderModeName:i,entryPrice:r,totalContracts:a}=t,n="MODE_BUY"===i,s=n?Gt.BUY:Gt.SELL,l=n?"+":"-",u=o(a,r),c=$d[s];e.setText("POSITION").setPrice(r).setQuantity(`${l}${u}`).setBodyFont("16pt Arial-BoldMT").setBodyTextColor("#fff").setBodyBackgroun
1dColor(c.MAIN_COLOR).setBodyBorderColor(c.MAIN_COLOR).setQuantityFont("16pt ArialMT").setQuantityBorderColor(c.SUB_COLOR).setQuantityBackgroundColor(c.SUB_COLOR).setLineColor(Ud.positionLine).setLineStyle(0).setLineLength(85).setLineWidth(2)}function d(e,t,i){if(!e||!t)return;const r="TP"===i,a=r?t.takeProfitOrder:t.stopLossOrder;if(!a)return;const n="#777",o="#333",s=r?"TP":"SL",l=r?Ud.green:Ud.red;e.setText(s).setPrice(a.triggerPrice).setBodyFont("16pt Arial-BoldMT").setBodyTextColor(l).setBodyBackgroundColor(n).setBodyBorderColor(n).setQuantity("All").setQuantityFont("16pt Arial-BoldMT").setQuantityTextColor(l).setQuantityBackgroundColor(o).setQuantityBorderColor(o).setLineStyle(2).setLineColor(l).setCancelButtonBackgroundColor(n).setCancelButtonBorderColor(n).setCancelButtonIconColor(l)}function p(e,t){Object.keys(e).forEach((i=>{t(i)&&(e[i].remove(),delete e[i])}))}function h(){p(s,(()=>!0)),p(l,(()=>!0)),p(u,(()=>!0))}return{renderPositionView:Ne((()=>{var o,m;if(e.value&&t&&r.value&&!i.value&&a.value){for(const t of n.value){const{positionId:i,closeOrder:r,takeProfitOrder:a,stopLossOrder:n}=t;s[i]&&s[i].remove(),s[i]=e.value.chart().createPositionLine(),c(s[i],t),r&&(a?(l[i]=l[i]||e.value.activeChart().createOrderLine(),d(l[i],t,"TP")):(null==(o=l[i])||o.remove(),delete l[i]),n?(u[i]=u[i]||e.value.activeChart().createOrderLine(),d(u[i],t,"SL")):(null==(m=u[i])||m.remove(),delete u[i]))}!function(){const e=e=>n.value.find((t=>t.positionId===e));p(s,(t=>!e(t))),p(l,(t=>{const i=e(t);return Boolean(i&&!i.takeProfitOrder)})),p(u,(t=>{const i=e(t);return Boolean(i&&!i.stopLossOrder)}))}()}else h()}),100),removeAllPositionLine:h}}function Vd({widget:e,symbol:t,isFutures:i,orderList:r,isLoading:a,theme:n,formatQuantity:o,translate:s,onOrderCancel:l}){const u=new WeakMap;let c=[],d=0,p=null;function h(e){return{key:`${t.value}_${e.orderID}`,mode:Kt[e.orderMode],price:e.price,size:i?e.amount:e.size,isTriggerOrder:e.triggerOrder}}const m=Ne((()=>{g()}),1500);function g(){if(a.value)return;const n=e.value&&u.get(e.value)||{},o={};e.value&&u.set(e.value,o);for(let a=0;a<r.value.length;a++){const s=r.value[a],{key:l,mode:u,price:d,size:p,isTriggerOrder:m}=h(s),g=i?s.marketName:s.symbol;0!==d&&t.value===g&&(o[l]=n[l]||(c.length>0?c.shift():e.value.chart().createOrderLine().setPrice(void 0).setBodyFont("16pt Arial-BoldMT").setQuantityFont("16pt ArialMT").setLineStyle(2)),n[l]&&delete n[l],f(o[l],{mode:u,price:d,size:p,isTriggerOrder:m,order:s,onCancel:()=>{o[l]&&(o[l].setPrice(1/0),c.push(o[l])),delete o[l]}}))}for(const e in n)t.value===e.split("_")[0]&&(n[e].setPrice(1/0),c.push(n[e]))}function f(e,t){const{mode:i,price:r,size:a,order:u,isTriggerOrder:c,onCancel:d}=t,p=$d[i],h=Nd[n.value],m=i===Gt.BUY?"buy":"sell",g=c?h.MAIN_COLOR:p.MAIN_COLOR,f=c?h.SUB_COLOR:p.SUB_COLOR,v=c?p.MAIN_COLOR:"#fff",y=c?h.BUTTON_COLOR:"#fff",b=o(a,r);e.setDirection(m).setText(s(`futuresMain.trade.chart.order.${m}`)).setPrice(r).setQuantity(b).setBodyTextColor(v).setBodyBackgroundColor(g).setBodyBorderColor(g).setQuantityTextColor(v).setCancelButtonIconColor(y).setQuantityBackgroundColor(f).setQuantityBorderColor(f).setCancelButtonBackgroundColor(g).setCancelButtonBorderColor(g).setLineColor(p.MAIN_COLOR),e.onCancel((()=>l(u,d)))}return{renderOrderLine:g,removeOrderLine:function(){const t=e.value&&u.get(e.value)||{};for(const e in t)t[e].remove();c.forEach((e=>e.remove())),c=[]},handleOrderListChange:function(){Date.now()-d>5e3?(p&&cancelAnimationFrame(p),p=requestAnimationFrame((()=>{d=Date.now(),g()}))):m()},resetUpdateTimestamp:()=>{d=0}}}const Wd=q("tradingViewChartStore",{state:()=>({tradingViewWidgetInstance:null}),actions:{setTradingViewWidgetInstance(e){this.tradingViewWidgetInstance=e}}}),qd=$n(A({__name:"TradingViewChart",props:{isFutures:{type:Boolean,default:!1},symbol:{type:String,required:!0},orderList:{type:Array,default:()=>[]},onOrderCancel:{type:Function,default:()=>{}},variant:{type:String,default:null,validator:e=>null===e||function(e){return"string"==typeof e&&e in Rd}(e)}},setup(e){const{defaultTradingViewStudyList:t,enableTradingVolume:i}=zt,r=e,a=k(),{t:n}=G(),s=K.useMq(),l=Ge(),{sizeType:u,sizeFilter:d}=Q(l),{isLeaderModeActive:p}=Q(pt()),h=Wd(),{windowIsInActive:m}=Q(Po()),g=`chartContainer-${j()}`,f=T(null),v=Y(null),y=T(!0),b=T(!1),S=Z(r,"symbol"),P=function(){const e=document.createElement("iframe");return Boolean(e.requestFullscreen||e.webkitRequestFullscreen)}(),O=M((()=>a.state.lang)),I=M((()=>a.state.theme)),_=M((()=>
1a.state.loginState)),A=M((()=>a.state.userConfig.tradingBox)),R=M((()=>a.state.userConfig.tradeHistoryOnChart)),F=M((()=>a.getters.userName)),E=qe(),{exchangeInfo:z,marketQuoteCurrency:$}=Q(E),N=M((()=>a.getters["futures/hasOpenPosition"])),U=M((()=>a.getters["futures/currentSettleInCurrency"])),V=M((()=>function({variant:e,theme:t,lang:i,loginState:r,userName:a,supportsFullscreenApi:n}){const o=e?Rd[e]:null,s=wo,l=s[(null==o?void 0:o.forceTheme)||t]||s.day,u=(null==o?void 0:o.chartKeyPrefix)??wo.localStorageConfigKeyPrefix,c=r?`.${Vt(a)}`:"",d=[...wo.disabledFeatures,...(null==o?void 0:o.disabledFeatures)??[]];return n||d.push("header_fullscreen_button"),{themeOptions:l,locale:wo.locale[i]||"en",chartDataKey:`${u}${c}`,disabledFeatures:d,enabledFeatures:wo.enabledFeatures,timeFrames:wo.timeFrames,favorites:(null==o?void 0:o.favorites)||wo.favorites,studiesAccess:s.studies_access,customCssUrl:(null==o?void 0:o.customCSSUrl)||"/static/css/tradingViewCustomStyle.css?20260415",defaultInterval:(null==o?void 0:o.defaultInterval)??wo.defaultInterval,useGlobalInterval:Boolean(null==o?void 0:o.globalInterval),themeOverrides:(null==o?void 0:o.themeOverrides)??{},forceAutoLogPriceScale:Boolean(null==o?void 0:o.forceAutoLogPriceScale),hidePositionLines:Boolean(null==o?void 0:o.hidePositionLines)}}({variant:r.variant,theme:I.value,lang:O.value,loginState:_.value,userName:F.value,supportsFullscreenApi:P}))),W=M((()=>{if(V.value.hidePositionLines)return[];return(p.value?a.getters["futures/leaderPosition"]:a.getters["futures/openPosition"]).filter((e=>0!==e.totalContracts))})),q=M((()=>{let e="";for(const t of W.value){const{positionId:i,entryPrice:r,totalContracts:a,closeOrder:n,takeProfitOrder:o,stopLossOrder:s}=t;e+=`@position[${i}]:${a}-${r}_closeOrder:${n?`:${(null==o?void 0:o.triggerPrice)||"-"}/${(null==s?void 0:s.triggerPrice)||"-"}}`:"-"}`}return e})),X=M((()=>p.value?a.state.futures.leaderOrderTrades:a.state.futures.futureOrderTrades));function J(e,t){switch(u.value.id){case Ke.CRYPTO:return Qt(Qe(e),d.value);case Ke.USD:{const i=Yt(e,t);return Qt(i,{formatKey:"max2",postfix:` ${U.value}`})}case Ke.CONTRACTS:default:return Qt(e,0)}}function ee(e,t){return r.isFutures?J(e,t):Qt(e,{minDigits:0,maxDigits:z.value.sizeDecimal})}function te(e){b.value=e}const{isTradingViewFullScreen:ie,createFullScreenButton:re}=zd(),ae=function({options:e,widget:t,symbol:i,isEditing:r,windowIsInActive:a,onExternalConfigChange:n}){function o(){return JSON.parse(window.localStorage.getItem(e.value.chartDataKey))}function s(){try{return JSON.parse(window.sessionStorage.getItem(`${e.value.chartDataKey}${Fd}`))??{}}catch(t){return{}}}function l(t){t.key===e.value.chartDataKey&&t.oldValue!==t.newValue&&n()}return{getChartConfig:o,getConfigInterval:function(t,i){var r,a;const n=s(),o=e.value.useGlobalInterval?n.globalInterval:null==(r=n.marketIntervalMap)?void 0:r[i],l=e.value.useGlobalInterval?null==t?void 0:t.globalInterval:null==(a=null==t?void 0:t.marketIntervalMap)?void 0:a[i];return o??l??e.value.defaultInterval},captureIntervalOverride:function(r){var a;try{const n=r??(null==(a=t.value)?void 0:a.symbolInterval().interval);if(!n)return;const o=s();e.value.useGlobalInterval?o.globalInterval=n:o.marketIntervalMap={...o.marketIntervalMap??{},[i.value]:n},window.sessionStorage.setItem(`${e.value.chartDataKey}${Fd}`,JSON.stringify(o))}catch(n){}},applySavedDataInterval:function(e,t){var i;null==(i=null==e?void 0:e.charts)||i.forEach((e=>{var i;null==(i=e.panes)||i.forEach((e=>{var i;null==(i=e.sources)||i.forEach((e=>{"MainSeries"===e.type&&e.state&&(e.state.interval=t)}))}))}))},getChartOverrideSetting:function(){var t,i,r;const a=o(),{themeOptions:n,themeOverrides:s}=e.value,l=n.defaultOverride,u={...(null==(t=null==a?void 0:a.panePropertiesMap)?void 0:t[n.theme])??{}},c=null==(r=null==(i=null==a?void 0:a.panePropertiesMap)?void 0:i[n.theme])?void 0:r["paneProperties.background"];return Ed.forEach((e=>{e in u&&!Bd(u[e])&&(u[e]=l[e])})),{...l,...a?u:n.overrides,"mainSeriesProperties.minTick":"default","paneProperties.background":Bd(c)?c:l["paneProperties.background"],...s}}
1,saveChart:function(a=!1){const n=t.value&&(a||r.value);setTimeout((()=>{var r;n&&(null==(r=t.value)||r.save((r=>{const a=r,n=o(),{interval:s}=t.value.symbolInterval(),l=a.charts[0].chartProperties.paneProperties,u=l.background,c=e.value.themeOptions.theme;a.marketIntervalMap={...(null==n?void 0:n.marketIntervalMap)??{}},a.panePropertiesMap={...(null==n?void 0:n.panePropertiesMap)??{}},a.hasEnableDefaultTa=!0,e.value.useGlobalInterval?a.globalInterval=s:a.marketIntervalMap[i.value]=s,a.panePropertiesMap[c]={...a.panePropertiesMap[c],"paneProperties.vertGridProperties.color":l.vertGridProperties.color,"paneProperties.horzGridProperties.color":l.horzGridProperties.color,"paneProperties.background":u},window.localStorage.setItem(e.value.chartDataKey,JSON.stringify(a))})))}),0)},toggleChartDataChangeWatcher:function(e=!0){a.value&&e?window.addEventListener("storage",l):window.removeEventListener("storage",l)}}}({options:V,widget:v,symbol:S,isEditing:b,windowIsInActive:m,onExternalConfigChange:()=>pe()}),ne=Hd({widget:v,isFutures:r.isFutures,isLoading:y,showOrderOnChart:A,hasOpenPosition:N,validOpenPosition:W,formatQuantity:ee}),oe=Vd({widget:v,symbol:S,isFutures:r.isFutures,orderList:Z(r,"orderList"),isLoading:y,theme:I,formatQuantity:ee,translate:n,onOrderCancel:(e,t)=>r.onOrderCancel(e,t)});const se=function({widget:e,isLoading:t,loginState:i,showTradeHistoryOnChart:r,getMarks:a,translate:n,debounceMs:o}){let s=[];const l=Ne((()=>{!t.value&&i.value&&r.value&&(u(),a().forEach((t=>{const i=t.isBuy?n("t.buy"):n("t.sell"),r=e.value.activeChart().createExecutionShape().setTooltip(`@${t.fillPriceLabel} ${t.orderTypeLabel} ${i} ${t.sizeLabel}`).setArrowColor(t.isBuy?Ud.green:Ud.red).setArrowHeight(10).setDirection(t.isBuy?"buy":"sell").setTime(t.time);s.push(r)})))}),o);function u(){s.forEach((e=>e.remove())),s=[]}return{drawTradeHistoryTriangle:function(){var t;const i=null==(t=e.value)?void 0:t._iFrame;(null==i?void 0:i.contentWindow)&&l()},clearMarks:u}}({widget:v,isLoading:y,loginState:_,showTradeHistoryOnChart:R,getMarks:r.isFutures?function(){return X.value.map((e=>({fillPriceLabel:e.fillPrice?Qt(e.fillPrice):"-",orderTypeLabel:n(jt(e.orderType,e.orderDetailType)),isBuy:"MODE_BUY"===e.orderModeName,sizeLabel:J(e.orderSize,e.fillPrice),time:e.dateTime/1e3})))}:function(){return a.state.spotWsData.orderTrade.filter((e=>e.quoteCurrency===$.value)).map((e=>({fillPriceLabel:e.price?Qt(e.price):"-",orderTypeLabel:n(`t.orderType_${e.orderType.toLowerCase()}`),isBuy:"B"===e.orderMode,sizeLabel:Qt(e.amount,{minDigits:0,maxDigits:z.value.sizeDecimal}),time:e.transactionTime/1e3})))},translate:n,debounceMs:r.isFutures?1e3:300});let le;const ue=Dd({translate:n,hasSpotMarket:e=>Boolean(E.marketMap[e]),getFuturesMarket:e=>a.state.futures.marketMap[e],getMarketSymbolFromBaseCurrency:e=>E.getMarketSymbolFromBaseCurrency(e)}),ce=Ne((()=>{try{v.value?v.value.setSymbol(S.value,ae.getConfigInterval(ae.getChartConfig(),S.value),(()=>{})):setTimeout((()=>ce()),100)}catch(e){}}),300);function de(){const e=ae.getChartOverrideSetting();
1try{v.value&&v.value.applyOverrides(e),!v.value&&setTimeout(de,100)}catch(t){}}function pe(){y.value=!0,he()}const he=Ne((()=>{var e;ae.toggleChartDataChangeWatcher(!1),ae.captureIntervalOverride();try{ne.removeAllPositionLine(),null==(e=v.value)||e.remove()}catch(t){}setTimeout((()=>{f.value&&me()}),300)}),1e3);function me(){clearTimeout(le),y.value=!0;const e=ae.getChartConfig(),r=ae.getConfigInterval(e,S.value);ae.applySavedDataInterval(e,r);const{themeOptions:a,locale:n,disabledFeatures:o,enabledFeatures:s,timeFrames:l,favorites:u,studiesAccess:c,customCssUrl:d}=V.value;try{v.value=new window.TradingView.widget({symbol:S.value,interval:r,container:g,datafeed:ue,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,library_path:"/static/js/charting_library/",autosize:!0,auto_save_delay:.01,saved_data:e,locale:n,overrides:a.overrides,studies_access:c,disabled_features:o,enabled_features:s,time_frames:l,favorites:u,theme:a.theme,custom_css_url:d,loading_screen:a.loadingScreen}),le=setTimeout(he,15e3),v.value.onChartReady((()=>{const e=v.value;e&&(h.setTradingViewWidgetInstance(e),clearTimeout(le),ce(),de(),function(e){var t;if(V.value.forceAutoLogPriceScale)try{const i=null==(t=e.chart().getPanes()[0])?void 0:t.getMainSourcePriceScale();null==i||i.setMode(1),null==i||i.setAutoScale(!0)}catch(i){}}(e),y.value=!1,ae.toggleChartDataChangeWatcher(),e.subscribe("onAutoSaveNeeded",(()=>{ae.saveChart()})),e.chart().onIntervalChanged().subscribe(null,(e=>{ae.captureIntervalOverride(e)})),e.headerReady().then((()=>{P||re(e)})),e.chart().onDataLoaded().subscribe(null,(()=>{y.value=!1,ne.renderPositionView(),oe.renderOrderLine(),function(){const e=ae.getChartConfig(),r=v.value.activeChart(),a=r.getAllStudies(),n=!(1===a.length&&"Volume"===a[0].name);i||a.forEach((e=>{e.name.toLowerCase().includes("volume")&&r.removeEntity(e.id)})),n||e&&e.hasEnableDefaultTa||(t.forEach((e=>{const{name:t,forceOverlay:i=!1,lock:a=!1,inputs:n=null,overrides:o=null}=e;r.createStudy(t,i,a,n??void 0,o??void 0)})),ae.saveChart(!0))}(),se.drawTradeHistoryTriangle()})))}))}catch(p){}}return D(O,(()=>{pe()})),D(I,(()=>{pe()})),D(S,(()=>{y.value=!0,oe.resetUpdateTimestamp(),oe.removeOrderLine(),ce(),de()})),D(m,(()=>{ae.toggleChartDataChangeWatcher()})),D(q,(()=>{ne.renderPositionView()})),D(A,(()=>{ne.renderPositionView()})),D(u,(()=>{ne.renderPositionView(),oe.renderOrderLine()})),D(U,(()=>{ne.renderPositionView(),oe.renderOrderLine()})),D((()=>r.orderList),(()=>{oe.handleOrderListChange()})),D((()=>s.current),(()=>{r.orderList.length&&pe()})),D(X,(()=>{se.drawTradeHistoryTriangle()})),D((()=>a.state.spotWsData.orderTrade),(()=>{se.drawTradeHistoryTriangle()})),D(R,(e=>{e?se.drawTradeHistoryTriangle():se.clearMarks()})),D(F,(()=>{me()})),function(){if(!$t()||ud){if(gd++,hd)return clearTimeout(hd),void(hd=null);Sd()}}(),L((()=>{me(),window.addEventListener(fd,he)})),w((()=>{var e;clearTimeout(le);try{null==(e=v.value)||e.remove()}catch(t){}h.tradingViewWidgetInstance===v.value&&h.setTradingViewWidgetInstance(null),v.value=null,gd=Math.max(0,gd-1),gd>0||(hd=setTimeout((()=>{hd=null,vd.clear(),md&&clearInterval(md),pd&&clearTimeout(pd),cd&&(cd.onmessage=null,cd.onclose=null,cd.readyState===WebSocket.OPEN?cd.close(1e3):cd.onopen=()=>null==cd?void 0:cd.close(1e3))}),5e3)),ae.toggleChartDataChangeWatcher(!1),window.removeEventListener(fd,he)})),(e,t)=>{const i=H("loading");return B((o(),c("div",{id:g,ref_key:"chartEl",ref:f,class:C({fullscreen:x(ie)}),onMouseover:t[0]||(t[0]=e=>te(!0)),onMouseleave:t[1]||(t[1]=e=>te(!1))},null,34)),[[i,y.value,"streamingLight"]])}}}),[["__scopeId","data-v-b4d98325"]]),Gd={buy:{value:0},sell:{value:1}},Kd={name:"TradingViewCard",components:{TradingViewChart:qd,ActionConfirmDialog:Oo},inject:["tabsActionUpdate"],props:{isFutures:{type:Boolean,default:!1},tradeModeCallback:{type:Function,default:()=>{}},boxFilled:{type:Boolean,default:!1}},data:()=>({tradingViewLogoText:mt.tradingViewLogoText,isShowCancelConfirmDialog:!1,cancelOrderData:null}),computed:{...y(pt,["isLeaderModeActive"]),...b({lang:"lang",isTradingViewFullScreen:"isTradingViewFullScreen",isMobileChartMode:"isMobileChartMode",futuresOpenOrderList:e=>e.futures.openOrderList,futuresLeaderOrderList:e=>e.futures.leaderOrderList,spotOpenOrderList:e=>e.spotWsData.orderPending,showOrderOnChart:e=>e.userConfig.tradingBox}),...U("futures",{futuresMarketData:"marketData"}
1),...y(qe,{isSpot:"isSpot",spotMarketSymbol:"marketSymbol",currentSpotMarketSymbol:"currentMarketSymbol"}),tradingViewSymbol(){return this.isFutures?this.futuresMarketData.tradingViewSymbol:this.currentSpotMarketSymbol},futuresOrders(){return this.isLeaderModeActive?this.futuresLeaderOrderList:this.futuresOpenOrderList},orderList(){return this.showOrderOnChart?this.isFutures?this.futuresOrders:this.spotOpenOrderList:[]}},methods:{...v("trading",["beforeSpotTradingBehaviorFn"]),async cancelOrder(){try{const e=this.isFutures?this.isLeaderModeActive?Xt:Ve:Jt;await e.cancelOrder(this.cancelOrderData),this.finishCancelCallback&&this.finishCancelCallback()}catch(e){}},async onOrderCancel(e,t){if(this.isSpot){if(!(await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:Zt.CLICK_CANCEL_ICON_ON_CHART})))return}this.isShowCancelConfirmDialog=!0,this.cancelOrderData=e,this.finishCancelCallback=t},backToTradeMode(e){this.isSpot&&this.tradeModeCallback(e),Ft(!1),this.tabsActionUpdate(Gd[e]),window.history.back()}}},Qd={key:0,class:"trading-view-logo tx-align--right"},jd={key:1,style:{"padding-top":"5px"}},Yd={key:1,class:"mobile-chart-buy-sell-block"};const Zd=$n(Kd,[["render",function(e,t,i,r,u,f){const v=a("TradingViewChart"),y=a("ActionConfirmDialog");return o(),c("div",{ref:"tradingViewCard",class:C(["brand-card card-shell card-shell__header trading-view-card",{"is-mobile":e.isMobile,"box-fill":i.boxFilled}])},[e.isSpot&&u.tradingViewLogoText?(o(),c("div",Qd,m(u.tradingViewLogoText),1)):h("",!0),i.isFutures?(o(),c("div",jd)):h("",!0),l("div",{class:C(["trading-view__content card-shell__content flex-box flex-column",{fullscreen:e.isTradingViewFullScreen}])},[f.tradingViewSymbol?(o(),n(v,{key:0,class:"flex-1",isFutures:i.isFutures,symbol:f.tradingViewSymbol,orderList:f.orderList,onOrderCancel:f.onOrderCancel},null,8,["isFutures","symbol","orderList","onOrderCancel"])):h("",!0),e.isMobile?(o(),c("div",Yd,[l("div",{class:"brand-button primary-buy",onClick:t[0]||(t[0]=e=>f.backToTradeMode("buy"))},[i.isFutures?(o(),c(g,{key:0},[p(m(e.$t("futuresMain.trade.buyLong")),1)],64)):(o(),c(g,{key:1},[p(m(e.$t("t.buy")),1)],64))]),l("div",{class:"brand-button primary-sell",onClick:t[1]||(t[1]=e=>f.backToTradeMode("sell"))},[i.isFutures?(o(),c(g,{key:0},[p(m(e.$t("futuresMain.trade.sellShort")),1)],64)):(o(),c(g,{key:1},[p(m(e.$t("t.sell")),1)],64))])])):h("",!0)],2),d(y,{visible:u.isShowCancelConfirmDialog,"onUpdate:visible":t[2]||(t[2]=e=>u.isShowCancelConfirmDialog=e),confirmAction:f.cancelOrder},{message:s((()=>[p(m(e.$t("futuresMain.trade.chart.order.dialog.content")),1)])),_:1},8,["visible","confirmAction"])],2)}],["__scopeId","data-v-15616561"]]);const Xd=$n({name:"TransferIconWithTooltip",components:{IconTransfer:Hn,Tooltip:ei},props:{onTransferClick:{type:Function,default:()=>{}}}},[["render",function(e,t,i,r,l,u){const c=a("IconTransfer"),p=a("Tooltip");return o(),n(p,{tooltip:e.$t("wallets.transfer"),placement:"left",disable:e.isMobile},{content:s((()=>[d(c,{class:"transfer-icon",width:"16",height:"16",onClick:i.onTransferClick},null,8,["onClick"])])),_:1},8,["tooltip","disable"])}],["__scopeId","data-v-d919f526"]]),{disableLinkOnTrading:Jd}=mt,ep={name:"WalletStatusCard",components:{TransferIconWithTooltip:Xd},props:{boxFilled:{type:Boolean,default:!1}},data:()=>({defaultValueString:"---"}),computed:{...b({isLogin:"loginState",lang:"lang"}),...b("futures",["fixedCurrency"]),...y(Vn,["isShowGridBotForm"]),...U(["isUnifiedWallet"]),...U("futures",{wallet:"wallet",futuresMarketData:"marketData",currentSettleInCurrency:"currentSettleInCurrency",currentMargin:"currentMargin",availableBalance:"availableBalance"}),margin(){return this.currentMargin[0]||{}},isCross(){return this.margin.marginMode===ri.CROSS},walletDataReady(){return this.wallet.activeWalletName},unrealizedPnl(){return!!this.walletDataReady&&this.wallet.unrealisedProfitLoss},totalMargin(){return!!this.walletDataReady&&S(this.wallet.maintenanceMargin).plus(this.wallet.openMargin).toNumber()},quoteCurrency(){return this.currentSettleInCurrency},numberFormatConfig(){return{postfix:` ${this.quoteCurrency}`,defaultValue:this.defaultValueString}},isTransferShow(){return this.isLogin&&!Jd},assetModeText(){return"MULTIPLE"!==this.margin.assetMode||this.isShowGridBotForm?this.$t("futures.assetDetails.assetMode.singleAssetMode"):this.$t("futures.assetDetails.assetMode.multiAssetMode")},assetModeHint(){return"MULTIPLE"===this.margin.assetMode?this.$t("futures.assetDetails.assetMode.hint.multiAsset"):this.$t("futures.assetDetails.assetMode.hint.singleAsset")}},methods:{...f(Vn,["toggleTransferPopup"]),onHeightChange(){const e=this.$refs.content;if(!e)return;let t=0;for(const i of e.children)t+=i.getBoundingClientRect().height;t!==this.prevHeight&&(this.prevHeight=t,this.$emit("height",t,"wallet-status"))},openFutureTransferPopup(){this.isTransferShow&&this.toggleTransferPopup({from:ii,to:this.isUnifiedWallet?ti:this.wallet.activeWalletName})},formatNumber(e,t){return this.$filters.formatNumber(e,t)}}}
1,tp={class:"brand-card-header card-shell__header divider"},ip={class:"brand-card-title"},rp={ref:"content",class:"wallet-detial-list"},ap={class:"wallet-detail-section"},np={class:"wallet-detail-section-title-wrap"},op={class:"no-select wallet-detail-section-title"},sp={class:"section-total-value"},lp={class:"wallet-detail-section"},up={class:"wallet-detail-section-title-wrap"},cp={class:"wallet-detail-section"},dp={class:"wallet-detail-section-title-wrap"},pp={class:"wallet-status-card__content"},hp={class:"section-total-value"},mp={class:"wallet-detail-section"},gp={class:"wallet-detail-section-title-wrap"},fp={class:"wallet-status-card__content"},vp={class:"wallet-detail-section"},yp={class:"wallet-detail-section-title-wrap"},bp={key:0,class:"wallet-detail-section"},Sp={class:"wallet-detail-section-title-wrap"},Cp={class:"no-select wallet-detail-section-title"},Pp={class:"section-total-value"},kp={key:1,class:"wallet-detail-section"},Tp={class:"wallet-detail-section-title-wrap"},Mp={class:"no-select wallet-detail-section-title"},Lp={class:"section-total-value"},wp={class:"wallet-detail-section"},Dp={class:"wallet-detail-section-title-wrap"},Op={class:"wallet-status-card__content"},Ip={class:"section-total-value"},xp={class:"wallet-detail-section"},_p={class:"wallet-detail-section-title-wrap"},Ap={class:"wallet-status-card__content"},Rp={class:"wallet-detail-section"},Fp={class:"wallet-detail-section-title-wrap"},Ep={class:"no-select wallet-detail-section-title"},Bp={class:"section-total-value"};const zp=$n(ep,[["render",function(e,t,i,r,u,f){const v=a("i18n-t"),y=a("Tooltip"),b=a("TransferIconWithTooltip");return o(),c("div",{class:C(["brand-card card-shell",{"box-fill":i.boxFilled}])},[l("div",tp,[l("div",ip,m(e.$t("futuresMain.walletStatus.title")),1)]),l("div",rp,[e.isUnifiedWallet?(o(),c(g,{key:1},[l("div",vp,[l("div",yp,[d(y,{class:C(["wallet-detail-section-title",{clickable:f.isTransferShow}]),content:e.$t("futuresMain.marginBalanace.availableBalance"),prompt:!0,onClick:t[2]||(t[2]=t=>e.isLargeSize&&f.openFutureTransferPopup())},{tooltip:s((()=>[d(v,{keypath:f.isCross?"futuresMain.unifiedWallet.availableBalance.tip":"futuresMain.unifiedWallet.availableBalance.isolated.tip",tag:"span"},{br:s((()=>t[6]||(t[6]=[l("br",null,null,-1)]))),_:1},8,["keypath"])])),_:1},8,["class","content"]),l("div",{class:"avb-value-area",onClick:t[3]||(t[3]=(...e)=>f.openFutureTransferPopup&&f.openFutureTransferPopup(...e))},[l("div",{class:C(["section-total-value",{clickable:f.isTransferShow}])},m(f.formatNumber(e.availableBalance,f.numberFormatConfig)),3),f.isTransferShow?(o(),n(b,{key:0})):h("",!0)])])]),f.isCross?(o(),c("div",bp,[l("div",Sp,[l("div",Cp,m(e.$t("futures.assetDetails.crossWalletValue")),1),l("div",Pp,m(f.formatNumber(f.margin.walletTotalValue,f.numberFormatConfig)),1)])])):(o(),c("div",kp,[l("div",Tp,[l("div",Mp,m(e.$t("futuresMain.trade.market")),1),l("div",Lp,m(e.futuresMarketData.symbol),1)])])),l("div",wp,[l("div",Dp,[d(y,{class:"no-select wallet-detail-section-title"},{content:s((()=>[l("div",Op,[l("p",null,m(f.isCross?e.$t("futures.assetDetails.crossMargin"):e.$t("futures.assetDetails.isolatedMargin")),1)])])),tooltip:s((()=>[p(m(f.isCross?e.$t("futures.assetDetails.crossMargin.hint"):e.$t("futures.assetDetails.isolatedMargin.hint")),1)])),_:1}),l("div",Ip,m(f.formatNumber(f.margin.totalMargin,f.numberFormatConfig)),1)])]),l("div",xp,[l("div",_p,[d(y,{class:"no-select wallet-detail-section-title"},{content:s((()=>[l("div",Ap,[l("p",null,m(f.isCross?e.$t("futures.assetDetails.crossUnrealizedPNL"):e.$t("futures.assetDetails.isolatedUnrealizedPNL")),1)])])),tooltip:s((()=>[p(m(f.isCross?e.$t("futures.assetDetails.crossUnrealizedPNL.hint"):e.$t("futures.assetDetails.isolatedUnrealizedPNL.hint")),1)])),_:1}),l("div",{class:C(["section-total-value",{"brand-color-positive":f.margin.unrealizedPnl>0,"brand-color-negative":f.margin.unrealizedPnl<0}])},m(f.formatNumber(f.margin.unrealizedPnl,{defaultValue:u.defaultValueString,signed:!0,postfix:` ${e.fixedCurrency}`})),3)])]),l("div",Rp,[l("div",Fp,[l("div",Ep,m(e.$t("futures.assetDetails.assetMode")),1),l("div",Bp,[d(y,null,{content:s((()=>[p(m(f.assetModeText),1)])),tooltip:s((()=>[p(m(f.assetModeHint),1)])),_:1})])])])],64)):(o(),c(g,{key:0},[l("div",ap,[l("div",np,[l("div",op,m(e.$t("futuresMain.marginBalanace.walletValue")),1),l("div",sp,m(f.formatNumber(e.wallet.walletTotalValue,f.numberFormatConfig)),1)])]),l("div",lp,[l("div",up,[d(y,{class:C(["wallet-detail-section-title",{clickable:f.isTransferShow}]),content:e.$t("futuresMain.marginBalanace.availableBalance"),prompt:!0,onClick:t[0]||(t[0]=t=>e.isLargeSize&&f.openFutureTransferPopup())},{tooltip:s((()=>[d(v,{keypath:"futuresMain.marginBalanace.availableBalance.tip",tag:"span"},{br:s((()=>t[4]||(t[4]=[l("br",null,null,-1)]))),_:1})])),_:1},8,["class","content"]),l("div",{class:"avb-value-area",onClick:t[1]||(t[1]=(...e)=>f.openFutureTransferPopup&&f.openFutureTransferPopup(...e))},[l("div",{class:C(["section-total-value",{clickable:f.isTransferShow}])},m(f.formatNumber(e.wallet.availableBalance,f.numberFormatConfig)),3),f.isTransferShow?(o(),n(b,{key:0})):h("",!0)])])]),l("div",cp,[l("div",dp,[d(y,{class:"no-select wallet-detail-section-title"},{content:s((()=>[l("div",pp,[l("p",null,m(e.$t("futures.assetDetails.totalMargin")),1)])])),tooltip:s((()=>[d(v,{keypath:"futures.assetDetails.totalMargin.tooltip",tag:"span"},{br:s((()=>t[5]||(t[5]=[l("br",null,null,-1)]))),_:1})])),_:1}),l("div",hp,m(f.formatNumber(f.totalMargin,f.numberFormatConfig)),1)])]),l("div",mp,[l("div",gp,[d(y,{class:"no-select wallet-detail-section-title"},{content:s((()=>[l("div",fp,[l("p",null,m(e.$t("futuresMain.marginBalanace.unrealizedPNL")),1)])])),tooltip:s((()=>[p(m(e.$t("futuresMain.marginBalanace.unrealizedPNL.tip")),1)])),_:1}),l("div",{class:C(["section-total-value",{"brand-color-positive":f.unrealizedPnl>0,"brand-color-negative":f.unrealizedPnl<0}])},[l("span",null,m(f.formatNumber(f.unrealizedPnl,{defaultValue:u.defaultValueString,
1signed:!0})),1),f.walletDataReady?(o(),c(g,{key:0},[p(m(` ${f.quoteCurrency}`),1)],64)):h("",!0)],2)])])],64))],512)],2)}],["__scopeId","data-v-6cceae2d"]]);const $p=$n({name:"FlashingBall",props:{active:{type:Boolean,default:!1},warning:{type:Boolean,default:!1}}},[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["flashing-ball",{active:i.active,warning:i.warning}])},null,2)}],["__scopeId","data-v-1d48acd7"]]),{enableFuturesTradingBot:Np}=mt,{tradingTypeTabs:Up,futureAdvancedTradingTypeOptions:Hp}=zt,Vp={POSITIONS:"positions",ORDERS:"orders",TRADE_HISTORY:"tradeHistory",TWAP:"twap",BOT:"bot"},Wp={name:"OrderTabs",components:{FlashingBall:$p},props:{currentTab:{type:String,required:!0}},emits:["update:currentTab"],data:()=>({TAB_TYPE:Vp}),computed:{...b(["lang","accountInfo"]),...b("futures",["openPositionList","leaderPositionList","openOrderList","allOpenOrderList","allLeaderOpenOrderList","twapOrderList","futuresBotListPagination"]),...y(pt,["isLeaderMode"]),...U(["isUnifiedWallet"]),...U("futures",{currentSymbol:"symbol",marginMode:"marginMode"}),showBotTab(){return Np&&!this.isLeaderMode},isShowTwap(){return(Up.includes(ni.TWAP)||Hp.includes(ni.TWAP))&&!this.isLeaderMode},displayedPositions(){return this.isLeaderMode?this.leaderPositionList:this.openPositionList},openPositionLength(){return this.displayedPositions.length},openOrderLength(){const e=this.isLeaderMode?this.allLeaderOpenOrderList:this.allOpenOrderList;return e.length>200?"200+":e.length},twapLength(){return this.twapOrderList.length},botLength(){return this.futuresBotListPagination.totalRows}},methods:{handleClickTab(e){this.isLeaderMode&&e===Vp.TRADE_HISTORY?this.$router.push({name:ai.COPY_LEADER_TRADER_INFO,params:{lang:this.lang,id:this.accountInfo.uid},query:{tab:2}}):this.$emit("update:currentTab",e)}}},qp={class:"order-tabs"},Gp={key:0},Kp={key:0},Qp={key:0};const jp=$n(Wp,[["render",function(e,t,i,r,s,u){const d=a("FlashingBall");return o(),c("div",qp,[l("div",{class:C(["order-tab",{active:i.currentTab===s.TAB_TYPE.POSITIONS}]),onClick:t[0]||(t[0]=e=>u.handleClickTab(s.TAB_TYPE.POSITIONS))},[p(m(e.$t("order.positions"))+" ",1),u.openPositionLength?(o(),c("span",Gp,"("+m(u.openPositionLength)+")",1)):h("",!0)],2),l("div",{class:C(["order-tab",{active:i.currentTab===s.TAB_TYPE.ORDERS}]),onClick:t[1]||(t[1]=e=>u.handleClickTab(s.TAB_TYPE.ORDERS))},[p(m(e.$t("order.orders"))+" ",1),u.openOrderLength?(o(),c("span",Kp,"("+m(u.openOrderLength)+")",1)):h("",!0)],2),l("div",{class:C(["order-tab",{active:i.currentTab===s.TAB_TYPE.TRADE_HISTORY}]),onClick:t[2]||(t[2]=e=>u.handleClickTab(s.TAB_TYPE.TRADE_HISTORY))},m(e.$t("futuresMain.tradeHistory.title")),3),u.isShowTwap?(o(),c("div",{key:0,class:C(["order-tab",{active:i.currentTab===s.TAB_TYPE.TWAP}]),onClick:t[3]||(t[3]=e=>u.handleClickTab(s.TAB_TYPE.TWAP))},[p(m(e.$t("history.order.filter.type.twap"))+" ",1),u.twapLength?(o(),c("span",Qp,"("+m(u.twapLength)+")",1)):h("",!0)],2)):h("",!0),u.showBotTab?(o(),c("div",{key:1,class:C(["order-tab",{active:i.currentTab===s.TAB_TYPE.BOT}]),onClick:t[4]||(t[4]=e=>u.handleClickTab(s.TAB_TYPE.BOT))},[u.botLength?(o(),n(d,{key:0,active:!0})):h("",!0),p(" "+m(`${e.$t("t.bot")}${u.botLength?` (${u.botLength})`:""}`),1)],2)):h("",!0)])}],["__scopeId","data-v-47b561ec"]]),Yp={class:"tabs-wrap"},Zp=["onClick"],Xp={key:0};const Jp=$n({name:"OrderManagementTabSwitcher",props:{value:{type:[String,Number],required:!0},list:{type:Array,required:!0}},emits:["update:value"]},[["render",function(e,t,i,r,a,s){return o(),c("div",Yp,[(o(!0),c(g,null,R(i.list,(t=>(o(),c("div",{key:t.value,class:C(["tab",{active:i.value===t.value}]),onClick:i=>e.$emit("update:value",t.value)},[t.component?(o(),n(F(t.component),{key:0})):(o(),c(g,{key:1},[p(m(t.label)+" ",1),void 0!==t.total?(o(),c("span",Xp,"("+m(t.total)+")",1)):h("",!0)],64))],10,Zp)))),128))])}],["__scopeId","data-v-04695473"]]),eh=$n(A({__name:"CancelAllButton",props:{disabled:{type:Boolean},text:{}},emits:["click"],setup:e=>(e,t)=>{const i=a("BrandButton");return o(),n(i,{class:"cancel-all",type:"primary",size:"smallest",disabled:e.disabled,onClick:t[0]||(t[0]=t=>e.$emit("click"))},{default:s((()=>[p(m(e.text),1)])),_:1},8,["disabled"])}}),[["__scopeId","data-v-4fc6324b"]]),th={LONG:"positive-background",BUY:"positive-background",SHORT:"negative-background",SELL:"negative-background",NEUTRAL:"neutral-background"};const ih=$n({name:"FrontBar",props:{direction:{type:String,default:""}},computed:{frontBarClass(){return th[this.direction.toUpperCase()]}}},[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["front-bar",n.frontBarClass])},null,2)}],["__scopeId","data-v-c9ae29b3"]]);const rh=$n({name:"FrontBarCell",components:{FrontBar:ih}},[["render",function(e,t,i,r,l,u){const c=a("FrontBar"),p=a("Cell");return o(),n(p,{textAlign:"left",class:"front-bar-cell"},{default:s((()=>[d(c,X(J(e.$attrs)),null,16)])),_:1})}],["__scopeId","data-v-c42be1b0"]]);
1const ah=$n({name:"SymbolLink",props:{symbol:{type:String,default:""},isSpot:{type:Boolean,default:!1},disableUnderline:{type:Boolean,default:!1}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},computed:{...b(["lang"]),displayMarketName(){return this.convertToDisplaySymbol(this.symbol)},isShowUnderline(){return!this.disableUnderline&&this.symbol!==this.$route.params.id},symbolRoute(){return{name:this.isSpot?"tradingId":"futuresId",params:{lang:this.lang,id:this.symbol},state:{noScrollTop:this.isMobile}}}}},[["render",function(e,t,i,r,u,c){const d=a("RouterLink");return o(),n(d,{class:"market-link",to:c.symbolRoute},{default:s((()=>[l("span",{class:C(["symbol",{underline:c.isShowUnderline}])},m(c.displayMarketName),3)])),_:1},8,["to"])}],["__scopeId","data-v-a56cb375"]]);const nh=$n({name:"IconEditPro",components:{Icon:Ee}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"11",height:"12",viewBox:"0 0 11 12",fill:"none","aria-label":"Edit Icon"},{default:s((()=>t[0]||(t[0]=[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.93687 5.01098C8.94573 5.00261 8.9545 4.99408 8.96318 4.9854L9.65164 4.29694C10.1492 3.79938 10.1492 2.99266 9.65164 2.49509L8.27972 1.12318C8.02015 0.863606 7.67645 0.739448 7.33639 0.750701C7.02434 0.760844 6.71531 0.885011 6.47712 1.1232L2.06871 5.53161C1.8569 5.74342 1.73525 6.01125 1.70378 6.28741C1.6959 6.30454 1.68896 6.32231 1.68302 6.3407L0.654248 9.52594C0.600691 9.69176 0.641656 9.87359 0.761146 10.0004C0.880636 10.1273 1.0597 10.179 1.22841 10.1354L4.41372 9.31251C4.57175 9.27169 4.6908 9.15641 4.74301 9.01394C4.92559 8.9535 5.09721 8.85064 5.24248 8.70537L8.93687 5.01098ZM7.3673 1.70578C7.45236 1.70293 7.53834 1.73397 7.60327 1.79889L8.97519 3.17081C9.09958 3.2952 9.09958 3.49688 8.97519 3.62128L8.27417 4.3223C8.14909 4.43395 7.95707 4.42976 7.83702 4.30971L6.46511 2.93779C6.34071 2.8134 6.34071 2.61172 6.46511 2.48733L7.15357 1.79887C7.21284 1.7396 7.28966 1.70857 7.3673 1.70578ZM5.59229 3.35941C5.6458 3.4501 5.71151 3.53558 5.78941 3.61348L7.16133 4.9854C7.23897 5.06304 7.32414 5.12857 7.41449 5.18198L4.56678 8.02968C4.44239 8.15407 4.24071 8.15407 4.11632 8.02968L2.7444 6.65776C2.62001 6.53337 2.62001 6.33169 2.7444 6.2073L5.59229 3.35941ZM1.8306 8.99288L2.29384 7.55859L3.33857 8.60332L1.8306 8.99288ZM0.710656 10.4537C0.490761 10.4537 0.3125 10.632 0.3125 10.8519C0.3125 11.0718 0.49076 11.25 0.710656 11.25L9.47009 11.25C9.68998 11.25 9.86824 11.0718 9.86824 10.8519C9.86824 10.632 9.68998 10.4537 9.47009 10.4537L0.710656 10.4537Z",fill:"#31B5FF"},null,-1)]))),_:1,__:[0]})}]]);const oh=$n({name:"IconEditLite",components:{Icon:Ee}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none","aria-label":"Edit Icon"},{default:s((()=>t[0]||(t[0]=[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.319336 9.72232L0.332188 7.39819C0.332188 7.26708 0.39645 7.14789 0.486417 7.05254L5.1904 2.70224L6.91262 1.09322C7.13111 0.902521 7.46527 0.902521 7.67091 1.09322L10.1386 3.40544C10.3442 3.60805 10.3442 3.91794 10.1386 4.10864L3.71237 10.068C3.60955 10.1633 3.48103 10.211 3.33965 10.211L0.846285 10.2229C0.704908 10.2229 0.576384 10.1752 0.473565 10.0799C0.370746 9.98453 0.319336 9.85343 0.319336 9.72232ZM9.03338 3.75066L7.29831 2.14164L6.32153 3.04746L8.0566 4.65648L9.03338 3.75066ZM5.56316 3.75116L7.29824 5.36018L3.13406 9.2099L1.38613 9.22182L1.39898 7.6128L5.56316 3.75116ZM0.538829 12.0176H10.448C10.7503 12.0176 11 12.2412 11 12.5C11 12.7588 10.7634 12.9824 10.4612 12.9824H0.538829C0.249701 12.9824 0 12.7588 0 12.5C0 12.2412 0.236559 12.0176 0.538829 12.0176Z",fill:"var(--custom-icon-edit-lite-fill, #31B5FF)"},null,-1)]))),_:1,__:[0]})}]]);const sh={name:"PositionCalculator",components:{IconCalculator:$n({name:"IconCalculator",components:{Icon:Ee}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{"aria-label":"calculator",width:"18",height:"18"},{default:s((()=>t[0]||(t[0]=[l("path",{d:"M1.5 1.5L16.5 1.5L16.5 4.59L1.5 4.59L1.5 1.5Z"},null,-1),l("path",{d:"M1.5 16.5L1.5 6L16.5 6L16.5 16.5L1.5 16.5ZM7.5 15.25L10.5 15.25L10.5 13.25L7.5 13.25L7.5 15.25ZM3 15.25L6 15.25L6 13.25L3 13.25L3 15.25ZM12 15.18L15 15.18L15 10.18L12 10.18L12 15.18ZM3 12.18L6 12.18L6 10.18L3
110.18L3 12.18ZM7.5 12.18L10.5 12.18L10.5 10.18L7.5 10.18L7.5 12.18ZM12 9.25L15 9.25L15 7.25L12 7.25L12 9.25ZM7.5 9.25L10.5 9.25L10.5 7.25L7.5 7.25L7.5 9.25ZM3 9.25L6 9.25L6 7.25L3 7.25L3 9.25Z"},null,-1)]))),_:1,__:[0]})}]]),IconPlus:Ue},props:{market:{type:Object,required:!0},marketDetail:{type:Object,required:!0},markIndex:{type:Object,required:!0},position:{type:Object,required:!0}},data:()=>({COMPACT_NUMBER_THRESHOLD:1e6,defaultValueString:"---",calculatorIsOpen:!1,assumedPrice:""}),computed:{...b("futures",{assetExchangeRateMap:"assetExchangeRateMap"}),assumedPriceValid(){return""!==this.assumedPrice&&Number(this.assumedPrice)>=0},assumedUnrealizedPnlInSettleAsset(){const e=Number(this.assumedPrice);if(this.calculatorIsOpen&&this.assumedPriceValid){const t=si({formula:"unrealizedPnlInUsdt",position:this.position,market:this.market,markIndex:{price:e},marketDetail:this.marketDetail}),{settleWithNonUSDAsset:i}=this.position,r=i===this.market.baseCurrency?[[e],[1/0]]:(this.assetExchangeRateMap[i]||{}).ask||!1;return si({formula:"unrealizedPnl",unrealizedPnlInUsdt:t,assetExchangeRateMap:r})}return!1},assumedRoe(){const e=Number(this.assumedPrice);return!(!this.calculatorIsOpen||!this.assumedPriceValid)&&si({formula:"positionRoe",position:this.position,markIndex:{price:e},leverage:this.position.isolatedLeverage})},assumedUnrealizedPnlInSettleAssetValid(){return!1!==this.assumedUnrealizedPnlInSettleAsset}},watch:{assumedPrice(e,t){if(""===e)return;const i=Tt(e);(!oi(i)||i<0)&&this.$nextTick((()=>{this.assumedPrice=t}))},"position.position.closeOrder"(){this.initialAssumedPrice()}},created(){this.initialAssumedPrice()},beforeUnmount(){document.removeEventListener("click",this.onClickOutside),window.removeEventListener("resize",this.throttleUpdateCalculatorPosition),window.removeEventListener("scroll",this.throttleUpdateCalculatorPosition)},methods:{updateCalculatorPosition(){const{positionCalculator:e,calculator:t}=this.$refs;if(e&&t){const i=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.style.left=window.scrollX+i.right-r.width+"px",t.style.top=window.scrollY+i.y-r.height+"px"}},throttleUpdateCalculatorPosition:nt((function(){this.updateCalculatorPosition()}),200),onClickOutside(e){this.calculatorIsOpen&&this.$refs.positionCalculator&&!this.$refs.positionCalculator.contains(e.target)&&(this.calculatorIsOpen=!1)},initialAssumedPrice(){const e=(this.position.closeOrder?this.position.triggerPrice:this.markIndex.price)||0;this.assumedPrice=Tt(this.$filters.formatNumber(e,this.market.priceFilter))},toggleCalculator(){this.calculatorIsOpen=!this.calculatorIsOpen,this.calculatorIsOpen?(this.initialAssumedPrice(),this.$nextTick((()=>{this.updateCalculatorPosition()})),document.addEventListener("click",this.onClickOutside),window.addEventListener("resize",this.throttleUpdateCalculatorPosition),window.addEventListener("scroll",this.throttleUpdateCalculatorPosition)):(document.removeEventListener("click",this.onClickOutside),window.removeEventListener("resize",this.throttleUpdateCalculatorPosition),window.removeEventListener("scroll",this.throttleUpdateCalculatorPosition))}}},lh={class:"calculator-header"},uh={class:"calculator-price-cell"},ch={key:1,class:"calculator-roe-cell"},dh={class:"calculator-content"},ph={key:0,class:"calculator-roe-cell"},hh={class:"calculator-roe-cell"};function mh({isClose:e=T(!1),symbol:t=T("")}={}){const i=k(),r=pt(),a=M((()=>i.getters["futures/symbol"])),n=M((()=>t.value||a.value||"")),o=M((()=>i.state.futures.openPositionMap)),s=M((()=>i.state.futures.leaderPositionMap)),l=M((()=>r.isLeaderModeActive?s.value[n.value]||[]:o.value[n.value]||[])),u=M((()=>l.value.some((e=>0!==e.totalContracts)))),c=M((()=>i.getters["futures/isRiskLimitExceedLimitMap"])),d=M((()=>i.getters["futures/isLeaderRiskLimitExceedLimitMap"])),p=M((()=>r.isLeaderModeActive?d.value[n.value]:c.value[n.value])),h=M((()=>i.state.futures.marketPositionMap)),m=M((()=>i.state.futures.leaderMarketPositionMap)),g=M((()=>(r.isLeaderModeActive?m.value:h.value)[n.value]||{})),f=M((()=>g.value.positionMode===li.ONE_WAY));return{isBuyExceedLimit:M((()=>f.value?u.value&&p.value&&l.value[0].orderModeName===xt.BUY:p.value&&!e.value)),isSellExceedLimit:M((()=>f.value?u.value&&p.value&&l.value[0].orderModeName===xt.SELL:p.value&&!e.value)),showRiskLimitDialog:function(){i.commit("futures/setRiskLimitPopupTrigger",{symbol:n.value})}}}const gh={LIMIT:"Limit",MARKET:"Market",REVERSE:"Reverse"},fh={name:"ClosePosition",components:{PositionCalculator:$n(sh,[["render",function(e,t,i,r,s,u){const h=a("IconCalculator"),f=a("IconPlus");return o(),c("div",{ref:"positionCalculator",class:C(["icon-calculator-button",{"is-open":s.calculatorIsOpen}]),onClick:t[3]||(t[3]=(...e)=>u.toggleCalculator&&u.toggleCalculator(...e))},[d(h,{class:"icon-calculator"}),(o(),n(ee,{to:"body",disabled:!s.calculatorIsOpen},[B(l("div",{ref:"calculator",class:C(["calculator",{"mobile-mode":e.isMobile}]),onClick:t[2]||(t[2]=E((()=>{}),["stop"]))},[d(f,{"aria-label":"close popup button",class:"icon-close","stroke-width":"2",onClick:u.toggleCalculator},null,8,["onClick"]),l("div",lh,[l("div",uh,m(e.$t("t.price")),1),e.isMobile?B((o(),c("input",{key:0,"onUpdate:modelValue":t[0]||(t[0]=e=>s.assumedPrice=e),class:"calculator-price-cell calculator-price-cell-input",maxlength:10},null,512)),[[z,s.assumedPrice]]):(o(),c("div",ch,m(e.$t("futuresMain.openPosition.unrealizedPNL")),1))]),l("div",dh,[e.isMobile?(o(),c("div",ph,m(e.$t("futuresMain.openPosition.unrealizedPNL")),1)):B((o(),c("input",{key:1,"onUpdate:modelValue":t[1]||(t[1]=e=>s.assumedPrice=e),class:"calculator-price-cell calculator-price-cell-input",maxlength:10},null,512)),[[z,s.assumedPrice]]),l("div",hh,[u.assumedUnrealizedPnlInSettleAssetValid?(o(),c("span",{key:0,class:C({"brand-color-positive":u.assumedUnrealizedPnlInSettleAsset>0,"brand-color-negative":u.assumedUnrealizedPnlInSettleAsset<0})},m(e.$filters.formatNumber(u.assumedUnrealizedPnlInSettleAsset,{formatKey:i.position.unrealizedPnlFilter,accounting:!0,compact:Math.abs(u.assumedUnrealizedPnlInSettleAsset)>
1=s.COMPACT_NUMBER_THRESHOLD})),3)):(o(),c(g,{key:1},[p(m(s.defaultValueString),1)],64)),p(" "+m(i.position.settleWithNonUSDAsset)+" ",1),l("span",{class:C({"brand-color-positive":u.assumedUnrealizedPnlInSettleAsset>0,"brand-color-negative":u.assumedUnrealizedPnlInSettleAsset<0})}," ("+m(e.$filters.formatNumber(u.assumedRoe,{postfix:" %",defaultValue:s.defaultValueString,compact:Math.abs(u.assumedRoe)>=s.COMPACT_NUMBER_THRESHOLD}))+") ",3)])])],2),[[N,s.calculatorIsOpen]])],8,["disabled"]))],2)}],["__scopeId","data-v-2f1daadd"]]),TradingInput:Wn},props:{position:{type:Object,required:!0},isProMode:{type:Boolean,default:!1},isSmallSize:{type:Boolean,default:!1},currentHoverRow:{type:String,default:""}},emits:["clickClosePosition"],setup(e){const{isBuyExceedLimit:t,isSellExceedLimit:i,showRiskLimitDialog:r}=mh({symbol:Z((()=>{var t;return null==(t=e.position)?void 0:t.symbol}))});return{isBuyExceedLimit:t,isSellExceedLimit:i,showRiskLimitDialog:r}},data:()=>({CloseType:gh,limitClosePrice:""}),computed:{...b("futures",{futuresMarkPriceMap:"futuresMarkPriceMap",futuresMarketMap:"marketMap",futuresMarketDetailMap:"marketDetailMap",openOrderList:"openOrderList"}),...U("futures",{futuresMarketData:"marketData"}),symbol(){var e;return null==(e=this.position)?void 0:e.symbol},market(){return this.futuresMarketMap[this.symbol]||{}},marketDetail(){return this.futuresMarketDetailMap[this.symbol]||{}},markIndex(){return{price:this.futuresMarkPriceMap[this.symbol]||0}},disableLimitOrderButton(){return!this.isSmallSize&&!Number(this.limitClosePrice)},isExceedLimit(){return this.isBuyExceedLimit||this.isSellExceedLimit}},watch:{symbol(){this.limitClosePrice=""},limitClosePrice(e,t){if(""===e)return;const i=Tt(e);!oi(i)||i<0?this.$nextTick((()=>{this.limitClosePrice=t})):this.$nextTick((()=>{this.limitClosePrice=e.replaceAll(",","")}))}},methods:{handleReverse(){this.isExceedLimit?this.showRiskLimitDialog():this.$emit("clickClosePosition",gh.REVERSE,this.position)}}},vh={class:"calculator-wrap"};const yh=$n(fh,[["render",function(e,t,i,r,n,u){const f=a("PositionCalculator"),v=a("TradingInput"),y=a("BaseButton"),b=a("Tooltip");return o(),c("div",{class:C(["close-position",{"pro-mode":i.isProMode,"small-size":i.isSmallSize,hover:i.currentHoverRow===i.position.positionId}])},[i.isSmallSize?h("",!0):(o(),c(g,{key:0},[l("div",vh,[d(f,{market:u.market,marketDetail:u.marketDetail,markIndex:u.markIndex,position:i.position},null,8,["market","marketDetail","markIndex","position"])]),d(v,{value:n.limitClosePrice,"onUpdate:value":t[0]||(t[0]=e=>n.limitClosePrice=e),class:C(["limit-close-price-input",{lite:!i.isProMode}]),enableThousandSeparator:"",placeholder:i.isProMode?e.$t("futuresMain.closePosition.closePrice"):e.$t("t.price"),step:Number(u.marketDetail.minPriceIncrement),enableCountBtn:i.isProMode||null},null,8,["value","class","placeholder","step","enableCountBtn"])],64)),d(y,{class:C(["close-btn primary extra-small",{disabled:u.disableLimitOrderButton}]),onClick:t[1]||(t[1]=t=>!u.disableLimitOrderButton&&e.$emit("clickClosePosition",n.CloseType.LIMIT,i.position,n.limitClosePrice))},{default:s((()=>[p(m(e.$t("futuresMain.trade.limit")),1)])),_:1},8,["class"]),d(y,{class:"close-btn primary extra-small",onClick:t[2]||(t[2]=t=>e.$emit("clickClosePosition",n.CloseType.MARKET,i.position))},{default:s((()=>[p(m(e.$t("futuresMain.trade.market")),1)])),_:1}),d(b,{tooltip:u.isExceedLimit?e.$t("futures.riskLimit.errorMessage.needAdjust",{market:u.symbol}):e.$t("reversePosition.tooltip"),class:"reverse-tooltip-wrap"},{content:s((()=>[d(y,{class:"close-btn primary extra-small w-100",onClick:u.handleReverse},{default:s((()=>[p(m(e.$t("t.reverse")),1)])),_:1},8,["onClick"])])),_:1},8,["tooltip"])],2)}],["__scopeId","data-v-e19bb649"]]),bh={name:"TpSlPriceWithTooltip",props:{tpOrder:{type:Object,default:()=>({})},slOrder:{type:Object,default:()=>({})},isLong:{type:Boolean,default:!1},entryPrice:{type:Number,default:0},priceFilter:{type:Number,default:2},isPosition:{type:Boolean,default:!1}},computed:{hasTpSlSetting(){return this.hasTpPrice||this.hasSlPrice},hasTpPrice(){return!!this.tpPrice},hasSlPrice(){return!!this.slPrice},tpPrice(){var e;return null==(e=this.tpOrder)?void 0:e.triggerPrice},slPrice(){var e;return null==(e=this.slOrder)?void 0:e.triggerPrice},tpPriceType(){return this.tpOrder.triggerUseLastPrice?this.$t("trading.last"):this.$t("trading.mark")},slPriceType(){return this.slOrder.triggerUseLastPrice?this.$t("trading.last"):this.$t("trading.mark")},tpPriceClass(){return this.isPosition?this.getPositionPriceClass(this.tpPrice):"brand-color-positive"},slPriceClass(){return this.isPosition?this.getPositionPriceClass(this.slPrice):"brand-color-negative"}},methods:{getPositionPriceClass(e){return{"brand-color-positive":this.isLong&&e>this.entryPrice||!this.isLong&&e<this.entryPrice,"brand-color-negative":this.isLong&&e<this.entryPrice||!this.isLong&&e>this.entryPrice}}}},Sh={key:1},Ch={key:3},Ph={class:"tp-sl-tooltip-wrap"},kh={class:"tp-wrap"},Th={class:"header"},Mh={class:"content"},Lh={key:1},wh={class:"sl-wrap"},Dh={class:"header"},Oh={class:"content"},Ih={key:1},xh={class:"qty-wrap"},_h={class:"header"},Ah={class:"content qty"};const Rh=$n(bh,[["render",function(e,t,i,r,u,d){const h=a("ToolTip");return o(),n(h,{hasCursorQuestion:!1,tooltipStyle:{"max-width":"300
1px"},disable:!d.hasTpSlSetting},{content:s((()=>[d.hasTpPrice?(o(),c("span",{key:0,class:C(d.tpPriceClass)},m(e.$filters.formatNumber(d.tpPrice,i.priceFilter)),3)):(o(),c("span",Sh,"-")),t[0]||(t[0]=l("span",{class:"slash"},"Â /Â ",-1)),d.hasSlPrice?(o(),c("span",{key:2,class:C(d.slPriceClass)},m(e.$filters.formatNumber(d.slPrice,i.priceFilter)),3)):(o(),c("span",Ch,"-"))])),tooltip:s((()=>[l("div",Ph,[l("div",kh,[l("div",Th,m(e.$t("trading.stop-take-profit.takeProfit")),1),l("div",Mh,[d.hasTpPrice?(o(),c("div",{key:0,class:C(d.tpPriceClass)},[l("span",null,m(e.$filters.formatNumber(d.tpPrice,i.priceFilter)),1),t[1]||(t[1]=l("br",null,null,-1)),p(" ("+m(d.tpPriceType)+") ",1)],2)):(o(),c("span",Lh,"-"))])]),t[3]||(t[3]=l("div",{class:"divider"},null,-1)),l("div",wh,[l("div",Dh,m(e.$t("tpsl.sl")),1),l("div",Oh,[d.hasSlPrice?(o(),c("div",{key:0,class:C(d.slPriceClass)},[l("span",null,m(e.$filters.formatNumber(d.slPrice,i.priceFilter)),1),t[2]||(t[2]=l("br",null,null,-1)),p(" ("+m(d.slPriceType)+") ",1)],2)):(o(),c("span",Ih,"-"))])]),t[4]||(t[4]=l("div",{class:"divider"},null,-1)),l("div",xh,[l("div",_h,m(e.$t("t.qty")),1),l("div",Ah,m(e.$t("tpsl.entirePosition")),1)])])])),_:1},8,["disable"])}],["__scopeId","data-v-80e0f1c3"]]);const Fh=$n({name:"IconAddCircle",components:{Icon:Ee},emits:["click"]},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"37",height:"37",onClick:t[0]||(t[0]=t=>e.$emit("click",t))},{default:s((()=>t[1]||(t[1]=[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.94 3.5c8.284 0 15 6.716 15 15 0 8.284-6.716 15-15 15-8.285 0-15-6.716-15-15 0-8.284 6.715-15 15-15Zm0 1.875c-7.25 0-13.126 5.876-13.126 13.125s5.877 13.125 13.125 13.125c7.25 0 13.126-5.876 13.126-13.125S26.188 5.375 18.94 5.375Zm0 23.21a.938.938 0 0 1-.938-.937v-8.21h-7.39a.937.937 0 0 1 0-1.875h7.39v-6.79a.937.937 0 1 1 1.875 0v6.79h7.61a.937.937 0 1 1 0 1.875h-7.61v8.21c0 .518-.42.937-.938.937Z"},null,-1)]))),_:1,__:[1]})}]]),Eh={name:"OptionsBoard",props:{show:{type:Boolean,default:!1},triggerIndex:{type:Number,required:!0}},emits:["update:show","change"],data:()=>({activeIndex:0}),computed:{optionList(){return[{text:this.$t("t.roe")+"%",value:"roe",description:this.$t("tpsl.triggerBy.note1")},{text:this.$t("tpsl.triggerBy.priceChange"),value:"change",description:this.$t("tpsl.triggerBy.note2")},{text:this.$t("t.pnl"),value:"pnl",description:this.$t("tpsl.triggerBy.note3")}]}},watch:{show:{immediate:!0,handler(e){e&&(this.activeIndex=this.triggerIndex)}}},methods:{goBack(){this.$emit("update:show",!1)},clickOption(e){this.activeIndex=e,this.$emit("change",this.activeIndex),this.goBack()}}},Bh={class:"options-board-content"},zh={class:"options-wrapper"},$h=["onClick"],Nh={class:"option-title"},Uh={class:"option-description"};const Hh=$n(Eh,[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["options-board",{active:i.show}])},[t[3]||(t[3]=l("div",{class:"options-board-background"},null,-1)),l("div",Bh,[l("div",null,[l("span",{class:"cursor-pointer",onClick:t[0]||(t[0]=(...e)=>n.goBack&&n.goBack(...e))},[t[1]||(t[1]=l("i",{class:"el-icon-arrow-left"},null,-1)),p(" "+m(e.$t("t.back")),1)])]),t[2]||(t[2]=l("div",{class:"line"},null,-1)),l("div",zh,[(o(!0),c(g,null,R(n.optionList,((t,i)=>(o(),c("div",{key:t.value,class:C(["option",{active:a.activeIndex===i}]),onClick:e=>n.clickOption(i)},[l("p",Nh,m(e.$t("tpsl.triggerBy"))+" "+m(t.text),1),l("p",Uh,m(t.description),1)],10,$h)))),128))])])],2)}],["__scopeId","data-v-af0c9987"]]),Vh={name:"PercentSlider",props:{maxPercent:{type:[String,Number],default:100},markGap:{type:[String,Number],default:25},value:{type:[String,Number],default:0},showPercentageSign:{type:Boolean,default:!1}},emits:["change"],data(){return{railStyle:{backgroundColor:"var(--app--color--blue-grey-darker--o-3)"},processStyle:{backgroundColor:"var(--app--color--primary-light)"},marks:e=>e%this.markGap===0}},methods:{handleClick(e){this.$emit("change",e)}}},Wh={class:"percent-slider-content"},qh=["onClick"],Gh=["onClick"];const Kh=$n(Vh,[["render",function(e,t,i,r,n,u){const p=a("VueSlider");return o(),c("div",Wh,[d(p,{ref:"slider",modelValue:i.value,dragOnClick:!1,marks:n.marks,railStyle:n.railStyle,height:4,processStyle:n.processStyle,dotSize:16,max:i.maxPercent,tooltip:"none",onChange:t[0]||(t[0]=e=>u.handleClick(e))},{dot:s((()=>t[1]||(t[1]=[l("div",{class:"border-box custom-dot"},null,-1)]))),step:s((({active:e,value:t})=>[l("div",{class:C(["custom-step",{active:e}]),onClick:e=>u.handleClick(t)},null,10,qh)])),label:s((({label:e,value:t})=>[l("span",{class:"custom-label",onClick:E((e=>u.handleClick(t)),["stop"])},m(`${e}${i.showPercentageSign?"%":""}`),9,Gh)])),_:1},8,["modelValue","marks","railStyle","processStyle","max"])])}],["__scopeId","data-v-9e95daea"]]),Qh=[{id:"ROE",getLabel:e=>`${e("t.roe")}%`},{id:"CHANGE",getLabel:e=>`%${e("t.change")}`},{id:"PNL",getLabel:e=>e("t.pnl")}];function jh(e,t,i=0,r=0,a=5e-4,n=!0){try{const o=S(e),s=S(t),l=S(a),u=S(i),c=S(n?1:-1),d=o.minus(s).abs().times(u),p=u.times(o).times(l);return c.times(d).minus(p).dp(r,S.ROUND_HALF_UP).toNumber()}catch{return""}}function Yh(e,t,i,r,a,n=!0){const o=S(i),s=S(r),l=S(a);try{return n?o.div(e>t?s:l).times(100).dp(2,S.ROUND_HALF_UP).toNumber():o.div(e<t?s:l).times(100).dp(2,S.ROUND_HALF_UP).toNumber()}catch{return""}}function Zh(e,t,i,r){return S(e).minus(t).times(i).div(t).times(100).times(r?1:-1).dp(2,S.ROUND_HALF_UP).toNumber()}function Xh(e,t,i=0,r=5e-4,a,n,o=0,s=0,l=!0,u=!0,c,d){if(0===o)try{if
1(c)return function(e,t,i,r=0,a=!0,n=!0){try{const o=S(e).div(100);return n?a?o.times(t).div(i).plus(t).dp(r,S.ROUND_HALF_UP).toNumber():S(-1).times(o).times(t).div(i).plus(t).dp(r,S.ROUND_DOWN).toNumber():a?o.times(t).div(i).plus(t).dp(r,S.ROUND_HALF_UP).toNumber():o.abs().times(t).div(i).plus(t).dp(r,S.ROUND_DOWN).toNumber()}catch{return""}}(e,t,d,s,l,u);const o=S(l?a:n).times(e).div(100),p=S(u?1:-1).times(i).times(t),h=S(1).minus(r);let m;if(l){const e=S(i).times(h);m=u?o.plus(p).div(e):o.minus(p).div(e)}else{const e=S(-1).times(i).times(h);m=u?o.minus(p).div(e):o.plus(p).div(e)}return m.dp(s,S.ROUND_HALF_UP).toNumber()}catch{return""}if(1===o)try{const i=S(e).div(100).plus(1);return S(t).times(i).dp(s,S.ROUND_HALF_UP).toNumber()}catch{return""}if(2===o)try{const a=l?S(1).minus(r):S(1).plus(r),n=l?S(e):S(-1).times(e);return S(t).times(i).plus(n).div(i).times(a).dp(s,S.ROUND_HALF_UP).toNumber()}catch{return""}}const Jh={name:"FuturesChoose",props:{form:{type:[String,Object],default:""},items:{type:Array,default:()=>[]},returnObject:{type:Boolean,default:!1},tooltipPlacement:{type:String,default:"top-start"}},emits:["update:form"],data:()=>({showMenu:!1}),computed:{selected(){return this.form?this.items.find((e=>e.id===(this.returnObject?this.form.id:this.form))):null},isLocked(){return this.items.length<=1&&!!this.selected},selectedDisplayText(){return this.selected?this.selected.isI18nKey?this.$t(this.selected.lang):this.selected.lang:""}},watch:{showMenu(e){e&&this.$nextTick((()=>{const e=this.$refs.selectItems;if(e.scrollHeight>e.clientHeight){const e=this.$el.querySelector(".is-current-item");e&&e.scrollIntoView({block:"center"})}}))}},created:function(){window.addEventListener("click",this.closeMenu)},beforeUnmount(){window.removeEventListener("click",this.closeMenu)},methods:{isCurrent(e){var t;return e.id===(null==(t=this.selected)?void 0:t.id)},closeMenu(e){this.$refs.limitDropdown.contains(e.target)||(this.showMenu=!1)},toggleMenu(){this.isLocked||(this.showMenu=!this.showMenu)},select(e){this.isCurrent(e)||this.$emit("update:form",this.returnObject?e:e.id),this.showMenu=!1}}},em={class:"future-choose-text"},tm={key:0},im={class:"el-icon-arrow-up"},rm={class:"el-icon-arrow-down"},am={key:0,ref:"selectItems",class:"border-box select-items"},nm=["onClick"];const om=$n(Jh,[["render",function(e,t,i,r,n,u){var p,f;const v=a("ToolTip");return o(),c("div",{ref:"limitDropdown",class:C(["border-box select-container no-select",{"is-locked":u.isLocked}])},[l("div",{class:"border-box inline-flex current-item",onClick:t[0]||(t[0]=(...e)=>u.toggleMenu&&u.toggleMenu(...e))},[d(v,{class:"flex-grow-1",tooltip:null==(p=u.selected)?void 0:p.tooltip,disable:!(null==(f=u.selected)?void 0:f.tooltip),placement:i.tooltipPlacement},{content:s((()=>[l("span",em,m(u.selectedDisplayText),1)])),_:1},8,["tooltip","disable","placement"]),u.isLocked?h("",!0):(o(),c("span",tm,[B(l("i",im,null,512),[[N,n.showMenu]]),B(l("i",rm,null,512),[[N,!n.showMenu]])]))]),n.showMenu?(o(),c("div",am,[(o(!0),c(g,null,R(i.items,(t=>(o(),c("div",{key:t.id,class:C(["item",{"is-current-item":u.isCurrent(t)}]),onClick:e=>u.select(t)},m(t.isI18nKey?e.$t(t.fullName||t.lang):t.fullName||t.lang),11,nm)))),128))],512)):h("",!0)],2)}],["__scopeId","data-v-68ce647e"]]),sm={MARK:{id:1,isI18nKey:!0,lang:"trading.mark",fullName:"spot.order.market.markPrice",payloadName:"markPrice"},LAST:{id:2,isI18nKey:!0,lang:"trading.last",fullName:"spot.order.market.lastPrice",payloadName:"lastPrice"}},lm=e=>e!==ui.MARK_PRICE&&zt.enableLastPriceDependentUI?sm.LAST:sm.MARK;const um=$n({name:"FuturesMarkLastSelect",components:{FuturesChoose:om},props:{value:{type:Object,required:!0}},emits:["update:value"],computed:{types:()=>zt.enableLastPriceDependentUI?Object.values(sm):[sm.MARK]},methods:{setType(e){this.$emit("update:value",e)}}},[["render",function(e,t,i,r,s,l){const u=a("FuturesChoose");return o(),n(u,{class:"select-wrapper",items:l.types,form:i.value,returnObject:"","onUpdate:form":l.setType},null,8,["items","form","onUpdate:form"])}],["__scopeId","data-v-d356d460"]]),cm={name:"TriggerBlock",components:{PercentSlider:Kh,TradingInput:Wn,FuturesMarkLastSelect:um,IconQuestionCircle2:qn}
1,props:{symbol:{type:String,required:!0},isFromPosition:{type:Boolean,required:!0},type:{type:String,required:!0},title:{type:String,required:!0},tpslPrice:{type:[String,Number],required:!0},trigger:{type:Object,required:!0},triggerIndex:{type:Number,required:!0},percentData:{type:Object,required:!0},orderPrice:{type:[String,Number],default:"0"},orderSize:{type:[String,Number],required:!0},side:{type:Number,required:!0},part1FormulaResultBuy:{type:Number,required:!0},part1FormulaResultSell:{type:Number,required:!0},errorMsg:{type:String,default:""},leverage:{type:Number,default:1},tooltipIconMsg:{type:String,default:""},warningMsg:{type:String,default:""}},emits:["update:tpslPrice","update:trigger","clickTriggerText"],setup:()=>({takerFee:ci().takerFee}),data(){return{FUTURES_BASE_CURRENCY:ht,triggerPrice:this.tpslPrice,triggerPercent:"",sliderPercent:"",isSlSignFlag:!1}},computed:{...b("futures",["marketDetailMap"]),marketDetail(){return this.marketDetailMap[this.symbol]},priceFilter(){var e;return(null==(e=this.marketDetail)?void 0:e.priceFilter)??2},isLong(){return this.side===Gt.BUY},isTakeProfit(){return"TAKE_PROFIT"===this.type},triggerText(){const e=Qh[this.triggerIndex];return e?e.getLabel((e=>this.$t(e))):this.triggerIndex},showHint(){return""!==this.triggerPrice&&""!==this.triggerPercent},mlPrice(){return this.$t(this.trigger.fullName).toLowerCase()},resultA(){return this.isFromPosition?function(e,t,i=0,r=0,a=5e-4,n=!0){try{const o=S(e),s=S(t),l=S(a),u=S(i),c=S(n?1:-1),d=o.minus(s).times(c).times(u),p=u.times(o).times(l);return d.minus(p).dp(r,S.ROUND_HALF_UP).toNumber()}catch{return""}}(Number(this.triggerPrice),Number(this.orderPrice),Number(this.orderSize),this.priceFilter,this.takerFee,this.isLong):jh(Number(this.triggerPrice),Number(this.orderPrice),Number(this.orderSize),this.priceFilter,this.takerFee,this.isTakeProfit)},errorShown(){return""!==this.errorMsg},warningShown(){return""!==this.warningMsg},displayRoe(){return 0===this.triggerIndex?this.triggerPercent:this.isFromPosition?Zh(Number(this.triggerPrice),Number(this.orderPrice),this.leverage,this.isLong):Yh(Number(this.triggerPrice),Number(this.orderPrice),this.resultA,this.part1FormulaResultBuy,this.part1FormulaResultSell,this.isTakeProfit)}},watch:{isLong(){this.clearPercent()},triggerIndex(){this.clearPercent()},triggerPercent(e){this.isSlSignFlag?this.isSlSignFlag=!1:this.triggerPercent=this.checkPercentPlusOrMinus(e)},triggerPrice(e){this.$emit("update:tpslPrice",e)}},mounted(){this.triggerPrice&&this.transferToPercent(this.triggerPrice)},methods:{clearPercent(){this.triggerPercent="",this.sliderPercent=""},onSliderChange(e){this.sliderPercent=e,this.triggerPercent=e,this.transferToPrice(e)},transferToPercent(e){!this.isTakeProfit&&this.isFromPosition&&(this.isSlSignFlag=!0),this.triggerPercent=function(e,t,i,r,a,n=0,o=!0,s,l){if(!e)return"";if(0===n)try{return s?Zh(e,t,l,o):S(i).div(o?r:a).times(100).dp(2,S.ROUND_HALF_UP).toNumber()}catch{return""}if(1===n)try{const i=S(e),r=S(t);return i.minus(r).div(r).times(100).dp(2,S.ROUND_HALF_UP).toNumber()}catch{return""}return 3===n?i:void 0}(Number(e),Number(this.orderPrice),this.resultA,this.part1FormulaResultBuy,this.part1FormulaResultSell,this.triggerIndex,this.isLong,this.isFromPosition,this.leverage),this.syncSliderPercent(this.triggerPercent)},checkPercentPlusOrMinus(e){if(1!==this.triggerIndex){if(!this.isTakeProfit&&e>0)return-1*e}else if((this.isLong&&!this.isTakeProfit||!this.isLong&&this.isTakeProfit)&&e>0)return-1*e;return e},transferToPrice(e){if(this.syncSliderPercent(e),""===e)return void(this.triggerPrice="");let t=this.checkPercentPlusOrMinus(e);const i=Xh(Number(t),Number(this.orderPrice),Number(this.orderSize),this.takerFee,this.part1FormulaResultBuy,this.part1FormulaResultSell,this.triggerIndex,this.priceFilter,this.isLong,this.isTakeProfit,this.isFromPosition,this.leverage);this.triggerPrice=i>=0?i:0},syncSliderPercent(e){Number.isNaN(e)||(this.sliderPercent=Math.abs(e)>this.percentData.percent?this.percentData.percent:e)},hintColorClass(e){return this.isFromPosition?e>=0?"color-green":"color-red":this.isTakeProfit?"color-green":"color-red"}}},dm={class:"block"},pm={class:"block-title"},hm={class:"flex-1"},mm={class:"weight-400"},gm={class:"weight-400"},fm={class:"white weight-400"},vm={key:0,class:"hint warning"},ym={key:2,class:"hint error"};const bm={TAKE_PROFIT:"TAKE_PROFIT",STOP_LOSS:"STOP_LOSS"},Sm={name:"TpslAdvancedDialog",components:{BrandDialog:pi,BaseButton:di,OptionsBoard:Hh,TriggerBlock:$n(cm,[["render",function(e,t,i,r,u,g){const f=a("IconQuestionCircle2"),v=a("Tooltip"),y=a("FuturesMarkLastSelect"),b=a("TradingInput"),S=a("PercentSlider"),P=a("i18n-t");return o(),c("div",dm,[l("div",pm,[l("div",hm,[p(m(i.title)+"-"+m(e.$t("tpsl.triggerBy"))+" ",1),l("span",{class:"white cursor-pointer",onClick:t[0]||(t[0]=t=>e.$emit("clickTriggerText"))},[p(m(g.triggerText)+" ",1),t[4]||(t[4]=l("i",{class:"el-icon-arrow-down"},null,-1))])]),i.tooltipIconMsg?(o(),n(v,{key:0,tooltip:i.tooltipIconMsg},{content:s((()=>[d(f,{class:"icon-tips"})])),_:1},8,["tooltip"])):h("",!0)]),l("div",{class:C(["block-input-content",{mobile:e.isMobile}])},[d(b,{value:u.triggerPrice,"onUpdate:value":t[2]||(t[2]=e=>u.triggerPrice=e),class:"flex-4",label:"triggerPrice",type:"number",enableThousandSeparator:"",step:Number(g.marketDetail.minPriceIncrement),min:Number(g.marketDetail.minValidPrice),errorShown:g.errorShown,onInput:g.transferToPercent},{prepend:s((()=>[l("span",mm,m(e.$t("trading.stop-take-profit.triggerPrice")),1)])),append:s((()=>[d(y,{value:i.trigger,"onUpdate:value":t[1]||(t[1]=t=>e.$emit("update:trigger",t))},null,8,["value"])])),_:1},8,["value","step","min","errorShown","onInput"]),d(b,{value:u.triggerPercent,"onUpdate:value":t[3]||(t[3]=e=>u.triggerPercent=e),class:"flex-2",label:"triggerPercent",type:"number",enableThousandSeparator:2===i.triggerIndex,placeholder:g.triggerText,max:i.percentData.max,min:i.percentData.min,step:.
101,maxDecimalPlaces:2,onInput:g.transferToPrice},te({append:s((()=>[l("span",fm,m(2===i.triggerIndex?"USDT":"%"),1)])),_:2},[e.isMobile?{name:"prepend",fn:s((()=>[l("span",gm,m(g.triggerText),1)])),key:"0"}:void 0]),1032,["value","enableThousandSeparator","placeholder","max","min","onInput"])],2),g.warningShown?(o(),c("p",vm,m(i.warningMsg),1)):h("",!0),2!==i.triggerIndex?(o(),n(S,{key:1,maxPercent:i.percentData.percent,markGap:i.percentData.gap,value:Math.abs(Number(u.sliderPercent)),onChange:g.onSliderChange},null,8,["maxPercent","markGap","value","onChange"])):h("",!0),g.errorShown?(o(),c("p",ym,m(i.errorMsg),1)):h("",!0),g.showHint?(o(),n(P,{key:3,keypath:"tpsl.advanced.note",tag:"p",class:"hint"},{currency:s((()=>[p(m(u.FUTURES_BASE_CURRENCY),1)])),mlPrice:s((()=>[p(m(g.mlPrice),1)])),price:s((()=>[p(m(u.triggerPrice),1)])),estimatedPnl:s((()=>[d(v,{tooltip:e.$t("tpsl.estimated.pnl.tooltip")},{content:s((()=>[d(P,{keypath:g.isTakeProfit?"tpsl.advanced.note.estimated.profit":"tpsl.advanced.note.estimated.loss"},{currency:s((()=>[p(m(u.FUTURES_BASE_CURRENCY),1)])),resultA:s((()=>[l("span",{class:C(g.hintColorClass(g.resultA))},m(g.resultA),3)])),resultB:s((()=>[l("span",{class:C(g.hintColorClass(g.displayRoe))},m(g.displayRoe||0)+"% ",3)])),_:1},8,["keypath"])])),_:1},8,["tooltip"])])),_:1})):h("",!0)])}],["__scopeId","data-v-1f22a4af"]])},props:{show:{type:Boolean,default:!1},symbol:{type:String,required:!0},orderPrice:{type:[String,Number],default:"0"},orderSize:{type:[String,Number],required:!0},tpPrice:{type:[String,Number],default:""},tpTrigger:{type:Object,required:!0},slPrice:{type:[String,Number],default:""},slTrigger:{type:Object,required:!0},formPrice:{type:Number,default:0},buyQty:{type:Number,default:0},sellQty:{type:Number,default:0},priceError:{type:String,default:""},lockType:{type:Number,default:-1},isCurrentMarket:{type:Boolean,default:!1},position:{type:Object,default:()=>({})},defaultSide:{type:String,default:""}},emits:["update:show","confirm"],setup:()=>({takerFee:ci().takerFee}),data(){const e=this.lockType>=0;return{TRIGGERS:bm,OrderMode:Gt,isFromPosition:e,type:e?this.lockType:"short"===this.defaultSide?Gt.SELL:Gt.BUY,showBoard:!1,profitTriggerIndex:0,lossTriggerIndex:0,whichTrigger:"",takeProfitPrice:this.tpPrice,takeProfitTrigger:this.tpTrigger,stopLossPrice:this.slPrice,stopLossTrigger:this.slTrigger}},computed:{...b("futures",["futuresMarkPriceMap","marketDetailMap"]),...U(["isUnifiedWallet"]),...U("futures",["walletLeverage","isHedgeMode","currentMargin","marketDetail","initialMarginPercentage"]),...y(Ge,["orderFormType","isMarketOrderFormType"]),...y(Nn,["bestAskPrice","bestBidPrice"]),visible:{get(){return this.show},set(e){this.$emit("update:show",e)}},triggerIndex(){return this.whichTrigger===bm.TAKE_PROFIT?this.profitTriggerIndex:this.lossTriggerIndex},isLong(){return this.type===Gt.BUY},bestPrice(){return(this.isLong?this.bestAskPrice:this.bestBidPrice)||0},takeProfitPercentInfo(){let e;switch(this.profitTriggerIndex){case 0:e={percent:150,gap:50,max:1/0,min:0};break;case 1:e={percent:25,gap:5,max:this.isLong?1/0:9,min:this.isLong?0:-1/0};break;default:e={percent:100,gap:25,max:1/0,min:0}}return e},stopLossPercentInfo(){let e;switch(this.lossTriggerIndex){case 0:e={percent:75,gap:25,max:9,min:-1/0};break;case 1:e={percent:10,gap:5,max:this.isLong?9:1/0,min:this.isLong?-1/0:0};break;default:e={percent:100,gap:25,max:9,min:-1/0}}return e},positionMarkPrice(){return this.futuresMarkPriceMap[this.position.symbol]||0},tpErrorMsg(){if(this.priceError)return this.priceError;if(""===this.takeProfitPrice)return"";if(this.isFromPosition&&!this.isCurrentMarket&&"lastPrice"===this.takeProfitTrigger.payloadName)return"";const e=Number(this.takeProfitPrice),t=(this.isMarketOrderFormType||this.isFromPosition)&&"lastPrice"===this.takeProfitTrigger.payloadName,i=Number(t?this.bestPrice:this.positionMarkPrice||this.orderPrice),r=this.orderTypePirceText("markPrice"===this.takeProfitTrigger.payloadName);if(this.isLong){if(S(e).lte(i))return this.$t("tpsl.triggerWarning",{triggerType:this.$t("futuresMain.trade.takeProfit"),highOrLow:this.$t("t.higher").toLowerCase(),price:r})}else if(S(e).gte(i))return this.$t("tpsl.triggerWarning",{triggerType:this.$t("futuresMain.trade.takeProfit"),highOrLow:this.$t("t.lower").toLowerCase(),price:r});return""},slErrorMsg(){if(this.priceError)return this.priceError;if(""===this.stopLossPrice)return"";
1if(this.isFromPosition&&!this.isCurrentMarket&&"lastPrice"===this.stopLossTrigger.payloadName)return"";const e=Number(this.stopLossPrice),t=(this.isMarketOrderFormType||this.isFromPosition)&&"lastPrice"===this.stopLossTrigger.payloadName,i=Number(t?this.bestPrice:this.positionMarkPrice||this.orderPrice),r=this.orderTypePirceText("markPrice"===this.stopLossTrigger.payloadName);if(this.isLong){if(S(e).gte(i))return this.$t("tpsl.triggerWarning",{triggerType:this.$t("tpsl.sl"),highOrLow:this.$t("t.lower").toLowerCase(),price:r})}else if(S(e).lte(i))return this.$t("tpsl.triggerWarning",{triggerType:this.$t("tpsl.sl"),highOrLow:this.$t("t.higher").toLowerCase(),price:r});return""},slTooltipIconMsg(){return this.isFromPosition?"":this.isLong?this.$t("tpsl.sl.tooltip.fromOrder.long"):this.$t("tpsl.sl.tooltip.fromOrder.short")},slWarningMsg(){if(!this.isFromPosition)return"";const e=this.marketDetailMap[this.position.symbol],t=S(1).div((null==e?void 0:e.initialMargin)||.01).toNumber(),{liquidationPrice:i}=this.position,r=t>=50?this.isLong?1.03:.97:this.isLong?1.1:.9,a=S(i).times(r),n=S(this.stopLossPrice);return(this.isLong?n.lt(a):n.gt(a))?this.isLong?this.$t("tpsl.sl.tooltip.fromPosition.long"):this.$t("tpsl.sl.tooltip.fromPosition.short"):""},isSubmitDisabled(){const{takeProfitOrder:e,stopLossOrder:t}=this.position,i=(null==e?void 0:e.orderId)||(null==t?void 0:t.orderId);return this.isFromPosition&&!i&&!this.takeProfitPrice&&!this.stopLossPrice||""!==this.tpErrorMsg||""!==this.slErrorMsg},leverage(){if(this.isFromPosition)return this.position.leverage;if(this.isUnifiedWallet&&this.isHedgeMode){return this.currentMargin.map((e=>e.leverage))[this.isLong?0:1]}return this.walletLeverage},part1FormulaResultBuy(){return this.isFromPosition?this.position.positionMargin:hi({price:this.formPrice,qty:this.buyQty,contractValue:this.marketDetail.contractSize,takerFees:this.takerFee,initialMarginPercentage:this.initialMarginPercentage(this.symbol),leverage:this.leverage})},part1FormulaResultSell(){return this.isFromPosition?this.position.positionMargin:hi({price:this.formPrice,qty:this.sellQty,contractValue:this.marketDetail.contractSize,takerFees:this.takerFee,initialMarginPercentage:this.initialMarginPercentage(this.symbol),leverage:this.leverage})}},methods:{showOptionsBoard(e){this.whichTrigger=e,this.showBoard=!0},onChangeTriggerIndex(e){this.whichTrigger===bm.TAKE_PROFIT?this.profitTriggerIndex=e:this.lossTriggerIndex=e},orderTypePirceText(e=!0){if(this.isFromPosition)return e?this.$t("futuresMain.openPosition.markPrice").toLowerCase():this.isLong?this.$t("t.bestAskPrice").toLowerCase():this.$t("t.bestBidPrice").toLowerCase();switch(this.orderFormType){case ni.LIMIT:case ni.LIMIT_STOP:case ni.LIMIT_TAKE_PROFIT:return this.$t("c2c.limitPrice").toLowerCase();case ni.MARKET:return e?this.$t("futuresMain.openPosition.markPrice").toLowerCase():this.isLong?this.$t("t.bestAskPrice").toLowerCase():this.$t("t.bestBidPrice").toLowerCase();case ni.MARKET_STOP:return this.$t("futuresMain.trade.stopPrice").toLowerCase();case ni.MARKET_TAKE_PROFIT:return this.$t("futuresMain.trade.triggerPrice").toLowerCase();default:return this.$t("t.price").toLowerCase()}},onConfirm(){this.$emit("confirm",{tpPrice:this.takeProfitPrice,tpTrigger:this.takeProfitTrigger,slPrice:this.stopLossPrice,slTrigger:this.stopLossTrigger}),this.$emit("update:show",!1)}}},Cm={class:"title"},Pm={class:"dialog-body"},km={class:"flex-box justify-between"},Tm={class:"white label"},Mm={class:"btn-wrapper"};const Lm=$n(Sm,[["render",function(e,t,i,r,u,h){const f=a("TriggerBlock"),v=a("BaseButton"),y=a("OptionsBoard"),b=a("BrandDialog");return o(),n(b,{visible:h.visible,"onUpdate:visible":t[10]||(t[10]=e=>h.visible=e),width:e.isMobile?"90%":"480px",idPrefix:"tpsl_advanced_dialog",center:"",draggable:"",transparentMask:""},{header:s((()=>[l("div",Cm,m(e.$t("futuresMain.trade.takeProfit"))+" / "+m(e.$t("tpsl.sl")),1)])),body:s((()=>[l("div",Pm,[l("div",{class:C(["dialog-tab",{"lock-type":u.isFromPosition}])},[u.isFromPosition?(o(),c("div",{key:0,class:C(["flex-box flex-1 justify-center tab active full",i.lockType===u.OrderMode.BUY?"green":"red"])},m(i.lockType===u.OrderMode.BUY?e.$t("t.long"):e.$t("t.short")),3)):(o(),c(g,{key:1},[l("div",{class:C(["flex-box flex-1 justify-center green tab",{active:u.type===u.OrderMode.BUY}]),onClick:t[0]||(t[0]=e=>u.type=u.OrderMode.BUY)},m(e.$t("t.long")),3),l("div",{class:C(["flex-box flex-1 justify-center red tab",{active:u.type===u.OrderMode.SELL}]),onClick:t[1]||(t[1]=e=>u.type=u.OrderMode.SELL)},m(e.$t("t.short")),3)],64))],2),l("div",km,[l("div",null,m(e.$t("tpsl.applicableTo")),1),l("div",Tm,m(e.$t("tpsl.entirePosition")),1)]),t[11]||(t[11]=l("div",{class:"line"},null,-1)),d(f,{tpslPrice:u.takeProfitPrice,"onUpdate:tpslPrice":t[2]||(t[2]=e=>
1u.takeProfitPrice=e),trigger:u.takeProfitTrigger,"onUpdate:trigger":t[3]||(t[3]=e=>u.takeProfitTrigger=e),symbol:i.symbol,isFromPosition:u.isFromPosition,type:u.TRIGGERS.TAKE_PROFIT,title:e.$t("futuresMain.trade.takeProfit"),triggerIndex:u.profitTriggerIndex,percentData:h.takeProfitPercentInfo,orderPrice:i.orderPrice,orderSize:i.orderSize,side:u.type,part1FormulaResultBuy:h.part1FormulaResultBuy,part1FormulaResultSell:h.part1FormulaResultSell,errorMsg:h.tpErrorMsg,leverage:h.leverage,onClickTriggerText:t[4]||(t[4]=e=>h.showOptionsBoard(u.TRIGGERS.TAKE_PROFIT))},null,8,["tpslPrice","trigger","symbol","isFromPosition","type","title","triggerIndex","percentData","orderPrice","orderSize","side","part1FormulaResultBuy","part1FormulaResultSell","errorMsg","leverage"]),t[12]||(t[12]=l("div",{class:"line"},null,-1)),d(f,{tpslPrice:u.stopLossPrice,"onUpdate:tpslPrice":t[5]||(t[5]=e=>u.stopLossPrice=e),trigger:u.stopLossTrigger,"onUpdate:trigger":t[6]||(t[6]=e=>u.stopLossTrigger=e),symbol:i.symbol,isFromPosition:u.isFromPosition,type:u.TRIGGERS.STOP_LOSS,title:e.$t("tpsl.sl"),triggerIndex:u.lossTriggerIndex,percentData:h.stopLossPercentInfo,orderPrice:i.orderPrice,orderSize:i.orderSize,side:u.type,part1FormulaResultBuy:h.part1FormulaResultBuy,part1FormulaResultSell:h.part1FormulaResultSell,errorMsg:h.slErrorMsg,leverage:h.leverage,tooltipIconMsg:h.slTooltipIconMsg,warningMsg:h.slWarningMsg,onClickTriggerText:t[7]||(t[7]=e=>h.showOptionsBoard(u.TRIGGERS.STOP_LOSS))},null,8,["tpslPrice","trigger","symbol","isFromPosition","type","title","triggerIndex","percentData","orderPrice","orderSize","side","part1FormulaResultBuy","part1FormulaResultSell","errorMsg","leverage","tooltipIconMsg","warningMsg"]),l("div",Mm,[d(v,{class:"primary btn",size:"large",disabled:h.isSubmitDisabled,onClick:h.onConfirm},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["disabled","onClick"]),d(v,{class:"cancel btn",size:"small",onClick:t[8]||(t[8]=t=>e.$emit("update:show",!1))},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})]),d(y,{show:u.showBoard,"onUpdate:show":t[9]||(t[9]=e=>u.showBoard=e),triggerIndex:h.triggerIndex,onChange:h.onChangeTriggerIndex},null,8,["show","triggerIndex","onChange"])])])),_:1},8,["visible","width"])}],["__scopeId","data-v-7b00f8ea"]]),wm=0,Dm=1,Om=2,Im=3;function xm({positions:e,orderMode:t,orderContractSize:i,isHedgeMode:r}){for(const a of e){const{orderMode:e,takeProfitOrder:n,stopLossOrder:o,totalContracts:s}=a;if(t===e){return(null==n?void 0:n.orderId)||(null==o?void 0:o.orderId)?Dm:Om}if(!r)return i<=s?Im:wm}return wm}const _m="tpLteLast",Am="tpLteMark",Rm="tpGteLast",Fm="tpGteMark",Em="slLteLast",Bm="slLteMark",zm="slGteLast",$m="slGteMark";function Nm({newTpPrice:e,tpTriggerUseLastPrice:t,newSlPrice:i,slTriggerUseLastPrice:r,markPrice:a,lastPrice:n,isLong:o}){const s={};return o?(e&&(t?s[_m]=e<=n:s[Am]=e<=a),i&&(r?s[zm]=i>=n:s[$m]=i>=a)):(e&&(t?s[Rm]=e>=n:s[Fm]=e>=a),i&&(r?s[Em]=i<=n:s[Bm]=i<=a)),s}const Um={name:"TpSlModifyWarningDialog",components:{WarningConfirmDialog:mi},props:{visible:{type:Boolean,default:!1},validateResult:{type:Object,default:()=>({})}},emits:["update:visible"],computed:{isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},contentText(){if(0===Object.entries(this.validateResult).length)return"";let e="";for(const[t,i]of Object.entries(this.validateResult))i&&(e+=this.warningI18nMap[t]+"\n");return e},warningI18nMap(){return{[_m]:this.$t("tpsl.bindWarning.TP_LTE_LAST"),[Am]:this.$t("tpsl.bindWarning.TP_LTE_MARK"),[zm]:this.$t("tpsl.bindWarning.SL_GTE_LAST"),[$m]:this.$t("tpsl.bindWarning.SL_GTE_MARK"),[Rm]:this.$t("tpsl.bindWarning.TP_GTE_LAST"),[Fm]:this.$t("tpsl.bindWarning.TP_GTE_MARK"),[Em]:this.$t("tpsl.bindWarning.SL_LTE_LAST"),[Bm]:this.$t("tpsl.bindWarning.SL_LTE_MARK")}}}},Hm={class:"tp-sl-warning-dialog"},Vm={class:"dialog-content"};const Wm=$n(Um,[["render",function(e,t,i,r,u,c){const h=a("BaseButton"),g=a("WarningConfirmDialog");return o(),n(g,{visible:c.isShow,"onUpdate:visible":t[1]||(t[1]=e=>c.isShow=e),isNewStyle:""},{buttons:s((()=>[d(h,{type:"confirm",class:"primary block",size:"large",onClick:t[0]||(t[0]=e=>c.isShow=!1)},{default:s((()=>[p(m(e.$t("msg.modify")),1)])),_:1})])),default:s((()=>[l("div",Hm,[t[2]||(t[2]=l("h2",{class:"dialog-title"},m("Notice"),-1)),l("div",Vm,m(c.contentText),1)])])),_:1},8,["visible"])}],["__scopeId","data-v-7dc34bc6"]]),qm={name:"TpSlSetting",components:{IconEdit:gi,IconAddCircle:Fh,TpSlPriceWithTooltip:Rh,TpSlModifyWarningDialog:Wm,TpslAdvancedDialog:Lm},props:{position:{type:Object,required:!0},marketDetail:{type:Object,required:!0},markPrice:{type:[String,Number],default:""},lastPrice:{type:[String,Number],default:""},isProMode:{type:Boolean,default:!1}},data:()=>({OrderMode:Gt,validateTpSlResult:{},showTpSlModifyWarningDialog:!1,showTpslAdvancedDialog:!1}),computed:{...y(pt,["isLeaderMode"]),...U("futures",{currentMarketSymbol
1:"symbol"}),symbol(){return this.position.symbol},isHedgeModePosition(){return this.position.positionMode===li.HEDGE},isBuySide(){return"MODE_BUY"===this.position.orderModeName},tpPrice(){const{takeProfitOrder:e}=this.position;return null==e?void 0:e.triggerPrice},tpPriceType(){const{takeProfitOrder:e}=this.position;return(null==e?void 0:e.triggerUseLastPrice)&&zt.enableLastPriceDependentUI?sm.LAST:sm.MARK},slPrice(){const{stopLossOrder:e}=this.position;return null==e?void 0:e.triggerPrice},slPriceType(){const{stopLossOrder:e}=this.position;return(null==e?void 0:e.triggerUseLastPrice)&&zt.enableLastPriceDependentUI?sm.LAST:sm.MARK},hasTpSlSetting(){return this.hasTpPrice||this.hasSlPrice},hasTpPrice(){return!!this.tpPrice},hasSlPrice(){return!!this.slPrice},cryptoSize(){return Qe(this.position.totalContracts,this.symbol)}},methods:{handleClickTpSlConfirm({tpPrice:e,tpTrigger:t,slPrice:i,slTrigger:r}){const{takeProfitOrder:a,stopLossOrder:n}=this.position;if(""===e&&""===i){const e=(null==a?void 0:a.orderId)||(null==n?void 0:n.orderId);return void(this.isLeaderMode?Xt.cancelOrder:Ve.cancelOrder)({marketName:this.position.marketName,orderID:e},!0)}this.validateTpSlResult=Nm({newTpPrice:e,tpTriggerUseLastPrice:"lastPrice"===t.payloadName,newSlPrice:i,slTriggerUseLastPrice:"lastPrice"===r.payloadName,markPrice:this.markPrice,lastPrice:this.lastPrice,isLong:this.isBuySide});if(Object.values(this.validateTpSlResult).some((e=>!0===e)))return void(this.showTpSlModifyWarningDialog=!0);let o="";if(this.isHedgeModePosition){o=this.position.positionDirection===fi.LONG?"SELL":"BUY"}else o=this.isBuySide?"SELL":"BUY";(this.isLeaderMode?Xt.bindTpSlToPosition:Ve.bindTpSlToPosition)({symbol:this.symbol,side:o,takeProfitPrice:e||null,takeProfitTrigger:t?t.payloadName:null,stopLossPrice:i||null,stopLossTrigger:r?r.payloadName:null,positionMode:this.position.positionMode,positionId:this.position.positionId})}}},Gm={class:"tp-sl-wrap"},Km={class:"text-add"};const Qm=$n(qm,[["render",function(e,t,i,r,s,u){const p=a("TpSlPriceWithTooltip"),f=a("IconEdit"),v=a("IconAddCircle"),y=a("TpslAdvancedDialog"),b=a("TpSlModifyWarningDialog");return o(),c("div",Gm,[u.hasTpSlSetting?(o(),c(g,{key:0},[d(p,{tpOrder:i.position.takeProfitOrder,slOrder:i.position.stopLossOrder,isLong:u.isBuySide,entryPrice:i.position.entryPrice,priceFilter:i.marketDetail.priceFilter,isPosition:""},null,8,["tpOrder","slOrder","isLong","entryPrice","priceFilter"]),d(f,{class:C(["icon-edit",{"absolute-icon":i.isProMode}]),onClick:t[0]||(t[0]=e=>s.showTpslAdvancedDialog=!0)},null,8,["class"])],64)):(o(),c(g,{key:1},[l("span",Km,m(e.$t("t.add")),1),d(v,{class:"icon-add",onClick:t[1]||(t[1]=e=>s.showTpslAdvancedDialog=!0)})],64)),s.showTpslAdvancedDialog?(o(),n(y,{key:2,show:s.showTpslAdvancedDialog,"onUpdate:show":t[2]||(t[2]=e=>s.showTpslAdvancedDialog=e),symbol:u.symbol,orderPrice:i.position.entryPrice,orderSize:u.cryptoSize,tpPrice:u.tpPrice,tpTrigger:u.tpPriceType,slPrice:u.slPrice,slTrigger:u.slPriceType,lockType:u.isBuySide?s.OrderMode.BUY:s.OrderMode.SELL,position:i.position,isCurrentMarket:u.symbol===e.currentMarketSymbol,onConfirm:u.handleClickTpSlConfirm},null,8,["show","symbol","orderPrice","orderSize","tpPrice","tpTrigger","slPrice","slTrigger","lockType","position","isCurrentMarket","onConfirm"])):h("",!0),d(b,{visible:s.showTpSlModifyWarningDialog,"onUpdate:visible":t[3]||(t[3]=e=>s.showTpSlModifyWarningDialog=e),validateResult:s.validateTpSlResult},null,8,["visible","validateResult"])])}],["__scopeId","data-v-c2196c10"]]),jm={name:"BrandDropdownList",components:{IconDay:xo,IconNight:Io,IconChevronDown:Ze},props:{itemList:{type:Array,required:!0},position:{type:String,default:""},alignRight:{type:Boolean,default:!0}},data:()=>({selectedKeys:{}}),methods:{textSelectLabel:e=>(e.list.find((({value:t})=>e.state===t))||{}).shortLabel||e.state,handleSelected(e){this.selectedKeys={...this.selectedKeys,[e]:!this.selectedKeys[e]}},processSelect(e,t){e.select(t.value),this.selectedKeys[e.key]=!1}}},Ym=["href"],Zm=["onClick"],Xm=["onClick"],Jm={key:0,class:"brand-switch--day"},eg=["onClick"],tg={class:"select-dropdown-label"},ig=["onClick"];
1const rg={name:"BrandDropdownListButton",components:{BrandDropdownList:$n(jm,[["render",function(e,t,i,r,u,f){const v=a("IconDay"),y=a("IconNight"),b=a("IconChevronDown"),S=a("RouterLink");return o(),c("div",{class:C(["brand-dropdown-list",[`position-${i.position}`,{"align-left":!i.alignRight}]])},[(o(!0),c(g,null,R(i.itemList,(e=>(o(),c(g,{key:e.key},[e.href?(o(),c("a",{key:0,class:"brand-dropdown-list-item",href:e.href,rel:"noopener nofollow"},m(e.label),9,Ym)):e.click?(o(),c("div",{key:1,class:C(["brand-dropdown-list-item",{"brand-dropdown-list-item--separate":e.separate}]),onClick:e.click},m(e.label||e.key),11,Zm)):e.toggle?(o(),c("div",{key:2,class:"brand-dropdown-list-item",onClick:E((t=>e.toggle(!e.state)),["stop"])},[p(m(e.label||e.key)+" ",1),"day"===e.toggleType?(o(),c("div",Jm,[d(v,{class:C({active:"day"===e.state}),"aria-label":"theme mode switch"},null,8,["class"]),d(y,{class:C({active:"night"===e.state}),"aria-label":"theme mode switch"},null,8,["class"])])):(o(),c("div",{key:1,class:C(["brand-switch",{active:e.state}])},null,2))],8,Xm)):e.select?(o(),c(g,{key:3},[(o(),c("div",{key:e.key,class:"brand-dropdown-list-item",onClick:E((t=>f.handleSelected(e.key)),["stop"])},[p(m(e.label||e.key)+" ",1),l("div",tg,[l("div",null,m(f.textSelectLabel(e)),1),d(b,{class:C(["icon-chevron-down",{active:u.selectedKeys[e.key]}]),"aria-label":"Chevron Down"},null,8,["class"])])],8,eg)),u.selectedKeys[e.key]?(o(),c("div",{key:`${e.key}-select`,class:"select-dropdown-list"},[(o(!0),c(g,null,R(e.list,(t=>(o(),c("div",{key:t.value,class:C(["select-dropdown-list-option",{active:e.state===t.value}]),onClick:E((i=>f.processSelect(e,t)),["stop"])},m(t.shortLabel),11,ig)))),128))])):h("",!0)],64)):(o(),n(S,{key:4,class:"brand-dropdown-list-item",to:e,onClick:t=>e.callback&&e.callback()},{default:s((()=>[p(m(e.label),1)])),_:2},1032,["to","onClick"]))],64)))),128))],2)}],["__scopeId","data-v-d31d6566"]]),IconChevronDown:Ze},props:{buttonText:{type:String,default:""},itemList:{type:Array,required:!0},position:{type:String,default:""},alignRight:{type:Boolean,default:!0},hideChevron:{type:Boolean,default:!1},customClick:{type:Function,default:null}},data:()=>({showDropdownList:!1}),beforeUnmount(){document.removeEventListener("click",this.onClickOutside)},methods:{handleDropdownClick(){if(this.customClick)return this.customClick();this.toggleDropdownList()},toggleDropdownList(){this.showDropdownList=!this.showDropdownList,this.showDropdownList&&document.addEventListener("click",this.onClickOutside),!this.showDropdownList&&document.removeEventListener("click",this.onClickOutside)},onClickOutside(e){this.$refs.dropdownListButton&&!this.$refs.dropdownListButton.contains(e.target)&&(this.showDropdownList=!1)}}},ag=["data-showdropdownlist"],ng={class:"dropdown-list-label"};const og=$n(rg,[["render",function(e,t,i,r,s,u){const d=a("IconChevronDown"),g=a("BrandDropdownList"),f=H("escapeclose");return B((o(),c("div",{ref:"dropdownListButton",class:"brand-dropdown-list-button no-select","data-showdropdownlist":s.showDropdownList,onClick:t[0]||(t[0]=(...e)=>u.handleDropdownClick&&u.handleDropdownClick(...e))},[l("div",ng,[_(e.$slots,"default",{},void 0,!0),p(" "+m(i.buttonText),1)]),i.hideChevron?h("",!0):(o(),n(d,{key:0,class:C(["icon-chevron-down",{active:s.showDropdownList}]),"aria-label":"Chevron Down"},null,8,["class"])),s.showDropdownList?(o(),n(g,{key:1,itemList:i.itemList,position:i.position,alignRight:i.alignRight},null,8,["itemList","position","alignRight"])):h("",!0)],8,ag)),[[f,u.toggleDropdownList]])}],["__scopeId","data-v-6b8251b5"]]),sg={class:"adl-meter"};const lg=$n({name:"AdlMeter",props:{blockAmount:{type:Number,default:5},rank:{type:Number,required:!0}}},[["render",function(e,t,i,r,a,n){return o(),c("div",sg,[(o(!0),c(g,null,R(i.blockAmount,(e=>(o(),c("div",{key:`block${e}`,class:C(["block",{"fill-block":e<=i.rank}])},null,2)))),128))])}],["__scopeId","data-v-45d2a50b"]]),ug={class:"content"},cg={__name:"TradingDetailsPopover",props:{target:{type:Object,required:!0},visible:{type:Boolean,default:!1},position:{type:String,default:"top"},offset:{type:Object,default:()=>({x:0,y:6})}},emits:["close"],setup(e,{emit:t}){const i=e,r=t,a=T(null),s=T({});D((()=>i.visible),(e=>{e&&setTimeout((()=>{(()=>{if(!i.target||!a.value)return;const e=i.target.getBoundingClientRect(),t=a.value.offsetWidth,r=a.value.offsetHeight,n=window.innerWidth;let o,l=e.left+i.offset.x+window.scrollX;l+t>n&&(l=n-t-10),l<0&&(l=10),o="top"===i.position?e.top-r-i.offset.y+window.scrollY:e.bottom+i.offset.y+window.scrollY,s.value={top:`${o}px`,left:`${l}px`}})()}),0)}));const u=e=>{!a.value||a.value.contains(e.target)||i.target.contains(e.target)||p()},p=()=>{r("close")};return L((()=>{document.addEventListener("click",u)})),w((()=>{document.removeEventListener("click",u)})),(t,i)=>(o(),n(ee,{to:"body"}
1,[e.visible?(o(),c("div",{key:0,ref_key:"panelRef",ref:a,class:"floating-panel",style:P(s.value),onClick:i[0]||(i[0]=E((()=>{}),["stop"]))},[d(x(Ue),{class:"icon-close","stroke-width":"2",onClick:p}),l("div",ug,[_(t.$slots,"default",{},void 0,!0)])],4)):h("",!0)]))}},dg=$n(cg,[["__scopeId","data-v-b2883b9f"]]),pg={class:"size-details"},hg={class:"size-details-item"},mg={class:"item-label"},gg={class:"size-details-item"},fg={class:"item-label"},vg={class:"item-value"},yg={class:"size-details-item"},bg={class:"item-label"},Sg={class:"item-value"},Cg={class:"size-details-item"},Pg={class:"item-label"},kg={class:"item-value"},Tg=$n({__name:"PositionSizeDetailPopover",props:{sizeInfo:{type:Object,required:!0},target:{type:Object,required:!0},visible:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:t}){const i=e,r=G(),a=t,u=M((()=>c.value?r.t("t.long"):r.t("t.short"))),c=M((()=>i.sizeInfo.direction===fi.LONG));function d(e){return Qt(e,{preserveDecimals:!0})}function p(){a("close")}return(t,i)=>(o(),n(dg,{target:e.target,visible:e.visible,onClose:p},{default:s((()=>[l("div",pg,[l("div",hg,[l("span",mg,m(t.$t("t.direction")),1),l("span",{class:C(["item-value direction",{long:c.value,short:!c.value}])},m(u.value),3)]),l("div",gg,[l("span",fg,m(x(vi)(t.$t("t.contracts.2"))),1),l("span",vg,m(d(e.sizeInfo.totalContracts))+" "+m(t.$t("t.contracts.2")),1)]),l("div",yg,[l("span",bg,m(t.$t("t.crypto")),1),l("span",Sg,m(d(e.sizeInfo.cryptoSize))+" "+m(e.sizeInfo.baseCurrency),1)]),l("div",Cg,[l("span",Pg,m
1(t.$t("t.totalValue")),1),l("span",kg,m(d(e.sizeInfo.totalValue))+" "+m(x(ht)),1)])])])),_:1},8,["target","visible"]))}},[["__scopeId","data-v-16b2cfad"]]),Mg="LONG",Lg="SHORT";function wg(e){return"number"==typeof e&&Number.isFinite(e)}function Dg({position:e,positions:t,walletMap:i}){var r;const a=null==e?void 0:e.activeWalletName;if(!a)return null;const n=(t||[]).filter((e=>(null==e?void 0:e.activeWalletName)===a));return n.length?function({legs:e,originalAvailableBalance:t}){if(!wg(t))return null;const i=(e||[]).filter((e=>wg(null==e?void 0:e.totalContracts)&&e.totalContracts>0));if(!i.length)return 0;const r=i.reduce(((e,t)=>t.positionDirection===Lg?e-t.totalContracts:e+t.totalContracts),0);if(0===r)return 0;const a=r>0?Mg:Lg,n=i.find((e=>e.positionDirection===a));if(!n||!wg(n.totalMaintenanceMargin))return null;const o=S(n.totalMaintenanceMargin).times(Math.abs(r)).div(n.totalContracts),s=o.plus(t);return s.lte(0)?1:S.min(S.max(o.div(s),0),1).toNumber()}({legs:n,originalAvailableBalance:null==(r=null==i?void 0:i[a.replace("-USDT","-USD")])?void 0:r.originalAvailableBalance}):null}const{enableFuturesPnlSharing:Og,enableMarginCall:Ig}=mt,xg={name:"Position",components:{FrontBar:ih,FrontBarCell:rh,SymbolLink:ah,IconEditLite:oh,IconEditPro:nh,ClosePosition:yh,BrandDropdownListButton:og,AdlMeter:lg,IconShare:yi,IconLink:os,TpSlSetting:Qm,PositionSizeDetailPopover:Tg,Tooltip:ei},props:{position:{type:Object,required:!0},isProMode:{type:Boolean,default:!1},isSmallSize:{type:Boolean,default:!1},filterSettings:{type:Object,default:()=>({})}},emits:["onShare","handleSettleIn","editLeverage","editPositionMargin","openMarginCallSetting"],setup:()=>({sizeRef:T(null)}),data:()=>({supportConfig:Pi,ROUTE_NAME:ai,isLoading:!1,isShowDetailPopover:!1}),computed:{...b(["lang","includeUnrealizedPnl"]),...b("futures",{futuresWalletMap:"walletMap",futuresMarkPriceMap:"futuresMarkPriceMap",futuresLastPriceMap:"futuresLastPriceMap",futuresMarketMap:"marketMap",futuresMarketDetailMap:"marketDetailMap",leaderWalletMap:"leaderWalletMap",openPositionMap:"openPositionMap",leaderPositionMap:"leaderPositionMap"}),...y(pt,["isLeaderMode"]),...U(["isUnifiedWallet"]),...U("futures",["initialMarginPercentage"]),...ie(Ge),isIsolated(){return this.position.marginTypeName===Ci.ISOLATED},symbol(){return this.position.symbol},lastPrice(){return this.futuresLastPriceMap[this.symbol]||0},isAllowFuturePnlSharing:()=>Og,isBuySide(){return"MODE_BUY"===this.position.orderModeName},markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},priceFilter(){return this.futuresMarketMap[this.symbol].priceFilter},quoteCurrency(){return Si(this.symbol)},marketDetail(){return this.futuresMarketDetailMap[this.symbol]||{}},marginType(){return this.isIsolated?this.$t("t.isolated"):this.$t("futuresMain.trade.cross")},displayLeverage(){const{isolatedLeverage:e}=this.position;return`${bi(e,this.initialMarginPercentage(this.symbol),2)}x`},activeSizeRef(){return this.sizeRef?Array.isArray(this.sizeRef)?this.sizeRef.find((e=>e)):this.sizeRef:null},displaySize(){var e;const{direction:t,totalContracts:i,totalValue:r,cryptoSize:a}=this.sizeInfo,n=t===fi.LONG?"+":"-",o=e=>this.$filters.formatNumber(e,{preserveDecimals:!0});if(this.futuresSettingStore.isContractSizeType)return`${n} ${o(i)}`;if(this.futuresSettingStore.isUsdSizeType)return`${n} ${o(r)} ${ht}`;const s=(null==(e=this.futuresMarketMap[this.symbol])?void 0:e.baseCurrency)||"";return`${n} ${o(a)} ${s}`},sizeInfo(){var e;return{direction:this.isBuySide?fi.LONG:fi.SHORT,totalContracts:this.position.totalContracts,cryptoSize:Qe(this.position.totalContracts,this.symbol),totalValue:Yt(this.position.totalContracts,this.markPrice,this.symbol),baseCurrency:(null==(e=this.futuresMarketMap[this.symbol])?void 0:e.baseCurrency)||""}},displayEntryPrice(){return this.$filters.formatNumber(this.position.entryPrice,{formatKey:this.priceFilter+1,roundMode:this.isBuySide?S.ROUND_UP:S.ROUND_DOWN})},displayMarkPrice(){return this.markPrice?this.$filters.formatNumber(this.markPrice,this.priceFilter):"-"},displayLiqPrice(){return this.$filters.formatNumber(this.position.liquidationPrice,{formatKey:this.priceFilter,roundMode:this.isBuySide?S.ROUND_DOWN:S.ROUND_HALF_UP})},hasEstimatedLossTooltip(){return this.isUnifiedWallet&&this.position.estimatedLossMargin&&this.position.liquidationPrice},displayEstimatedLoss(){const e=this.position.estimatedLossMargin;return e?`-${this.$filters.formatNumber(Math.abs(Number(e)),{formatKey:2})}`:""},displayUnrealizedPnL(){const{unrealizedPnlInSettleAsset:e,unrealizedPnlFilter:t,settleWithNonUSDAsset:i}=this.position;return e&&i?`${this.$filters.formatNumber(e,t)} ${i}`:"-"},displayRoe(){const{positionRoe:e}=this.position;return e?this.$filters.formatNumber(e,{postfix:"%"}):"-"},marginRatio(){return Dg({position:this.position,positions:(this.isLeaderMode?this.leaderPositionMap:this.openPositionMap)[this.symbol]||[],walletMap:this.isLeaderMode?this.leaderWalletMap:this.futuresWalletMap})},displayMarginRatio(){return wg(e=this.marginRatio)?`${S(e).times(100).toFixed(2,S.ROUND_UP)}%`:"--";var e},isMarginRatioDanger(){return!!wg(e=this.marginRatio)&&S(e).times(100).dp(2,S.ROUND_UP).gte(60);var e},displayPositionMargin(){let e;if(this.isIsolated)e=this.getPositionMargin(this.position);else{const t=this.marketDetail.contractSize,i=this.position.totalContracts||0,r=this.markPrice||0,a=bi(this.position.isolatedLeverage,this.initialMarginPercentage(this.symbol),2);if(!(t&&i&&r&&a))return"-";
1e=S(r).times(i).times(t).div(a).toNumber()}return this.$filters.formatNumber(e,{formatKey:2,postfix:` ${ht}`})},displayExposure(){return this.$filters.formatNumber(this.position.currentLeverage)},positionValue(){const e=this.marketDetail.contractSize;if(this.markPrice&&e&&this.position.totalContracts){const t=Number(S(this.markPrice).times(this.position.totalContracts).times(e));return`${this.$filters.formatNumber(t)} ${this.quoteCurrency}`}return""},adlRank(){return this.position.adlScoreBucket||0},positionDetails(){return[[{id:"size",label:this.$t("t.size"),tooltip:this.$t("futuresMain.openPosition.size.tip"),value:this.displaySize,valueClass:this.isBuySide?"brand-color-positive":"brand-color-negative"},{id:"value",label:this.$t("futuresMain.openPosition.value"),tooltip:this.$t("futuresMain.openPosition.value.tip"),value:this.positionValue},{id:"marginRatio",label:this.$t("t.marginRatio"),tooltip:this.$t("futuresMain.openPosition.marginRatio.tip"),value:this.displayMarginRatio,valueClass:{"danger-value":this.isMarginRatioDanger},tipBottomAction:Ig&&!this.isLeaderMode?{text:this.$t("trade.marginCall.setup"),action:()=>this.$emit("openMarginCallSetting")}:null},this.isUnifiedWallet&&this.isIsolated&&{id:"positionMargin",label:this.$t("futuresMain.openPosition.margin"),tooltip:this.$t("futuresMain.openPosition.positionMargin.tip"),value:this.displayPositionMargin,editEventName:"editPositionMargin"},{id:"exposure",label:this.$t("futuresMain.openPosition.exposure"),tooltip:this.includeUnrealizedPnl?this.$t("futuresMain.exposure.hint.2.excludeUnrealizedPnl"):this.$t("futuresMain.exposure.hint.2"),value:this.displayExposure}],[{id:"entryPrice",label:this.$t("futuresMain.openPosition.entryPrice"),tooltip:this.$t("futuresMain.openPosition.entryPrice.tip"),value:this.displayEntryPrice},{id:"markPrice",label:this.$t("futuresMain.openPosition.markPrice"),tooltip:this.$t("futuresMain.openPosition.markPrice.tip"),value:this.displayMarkPrice},{id:"unrealizedPNL",label:this.$t("futuresMain.marginBalanace.unrealizedPNL"),tooltip:this.$t("futuresMain.openPosition.unrealizedPNL.tip"),value:this.displayUnrealizedPnL,valueClass:{"brand-color-positive":this.position.unrealizedPnlInSettleAsset>0,"brand-color-negative":this.position.unrealizedPnlInSettleAsset<0}},{id:"roe",label:this.$t("t.roe"),value:this.displayRoe,valueClass:{"brand-color-positive":this.position.unrealizedPnlInSettleAsset>0,"brand-color-negative":this.position.unrealizedPnlInSettleAsset<0}}],[{id:"tpsl",label:this.$t("t.tpsl")},!this.isLeaderMode&&{id:"settleIn",label:this.$t("futuresMain.openPosition.settleIn"),tooltip:this.$t("futuresMain.openPosition.settleIn.tip")},{id:"liqPrice",label:this.$t("futuresMain.openPosition.liqPrice"),tooltip:this.$t("futuresMain.openPosition.liqPrice.tip.v2"),value:this.displayLiqPrice},{id:"adl",label:"ADL",tooltip:this.$t("futuresMain.contractInfo.priorityRanking.tip")}]].filter((e=>e))}},methods:{handleSettinDropdownClick(){this.$emit("handleSettleIn",this.position)},getPositionMargin(e){var t,i;const r=null==(t=null==e?void 0:e.activeWalletName)?void 0:t.replace("-USDT","-USD");return(null==(i=(this.isLeaderMode?this.leaderWalletMap:this.futuresWalletMap)[r])?void 0:i.marginBalance)||0}}},_g={class:"position-card"},Ag={class:"position-card-title"},Rg={class:"title-wrap"},Fg={class:"leverage-wrap"},Eg={class:"position-card-content"},Bg={key:0,class:"settle-in-label"},zg={class:"item-label"},$g=["href"],Ng=["href"],Ug={class:"item-label"},Hg={key:2,class:"item-label"},Vg={class:"item-value liq-price-trigger"},Wg={class:"estimated-loss-value"},qg={key:1,class:"lite-position-row"},Gg={class:"tx-align--left"},Kg={class:"leverage-wrap"},Qg={key:0,class:"position-cell"},jg={class:"position-cell"},Yg={class:"position-cell"},Zg={class:"position-cell"},Xg={class:"liq-price-trigger"},Jg={class:"estimated-loss-value"},ef={key:1,class:"position-cell"},tf={class:"position-cell"},rf={key:2,class:"position-cell"},af={key:3,class:"position-cell"},nf={key:4,class:"position-cell"};const of=$n(xg,[["render",function(e,t,i,r,u,f){const v=a("FrontBar"),y=a("SymbolLink"),b=a("IconEditPro"),S=a("IconShare"),P=a("ClosePosition"),k=a("i18n-t"),T=a("Tooltip"),M=a("IconLink"),L=a("TpSlSetting"),w=a("BrandDropdownListButton"),D=a("AdlMeter"),I=a("PositionSizeDetailPo
1pover"),x=a("router-link"),_=a("IconEditLite"),A=a("FrontBarCell"),F=H("loading");return i.isProMode?(o(),c("div",{key:0,class:C(["pro-mode pro-position-wrap",{"small-size":i.isSmallSize}])},[l("div",_g,[l("div",Ag,[l("div",Rg,[B(d(v,{direction:f.isBuySide?"LONG":"SHORT"},null,8,["direction"]),[[F,u.isLoading,"streamingLight"]]),d(y,{class:"symbol",symbol:i.position.symbol,disableUnderline:""},null,8,["symbol"]),l("div",Fg,[l("div",{class:C(["leverage",{"brand-color-positive":f.isBuySide,"brand-color-negative":!f.isBuySide}])},[p(m(f.marginType)+" ",1),l("span",{class:C({"editable-leverage":e.isUnifiedWallet})},m(f.displayLeverage),3)],2)]),e.isUnifiedWallet?(o(),c("span",{key:0,class:"icon-wrap",onClick:t[0]||(t[0]=t=>e.$emit("editLeverage"))},[d(b,{class:"icon-edit"})])):h("",!0),f.isAllowFuturePnlSharing?(o(),c("span",{key:1,class:"icon-wrap",onClick:t[1]||(t[1]=t=>e.$emit("onShare"))},[d(S,{class:"icon-share",width:10,height:10})])):h("",!0)]),d(P,O(e.$attrs,{position:i.position,isSmallSize:i.isSmallSize,isProMode:""}),null,16,["position","isSmallSize"])]),l("div",Eg,[(o(!0),c(g,null,R(f.positionDetails,((r,a)=>(o(),c("div",{key:a,class:"detail-column"},[(o(!0),c(g,null,R(r,(r=>(o(),c("div",{key:r.id,class:"detail-item"},["settleIn"===r.id&&Boolean(u.supportConfig.settleInTooltipUrl)?(o(),c("div",Bg,[d(T,{delay:300},{content:s((()=>[l("div",zg,m(r.label),1)])),tooltip:s((()=>[d(k,{tag:"p",keypath:"futuresMain.openPosition.settleIn.tip2"},{link:s((()=>[l("a",{href:u.supportConfig.settleInTooltipUrl,target:"_blank",rel:"noopener noreferrer"},m(e.$t("t.here")),9,$g)])),_:1})])),_:2},1024),l("a",{class:"settle-in-info-link",href:u.supportConfig.settleInTooltipUrl,target:"_blank",rel:"noopener noreferrer",onClick:t[2]||(t[2]=E((()=>{}),["stop"]))},[d(M,{class:"settle-in-info-icon"})],8,Ng)])):r.tooltip?(o(),n(T,{key:1,tooltip:r.tooltip,tipBottomAction:r.tipBottomAction,delay:r.tipBottomAction?300:""},{content:s((()=>[l("div",Ug,m(r.label),1)])),_:2},1032,["tooltip","tipBottomAction","delay"])):(o(),c("div",Hg,m(r.label),1)),"tpsl"===r.id?(o(),n(L,{key:3,position:i.position,marketDetail:f.marketDetail,markPrice:f.markPrice,lastPrice:f.lastPrice,isProMode:""},null,8,["position","marketDetail","markPrice","lastPrice"])):"settleIn"===r.id?(o(),n(w,{key:4,class:"position-settle-in",buttonText:i.position.settleWithNonUSDAsset||"",itemList:[],customClick:f.handleSettinDropdownClick},null,8,["buttonText","customClick"])):"adl"===r.id?(o(),n(D,{key:5,class:"adl-meter",rank:f.adlRank},null,8,["rank"])):"size"===r.id?(o(),c(g,{key:6},[l("span",{ref_for:!0,ref:"sizeRef",class:C(["size-column item-value",r.valueClass]),onClick:t[3]||(t[3]=e=>u.isShowDetailPopover=!u.isShowDetailPopover)},m(r.value),3),f.activeSizeRef?(o(),n(I,{key:0,target:f.activeSizeRef,visible:u.isShowDetailPopover,sizeInfo:f.sizeInfo,position:e.isMobile?"bottom":"top",onClose:t[4]||(t[4]=e=>u.isShowDetailPopover=!1)},null,8,["target","visible","sizeInfo","position"])):h("",!0)],64)):"liqPrice"===r.id&&f.hasEstimatedLossTooltip?(o(),n(T,{key:7,delay:1e3,tooltipStyle:{maxWidth:"280px"},onlyShowOneInPage:""},{content:s((()=>[l("div",Vg,m(r.value),1)])),tooltip:s((()=>[d(k,{keypath:"futuresMain.openPosition.liqPrice.estimatedLoss.tip",tag:"p"},{value:s((()=>[l("span",Wg,m(f.displayEstimatedLoss),1)])),link:s((()=>[d(x,{to:{name:u.ROUTE_NAME.TRADING_RULES,params:{lang:e.lang,marketType:"collateral"}},target:"_blank"},{default:s((()=>[p(m(e.$t("tradingRules.collateralRatio")),1)])),_:1},8,["to"])])),_:1})])),_:2},1024)):(o(),c("div",{key:8,class:C(["item-value",r.valueClass])},[p(m(r.value)+" ",1),f.isIsolated&&r.editEventName?(o(),n(_,{key:0,class:"icon-edit",onClick:t=>e.$emit(r.editEventName)},null,8,["onClick"])):h("",!0)],2))])))),128))])))),128))])])],2)):(o(),c("tr",qg,[d(A,{direction:f.isBuySide?"LONG":"SHORT"},null,8,["direction"]),l("td",Gg,[d(y,{symbol:i.position.symbol,disableUnderline:""},null,8,["symbol"]),l("div",Kg,[l("div",{class:C(["leverage",{"brand-color-positive":f.isBuySide,"brand-color-negative":!f.isBuySide}])},[p(m(f.marginType)+" ",1),l("span",{class:C({"editable-leverage":e.isUnifiedWallet})},m(f.displayLeverage),3)],2),e.isUnifiedWallet?(o(),n(_,{key:0,class:"icon-edit",onClick:t[5]||(t[5]=t=>e.$emit("editLeverage"))})):h("",!0)])]),l("td",{class:C(["position-cell",{"brand-color-positive":f.isBuySide,"brand-color-negative":!f.isBuySide}])},[l("span",{ref:"sizeRef",class:"size-column",onClick:t[6]||(t[6]=e=>u.isShowDetailPopover=!u.isShowDetailPopover)},m(f.displaySize),513),f.activeSizeRef?(o(),n(I,{key:0,target:f.activeSizeRef,visible:u.isShowDetailPopover,sizeInfo:f.sizeInfo,position:e.isMobile?"bottom":"top",onClose:t[7]||(t[7]=e=>u.isShowDetailPopover=!1)},null,8,["target","visible","sizeInfo","position"])):h("",!0)],2),i.filterSettings.value?(o(),c("td",Qg,m(f.positionValue),1)):h("",!0),l("td",jg,m(f.displayEntryPrice),1),l("td",Yg,m(f.displayMarkPrice),1),l("td",Zg,[f.hasEstimatedLossTooltip?(o(),n(T,{key:0,delay:1e3,tooltipStyle:{maxWidth:"280px"},onlyShowOneInPage:""},{content:s((()=>[l("span",Xg,m(f.displayLiqPrice),1)])),tooltip:s((()=>[d(k,{keypath:"futuresMain.openPosition.liqPrice.estimatedLoss.tip",tag:"p"},{value:s((()=>[l("span",Jg,m(f.displayEstimatedLoss),1)])),link:s((()=>[d(x,{to:{name:u.ROUTE_NAME.TRADING_RULES,params:{lang:e.lang,marketType:"collateral"}},target:"_blank"},{default:s((()=>[p(m(e.$t("tradingRules.collateralRatio")),1)])),_:1},8,["to"])])),_:1})])),_:1})):(o(),c(g,{key:1},[p(m(f.displayLiqPrice),1)],64))]),l("td",{class:C(["position-cell",{"brand-color-positive":i.position.unrealizedPnlInSettleAsset>0,"brand-color-negative":i.position.unrealizedPnlInSettleAsset<0}])},[p(m(f.displayUnrealizedPnL)+" ("+m(f.displayRoe)+") ",1),f.isAllowFuturePnlSharing?(o(),c("span",{key:0,class:"share-wrapper",onClick:t[8]||(t[8]=t=>e.$emit("onShare"))},[d(S,{width:10,height:10})])):h("",!0)],2),l("td",{class:C(["position-cell",{"danger-value":f.isMarginRatioDanger}])},m(f.displayMarginRatio),3),e.isUnifiedWallet?(o(),c("td",ef,[p(m(f.displayPositionMargin)+" ",1),f.isIsolated?(o(),n(_,{key:0,class:"icon-edit",onClick:t[9]||(t[9]=t=>e.$emit("editPositionMargin"))})):h("",!0)])):h("",!0),l("td",tf,[d(L,{position:i.position,marketDetail:f.marketDetail,markPrice:f.markPrice,lastPrice:f.lastPrice},null,8,["position","marketDetail","markPrice","lastPrice"])]),i.filterSettings.exposure?(o(),c("td",rf,m(f.displayExposure),1)):h("",!0),i.filterSettings.adl?(o(),c("td",af,[d(D,{class:"adl-meter",rank:f.adlRank},null,8,["rank"])])):h("",!0),i.filterSettings.settleIn&&!e.isLeaderMode?(o(),c("td",nf,[d(w,{class:"position-settle-in",buttonText:i.position.settleWithNonUSDAsset||"",itemList:[],customClick:f.handleSettinDropdownClick},null,8,["buttonText","customClick"])])):h("",!0)]))}],["__scopeId","data-v-63b858ea"]]),sf={name:"ClosePositionConfirmationPopup",components:{BrandDialog:pi},props:{show:{type:Boolean,required:!0},price:{type:Number,required:!0},closeType:{type:String,required:!0},position:{type:Object,required:!0},confirmCallback:{type:Function,required:!0},cancelCallback:{type:Function,required:!0}},data:()=>({hideConfirmPopupNextTime:!1}),computed:{...b("futures",["marketDetailMap","fixedCurrency"]),popupConfig(){return{visible:this.show}},isLimitType(){return this.closeType===gh.LIMIT},isBuySide(){return"MODE_BUY"!==this.position.orderModeName},marketDetail(){return this.marketDetailMap[this.position.symbol]},priceFilter(){var e;return null==(e=this.marketDetail)?void 0:e.priceFilter},estLimitPnl(){return S(this.price).minus(this.position.entryPrice).times(this.isBuySide?-1:1).times(this.position.totalContracts).times(this.marketDetail.contractSize).toNumber()},descriptionI18nKey(){return this.isLimitType?"futuresMain.closePosition.reduceOrder.content":"futuresMain.closeOrderPlacement.operation"}},methods:{onConfirmClick(){this.confirmCallback(this.position.symbol,this.hideConfirmPopupNextTime)}}},lf={class:"close-order-confirmation-description"},uf={class:"emphasize"},cf={class:"emphasize"},df={key:0,class:"emphasize"},pf={key:1},hf={key:0,class:"est-pnl"},mf={class:"error-msg"},gf={class:"no-show-box"};const ff=$n(sf,[["render",function(e,t,i,r,u,g){const f=a("i18n-t"),v=a("Checkbox"),y=a("BrandButton"),b=a("BrandDialog");return o(),n(b,{visible:g.popupConfig.visible,"onUpdate:visible":t[1]||(t[1]=e=>g.popupConfig.visible=e),width:"412px",class:"close-position-confirmation-dialog",idPrefix:"close_position_confirmation_dialog",center:"",onClosed:i.cancelCallback},{header:s((()=>[p(m(g.isLimitType?e.$t("futuresMain.closePosition.reduceOrder.title"):e.$t("futuresMain.closeOrderPlacement.header")),1)])),body:s((()=>[l("div",{class:C(["close-order-action-title",{"brand-color-positive":g.isBuySide,"brand-color-negative":!g.isBuySide}])},[t[2]||(t[2]=p(" [ ")),l("span",null,m(g.isLimitType?e.$t("futuresMain.trade.limit"):e.$t("futuresMain.trade.market"))+" "+m(g.isBuySide?e.$t("futuresMain.closeOrderPlacement.buySide"):e.$t("futuresMain.closeOrderPlacement.sellSide"))+" "+m(e.$t("t.reduce")),1),t[3]||(t[3]=p(" ] "))],2),l("div",lf,[d(f,{keypath:g.descriptionI18nKey},{type:s((()=>[p(m(g.isLimitType?e.$t("futuresMain.trade.limit").toLowerCase():e.$t("futuresMain.trade.market").toLowerCase()),1)])),side:s((()=>[p(m(g.isBuySide?e.$t("futuresMain.closeOrderPlacement.buySide").toLowerCase():e.$t("futuresMain.closeOrderPlacement.sellSide").toLowerCase()),1)])),br:s((()=>t[4]||(t[4]=[l("br",null,null,-1)]))),total:s((()=>[l("span",uf,m(i.position.totalContracts),1)])),symbol:s((()=>[l("span",cf,m(i.position.symbol),1)])),price:s((()=>[g.isLimitType?(o(),c("span",df,m(e.$filters.formatNumber(i.price,g.priceFilter)),1)):(o(),c("span",pf,m(e.$t("futuresMain.closeOrderPlacement.contentMarketPrice")),1))])),_:1},8,["keypath"])]),g.isLimitType?(o(),c("div",hf,[d(f,{keypath:"futuresMain.closeOrderPlacement.estPnl"},{value:s((()=>[l("span",{class:C(["pnl-num",{"brand-color-positive":g.estLimitPnl>=0,"brand-color-negative":g.estLimitPnl<0}])},m(e.$filters.formatNumber(g.estLimitPnl,{formatKey:2,signed:!0}))+" "+m(e.fixedCurrency),3)])),_:1})])):h("",!0),l("div",mf,m(e.$t("futuresMain.closePosition.reduceOrder.error")),1),l("div",gf,[d(v,{value:u.hideConfirmPopupNextTime,"onUpdate:value":t[0]||(t[0]=e=>u.hideConfirmPopupNextTime=e)},{default:s((()=>[p(m(e.$t("futuresMain.orderPlacement.noShow")),1)])),_:1},8,["value"])])])),footer:s((()=>[d(y,{class:"flex-1",type:"cancel",onClick:i.cancelCallback},{default:s((()=>[p(m(e.$t("msg.cancel")),1)])),_:1},8,["onClick"]),d(y,{class:"flex-1",type:"confirm",onClick:g.onConfirmClick},{default:s((()=>[p(m(e.$t("futuresMain.orderPlacement.execute")),1)])),_:1},8,["onClick"])])),_:1},8,["visible","onClosed"])}],["__scopeId","data-v-faf236f8"]]),vf=[50,55,60,65,70,75,80],yf=[{enabled:!0,percentage:80},{enabled:!1,percentage:70},{enabled:!1,percentage:60}],bf={name:"MarginCallDialog",components:{Dialog:Mi,Dropdown:Ti,DropdownItem:ki},props:{show:{type:Boolean,required:!0}},emits:["update:show"],data:()=>({isLoading:!1,settings:[],MARGIN_RATIO_OPTIONS:vf}),computed:{...U(["userName"])},created(){this.getMarginCall()},methods:{...v(["messageCustom"]),onClose(){this.$emit("update:show",!1)},async getMarginCall(){try{this.isLoading=!0;const{alerts:e}=await Xe.getMarginCall();this.settings=yf.map(((t,i)=>{const r=null==e?void 0:e[i];return r?{...r,percentage:vf.includes(r.percentage)?r.percentage:t.percentage}:{...t}}))}catch(e){this.onClose()}finally{this.isLoading=!1}},async handleSubmit(){try{this.isLoading=!0,await Xe.updateMarginCall({alerts:this.settings}),this.messageCustom({subTitle:`[${this.$t("trade.marginCall")}]`,title:this.$t("trade.marginCall.successTitle"),body:this.$t("trade.marginCall.successText"),success:!0}),Li(wi.MARGIN_CALL_SETTING_UPDATED,{s1:this.settings[0].enabled?"on":"off",s2:this.settings[1].enabled?"on":"off",s3:this.settings[2].enabled?"on":"off",i1:this.settings[0].percentage,i2:this.settings[1].percentage,i3:this.settings[2].percentage})}catch{this.messageCustom({subTitle:`[${this.$t("trade.marginCall")}]`,title:this.$t("trade.marginCall.errorTitle"),body:this.$t("trade.marginCall.errorText"),error:!0})}finally{this.isLoading=!1,this.onClose()}}}},Sf={class:"prompt"},Cf={class:"form-wrapper"},Pf={class:"header"},kf={class:"title"},Tf=["onClick"],Mf={class:"body"},Lf={class:"info"},wf={class:"dropdown-value"},Df={class:"note-wrapper"},Of={class:"btn-wrapper"};const If=$n(bf,[["render",function(e,t,i,r,u,h){const f=a("DropdownItem"),v=a("Dropdown"),y=a("BaseButton"),b=a("Dialog"),S=H("loading");return o(),n(b,{class:"margin-call-dialog",width:e.isLargeSize?"560px":"9
10%",isBrandNewStyle:"",onClosed:h.onClose},{header:s((()=>[p(m(e.$t("trade.marginCall.title.v2")),1)])),body:s((()=>[l("p",Sf,m(e.$t("trade.marginCall.prompt")),1),B((o(),c("div",Cf,[(o(!0),c(g,null,R(u.settings,((t,i)=>(o(),c("div",{key:i,class:C(["margin-call-option",{active:t.enabled}])},[l("div",Pf,[l("div",kf,m(`${e.$t("trade.marginCall")} 0${i+1}`),1),l("div",{class:C(["switch",{active:t.enabled}]),onClick:e=>t.enabled=!t.enabled},null,10,Tf)]),d(re,{name:"fade"},{default:s((()=>[B(l("div",Mf,[l("div",Lf,m(e.$t("trade.marginCall.notifyWhen.v2")),1),d(v,{value:t.percentage.toString(),onInput:e=>t.percentage=Number(e)},{value:s((()=>[l("span",wf,m(`${t.percentage}%`),1)])),default:s((()=>[(o(!0),c(g,null,R(u.MARGIN_RATIO_OPTIONS,(e=>(o(),n(f,{key:e,value:e.toString()},{default:s((()=>[p(m(`${e}%`),1)])),_:2},1032,["value"])))),128))])),_:2},1032,["value","onInput"])],512),[[N,t.enabled]])])),_:2},1024)],2)))),128))])),[[S,u.isLoading,"streamingLight"]]),l("div",Df,[l("p",null,m(e.$t("t.notes"))+":",1),l("p",null,"1. "+m(e.$t("trade.marginCall.info1.v3")),1),l("p",null,"2. "+m(e.$t("trade.marginCall.info2.v3")),1)])])),footer:s((()=>[l("div",Of,[d(y,{size:"large",class:"primary save-btn",isLoading:u.isLoading,onClick:h.handleSubmit},{default:s((()=>[p(m(e.$t("t.save")),1)])),_:1},8,["isLoading","onClick"]),d(y,{size:"large",class:"cancel-btn",onClick:h.onClose},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1},8,["onClick"])])])),_:1},8,["width","onClosed"])}],["__scopeId","data-v-8ef86f37"]]),xf={name:"LimitReduceDialog",components:{Dialog:Mi,TradingInput:Wn,BaseButton:di},props:{visible:{type:Boolean,required:!0},position:{type:Object,required:!0}},emits:["update:visible","clickReduce"],data:()=>({COMPACT_NUMBER_THRESHOLD:1e6,limitPrice:""}),computed:{...b("futures",{futuresMarketMap:"marketMap",futuresMarketDetailMap:"marketDetailMap",assetExchangeRateMap:"assetExchangeRateMap"}),isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},symbol(){return this.position.symbol},isBuySide(){return"MODE_BUY"===this.position.orderModeName},isPriceValid(){return""!==this.limitPrice&&Number(this.limitPrice)>=0},market(){return this.futuresMarketMap[this.symbol]||{}},marketDetail(){return this.futuresMarketDetailMap[this.symbol]||{}},unrealizedPnlInSettleAsset(){var e;if(!this.isPriceValid)return;const t=Number(this.limitPrice),i=si({formula:"unrealizedPnlInUsdt",position:this.position,market:this.market,markIndex:{price:t},marketDetail:this.marketDetail}),{settleWithNonUSDAsset:r}=this.position,a=r===this.market.baseCurrency?[[t],[1/0]]:(null==(e=this.assetExchangeRateMap[r])?void 0:e.ask)||null;return si({formula:"unrealizedPnl",unrealizedPnlInUsdt:i,assetExchangeRateMap:a})},unrealizedPnlRoe(){if(!this.isPriceValid)return;const e=Number(this.limitPrice);return si({formula:"positionRoe",position:this.position,markIndex:{price:e},leverage:this.position.isolatedLeverage})}},methods:{handleClickReduce(){this.$emit("clickReduce",this.limitPrice),this.isShow=!1}}},_f={class:"header-text"},Af={class:"dialog-body"},Rf={class:"title-wrap"},Ff={class:"pnl-wrap"},Ef={class:"pnl-label"};const Bf=$n(xf,[["render",function(e,t,i,r,u,h){const f=a("TradingInput"),v=a("BaseButton"),y=a("Dialog");return o(),n(y,{visible:h.isShow,"onUpdate:visible":t[1]||(t[1]=e=>h.isShow=e),class:"limit-reduce-dialog",width:"90%",isBrandNewStyle:"",isCenterView:"",onClosed:t[2]||(t[2]=e=>h.isShow=!1)},{header:s((()=>[l("span",_f,m(e.$t("futuresMain.trade.limitReduce")),1)])),body:s((()=>[l("div",Af,[l("div",Rf,[l("span",{class:C(h.isBuySide?"green":"red")},m(h.symbol),3),p(" "+m(e.$t("futuresMain.trade.reduceBy")),1)]),d(f,{value:u.limitPrice,"onUpdate:value":t[0]||(t[0]=e=>u.limitPrice=e),enableThousandSeparator:"",class:"price-input",placeholder:e.$t("t.price"),step:h.marketDetail.minPriceIncrement},null,8,["value","placeholder","step"]),l("div",Ff,[l("div",Ef,m(e.$t("futuresMain.openPosition.unrealizedPNL")),1),l("div",{class:C({green:h.unrealizedPnlInSettleAsset>0,red:h.unrealizedPnlInSettleAsset<0})},[h.isPriceValid?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(h.unrealizedPnlInSettleAsset,{formatKey:i.position.unrealizedPnlFilter,signed:!0,compact:Math.abs(h.unrealizedPnlInSettleAsset)>
1=u.COMPACT_NUMBER_THRESHOLD}))+" "+m(i.position.settleWithNonUSDAsset)+" ("+m(e.$filters.formatNumber(h.unrealizedPnlRoe,{postfix:" %",defaultValue:"---",compact:Math.abs(h.unrealizedPnlRoe)>=u.COMPACT_NUMBER_THRESHOLD}))+") ",1)],64)):(o(),c(g,{key:1},[p("-")],64))],2)]),d(v,{class:"primary block reduce-btn",disabled:!h.isPriceValid,onClick:h.handleClickReduce},{default:s((()=>[p(m(e.$t("futuresMain.trade.limitReduce")),1)])),_:1},8,["disabled","onClick"])])])),_:1},8,["visible"])}],["__scopeId","data-v-bfd1b3fe"]]),zf={LONG:"long",BUY:"long",SHORT:"short",SELL:"short"};const $f=$n({name:"DirectionTag",props:{direction:{type:String,default:""},displayText:{type:String,default:""}},computed:{tagClasses(){return zf[this.direction.toUpperCase()]}}},[["render",function(e,t,i,r,a,n){return o(),c("span",{class:C(["tag",n.tagClasses])},m(i.displayText),3)}],["__scopeId","data-v-0441690e"]]),Nf={name:"ReversePositionDialog",components:{Dialog:Mi,DirectionTag:$f,IconArrowRight:Oi,IconNotification:Di},props:{visible:{type:Boolean,required:!0},position:{type:Object,required:!0}},emits:["update:visible"],data:()=>({FuturesSizeType:Ke,isLoading:!1,lastPrice:0}),computed:{...b("futures",{futuresMarkPriceMap:"futuresMarkPriceMap",futuresMarketMap:"marketMap",futuresMarketDetailMap:"marketDetailMap",isHedgeMode:"isHedgeMode"}),...y(pt,["isLeaderMode"]),...y(ci,["takerFee"]),...U(["isUnifiedWallet"]),...U("futures",["currentMarketPositionMode","currentMargin","initialMarginPercentage"]),...y(Ge,["isContractSizeType"]),isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},symbol(){return this.position.symbol},isBuySide(){return"MODE_BUY"===this.position.orderModeName},marketDetail(){return this.futuresMarketDetailMap[this.symbol]||{}},positionLeverageType(){return this.isPositionMarginIsolated?this.$t("t.isolated"):this.$t("futuresMain.trade.cross")},displayLeverage(){const{isolatedLeverage:e}=this.position,t=bi(e,this.initialMarginPercentage(this.symbol),2);return`${this.positionLeverageType} ${t}x`},reverseLeverage(){var e;if(this.isUnifiedWallet&&this.isPositionMarginIsolated){const{positionMode:t,positionDirection:i}=this.position;if(t===li.HEDGE){const e=i===fi.LONG?fi.SHORT:fi.LONG,t=this.currentMargin.find((t=>t.positionDirection===e));return`${this.positionLeverageType} ${null==t?void 0:t.leverage}x`}if(t===li.ISOLATED)return`${this.positionLeverageType} ${null==(e=this.currentMargin[0])?void 0:e.leverage}x`}return this.displayLeverage},showLeverageWarning(){return this.displayLeverage!==this.reverseLeverage},markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},priceFilter(){return this.futuresMarketMap[this.symbol].priceFilter},displaySize(){if(this.isContractSizeType)return`${this.position.totalContracts}`;return`${Qe(this.position.totalContracts,this.symbol)} ${this.futuresMarketMap[this.symbol].baseCurrency}`},displayEntryPrice(){return this.$filters.formatNumber(this.position.entryPrice,{formatKey:this.priceFilter+1,roundMode:this.isBuySide?S.ROUND_UP:S.ROUND_DOWN})},displayMarkPrice(){return this.$filters.formatNumber(this.markPrice,this.priceFilter)},initialMargin(){const{isolatedLeverage:e}=this.position;return e?S(1).div(e).toNumber():this.initialMarginPercentage(this.symbol)||1},isPositionMarginIsolated(){return this.position.marginTypeName===Ci.ISOLATED}},mounted(){this.extraSubscribe({topics:[this.getTradeHistoryTopic()],callbacks:{tradeHistory:e=>{const t=e[0].price;this.lastPrice=t}}})},beforeUnmount(){this.unSubscribeTopics({topics:[this.getTradeHistoryTopic()]})},methods:{...v("futures",["futuresOrder"]),...f(Ri,["extraSubscribe","unSubscribeTopics"]),getTradeHistoryTopic(){return`tradeHistory:${this.symbol}-${Ai}`},async handleClickConfirm(){try{this.isLoading=!0;const{symbol:e,positionId:t}=this.position,i=this.isLeaderMode?Xt.closePosition:Ve.closePosition,[r]=await i({symbol:e,type:"MARKET",positionId:t});if(r.remainingSize>0)return;const a=await this.getMaxSizeFromOrderBook();if(0===a)return;const n=Math.min(r.fillSize,a);await this.createReverseMarketOrder(e,n)}finally{this.isLoading=!1,this.isShow=!1}},async createReverseMarketOrder(e,t){if(0===t)return;
1const i={symbol:e,type:"MARKET",side:this.isBuySide?"SELL":"BUY",size:t,positionMode:this.currentMarketPositionMode.positionMode},r=Number(this.lastPrice)||0,a=Number(this.marketDetail.contractSize)||0,n=S(r).times(t).times(a).toNumber();await this.futuresOrder({orderData:i,orderValue:n})},async getAvailableBalance(){try{const{responses:e}=await Ve.getWalletDisplay(),t=!this.isUnifiedWallet&&this.isPositionMarginIsolated?this.position.activeWalletName.replace("-USDT","-USD"):xi,i=e.find((e=>this.isLeaderMode?e.activeWalletName.startsWith("LEAD"):e.activeWalletName===t));return this.isUnifiedWallet&&this.isPositionMarginIsolated?_i(i):(null==i?void 0:i.availableBalance)||0}catch(e){return 0}},async getMaxSizeFromOrderBook(){const e=await this.getAvailableBalance(),t=await Ve.getOrderBookL2({symbol:this.symbol,depth:50}),i=this.isBuySide?t.buyQuote:t.sellQuote;return this.calculateMaxSizeFromContractOrderBook({quoteList:i,availableBalance:e,contractSize:this.marketDetail.contractSize,initialMargin:this.initialMargin,takerFee:this.takerFee,adjConf:this.marketDetail.initialMarginMarkup||Ii})},calculateMaxSizeFromContractOrderBook({quoteList:e,availableBalance:t,initialMargin:i,takerFee:r,contractSize:a,adjConf:n}){const o=S(i),s=S(r).times(2),l=S(a);let u=S(t),c=S(0);for(const{price:d,size:p}of e){const e=l.times(d).times(o.plus(s)).times(n),t=S(e).times(p);if(S(t).gt(u)){c=c.plus(S(u).div(e).dp(0,S.ROUND_DOWN));break}c=c.plus(p),u=u.minus(t)}return c.toNumber()}}},Uf={class:"header-text"},Hf={class:"dialog-content"},Vf={class:"reverse-description"},Wf={class:"position-info-wrap"},qf={class:"position-block"},Gf={class:"position-title"},Kf={class:"symbol-wrap"},Qf={class:"symbol"},jf={class:"position-content"},Yf={class:"info-item"},Zf={class:"item-label"},Xf={class:"info-item"},Jf={class:"item-label"},ev={class:"item-value"},tv={class:"info-item"},iv={class:"item-label"},rv={class:"item-value"},av={class:"position-block"},nv={class:"position-title"},ov={class:"symbol-wrap"},sv={class:"symbol"},lv={class:"position-content"},uv={class:"info-item"},cv={class:"item-label"},dv={class:"info-item"},pv={class:"item-label"},hv={class:"item-value"},mv={class:"info-item"},gv={class:"item-label"},fv={class:"item-value"},vv={class:"position-icon-wrap"},yv={key:0,class:"warning-block"},bv={class:"icon-wrap"},Sv={class:"buttons-wrap"};const Cv=$n(Nf,[["render",function(e,t,i,r,u,g){const f=a("DirectionTag"),v=a("IconArrowRight"),y=a("IconNotification"),b=a("BaseButton"),S=a("Dialog");return o(),n(S,{visible:g.isShow,"onUpdate:visible":t[1]||(t[1]=e=>g.isShow=e),class:"reverse-position-dialog",width:e.isMobile?"90%":"530px",isBrandNewStyle:"",isCenterView:"",onClosed:t[2]||(t[2]=e=>g.isShow=!1)},{header:s((()=>[l("span",Uf,m(e.$t("futuresMain.closePosition.reversePosition")),1)])),body:s((()=>[l("div",Hf,[l("div",Vf,m(e.$t("futuresMain.closePosition.reversePosition.description")),1),l("div",Wf,[l("div",qf,[l("div",Gf,[l("div",Kf,[l("div",Qf,m(g.symbol),1),l("div",{class:C({"brand-color-positive":g.isBuySide,"brand-color-negative":!g.isBuySide})},m(g.displayLeverage),3)]),d(f,{direction:g.isBuySide?"Long":"Short",displayText:g.isBuySide?"Long":"Short"},null,8,["direction","displayText"])]),l("div",jf,[l("div",Yf,[l("div",Zf,m(e.$t("t.positionSize")),1),l("div",{class:C(["item-value",{"brand-color-positive":g.isBuySide,"brand-color-negative":!g.isBuySide}])},m(g.isBuySide?"+":"-")+" "+m(g.displaySize),3)]),l("div",Xf,[l("div",Jf,m(e.$t("futuresMain.openPosition.entryPrice")),1),l("div",ev,m(g.displayEntryPrice),1)]),l("div",tv,[l("div",iv,m(e.$t("futuresMain.openPosition.markPrice")),1),l("div",rv,m(g.displayMarkPrice),1)])])]),l("div",av,[l("div",nv,[l("div",ov,[l("div",sv,m(g.symbol),1),l("div",{class:C({"brand-color-positive":!g.isBuySide,"brand-color-negative":g.isBuySide})},m(g.reverseLeverage),3)]),d(f,{direction:g.isBuySide?"Short":"Long",displayText:g.isBuySide?"Short":"Long"},null,8,["direction","displayText"])]),l("div",lv,[l("div",uv,[l("div",cv,m(e.$t("t.positionSize")),1),l("div",{class:C(["item-value",{"brand-color-positive":!g.isBuySide,"brand-color-negative":g.isBuySide}])},m(g.isBuySide?"-":"+")+" "+m(g.displaySize),3)]),l("div",dv,[l("div",pv,m(e.$t("futuresMain.openPosition.entryPrice")),1),l("div",hv,m(e.$t("trading.marketPrice")),1)]),l("div",mv,[l("div",gv,m(e.$t("futuresMain.openPosition.markPrice")),1),l("div",fv,m(g.displayMarkPrice),1)])])]),l("div",vv,[d(v,{width:"12",height:"12"})])]),g.showLeverageWarning?(o(),c("div",yv,[l("div",bv,[d(y,{class:"warning-icon"})]),p(" "+m(e.$t("futuresMain.closePosition.reversePosition.warning",{currentLeverage:g.displayLeverage,reverseLeverage:g.reverseLeverage})),1)])):h("",!0)]),l("div",Sv,[d(b,{class:"primary",size:"large",isLoading:u.isLoading,onClick:g.handleClickConfirm},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["isLoading","onClick"]),d(b,{class:"cancel-button",size:"extra-small",onClick:t[0]||(t[0]=e=>g.isShow=!1)},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})])])),_:1},8,["visible","width"])}],["__scopeId","data-v-a61ad831"]]),Pv={name:"SettleInDialog",components:{Dialog:Mi},props:{visible:{type:Boolean,required:!0},position:{type:Object,required:!0}},emits:["update:visible"],data(){return{isLoading:!1,selectedTab:1,selectedCoin:this.position.settleWithNonUSDAsset,settleInTooltipUrl:Pi.settleInTooltipUrl}},computed:{...b(["currencyMap"]),...b("futures",{futuresMarketDetailMap:"marketDetailMap"}),isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},marketDetail(){const e=this.position.symbol;return this.futuresMarketDetailMap[e]||{}},cryptoList(){var e;return(null==(e=this.marketDetail)?void 0:e.availableSettlement).filter((e=>this.currencyMap[e].isCrypto))},fiatList(){var e;return(null==(e=this.marketDetail)?void 0:e.availableSettlement).filter((e=>this.currencyMap[e].isFiat))},showList(){return 1===this.selectedTab?this.cryptoList:this.fiatList}},methods:{async setSettleCoin(){try{this.isLoading=!0,await Ve.switchPositionAsset(this.position.symbol,this.selectedCoin,this.position.positionId),this.isShow=!1}finally{this.isLoading=!1}}}},kv={class:"header-text"},Tv={class:"dialog-content"},Mv={class:"tabs"},Lv={class:"coins"},wv=["onClick"],Dv=["href"],Ov={class:"buttons-wrap"};const Iv=$n(Pv,[["render",function(e,t,i,r,u,f){const v=a("i18n-t"),y=a("BaseButton"),b=a("Dialog");return o(),n(b,{visible:f.isShow,"onUpdate:visible":t[3]||(t[3]=e=>f.isShow=e),class:"settin-in-dialog",width:e.isMobile?"90%":"480px",
1isBrandNewStyle:"",isCenterView:"",onClosed:t[4]||(t[4]=e=>f.isShow=!1)},{header:s((()=>[l("span",kv,m(e.$t("futuresMain.openPosition.settleIn")),1)])),body:s((()=>[l("div",Tv,[l("div",Mv,[l("div",{class:C(["tab",{selected:1===u.selectedTab}]),onClick:t[0]||(t[0]=e=>u.selectedTab=1)},m(e.$t("t.crypto")),3),l("div",{class:C(["tab",{selected:2===u.selectedTab}]),onClick:t[1]||(t[1]=e=>u.selectedTab=2)},m(e.$t("t.fiat")),3)]),l("div",Lv,[(o(!0),c(g,null,R(f.showList,(e=>(o(),c("div",{key:e,class:C(["coin",{selected:e===u.selectedCoin}]),onClick:t=>u.selectedCoin=e},m(e),11,wv)))),128))]),u.settleInTooltipUrl?(o(),n(v,{key:0,tag:"p",class:"settle-in-hint",keypath:"futuresMain.openPosition.settleIn.tip2"},{link:s((()=>[l("a",{href:u.settleInTooltipUrl,target:"_blank",rel:"noopener noreferrer"},m(e.$t("t.here")),9,Dv)])),_:1})):h("",!0)]),l("div",Ov,[d(y,{class:"primary",size:"large",isLoading:u.isLoading,onClick:f.setSettleCoin},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["isLoading","onClick"]),d(y,{class:"cancel-button",size:"extra-small",onClick:t[2]||(t[2]=e=>f.isShow=!1)},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})])])),_:1},8,["visible","width"])}],["__scopeId","data-v-9c1c35bd"]]);function xv({shareLib:e,wasmFunction:t,params:i,defaultResult:r=0,enableLog:a=!1}){if(!e||!t||!i)return r;const n=_o(JSON.stringify(i)),o=JSON.parse(Ao(t(n)));return o.success?o.data:r}const _v={name:"TradingEditDialog",components:{Dialog:Mi},props:{visible:{type:Boolean,required:!0},title:{type:String,default:""},contentClass:{type:String,default:""},disableConfirm:{type:Boolean,default:!1},isLoading:{type:Boolean,default:!1}},emits:["update:visible","clickConfirm"],computed:{isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}}},Av={class:"title"},Rv={class:"dialog-content-wrap"},Fv={class:"buttons-wrap"};const Ev=$n(_v,[["render",function(e,t,i,r,u,c){const h=a("BaseButton"),g=a("Dialog");return o(),n(g,{visible:c.isShow,"onUpdate:visible":t[2]||(t[2]=e=>c.isShow=e),class:"edit-dialog",width:"560px",isCenterView:""},{header:s((()=>[l("div",Av,m(i.title),1)])),body:s((()=>[l("div",Rv,[_(e.$slots,"content",{},void 0,!0)]),l("div",Fv,[d(h,{class:"confirm-button primary block",disabled:i.disableConfirm,isLoading:i.isLoading,size:"large",onClick:t[0]||(t[0]=t=>e.$emit("clickConfirm"))},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["disabled","isLoading"]),d(h,{class:"cancel-btn block",onClick:t[1]||(t[1]=e=>c.isShow=!1)},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})])])),_:3},8,["visible"])}],["__scopeId","data-v-e4caa4e4"]]),Bv="increase",zv="decrease",$v={name:"AdjustMarginDialog",components:{EditDialog:Ev,IconArrowRight:Oi,FuturesChoose:om,TradingInput:Wn,PercentSlider:Kh},props:{visible:{type:Boolean,required:!0},position:{type:Object,required:!0}},emits:["update:visible"],data:()=>({FUTURES_BASE_CURRENCY:ht,selectedType:Bv,adjustInputValue:"",sliderValue:0,isLoading:!1,topicKey:""}),computed:{...b(["includeUnrealizedPnl"]),...b("futures",{futuresWalletMap:"walletMap",futuresMarketMap:"marketMap",futuresMarketDetailMap:"marketDetailMap",futuresMarkPriceMap:"futuresMarkPriceMap",leaderWalletMap:"leaderWalletMap",futuresMarketAvailableBalanceMap:"marketAvailableBalanceMap"}),...y(pt,["isLeaderMode"]),...y(ci,["takerFee"]),...U("futures",["currentMargin","maintenanceMarginPercentage","leaderMainWallet","marketData"]),isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},isIncrease(){return this.selectedType===Bv},adjustTypeList(){return[{id:Bv,lang:this.$t("t.increase")},{id:zv,lang:this.$t("t.decrease")}]},isolatedWalletName(){var e,t,i;return this.isLeaderMode?null==(e=this.position)?void 0:e.activeWalletName:null==(i=null==(t=this.position)?void 0:t.activeWalletName)?void 0:i.replace("-USDT","-USD")},isolatedWallet(){const e=this.isLeaderMode?this.leaderWalletMap:this.futuresWalletMap;return(null==e?void 0:e[this.isolatedWalletName])||{}},fromWalletName(){var e;return this.isLeaderMode?this.isIncrease?null==(e=this.leaderMainWallet)?void 0:e.activeWalletName:this.isolatedWalletName:this.isIncrease?xi:this.isolatedWalletName},toWalletName(){var e;return this.isLeaderMode?this.isIncrease?this.isolatedWalletName:null==(e=this.leaderMainWallet)?void 0:e.activeWalletName:this.isIncrease?this.isolatedWalletName:xi},maxPossibleValue(){if(this.isIncrease)return S(this.futuresMarketAvailableBalanceMap[this.symbol]||0).dp(2,S.ROUND_DOWN).toNumber();const{walletTotalValue:e}=this.isolatedWallet,{minimumRequiredMargin:t,unrealizedPnl:i}=this.position;let r=S(e).minus(t);return i<0&&(r=r.minus(Math.abs(i))),r=S.max(r,0),r.dp(2,S.ROUND_DOWN).toNumber()},showInputError(){return!!this.adjustInputValue&&S(this.adjustInputValue).gt(this.maxPossibleValue)},disableConfirm(){return this.showInputError},symbol(){return this.position.symbol},market(){return this.futuresMarketMap[this.symbol]||{}},marketDetail(){return this.futuresMarketDetailMap[this.symbol]||{}},isBuySide(){return"MODE_BUY"===this.position.orderModeName},markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},priceFilter(){return this.market.priceFilter??2},currentPositionMargin(){return this.isolatedWallet.marginBalance||0},displayCurrentPositionMargin(){return this.$filters.formatNumber(this.currentPositionMargin,{formatKey:2,postfix:` ${ht}`})},displayCurrentLiqPrice(){return this.$filters.formatNumber(this.position.liquidationPrice,{formatKey:this.priceFilter,roundMode:this.isBuySide?S.ROUND_DOWN:S.ROUND_HALF_UP,postfix:` ${ht}`})},displayNewPositionMargin(){if(!this.adjustInputValue||"0"===this.adjustInputValue)return this.displayCurrentPositionMargin;const e=this.estimatedMarginAdjustment.newPositionMargin||0;return this.$filters.formatNumber(e,{formatKey:2,postfix:` ${ht}`})},displayNewLiqPrice(){const e=this.position.liquidationPrice,t=this.estimatedMarginAdjustment.estimatedLiquidationPrice||0;if(this.isBuySide&&e<t)return"-";if(!this.isBuySide&&e>t)return"-";if(!this.adjustInputValue||"0"===this.adjustInputValue)return this.displayCurrentLiqPrice;const i=Math.max(t,0);return this.$filters.formatNumber(i,{formatKey:this.priceFilter,postfix:` ${ht}`})},estimatedMarginAdjustment(){var e;const{isolatedLeverage:t,entryPrice:i,totalContracts:r}=this.position,{contractSize:a=1,initialMarginMarkup:n=Ii}=this.marketDetail,{fundingRate:o=0}=this.market,s=(null==(e=this.isolatedWallet)?void 0:e.originalAvailableBalance)||0,l=this.isBuySide?r:-r,u={adjustment:{adjustmentType:this.isIncrease?"INCREASE":"DECREASE",amount:this.adjustInputValue,contractSize:a,markPrice:this.markPrice},orderConfig:{leverage:t,takerFee:this.takerFee,maintenanceMarginRatio:this.maintenanceMarginPercentage(this.symbol),fundingRate:o,adjConf:n,isMarginIncludeUnrealizedPnl:this.includeUnrealizedPnl},curState:{availableBalance:s,positionMargin:this.currentPositionMargin,entryPrice:i,positionSize:l}};return xv({shareLib:this.$shareLib,wasmFunction:Ro,params:u,defaultResult:{estimatedLiquidationPrice:0,newPositionMargin:0}})}},async created(){this.toggleHideInsufficientBalancePopup(!0),this.checkPositionMarketMatch()},beforeUnmount(){this.toggleHideInsufficientBalancePopup(!1),this.topicKey&&this.unSubscribeTopics({topics:[this.topicKey]})},methods:{...v("futures",["updateMargin"]),...f(Vn,["toggleHideInsufficientBalancePopup"]),...f(Ri,["extraSubscribe","unSubscribeTopics"]),checkPositionMarketMatch(){this.marketData.symbol!==this.symbol&&(this.topicKey=`marginV2:${this.symbol}-${ht}
1`,this.extraSubscribe({topics:[this.topicKey],callbacks:{[this.topicKey]:e=>{this.updateMargin({margin:e})}}}))},onUpdateSelectedType(){this.adjustInputValue=0,this.sliderValue=0},onAdjustInputChange(e){this.sliderValue=e?S(e).div(this.maxPossibleValue).times(100).dp(0,S.ROUND_HALF_UP).toNumber():0},onSliderChange(e){this.sliderValue=e,this.adjustInputValue=S(this.maxPossibleValue).times(e).div(100).dp(2,S.ROUND_DOWN).toNumber()},onClickMaxButton(){this.adjustInputValue=this.maxPossibleValue,this.onAdjustInputChange(this.maxPossibleValue)},async submit(){if(!Number(this.adjustInputValue))return void(this.isShow=!1);const e=[{currency:ht,balance:this.adjustInputValue}];try{this.isLoading=!0;const t=this.isLeaderMode?Xt.walletTransfer:Xe.walletTransfer,i=this.isLeaderMode?{walletDest:this.toWalletName,walletSrc:this.fromWalletName,apiWallets:e}:{sourceWalletName:this.fromWalletName,targetWalletName:this.toWalletName,walletSrcType:Fi(this.fromWalletName),walletDestType:Fi(this.toWalletName),apiWallets:e},r=await t(i);if(this.isLeaderMode)return void(this.isShow=!1);r.requestId&&(this.isShow=!1)}catch(sU){}finally{this.isLoading=!1}}}},Nv={class:"margin-adjustment-control"},Uv={class:"max-adjust-wrap"},Hv={class:"data-label adjust-label"},Vv={class:"data-label adjust-label"},Wv={class:"data-value"},qv={class:"adjust-value-wrap"},Gv={class:"slider-wrap"},Kv={class:"margin-adjustment-preview"},Qv={class:"info-block"},jv={class:"position-data"},Yv={class:"data-label"},Zv={class:"data-value"},Xv={class:"position-data"},Jv={class:"data-label"},ey={class:"data-value"},ty={class:"divider-block"},iy={class:"icon-arrow-wrap"},ry={class:"info-block"},ay={class:"position-data"},ny={class:"data-label"},oy={class:"data-value"},sy={class:"position-data"},ly={class:"data-label"},uy={class:"data-value"};const cy=$n($v,[["render",function(e,t,i,r,u,c){const p=a("Tooltip"),h=a("FuturesChoose"),g=a("TradingInput"),f=a("PercentSlider"),v=a("IconArrowRight"),y=a("EditDialog");return o(),n(y,{visible:c.isShow,"onUpdate:visible":t[3]||(t[3]=e=>c.isShow=e),title:e.$t("futuresMain.adjustMargin"),disableConfirm:c.disableConfirm,isLoading:u.isLoading,onClickConfirm:c.submit},{content:s((()=>[l("div",Nv,[l("div",Uv,[l("div",Hv,m(e.$t("margin.usdt")),1),l("div",Vv,[d(p,{tooltip:c.isIncrease?e.$t("max.increase.possibile.tip"):e.$t("max.decrease.possibile.tip"),content:c.isIncrease?e.$t("max.increase.possibile"):e.$t("max.decrease.possibile")},null,8,["tooltip","content"])]),l("div",Wv,m(`${c.maxPossibleValue} ${u.FUTURES_BASE_CURRENCY}`),1)]),l("div",qv,[d(h,{form:u.selectedType,"onUpdate:form":[t[0]||(t[0]=e=>u.selectedType=e),c.onUpdateSelectedType],class:"adjust-type-select",items:c.adjustTypeList},null,8,["form","items","onUpdate:form"]),d(g,{value:u.adjustInputValue,"onUpdate:value":t[2]||(t[2]=e=>u.adjustInputValue=e),class:"adjust-input",enableThousandSeparator:"",step:.01,maxDecimalPlaces:2,min:0,max:c.maxPossibleValue,errorShown:c.showInputError,onInput:c.onAdjustInputChange},{content:s((()=>[l("span",{class:"max-button",onClick:t[1]||(t[1]=(...e)=>c.onClickMaxButton&&c.onClickMaxButton(...e))},m(e.$t("amount-max")),1)])),_:1},8,["value","max","errorShown","onInput"])]),l("div",Gv,[d(f,{value:u.sliderValue,showPercentageSign:"",onChange:c.onSliderChange},null,8,["value","onChange"])])]),l("div",Kv,[l("div",Qv,[l("div",jv,[l("span",Yv,[d(p,{tooltip:e.$t("trading.currentPositionMargin.tip"),content:e.$t("trading.currentPositionMargin")},null,8,["tooltip","content"])]),l("span",Zv,m(c.displayCurrentPositionMargin),1)]),l("div",Xv,[l("span",Jv,m(e.$t("trading.currentLiquidationPrice")),1),l("span",ey,m(c.displayCurrentLiqPrice),1)])]),l("div",ty,[t[4]||(t[4]=l("div",{class:"rectangle"},null,-1)),l("div",iy,[d(v,{class:"icon-arrow",width:"12",height:"12"})])]),l("div",ry,[l("div",ay,[l("span",ny,m(e.$t("trading.newPositionMargin")),1),l("span",oy,m(c.displayNewPositionMargin),1)]),l("div",sy,[l("span",ly,m(e.$t("trading.newEstLiquidationPrice")),1),l("span",uy,m(c.displayNewLiqPrice),1)])])])])),_:1}
1,8,["visible","title","disableConfirm","isLoading","onClickConfirm"])}],["__scopeId","data-v-d4d9b0ce"]]),dy={class:"title"},py={class:"confirm-msg-wrap"},hy=$n(A({__name:"CloseAllConfirmDialog",props:ae({isFutures:{type:Boolean}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:ae(["confirm"],["update:visible"]),setup(e,{emit:t}){const i=ne(e,"visible"),r=t,{isLeader:u,isLeaderModeActive:c}=Q(pt());function h(){i.value=!1,r("confirm")}return(e,t)=>{const r=a("BaseButton");return o(),n(mi,{visible:i.value,"onUpdate:visible":t[1]||(t[1]=e=>i.value=e),class:"action-confirm-dialog",width:"560px"},{buttons:s((()=>[d(r,{class:"primary block",size:"large",onClick:h},{default:s((()=>[p(m(e.$t("t.confirm"))+m(e.isFutures&&x(u)?` (${x(c)?e.$t("copyTrading.lead"):e.$t("debitCard.landing.feesLimits.personal")})`:""),1)])),_:1}),d(r,{class:"cancel-btn block",size:"large",onClick:t[0]||(t[0]=e=>i.value=!1)},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})])),default:s((()=>[l("h6",dy,[_(e.$slots,"title",{},void 0,!0)]),l("div",py,[_(e.$slots,"message",{},void 0,!0)])])),_:3},8,["visible"])}}}),[["__scopeId","data-v-1f28736f"]]),my={class:"table-wrapper"},gy=$n(A({__name:"TableWithActionsPanel",setup(e){const t=T(),i=T(!1);let r=null;const a=()=>{const e=t.value;if(!e)return;const{scrollLeft:r,scrollWidth:a,clientWidth:n}=e,o=Math.abs(r+n-a)<1;i.value=!o};return L((()=>{oe((()=>{var e,i;null==(e=t.value)||e.addEventListener("scroll",a),r=new MutationObserver(a);const n=null==(i=t.value)?void 0:i.parentNode;n&&(r.observe(n,{attributes:!0,subtree:!0}),a())}))})),w((()=>{var e;null==(e=t.value)||e.removeEventListener("scroll",a),null==r||r.disconnect()})),(e,r)=>(o(),c("div",{ref_key:"tableWithActionsWrapper",ref:t,class:"table-with-actions-wrapper"},[l("div",my,[_(e.$slots,"table",{},(()=>[_(e.$slots,"default",{},void 0,!0)]),!0),e.$slots.actions?(o(),c("div",{key:0,class:C(["actions-panel",{shadow:i.value}])},[_(e.$slots,"actions",{},void 0,!0)],2)):h("",!0)])],512))}}),[["__scopeId","data-v-fb604477"]]);const fy=$n({name:"IconProPosition",components:{Icon:Ee}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{"aria-label":"whatsapp2",width:"16",height:"16"},{default:s((()=>t[0]||(t[0]=[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.66667 3.19967C2.22484 3.19967 1.86667 3.55785 1.86667 3.99967V11.9997C1.86667 12.4415 2.22484 12.7997 2.66667 12.7997H13.3333C13.7752 12.7997 14.1333 12.4415 14.1333 11.9997V3.99967C14.1333 3.55785 13.7752 3.19967 13.3333 3.19967H2.66667ZM0 3.99967C0 2.52692 1.19391 1.33301 2.66667 1.33301H13.3333C14.8061 1.33301 16 2.52692 16 3.99967V11.9997C16 13.4724 14.8061 14.6663 13.3333 14.6663H2.66667C1.19391 14.6663 0 13.4724 0 11.9997V3.99967Z",fill:"currentColor"},null,-1),l("rect",{x:"3.33325",y:"4.40039",width:"9.33333",height:"2.26667",rx:"1",fill:"currentColor"},null,-1)]))),_:1,__:[0]})}]]);const vy=$n({name:"IconLitePosition",components:{Icon:Ee}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{"aria-label":"whatsapp2",width:"16",height:"16"},{default:s((()=>t[0]||(t[0]=[l("g",null,[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.2 1.86621C0.537258 1.86621 0 2.40347 0 3.06621C0 3.72895 0.537258 4.26621 1.2 4.26621H6V1.86621H1.2ZM14.8 1.86621H8V4.26621H14.8C15.4627 4.26621 16 3.72895 16 3.06621C16 2.40347 15.4627 1.86621 14.8 1.86621ZM8 6.66569H14.8C15.4627 6.66569 16 7.20295 16 7.86569C16 8.52843 15.4627 9.06569 14.8 9.06569H8V6.66569ZM1.2 6.66569C0.537258 6.66569 0 7.20295 0 7.86569C0 8.52843 0.537258 9.06569 1.2 9.06569H6V6.66569H1.2ZM8 11.4652H14.8C15.4627 11.4652 16 12.0024 16 12.6652C16 13.3279 15.4627 13.8652 14.8 13.8652H8V11.4652ZM1.2 11.4652C0.537258 11.4652 0 12.0024 0 12.6652C0 13.3279 0.537258 13.8652 1.2 13.8652H6V11.4652H1.2Z",fill:"currentColor"})],-1)]))),_:1,__:[0]})}]]),yy={name:"LitePositionFilterPanel",props:{filterSettings:{type:Object,required:!0},toggleFilterPanel:{type:Function,required:!0},actionRef:{type:HTMLElement,required:!0}},computed:{...y(pt,["isLeaderMode"])},mounted(){document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)},methods:{handleClickOutside(e){const t=this.$refs.filterPanel;!t||t.contains(e.target)||this.actionRef.contains(e.target)||this.toggleFilterPanel(!1)}}},by={ref:"filterPanel",class:"position-filter-panel"};const Sy=$n(yy,[["render",function(e,t,i,r,n,l){const u=a("Checkbox");return o(),c("div",by,[d(u,{value:i.filterSettings.value,"onUpdate:value":t[0]||(t[0]=e=>i.filterSettings.value=e)},{default:s((()=>[p(m(e.$t("futuresMain.openPosition.value")),1)])),_:1},8,["value"]),d(u,{value:i.filterSettings.exposure,"onUpdate:value":t[1]||(t[1]=e=>i.filterSettings.exposure=e)},{default:s((()=>[p(m(e.$t("futuresMain.openPosition.exposure")),1)])),_:1},8,["value"]),d(u,{value:i.filterSettings.adl,"onUpdate:value":t[2]||(t[2]=e=>i.filterSettings.adl=e)},{default:s((()=>t[4]||(t[4]=[p("ADL")]))),_:1,__:[4]},8,["value"]),B(d(u,{value:i.filterSettings.settleIn,"onUpdate:value":t[3]||(t[3]=e=>i.filterSettings.settleIn=e)},{default:s((()=>[p(m(e.$t("futuresMain.openPosition.settleIn")),1)])),_:1},8,["value"]),[[N,!e.isLeaderMode]])],512)}],["__scopeId","data-v-a55a1df5"]]),{enableMarginCall:Cy}=mt,Py="PRO",ky="LITE",Ty={name:"Positions",components:{TabSwitcher:Jp,C
1ancelAllButton:eh,Position:of,ClosePosition:yh,ClosePositionConfirmationPopup:ff,MarginCallDialog:If,SharePnlDialog:Kn,LimitReduceDialog:Bf,ReversePositionDialog:Cv,SettleInDialog:Iv,AdjustMarginDialog:cy,IconSetting2:Gn,IconLink:os,LitePositionFilterPanel:Sy,NoDataAvailable:it,CloseAllConfirmDialog:hy,TableWithActionsPanel:gy},props:{boxFilled:{type:Boolean,default:!1},contentWidth:{type:Number,default:0}},data:()=>({supportConfig:Pi,FuturesSizeType:Ke,isLoading:!0,currentTab:"",showConfirmationPopup:!1,selectedPositionId:"",positionToClose:{},positionToSettleIn:{},closePositionType:"",closePositionPrice:0,prevHeight:0,enableMarginCall:Cy,isShowMarginCallPopup:!1,showShareDialog:!1,showLimitReduceDialog:!1,showReverseDialog:!1,showSettleInDialog:!1,showAdjustMarginDialog:!1,sharingPosition:{},popupStorageKey:$i.NOT_SHOW_POSITION_CONFIRM_POPUP,isOpenFilterPanel:!1,currentHoverRow:"",filterSettings:{value:!1,exposure:!1,adl:!1,settleIn:!0},isShowCancelAllConfirmDialog:!1}),computed:{...b({lang:"lang",isLogin:"loginState",userConfig:"userConfig",includeUnrealizedPnl:"includeUnrealizedPnl"}),...b("futures",{futuresMarketMap:"marketMap",futuresMarketList:"marketList",openPositionMap:"openPositionMap",openPositionList:"openPositionList",leaderPositionMap:"leaderPositionMap",leaderPositionList:"leaderPositionList"}),...y(Vn,["isShowAllPositions"]),...y(pt,["isLeaderMode"]),...U(["isUnifiedWallet","userName","isArabic","isNightTheme"]),...U("futures",["marketData","openPosition","currentMarketPositionMode","marginMode","initialMarginPercentage"]),...y(Ge,["isContractSizeType"]),styleVars(){return{"--title-font-size":"ja-JP"===this.lang?"10px":"12px"}},tabList(){return[{value:Py,label:this.$t("t.pro"),component:fy},{value:ky,label:this.$t("t.lite"),component:vy}]},isProMode(){return this.currentTab===Py},isLiteMode(){return this.currentTab===ky},isSmallWidthContainer(){return this.contentWidth<768},marginCallTipAction(){return Cy&&this.isLogin&&!this.isLeaderMode?{text:this.$t("trade.marginCall.setup"),action:()=>{this.isShowMarginCallPopup=!0}}:null},liteModeHeaderList(){return[{id:"frontBar",content:""},{id:"symbol",class:"position-symbol",content:this.$t("futuresMain.symbol")},{id:"size",content:this.$t("t.positionSize"),tooltip:this.$t("futuresMain.openPosition.size.tip")},this.filterSettings.value&&{id:"value",content:this.$t("futuresMain.openPosition.value"),tooltip:this.$t("futuresMain.openPosition.value.tip")},{id:"entryPrice",content:this.$t("futuresMain.openPosition.entryPrice"),tooltip:this.$t("futuresMain.openPosition.entryPrice.tip")},{id:"markPrice",content:this.$t("futuresMain.openPosition.markPrice"),tooltip:this.$t("futuresMain.openPosition.markPrice.tip")},{id:"liqPrice",content:this.$t("futuresMain.openPosition.liqPrice"),tooltip:this.$t("futuresMain.openPosition.liqPrice.tip.v2")},{id:"unrealizedPNL",content:this.$t("futuresMain.openPosition.unrealizedPNL"),tooltip:this.$t("futuresMain.openPosition.unrealizedPNL.tip")},{id:"marginRatio",content:this.$t("t.marginRatio"),tooltip:this.$t("futuresMain.openPosition.marginRatio.tip"),tipBottomAction:this.marginCallTipAction},this.isUnifiedWallet&&{id:"positionMargin",content:this.$t("futuresMain.openPosition.margin"),tooltip:this.$t("futuresMain.openPosition.positionMargin.tip")},{id:"tpsl",content:this.$t("t.tpsl")},this.filterSettings.exposure&&{id:"exposure",content:this.$t("futuresMain.openPosition.exposure"),tooltip:this.includeUnrealizedPnl?this.$t("futuresMain.exposure.hint.2.excludeUnrealizedPnl"):this.$t("futuresMain.exposure.hint.2")},this.filterSettings.adl&&{id:"adl",content:"ADL",tooltip:this.$t("futuresMain.contractInfo.priorityRanking.tip")},this.filterSettings.settleIn&&!this.isLeaderMode&&{id:"settleIn",content:this.$t("futuresMain.openPosition.settleIn"),tooltip:this.$t("futuresMain.openPosition.settleIn.tip")}].filter((e=>e))},displayedPositions(){return this.isLeaderMode?this.leaderPositionList:this.openPositionList},displayedPositionMap(){return this.isLeaderMode?this.leaderPositionMap:this.openPositionMap},filterPositions(){const e=this.marketData.symbol,t=this.displayedPositions.includes(e);if(!this.isShowAllPositions)return this.displayedPositions.includes(e)?this.displayedPositionMap[e].filter((e=>e.totalContracts>0)):[];const i=t?[...new Set([e,...this.displayedPositions])]:[...new Set(this.displayedPositions)],r=[];
1return i.forEach((e=>{const t=this.displayedPositionMap[e].filter((e=>e.totalContracts>0));r.push(...t)})),r},selectedPosition(){return this.selectedPositionId&&this.filterPositions.find((e=>e.positionId===this.selectedPositionId))||{}},showClosePosition(){return!this.noPosition},noPosition(){return 0===this.filterPositions.length}},watch:{"marketData.symbol":{flush:"post",handler(){this.isLoading=!0,this.getOpenPositionList().then((()=>{this.isLoading=!1}))}},filterPositions(e,t){e.length!==t.length&&this.$nextTick(this.onHeight)},isMobile(){this.$nextTick(this.onHeight)},currentTab(){this.updateUserConfigByKey({key:He.POSITION_DISPLAY_MODE,value:this.currentTab})},filterSettings:{handler:function(e){this.saveColumnSetting(e)},deep:!0},userConfig:{immediate:!0,handler(e){if(e){this.currentTab=e[He.POSITION_DISPLAY_MODE]||ky;const t=e[He.OPEN_POSITION_COLUMN_SETTING];t&&(this.filterSettings=t)}}}},async mounted(){this.getOpenPositionList().then((()=>{this.isLoading=!1})),this.$nextTick(this.onHeight)},methods:{...v(["updateUserConfigByKey"]),...v("futures",["getOpenPositionList","futuresOrder"]),...f(Vn,["setLeverageDialog"]),closeConfirmationPopup(){this.showConfirmationPopup=!1},handleClickClosePosition(e,t,i){if(this.closePositionType=e,this.positionToClose=t,e!==gh.REVERSE){if(e===gh.LIMIT){if(this.isSmallWidthContainer)return void(this.showLimitReduceDialog=!0);this.closePositionPrice=Number(i)}this.closePositionHandler()}else this.showReverseDialog=!0},handleClickReduce(e){this.closePositionPrice=Number(e),this.closePositionHandler()},async closePositionHandler(){await this.shouldHideConfirmPopupSetting()?this.closePositionOrder():this.showConfirmationPopup=!0},async closePositionOrder(e=!1){const{symbol:t,positionId:i,orderMode:r,totalContracts:a,totalValue:n,positionMode:o}=this.positionToClose;if(!this.isLoading){this.isLoading=!0,this.showConfirmationPopup=!1,e&&this.saveConfirmPopupSetting();try{if(this.closePositionType===gh.MARKET){const e=this.isLeaderMode?Xt.closePosition:Ve.closePosition;await e({symbol:t,type:"MARKET",positionId:i})}else if(this.closePositionType===gh.LIMIT){const e={symbol:t,type:"LIMIT",side:r===ot.BUY?"SELL":"BUY",price:this.closePositionPrice,size:a,reduceOnly:!0,positionMode:o,positionId:i};await this.futuresOrder({orderData:e,orderValue:n})}}catch(sU){}finally{this.isLoading=!1}}},onHeight(){var e;let t=this.$refs.header;if(!t)return;let i=this.$refs.contentList;if(!i)return;let r=0;const a=null==(e=i[0])?void 0:e.value;if(!this.noPosition&&a&&a.$el){const e=a.$el.getBoundingClientRect().height;r=t.getBoundingClientRect().height+e*i.length}const n=this.$refs["close-position-panel"];n&&(r+=n.getBoundingClientRect().height),r!==this.prevHeight&&(this.prevHeight=r,this.$emit("height",r))},shouldHideConfirmPopupSetting(){return zi(this.popupStorageKey)},saveConfirmPopupSetting(){Bi(this.popupStorageKey)},handleShare(e){const{symbol:t}=e;Li(wi.SHARE_POSITION_SHARE_ENTRANCE_CLICKED,{s1:"futures",s2:Ei(t)}),this.showShareDialog=!0,this.sharingPosition=e},toggleFilterPanel(e){this.isOpenFilterPanel=e},saveColumnSetting(){this.updateUserConfigByKey({key:He.OPEN_POSITION_COLUMN_SETTING,value:{...this.filterSettings}})},handleSettleIn(e){this.positionToSettleIn=e,this.showSettleInDialog=!0},handleEditLeverage(e){this.setLeverageDialog({show:!0,data:{...e,leverage:e.isolatedLeverage,marginMode:e.marginMode,initialMarginPercentage:this.initialMarginPercentage(e.symbol)}})},handleAdjustMargin(e){this.selectedPositionId=e,this.showAdjustMarginDialog=!0},openConfirmDialog(){this.isShowCancelAllConfirmDialog=!0},handleCancelAll(){(this.isLeaderMode?Xt.batchLeaderPositions:Ve.batchClosePositions)(this.isShowAllPositions?"ALL":this.marketData.symbol)}}},My={key:0,class:"switcher-wrap"},Ly={class:"switcher-right"},wy={key:0,ref:"settingWrap",class:"svg-wrapper"},Dy={ref:"header",class:"header-row"},Oy={key:0,class:"tx-align--left"},Iy={class:"size-unit"},xy={key:1},_y={key:1,class:"settle-in-header"},Ay=["href"],Ry=["href"],Fy={key:0,class:"no-position-block"},Ey={class:"close-position-panel"},By={class:"header-row title"},zy={key:0,class:"no-position-block"},$y={class:"highlight"};const Ny=$n(Ty,[["render",function(e,t,i,r,u,f){const v=a("TabSwitcher"),y=a("CancelAllButton"),b=a("IconSetting2"),S=a("LitePositionFilterPanel"),k=a("ToolTip"),T=a("i18n-t"),M=a("Tooltip"),L=a("IconLink"),w=a("Position"),D=a("NoDataAvailable"),O=a("ClosePosition"),I=a("TableWithActionsPanel"),x=a("ClosePositionConfirmationPopup"),_=a("MarginCallDialog"),A=a("SharePnlDialog"),F=a("LimitReduceDialog"),z=a("ReversePositionDialog"),$=a("SettleInDialog"),N=a("AdjustMarginDialog"),U=a("CloseAllConfirmDialog"),V=H("loading");return B((o(),c("div",{ref:"positions",class:C(["positions",{"box-fill":i.boxFilled}]),style:P(f.styleVars)},[l("div",{class:C(["content-wrap",{"small-size":f.isSmallWidthContainer}])},[f.isSmallWidthContainer?h("",!0):(o(),c("div",My,[d(v,{value:u.currentTab,"onUpdate:value":t[0]||(t[0]=e=>u.currentTab=e),class:"tab-switcher",list:f.tabList},null,8,["value","list"]),l("div",Ly,[d(y,{disabled:!f.filterPositions.length,text:e.$t("msg.closeAll"),onClick:f.openConfirmDialog},null,8,["disabled","text","onClick"]),f.isLiteMode?(o(),c("div",wy,[d(b,{class:"icon-setting",onClick:t[1]||(t[1]=e=>f.toggleFilterPanel(!u.isOpenFilterPanel))}),u.isOpenFilterPanel?(o(),n(S,{key:0,filterSettings:u.filterSettings,actionRef:e.$refs.settingWrap,toggleFilterPanel:f.toggleFilterPanel},null,8,["filterSettings","actionRef","toggleFilterPanel"])):h("",!0)],512)):h("",!0)])])),f.isLiteMode&&!f.isSmallWidthContainer?(o(),n(I,{key:1,class:"table-container"},te({table:s((()=>[l("table",{class:C(["position-list",{"is-empty":f.noPosition}])},[l("thead",null,[l("tr",Dy,[(o(!0),c(g,null,R(f.liteModeHeaderList,(i=>(o(),c("th",{key:i.id,class:C(["position-cell",i.class])},["size"===i.id?(o(),n(k,{key:0,tooltip:i.tooltip},{content:s((()=>[e.isContractSizeType?(o(),c("span",Oy,[p(m(e.$t("t.positionSize"))+" ",1),t[12]||(t[12]=l("br",null,null,-1)),l("span",Iy," ("+m(e.$t("futuresMain.contracts"))+") ",1)])):(o(),c("span",xy,m(e.$t("t.positionSize")),1))])),_:2},1032,["tooltip"])):"settleIn"===i.id&&Boolean(u.supportConfig.settleInTooltipUrl)?(o(),c("div",_y,[d(M,{content:i.content,delay:300},{tooltip:s((()=>[d(T,{tag:"p",keypath:"futuresMain.openPosition.settleIn.tip2"},{link:s((()=>[l("a",{href:u.supportConfig.settleInTooltipUrl,target:"_blank",rel:"noopener noreferrer"},m(e.$t("t.here")),9,Ay)])),_:1})])),_:2},1032,["content"]),l("a",{class:"settle-in-info-link",href:u.supportConfig.settleInTooltipUrl,target:"_blank",rel:"noopener noreferrer",onClick:t[2]||(t[2]=E((()=>{}),["stop"]))},[d(L,{class:"settle-in-info-icon"})],8,Ry)])):i.tooltip?(o(),n(k,{key:2,tooltip:i.tooltip,content:i.content,tipBottomAction:i.tipBottomAction,delay:i.tipBottomAction?300:""},null,8,["tooltip","content","tipBottomAction","delay"])):(o(),c(g,{key:3},[p(m(i.content),1)],64))],2)))),128))],512)]),l("tbody",null,[(o(!0),c(g,null,R(f.filterPositions,((e,i)=>(o(),n(w,{ref_for:!0,ref:"contentList",key:`${e.symbol}-${i}`,position:e,filterSettings:u.filterSettings,onMouseover:t=>u.currentHoverRow=e.positionId,onMouseleave:t[3]||(t[3]=e=>u.currentHoverRow=""),onOnShare:t=>f.handleShare(e),onHandleSettleIn:f.handleSettleIn,onEditLeverage:t=>f.handleEditLeverage(e),onEditPositionMargin:t=>f.handleAdjustMargin(e.positionId)},null,8,["position","filterSettings","onMouseover","onOnShare","onHandleSettleIn","onEditLeverage","onEditPositionMargin"])))),128))])],2),f.noPosition?(o(),c("div",Fy,[d(D,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])):h("",!0)])),_:2},[!e.isMobile&&f.showClosePosition?{name:"actions",fn:s((()=>[l("div",Ey,[l("div",By,m(e.$t("futuresMain.trade.reducePosition")),1),(o(!0),c(g,null,R(f.filterPositions,((e,t)=>(o(),n(O,{key:`${e.symbol}-${t}`,position:e,currentHoverRow:u.currentHoverRow,onClickClosePosition:f.handleClickClosePosition},null,8,["position","currentHoverRow","onClickClosePosition"])))),128))])])),key:"0"}:void 0]),1024)):(o(),c(g,{key:2},[f.noPosition?(o(),c("div",zy,[d(D,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])):(o(!0),c(g,{key:1},R(f.filterPositions,((e,i)=>(o(),n(w,{ref_for:!0,ref:"contentList",key:`${e.symbol}-${i}
1`,position:e,symbol:e.symbol,isSmallSize:f.isSmallWidthContainer,isProMode:"",onOnShare:t=>f.handleShare(e),onEditLeverage:t=>f.handleEditLeverage(e),onEditPositionMargin:t=>f.handleAdjustMargin(e.positionId),onClickClosePosition:f.handleClickClosePosition,onHandleSettleIn:f.handleSettleIn,onOpenMarginCallSetting:t[4]||(t[4]=e=>u.isShowMarginCallPopup=!0)},null,8,["position","symbol","isSmallSize","onOnShare","onEditLeverage","onEditPositionMargin","onClickClosePosition","onHandleSettleIn"])))),128))],64))],2),f.showClosePosition?(o(),n(x,{key:0,show:u.showConfirmationPopup,price:u.closePositionPrice,closeType:u.closePositionType,position:u.positionToClose,confirmCallback:f.closePositionOrder,cancelCallback:f.closeConfirmationPopup},null,8,["show","price","closeType","position","confirmCallback","cancelCallback"])):h("",!0),u.enableMarginCall&&u.isShowMarginCallPopup?(o(),n(_,{key:1,show:u.isShowMarginCallPopup,"onUpdate:show":t[5]||(t[5]=e=>u.isShowMarginCallPopup=e)},null,8,["show"])):h("",!0),u.showShareDialog?(o(),n(A,{key:2,show:u.showShareDialog,"onUpdate:show":t[6]||(t[6]=e=>u.showShareDialog=e),position:u.sharingPosition},null,8,["show","position"])):h("",!0),u.showLimitReduceDialog?(o(),n(F,{key:3,visible:u.showLimitReduceDialog,"onUpdate:visible":t[7]||(t[7]=e=>u.showLimitReduceDialog=e),position:u.positionToClose,onClickReduce:f.handleClickReduce},null,8,["visible","position","onClickReduce"])):h("",!0),u.showReverseDialog?(
1o(),n(z,{key:4,visible:u.showReverseDialog,"onUpdate:visible":t[8]||(t[8]=e=>u.showReverseDialog=e),position:u.positionToClose},null,8,["visible","position"])):h("",!0),u.showSettleInDialog?(o(),n($,{key:5,visible:u.showSettleInDialog,"onUpdate:visible":t[9]||(t[9]=e=>u.showSettleInDialog=e),position:u.positionToSettleIn},null,8,["visible","position"])):h("",!0),u.showAdjustMarginDialog?(o(),n(N,{key:6,visible:u.showAdjustMarginDialog,"onUpdate:visible":t[10]||(t[10]=e=>u.showAdjustMarginDialog=e),position:f.selectedPosition},null,8,["visible","position"])):h("",!0),d(U,{visible:u.isShowCancelAllConfirmDialog,"onUpdate:visible":t[11]||(t[11]=e=>u.isShowCancelAllConfirmDialog=e),isFutures:"",onConfirm:f.handleCancelAll},{title:s((()=>[p(m(e.$t("msg.close"))+" ",1),l("span",$y,[p(m(e.$t("msg.all"))+" ",1),e.isShowAllPositions?h("",!0):(o(),c(g,{key:0},[p(m(e.marketData.symbol),1)],64))]),p(" "+m(e.$t("order.positions"))+"? ",1)])),message:s((()=>[p(m(e.$t("msg.confirmCancelAllPositions",{symbol:e.isShowAllPositions?"":e.marketData.symbol})),1)])),_:1},8,["visible","onConfirm"])],6)),[[V,u.isLoading,"streamingLight"]])}],["__scopeId","data-v-87ec9d5d"]]);const Uy={name:"Tutorial",components:{IconShine:$n({name:"IconShine",components:{Icon:Ee},props:{width:{type:[Number,String],default:20},height:{type:[Number,String],default:21}}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{"aria-label":"Shine Icon",width:i.width,height:i.height,viewBox:"0 0 20 21",fill:"currentColor"},{default:s((()=>t[0]||(t[0]=[l("path",{d:"M1.2219 4.05634C2.44745 4.05634 3.44412 3.05968 3.44412 1.83412C3.44412 1.52745 3.69301 1.27856 3.99968 1.27856C4.30634 1.27856 4.55523 1.52745 4.55523 1.83412C4.55523 3.05968 5.5519 4.05634 6.77745 4.05634C7.08412 4.05634 7.33301 4.30523 7.33301 4.6119C7.33301 4.91856 7.08412 5.16745 6.77745 5.16745C5.5519 5.16745 4.55523 6.16412 4.55523 7.38968C4.55523 7.69634 4.30634 7.94523 3.99968 7.94523C3.69301 7.94523 3.44412 7.69634 3.44412 7.38968C3.44412 6.16412 2.44745 5.16745 1.2219 5.16745C0.915231 5.16745 0.666342 4.91856 0.666342 4.6119C0.666342 4.30523 0.915231 4.05634 1.2219 4.05634Z"},null,-1),l("path",{d:"M6.16667 11.0841C8.74033 11.0841 10.8333 8.99107 10.8333 6.4174C10.8333 5.7734
111.356 5.25073 12 5.25073C12.644 5.25073 13.1667 5.7734 13.1667 6.4174C13.1667 8.99107 15.2597 11.0841 17.8333 11.0841C18.4773 11.0841 19 11.6067 19 12.2507C19 12.8947 18.4773 13.4174 17.8333 13.4174C15.2597 13.4174 13.1667 15.5104 13.1667 18.0841C13.1667 18.7281 12.644 19.2507 12 19.2507C11.356 19.2507 10.8333 18.7281 10.8333 18.0841C10.8333 15.5104 8.74033 13.4174 6.16667 13.4174C5.52267 13.4174 5 12.8947 5 12.2507C5 11.6067 5.52267 11.0841 6.16667 11.0841Z"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]])},props:{tutorialId:{type:String,default:null},title:{type:String,default:""},tooltip:{type:String,default:""},storageKey:{type:String,default:""},placement:{type:String,default:"right"},buttonText:{type:String,default:""},mask:{type:Boolean,default:!1},closeOnMaskClicked:{type:Boolean,default:!1},offsetTop:{type:Number,default:0},offsetLeft:{type:Number,default:0},arrowOffsetX:{type:Number,default:0},tooltipStyle:{type:Object,default:()=>({})}},emits:["gotIt"],data:()=>({btnEl:void 0,showed:!0,maskEl:void 0}),computed:{customTooltipStyle(){return{"background-color":"var(--app--color--primary-darker)",border:"1px solid var(--border-primary-400)","--arrow-bg":"var(--app--color--primary-darker)","--arrow-border":"var(--app--color--primary)",padding:"12px 18px",...this.tooltipStyle}}},watch:{showed(e){e||this.$nextTick((()=>{var e;null==(e=this.$refs["tooltip-parent"])||e.show(),this.init(),window.addEventListener("resize",this.handleResize)}))}},created(){this.showed=zi($i[this.storageKey])},mounted(){this.$store.commit("tutorial/addTutorial",{id:this.tutorialId??j(),vm:this})},beforeUnmount(){window.removeEventListener("resize",this.handleResize),this.removeMask()},methods:{init(){setTimeout((()=>{var e;this.btnEl=null==(e=this.$refs["tooltip-parent"])?void 0:e.tipDOM.querySelector(".tutorial-got-it-btn"),this.btnEl&&this.btnEl.addEventListener("click",this.handleClick),this.mask&&this.setMask()}),200)},setMask(){const{x:e,y:t,width:i,height:r}=this.$refs.content.getBoundingClientRect(),a=document.createElement("div");a.style.position="absolute",a.style.zIndex=2999,a.style.width=`${window.innerWidth}px`,a.style.height=`${document.body.scrollHeight}px`;const n=document.createElement("div");n.style.position="absolute",n.style.width=`${i}px`,n.style.height=`${r}px`,n.style.left=`${e}px`,n.style.top=`${t+window.scrollY}px`;const o=Math.max(document.body.scrollWidth,document.body.scrollHeight);n.style.boxShadow=`0 0 0 ${o}px rgba(0, 0, 0, 0.5)`,this.closeOnMaskClicked&&a.addEventListener("click",this.handleClick),a.append(n),this.maskEl=a,document.body.append(a)},dismiss(){this.showed||this.handleClick()},handleClick(){var e,t;null==(e=this.btnEl)||e.removeEventListener("click",this.handleClick),this.closeOnMaskClicked&&this.maskEl.removeEventListener("click",this.handleClick),null==(t=this.$refs["tooltip-parent"])||t.hide(),this.$emit("gotIt"),this.showed=!0,this.storageKey&&Bi($i[this.storageKey]),this.removeMask()},handleResize:Ne((function(){var e;null==(e=this.$refs["tooltip-parent"])||e.adjustPosition(),this.mask&&(this.maskEl.remove(),this.setMask())}),200),removeMask(){var e;this.mask&&(null==(e=this.maskEl)||e.remove())}}},Hy={key:0,class:"tooltip-title"},Vy={class:"tooltip-info"},Wy={class:"tooltip-actions"},qy={ref:"content"};const Gy=$n(Uy,[["render",function(e,t,i,r,u,g){const f=a("IconShine"),v=a("BaseButton"),y=a("Tooltip");return o(),n(y,{ref:"tooltip-parent",visibleArrow:"",immediately:"",disableBlurHide:"",onlyShowOnClick:"",noFlex:"",tooltipStyle:g.customTooltipStyle,placement:i.placement,disable:u.showed,hasCursorQuestion:!1,offsetTop:i.offsetTop,offsetLeft:i.offsetLeft,arrowOffsetX:i.arrowOffsetX},{tooltip:s((()=>[i.title?(o(),c("div",Hy,[_(e.$slots,"icon",{},(()=>[d(f)]),!0),l("span",null,m(i.title),1)])):h("",!0),l("div",Vy,[_(e.$slots,"tooltip",{},(()=>[p(m(i.tooltip),1)]),!0)]),l("div",Wy,[d(v,{class:"primary tutorial-got-it-btn",size:"extra-small"},{default:s((()=>[p(m(i.buttonText||e.$t("t.gotIt")),1)])),_:1})]),_(e.$slots,"footer",{},void 0,!0)])),content:s((()=>[l("div",qy,[_(e.$slots,"default",{},void 0,!0)],512)])),_:3},8,["tooltipStyle","placement","disable","offsetTop","offsetLeft","arrowOffsetX"])}],["__scopeId","data-v-98e68135"]]),{enableMarginCall:Ky}=mt,Qy="futures-trading-order-management-position-settings",jy={name:"PositionsSettings",components:{Tutorial:Gy,IconBell2:us,MarginCallDialog:If},setup:()=>({viewedListSyncCount:Ni}),data:()=>({tutorialId:Qy,enableMarginCall:Ky,isCurrentSymbol:!1,isShowMarginCallPopup:!1,showTutorial4Key:$i.MARGIN_CALL_TUTORIAL4,isGoingToShowSettingsUpdated:!1}),computed:{...U(["userName","isArabic"]),...b({lang:"lang",isLogin:"loginState",userConfig:"userConfig"}),...y(Vn,["showFirstTimeTradeQuiz","showFeatureVerificationCheckDialog"]),isGoingToShow(){if(!Ky)return!1;if(!this.isLogin)return!1;
1switch(!0){case this.showFeatureVerificationCheckDialog:case this.showFirstTimeTradeQuiz:return!1;default:return!0}},...y(pt,["isLeaderMode"])},watch:{isCurrentSymbol(){this.updateShowAllPositions(!this.isCurrentSymbol)},viewedListSyncCount:{immediate:!0,handler(){this.isGoingToShowSettingsUpdated=zi($i.MARGIN_CALL_TUTORIAL1)&&!zi($i.MARGIN_CALL_TUTORIAL4)}}},created(){const e=this.userConfig[He.SHOW_FUTURES_ALL_POSITION_SETTING];void 0!==e&&(this.isCurrentSymbol=!e)},methods:{...f(Vn,["updateShowAllPositions"]),handleClickBellIcon(){var e;const t=this.$route.params.id;Li(wi.MARGIN_CALL_ENTRY_CLICKED,{s1:Ei(t)}),this.isLogin?(null==(e=this.$refs.settingsUpdatedTutorial)||e.dismiss(),this.openMarginCallSetting()):this.$router.push({name:"login",params:{lang:this.lang}})},openMarginCallSetting(){this.isShowMarginCallPopup=!0}}},Yy={class:"positions-settings-wrap"},Zy={key:0,class:"icons-wrap"},Xy={key:0,class:"svg-wrapper"};const Jy=$n(jy,[["render",function(e,t,i,r,l,u){const g=a("Checkbox"),f=a("IconBell2"),v=a("Tutorial"),y=a("MarginCallDialog");return o(),c("div",Yy,[d(g,{value:l.isCurrentSymbol,"onUpdate:value":t[0]||(t[0]=e=>l.isCurrentSymbol=e)},{default:s((()=>[p(m(e.$t("trading.orders.currentTradingPair")),1)])),_:1},8,["value"]),e.isLeaderMode?h("",!0):(o(),c("div",Zy,[u.isGoingToShow?(o(),c("div",Xy,[l.isGoingToShowSettingsUpdated?(o(),n(v,{key:0,ref:"settingsUpdatedTutorial",tutorialId:l.tutorialId,storageKey:l.showTutorial4Key,placement:e.isMobile?"top-end":e.isArabic?"right":"left",tooltipStyle:{"max-width":"294px"},title:e.$t("trade.marginCall.settingsUpdatedTitle"),tooltip:e.$t("trade.marginCall.settingsUpdatedText"),buttonText:e.$t("trade.marginCall.settingsUpdatedButton"),onGotIt:u.openMarginCallSetting},{default:s((()=>[d(f,{class:"icon-bell",onClick:u.handleClickBellIcon},null,8,["onClick"])])),_:1},8,["tutorialId","storageKey","placement","title","tooltip","buttonText","onGotIt"])):(o(),n(f,{key:1,class:"icon-bell",onClick:u.handleClickBellIcon},null,8,["onClick"]))])):h("",!0)])),l.enableMarginCall&&l.isShowMarginCallPopup?(o(),n(y,{key:1,show:l.isShowMarginCallPopup,"onUpdate:show":t[1]||(t[1]=e=>l.isShowMarginCallPopup=e)},null,8,["show"])):h("",!0)])}],["__scopeId","data-v-43187a82"]]);const eb=$n({name:"VirtualScrollTable",props:{list:{type:Array,required:!0},visibleHeight:{type:Number,required:!0},rowHeight:{type:Number,required:!0},buffer:{type:Number,default:10}},data:()=>({tableWrapRef:null,afRequestId:!1,numberOfVisibleItems:0,visibleStartIndex:0,isNearBottom:!1}),computed:{visibleList(){return this.list.slice(this.visibleStartIndex,this.visibleStartIndex+this.numberOfVisibleItems)},dummyRowStyle(){return{height:`${this.visibleStartIndex*this.rowHeight}px`}}},mounted(){this.$nextTick((()=>{this.tableWrapRef=this.$refs.tableWrap,this.calculateVisibleRange()}))},methods:{requestAnimationFrameHandler(){this.afRequestId&&cancelAnimationFrame(this.afRequestId),this.afRequestId=requestAnimationFrame(this.calculateVisibleRange)},handleScroll(){this.requestAnimationFrameHandler()},handleScrollEnd(){this.checkIfNearBottom()},checkIfNearBottom(){const e=this.tableWrapRef;if(!e)return;const t=e.scrollTop+e.clientHeight,i=this.list.length*this.rowHeight,r=2*this.rowHeight;this.isNearBottom=t>=i-r},calculateVisibleRange(){const e=this.tableWrapRef,t=e.scrollTop;this.visibleStartIndex=Math.floor(t/this.rowHeight)-this.buffer,this.visibleStartIndex=Math.max(this.visibleStartIndex,0);const i=this.visibleHeight||e.clientHeight;this.numberOfVisibleItems=Math.ceil(i/this.rowHeight)+this.buffer}}},[["render",function(e,t,i,r,n,u){const p=a("DataTable");return o(),c("div",{ref:"tableWrap",class:"virtual-scroll-table-wrap",style:P({"max-height":i.visibleHeight+"px"}),onScroll:t[0]||(t[0]=(...e)=>u.handleScroll&&u.handleScroll(...e)),onScrollend:t[1]||(t[1]=(...e)=>u.handleScrollEnd&&u.handleScrollEnd(...e))},[d(p,X(J(e.$attrs)),{header:s((()=>[_(e.$slots,"header",{},void 0,!0)])),body:s((()=>[l("tr",{style:P(u.dummyRowStyle)},null,4),(o(!0),c(g,null,R(u.visibleList,((t,i)=>_(e.$slots,"default",{item:t,index:i},void 0,!0))),256))])),empty:s((()=>[_(e.$slots,"empty",{},void 0,!0)])),_:3},16),n.isNearBottom?_(e.$slots,"postfix",{key:0},void 0,!0):h("",!0)],36)}],["__scopeId","data-v-91785f86"]]),tb={VOID:"",ASC:"asc",DESC:"desc"},ib={class:"sort-icon-block"};const rb=$n({name:"SortShell",inject:{SortType:{type:Object,default:tb},SORT_TYPE_CAROUSAL:{type:Object,default:{[tb.VOID]:tb.ASC,[tb.ASC]:tb.DESC,[tb.DESC]:tb.VOID}},IconChevronDown:{type:Object,default:Ze}},props:{sortType:{type:String,default:tb.VOID}}
1,emits:["sort"]},[["render",function(e,t,i,r,a,s){return o(),c("div",{class:"sort-shell",onClick:t[2]||(t[2]=E((t=>e.$emit("sort",s.SORT_TYPE_CAROUSAL[i.sortType||s.SortType.VOID])),["stop"]))},[_(e.$slots,"default",{},void 0,!0),l("div",ib,[(o(),n(F(s.IconChevronDown),{class:C(["icon-sort",{active:"asc"===i.sortType}]),"aria-label":"sort",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",onClick:t[0]||(t[0]=E((t=>e.$emit("sort",s.SortType.ASC)),["stop"]))},null,8,["class"])),(o(),n(F(s.IconChevronDown),{class:C(["icon-sort",{active:"desc"===i.sortType}]),"aria-label":"sort",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",onClick:t[1]||(t[1]=E((t=>e.$emit("sort",s.SortType.DESC)),["stop"]))},null,8,["class"]))])])}],["__scopeId","data-v-9bc45bf8"]]),ab={key:0},nb={key:0},ob={class:"subtitle"},sb={class:"cancel-th"},lb={class:"cancel-th-text"},ub=$n(A({__name:"OrderListHeader",props:{headerTitles:{default:()=>[]},sortKey:{default:""},sortType:{default:tb.VOID}},emits:["sort"],setup(e){const{t:t}=G();function i(e){const t=[];
1return"type"===e.id&&t.push("type-column"),e.textAlign&&t.push(`align-${e.textAlign}`),t}function r(e){return`${t(e.lang)} ${e.more||""}`}return(e,t)=>{const u=a("ToolTip"),f=a("i18n-t"),v=a("HeaderRow");return o(),n(v,{class:"row"},{default:s((()=>[t[1]||(t[1]=l("th",{class:"no-padding"},null,-1)),t[2]||(t[2]=l("th",{class:"no-padding"},null,-1)),(o(!0),c(g,null,R(e.headerTitles,(a=>(o(),c("th",{key:a.id,class:C(i(a))},[a.sortable?(o(),n(rb,{key:0,sortType:e.sortKey===a.id?e.sortType:"",onSort:t=>e.$emit("sort",{key:a.id,type:t})},{default:s((()=>[a.tip&&e.$te(a.tip)||e.$te(`${a.lang}.tip`)?(o(),n(u,{key:0,tooltip:a.tip?e.$t(a.tip):e.$t(`${a.lang}.tip`)},{content:s((()=>[a.subtitle?(o(),c("div",ab,[p(m(r(a))+" ",1),a.subtitle.length>4?(o(),c("br",nb)):h("",!0),l("span",ob,"("+m(a.subtitle)+")",1)])):(o(),c(g,{key:1},[p(m(r(a)),1)],64))])),_:2},1032,["tooltip"])):(o(),c(g,{key:1},[p(m(r(a)),1)],64))])),_:2},1032,["sortType","onSort"])):a.tip&&e.$te(a.tip)||e.$te(`${a.lang}.tip`)?(o(),n(u,{key:1,content:r(a),tooltip:a.tip?e.$t(a.tip):e.$t(`${a.lang}.tip`)},te({_:2},[a.html?{name:"tooltip",fn:s((()=>[d(f,{keypath:`${a.lang}.tip`,tag:"span"},{br:s((()=>t[0]||(t[0]=[l("br",null,null,-1)]))),_:2},1032,["keypath"])])),key:"0"}:void 0]),1032,["content","tooltip"])):(o(),c(g,{key:2},[p(m(r(a)),1)],64))],2)))),128)),l("th",sb,[l("span",lb,m(e.$t("wallets.futuresList.actions")),1)])])),_:1,__:[1,2]})}}}),[["__scopeId","data-v-1c0135c1"]]),cb=Object.freeze({[ot.BUY]:"B",[ot.SELL]:"S",1003:"Q"}),db=Object.freeze({[ut.LIMIT]:"L",[ut.MARKET]:"M",[ut.PEG]:"P",[ut.OTC]:"O",1003:"Q",1004:"A",1006:"S",110:"F"}),pb=Object.freeze({1001:"1",1002:"2"}),hb={"futuresMain.orderType.L-B":"futuresMain.singleOrderType.76","futuresMain.orderType.L-B-1":"trading.orderForm.orderTypes.stopLimit","futuresMain.orderType.L-B-2":"history.order.filter.type.takeProfitLimit","futuresMain.orderType.L-S":"futuresMain.singleOrderType.76","futuresMain.orderType.L-S-1":"trading.orderForm.orderTypes.stopLimit","futuresMain.orderType.L-S-2":"history.order.filter.type.takeProfitLimit","futuresMain.orderType.M-B":"futuresMain.singleOrderType.77","futuresMain.orderType.M-B-1":"trading.orderForm.orderTypes.stopMarket","futuresMain.orderType.M-B-2":"history.order.filter.type.takeProfitMarket","futuresMain.orderType.M-B-3":"history.order.filter.type.trailingStopMarket","futuresMain.orderType.M-S":"futuresMain.singleOrderType.77","futuresMain.orderType.M-S-1":"trading.orderForm.orderTypes.stopMarket","futuresMain.orderType.M-S-2":"history.order.filter.type.takeProfitMarket","futuresMain.orderType.M-S-3":"history.order.filter.type.trailingStopMarket","futuresMain.orderType.P-B":"futuresMain.singleOrderType.80","futuresMain.orderType.P-S":"futuresMain.singleOrderType.80","futuresMain.orderType.Q-B":"futuresMain.singleOrderType.1003","futuresMain.orderType.Q-Q":"futuresMain.singleOrderType.1003","futuresMain.orderType.Q-S":"futuresMain.singleOrderType.1003","futuresMain.orderType.A-B":"futuresMain.singleOrderType.1004","futuresMain.orderType.A-S":"futuresMain.singleOrderType.1004"},mb={name:"FutureOrderType",props:{item:{type:Object,default:()=>({})}},computed:{isPostionBindTpSl(){return this.item.closeOrder},postionBindTpSlDisplayText(){const{orderMode:e}=this.item;return e===ot.BUY?this.$t("tpsl.closeShort"):this.$t("tpsl.closeLong")},isMarketOrder(){return db[this.item.orderType]},isTrailingStop(){return this.isMarketOrder&&this.item.trailValue&&0!==this.item.trailValue}},methods:{triggerOrder(e){if(void 0===pb[e.triggerOrderType])return e.orderType;const t=this.isTrailingStop?"3":pb[e.triggerOrderType],i=`${db[e.orderType]}-${cb[e.orderMode]}-${t}`,r=hb[`futuresMain.orderType.${i}`]||`futuresMain.orderType.${i}`;return this.$t(r)},order(){let e=db[this.item.orderType];const t=cb[this.item.orderMode];if(this.item.orderDetailType)switch(this.item.orderDetailType){case Hi.TWAP:return this.getI18n(e,t,!0);case Hi.PARTIAL_LIQUIDATION:return this.$t("futuresMain.orderType.partialLiquidation");case Hi.FORCED_MARKET_BUY:case Hi.FORCED_MARKET_SELL:return this.$t("futuresMain.orderType.forcedMarket")}e===ut.OTC&&this.item.isRebate&&(e=`${e}_R`);let i=this.getI18n(e,t);
1return i||(i=this.getI18n(this.item.orderType,this.item.orderMode),i||this.item.orderType)},getI18n(e,t,i){let r=`futuresMain.orderType.${e}-${t}`;if(i){const e=r+"-TW";if(Ui(e))return this.$t(e)}if(Ui(r)){const e=hb[r]||r;return this.$t(e)}const a=[e,t];return this.item.triggerOrderType&&a.push(this.item.triggerOrderType),this.item.trailValue&&a.push("T"),r=`order.type.${a.join("_")}`,Ui(r)?this.$t(r):null}}},gb={class:"order-type"},fb={key:0},vb={key:1};const yb=$n(mb,[["render",function(e,t,i,r,a,n){return o(),c("div",gb,[n.isPostionBindTpSl?(o(),c("span",fb,m(n.postionBindTpSlDisplayText),1)):(o(),c("span",vb,m(i.item.triggerOrderType?n.triggerOrder(i.item):n.order()),1))])}],["__scopeId","data-v-22b69ba8"]]),bb={props:{order:{type:Object,required:!0}},data:()=>({TRADING_ORDER_DETAIL_TYPE:Hi}),computed:{...U("futures",{futuresMarketData:"marketData"}),isReduceOrder(){return this.order.reduceOnly},isCloseOrder(){return this.order.closeOrder},triggerPrice(){return this.$filters.formatNumber(this.order.triggerPrice,this.futuresMarketData.priceFilter)}}},Sb={class:"order-status"};const Cb=$n(bb,[["render",function(e,t,i,r,a,n){return o(),c("div",Sb,[i.order.orderDetailType===a.TRADING_ORDER_DETAIL_TYPE.TWAP?(o(),c(g,{key:0},[p(m(e.$t("trading.twap.openOrder.status")),1)],64)):i.order.triggerOrderType?(o(),c(g,{key:1},[p(m(i.order.isTriggered?`${e.$t("msg.triggerOrderType.trigger")} @ ${n.triggerPrice}`:e.$t("msg.triggerOrderType.not-trigger")),1)],64)):i.order.cancelDuration?(o(),c(g,{key:2},[p(m(e.$filters.formatDate(i.order.cancelDuration)),1)],64)):(o(),c(g,{key:3},[n.isReduceOrder?(o(),c(g,{key:0},[p(m(e.$t("futuresMain.reduceOrder")),1)],64)):n.isCloseOrder?(o(),c(g,{key:1},[p(m(e.$t("futuresMain.closeOrder")),1)],64)):h("",!0),p(" "+m(e.$t("t.order.timeInForce.GTC")),1)],64))])}]]),Pb={name:"EditableCell",components:{TradingInput:Wn,IconEdit:Wi,IconCheck3:Vi,IconClose:ze},props:{checkAction:{type:Function,default:()=>{}},fieldData:{type:String,required:!0},orderInfo:{type:Object,required:!0},marketInfo:{type:Object,required:!0},priceFormat:{type:Object,default:()=>({formatKey:0})},type:{type:String,required:!0},disable:{type:Boolean,required:!0},hide:{type:Boolean,default:!1},marketRoute:{type:Object,default:()=>({})},postfix:{type:String,default:""}},emits:["update:disableEditableCell","editModeChange"],data:()=>({editMode:!1,editedFormatValue:null,fieldValue:""}),computed:{...b(["currencyMap"]),...y(qe,["isSpot"]),...U("futures",["isFutures"]),...y(Ge,["sizeType","isContractSizeType"]),initValue(){if(this.isSizeType&&!this.isFutures){const{fillSize:e,size:t}=this.orderInfo;return S(e).plus(t).toNumber()}return parseFloat(this.fieldData.replaceAll(",",""))},inputLimit(){return this.getInputLimit()},valuePostfix(){return this.isPriceType?this.orderInfo.currency:this.isTriggerPriceType?this.triggerPriceTypeDisplay:this.postfix||""},enableMarketRouteLink(){return Object.keys(this.marketRoute).length>0},balance(){var e;return(null==(e=this.currencyMap[this.orderInfo.currency])?void 0:e.available)??0},orderSymbol(){return this.marketInfo.market},isSizeType(){return"SIZE"===this.type},isPriceType(){return"PRICE"===this.type},isTriggerPriceType(){return"TRIGGERPRICE"===this.type},isMarketOrder(){return this.orderInfo.orderType===ct.MARKET},triggerPriceTypeDisplay(){const e=this.$t(this.orderInfo.triggerUseLastPrice?"trading.last":this.isFutures?"trading.mark":"futuresMain.trade.index");return this.isFutures?`(${e})`:`${this.orderInfo.currency} (${e})`}},watch:{sizeType(e,t){this.isSizeType&&this.editedFormatValue&&(t.id===Ke.CONTRACTS?this.editedFormatValue=Qe(this.editedFormatValue,this.orderSymbol):e.id===Ke.CONTRACTS&&(this.editedFormatValue=qi(this.editedFormatValue,this.orderSymbol)))},editMode(e){e&&(this.fieldValue=this.initValue,this.$nextTick((()=>{this.$refs.tradingInput.focusInput()})))}},methods:{activeEditMode(){this.disable||(this.editMode=!0,this.$emit("editModeChange",!0))},closeEditMode(){this.editMode=!1,this.$emit("editModeChange",!1)},cancel(){this.closeEditMode()},checkToSubmit(){const e=parseFloat(this.fieldValue);this.editedFormatValue=this.decimalDigits(e),this.closeEditMode(),this.editedFormatValue!==this.fieldData&&e&&this.checkAction({newValue:e,type:this.t
1ype,order:this.orderInfo,cancelEdit:this.cancelEdit})},cancelEdit(){this.editedFormatValue=null},getInputLimit(){var e,t;const{minValidPrice:i,minPriceIncrement:r,minOrderSize:a,maxOrderSize:n,minSizeIncrement:o,contractSize:s,priceDecimal:l}=this.marketInfo,u="max8"===(null==(e=this.priceFormat)?void 0:e.formatKey)?8:null==(t=this.priceFormat)?void 0:t.formatKey;if(this.isPriceType){if(this.isSpot){const{originalSize:e,price:t,orderMode:a}=this.orderInfo,n=S(this.balance).div(e).plus(t).dp(u,S.ROUND_DOWN).toNumber();return{min:i,max:a===st.SELL?void 0:n,step:r}}return{min:i,step:r}}if(this.isTriggerPriceType)return{min:i,step:r};if(this.isSizeType){if(this.isFutures){const{filledSize:e}=this.orderInfo,t=Math.max(a,e+1);return this.isContractSizeType?{min:t,max:n,step:o}:{min:Qe(t,this.orderSymbol),max:Qe(n,this.orderSymbol),step:s}}const{originalSize:e,fillSize:t,price:i,orderMode:r,triggerPrice:c}=this.orderInfo,d=r===st.SELL,p=S(this.balance).div(i).plus(e).dp(u,S.ROUND_DOWN).toNumber();let h=Math.max(a,t+o),m=o;if(!d&&this.isMarketOrder){const e=S(a).times(c).times(1.05).toNumber();h=S(t).plus(e).dp(l).toNumber(),m=1/Math.pow(10,u)}return{min:h,max:d?n:Math.min(n,p),step:m}}},decimalDigits(e){var t;const i=null==(t=this.priceFormat)?void 0:t.formatKey;return i||0===i?this.$filters.formatNumber(e,this.priceFormat):e}}},kb={class:"editable-cell"},Tb={class:"value-wrapper"},Mb={class:"postfix"},Lb={key:1,class:"edit-wrapper"},wb={class:"postfix"};const Db=$n(Pb,[["render",function(e,t,i,r,u,f){const v=a("IconEdit"),y=a("Tooltip"),b=a("TradingInput"),S=a("IconCheck3"),P=a("IconClose");return o(),c("div",kb,[u.editMode?(o(),c("div",Lb,[d(b,{ref:"tradingInput",value:u.fieldValue,"onUpdate:value":t[0]||(t[0]=e=>u.fieldValue=e),class:"edit-input",enableThousandSeparator:"",hideSpin:"",mobileStyle:"",enablePlaceZero:f.isPriceType,min:f.inputLimit.min,max:f.inputLimit.max,step:f.inputLimit.step,onEnter:f.checkToSubmit,type:i.type},null,8,["value","enablePlaceZero","min","max","step","onEnter","type"]),l("span",wb,m(f.valuePostfix),1),l("div",{class:C(["check-wrapper",{disable:!u.fieldValue}]),onClick:t[1]||(t[1]=(...e)=>f.checkToSubmit&&f.checkToSubmit(...e))},[d(S,{class:"icon-check"})],2),l("div",{class:"cancel-wrapper",onClick:t[2]||(t[2]=(...e)=>f.cancel&&f.cancel(...e))},[d(P,{class:"icon-close"})])])):(o(),c(g,{key:0},[_(e.$slots,"modeMark",{},void 0,!0),l("div",Tb,[(o(),n(F(f.enableMarketRouteLink?"RouterLink":"span"),{to:i.marketRoute,class:"value"},{default:s((()=>[p(m(u.editedFormatValue||i.fieldData)+" ",1),l("span",Mb,m(f.valuePostfix),1)])),_:1},8,["to"])),!i.hide&&f.initValue?(o(),n(y,{key:0,offsetLeft:40,disable:i.disable,hasCursorQuestion:!1},{content:s((()=>[d(v,{class:C(["icon-edit",{disable:i.disable}]),onClick:f.activeEditMode},null,8,["class","onClick"])])),tooltip:s((()=>[l("span",null,m(e.$t("trading.buySell.clickToAmend")),1)])),_:1},8,["disable"])):h("",!0)])],64))])}],["__scopeId","data-v-9c4d248d"]]),Ob={name:"EditableInput",components:{TradingInput:Wn,IconCheck3:Vi,IconClose:ze},props:{enableSecondInput:{type:Boolean,default:!1},originalValue:{type:[String,Number],default:""},secondOriginalValue:{type:[String,Number],default:""},placeholder:{type:String,default:""},secondPlaceholder:{type:String,default:""},disableCheckBtn:{type:Boolean,default:!1},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},step:{type:Number,default:1}},emits:["clickCheck","clickClose"],data(){return{inputValue:this.originalValue,secondInputValue:this.secondOriginalValue}},mounted(){const{tradingInput:e,secondTradingInput:t}=this.$refs;this.adjustWidth(e,this.inputValue),this.adjustWidth(t,this.secondInputValue)},methods:{handleClickCheck(){this.enableSecondInput?this.$emit("clickCheck",this.inputValue,this.secondInputValue):this.$emit("clickCheck",this.inputValue)},handleInput(e){this.adjustWidth(this.$refs.tradingInput,e)},handleSecondInput(e){this.adjustWidth(this.$refs.secondTradingInput,e)},adjustWidth(e,t){const i=8*(String(t).length-4),r=Math.max(100,100+i);e.$el.style.width=`${r}px`}}},Ib={class:"editable-input-wrap"},xb={class:"btns-wrap"};const _b=$n(Ob,[["render",function(e,t,i,r,s,u){const p=a("TradingInput"),m=a("IconCheck3"),g=a("IconClose");return o(),c("div",Ib,[d(p,{ref:"tradingInput",value:s.inputValue,"onUpdate:value":t[0]||(t[0]=e=>s.inputValue=e),class:"editable-input",enableThousandSeparator:"",placeholder:i.placeholder,step:i.step,min:i.min,max:i.max,mobileStyle:"",onInput:u.handleInput},null,8,["value","placeholder","step","min","max","onInput"]),i.enableSecondInput?
1(o(),n(p,{key:0,ref:"secondTradingInput",value:s.secondInputValue,"onUpdate:value":t[1]||(t[1]=e=>s.secondInputValue=e),class:"second-editable-input",enableThousandSeparator:"",placeholder:i.secondPlaceholder,step:i.step,min:i.min,max:i.max,mobileStyle:"",onInput:u.handleSecondInput},null,8,["value","placeholder","step","min","max","onInput"])):h("",!0),l("div",xb,[l("div",{class:C(["btn-wrap btn-check-wrap",{disabled:i.disableCheckBtn}]),onClick:t[2]||(t[2]=(...e)=>u.handleClickCheck&&u.handleClickCheck(...e))},[d(m,{class:"icon-check"})],2),l("div",{class:"btn-wrap btn-close-wrap",onClick:t[3]||(t[3]=t=>e.$emit("clickClose"))},[d(g,{class:"icon-close"})])])])}],["__scopeId","data-v-279a0155"]]),Ab={class:"header"},Rb={class:"title"},Fb={class:"body"},Eb={class:"content"},Bb={class:"btn-wrapper"},zb=$n({__name:"UnunifiedWalletBotOrderRemindDialog",props:{title:{type:String,default:""},content:{type:String,default:""},confirmCallback:{type:Function,default:()=>{}}},emits:["dialog:closed"],setup(e,{emit:t}){const i=e,r=t;function u(){r("dialog:closed")}function c(){i.confirmCallback(),r("dialog:closed")}return(t,i)=>{const r=a("BrandButton");return o(),n(x(pi),{class:"ununified-wallet-bot-order-remind-dialog",width:t.isMobile?"100%":"400px",isBrandNewStyle:"",isBottomUp:t.isMobile,showClose:!1,onClosed:u},{body:s((()=>[l("div",Ab,[l("span",Rb,m(e.title),1),d(x(ze),{class:"icon-close",onClick:u})]),l("div",Fb,[l("div",Eb,m(e.content),1),l("div",Bb,[d(r,{class:"btn",onClick:c},{default:s((()=>[p(m(t.$t("t.confirm")),1)])),_:1}),d(r,{class:"btn custom",onClick:u},{default:s((()=>[p(m(t.$t("t.goBack")),1)])),_:1})])])])),_:1},8,["width","isBottomUp"])}}},[["__scopeId","data-v-07f378c2"]]),$b={name:"OrderListRow",components:{SymbolLink:ah,OrderType:yb,OrderStatus:Cb,EditableCell:Db,IconBot:ds,IconEditLite:oh,TpSlEditableInput:_b,TpSlPriceWithTooltip:Rh,IconClose:ze},props:{openOrder:{type:Object,default:function(){return{}}},index:{type:Number,required:!0},anyRowEditing:{type:Boolean,default:!1},chasingOrderMap:{type:Object,default:()=>({})}},emits:["update:disableEditableCell","mouseover","mouseleave","update:anyRowEditing","showTpSlModifyWarningDialog","confirmClose","editLeverage","chase"],data:()=>({amendData:{type:"",value:""},currentRowEditing:!1,cancelEdit:()=>{},isEditingTpSl:!1,isHover:!1,isCancelToggleOn:!1}),computed:{...b({futuresLastPriceMap:e=>e.futures.futuresLastPriceMap,futuresMarkPriceMap:e=>e.futures.futuresMarkPriceMap,marketMap:e=>e.futures.marketMap,marketDetailMap:e=>e.futures.marketDetailMap}),...b("futures",["futuresIndexPriceMap"]),...y(pt,["isLeaderMode"]),...U(["isUnifiedWallet"]),...U("futures",{isHedgeMode:"isHedgeMode",initialMarginPercentage:"initialMarginPercentage"}),...y(Ge,["isContractSizeType","sizeFilter"]),rowBgColor(){return this.index%2==1?"even":"odd"},isIsolated(){return this.openOrder.marginMode===ri.ISOLATED},marginType(){return this.isIsolated?this.$t("t.isolated"):this.$t("futuresMain.trade.cross")},displayLeverage(){const{leverage:e}=this.openOrder;return`${bi(e,this.initialMarginPercentage(this.symbol),2)}x`},indexPrice(){return this.futuresIndexPriceMap[this.symbol]||0},markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},lastPrice(){return this.futuresLastPriceMap[this.symbol]||0},orderSize(){return this.convertSize(this.openOrder.amount+this.openOrder.filledSize)},isTwap(){return this.openOrder.orderDetailType===Hi.TWAP},isBot(){return"trading-bot"===this.openOrder.vendorName},isTrailingStopOrder(){return 0!==this.openOrder.trailValue},isWaitingForActivation(){return this.openOrder.activationPrice&&0===Number(this.openOrder.triggerPrice)},symbol(){return lt(this.openOrder.marketName)},orderMarketDetail(){return this.marketDetailMap[this.symbol]||{}},orderPriceFormat(){return{formatKey:this.orderMarketDetail.priceFilter??"",currency:this.quoteCurrency}},quoteCurrency(){return Si(this.symbol)},isPositionBindTpSl(){return this.openOrder.closeOrder},hasTpSlSetting(){return this.hasTpPrice||this.hasSlPrice},hasTpPrice(){return!!this.tpPrice},hasSlPrice(){return!!this.slPrice},tpPrice(){const{takeProfitOrder:e}=this.openOrder;return null==e?void 0:e.triggerPrice},slPrice(){const{stopLossOrder:e}=this.openOrder;return null==e?void 0:e.triggerPrice},isBuy(){return this.openOrder.orderMode===ot.BUY},canEditPrice(){return this.canEdit("PRICE")&&!this.isTwap&&!(this.isBot&&!this.isUnifiedWallet)},canChase(){return Zi(this.openOrder.orderType)&&!Yi(this.openOrder.triggerOrderType)&&this.canEditPrice&&!this.isPositionBindTpSl},isChasing(){return!!this.chasingOrderMap[this.openOrder.orderID]},orderSide(){const e=rr(this.openOrder,{isBuyOrder:this.isBuy});return this.$t(e)},orderSideClass(){return ir(this.openOrder,{isBuyOrder:this.isBuy})},orderValue(){const e=this.openOrder;return Qi(e.orderType)?this.getPegOrderValue(e):Yi(e.triggerOrderType)?this.get
1StopeAndTakeProfitOrderValue(e):this.calculateOrderValue(e.amount,e.price)},triggerPriceType(){return this.openOrder.triggerUseLastPrice?this.$t("trading.last"):this.$t("trading.mark")},formattedActivationPrice(){const e=this.openOrder.activationPrice;return e?this.$filters.formatNumber(e,this.orderPriceFormat):"-"},sizeFormat(){return{formatKey:this.isContractSizeType?this.sizeFilter:this.currentMarketData.sizeFilter}},currentMarketData(){var e;return this.marketMap[null==(e=this.openOrder.marketName)?void 0:e.replace(tr,"")]||{}}},beforeUnmount(){this.anyRowEditing&&this.currentRowEditing&&this.$emit("update:anyRowEditing",!1)},methods:{...u("futures",["updateOpenOrderRow"]),isBuyMode:Ki,e2eID:Gi,decimalDigits(e){return this.$filters.formatNumber(e,this.orderPriceFormat)},getPegOrderInfo(e){let t="";const i=this.indexPrice+this.indexPrice*e.pegPriceDeviation;let r=0;return Ki(e.orderMode)&&(r=e.price<=i?e.price:i,t="Max"),er(e.orderMode)&&(r=e.price>=i?e.price:i,t="Min"),{orderPrice:r,maxMin:t}},handlePegPrice(e){const{maxMin:t,orderPrice:i}=this.getPegOrderInfo(e);return`${t}: ${this.decimalDigits(e.price)} | ${this.decimalDigits(i)}`},getStopeAndTakeProfitPriceInfo(e){const t=e.orderType;if(Zi(t))return{orderPrice:e.price,triggerPrice:e.triggerPrice};if(ji(t)){let t=e.triggerPrice;return this.isTrailingStopOrder&&(t=this.getTrailingStopTriggerPrice(e)),{orderPrice:e.triggerUseLastPrice?this.lastPrice:this.markPrice,triggerPrice:t}}},getTrailingStopTriggerPrice(e){return Ji({isSellOrder:er(e.orderMode),lastPrice:e.triggerUseLastPrice?this.lastPrice:this.markPrice,triggerPrice:e.triggerPrice,trailValue:e.trailValue,trailValueType:e.trailValueType})},formatTrailValue(e,t){if(t===Xi.PERCENTAGE)return`${e>=0?"+":""}${100*e}%`;const i=this.$filters.formatNumber(e,this.orderPriceFormat);return e>=0?`+${i}`:i},handleStopeAndTakeProfitPrice(e){const{orderPrice:t}=this.getStopeAndTakeProfitPriceInfo(e);return this.decimalDigits(t)},getPegOrderValue(e){const{orderPrice:t}=this.getPegOrderInfo(e);return this.calculateOrderValue(e.amount,t)},getStopeAndTakeProfitOrderValue(e){const t=e.orderType;let i=0;return Zi(t)&&(i=e.price),ji(t)&&(i=e.triggerPrice),this.calculateOrderValue(e.amount,i)},calculateOrderValue(e,t){e=Number(e)||0,t=Number(t)||0;const i=S(e).times(t).times(this.orderMarketDetail.contractSize);return this.decimalDigits(Number(i))},f_orderPrice(e){return Qi(e.orderType)?this.handlePegPrice(e):Yi(e.triggerOrderType)?this.handleStopeAndTakeProfitPrice(e):this.decimalDigits(e.price)},getTriggerPrice(e){if(Yi(e.triggerOrderType)){const{triggerPrice:t}=this.getStopeAndTakeProfitPriceInfo(e);return this.decimalDigits(t)}return"-"},resetData(){this.amendData={type:null,value:null},this.cancelEdit=()=>{}},updateRowData(){const{type:e,value:t}
1=this.amendData,i={[{SIZE:"originalAmount",PRICE:"price",TRIGGERPRICE:"triggerPrice"}[e]]:t};this.updateOpenOrderRow({orderID:this.openOrder.orderID,newData:i,isLeaderMode:this.isLeaderMode})},updateRowEditStatus(e){this.currentRowEditing=e,this.$emit("update:anyRowEditing",e)},toggleTpSlEditMode(e){this.isEditingTpSl=e,this.updateRowEditStatus(e)},async amendSubmit(e){try{const e=this.isLeaderMode?Xt.amendOrder:Ve.amendOrder,t=await e(this.amendData);t[0]&&123===t[0].status?this.updateRowData():this.cancelEdit()}catch(t){e()}finally{this.resetData(),this.updateRowEditStatus(!1)}},amendOrderCallback({order:e,type:t,newValue:i,cancelEdit:r}){if(this.amendData=this.getAmendData(e,t,i),this.cancelEdit=r,"SIZE"===t){const{filledSize:t}=e,r=this.isContractSizeType?i:qi(i,this.symbol);this.amendData.value=r-t}this.amendSubmit(r)},getAmendData:(e,t,i)=>({orderID:e.orderID,type:t,value:i,symbol:lt(e.marketName)}),canEdit(e){const{orderType:t,isTriggered:i,closeOrder:r}=this.openOrder;if("TRIGGERPRICE"===e&&i)return!1;if(Qi(t))return!1;if(ji(t)){if("PRICE"===e)return!1;if(this.isTrailingStopOrder&&"TRIGGERPRICE"===e)return!1}return!r},convertSize(e){return this.isContractSizeType?e:Qe(e,this.symbol,this.orderMarketDetail.contractSize)},handleClickTpSlCheck(e,t){if(""===e&&""===t){return(this.isLeaderMode?Xt.cancelOrder:Ve.cancelOrder)(this.openOrder),void(this.isEditingTpSl=!1)}const{takeProfitOrder:i,stopLossOrder:r,orderMode:a}=this.openOrder,n=Nm({newTpPrice:e,tpTriggerUseLastPrice:null==i?void 0:i.triggerUseLastPrice,newSlPrice:t,slTriggerUseLastPrice:null==r?void 0:r.triggerUseLastPrice,markPrice:this.markPrice,lastPrice:this.lastPrice,isLong:!Ki(a)});if(Object.values(n).some((e=>!0===e)))this.$emit("showTpSlModifyWarningDialog",!0,n);else{this.isEditingTpSl=!1;const a=(null==i?void 0:i.triggerUseLastPrice)?"lastPrice":"markPrice",n=(null==r?void 0:r.triggerUseLastPrice)?"lastPrice":"markPrice";let o="";if(this.isHedgeMode){o=this.openOrder.positionDirection===fi.LONG?"SELL":"BUY"}else o=this.isBuy?"SELL":"BUY";(this.isLeaderMode?Xt.bindTpSlToPosition:Ve.bindTpSlToPosition)({symbol:this.symbol,side:o,takeProfitPrice:e||null,takeProfitTrigger:e?a:null,stopLossPrice:t||null,stopLossTrigger:e?n:null,positionMode:this.openOrder.positionMode,positionId:this.openOrder.positionId})}},handleCancelClick(){if(!this.isUnifiedWallet&&this.isBot)return this.$openDialog(zb,{title:this.$t("trading.order.cancel.notUnifiedWallet.dialog.title"),content:this.$t("trading.order.cancel.notUnifiedWallet.dialog.content1"),confirmCallback:this.handleClickConfirmCancel});this.isCancelToggleOn=!0},handleClickConfirmCancel(){this.isCancelToggleOn=!1,this.$emit("confirmClose",this.openOrder)},handleChaseClick(){this.$emit("chase",{orderID:this.openOrder.orderID,symbol:this.symbol,side:Ki(this.openOrder.orderMode)?"BUY":"SELL"})}}},Nb={class:"icon-wrapper"},Ub={class:"symbol-cell"},Hb={class:"leverage-wrap"},Vb={key:0},Wb={key:1},qb={key:0},Gb={class:"mode-mark"},Kb={class:"align-left"},Qb={key:0},jb={class:"align-left"},Yb={key:1,class:"tp-sl-wrap"},Zb={class:"trigger-type"},Xb={class:"align-left"},Jb={key:0},eS={class:"align-left"},tS=["title"],iS={class:"cancel-order-td"};const rS=$n($b,[["render",function(e,t,i,r,u,f){const v=a("IconBot"),y=a("SymbolLink"),b=a("IconEditLite"),S=a("Cell"),P=a("EditableCell"),k=a("TpSlEditableInput"),T=a("TpSlPriceWithTooltip"),M=a("ToolTip"),L=a("OrderType"),w=a("OrderStatus"),D=a("BrandButton"),O=a("Tooltip"),I=a("IconClose");return o(),c("tr",{class:C(["row",[f.rowBgColor,{"disable-hover":e.isMobile}]]),onMouseover:t[4]||(t[4]=e=>u.isHover=!0),onMouseleave:t[5]||(t[5]=e=>u.isHover=!1)},[l("td",null,[l("span",{class:C(["indicator",f.orderSideClass])},null,2)]),l("td",Nb,[f.isBot?(o(),n(v,{key:0,width:"17",height:"16"})):h("",!0)]),l("td",Ub,[d(y,{symbol:f.symbol,disableUnderline:""},null,8,["symbol"]),l("div",Hb,[l("div",{class:C(["leverage",{"brand-color-positive":f.isBuy,"brand-color-negative":!f.isBuy}])},[p(m(f.marginType)+" ",1),l("span",{class:C({"editable-leverage":e.isUnifiedWallet})},m(f.displayLeverage),3)],2),e.isUnifiedWallet?(o(),n(b,{key:0,class:"icon-edit",onClick:t[0]||(t[0]=t=>e.$emit("editLeverage"))})):h("",!0)])]),d(S,{textAlign:"left"},{default:s((()=>[f.isPositionBindTpSl?(o(),c("span",Vb,"-")):(o(),c("span",Wb,m(e.$filters.formatNumber(f.convertSize(i.openOrder.filledSize),f.sizeFormat)),1
1))])),_:1}),l("td",{class:C(f.orderSideClass)},[f.isPositionBindTpSl?(o(),c("div",qb,m(e.$t("tpsl.entirePosition")),1)):(o(),n(P,{key:1,checkAction:f.amendOrderCallback,fieldData:e.$filters.formatNumber(f.orderSize,f.sizeFormat),orderInfo:i.openOrder,marketInfo:f.orderMarketDetail,priceFormat:f.sizeFormat,type:"SIZE",disable:i.anyRowEditing,hide:!f.canEdit("SIZE")||f.isTwap||i.openOrder.activationPrice||f.isBot&&!e.isUnifiedWallet,postfix:e.isContractSizeType?`(${e.$t("futuresMain.contracts")})`:`(${f.currentMarketData.coin})`,onEditModeChange:f.updateRowEditStatus},{modeMark:s((()=>[l("span",Gb,m("MODE_BUY"===i.openOrder.orderModeName?"+":"-"),1)])),_:1},8,["checkAction","fieldData","orderInfo","marketInfo","priceFormat","disable","hide","postfix","onEditModeChange"]))],2),l("td",Kb,[f.isPositionBindTpSl?(o(),c("div",Qb,m(e.$t("t.orderType_m")),1)):(o(),n(P,{key:1,checkAction:f.amendOrderCallback,fieldData:f.f_orderPrice(i.openOrder),orderInfo:i.openOrder,marketInfo:f.orderMarketDetail,priceFormat:f.orderPriceFormat,type:"PRICE",disable:i.anyRowEditing,hide:!f.canEditPrice,onEditModeChange:f.updateRowEditStatus},null,8,["checkAction","fieldData","orderInfo","marketInfo","priceFormat","disable","hide","onEditModeChange"]))]),l("td",jb,[f.isWaitingForActivation?(o(),c(g,{key:0},[p("-")],64)):f.isPositionBindTpSl?(o(),c("div",Yb,[u.isEditingTpSl?(o(),n(k,{key:0,enableSecondInput:"",originalValue:f.tpPrice,placeholder:"TP",secondOriginalValue:f.slPrice,secondPlaceholder:"SL",step:f.orderMarketDetail.minPriceIncrement,min:f.orderMarketDetail.minValidPrice,max:2147483647,onClickCheck:f.handleClickTpSlCheck,onClickClose:t[1]||(t[1]=e=>f.toggleTpSlEditMode(!1))},null,8,["originalValue","secondOriginalValue","step","min","onClickCheck"])):(o(),c(g,{key:1},[d(T,{tpOrder:i.openOrder.takeProfitOrder,slOrder:i.openOrder.stopLossOrder,isLong:f.isBuyMode(i.openOrder.orderMode)},null,8,["tpOrder","slOrder","isLong"]),f.hasTpSlSetting?(o(),n(b,{key:0,class:C(["icon-edit",{disable:i.anyRowEditing}]),onClick:t[2]||(t[2]=e=>f.toggleTpSlEditMode(!0))},null,8,["class"])):h("",!0)],64))])):f.isTrailingStopOrder?(o(),c(g,{key:2},[d(M,null,{content:s((()=>[p(m(e.$filters.formatNumber(i.openOrder.triggerPrice,f.orderPriceFormat)),1)])),tooltip:s((()=>[l("div",null,m(e.$t("futuresMain.activeOrders.trailValue"))+": "+m(f.formatTrailValue(i.openOrder.trailValue,i.openOrder.trailValueType)),1)])),_:1}),l("span",Zb,"("+m(f.triggerPriceType)+")",1)],64)):(o(),n(P,{key:3,checkAction:f.amendOrderCallback,fieldData:f.getTriggerPrice(i.openOrder),orderInfo:i.openOrder,marketInfo:f.orderMarketDetail,priceFormat:f.orderPriceFormat,type:"TRIGGERPRICE",disable:i.anyRowEditing,hide:!f.canEdit("TRIGGERPRICE"),onEditModeChange:f.updateRowEditStatus},null,8,["checkAction","fieldData","orderInfo","marketInfo","priceFormat","disable","hide","onEditModeChange"]))]),l("td",Xb,[f.isPositionBindTpSl?(o(),c("div",Jb,"- / -")):(o(),n(T,{key:1,tpOrder:i.openOrder.takeProfitOrder,slOrder:i.openOrder.stopLossOrder,isLong:f.isBuyMode(i.openOrder.orderMode)},null,8,["tpOrder","slOrder","isLong"]))]),l("td",{class:C(f.orderSideClass)},m(f.orderSide),3),l("td",null,[d(L,{item:i.openOrder},null,8,["item"])]),l("td",null,m(f.orderValue)+" "+m(f.quoteCurrency),1),l("td",null,[d(w,{order:i.openOrder},null,8,["order"])]),l("td",eS,m(f.formattedActivationPrice),1),l("td",null,[l("p",{title:e.$filters.formatDate(i.openOrder.createTimestamp)},m(e.$filters.formatDate(i.openOrder.createTimestamp)),9,tS)]),l("td",iS,[l("div",{class:C(["cancel-order",[f.rowBgColor,{hover:u.isHover}]])},[f.canChase&&!u.isCancelToggleOn?(o(),n(D,{key:0,class:"cancel-btn chase-btn",type:"primary",size:"smallest",loading:f.isChasing,onClick:f.handleChaseClick},{default:s((()=>[p(m(e.$t("trading.chase")),1)])),_:1},8,["loading","onClick"])):h("",!0),u.isCancelToggleOn?(o(),c(g,{key:1},[d(O,{disable:!f.isBot,hasCursorQuestion:!1,immediately:"",popover:""},{content:s((()=>[d(D,{class:"cancel-btn",type:"primary",size:"smallest",onClick:f.handleClickConfirmCancel},{default:s((()=>[p(m(e.$t("msg.confirm")),1)])),_:1},8,["onClick"])])),tooltip:s((()=>[l("span",null,m(e.$t("trading.bot.cancel.order.tip")),1)])),_:1},8,["disable"]),l("div",{class:"toggle-cancel-wrapper",onClick:t[3]||(t[3]=e=>u.isCancelToggleOn=!1)},[d(I,{id:f.e2eID("btn_cross"),class:"close-icon"},null,8,["id"])])],64)):(o(),n(D,{key:2,class:"cancel-btn",type:"primary",size:"smallest",disabled:f.isChasing,onClick:f.handleCancelClick}
1,{default:s((()=>[p(m(e.$t("msg.cancel")),1)])),_:1},8,["disabled","onClick"]))],2)])],34)}],["__scopeId","data-v-57bb4808"]]),aS={class:"description"},nS={class:"no-show-box"},oS={class:"go-back-wrap"},sS=$n(A({__name:"ChaseOrderConfirmDialog",props:{visible:{type:Boolean}},emits:["update:visible","confirm"],setup(e){const t=e,i=T(!1);return D((()=>t.visible),(e=>{e&&(i.value=!1)})),(e,t)=>{const r=a("Checkbox"),u=a("BrandButton");return o(),n(pi,{visible:e.visible,width:"400px",center:"",isBrandNewStyle:"",class:"chase-order-confirm-dialog",idPrefix:"chase_order_confirm_dialog","onUpdate:visible":t[3]||(t[3]=t=>e.$emit("update:visible",t))},{header:s((()=>[p(m(e.$t("trading.chaseOrder")),1)])),body:s((()=>[l("div",aS,m(e.$t("trading.chaseOrder.description")),1),l("div",nS,[d(r,{value:i.value,"onUpdate:value":t[0]||(t[0]=e=>i.value=e)},{default:s((()=>[p(m(e.$t("t.dontShowMeAgain")),1)])),_:1},8,["value"])]),d(u,{class:"confirm-btn",type:"confirm",size:"biggest",onClick:t[1]||(t[1]=t=>e.$emit("confirm",i.value))},{default:s((()=>[p(m(e.$t("msg.confirm")),1)])),_:1}),l("div",oS,[l("span",{class:"go-back",onClick:t[2]||(t[2]=t=>e.$emit("update:visible",!1))},m(e.$t("t.goBack")),1)])])),_:1},8,["visible"])}}}),[["__scopeId","data-v-0e0236da"]]);function lS({isConfirmationOn:e,disableConfirmation:t,amendOrder:i}){const r=T(!1),a=se({});let n=null;async function o({orderID:e,symbol:t,side:r}){a[e]=!0;try{await i({orderID:e,symbol:t,type:"CHASE",side:r})}catch(n){}finally{delete a[e]}}return{isChaseDialogVisible:r,chasingOrderMap:a,requestChase:function(t){if(!a[t.orderID])return e()?(n=t,void(r.value=!0)):void o(t)},confirmChase:function(e){r.value=!1,e&&t(),n&&(o(n),n=null)}}}const uS={class:"order-list-wrap"},cS={key:0,class:"order-list-notice"},dS=$n(A({__name:"OrderList",props:{orderType:{default:null},visibleHeight:{default:0},currentTabOrderList:{default:()=>[]},openOrderList:{default:()=>[]},hasOpenOrder:{type:Boolean,default:!1},orderListLimit:{default:0}},setup(e){const t={qty:"originalAmount",orderPrice:"price",time:"createTimestamp"},i=e,r=k(),a=le(),u=ue(),g=pt(),{isLeaderMode:f}=Q(g),v=Ge(),{showCurrentSymbol:y,orderFormSettings:b}=Q(v),S=Vn(),C=M((()=>r.state.loginState)),P=M((()=>r.state.lang)),w=M((()=>r.getters["futures/marketData"])),O=M((()=>r.getters["futures/initialMarginPercentage"])),I=M((()=>r.getters["futures/currentModeOrderList"])),_=M((()=>r.getters.isNightTheme)),A=T(!0),R=T(!1),F=T(""),E=T(tb.VOID),z=T(!1),$=T({}),N=M((()=>[{id:"symbol",lang:"futuresMain.symbol",textAlign:"left"},{id:"filled",lang:"futuresMain.activeOrders.filled",textAlign:"left"},{id:"qty",lang:"trading.orders.totalSize",tip:"futuresMain.activeOrders.qty.tip",textAlign:"left",sortable:!0},{id:"orderPrice",lang:"futuresMain.activeOrders.orderPrice",textAlign:"left",sortable:!0},{id:"triggerPrice",lang:"futuresMain.trade.triggerPrice",textAlign:"left",html:!0},{id:"tpSl",lang:"t.tpsl",textAlign:"left"},{id:"side",lang:"t.side",textAlign:"left"},{id:"type",lang:"c2c.orderType",tip:"futuresMain.activeOrders.type.tip",textAlign:"left"},{id:"orderValue",lang:"futuresMain.activeOrders.orderValue",textAlign:"left"},{id:"status",lang:"futuresMain.activeOrders.status",textAlign:"left"},{id:"activationPrice",lang:"t.activationPrice",textAlign:"left"},{id:"time",lang:"t.time",tip:"futuresMain.activeOrders.time.tip",textAlign:"left",sortable:!0}])),U=M((()=>{const e=t[F.value];if(!e||!E.value)return Array.from(i.openOrderList).sort(((e,t)=>t.createTimestamp-e.createTimestamp));const r=E.value===tb.ASC?1:-1;return Array.from(i.openOrderList).sort(((t,i)=>{const a=t[e],n=i[e];return null==a||null==n||a===n?0:(a>n?1:-1)*r}))}));function V(){if(!y.value)return void(A.value=!1);const e=u.params.id,t=I.value[0]||{};e!==lt(t.marketName||"")&&0!==I.value.length||(A.value=!1)}D((()=>{var e;return null==(e=w.value)?void 0:e.symbol}),(()=>{C.value&&y.value?A.value=!0:A.value=!1})),D(I,(()=>{A.value&&V()})),L((()=>{C.value?V():A.value=!1}));const{isChaseDialogVisible:W,chasingOrderMap:q,requestChase:G,confirmChase:K}=lS({isConfirmationOn:()=>b.value.chaseOrderConfirmation,disableConfirmation:()=>v.updateOrderFormSettings({chaseOrderConfirmation:!1}),amendOrder:e=>(f.value?Xt.amendOrder:Ve.amendOrder)(e)});function j(e){A.value=!0;(f.value?Xt.cancelOrder:Ve.cancelOrder)(e).finally((()=>{A.value=!1}))}function Y(e,t){z.value=e,$.value=t}function Z({key:e,type:t}){F.value=e,E.value=t}function X(){a.push({name:"futuresOpenOrder",params:{lang:P.value}})}return(e,t)=>{const i=H("loading");return B((o(),c("div",uS,[d(eb,{class:"order-list-table",list:U.value,visibleHeight:e.visibleHeight,rowHeight:33,isEmpty:!e.hasOpenOrder,fixLastColumn:""},{header:s((()=>[d(ub,{headerTitles:N.value,sortKey:F.value,sortType:E.value,onSort:Z},null,8,["headerTitles","sortKey","sortType"])])),default:s((({item:e,index:i})=>[(o(),n(rS,{key:e.orderID,anyRowEditing:R.value,"onUpdate:anyRowEditing":t[0]||(t[0]=e=>R.value=e),index:i,openOrder:e,chasingOrderMap:x(q),onConfirmClose:j,onShowTpSlModifyWarningDialog:Y,onEditLeverage:t=>function(e){const t=lt(e.marketName);
1S.setLeverageDialog({show:!0,data:{...e,symbol:t,initialMarginPercentage:O.value(t)}})}(e),onChase:x(G)},null,8,["anyRowEditing","index","openOrder","chasingOrderMap","onEditLeverage","onChase"]))])),postfix:s((()=>[e.currentTabOrderList.length>=e.orderListLimit?(o(),c("div",cS,[p(m(e.$t("trading.openOrdersLimitNotice",{limit:e.orderListLimit}))+" Â ",1),l("a",{class:"order-list-link",onClick:X},m(e.$t("trading.seeAllOpenOrders")),1)])):h("",!0)])),empty:s((()=>[d(it,{isIconDark:_.value,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["list","visibleHeight","isEmpty"]),d(Wm,{visible:z.value,"onUpdate:visible":t[1]||(t[1]=e=>z.value=e),validateResult:$.value},null,8,["visible","validateResult"]),d(sS,{visible:x(W),"onUpdate:visible":t[2]||(t[2]=e=>ce(W)?W.value=e:null),onConfirm:x(K)},null,8,["visible","onConfirm"])])),[[i,A.value,"streamingLight"]])}}}),[["__scopeId","data-v-912b3734"]]),pS={class:"orders-container"},hS={class:"switcher-wrap"},mS={class:"highlight"},gS=200,fS=$n(A({__name:"Orders",props:{contentHeight:{default:0}},setup(e){const t="active",i="conditional",r=e,n=k(),{t:u}=G(),{$openDialog:f}=ar(),v=pt(),{isLeaderMode:y}=Q(v),b=Ge(),{showCurrentSymbol:S}=Q(b),C=M((()=>n.getters["futures/currentModeOrderList"])),P=M((()=>n.getters["futures/marketData"])),L=M((()=>n.getters.isUnifiedWallet)),w=T(t),D=T(!1),O=T(250),I=M((()=>w.value===i)),_=M((()=>I.value?C.value.filter((({triggerOrderType:e})=>[nr.STOP,nr.TAKE_PROFIT].includes(e))):C.value)),A=M((()=>_.value.slice(0,O.value))),R=M((()=>C.value.length>0)),F=M((()=>{const e=C.value.filter((({triggerOrderType:e})=>[nr.STOP,nr.TAKE_PROFIT].includes(e))).length;return e>gS?"200+":e})),E=M((()=>C.value.length>gS?"200+":C.value.length)),B=M((()=>[{value:t,label:u("t.all"),total:E.value},{value:i,label:u("t.tpsl"),total:F.value}])),z=M((()=>r.contentHeight-34));function $(){const e=A.value.some((e=>"trading-bot"===e.vendorName));if(!L.value&&e)return f(zb,{title:u("trading.order.cancel.notUnifiedWallet.dialog.title"),content:u("trading.order.cancel.notUnifiedWallet.dialog.content1"),confirmCallback:N});D.value=!0}function N(){(y.value?Xt.cancelAllOrders:Ve.cancelAllOrders)(S.value?P.value.symbol:"ALL")}return(e,t)=>{const i=a("i18n-t");return o(),c("div",pS,[l("div",hS,[d(Jp,{value:w.value,"onUpdate:value":t[0]||(t[0]=e=>w.value=e),class:"tab-switcher",list:B.value},null,8,["value","list"]),d(eh,{disabled:!R.value,text:x(u)("msg.cancelAll"),onClick:$},null,8,["disabled","text"])]),d(dS,{orderType:w.value,visibleHeight:z.value,currentTabOrderList:_.value,hasOpenOrder:R.value,openOrderList:A.value,orderListLimit:O.value},null,8,["orderType","visibleHeight","currentTabOrderList","hasOpenOrder","openOrderList","orderListLimit"]),d(hy,{visible:D.value,"onUpdate:visible":t[1]||(t[1]=e=>D.value=e),isFutures:"",onConfirm:N},{title:s((()=>[p(m(e.$t("msg.cancel"))+" ",1),l("span",mS,[p(m(e.$t("msg.all"))+" ",1),x(S)?(o(),c(g,{key:0},[p(m(P.value.symbol),1)],64)):h("",!0)]),p(" "+m(e.$t("order.orders"))+"? ",1)])),message:s((()=>[d(i,{keypath:x(S)?"msg.confirmCancelAll":"msg.confirmCancelAll.allMarkets",tag:"span"},te({_:2},[x(S)?{name:"symbol",fn:s((()=>[p(m(P.value.symbol),1)])),key:"1"}:{name:"all",fn:s((()=>[p(m(e.$t("msg.all").toLowerCase()),1)])),key:"0"}]),1032,["keypath"])])),_:1},8,["visible"])])}}}),[["__scopeId","data-v-5da298cf"]]),vS={key:0},yS={class:"subtitle"};const bS=$n({name:"FillsListHeader",components:{SortShell:rb},props:{headerTitles:{type:Array,default:function(){return[]}},cancelAllButtonWidth:{type:String,default:null},sortKey:{type:String,default:""},sortType:{type:String,default:tb.VOID}},emits:["sort"],methods:{getClass(e){const t=[];
1return"type"===e.id&&t.push("type-column"),"dateTime"===e.id&&t.push("no-padding"),e.textAlign&&t.push(`align-${e.textAlign}`),t},generateTitle(e){return`${this.$t(e.lang)} ${e.more||""}`}}},[["render",function(e,t,i,r,u,d){const f=a("SortShell"),v=a("HeaderRow");return o(),n(v,{class:"row"},{default:s((()=>[t[0]||(t[0]=l("th",{class:"no-padding"},null,-1)),(o(!0),c(g,null,R(i.headerTitles,(t=>(o(),c("th",{key:t.id,class:C(d.getClass(t))},[t.sortable?(o(),n(f,{key:0,sortType:i.sortKey===t.id?i.sortType:"",onSort:i=>e.$emit("sort",{key:t.id,type:i})},{default:s((()=>[p(m(d.generateTitle(t)),1)])),_:2},1032,["sortType","onSort"])):(o(),c(g,{key:1},[p(m(d.generateTitle(t))+" ",1),t.subtitle?(o(),c(g,{key:0},[t.subtitle.length>4?(o(),c("br",vS)):h("",!0),l("span",yS,"("+m(t.subtitle)+")",1)],64)):h("",!0)],64))],2)))),128))])),_:1,__:[0]})}],["__scopeId","data-v-6d575dec"]]);const SS={class:"trade-detail"},CS={class:"trade-detail__title"};const PS={name:"FillsListRow",components:{OrderType:yb,Cell:$n({name:"FillsListCell",props:{textAlign:{type:String,default:"right"},direction:{type:String,default:null}},computed:{classes(){return{"buy-text":"buy"===this.direction,"sell-text":"sell"===this.direction}}}},[["render",function(e,t,i,r,l,u){const c=a("Cell");return o(),n(c,{class:C(["cell",u.classes]),textAlign:i.textAlign},{default:s((()=>[_(e.$slots,"default",{},void 0,!0)])),_:3},8,["textAlign","class"])}
1],["__scopeId","data-v-98432866"]]),HistoryFuturesTradeDetail:$n({name:"HistoryFuturesTradeDetail",components:{Table:ur,HeaderRow:lr,Row:sr,Cell:or},props:{tableData:{type:Array,default:()=>[]},total:{type:Number,default:0}}},[["render",function(e,t,i,r,u,h){const f=a("Cell"),v=a("HeaderRow"),y=a("Row"),b=a("Table");return o(),c("div",SS,[l("p",CS,m(e.$t("futuresMain.tradeHistory.detail_title")),1),d(b,{class:"trade-detail__table"},{header:s((()=>[d(v,{class:"table__header"},{default:s((()=>[d(f,{textAlign:"left"},{default:s((()=>[p(m(e.$t("futuresMain.tradeHistory.detail_assets")),1)])),_:1}),d(f,null,{default:s((()=>[p(m(e.$t("t.amount")),1)])),_:1}),d(f,null,{default:s((()=>[p(m(e.$t("futuresMain.tradeHistory.detail_assetPrice")),1)])),_:1}),d(f,null,{default:s((()=>[p(m(e.$t("futuresMain.tradeHistory.detail_value")),1)])),_:1})])),_:1})])),body:s((()=>[i.tableData.length?(o(!0),c(g,{key:0},R(i.tableData,((t,i)=>(o(),n(y,{key:`${t.orderId}_${i}`,disableBackground:!0,index:0},{default:s((()=>[d(f,{textAlign:"left"},{default:s((()=>[p(m(t.asset),1)])),_:2},1024),d(f,null,{default:s((()=>[p(m(e.$filters.formatNumber(t.amount,t.fiat?"fc":"vc")),1)])),_:2},1024),d(f,null,{default:s((()=>[p(m(e.$filters.formatNumber(t.assetPrice,t.fiat?"fc":"vc")),1)])),_:2},1024),d(f,{class:C({positive:t.value>0,negative:t.value<0})},{default:s((()=>[p(m(e.$filters.formatNumber(t.value,{formatKey:4})),1)])),_:2},1032,["class"])])),_:2},1024)))),128)):(o(),n(y,{key:1,index:0},{default:s((()=>[p(m(e.$t("msg.noData")),1)])),_:1}))])),_:1})])}],["__scopeId","data-v-bc03c42c"]])},props:{fillOrder:{type:Object,default:function(){return{}}},index:{type:Number,required:!0},isExpand:{type:Boolean,default:!1}},emits:["toggleExpand"],data:()=>({loading:!1,detailData:[]}),computed:{...b("futures",["marketMap"]),...y(Ge,["isContractSizeType","sizeFilter","sizeUnit"]),hasSubList(){var e,t;return(null==(t=null==(e=this.fillOrder)?void 0:e.futureTradeHistories)?void 0:t.length)>1},marketSymbol(){return(this.fillOrder.marketName||"").replace(tr,"")},priceFilter(){return(this.marketMap[this.marketSymbol]||{}).priceFilter??""},filledPriceFormatSetting(){return{formatKey:this.priceFilter,roundMode:this.isBuy?S.ROUND_UP:S.ROUND_DOWN}},isSubTransaction(){return this.fillOrder.parentId},isMarketOrder(){return"TYPE_MARKET"===this.fillOrder.orderTypeName},isAdlOrder(){return"ORDER_ADL"===this.fillOrder.orderTypeName},isLiquidationOrder(){return"ORDER_LIQUIDATION"===this.fillOrder.orderTypeName},detailOrderData(){var e,t;return(null==(t=null==(e=this.fillOrder)?void 0:e.futureTradeHistories)?void 0:t[0])||!1},showLiquidationMultiTransactions(){return this.isLiquidationOrder&&this.hasSubList},showDetailOrderData(){return this.isLiquidationOrder&&this.detailOrderData},isBuy(){return this.fillOrder.orderMode===ot.BUY},orderSide(){const e=rr(this.fillOrder,{isBuyOrder:this.isBuy});return this.$t(e)},orderSideClass(){return ir(this.fillOrder,{isBuyOrder:this.isBuy})}},methods:{getDetailWidth(){return this.$deviceSmallerThan.md(this.$mq)?300:530},getRealizedPnl(e){this.loading=!0,Ve.futuresTradeHistoryDetail({orderId:e.orderId,timestamp:e.dateTime}).then((e=>{this.detailData=e})).finally((()=>{this.loading=!1,this.$refs.detailTooltip.forceUpdateTooltip()}))},isZero:e=>e<0&&e<-1e-5?-1:e>0&&e>1e-5?1:0,onClickExpandIcon(){this.$emit("toggleExpand",this.fillOrder.orderId,!this.isExpand)},convertSize(e,t){return this.isContractSizeType?e:Qe(e,void 0,t)}}},kS={class:"first-cell"},TS={key:0},MS={key:1},LS={key:2},wS={key:3},DS={key:0},OS={key:1},IS={key:2},xS={key:0},_S={class:"size_unit"},AS={key:0},RS={key:1},FS={class:"size_unit"},ES={key:2},BS={class:"size_unit"},zS={key:0},$S={key:1},NS={class:"size_unit"},US={key:2},HS={class:"size_unit"},VS={class:"size_unit"};const WS={orderPrice:"orderPrice",fillPrice:"fillPrice",dateTime:"dateTime"};const qS=$n({name:"FillsList",components:{VirtualScrollTable:eb,FillsListHeader:bS,FillsListRow:$n(PS,[["render",function(e,t,i,r,u,f){const v=a("Cell"),y=a("OrderType"),b=a("HistoryFuturesTradeDetail"),S=a("Tooltip"),P=a("Row"),k=H("loading");return o(),n(P,{class:"row",disableCssHoverEffect:e.isMobile,index:i.index},{default:s((()=>[l("td",kS,[l("span",{class:C(["indicator",f.orderSideClass])},null,2),f.hasSubList?(o(),c("span",{key:0,class:C(["expand-icon",{"is-expand":i.isExpand}])},[l("i",{onClick:t[0]||(t[0]=(...e)=>f.onClickExpandIcon&&f.onClickExpandIcon(...e))})],2)):h("",!0)]),d(v,{class:"date-cell",textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.fillOrder.dateTime,"MM-dd HH:mm:ss")),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.marketSymbol),1)])),_:1}),d(v,{textAlign:"left",class:C(f.orderSideClass)},{default:s((()=>[p(m(f.orderSide),1)])),_:1},8,["class"]),d(v,{textAlign:"left"},{default:s((()=>[d(y,{item:i.fillOrder},null,8,["item"])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[f.isMarketOrder?(o(),c("span",TS,m(e.$t("t.orderType_m")),1)):f.showLiquidationMultiTransactions?(o(),c("span",MS,"-")):f.showDetailOrderData?(o(),c("span",LS,m(e.$filters.formatNumber(f.detailOrderData.orderPriceDecimal,{preserveDecimals:!0,defaultValue:"-"})),1)):(o(),c("span",wS,m(e.$filters.formatNumber(i.fillOrder.orderPriceDecimal,{preserveDecimals:!0,defaultValue:"-"})),1))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[f.showLiquidationMultiTransactions?(o(),c("span",DS,"-")):f.showDetailOrderData?(o(),c("span",OS,m(e.$filters.formatNumber(f.detailOrderData.fillPriceDecimal,{preserveDecimals:!0,defaultValue:"-"})),1)):(o(),c("span",IS,m(e.$filters.formatNumber(i.fillOrder.fillPriceDecimal,{preserveDecimals:!0,defaultValue:"-"})),1))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[f.isSubTransaction?(o(),c(g,{key:0},[f.isLiquidationOrder||f.isAdlOrder?(o(),c("span",xS,[p(m(f.convertSize(i.fillOrder.orderSize,i.fillOrder.contractSize))+" ",1),l("span",_S,m(e.sizeUnit),1)])):h("",!0)],64)):(o(),c(g,{key:1},[f.showLiquidationMultiTransactions?(o(),c("span",AS,"-")):f.showDetailOrderData?(o(),c("span",RS,[p(m(e.$filters.formatNumber(f.convertSize(f.detailOrderData.orderSize,f.detailOrderData.contractSize),e.sizeFilter))+" ",1),l("span",FS,m(e.sizeUnit),1)])):(o(),c("span",ES,[p(m(e.$filters.formatNumber(f.convertSize(i.fillOrder.orderSize,i.fillOrder.contractSize),e.sizeFilter))+" ",1),l("span",BS,m(e.sizeUnit),1)]))],64))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[f.showLiquidationMultiTransactions?(o(),c("span",zS,"-")):f.showDetailOrderData?(o(),c("span",$S,[p(m(e.$filters.formatNumber(f.convertSize(f.detailOrderData.fillSize,f.detailOrderData.contractSize),e.sizeFilter))+" ",1),l("span",NS,m(e.sizeUnit),1)])):(o(),c("span",US,[p(m(e.$filters.formatNumber(f.convertSize(i.fillOrder.fillSize,i.fillOrder.contractSize),e.sizeFilter))+" ",1),l("span",HS,m(e.sizeUnit),1)]))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[l("span",{class:C(["cell__fee",{"color-success":f.isZero(0-i.fillOrder.fee)>0,"color-danger":f.isZero(0-i.fillOrder.fee)<0}])},m(e.$filters.formatNumber(0-i.fillOrder.fee,{formatKey:"25"})),3)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[l("span",{class:C({"color-success":f.isZero(i.fillOrder.realizedPnl)>0,"color-danger":f.isZero(i.fillOrder.realizedPnl)<0})},m(e.$filters.formatNumber(i.fillOrder.realizedPnl,{formatKey:"25"})),3)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[0===f.isZero(i.fillOrder.total)?(o(),c("span",{key:0,class:C({"color-success":f.isZero(i.fillOrder.total)>0,"color-danger":f.isZero(i.fillOrder.total)<0})},m(e.$filters.formatNumber(i.fillOrder.total,{formatKey:"25"})),3)):(o(),n(S,{key:1,ref:"detailTooltip",placement:"left",tooltipStyle:{width:`${f.getDetailWi
1dth()}px`,maxWidth:"none"},popover:"",onlyShowOnClick:"",visibleArrow:""},{content:s((()=>[l("span",{class:C({"color-success":f.isZero(i.fillOrder.total)>0,"color-danger":f.isZero(i.fillOrder.total)<0}),style:{"text-decoration":"underline",cursor:"pointer"},onClick:t[1]||(t[1]=e=>f.getRealizedPnl(i.fillOrder))},m(e.$filters.formatNumber(i.fillOrder.total,{formatKey:"25"})),3)])),tooltip:s((()=>[B(d(b,{"table-data":u.detailData,total:i.fillOrder.total},null,8,["table-data","total"]),[[k,u.loading]])])),_:1},8,["tooltipStyle"]))])),_:1}),d(v,{class:"last-cell",textAlign:"left"},{default:s((()=>[p(m(f.convertSize(i.fillOrder.positionRemaining,i.fillOrder.contractSize))+" ",1),l("span",VS,m(e.sizeUnit),1)])),_:1})])),_:1},8,["disableCssHoverEffect","index"])}],["__scopeId","data-v-e588669b"]]),NoDataAvailable:it},props:{contentHeight:{type:Number,default:0}},data:()=>({subListExpandMap:{},sortKey:"",sortType:tb.VOID}),computed:{...b(["loginState"]),...b("futures",["futureOrderTrades"]),...U("futures",["marketData"]),...U(["isNightTheme"]),...y(Ge,["sizeUnit"]),listVisibleHeight(){return this.contentHeight},headerTitles:()=>[{id:"dateTime",lang:"futuresMain.tradeHistory.dateTime",sortable:!0,textAlign:"left"},{id:"symbol",lang:"futuresMain.symbol",textAlign:"left"},{id:"side",lang:"t.side",textAlign:"left"},{id:"type",lang:"c2c.orderType",textAlign:"left"},{id:"orderPrice",lang:"futuresMain.tradeHistory.orderPrice",sortable:!0,textAlign:"left"},{id:"fillPrice",lang:"futuresMain.tradeHistory.fillPrice",sortable:!0,textAlign:"left"},{id:"orderSize",lang:"futuresMain.tradeHistory.orderSize",textAlign:"left"},{id:"fillSize",lang:"futuresMain.tradeHistory.fillSize",textAlign:"left"},{id:"fees",lang:"futuresMain.tradeHistory.fees",textAlign:"left"},{id:"realizedPNL",lang:"futuresMain.tradeHistory.realizedPNL",textAlign:"left"},{id:"total",lang:"t.total",textAlign:"left"},{id:"positionRemaining",lang:"futuresMain.tradeHistory.positionRemaining",textAlign:"left"}],hasFillOrder(){return this.fillsOrderList.length>0},displayList(){return this.sortedList.filter((e=>!e.parentId||this.subListExpandMap[e.parentId]))},sortedList(){const e=WS[this.sortKey];if(!this.sortKey||!this.sortType)return this.fillsOrderList;const t=this.sortType===tb.ASC?1:-1,i=[],r=this.fillsOrderList.filter((e=>!e.parentId||(i.push(e),!1))).sort(((i,r)=>i[e]===r[e]?0:(i[e]>r[e]?1:-1)*t));for(const a of i){const e=r.findIndex((e=>e.orderId===a.orderId));e<0||r.splice(e+1,0,a)}return r},fillsOrderList(){let e=[];for(let t=0;t<this.futureOrderTrades.length;t++){const i=this.futureOrderTrades[t];if("FUTURES_FUNDING"!==i.orderTypeName){e.push(i);i.futureTradeHistories.length>1&&(e=e.concat(i.futureTradeHistories.map(((e,t)=>(e.parentId=i.orderId,e.subitemKey=`${e.orderId}-${t}`,e)))))}}return e}},watch:{loginState(){this.loginState||this.updateFutureOrderTrades([])},"marketData.symbol"(e,t){e!==t&&this.updateFutureOrderTrades([])}},methods:{...v("futures",["updateFutureOrderTrades"]),onToggleExpand(e,t){this.subListExpandMap[e]=t},onSort({key:e,type:t}){this.sortKey=e,this.sortType=t}}},[["render",function(e,t,i,r,l,u){const c=a("FillsListHeader"),p=a("FillsListRow"),h=a("NoDataAvailable"),m=a("VirtualScrollTable");return o(),n(m,{class:"fills-list-table",list:u.displayList,visibleHeight:u.listVisibleHeight,rowHeight:32,isEmpty:!u.hasFillOrder,fixHeader:""},{header:s((()=>[d(c,{headerTitles:u.headerTitles,sortKey:l.sortKey,sortType:l.sortType,onSort:u.onSort},null,8,["headerTitles","sortKey","sortType","onSort"])])),default:s((({item:e,index:t})=>[(o(),n(p,{key:e.subitemKey||e.orderID||e.orderId,index:t,fillOrder:e,isExpand:l.subListExpandMap[e.orderId],onToggleExpand:u.onToggleExpand},null,8,["index","fillOrder","isExpand","onToggleExpand"]))])),empty:s((()=>[d(h,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["list","visibleHeight","isEmpty"])}],["__scopeId","data-v-c5912215"]]),{disableLinkOnTrading:GS}=mt,KS={name:"FuturesHistoryAction",components:{IconHistory:cr},props:{currentTab:{type:String,required:!0}},data:()=>({disableLinkOnTrading:GS,TAB_TYPE:Vp}
1),computed:{...b(["lang"]),...U("futures",{marketSymbol:"symbol"}),...y(Ge,["showCurrentSymbol","showTwapCurrentSymbol"]),displayCurrentSymbol(){return this.currentTab===Vp.TWAP?this.showTwapCurrentSymbol:this.showCurrentSymbol}},methods:{...f(Ge,["toggleCurrentSymbol","toggleTwapCurrentSymbol"]),onToggleCurrentSymbol(){this.currentTab===Vp.TWAP?this.toggleTwapCurrentSymbol():this.toggleCurrentSymbol()},goFuturesHistory(){let e=null;switch(this.currentTab){case Vp.ORDERS:case Vp.TWAP:e="futuresOpenOrder";break;case Vp.TRADE_HISTORY:e="futuresTradeHistory"}e&&this.$router.push({name:e,params:{lang:this.lang},query:{}})}}},QS={class:"futures-history-action"},jS={key:0};const YS=$n(KS,[["render",function(e,t,i,r,l,u){const g=a("Checkbox"),f=a("IconHistory");return o(),c("div",QS,[i.currentTab!==l.TAB_TYPE.TRADE_HISTORY?(o(),n(g,{key:0,value:u.displayCurrentSymbol,"onUpdate:value":u.onToggleCurrentSymbol},{default:s((()=>[p(m(e.$t("trading.orders.currentTradingPair")),1)])),_:1},8,["value","onUpdate:value"])):h("",!0),l.disableLinkOnTrading?h("",!0):(o(),c("div",{key:1,class:"go-history-wrapper",onClick:t[0]||(t[0]=(...e)=>u.goFuturesHistory&&u.goFuturesHistory(...e))},[d(f,{class:"icon-history"}),e.isMobile?h("",!0):(o(),c("span",jS,m(e.$t("router.futuresHistory")),1))]))])}],["__scopeId","data-v-6d1ecf70"]]),ZS={name:"CancelPanel",components:{IconClose:ze},props:{hasOpenOrder:{type:Boolean,required:!0},openOrderList:{type:Array,default:()=>[]},cancelOrderMap:{type:Object,required:!0},toggleCloseOrder:{type:Function,required:!0},confirmCloseOrder:{type:Function,required:!0},deleteAll:{type:Function,required:!0},currentHoverRow:{type:String,default:""},enableCancelAll:{type:Boolean,default:!0},chaseOrder:{type:Function,default:null},canChaseOrder:{type:Function,default:()=>!1},chasingOrderMap:{type:Object,default:()=>({})}},methods:{e2eID:Gi}},XS={class:"panel-header"},JS={class:"cancel-panel-content"},eC=["onClick"];const tC=$n(ZS,[["render",function(e,t,i,r,u,f){const v=a("BrandButton"),y=a("Tooltip"),b=a("IconClose");return o(),c("div",{ref:"panel",class:C(["cancel-panel",{"has-chase":!!i.chaseOrder}])},[l("div",XS,[i.enableCancelAll?(o(),n(v,{key:0,class:"cancel-btn cancel-all",type:"primary",size:"smallest",disabled:!i.hasOpenOrder,onClick:i.deleteAll},{default:s((()=>[p(m(e.$t("msg.cancelAll")),1)])),_:1},8,["disabled","onClick"])):h("",!0)]),l("div",JS,[(o(!0),c(g,null,R(i.openOrderList,(t=>(o(),c("div",{key:t.orderID,class:C(["cancel-order",{hover:t.orderID===i.currentHoverRow}])},[i.chaseOrder&&i.canChaseOrder(t)&&!i.cancelOrderMap[t.orderID]?(o(),n(v,{key:0,class:"cancel-btn chase-btn",type:"primary",size:"smallest",loading:!!i.chasingOrderMap[t.orderID],onClick:e=>i.chaseOrder(t)},{default:s((()=>[p(m(e.$t("trading.chase")),1)])),_:2},1032,["loading","onClick"])):h("",!0),i.cancelOrderMap[t.orderID]?(o(),c(g,{key:1},[d(y,{disable:!t.vendorName,hasCursorQuestion:!1,immediately:"",popover:""},{content:s((()=>[(o(),n(v,{key:`confirm_cancel_${t.orderID}`,class:"cancel-btn",type:"primary",size:"smallest",onClick:e=>i.confirmCloseOrder(t)},{default:s((()=>[p(m(e.$t("msg.confirm")),1)])),_:2},1032,["onClick"]))])),tooltip:s((()=>[l("span",null,m(e.$t("trading.bot.cancel.order.tip")),1)])),_:2},1032,["disable"]),l("div",{class:"toggle-cancel-wrapper",onClick:e=>i.toggleCloseOrder(t.orderID)},[d(b,{id:f.e2eID("btn_cross"),class:"close-icon"},null,8,["id"])],8,eC)],64)):(o(),n(v,{key:`cancel_${t.orderID}`,class:"cancel-btn",type:"primary",size:"smallest",disabled:!!i.chasingOrderMap[t.orderID],onClick:e=>i.toggleCloseOrder(t.orderID)},{default:s((()=>[p(m(e.$t("msg.cancel")),1)])),_:2},1032,["disabled","onClick"]))],2)))),128))])],2)}],["__scopeId","data-v-a836594a"]]);const iC=$n({name:"TwapOrderListHeader",components:{SortableHeaderCell:dr},props:{headerTitles:{type:Array,default:function(){return[]}},cancelAllButtonWidth:{type:String,default:null},sortKey:{type:[Boolean,String],required:!1}},methods:{getClass(e){const t=[];return e.textAlign&&t.push(`align-${e.textAlign}`),t}}},[["render",function(e,t,i,r,u,d){const h=a("Tooltip"),f=a("SortableHeaderCell"),v=a("HeaderRow");return o(),n(v,{class:"twap-order-header"},{default:s((()=>[(o(!0),c(g,null,R(i.headerTitles,(t=>(o(),n(f,O({ref_for:!0},e.$attrs,{key:t.id,currentSortKey:i.sortKey,class:d.getClass(t),title:t}),{content:s((()=>[l("span",null,[t.tooltip?(o(),n(h,{key:0,content:e.$t(t.lang),tooltip:e.$t(t.tooltip)},null,8,["content","tooltip"])):(o(),c(g,{key:1},[p(m(e.$t(t.lang)),1)],64))])])),_:2},1040,["currentSortKey","class","title"])))),128))])),_:1})}],["__scopeId","data-v-8e83c444"]]);const rC=$n({name:"TwapOrderListRowOrderType",props:{orderMode:{type:Number,default:ot.BUY}},computed:{isBuy(){return this.orderMode===ot.BUY}}},[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["spot-order-type",n.isBuy?"buy-type":"sell-type"])},m(n.isBuy?e.$t("t.buy"):e.$t("t.sell")),3)}],["__scopeId","data-v-c3d9ffeb"]]),{enableLastPriceDependentUI:aC}=zt,nC={name:"TwapOrderListRow",components:{TwapOrderListRowOrderType:rC},props:{orderItem:{type:Object,default:function(){return{}}},direction:{type:String,required:!0},index:{type:Number,required:!0}},emits:["mouseleave","mouseover"],data:()=>({enableLastPriceDependentUI:aC}),computed:{...b(["lang"]),...b("orderBook",["lastPrice"]),...b("futures",["marketMap","marketDetailMap"]),...U("futures",{futuresMarketData:"marketData"}
1),...y(Ge,["isContractSizeType"]),lasting(){const e=(new Date).getTime(),t=de(e,this.orderItem.createTimestamp);return`${t?`${t}H `:""}${pe(e,this.orderItem.createTimestamp)%60}M`},period(){const e=this.orderItem.orderDetail.timePeriod,t=Math.floor(e/60),i=Math.floor(t/60);return`${i?`${i}H `:""}${t%60}M`},formattedActivationPrice(){var e;const t=this.orderItem.activationPrice,i=(null==(e=this.marketMap[this.orderItem.symbol])?void 0:e.priceDecimal)??"max8";return t?this.$filters.formatNumber(t,i):"-"},orderFuturesRoute(){return{name:"futuresId",params:{lang:this.lang,id:this.orderItem.symbol},state:{noScrollTop:this.isMobile}}},showLinkMarketLine(){return this.orderItem.symbol!==this.$route.params.id},originalFilled(){return this.isContractSizeType?this.orderItem.originalAmount:this.convertContractToCrypto(this.orderItem.originalAmount)},filled(){return this.isContractSizeType?this.orderItem.filledSize:this.convertContractToCrypto(this.orderItem.filledSize)},maxIndividualOrderSize(){return this.isContractSizeType?this.orderItem.orderDetail.subTwapMaxOrderSize:this.convertContractToCrypto(this.orderItem.orderDetail.subTwapMaxOrderSize)},baseCurrency(){var e;return this.isContractSizeType?Ke.CONTRACTS:(null==(e=this.marketMap[this.orderItem.symbol])?void 0:e.baseCurrency)||""},averageFillPrice(){if(!this.lastPrice)return"-";const e=pr(this.lastPrice);return S(this.orderItem.averageFillPrice).toFixed(e+1,S.ROUND_DOWN)},filledText(){const e=this.$filters.formatNumber(this.filled,"max8"),t=this.$filters.formatNumber(this.originalFilled,"max8"),i=Math.max(pr(e),pr(t));return`${S(this.filled).toFixed(i,S.ROUND_DOWN)} / ${S(this.originalFilled).toFixed(i,S.ROUND_DOWN)}`},symbol(){return this.orderItem.symbol},quoteCurrency(){return Si(this.symbol)}},methods:{getOrderValue(e){const{price:t,amount:i}=e;return S(t).times(i).toNumber()},convertContractToCrypto(e){var t;return e*((null==(t=this.marketDetailMap[this.orderItem.symbol])?void 0:t.contractSize)||0)}}},oC={class:"market-column-content"},sC={class:"currency"},lC={class:"currency"},uC={class:"currency"},cC={class:"currency"};const dC=$n(nC,[["render",function(e,t,i,r,u,f){const v=a("Cell"),y=a("RouterLink"),b=a("TwapOrderListRowOrderType"),S=a("Row");return o(),n(S,{class:C(["twap-order-list-row",[i.direction]]),index:i.index,onMouseover:t[0]||(t[0]=t=>e.$emit("mouseover",t)),onMouseleave:t[1]||(t[1]=t=>e.$emit("mouseleave",t))},{default:s((()=>[d(v,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.orderItem.createTimestamp)),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[l("div",oC,[d(y,{class:"market-link",to:f.orderFuturesRoute},{default:s((()=>[l("span",{class:C(["crypto",{underline:f.showLinkMarketLine}])},m(i.orderItem.symbol),3)])),_:1},8,["to"])])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[d(b,{orderMode:i.orderItem.orderMode},null,8,["orderMode"])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.filledText)+" ",1),l("span",sC,m(f.baseCurrency),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.averageFillPrice)+" ",1),l("span",lC,m(f.quoteCurrency),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.lasting)+" / "+m(f.period),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.formattedActivationPrice),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(i.orderItem.orderDetail.randomizeSize?"â":"-"),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(i.orderItem.orderDetail.makerFirst?"â":"-"),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(i.orderItem.reduceOnly?"â":"-"),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.maxSpread?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(100*i.orderItem.orderDetail.maxSpread,"max8"))+" ",1),t[2]||(t[2]=l("span",{class:"currency"},"%",-1))],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1}),u.enableLastPriceDependentUI?(o(),n(v,{key:0,textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.maxDistanceThroughBook?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(100*i.orderItem.orderDetail.maxDistanceThroughBook,"max8"))+" ",1),t[3]||(t[3]=l("span",{class:"currency"},"%",-1))],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1})):h("",!0),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.subTwapMaxOrderSize?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(f.maxIndividualOrderSize,"max8"))+" ",1),l("span",uC,m(f.baseCurrency),1)],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.pausePrice?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(i.orderItem.orderDetail.pausePrice,"max8"))+" ",1),l("span",cC,m(f.quoteCurrency),1)],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1})])),_:1},8,["class","index"])}
1],["__scopeId","data-v-89f2737f"]]),{enableLastPriceDependentUI:pC}=zt,hC=[{id:"createTimestamp",lang:"t.time",textAlign:"left",sortable:!0},{id:"market",lang:"trading.orders.markets",textAlign:"left"},{id:"side",lang:"t.side",textAlign:"left"},{id:"filled",lang:"futuresMain.activeOrders.filled",textAlign:"left",tooltip:"trading.orders.hint.filledSize"},{id:"avgFilledPrice",lang:"trading.orders.avgFilledPrice",textAlign:"left"},{id:"lastingPeriod",lang:"trading.orders.lastingPeriod",textAlign:"left",tooltip:"trading.orders.hint.lasting"},{id:"activationPrice",lang:"t.activationPrice",textAlign:"left"},{id:"randomizeSize",lang:"trading.twap.randomizeSize",textAlign:"left"},{id:"makerFirst",lang:"trading.twap.makerFirst",textAlign:"left"},{id:"reduceOnly",lang:"order.reduce-only",textAlign:"left"},{id:"maxSpread",lang:"trading.twap.maxSpread",textAlign:"left"},...pC?[{id:"maxDistanceThroughBook",lang:"trading.twap.maxDistanceThroughBook",textAlign:"left"}]:[],{id:"maxIndividualOrderSize",lang:"trading.twap.maxIndividualOrderSize",textAlign:"left"},{id:"pausePrice",lang:"trading.orders.pausePrice",textAlign:"right"}],mC={name:"TwapOrders",components:{TwapOrderListHeader:iC,TwapOrderListRow:dC,CancelPanel:tC,NoDataAvailable:it},data:()=>({isLoading:!1,headerTitles:hC,requestAnimationFrameId:!1,sortKey:!1,sortOrder:!1,cancelOrderMap:{},currentHoverRow:"",scrollTicking:!1,touchElement:null,isShowShadow:!1,isShowCancellAllDialog:!1,cancelPanelObserver:null}),computed:{...b({futuresTwapOrderList:e=>e.futures.twapOrderList}),...U(["isNightTheme"]),...U("futures",["marketData"]),...y(Ge,["showTwapCurrentSymbol"]),filteredTwapOrderList(){return this.showTwapCurrentSymbol?this.futuresTwapOrderList.filter((e=>{var t;return e.symbol===(null==(t=this.marketData)?void 0:t.symbol)})):this.futuresTwapOrderList},ordersData(){return this.sortKey?JSON.parse(JSON.stringify(this.filteredTwapOrderList)).sort(((e,t)=>{if("orderType"===this.sortKey){const{orderType:i,orderMode:r,triggerOrderType:a}=e,{orderType:n,orderMode:o,triggerOrderType:s}=t,l=`${i}_${r}_${a}`,u=`${n}_${o}_${s}`;return"asc"===this.sortOrder?l.localeCompare(u):u.localeCompare(l)}return"market"===this.sortKey?"asc"===this.sortOrder?e.marketName.localeCompare(t.marketName):t.marketName.localeCompare(e.marketName):"asc"===this.sortOrder?e[this.sortKey]-t[this.sortKey]:t[this.sortKey]-e[this.sortKey]})):this.filteredTwapOrderList},emptyOrderData(){return!this.ordersData||0===this.ordersData.length}},mounted(){this.$nextTick((()=>{var e;this.tableWrapper=this.$refs.tableWrapper,this.initPanelEvents(this.tableWrapper),this.tableWrapper.addEventListener("scroll",this.checkShowShadow),(null==(e=this.$refs.cancelPanel)?void 0:e.$refs.panel)?(this.cancelPanel=this.$refs.cancelPanel.$refs.panel,this.initPanelEvents(this.cancelPanel)):(this.cancelPanelObserver=new MutationObserver((e=>{e.forEach((e=>{var t;"childList"===e.type&&(this.cancelPanel=null==(t=this.$refs.cancelPanel)?void 0:t.$refs.panel,this.cancelPanel&&this.initPanelEvents(this.cancelPanel))}))})),this.cancelPanelObserver.observe(this.$el,{childList:!0,subtree:!0})),this.gridWrapperObserver=new MutationObserver(this.checkShowShadow),this.gridWrapperObserver.observe(this.tableWrapper.parentNode,{attributes:!0,childList:!0,subtree:!0}),this.checkShowShadow()}))},beforeUnmount(){cancelAnimationFrame(this.requestAnimationFrameId),clearTimeout(this.timeout),this.removePanelEvents(this.tableWrapper),this.removePanelEvents(this.cancelPanel),this.tableWrapper.removeEventListener("scroll",this.checkShowShadow),this.gridWrapperObserver&&this.gridWrapperObserver.disconnect(),this.cancelPanelObserver&&this.cancelPanelObserver.disconnect()},methods:{initPanelEvents(e){null==e||e.addEventListener("scroll",this.syncScroll),null==e||e.addEventListener("touchstart",this.setTouchElement),null==e||e.addEventListener("touchmove",this.syncScroll),null==e||e.addEventListener("touchend",this.syncScroll)},removePanelEvents(e){null==e||e.removeEventListener("scroll",this.syncScroll),null==e||e.removeEventListener("touchstart",this.setTouchElement),null==e||e.removeEventListener("touchmove",this.syncScroll),null==e||e.removeEventListener("touchend",this.syncScroll)},setSortData({key:e,order:t}){this.sortKey=e,this.sortOrder=t},getMode:e=>e===ot.BUY?"buy":e===ot.SELL?"sell":void 0,toggleCloseOrder(e){this.cancelOrderMap[e]=!this.cancelOrderMap[e]},confirmCloseOrder(e){Ve.cancelOrder(e).then((()=>{delete this.cancelOrderMap[e.orderID]}))},setCurrentHoverRow(e){this.currentHoverRow=e},setTouchElement(e){const t=e.target,i=t.parentElement,r=t.getAttribute("class")||"",a=i.getAttribute("class")||"";r.includes("cancel")||a.includes("cancel")?this.touchElement=this.cancelPanel:this.touchElement=this.tableWrapper,this.syncScroll(e)},syncScroll(e){this.scrollTicking||(this.requestAnimationFrameId=requestAnimationFrame((()=>{let t,i;const r=this.tableWrapper.scrollHeight-this.tableWrapper.clientHeight;e.type.includes("touch")?(i=this.touchElement===this.tableWrapper?this.cancelPanel:this.tableWrapper,t=this.touchElement.scrollTop):(i="table-wrapper"===e.target.className?this.cancelPanel:this.tableWrapper,t=e.target.scrollTop),clearTimeout(this.timeout),i&&(i.removeEventListener("scroll",this.syncScroll),i.scrollTop=t,this.timeout=setTimeout((()=>{i.addEventListener("scroll",this.syncScroll)}),100)),t>r&&(this.cancelPanel.scrollTop=r),this.scrollTicking=!1}))),this.scrollTicking=!0},checkShowShadow(){const e=this.$refs.tableWrapper,{scrollLeft:t,scrollWidth:i,clientWidth:r}=e,a=t+r===i;this.isShowShadow=!a}}},gC={class:"orders-wrapper"},fC={ref:"tableWrapper",class:"table-wrapper"};const vC=$n(mC,[["render",function(e,t,i,r,u,p){const h=a("TwapOrderListHeader"),m=a("TwapOrderListRow"),f=a("NoDataAvailable"),v=a("DataTable"),y=a("CancelPanel"),b=H("loading");return B((o(),c("div",gC,[l("div",fC,[d(v,{isEmpty:p.emptyOrderData,"fix-header":""},{header:s((()=>[d(h,{headerTitles:u.headerTitles,sortKey:u.sortKey,onSort:p.setSortData},null,8,["headerTitles","sortKey","onSort"])])),body:s((()=>[(o(!0),c(g,null,R(p.ordersData,((e,i)=>(o(),n(m,{key:`${i}-${e.displayCurrency}-${e.orderID}`,index:i,direction:p.getMode(e.orderMode),orderItem:e,onMouseover:t=>p.setCurrentHoverRow(e.orderID),onMouseleave:t[0]||(t[0]=e=>p.setCurrentHoverRow(""))},null,8,["index","direction","orderItem","onMouseover"])))),128))])),empty:s((()=>[d(f,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["isEmpty"])],512),d(y,{ref:"cancelPanel",class:C(["cancel-panel",{shadow:u.isShowShadow}]),hasOpenOrder:!p.emptyOrderData,openOrderList:p.ordersData,cancelOrderMap:u.cancelOrderMap,toggleCloseOrder:p.toggleCloseOrder,confirmCloseOrder:p.c
1onfirmCloseOrder,deleteAll:()=>{},currentHoverRow:u.currentHoverRow,enableCancelAll:!1},null,8,["class","hasOpenOrder","openOrderList","cancelOrderMap","toggleCloseOrder","confirmCloseOrder","currentHoverRow"])])),[[b,u.isLoading,"streamingLight"]])}],["__scopeId","data-v-219fc79e"]]),yC={name:"ConfirmCloseDialog",components:{WarningConfirmDialog:mi},props:{visible:{type:Boolean,required:!0},title:{type:String,default:""},description:{type:String,default:""},closeBtnText:{type:String,default:""}},emits:["confirmClose","update:visible"],computed:{isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}}},bC={class:"title"},SC={class:"description"},CC={class:"buttons-wrap"};const PC=$n(yC,[["render",function(e,t,i,r,u,c){const h=a("BaseButton"),g=a("WarningConfirmDialog");return o(),n(g,{visible:c.isShow,"onUpdate:visible":t[2]||(t[2]=e=>c.isShow=e),class:"confirm-close-dialog",width:"560px"},{buttons:s((()=>[l("div",CC,[d(h,{class:"primary",onClick:t[0]||(t[0]=e=>c.isShow=!1)},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1}),d(h,{class:"close-bot-btn",onClick:t[1]||(t[1]=t=>e.$emit("confirmClose"))},{default:s((()=>[p(m(i.closeBtnText||e.$t("t.close")),1)])),_:1})])])),default:s((()=>[l("div",bC,m(i.title),1),l("div",SC,m(i.description),1)])),_:1},8,["visible"])}],["__scopeId","data-v-a52a8b2c"]]);const kC=$n({name:"FuturesGridConfirmCloseBotDialog",components:{ConfirmCloseDialog:PC},props:{visible:{type:Boolean,required:!0},symbol:{type:String,required:!0},cancelAllOrders:{type:Boolean,required:!0},closeAllPositions:{type:Boolean,required:!0}},emits:["update:visible","confirmCloseBot"],computed:{isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},title(){return this.closeAllPositions&&this.cancelAllOrders?this.$t("trading.bot.grid.confirmClose.bothClose.title",{symbol:this.symbol}):this.closeAllPositions?this.$t("trading.bot.grid.confirmClose.closeAllPositions.title",{symbol:this.symbol}):this.cancelAllOrders?this.$t("trading.bot.grid.confirmClose.cancelAllOrders.title",{symbol:this.symbol}):this.$t("trading.bot.grid.confirmClose.bothLeave.title",{symbol:this.symbol})},description(){return this.closeAllPositions&&this.cancelAllOrders?this.$t("trading.bot.grid.confirmClose.bothClose.description",{symbol:this.symbol}):this.closeAllPositions?this.$t("trading.bot.grid.confirmClose.closeAllPositions.description"):this.cancelAllOrders?this.$t("trading.bot.grid.confirmClose.cancelAllOrders.description"):this.$t("trading.bot.grid.confirmClose.bothLeave.description")}},methods:{handleConfirmCloseBot(){this.$emit("confirmCloseBot"),this.isShow=!1}}},[["render",function(e,t,i,r,s,l){const u=a("ConfirmCloseDialog");return o(),n(u,{visible:l.isShow,"onUpdate:visible":t[0]||(t[0]=e=>l.isShow=e),title:l.title,description:l.description,closeBtnText:e.$t("trading.bot.closeBot"),onConfirmClose:l.handleConfirmCloseBot}
1,null,8,["visible","title","description","closeBtnText","onConfirmClose"])}]]),TC={class:"symbol-row"},MC={class:"symbol"},LC={class:"description"},wC={class:"option-title"},DC={class:"option-description"},OC={class:"option-title"},IC={class:"option-description bullet-list"},xC={key:1,class:"description"},_C={class:"buttons-wrap"},AC=$n(A({__name:"StopGridBotDialog",props:{visible:{type:Boolean},symbol:{},baseCurrency:{},hasPosition:{type:Boolean,default:!1},positionSize:{default:0},defaultIsKeepPosition:{type:Boolean,default:!1}},emits:["update:visible","confirm"],setup(e,{emit:t}){const i="close_all",r="keep_position",a=e,u=t,h=T(a.visible),f=T(v(a.defaultIsKeepPosition));function v(e){return e?r:i}function y(){h.value=!1}function b(){const e=a.hasPosition&&f.value===r;u("confirm",{isKeepPosition:e}),h.value=!1}return D((()=>a.visible),(e=>{h.value=e,e&&(f.value=v(a.defaultIsKeepPosition))})),D(h,(e=>{u("update:visible",e)})),(e,t)=>(o(),n(pi,{visible:h.value,"onUpdate:visible":t[1]||(t[1]=e=>h.value=e),class:"stop-grid-bot-dialog",width:"560px",isBrandNewStyle:"",onClosed:y},{header:s((()=>[p(m(e.$t("trading.bot.grid.stopDialog.title")),1)])),body:s((()=>[l("div",TC,[d(Rt,{name:e.baseCurrency,showName:!1,size:"24"},null,8,["name"]),l("span",MC,m(e.symbol),1)]),e.hasPosition?(o(),c(g,{key:0},[l("p",LC,m(e.$t("trading.bot.grid.stopDialog.hasPosition.description",{symbol:e.symbol})),1),d(hr,{modelValue:f.value,"onUpdate:modelValue":t[0]||(t[0]=e=>f.value=e),class:"options"},{default:s((()=>[d(mr,{class:"option",type:x(gr).HOLLOW,label:i},{default:s((()=>[l("div",wC,m(e.$t("trading.bot.grid.stopDialog.closeAll.title")),1),l("div",DC,m(e.$t("trading.bot.grid.stopDialog.closeAll.description",{positionSize:e.positionSize,baseCurrency:e.baseCurrency})),1)])),_:1},8,["type","label"]),d(mr,{class:"option",type:x(gr).HOLLOW,label:r},{default:s((()=>[l("div",OC,m(e.$t("trading.bot.grid.stopDialog.keepPosition.title")),1),l("ul",IC,[l("li",null,m(e.$t("trading.bot.grid.stopDialog.keepPosition.description1",{positionSize:e.positionSize,baseCurrency:e.baseCurrency})),1),l("li",null,m(e.$t("trading.bot.grid.stopDialog.keepPosition.description2")),1)])])),_:1},8,["type","label"])])),_:1},8,["modelValue"])],64)):(o(),c("p",xC,m(e.$t("trading.bot.grid.stopDialog.noPosition.description",{symbol:e.symbol})),1))])),footer:s((()=>[l("div",_C,[d(di,{class:"primary confirm-btn",onClick:b},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1}),l("button",{class:"cancel-btn",type:"button",onClick:y},m(e.$t("t.cancel")),1)])])),_:1},8,["visible"]))}}),[["__scopeId","data-v-85a9c64f"]]),RC={class:"dialog-title"},FC={class:"dialog-content"},EC={class:"position-card"},BC={class:"row symbol-row"},zC={class:"symbol"},$C={class:"row"},NC={class:"label"},UC={class:"value"},HC={class:"row"},VC={class:"label"},WC={class:"value"},qC={class:"row"},GC={class:"label"},KC={class:"value"},QC=$n(A({__name:"CloseGridBotPositionDialog",props:{visible:{type:Boolean},symbol:{},baseCurrency:{},direction:{},orderType:{},price:{},size:{}},emits:["update:visible","confirm"],setup(e,{emit:t}){const i=e,r=t,{t:a}=G(),u=T(i.visible);D((()=>i.visible),(e=>{u.value=e})),D(u,(e=>{r("update:visible",e)}));const c=M((()=>Qn(i.direction))),h=M((()=>i.orderType===fr.LIMIT?a("futuresMain.trade.limit"):a("futuresMain.trade.market"))),g=M((()=>i.orderType===fr.LIMIT?String(i.price??"-"):a("futuresMain.trade.market"))),f=()=>{u.value=!1},v=()=>{r("confirm"),u.value=!1};return(e,t)=>(o(),n(mi,{visible:u.value,"onUpdate:visible":t[0]||(t[0]=e=>u.value=e),width:"560px",class:"close-grid-bot-position-dialog"},{buttons:s((()=>[d(di,{type:"confirm",class:"primary block",size:x(yr).L,onClick:v},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["size"]),d(di,{type:"confirm",class:"block button-cancel",size:x(yr).L,onClick:f},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1},8,["size"])])),default:s((()=>[l("div",null,[l("h2",RC,m(e.$t("trading.bot.grid.closePosition.title")),1),l("div",FC,m(e.$t("trading.bot.grid.closePosition.hint")),1),l("div",EC,[l("div",BC,[d(Rt,{size:"20",type:x(vr).COIN,name:e.baseCurrency},{default:s((()=>[l("span",zC,m(e.$filters.digitalCurrency(e.symbol)),1)])),_:1},8,["type","name"]),d($f,{class:"direction",direction:e.direction,displayText:c.value},null,8,["direction","displayText"])]),l("div",$C,[l("span",NC,m(e.$t("t.price")),1),l("span",UC,m(g.value),1)]),l("div",HC,[l("span",VC,m(e.$t("t.positionSize")),1),l("span",WC,m(e.size)+" "+m(e.baseCurrency),1)]),l("div",qC,[l("span",GC,m(e.$t("trading.orders.type")),1),l("span",KC,m(h.value),1)])])])])),_:1},8,["visible"]))}}),[["__scopeId","data-v-a50f9651"]]);function jC(){const e=ci(),{t:t}=G(),i=M((()=>e.makerFee)),r=M((()=>e.takerFee)),a=M((()=>[{id:br.MAKER,lang:`${t("t.makerFee")}: ${S(i.value).times(100).toNumber()}%`,isI18nKey:!1,value:i.value},{id:br.TAKER,lang:`${t("t.takerFee")}: ${S(r.value).times(100).toNumber()}%`,isI18nKey:!1,value:r.value}]));return{makerFee:i,takerFee:r,feeOptions:a}}const{PRICE_RANGE_LIMITS:YC}=Sr;
1function ZC(e){const{lowerPrice:t,upperPrice:i,lowerRange:r,upperRange:a,midPrice:n,priceFilter:o}=e,{t:s}=G();return{errorUpperPrice:M((()=>{if(i.value){if(n.value&&S(i.value).gt(n.value*YC.UPPER_MULTIPLIER))return s("trading.bot.grid.errorUpperPrice1",{value:(n.value*YC.UPPER_MULTIPLIER).toFixed(o.value)});if(t.value&&S(i.value).lte(t.value))return s("trading.bot.grid.errorUpperPrice2")}return null})),errorLowerPrice:M((()=>{if(t.value){if(n.value&&S(t.value).lt(n.value*YC.LOWER_MULTIPLIER))return s("trading.bot.grid.errorLowerPrice1",{value:(n.value*YC.LOWER_MULTIPLIER).toFixed(o.value)});if(i.value&&S(t.value).gte(i.value))return s("trading.bot.grid.errorLowerPrice2")}return null})),errorUpperRange:M((()=>a.value&&S(a.value).gt(YC.MAX_RANGE_PERCENTAGE)?s("trading.bot.grid.errorUpperRange1",{value:`${YC.MAX_RANGE_PERCENTAGE}%`}):null)),errorLowerRange:M((()=>r.value&&S(r.value).gt(YC.MAX_RANGE_PERCENTAGE)?s("trading.bot.grid.errorLowerRange1",{value:`${YC.MAX_RANGE_PERCENTAGE}%`}):null))}}const XC=`${Nt[0]}/ws/oss/futures`;function JC(e){const t=k(),i=Nn(),r=M((()=>t.state.futures.currentMarketSymbol)),a=M((()=>e.value===r.value)),n=T(Yn()),o=M((()=>t.state.futures.marketDetailMap[e.value])),s=M((()=>{var e;return(null==(e=o.value)?void 0:e.minPriceIncrement)||0})),l=M((()=>{var e;return null==(e=o.value)?void 0:e.priceFilter})),u=M((()=>{var e,t;const i=null==(t=null==(e=n.value.asks)?void 0:e[n.value.asks.length-1])?void 0:t.price;return void 0!==i?S(i).dp(l.value??2,S.ROUND_DOWN).toNumber():void 0})),c=M((()=>{var e,t;const i=null==(t=null==(e=n.value.bids)?void 0:e[0])?void 0:t.price;return void 0!==i?S(i).dp(l.value??2,S.ROUND_DOWN).toNumber():void 0})),d=M((()=>{const e=void 0===u.value,t=void 0===c.value;if(e&&t)return null;const i=s.value;return e?S(c.value).plus(i).toNumber():t?S(u.value).minus(i).toNumber():S(u.value).plus(c.value).div(2).toNumber()})),p=M((()=>a.value||!e.value?"":`snapshot:${e.value}_0`)),h=M((()=>{const e=new Set;return p.value&&e.add(p.value),e})),{updateSubscriptions:m}=jn(XC,{onMessage({topic:e,data:t}){if(e===p.value){const{asks:e,bids:i}=Yn();t.asks=Zn(e,t.asks,!0),t.bids=Zn(i,t.bids,!1),n.value=t}}});D(h,(e=>m(e)),{immediate:!0});const g=M((()=>a.value?i.bestAskPrice:u.value)),f=M((()=>a.value?i.bestBidPrice:c.value)),v=M((()=>(a.value?i.midPrice:d.value)||0)),y=M((()=>a.value?i.orderBook.asks:n.value.asks)),b=M((()=>a.value?i.orderBook.bids:n.value.bids));return{bestAskPrice:g,bestBidPrice:f,midPrice:v,asks:y,bids:b,getEstFilledPrice:function(e,t){if(!e||e<=0)return{estFilledPrice:null,totalSize:0,canFill:!1};const i=t?b.value:y.value;if(!i||0===i.length)return{estFilledPrice:null,totalSize:0,canFill:!1};let r=S(0),a=null;const n=t?0:i.length-1,o=t?1:-1,s=e=>t?e<i.length:e>=0;for(let u=n;s(u);u+=o){const{price:t,size:n}=i[u];if(r=r.plus(n),a=t,r.gte(e))break}const l=r.gte(e);return{estFilledPrice:l?a:null,totalSize:r.toNumber(),canFill:l}}}}const eP={class:"title"},tP={class:"body-content"},iP={class:"bot-info"},rP={class:"bot-name"},aP={class:"bot-detail"},nP={class:"bot-detail-item"},oP={class:"info-item"},sP={class:"info-item-label"},lP={class:"info-item-value"},uP={class:"info-item"},cP={class:"info-item-label"},dP={class:"info-item-value"},pP={class:"info-item"},hP={class:"info-item-label"},mP={class:"info-item-value"},gP={class:"info-item"},fP={class:"info-item-label"},vP={class:"info-item-value"},yP={class:"bot-detail-item"},bP={class:"info-item"},SP={class:"info-item-label"},CP={class:"info-item-value"},PP={class:"info-item"},kP={class:"info-item-label"},TP={class:"info-item-value"},MP={class:"info-item"},LP={class:"info-item-label"},wP={class:"info-item-value"},DP={class:"info-item"},OP={class:"info-item-label"},IP={class:"info-item-value"},xP={class:"arrow-icon-wrap"},_P={class:"flex-box justify-between items-center"},AP={class:"setting-title"},RP={class:"transfer-amount"},FP={class:"button-content"},EP=$n({__name:"ConfirmModificationsDialog",props:{botData:{type:Object,default:()=>({})},lowerPrice:{type:Number,default:0},upperPrice:{type:Number,default:0},gridNumber:{type:Number,default:0},lowerProfitPercentage:{type:Number,default:0},higherProfitPercentage:{type:Number,default:0},newPerSize:{type:Number,default:0},investmentInsufficient:{type:Number,default:0}},emits:["update:visible","updated","wallet-insufficient"],setup(e,{emit:t}){const i=e,r=t,{t:u}=G(),c=k(),h=T(!1),g=M((()=>i.botData.symbol)),f=M((()=>c.state.futures.fixedCurrency)),v=M((()=>c.state.futures.marketDetailMap[g.value])),y=M((()=>{var e;return(null==(e=v.value)?void 0:e.priceFilter)??2})),b=M((()=>{var e;return(null==(e=i.botData.detail.position)?void 0:e.unrealizedProfitLoss)||0})),P=M((()=>{var e,t;const r=null==(e=i.botData.detail.walletName)?void 0:e.replace("-USDT","-USD");return(null==(t=c.state.futures.walletMap[r])?void 0:t.walletTotalValue)||0})),L=M((()=>
1Xn({upperPrice:i.botData.detail.upperPrice,lowerPrice:i.botData.detail.lowerPrice,gridNumber:i.botData.detail.gridNumber,priceFilter:y.value}))),{feeOptions:w}=jC(),D=T(w.value.find((e=>e.id===i.botData.detail.feeType))),O=M((()=>Jn({stepPrice:L.value,upperPrice:i.botData.detail.upperPrice,fee:D.value.value}))),I=M((()=>eo({stepPrice:L.value,lowerPrice:i.botData.detail.lowerPrice,fee:D.value.value}))),_=M((()=>{var e;const t=(null==(e=v.value)?void 0:e.contractSize)??0;return S(i.botData.detail.contractPerStep).times(t).toNumber()}));function A(){r("update:visible",!1)}async function R(){h.value=!0;try{await Cr.updateTradingBot(i.botData.tradingBotId,{config:{lowerPrice:String(i.lowerPrice),upperPrice:String(i.upperPrice),gridNumber:Number(i.gridNumber)}}),c.dispatch("futures/fetchGridBotList"),r("updated")}catch(e){e===Pr.WALLET_INSUFFICIENT&&r("wallet-insufficient")}finally{h.value=!1}}return(t,i)=>{const r=a("i18n-t"),c=a("BaseButton");return o(),n(x(Mi),{class:"confirm-modifications-dialog",width:"530px",isBrandNewStyle:"",showHeaderBottomDivider:!1,onClosed:A},{header:s((()=>[l("div",eP,m(t.$t("trading.bot.confirmModifications")),1)])),body:s((()=>[l("div",tP,[d(r,{keypath:"trading.bot.confirmModifications.prompt",tag:"p",class:"description"},{amount:s((()=>[l("span",null,m(x(Qt)(P.value))+" "+m(f.value),1)])),pnl:s((()=>[l("span",{class:C({"brand-color-positive":b.value>=0,"brand-color-negative":b.value<0})}," ("+m(x(Qt)(b.value,{signed:!0}))+" "+m(f.value)+") ",3)])),_:1}),l("div",iP,[d(x(Rt),{name:e.botData.baseCurrency,showName:!1,size:"24"},null,8,["name"]),l("p",rP,m(g.value),1),d(x($f),{class:"bot-tag",direction:e.botData.direction,displayText:x(Qn)(e.botData.direction)},null,8,["direction","displayText"]),d(x($f),{class:"bot-tag",direction:e.botData.direction,displayText:x(Qt)(e.botData.detail.initialLeverage,{formatKey:2,postfix:"x"})},null,8,["direction","displayText"])]),l("div",aP,[l("div",nP,[l("div",oP,[l("div",sP,m(x(u)("t.range"))+" ("+m(f.value)+") ",1),l("div",lP,m(x(Qt)(e.botData.detail.lowerPrice,{formatKey:y.value}))+" ~ "+m(x(Qt)(e.botData.detail.upperPrice,{formatKey:y.value})),1)]),l("div",uP,[l("div",cP,m(x(u)("trading.bot.numberOfGrids")),1),l("div",dP,m(e.botData.detail.gridNumber),1)]),l("div",pP,[l("div",hP,m(x(u)("trading.bot.profitPerGrid")),1),l("div",mP,m(O.value)+"% - "+m(I.value)+"% ",1)]),l("div",gP,[l("div",fP,m(x(u)("trading.bot.grid.qtyPerOrder")),1),l("div",vP,m(_.value)+" "+m(e.botData.baseCurrency),1)])]),l("div",yP,[l("div",bP,[l("div",SP,m(x(u)("t.range"))+" ("+m(f.value)+") ",1),l("div",CP,m(x(Qt)(e.lowerPrice,{formatKey:y.value}))+" ~ "+m(x(Qt)(e.upperPrice,{formatKey:y.value})),1)]),l("div",PP,[l("div",kP,m(x(u)("trading.bot.numberOfGrids")),1),l("div",TP,m(e.gridNumber),1)]),l("div",MP,[l("div",LP,m(x(u)("trading.bot.profitPerGrid")),1),l("div",wP,m(e.lowerProfitPercentage)+"% - "+m(e.higherProfitPercentage)+"% ",1)]),l("div",DP,[l("div",OP,m(x(u)("trading.bot.estQtyPerOrder")),1),l("div",IP,m(e.newPerSize)+" "+m(e.botData.baseCurrency),1)])]),l("div",xP,[d(x(Oi),{width:"16",height:"16",class:"arrow-icon"})])]),l("div",_P,[l("div",AP,m(t.$t("trading.bot.investmentAdjustment")),1),l("div",null,m(x(Qt)(e.investmentInsufficient,{signed:!0}))+" "+m(f.value),1)]),d(r,{keypath:"trading.bot.transferHint",tag:"p",class:"transfer-hint"},{amount:s((()=>[l("span",RP,m(x(Qt)(e.investmentInsufficient,{minDigits:2}))+" "+m(f.value),1)])),_:1}),l("div",FP,[d(c,{class:"primary",size:"large",disabled:h.value,onClick:R},{default:s((()=>[p(m(t.$t("t.confirm")),1)])),_:1},8,["disabled"]),d(c,{class:"button-cancel",size:"medium",onClick:A},{default:s((()=>[p(m(t.$t("t.cancel")),1)])),_:1})])])])),_:1})}}},[["__scopeId","data-v-a7a2b639"]]),BP={name:"Radio",props:{label:{type:String,required:!0},checked:{type:Boolean,default:!1}},emits:["click"]},zP={class:"outer"},$P={class:"inner"},NP={class:"label"};const UP=$n(BP,[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["radio-wrapper",{active:i.checked}]),onClick:t[0]||(t[0]=t=>e.$emit("click"))},[l("div",zP,[B(l("div",$P,null,512),[[N,i.checked]])]),l("div",NP,m(i.label),1)],2)}],["__scopeId","data-v-157114a9"]]),HP={class:"range-settings"},VP={class:"setting-on-wrapper"},WP={class:"setting-on"},qP={class:"mid-price"},GP={class:"label"},KP={class:"value"},QP={class:"price-wrapper"},jP={key:2,class:"price-separator"},YP={class:"setting-description"},ZP=$n(A({__name:"FuturesRangeSettings",props:ae({errorUpperPrice
1:{},errorLowerPrice:{},errorUpperRange:{},errorLowerRange:{},priceFilter:{},quoteCurrency:{},computedLowerPrice:{},computedUpperPrice:{},midPriceText:{}},{lowerPrice:{},lowerPriceModifiers:{},lowerRange:{},lowerRangeModifiers:{},upperPrice:{},upperPriceModifiers:{},upperRange:{},upperRangeModifiers:{},settingOn:{},settingOnModifiers:{}}),emits:["update:lowerPrice","update:lowerRange","update:upperPrice","update:upperRange","update:settingOn"],setup(e){const t=e,{t:i}=G(),r=ne(e,"lowerPrice"),a=ne(e,"lowerRange"),u=ne(e,"upperPrice"),f=ne(e,"upperRange"),v=ne(e,"settingOn"),y=M((()=>[{label:i("futuresMain.trade.price"),value:1},{label:i("futuresMain.trade.percentage"),value:2}])),b=M((()=>t.errorLowerPrice||t.errorUpperPrice||"")),S=M((()=>t.errorLowerRange||t.errorUpperRange||"")),C=M((()=>!!t.errorUpperPrice&&!t.errorLowerPrice)),P=M((()=>!!t.errorUpperRange&&!t.errorLowerRange));return(e,t)=>(o(),c("div",HP,[l("div",VP,[l("div",WP,[(o(!0),c(g,null,R(y.value,(e=>(o(),n(UP,{key:e.value,label:e.label,checked:v.value===e.value,onClick:t=>v.value=e.value},null,8,["label","checked","onClick"])))),128))]),l("div",qP,[l("span",GP,m(e.$t("trading.bot.midPrice"))+":",1),l("span",KP,m(e.midPriceText),1)])]),l("div",QP,[1===v.value?(o(),n(Wn,{key:0,value:r.value,"onUpdate:value":t[0]||(t[0]=e=>r.value=e),label:e.$t("trading.bot.lowerPrice"),enableThousandSeparator:"",step:.01,min:0,errorShown:!!e.errorLowerPrice,errorMsg:b.value,maxDecimalPlaces:e.priceFilter},te({_:2},[e.isMobile?void 0:{name:"prepend",fn:s((()=>[d(ei,{content:e.$t("t.lower")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.bot.lowerPriceInfo")),1)])),_:1},8,["content"])])),key:"0"}]),1032,["value","label","errorShown","errorMsg","maxDecimalPlaces"])):(o(),n(Wn,{key:1,value:a.value,"onUpdate:value":t[1]||(t[1]=e=>a.value=e),label:e.$t("trading.bot.lowerRange"),type:"number",min:0,max:70,step:1,errorShown:!!e.errorLowerRange,errorMsg:S.value,maxDecimalPlaces:0},te({_:2},[e.isMobile?void 0:{name:"prepend",fn:s((()=>[d(ei,{content:e.$t("t.lower")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.bot.lowerRangeInfo")),1)])),_:1},8,["content"])])),key:"0"},e.isMobile?void 0:{name:"append",fn:s((()=>[t[4]||(t[4]=p("%"))])),key:"1"}]),1032,["value","label","errorShown","errorMsg"])),e.isMobile?h("",!0):(o(),c("span",jP,"-")),1===v.value?(o(),n(Wn,{key:3,value:u.value,"onUpdate:value":t[2]||(t[2]=e=>u.value=e),label:e.$t("trading.bot.upperPrice"),enableThousandSeparator:"",step:.01,min:0,errorShown:C.value,maxDecimalPlaces:e.priceFilter},te({_:2},[e.isMobile?void 0:{name:"prepend",fn:s((()=>[d(ei,{content:e.$t("t.upper")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.bot.upperPriceInfo")),1)])),_:1},8,["content"])])),key:"0"}]),1032,["value","label","errorShown","maxDecimalPlaces"])):(o(),n(Wn,{key:4,value:f.value,"onUpdate:value":t[3]||(t[3]=e=>f.value=e),label:e.$t("trading.bot.upperRange"),type:"number",min:0,max:70,step:1,errorShown:P.value,maxDecimalPlaces:0},te({_:2},[e.isMobile?void 0:{name:"prepend",fn:s((()=>[d(ei,{content:e.$t("t.upper")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.bot.upperRangeInfo")),1)])),_:1},8,["content"])])),key:"0"},e.isMobile?void 0:{name:"append",fn:s((()=>[t[5]||(t[5]=p("%"))])),key:"1"}]),1032,["value","label","errorShown"]))]),l("div",YP,m(e.$t("trading.bot.yourGridRange"))+": "+m(null!==e.computedLowerPrice?e.$filters.formatNumber(e.computedLowerPrice,e.priceFilter):"")+" ~ "+m(null!==e.computedUpperPrice?e.$filters.formatNumber(e.computedUpperPrice,e.priceFilter):"")+" "+m(e.quoteCurrency),1)]))}}),[["__scopeId","data-v-cea2c75f"]]),XP=["fill"];const JP=$n({name:"IconColorAlertCircle",components:{Icon:Ee},props:{width:{type:[Number,String],default:24},height:{type:[Number,String],default:24},fill:{type:String,default:"#E6B230"}}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:i.width,height:i.height,viewBox:"0 0 16 16",fill:"none"},{default:s((()=>[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8ZM8.00823 2.60724C8.65378 2.60724 9.2 3.14376 9.2 3.69003C9.2 4.68287 9.13585 5.81223 9.07321 6.91494C9.03068 7.6636 8.98885 8.39998 8.96827 9.073C8.95505 9.50533 8.63458 10.0356 8.00823 10.0356C7.37827 10.0356 7.04531 9.50517 7.03168 9.073C7.01079 8.41084 6.96967 7.68528 6.92779 6.94641L6.92779 6.94639C6.86475 5.83407 6.8 4.69162 6.8 3.69003C6.8 3.14376 7.32961 2.60724 8.00823 2.60724ZM6.8 12.3181C6.8 12.9591 7.31769 13.5219 8.00785 13.5219C8.65097 13.5219 9.2 12.9591 9.2 12.3181C9.2 11.6615 8.65097 11.1144 8.00785 11.1144C7.31764 11.1144 6.8 11.6615 6.8 12.3181Z",fill:i.fill},null,8,XP)])),_:1},8,["width","height"])}]]),ek={class:"risk-limit-label"},tk={class:"order-summary-title"},ik={class:"mb-20"},rk={class:"dot-list"},ak=$n(A({__name:"RiskLimitLabel",props:{level:{},symbol:{}},setup(e){const t=e,i=k(),r=M((()=>{var e;return(null==(e=i.state.futures.riskLimitSettingMap)?void 0:e[t.symbol])||[]})),u=M((()=>r.value.find((e=>e.riskLevel===t.level))));return(e,i)=>{const r=a("ToolTip");return o(),n(r,{class:"risk-limit-label-wrapper"},{content:s((()=>[l("div",ek,[l("div",tk,m(e.$t("trading.riskLimitLevel"))+": ",1),l("div",{class:C(["level-wrapper",{warning:(null==t?void 0:t.level)&&t.level>1}])},m((null==t?void 0:t.level)??"-"),3)])])),tooltip:s((()=>{var i,r;return[l("p",ik,m(e.$t("copyTrading.tooltip.riskLimitLevel")),1),l("p",null,m(e.$t("trading.currentRiskLimitLevel"))+": "+m(t.level),1),l("ul",rk,[l("li",null,m(e.$t("t.maintenanceMargin"))+": "+m(x(kr)((null==(i=u.value)?void 0:i.maintenanceMarginRate)||0)),1),l("li",null,m(e.$t("t.initialMargin"))+": "+m(x(kr)((null==(r=u.value)?void 0:r.initialMarginRate)||0)),1)])]})),_:1})}}}),[["__scopeId","data-v-450ade00"]]),nk={class:"order-summary"},ok={class:"order-summary-list"},sk={class:"order-summary-title"},lk={class:"order-summary-list"},uk={class:"order-summary-title"},ck={key:0,class:"order-summary-list"},dk={class:"order-summary-title"},pk={key:1,class:"order-summary-list"},hk={class:"order-summary-title"},mk={key:2,class:"order-summary-list"},gk={class:"order-summary-title"},fk={key:0,class:"risk-warning"},vk={class:"warning-icon","aria-hidden":"true"},yk={class:"warning-text"},bk=$n(A({__name:"FuturesOrderSummary",props:{stepPrice:{},qtyPerOrder:{},investmentAfterLeverage:{},coin:{},currentSettleInCurrency:{},gridSide:{},lowerPrice:{}
1,upperPrice:{},estLongLiqPrice:{},estShortLiqPrice:{},riskLimitLevel:{},customizePerOrderLabel:{}},setup(e){const t=e,i=e=>Number(e)<=t.upperPrice&&Number(e)>=t.lowerPrice,r=M((()=>t.gridSide===Tr.NEUTRAL.id||t.gridSide===Tr.LONG.id)),n=M((()=>t.gridSide===Tr.NEUTRAL.id||t.gridSide===Tr.SHORT.id)),u=M((()=>Number(t.estLongLiqPrice)<0?0:t.estLongLiqPrice)),f=M((()=>Number(t.estShortLiqPrice)<0?0:t.estShortLiqPrice)),v=M((()=>{if(!t.lowerPrice||!t.upperPrice)return!1;if(t.gridSide===Tr.NEUTRAL.id)return i(t.estLongLiqPrice)||i(t.estShortLiqPrice);const e=t.gridSide===Tr.LONG.id?t.estLongLiqPrice:t.estShortLiqPrice;return i(e)}));return(e,t)=>{const i=a("ToolTip");return o(),c(g,null,[l("ul",nk,[d(ak,{level:e.riskLimitLevel,symbol:`${e.coin}-PERP`},null,8,["level","symbol"]),l("li",ok,[l("p",sk,[d(i,{tooltip:e.$t("trading.bot.stepPrice.tooltip")},{content:s((()=>[p(m(e.$t("trading.bot.stepPrice"))+":",1)])),_:1},8,["tooltip"])]),l("p",null,m(e.stepPrice&&e.$filters.formatNumber(e.stepPrice,{preserveDecimals:!0}))+" "+m(e.currentSettleInCurrency),1)]),l("li",lk,[l("p",uk,[d(i,{tooltip:e.$t("trading.bot.qtyPerOrder.tooltip")},{content:s((()=>[p(m(e.customizePerOrderLabel||e.$t("trading.bot.grid.qtyPerOrder")),1)])),_:1},8,["tooltip"])]),l("p",null,m(e.$filters.formatNumber(e.qtyPerOrder,{preserveDecimals:!0}))+" "+m(e.coin),1)]),void 0!==e.investmentAfterLeverage?(o(),c("li",ck,[l("p",dk,[d(i,{tooltip:e.$t("trading.bot.investmentAfterLeverage.tooltip")},{content:s((()=>[p(m(e.$t("t.investmentAfterLeverage"))+":",1)])),_:1},8,["tooltip"])]),l("p",null,m(e.$filters.formatNumber(e.investmentAfterLeverage,{preserveDecimals:!0}))+" "+m(e.currentSettleInCurrency),1)])):h("",!0),r.value?(o(),c("li",pk,[l("p",hk,[d(i,{tooltip:e.$t("trading.bot.estLiqPrice.tooltip",{direction:e.$t("t.long").toLowerCase()})},{content:s((()=>[p(m(e.$t("t.estLiqPrice"))+"("+m(e.$t("t.long"))+"): ",1)])),_:1},8,["tooltip"])]),l("p",null,m(e.$filters.formatNumber(u.value,{preserveDecimals:!0}))+" "+m(e.currentSettleInCurrency),1)])):h("",!0),n.value?(o(),c("li",mk,[l("p",gk,[d(i,{tooltip:e.$t("trading.bot.estLiqPrice.tooltip",{direction:e.$t("t.short").toLowerCase()})},{content:s((()=>[p(m(e.$t("t.estLiqPrice"))+"("+m(e.$t("t.short"))+"): ",1)])),_:1},8,["tooltip"])]),l("p",null,m(e.$filters.formatNumber(f.value,{preserveDecimals:!0}))+" "+m(e.currentSettleInCurrency),1)])):h("",!0)]),v.value?(o(),c("aside",fk,[l("span",vk,[d(JP,{width:16,height:16})]),l("p",yk,m(e.$t("trading.bot.liquidationRiskWarning")),1)])):h("",!0)],64)}}}),[["__scopeId","data-v-eeaf5845"]]),Sk={class:"title"},Ck={class:"body-content"},Pk={class:"bot-info"},kk={class:"bot-name"},Tk={class:"setting-content no-border"},Mk={class:"setting-title"},Lk={class:"setting-content"},wk={class:"setting-title"},Dk={class:"setting-description"},Ok={class:"setting-content no-border"},Ik={class:"flex-box justify-between items-center mb-12"},xk={class:"setting-title"},_k={class:"transfer-amount"},Ak={class:"button-content"},Rk={class:"button-hint-text"},Fk=$n({__name:"ModifyGridParamsDialog",props:{visible:{type:Boolean,default:!1},botData:{type:Object,default:()=>({})}},emits:["dialog:closed"],setup(e,{emit:t}){const{MAX_GRID_NUMBER:i}=Sr,r=e,u=k(),{t:f}=G(),v=Mr(),y=Vn(),b=t,C=T(!1),P=T(Number(r.botData.detail.lowerPrice)),L=T(Number(r.botData.detail.upperPrice)),w=T(Number(r.botData.detail.gridNumber)),O=T(1),I=T(null),_=T(null),A=M((()=>u.state.futures.fixedCurrency)),R=M((()=>u.state.futures.marketMap)),F=M((()=>u.state.futures.marketDetailMap[K.value])),E=M((()=>{var e;return(null==(e=F.value)?void 0:e.priceFilter)??2})),B=M((()=>{var e;return(null==(e=F.value)?void 0:e.contractSize)||0})),z=M((()=>1===O.value?L.value:Q.value&&_.value?S(Q.value).times(S(100).plus(_.value).div(100)).dp(E.value,S.ROUND_DOWN).toNumber():null)),$=M((()=>1===O.value?P.value:Q.value&&I.value?S(Q.value).times(S(100).minus(I.value).div(100)).dp(E.value,S.ROUND_DOWN).toNumber():null)),{feeOptions:N}=jC(),U=T(N.value.find((e=>e.id===r.botData.detail.feeType))),H=M((()=>Xn({upperPrice:z.value,lowerPrice:$.value,gridNumber:w.value,priceFilter:E.value}))),V=M((()=>
1Jn({stepPrice:H.value,upperPrice:z.value,fee:U.value.value}))),W=M((()=>eo({stepPrice:H.value,lowerPrice:$.value,fee:U.value.value})));D(O,(e=>{1===e?(P.value=Number(r.botData.detail.lowerPrice),L.value=Number(r.botData.detail.upperPrice),I.value=null,_.value=null):(P.value=null,L.value=null,I.value=null,_.value=null)}));const q=e=>{""!==e&&Number(e)<2&&(w.value=2)},K=M((()=>r.botData.symbol)),{midPrice:Q,getEstFilledPrice:j}=JC(K),Y=M((()=>`${Qt(Q.value,{preserveDecimals:!0})} ${A.value}`)),{errorUpperPrice:Z,errorLowerPrice:X,errorUpperRange:J,errorLowerRange:ee}=ZC({lowerPrice:P,upperPrice:L,lowerRange:I,upperRange:_,midPrice:Q,priceFilter:E}),te=M((()=>{var e,t;return to({upperPrice:z.value,lowerPrice:$.value,minPriceIncrement:null==(e=F.value)?void 0:e.minPriceIncrement,fee:null==(t=U.value)?void 0:t.value})})),ie=M((()=>{if(w.value){if(te.value&&w.value>te.value)return f("trading.bot.grid.errorGridNo1",{value:te.value});if(w.value>i||w.value<2)return""}return null})),re=M((()=>r.botData.direction===Tr.NEUTRAL.value)),ae=M((()=>r.botData.direction===Tr.LONG.value)),ne=M((()=>null!==ie.value?null:re.value?io({stepPrice:H.value,midPrice:Q.value,gridNumber:w.value,lowerPrice:$.value,priceFilter:E.value}):ro({stepPrice:H.value,upperPrice:z.value,lowerPrice:$.value,isLong:ae.value,priceFilter:E.value,gridNumber:w.value}))),oe=M((()=>{var e,t;return null==(t=null==(e=v.tradingBotInitData.futures)?void 0:e.grid)?void 0:t.initialMarginAdjConf})),se=()=>oe.value?re.value?oe.value.neutral:ae.value?oe.value.long:oe.value.short:null,le=M((()=>{const e=ao({sumOfGridPrices:ne.value,leverage:Number(r.botData.detail.initialLeverage),marketDetail:F.value,adjConf:se()});return Math.max(e,Lr)})),ue=M((()=>u.state.futures.riskLimitSettingMap[K.value])),ce=M((()=>u.getters["futures/riskLimit"])),de=M((()=>{var e,t,i;const a=S((null==(i=null==(t=null==(e=v.tradingBotInitData.futures)?void 0:e.grid)?void 0:t.riskLimitLevel)?void 0:i.default)||0).plus(1).toNumber(),{riskLimitValue:n}=ue.value.find((e=>e.riskLevel===a))||{},o=n??ce.value;return no({sumOfGridPrices:ne.value,leverage:Number(r.botData.detail.initialLeverage),marketDetail:F.value,gridNumber:w.value,riskLimitSize:o,adjConf:se(),isLong:ae.value,upperPrice:z.value,markPrice:Q.value,stepPrice:H.value})})),pe=M((()=>{var e;return(null==(e=r.botData.detail.position)?void 0:e.orderMode)===ot.BUY})),me=M((()=>{const{detail:e}=r.botData;return e.position?j(e.position.totalContracts,pe.value).estFilledPrice??0:0})),ge=M((()=>{const{position:e}=r.botData.detail;if(!e||!me.value)return 0;const{entryPrice:t,totalContracts:i}=e;return(pe.value?S(me.value).minus(t):S(t).minus(me.value)).times(i).times(B.value).toNumber()})),fe=M((()=>{var e,t;const i=null==(e=r.botData.detail.walletName)?void 0:e.replace("-USDT","-USD");return(null==(t=u.state.futures.walletMap[i])?void 0:t.walletTotalValue)||0})),ve=M((()=>S(fe.value).plus(ge.value).toNumber())),ye=M((()=>S(le.value).times(wr).toNumber())),be=M((()=>ve.value<ye.value?le.value:S.minimum(ve.value,de.value).times(Dr).toNumber())),Se=M((()=>{const e=S.min(se(),Or),t=R.value[K.value].sizeFilter;return S(be.value).times(r.botData.detail.initialLeverage).times(e).div(ne.value).dp(t,S.ROUND_DOWN).toNumber()||"-"})),Ce=M((()=>S.maximum(S(ye.value).minus(ve.value),0).dp(2,S.ROUND_UP).toNumber())),Pe=M((()=>Number($.value)!==Number(r.botData.detail.lowerPrice)||Number(z.value)!==Number(r.botData.detail.upperPrice)||w.value!==r.botData.detail.gridNumber||U.value.id!==r.botData.detail.feeType)),ke=M((()=>!Pe.value||(!($.value&&z.value&&w.value)||(null!==ie.value||null!==Z.value||null!==X.value||null!==J.value||null!==ee.value)))),Te=M((()=>u.getters["futures/gridBotAvailableBalance"])),Me=M((()=>Ce.value>Te.value)),Le=M((()=>S(Ce.value).minus(Te.value).dp(2,S.ROUND_UP).toNumber()||0)),we=M((()=>{var e,t;return(null==(t=null==(e=r.botData)?void 0:e.detail)?void 0:t.riskLimitLevel)>=0?Number(r.botData.detail.riskLimitLevel)+1:null})),De=M((()=>{var e;return(null==(e=R.value[K.value])?void 0:e.fundingRate)||0})),Oe=M((()=>ue.value.find((e=>e.riskLevel===we.value)))),Ie=M((()=>{var e;return(null==(e=Object.values(Tr).find((e=>e.value===r.botData.direction)))?void 0:e.id)??Tr.NEUTRAL.id})),xe=M((()=>!!(z.value&&$.value&&w.value&&be.value))),_e=M((()=>null===ie.value&&null===Z.value&&null===X.value&&null===J.value&&null===ee.value)),{proxy:Ae}=he(),Re=M((()=>{var e,t,i,a,n,o,s;const l={estimatedLongLiquidationPrice:"",estimatedShortLiquidationPrice:""};return xe.value&&_e.value?xv({shareLib:Ae.$shareLib,wasmFunction:Fo,params:{newGridBot:{side:r.botData.direction,investment:be.value,upperPrice
1:z.value,lowerPrice:$.value,gridNumber:w.value,midPrice:null==(e=Q.value)?void 0:e.toString()},gridBotConfig:{leverage:r.botData.detail.initialLeverage,takerFee:null==(i=null==(t=F.value)?void 0:t.takerFees)?void 0:i.toString(),adjConf:null==(a=se())?void 0:a.toString(),fundingRate:null==(n=De.value)?void 0:n.toString(),maintenanceMarginRatio:null==(s=null==(o=Oe.value)?void 0:o.maintenanceMarginRate)?void 0:s.toString()}},defaultResult:l}):l})),Fe=M((()=>S(Re.value.estimatedLongLiquidationPrice).toFixed(E.value,S.ROUND_UP))),Ee=M((()=>S(Re.value.estimatedShortLiquidationPrice).toFixed(E.value,S.ROUND_DOWN)));function Be(e){b("dialog:closed",{modified:e})}function ze(){C.value=!1,Be(!0)}function $e(){b("dialog:closed",{insufficient:!0})}async function Ne(){C.value=!0}function Ue(){y.toggleTransferPopup({from:ii,to:ti})}return(t,r)=>{const u=a("i18n-t"),f=a("BaseButton");return o(),c(g,null,[d(x(Mi),{class:"modify-grid-params-dialog",width:"480px",isBrandNewStyle:"",showHeaderBottomDivider:!1,onClosed:Be},{header:s((()=>[l("div",Sk,m(t.$t("trading.bot.modifyGridParams")),1)])),body:s((()=>[l("div",Ck,[l("div",Pk,[d(x(Rt),{name:e.botData.baseCurrency,showName:!1,size:"24"},null,8,["name"]),l("p",kk,m(K.value),1),d(x($f),{class:"bot-tag",direction:e.botData.direction,displayText:x(Qn)(e.botData.direction)},null,8,["direction","displayText"]),d(x($f),{class:"bot-tag",direction:e.botData.direction,displayText:x(Qt)(e.botData.detail.initialLeverage,{formatKey:2,postfix:"x"})},null,8,["direction","displayText"])]),l("div",Tk,[l("div",Mk,m(t.$t("trading.bot.rangeSettings")),1),d(ZP,{lowerPrice:P.value,"onUpdate:lowerPrice":r[0]||(r[0]=e=>P.value=e),upperPrice:L.value,"onUpdate:upperPrice":r[1]||(r[1]=e=>L.value=e),lowerRange:I.value,"onUpdate:lowerRange":r[2]||(r[2]=e=>I.value=e),upperRange:_.value,"onUpdate:upperRange":r[3]||(r[3]=e=>_.value=e),settingOn:O.value,"onUpdate:settingOn":r[4]||(r[4]=e=>O.value=e),errorUpperPrice:x(Z),errorLowerPrice:x(X),errorUpperRange:x(J),errorLowerRange:x(ee),priceFilter:E.value,quoteCurrency:A.value,computedLowerPrice:$.value,computedUpperPrice:z.value,midPriceText:Y.value},null,8,["lowerPrice","upperPrice","lowerRange","upperRange","settingOn","errorUpperPrice","errorLowerPrice","errorUpperRange","errorLowerRange","priceFilter","quoteCurrency","computedLowerPrice","computedUpperPrice","midPriceText"])]),l("div",Lk,[l("div",wk,m(t.$t("trading.bot.gridsSetting")),1),d(x(Wn),{value:w.value,"onUpdate:value":r[5]||(r[5]=e=>w.value=e),label:t.$t("trading.bot.noOfGrids"),type:"number",min:1,max:x(i),step:1,maxDecimalPlaces:0,placeholder:`2 - ${x(i)}`,errorShown:null!==ie.value,errorMsg:ie.value,onBlur:q},{prepend:s((()=>[l("p",null,m(t.$t("trading.bot.noOfGrids")),1)])),append:s((()=>[p(m(t.$t("trading.bot.grids")),1)])),_:1},8,["value","label","max","placeholder","errorShown","errorMsg"]),l("div",Dk,[l("div",null,m(t.$t("trading.bot.grid.profitPerGrid"))+": "+m(`${V.value}%`)+" ~ "+m(`${W.value}%`),1)])])]),d(bk,{stepPrice:H.value,qtyPerOrder:Se.value,coin:e.botData.baseCurrency,currentSettleInCurrency:A.value,gridSide:Ie.value,lowerPrice:$.value,upperPrice:z.value,estLongLiqPrice:Fe.value,estShortLiqPrice:Ee.value,riskLimitLevel:we.value,customizePerOrderLabel:t.$t("trading.bot.estQtyPerOrder")},null,8,["stepPrice","qtyPerOrder","coin","currentSettleInCurrency","gridSide","lowerPrice","upperPrice","estLongLiqPrice","estShortLiqPrice","riskLimitLevel","customizePerOrderLabel"]),l("div",Ok,[l("div",Ik,[l("div",xk,m(t.$t("trading.bot.investmentAdjustment")),1),l("div",null,m(x(Qt)(Ce.value,{signed:!0}))+" "+m(A.value),1)]),d(u,{keypath:"trading.bot.transferHint",tag:"p",class:"transfer-hint"},{amount:s((()=>[l("span",_k,m(x(Qt)(Ce.value,{minDigits:2}))+" "+m(A.value),1)])),_:1})]),l("div",Ak,[!ke.value&&Me.value?(o(),n(f,{key:0,class:"list transfer-btn",size:"large",onClick:Ue},{default:s((()=>[l("div",null,[l("p",null,m(t.$t("t.insufficientBalance")),1),l("p",Rk," ("+m(t.$t("trading.copywise.minAmount",{amount:x(Qt)(Le.value),currency:A.value}))+") ",1)])])),_:1})):(o(),n(f,{key:1,class:"primary",size:"large",disabled:ke.value,onClick:Ne},{default:s((()=>[p(m(t.$t("t.confirm")),1)])),_:1},8,["disabled"])),d(f,{class:"button-cancel",size:"medium",onClick:Be},{default:s((()=>[p(m(t.$t("t.cancel")),1)])),_:1})])])),_:1}),C.value?(o(),n(x(EP),{key:0,visible:C.value,"onUpdate:visible":r[6]||(r[6]=e=>
1C.value=e),botData:e.botData,lowerPrice:$.value,upperPrice:z.value,gridNumber:w.value,investmentInsufficient:Ce.value,newPerSize:Se.value,lowerProfitPercentage:V.value,higherProfitPercentage:W.value,onUpdated:ze,onWalletInsufficient:$e},null,8,["visible","botData","lowerPrice","upperPrice","gridNumber","investmentInsufficient","newPerSize","lowerProfitPercentage","higherProfitPercentage"])):h("",!0)],64)}}},[["__scopeId","data-v-f10594e8"]]),Ek={class:"dialog-title"},Bk={class:"dialog-content"},zk=$n({__name:"InsufficientBalanceWarningDialog",props:{visible:{type:Boolean,default:!1}},emits:["dialog:closed"],setup(e,{emit:t}){const i=e,r=t,u=Vn(),c=M({get:()=>i.visible,set(){r("dialog:closed")}});function h(){u.toggleTransferPopup({from:ii,to:ti}),c.value=!1}return(e,t)=>{const i=a("BaseButton");return o(),n(x(mi),{visible:c.value,"onUpdate:visible":t[1]||(t[1]=e=>c.value=e),isNewStyle:"",class:"insufficient-balance-warning-dialog"},{buttons:s((()=>[d(i,{type:"confirm",class:"primary block",size:"large",onClick:h},{default:s((()=>[p(m(e.$t("t.transfer")),1)])),_:1}),d(i,{type:"confirm",class:"block button-cancel",size:"large",onClick:t[0]||(t[0]=e=>c.value=!1)},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})])),default:s((()=>[l("div",null,[l("h2",Ek,m(e.$t("t.insufficientBalance")),1),l("div",Bk,m(e.$t("trading.bot.insufficientBalance.hint")),1)])])),_:1},8,["visible"])}}},[["__scopeId","data-v-3f36b466"]]);function $k(e){const{$openDialog:t}=ar(),i=k(),r=T(0),a=M((()=>i.getters.isEnableTradingBotUpdateParameter)),n=M((()=>x(e)));return{openModifyGridParamsDialog:async function(){if(!a.value)return;const e=await t(Fk,{botData:n.value});if(e.insufficient)return async function(){await t(zk,{visible:!0})}();e.modified&&r.value++},isModifiedCount:r}}const Nk={key:0},Uk={key:1},Hk={key:2,class:"unit"},Vk=$n(A({__name:"PnL",props:{pnl:{default:0},roi:{default:0},unit:{default:""},multiline:{type:Boolean,default:!1}},setup(e){const t=M((()=>({formatKey:2,signed:!0,currency:e.unit})));return(e,i)=>(o(),c("span",{class:C(["profit",{"brand-color-positive":Number(e.pnl)>0,"brand-color-negative":Number(e.pnl)<0}])},[p(m(e.$filters.formatNumber(Number(e.pnl),t.value))+" ",1),e.unit&&e.multiline?(o(),c("span",Nk,m(e.unit),1)):h("",!0),e.multiline?(o(),c("br",Uk)):h("",!0),p(" ("+m(e.$filters.formatNumber(Number(e.roi),{formatKey:2,signed:!0,postfix:"%"}))+") ",1),e.unit&&!e.multiline?(o(),c("span",Hk,m(e.unit),1)):h("",!0)],2))}}),[["__scopeId","data-v-c626a82d"]]),Wk=$n(A({__name:"PriceRange",props:{lowerPrice:{},upperPrice:{},midPrice:{},symbol:{},isOutOfRange:{type:Boolean}},emits:["openModifyGridParamsDialog"],setup(e,{emit:t}){const i=k(),r=M((()=>i.state.futures.marketMap)),u=M((()=>i.getters.isUnifiedWallet)),c=M((()=>i.getters.isEnableTradingBotUpdateParameter)),d=M((()=>{var e,t;return(null==(t=null==(e=r.value)?void 0:e[h.symbol])?void 0:t.priceFilter)??2})),h=e,g=t;return(e,t)=>{const i=a("Tooltip");return o(),n(i,{tooltip:e.$t("trading.bot.grid.priceOutOfRange"),hasCursorQuestion:!0,disable:!e.isOutOfRange,tipBottomAction:c.value&&u.value?{text:`${e.$t("trading.bot.modifyPriceRange")} >`,action:()=>g("openModifyGridParamsDialog")}:null,onlyShowOneInPage:c.value,popover:c.value},{content:s((()=>[l("span",{class:C(["price-range",{"brand-color-negative":e.isOutOfRange}])},[p(m(e.$filters.formatNumber(Number(e.lowerPrice),{formatKey:d.value}))+" - ",1),t[0]||(t[0]=l("br",null,null,-1)),p(" "+m(e.$filters.formatNumber(Number(e.upperPrice),{formatKey:d.value})),1)],2)])),_:1},8,["tooltip","disable","tipBottomAction","onlyShowOneInPage","popover"])}}}),[["__scopeId","data-v-5a562b6c"]]);const qk=$n({name:"PriceAndPercentageInput",components:{FuturesMarkLastSelect:um,TradingInput:Wn},inheritAttrs:!1,props:{priceValue:{type:[Number,String],default:""},errorMsg:{type:String,default:""},basePrice:{type:[Number,String],default:null},preLabel:{type:String,default:""},preLabelMobile:{type:String,default:""},preTooltip:{type:String,default:""},postLabel:{type:String,default:"%"},priceStep:{type:Number,default:1},triggeredBy:{type:Object,default:()=>sm.MARK},isBottom:{type:Boolean,default:!1},priceFilter:{type:Number,default:2},hideSpin:{type:Boolean,default:!0}},emits:["update:priceValue","update:triggeredBy"],data:()=>({isInputByPercentage:!1,percentage:null}),computed:{maxPercent(){return this.isBottom?99:100}},watch:{triggeredBy(){this.handleRecalculation()},isBottom(){this.handleRecalculation()},priceValue(e){null!==e&&""!==e&&void 0!==e||(this.percentage=null)}},mounted(){this.handleRecalculation()},methods:{handleRecalculation(){this.$nextTick((()=>{this.autoPrice(),this.autoPercentage()}))},setPrice(e){this.$emit("update:priceValue",e)},handleInputPrice(e){this.setPrice(e),this.isInputByPercentage=!1,this.$nextTick((()=>{this.autoPercentage()}))},handleInputPercentage(e){this.isInputByPercentage=!0,this.percentage=e,this.autoPrice()},autoPrice(){if(!this.isInputByPercentage)return;if(!this.percentage||!this.basePrice)return void this.setPrice(null);const e=this.basePrice,t=S(this.percentage).times(e).div(100),i=this.isBottom?S(e).minus(t).dp(this.priceFilter).toNumber():S(e).plus(t).dp(this.priceFilter).toNumber();this.setPrice(i)},autoPercentage(){!this.isInputByPercentage&&this.priceValue&&this.basePrice&&(this.errorMsg?this.percentage=null:this.percentage=S(this.priceValue).div(this.basePrice).minus(1).times(100).abs().dp(2).toNumber())}}},[["render",function(e,t,i,r,n,u){const p=a("Tooltip"),h=a("FuturesMarkLastSelect"),g=a("TradingInput");return e.isMobile?(o(),c("div",{key:0,class:C(["wrapper m-wrapper",e.$attrs.class])},[d(g,{class:"tb-row-1",hideSpin:"",enableThousandSeparator:"",mobileStyle:"",value:i.priceValue,step:i.priceStep,min:i.priceStep,errorShown:!!i.errorMsg,errorContent:i.errorMsg,onInput:u.handleInputPrice},{prepend:s((()=>[d(p,{tooltip:i.preTooltip},{content:s((()=>[l("span",null,m(e.$t(i.preLabelMobile||i.preLabel)),1)])),_:1},8,["tooltip"])])),append:s((()=>[d(h,{value:i.triggeredBy,"onUpdate:value":t[0]||(t[0]=t=>e.$emit("update:triggeredBy",t))},null,8,["value"])])),_:1},8,["value","step","min","errorShown","errorContent","onInput"]),d(g,{class:"tb-row-2",hideSpin:"",enableThousandSeparator:"",mobileStyle:"",value:n.percentage,step:1,min:0,max:u.maxPercent,errorShown:!!i.errorMsg,onInput:u.handleInputPercentage},null,8,["value","max","errorShown","onInput"])],2)):(o(),c("div",{key:1,class:C(["wrapper",e.$attrs.class])},[d(g,{class:"tb-row-1",hideSpin:"",enableThousandSeparator:"",value:i.priceValue,step:i.priceStep,min:i.priceStep,errorShown:!!i.errorMsg,errorContent:i.errorMsg,onInput:u.handleInputPrice},{prepend:s((()=>[d(p,{tooltip:i.preTooltip},{content:s((()=>[l("span",null,m(e.$t(i.preLabel)),1)])),_:1},8,["tooltip"])])),append:s((()=>[d(h,{value:i.triggeredBy,"onUpdate:value":t[1]||(t[1]=t=>e.$emit("update:triggeredBy",t))},null,8,["value"])])),_:1},8,["value","step","min","errorShown","errorContent","onInput"]),d(g,{class:"tb-row-2",hideSpin:"",enableThousandSeparator:"",value:n.percentage,step:1,min:0,max:u.maxPercent,errorShown:!!i.errorMsg,onInput:u.handleInputPercentage},{append:s((()=>
1[l("span",null,m(i.postLabel),1)])),_:1},8,["value","max","errorShown","onInput"])],2))}],["__scopeId","data-v-4f98c890"]]),Gk={class:"title"},Kk={class:"content"},Qk={class:"price-info-list"},jk={class:"price-label"},Yk={class:"price-value"},Zk={class:"price-label"},Xk={class:"price-value"},Jk={class:"price-label"},eT={class:"price-value"},tT={class:"price-label"},iT={class:"price-value"},rT={class:"price-label"},aT={class:"price-value"},nT={class:"stop-price-wrapper"},oT={class:"input-wrap"},sT={key:0},lT={class:"input-wrap"},uT={key:0},cT={class:"desc"},dT={class:"highlight"},pT={key:0,class:"non-unified-options"},hT={key:1,class:"desc"},mT={class:"btn-wrapper"},gT=$n({__name:"EditAdvancedSettingDialog",props:{visible:{type:Boolean,required:!0},botDetail:{type:Object,default:()=>({})},isFromForm:{type:Boolean,default:!1}},emits:["update:visible","confirmUpdateSettings"],setup(e,{emit:t}){const i=e,r=t,u=k(),{t:f}=G(),v=Ir(),y=T(""),b=T(sm.MARK),C=T(""),P=T(sm.MARK),L=T(!1),w=T(!1),O=M({get:()=>i.visible,set:e=>r("update:visible",e)}),I=M((()=>v.isMobile)),_=M((()=>u.getters.isUnifiedWallet)),A=M((()=>u.state.futures.marketMap)),R=M((()=>u.state.futures.futuresMarkPriceMap)),F=M((()=>u.state.futures.futuresLastPriceMap)),E=M((()=>i.botDetail.detail||{})),B=M((()=>i.botDetail.symbol)),z=M((()=>R.value[B.value]||0)),$=M((()=>F.value[B.value]||0)),N=M((()=>{var e,t;return(null==(t=null==(e=A.value)?void 0:e[B.value])?void 0:t.priceFilter)??2})),U=M((()=>{const e=N.value;return e>0?S(10).pow(-e).toNumber():1})),H=M((()=>i.botDetail.direction===Tr.NEUTRAL.value)),V=M((()=>i.botDetail.direction===Tr.SHORT.value)),W=e=>e.id===sm.MARK.id?z.value:$.value,q=M((()=>i.isFromForm?W(b.value):E.value.initialLastPrice)),K=M((()=>i.isFromForm?W(P.value):E.value.initialLastPrice)),Q=M((()=>H.value?"trading.bot.stopTopPrice":"trading.bot.takeProfitPrice")),j=M((()=>H.value?"trading.bot.stopBottomPrice":"trading.bot.stopLossPrice")),Y=M((()=>H.value?f("trading.bot.stopTopInfo.neutral"):f("trading.bot.stopTopInfo"))),Z=M((()=>H.value?f("trading.bot.stopBottomInfo.neutral"):f("trading.bot.stopBottomInfo"))),X=M((()=>{if(!y.value)return;const e=f(b.value.fullName).toLowerCase(),t=H.value?f("trading.bot.stopTopPrice"):f("trading.bot.takeProfitPrice"),i=W(b.value);if(V.value){if(S(y.value).gte(i))return f("trading.bot.grid.errorStopBottom1.v2",{price:t,priceType:e})}else if(S(y.value).lte(i))return f("trading.bot.grid.errorStopTop1.v2",{price:t,priceType:e});return""})),J=M((()=>
1{if(!C.value)return;const e=f(P.value.fullName).toLowerCase(),t=H.value?f("trading.bot.stopBottomPrice"):f("trading.bot.stopLossPrice"),i=W(P.value);if(V.value){if(S(C.value).lte(i))return f("trading.bot.grid.errorStopTop1.v2",{price:t,priceType:e})}else if(S(C.value).gte(i))return f("trading.bot.grid.errorStopBottom1.v2",{price:t,priceType:e});return""})),ee=e=>{var t,i;const r=(null==(i=null==(t=A.value)?void 0:t[B.value])?void 0:i.priceFilter)??1;return Qt(e,{formatKey:r,defaultValue:"-"})},te=()=>{y.value=null},ie=()=>{C.value=null},re=()=>{O.value=!1;const e=V.value?C.value:y.value,t=V.value?y.value:C.value,i=V.value?P.value:b.value,a=V.value?b.value:P.value;r("confirmUpdateSettings",{top:{price:e,type:i.id===sm.MARK.id?ui.MARK_PRICE:ui.LAST_PRICE},bottom:{price:t,type:a.id===sm.MARK.id?ui.MARK_PRICE:ui.LAST_PRICE},closeAllPositions:L.value,cancelAllOrders:w.value})};return D(O,(e=>{e&&(()=>{const{exitCondition:e={top:{price:"",type:ui.MARK_PRICE},bottom:{price:"",type:ui.MARK_PRICE}},botStopAction:{closeAllPositions:t=!1,cancelAllOrders:i=!1}={}}=E.value,{top:r,bottom:a}=e;r&&(V.value?(C.value=r.price?S(r.price).toFixed(N.value):"",P.value=lm(r.type)):(y.value=r.price?S(r.price).toFixed(N.value):"",b.value=lm(r.type))),a&&(V.value?(y.value=a.price?S(a.price).toFixed(N.value):"",b.value=lm(a.type)):(C.value=a.price?S(a.price).toFixed(N.value):"",P.value=lm(a.type))),L.value=t,w.value=i})()})),D(L,(e=>{e&&(w.value=!0)})),(t,i)=>{const r=a("Checkbox"),u=a("Tooltip"),f=a("BaseButton");return o(),n(x(Mi),{visible:O.value,"onUpdate:visible":i[6]||(i[6]=e=>O.value=e),class:"edit-advanced-setting-dialog",width:"90%",showHeaderBottomDivider:!1,isBrandNewStyle:"",onClickConfirm:re},{header:s((()=>[l("div",Gk,m(t.$t("t.takeProfitStopLoss")),1)])),body:s((()=>[l("div",Kk,[l("ul",Qk,[l("li",null,[l("p",jk,m(t.$t("strategy.priceRange")),1),l("p",Yk,m(ee(E.value.lowerPrice))+" - "+m(ee(E.value.upperPrice)),1)]),e.isFromForm?h("",!0):(o(),c(g,{key:0},[l("li",null,[l("p",Zk,m(t.$t("trading.bot.startPriceCapital")),1),l("p",Xk,m(ee(E.value.initialLastPrice)),1)]),l("li",null,[l("p",Jk,m(t.$t("futuresMain.openPosition.entryPrice")),1),l("p",eT,m(ee(E.value.entryPrice)),1)])],64)),l("li",null,[l("p",tT,m(t.$t("futuresMain.openPosition.markPrice")),1),l("p",iT,m(ee(z.value)),1)]),l("li",null,[l("p",rT,m(t.$t("msg.lastPrice")),1),l("p",aT,m(ee($.value)),1)])]),l("div",nT,[l("div",oT,[d(x(qk),{priceValue:y.value,"onUpdate:priceValue":i[0]||(i[0]=e=>y.value=e),triggeredBy:b.value,"onUpdate:triggeredBy":i[1]||(i[1]=e=>b.value=e),class:"price-percent-input",basePrice:q.value,errorMsg:X.value,preLabel:Q.value,preLabelMobile:Q.value,preTooltip:Y.value,isBottom:V.value,priceFilter:N.value,priceStep:U.value},null,8,["priceValue","triggeredBy","basePrice","errorMsg","preLabel","preLabelMobile","preTooltip","isBottom","priceFilter","priceStep"]),l("div",{class:"clear-btn",onClick:te},[I.value?(o(),c("p",sT,m(t.$t("t.clear")),1)):(o(),n(x(At),{key:1,class:"icon-cross"}))])]),l("div",lT,[d(x(qk),{priceValue:C.value,"onUpdate:priceValue":i[2]||(i[2]=e=>C.value=e),triggeredBy:P.value,"onUpdate:triggeredBy":i[3]||(i[3]=e=>P.value=e),class:"price-percent-input",basePrice:K.value,errorMsg:J.value,preLabel:j.value,preLabelMobile:j.value,preTooltip:Z.value,isBottom:!V.value,priceFilter:N.value,priceStep:U.value},null,8,["priceValue","triggeredBy","basePrice","errorMsg","preLabel","preLabelMobile","preTooltip","isBottom","priceFilter","priceStep"]),l("div",{class:"clear-btn",onClick:ie},[I.value?(o(),c("p",uT,m(t.$t("t.clear")),1)):(o(),n(x(At),{key:1,class:"icon-cross"}))])]),i[7]||(i[7]=l("div",{class:"divider"},null,-1))]),l("div",cT,[p(m(H.value?t.$t("trading.bot.neutralPrice.description"):t.$t("trading.bot.longShortPrice.description"))+" ",1),l("strong",dT,m(e.isFromForm?t.$t("trading.bot.markLastPriceSelected"):t.$t("trading.bot.startPriceCapital")),1)]),_.value?h("",!0):(o(),c("div",pT,[d(u,{class:"checkbox-wrap",tooltip:t.$t("trading.bot.grid.closeAndCancelTooltip"),hasCursorQuestion:!1},{content:s((()=>[d(r,{value:w.value,"onUpdate:value":i[4]||(i[4]=e=>w.value=e),disabled:L.value},{default:s((()=>[p(m(t.$t("trading.bot.cancelOrderOnStop")),1)])),_:1},8,["value","disabled"])])),_:1},8,["tooltip"]),d(u,{class:"checkbox-wrap",tooltip:t.$t("trading.bot.grid.closeAndCancelTooltip"),hasCursorQuestion:!1},{content:s((()=>[d(r,{value:L.value,"onUpdate:value":i[5]||(i[5]=e=>L.value=e)},{default:s((()=>[p(m(t.$t("trading.bot.cancelPositionOnStop")),1)])),_:1},8,["value"])])),_:1},8,["tooltip"])])),_.value?(o(),c("div",hT,m(t.$t("trading.bot.grid.confirmClose.bothClose.description",{symbol:B.value})),1)):h("",!0)]),l("div",mT,[d(f,{class:"primary",disabled:!(!X.value&&!J.value),onClick:re},{default:s((()=>[p(m(t.$t("t.confirm")),1)])),_:1},8,["disabled"])])])),_:1},8,["visible"])}}},[["__scopeId","data-v-70266fbb"]]);function fT(e,t){const{top:i,bottom:r,trailingStop:a,trailingStopType:n,trailingStopActivation:o}=t||{},s=e.top??i,l=e.bottom??r,u=e.trailingStop??a,c=e.trailingStopType??n,d=void 0!==e.trailingStopActivation?e.trailingStopActivation:o,p={};(null==s?void 0:s.price)&&(p.top={price:String(s.price),type:s.type}),(null==l?void 0:l.price)&&(p.bottom={price:String(l.price),type:l.type}),u&&(p.trailingStop=u,c&&(p.trailingStopType=c),d&&(p.trailingStopActivation=d));return{priceOutRange:p}}const vT={class:"tp-sl-display"},yT={class:"tp-sl-wrapper"},bT={class:"tp-sl-row"},ST={class:"title"},CT={class:"price"},PT={class:"tp-sl-row"},kT={class:"title"},TT={class:"price"},MT={class:"title"},LT={key:2,class:"add-row"},wT=$n(A({__name:"Tpsl",props:{botDetail:{},isHistory:{type:Boolean,default:!1}},setup(e){const t=k(),i=T(!1),r=M((()=>t.state.futures.marketMap)),a=M((()=>{var t,i;return(null==(i=null==(t=r.value)?void 0:t[e.botDetail.symbol])?void 0:i.priceFilter)??1})),s=e=>e?Qt(e,{formatKey:a.value,defaultValue:"-"}):"-",u=M((()=>"SHORT"===e.botDetail.direction)),p=M((()=>e.botDetail.detail.exitCondition||{})),f=M((()=>{const{top:e,bottom:t}=p.value;return{tp:u.value?null==t?void 0:t.price:null==e?void 0:e.price,sl:u.value?null==e?void 0:e.price:null==t?void 0:t.price}})),v=M((()=>s(f.value.tp))),y=M((()=>s(f.value.sl))),b=M((()=>!(!f.value.tp&&!f.value.sl))),S=M((()=>!e.isHistory&&!oo(e.botDetail.state))),C=()=>{i.value=!0},P=async r=>{const a=e.botDetail.tradingBotId,{top:n,bottom:o,closeAllPositions:s,cancelAllOrders:l}=r,u={exitCondition:fT({top:n,bottom:o},e.botDetail.detail.exitCondition),botStopAction:{closeAllPositions:s,cancelAllOrders:l}};await Cr.updateTradingBot(a,{config:u}),t.dispatch("futures/fetchGridBotList"),i.value=!1};return(e,t)=>(o(),c("div",vT,[b.value?(o(),c(g,{key:0},[l("div",yT,[l("div",bT,[l("span",ST,m(e.$t("t.tp"))+":",1),l("span",CT,m(v.value),1)]),l("div",PT,[l("span",kT,m(e.$t("t.sl"))+":",1),l("span",TT,m(y.value),1)])]),S.value?(o(),n(oh,{key:0,class:"icon-edit",onClick:C})):h("",!0)],64)):S.value?(o(),c("div",{key:1,class:"add-row",onClick:C},[l("span",MT,m(e.$t("t.add")),1),d(Fh,{class:"icon-edit"})])):(o(),c("div",LT,"-")),d(gT,{visible:i.value,"onUpdate:visible":t[0]||(t[0]=e=>i.value=e),botDetail:e.botDetail,onConfirmUpdateSettings:P},null,8,["visible","botDetail"])]))}}),[["__scopeId","data-v-fa31dff0"]]);function DT(e,t){return e?"PERCENTAGE"===t?S(e).div(100).toString():String(e):""}function OT(e,t){return e?"PERCENTAGE"===t?S(e).times(100).toString():String(e):""}function IT(e){const t={trailingStop:DT(e.trailingStop,e.trailingStopType),trailingStopType:e.trailingStopType};return e.trailingStopActivationPriceChecked&&e.trailingStopActivationPrice?t.trailingStopActivation={price:String(e.trailingStopActivationPrice),type:e.trailingStopActivationType}:t.trailingStopActivation=null,t}const xT={GTE:"â¥",LTE:"â¤"};function _T(e){const{t:t}=G(),{exitCondition:i,direction:r,trailingStopActivationDirection:a,formatPrice:n,trailingStopEstPrice:o}=e,s=M((()=>{var e;return null==(e=i.value)?void 0:e.trailingStop})),l=M((()=>{var e;return null==(e=i.value)?void 0:e.trailingStopType})),u=M((()=>{var e,t;return null==(t=null==(e=i.value)?void 0:e.trailingStopActivation)?void 0:t.price})),c=M((()=>{var e,t;return null==(t=null==(e=i.value)?void 0:e.trailingStopActivation)?void 0:t.type})),d=M((()=>{const e=a.value;return xT[e]||""})),p=M((()=>{const e=s.value,t=l.value;if(!e)return"-";if("PERCENTAGE"===t){return`${OT(e,t)}%`}return n(e)})),h=M((()=>u.value?`${d.value} ${n(u.value)}`:t("t.immediately"))),m=M((()=>"LONG"===r?"icon-arrow-down":"icon-arrow-up")),g=M((()=>{const e=p.value,t=o.value;return"-"!==e&&t?`${e} (${n(t)})`:e})),f=M((()=>{const e=s.value,t=l.value;return"PERCENTAGE"===t&&e?OT(e,t):e}));return{activationPrice:u,activationPriceType:c,condition:d,formattedTrailingStop:p,formattedActivationPrice:h,formattedTrailingStopWithEstPrice:g,arrowClass:m,trailingStopPercentageValue:f}}const AT={class:"trailing-stop-distance-percentage-input"},RT={key:0,class:"percent-actions"},FT=$n({__name:"TrailingStopDistancePercentageInput",props:{value:{type:[Number,String],default:""},type:{type:String,default:""},max:{type:Number,default:1/0},min:{type:Number,default:.01},step:{type:Number,default:.01},currency:{type:String,default:""},placeholder:{type:[String,Number],default:""},hidePercentActions:{type:Boolean,default:!1},distanceTooltip:{type:String,default:""},percentageTooltip:{type:String,default:""},errorShown:{type:Boolean,default:!1},priceFilter:{type:Number,default:2}},emits:["update:value","update:type"],setup(e,{emit:t}){const i=e,r=t,a=T(i.type||Xi.DISTANCE);D((()=>i.type),(e=>{a.value=e}));const n=M((()=>a.value===Xi.PERCENTAGE)),u=M((()=>[{id:Xi.DISTANCE,lang:"t.distance",fullName:"t.distance",isI18nKey:!0,tooltip:i.distanceTooltip},{id:Xi.PERCENTAGE,lang:"futuresMain.trade.percentage",fullName:"futuresMain.trade.percentage",isI18nKey:!0,tooltip:i.percentageTooltip}])),g=M((()=>({step:i.step,min:i.min,max:i.max,maxDecimalPlaces:i.priceFilter,placeholder:i.placeholder,errorShown:i.errorShown})));function f(e){a.value=e,r("update:value",""),r("update:type",e)}const v=e=>{r("update:value",e)};function y(e){r("update:value",e)}return(t,i)=>(o(),c("div",AT,[d(x(Wn),O({value:e.value,max:e.max,prependFocusInput:!1,label:"trailValue",enableThousandSeparator:"",enablePlaceZero:!n.value,hideSpin:""},g.value,{onInput:v}),{prepend:s((()=>[d(x(om),{class:"mode-type-select",items:u.value,form:a.value,tooltipPlacement:"bottom-start","onUpdate:form":f},null,8,["items","form"])])),append:s((()=>[p(m(n.value?"%":e.currency),1)])),_:1},16,["value","max","enablePlaceZero"]),n.value&&!e.hidePercentActions?(o(),c("div",RT,[l("div",{class:"percent-action",onClick:i[0]||(i[0]=e=>y(5))},"5%"),l("div",{class:"percent-action",onClick:i[1]||(i[1]=e=>y(10))},"10%"),l("div",{class:"percent-action",onClick:i[2]||(i[2]=e=>y(15))},"15%")])):h("",!0)]))}},[["__scopeId","data-v-5a94399d"]]),ET={class:"tif-text"},BT=A({__name:"ActivationPriceCheckbox",props:{value:{type:Boolean},orderType:{},tooltip:{}}
1,emits:["update:value"],setup(e){const t=e,i=M((()=>Boolean(t.value)));return(e,r)=>{const u=a("ToolTip"),c=a("Checkbox");return o(),n(c,{value:i.value,name:"activationPrice",onInput:r[0]||(r[0]=t=>e.$emit("update:value",t))},{default:s((()=>[d(u,{tooltip:e.tooltip?e.tooltip:e.$t("trading.order.tooltip.activationPrice",{orderType:e.$t(t.orderType)})},{content:s((()=>[l("span",ET,m(e.$t("t.activationPrice")),1)])),_:1},8,["tooltip"])])),_:1},8,["value"])}}}),zT=$n({__name:"PriceTypeSelect",props:{value:{type:String,required:!0},walletType:{type:String,required:!0,validator:e=>["spot","futures","bot"].includes(e)}},emits:["update:value"],setup(e){const{enableLastPriceDependentUI:t}=zt,i=e,r=(e,t,i)=>({id:e,lang:t,fullName:i,isI18nKey:!0}),a=e=>r(e,"trading.last","spot.order.market.lastPrice"),s=M((()=>{const e={spot:[r(_r.INDEX_PRICE,"futuresMain.trade.index","futuresMain.trade.indexPrice"),...t?[a(_r.LAST_PRICE)]:[]],bot:[r(ui.MARK_PRICE,"trading.mark","spot.order.market.markPrice"),...t?[a(ui.LAST_PRICE)]:[]],futures:[r("indexPrice","futuresMain.trade.index","futuresMain.trade.indexPrice"),r(xr.MARK_PRICE,"trading.mark","spot.order.market.markPrice"),...t?[a(xr.LAST_PRICE)]:[]]};return e[i.walletType]||e.futures}));return(t,i)=>(o(),n(x(om),{class:"size-type",items:s.value,form:e.value,"onUpdate:form":i[0]||(i[0]=e=>t.$emit("update:value",e))},null,8,["items","form"]))}},[["__scopeId","data-v-65048561"]]),$T={class:"inline-block"},NT=$n(A({__name:"ActivationPriceInput",props:{checked:{type:Boolean},price:{},quoteCurrency:{},priceType:{},walletType:{},priceFilter:{},max:{},step:{},errorShown:{type:Boolean}},emits:["update:price","update:priceType"],setup:e=>(e,t)=>e.checked?(o(),n(Wn,{key:0,value:e.price,enableThousandSeparator:"",enablePlaceZero:"",min:0,max:e.max,step:e.step,maxDecimalPlaces:e.priceFilter,errorShown:e.errorShown,hideSpin:"",onInput:t[1]||(t[1]=t=>e.$emit("update:price",t))},{prepend:s((()=>[l("p",$T,m(e.$t("t.price")),1)])),remark:s((()=>[p("("+m(e.quoteCurrency)+")",1)])),append:s((()=>[d(zT,{value:e.priceType,walletType:e.walletType,"onUpdate:value":t[0]||(t[0]=t=>e.$emit("update:priceType",t))},null,8,["value","walletType"])])),_:1},8,["value","max","step","maxDecimalPlaces","errorShown"])):h("",!0)}),[["__scopeId","data-v-bdb4992d"]]);const UT=$n({name:"IconTrailingStopDistanceLongLeft",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"182",height:"85",viewBox:"0 0 182 85",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{width:"140",height:"31",transform:"matrix(1 0 0 -1 1 66.5693)",fill:"url(#paint0_linear_21696_9184)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("path",{d:"M0 2.56934H158",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("path",{d:"M0 34.5693H158",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{y1:"66.0693",x2:"158",y2:"66.0693",stroke:"#7E8F9F"})],-1),l("path",{d:"M101.89 54.7133C101.182 54.7133 100.582 54.5933 100.09 54.3413C99.5976 54.0773 99.1776 53.7413 98.8176 53.3093L99.7536 52.4333C100.054 52.7933 100.378 53.0573 100.738 53.2493C101.098 53.4293 101.494 53.5253 101.95 53.5253C102.49 53.5253 102.898 53.4053 103.162 53.1653C103.438 52.9253 103.57 52.6013 103.57 52.1933C103.57 51.8573 103.474 51.6053 103.282 51.4133C103.09 51.2213 102.754 51.0773 102.262 50.9813L101.518 50.8493C100.702 50.6933 100.09 50.4293 99.6816 50.0453C99.2736 49.6613 99.0696 49.1333 99.0696 48.4613C99.0696 48.0893 99.1416 47.7533 99.2856 47.4533C99.4296 47.1533 99.6216 46.9013 99.8736 46.6973C100.126 46.4933 100.426 46.3373 100.786 46.2293C101.146 46.1093 101.554 46.0613 101.998 46.0613C102.634 46.0613 103.186 46.1693 103.654 46.3853C104.11 46.6013 104.506 46.9253 104.842 47.3453L103.894 48.1853C103.678 47.8973 103.414 47.6813 103.102 47.5133C102.79 47.3453 102.394 47.2613 101.938 47.2613C101.458 47.2613 101.086 47.3573 100.822 47.5493C100.558 47.7413 100.426 48.0173 100.426 48.3893C100.426 48.7373 100.534 49.0013 100.75 49.1693C100.966 49.3373 101.302 49.4693 101.758 49.5533L102.502 49.7093C103.342 49.8773 103.954 50.1413 104.338 50.5253C104.722 50.9093 104.926 51.4373 104.926 52.1093C104.926 52.5053 104.854 52.8653 104.722 53.1773C104.578 53.5013 104.386 53.7773 104.122 54.0053C103.858 54.2333 103.546 54.4133 103.174 54.5333C102.79 54.6533 102.37 54.7133 101.89 54.7133ZM108.162 54.5693C107.706 54.5693 107.358 54.4613 107.13 54.2213C106.89 53.9813 106.782 53.6453 106.782 53.2133V49.3973H105.81V48.3293H106.338C106.554 48.3293 106.698 48.2813 106.782 48.1853C106.866 48.0893 106.914 47.9333 106.914 47.7173V46.6253H108.09V48.3293H109.398V49.3973H108.09V53.5013H109.302V54.5693H108.162ZM113.159 54.7133C112.727 54.7133 112.331 54.6413 111.971 54.4853C111.611 54.3413 111.311 54.1253 111.059 53.8373C110.819 53.5493 110.627 53.2133 110.483 52.8053C110.351 52.3973 110.279 51.9533 110.279 51.4493C110.279 50.9573 110.351 50.5133 110.483 50.1053C110.627 49.6973 110.819 49.3613 111.059 49.0733C111.311 48.7853 111.611 48.5693 111.971 48.4133C112.331 48.2693 112.727 48.1853 113.159 48.1853C113.591 48.1853 113.975 48.2693 114.335 48.4133C114.695 48.5693 114.995 48.7853 115.247 49.0733C115.487 49.3613 115.679 49.6973 115.823 50.1053C115.955 50.5133 116.027 50.9573 116.027 51.4493C116.027 51.9533 115.955 52.3973 115.823 52.8053C115.679 53.2133 115.487 53.5493 115.247 53.8373C114.995 54.1253 114.695 54.3413 114.335 54.4853C113.975 54.6413 113.591 54.7133 113.159 54.7133ZM113.159 53.6333C113.603 53.6333 113.963 53.5013 114.239 53.2253C114.503 52.9493 114.647 52.5293 114.647 51.9773V50.9213C114.647 50.3693 114.503 49.9613 114.239 49.6853C113.963 49.4093 113.603 49.2653 113.159 49.2653C112.703 49.2653 112.343 49.4093 112.079 49.6853C111.803 49.9613 111.671 50.3693 111.671 50.9213V51.9773C111.671 52.5293 111.803 52.9493 112.079 53.2253C112.343 53.5013 112.703 53.6333 113.159 53.6333ZM117.485 48.3293H118.793V49.3613H118.853C118.985 48.9893 119.201 48.7013 119.513 48.4973C119.825 48.2933 120.185 48.1853 120.605 48.1853C121.397 48.1853 122.009 48.4733 122.441 49.0493C122.873 49.6253 123.089 50.4173 123.089 51.4493C123.089 52.4813 122.873 53.2853 122.441 53.8613C122.009 54.4373 121.397 54.7133 120.605 54.7133C120.185 54.7133 119.825 54.6173 119.513 54.4013C119.201 54.1973 118.985 53.9093 118.853 53.5373H118.793V56.9693H117.485V48.3293ZM120.209 53.5853C120.665 53.5853 121.025 53.4413 121.301 53.1533C121.565 52.8653 121.709 52.4693 121.709 51.9893V50.9093C121.709 50.4293 121.565 50.0453 121.301 49.7573C121.025 49.4693 120.665 49.3133 120.209 49.3133C119.801 49.3133 119.465 49.4213 119.201 49.6133C118.925 49.8053 118.793 50.0693 118.793 50.3813V52.5173C118.793 52.8413 118.925 53.1053 119.201 53.2973C119.465 53.4893 119.801 53.5853 120.209 53.5853Z",fill:"#7E8F9F"},null,-1),l("g",{opacity:"0.7"},[l("path",{d:"M148.5 41.5693L150.887 36.5693L145.113 36.5693L147.5 41.5693L148.5 41.5693ZM147.5 59.5693L145.113 64.5693L150.887 64.5693L148.5 59.5693L147.5 59.5693ZM148 39.5693L147.5 39.5693L147.5 41.5693L148 41.5693L148.5 41.5693L148.5 39.5693L148 39.5693ZM148 43.5693L147.5 43.5693L147.5 45.5693L148 45.5693L148.5 45.5693L148.5 43.5693L148 43.5693ZM148 47.5693L147.5 47.5693L147.5 49.5693L148 49.5693L148.5 49.5693L148.5 47.5693L148 47.5693ZM148 51.5693L147.5 51.5693L147.5 53.5693L148 53.5693L148.5 53.5693L148.5 51.5693L148 51.5693ZM148 55.5693L147.5 55.5693L147.5 57.5693L148 57.5693L148.5 57.5693L148.5 55.5693L148 55.5693ZM148 59.5693L147.5 59.5693L147.5 61.5693L148 61.5693L148.5 61.5693L148.5 59.5693L148 59.5693Z",fill:"#00B15D"}),l("path",{d:"M153.368 55.5693V47.1933H156.704C157.448 47.1933 158.036 47.4093 158.444 47.8293C158.84 48.2613 159.044 48.8493 159.044 49.5933C159.044 50.3373 158.84 50.9253 158.444 51.3453C158.036 51.7773 157.448 51.9933 156.704 51.9933H154.376V55.5693H153.368ZM154.376 51.1053H156.704C157.1 51.1053 157.412 51.0093 157.628 50.7933C157.844 50.5893 157.964 50.2893 157.964 49.9053V49.2813C157.964 48.8973 157.844 48.6093 157.628 48.3933C157.412 48.1893 157.1 48.0813 156.704 48.0813H154.376V51.1053ZM160.549 55.5693V49.3773H161.509V50.5173H161.569C161.677 50.2293 161.881 49.9653 162.169 49.7253C162.457 49.4973 162.853 49.3773 163.357 49.3773H163.729V50.3373H163.165C162.637 50.3373 162.241 50.4333 161.953 50.6253C161.653 50.8293 161.509 51.0813 161.509 51.3693V55.5693H160.549ZM167.296 55.7133C166.876 55.7133 166.492 55.6413 166.156 55.4853C165.808 55.3413 165.508 55.1133 165.268 54.8253C165.028 54.5493 164.836 54.2133 164.704 53.8053C164.56 53.4213 164.5 52.9773 164.5 52.4733C164.5 51.9933 164.56 51.5493 164.704 51.1413C164.836 50.7453 165.028 50.3973 165.268 50.1093C165.508 49.8333 165.808 49.6173 166.156 49.4613C166.492 49.3173 166.876 49.2333 167.296 49.2333C167.704 49.2333 168.088 49.3173 168.436 49.4613C168.772 49.6173 169.06 49.8333 169.312 50.1093C169.552 50.3973 169.744 50.7453 169.888 51.1413C170.02 51.5493 170.092 51.9933 170.092 52.4733C170.092 52.9773 170.02 53.4213 169.888 53.8053C169.744 54.2133 169.552 54.5493 169.312 54.8253C169.06 55.1133 168.772 55.3413 168.436 55.4853C168.088 55.6413 167.704 55.7133 167.296 55.7133ZM167.296 54.8613C167.812 54.8613 168.232 54.7053 168.568 54.3813C168.892 54.0693 169.06 53.5773 169.06 52.9173V52.0293C169.06 51.3813
1168.892 50.8893 168.568 50.5653C168.232 50.2533 167.812 50.0853 167.296 50.0853C166.768 50.0853 166.348 50.2533 166.024 50.5653C165.688 50.8893 165.532 51.3813 165.532 52.0293V52.9173C165.532 53.5773 165.688 54.0693 166.024 54.3813C166.348 54.7053 166.768 54.8613 167.296 54.8613ZM172.006 50.2173H170.998V49.3773H172.006V48.1293C172.006 47.6973 172.114 47.3493 172.342 47.0853C172.558 46.8213 172.906 46.6893 173.362 46.6893H174.298V47.5293H172.966V49.3773H174.298V50.2173H172.966V55.5693H172.006V50.2173ZM176.041 47.9253C175.825 47.9253 175.681 47.8773 175.597 47.7693C175.501 47.6733 175.453 47.5533 175.453 47.3853V47.2293C175.453 47.0733 175.501 46.9413 175.597 46.8453C175.681 46.7493 175.825 46.6893 176.041 46.6893C176.245 46.6893 176.401 46.7493 176.497 46.8453C176.581 46.9413 176.629 47.0733 176.629 47.2293V47.3853C176.629 47.5533 176.581 47.6733 176.497 47.7693C176.401 47.8773 176.245 47.9253 176.041 47.9253ZM175.561 49.3773H176.521V55.5693H175.561V49.3773ZM179.929 55.5693C179.593 55.5693 179.341 55.4733 179.173 55.2813C178.993 55.1013 178.909 54.8613 178.909 54.5493V50.2173H177.889V49.3773H178.465C178.669 49.3773 178.813 49.3413 178.897 49.2453C178.969 49.1733 179.005 49.0293 179.005 48.8133V47.6613H179.869V49.3773H181.225V50.2173H179.869V54.7293H181.129V55.5693H179.929Z",fill:"#00B15D"})],-1),l("path",{opacity:"0.5",d:"M83 1.06934L92.5 12.0693L95 20.0693H101L108.5 33.0693",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("path",{opacity:"0.7",d:"M5 61.5693L15.6798 49.5427L30.3596 33.5161L40.2237 45.1301L59.3353 22.6279L64.1965 27.7227L83 0.569336",stroke:"#00B15D","stroke-width":"2","stroke-linejoin":"round","stroke-dasharray":"2 2"},null,-1),l("circle",{opacity:"0.5",cx:"110",cy:"36.5693",r:"4",fill:"#FF5B5A"},null,-1),l("circle",{opacity:"0.7",cx:"3",cy:"64.5693",r:"2",stroke:"#00B15D","stroke-width":"2"},null,-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_21696_9184",x1:"70",y1:"61.5",x2:"70",y2:"6.5",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#00B15D"}),l("stop",{offset:"1","stop-color":"#00B15D","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]);const HT=$n({name:"IconTrailingStopDistanceLongRight",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"178",height:"83",viewBox:"0 0 178 83",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{x:"4",y:"23",width:"140",height:"41",fill:"url(#paint0_linear_21716_9204)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("line",{x1:"4",y1:"23.5",x2:"167",y2:"23.5",stroke:"#7E8F9F"}),l("line",{x1:"4",y1:"43.5",x2:"167",y2:"43.5",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{x1:"4",y1:"63.5",x2:"167",y2:"63.5",stroke:"#7E8F9F","stroke-dasharray":"2 2"})],-1),l("path",{opacity:"0.5",d:"M5 23L14.5 30.5L21.5 27L30 39.5L40 37L48 49L56.5 35L61 49L71 45.5L86 59.5",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("circle",{opacity:"0.7",cx:"3",cy:"21",r:"2",stroke:"#00B15D","stroke-width":"2"},null,-1),l("path",{d:"M79.8896 80.144C79.1816 80.144 78.5816 80.024 78.0896 79.772C77.5976 79.508 77.1776 79.172 76.8176 78.74L77.7536 77.864C78.0536 78.224 78.3776 78.488 78.7376 78.68C79.0976 78.86 79.4936 78.956 79.9496 78.956C80.4896 78.956 80.8976 78.836 81.1616 78.596C81.4376 78.356 81.5696 78.032 81.5696 77.624C81.5696 77.288 81.4736 77.036 81.2816 76.844C81.0896 76.652 80.7536 76.508 80.2616 76.412L79.5176 76.28C78.7016 76.124 78.0896 75.86 77.6816 75.476C77.2736 75.092 77.0696 74.564 77.0696 73.892C77.0696 73.52 77.1416 73.184 77.2856 72.884C77.4296 72.584 77.6216 72.332 77.8736 72.128C78.1256 71.924 78.4256 71.768 78.7856 71.66C79.1456 71.54 79.5536 71.492 79.9976 71.492C80.6336 71.492 81.1856 71.6 81.6536 71.816C82.1096 72.032 82.5056 72.356 82.8416 72.776L81.8936 73.616C81.6776 73.328 81.4136 73.112 81.1016 72.944C80.7896 72.776 80.3936 72.692 79.9376 72.692C79.4576 72.692 79.0856 72.788 78.8216 72.98C78.5576 73.172 78.4256 73.448 78.4256 73.82C78.4256 74.168 78.5336 74.432 78.7496 74.6C78.9656 74.768 79.3016 74.9 79.7576 74.984L80.5016 75.14C81.3416 75.308 81.9536 75.572 82.3376 75.956C82.7216 76.34 82.9256 76.868 82.9256 77.54C82.9256 77.936 82.8536 78.296 82.7216 78.608C82.5776 78.932 82.3856 79.208 82.1216 79.436C81.8576 79.664 81.5456 79.844 81.1736 79.964C80.7896 80.084 80.3696 80.144 79.8896 80.144ZM86.162 80C85.706 80 85.358 79.892 85.13 79.652C84.89 79.412 84.782 79.076 84.782 78.644V74.828H83.81V73.76H84.338C84.554 73.76 84.698 73.712 84.782 73.616C84.866 73.52 84.914 73.364 84.914 73.148V72.056H86.09V73.76H87.398V74.828H86.09V78.932H87.302V80H86.162ZM91.1594 80.144C90.7274 80.144 90.3314 80.072 89.9714 79.916C89.6114 79.772 89.3114 79.556 89.0594 79.268C88.8194 78.98 88.6274 78.644 88.4834 78.236C88.3514 77.828 88.2794 77.384 88.2794 76.88C88.2794 76.388 88.3514 75.944 88.4834 75.536C88.6274 75.128 88.8194 74.792 89.0594 74.504C89.3114 74.216 89.6114 74 89.9714 73.844C90.3314 73.7 90.7274 73.616 91.1594 73.616C91.5914 73.616 91.9754 73.7 92.3354 73.844C92.6954 74 92.9954 74.216 93.2474 74.504C93.4874 74.792 93.6794 75.128 93.8234 75.536C93.9554 75.944 94.0274 76.388 94.0274 76.88C94.0274 77.384 93.9554 77.828 93.8234 78.236C93.6794 78.644 93.4874 78.98 93.2474 79.268C92.9954 79.556 92.6954 79.772 92.3354 79.916C91.9754 80.072 91.5914 80.144 91.1594 80.144ZM91.1594 79.064C91.6034 79.064 91.9634 78.932 92.2394 78.656C92.5034 78.38 92.6474 77.96 92.6474 77.408V76.352C92.6474 75.8 92.5034 75.392 92.2394 75.116C91.9634 74.84 91.6034 74.696 91.1594 74.696C90.7034 74.696 90.3434 74.84 90.0794 75.116C89.8034 75.392 89.6714 75.8 89.6714 76.352V77.408C89.6714 77.96 89.8034 78.38 90.0794 78.656C90.3434 78.932 90.7034 79.064 91.1594 79.064ZM95.4848 73.76H96.7928V74.792H96.8528C96.9848 74.42 97.2008 74.132 97.5128 73.928C97.8248 73.724 98.1848 73.616 98.6048 73.616C99.3968 73.616 100.009 73.904 100.441 74.48C100.873 75.056 101.089 75.848 101.089 76.88C101.089 7
17.912 100.873 78.716 100.441 79.292C100.009 79.868 99.3968 80.144 98.6048 80.144C98.1848 80.144 97.8248 80.048 97.5128 79.832C97.2008 79.628 96.9848 79.34 96.8528 78.968H96.7928V82.4H95.4848V73.76ZM98.2088 79.016C98.6648 79.016 99.0248 78.872 99.3008 78.584C99.5648 78.296 99.7088 77.9 99.7088 77.42V76.34C99.7088 75.86 99.5648 75.476 99.3008 75.188C99.0248 74.9 98.6648 74.744 98.2088 74.744C97.8008 74.744 97.4648 74.852 97.2008 75.044C96.9248 75.236 96.7928 75.5 96.7928 75.812V77.948C96.7928 78.272 96.9248 78.536 97.2008 78.728C97.4648 78.92 97.8008 79.016 98.2088 79.016Z",fill:"#7E8F9F"},null,-1),l("circle",{opacity:"0.5",cx:"89",cy:"62",r:"4",fill:"#FF5B5A"},null,-1),l("g",{opacity:"0.5"},[l("path",{d:"M149.5 29L151.887 24L146.113 24L148.5 29L149.5 29ZM148.5 57L146.113 62L151.887 62L149.5 57L148.5 57ZM149 26.85L148.5 26.85L148.5 28.75L149 28.75L149.5 28.75L149.5 26.85L149 26.85ZM149 30.65L148.5 30.65L148.5 32.55L149 32.55L149.5 32.55L149.5 30.65L149 30.65ZM149 34.45L148.5 34.45L148.5 36.35L149 36.35L149.5 36.35L149.5 34.45L149 34.45ZM149 38.25L148.5 38.25L148.5 40.15L149 40.15L149.5 40.15L149.5 38.25L149 38.25ZM149 42.05L148.5 42.05L148.5 43.95L149 43.95L149.5 43.95L149.5 42.05L149 42.05ZM149 45.85L148.5 45.85L148.5 47.75L149 47.75L149.5 47.75L149.5 45.85L149 45.85ZM149 49.65L148.5 49.65L148.5 51.55L149 51.55L149.5 51.55L149.5 49.65L149 49.65ZM149 53.45L148.5 53.45L148.5 55.35L149 55.35L149.5 55.35L149.5 53.45L149 53.45ZM149 57.25L148.5 57.25L148.5 59.15L149 59.15L149.5 59.15L149.5 57.25L149 57.25Z",fill:"#FF5B5A"}),l("path",{d:"M154.405 48V39.624H155.413V47.112H158.977V48H154.405ZM162.661 48.144C162.241 48.144 161.857 48.072 161.521 47.916C161.173 47.772 160.873 47.544 160.633 47.256C160.393 46.98 160.201 46.644 160.069 46.236C159.925 45.852 159.865 45.408 159.865 44.904C159.865 44.424 159.925 43.98 160.069 43.572C160.201 43.176 160.393 42.828 160.633 42.54C160.873 42.264 161.173 42.048 161.521 41.892C161.857 41.748 162.241 41.664 162.661 41.664C163.069 41.664 163.453 41.748 163.801 41.892C164.137 42.048 164.425 42.264 164.677 42.54C164.917 42.828 165.109 43.176 165.253 43.572C165.385 43.98 165.457 44.424 165.457 44.904C165.457 45.408 165.385 45.852 165.253 46.236C165.109 46.644 164.917 46.98 164.677 47.256C164.425 47.544 164.137 47.772 163.801 47.916C163.453 48.072 163.069 48.144 162.661 48.144ZM162.661 47.292C163.177 47.292 163.597 47.136 163.933 46.812C164.257 46.5 164.425 46.008 164.425 45.348V44.46C164.425 43.812 164.257 43.32 163.933 42.996C163.597 42.684 163.177 42.516 162.661 42.516C162.133 42.516 161.713 42.684 161.389 42.996C161.053 43.32 160.897 43.812 160.897 44.46V45.348C160.897 46.008 161.053 46.5 161.389 46.812C161.713 47.136 162.133 47.292 162.661 47.292ZM168.896 48.144C168.32 48.144 167.84 48.036 167.456 47.82C167.06 47.604 166.724 47.304 166.448 46.932L167.132 46.38C167.372 46.692 167.636 46.92 167.936 47.088C168.224 47.256 168.572 47.328 168.968 47.328C169.376 47.328 169.688 47.244 169.928 47.064C170.144 46.896 170.264 46.644 170.264 46.32C170.264 46.08 170.18 45.876 170.036 45.708C169.868 45.54 169.592 45.42 169.184 45.348L168.692 45.276C168.404 45.24 168.14 45.18 167.9 45.096C167.66 45.012 167.444 44.904 167.276 44.76C167.084 44.616 166.952 44.448 166.856 44.232C166.748 44.028 166.7 43.776 166.7 43.488C166.7 43.188 166.748 42.924 166.868 42.696C166.976 42.468 167.132 42.276 167.336 42.12C167.528 41.976 167.756 41.856 168.032 41.784C168.296 41.712 168.596 41.664 168.908 41.664C169.412 41.664 169.832 41.76 170.18 41.928C170.516 42.108 170.804 42.348 171.068 42.66L170.432 43.236C170.288 43.044 170.096 42.876 169.832 42.72C169.568 42.564 169.232 42.48 168.836 42.48C168.428 42.48 168.128 42.576 167.936 42.744C167.72 42.912 167.624 43.152 167.624 43.44C167.624 43.752 167.72 43.968 167.936 44.1C168.128 44.244 168.428 44.34 168.812 44.4L169.292 44.472C169.976 44.58 170.468 44.784 170.756 45.072C171.044 45.36 171.188 45.744 171.188 46.212C171.188 46.812 170.984 47.292 170.576 47.628C170.168 47.976 169.604 48.144 168.896 48.144ZM174.743 48.144C174.167 48.144 173.687 48.036 173.303 47.82C172.907 47.604 172.571 47.304 172.295 46.932L172.979 46.38C173.219 46.692 173.483 46.92 173.783 47.088C174.071 47.256 174.419 47.328 174.815 47.328C175.223 47.328 175.535 47.244 175.775 47.064C175.991 46.896 176.111 46.644 176.111 46.32C176.111 46.08 176.027 45.876 175.883 45.708C175.715 45.54 175.439 45.42 175.031 45.348L174.539 45.276C174.251 45.24 173.987 45.18 173.747 45.096C173.507 45.012 173.291 44.904 173.123 44.76C172.931 44.616 172.799 44.448 172.703 44.232C172.595 44.028 172.547 43.776 172.547 43.488C172.547 43.188 172.595 42.924 172.715 42.696C172.823 42.468 172.979 42.276 173.183 42.12C173.375 41.976 173.603 41.856 173.879 41.784C174.143 41.712 174.443 41.664 174.755 41.664C175.259 41.664 175.679 41.76 176.027 41.928C176.363 42.108 176.651 42.348 176.915 42.66L176.279 43.236C176.135 43.044 175.943 42.876 175.679 42.72C175.415 42.564 175.079 42.48 174.683 42.48C174.275 42.48 173.975 42.576 173.783 42.744C173.567 42.912 173.471 43.152 173.471 43.44C173.471 43.752 173.567 43.968 173.783 44.1C173.975 44.244 174.275 44.34 174.659 44.4L175.139 44.472C175.823 44.58 176.315 44.784 176.603 45.072C176.891 45.36 177.035 45.744 177.035 46.212C177.035 46.812 176.831 47.292 176.423 47.628C176.015 47.976 175.451 48.144 174.743 48.144Z",fill:"#FF5B5A"})],-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_21716_9204",x1:"74",y1:"-2",x2:"74",y2:"64",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#FF5B5A"}),l("stop",{offset:"1","stop-color":"#FF5B5A","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]);const VT=$n({name:"IconTrailingStopDistanceShortLeft",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"178",height:"89",viewBox:"0 0 178 89",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{width:"137",height:"31",transform:"matrix(1 0 0 -1 2 56)",fill:"url(#paint0_linear_21728_13410)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("line",{x1:"2",y1:"23.5",x2:"160",y2:"23.5",stroke:"#7E8F9F"}),l("path",{d:"M2 56H160",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("path",{d:"M2 88H160",stroke:"#7E8F9F","stroke-dasharray":"2 2"})],-1),l("path",{d:"M108.89 47.144C108.182 47.144 107.582 47.024 107.09 46.772C106.598 46.508 106.178 46.172 105.818 45.74L106.754 44.864C107.054 45.224 107.378 45.488 107.738 45.68C108.098 45.86 108.494 45.956 108.95 45.956C109.49 45.956 109.898 45.836 110.162 45.596C110.438 45.356 110.57 45.032 110.57 44.624C110.57 44.288 110.474 44.036 110.282 43.844C110.09 43.652 109.754 43.508 109.262 43.412L108.518 43.28C107.702 43.124 107.09 42.86 106.682 42.476C106.274 42.092 106.07 41.564 106.07 40.892C106.07 40.52 106.142 40.184 106.286 39.884C106.43 39.584 106.622 39.332 106.874 39.128C107.126 38.924 107.426 38.768 107.786 38.66C108.146 38.54 108.554 38.492 108.998 38.492C109.634 38.492 110.186 38.6 110.654 38.816C111.11 39.032 111.506 39.356 111.842 39.776L110.894 40.616C110.678 40.328 110.414 40.112 110.102 39.944C109.79 39.776 109.394 39.692 108.938 39.692C108.458 39.692 108.086 39.788 107.822 39.98C107.558 40.172 107.426 40.448 107.426 40.82C107.426 41.168 107.534 41.432 107.75 41.6C107.966 41.768 108.302 41.9 108.758 41.984L109.502 42.14C110.342 42.308 110.954 42.572 111.338 42.956C111.722 43.34 111.926 43.868 111.926 44.54C111.926 44.936 111.854 45.296 111.722 45.608C111.578 45.932 111.386 46.208 111.122 46.436C110.858 46.664 110.546 46.844 110.174 46.964C109.79 47.084 109.37 47.144 108.89 47.144ZM115.162 47C114.706 47 114.358 46.892 114.13 46.652C113.89 46.412 113.782 46.076 113.782 45.644V41.828H112.81V40.76H113.338C113.554 40.76 113.698 40.712 113.782 40.616C113.866 40.52 113.914 40.364 113.914 40.148V39.056
1H115.09V40.76H116.398V41.828H115.09V45.932H116.302V47H115.162ZM120.159 47.144C119.727 47.144 119.331 47.072 118.971 46.916C118.611 46.772 118.311 46.556 118.059 46.268C117.819 45.98 117.627 45.644 117.483 45.236C117.351 44.828 117.279 44.384 117.279 43.88C117.279 43.388 117.351 42.944 117.483 42.536C117.627 42.128 117.819 41.792 118.059 41.504C118.311 41.216 118.611 41 118.971 40.844C119.331 40.7 119.727 40.616 120.159 40.616C120.591 40.616 120.975 40.7 121.335 40.844C121.695 41 121.995 41.216 122.247 41.504C122.487 41.792 122.679 42.128 122.823 42.536C122.955 42.944 123.027 43.388 123.027 43.88C123.027 44.384 122.955 44.828 122.823 45.236C122.679 45.644 122.487 45.98 122.247 46.268C121.995 46.556 121.695 46.772 121.335 46.916C120.975 47.072 120.591 47.144 120.159 47.144ZM120.159 46.064C120.603 46.064 120.963 45.932 121.239 45.656C121.503 45.38 121.647 44.96 121.647 44.408V43.352C121.647 42.8 121.503 42.392 121.239 42.116C120.963 41.84 120.603 41.696 120.159 41.696C119.703 41.696 119.343 41.84 119.079 42.116C118.803 42.392 118.671 42.8 118.671 43.352V44.408C118.671 44.96 118.803 45.38 119.079 45.656C119.343 45.932 119.703 46.064 120.159 46.064ZM124.485 40.76H125.793V41.792H125.853C125.985 41.42 126.201 41.132 126.513 40.928C126.825 40.724 127.185 40.616 127.605 40.616C128.397 40.616 129.009 40.904 129.441 41.48C129.873 42.056 130.089 42.848 130.089 43.88C130.089 44.912 129.873 45.716 129.441 46.292C129.009 46.868 128.397 47.144 127.605 47.144C127.185 47.144 126.825 47.048 126.513 46.832C126.201 46.628 125.985 46.34 125.853 45.968H125.793V49.4H124.485V40.76ZM127.209 46.016C127.665 46.016 128.025 45.872 128.301 45.584C128.565 45.296 128.709 44.9 128.709 44.42V43.34C128.709 42.86 128.565 42.476 128.301 42.188C128.025 41.9 127.665 41.744 127.209 41.744C126.801 41.744 126.465 41.852 126.201 42.044C125.925 42.236 125.793 42.5 125.793 42.812V44.948C125.793 45.272 125.925 45.536 126.201 45.728C126.465 45.92 126.801 46.016 127.209 46.016Z",fill:"#7E8F9F"},null,-1),l("g",{opacity:"0.7"},[l("path",{d:"M144.5 31L146.887 26L141.113 26L143.5 31L144.5 31ZM143.5 49L141.113 54L146.887 54L144.5 49L143.5 49ZM144 29L143.5 29L143.5 31L144 31L144.5 31L144.5 29L144 29ZM144 33L143.5 33L143.5 35L144 35L144.5 35L144.5 33L144 33ZM144 37L143.5 37L143.5 39L144 39L144.5 39L144.5 37L144 37ZM144 41L143.5 41L143.5 43L144 43L144.5 43L144.5 41L144 41ZM144 45L143.5 45L143.5 47L144 47L144.5 47L144.5 45L144 45ZM144 49L143.5 49L143.5 51L144 51L144.5 51L144.5 49L144 49Z",fill:"#00B15D"}),l("path",{d:"M149.368 45V36.624H152.704C153.448 36.624 154.036 36.84 154.444 37.26C154.84 37.692 155.044 38.28 155.044 39.024C155.044 39.768 154.84 40.356 154.444 40.776C154.036 41.208 153.448 41.424 152.704 41.424H150.376V45H149.368ZM150.376 40.536H152.704C153.1 40.536 153.412 40.44 153.628 40.224C153.844 40.02 153.964 39.72 153.964 39.336V38.712C153.964 38.328 153.844 38.04 153.628 37.824C153.412 37.62 153.1 37.512 152.704 37.512H150.376V40.536ZM156.549 45V38.808H157.509V39.948H157.569C157.677 39.66 157.881 39.396 158.169 39.156C158.457 38.928 158.853 38.808 159.357 38.808H159.729V39.768H159.165C158.637 39.768 158.241 39.864 157.953 40.056C157.653 40.26 157.509 40.512 157.509 40.8V45H156.549ZM163.296 45.144C162.876 45.144 162.492 45.072 162.156 44.916C161.808 44.772 161.508 44.544 161.268 44.256C161.028 43.98 160.836 43.644 160.704 43.236C160.56 42.852 160.5 42.408 160.5 41.904C160.5 41.424 160.56 40.98 160.704 40.572C160.836 40.176 161.028 39.828 161.268 39.54C161.508 39.264 161.808 39.048 162.156 38.892C162.492 38.748 162.876 38.664 163.296 38.664C163.704 38.664 164.088 38.748 164.436 38.892C164.772 39.048 165.06 39.264 165.312 39.54C165.552 39.828 165.744 40.176 165.888 40.572C166.02 40.98 166.092 41.424 166.092 41.904C166.092 42.408 166.02 42.852 165.888 43.236C165.744 43.644 165.552 43.98 165.312 44.256C165.06 44.544 164.772 44.772 164.436 44.916C164.088 45.072 163.704 45.144 163.296 45.144ZM163.296 44.292C163.812 44.292 164.232 44.136 164.568 43.812C164.892 43.5 165.06 43.008 165.06 42.348V41.46C165.06 40.812 164.892 40.32 164.568 39.996C164.232 39.684 163.812 39.516 163.296 39.516C162.768 39.516 162.348 39.684 162.024 39.99
16C161.688 40.32 161.532 40.812 161.532 41.46V42.348C161.532 43.008 161.688 43.5 162.024 43.812C162.348 44.136 162.768 44.292 163.296 44.292ZM168.006 39.648H166.998V38.808H168.006V37.56C168.006 37.128 168.114 36.78 168.342 36.516C168.558 36.252 168.906 36.12 169.362 36.12H170.298V36.96H168.966V38.808H170.298V39.648H168.966V45H168.006V39.648ZM172.041 37.356C171.825 37.356 171.681 37.308 171.597 37.2C171.501 37.104 171.453 36.984 171.453 36.816V36.66C171.453 36.504 171.501 36.372 171.597 36.276C171.681 36.18 171.825 36.12 172.041 36.12C172.245 36.12 172.401 36.18 172.497 36.276C172.581 36.372 172.629 36.504 172.629 36.66V36.816C172.629 36.984 172.581 37.104 172.497 37.2C172.401 37.308 172.245 37.356 172.041 37.356ZM171.561 38.808H172.521V45H171.561V38.808ZM175.929 45C175.593 45 175.341 44.904 175.173 44.712C174.993 44.532 174.909 44.292 174.909 43.98V39.648H173.889V38.808H174.465C174.669 38.808 174.813 38.772 174.897 38.676C174.969 38.604 175.005 38.46 175.005 38.244V37.092H175.869V38.808H177.225V39.648H175.869V44.16H177.129V45H175.929Z",fill:"#00B15D"})],-1),l("path",{opacity:"0.7",d:"M78.5 88L85 77H91.5L96 69H106L116.5 58",stroke:"#00B15D","stroke-width":"2"},null,-1),l("path",{opacity:"0.5",d:"M5 23.5L15.5 35.5L27 48L37 39L50 62L59.5 56L77.5 87",stroke:"#FF5B5A","stroke-width":"2","stroke-linejoin":"round","stroke-dasharray":"2 2"},null,-1),l("circle",{opacity:"0.7",cx:"4",cy:"4",r:"4",transform:"matrix(1 0 0 -1 114 59)",fill:"#00B15D"},null,-1),l("circle",{opacity:"0.5",cx:"3",cy:"21",r:"2",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_21728_13410",x1:"68.5",y1:"61.5",x2:"68.5",y2:"6.5",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#00B15D"}),l("stop",{offset:"1","stop-color":"#00B15D","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]);const WT=$n({name:"IconTrailingStopDistanceShortRight",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"178",height:"78",viewBox:"0 0 178 78",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{x:"4",y:"16",width:"140",height:"41",fill:"url(#paint0_linear_21728_13431)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("line",{x1:"4",y1:"16.5",x2:"167",y2:"16.5",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{x1:"4",y1:"36.5",x2:"167",y2:"36.5",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{x1:"4",y1:"56.5",x2:"167",y2:"56.5",stroke:"#7E8F9F"})],-1),l("path",{opacity:"0.7",d:"M5.5 57.5L13.5 50.5L20.5 54L29 41.5L39 44L47 32L55.5 46L60 32L70 35.5L85 21.5",stroke:"#00B15D","stroke-width":"2"},null,-1),l("circle",{opacity:"0.5",cx:"3",cy:"59",r:"2",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("path",{d:"M78.8896 12.144C78.1816 12.144 77.5816 12.024 77.0896 11.772C76.5976 11.508 76.1776 11.172 75.8176 10.74L76.7536 9.864C77.0536 10.224 77.3776 10.488 77.7376 10.68C78.0976 10.86 78.4936 10.956 78.9496 10.956C79.4896 10.956 79.8976 10.836 80.1616 10.596C80.4376 10.356 80.5696 10.032 80.5696 9.624C80.5696 9.288 80.4736 9.036 80.2816 8.844C80.0896 8.652 79.7536 8.508 79.2616 8.412L78.5176 8.28C77.7016 8.124 77.0896 7.86 76.6816 7.476C76.2736 7.092 76.0696 6.564 76.0696 5.892C76.0696 5.52 76.1416 5.184 76.2856 4.884C76.4296 4.584 76.6216 4.332 76.8736 4.128C77.1256 3.924 77.4256 3.768 77.7856 3.66C78.1456 3.54 78.5536 3.492 78.9976 3.492C79.6336 3.492 80.1856 3.6 80.6536 3.816C81.1096 4.032 81.5056 4.356 81.8416 4.776L80.8936 5.616C80.6776 5.328 80.4136 5.112 80.1016 4.944C79.7896 4.776 79.3936 4.692 78.9376 4.692C78.4576 4.692 78.0856 4.788 77.8216 4.98C77.5576 5.172 77.4256 5.448 77.4256 5.82C77.4256 6.168 77.5336 6.432 77.7496 6.6C77.9656 6.768 78.3016 6.9 78.7576 6.984L79.5016 7.14C80.3416 7.308 80.9536 7.572 81.3376 7.956C81.7216 8.34 81.9256 8.868 81.9256 9.54C81.9256 9.936 81.8536 10.296 81.7216 10.608C81.5776 10.932 81.3856 11.208 81.1216 11.436C80.8576 11.664 80.5456 11.844 80.1736 11.964C79.7896 12.084 79.3696 12.144 78.8896 12.144ZM85.162 12C84.706 12 84.358 11.892 84.13 11.652C83.89 11.412 83.782 11.076 83.782 10.644V6.828H82.81V5.76H83.338C83.554 5.76 83.698 5.712 83.782 5.616C83.866 5.52 83.914 5.364 83.914 5.148V4.056H85.09V5.76H86.398V6.828H85.09V10.932H86.302V12H85.162ZM90.1594 12.144C89.7274 12.144 89.3314 12.072 88.9714 11.916C88.6114 11.772 88.3114 11.556 88.0594 11.268C87.8194 10.98 87.6274 10.644 87.4834 10.236C87.3514 9.828 87.2794 9.384 87.2794 8.88C87.2794 8.388 87.3514 7.944 87.4834 7.536C87.6274 7.128 87.8194 6.792 88.0594 6.504C88.3114 6.216 88.6114 6 88.9714 5.844C89.3314 5.7 89.7274 5.616 90.1594 5.616C90.5914 5.616 90.9754 5.7 91.3354 5.844C91.6954 6 91.9954 6.216 92.2474 6.504C92.4874 6.792 92.6794 7.
1128 92.8234 7.536C92.9554 7.944 93.0274 8.388 93.0274 8.88C93.0274 9.384 92.9554 9.828 92.8234 10.236C92.6794 10.644 92.4874 10.98 92.2474 11.268C91.9954 11.556 91.6954 11.772 91.3354 11.916C90.9754 12.072 90.5914 12.144 90.1594 12.144ZM90.1594 11.064C90.6034 11.064 90.9634 10.932 91.2394 10.656C91.5034 10.38 91.6474 9.96 91.6474 9.408V8.352C91.6474 7.8 91.5034 7.392 91.2394 7.116C90.9634 6.84 90.6034 6.696 90.1594 6.696C89.7034 6.696 89.3434 6.84 89.0794 7.116C88.8034 7.392 88.6714 7.8 88.6714 8.352V9.408C88.6714 9.96 88.8034 10.38 89.0794 10.656C89.3434 10.932 89.7034 11.064 90.1594 11.064ZM94.4848 5.76H95.7928V6.792H95.8528C95.9848 6.42 96.2008 6.132 96.5128 5.928C96.8248 5.724 97.1848 5.616 97.6048 5.616C98.3968 5.616 99.0088 5.904 99.4408 6.48C99.8728 7.056 100.089 7.848 100.089 8.88C100.089 9.912 99.8728 10.716 99.4408 11.292C99.0088 11.868 98.3968 12.144 97.6048 12.144C97.1848 12.144 96.8248 12.048 96.5128 11.832C96.2008 11.628 95.9848 11.34 95.8528 10.968H95.7928V14.4H94.4848V5.76ZM97.2088 11.016C97.6648 11.016 98.0248 10.872 98.3008 10.584C98.5648 10.296 98.7088 9.9 98.7088 9.42V8.34C98.7088 7.86 98.5648 7.476 98.3008 7.188C98.0248 6.9 97.6648 6.744 97.2088 6.744C96.8008 6.744 96.4648 6.852 96.2008 7.044C95.9248 7.236 95.7928 7.5 95.7928 7.812V9.948C95.7928 10.272 95.9248 10.536 96.2008 10.728C96.4648 10.92 96.8008 11.016 97.2088 11.016Z",fill:"#7E8F9F"},null,-1),l("circle",{opacity:"0.7",cx:"88",cy:"20",r:"4",fill:"#00B15D"},null,-1),l("g",{opacity:"0.5"},[l("path",{d:"M149.5 22.5L151.887 17.5L146.113 17.5L148.5 22.5L149.5 22.5ZM148.5 50.5L146.113 55.5L151.887 55.5L149.5 50.5L148.5 50.5ZM149 20.35L148.5 20.35L148.5 22.25L149 22.25L149.5 22.25L149.5 20.35L149 20.35ZM149 24.15L148.5 24.15L148.5 26.05L149 26.05L149.5 26.05L149.5 24.15L149 24.15ZM149 27.95L148.5 27.95L148.5 29.85L149 29.85L149.5 29.85L149.5 27.95L149 27.95ZM149 31.75L148.5 31.75L148.5 33.65L149 33.65L149.5 33.65L149.5 31.75L149 31.75ZM149 35.55L148.5 35.55L148.5 37.45L149 37.45L149.5 37.45L149.5 35.55L149 35.55ZM149 39.35L148.5 39.35L148.5 41.25L149 41.25L149.5 41.25L149.5 39.35L149 39.35ZM149 43.15L148.5 43.15L148.5 45.05L149 45.05L149.5 45.05L149.5 43.15L149 43.15ZM149 46.95L148.5 46.95L148.5 48.85L149 48.85L149.5 48.85L149.5 46.95L149 46.95ZM149 50.75L148.5 50.75L148.5 52.65L149 52.65L149.5 52.65L149.5 50.75L149 50.75Z",fill:"#FF5B5A"}),l("path",{d:"M154.405 41.5V33.124H155.413V40.612H158.977V41.5H154.405ZM162.661 41.644C162.241 41.644 161.857 41.572 161.521 41.416C161.173 41.272 160.873 41.044 160.633 40.756C160.393 40.48 160.201 40.144 160.069 39.736C159.925 39.352 159.865 38.908 159.865 38.404C159.865 37.924 159.925 37.48 160.069 37.072C160.201 36.676 160.393 36.328 160.633 36.04C160.873 35.764 161.173 35.548 161.521 35.392C161.857 35.248 162.241 35.164 162.661 35.164C163.069 35.164 163.453 35.248 163.801 35.392C164.137 35.548 164.425 35.764 164.677 36.04C164.917 36.328 165.109 36.676 165.253 37.072C165.385 37.48 165.457 37.924 165.457 38.404C165.457 38.908 165.385 39.352 165.253 39.736C165.109 40.144 164.917 40.48 164.677 40.756C164.425 41.044 164.137 41.272 163.801 41.416C163.453 41.572 163.069 41.644 162.661 41.644ZM162.661 40.792C163.177 40.792 163.597 40.636 163.933 40.312C164.257 40 164.425 39.508 164.425 38.848V37.96C164.425 37.312 164.257 36.82 163.933 36.496C163.597 36.184 163.177 36.016 162.661 36.016C162.133 36.016 161.713 36.184 161.389 36.496C161.053 36.82 160.897 37.312 160.897 37.96V38.848C160.897 39.508 161.053 40 161.389 40.312C161.713 40.636 162.133 40.792 162.661 40.792ZM168.896 41.644C168.32 41.644 167.84 41.536 167.456 41.32C167.06 41.104 166.724 40.804 166.448 40.432L167.132 39.88C167.372 40.192 167.636 40.42 167.936 40.588C168.224 40.756 168.572 40.828 168.968 40.828C169.376 40.828 169.688 40.744 169.928 40.564C170.144 40.396 170.264 40.144 170.264 39.82C170.264 39.58 170.18 39.376 170.036 39.208C169.868 39.04 169.592 38.92 169.184 38.848L168.692 38.776C168.404 38.74 168.14 38.68 167.9 38.596C167.66 38.512 167.444 38.404 167.276 38.26C167.084 38.116 166.952 37.948 166.856 37.732C166.748 37.528 166.7 37.276 166.7 36.988C166.7 36.688 166.748 36.424 166.868 36.196C166.976 35.968 167.132 35.776 167.336 35.62C167.528 35.476 167.756 35.356 168.032 35.284C168.296 35.212 168.596 35.164 168.908 35.164C169.412 35.164 169.832 35.26 170.18 35.428C170.516 35.608 170.804 35.848 171.068 36.16L170.432 36.736C170.288 36.544 170.096 36.376 169.832 36.22C169.568 36.064 169.232 35.98 168.836 35.98C168.428 35.98 168.128 36.076 167.936 36.244C167.72 36.412 167.624 36.652 167.624 36.94C167.624 37.252 167.72 37.468 167.936 37.6C168.128 37.744 168.428 37.84 168.812 37.9L169.292 37.972C169.976 38.08 170.468 38.284 170.756 38.572C1
171.044 38.86 171.188 39.244 171.188 39.712C171.188 40.312 170.984 40.792 170.576 41.128C170.168 41.476 169.604 41.644 168.896 41.644ZM174.743 41.644C174.167 41.644 173.687 41.536 173.303 41.32C172.907 41.104 172.571 40.804 172.295 40.432L172.979 39.88C173.219 40.192 173.483 40.42 173.783 40.588C174.071 40.756 174.419 40.828 174.815 40.828C175.223 40.828 175.535 40.744 175.775 40.564C175.991 40.396 176.111 40.144 176.111 39.82C176.111 39.58 176.027 39.376 175.883 39.208C175.715 39.04 175.439 38.92 175.031 38.848L174.539 38.776C174.251 38.74 173.987 38.68 173.747 38.596C173.507 38.512 173.291 38.404 173.123 38.26C172.931 38.116 172.799 37.948 172.703 37.732C172.595 37.528 172.547 37.276 172.547 36.988C172.547 36.688 172.595 36.424 172.715 36.196C172.823 35.968 172.979 35.776 173.183 35.62C173.375 35.476 173.603 35.356 173.879 35.284C174.143 35.212 174.443 35.164 174.755 35.164C175.259 35.164 175.679 35.26 176.027 35.428C176.363 35.608 176.651 35.848 176.915 36.16L176.279 36.736C176.135 36.544 175.943 36.376 175.679 36.22C175.415 36.064 175.079 35.98 174.683 35.98C174.275 35.98 173.975 36.076 173.783 36.244C173.567 36.412 173.471 36.652 173.471 36.94C173.471 37.252 173.567 37.468 173.783 37.6C173.975 37.744 174.275 37.84 174.659 37.9L175.139 37.972C175.823 38.08 176.315 38.284 176.603 38.572C1
176.891 38.86 177.035 39.244 177.035 39.712C177.035 40.312 176.831 40.792 176.423 41.128C176.015 41.476 175.451 41.644 174.743 41.644Z",fill:"#FF5B5A"})],-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_21728_13431",x1:"74",y1:"-9",x2:"74",y2:"57",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#FF5B5A"}),l("stop",{offset:"1","stop-color":"#FF5B5A","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]);const qT=$n({name:"IconTrailingStopDistanceLongLeftMobile",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"279",height:"68",viewBox:"0 0 279 68",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{width:"214.615",height:"31",transform:"matrix(1 0 0 -1 1.53296 66)",fill:"url(#paint0_linear_22230_57337)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("path",{d:"M0 2H279",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("path",{d:"M0 34H279",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{y1:"65.5",x2:"279",y2:"65.5",stroke:"#7E8F9F"})],-1),l("path",{d:"M161.049 54.144C160.341 54.144 159.741 54.024 159.249 53.772C158.757 53.508 158.337 53.172 157.977 52.74L158.913 51.864C159.213 52.224 159.537 52.488 159.897 52.68C160.257 52.86 160.653 52.956 161.109 52.956C161.649 52.956 162.057 52.836 162.321 52.596C162.597 52.356 162.729 52.032 162.729 51.624C162.729 51.288 162.633 51.036 162.441 50.844C162.249 50.652 161.913 50.508 161.421 50.412L160.677 50.28C159.861 50.124 159.249 49.86 158.841 49.476C158.433 49.092 158.229 48.564 158.229 47.892C158.229 47.52 158.301 47.184 158.445 46.884C158.589 46.584 158.781 46.332 159.033 46.128C159.285 45.924 159.585 45.768 159.945 45.66C160.305 45.54 160.713 45.492 161.157 45.492C161.793 45.492 162.345 45.6 162.813 45.816C163.269 46.032 163.665 46.356 164.001 46.776L163.053 47.616C162.837 47.328 162.573 47.112 162.261 46.944C161.949 46.776 161.553 46.692 161.097 46.692C160.617 46.692 160.245 46.788 159.981 46.98C159.717 47.172 159.585 47.448 159.585 47.82C159.585 48.168 159.693 48.432 159.909 48.6C160.125 48.768 160.461 48.9 160.917 48.984L161.661 49.14C162.501 49.308 163.113 49.572 163.497 49.956C163.881 50.34 164.085 50.868 164.085 51.54C164.085 51.936 164.013 52.296 163.881 52.608C163.737 52.932 163.545 53.208 163.281 53.436C163.017 53.664 162.705 53.844 162.333 53.964C161.949 54.084 161.529 54.144 161.049 54.144ZM167.322 54C166.866 54 166.518 53.892 166.29 53.652C166.05 53.412 165.942 53.076 165.942 52.644V48.828H164.97V47.76H165.498C165.714 47.76 165.858 47.712 165.942 47.616C166.026 47.52 166.074 47.364 166.074 47.148V46.056H167.25V47.76H168.558V48.828H167.25V52.932H168.462V54H167.322ZM172.319 54.144C171.887 54.144 171.491 54.072 171.131 53.916C170.771 53.772 170.471 53.556 170.219 53.268C169.979 52.98 169.787 52.644 169.643 52.236C169.511 51.828 169.439 51.384 169.439 50.88C169.439 50.388 169.511 49.944 169.643 49.536C169.787 49.128 169.979 48.792 170.219 48.504C170.471 48.216 170.771 48 171.131 47.844C171.491 47.7 171.887 47.616 172.319 47.616C172.751 47.616 173.135 47.7 173.495 47.844C173.855 48 174.155 48.216 174.407 48.504C174.647 48.792 174.839 49.128 174.983 49.536C175.115 49.944 175.187 50.388 175.187 50.88C175.187 51.384 175.115 51.828 174.983 52.236C174.839 52.644 174.647 52.98 174.407 53.268C174.155 53.556 173.855 53.772 173.495 53.916C173.135 54.072 172.751 54.144 172.319 54.144ZM172.319 53.064C172.763 53.064 173.123 52.932 173.399 52.656C173.663 52.38 173.807 51.96 173.807 51.408V50.352C173.807 49.8 173.663 49.392 173.399 49.116C173.123 48.84 172.763 48.696 172.319 48.696C171.863 48.696 171.503 48.84 171.239 49.116C170.963 49.392 170.831 49.8 170.831 50.352V51.408C170.831 51.96 170.963 52.38 171.239 52.656C171.503 52.932 171.863 53.064 172.319 53.064ZM176.644 47.76H177.952V48.792H178.012C178.144 48.42 178.36 48.132 178.672 47.928C178.984 47.724 179.344 47.616 179.764 47.616C180.556 47.616 181.168 47.904 181.6 48.48C182.032 49.056 182.248 49.848 182.248 50.88C182.248 51.912 182.032 52.716 181.6 53.292C181.168 53.868 180.556 54.144 179.764 54.144C179.344 54.144 178.984 54.048 178.672 53.832C178.36 53.628 178.144 53.34 178.012 52.968H177.952V56.4H176.644V47.76ZM179.368 53.016C179.824 53.016 180.184 52.872 180.46 52.584C180.724 52.296 180.868 51.9 180.868 51.42V50.34C180.868 49.86 180.724 49.476 180.46 49.188C180.184 48.9 179.824 48.744 179.368 48.744C178.96 48.744 178.624 48.852 178.36 49.044C178.084 49.236 177.952 49.5 177.952 49.8
112V51.948C177.952 52.272 178.084 52.536 178.36 52.728C178.624 52.92 178.96 53.016 179.368 53.016Z",fill:"#7E8F9F"},null,-1),l("g",{opacity:"0.7"},[l("path",{d:"M227.379 41L229.766 36L223.993 36L226.379 41L227.379 41ZM226.379 59L223.993 64L229.766 64L227.379 59L226.379 59ZM226.879 39L226.379 39L226.379 41L226.879 41L227.379 41L227.379 39L226.879 39ZM226.879 43L226.379 43L226.379 45L226.879 45L227.379 45L227.379 43L226.879 43ZM226.879 47L226.379 47L226.379 49L226.879 49L227.379 49L227.379 47L226.879 47ZM226.879 51L226.379 51L226.379 53L226.879 53L227.379 53L227.379 51L226.879 51ZM226.879 55L226.379 55L226.379 57L226.879 57L227.379 57L227.379 55L226.879 55ZM226.879 59L226.379 59L226.379 61L226.879 61L227.379 61L227.379 59L226.879 59Z",fill:"#00B15D"}),l("path",{d:"M232.247 55V46.624H235.583C236.327 46.624 236.915 46.84 237.323 47.26C237.719 47.692 237.923 48.28 237.923 49.024C237.923 49.768 237.719 50.356 237.323 50.776C236.915 51.208 236.327 51.424 235.583 51.424H233.255V55H232.247ZM233.255 50.536H235.583C235.979 50.536 236.291 50.44 236.507 50.224C236.723 50.02 236.843 49.72 236.843 49.336V48.712C236.843 48.328 236.723 48.04 236.507 47.824C236.291 47.62 235.979 47.512 235.583 47.512H233.255V50.536ZM239.429 55V48.808H240.389V49.948H240.449C240.557 49.66 240.761 49.396 241.049 49.156C241.337 48.928 241.733 48.808 242.237 48.808H242.609V49.768H242.045C241.517 49.768 241.121 49.864 240.833 50.056C240.533 50.26 240.389 50.512 240.389 50.8V55H239.429ZM246.175 55.144C245.755 55.144 245.371 55.072 245.035 54.916C244.687 54.772 244.387 54.544 244.147 54.256C243.907 53.98 243.715 53.644 243.583 53.236C243.439 52.852 243.379 52.408 243.379 51.904C243.379 51.424 243.439 50.98 243.583 50.572C243.715 50.176 243.907 49.828 244.147 49.54C244.387 49.264 244.687 49.048 245.035 48.892C245.371 48.748 245.755 48.664 246.175 48.664C246.583 48.664 246.967 48.748 247.315 48.892C247.651 49.048 247.939 49.264 248.191 49.54C248.431 49.828 248.623 50.176 248.767 50.572C248.899 50.98 248.971 51.424 248.971 51.904C248.971 52.408 248.899 52.852 248.767 53.236C248.623 53.644 248.431 53.98 248.191 54.256C247.939 54.544 247.651 54.772 247.315 54.916C246.967 55.072 246.583 55.144 246.175 55.144ZM246.175 54.292C246.691 54.292 247.111 54.136 247.447 53.812C247.771 53.5 247.939 53.008 247.939 52.348V51.46C247.939 50.812 247.771 50.32 247.447 49.996C247.111 49.684 246.691 49.516 246.175 49.516C245.647 49.516 245.227 49.684 244.903 49.996C244.567 50.32 244.411 50.812 244.411 51.46V52.348C244.411 53.008 244.567 53.5 244.903 53.812C245.227 54.136 245.647 54.292 246.175 54.292ZM250.886 49.648H249.878V48.808H250.886V47.56C250.886 47.128 250.994 46.78 251.222 46.516C251.438 46.252 251.786 46.12 252.242 46.12H253.178V46.96H251.846V48.808H253.178V49.648H251.846V55H250.886V49.648ZM254.92 47.356C254.704 47.356 254.56 47.308 254.476 47.2C254.38 47.104 254.332 46.984 254.332 46.816V46.66C254.332 46.504 254.38 46.372 254.476 46.276C254.56 46.18 254.704 46.12 254.92 46.12C255.124 46.12 255.28 46.18 255.376 46.276C255.46 46.372 255.508 46.504 255.508 46.66V46.816C255.508 46.984 255.46 47.104 255.376 47.2C255.28 47.308 255.124 47.356 254.92 47.356ZM254.44 48.808H255.4V55H254.44V48.808ZM258.808 55C258.472 55 258.22 54.904 258.052 54.712C257.872 54.532 257.788 54.292 257.788 53.98V49.648H256.768V48.808H257.344C257.548 48.808 257.692 48.772 257.776 48.676C257.848 48.604 257.884 48.46 257.884 48.244V47.092H258.748V48.808H260.104V49.648H258.748V54.16H260.008V55H258.808Z",fill:"#00B15D"})],-1),l("path",{opacity:"0.5",d:"M126.236 1.5L141.8 11.5L145.632 19.5H154.83L166.327 32.5",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("path",{opacity:"0.7",d:"M7.66504 61L24.0368 48.9734L46.5405 32.9467L61.6617 44.5608L90.9592 22.0586L98.4113 27.1533L126.236 2",stroke:"#00B15D","stroke-width":"2","stroke-linejoin":"round","stroke-dasharray":"2 2"},null,-1),l("circle",{opacity:"0.5",cx:"169",cy:"35",r:"4",fill:"#FF5B5A"},null,-1),l("circle",{opacity:"0.7",cx:"4",cy:"64",r:"3",stroke:"#00B15D","stroke-width":"2"},null,-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_22230_57337",x1:"107.308",y1:"61.5",x2:"107.308",y2:"6.5",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#00B15D"}),l("stop",{offset:"1","stop-color":"#00B15D","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]);const GT=$n({name:"IconTrailingStopDistanceLongRightMobile",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"279",height:"68",viewBox:"0 0 279 68",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{x:"6.26978",y:"6.23047",width:"219.438",height:"42.9243",fill:"url(#paint0_linear_22230_57413)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("line",{y1:"6.77734",x2:"279",y2:"6.77734",stroke:"#7E8F9F"}),l("line",{y1:"26.7773",x2:"279",y2:"26.7773",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{y1:"46.7773",x2:"279",y2:"46.7773",stroke:"#7E8F9F","stroke-dasharray":"2 2"})],-1),l("path",{opacity:"0.5",d:"M7.83716 6.23047L22.7276 14.0825L33.6995 10.4182
1L47.0226 23.5049L62.6967 20.8875L75.236 33.4507L88.5591 18.7937L95.6124 33.4507L111.287 29.7865L134.798 44.4435",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("circle",{opacity:"0.7",cx:"4.90698",cy:"4",r:"3",stroke:"#00B15D","stroke-width":"2"},null,-1),l("path",{d:"M130.39 65.4868C129.682 65.4868 129.082 65.3668 128.59 65.1148C128.098 64.8508 127.678 64.5148 127.318 64.0828L128.254 63.2068C128.554 63.5668 128.878 63.8308 129.238 64.0228C129.598 64.2028 129.994 64.2988 130.45 64.2988C130.99 64.2988 131.398 64.1788 131.662 63.9388C131.938 63.6988 132.07 63.3748 132.07 62.9668C132.07 62.6308 131.974 62.3788 131.782 62.1868C131.59 61.9948 131.254 61.8508 130.762 61.7548L130.018 61.6228C129.202 61.4668 128.59 61.2028 128.182 60.8188C127.774 60.4348 127.57 59.9068 127.57 59.2348C127.57 58.8628 127.642 58.5268 127.786 58.2268C127.93 57.9268 128.122 57.6748 128.374 57.4708C128.626 57.2668 128.926 57.1108 129.286 57.0028C129.646 56.8828 130.054 56.8348 130.498 56.8348C131.134 56.8348 131.686 56.9428 132.154 57.1588C132.61 57.3748 133.006 57.6988 133.342 58.1188L132.394 58.9588C132.178 58.6708 131.914 58.4548 131.602 58.2868C131.29 58.1188 130.894 58.0348 130.438 58.0348C129.958 58.0348 129.586 58.1308 129.322 58.3228C129.058 58.5148 128.926 58.7908 128.926 59.1628C128.926 59.5108 129.034 59.7748 129.25 59.9428C129.466 60.1108 129.802 60.2428 130.258 60.3268L131.002 60.4828C131.842 60.6508 132.454 60.9148 132.838 61.2988C133.222 61.6828 133.426 62.2108 133.426 62.8828C133.426 63.2788 133.354 63.6388 133.222 63.9508C133.078 64.2748 132.886 64.5508 132.622 64.7788C132.358 65.0068 132.046 65.1868 131.674 65.3068C131.29 65.4268 130.87 65.4868 130.39 65.4868ZM136.662 65.3428C136.206 65.3428 135.858 65.2348 135.63 64.9948C135.39 64.7548 135.282 64.4188 135.282 63.9868V60.1708H134.31V59.1028H134.838C135.054 59.1028 135.198 59.0548 135.282 58.9588C135.366 58.8628 135.414 58.7068 135.414 58.4908V57.3988H136.59V59.1028H137.898V60.1708H136.59V64.2748H137.802V65.3428H136.662ZM141.66 65.4868C141.228 65.4868 140.832 65.4148 140.472 65.2588C140.112 65.1148 139.812 64.8988 139.56 64.6108C139.32 64.3228 139.128 63.9868 138.984 63.5788C138.852 63.1708 138.78 62.7268 138.78 62.2228C138.78 61.7308 138.852 61.2868 138.984 60.8788C139.128 60.4708 139.32 60.1348 139.56 59.8468C139.812 59.5588 140.112 59.3428 140.472 59.1868C140.832 59.0428 141.228 58.9588 141.66 58.9588C142.092 58.9588 142.476 59.0428 142.836 59.1868C143.196 59.3428 143.496 59.5588 143.748 59.8468C143.988 60.1348 144.18 60.4708 144.324 60.8788C144.456 61.2868 144.528 61.7308 144.528 62.2228C144.528 62.7268 144.456 63.1708 144.324 63.5788C144.18 63.9868 143.988 64.3228 143.748 64.6108C143.496 64.8988 143.196 65.1148 142.836 65.2588C142.476 65.4148 142.092 65.4868 141.66 65.4868ZM141.66 64.4068C142.104 64.4068 142.464 64.2748 142.74 63.9988C143.004 63.7228 143.148 63.3028 143.148 62.7508V61.6948C143.148 61.1428 143.004 60.7348 142.74 60.4588C142.464 60.1828 142.104 60.0388 141.66 60.0388C141.204 60.0388 140.844 60.1828 140.58 60.4588C140.304 60.7348 140.172 61.1428 140.172 61.6948V62.7508C140.172 63.3028 140.304 63.7228 140.58 63.9988C140.844 64.2748 141.204 64.4068 141.66 64.4068ZM145.985 59.1028H147.293V60.1348H147.353C147.485 59.7628 147.701 59.4748 148.013 59.2708C148.325 59.0668 148.685 58.9588 149.105 58.9588C149.897 58.9588 150.509 59.2468 150.941 59.8228C151.373 60.3988 151.589 61.1908 151.589 62.2228C151.589 63.2548 151.373 64.0588 150.941 64.6348C150.509 65.2108 149.897 65.4868 149.105 65.4868C148.685 65.4868 148.325 65.3908 148.013 65.1748C147.701 64.9708 147.485 64.6828 147.353 64.3108H147.293V67.7428H145.985V59.1028ZM148.709 64.3588C149.165 64.3588 149.525 64.2148 149.801 63.9268C150.065 63.6388 150.209 63.2428 150.209 62.7628V61.6828C150.209 61.2028 150.065 60.8188 149.801 60.5308C149.525 60.2428 149.165 60.0868 148.709 60.0868C148.301 60.0868 147.965 60.1948 147.701 60.3868C147.425 60.5788 147.293 60.8428 147.293 61.1548V63.2908C147.293 63.6148 147.425 63.8788 147.701 64.0708C147.965 64.2628 148.301 64.3588 148.709 64.3588Z",fill:"#7E8F9F"},null,-1),l("circle",{opacity:"0.5",cx:"138",cy:"46.0156",r:"4.09279",fill:"#FF5B5A"},null,-1),l("g",{opacity:"0.5"},[l("path",{d:"M234.045 13.1689L236.432 8.16895L230.658 8.16895L233.045 13.1689L234.045 13.1689ZM233.045 41.1689L230.658 46.1689L236.432 46.1689L234.045 41.1689L233.045 41.1689ZM233.545 11.0189L233.045 11.0189L233.045 12.9189L233.545 12.9189L234.045 12.9189L234.045 11.0189L233.545 11.0189ZM233.545 14.8189L233.045 14.8189L233.045 16.7189L233.545 16.7189L234.045 16.7189L234.045 14.8189L233.545 14.8189ZM233.545 18.6189L233.045 18.6189L233.045 20.5189L233.545 20.5189L234.045 20.5189L234.045 18.6189L233.545 18.6189ZM233.545 22.4189L233.045 22.4189L233.045 24.3189L233.545 24.3189L234.045 24.3189L234.045 22.4189L233.545 22.4189ZM233.545 26.2189L233.045 26.2189L233.045 28.1189L233.545 28.1189L234.045 28.1189L234.045 26.2189L233.545 26.2189ZM233.545 30.0189L233.045 30.0189L233.045 31.9189L233.545 31.9189L234.045 31.9189L234.045 30.0189L233.545 30.0189ZM233.545 33.8189L233.045 33.8189L233.045 35.7189L233.545 35.7189L234.045 35.7189L234.045 33.8189L233.545 33.8189ZM233.545 37.6189L233.045 37.6189L233.045 39.5189L233.545 39.5189L234.045 39.5189L234.045 37.6189L233.545 37.6189ZM233.545 41.4189L233.045 41.4189L233.045 43.3189L233.545 43.3189L234.045 43.3189L234.045 41.4189L233.545 41.4189Z",fill:"#FF5B5A"}),l("path",{d:"M238.95 32.1689V23.7929H239.958V31.2809H243.522V32.1689H238.95ZM247.206 32.3129C246.786 32.3129 246.402 32.2409 246.066 32.0849C245.718 31.9409 245.418 31.7129 245.178 31.4249C244.938 31.1489 244.746 30.8129 244.614 30.4049C244.47 30.0209 244.41 29.5769 244.41 29.0729C244.41 28.5929 244.47 28.1489 244.614 27.7409C244.746 27.3449 244.938 26.9969 245.178 26.7089C245.418 26.4329 245.718 26.2169 246.066 26.0609C246.402 25.9169 246.786 25.8329 247.206 25.8329C247.614 25.8329 247.998 25.9169 248.346 26.0609C248.682 26.2169 248.97 26.4329 249.222 26.7089C249.462 26.9969 249.654 27.3449 249.798 27.7409C249.93 28.1489 250.002 28.5929 250.002 29.0729C250.002 29.5769 249.93 30.0209 249.798 30.4049C249.654 30.8129 249.462 31.1489 249.222 31.4249C248.97 31.7129 248.682 31.9409 248.346 32.0849C247.998 32.2409 247.614 32.3
1129 247.206 32.3129ZM247.206 31.4609C247.722 31.4609 248.142 31.3049 248.478 30.9809C248.802 30.6689 248.97 30.1769 248.97 29.5169V28.6289C248.97 27.9809 248.802 27.4889 248.478 27.1649C248.142 26.8529 247.722 26.6849 247.206 26.6849C246.678 26.6849 246.258 26.8529 245.934 27.1649C245.598 27.4889 245.442 27.9809 245.442 28.6289V29.5169C245.442 30.1769 245.598 30.6689 245.934 30.9809C246.258 31.3049 246.678 31.4609 247.206 31.4609ZM253.441 32.3129C252.865 32.3129 252.385 32.2049 252.001 31.9889C251.605 31.7729 251.269 31.4729 250.993 31.1009L251.677 30.5489C251.917 30.8609 252.181 31.0889 252.481 31.2569C252.769 31.4249 253.117 31.4969 253.513 31.4969C253.921 31.4969 254.233 31.4129 254.473 31.2329C254.689 31.0649 254.809 30.8129 254.809 30.4889C254.809 30.2489 254.725 30.0449 254.581 29.8769C254.413 29.7089 254.137 29.5889 253.729 29.5169L253.237 29.4449C252.949 29.4089 252.685 29.3489 252.445 29.2649C252.205 29.1809 251.989 29.0729 251.821 28.9289C251.629 28.7849 251.497 28.6169 251.401 28.4009C251.293 28.1969 251.245 27.9449 251.245 27.6569C251.245 27.3569 251.293 27.0929 251.413 26.8649C251.521 26.6369 251.677 26.4449 251.881 26.2889C252.073 26.1449 252.301 26.0249 252.577 25.9529C252.841 25.8809 253.141 25.8329 253.453 25.8329C253.957 25.8329 254.377 25.9289 254.725 26.0969C255.061 26.2769 255.349 26.5169 255.613 26.8289L254.977 27.4049C254.833 27.2129 254.641 27.0449 254.377 26.8889C254.113 26.7329 253.777 26.6489 253.381 26.6489C252.973 26.6489 252.673 26.7449 252.481 26.9129C252.265 27.0809 252.169 27.3209 252.169 27.6089C252.169 27.9209 252.265 28.1369 252.481 28.2689C252.673 28.4129 252.973 28.5089 253.357 28.5689L253.837 28.6409C254.521 28.7489 255.013 28.9529 255.301 29.2409C255.589 29.5289 255.733 29.9129 255.733 30.3809C255.733 30.9809 255.529 31.4609 255.121 31.7969C254.713 32.1449 254.149 32.3129 253.441 32.3129ZM259.288 32.3129C258.712 32.3129 258.232 32.2049 257.848 31.9889C257.452 31.7729 257.116 31.4729 256.84 31.1009L257.524 30.5489C257.764 30.8609 258.028 31.0889 258.328 31.2569C258.616 31.4249 258.964 31.4969 259.36 31.4969C259.768 31.4969 260.08 31.4129 260.32 31.2329C260.536 31.0649 260.656 30.8129 260.656 30.4889C260.656 30.2489 260.572 30.0449 260.428 29.8769C260.26 29.7089 259.984 29.5889 259.576 29.5169L259.084 29.4449C258.796 29.4089 258.532 29.3489 258.292 29.2649C258.052 29.1809 257.836 29.0729 257.668 28.9289C257.476 28.7849 257.344 28.6169 257.248 28.4009C257.14 28.1969 257.092 27.9449 257.092 27.6569C257.092 27.3569 257.14 27.0929 257.26 26.8649C257.368 26.6369 257.524 26.4449 257.728 26.2889C257.92 26.1449 258.148 26.0249 258.424 25.9529C258.688 25.8809 258.988 25.8329 259.3 25.8329C259.804 25.8329 260.224 25.9289 260.572 26.0969C260.908 26.2769 261.196 26.5169 261.46 26.8289L260.824 27.4049C260.68 27.2129 260.488 27.0449 260.224 26.8889C259.96 26.7329 259.624 26.6489 259.228 26.6489C258.82 26.6489 258.52 26.7449 258.328 26.9129C258.112 27.0809 258.016 27.3209 258.016 27.6089C258.016 27.9209 258.112 28.1369 258.328 28.2689C258.52 28.4129 258.82 28.5089 259.204 28.5689L259.684 28.6409C260.368 28.7489 260.86 28.9529 261.148 29.2409C261.436 29.5289 261.58 29.9129 261.58 30.3809C261.58 30.9809 261.376 31.4609 260.968 31.7969C260.56 32.1449 259.996 32.3129 259.288 32.3129Z",fill:"#FF5B5A"})],-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_22230_57413",x1:"115.989",y1:"-19.9429",x2:"115.989",y2:"49.1547",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#FF5B5A"}),l("stop",{offset:"1","stop-color":"#FF5B5A","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]);const KT=$n({name:"IconTrailingStopDistanceShortLeftMobile",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"279",height:"68",viewBox:"0 0 279 68",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{width:"214.736",height:"29.6509",transform:"matrix(1 0 0 -1 0 34.3916)",fill:"url(#paint0_linear_22230_60574)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("line",{y1:"4.28516",x2:"279",y2:"4.28516",stroke:"#7E8F9F"}),l("path",{d:"M0 35.7852H279",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("path",{d:"M0 66.7852H279",stroke:"#7E8F9F","stroke-dasharray":"2 2"})],-1),l("path",{d:"M175.845 28.4506C175.137 28.4506 174.537 28.3306 174.045 28.0786C173.553 27.8146 173.133 27.4786 172.773 27.0466L173.709 26.1706C174.009 26.5306 174.333 26.7946 174.693 26.9866C175.053 27.1666 175.449 27.2626 175.905 27.2626C176.445 27.2626 176.853 27.1426 177.117 26.9026C177.393 26.6626 177.525 26.3386 177.525 25.9306C177.525 25.5946 177.429 25.3426 177.237 25.1506C177.045 24.9586 176.709 24.8146 176.217 24.7186L175.473 24.5866C174.657 24.4306 174.045 24.1666 173.637 23.7826C173.229 23.3986 173.025 22.8706 173.025 22.1986C173.025 21.8266 173.097 21.4906 173.241 21.1906C173.385 20.8906 173.577 20.6386 173.829 20.4346C174.081 20.2306 174.381 20.0746 174.741 19.9666C175.101 19.8466 175.509 19.7986 175.953 19.7986C176.589 19.7986 177.141 19.9066 177.609 20.1226C178.065 20.3386 178.461 20.6626 178.797 21.0826L177.849 21.9226C177.633 21.6346 177.369 21.4186 177.057 21.2506C176.745 21.0826 176.349 20.9986 175.893 20.9986C175.413 20.9986 175.041 21.0946 174.777 21.2866C174.513 21.4786 174.381 21.7546 174.381 22.1266C174.381 22.4746 174.489 22.7386 174.705 22.9066C174.921 23.0746 175.257 23.2066 175.713 23.2906L176.457 23.4466C177.297 23.6146 177.909 23.8786 178.293 24.2626C178.677 24.6466 178.881 25.1746 178.881 25.8466C178.881 26.2426 178.809 26.6026 178.677 26.9146C178.533 27.2386 178.341 27.5146 178.077 27.7426C177.813 27.9706 177.501 28.1506 177.129 28.2706C176.745 28.3906 176.325 28.4506 175.845 28.4506ZM182.117 28.3066C181.661 28.3066 181.313 28.1986 181.085 27.9586C180.845 27.7186 180.737 27.3826 180.737 26.9506V23.1346H179.765V22.0666H180.293C180.509 22.0666 180.653 22.0186 180.737 21.9226C180.821 21.8266 180.869 21.6706 180.869 21.4546V20.3626H182.045V22.0666H183.353V23.1346H182.045V27.2386H183.257V28.3066H182.117ZM187.114 28.4506C186.682 28.4506 186.286 28.3786 185.926 28.2226C185.566 28.0786 185.266 27.8626 185.014 27.5746C184.774 27.2866 184.582 26.9506 184.438 26.5426C184.306 26.1346 184.234 25.6906 184.234 25.1866C184.234 24.6946 184.306 24.2506 184.438 23.8426C184.582 23.4346 184.774 23.0986 185.014 22.8106C185.266 22.5226 185.566 22.3066 185.926 22.1506C186.286 22.0066 186.682 21.9226 187.114 21.9226C187.546 21.9226 187.93 22.0066 188.29 22.1506C188.65 22.3066 188.95 22.5226 189.202 22.8106C189.442 23.0986 189.634 23.4346 189.778 23.8426C189.91 24.2506 189.982 24.6946 189.982 25.1866C189.982 25.6906 189.91 26.1346 189.778 26.5426C189.634 26.9506 189.442 27.2866 189.202 27.5746C188.95 27.8626 188.65 28.0786 188.29 28.2226C187.93 28.3786 187.546 28.4506 187.114 28.4506ZM187.114 27.3706C187.558 27.3706 187.918 27.2386 188.194 26.9626C188.458 26.6866 188.602 26.2666 188.602 25.7146V24.6586C188.602 24.1066 188.458 23.6986 188.194 23.4226C187.918 23.1466 187.558 23.0026 187.114 23.0026C186.658 23.0026 186.298 23.1466 186.034 23.4226C185.758 23.6986 185.626 24.1066 185.626 24.6586V25.7146C185.626 26.2666 185.758 26.6866 186.034 26.9626C186.298 27.2386 186.658 27.3706 187.114 27.3706ZM191.44 22.0666H192.748V23.0986H192.808C192.94 22.7266 193.156 22.4386 193.468 22.2346C193.78 22.0306 194.14 21.9226 194.56 21.9226C195.352 21.9226 195.964 22.2106 196.396 22.7866C196.828 23.3626 197.044 24.1546 197.044 25.1866C197.044 26.2186 196.828 27.0226 196.396 27.5986C195.964 28.1746 195.352 28.4506 194.56 28.4506C194.14 28.4506 193.78 28.3546 193.468 28.1386C193.156 27.9346 192.94 27.6466 192.808 27.2746H192.748V30.7066H191.44V22.0666ZM194.164 27.3226C194.62 27.3226 194.98 27.1786 195.256 26.8906C195.52 26.6026 195.664 26.2066 195.664 25.7266V24.6466C195.664 24.1666 195.52 23.7826 195.256 23.4946C194.98 23.2066 194.62 23.0506 194.164 23.0506C193.756 23.0506 193.42 23.1586 193.156 23.3506C192.88 23.5426 192.748 23.8
1066 192.748 24.1186V26.2546C192.748 26.5786 192.88 26.8426 193.156 27.0346C193.42 27.2266 193.756 27.3226 194.164 27.3226Z",fill:"#7E8F9F"},null,-1),l("g",{opacity:"0.7"},[l("path",{d:"M226.5 12L228.887 7L223.113 7L225.5 12L226.5 12ZM225.5 30L223.113 35L228.887 35L226.5 30L225.5 30ZM226 10L225.5 10L225.5 12L226 12L226.5 12L226.5 10L226 10ZM226 14L225.5 14L225.5 16L226 16L226.5 16L226.5 14L226 14ZM226 18L225.5 18L225.5 20L226 20L226.5 20L226.5 18L226 18ZM226 22L225.5 22L225.5 24L226 24L226.5 24L226.5 22L226 22ZM226 26L225.5 26L225.5 28L226 28L226.5 28L226.5 26L226 26ZM226 30L225.5 30L225.5 32L226 32L226.5 32L226.5 30L226 30Z",fill:"#00B15D"}),l("path",{d:"M231.368 26V17.624H234.704C235.448 17.624 236.036 17.84 236.444 18.26C236.84 18.692 237.044 19.28 237.044 20.024C237.044 20.768 236.84 21.356 236.444 21.776C236.036 22.208 235.448 22.424 234.704 22.424H232.376V26H231.368ZM232.376 21.536H234.704C235.1 21.536 235.412 21.44 235.628 21.224C235.844 21.02 235.964 20.72 235.964 20.336V19.712C235.964 19.328 235.844 19.04 235.628 18.824C235.412 18.62 235.1 18.512 234.704 18.512H232.376V21.536ZM238.549 26V19.808H239.509V20.948H239.569C239.677 20.66 239.881 20.396 240.169 20.156C240.457 19.928 240.853 19.808 241.357 19.808H241.729V20.768H241.165C240.637 20.768 240.241 20.864 239.953 21.056C239.653 21.26 239.509 21.512 239.509 21.8V26H238.549ZM245.296 26.144C244.876 26.144 244.492 26.072 244.156 25.916C243.808 25.772 243.508 25.544 243.268 25.256C243.028 24.98 242.836 24.644 242.704 24.236C242.56 23.852 242.5 23.408 242.5 22.904C242.5 22.424 242.56 21.98 242.704 21.572C242.836 21.176 243.028 20.828 243.268 20.54C243.508 20.264 243.808 20.048 244.156 19.892C244.492 19.748 244.876 19.664 245.296 19.664C245.704 19.664 246.088 19.748 246.436 19.892C246.772 20.048 247.06 20.264 247.312 20.54C247.552 20.828 247.744 21.176 247.888 21.572C248.02 21.98 248.092 22.424 248.092 22.904C248.092 23.408 248.02 23.852 247.888 24.236C247.744 24.644 247.552 24.98 247.312 25.256C247.06 25.544 246.772 25.772 246.436 25.916C246.088 26.072 245.704 26.144 245.296 26.144ZM245.296 25.292C245.812 25.292 246.232 25.136 246.568 24.812C246.892 24.5 247.06 24.008 247.06 23.348V22.46C247.06 21.812 246.892 21.32 246.568 20.996C246.232 20.684 245.812 20.516 245.296 20.516C244.768 20.516 244.348 20.684 244.024 20.996C243.688 21.32 243.532 21.812 243.532 22.46V23.348C243.532 24.008 243.688 24.5 244.024 24.812C244.348 25.136 244.768 25.292 245.296 25.292ZM250.006 20.648H248.998V19.808H250.006V18.56C250.006 18.128 250.114 17.78 250.342 17.516C250.558 17.252 250.906 17.12 251.362 17.12H252.298V17.96H250.966V19.808H252.298V20.648H250.966V26H250.006V20.648ZM254.041 18.356C253.825 18.356 253.681 18.308 253.597 18.2C253.501 18.104 253.453 17.984 253.453 17.816V17.66C253.453 17.504 253.501 17.372 253.597 17.276C253.681 17.18 253.825 17.12 254.041 17.12C254.245 17.12 254.401 17.18 254.497 17.276C254.581 17.372 254.629 17.504 254.629 17.66V17.816C254.629 17.984 254.581 18.104 254.497 18.2C254.401 18.308 254.245 18.356 254.041 18.356ZM253.561 19.808H254.521V26H253.561V19.808ZM257.929 26C257.593 26 257.341 25.904 257.173 25.712C256.993 25.532 256.909 25.292 256.909 24.98V20.648H255.889V19.808H256.465C256.669 19.808 256.813 19.772 256.897 19.676C256.969 19.604 257.005 19.46 257.005 19.244V18.092H257.869V19.808H259.225V20.648H257.869V25.16H259.129V26H257.929Z",fill:"#00B15D"})],-1),l("path",{opacity:"0.7",d:"M120.205 67L130.393 57.4787H140.581L147.635 49.8269H163.309L179.767 39.3056",stroke:"#00B15D","stroke-width":"2"},null,-1),l("path",{opacity:"0.5",d:"M7.77763 7.71312L21.4579 17.7852L39.4832 29.7412L55.1574 21.1329L75.5338 43.1319L90.4242 37.393L118.638 67.0439",stroke:"#FF5B5A","stroke-width":"2","stroke-linejoin":"round","stroke-dasharray":"2 2"},null,-1),l("circle",{opacity:"0.7",cx:"4",cy:"4",r:"4",transform:"matrix(1 0 0 -1 178.339 41.3047)",fill:"#00B15D"},null,-1),l("circle",{opacity:"0.5",cx:"5.08813",cy:"5",r:"3",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_22230_60574",x1:"107.368",y1:"58.8236",x2:"107.368",y2:"6.21713",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#00B15D"}),l("stop",{offset:"1","stop-color":"#00B15D","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]);const QT=$n({name:"IconTrailingStopDistanceShortRightMobile",components:{Icon:Ee},data:()=>({randomId:Be()})},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"279",height:"68",viewBox:"0 0 279 68",fill:"none"},{default:s((()=>t[0]||(t[0]=[l("rect",{y:"17.375",width:"219.438",height:"44.5231",fill:"url(#paint0_linear_22230_60650)","fill-opacity":"0.08"},null,-1),l("g",{opacity:"0.2"},[l("line",{y1:"17.9609",x2:"279",y2:"17.9609",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{y1:"37.9609",x2:"279",y2:"37.9609",stroke:"#7E8F9F","stroke-dasharray":"2 2"}),l("line",{y1:"57.9609",x2:"279",y2:"57.9609",stroke:"#7E8F9F"})],-1),l("path",{opacity:"0.7",d:"M8.62085 62.4404L21.1602 54.8389L32.1321 58.6397L45.4551 45.0655L61.1293 47.7804L73.6686 34.7492L86.9916 49.9522L94.045 34.7492L109.719 38.55L133.23 23.3469",stroke:"#00B15D","stroke-width":"2"},null,-1),l("circle",{opacity:"0.5",cx:"4.70203",cy:"64.0858",r:"2.91394",stroke:"#FF5B5A","stroke-width":"2"},null,-1),l("path",{d:"M128.822 12.144C128.114 12.144 127.514 12.024 127.022 11.772C126.53 11.508 126.11 11.172 125.75 10.74L126.686 9.864C126.986 10.224 127.31 10.488 127.67 10.68C128.03 10.86 128.426 10.956 128.882
110.956C129.422 10.956 129.83 10.836 130.094 10.596C130.37 10.356 130.502 10.032 130.502 9.624C130.502 9.288 130.406 9.036 130.214 8.844C130.022 8.652 129.686 8.508 129.194 8.412L128.45 8.28C127.634 8.124 127.022 7.86 126.614 7.476C126.206 7.092 126.002 6.564 126.002 5.892C126.002 5.52 126.074 5.184 126.218 4.884C126.362 4.584 126.554 4.332 126.806 4.128C127.058 3.924 127.358 3.768 127.718 3.66C128.078 3.54 128.486 3.492 128.93 3.492C129.566 3.492 130.118 3.6 130.586 3.816C131.042 4.032 131.438 4.356 131.774 4.776L130.826 5.616C130.61 5.328 130.346 5.112 130.034 4.944C129.722 4.776 129.326 4.692 128.87 4.692C128.39 4.692 128.018 4.788 127.754 4.98C127.49 5.172 127.358 5.448 127.358 5.82C127.358 6.168 127.466 6.432 127.682 6.6C127.898 6.768 128.234 6.9 128.69 6.984L129.434 7.14C130.274 7.308 130.886 7.572 131.27 7.956C131.654 8.34 131.858 8.868 131.858 9.54C131.858 9.936 131.786 10.296 131.654 10.608C131.51 10.932 131.318 11.208 131.054 11.436C130.79 11.664 130.478 11.844 130.106 11.964C129.722 12.084 129.302 12.144 128.822 12.144ZM135.095 12C134.639 12 134.291 11.892 134.063 11.652C133.823 11.412 133.715 11.076 133.715 10.644V6.828H132.743V5.76H133.271C133.487 5.76 133.631 5.712 133.715 5.616C133.799 5.52 133.847 5.364 133.847 5.148V4.056H135.023V5.76H136.331V6.828H135.023V10.932H136.235V12H135.095ZM140.092 12.144C139.66 12.144 139.264 12.072 138.904 11.916C138.544 11.772 138.244 11.556 137.992 11.268C137.752 10.98 137.56 10.644 137.416 10.236C137.284 9.828 137.212 9.384 137.212 8.88C137.212 8.388 137.284 7.944 137.416 7.536C137.56 7.128 137.752 6.792 137.992 6.504C138.244 6.216 138.544 6 138.904 5.844C139.264 5.7 139.66 5.616 140.092 5.616C140.524 5.616 140.908 5.7 141.268 5.844C141.628 6 141.928 6.216 142.18 6.504C142.42 6.792 142.612 7.128 142.756 7.536C142.888 7.944 142.96 8.388 142.96 8.88C142.96 9.384 142.888 9.828 142.756 10.236C142.612 10.644 142.42 10.98 142.18 11.268C141.928 11.556 141.628 11.772 141.268 11.916C140.908 12.072 140.524 12.144 140.092 12.144ZM140.092 11.064C140.536 11.064 140.896 10.932 141.172 10.656C141.436 10.38 141.58 9.96 141.58 9.408V8.352C141.58 7.8 141.436 7.392 141.172 7.116C140.896 6.84 140.536 6.696 140.092 6.696C139.636 6.696 139.276 6.84 139.012 7.116C138.736 7.392 138.604 7.8 138.604 8.352V9.408C138.604 9.96 138.736 10.38 139.012 10.656C139.276 10.932 139.636 11.064 140.092 11.064ZM144.417 5.76H145.725V6.792H145.785C145.917 6.42 146.133 6.132 146.445 5.928C146.757 5.724 147.117 5.616 147.537 5.616C148.329 5.616 148.941 5.904 149.373 6.48C149.805 7.056 150.021 7.848 150.021 8.88C150.021 9.912 149.805 10.716 149.373 11.292C148.941 11.868 148.329 12.144 147.537 12.144C147.117 12.144 146.757 12.048 146.445 11.832C146.133 11.628 145.917 11.34 145.785 10.968H145.725V14.4H144.417V5.76ZM147.141 11.016C147.597 11.016 147.957 10.872 148.233 10.584C148.497 10.296 148.641 9.9 148.641 9.42V8.34C148.641 7.86 148.497 7.476 148.233 7.188C147.957 6.9 147.597 6.744 147.141 6.744C146.733 6.744 146.397 6.852 146.133 7.044C145.857 7.236 145.725 7.5 145.725 7.812V9.948C145.725 10.272 145.857 10.536 146.133 10.728C146.397 10.92 146.733 11.016 147.141 11.016Z",fill:"#7E8F9F"},null,-1),l("circle",{opacity:"0.7",cx:"137",cy:"20.6332",r:"4.16832",fill:"#00B15D"},null,-1),l("g",{opacity:"0.5"},[l("path",{d:"M234.045 25.6367L236.432 20.6367L230.658 20.6367L233.045 25.6367L234.045 25.6367ZM233.045 53.6367L230.658 58.6367L236.432 58.6367L234.045 53.6367L233.045 53.6367ZM233.545 23.4867L233.045 23.4867L233.045 25.3867L233.545 25.3867L234.045 25.3867L234.045 23.4867L233.545 23.4867ZM233.545 27.2867L233.045 27.2867L233.045 29.1867L233.545 29.1867L234.045 29.1867L234.045 27.2867L233.545 27.2867ZM233.545 31.0867L233.045 31.0867L233.045 32.9867L233.545 32.9867L234.045 32.9867L234.045 31.0867L233.545 31.0867ZM233.545 34.8867L233.045 34.8867L233.045 36.7867L233.545 36.7867L234.045 36.7867L234.045 34.8867L233.545 34.8867ZM233.545 38.6867L233.045 38.6867L233.045 40.5867L233.545 40.5867L234.045 40.5867L234.045 38.6867L233.545 38.6867ZM233.545 42.4867L233.045 42.4867L233.045 44.3867L233.545 44.3867L234.045 44.3867L234.045 42.4867L233.545 42.4867ZM233.545 46.2867L233.045 46.2867L233.045 48.1867L233.545 48.1867L234.045 48.1867L234.045 46.2867L233.545 46.2867ZM233.545 50.0867L233.045 50.0867L233.045 51.9867L233.545 51.9867L234.045 51.9867L234.045 50.0867L233.545 50.0867ZM233.545 53.8867L233.045 53.8867L233.045 55.7867L233.545 55.7867L234.045 55.7867L234.045 53.8867L233.545 53.8867Z",fill:"#FF5B5A"}),l("path",{d:"M238.95 44.6367V36.2607H239.958V43.7487H243.522V44.6367H238.95ZM247.206 44.7807C246.786 44.7807 246.402 44.7087 246.066 44.5527C245.718 44.4087 245.418 44.1807 245.178 43.8927C244.938 43.6167 244.746 43.2807 244.614 42.8727C244.47 42.4887 244.41 42.0447 244.41 41.54
107C244.41 41.0607 244.47 40.6167 244.614 40.2087C244.746 39.8127 244.938 39.4647 245.178 39.1767C245.418 38.9007 245.718 38.6847 246.066 38.5287C246.402 38.3847 246.786 38.3007 247.206 38.3007C247.614 38.3007 247.998 38.3847 248.346 38.5287C248.682 38.6847 248.97 38.9007 249.222 39.1767C249.462 39.4647 249.654 39.8127 249.798 40.2087C249.93 40.6167 250.002 41.0607 250.002 41.5407C250.002 42.0447 249.93 42.4887 249.798 42.8727C249.654 43.2807 249.462 43.6167 249.222 43.8927C248.97 44.1807 248.682 44.4087 248.346 44.5527C247.998 44.7087 247.614 44.7807 247.206 44.7807ZM247.206 43.9287C247.722 43.9287 248.142 43.7727 248.478 43.4487C248.802 43.1367 248.97 42.6447 248.97 41.9847V41.0967C248.97 40.4487 248.802 39.9567 248.478 39.6327C248.142 39.3207 247.722 39.1527 247.206 39.1527C246.678 39.1527 246.258 39.3207 245.934 39.6327C245.598 39.9567 245.442 40.4487 245.442 41.0967V41.9847C245.442 42.6447 245.598 43.1367 245.934 43.4487C246.258 43.7727 246.678 43.9287 247.206 43.9287ZM253.441 44.7807C252.865 44.7807 252.385 44.6727 252.001 44.4567C251.605 44.2407 251.269 43.9407 250.993 43.5687L251.677 43.0167C251.917 43.3287 252.181 43.5567 252.481 43.7247C252.769 43.8927 253.117 43.9647 253.513 43.9647C253.921 43.9647 254.233 43.8807 254.473 43.7007C254.689 43.5327 254.809 43.2807 254.809 42.9567C254.809 42.7167 254.725 42.5127 254.581 42.3447C254.413 42.1767 254.137 42.0567 253.729 41.9847L253.237 41.9127C252.949 41.8767 252.685 41.8167 252.445 41.7327C252.205 41.6487 251.989 41.5407 251.821 41.3967C251.629 41.2527 251.497 41.0847 251.401 40.8687C251.293 40.6647 251.245 40.4127 251.245 40.1247C251.245 39.8247 251.293 39.5607 251.413 39.3327C251.521 39.1047 251.677 38.9127 251.881 38.7567C252.073 38.6127 252.301 38.4927 252.577 38.4207C252.841 38.3487 253.141 38.3007 253.453 38.3007C253.957 38.3007 254.377 38.3967 254.725 38.5647C255.061 38.7447 255.349 38.9847 255.613 39.2967L254.977 39.8727C254.833 39.6807 254.641 39.5127 254.377 39.3567C254.113 39.2007 253.777 39.1167 253.381 39.1167C252.973 39.1167 252.673 39.2127 252.481 39.3807C252.265 39.5487 252.169 39.7887 252.169 40.0767C252.169 40.3887 252.265 40.6047 252.481 40.7367C252.673 40.8807 252.973 40.9767 253.357 41.0367L253.837 41.1087C254.521 41.2167 255.013 41.4207 255.301 41.7087C255.589 41.9967 255.733 42.3807 255.733 42.8487C255.733 43.4487 255.529 43.9287 255.121 44.2647C254.713 44.6127 254.149 44.7807 253.441 44.7807ZM259.288 44.7807C258.712 44.7807 258.232 44.6727 257.848 44.4567C257.452 44.2407 257.116 43.9407 256.84 43.5687L257.524 43.0167C257.764 43.3287 258.028 43.5567 258.328 43.7247C258.616 43.8927 258.964 43.9647 259.36 43.9647C259.768 43.9647 260.08 43.8807 260.32 43.7007C260.536 43.5327 260.656 43.2807 260.656 42.9567C260.656 42.7167 260.572 42.5127 260.428 42.3447C260.26 42.1767 259.984 42.0567 259.576 41.9847L259.084 41.9127C258.796 41.8767 258.532 41.8167 258.292 41.7327C258.052 41.6487 257.836 41.5407 257.668 41.3967C257.476 41.2527 257.344 41.0847 257.248 40.8687C257.14 40.6647 257.092 40.4127 257.092 40.1247C257.092 39.8247 257.14 39.5607 257.26 39.3327C257.368 39.1047 257.524 38.9127 257.728 38.7567C257.92 38.6127 258.148 38.4927 258.424 38.4207C258.688 38.3487 258.988 38.3007 259.3 38.3007C259.804 38.3007 260.224 38.3967 260.572 38.5647C260.908 38.7447 261.196 38.9847 261.46 39.2967L260.824 39.8727C260.68 39.6807 260.488 39.5127 260.224 39.3567C259.96 39.2007 259.624 39.1167 259.228 39.1167C258.82 39.1167 258.52 39.2127 258.328 39.3807C258.112 39.5487 258.016 39.7887 258.016 40.0767C258.016 40.3887 258.112 40.6047 258.328 40.7367C258.52 40.8807 258.82 40.9767 259.204 41.0367L259.684 41.1087C260.368 41.2167 260.86 41.4207 261.148 41.7087C261.436 41.9967 261.58 42.3807 261.58 42.8487C261.58 43.4487 261.376 43.9287 260.968 44.2647C260.56 44.6127 259.996 44.7807 259.288 44.7807Z",fill:"#FF5B5A"})],-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_22230_60650",x1:"109.719",y1:"-9.77326",x2:"109.719",y2:"61.8981",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#FF5B5A"}),l("stop",{offset:"1","stop-color":"#FF5B5A","stop-opacity":"0.2"})])],-1)]))),_:1,__:[0]})}]]),jT={key:0,class:"mobile-svg-content"},YT={class:"svg-tab-content"},ZT={class:"svg-content-item-description"},XT={class:"svg-content-item-icon-wrapper"},JT={key:0,class:"svg-content"},eM={class:"svg-content-item"},tM={class:"svg-content-item-description"},iM={class:"svg-content-item-icon-value short left"},rM={class:"svg-content-item-icon-activation-price short left"},aM={class:"svg-content-item"},nM={class:"svg-content-item-description"},oM={class:"svg-content-item-icon-value short right"},sM={class:"svg-content-item-icon-activation-price short right"},lM={key:1,class:"svg-content"},uM={class:"svg-content-item"},cM={class:"svg-content-item-description"},dM={class:"svg-content-item-icon-value long left"},pM={class:"svg-content-item-icon-activation-price long left"},hM={class:"svg-content-item"},mM={class:"svg-content-item-description"},gM={class:"svg-content-item-icon-value long right"},fM={class:"svg-content-item-icon-activation-price long right"},vM=$n({__name:"TrailingStopSvg",props:{isLong:{type:Boolean,required:!0},inputDisplay:{type:String,required:!0},activationPriceDisplay:{type:String,required:!0}},setup(e){const t=e,i="Rises",r="Falls",{t:a}=G(),s=T(i),u=M((()=>t.isLong?s.value===i?a("trading.bot.trailingStop.tutorial.long.left"):a("trading.bot.trailingStop.tutorial.long.right"):s.value===i?a("trading.bot.trailingStop.tutorial.short.left"):a("trading.bot.trailingStop.tutorial.short.right"))),p=M((()=>t.isLong?s.value===i?qT:GT:s.value===i?KT:QT));return(t,a)=>
1t.isMobile?(o(),c("div",jT,[l("div",YT,[l("div",{class:C(["svg-tab-content-item",{active:s.value===i}]),onClick:a[0]||(a[0]=e=>s.value=i)},m(t.$t("t.rises")),3),l("div",{class:C(["svg-tab-content-item",{active:s.value===r}]),onClick:a[1]||(a[1]=e=>s.value=r)},m(t.$t("t.falls")),3)]),l("p",ZT,m(u.value),1),l("div",XT,[(o(),n(F(p.value),{class:"svg-content-item-icon"})),l("p",{class:C(["svg-content-item-icon-value",{short:e.isLong,long:!e.isLong,left:s.value===i,right:s.value===r}])},m(`${e.isLong?"-":"+"}${e.inputDisplay}`),3),l("p",{class:C(["svg-content-item-icon-activation-price",{short:e.isLong,long:!e.isLong,left:s.value===i,right:s.value===r}])},m(e.activationPriceDisplay),3)])])):(o(),c(g,{key:1},[e.isLong?(o(),c("div",JT,[l("div",eM,[l("p",tM,m(t.$t("trading.bot.trailingStop.tutorial.long.left")),1),d(UT,{class:"svg-content-item-icon"}),l("p",iM," -"+m(e.inputDisplay),1),l("p",rM,m(e.activationPriceDisplay),1)]),l("div",aM,[l("p",nM,m(t.$t("trading.bot.trailingStop.tutorial.long.right")),1),d(HT,{class:"svg-content-item-icon"}),l("p",oM," -"+m(e.inputDisplay),1),l("p",sM,m(e.activationPriceDisplay),1)])])):(o(),c("div",lM,[l("div",uM,[l("p",cM,m(t.$t("trading.bot.trailingStop.tutorial.short.left")),1),d(VT,{class:"svg-content-item-icon"}),l("p",dM,"+"+m(e.inputDisplay),1),l("p",pM,m(e.activationPriceDisplay),1)]),l("div",hM,[l("p",mM,m(t.$t("trading.bot.trailingStop.tutorial.short.right")),1),d(WT,{class:"svg-content-item-icon"}),l("p",gM," +"+m(e.inputDisplay),1),l("p",fM,m(e.activationPriceDisplay),1)])]))],64))}},[["__scopeId","data-v-0e6e1806"]]),yM={class:"title"},bM={class:"content"},SM={class:"price-info-content"},CM={class:"price-info-item"},PM={class:"price-info-item-label"},kM={class:"price-info-item-value"},TM={key:0,class:"price-info-item"},MM={class:"price-info-item-label"},LM={class:"price-info-item-value"},wM={class:"price-info-item"},DM={class:"price-info-item-label"},OM={class:"price-info-item-value"},IM={class:"price-info-item"},xM={class:"price-info-item-label"},_M={class:"price-info-item-value"},AM={class:"input-content"},RM={class:"input-content-item"},FM={key:0,class:"input-content-error"},EM={class:"input-content-description-value"},BM={class:"input-content"},zM={key:0,class:"input-content-item"},$M={key:1,class:"input-content-error"},NM={class:"description-content"},UM=$n(A({__name:"index",props:{symbol:{type:String,default:""},direction:{type:String,default:Tr.NEUTRAL.value},upperPrice:{type:[Number,String],default:""},lowerPrice:{type:[Number,String],default:""},trailingStop:{type:[Number,String],default:""},trailingStopType:{type:String,default:Xi.DISTANCE},trailingStopActivationPriceChecked:{type:Boolean,default:!1},trailingStopActivationPrice:{type:[Number,String],default:""},trailingStopActivationType:{type:String,default:zt.enableLastPriceDependentUI?ui.LAST_PRICE:ui.MARK_PRICE},entryPrice:{type:[Number,String],default:""},isFromForm:{type:Boolean,default:!1}},emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=e,u=k(),{t:g}=G(),f=Ir(),v=M((()=>f.isMobile)),y=T(r.trailingStop),b=T(r.trailingStopType),C=M((()=>b.value===Xi.DISTANCE)),P=M((()=>`${Qt(y.value||0,{})}${C.value?"":"%"}`)),L=M((()=>u.state.futures.futuresMarkPriceMap[r.symbol])),w=M((()=>u.state.futures.futuresLastPriceMap[r.symbol])),D=M((()=>S(L.value).times(10).dp(2,S.ROUND_DOWN).toNumber())),O=M((()=>{if(C.value){const e=S(L.value).times(.99).dp(2);return e.isPositive()?e.toNumber():0}return 100})),I=M((()=>u.state.futures.fixedCurrency)),_=M((()=>{var e,t;return(null==(t=null==(e=u.state.futures.marketMap)?void 0:e[r.symbol])?void 0:t.priceFilter)??1})),A=M((()=>u.getters["futures/marketDetail"]));function R(e){return Qt(e,{formatKey:_.value,defaultValue:"-"})}const F=M((()=>r.direction===Tr.LONG.value)),E=M((()=>F.value?"trading.bot.trailingStop.hint.long":"trading.bot.trailingStop.hint.short")),B=M((()=>C.value?`${y.value?Qt(y.value,{}):"-"} ${I.value}`:`${y.value||"-"}%`)),z=M((()=>C.value?g("trading.bot.trailingStop.distance.error",{price:O.value}):g("trading.bot.trailingStop.percentage.error"))),$=M((()=>g("trading.bot.trailingStop.activationPrice.error",{price:D.value})));function N(){y.value="",b.value=Xi.DISTANCE}const U=T(r.trailingStopActivationPriceChecked),H=T(Ar(r.trailingStopActivationType,{disabledValue:ui.LAST_PRICE,fallbackValue:ui.MARK_PRICE,isDisabled:!zt.enableLastPriceDependentUI})),V=T(r.trailingStopActivationPrice),W=M((()=>`${g("t.start")}${U.value&&V.value?` (${Qt(V.value||"",{})})`:""}`)),q=M((()=>"0"!==y.value)),K=M((()=>!U.value||(""===V.value||null===V.value||Number(V.value)>0)));function Q(){i("dialog:closed",{trailingStop:y.value,trailingStopType:b.value,trailingStopActivationPriceChecked:U.value,trailingStopActivationPrice:y.value?V.value:"",trailingStopActivationType:H.value})}function j(){const e=!U.value;U.value=e,e||(V.value="")}function Y(e){V.value=""===e?"":Number(e)}function Z(e){H.value=e}function X(){V.value=""}return(t,r)=>{const u=a("i18n-t"),g=a("BaseButton");return o(),n(Mi,{class:"trailing-stop-dialog",width:v.value?"90%":"480px",
1isBrandNewStyle:"",onClosed:r[2]||(r[2]=e=>i("dialog:closed",!1))},{header:s((()=>[l("div",yM,m(t.$t("futuresMain.trade.trailingStop")),1)])),body:s((()=>[l("div",bM,[l("div",SM,[l("div",CM,[l("div",PM,m(t.$t("strategy.priceRange")),1),l("div",kM,m(e.lowerPrice?x(Qt)(e.lowerPrice,{}):"-")+" ~ "+m(e.upperPrice?x(Qt)(e.upperPrice,{}):"-"),1)]),e.isFromForm?h("",!0):(o(),c("div",TM,[l("div",MM,m(t.$t("futuresMain.openPosition.entryPrice")),1),l("div",LM,m(R(e.entryPrice)),1)])),l("div",wM,[l("div",DM,m(t.$t("spot.order.market.markPrice")),1),l("div",OM,m(R(L.value)),1)]),l("div",IM,[l("div",xM,m(t.$t("spot.order.market.lastPrice")),1),l("div",_M,m(R(w.value)),1)])]),l("div",AM,[l("div",RM,[d(FT,{value:y.value,"onUpdate:value":r[0]||(r[0]=e=>y.value=e),type:b.value,"onUpdate:type":r[1]||(r[1]=e=>b.value=e),class:"price-percent-input",step:.01,min:C.value?.01:.1,max:O.value,currency:I.value,placeholder:C.value?">0":"â¥0.1","distance-tooltip":t.$t("trading.bot.trailingStop.type.tooltip"),"percentage-tooltip":t.$t("trading.bot.trailingStop.type.tooltip"),priceFilter:C.value?_.value:2,errorShown:!q.value,hidePercentActions:""},null,8,["value","type","min","max","currency","placeholder","distance-tooltip","percentage-tooltip","priceFilter","errorShown"]),v.value?h("",!0):(o(),c("div",{key:0,class:"clear-btn",onClick:N},[d(At,{class:"icon-cross"})]))]),q.value?(o(),n(u,{key:1,keypath:E.value,class:"input-content-description",tag:"p"},{value:s((()=>[l("span",EM,m(B.value),1)])),_:1},8,["keypath"])):(o(),c("p",FM,m(z.value),1))]),l("div",BM,[d(BT,{value:U.value,orderType:"history.order.filter.type.trailingStopMarket",tooltip:t.$t("trading.bot.trailingStop.activationPrice.tooltip"),class:"form-checkbox","onUpdate:value":j},null,8,["value","tooltip"]),U.value?(o(),c("div",zM,[d(NT,{class:"price-percent-input",max:D.value,checked:U.value,price:V.value,step:Number(A.value.minPriceIncrement),quoteCurrency:I.value,priceType:H.value,priceFilter:_.value,errorShown:!K.value,walletType:"bot","onUpdate:price":Y,"onUpdate:priceType":Z},null,8,["max","checked","price","step","quoteCurrency","priceType","priceFilter","errorShown"]),v.value?h("",!0):(o(),c("div",{key:0,class:"clear-btn",onClick:X},[d(At,{class:"icon-cross"})]))])):h("",!0),K.value?h("",!0):(o(),c("p",$M,m($.value),1))]),d(vM,{isLong:F.value,inputDisplay:P.value,activationPriceDisplay:W.value},null,8,["isLong","inputDisplay","activationPriceDisplay"]),l("div",NM,m(t.$t("trading.bot.trailingStop.decription",{symbol:e.symbol})),1),d(g,{class:"primary",disabled:!q.value||!K.value,onClick:Q},{default:s((()=>[p(m(t.$t("t.confirm")),1)])),_:1},8,["disabled"])])])),_:1},8,["width"])}}}),[["__scopeId","data-v-f2fc6660"]]),HM={class:"trailing-wrap"},VM={key:0,class:"enable-wrap"},WM={class:"price-wrap"},qM=A({__name:"TrailingStop",props:{isHistory:{type:Boolean,default:!1},state:{default:""},direction:{},detail:{},formatPrice:{type:Function},botId:{},symbol:{}},setup(e){const{t:t}=G(),i=k(),r=M((()=>!e.isHistory&&!oo(e.state))),a=M((()=>e.detail.exitCondition)),u=M((()=>{var e;return!!(null==(e=a.value)?void 0:e.trailingStop)})),f=M((()=>e.detail.isTrailingStopActive)),v=M((()=>e.detail.trailingStopActivationDirection)),y=M((()=>e.detail.trailingStopEstPrice)),{formattedTrailingStop:b,formattedActivationPrice:S,formattedTrailingStopWithEstPrice:P,condition:L,arrowClass:w,activationPrice:D,activationPriceType:O,trailingStopPercentageValue:I}=_T({exitCondition:a,direction:e.direction,formatPrice:e.formatPrice,trailingStopActivationDirection:v,trailingStopEstPrice:y}),_=M((()=>
1{if(!e.isHistory){const e=O.value===ui.MARK_PRICE?"trading.mark":"trading.last",i=D.value?t(e).toLowerCase():"";return t("trading.bot.trailingStop.activationTooltip",{priceType:i,condition:L.value,price:D.value})}return f.value?t("trading.bot.trailingStop.activated",{price:S.value}):t("trading.bot.trailingStop.notActivated",{price:S.value})})),A=T(!1);function R(){A.value=!0}async function F(t){if(!t)return;const r={exitCondition:fT(IT(t),e.detail.exitCondition),botStopAction:e.detail.botStopAction};try{await Cr.updateTradingBot(e.botId,{config:r}),i.dispatch("futures/fetchGridBotList")}finally{A.value=!1}}return(e,t)=>{var i,v,y,k,T,M;return o(),c(g,null,[l("div",HM,[u.value?(o(),c("div",VM,[l("div",WM,[d($p,{active:f.value,class:"flashing-ball"},null,8,["active"]),f.value?(o(),c(g,{key:0},[e.isHistory?(o(),n(ei,{key:0,tooltip:_.value},{content:s((()=>[d(Oi,{class:C(x(w))},null,8,["class"]),p(" "+m(x(b)),1)])),_:1},8,["tooltip"])):(o(),c(g,{key:1},[d(Oi,{class:C(x(w))},null,8,["class"]),p(" "+m(x(P)),1)],64))],64)):(o(),n(ei,{key:1,tooltip:_.value,class:"inactive"},{content:s((()=>[e.isHistory?(o(),c(g,{key:0},[d(Oi,{class:C(x(w))},null,8,["class"]),l("span",null,m(x(b)),1)],64)):(o(),c(g,{key:1},[p(m(e.$t("t.activationPrice"))+" ",1),t[1]||(t[1]=l("br",null,null,-1)),p(" "+m(x(S)),1)],64))])),_:1},8,["tooltip"]))]),r.value?(o(),n(oh,{key:0,class:"icon icon-edit",onClick:R})):h("",!0)])):r.value&&"NEUTRAL"!==e.direction?(o(),c(g,{key:1},[l("span",{class:"title",onClick:R},m(e.$t("t.add")),1),d(Fh,{class:"icon",onClick:R})],64)):(o(),c(g,{key:2},[p("-")],64))]),A.value?(o(),n(UM,{key:0,visible:A.value,"onUpdate:visible":t[0]||(t[0]=e=>A.value=e),symbol:e.symbol,direction:e.direction,upperPrice:e.detail.upperPrice,lowerPrice:e.detail.lowerPrice,entryPrice:e.detail.entryPrice,trailingStop:x(I),trailingStopType:null==(i=a.value)?void 0:i.trailingStopType,trailingStopActivationPriceChecked:!!(null==(v=a.value)?void 0:v.trailingStopActivation),trailingStopActivationPrice:null==(k=null==(y=a.value)?void 0:y.trailingStopActivation)?void 0:k.price,trailingStopActivationType:null==(M=null==(T=a.value)?void 0:T.trailingStopActivation)?void 0:M.type,"onDialog:closed":F},null,8,["visible","symbol","direction","upperPrice","lowerPrice","entryPrice","trailingStop","trailingStopType","trailingStopActivationPriceChecked","trailingStopActivationPrice","trailingStopActivationType"])):h("",!0)],64)}}}),GM={name:"FuturesGridListRow",components:{FrontBarCell:rh,SymbolLink:ah,DirectionTag:$f,PnL:Vk,PriceRange:Wk,IconEditLite:oh,Tpsl:wT,TrailingStop:$n(qM,[["__scopeId","data-v-0b4fdde7"]]),IconAlertCircle:Rr,Tooltip:ei},props:{data:{type:Object,required:!0},index:{type:Number,required:!0},isHistory:{type:Boolean,default:!1}},emits:["clickAdjustMargin"],setup(e){const t=M((()=>e.data)),{openModifyGridParamsDialog:i}=$k(t);return{openModifyGridParamsDialog:i}},data:()=>({BotStatus:Fr}),computed:{...b(["lang"]),...b("futures",["marketMap","openPositionMap","marketDetailMap","futuresMarkPriceMap"]),...U(["isUnifiedWallet","isEnableTradingBotUpdateParameter"]),priceFilter(){var e;return(null==(e=this.marketMap[this.data.symbol])?void 0:e.priceFilter)??2},actualQty(){const e=this.marketDetailMap[this.data.symbol],t=(null==e?void 0:e.contractSize)||0,i=(null==e?void 0:e.sizeFilter)||0,r=S(this.data.detail.contractPerStep).times(t).toNumber();return this.$filters.formatNumber(r,{formatKey:i})},showEditMargin(){return this.isUnifiedWallet&&this.data.detail.walletName&&co(this.data.state)},showEditModifyGridParams(){return this.isUnifiedWallet&&this.isEnableTradingBotUpdateParameter&&uo(this.data.state)},isNeutral(){return this.data.direction===Tr.NEUTRAL.value},isLong(){return this.data.direction===Tr.LONG.value},isShort(){return this.data.direction===Tr.SHORT.value},displayMargin(){const e=this.showEditMargin?this.data.detail.botMargin:this.data.detail.initialMargin;return e?this.$filters.formatNumber(e,2):"-"},isOutOfRange(){if(lo(this.data.state)||oo(this.data.state))return!1;const e=this.data.detail.lowerPrice,t=this.data.detail.upperPrice,i=this.data.midPrice;if(!i)return!1;const r=S(i),a=null!=e&&r.lt(e),n=null!=t&&r.gt(t);return a||n},isInsufficient(){return this.data.detail.nonFatalErrorReason===Br.INSUFFICIENT_BALANCE},alertToolTip(){return this.isInsufficient?this.$t("trading.bot.grid.insufficientBalance"):this.isOutOfRange?this.$t("trading.bot.grid.priceOutOfRange"):""},symbolTipBottomAction(){return this.isInsufficient?{text:`${this.$t("trading.increaseMargin")} >`,action:this.handleEditMarginClick}:this.isOutOfRange&&this.isEnableTradingBotUpdateParameter&&this.isUnifiedWallet?{text:`${this.$t("trading.bot.modifyPr
1iceRange")} >`,action:this.openModifyGridParamsDialog}:null}},methods:{getDirectionText:Qn,getSettleInDisplayCurrency:Si,getBotStatusText:so,formatPrice(e){return this.$filters.formatNumber(e,this.priceFilter)},getCloseReasonText(e,t){if(e===Fr.CLOSED)return"-";if(this.$te(Er[t])){let e="";return this.isNeutral?e=this.isLong?this.$t("trading.bot.topPriceStop"):this.$t("trading.bot.bottomPriceStop"):"TOP_PRICE_EXIT_CONDITION_REACHED"===t?e=this.isLong?this.$t("trading.bot.takeProfitPrice"):this.$t("trading.bot.stopLossPrice"):"BOTTOM_PRICE_EXIT_CONDITION_REACHED"===t&&(e=this.isLong?this.$t("trading.bot.stopLossPrice"):this.$t("trading.bot.takeProfitPrice")),this.$t(Er[t],{price:vi(e)})}return t},getDisplayLiqPrice(e){const t=this.data.detail.position||{};return e&&"undefined"!==e?this.$filters.formatNumber(e,{formatKey:this.priceFilter,roundMode:66===t.orderMode?S.ROUND_DOWN:S.ROUND_HALF_UP}):"-"},goToDetail(e,t){this.$router.push({name:ai.FUTURES_GRID_BOT_DETAIL,params:{lang:this.lang,id:e,botId:t}})},handleEditMarginClick(){this.$emit("clickAdjustMargin",{botMargin:this.data.detail.botMargin,symbol:this.data.symbol,botData:this.data})}}},KM={class:"align-center"},QM={class:"direction-wrap"},jM={class:"direction-wrap"},YM={class:"bot-margin"},ZM={class:"unit"},XM={class:"direction-wrap"},JM={class:"direction-wrap"},eL={class:"unit"};const tL=$n(GM,[["render",function(e,t,i,r,u,c){const g=a("FrontBarCell"),f=a("SymbolLink"),v=a("IconAlertCircle"),y=a("Tooltip"),b=a("DirectionTag"),S=a("Cell"),P=a("IconEditLite"),k=a("PnL"),T=a("PriceRange"),M=a("Tpsl"),L=a("TrailingStop"),w=a("Row");return o(),n(w,{index:i.index},{default:s((()=>[d(g,{direction:i.data.direction},null,8,["direction"]),d(S,{textAlign:"left",class:"bold"},{default:s((()=>[l("div",KM,[d(f,{symbol:i.data.symbol},null,8,["symbol"]),i.isHistory||!c.isOutOfRange&&!c.isInsufficient?h("",!0):(o(),n(y,{key:0,tooltip:c.alertToolTip,tipBottomAction:c.symbolTipBottomAction,onlyShowOneInPage:"",popover:"",placement:"bottom-end"},{content:s((()=>[d(v,{class:"color-red",width:"14",height:"14"})])),_:1},8,["tooltip","tipBottomAction"]))]),l("div",QM,[d(b,{direction:i.data.direction,displayText:c.getDirectionText(i.data.direction)},null,8,["direction","displayText"]),d(b,{direction:i.data.direction,displayText:e.$filters.formatNumber(i.data.detail.initialLeverage,{formatKey:2,postfix:"x"})},null,8,["direction","displayText"])])])),_:1}),d(S,{textAlign:"left"},{default:s((()=>[l("div",jM,[l("div",YM,[d(y,{tooltip:c.alertToolTip,hasCursorQuestion:!0,content:c.displayMargin,class:C({bold:!i.isHistory,"color-red":c.isInsufficient}),disable:!c.isInsufficient},null,8,["tooltip","content","class","disable"]),l("p",ZM,m(c.getSettleInDisplayCurrency(i.data.symbol)),1)]),c.showEditMargin?(o(),n(P,{key:0,class:"icon-edit",onClick:c.handleEditMarginClick},null,8,["onClick"])):h("",!0)])])),_:1}),d(S,{textAlign:"left",class:C({bold:!i.isHistory})},{default:s((()=>[d(k,{pnl:i.data.totalProfit,roi:i.data.totalRoi,unit:i.isHistory?c.getSettleInDisplayCurrency(i.data.symbol):"",multiline:""},null,8,["pnl","roi","unit"])])),_:1},8,["class"]),d(S,{textAlign:"left",class:C({bold:!i.isHistory})},{default:s((()=>[l("div",XM,[d(T,{lowerPrice:i.data.detail.lowerPrice,upperPrice:i.data.detail.upperPrice,midPrice:e.midPrice,symbol:i.data.symbol,isOutOfRange:c.isOutOfRange,onOpenModifyGridParamsDialog:r.openModifyGridParamsDialog},null,8,["lowerPrice","upperPrice","midPrice","symbol","isOutOfRange","onOpenModifyGridParamsDialog"]),c.showEditModifyGridParams?(o(),n(P,{key:0,class:"icon-edit",onClick:r.openModifyGridParamsDialog},null,8,["onClick"])):h("",!0)])])),_:1},8,["class"]),d(S,{textAlign:"left",class:C({bold:!i.isHistory})},{default:s((()=>[l("div",JM,[l("span",null,m(i.data.detail.gridNumber),1),c.showEditModifyGridParams?(o(),n(P,{key:0,class:"icon-edit",onClick:r.openModifyGridParamsDialog},null,8,["onClick"])):h("",!0)])])),_:1},8,["class"]),d(S,{textAlign:"left"},{default:s((()=>[l("div",null,[l("span",{class:C({bold:!i.isHistory})},m(c.actualQty),3),l("p",eL,m(i.data.baseCurrency),1)])])),_:1}),d(S,{textAlign:"left",class:C({bold:!i.isHistory})},{default:s((()=>[d(M,{botDetail:i.data,isHistory:i.isHistory},null,8,["botDetail","isHistory"])])),_:1},8,["class"]),d(S,{textAlign:"left",class:C({bold:!i.isHistory})},{default:s((()=>[d(L,{isHistory:i.isHistory,state:i.data.state,direction:i.data.direction,detail:i.data.detail,formatPrice:c.formatPrice,botId:i.data.tradingBotId,symbol:i.data.symbol},null,8,["isHistory","state","direction","detail","formatPrice","botId","symbol"])])),_:1},8,["class"]),i.isHistory?h("",!0):(o(),n(S,{key:0,textAlign:"left",class:"bold"},{default:s((()=>{var t,r;return[p(m(e.$filters.formatNumber(i.data.detail.entryPrice,{formatKey:(null==(r=null==(t=e.marketMap)?void 0:t[i.data.symbol])?void 0:r.priceFilter)??1,defaultValue:"-"})),1)]})),_:1})),i.isHistory?h("",!0):(o(),n(S,{key:1,textAlign:"left",class:"bold"},{default:s((()=>[p(m(c.getDisplayLiqPrice(i.data.detail.liquidationPrice)),1)])),_:1})),i.isHistory?(o(),n(S,{key:2,textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.data.closedAt,"yyyy-MM-dd"))+" ",1),t[0]||(t[0]=l("br",null,null,-1)),p(" "+m(e.$filters.formatDate(i.data.closedAt,"HH:mm")),1)])),_:1,__:[0]})):h("",!0),d(S,{textAlign:"left",class:C({bold:!i.isHistory})},{default:s((()=>[p(m(i.data.duration),1)])),_:1},8,["class"]),i.isHistory?h("",!0):(o(),n(S,{key:3,textAlign:"left",class:"bold"},{default:s((()=>[p(m(e.$filters.formatDate(i.data.createdAt,"yyyy-MM-dd"))+" ",1),t[1]||(t[1]=l("br",null,null,-1)),p(" "+m(e.$filters.formatDate(i.data.createdAt,"HH:mm")),1)])),_:1,__:[1]})),d(S,{textAlign:"left",class:C({bold:!i.isHistory})},{default:s((()=>[l("span",{class:C({"brand-color-negative":i.data.state===u.BotStatus.DEACTIVATED,"color-yellow":i.data.state===u.BotStatus.STOPPED_HOLDING})},m(c.getBotStatusText(i.data.state)),3)])),_:1},8,["class"]),i.isHistory?(o(),n(S,{key:4,textAlign:"left"},{default:s((()=>[l("span",{class:C(["reason-text",{"brand-color-negative":i.data.state===u.BotStatus.DEACTIVATED}])},m(c.getCloseReasonText(i.data.state,i.data.reason)),3)])),_:1})):h("",!0)])),_:1},8,["index"])}],["__scopeId","data-v-2667ad9c"]]);const iL=$n({name:"DetailButton",components:{IconDetail2:$n({name:"IconDetail2",components:{Icon:Ee},props:{width:{type:[Number,String],default:14},height:{type:[Number,String],default:14}},emits:["click"]},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:i.width,height:i.height,viewBox:"0 0 14 14","aria-label":"Detail Icon","fill-rule":"evenodd",onClick:t[0]||(t[0]=t=>e.$emit("click",t))},{default:s((()=>t[1]||(t[1]=[l("path",{d:"M9.625 2.66492H4.375C3.89175 2.66492 3.5 3.05667 3.5 3.53992V10.5399C3.5 11.0232 3.89175 11.4149 4.375 11.4149H6.125C6.36662 11.4149 6.5625 11.6108 6.5625 11.8524C6.5625 12.094 6.36662 12.2899 6.125 12.2899H4.375C3.4085 12.2899 2.625 11.5064 2.625 10.5399V3.53992C2.625 2.57342 3.4085 1.78992 4.375 1.78992H9.625C10.5915 1.78992 11.375 2.57342 11.375 3.53992V7.43747C11.375 7.67909 11.1791 7.87497 10.9375 7.87497C10.6959 7.87497 10.5 7.67909 10.5 7.43747V3.53992C10.5 3.05667 10.
11082 2.66492 9.625 2.66492Z"},null,-1),l("path",{d:"M9.625 4.81247C9.625 5.05409 9.42912 5.24997 9.1875 5.24997H4.8125C4.57088 5.24997 4.375 5.05409 4.375 4.81247C4.375 4.57084 4.57088 4.37497 4.8125 4.37497H9.1875C9.42912 4.37497 9.625 4.57084 9.625 4.81247Z"},null,-1),l("path",{d:"M7.4375 7.87497C7.67912 7.87497 7.875 7.67909 7.875 7.43747C7.875 7.19584 7.67912 6.99997 7.4375 6.99997H4.8125C4.57088 6.99997 4.375 7.19584 4.375 7.43747C4.375 7.67909 4.57088 7.87497 4.8125 7.87497H7.4375Z"},null,-1),l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.2278 8.21653C9.95494 7.76116 9.29506 7.76115 9.02218 8.21653L8.87325 8.46507C8.84124 8.51848 8.77806 8.54466 8.71766 8.52952L8.4366 8.45909C7.92165 8.33004 7.45504 8.79665 7.58409 9.3116L7.65452 9.59266C7.66966 9.65306 7.64348 9.71624 7.59007 9.74825L7.34153 9.89718C6.88616 10.1701 6.88615 10.8299 7.34153 11.1028L7.59007 11.2518C7.64348 11.2838 7.66966 11.3469 7.65452 11.4073L7.58409 11.6884C7.45504 12.2034 7.92165 12.67 8.4366 12.5409L8.71766 12.4705C8.77806 12.4553 8.84124 12.4815 8.87325 12.5349L9.02218 12.7835C9.29506 13.2388 9.95494 13.2388 10.2278 12.7835L10.3768 12.5349C10.4088 12.4815 10.4719 12.4553 10.5323 12.4705L10.8134 12.5409C11.3284 12.67 11.795 12.2034 11.6659 11.6884L11.5955 11.4073C11.5803 11.3469 11.6065 11.2838 11.6599 11.2518L11.9085 11.1028C12.3638 10.8299 12.3638 10.1701 11.9085 9.89718L11.6599 9.74825C11.6065 9.71624 11.5803 9.65306 11.5955 9.59266L11.6659 9.3116C11.795 8.79665 11.3284 8.33004 10.8134 8.45909L10.5323 8.52952C10.4719 8.54466 10.4088 8.51848 10.3768 8.46507L10.2278 8.21653ZM9.50377 8.50512C9.55864 8.41354 9.69135 8.41353 9.74623 8.50512L9.89517 8.75366C10.0543 9.01923 10.3685 9.14937 10.6688 9.07411L10.9499 9.00368C11.0534 8.97773 11.1473 9.07157 11.1213 9.17513L11.0509 9.45618C10.9756 9.7565 11.1058 10.0707 11.3713 10.2298L11.6199 10.3788C11.7115 10.4336 11.7115 10.5664 11.6199 10.6212L11.3713 10.7702C11.1058 10.9293 10.9756 11.2435 11.0509 11.5438L11.1213 11.8249C11.1473 11.9284 11.0534 12.0223 10.9499 11.9963L10.6688 11.9259C10.3685 11.8506 10.0543 11.9808 9.89517 12.2463L9.74623 12.4949C9.69135 12.5865 9.55864 12.5865 9.50377 12.4949L9.35483 12.2463C9.19569 11.9808 8.8815 11.8506 8.58118 11.9259L8.30013 11.9963C8.19657 12.0223 8.10273 11.9284 8.12868 11.8249L8.19911 11.5438C8.27437 11.2435 8.14423 10.9293 7.87866 10.7702L7.63012 10.6212C7.53853 10.5664 7.53853 10.4336 7.63012 10.3788L7.87866 10.2298C8.14423 10.0707 8.27437 9.7565 8.19911 9.45618L8.12868 9.17513C8.10273 9.07157 8.19657 8.97773 8.30013 9.00368L8.58118 9.07411C8.8815 9.14937 9.19569 9.01923 9.35483 8.75366L9.50377 8.50512ZM8.97112 10.5C8.97112 10.1389 9.26385 9.8462 9.62494 9.8462C9.98604 9.8462 10.2788 10.1389 10.2788 10.5C10.2788 10.8611 9.98604 11.1538 9.62494 11.1538C9.26385 11.1538 8.97112 10.8611 8.97112 10.5ZM9.62494 9.22448C8.92048 9.22448 8.3494 9.79556 8.3494 10.5C8.3494 11.2045 8.92048 11.7756 9.62494 11.7756C10.3294 11.7756 10.9005 11.2045 10.9005 10.5C10.9005 9.79556 10.3294 9.22448 9.62494 9.22448Z"},null,-1)]))),_:1,__:[1]},8,["width","height"])}]])},emits:["click"]},[["render",function(e,t,i,r,s,l){const u=a("IconDetail2");return o(),n(u,{class:"detail-icon",onClick:t[0]||(t[0]=t=>e.$emit("click"))})}],["__scopeId","data-v-57eecb4a"]]);const rL=$n({name:"ShareButton",components:{IconShare:yi},emits:["click"]},[["render",function(e,t,i,r,s,l){const u=a("IconShare");return o(),n(u,{onClick:t[0]||(t[0]=t=>e.$emit("click"))})}],["__scopeId","data-v-0419e533"]]),aL=$n(A({__name:"CloseButton",props:{disabled:{type:Boolean,default:!1}},emits:["click"],setup(e,{emit:t}){const i=t;return(e,t)=>{const r=a("BaseButton"),l=a("Tooltip");return o(),n(l,{placement:"bottom-end",disable:!e.disabled},{content:s((()=>[d(r,{class:"outline-red btn-close",size:"extra-small",disabled:e.disabled,onClick:t[0]||(t[0]=e=>i("click"))},{default:s((()=>[_(e.$slots,"default",{},void 0,!0)])),_:3},8,["disabled"])])),tooltip:s((()=>[p(m(e.$t("t.postOnlyCloseBotDisabled")),1)])),_:3},8,["disable"])}}}),[["__scopeId","data-v-9100aad0"]]),nL={ref:"panel",class:"bot-actions-panel"},oL={class:"panel-header"},sL={class:"actions-wrap"},lL=$n(A({__name:"BotActionsPanel",props:{dataList:{},isHistory:{type:Boolean,default:!1},currentHoverRow:{default:""}},emits:["clickShareBot","clickCloseBot"],setup(e,{emit:t}){const i=t,r=k(),a=le(),u=M((()=>r.state.lang)),f=e=>{if(!e)return!1;const t=r.state.futures.marketMap[e],i=r.state.futures.marketDetailMap[e];return((null==t?void 0:t.marketStatus)||(null==i?void 0:i.marketStatus))===zr.MARKET_OFF_HOURS};return(e,t)=>(o(),c("div",nL,[l("div",oL,m(e.$t("wallets.spotList.actions")),1),(o(!0),c(g,null,R(e.dataList,(t=>(o(),c("div",{key:t.tradingBotId,class:C(["action-row",{hover:t.tradingBotId===e.currentHoverRow}])},[l("div",sL,[d(iL,{class:C({"history-icon":e.isHistory}),onClick:e=>{return i=t.symbol,r=t.tradingBotId,void a.push({name:ai.FUTURES_GRID_BOT_DETAIL,params:{lang:u.value,id:i,botId:r}});var i,r}},null,8,["class","onClick"]),d(rL,{class:C({"history-icon":e.isHistory}),onClick:e=>i("clickShareBot",t)},null,8,["class","onClick"]),e.isHistory?h("",!0):(o(),n(aL,{key:0,class:C({"invisible-btn":x(oo)(t.state)}),disabled:f(t.symbol),onClick:e=>i("clickCloseBot",t)},{default:s((()=>[p(m(x(lo)(t.state)?e.$t("futuresMain.openPosition.closePosition"):e.$t("trading.bot.closeBot")),1)])),_:2}
1,1032,["class","disabled","onClick"]))])],2)))),128))],512))}}),[["__scopeId","data-v-72fc9fbc"]]);const uL=$n({name:"FuturesGridBotDataTable",components:{FuturesGridListRow:tL,NoDataAvailable:it,TableWithActionsPanel:gy,BotActionsPanel:lL,Tooltip:ei},props:{dataList:{type:Array,default:()=>[]}},data:()=>({currentHoverRow:""}),computed:{...U(["isUnifiedWallet","isNightTheme"]),headerList(){return[{id:"frontBar",textAlign:"left",class:"front-bar-header-cell"},{id:"symbol",lang:this.$t("futuresMain.symbol"),textAlign:"left"},{id:"initialMargin",lang:this.isUnifiedWallet?this.$t("trading.botMargin"):this.$t("futuresMain.changeRiskLimit.initialMargin"),textAlign:"left"},{id:"totalPnL",lang:this.$t("trading.bot.grid.totalPnl"),textAlign:"left",tooltip:this.$t("trading.bot.tooltip.totalPnl")},{id:"priceRange",lang:this.$t("strategy.priceRange"),textAlign:"left"},{id:"noOfGrids",lang:this.$t("trading.bot.noOfGrids"),textAlign:"left"},{id:"qtyOrder",lang:this.$t("trading.bot.grid.qtyOrder"),textAlign:"left"},{id:"tpsl",lang:this.$t("t.tpsl"),textAlign:"left"},{id:"trailingStop",lang:this.$t("futuresMain.trade.trailingStop"),textAlign:"left"},{id:"entryPrice",lang:this.$t("futuresMain.openPosition.entryPrice"),textAlign:"left"},{id:"liqPrice",lang:this.$t("futuresMain.order.liquidation"),textAlign:"left"},{id:"duration",lang:this.$t("t.duration"),textAlign:"left"},{id:"createdAt",lang:this.$t("t.createTime"),textAlign:"left"},{id:"status",lang:this.$t("t.status"),textAlign:"left"}]},emptyOrderData(){return!this.dataList||0===this.dataList.length}},errorCaptured:(e,t,i)=>(ps(e),!1),methods:{setCurrentHoverRow(e){this.currentHoverRow=e}}},[["render",function(e,t,i,r,l,u){const h=a("Tooltip"),f=a("Cell"),v=a("HeaderRow"),y=a("FuturesGridListRow"),b=a("NoDataAvailable"),S=a("DataTable"),P=a("BotActionsPanel"),k=a("TableWithActionsPanel");return o(),n(k,{style:{"--bot-panel-text-align":"right","--table-wrapper-height":"100%"}},te({table:s((()=>[d(S,{isEmpty:u.emptyOrderData},{header:s((()=>[d(v,null,{default:s((()=>[(o(!0),c(g,null,R(u.headerList,(e=>(o(),n(f,{key:e.id,textAlign:e.textAlign,class:C(e.class)},{default:s((()=>[e.tooltip?(o(),n(h,{key:0,tooltip:e.tooltip},{content:s((()=>[p(m(e.lang),1)])),_:2},1032,["tooltip"])):(o(),c(g,{key:1},[p(m(e.lang),1)],64))])),_:2},1032,["textAlign","class"])))),128))])),_:1})])),body:s((()=>[(o(!0),c(g,null,R(i.dataList,((i,r)=>(o(),n(y,O({ref_for:!0},e.$attrs,{key:i.tradingBotId,data:i,index:r,onMouseover:e=>u.setCurrentHoverRow(i.tradingBotId),onMouseleave:t[0]||(t[0]=e=>u.setCurrentHoverRow(""))}),null,16,["data","index","onMouseover"])))),128))])),empty:s((()=>[d(b,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["isEmpty"])])),_:2},[u.emptyOrderData?void 0:{name:"actions",fn:s((()=>[d(P,O(e.$attrs,{dataList:i.dataList,currentHoverRow:l.currentHoverRow}),null,16,["dataList","currentHoverRow"])])),key:"0"}]),1024)}],["__scopeId","data-v-e5647555"]]),cL="increase",dL="decrease",pL={name:"AdjustBotMarginDialog",components:{EditDialog:Ev,IconArrowRight:Oi,IconChevronDown:Ze,FuturesChoose:om,TradingInput:Wn,PercentSlider:Kh},props:{visible:{type:Boolean,required:!0},currentMarginProp:{type:[Number,String],default:0},botSymbol:{type:String,default:""},botData:{type:Object,default:()=>({})},position:{type:Object,default:null}},emits:["update:visible"],setup(e){const t=ci(),i=Mr(),r=M((()=>e.botSymbol)),{midPrice:a}=JC(r);return{takerFee:t.takerFee,tradingBotInitDataStore:i,orderbookMidPrice:a}},data:()=>({FUTURES_BASE_CURRENCY:ht,SPOT_WALLET_KEY:$r,CROSS_WALLET_NAME:xi,selectedType:cL,adjustInputValue:"",sliderValue:0,isLoading:!1,pinnedPositionMargin:null,botPosition:null,isSelfSubscribed:!1,openWalletDropDown:!1,selectedWallet:xi}),computed:{...b(["includeUnrealizedPnl","currencyMap"]),...b("futures",{futuresWalletMap:"walletMap",futuresMarketMap:"marketMap",futuresMarketDetailMap:"marketDetailMap",futuresMarkPriceMap:"futuresMarkPriceMap"}),...U("futures",["currentMargin","maintenanceMarginPercentage","gridBotAvailableBalance"]),isShow:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},isIncrease(){return this.selectedType===cL}
1,adjustTypeList(){return[{id:cL,lang:this.$t("t.increase")},{id:dL,lang:this.$t("t.decrease")}]},isolatedWalletName(){var e;return null==(e=this.botData.detail.walletName)?void 0:e.replace("-USDT","-USD")},isolatedWallet(){var e;return(null==(e=this.futuresWalletMap)?void 0:e[this.isolatedWalletName])||{}},initialMarginAdjConf(){var e,t;return null==(t=null==(e=this.tradingBotInitDataStore.tradingBotInitData.futures)?void 0:e.grid)?void 0:t.initialMarginAdjConf},stepPrice(){const{lowerPrice:e,upperPrice:t,gridNumber:i}=this.botData.detail;return Xn({upperPrice:Number(t),lowerPrice:Number(e),gridNumber:Number(i),priceFilter:this.priceFilter})},sumOfGridPrices(){if(!this.stepPrice)return null;const{lowerPrice:e,upperPrice:t,gridNumber:i}=this.botData.detail;return this.isNeutral?io({stepPrice:this.stepPrice,midPrice:this.orderbookMidPrice,gridNumber:Number(i),lowerPrice:Number(e),priceFilter:this.priceFilter}):ro({stepPrice:this.stepPrice,upperPrice:Number(t),lowerPrice:Number(e),isLong:this.isLong,priceFilter:this.priceFilter,gridNumber:Number(i)})},isFromSpotWallet(){return this.selectedWallet===$r},spotAvbl(){var e;return S((null==(e=this.currencyMap[ht])?void 0:e.available)||0).dp(2,S.ROUND_DOWN).toNumber()},gridBotAvbl(){return S(this.gridBotAvailableBalance||0).dp(2,S.ROUND_DOWN).toNumber()},maxPossibleValue(){if(this.isIncrease)return this.isFromSpotWallet?this.spotAvbl:this.gridBotAvbl;const{walletTotalValue:e,unrealisedProfitLoss:t}=this.isolatedWallet,i=S(t).lt(0)?t:0,{contractPerStep:r,initialLeverage:a}=this.botData.detail,{contractSize:n=1}=this.marketDetail,o=S(r).times(n),s=this.getAdjConfig();if(!this.sumOfGridPrices||!s)return 0;const l=S(this.sumOfGridPrices).times(o).div(a).div(s),u=S(e).minus(l).minus(S(i).abs()).times(.99);return S.max(u,0).dp(2,S.ROUND_DOWN).toNumber()},showInputError(){return!!this.adjustInputValue&&S(this.adjustInputValue).gt(this.maxPossibleValue)},disableConfirm(){return this.showInputError},symbol(){var e;return(null==(e=this.botPosition)?void 0:e.symbol)||this.botSymbol},market(){return this.futuresMarketMap[this.symbol]||{}},marketDetail(){return this.futuresMarketDetailMap[this.symbol]||{}},isNeutral(){return this.botData.direction===Tr.NEUTRAL.value},isLong(){return this.botData.direction===Tr.LONG.value},isBuySide(){var e;return"MODE_BUY"===(null==(e=this.botPosition)?void 0:e.orderModeName)},markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},priceFilter(){return this.market.priceFilter??2},currentPositionMargin(){return+this.currentMarginProp?+this.currentMarginProp:this.isolatedWallet.marginBalance||0},displayCurrentPositionMargin(){return this.$filters.formatNumber(this.currentPositionMargin,{formatKey:2,postfix:` ${ht}`})},displayCurrentLiqPrice(){var e;return this.botPosition?this.$filters.formatNumber((null==(e=this.botPosition)?void 0:e.liquidationPrice)||0,{formatKey:this.priceFilter,roundMode:this.isBuySide?S.ROUND_DOWN:S.ROUND_HALF_UP,postfix:` ${ht}`}):"-"},displayNewPositionMargin(){if(!this.adjustInputValue||"0"===this.adjustInputValue)return this.displayCurrentPositionMargin;const e=this.estimatedMarginAdjustment.newPositionMargin||0;return this.$filters.formatNumber(e,{formatKey:2,postfix:` ${ht}`})},displayNewLiqPrice(){var e;if(!this.botPosition)return"-";const t=(null==(e=this.botPosition)?void 0:e.liquidationPrice)||0,i=this.estimatedMarginAdjustment.estimatedLiquidationPrice||0;if(this.isBuySide&&t<i)return"-";if(!this.isBuySide&&t>i)return"-";if(!this.adjustInputValue||"0"===this.adjustInputValue)return this.displayCurrentLiqPrice;const r=Math.max(i,0);return this.$filters.formatNumber(r,{formatKey:this.priceFilter,postfix:` ${ht}`})},estimatedMarginAdjustment(){var e;const{isolatedLeverage:t,entryPrice:i,totalContracts:r}=this.botPosition||{},{contractSize:a=1,initialMarginMarkup:n=Ii}=this.marketDetail,{fundingRate:o=0}=this.market,s=(null==(e=this.isolatedWallet)?void 0:e.availableBalance)||0,l=r?this.isBuySide?r:-r:0,u={adjustment:{adjustmentType:this.isIncrease?"INCREASE":"DECREASE",amount:this.adjustInputValue,contractSize:a,markPrice:this.markPrice},orderConfig:{leverage:t||this.botData.detail.initialLeverage,takerFee:this.takerFee,maintenanceMarginRatio:this.maintenanceMarginPercentage(this.symbol),fundingRate:o,adjConf:n,isMarginIncludeUnrealizedPnl:this.includeUnrealizedPnl},curState:{availableBalance:s,positionMargin:this.pinnedPositionMargin??this.currentPositionMargin,entryPrice:i,positionSize:l}};return xv({shareLib:this.$shareLib,wasmFunction:Ro,params:u,defaultResult:{estimatedLiquidationPrice:0,newPositionMargin:0}})},getTopics(){return`all-position-isolated-wallet:${this.symbol}-${ht}:${this.botData.detail.walletName}`}},watch:{position:{handler(e){e?(this.botPosition=e,this.stopSelfSubscribeIfNeeded()):this.startSelfSubscribeIfNeeded()},immediate:!0}},created(){this.toggleHideInsufficientBalancePopup(!0)},beforeUnmount(){this.stopSelfSubscribeIfNeeded(),this.toggleHideInsufficientBalancePopup(!1)},methods:{...f(Vn,["toggleHideInsufficientBalancePopup"]),...f(Ri,["extraSubscribe","unSubscribeTopics"]),startSelfSubscribeIfNeeded(){this.isSelfSubscribed||(this.extraSubscribe({topics:[this.getTopics],callbacks:{[this.getTopics]:e=>{this.botPosition=e[0]}}}),this.isSelfSubscribed=!0)},stopSelfSubscribeIfNeeded(){this.isSelfSubscribed&&(this.unSubscribeTopics({topics:[this.getTopics]}),this.isSelfSubscribed=!1)},getAdjConfig(){return this.initialMarginAdjConf?this.isNeutral?this.initialMarginAdjConf.neutral:this.isLong?this.initialMarginAdjConf.long:this.initialMarginAdjConf.short:null},onUpdateSelectedType(){this.adjustInputValue=0,this.sliderValue=0},onAdjustInputChange(e){this.sliderValue=e?S(e).div(this.maxPossibleValue).times(100).dp(0,S.ROUND_HALF_UP).toNumber():0},onSliderChange(e){this.sliderValue=e,this.adjustInputValue=S(this.maxPossibleValue).times(e).div(100).dp(2,S.ROUND_DOWN).toNumber()},onClickMaxButton(){this.adjustInputValue=this.maxPossibleValue,this.onAdjustInputChange(this.maxPossibleValue)},onWalletTypeClick(e){this.selectedWallet=e,this.adjustInputValue=0,this.onAdjustInputChange(0),this.openWalletDropDown=!1},async submit(){if(this.isLoading)return;if(!Number(this.adjustInputValue))return void(this.isShow=!1);const e={assets:[{currency:ht,amount:this.isIncrease?this.adjustInputValue:-this.adjustInputValue}],walletSrc:this.isFromSpotWallet&&this.isIncrease?$r:xi};try{this.isLoading=!0,this.pinnedPositionMargin=this.currentPositionMargin,await Cr.botTransfer(this.botData.tradingBotId,e),setTimeout((()=>{this.isShow=!1,this.isLoading=!1}),1e3)}catch(t){}finally{this.isLoading=!1}}}},hL={class:"margin-adjustment-control"},mL={class:"max-adjust-wrap"},gL={class:"data-label adjust-label"},fL={key:0,class:"increase-wrap"},vL={class:"data-label adjust-label"},yL={class:"data-value"},bL={key:0,class:"wallet-drop-down"},SL={key:1,class:"decrease-wrap"},CL={class:"data-label adjust-label"},PL={class:"data-value"},kL={class:"adjust-value-wrap"},TL={class:"slider-wrap"},ML={class:"margin-adjustment-preview"},LL={class:"info-block"},wL={class:"position-data"},DL={class:"data-label"},OL={class:"data-value"},IL={class:"position-data"},xL={class:"data-label"},_L={class:"data-value"},AL={class:"divider-block"},RL={class:"icon-arrow-wrap"},FL={class:"info-block"},EL={class:"position-data"},BL={class:"data-label"},zL={class:"data-value"},$L={class:"position-data"},NL={class:"data-label"},UL={class:"data-value"};const HL=$n(pL,[["render",function(e,t,i,r,u,g){const f=a("IconChevronDown"),v=a("Tooltip"),y=a("FuturesChoose"),b=a("TradingInput"),S=a("PercentSlider"),P=a("IconArrowRight"),k=a("EditDialog");return o(),n(k,{visible:g.isShow,"onUpdate:visible":t[6]||(t[6]=e=>g.isShow=e),title:e.$t("futuresMain.adjustMargin"),disableConfirm:g.disableConfirm,isLoading:u.isLoading,onClickConfirm:g.submit},{content:s((()=>[l("div",hL,[l("div",mL,[l("div",gL,m(e.$t("margin.usdt")),1),g.isIncrease?(o(),c("div",fL,[l("div",vL,[p(m(e.$t("t.from"))+" ",1),l("span",yL,m(g.isFromSpotWallet?e.$t("t.spotWallet"):e.$t("wallets.futuresWallet")),1),p(" "+m(e.$t("trading.bot.avbl"))+": ",1)]),l("div",{class:"data-value cursor-pointer",onClick:t[0]||(t[0]=e=>u.openWalletDropDown=!u.openWalletDropDown)},[p(m(`${e.$filters.formatNumber(g.maxPossibleValue)} ${u.FUTURES_BASE_CURRENCY}`)+" ",1),d(f,{class:"icon",width:"16",height:"16"})]),u.openWalletDropDown?(o(),c("div",bL,[l("div",{class:C(["wallet-drop-down-item",{selected:g.isFromSpotWallet}]),onClick:t[1]||(t[1]=e=>g.onWalletTypeClick(u.SPOT_WALLET_KEY))},[l("span",null,m(e.$t("t.spotWallet")),1),l("span",null,m(e.$filters.formatNumber(g.spotAvbl))+" "+m(u.FUTURES_BASE_CURRENCY),1)],2),l("div",{class:C(["wallet-drop-down-item",{selected:!g.isFromSpotWallet}]),onClick:t[2]||(t[2]=e=>g.onWalletTypeClick(u.CROSS_WALLET_NAME))},[l("span",null,m(e.$t("wallets.futuresWallet")),1),l("span",null,m(e.$filters.formatNumber(g.gridBotAvbl))+" "+m(u.FUTURES_BASE_CURRENCY),1)],2)])):h("",!0)])):(o(),c("div",SL,[l("div",CL,[d(v,{tooltip:e.$t("max.decrease.possibile.tip2"),content:e.$t("max.decrease.possibile")},null,8,["tooltip","content"])]),l("div",PL,m(`${e.$filters.formatNumber(g.maxPossibleValue)} ${u.FUTURES_BASE_CURRENCY}`),1)]))]),l("div",kL,[d(y,{form:u.selectedType,"onUpdate:form":[t[3]||(t[3]=e=>u.selectedType=e),g.onUpdateSelectedType],class:"adjust-type-select",items:g.adjustTypeList},null,8,["form","items","onUpdate:form"]),d(b,{value:u.adjustInputValue,"onUpdate:value":t[5]||(t[5]=e=>u.adjustInputValue=e),class:"adjust-input",enableThousandSeparator:"",step:.01,maxDecimalPlaces:2,min:0,max:g.maxPossibleValue,errorShown:g.showInputError,onInput:g.onAdjustInputChange},{content:s((()=>[l("span",{class:"max-button",onClick:t[4]||(t[4]=(...e)=>g.onClickMaxButton&&g.onClickMaxButton(...e))},m(e.$t("amount-max")),1)])),_:1},8,["value","max","errorShown","onInput"])]),l("div",TL,[d(S,{value:u.sliderValue,showPercentageSign:"",onCh
1ange:g.onSliderChange},null,8,["value","onChange"])])]),l("div",ML,[l("div",LL,[l("div",wL,[l("span",DL,[d(v,{tooltip:e.$t("trading.currentPositionMargin.tip"),content:e.$t("trading.currentBotMargin")},null,8,["tooltip","content"])]),l("span",OL,m(g.displayCurrentPositionMargin),1)]),l("div",IL,[l("span",xL,m(e.$t("trading.currentLiquidationPrice")),1),l("span",_L,m(g.displayCurrentLiqPrice),1)])]),l("div",AL,[t[7]||(t[7]=l("div",{class:"rectangle"},null,-1)),l("div",RL,[d(P,{class:"icon-arrow",width:"12",height:"12"})])]),l("div",FL,[l("div",EL,[l("span",BL,m(e.$t("trading.newBotMargin")),1),l("span",zL,m(g.displayNewPositionMargin),1)]),l("div",$L,[l("span",NL,m(e.$t("trading.newEstLiquidationPrice")),1),l("span",UL,m(g.displayNewLiqPrice),1)])])])])),_:1},8,["visible","title","disableConfirm","isLoading","onClickConfirm"])}],["__scopeId","data-v-0ddf8c5a"]]),VL={name:"FuturesBot",components:{BotDataTable:uL,ConfirmCloseBotDialog:kC,StopGridBotDialog:AC,CloseGridBotPositionDialog:QC,SharePnlDialog:Kn,AdjustBotMarginDialog:HL,Pagination:Nr},data:()=>({confirmCloseBotDialogInfo:{visible:!1,symbol:"",cancelAllOrders:!1,closeAllPositions:!1},stopGridBotDialogInfo:{visible:!1,symbol:"",baseCurrency:"",hasPosition:!1,positionSize:0,defaultIsKeepPosition:!1},closeGridBotPositionDialogInfo:{visible:!1,symbol:"",botId:"",baseCurrency:"",direction:"",size:0},shareBotInfo:{},showShareDialog:!1,tmpBotData:{symbol:"",direction:""},showAdjustBotMarginDialog:!1,adjustBotMarginData:{position:{},botMargin:0,symbol:""},CloseOrderType:fr}),computed:{...b("futures",["futuresBotList","futuresBotListPagination"]),...U("futures",["marketData"]),...U(["isUnifiedWallet","isEnableFuturesGridKeepPosition"]),...y(Ge,["showBotCurrentSymbol"]),filteredBotList(){return this.showBotCurrentSymbol?this.futuresBotList.filter((e=>{var t;return e.symbol===(null==(t=this.marketData)?void 0:t.symbol)})):this.futuresBotList}},methods:{...v("futures",["fetchGridBotList"]),handleClickCloseBot(e){if(this.tmpBotData=e,lo(e.state))return void this.openCloseGridBotPositionDialog(e);if(this.isEnableFuturesGridKeepPosition&&this.isUnifiedWallet)return void this.openStopGridBotDialog(e);const{symbol:t,detail:{botStopAction:{cancelAllOrders:i,closeAllPositions:r}}}=e;this.confirmCloseBotDialogInfo={visible:!0,symbol:t,cancelAllOrders:i,closeAllPositions:r}},openStopGridBotDialog(e){const{symbol:t,baseCurrency:i,detail:{botStopAction:r,position:a}}=e,n=null==a?void 0:a.totalContracts;this.stopGridBotDialogInfo={visible:!0,symbol:t,baseCurrency:i,hasPosition:!!n,positionSize:n?Qe(n,t):0,defaultIsKeepPosition:!r.closeAllPositions}},openCloseGridBotPositionDialog(e){const{symbol:t,baseCurrency:i,direction:r,tradingBotId:a,detail:{position:n}}=e,o=null==n?void 0:n.totalContracts;this.closeGridBotPositionDialogInfo={visible:!0,symbol:t,botId:a,baseCurrency:i,direction:r,size:o?Qe(o,t):0}},handleClickShareBot(e){const{totalRoi:t,detail:{initialLeverage:i}}=e;this.shareBotInfo={...e,leverage:i,percentage:t},this.showShareDialog=!0},handleAdjustMargin(e){this.showAdjustBotMarginDialog=!0,this.adjustBotMarginData=e},async handleConfirmCloseBot({isKeepPosition:e=!1}={}){const{symbol:t,direction:i="NEUTRAL",tradingBotId:r}=this.tmpBotData;await Cr.closeBot(r,{isKeepPosition:e}),this.fetchGridBotList(),e||Li(wi.TRADING_BOT_GRID_BOT_CLOSED,{s1:i.toLowerCase(),s2:"futures",s3:t})},async handleConfirmClosePosition(){const{botId:e}=this.closeGridBotPositionDialogInfo;await Cr.closePosition(e),this.fetchGridBotList()},handlePageChange(e=1){this.fetchGridBotList({page:e})}}},WL={class:"futures-bot"},qL={class:"content-wrap flex-column"},GL={class:"table-wrapper"};const KL=$n(VL,[["render",function(e,t,i,r,s,u){const p=a("BotDataTable"),m=a("Pagination"),g=a("ConfirmCloseBotDialog"),f=a("StopGridBotDialog"),v=a("CloseGridBotPositionDialog"),y=a("SharePnlDialog"),b=a("AdjustBotMarginDialog");return o(),c("div",WL,[l("div",qL,[l("div",GL,[d(p,{dataList:u.filteredBotList,onClickShareBot:u.handleClickShareBot,onClickCloseBot:u.handleClickCloseBot,onClickAdjustMargin:u.handleAdjustMargin},null,8,["dataList","onClickShareBot","onClickCloseBot","onClickAdjustMargin"])]),d(m,{class:"pagination",layout:"prev, pager, next",background:!1,currentPage:e.futuresBotListPagination.currentPage,pageSize:e.futuresBotListPagination.pageSize,totalPages:e.futuresBotListPagination.totalPages,total:e.futuresBotListPagination.totalRows,pagerCount:5,onHandleCurrentChangeP:u.handlePageChange},null,8,["currentPage","pageSize","totalPages","total","onHandleCurrentChangeP"])]),d(g,{visible:s.confirmCloseBotDialogInfo.visible,"onUpdate:visible":t[0]||(t[0]=e=>s.confirmCloseBotDialogInfo.visible=e),symbol:s.confirmCloseBotDialogInfo.symbol,cancelAllOrders:s.confirmCloseBotDialogInfo.cancelAllOrders,closeAllPositions:s.confirmCloseBotDialogInfo.closeAllPositions,onConfirmCloseBot:u.handleConfirmCloseBot},null,8,["visible","symbol","cancelAllOrders","closeAllPositions","onConfirmCloseBot"]),e.isEnableFuturesGridKeepPosition&&e.isUnifiedWallet?(o(),n(f,{key:0,visible:s.stopGridBotDialogInfo.visible,"onUpdate:visible":t[1]||(t[1]=e=>s.stopGridBotDialogInfo.visible=e),symbol:s.stopGridBotDialogInfo.symbol,baseCurrency:s.stopGridBotDialogInfo.baseCurrency,hasPosition:s.stopGridBotDialogInfo.hasPosition,positionSize:s.stopGridBotDialogInfo.positionSize,defaultIsKeepPosition:s.stopGridBotDialogInfo.defaultIsKeepPosition,onConfirm:u.handleConfirmCloseBot},null,8,["visible","symbol","baseCurrency","hasPosition","positionSize","defaultIsKeepPosition","onConfirm"])):h("",!0),d(v,{visible:s.closeGridBotPositionDialogInfo.visible,"onUpdate:visible":t[2]||(t[2]=e=>s.closeGridBotPositionDialogInfo.visible=e),symbol:s.closeGridBotPositionDialogInfo.symbol,baseCurrency:s.closeGridBotPositionDialogInfo.baseCurrency,direction:s.closeGridBotPositionDialogInfo.direction,orderType:s.CloseOrderType.MARKET,size:s.closeGridBotPositionDialogInfo.size,onConfirm:u.handleConfirmClosePosition},null,8,["visible","symbol","baseCurrency","direction","orderType","size","onConfirm"]),s.showShareDialog?(
1o(),n(y,{key:1,show:s.showShareDialog,"onUpdate:show":t[3]||(t[3]=e=>s.showShareDialog=e),position:s.shareBotInfo,isBotSharing:""},null,8,["show","position"])):h("",!0),s.showAdjustBotMarginDialog?(o(),n(b,{key:2,visible:s.showAdjustBotMarginDialog,"onUpdate:visible":t[4]||(t[4]=e=>s.showAdjustBotMarginDialog=e),currentMarginProp:s.adjustBotMarginData.botMargin,botSymbol:s.adjustBotMarginData.symbol,botData:s.adjustBotMarginData.botData},null,8,["visible","currentMarginProp","botSymbol","botData"])):h("",!0)])}],["__scopeId","data-v-ff1f4517"]]),QL={name:"BotHistoryAction",components:{IconHistory:cr,IconAddCircle:Fh},computed:{...b(["lang"]),...y(Ge,["showBotCurrentSymbol"])},methods:{...f(Ge,["setForceOrderFormToGridForm","toggleBotCurrentSymbol"]),goToBotHistory(){this.$router.push({name:ai.TRADING_BOT_HISTORY,params:{lang:this.lang},state:{tradingBotType:Ur.FUTURES_GRID}})},goToBotCreate(){this.setForceOrderFormToGridForm(!0)}}},jL={class:"bot-history-wrap"};const YL=$n(QL,[["render",function(e,t,i,r,n,u){const h=a("Checkbox"),g=a("IconAddCircle"),f=a("IconHistory");return o(),c("div",jL,[d(h,{value:e.showBotCurrentSymbol,"onUpdate:value":e.toggleBotCurrentSymbol},{default:s((()=>[p(m(e.$t("trading.orders.currentTradingPair")),1)])),_:1},8,["value","onUpdate:value"]),l("div",{class:"bot-history-btn-wrapper",onClick:t[0]||(t[0]=(...e)=>u.goToBotCreate&&u.goToBotCreate(...e))},[d(g,{class:"icon"}),l("span",null,m(e.$t("trading.bot.create")),1)]),l("div",{class:"bot-history-btn-wrapper",onClick:t[1]||(t[1]=(...e)=>u.goToBotHistory&&u.goToBotHistory(...e))},[d(f,{class:"icon"}),l("span",null,m(e.$t("trading.bot.history")),1)])])}],["__scopeId","data-v-d8146e1a"]]),{disableLinkOnTrading:ZL,enableFuturesTradingBot:XL}=mt,JL={name:"OrderManagement",components:{OrderTabs:jp,PositionsSettings:Jy,FuturesHistoryAction:YS,TwapOrders:vC,FuturesBot:KL},props:{resizeTrigger:{type:String,default:""}},data:()=>({ORDER_MANAGEMENT_TAB_HEIGHT:41,botListIntervalId:null,Positions:Ny,currentTab:Vp.POSITIONS,containerWidth:0,containerHeight:0}),computed:{...b(["loginState","userConfig"]),...y(pt,["isLeaderMode"]),contentComponent(){switch(this.currentTab){case Vp.POSITIONS:return Ny;case Vp.ORDERS:return fS;case Vp.TRADE_HISTORY:return qS;case Vp.TWAP:return vC;case Vp.BOT:return KL;default:return Ny}},settingComponent(){switch(this.currentTab){case Vp.POSITIONS:return Jy;case Vp.ORDERS:case Vp.TRADE_HISTORY:case Vp.TWAP:return!ZL&&YS;case Vp.BOT:return YL;default:return null}}},watch:{resizeTrigger(){this.$nextTick((()=>{this.debounceGetContainerWH()}))},loginState(){this.loginState||clearInterval(this.botListIntervalId)},isLeaderMode(e){e&&this.currentTab!==Vp.POSITIONS&&this.currentTab!==Vp.ORDERS&&(this.currentTab=Vp.POSITIONS)}},created(){if(this.loginState&&XL){this.fetchGridBotList(),this.botListIntervalId=setInterval((()=>{this.fetchGridBotList({hideCode:!0})}),5e3);const{tabType:e}=history.state;e&&(this.currentTab=e)}window.addEventListener("resize",this.debounceGetContainerWH)},mounted(){this.$nextTick((()=>{this.debounceGetContainerWH()}))},beforeUnmount(){clearInterval(this.botListIntervalId),window.removeEventListener("resize",this.debounceGetContainerWH)},methods:{...v("futures",["fetchGridBotList"]),debounceGetContainerWH:Ne((function(){var e,t;this.containerWidth=null==(e=this.$refs.orderManagement)?void 0:e.clientWidth,this.containerHeight=null==(t=this.$refs.orderManagement)?void 0:t.clientHeight}),100)}},ew={ref:"orderManagement",class:"order-management-wrapper brand-card card-shell"},tw={class:"order-tabs-wrapper card-shell__header"},iw={class:"tabs-container"},rw={class:"setting-container"},aw={class:"content-container card-shell__content"};const nw=$n(JL,[["render",function(e,t,i,r,s,u){const p=a("OrderTabs");return o(),c("div",ew,[l("div",tw,[l("div",iw,[d(p,{currentTab:s.currentTab,"onUpdate:currentTab":t[0]||(t[0]=e=>s.currentTab=e),class:"order-tabs"},null,8,["currentTab"])]),l("div",rw,[(o(),n(F(u.settingComponent),{class:"setting-wrapper",currentTab:s.currentTab},null,8,["currentTab"]))])]),l("div",aw,[(o(),n(F(u.contentComponent),O(e.$attrs,{contentWidth:s.containerWidth,contentHeight:s.containerHeight-s.ORDER_MANAGEMENT_TAB_HEIGHT}),null,16,["contentWidth","contentHeight"]))])],512)}],["__scopeId","data-v-022b8974"]]),{disableLinkOnTrading:ow,hideContractSpecification:sw}=mt,{enable24hVolume:lw}=zt,uw="height",cw=10,dw=5,pw={name:"ContractDetail",components:{IconChevronDown:Ze},props:{boxFilled:{type:Boolean,default:!1}},data:()=>({disableLinkOnTrading:ow,hideContractSpecification:sw,enable24hVolume:lw,isShrink:!1,contractDetailHeight:null,expandBtnHeight:null}),computed:{...b({isLogin:"loginState",lang:"lang",triggerLayoutReset:"triggerLayoutReset",lastPrice:e=>e.orderBook.lastPrice,showContractDetails:e=>e.userConfig.contractDetails,futuresIndexPriceMap:e=>e.futures.futuresIndexPriceMap,futuresLastDataMap:e=>e.futures.futuresLastDataMap,futuresMarkPriceMap:e=>e.futures.futuresMarkPriceMap}),...U("futures",{futuresMarketData:"marketData",futuresMarketDetail:"marketDetail",isFutures:"isFutures",currentSettleInCurrency:"currentSettleInCurrency"}),...y(qe,{isSpot:"isSpot",spotMarketQuoteCurrency:"marketQuoteCurrency",spotMarketSymbol
1:"marketSymbol"}),...y(Bt,["marketStatsMap"]),marketName(){var e;return`${(null==(e=this.futuresMarketData)?void 0:e.symbol)||""} ${this.$t("futuresMain.contractDetail.title")}`},isBncIndexMarket(){return Vr.includes(this.futuresMarketData.baseCurrency)},priceFilter(){return this.futuresMarketData.priceFilter},isTimeBasedContract(){var e;return null==(e=this.futuresMarketData)?void 0:e.isTimeBasedContract},marketBaseCurrency(){return this.futuresMarketData.customCategoryCurrency},contractSize(){return this.isBncIndexMarket?"$0.01":`${this.futuresMarketDetail.contractSize} ${this.marketBaseCurrency}`},marketSymbol(){return this.futuresMarketData.symbol},quote(){return this.isSpot?this.spotMarketQuoteCurrency:this.currentSettleInCurrency},indexPrice(){return this.futuresIndexPriceMap[this.marketSymbol]||0},markPrice(){return this.futuresMarkPriceMap[this.marketSymbol]||0},marketIndex(){return this.isFutures?this.futuresLastDataMap[this.futuresMarketData.symbol]||{}:this.marketStatsMap[this.spotMarketSymbol]||{}},tradingRulesRoute(){return{name:ai.TRADING_RULES,params:{lang:this.lang,marketType:"futures"}}},expirationDate(){const{closeTime:e}=this.futuresMarketData,t=e?Hr(e,"dd MMM yyyy"):"-";return this.isTimeBasedContract?t:this.$t("t.perpetual.abbreviation")},fundingIntervalHours(){return this.futuresMarketData.fundingIntervalMinutes/60}},watch:{triggerLayoutReset(){this.isShrink=!1,this.$nextTick(this.initAndResetHeight)},futuresMarketData:{async handler(){this.isShrink=!1,this.$nextTick(this.initAndResetHeight),await this.$nextTick(),this.getDefaultHeight()},flush:"post"},showContractDetails(e){e&&this.getDefaultHeight()}},mounted(){this.getDefaultHeight(),this.initAndResetHeight()},methods:{onFundingRateClick(){const e=this.$router.resolve({name:"fundingHistory",params:{lang:this.lang},query:{symbol:this.$route.params.id}});window.open(e.href,"_blank","noopener")},getDefaultHeight(){this.contractDetailHeight=this.$refs.contractDetail.clientHeight,this.expandBtnHeight=this.$refs.expandBtn.clientHeight},getOffsetHeight(){const e=this.$refs.contractDetail;let t=0;for(const i of e.children)t+=i.offsetHeight+8;return t},initAndResetHeight(){const e=this.expandBtnHeight+20,t=this.getOffsetHeight()+e+12;this.$emit(uw,t,"contract-detail")},onShrink(){this.isShrink=!this.isShrink;const e=this.$refs.content.clientHeight,t=this.$refs.contractDetail.clientHeight,i=this.isMobile?t-cw:t-dw;let r=0;r=this.isShrink?e-this.contractDetailHeight+this.expandBtnHeight:this.contractDetailHeight+i,this.$emit(uw,r,"contract-detail")}}}
1,hw={class:"brand-card-header card-shell__header divider"},mw={class:"brand-card-title"},gw={class:"flex-box justify-between contract-detail-data"},fw={class:"contract-detail-label"},vw={class:"flex-box justify-between contract-detail-data"},yw=["title"],bw={class:"flex-box justify-between contract-detail-data"},Sw=["title"],Cw={class:"flex-box justify-between contract-detail-data"},Pw={class:"contract-detail-cell"},kw={class:"flex-box justify-between contract-detail-data"},Tw={class:"contract-detail-cell"},Mw={class:"flex-box justify-between contract-detail-data"},Lw={class:"contract-detail-cell"},ww={key:0,class:"flex-box justify-between contract-detail-data"},Dw={class:"contract-detail-cell"},Ow={class:"flex-box justify-between contract-detail-data"},Iw={class:"contract-detail-cell"},xw={key:1,class:"flex-box justify-between"},_w={key:2},Aw={ref:"expandBtn",class:"expand-wrapper"};const Rw=$n(pw,[["render",function(e,t,i,r,n,u){const g=a("ToolTip"),f=a("RouterLink"),v=a("IconChevronDown");return o(),c("div",{ref:"content",class:C(["brand-card card-shell",{"box-fill":i.boxFilled}])},[l("div",hw,[l("div",mw,m(u.marketName),1)]),l("div",{ref:"contractDetail",class:C(["contract-detail flex-box flex-column",{"is-shrink":n.isShrink}])},[l("div",gw,[l("p",fw,m(e.$t("futuresMain.contractDetail.expirationDate")),1),l("p",null,m(u.expirationDate),1)]),l("div",vw,[d(g,{class:"contract-detail-label",content:e.$t("futuresMain.trade.indexPrice"),tooltip:e.$t("futuresMain.contractInfo.brandIndPrice.tip",{brandName:e.$t("brand.name")})},null,8,["content","tooltip"]),l("div",{class:"contract-detail-cell",title:u.indexPrice},m(e.$filters.formatNumber(u.indexPrice,u.priceFilter)),9,yw)]),l("div",bw,[d(g,{class:"contract-detail-label",content:e.$t("futuresMain.contractInfo.markPrice"),tooltip:e.$t("futuresMain.contractInfo.brandMarkPrice.tip")},null,8,["content","tooltip"]),l("div",{class:"contract-detail-cell",title:u.markPrice},m(e.$filters.formatNumber(u.markPrice,u.priceFilter)),9,Sw)]),l("div",Cw,[d(g,{class:"contract-detail-label",content:e.$t("futuresMain.contractInfo.openInterest"),tooltip:e.$t("futuresMain.contractInfo.openInterest.tip")},null,8,["content","tooltip"]),l("div",Pw,m(e.$filters.formatNumber(e.futuresMarketData.openInterest,0))+" "+m(e.$t("futuresMain.contracts")),1)]),l("div",kw,[d(g,{class:"contract-detail-label",content:e.$t("futuresMain.contractDetail.24H_high"),tooltip:e.$t("futuresMain.marketInfo.high.tip")},null,8,["content","tooltip"]),l("div",Tw,m(e.$filters.formatNumber(u.marketIndex.high,u.priceFilter)),1)]),l("div",Mw,[d(g,{class:"contract-detail-label",content:e.$t("futuresMain.contractDetail.24H_low"),tooltip:e.$t("futuresMain.marketInfo.low.tip")},null,8,["content","tooltip"]),l("div",Lw,m(e.$filters.formatNumber(u.marketIndex.low,u.priceFilter)),1)]),n.enable24hVolume?(o(),c("div",ww,[d(g,{class:"contract-detail-label",content:e.$t("futuresMain.contractDetail.24H_volume"),tooltip:e.$t("futuresMain.marketInfo.vol.tipWithCoin",{coin:u.quote}),offsetLeft:12},null,8,["content","tooltip"]),l("div",Dw,m(e.$filters.formatNumber(u.marketIndex.volume,0))+" "+m(u.quote),1)])):h("",!0),l("div",Ow,[d(g,{class:"contract-detail-label",content:e.$t("futuresMain.contractInfo.contractValue"),tooltip:e.$t("futuresMain.contractInfo.contractValue.tip")},null,8,["content","tooltip"]),l("div",Iw,m(u.contractSize),1)]),n.disableLinkOnTrading||u.isTimeBasedContract?h("",!0):(o(),c("div",xw,[d(g,{class:"contract-detail-link",content:e.$t("futuresMain.contractDetail.fundingRateHistory"),tooltip:e.$t("futuresMain.contractInfo.fundingRate.tip2",{interval:u.fundingIntervalHours}),placement:"top",offsetLeft:e.isMobile?0:50,onClick:u.onFundingRateClick},null,8,["content","tooltip","offsetLeft","onClick"])])),n.hideContractSpecification?h("",!0):(o(),c("div",_w,[d(f,{class:"contract-detail-link",to:u.tradingRulesRoute,target:"_blank"},{default:s((()=>[p(m(e.$t("futuresMain.contractInfo.contractSpecifications")),1)])),_:1},8,["to"])]))],2),l("div",Aw,[t[1]||(t[1]=l("div",{class:"expand-line"},null,-1)),l("div",{class:"expand-button flex-center-center",onClick:t[0]||(t[0]=(...e)=>u.onShrink&&u.onShrink(...e))},[d(v,{class:C(["expand-icon",{"is-expand":!n.isShrink}])},null,8,["class"])])],512)],2)}],["__scopeId","data-v-61e08967"]]),{captureEvent:Fw}=Yr(),{enableConvert:Ew,enableWalletSpot:Bw,enableWalletFutures:zw}=mt,{enableTradingFeeLowerDisplay:$w}
1=zt,Nw={name:"FundingCard",components:{IconLottery:vs,ConvertDialog:ls,CommonDialogGroup:ss},props:{isFutures:{type:Boolean,default:!1}},data:()=>({isShowConvertDialog:!1,isShowStakeTooltip:!1,ROUTE_NAME:ai,targetMakerFee:0,targetTakerFee:0,currentMakerFee:0,currentTakerFee:0}),computed:{...b(["lang","isDefaultBrand","loginState"]),...U(["featurePermissions","isUnifiedWallet"]),...U("futures",{futuresWallet:"wallet"}),isShowPromoText(){return this.isDefaultBrand&&this.loginState&&(this.featurePermissions[Xr[ai.TOKEN_STAKING_BENEFITS]]??Zr[ai.TOKEN_STAKING_BENEFITS])},tokenName(){return this.$filters.digitalCurrency(mt.brandToken)},isShowConvert:()=>Ew,isShowTransfer:()=>Bw&&zw,isShowLowerFees:()=>$w},created(){this.isDefaultBrand&&this.getFees()},beforeUnmount(){clearTimeout(this.tmpItv)},methods:{...f(Vn,["toggleTransferPopup"]),handleToggleConvertDialog(e){this.isShowConvertDialog=e},handleGoDeposit(){const e=this.isFutures?Gr.futuresTrading:Gr.spotTrading;this.$sendEvent(Kr.EVENT_WEB_GOTO_DEPOSIT_PAGE,{route:this.$route,fromWhere:Qr.TRADE_FUNDING_CARD_COMPONENT,currency:null}),jr({entryChannel:e}),Fw("deposit_entrance",{entry_channel:this.isFutures?"futures_trading":"spot_trading"});const t=this.$router.resolve({name:ai.DEPOSIT,params:{lang:this.lang}});window.open(t.href,"_blank")},handleCloseTooltip(){this.isShowStakeTooltip=!1},openFuturesTransferPopup(){const e=this.isUnifiedWallet?ti:xi,t=this.isUnifiedWallet?ti:this.futuresWallet.activeWalletName;this.toggleTransferPopup({from:this.isFutures?ii:e,to:this.isFutures?t:ii,showTopUpOptions:!0})},onMouseEnter(){clearTimeout(this.tmpItv)},onMouseLeave(){this.tmpItv=setTimeout((()=>{this.handleCloseTooltip()}),500)},async getFees(){if(!this.loginState)return;const[e,t]=await Promise.all([Wr.getStakeTradingFeeRules(),qr.getTradingFee()]),i=this.isFutures?null==e?void 0:e.futures[3]:null==e?void 0:e.spot[3];i&&(this.targetMakerFee=S(i.maker).times(100),this.targetTakerFee=S(i.taker).times(100));const r=this.isFutures?null==t?void 0:t.fees.future:null==t?void 0:t.fees.spot;r&&(this.currentMakerFee=S(r.maker).times(100),this.currentTakerFee=S(r.taker).times(100))},percentFormat(e){var t;return(null==(t=String(e).split(".")[1])?void 0:t.length)>1?e:e.toFixed(1)}}},Uw={class:"brand-card card-shell funding-card"},Hw={class:"fund-title card-shell__header"},Vw={class:"fund-btns"},Ww=["disabled"],qw={key:0,class:"fee-discount"},Gw={class:"title"},Kw={class:"content"}
1,Qw={key:0},jw={class:"del-num"},Yw={key:0,class:"del-num"},Zw={class:"num"},Xw={key:0,class:"num"},Jw={class:"go-stake"};const eD=$n(Nw,[["render",function(e,t,i,r,u,g){const f=a("IconLottery"),v=a("router-link"),y=a("ConvertDialog"),b=a("CommonDialogGroup"),S=H("click-outside");return o(),c("div",Uw,[l("div",Hw,m(e.$t("trading.needFund")),1),l("div",Vw,[g.isShowTransfer?(o(),c("div",{key:0,class:C(["fund-action",{disable:!e.loginState}]),onClick:t[0]||(t[0]=(...e)=>g.openFuturesTransferPopup&&g.openFuturesTransferPopup(...e))},m(e.$t("t.transfer")),3)):h("",!0),l("div",{class:"fund-action",disabled:!e.loginState,onClick:t[1]||(t[1]=(...e)=>g.handleGoDeposit&&g.handleGoDeposit(...e))},m(e.$t("t.deposit")),9,Ww),g.isShowConvert?(o(),c("div",{key:1,class:C(["fund-action",{disable:!e.loginState}]),onClick:t[2]||(t[2]=()=>g.handleToggleConvertDialog(!0))},m(e.$t("t.convert")),3)):h("",!0)]),g.isShowPromoText?(o(),c("div",qw,[l("div",{class:"discount-text",onClick:t[3]||(t[3]=e=>u.isShowStakeTooltip=!0)},[d(f),l("span",null,m(g.isShowLowerFees?e.$t("trading.makerFeesDiscountLower"):e.$t("trading.makerFeesDiscount",{percentage:"0%"})),1)])])):h("",!0),u.isShowStakeTooltip?B((o(),c("div",{key:1,class:"stake-tooltip",onMouseenter:t[4]||(t[4]=(...e)=>g.onMouseEnter&&g.onMouseEnter(...e)),onMouseleave:t[5]||(t[5]=(...e)=>g.onMouseLeave&&g.onMouseLeave(...e))},[l("div",Gw,[d(f),l("span",null,m(g.isShowLowerFees?e.$t("trading.stakeBenefitLower",{token:g.tokenName}):e.$t("trading.stakeBenefit",{percentage:"0%",token:g.tokenName})),1)]),l("div",Kw,[l("table",null,[l("tbody",null,[l("tr",null,[t[6]||(t[6]=l("td",null,null,-1)),l("td",null,m(e.$t("trading.makerFees")),1),g.isShowLowerFees?(o(),c("td",Qw,m(e.$t("trading.takerFees")),1)):h("",!0)]),l("tr",null,[l("td",null,m(e.$t("trading.currentFee"))+":",1),l("td",jw,m(g.percentFormat(u.currentMakerFee))+"%",1),g.isShowLowerFees?(o(),c("td",Yw,m(g.percentFormat(u.currentTakerFee))+"% ",1)):h("",!0)]),l("tr",null,[l("td",null,m(e.$t("trading.withStake",{token:g.tokenName}))+":",1),l("td",Zw,m(g.percentFormat(u.targetMakerFee))+"%",1),g.isShowLowerFees?(o(),c("td",Xw,m(g.percentFormat(u.targetTakerFee))+"% ",1)):h("",!0)])])])]),l("div",Jw,[d(v,{to:{name:u.ROUTE_NAME.TOKEN_STAKING_BENEFITS,params:{lang:e.lang}},target:"_blank"},{default:s((()=>[p(m(e.$t("trading.stakeNow",{token:g.tokenName})),1)])),_:1},8,["to"])])],32)),[[S,g.handleCloseTooltip]]):h("",!0),d(b,null,{default:s((()=>[u.isShowConvertDialog?(o(),n(y,{key:0,closeDialog:()=>g.handleToggleConvertDialog(!1)},null,8,["closeDialog"])):h("",!0)])),_:1})])}]]),tD={class:"border-box flex-box justify-between relative info"},iD={class:"info-title"},rD={key:0,class:"remark"},aD=["innerHTML"],nD={class:"info-content-wrap"},oD={key:0,class:"info-content"},sD={key:1,class:"info-content"};const lD=$n({name:"FuturesFormInfo",props:{title:{type:String,default:""},numberContent:{type:Number,default:void 0},content:{type:String,default:""},postAppend:{type:String,default:""},remark:{type:String,default:""},titleTooltip:{type:String,default:null},symbols:{type:Object,default:function(){return{br:"<br>"}}}}},[["render",function(e,t,i,r,n,u){const g=a("ToolTip");return o(),c("div",tD,[d(g,{disable:!(i.title&&i.titleTooltip)},{content:s((()=>[l("div",iD,[p(m(e.$t(i.title))+" ",1),i.remark?(o(),c("span",rD,"("+m(i.remark)+")",1)):h("",!0)])])),tooltip:s((()=>[l("span",{innerHTML:e.$t(i.titleTooltip,{...i.symbols,brandName:e.$t("brand.name")})},null,8,aD)])),_:1},8,["disable"]),l("div",nD,[void 0!==i.numberContent?(o(),c("span",oD,m(e.$filters.formatNumber(i.numberContent)),1)):(o(),c("span",sD,m(i.content),1)),l("span",null,m(i.postAppend),1)])])}],["__scopeId","data-v-86e8c405"]]),{disableLinkOnTrading:uD}=mt,cD={name:"FuturesAvailableBalance",components:{FuturesFormInfo:lD,TransferIconWithTooltip:Xd},props:{showTransfer:{type:Boolean,default:!0}},computed:{...b(["includeUnrealizedPnl","loginState"]),...U(["isUnifiedWallet"]),...U("futures",["wallet","currentSettleInCurrency","availableBalance","marginMode"]),isCross(){return this.marginMode===ri.CROSS},isTransferShow(){return this.showTransfer&&!uD&&this.loginState},quoteCurrency(){return this.currentSettleInCurrency},tooltip(){return this.isUnifiedWallet?this.isCross?"futuresMain.unifiedWallet.availableBalance.tip":"futuresMain.unifiedWallet.availableBalance.isolated.tip":this.includeUnrealizedPnl?"futuresMain.marginBalanace.availableBalance.tip":"futuresMain.marginBalanace.availableBalance.tip2"}},methods:{...f(Vn,["toggleTransferPopup"]),openFuturesTransferPopup(){this.toggleTransferPopup({from:ii,to:this.isUnifiedWallet?ti:this.wallet.activeWalletName,showTopUpOptions:!0,currency:ht})}}},dD={class:"avbl-wrapper"};const pD=$n(cD,[["render",function(e,t,i,r,s,l){const u=a("FuturesFormInfo"),p=a("TransferIconWithTooltip");return o(),c("div",dD,[d(u,{class:"form-info-wrapper",title:"futuresMain.trade.avail.balance",numberContent:e.availableBalance,postAppend:l.quoteCurrency,titleTooltip:l.tooltip},null,8,["numberContent","postAppend","titleTooltip"]),l.isTransferShow?(o(),n(p,{key:0,onTransferClick:l.openFuturesTransferPopup},null,8,["onTransferClick"])):h("",!0)])}],["__scopeId","data-v-52114fc6"]]);const hD=$n({name:"FuturesButton",props:{handleClick:{type:Function,default:()=>{}}
1,disabled:Boolean,success:Boolean,cancel:Boolean,confirm:Boolean},computed:{classes(){return{disabled:this.disabled,success:this.success,danger:!this.success,cancel:this.cancel,confirm:this.confirm}}},methods:{click(){this.disabled||this.handleClick()}}},[["render",function(e,t,i,r,a,n){return o(),c("button",{class:C(["border-box button",n.classes]),onClick:t[0]||(t[0]=(...e)=>n.click&&n.click(...e))},[_(e.$slots,"default",{},void 0,!0)],2)}],["__scopeId","data-v-efbdaf3d"]]),mD={class:"futures-form-action-block"},gD={class:"block-btns"},fD={key:0,class:"leader-exceed-limit"},vD=$n({__name:"FuturesFormActions",props:{buyDisabled:{type:Boolean,default:!0},sellDisabled:{type:Boolean,default:!0},isOpen:{type:Boolean,default:!1},isClose:{type:Boolean,default:!1},buySubmit:{type:Function,default:()=>{}},sellSubmit:{type:Function,default:()=>{}}},setup(e){const t=e,{showIdVerificationRequiredDialog:i}=hs(),r=k(),{t:a}=G(),{isBuyExceedLimit:n,isSellExceedLimit:u,showRiskLimitDialog:g}=mh({isClose:Z((()=>t.isClose))}),f=pt(),{$openDialog:v}=ar(),y=M((()=>r.state.isTradingCountry)),b=M((()=>r.getters.isUnifiedWallet)),S=M((()=>r.state.futures.futuresBotList)),C=M((()=>r.state.futures.currentMarketSymbol)),P=M((()=>r.getters["futures/symbol"])),T=M((()=>!y.value||t.buyDisabled)),L=M((()=>!y.value||t.sellDisabled)),w=M((()=>t.isOpen?a("trading.openLong"):t.isClose?a("trading.closeShort"):a("futuresMain.trade.buyLong"))),D=M((()=>t.isOpen?a("trading.openShort"):t.isClose?a("trading.closeLong"):a("futuresMain.trade.sellShort"))),O=M((()=>S.value.some((e=>e.symbol===C.value)))),I=M((()=>{var e;return(null==(e=r.getters["futures/currentRiskLimitData"])?void 0:e.riskLimitValue)||0})),_=()=>{if(!i(Jr.TRADING_FUTURES.BUY)){if(!n.value)return!b.value&&O.value?v(zb,{title:a("c2c.buySell.confirmOrder"),content:a("trading.order.cancel.notUnifiedWallet.dialog.content2"),confirmCallback:t.buySubmit}):void t.buySubmit();g()}},A=()=>{if(!u.value)return!b.value&&O.value?v(zb,{title:a("c2c.buySell.confirmOrder"),content:a("trading.order.cancel.notUnifiedWallet.dialog.content2"),confirmCallback:t.sellSubmit}):void t.sellSubmit();g()};return(e,t)=>(o(),c("div",mD,[l("div",gD,[d(ei,{tooltip:e.$t(x(f).isLeaderMode?"futures.riskLimit.errorMessage.onlyReduce":"futures.riskLimit.errorMessage.needAdjust",{market:P.value}),disable:!x(n)},{content:s((()=>[d(hD,{class:"action-button",success:!0,disabled:T.value,handleClick:_},{default:s((()=>[p(m(w.value),1)])),_:1},8,["disabled"])])),_:1},8,["tooltip","disable"]),d(ei,{tooltip:e.$t(x(f).isLeaderMode?"futures.riskLimit.errorMessage.onlyReduce":"futures.riskLimit.errorMessage.needAdjust",{market:P.value}),disable:!x(u)},{content:s((()=>[d(hD,{class:"action-button",success:!1,disabled:L.value,handleClick:A},{default:s((()=>[p(m(D.value),1)])),_:1},8,["disabled"])])),_:1},8,["tooltip","disable"])]),x(f).isLeaderMode&&(x(n)||x(u))?(o(),c("div",fD,[d(Di,{class:"icon-notification"}),l("div",null,m(e.$t("futures.riskLimit.errorMessage.exceedValueReduce",{value:x(Qt)(I.value,0)})),1)])):h("",!0)]))}},[["__scopeId","data-v-5cf94528"]]),yD=$n({__name:"FuturesTriggerTypeSelect",props:{value:{type:String,default:xr.default}},emits:["update:value"],setup(e,{emit:t}){const{enableLastPriceDependentUI:i}=zt,r=t,a=Ge(),s=M((()=>[{id:xr.MARK_PRICE,lang:"trading.mark",fullName:"spot.order.market.markPrice",isI18nKey:!0},...i?[{id:xr.LAST_PRICE,lang:"trading.last",fullName:"spot.order.market.lastPrice",isI18nKey:!0}]:[]]));D((()=>a.orderFormSettings),(({triggerOn:e})=>{r("update:value",e)})),L((()=>{r("update:value",a.orderFormSettings.triggerOn)}));const l=ea((async e=>{await a.updateOrderFormSettings({triggerOn:e})}),500);return(e,t)=>(o(),n(x(om),{class:"size-type",items:s.value,form:x(a).orderFormSettings.triggerOn,"onUpdate:form":x(l)},null,8,["items","form","onUpdate:form"]))}},[["__scopeId","data-v-8268a47b"]]),bD={name:"FuturesMarginInfo",components:{FuturesTriggerTypeSelect:yD},props:{buyInfo:{type:[Number,String],default:0},sellInfo:{type:[Number,String],default:0},preAddon:{type:String,default:""},postAddon:{type:String,default:""},title:{type:String,default:""},titleTooltip:{type:String,default:""},subtitle:{type:String,default:""},priceFilter:{type:Number,default:null},roundMode:{type:Number,default:void 0},showTriggerSelect:{type:Boolean,default:!1}}},SD={class:"border-box flex-box margin-info"},CD={class:"buy"},PD={class:"inline-flex relative title"},kD={class:"title"},TD={key:0},MD={class:"sell"};const LD=$n(bD,[["render",function(e,t,i,r,u,f){const v=a("i18n-t"),y=a("ToolTip"),b=a("FuturesTriggerTypeSelect");return o(),c("div",SD,[l("div",CD,m(e.$filters.formatNumber(i.buyInfo,{formatKey:i.priceFilter,defaultValue:0,prefix:i.preAddon,postfix:i.postAddon,roundMode:i.roundMode})),1),l("div",PD,[d(y,{disable:!(i.title&&i.titleTooltip)},{content:s((()=>[l("span",kD,[p(m(e.$t(i.title))+" ",1),_(e.$slots,"title-suffix",{},void 0,!0),i.subtitle?(o(),c(g,{key:0},[!e.isMobile&&i.subtitle.length>
17?(o(),c("br",TD)):h("",!0),p(" "+m(i.subtitle),1)],64)):h("",!0)])])),tooltip:s((()=>[d(v,{keypath:i.titleTooltip},{br:s((()=>t[0]||(t[0]=[l("br",null,null,-1)]))),_:1},8,["keypath"])])),_:3},8,["disable"]),i.showTriggerSelect?(o(),n(b,{key:0,class:"trigger-type-select"})):h("",!0)]),l("div",MD,m(e.$filters.formatNumber(i.sellInfo,{formatKey:i.priceFilter,defaultValue:0,prefix:i.preAddon,postfix:i.postAddon,roundMode:i.roundMode})),1)])}],["__scopeId","data-v-fb1848c8"]]),wD={name:"LoginViewContent",props:{promotionComponent:{type:Object,required:!1,default:null}},data:()=>({testnetLink:ta,showTestnetHint:mt.enableTradingTestnetHint,showRegister:mt.enableTradingRegister}),computed:{...b({LANG:"lang",LOGIN_STATE:"loginState"})}},DD={key:0,class:"login-view-content"},OD={class:"login-button-wrap"},ID={class:"_p1"},xD={class:"_p2"},_D=["href"];const AD=$n(wD,[["render",function(e,t,i,r,u,g){const f=a("BrandButton"),v=a("i18n-t");return e.LOGIN_STATE?h("",!0):(o(),c("div",DD,[l("div",OD,[l("p",ID,m(e.$t("msg.loginOverlayText")),1),l("div",xD,[d(f,{type:"confirm",onClick:t[0]||(t[0]=t=>e.$router.push("/"+e.LANG+"/login"))},{default:s((()=>[p(m(e.$t("msg.login")),1)])),_:1}),u.showRegister?(o(),n(f,{key:0,type:"danger",onClick:t[1]||(t[1]=t=>e.$router.push("/"+e.LANG+"/register"))},{default:s((()=>[p(m(e.$t("msg.register")),1)])),_:1})):h("",!0)]),u.showTestnetHint?(o(),n(v,{key:0,keypath:"trading.orders.experience.testnet",tag:"p",class:"_p3"},{testnetLink:s((()=>[l("a",{href:u.testnetLink,target:"_blank"},m(e.$t("footer.testnet")),9,_D)])),_:1})):h("",!0),i.promotionComponent?(o(),n(F(i.promotionComponent),{key:1})):h("",!0)])]))}]]),RD=ia({component:null},"LoginPromotionContext"),FD={name:"FuturesMarginInfoList",components:{FuturesMarginInfo:LD,LoginViewContent:AD,IconChevronDown:Ze},inject:{...RD.consumeContext(),adjustOrderFormHeight:"adjustOrderFormHeight"},props:{price:{type:String,default:"0"},buySize:{type:[String,Number],required:!0},sellSize:{type:[String,Number],required:!0},isMarketOrderType:{type:Boolean,default:!1},isClose:{type:Boolean,default:!1},hideExposure:{type:Boolean,default:!1},isTrailingStopOrderType:{type:Boolean,default:!1},trailingStopInfo:{type:Object,default:()=>null},sideLimitPrice:{type:Object,default:()=>null}},emits:["updateMaxSize"],setup:()=>({takerFee:ci().takerFee}),data:()=>({isExpand:!1}),computed:{...b(["loginState","deprecated_isTestnet","currentOrder","includeUnrealizedPnl"]),...y(oa,{futuresWalletState:"wallet"}),...U(["isUnifiedWallet"]),...U("futures",["marketData","marketDetail","currentModePosition","hasOpenPosition","wallet","isHedgeMode","currentFuturesMarkPrice","walletLeverage","currentMargin","availableBalance","maintenanceMarginPercentage","maxLeverage"]),...y(Ge,["isUsdSizeType","futuresSizeCurrency","sizeFilterPhase2","orderFormType"]),...y(Nn,["orderBook"]),buyPrice(){return this.sideLimitPrice?Number(this.sideLimitPrice.buy)||0:this.isTrailingStopOrderType&&this.trailingStopInfo?this.trailingStopInfo.buy||0:Number(this.price)||0},sellPrice(){return this.sideLimitPrice?Number(this.sideLimitPrice.sell)||0:this.isTrailingStopOrderType&&this.trailingStopInfo?this.trailingStopInfo.sell||0:Number(this.price)||0},order(){return{buyQty:Number(this.buySize)||0,sellQty:Number(this.sellSize)||0}},futuresWallet(){var e;return this.isUnifiedWallet?{walletTotalValue:this.futuresWalletState.totalValue,unrealisedProfitLoss:this.futuresWalletState.unrealisedProfitLoss,originalAvailableBalance:(null==(e=this.currentMargin[0])?void 0:e.originalAvailableBalance)||0}:this.wallet},buyLeverage(){return na({marketDetail:this.marketDetail,wallet:this.futuresWallet,position:this.currentModePosition,order:{price:this.buyPrice,qty:this.order.buyQty},isLong:!0,isHedgeMode:this.isHedgeMode,isClose:this.isClose,isMarketOrder:this.isMarketOrderType,includeUnrealizedPnl:this.includeUnrealizedPnl})},sellLeverage(){return na({marketDetail:this.marketDetail,wallet:this.futuresWallet,position:this.currentModePosition,order:{price:this.sellPrice,qty:this.order.sellQty},isLong:!1,isHedgeMode:this.isHedgeMode,isClose:this.isClose,isMarketOrder:this.isMarketOrderType,includeUnrealizedPnl:this.includeUnrealizedPnl})},maxSizeSubtitle(){return`(${this.futuresSizeCurrency})`},initialMargin(){return this.isUnifiedWallet&&this.isHedgeMode?this.currentMargin.map((e=>S(1).div(e.leverage||this.maxLeverage).toNumber())):S(1).div(this.walletLeverage||1).toNumber()},maxSize(){const e={availableBalance:this.availableBalance,contractSize:this.marketDetail.contractSize,initialMargin:this.initialMargin,takerFees:this.takerFee,position:this.currentModePosition,isHedgeMode:this.isHedgeMode,isClose:this.isClose},t=ra({...e,orderPrice:this.buyPrice}),i=ra({...e,orderPrice:this.sellPrice});return this.isMarketOrderType&&this.isUsdSizeType?{buy:aa(t.buy,this.orderBook.asks,!0),sell:aa(i.sell,this.orderBook.bids,!1)}:{buy:Number(gt(t.buy,this.buyPrice)),sell:Number(gt(i.sell,this.sellPrice))}},maxSizeFormatConfig(){return{filter:this.sizeFilterPhase2,roundMode:S.ROUND_DOWN}},promotionComponent(){return this[RD.contextName].component.default}},watch:{isExpand(e){this.adjustOrderFormHeight(e,this.orderFormType)},maxSize:{handler(e){this.$emit("updateMaxSize",e)},immediate:!0}}},ED={class:"info-wrapper"};const BD=$n(FD,[["render",function(e,t,i,r,s,u){const p=a("FuturesMarginInfo"),m=a("IconChevronDown"),f=a("LoginViewContent");return o(),c("div",{class:C(["relative margin-info-list",{"non-login":!e.loginState}])},[e.loginState?(o(),c(g,{key:0},[B(l("div",ED,[i.hideExposure?h("",!0):(o(),n(p,{key:0,title:"futuresMain.openPosition.exposure",buyInfo:u.buyLeverage,sellInfo:u.sellLeverage,preAddon:"",postAddon:"x",titleTooltip:e.includeUnrealizedPnl?"futuresMain.exposure.hint.1.excludeUnrealizedPnl":"futuresMain.exposure.hint.1"},null,8,["buyInfo","sellInfo","titleTooltip"])),d(p,{title:i.isClose?"trading.avblPosition":"futuresMain.order.maxSize",titleTooltip:"futuresMain.order.maxSize.t
1ip",subtitle:u.maxSizeSubtitle,buyInfo:u.maxSize.buy,sellInfo:u.maxSize.sell,priceFilter:u.maxSizeFormatConfig.filter,roundMode:u.maxSizeFormatConfig.roundMode,preAddon:""},null,8,["title","subtitle","buyInfo","sellInfo","priceFilter","roundMode"])],512),[[N,s.isExpand]]),l("div",{class:C(["expand-btn",{"is-expanded":s.isExpand}]),onClick:t[0]||(t[0]=e=>s.isExpand=!s.isExpand)},[d(m,{class:"icon-chevron-down"})],2)],64)):(o(),n(f,{key:1,promotionComponent:u.promotionComponent},null,8,["promotionComponent"]))],2)}],["__scopeId","data-v-32dce2ef"]]),zD={name:"FuturesAdvancedOrderValue",components:{FuturesMarginInfo:LD},props:{orderValueInfo:{type:Object,required:!0},price:{type:String,default:"0"},buySize:{type:[String,Number],required:!0},sellSize:{type:[String,Number],required:!0},orderFormSize:{type:[String,Number],default:"0"},orderFormPrice:{type:[String,Number],default:"0"},isClose:{type:Boolean,default:!1},isTrailingStopOrderType:{type:Boolean,default:!1},trailingStopInfo:{type:Object,default:()=>({})},isMarketType:{type:Boolean,default:!1},isMarketOrderType:{type:Boolean,default:!1},hideLiqPrice:{type:Boolean,default:!1},sideLimitPrice:{type:Object,default:()=>null}},emits:["updateMarginRequired"],setup(){const e=ci();return{BigNumber:S,takerFee:e.takerFee}},computed:{...b(["includeUnrealizedPnl"]),...y(oa,{futuresWalletState:"wallet"}),...U(["isUnifiedWallet"]),...U("futures",["marketDetail","currentSymbolModeOrderList","currentModePosition","wallet","marketData","currentSettleInCurrency","maxLeverage","isHedgeMode","walletLeverage","currentMargin","initialMarginPercentage","currentFuturesMarkPrice","maintenanceMarginPercentage"]),...y(Ge,["isUsdSizeType","isContractSizeType"]),buyPrice(){return this.sideLimitPrice?Number(this.sideLimitPrice.buy)||0:this.isTrailingStopOrderType&&this.trailingStopInfo?this.trailingStopInfo.buy||0:Number(this.price)||0},sellPrice(){return this.sideLimitPrice?Number(this.sideLimitPrice.sell)||0:this.isTrailingStopOrderType&&this.trailingStopInfo?this.trailingStopInfo.sell||0:Number(this.price)||0},buyOrder(){return{price:this.buyPrice,buyQty:Number(this.buySize)||0,sellQty:0}},sellOrder(){return{price:this.sellPrice,buyQty:0,sellQty:Number(this.sellSize)||0}},order(){return{price:Number(this.price)||0,buyQty:Number(this.buySize)||0,sellQty:Number(this.sellSize)||0}},initialMargin(){if(this.isUnifiedWallet&&this.isHedgeMode)return this.currentMargin.map((e=>S(1).div(e.leverage||this.maxLeverage).toNumber()));const e=S(1).div(this.walletLeverage||1).toNumber();return[e,e]},marginRequired(){if(!this.isHedgeMode){const e={openOrderList:this.currentSymbolModeOrderList,position:this.currentModePosition,contractValue:this.marketDetail.contractSize,takerFees:this.takerFee,leverage:this.walletLeverage||this.maxLeverage,initialMarginPercentage:this.initialMarginPercentage()};if(this.isTrailingStopOrderType&&this.trailingStopInfo){const t=ua({...e,order:this.buyOrder}),i=ua({...e,order:this.sellOrder});return{buy:t.buy,sell:i.sell}}return ua({...e,order:this.order})}return{buy:ca({takerFees:this.takerFee,orderValue:Number(this.orderValueInfo.buyValue),initialMargin:this.initialMargin[0]}),sell:ca({takerFees:this.takerFee,orderValue:Number(this.orderValueInfo.sellValue),initialMargin:this.initialMargin[1]})}},baseCurrency(){return this.marketData.baseCurrency},quoteCurrency(){return this.currentSettleInCurrency},futuresWallet(){var e;return this.isUnifiedWallet?{walletTotalValue:this.futuresWalletState.totalValue,unrealisedProfitLoss:this.futuresWalletState.unrealisedProfitLoss,originalAvailableBalance:(null==(e=this.currentMargin[0])?void 0:e.originalAvailableBalance)||0}:this.wallet},buyLiquidationPrice(){return la({marketDetail:this.marketDetail,marketData:this.marketData,wallet:this.futuresWallet,order:{price:this.buyPrice,qty:this.order.buyQty},isLong:!0,position:this.currentModePosition,isHedgeMode:this.isHedgeMode,isClose:this.isClose,isMarketOrder:this.isMarketOrderType,isMarket:this.isMarketType,includeUnrealizedPnl:this.includeUnrealizedPnl,markPrice:this.currentFuturesMarkPrice,maintenanceMarginPercentage:this.maintenanceMarginPercentage()})},sellLiquidationPrice(){return la({marketDetail:this.marketDetail,marketData:this.marketData,wallet:this.futuresWallet,order:{price:this.sellPrice,qty:this.order.sellQty},isLong:!1,position:this.currentModePosition,isHedgeMode:this.isHedgeMode,isClose:this.isClose,isMarketOrder:this.isMarketOrderType,isMarket:this.isMarketType,includeUnrealizedPnl:this.includeUnrealizedPnl,markPrice:this.currentFuturesMarkPrice,maintenanceMarginPercentage:this.maintenanceMarginPercentage()})},cryptoUnitSize(){return this.isUsdSizeType?sa(this.orderFormSize,this.orderFormPrice):this.isContractSizeType?Qe(this.orderFormSize):this.orderFormSize}},watch:{marginRequired(e){this.$emit("updateMarginRequired",e)}}},$D={class:"balance-info"},ND={class:"body-wrapper"},UD={class:"border-box flex-box justify-between relative info"};const HD=$n(zD,[["render",function(e,t,i,r,s,u){const p=a("FuturesMarginInfo");return o(),c("div",$D,[l("div",ND,[l("div",UD,[l("p",null,m(e.$t("t.buy")),1),l("p",null,m(e.$t("t.sell")),1)]),d(p,{title:"t.value",buyInfo:+i.orderValueInfo.buyValue,sellInfo:+i.orderValueInfo.sellValue,priceFilter:2,roundMode:r.BigNumber.ROUND_UP,subtitle:`(${u.quoteCurrency})`},null,8,["buyInfo","sellInfo","roundMode","subtitle"]),d(p,{title:"t.qty",buyInfo:u.cryptoUnitSize,sellInfo:u.cryptoUnitSize,priceFilter:e.marketData.sizeFilter,subtitle:`(${u.baseCurrency})`},null,8,["buyInfo","sellInfo","priceFilter","subtitle"]),i.isClose?h("",!0):(o(),n(p,{key:0,title:"futuresMain.order.margin",titleTooltip:"futuresMain.order.margin.tip",buyInfo:u.marginRequired.buy,sellInfo:u.marginRequired.sell,roundMode:r.BigNumber.ROUND_UP},null,8,["buyInfo","sellInfo","roundMode"])),i.isTrailingStopOrderType?(o(),n(p,{key:1,title:"futuresMain.trade.triggerPrice",titleTooltip:"futuresMain.trade.triggerPrice.tip",buyInfo:i.trailingStopInfo.buy,sellInfo:i.trailingStopInfo.sell,showTriggerSelect:""},null,8,["buyInfo","sellInfo"])):h("",!0),i.isClose||i.hideLiqPrice?h("",!0):(o(),n(p,{key:2,title:"futuresMain.order.liquidation",buyInfo:u.buyLiquidationPrice,sellInfo:u.sellLiquidationPrice,priceFilter:e.marketData.priceFilter,titleTooltip:"futuresMain.liqPrice.hint"},null,8,["buyInfo","sellInfo","priceFilter"]))])])}],["__scopeId","data-v-c9cee778"]]);function VD({shareLib:e,positionMode:t,price:i,size:r,side:a,contractSize:n,leverage:o,takerFee:s,adjConf:l,positionSize:u,pendingOrders:c}
1){return xv({shareLib:e,wasmFunction:Eo,params:{newOrder:{mode:t,price:i,size:r,side:a,contractSize:n},orderConfig:{leverage:o,takerFee:s,adjConf:l},curState:{positionSize:u,pendingOrders:c}}})}function WD(e,t){const i=k(),r=pt(),a=ci(),n=Ge(),o=Nn(),s=M((()=>i.state.includeUnrealizedPnl)),l=M((()=>i.state.futures.walletMap)),u=M((()=>i.state.futures.leaderWalletMap)),c=M((()=>i.getters["futures/currentMarketPositionMode"])),d=M((()=>i.getters["futures/isOneWayMode"])),p=M((()=>i.getters["futures/isHedgeMode"])),h=M((()=>i.getters["futures/isMultipleMode"])),m=M((()=>i.getters["futures/currentMargin"])),g=M((()=>i.getters["futures/marketData"])),f=M((()=>i.getters["futures/marketDetail"])),v=M((()=>i.getters["futures/currentModePosition"])),y=M((()=>i.getters["futures/maintenanceMarginPercentage"])),b=M((()=>i.getters["futures/currentSymbolModeOrderList"])),C=M((()=>n.isUsdSizeType)),P=M((()=>n.isCryptoSizeType)),T=M((()=>o.normalizedAsks)),L=M((()=>o.normalizedBids)),w=M((()=>r.isLeaderMode?u.value:l.value)),D=M((()=>da[e.orderFormType])),O=M((()=>"MARKET_ORDER"===D.value)),I=M((()=>R({isLong:!0}))),x=M((()=>R({isLong:!1})));function _(){return Number(e.contractOrderSize)>0}function A({isLong:e}){const t=e?I.value:x.value;return Number(t)>0}function R({isLong:i}){var r,a;const{markPrice:n,lastPrice:o,limitPrice:s,trailValue:l,triggerPrice:u,effectivePrice:c,usePrice:d}=e.priceConfig,p=(null==(r=e.trailingStopInfo)?void 0:r.type)===Xi.PERCENTAGE,h=e.isTrailingStopOrderType&&e.trailingStopInfo?i?e.trailingStopInfo.buy:e.trailingStopInfo.sell:u,m=e.sideLimitPrice?i?e.sideLimitPrice.buy:e.sideLimitPrice.sell:s,g={newOrder:{orderType:D.value,side:i?"LONG":"SHORT",contractSize:(null==(a=f.value)?void 0:a.contractSize)||1},price:{markPrice:n||0,lastPrice:o||0,limitPrice:Number(m)||0},priceParams:{[p?"trailPercentage":"trailValue"]:(p?String((l||0)/100):l)||0,...h&&{triggerPrice:String(h)},effectivePrice:c||0,...d&&{usePrice:d}}};if(O.value){let t;t=e.isMarketUsdReducePercentMode?Yt(e.contractOrderSize,n):C.value?e.usdOrderSize:e.contractOrderSize,g.newOrder.size=t||0,g.curState={unitType:C.value?"USDT":"CONTRACT",orderbook:i?T.value:L.value}}return xv({shareLib:t,wasmFunction:Uo,params:g})}function F({isLong:e,quoteList:i}){var r,a;const n={newOrder:B({isLong:e}),orderConfig:z({isLong:e}),curState:{...U({isLong:e}),crossAvailableBalance:(null==(a=null==(r=m.value)?void 0:r[0])?void 0:a.availableBalance)||0}};O.value&&(n.curState.orderbook=i);const o=Number(xv({shareLib:t,wasmFunction:Vo,params:n}));return Math.abs(o)}function E({isLong:e,quoteList:i}){var r,a;const n={newOrder:B({isLong:e}),orderConfig:z({isLong:e}),curState:{...U({isLong:e}),crossAvailableBalance:(null==(a=null==(r=m.value)?void 0:r[0])?void 0:a.availableBalance)||0,...O.value&&{orderbook:i}}},o=Number(xv({shareLib:t,wasmFunction:Ho,params:n}));return Math.abs(o)}function B({isLong:t}){var i;const{contractSize:r=1}=f.value||{},a=t?I.value:x.value;return{mode:null==(i=c.value)?void 0:i.positionMode,orderType:D.value,price:a,size:Number(e.contractOrderSize)||0,side:t?"LONG":"SHORT",contractSize:r,isReduceOnly:e.isReducePosition}}function z({isLong:e}){var t,i,r,n;let o;if(p.value){const i=null==(t=m.value)?void 0:t.find((t=>t.positionDirection===(e?"LONG":"SHORT")));o=null==i?void 0:i.leverage}else o=null==(r=null==(i=m.value)?void 0:i[0])?void 0:r.leverage;const{initialMarginMarkup:l=Ii}=f.value||{};return{leverage:o||1,takerFee:a.takerFee,makerFee:a.makerFee,maintenanceMarginRatio:"function"==typeof y.value?y.value():0,fundingRate:(null==(n=g.value)?void 0:n.fundingRate)||0,adjConf:l,isMarginIncludeUnrealizedPnl:s.value}}function $({isLong:t}){var i,r,a;if(h.value)return null;if(d.value&&((null==(r=null==(i=v.value)?void 0:i[0])?void 0:r.totalContracts)||0)>0)return v.value[0];if(p.value){const i=e.isReducePosition?t?"MODE_SELL":"MODE_BUY":t?"MODE_BUY":"MODE_SELL";return null==(a=v.value)?void 0:a.find((e=>e.orderModeName===i&&e.totalContracts>0))}return null}function N(){var e;return d.value&&(null==(e=b.value)?void 0:e.length)?b.value.reduce(((e,t)=>("MODE_BUY"===t.orderModeName?e.longOrderSize=S(e.longOrderSize).plus(t.size).toNumber():"MODE_SELL"===t.orderModeName&&(e.shortOrderSize=S(e.shortOrderSize).plus(t.size).toNumber()),e)),{longOrderSize:0,shortOrderSize:0}):{longOrderSize:0,shortOrderSize:0}}function U({isLong:e}){var t,i,r;const a=$({isLong:e});if(!a)return{availableBalance:0,positionSize:0,entryPrice:0,maintenanceMargin:0,unrealizedPnl:0};const n=null==(t=a.activeWalletName)?void 0:t.replace("-USDT","-USD"),o=(null==(r=null==(i=w.value)?void 0:i[n])?void 0:r.originalAvailableBalance)||0,s="MODE_BUY"===a.orderModeName?a.totalContracts:-a.totalContracts,l=N();return{availableBalance:o,positionSize:s,entryPrice:a.entryPrice,maintenanceMargin:a.positionMargin,unrealizedPnl:a.unrealizedPnl,pendingOrders:l}}return{buyCalculatePrice:I,sellCalculatePrice:x,isValidSize:_,isValidPrice:A,getLiqPrice:function({isLong:i}){if(e.isReducePosition||!_()||!A({isLong:i}))return 0;const r={newOrder:B({isLong:i}),orderConfig:z({isLong:i}),curState:U({isLong:i})};return xv({shareLib:t,wasmFunction:qo,params:r})},getExposure:function({isLong:e}){if(!_()||!A({isLong:e}))return 0;const i={newOrder:B({isLong:e}),orderConfig:z({isLong:e}),curState:U({isLong:e})};return xv({shareLib:t,wasmFunction:Wo,params:i})},getMaxSize:function({isLong:e}){const t=e?T.value:L.value;return(O.value?0===((null==t?void 0:t.length)||0):!A({isLong:e}))?0:C.value?F({isLong:e,quoteList:t}):P.value?Qe(E({isLong:e,quoteList:t})):E({isLong:e,quoteList:t})},getUsdtMaxSize:F,getContractMaxSize:E,getCalculatePrice:R,getNewOrder:B,getOrderConfig:z,getCurrentPosition:$,getPendingOrders:N,getCurState:U}}const qD={name:"FuturesOrderValueV2",components:{FuturesTriggerTypeSelect:yD},props:{orderFormType:{type:String,required:!0},priceConfig:{type:Object,required:!0},contractOrderSize:{type:[String,Number],default:"0"},orderFormSize:{type:[String,Number],default:"0"},orderFormPrice:{type:[String,Number],default:"0"},isReducePosition:{type:Boolean,default:!1},isMarketUsdReducePercentMode:{type:Boolean,default:!1},isTrailingStopOrderType:{type:Boolean,default:!1},trailingStopInfo:{type:Object,default:()=>({})},sideLimitPrice:{type:Object,default:()=>null}},emits:["updateContractOrderSizeConvertFromUsdt","updateMarginRequired"],setup(e){const t=ci(),{proxy:i}=he(),{getLiqPrice:r}=WD(e,i.$shareLib);return{takerFee:t.takerFee,getLiqPrice:r}},computed:{...U("futures",["currentMarketPositionMode","isOneWayMode","isHedgeMode","marketData","marketDetail","currentModePosition","currentSettleInCurrency","currentMargin","currentSymbolModeOrderList"]),...y(Ge,["isUsdSizeType","sizeType"]),...y(Nn,["normalizedAsks","normalizedBids"]),orderTypeParam(){return da[this.orderFormType]},isMarketOrder(){return"MARKET_ORDER"===this.orderTypeParam},baseCurrency(){return this.marketData.baseCurrency},quoteCurrency(){return this.currentSettleInCurrency},calculatePrice(){return{buy:this.getCalculatePrice({isLong:!0}),sell:this.getCalculatePrice({isLong:!1})}},usdOrderSize(){switch(this.sizeType.id){case Ke.CONTRACTS:return Yt(this.orderFormSize,this.orderFormPrice);case Ke.CRYPTO:return ha(this.orderFormSize,this.orderFormPrice);case Ke.USD:default:return this.orderFormSize}}
1,contractOrderSizeConvertFromUsdt(){return this.isMarketOrder&&this.isUsdSizeType?{buy:pa(this.usdOrderSize,this.calculatePrice.buy),sell:pa(this.usdOrderSize,this.calculatePrice.sell)}:{buy:0,sell:0}},buyOrderValue(){return this.formatValue(this.getOrderValue({isLong:!0}))},sellOrderValue(){return this.formatValue(this.getOrderValue({isLong:!1}))},buyOrderQuantity(){return this.formatSize(this.getOrderQuantity({isLong:!0}))},sellOrderQuantity(){return this.formatSize(this.getOrderQuantity({isLong:!1}))},buyLiqPrice(){const e=this.getLiqPrice({isLong:!0});return this.formatLiqPrice({price:e,isLong:!0})},sellLiqPrice(){const e=this.getLiqPrice({isLong:!1});return this.formatLiqPrice({price:e,isLong:!1})},marginReq(){return{buy:this.getMarginReq({isLong:!0}),sell:this.getMarginReq({isLong:!1})}},displayBuyMarginReq(){return this.formatMarginReq(this.marginReq.buy)},displaySellMarginReq(){return this.formatMarginReq(this.marginReq.sell)},hideLiqPrice(){return this.isReducePosition||[ni.MARKET_TRAILING_STOP,ni.INDEX].includes(this.orderFormType)}},watch:{contractOrderSizeConvertFromUsdt(e){this.$emit("updateContractOrderSizeConvertFromUsdt",e)},marginReq(e){this.$emit("updateMarginRequired",e)}},methods:{getCalculatePrice({isLong:e}){var t,i;const{markPrice:r,lastPrice:a,limitPrice:n,trailValue:o,triggerPrice:s,effectivePrice:l,usePrice:u}=this.priceConfig,c=(null==(t=this.trailingStopInfo)?void 0:t.type)===Xi.PERCENTAGE,d=this.isTrailingStopOrderType&&this.trailingStopInfo?e?this.trailingStopInfo.buy:this.trailingStopInfo.sell:s,p=this.sideLimitPrice?e?this.sideLimitPrice.buy:this.sideLimitPrice.sell:n,h={newOrder:{orderType:this.orderTypeParam,side:e?"LONG":"SHORT",contractSize:(null==(i=this.marketDetail)?void 0:i.contractSize)||1},price:{markPrice:r||0,lastPrice:a||0,limitPrice:p||0},priceParams:{[c?"trailPercentage":"trailValue"]:(c?String(o/100):o)||0,...d&&{triggerPrice:String(d)},effectivePrice:l||0,...u&&{usePrice:u}}};if(this.isMarketOrder){let t;t=this.isMarketUsdReducePercentMode?Yt(this.contractOrderSize,r):this.isUsdSizeType?this.usdOrderSize:this.contractOrderSize,h.newOrder.size=t||0,h.curState={unitType:this.isUsdSizeType?"USDT":"CONTRACT",orderbook:e?this.normalizedAsks:this.normalizedBids}}return xv({shareLib:this.$shareLib,wasmFunction:Uo,params:h})},getOrderValue({isLong:e}){var t;return function({shareLib:e,price:t,orderSize:i,contractSize:r}){return xv({shareLib:e,wasmFunction:zo,params:{price:t,orderSize:i,contractSize:r}}
1)}({shareLib:this.$shareLib,price:e?this.calculatePrice.buy:this.calculatePrice.sell,orderSize:this.contractOrderSize,contractSize:(null==(t=this.marketDetail)?void 0:t.contractSize)||1})},getOrderQuantity({isLong:e}){return this.isMarketUsdReducePercentMode?Qe(this.contractOrderSize):function({shareLib:e,price:t,valueInUSDT:i}){return xv({shareLib:e,wasmFunction:Bo,params:{price:t,valueInUSDT:i}})}({shareLib:this.$shareLib,price:e?this.calculatePrice.buy:this.calculatePrice.sell,valueInUSDT:this.usdOrderSize||0})},getMarginReq({isLong:e}){var t;if(this.isReducePosition)return 0;let i;if(this.isHedgeMode){const t=this.currentMargin.find((t=>t.positionDirection===(e?"LONG":"SHORT")));i=null==t?void 0:t.leverage}else i=null==(t=this.currentMargin[0])?void 0:t.leverage;const{initialMarginMarkup:r=Ii,contractSize:a=1}=this.marketDetail;let n=0;if(this.isOneWayMode){const{totalContracts:e=0,orderModeName:t}=this.currentModePosition[0]||{};n=e>0&&"MODE_BUY"===t?e:-e}const o=this.getPendingOrders(),s=this.isMarketOrder&&this.isUsdSizeType?e?this.contractOrderSizeConvertFromUsdt.buy:this.contractOrderSizeConvertFromUsdt.sell:this.contractOrderSize;return VD({shareLib:this.$shareLib,positionMode:this.currentMarketPositionMode.positionMode,price:e?this.calculatePrice.buy:this.calculatePrice.sell,size:s||0,side:e?"LONG":"SHORT",contractSize:a,leverage:i||1,takerFee:this.takerFee,adjConf:r,positionSize:n,pendingOrders:o})},getPendingOrders(){if(!this.isOneWayMode||!this.currentSymbolModeOrderList.length)return{longOrderSize:0,shortOrderSize:0};const{longOrderSize:e,shortOrderSize:t}=this.currentSymbolModeOrderList.reduce(((e,t)=>("MODE_BUY"===t.orderModeName?e.longOrderSize+=t.size:"MODE_SELL"===t.orderModeName&&(e.shortOrderSize+=t.size),e)),{longOrderSize:0,shortOrderSize:0});return{longOrderSize:e,shortOrderSize:t}},formatValue(e){return this.$filters.formatNumber(e,{formatKey:2,roundMode:S.ROUND_HALF_UP})},formatSize(e){return this.$filters.formatNumber(e,{formatKey:this.marketData.sizeFilter})},formatMarginReq(e){return this.$filters.formatNumber(e,{formatKey:2,roundMode:S.ROUND_UP})},formatLiqPrice({price:e,isLong:t}){return this.$filters.formatNumber(Math.max(e,0),{formatKey:this.marketData.priceFilter,roundMode:t?S.ROUND_UP:S.ROUND_DOWN})}}},GD={class:"order-value-v2"},KD={class:"header-wrap"},QD={class:"content-wrap"},jD={class:"buy"},YD={class:"label"},ZD={class:"sell text-right"},XD={class:"content-wrap"},JD={class:"buy"},eO={class:"label"},tO={class:"sell text-right"},iO={key:0,class:"content-wrap"},rO={class:"buy"},aO={class:"sell text-right"},nO={key:1,class:"content-wrap"},oO={class:"buy"},sO={class:"label"},lO={class:"sell text-right"},uO={key:2,class:"content-wrap"},cO={class:"buy"},dO={class:"sell text-right"};const pO=$n(qD,[["render",function(e,t,i,r,n,s){const u=a("ToolTip"),p=a("FuturesTriggerTypeSelect");return o(),c("div",GD,[l("div",KD,[l("span",null,m(e.$t("t.buy")),1),l("span",null,m(e.$t("t.sell")),1)]),l("div",QD,[l("span",jD,m(s.buyOrderValue),1),l("span",YD,m(`${e.$t("t.value")} (${s.quoteCurrency})`),1),l("span",ZD,m(s.sellOrderValue),1)]),l("div",XD,[l("span",JD,m(s.buyOrderQuantity),1),l("span",eO,m(`${e.$t("t.qty")} (${s.baseCurrency})`),1),l("span",tO,m(s.sellOrderQuantity),1)]),i.isReducePosition?h("",!0):(o(),c("div",iO,[l("span",rO,m(s.displayBuyMarginReq),1),d(u,{class:"label",content:e.$t("futuresMain.order.margin"),tooltip:e.$t("futuresMain.order.margin.tip")},null,8,["content","tooltip"]),l("span",aO,m(s.displaySellMarginReq),1)])),i.isTrailingStopOrderType?(o(),c("div",nO,[l("span",oO,m(i.trailingStopInfo.buy),1),l("div",sO,[l("span",null,m(e.$t("futuresMain.trade.triggerPrice")),1),d(p,{class:"trigger-type-select"})]),l("span",lO,m(i.trailingStopInfo.sell),1)])):h("",!0),s.hideLiqPrice?h("",!0):(o(),c("div",uO,[l("span",cO,m(s.buyLiqPrice),1),d(u,{class:"label",content:e.$t("futuresMain.order.liquidation"),tooltip:e.$t("futuresMain.liqPrice.hint")},null,8,["content","tooltip"]),l("span",dO,m(s.sellLiqPrice),1)]))])}],["__scopeId","data-v-bf1eec35"]]),hO={name:"FuturesOrderInfoV2",components:{IconChevronDown:Ze},inject:{adjustOrderFormHeight:"adjustOrderFormHeight"},props:{orderFormType:{type:String,required:!0},priceConfig:{type:Object,required:!0},contractOrderSize:{type:[String,Number],default:""},usdOrderSize:{type:[String,Number],default:"0"},isReducePosition:{type:Boolean,default:!1},isMarketUsdReducePercentMode:{type:Boolean,default:!1},isTrailingStopOrderType:{type:Boolean,default:!1},trailingStopInfo:{type:Object,default:()=>null},sideLimitPrice:{type:Object,default:()=>null}},emits:["updateMaxSize"],setup(e){const t=pt(),i=ci(),{proxy:r}=he(),{buyCalculatePrice:a,sellCalculatePrice:n,isValidSize:o,isValidPrice:s,getExposure:l,getMaxSize:u,getUsdtMaxSize:c,getContractMaxSize:d,getCalculatePrice:p,getNewOrder:h,getOrderConfig:m,getCurrentPosition:g,getPendingOrders:f,getCurState:v}=WD(e,r.$shareLib);return{copyLeaderStore:t,makerFee:i.makerFee,takerFee:i.takerFee,buyCalculatePrice:a,sellCalculatePrice:n,isValidSize:o,isValidPrice:s,getExposure:l,getMaxSize:u,getUsdtMaxSize:c,getContractMaxSize:d,getCalculatePrice:p,getNewOrder:h,getOrderConfig:m,getCurrentPosition:g,getPendingOrders:f,getCurState:v}},data:()=>({isExpand:!1}),computed:{...b(["includeUnrealizedPnl"]),...b("futures",["walletMap","leaderWalletMap"]),...U("futures",["currentMarketPositionMode","isOneWayMode","isHedgeMode","isMultipleMode","currentMargin","marketData","marketDetail","currentModePosition","maintenanceMarginPercentage","currentSymbolModeOrderList"]),...y(Ge,["isUsdSizeType","isCryptoSizeType","futuresSizeCurrency","sizeFilterPhase2"]),...y(Nn,["normalizedAsks","normalizedBids"]),currentModeWalletMap(){return this.copyLeaderStore.isLeaderMode?this.leaderWalletMap:this.walletMap},orderTypeParam(){return da[this.orderFormType]},symbol(){return this.marketData.symbol},isMarketOrder(){return"MARKET_ORDER"===this.orderTypeParam},buyLiqPrice(){const e=this.getLiqPrice({isLong:!0});return this.formatLiqPrice({price:e,isLong:!0})},sellLiqPrice(){const e=this.getLiqPrice({isLong:!1});return this.formatLiqPrice({price:e,isLong:!1})},buyExposure(){return this.formatExposure(this.getExposure({isLong:!0}))},sellExposure(){return this.formatExposure(this.getExposure({isLong:!1}))},maxSize(){return{buy:this.getMaxSize({isLong:!0}),sell:this.getMaxSize({isLong:!1})}},hideExposure(){return[ni.MARKET_TRAILING_STOP,ni.INDEX].includes(this.orderFormType)}},watch:{isExpand(e){this.adjustOrderFormHeight(e,this.orderFormType)},maxSize:{handler(e){this.$emit("updateMaxSize",e)},immediate:!0}},methods:{formatLiqPrice({price:e,isLong:t}){return this.$filters.formatNumber(Math.max(e,0),{formatKey:this.marketData.priceFilter,roundMode:t?S.ROUND_UP:S.ROUND_DOWN})},formatExposure(e){return this.$filters.formatNumber(e,{formatKey:2,postfix:"x",roundMode:S.ROUND_UP})},formatMaxSize(e){return this.$filters.formatNumber(e,{formatKey:this.sizeFilterPhase2,roundMode:this.isUsdSizeType?S.ROUND_HALF_UP:S.ROUND_DOWN})}}},mO={class:"order-info-v2"},gO={key:0,class:"content-wrap"},fO={class:"buy"},vO={class:"sell text-right"},yO={class:"content-wrap"},bO={class:"buy"},SO={class:"title"},CO={key:0},PO={class:"sell text-right"};const kO=$n(hO,[["render",function(e,t,i,r,n,u){const f=a("ToolTip"),v=a("IconChevronDown");return o(),c("div",mO,[n.isExpand?(o(),c(g,{key:0},[u.hideExposure?h("",!0):(o(),c("div",gO,[l("span",fO,m(u.buyExposure),1),d(f,{class:"label",content:e.$t("futuresMain.openPosition.exposure"),tooltip:e.$t(e.includeUnrealizedPnl?"futuresMain.exposure.hint.1.excludeUnrealizedPnl":"futuresMain.exposure.hint.1")},null,8,["content","tooltip"]),l("span",vO,m(u.sellExposure),1)])),l("div",yO,[l("span",bO,m(u.formatMaxSize(u.maxSize.buy)),1),d(f,{class:"label",tooltip:e.$t("futuresMain.order.maxSize.t
1ip")},{content:s((()=>[l("span",SO,[p(m(e.$t(i.isReducePosition?"trading.avblPosition":"futuresMain.order.maxSize"))+" ",1),!e.isMobile&&e.futuresSizeCurrency.length>5?(o(),c("br",CO)):h("",!0),p(" ("+m(e.futuresSizeCurrency)+") ",1)])])),_:1},8,["tooltip"]),l("span",PO,m(u.formatMaxSize(u.maxSize.sell)),1)])],64)):h("",!0),l("div",{class:C(["expand-btn",{"is-expanded":n.isExpand}]),onClick:t[0]||(t[0]=e=>n.isExpand=!n.isExpand)},[d(v,{class:"icon-chevron-down"})],2)])}],["__scopeId","data-v-572b1619"]]),TO={name:"FuturesSizeTypeSelect",components:{FuturesChoose:om},computed:{...U("futures",["marketData","marketDetail","currentSettleInCurrency"]),...ie(Ge),crypto(){return this.marketData.baseCurrency||Ke.CRYPTO},sizeTypes(){return[{id:Ke.CRYPTO,lang:this.crypto,isI18nKey:!1},{id:Ke.USD,lang:this.currentSettleInCurrency,isI18nKey:!1},{id:Ke.CONTRACTS,lang:this.$t("futuresMain.contracts"),isI18nKey:!1}]}},watch:{$route(){this.initSizeType()}},created(){this.initSizeType()},methods:{initSizeType(){this.futuresSettingStore.isCryptoSizeType&&this.futuresSettingStore.setSizeType({id:Ke.CRYPTO,lang:this.crypto})}}};const MO={name:"FuturesSizeInput",components:{TradingInput:Wn,FuturesSizeTypeSelect:$n(TO,[["render",function(e,t,i,r,s,l){const u=a("FuturesChoose");return o(),n(u,{class:"size-type",items:l.sizeTypes,form:e.futuresSettingStore.sizeType,returnObject:"","onUpdate:form":e.futuresSettingStore.setSizeType},null,8,["items","form","onUpdate:form"])}],["__scopeId","data-v-1176c36b"]])},props:{hideSpin:{type:Boolean,default:!0},isTwap:{type:Boolean,default:!1},isPercent:{type:Boolean,default:!1},percent:{type:String,default:""},disableUsdTooltip:{type:Boolean,default:!1},price:{type:[String,Number],default:0},size:{type:[String,Number],required:!0},max:{type:[String,Number],default:0},limitMaxOrderSize:{type:Boolean,default:!1},percentPlaceholder:{type:String,default:""},maxSizeCalulatedPrice:{type:Number,default:0},minSizeCalulatedPrice:{type:Number,default:0},usdMinDecimalPlaces:{type:Number,default:2},maxSizeCheckByCalulatedPrice:{type:Boolean,default:!1}},emits:["focus","update:size","input"],data:()=>({FuturesSizeType:Ke,inputValue:""}),computed:{...U("futures",["marketData","marketDetail"]),...y(Ge,["sizeType","isCryptoSizeType","isContractSizeType","isUsdSizeType","sizeFilterPhase2"]),sizeStep(){const{contractSize:e}=this.marketDetail;switch(this.sizeType.id){case Ke.CRYPTO:return e;case Ke.USD:return.01;case Ke.CONTRACTS:default:return 1}},usdMinCalculatedPrice(){return this.minSizeCalulatedPrice||Number(this.price)},minOrderSize(){const{minOrderSize:e,contractSize:t}=this.marketDetail;return this.isUsdSizeType&&this.minSizeCalulatedPrice?S(e).times(t).times(this.minSizeCalulatedPrice).dp(this.usdMinDecimalPlaces,S.ROUND_UP).toNumber():Number(gt(e,this.price))},maxOrderSize(){const{maxOrderSize:e,contractSize:t}=this.marketDetail;return this.isUsdSizeType&&this.maxSizeCheckByCalulatedPrice?this.maxSizeCalulatedPrice?S(e).times(t).times(this.maxSizeCalulatedPrice).dp(2,S.ROUND_DOWN).toNumber():0:Number(gt(e,this.price))},maxInputSize(){return Number(this.max)?Number(this.max):this.limitMaxOrderSize&&this.maxOrderSize?this.maxOrderSize:void 0},crypto(){return this.marketData.baseCurrency||Ke.CRYPTO},showMinQtyTooltip(){return!(this.isUsdSizeType&&!this.usdMinCalculatedPrice)&&Number(this.size)<this.minOrderSize},showMaxQtyTooltip(){return!(this.isUsdSizeType&&!this.maxSizeCalulatedPrice)&&Number(this.size)>this.maxOrderSize},showCryptoTooltip(){if(!this.isCryptoSizeType||!this.size)return!1;return Number(S(this.size).div(this.marketDetail.contractSize))!==qi(this.size)},showUsdTooltip(){return!(!this.price||this.disableUsdTooltip)&&this.isUsdSizeType},showTooltip(){return""!==this.size&&(this.showMinQtyTooltip||this.showMaxQtyTooltip||this.showCryptoTooltip||this.showUsdTooltip)},showAlert(){return this.showTooltip&&(this.showMinQtyTooltip||this.showMaxQtyTooltip)},minQtyTooltipContent(){let e="";if(this.isCryptoSizeType)e=` ${this.minOrderSize} ${this.crypto}`;else if(this.isUsdSizeType){const t=this.$filters.formatNumber(this.minOrderSize,{formatKey:2,roundMode:S.ROUND_UP}),i=Qe(this.marketDetail.minOrderSize);e=` ${t} ${ht} â ${i} ${this.crypto}`}else e=` ${this.minOrderSize} ${this.$t("t.contract")}`;return this.$t("futures.order.size.minQty.tip")+e},maxQtyTooltipContent(){const{maxOrderSize:e,contractSize:t}=this.marketDetail;if(this.isCryptoSizeType)return this.$t("trading.buySell.maxOrderQuantity",{value:`${this.maxOrderSize} ${this.crypto}`});if(this.isUsdSizeType){const i=S(e).times(t).times(this.maxSizeCalulatedPrice).dp(2,S.ROUND_DOWN).toNumber();return this.$t("trading.buySell.maxOrderValue",{value:`${i} ${ht}`})}return this.$t("trading.buySell.maxOrderQuantity",{value:`${this.maxOrderSize} ${this.$t("futuresMain.contracts")}`})},cryptoTooltipContent(){const e=qi(this.size);return`â ${Qe(e)} ${this.crypto} ${this.$t("futures.order.size.crypto.tip",{crypto:this.crypto,tickSize:this.marketDetail.contractSize})}`},usdTooltipContent(){return`â ${V(",")(sa(this.size,this.price))} ${this.crypto}`},decimalPlaces(){return this.sizeFilterPhase2},tipContent(){return this.showMinQtyTooltip?this.minQtyTooltipContent:this.showMaxQtyTooltip?this.maxQtyTooltipContent:this.showCryptoTooltip?this.cryptoTooltipContent:this.showUsdTooltip?this.usdTooltipContent:""}},watch:{size:{handler(e){this.inputValue=e},immediate:!0},inputValue:{handler(e){this.$emit("update:size",e),this.$emit("input",e)},immediate:!0},sizeType(e,t){this.inputValue&&(this.inputValue=this.autoConvertSize(t.id,e.id))}},methods:{autoConvertSize(e,t){switch(e){case Ke.CRYPTO:if(t===Ke.CONTRACTS)return qi(this.inputValue);if(t===Ke.USD)return ha(this.inputValue,this.price);break;case Ke.USD:if(t===Ke.CONTRACTS)return pa(this.inputValue,this.price);if(t===Ke.CRYPTO)return sa(this.inputValue,this.price);break;case Ke.CONTRACTS:if(t===Ke.CRYPTO)return Qe(this.inputValue);if(t===Ke.USD)return Yt(this.inputValue,this.price)}}}},LO={key:0,class:"input-unit"};const wO=$n(MO,[["render",function(e,t,i,r,u,p){const h=a("Tooltip"),g=a("FuturesSizeTypeSelect"),f=a("TradingInput");return o(),n(f,{value:i.isPercent?i.percent:u.inputValue,label:"size",hideSpin:i.hideSpin,type:i.isPercent?"text":"number",enableThousandSeparator:!i.isPercent,step:p.sizeStep,min:0,max:p.maxInputSize,maxDecimalPlaces:p.decimalPlaces,placeholder:e.isUsdSizeType&&!i.isTwap?"":p.minOrderSize,tipShown:p.showTooltip,errorShown:p.showAlert,errorContent:p.tipContent,onF
1ocus:t[0]||(t[0]=t=>e.$emit("focus")),onInput:t[1]||(t[1]=e=>u.inputValue=e)},{prepend:s((()=>[d(h,{tooltip:e.$t("futuresMain.trade.quantity.tip",{customText:e.marketDetail.contractSize})},{content:s((()=>[l("span",null,m(e.$t("t.positionSize")),1)])),_:1},8,["tooltip"])])),append:s((()=>[i.isPercent?(o(),c("span",LO,m(i.percentPlaceholder||e.$t("trading.twap.availBalance")),1)):(o(),n(g,{key:1}))])),_:1},8,["value","hideSpin","type","enableThousandSeparator","step","max","maxDecimalPlaces","placeholder","tipShown","errorShown","errorContent"])}],["__scopeId","data-v-8f67aae7"]]),DO={class:"strong"},OO={class:"strong"},IO={class:"strong"},xO=$n(A({__name:"BboButton",props:{active:{type:Boolean,default:!1}},emits:["toggle"],setup(e){const t=e;return(e,i)=>{const r=a("Tooltip");return o(),n(r,{disable:e.isMobile,placement:x(ma).bottomEnd,hasCursorQuestion:!1},{tooltip:s((()=>[l("p",null,m(e.$t("trading.bbo.tooltip.1")),1),l("ul",null,[l("li",null,[l("span",DO,m(e.$t("trading.bot.midPrice")),1),p(" â "+m(e.$t("trading.bbo.tooltip.2")),1)]),l("li",null,[l("span",OO,m(e.$t("trading.bbo.tooltip.3")),1),p(" â "+m(e.$t("trading.bbo.tooltip.4")),1)]),l("li",null,[l("span",IO,m(e.$t("trading.bbo.tooltip.5")),1),p(" â "+m(e.$t("trading.bbo.tooltip.6")),1)])]),l("p",null,m(e.$t("trading.bbo.tooltip.7")),1)])),content:s((()=>[l("div",{class:C(["bbo-btn",{active:t.active}]),onClick:i[0]||(i[0]=t=>e.$emit("toggle"))}," BBO ",2)])),_:1},8,["disable","placement"])}}}),[["__scopeId","data-v-fbca4c45"]]),{enableLastPriceDependentUI:_O}=zt;const AO=$n({name:"LimitLastPriceBtn",props:{futures:{type:Boolean,default:!1},isBuy:{type:Boolean}},emits:["change"],data:()=>({enableLastPriceDependentUI:_O}),computed:{...b("orderBook",["lastPrice"]),...y(Nn,["bestAskPrice","bestBidPrice"])},methods:{handleClick(){let e;e=this.lastPrice||this.futures?this.lastPrice:this.isBuy?this.bestBidPrice:this.bestAskPrice,this.$emit("change",String(e||""))}}},[["render",function(e,t,i,r,a,n){return a.enableLastPriceDependentUI?(o(),c("span",{key:0,class:"last-price",onClick:t[0]||(t[0]=(...e)=>n.handleClick&&n.handleClick(...e))},m(e.$t("trading.form.last")),1)):h("",!0)}],["__scopeId","data-v-bc14ca0d"]]),RO={name:"TpSlOrderFormOptions",components:{TradingInput:Wn,FuturesMarkLastSelect:um,IconNotification:Di,TpslAdvancedDialog:Lm},props:{symbol:{type:String,required:!0},enableTpSl:{type:Boolean,default:!1},tpPrice:{type:[String,Number],default:""},tpPriceType:{type:Object,default:()=>({})},slPrice:{type:[String,Number],default:""},slPriceType:{type:Object,default:()=>({})},price:{type:[String,Number],default:""},cryptoSize:{type:[String,Number],default:""},buyQty:{type:Number,default:0},sellQty:{type:Number,default:0},priceError:{type:String,default:""},dialogDefaultSide:{type:String,default:""}},emits:["update:slPrice","update:slPriceType","update:tpPrice","update:tpPriceType","update:enableTpSl"],setup:()=>({takerFee:ci().takerFee}),data:()=>({tpErrorMsg:"",slErrorMsg:"",showAdvancedDialog:!1}),computed:{...U(["isUnifiedWallet"]),...U("futures",["marketData","marketDetail","hasOpenPosition","openPosition","isHedgeMode","walletLeverage","currentMargin","initialMarginPercentage"]),...y(Ge,["orderFormType","isMarketOrderFormType"]),...y(Nn,["bestAskPrice","bestBidPrice"]),hasTpSlSetting(){return this.openPosition.some((e=>{const{takeProfitOrder:t,stopLossOrder:i}=e;return t||i}))},showProfit(){return this.tpPrice&&!this.disableEstimatedPnl&&!this.showTpError&&!this.priceError},showLoss(){return this.slPrice&&!this.disableEstimatedPnl&&!this.showSlError&&!this.priceError},showTpError(){return!!this.tpErrorMsg},showSlError(){return!!this.slErrorMsg},disableEstimatedPnl(){return!this.price||!this.cryptoSize||(!!(this.tpPrice&&this.slPrice&&(S(this.tpPrice).gt(this.price)&&S(this.slPrice).gt(this.price)||S(this.tpPrice).lt(this.price)&&S(this.slPrice).lt(this.price)))||!!(this.tpPrice&&S(this.tpPrice).eq(this.price)||this.slPrice&&S(this.slPrice).eq(this.price)))},estimatedProfit(){return jh(this.tpPrice,this.price,this.cryptoSize,this.marketData.priceFilter,this.takerFee,!0)},estimatedLoss(){return jh(this.slPrice,this.price,this.cryptoSize,this.marketData.priceFilter,this.takerFee,!1)},tpslFormulaLeverage(){if(!this.isUnifiedWallet||!this.isHedgeMode)return this.walletLeverage;return this.currentMargin.map((e=>e.leverage))[this.tpPrice>this.slPrice?0:1]},part1FormulaResultBuy(){return this.enableTpSl?hi({price:Number(this.price),qty:this.buyQty,contractValue:this.marketDetail.contractSize,takerFees:this.takerFee,initialMarginPercentage:this.initialMarginPercentage(),leverage:this.tpslFormulaLeverage}):0},part1FormulaResultSell(){return this.enableTpSl?hi({price:Number(this.price),qty:this.sellQty,contractValue:this.marketDetail.contractSize,takerFees:this.takerFee,initialMarginPercentage:this.initialMarginPercentage(),leverage:this.tpslFormulaLeverage}):0},estimatedProfitRoe(){return Yh(this.tpPrice,this.price,this.estimatedProfit,this.part1FormulaResultBuy,this.part1FormulaResultSell,!0)},estimatedLossRoe(){return Yh(this.slPrice,this.price,this.estimatedLoss,this.part1FormulaResultBuy,this.part1FormulaResultSell,!1)},currentPositionTpPrice(){return this.getPositionTpSlPrice(this.openPosition[0],"takeProfitOrder")},currentPositionSlPrice(){return this.getPositionTpSlPrice(this.openPosition[0],"stopLossOrder")},currentLongPosition(){return this.openPosition.find((e=>"LONG"===e.positionDirection))},currentShortPosition(){return this.openPosition.find((e=>"SHORT"===e.positionDirection))},currentLongPositionTpPrice(){return this.getPositionTpSlPrice(this.currentLongPosition,"takeProfitOrder")},currentLongPositionSlPrice(){return this.getPositionTpSlPrice(this.currentLongPosition,"stopLossOrder")},currentShortPositionTpPrice(){return this.getPositionTpSlPrice(this.currentShortPosition,"takeProfitOrder")},currentShortPositionSlPrice(){return this.getPositionTpSlPrice(this.currentShortPosition,"stopLossOrder")}},watch:{enableTpSl(e){this.setEnableOrderFormTpSl(e)}},methods:{...f(Vn,["setEnableOrderFormTpSl"]),getBestPriceFromOrderbook(){return(this.isLong?this.bestAskPrice:this.bestBidPrice)||0},validateTpSl(e){let t=!1,i=!1;if(this.tpPrice){const i=this.isMarketOrderFormType&&"lastPrice"
1===this.tpPriceType.payloadName?this.getBestPriceFromOrderbook():this.price;t=e?S(this.tpPrice).lte(i):S(this.tpPrice).gte(i)}if(this.slPrice){const t=this.isMarketOrderFormType&&"lastPrice"===this.slPriceType.payloadName?this.getBestPriceFromOrderbook():this.price;i=e?S(this.slPrice).gte(t):S(this.slPrice).lte(t)}return this.tpErrorMsg=t?this.setTpErrorMsg(e):"",this.slErrorMsg=i?this.setSlErrorMsg(e):"",!t&&!i},setTpErrorMsg(e){return this.$t("tpsl.triggerWarning",{triggerType:this.$t("futuresMain.trade.takeProfit"),highOrLow:e?this.$t("t.higher").toLowerCase():this.$t("t.lower").toLowerCase(),price:this.getOrderTypePriceText(e,"markPrice"===this.tpPriceType.payloadName)})},setSlErrorMsg(e){return this.$t("tpsl.triggerWarning",{triggerType:this.$t("tpsl.sl"),highOrLow:e?this.$t("t.lower").toLowerCase():this.$t("t.higher").toLowerCase(),price:this.getOrderTypePriceText(e,"markPrice"===this.slPriceType.payloadName)})},getPositionTpSlPrice(e,t){var i;const r=null==(i=null==e?void 0:e[t])?void 0:i.triggerPrice;return r?this.$filters.formatNumber(r,this.marketData.priceFilter):"-"},handleClickConfirm({tpPrice:e,tpTrigger:t,slPrice:i,slTrigger:r}){this.$emit("update:tpPrice",e),this.$emit("update:tpPriceType",t),this.$emit("update:slPrice",i),this.$emit("update:slPriceType",r)},getOrderTypePriceText(e,t){switch(this.orderFormType){case ni.LIMIT:case ni.LIMIT_STOP:case ni.LIMIT_TAKE_PROFIT:return this.$t("c2c.limitPrice").toLowerCase();case ni.MARKET:return t?this.$t("futuresMain.openPosition.markPrice").toLowerCase():e?this.$t("t.bestAskPrice").toLowerCase():this.$t("t.bestBidPrice").toLowerCase();case ni.MARKET_STOP:return this.$t("futuresMain.trade.stopPrice").toLowerCase();case ni.MARKET_TAKE_PROFIT:return this.$t("futuresMain.trade.triggerPrice").toLowerCase();default:return this.$t("t.price").toLowerCase()}}}},FO={class:"tp-sl-options"},EO={class:"tp-sl-checkbox-row"},BO={class:"tp-sl-checkbox-wrap"},zO={key:0,class:"entire-position-text"},$O={key:0,class:"inputs-container"},NO={class:"estimated-text-wrap"},UO={key:0,class:"brand-color-positive"},HO={key:1},VO={key:2,class:"brand-color-positive"},WO={key:3},qO={class:"estimated-text-wrap"},GO={key:0,class:"brand-color-negative"},KO={key:1},QO={key:2,class:"brand-color-negative"},jO={key:3},YO={key:1,class:"current-position-tp-sl-info"},ZO={key:0},XO={class:"brand-color-positive"},JO={class:"brand-color-negative"},eI={key:1};const tI=$n(RO,[["render",function(e,t,i,r,u,f){const v=a("Tooltip"),y=a("Checkbox"),b=a("FuturesMarkLastSelect"),S=a("TradingInput"),C=a("IconNotification"),P=a("TpslAdvancedDialog");return o(),c("div",FO,[l("div",EO,[l("div",BO,[d(y,{value:i.enableTpSl,class:"tp-sl-checkbox",onInput:t[0]||(t[0]=t=>e.$emit("update:enableTpSl",t))},{default:s((()=>[d(v,{tooltip:e.$t("tpsl.checkbox.tooltip"),content:`${e.$t("trading.stop-take-profit.takeProfit")} / ${e.$t("tpsl.sl")}`},null,8,["tooltip","content"])])),_:1},8,["value"]),i.enableTpSl?(o(),c("span",zO," ("+m(e.$t("tpsl.entirePosition"))+") ",1)):h("",!0)]),i.enableTpSl?(o(),c("span",{key:0,class:"advanced-btn",onClick:t[1]||(t[1]=e=>u.showAdvancedDialog=!0)},m(e.$t("t.advanced")),1)):h("",!0)]),i.enableTpSl?(o(),c("div",$O,[d(S,{value:i.tpPrice,label:e.$t("trading.stop-take-profit.takeProfit"),enableThousandSeparator:"",errorMsg:u.tpErrorMsg,errorShown:f.showTpError,step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),onInput:t[3]||(t[3]=t=>e.$emit("update:tpPrice",t)),onFocus:t[4]||(t[4]=e=>u.tpErrorMsg="")},{prepend:s((()=>[p(m(e.$t("trading.stop-take-profit.takeProfit")),1)])),append:s((()=>[d(b,{value:i.tpPriceType,"onUpdate:value":t[2]||(t[2]=t=>e.$emit("update:tpPriceType",t))},null,8,["value"])])),_:1},8,["value","label","errorMsg","errorShown","step","min"]),d(v,{tooltip:e.$t("tpsl.estimated.pnl.tooltip")},{content:s((()=>[l("div",NO,[p(m(e.$t("t.estimatedProfit"))+": ",1),f.showProfit?(o(),c("span",UO,m(f.estimatedProfit),1)):(o(),c("span",HO,"-")),p(" USDT ("+m(e.$t("t.roe"))+": ",1),f.showProfit?(o(),c("span",VO,m(f.estimatedProfitRoe)+"% ",1)):(o(),c("span",WO,"-")),t[9]||(t[9]=p(" ) "))])])),_:1},8,["tooltip"]),d(S,{value:i.slPrice,label:e.$t("tpsl.sl"),enableThousandSeparator:"",errorMsg:u.slErrorMsg,errorShown:f.showSlError,step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),onInput:t[6]||(t[6]=t=>e.$emit("update:slPrice",t)),onFocus:t[7]||(t[7]=e=>u.slErrorMsg="")},{prepend:s((()=>[p(m(e.$t("tpsl.sl")),1)])),append:s((()=>[d(b,{value:i.slPriceType,"onUpdate:value":t[5]||(t[5]=t=>e.$emit("update:slPriceType",t))},null,8,["value"])])),_:1},8,["value","label","errorMsg","errorShown","step","min"]),d(v,{tooltip:e.$t("tpsl.estimated.pnl.tooltip")},{content:s((()=>[l("div",qO,[p(m(e.$t("t.estimatedLoss"))+": ",1),f.showLoss?(o(),c("span",GO,m(f.estimatedLoss),1)):(o(),c("span",KO,"-")),p(" USDT ("+m(e.$t("t.roe"))+": ",1),f.showLoss?(o(),c("span",QO,m(f.estimatedLossRoe)+"% ",1)):(o(),c("span",jO,"-")),t[10]||(t[10]=p(" ) "))])])),_:1},8,["tooltip"])])):h("",!0),!i.enableTpSl&&f.hasTpSlSetting?(o(),c("div",YO,[d(C,{class:"icon-notification"}),e.isHedgeMode?(o(),c("div",ZO,[p(m(e.$t("tpsl.currentPosition.hedgeMode"))+" ",1),t[11]||(t[11]=l("br",null,null,-1)),f.currentLongPosition?(o(),c(g,{key:0},[l("span",XO,m(e.$t("t.long"))+":",1),p(" "+m(f.currentLongPositionTpPrice)+" / "+m(f.currentLongPositionSlPrice),1)],64)):h("",!0),t[12]||(t[12]=p(" Â ")),f.currentShortPosition?(o(),c(g,{key:1},[l("span",JO,m(e.$t("t.short"))+":",1),p(" "+m(f.currentShortPositionTpPrice)+" / "+m(f.currentShortPositionSlPrice),1)],64)):h("",!0)])):(o(),c("div",eI,[p(m(e.$t("tpsl.currentPosition"))+" ",1),t[13]||(t[13]=l("br",null,null,-1)),p(" "+m(f.currentPositionTpPrice)+" / "+m(f.currentPositionSlPrice),1)]))])):h("",!0),u.showAdvancedDialog?(o(),n(P,{key:2,show:u.showAdvancedDialog,"onUpdate:show":t[8]||(t[8]=e=>u.showAdvancedDialog=e),symbol:i.symbol,orderPrice:i.price,orderSize:i.cryptoSize,tpPrice:i.tpPrice,tpTrigger:i.tpPriceType,slPrice:i.slPrice,slTrigger:i.slPriceType,formPrice:Number(i.price),buyQty:i.buyQty,sellQty:i.sellQty,priceError:i.priceError,defaultSide:i.dialogDefaultSide,onConfirm:f.handleClickConfirm},null,8,["show","symbol","orderPrice","orderSize","tpPrice","tpTrigger","slPrice","slTrigger","formPrice","buyQty","sellQty","priceError","defaultSide","onConfirm"])):h("",!0)])}],["__scopeId","data-v-07545f50"]]),iI={name:"TpSlOrderWithPositioinWarningDialog",components:{WarningConfirmDialog:mi},props:{visible:{type:Boolean,default:!1},type:{type:Number,default:wm}},emits:["update:visible","confirm"],computed:{titleText(){return this.type===Im?this.$t("t.riskAlert"):this.$t("t.notice")},contentText(){switch(this.type){case Dm:return this.$t("tpsl.orderWithPosition.warning.override");case Om:return this.$t("tpsl.orderWithPosition.warning.apply");case Im:return this.$t("tpsl.orderWithPosition.warning.notTakeEffect");default:return""}}},methods:{handleClickConfirm(){this.$emit("confirm"),this.$emit("update:visible",!1)}}},rI={class:"tp-sl-warning-dialog"},aI={class:"dialog-title"},nI={class:"dialog-content"};const oI=$n(iI,[["render",function(e,t,i,r,u,c){const h=a("BaseButton"),g=a("WarningConfirmDialog");return o(),n(g,{isNewStyle:"",visible:i.visible,"onUpdate:visible":t[1]||(t[1]=t=>e.$emit("update:visible",t))},{buttons:s((()=>[d(h,{type:"confirm",class:"primary block",size:"large",onClick:c.handleClickConfirm},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["onClick"]),l("div",{class:"cancel-btn",onClick:t[0]||(t[0]=t=>e.$emit("update:visible",!1))},m(e.$t("t.cancel")),1)])),default:s((()=>[l("div",rI,[l("h2",aI,m(c.titleText),1),l("div",nI,m(c.contentText),1)])])),_:1},8,["visible"])}],["__scopeId","data-v-c307e1ac"]]),sI={name:"MultipleModePositionLimitWarning",components:{IconColorAlertCircle:JP},computed:{...U("futures",["isReachedMaxPositionSize","marketDetail"])}},lI={key:0,class:"position-limited-warning"},uI={class:"flex-1"};const cI=$n(sI,[["render",function(e,t,i,r,n,s){const u=a("IconColorAlertCircle");return e.isReachedMaxPositionSize?(o(),c("div",lI,[d(u,{width:16,height:16}),l("div",uI,m(e.$t("futuresMain.trade.isolated.orderLimitHint",{num:e.marketDetail.userMaxPositionSize})),1)])):h("",!0)}],["__scopeId","data-v-b94b2534"]]),dI={__name:"PostOnlyCheckbox",props:{value:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=Ge();D((()=>r.orderFormSettings),(({postOnly:e})=>{i("update:value",e)})),L((()=>{i("update:value",r.orderFormSettings.postOnly)}));const l=ea((async e=>{await r.updateOrderFormSettings({postOnly:e})}),500);return(t,i)=>{const r=a("Tooltip"),u=a("Checkbox");return o(),n(u,{value:e.value,name:"post-only",onInput:x(l)},{default:s((()=>[d(r,{tooltip:t.$t("order.post-only.tip"),content:t.$t("order.post-only")},null,8,["tooltip","content"]),_(t.$slots,"default")])),_:3},8,["value","onInput"])}}},pI={__name:"ReduceOnlyCheckbox",props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:t}){const i=e,r=t,l=Ge(),{t:u}=G(),c=M((()=>i.disabled?u("order.reduce-only.tip.disabled"):u("order.reduce-only.tip")));D((()=>l.orderFormSettings),(({reduceOnly:e})=>{r("update:value",e)})),L((()=>{r("update:value",l.orderFormSettings.reduceOnly)}
1));const p=ea((async e=>{await l.updateOrderFormSettings({reduceOnly:e})}),500);return(t,i)=>{const r=a("Tooltip"),l=a("Checkbox");return o(),n(l,{value:!e.disabled&&e.value,disabled:e.disabled,name:"reduce-only",onInput:x(p)},{default:s((()=>[d(r,{tooltip:c.value,content:t.$t("order.reduce-only")},null,8,["tooltip","content"])])),_:1},8,["value","disabled","onInput"])}}};const hI=$n({name:"TradingInputAppendSelect",components:{FuturesChoose:om},props:{value:{type:String,required:!0},typeList:{type:Array,default:()=>[]},returnObject:{type:Boolean,default:!1}},emits:["update:value"],methods:{setType(e){this.$emit("update:value",e)}}},[["render",function(e,t,i,r,s,l){const u=a("FuturesChoose");return o(),n(u,{class:"select-wrapper",items:i.typeList,form:i.value,returnObject:i.returnObject,"onUpdate:form":l.setType},null,8,["items","form","returnObject","onUpdate:form"])}],["__scopeId","data-v-5c86fc72"]]),mI={class:"tif"},gI=$n({__name:"TifSelector",props:{value:{type:String,default:"GTC"}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=Ge();D((()=>r.orderFormSettings),(({timeInForce:e})=>{i("update:value",e)}));const n=M((()=>ga.map((e=>({id:e,isI18nKey:!0,lang:`t.order.timeInForce.${e}`,fullName:`t.order.timeInForce.${e}`})))));L((()=>{i("update:value",r.orderFormSettings.timeInForce)}));const u=ea((async e=>{await r.updateOrderFormSettings({timeInForce:e})}),500);return(t,i)=>{const r=a("ToolTip");return o(),c("div",mI,[d(r,{tooltip:t.$t("trading.buySell.timeInForce")},{content:s((()=>i[0]||(i[0]=[l("span",{class:"tif-text"},"TIF",-1)]))),_:1},8,["tooltip"]),d(x(hI),{value:e.value,typeList:n.value,"onUpdate:value":x(u)},null,8,["value","typeList","onUpdate:value"])])}}},[["__scopeId","data-v-71572763"]]);function fI(){const e=k(),t=pt(),i=M((()=>t.isLeaderMode)),r=M((()=>{var t;if(!i.value)return!0;const r=(null==(t=e.getters["futures/leaderMainWallet"])?void 0:t.walletTotalValue)||0;return S(r).gte(fa)})),a=M((()=>i.value&&e.getters["futures/leaderPosition"]||[])),n=M((()=>i.value&&e.getters["futures/currentModeOrderList"]||[])),o=()=>{const e=a.value;if(0===e.length)return 0;let t=0;return e.forEach((e=>{const i=Number(e.totalContracts)||0,r=e.orderModeName===xt.BUY;t+=r?i:-i})),t},s=()=>{const e=n.value;if(0===e.length)return 0;let t=0;return e.forEach((e=>{const i=Number(e.amount)||0,r="BUY"===e.side||e.orderModeName===xt.BUY;t+=r?i:-i})),t},l=(e,t)=>{if(!Number(e))return!1;if(!i.value)return!1;const r=o(),a=s(),n=0!==r;if(!n)return!0;if(n){if(r>0===t)return!0}if(n||0!==a){const i=((e,t)=>{const i=o(),r=i+s()+(t?Math.abs(e):-Math.abs(e));return 0!==i&&Math.sign(r)!==Math.sign(i)&&0!==r})(e,t);if(i)return!0}return!1};return{shouldDisableOrder:(e,t)=>{if(!i.value)return!1;return!!l(e,t)&&!r.value}}}const vI={class:"leader-order-validation-warning"},yI=$n({__name:"LeaderOrderValidationWarning",setup:e=>(e,t)=>(o(),c("div",vI,m(e.$t("copyTrading.warning.underLimit.3",{value:`${x(fa)} ${x(ht)}`})),1))},[["__scopeId","data-v-d18f95b9"]]),bI={stop:{buy:">=",sell:"<="},takeProfit:{buy:"<=",sell:">="}},SI={indexPrice:"futuresMain.trade.index",markPrice:"trading.mark",lastPrice:"trading.last"};function CI({orderType:e,priceType:t,$t:i}){const r=bI[e].buy,a=bI[e].sell;return`${i("trading.order.tooltip.inactive")}\n ${i("trading.order.tooltip.execution",{side:i("t.buy"),priceType:i(SI[t]||"trading.last"),operator:r})}\n ${i("trading.order.tooltip.execution",{side:i("t.sell"),priceType:i(SI[t]||"trading.last"),operator:a})}`}const PI={class:"header"},kI={class:"title"},TI={class:"body"},MI={key:0,class:"message-title"},LI={class:"message-content"},wI={class:"highlight"},DI={class:"confirm-text"},OI={class:"btn-wrapper"},II=$n({__name:"PriceProtectionConfirmDialog",props:{width:{type:String,default:"400px"},headerTitle:{type:String,default:""},messages:{type:Array,default:()=>[]}},emits:["dialog:closed"],setup(e,{emit:t}){const i=t;function r(){i("dialog:closed",!0)}function u(){i("dialog:closed")}return(t,i)=>{const f=a("i18n-t");return o(),n(x(pi),{class:"common-warning-dialog",width:t.isMobile?"100%":e.width,isBrandNewStyle:"",isBottomUp:t.isMobile,showClose:!1,onClosed:u},{body:s((()=>[l("div",PI,[l("span",kI,m(e.headerTitle||t.$t("t.warning")),1),d(x(ze),{class:"icon-close",onClick:u})]),l("div",TI,[(o(!0),c(g,null,R(e.messages,((e,t)=>(o(),c("div",{key:t,class:"message"}
1,[e.title?(o(),c("div",MI,m(e.title),1)):h("",!0),l("div",LI,[d(f,{keypath:e.keypath},te({newOrderPrice:s((()=>[l("strong",wI,m(e.newOrderPrice),1)])),_:2},[e.state?{name:"state",fn:s((()=>[p(m(e.state),1)])),key:"0"}:void 0]),1032,["keypath"])])])))),128)),l("div",DI,m(t.$t("trading.order.priceProtection.confirm")),1),l("div",OI,[d(x(va),{class:"btn confirm",onClick:r},{default:s((()=>[p(m(t.$t("t.confirm")),1)])),_:1}),d(x(va),{class:"btn cancel",onClick:u},{default:s((()=>[p(m(t.$t("t.cancel")),1)])),_:1})])])])),_:1},8,["width","isBottomUp"])}}},[["__scopeId","data-v-fc091240"]]);function xI({dialogComponent:e=II}={}){const t=k(),{$openDialog:i}=ar(),r=dt(),{t:a}=G(),n=M((()=>r.currentMarketIndexPrice)),o=M((()=>t.state.futures.futuresMarkPriceMap)),{marketMap:s}=Q(qe()),l=M((()=>t.state.futures.marketMap)),u=({isSpot:e,isBuyAction:t,symbol:i}={})=>{const r=(e?s.value:l.value)[i][t?"protectionRatioBuy":"protectionRatioSell"];return Math.abs(r)};return{checkPriceProtection:async t=>{const r=t.tradingType===ni.TWAP,s=t.tradingType===ni.OCO;return r?await(async({isSpot:t,isBuyAction:r,symbol:n,maxDistanceThroughBook:o})=>{const s=u({isSpot:t,isBuyAction:r,symbol:n});return S(o||0).div(100).lte(s)?{ok:!0}:await i(e,{messages:[{headerTitle:a("tading.order.priceProtection.twap.headerTitle"),keypath:"tading.order.priceProtection.twap",newOrderPrice:`${Qt(100*s)}%`}]})?{ok:!0,maxDistanceThroughBook:100*s}:{ok:!1}})(t):s?await(async({isSpot:t,isBuyAction:r,symbol:s,orderPrice:l,limitPrice:c,triggerPrice:d,priceFilter:p,quoteCurrency:h="USDT"})=>{const m=u({isSpot:t,isBuyAction:r,symbol:s}),g=t?n.value:o.value[s],f=S(g).times(S(1).plus(r?m:-m)).dp(p).toNumber(),v=S(d).times(S(1).plus(r?m:-m)).dp(p).toNumber(),y=r?S(l).gt(f):S(l).lt(f),b=r?S(c).gt(v):S(c).lt(v);if(!y&&!b)return{ok:!0};const C=[],P=a(r?"t.exceeds":"t.isBelow");if(y&&C.push({title:a("tading.order.priceProtection.limit"),keypath:"tading.order.priceProtection.stopLimit",state:P,newOrderPrice:`${Qt(f,p)} ${h}`}),b&&C.push({title:a("tading.order.priceProtection.stopLimit.title"),keypath:"tading.order.priceProtection.limit",state:P,newOrderPrice:`${Qt(v,p)} ${h}`}),!(await i(e,{messages:C})))return{ok:!1};const k={ok:!0};return y&&(k.protectionPrice=f),b&&(k.triggerProtectionPrice=v),k})(t):await(async({isSpot:t,isBuyAction:r,symbol:s,orderPrice:l,triggerPrice:c,priceFilter:d,quoteCurrency:p="USDT"})=>{const h=u({isSpot:t,isBuyAction:r,symbol:s}),m=c||(t?n.value:o.value[s]),g=S(m).times(S(1).plus(r?h:-h)).dp(d).toNumber();if(!(r?S(l).gt(g):S(l).lt(g)))return{ok:!0};const f=a(r?"t.exceeds":"t.isBelow");return await i(e,{messages:[{keypath:"tading.order.priceProtection.limit",state:f,newOrderPrice:`${Qt(g,d)} ${p}`}]})?{ok:!0,protectionPrice:g}:{ok:!1}})(t)},getPriceProtectionRatio:u}}function _I(e,t=!1){return me(((i,r)=>({get(){i();const r=window.localStorage.getItem(e);return t?JSON.parse(r||"null"):r},set(i){null===i?window.localStorage.removeItem(e):window.localStorage.setItem(e,t?JSON.stringify(i):`${i}`),r()}})))}const AI="MID_PRICE",RI="COUNTERPARTY_1",FI="COUNTERPARTY_5",EI="QUEUE_1",BI="QUEUE_5",zI="BUY",$I="SELL",NI=[{id:AI,lang:ya("trading.bot.midPrice"),isI18nKey:!0},{id:RI,lang:ya("trading.bbo.counterparty1"),isI18nKey:!0},{id:FI,lang:ya("trading.bbo.counterparty5"),isI18nKey:!0},{id:EI,lang:ya("trading.bbo.queue1"),isI18nKey:!0},{id:BI,lang:ya("trading.bbo.queue5"),isI18nKey:!0}],UI={[EI]:{level:1,opposite:!1},[BI]:{level:5,opposite:!1},[RI]:{level:1,opposite:!0},[FI]:{level:5,opposite:!0}};function HI({type:e,side:t,orderBook:i}){if(!i)return null;const r=i.buyQuote??[],a=i.sellQuote??[],n=e=>{var t;return(null==(t=r[e-1])?void 0:t.price)??null},o=e=>{var t;return(null==(t=a[e-1])?void 0:t.price)??null};if(e===AI){const e=n(1),t=o(1);return null==e||null==t?null:S(e).plus(t).div(2).toString()}const s=UI[e];if(!s)return null;return(s.opposite?t===zI:t===$I)?o(s.level):n(s.level)}function VI({fetchOrderBook:e,symbol:t,depth:i=5,rpi:r=!0,storageKey:a}){const n=T(null),o=T(!1),s=a?_I(a):T(null),l=M((()=>NI.find((e=>e.id===s.value))??NI[0]));async function u(){const a=ge(t);if(!a)return null;o.value=!0;try{const t=await e({symbol:a,depth:i,rpi:r});return n.value=t,t}catch(s){return n.value=null,null}finally{o.value=!1}}return{orderBook:n,isLoading:o,options:NI,selectedOption:l,setSelectedType:function(e){s.value="string"==typeof e?e:e.id},refresh:u,resolve:function(e,t){return HI({type:e,side:t,orderBook:n.value})},resolveFresh:async function(e,t){return HI({type:e,side:t,orderBook:await u()})}}}const WI=A({__name:"IconCalculator2",setup:e=>(e,t)=>
1(o(),n(Ee,{"aria-label":"calculator",width:"16",height:"16"},{default:s((()=>t[0]||(t[0]=[l("path",{d:"M11.667 1.5C12.9554 1.50018 13.9998 2.5446 14 3.83301V12.167C13.9998 13.4554 12.9554 14.4998 11.667 14.5H4.33301C3.0446 14.4998 2.00018 13.4554 2 12.167V3.83301C2.00018 2.5446 3.0446 1.50018 4.33301 1.5H11.667ZM4.33301 2.66699C3.68893 2.66717 3.16717 3.18893 3.16699 3.83301V12.167C3.16717 12.8111 3.68893 13.3328 4.33301 13.333H11.667C12.3111 13.3328 12.8328 12.8111 12.833 12.167V3.83301C12.8328 3.18893 12.3111 2.66717 11.667 2.66699H4.33301ZM5.57812 11C5.81112 11 6 11.2239 6 11.5C6 11.7761 5.81112 12 5.57812 12H4.92188C4.68888 12 4.5 11.7761 4.5 11.5C4.5 11.2239 4.68888 11 4.92188 11H5.57812ZM7.57812 11C7.81112 11 8 11.2239 8 11.5C8 11.7761 7.81112 12 7.57812 12H6.92188C6.68888 12 6.5 11.7761 6.5 11.5C6.5 11.2239 6.68888 11 6.92188 11H7.57812ZM9.57812 11C9.81112 11 10 11.2239 10 11.5C10 11.7761 9.81112 12 9.57812 12H8.92188C8.68888 12 8.5 11.7761 8.5 11.5C8.5 11.2239 8.68888 11 8.92188 11H9.57812ZM11 7C11.2761 7 11.5 7.18888 11.5 7.42188V11.5781C11.5 11.8111 11.2761 12 11 12C10.7239 12 10.5 11.8111 10.5 11.5781V7.42188C10.5 7.18888 10.7239 7 11 7ZM5.57812 9C5.81112 9 6 9.22386 6 9.5C6 9.77614 5.81112 10 5.57812 10H4.92188C4.68888 10 4.5 9.77614 4.5 9.5C4.5 9.22386 4.68888 9 4.92188 9H5.57812ZM7.57812 9C7.81112 9 8 9.22386 8 9.5C8 9.77614 7.81112 10 7.57812 10H6.92188C6.68888 10 6.5 9.77614 6.5 9.5C6.5 9.22386 6.68888 9 6.92188 9H7.57812ZM9.57812 9C9.81112 9 10 9.22386 10 9.5C10 9.77614 9.81112 10 9.57812 10H8.92188C8.68888 10 8.5 9.77614 8.5 9.5C8.5 9.22386 8.68888 9 8.92188 9H9.57812ZM5.57812 7C5.81112 7 6 7.22386 6 7.5C6 7.77614 5.81112 8 5.57812 8H4.92188C4.68888 8 4.5 7.77614 4.5 7.5C4.5 7.22386 4.68888 7 4.92188 7H5.57812ZM7.57812 7C7.81112 7 8 7.22386 8 7.5C8 7.77614 7.81112 8 7.57812 8H6.92188C6.68888 8 6.5 7.77614 6.5 7.5C6.5 7.22386 6.68888 7 6.92188 7H7.57812ZM9.57812 7C9.81112 7 10 7.22386 10 7.5C10 7.77614 9.81112 8 9.57812 8H8.92188C8.68888 8 8.5 7.77614 8.5 7.5C8.5 7.22386 8.68888 7 8.92188 7H9.57812ZM11.0645 4C11.3865 4 11.6473 4.26099 11.6475 4.58301C11.6475 4.90517 11.3866 5.16699 11.0645 5.16699H4.93457C4.61255 5.16682 4.35156 4.90507 4.35156 4.58301C4.35174 4.2611 4.61266 4.00018 4.93457 4H11.0645Z"},null,-1)]))),_:1,__:[0]}))}),qI=A({__name:"IconSyncArrowDown",setup:e=>(e,t)=>(o(),n(Ee,{"aria-label":"sync-arrow-down",width:"16",height:"16"},{default:s((()=>t[0]||(t[0]=[l("path",{d:"M3.47837 13.2174V11.8261H4.46967C3.92474 11.3391 3.50735 10.7623 3.2175 10.0956C2.92764 9.42897 2.78271 8.73042 2.78271 7.99998C2.78271 6.7594 3.17112 5.66085 3.94793 4.70433C4.72474 3.74781 5.72764 3.14201 6.95663 2.88694V4.31303C6.12185 4.54491 5.44938 4.99998 4.93924 5.67824C4.42909 6.35651 4.17402 7.12462 4.17402 7.98259C4.17402 8.5623 4.29576 9.10433 4.53924 9.60868C4.78271 10.113 5.12474 10.5507 5.56532 10.9217V9.73911H6.95663V13.2174H3.47837ZM9.04358 13.113V11.6869C9.87837 11.4551 10.5508 11 11.061 10.3217C11.5711 9.64346 11.8262 8.87535 11.8262 8.01738C11.8262 7.43767 11.7045 6.89564 11.461 6.39129C11.2175 5.88694 10.8755 5.44926 10.4349 5.07824V6.26085H9.04358V2.78259H12.5218V4.1739H11.5305C12.0755 4.66085 12.4929 5.23767 12.7827 5.90433C13.0726 6.571 13.2175 7.26955 13.2175 7.99998C13.2175 9.24056 12.8291 10.3391 12.0523 11.2956C11.2755 12.2522 10.2726 12.858 9.04358 13.113Z"},null,-1)]))),_:1,__:[0]}))}),GI="ORDER_CALCULATOR_MODE";const KI=q("orderCalculator",(()=>{const e=T(!1),t=T(0),i=T("advance"===sessionStorage.getItem(GI)?"advance":"normal"),r=T("long"),a=T(null),n=T(""),o=T(0),s=T("price"),l=T("price");return{visible:e,openCount:t,mode:i,side:r,snapshot:a,marginMode:n,leverage:o,tpAnchor:s,slAnchor:l,open:function(i){a.value=i,r.value="long",n.value=i.marginMode,o.value=i.leverage,s.value="price",l.value="price",e.value=!0,t.value+=1},close:function(){e.value=!1},setMode:function(e){i.value=e,sessionStorage.setItem(GI,e)},setSide:function(e){r.value=e},setMarginMode:function(e){n.value=e},setLeverage:function(e){o.value=e}}})),QI=q("orderFormApply",(()=>{const e=T(null),t=T(0);return{pending:e,version:t,apply:function(i){e.value=i,t.value+=1},consume:function(){const t=e.value;return e.value=null,t}}})),jI={class:"calc-normal-form"},YI={class:"field"},ZI={class:"field-label"},XI={class:"unit"},JI={class:"field"},ex={class:"field-label"},tx={class:"unit"},ix={class:"field"},rx={class:"field-label"},ax={class:"unit"},nx=$n(A({__name:"OrderCalculatorNormalForm",props:{calc:{}},setup:e=>(e,t)=>
1(o(),c("div",jI,[l("div",YI,[l("span",ZI,m(e.$t("trading.bot.investment")),1),d(Wn,{desktopStyle:"",enableThousandSeparator:"",value:e.calc.investment.value,type:"number",min:0,step:.01,maxDecimalPlaces:2,"onUpdate:value":t[0]||(t[0]=t=>e.calc.investment.value=t)},{append:s((()=>[l("span",XI,m(e.calc.quoteCurrency.value),1)])),_:1},8,["value"])]),l("div",JI,[l("span",ex,m(e.$t("trading.orderCalculator.field.targetProfit")),1),d(Wn,{desktopStyle:"",enableThousandSeparator:"",value:e.calc.targetProfit.value,type:"number",min:0,step:.01,maxDecimalPlaces:2,"onUpdate:value":t[1]||(t[1]=t=>e.calc.targetProfit.value=t)},{append:s((()=>[l("span",tx,m(e.calc.quoteCurrency.value),1)])),_:1},8,["value"])]),l("div",ix,[l("span",rx,m(e.$t("trading.orderCalculator.field.maxLoss")),1),d(Wn,{desktopStyle:"",enableThousandSeparator:"",value:e.calc.maxLoss.value,type:"number",min:0,step:.01,maxDecimalPlaces:2,"onUpdate:value":t[2]||(t[2]=t=>e.calc.maxLoss.value=t)},{append:s((()=>[l("span",ax,m(e.calc.quoteCurrency.value),1)])),_:1},8,["value"])])]))}),[["__scopeId","data-v-94786c35"]]);const ox={class:"tpsl-block"},sx={class:"head"},lx={class:"trigger-by"},ux={class:"hint"},cx={class:"inputs"},dx={class:"field-name"},px={class:"unit"},hx={class:"field-name"},mx={class:"unit"},gx=$n(A({__name:"OrderCalculatorTpSlBlock",props:{leg:{},title:{},calc:{}},setup(e){const t=e,i=KI(),{t:r}=G(),a=M((()=>Qh.map((e=>({id:e.id,lang:e.getLabel((e=>r(e))),isI18nKey:!1}))))),n=M((()=>"tp"===t.leg?t.calc.tpLeg:t.calc.slLeg)),u=M((()=>10**-t.calc.priceFilter.value)),p=M((()=>"tp"===t.leg?i.tpAnchor:i.slAnchor)),h=M((()=>"PNL"===n.value.triggerType.value?t.calc.quoteCurrency.value:"%")),g=M((()=>"ROE"===n.value.triggerType.value?"ROE":"CHANGE"===n.value.triggerType.value?"%":"P&L"));function f(e){n.value.priceInput.value=e,y("price")}function v(e){n.value.triggerInput.value=e,y("trigger")}function y(e){"tp"===t.leg?i.tpAnchor=e:i.slAnchor=e}function b(e){n.value.triggerType.value=e}const P=M((()=>"tp"===t.leg?t.calc.tpPriceRaw.value:t.calc.slPriceRaw.value)),k=t.calc.advLegTriggerValue("tp"===t.leg?t.calc.tpLeg:t.calc.slLeg,t.leg);return D([P,p],(([e,i])=>{"trigger"===i&&(n.value.priceInput.value=null!==e&&e>0?S(e).toFixed(t.calc.priceFilter.value):"")}),{immediate:!0}),D([k,p],(([e,t])=>{"price"===t&&(n.value.triggerInput.value=null!==e&&Number.isFinite(e)?S(e).toFixed(2):"")}),{immediate:!0}),(e,t)=>(o(),c("div",ox,[l("div",sx,[l("span",{class:C(["title",e.leg])},m(e.title),3),l("div",lx,[l("span",ux,m(e.$t("tpsl.triggerBy")),1),d(om,{class:"trigger-choose",items:a.value,form:n.value.triggerType.value,"onUpdate:form":b},null,8,["items","form"])])]),l("div",cx,[d(Wn,{desktopStyle:"",enableThousandSeparator:"",class:C(["price-input",e.leg]),value:n.value.priceInput.value,type:"number",min:0,step:u.value,maxDecimalPlaces:e.calc.priceFilter.value,integerOnly:0===e.calc.priceFilter.value,"onUpdate:value":f},{prepend:s((()=>[l("span",dx,m(e.$t("futuresMain.orderBook.price")),1)])),append:s((()=>[l("span",px,m(e.calc.quoteCurrency.value),1)])),_:1},8,["class","value","step","maxDecimalPlaces","integerOnly"]),d(Wn,{desktopStyle:"",enableThousandSeparator:"",class:"trigger-input",value:n.value.triggerInput.value,type:"number",min:0,step:.01,maxDecimalPlaces:2,"onUpdate:value":v},{prepend:s((()=>[l("span",hx,m(g.value),1)])),append:s((()=>[l("span",mx,m(h.value),1)])),_:1},8,["value"])])]))}}),[["__scopeId","data-v-267f8dc0"]]),fx={class:"calc-advance-form"},vx={class:"field"},yx={class:"field-label"},bx={class:"unit"},Sx={class:"size-block"},Cx={class:"size-label-row"},Px={class:"label"},kx={key:0,class:"equivalent"},Tx=$n(A({__name:"OrderCalculatorAdvanceForm",props:{calc:{}},setup(e){const t=e,{t:i}=G(),r=M((()=>{var e;return(null==(e=t.calc.marketData.value)?void 0:e.baseCurrency)||""})),a=M((()=>[{id:Ke.CONTRACTS,lang:i("futuresMain.contracts"),isI18nKey:!1},{id:Ke.CRYPTO,lang:r.value,isI18nKey:!1},{id:Ke.USD,lang:t.calc.quoteCurrency.value,isI18nKey:!1}])),n=M((()=>t.calc.advSizeUnit.value===Ke.CONTRACTS)),u=M((()=>{switch(t.calc.advSizeUnit.value){case Ke.CRYPTO:return t.calc.sizeFilter.value;case Ke.CONTRACTS:return 0;case Ke.USD:default:return 2}})),p=M((()=>10**-t.calc.priceFilter.value)),g=M((()=>10**-u.value)),f=M((()=>t.calc.contracts.value>0?t.calc.advSizeUnit.value===Ke.USD?`â ${S(t.calc.cryptoAmount.value).toFormat(t.calc.sizeFilter.value,S.ROUND_DOWN)} ${r.value}
1`:t.calc.advSizeUnit.value===Ke.CRYPTO?`â ${S(t.calc.notional.value).toFormat(2,S.ROUND_HALF_UP)} ${t.calc.quoteCurrency.value}`:"":""));function v(e){if(e===t.calc.advSizeUnit.value)return;const i=t.calc.contracts.value;t.calc.advSizeUnit.value=e,i>0&&(t.calc.advSize.value=String(function({contracts:e,unit:t,orderPrice:i,contractSize:r}){if(!(e>0))return 0;switch(t){case Ke.CONTRACTS:return e;case Ke.CRYPTO:return S(e).times(r).toNumber();case Ke.USD:default:return S(e).times(r).times(i).dp(2,S.ROUND_DOWN).toNumber()}}({contracts:i,unit:e,orderPrice:t.calc.entryPrice.value,contractSize:t.calc.contractSize.value})))}return(e,t)=>(o(),c("div",fx,[l("div",vx,[l("span",yx,m(e.$t("futuresMain.activeOrders.orderPrice")),1),d(Wn,{desktopStyle:"",enableThousandSeparator:"",value:e.calc.advOrderPrice.value,type:"number",min:0,step:p.value,maxDecimalPlaces:e.calc.priceFilter.value,integerOnly:0===e.calc.priceFilter.value,"onUpdate:value":t[0]||(t[0]=t=>e.calc.advOrderPrice.value=t)},{append:s((()=>[l("span",bx,m(e.calc.quoteCurrency.value),1)])),_:1},8,["value","step","maxDecimalPlaces","integerOnly"])]),l("div",Sx,[l("div",Cx,[l("span",Px,m(e.$t("t.orderSize")),1),f.value?(o(),c("span",kx,m(f.value),1)):h("",!0)]),d(Wn,{desktopStyle:"",enableThousandSeparator:"",value:e.calc.advSize.value,type:"number",min:0,step:g.value,maxDecimalPlaces:u.value,integerOnly:n.value,"onUpdate:value":t[1]||(t[1]=t=>e.calc.advSize.value=t)},{append:s((()=>[d(om,{class:"unit-choose",items:a.value,form:e.calc.advSizeUnit.value,"onUpdate:form":v},null,8,["items","form"])])),_:1},8,["value","step","maxDecimalPlaces","integerOnly"])]),d(gx,{leg:"tp",calc:e.calc,title:e.$t("futuresMain.trade.takeProfit")},null,8,["calc","title"]),d(gx,{leg:"sl",calc:e.calc,title:e.$t("tpsl.sl")},null,8,["calc","title"])]))}}),[["__scopeId","data-v-e23fd6e2"]]);const Mx={class:"calc-sparkline"},Lx=["viewBox"],wx=["height"],Dx=["y","height"],Ox=["y","height"],Ix=["y1","y2","stroke-dasharray"],xx=["y"],_x=["y1","y2"],Ax=["y"],Rx=$n(A({__name:"OrderCalculatorSparkline",props:{layout:{},prices:{},formatPrice:{type:Function}},setup(e){const t=e,{t:i}=G(),r={tp:ya("t.tp"),last:ya("t.last"),entry:ya("trading.orderCalculator.chart.entry"),sl:ya("t.sl"),liq:ya("trading.orderCalculator.chart.liq")},a=e=>16+87*e,n=e=>Math.max(0,87*(e.bottom-e.top)),s={tp:0,last:1,entry:2,liq:3,sl:4},u=M((()=>
1{if(!t.layout)return[];const{markers:e,lastEqualsEntry:n,bands:o}=t.layout,l=n&&!o.green&&!o.red,u=e.filter((e=>!(l&&"entry"===e.key))).map((e=>{let o=a(e.position);"liq"===e.key&&e.clamped&&(o=0===e.position?8:111);let s=o;n&&"last"===e.key&&(s=o-1.5),n&&"entry"===e.key&&(s=o+1.5);const l=t.prices[e.key];return{key:e.key,lineY:s,textY:s,label:i(r[e.key]),value:null!=l?t.formatPrice(l):""}})).sort(((e,t)=>e.textY-t.textY||s[e.key]-s[t.key])),c=function(e,{minGap:t,top:i,bottom:r}){const a=[...e];for(let n=0;n<a.length;n++){const e=0===n?i:a[n-1]+t;a[n]=Math.max(a[n],e)}for(let n=a.length-1;n>=0;n--){const e=n===a.length-1?r:a[n+1]-t;a[n]=Math.min(a[n],e)}return a}(u.map((e=>e.textY)),{minGap:10,top:8,bottom:111});return u.map(((e,t)=>({...e,textY:c[t],lineY:"liq"===e.key?c[t]:e.lineY})))}));return(e,t)=>(o(),c("div",Mx,[(o(),c("svg",{viewBox:"0 0 215 119",xmlns:"http://www.w3.org/2000/svg"},[l("rect",{x:22,y:4,width:22,height:111,class:"stub"},null,8,wx),e.layout?(o(),c(g,{key:0},[e.layout.bands.green?(o(),c("rect",{key:0,x:22,y:a(e.layout.bands.green.top),width:22,height:n(e.layout.bands.green),class:"band-green"},null,8,Dx)):h("",!0),e.layout.bands.red?(o(),c("rect",{key:1,x:22,y:a(e.layout.bands.red.top),width:22,height:n(e.layout.bands.red),class:"band-red"},null,8,Ox)):h("",!0),(o(!0),c(g,null,R(u.value,(e=>(o(),c("g",{key:e.key},[l("line",{x1:17,x2:49,y1:e.lineY,y2:e.lineY,class:C(`tick tick--${e.key}`),"stroke-dasharray":"liq"===e.key?"3 2":void 0},null,10,Ix),l("text",{x:55,y:e.textY,class:C(["name",`name--${e.key}`])},m(e.label),11,xx),l("line",{x1:85,x2:157,y1:e.textY,y2:e.textY,class:"connector","stroke-dasharray":"2 3"},null,8,_x),l("text",{x:207,y:e.textY,class:C(["value",`value--${e.key}`]),"text-anchor":"end"},m(e.value),11,Ax)])))),128))],64)):h("",!0)],8,Lx))]))}}),[["__scopeId","data-v-e0092b09"]]),Fx={class:"description"},Ex={class:"no-show-box"},Bx={class:"cancel-wrap"},zx=$n(A({__name:"OrderCalculatorConfirmDialog",props:{visible:{type:Boolean}},emits:["update:visible","confirm"],setup(e){const t=e,i=T(!1);return D((()=>t.visible),(e=>{e&&(i.value=!1)})),(e,t)=>{const r=a("Checkbox"),u=a("BrandButton");return o(),n(pi,{visible:e.visible,width:"400px",center:"",isBrandNewStyle:"",class:"order-calculator-confirm-dialog",idPrefix:"order-calculator-confirm",appendToBody:!0,"onUpdate:visible":t[3]||(t[3]=t=>e.$emit("update:visible",t))},{header:s((()=>[p(m(e.$t("t.confirm")),1)])),body:s((()=>[l("div",Fx,m(e.$t("trading.orderCalculator.confirmPopup.content")),1),l("div",Ex,[d(r,{value:i.value,"onUpdate:value":t[0]||(t[0]=e=>i.value=e)},{default:s((()=>[p(m(e.$t("trading.orderCalculator.confirmPopup.dontShowAgain")),1)])),_:1},8,["value"])]),d(u,{class:"confirm-btn",type:"confirm",size:"biggest",onClick:t[1]||(t[1]=t=>e.$emit("confirm",i.value))},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1}),l("div",Bx,[l("span",{class:"cancel",onClick:t[2]||(t[2]=t=>e.$emit("update:visible",!1))},m(e.$t("t.cancel")),1)])])),_:1},8,["visible"])}}}),[["__scopeId","data-v-fe5c007a"]]);function $x(e,t,i){return t>0?S(e).div(t).dp(0,"up"===i?S.ROUND_UP:S.ROUND_DOWN).times(t).toNumber():e}function Nx({triggerPrice:e,orderPrice:t,cryptoAmount:i,requiredMargin:r,kind:a}){if(null===e||!(r>0))return null;const n=S(e).minus(t).abs().times(i).div(r).times(100);return"profit"===a?n.dp(2,S.ROUND_DOWN).toNumber():n.dp(2,S.ROUND_UP).negated().toNumber()}function Ux({entryNotional:e,exitNotional:t,feeRate:i}){return S(e).plus(t).times(i).dp(2,S.ROUND_UP).toNumber()}function Hx(e){return S(e).times(100).dp(2,S.ROUND_UP).toNumber()}function Vx({leverage:e,tierInitialMarginRate:t,takerFee:i}){return S.max(t,S(1).div(e)).plus(S(i).times(2)).toNumber()}const Wx=e=>"long"===e?fi.LONG:fi.SHORT;function qx(e){const t=k(),i=ci(),r=oa(),a=M((()=>t.getters.isUnifiedWallet)),n=M((()=>t.getters["futures/marketDetail"])),o=M((()=>t.getters["futures/marketData"])),s=M((()=>t.getters["futures/isHedgeMode"])),l=M((()=>t.getters["futures/currentMarketPositionMode"])),u=M((()=>t.getters["futures/currentModePosition"])),c=M((()=>t.getters["futures/currentMargin"])),d=M((()=>t.getters["futures/wallet"])),p=M((()=>t.state.includeUnrealizedPnl)),h=M((()=>{var e,t,i,n;return a.value?{walletTotalValue:null==(e=r.wallet)?void 0:e.totalValue,unrealisedProfitLoss:null==(t=r.wallet)?void 0:t.unrealisedProfitLoss,originalAvailableBalance:(null==(n=null==(i=c.value)?void 0:i[0])?void 0:n.originalAvailableBalance)||0}:d.value}));function m(e){return a.value&&e===ri.ISOLATED}function g(e){var i,r,a;const n=(u.value||[]).find((t=>t.totalContracts>0&&(!s.value||t.orderModeName===("long"===e.side?xt.BUY:xt.SELL))));if(!n)return{availableBalance:0,positionSize:0,entryPrice:0,maintenanceMargin:0,unrealizedPnl:0};const o=null==(i=n.activeWalletName)?void 0:i.replace("-USDT","-USD");return{availableBalance:(null==(a=null==(r=t.state.futures.walletMap)?void 0:r[o])?void 0:a.originalAvailableBalance)||0,positionSize:n.orderModeName===xt.BUY?n.totalContracts:-n.totalContracts,entryPrice:n.entryPrice,maintenanceMargin:n.positionMargin,unrealizedPnl:n.unrealizedPnl}}function f(){var e;if(!t.getters["futures/isOneWayMode"])return 0;const{totalContracts:i=0,orderModeName:r}=(null==(e=u.value)?void 0:e[0])||{};return i>0?r===xt.BUY?i:-i:0}function v(){const e=t.getters["futures/currentSymbolModeOrderList"]||[];return t.getters["futures/isOneWayMode"]&&e.length?e.reduce(((e,t)=>(t.orderModeName===xt.BUY?e.longOrderSize=S(e.longOrderSize).plus(t.size).toNumber():t.orderModeName===xt.SELL&&(e.shortOrderSize=S(e.shortOrderSize).plus(t.size).toNumber()),e)),{longOrderSize:0,shortOrderSize:0}):{longOrderSize:0,shortOrderSize:0}}function y(e){var r;const a=function(){const e=t.getters["futures/riskLimitSetting"]||[];if(!e.length)return null;const i=t.getters["futures/symbol"]||"";return e.map((e=>
1({symbol:String(e.symbol??i),riskLevel:Number(e.riskLevel),riskLimitValue:String(e.riskLimitValue),initialMarginRate:String(e.initialMarginRate),maintenanceMarginRate:String(e.maintenanceMarginRate),maxLeverage:String(e.maxLeverage)})))}();if(!a)return null;const{contractSize:s=1,initialMarginMarkup:l}=n.value||{},u=g(e),c=v();return{contractSize:s,orderConfig:{leverage:String(e.leverage||1),takerFee:String(i.takerFee),makerFee:String(i.makerFee),fundingRate:String((null==(r=o.value)?void 0:r.fundingRate)||0),adjConf:String(l??Ii),isMarginIncludeUnrealizedPnl:p.value,riskLimitTiers:a},curState:{availableBalance:String(u.availableBalance),positionSize:String(u.positionSize),entryPrice:String(u.entryPrice),unrealizedPnl:String(u.unrealizedPnl),pendingOrders:{longOrderSize:String(c.longOrderSize),shortOrderSize:String(c.shortOrderSize)}}}}return{isShareLibChannel:m,getLiqPrice:function(r){return r.orderPrice>0&&r.contracts>0?m(r.marginMode)?function(t){var r,a;const{contractSize:s=1,initialMarginMarkup:u}=n.value||{};return xv({shareLib:e,wasmFunction:qo,params:{newOrder:{mode:null==(r=l.value)?void 0:r.positionMode,orderType:"LIMIT_ORDER",price:t.orderPrice,size:t.contracts,side:Wx(t.side),contractSize:s,isReduceOnly:!1},orderConfig:{leverage:t.leverage||1,takerFee:i.takerFee,makerFee:i.makerFee,maintenanceMarginRatio:t.tierMaintenanceMarginRate,fundingRate:(null==(a=o.value)?void 0:a.fundingRate)||0,adjConf:u??Ii,isMarginIncludeUnrealizedPnl:p.value},curState:g(t)}})}(r):function(e){return la({marketDetail:n.value,marketData:o.value,wallet:h.value,order:{price:e.orderPrice,qty:e.contracts},isLong:"long"===e.side,position:u.value||[],isHedgeMode:s.value,isClose:!1,isMarketOrder:!1,isMarket:!1,includeUnrealizedPnl:p.value,markPrice:t.getters["futures/currentFuturesMarkPrice"],maintenanceMarginPercentage:e.tierMaintenanceMarginRate})}(r):0},getRequiredMargin:function(t){var r,a;if(!(t.orderPrice>0&&t.contracts>0))return 0;const{contractSize:o=1}=n.value||{};return m(t.marginMode)?VD({shareLib:e,positionMode:null==(r=l.value)?void 0:r.positionMode,price:t.orderPrice,size:t.contracts,side:Wx(t.side),contractSize:o,leverage:t.leverage||1,takerFee:i.takerFee,adjConf:(null==(a=n.value)?void 0:a.initialMarginMarkup)??Ii,positionSize:f(),pendingOrders:v()}):function({notional:e,leverage:t,tierInitialMarginRate:i,takerFee:r}){return S(e).times(Vx({leverage:t,tierInitialMarginRate:i,takerFee:r})).dp(2,S.ROUND_UP).toNumber()}({notional:S(t.contracts).times(o).times(t.orderPrice).toNumber(),leverage:t.leverage,tierInitialMarginRate:t.tierInitialMarginRate,takerFee:i.takerFee})},getCalculatorNormal:function(t){if(!m(t.marginMode))return null;if(!(t.orderPrice>0&&t.investment>0))return null;const i=y(t);return i?function({shareLib:e,newOrder:t,orderConfig:i,curState:r}){return xv({shareLib:e,wasmFunction:No,params:{newOrder:t,orderConfig:i,curState:r},defaultResult:null})}({shareLib:e,newOrder:{side:Wx(t.side),orderPrice:String(t.orderPrice),contractSize:String(i.contractSize),investment:String(t.investment),...null!=t.targetProfit&&t.targetProfit>0?{targetProfit:String(t.targetProfit)}:{},...null!=t.maxLoss&&t.maxLoss>0?{maxLoss:String(t.maxLoss)}:{}},orderConfig:i.orderConfig,curState:i.curState}):null},getCalculatorAdvanced:function(t){if(!m(t.marginMode))return null;if(!(t.orderPrice>0&&t.contracts>0))return null;const i=y(t);return i?function({shareLib:e,newOrder:t,orderConfig:i,curState:r}){return xv({shareLib:e,wasmFunction:$o,params:{newOrder:t,orderConfig:i,curState:r},defaultResult:null})}({shareLib:e,newOrder:{side:Wx(t.side),orderPrice:String(t.orderPrice),orderSize:String(t.contracts),contractSize:String(i.contractSize),...null!=t.tpPrice&&t.tpPrice>0?{takeProfit:{triggerBy:"PRICE",value:String(t.tpPrice)}}:{},...null!=t.slPrice&&t.slPrice>0?{stopLoss:{triggerBy:"PRICE",value:String(t.slPrice)}}:{}},orderConfig:i.orderConfig,curState:{...i.curState,futuresWalletBalance:String(r.totalBalance||0)}}):null}}}const Gx=e=>{const t=Number(e);return Number.isFinite(t)?t:0};function Kx(e){const t=k(),{t:i}=G(),r=ci(),a=KI(),n=oa(),o=qx(e),s=M((()=>t.getters["futures/marketDetail"])),l=M((()=>t.getters["futures/marketData"])),u=M((()=>{var e;return(null==(e=s.value)?void 0:e.minPriceIncrement)||0})),c=M((()=>{var e,t;return(null==(e=s.value)?void 0:e.priceFilter)??(null==(t=l.value)?void 0:t.priceFilter)??2})),d=M((()=>{var e,t;return(null==(e=s.value)?void 0:e.sizeFilter)??(null==(t=l.value)?void 0:t.sizeFilter)??0})),p=M((()=>{var e;return(null==(e=s.value)?void 0:e.contractSize)||1})),h=M((()=>{var e;return(null==(e=s.value)?void 0:e.maxOrderSize)||1/0})),m=M((()=>t.getters["futures/riskLimitSetting"]||[])),g=M((()=>r.takerFee)),f=M((()=>r.makerFee)),v=M((()=>t.getters["futures/availableBalance"]||0)),y=M((()=>n.totalBalance||0)),b=M((()=>t.getters["futures/currentSettleInCurrency"]||ht)),C=M((()=>function(e,t=0){var i;return(null==(i=e[0])?void 0:i.maxLeverage)??t}(m.value,t.getters["futures/maxLeverage"]||1))),P=M((()=>{const e=t.getters["futures/currentModePosition"]||[],i=t.getters["futures/currentSymbolModeOrderList"]||[];return e.some((e=>e.totalContracts>0))||i.length>0})),L=T(""),w=T(""),O=T(""),I=T(""),x=T(""),_=T(Ke.USD),A={priceInput:T(""),triggerType:T("ROE"),triggerInput:T("")},R={priceInput:T(""),triggerType:T("ROE"),triggerInput:T("")};D((()=>a.openCount),(()=>{if(!a.visible)return;const e=a.snapshot;
1L.value="",w.value="",O.value="",I.value=e?String(e.orderFormPrice||e.lastPrice||""):"",_.value=(null==e?void 0:e.sizeUnit)||Ke.USD,x.value=null!=(null==e?void 0:e.orderFormSize)?String(e.orderFormSize):"",A.priceInput.value=null!=(null==e?void 0:e.tpPrice)?String(e.tpPrice):"",A.triggerType.value="ROE",A.triggerInput.value="",R.priceInput.value=null!=(null==e?void 0:e.slPrice)?String(e.slPrice):"",R.triggerType.value="ROE",R.triggerInput.value=""}),{immediate:!0});const F=M((()=>"advance"===a.mode)),E=M((()=>a.side)),B=M((()=>a.leverage));D((()=>t.getters["futures/symbol"]),(()=>{a.visible&&a.close()})),D(E,(e=>{if(!(F.value&&z.value>0))return;const t=(t,i)=>{if("price"!==i)return;const r=Gx(t.priceInput.value);if(!(r>0))return;const a=S(z.value).times(2).minus(r);t.priceInput.value=String($x(a.toNumber(),u.value,"long"===e?"up":"down"))};t(A,a.tpAnchor),t(R,a.slAnchor)}));const z=M((()=>{if(F.value)return Gx(I.value);const e=a.snapshot;return(null==e?void 0:e.orderFormPrice)||(null==e?void 0:e.lastPrice)||0})),$=M((()=>S(Gx(L.value)).times(B.value).toNumber())),N=M((()=>{if(!F.value){const e=ee.value;return e?Gx(e.contracts):function({notional:e,orderPrice:t,contractSize:i}){return e>0&&t>0&&i>0?S(e).div(S(t).times(i)).dp(0,S.ROUND_DOWN).toNumber():0}({notional:$.value,orderPrice:z.value,contractSize:p.value})}return function({size:e,unit:t,orderPrice:i,contractSize:r}){if(!(e>0&&r>0))return 0;switch(t){case Ke.CONTRACTS:return S(e).dp(0,S.ROUND_DOWN).toNumber();case Ke.CRYPTO:return S(e).div(r).dp(0,S.ROUND_DOWN).toNumber();case Ke.USD:default:return i>0?S(e).div(S(i).times(r)).dp(0,S.ROUND_DOWN).toNumber():0}}({size:Gx(x.value),unit:_.value,orderPrice:z.value,contractSize:p.value})})),U=M((()=>S(N.value).times(p.value).toNumber())),H=M((()=>{const e=ee.value;return e?Gx(e.orderSize):S(U.value).times(z.value).toNumber()})),V=M((()=>{const e=t.getters["futures/currentModePosition"]||[],i=e.find((e=>e.totalContracts>0))??e[0];return(null==i?void 0:i.totalContracts)>0?i.orderModeName===xt.BUY?i.totalContracts:-i.totalContracts:0})),W=M((()=>(t.getters["futures/currentSymbolModeOrderList"]||[]).reduce(((e,t)=>(t.orderModeName===xt.BUY?e.buy=S(e.buy).plus(t.size||0).toNumber():t.orderModeName===xt.SELL&&(e.sell=S(e.sell).plus(t.size||0).toNumber()),e)),{buy:0,sell:0}))),q=M((()=>
1{if(!(z.value>0))return 0;const e=S(p.value).times(z.value),t=W.value,i=N.value;return ba({positionSignedValue:e.times(V.value).toNumber(),buyOrderValue:e.times("long"===E.value?t.buy+i:t.buy).toNumber(),sellOrderValue:e.times("short"===E.value?t.sell+i:t.sell).toNumber()})})),K=M((()=>function(e,t){return e.length?e.find((e=>t<=e.riskLimitValue))??e[e.length-1]:null}(m.value,q.value))),Q=M((()=>{var e;return(null==(e=K.value)?void 0:e.initialMarginRate)??1/(C.value||1)})),j=M((()=>{var e,t;return(null==(e=K.value)?void 0:e.maintenanceMarginRate)??(null==(t=s.value)?void 0:t.maintenanceMargin)??0})),Y=M((()=>t.getters["futures/currentRiskLimitData"]??null)),Z=M((()=>{const e=Y.value,t=K.value;return e&&t?t.maxLeverage<e.maxLeverage?t:e:e??t})),X=M((()=>({side:E.value,orderPrice:z.value,contracts:N.value,leverage:B.value,marginMode:a.marginMode,tierInitialMarginRate:Q.value,tierMaintenanceMarginRate:j.value}))),J=M((()=>({side:E.value,orderPrice:z.value,leverage:B.value,marginMode:a.marginMode}))),ee=M((()=>F.value?null:o.getCalculatorNormal({...J.value,investment:Gx(L.value),targetProfit:Gx(w.value)||null,maxLoss:Gx(O.value)||null}))),te=M((()=>F.value?o.getCalculatorAdvanced({...J.value,contracts:N.value,tpPrice:null,slPrice:null}):null)),ie=M((()=>{const e=te.value;return e?null===le.value&&null===ue.value?e:o.getCalculatorAdvanced({...J.value,contracts:N.value,tpPrice:le.value,slPrice:ue.value}):null})),re=M((()=>{const e=F.value?te.value:ee.value;return e?Gx(e.requiredMargin):o.getRequiredMargin(X.value)})),ae=M((()=>{const e=F.value?te.value:ee.value;return e?ne(e.estLiquidationPrice)??0:o.getLiqPrice(X.value)}));function ne(e){const t=Gx(e);return t>0?$x(t,u.value,"long"===E.value?"up":"down"):null}const oe=M((()=>F.value?ce(A,"tp"):""===w.value?null:function({orderPrice:e,targetProfit:t,notional:i,side:r,tickSize:a}){if(t<0||!(i>0)||!(e>0))return null;const n=S(t).div(i);return $x(S(e).times("long"===r?n.plus(1):S(1).minus(n)).toNumber(),a,"long"===r?"up":"down")}({orderPrice:z.value,targetProfit:Gx(w.value),notional:H.value,side:E.value,tickSize:u.value}))),se=M((()=>F.value?ce(R,"sl"):""===O.value?null:function({orderPrice:e,maxLoss:t,notional:i,side:r,tickSize:a}){if(t<0||!(i>0)||!(e>0))return null;const n=S(t).div(i);return $x(S(e).times("long"===r?S(1).minus(n):n.plus(1)).toNumber(),a,"long"===r?"up":"down")}({orderPrice:z.value,maxLoss:Gx(O.value),notional:H.value,side:E.value,tickSize:u.value}))),le=M((()=>De.value.tpInvalid?null:oe.value)),ue=M((()=>De.value.slInvalid?null:se.value));function ce(e,t){if("price"===("tp"===t?a.tpAnchor:a.slAnchor)){const t=Gx(e.priceInput.value);return t>0||""!==e.priceInput.value?t:null}const i=e.triggerInput.value;return""===i?null:function({triggerType:e,value:t,orderPrice:i,cryptoAmount:r,requiredMargin:a,side:n,leg:o,tickSize:s}){if(!(null!==t&&i>0&&r>0))return null;let l;switch(e){case"PNL":l=S(t);break;case"ROE":if(!(a>0))return null;l=S(t).div(100).times(a);break;case"CHANGE":l=S(t).div(100).times(i).times(r)}const u=l.div(r);return $x(("tp"===o==("long"===n)?S(i).plus(u):S(i).minus(u)).toNumber(),s,"long"===n?"up":"down")}({triggerType:e.triggerType.value,value:Gx(i),orderPrice:z.value,cryptoAmount:U.value,requiredMargin:re.value,side:E.value,leg:t,tickSize:u.value})}const de=M((()=>F.value?ie.value:ee.value)),pe=M((()=>{if(null===le.value)return null;const e=de.value;return e?Gx(e.profitPercent):Nx({triggerPrice:le.value,orderPrice:z.value,cryptoAmount:U.value,requiredMargin:re.value,kind:"profit"})})),he=M((()=>{if(null===ue.value)return null;const e=de.value;return e?Gx(e.lossPercent):Nx({triggerPrice:ue.value,orderPrice:z.value,cryptoAmount:U.value,requiredMargin:re.value,kind:"loss"})})),me=M((()=>
1{if(null===le.value)return null;const e=ie.value;return e?Gx(e.profitAmount):S(le.value).minus(z.value).abs().times(U.value).dp(2,S.ROUND_DOWN).toNumber()})),ge=M((()=>{if(null===ue.value)return null;const e=ie.value;return e?Gx(e.lossAmount):S(ue.value).minus(z.value).abs().times(U.value).dp(2,S.ROUND_UP).negated().toNumber()})),fe=M((()=>{if(null!==le.value&&null!==ue.value){const e=de.value;if(e){const t=Gx(e.riskReward);return t>0?t:null}}return function({tpPrice:e,slPrice:t,orderPrice:i}){if(null===e||null===t)return null;const r=S(t).minus(i).abs();return r.isZero()?null:S(e).minus(i).abs().div(r).toNumber()}({tpPrice:le.value,slPrice:ue.value,orderPrice:z.value})})),ve=M((()=>function({tpPrice:e,slPrice:t,orderPrice:i,cryptoAmount:r}){const a=Math.max(e??0,t??0,i);return S(a).times(r).toNumber()}({tpPrice:le.value,slPrice:ue.value,orderPrice:z.value,cryptoAmount:U.value}))),ye=M((()=>F.value&&ie.value?Gx(ie.value.tradingFeeTaker):!F.value&&ee.value?Gx(ee.value.tradingFee):Ux({entryNotional:H.value,exitNotional:ve.value,feeRate:g.value}))),be=M((()=>{const e=ie.value;return e?Gx(e.tradingFeeMaker):Ux({entryNotional:H.value,exitNotional:ve.value,feeRate:f.value})})),Se=M((()=>{const e=te.value;return e?ne(e.breakEvenPrice):z.value>0?function({orderPrice:e,side:t,tickSize:i,makerFee:r,takerFee:a}){return $x(("long"===t?S(e).times(S(1).plus(r)).div(S(1).minus(a)):S(e).times(S(1).minus(r)).div(S(1).plus(a))).toNumber(),i,"long"===t?"up":"down")}({orderPrice:z.value,side:E.value,tickSize:u.value,makerFee:f.value,takerFee:g.value}):null})),Ce=M((()=>{const e=te.value;return e?S(Gx(e.initialMarginRate)).times(100).dp(2,S.ROUND_UP).toNumber():function({leverage:e,tierInitialMarginRate:t,takerFee:i}){const r=Vx({leverage:e,tierInitialMarginRate:t,takerFee:i});return S(r).times(100).dp(2,S.ROUND_UP).toNumber()}({leverage:B.value,tierInitialMarginRate:Q.value,takerFee:g.value})})),Pe=M((()=>{const e=te.value;return Hx(e?Gx(e.maintenanceMarginRate):j.value)})),ke=M((()=>{if(De.value.slInvalid)return null;const e=ie.value;if(e){const t=Gx(e.maxLossPercentOfAccount);return t>0?t:null}return function({slPrice:e,liqPrice:t,orderPrice:i,cryptoAmount:r,futuresWalletBalance:a}){if(!(a>0))return null;const n=S(e??0).minus(i).abs(),o=S(t).minus(i).abs();return S.min(n,o).times(r).div(a).times(100).dp(2,S.ROUND_UP).toNumber()}({slPrice:null!==ue.value&&ue.value>0?ue.value:null,liqPrice:ae.value,orderPrice:z.value,cryptoAmount:U.value,futuresWalletBalance:y.value})})),Te=M((()=>!(null!==ue.value&&ue.value>0))),Me=M((()=>null!=a.snapshot&&a.marginMode!==a.snapshot.marginMode)),Le=M((()=>null!=a.snapshot&&a.leverage!==a.snapshot.leverage)),we=M((()=>{var e;const r=h.value,a=S(r).times(p.value).times(z.value||0);return F.value&&_.value!==Ke.USD?_.value===Ke.CRYPTO?{amount:S(r).times(p.value).toFormat(d.value),unit:(null==(e=l.value)?void 0:e.baseCurrency)||""}:{amount:S(r).toFormat(0),unit:i("futuresMain.contracts")}:{amount:a.toFormat(2),unit:t.getters["futures/currentSettleInCurrency"]||ht}})),De=M((()=>{var e,t;return function(e){const{mode:t,side:i,orderPrice:r,tpPrice:a,slPrice:n}=e,o="long"===i,s="advance"===t,l=null!==e.liqPrice&&e.liqPrice>0?e.liqPrice:null,u=[];let c=!1,d=!1,p=!1;null!==a&&(a<=0?(d=!0,u.push({priority:1,key:s?"trading.orderCalculator.error.tpPriceTooLow":"trading.orderCalculator.error.targetProfitTooHigh"})):(o?a<=r:a>=r)&&(d=!0,u.push({priority:3,key:`trading.orderCalculator.error.tpWrongSide${s?"Adv":"Normal"}${o?"Long":"Short"}`}))),null!==n&&(n<=0?(p=!0,u.push({priority:2,key:s?"trading.orderCalculator.error.slPriceTooLow":"trading.orderCalculator.error.maxLossTooHigh"})):null!==l&&(o?n<=l:n>=l)?(c=!0,p=!0,u.push({priority:4,key:s?"trading.orderCalculator.error.slBeyondLiqAdv"+(o?"Long":"Short"):"trading.orderCalculator.error.slBeyondLiqNormal"})):(o?n>=r:n<=r)&&(p=!0,u.push({priority:5,key:`trading.orderCalculator.error.slWrongSide${s?"Adv":"Normal"}${o?"Long":"Short"}`}))),e.contracts>e.maxOrderSize&&u.push({priority:6,key:"trading.orderCalculator.error.exceedsMaxOrderSize",params:{amount:e.maxSizeDisplay.amount,unit:e.maxSizeDisplay.unit}});const h=[];if(null!==n&&n>0&&null!==l&&!c){const t=function(e,t){const i=t>=50;return"long"===e?i?1.03:1.1:i?.97:.9}(i,e.marketMaxLeverage);(o?n<l*t:n>l*t)&&h.push({key:"trading.orderCalculator.warning.slCloseToLiq"})}e.leverage>e.currentTierCapLeverage&&h.push({key:"trading.orderCalculator.warning.leverageAboveTierCap",params:{n:e.currentTierLevel,max:e.currentTierCapLeverage}}),null!==e.requiredMargin&&e.requiredMargin>e.availableBalance&&h.push({key:"trading.orderCalculator.warning.insufficientBalance"}),e.marginModeDiffers&&e.hasPositionOrOrders&&h.push({key:"trading.orderCalculator.warning.marginModeDiffers"}),e.leverageDiffers&&e.hasPositionOrOrders&&h.push({key:"trading.orderCalculator.warning.leverageDiffers"});const m=u.sort(((e,t)=>e.priority-t.priority)).map((({key:e,params:t})=>t?{key:e,params:t}:{key:e}));return{errors:m,warnings:h,canConfirm:0===m.length,tpInvalid:d,slInvalid:p}}({mode:F.value?"advance":"normal",side:E.value,orderPrice:z.value,contracts:N.value,maxOrderSize:h.value,maxSizeDisplay:we.value,tpPrice:oe.value,slPrice:se.value,liqPrice:ae.value,marketMaxLeverage:C.value,leverage:B.value,currentTierCapLeverage:(null==(e=Z.value)?void 0:e.maxLeverage)||
11/0,currentTierLevel:(null==(t=Z.value)?void 0:t.riskLevel)||1,requiredMargin:re.value>0?re.value:null,availableBalance:v.value,marginModeDiffers:Me.value,leverageDiffers:Le.value,hasPositionOrOrders:P.value})})),Oe=M((()=>{var e;return function({tpPrice:e,slPrice:t,entryPrice:i,lastPrice:r,liqPrice:a}){if(null===i||!(i>0))return null;const n=[e,t,i,r].filter((e=>null!==e)),o=Math.max(...n),s=Math.min(...n),l=o-s,u=e=>0===l?.5:(o-e)/l,c=[],d=(e,t)=>{null!==t&&c.push({key:e,position:u(t),clamped:!1})};if(d("tp",e),d("last",r),d("entry",i),d("sl",t),null!==a&&a>0){const e=u(a),t=e<0||e>1;c.push({key:"liq",position:Math.min(1,Math.max(0,e)),clamped:t})}const p=u(i),h=e=>{if(null===e)return null;const t=u(e);return{top:Math.min(p,t),bottom:Math.max(p,t)}};return{markers:c,bands:{green:h(e),red:h(t)},lastEqualsEntry:null!==r&&r===i}}({tpPrice:null!==le.value&&le.value>0?le.value:null,slPrice:null!==ue.value&&ue.value>0?ue.value:null,entryPrice:z.value>0?z.value:null,lastPrice:(null==(e=a.snapshot)?void 0:e.lastPrice)||null,liqPrice:ae.value>0?ae.value:null})}));return{marketData:l,quoteCurrency:b,priceFilter:c,sizeFilter:d,tickSize:u,contractSize:p,maxLeverage:C,hasPositionOrOrders:P,investment:L,targetProfit:w,maxLoss:O,advOrderPrice:I,advSize:x,advSizeUnit:_,tpLeg:A,slLeg:R,advLegTriggerValue:function(e,t){return M((()=>{if("trigger"===("tp"===t?a.tpAnchor:a.slAnchor))return Gx(e.triggerInput.value);const i="tp"===t?oe.value:se.value;return function({triggerType:e,triggerPrice:t,orderPrice:i,cryptoAmount:r,requiredMargin:a}){if(!(null!==t&&i>0&&r>0))return null;const n=S(t).minus(i).abs().times(r);switch(e){case"PNL":return n.toNumber();case"ROE":return a>0?n.div(a).times(100).toNumber():null;case"CHANGE":return n.div(i).div(r).times(100).toNumber()}}({triggerType:e.triggerType.value,triggerPrice:i,orderPrice:z.value,cryptoAmount:U.value,requiredMargin:re.value})}))},isAdvance:F,side:E,leverage:B,entryPrice:z,contracts:N,cryptoAmount:U,notional:H,requiredMargin:re,liqPrice:ae,tpPrice:le,slPrice:ue,tpPriceRaw:oe,slPriceRaw:se,profitPercent:pe,lossPercent:he,profitAmount:me,lossAmount:ge,riskRewardRatio:fe,takerTradingFee:ye,makerTradingFee:be,breakEven:Se,initialMarginPct:Ce,maintenanceMarginPct:Pe,maxLossPctOfAccount:ke,maxLossAtLiq:Te,resolvedTier:K,marginModeDiffers:Me,leverageDiffers:Le,validation:De,sparkline:Oe,buildApplyPayload:function(){const e=!F.value||_.value===Ke.USD;let t=null;return N.value>0&&(t=e?S(H.value).dp(2,S.ROUND_DOWN).toNumber():_.value===Ke.CRYPTO?U.value:N.value),{side:E.value,price:z.value,size:t,sizeUnit:e?Ke.USD:_.value,tpPrice:null!==le.value&&le.value>0?le.value:null,slPrice:null!==ue.value&&ue.value>0?ue.value:null}}}}const Qx={class:"calc-header"},jx={class:"title"},Yx={class:"advance-toggle"},Zx={class:"symbol-row"},Xx={class:"market"},Jx={class:"symbol"},e_={class:"side-tab"},t_={class:"left-col"},i_={class:"leverage-block"},r_={class:"label"},a_={class:"slider-row"},n_=["max","value"],o_={class:"leverage-tag"},s_={class:"result-panel"},l_={class:"panel-title"},u_={class:"result-list"},c_={class:"row"},d_={class:"row-label"},p_={class:"row-value"},h_={class:"row"},m_={class:"row-value"},g_={class:"row"},f_={class:"row-label"},v_={class:"row-value green"},y_={class:"row"},b_={class:"row-label"},S_={class:"row-value red"},C_={class:"row"},P_={class:"row-label"},k_={class:"row-value"},T_={class:"green"},M_={class:"red"},L_={class:"row"},w_={class:"row-label"},D_={class:"row-value"},O_={class:"row"},I_={class:"row-label"},x_={class:"row-value"},__={class:"row"},A_={class:"row-value"},R_={class:"row"},F_={class:"row-label"},E_={class:"row-value"},B_={class:"row"},z_={class:"row-label"},$_={class:"row-value"},N_={class:"tier-badge"},U_={class:"row"},H_={class:"row-label"},V_={class:"row-value"},W_={class:"row"},q_={class:"row-label"},G_={class:"row-value"},K_={class:"row"},Q_={class:"row-label"},j_={class:"row-value"},Y_={class:"green"},Z_={class:"red"},X_={class:"row"},J_={class:"row-label"},eA={class:"row-value"},tA={class:"green"},iA={class:"red"},rA={class:"row"},aA={class:"row-label"},nA={class:"row-value"},oA={class:"row"},sA={class:"row-label"},lA={class:"row-value"},uA={key:0,class:"qualifier"},cA={class:"row"},dA={class:"row-label"},pA={class:"row-value"},hA={class:"row"},mA={class:"row-value"},gA={class:"row"},fA={class:"row-value"},vA={class:"row"},yA={class:"row-value"},bA={class:"calc-footer"},SA={key:0,class:"messages errors"},CA={key:0},PA={key:1},kA=["disabled"],TA="-",MA=$n(A({__name:"OrderCalculatorDialog",setup(e){const t=k(),{t:i}=G(),r=KI(),u=QI(),f=Ge(),{proxy:v}=he(),y=Kx(v.$shareLib),b=Ir(),L=M((()=>
1(null==b?void 0:b.isMobile)??!1)),w=M((()=>{var e;return(null==(e=t.getters["futures/marketData"])?void 0:e.symbol)||""})),D=M((()=>{var e;return(null==(e=t.getters["futures/marketData"])?void 0:e.baseCurrency)||""})),O=M((()=>t.getters["futures/currentSettleInCurrency"]||ht));fe((()=>{r.visible&&r.close()}));const I=M((()=>r.marginMode===ri.CROSS)),_=M((()=>I.value?i("trading.orderCalculator.marginMode.cross"):i("trading.orderCalculator.marginMode.isolated"))),A=M((()=>I.value?i("trading.orderCalculator.marginMode.crossTip"):i("trading.orderCalculator.marginMode.isolatedTip")));function F(){r.setMarginMode(I.value?ri.ISOLATED:ri.CROSS)}function E(e){r.setMode(e?"advance":"normal")}const B=M((()=>{const e=y.maxLeverage.value;return e<=1?0:(y.leverage.value-1)/(e-1)*100}));function z(e){r.setLeverage(Number(e.target.value))}function $(e){e||r.close()}const N=M((()=>y.entryPrice.value>0&&y.contracts.value>0));function U(e,t){return null!==e&&N.value?t(e):TA}const H=e=>S(e).toFormat(y.priceFilter.value),V=e=>`${e}%`,W=M((()=>y.entryPrice.value>0?`${H(y.entryPrice.value)} ${O.value}`:TA)),q=M((()=>N.value?`${S(y.notional.value).toFormat(2)} ${O.value}`:TA)),K=M((()=>{var e;return N.value?i("trading.orderCalculator.tooltip.orderSize",{base:(null==(e=y.marketData.value)?void 0:e.baseCurrency)||"",quote:O.value,cryptoAmount:S(y.cryptoAmount.value).toFormat(y.sizeFilter.value),usdValue:S(y.notional.value).toFormat(2)}):""})),Q=M((()=>y.validation.value.errors.some((e=>e.key.startsWith("trading.orderCalculator.error.slBeyondLiq")))?i("trading.orderCalculator.hint.outOfLiqPrice"):U(y.slPrice.value,H))),j=M((()=>null!==y.riskRewardRatio.value&&N.value?`1 : ${S(y.riskRewardRatio.value).toFormat(2)}`:TA)),Y=M((()=>N.value&&y.liqPrice.value>0?H(y.liqPrice.value):TA)),Z=M((()=>N.value&&y.requiredMargin.value>0?`${S(y.requiredMargin.value).toFormat(2)} ${O.value}`:TA)),X=e=>N.value?`${S(e).toFormat(2)} ${O.value}`:TA,J=e=>null!==e&&N.value?`${e>=0?"+":""}${S(e).toFormat(2)} ${O.value}`:TA,ee=M((()=>{var e;return{tp:y.tpPrice.value,sl:y.slPrice.value,entry:y.entryPrice.value||null,last:(null==(e=r.snapshot)?void 0:e.lastPrice)??null,liq:y.liqPrice.value>0?y.liqPrice.value:null}})),te=M((()=>y.validation.value.errors.map((e=>i(e.key,e.params||{}))))),ie=M((()=>y.validation.value.warnings.map((e=>i(e.key,e.params||{}))))),re=T(!1),ae=M((()=>!y.validation.value.canConfirm||!N.value));function ne(){f.orderFormSettings.orderCalculatorConfirmation?re.value=!0:se()}function oe(e){e&&f.updateOrderFormSettings({orderCalculatorConfirmation:!1}),se()}function se(){re.value=!1;const e=!y.hasPositionOrOrders.value&&(y.marginModeDiffers.value||y.leverageDiffers.value),{leverage:i,marginMode:a}=r;u.apply(y.buildApplyPayload()),r.close(),e&&t.dispatch("futures/setLeverage",{leverage:i,marginMode:a})}return(e,t)=>{const i=a("ToolTip");return o(),c(g,null,[d(pi,{visible:x(r).visible,width:"660px",idPrefix:"order-calculator",appendToBody:!0,isBrandNewStyle:!0,"onUpdate:visible":$},{header:s((()=>[l("div",Qx,[l("span",jx,m(e.$t("trading.orderCalculator.title")),1),l("div",Yx,[l("span",null,m(e.$t("t.advanced")),1),d(Sa,{modelValue:x(y).isAdvance.value,"onUpdate:modelValue":E},null,8,["modelValue"])])])])),body:s((()=>{var a;return[l("div",{class:C(["calc-body",{"is-mobile":L.value}])},[l("div",Zx,[l("div",Xx,[d(Rt,{name:D.value,showName:!1,size:"24"},null,8,["name"]),l("span",Jx,m(w.value),1)]),d(i,{class:"margin-mode-pill-wrap"},{content:s((()=>[l("button",{type:"button",class:"margin-mode-pill",onClick:F},[p(m(_.value)+" ",1),d(qI,{class:C(["sync-icon",{"is-isolated":!I.value}]),width:"16",height:"16"},null,8,["class"])])])),tooltip:s((()=>[p(m(A.value),1)])),_:1})]),l("div",e_,[l("button",{type:"button",class:C(["side-btn long",{active:"long"===x(y).side.value}]),onClick:t[0]||(t[0]=e=>x(r).setSide("long"))},m(e.$t("t.long")),3),l("button",{type:"button",class:C(["side-btn short",{active:"short"===x(y).side.value}]),onClick:t[1]||(t[1]=e=>x(r).setSide("short"))},m(e.$t("t.short")),3)]),l("div",t_,[x(y).isAdvance.value?(o(),n(Tx,{key:0,calc:x(y)},null,8,["calc"])):(o(),n(nx,{key:1,calc:x(y)},null,8,["calc"])),l("div",i_,[l("span",r_,m(e.$t("futuresMain.order.leverage")),1),l("div",a_,[l("input",{type:"range",min:1,max:x(y).maxLeverage.value,step:1,value:x(y).leverage.value,style:P({"--slider-fill":B.value+"%"}),onInput:z},null,44,n_),l("span",o_,m(x(y).leverage.value)+"x",1)])]),L.value?(o(),n(Rx,{key:2,layout:x(y).sparkline.value,prices:ee.value,formatPrice:H},null,8,["layout","prices"])):h("",!0)]),l("div",s_,[l("p",l_,m(e.$t("trading.orderCalculator.estResult")),1),L.value?h("",!0):(o(),n(Rx,{key:0,layout:x(y).sparkline.value,prices:ee.value,formatPrice:H},null,8,["layout","prices"])),l("div",u_,[x(y).isAdvance.value?(o(),c(g,{key:1},[l("div",R_,[l("span",F_,m(e.$t("trading.orderCalculator.row.requiredMargin")),1),l("span",E_,m(Z.value),1)]),l("div",B_,[l("span",z_,m(e.$t("trading.orderCalculator.row.riskLimitTier")),1),l("span",$_,[l("span",N_,m((null==(a=x(y).resolvedTier.value)?void 0:a.riskLevel)??"-"),1)])]),l("div",U_,[l("span",H_,m(`${e.$t("t.initialMargin")} %`),1),l("span",V_,m(N.value?`${x(y).initialMarginPct.value}%`:TA),1)]),l("div",W_,[l("span",q_,m(`${e.$t("t.maintenanceMargin")} %`),1),l("span",G_,m(N.value?`${x(y).maintenanceMarginPct.value}%`:TA),1)]),l("div",K_,[l("span",Q_,m(`${e.$t("t.profit")} / ${e.$t("t.loss")}`),1),l("span",j_,[l("span",Y_,m(J(x(y).profitAmount.value)),1),t[5]||(t[5]=p(" / ")),l("span",Z_,m(J(x(y).lossAmount.value)),1)])]),l("div",X_,[l("span",J_,m(`${e.$t("t.profit")} / ${e.$t("t.loss")} %`),1),l("span",eA,[l("span",tA,m(U(x(y).profitPercent.value,V)),1),t[6]||(t[6]=p(" / ")),l("span",iA,m(U(x(y).lossPercent.value,V)),1)])]),l("div",rA,[l("span",aA,m(`${e.$t("t.risk")} / ${e.$t("t.reward")}`),1),l("span",nA,m(j.value),1)]),l("div",oA,[l("span",sA,m(e.$t("trading.orderCalculator.row.maxLossOfAccount")),1),l("span",lA,[p(m(U(x(y).maxLossPctOfAccount.value,V))+" ",1),x(y).maxLossAtLiq.value&&null!==x(y).maxLossPctOfAccount.value?(o(),c("span",uA,m(e.$t("trading.orderCalculator.row.atLiq")),1)):h("",!0)])]),l("div",cA,[l("span",dA,m(e.$t("trading.orderCalculator.row.estLiqPrice")),1),l("span",pA,m(Y.value),1)]),l("div",hA,[d(i,{class:"row-label with-tip",content:e.$t("trading.orderCalculator.row.breakEvenPrice"),tooltip:e.$t("trading.orderCalculator.tooltip.breakEven")},null,8,["content","tooltip"]),l("span",mA,m(N.value&&null!==x(y).breakEven.value?H(x(y).breakEven.value):TA),1)]),l("div",gA,[d(i,{class:"row-label with-tip",content:`${e.$t("t.tradingFee")} (${e.$t("t.maker")})`,tooltip:e.$t("trading.orderCalculator.tooltip.tradingFeeMaker")},null,8,["content","tooltip"]),l("span",fA,m(X(x(y).makerTradingFee.value)),1)]),l("div",vA,[d(i,{class:"row-label with-tip",content:`${e.$t("t.tradingFee")} (${e.$t("t.taker")})`,tooltip:e.$t("trading.orderCalculator.tooltip.tradingFeeTaker")},null,8,["content","tooltip"]),l("span",yA,m(X(x(y).takerTradingFee.value)),1)])],64)):(o(),c(g,{key:0},[l("div",c_,[l("span",d_,m(e.$t("futuresMain.activeOrders.orderPrice")),1),l("span",p_,m(W.value),1)]),l("div",h_,[d(i,{class:"row-label with-tip",content:e.$t("t.orderSize"),tooltip:K.value},null,8,["content","tooltip"]),l("span",m_,m(q.value),1)]),l("div",g_,[l("span",f_,m(e.$t("trading.bot.takeProfitPrice")),1),l("span",v_,m(U(x(y).tpPrice.value,H)),1)]),l("div",y_,[l("span",b_,m(e.$t("trading.bot.stopLossPrice")),1),l("span",S_,m(Q.value),1)]),l("div",C_,[l
1("span",P_,m(`${e.$t("t.profit")} / ${e.$t("t.loss")} %`),1),l("span",k_,[l("span",T_,m(U(x(y).profitPercent.value,V)),1),t[4]||(t[4]=p(" / ")),l("span",M_,m(U(x(y).lossPercent.value,V)),1)])]),l("div",L_,[l("span",w_,m(`${e.$t("t.risk")} / ${e.$t("t.reward")}`),1),l("span",D_,m(j.value),1)]),l("div",O_,[l("span",I_,m(e.$t("trading.orderCalculator.row.estLiqPrice")),1),l("span",x_,m(Y.value),1)]),l("div",__,[d(i,{class:"row-label with-tip",content:e.$t("t.tradingFee"),tooltip:e.$t("trading.orderCalculator.tooltip.tradingFeeTaker")},null,8,["content","tooltip"]),l("span",A_,m(X(x(y).takerTradingFee.value)),1)])],64))])]),l("div",bA,[te.value.length?(o(),c("div",SA,[te.value.length>1?(o(),c("ul",CA,[(o(!0),c(g,null,R(te.value,(e=>(o(),c("li",{key:e},m(e),1)))),128))])):(o(),c("p",PA,m(te.value[0]),1))])):h("",!0),(o(!0),c(g,null,R(ie.value,(e=>(o(),c("div",{key:e,class:"warning-card"},[d(JP,{class:"warn-icon",width:"16",height:"16",fill:"currentColor"}),l("span",null,m(e),1)])))),128)),l("button",{type:"button",class:"confirm-btn",disabled:ae.value,onClick:ne},m(e.$t("t.confirm")),9,kA),l("span",{class:"cancel-btn",onClick:t[2]||(t[2]=e=>$(!1))},m(e.$t("t.cancel")),1)])],2)]})),_:1},8,["visible"]),d(zx,{visible:re.value,"onUpdate:visible":t[3]||(t[3]=e=>re.value=e),onConfirm:oe},null,8,["visible"])],64)}}}),[["__scopeId","data-v-0956ad42"]]),LA={section:"fee-table",tab:"futures"},wA=[{id:"size",lang:"t.positionSize",type:"inline"},{id:"balance",lang:"futuresMain.trade.balance"}],DA={price:"",size:"",stopPrice:"",triggerPrice:"",time:"GTC",reduceOnly:!1,postOnly:!1,trigger:xr.default,percent:0,enableTpSl:!1,tpPrice:"",slPrice:"",tpPriceType:sm.MARK,slPriceType:sm.MARK},OA=ga.map((e=>({id:e,lang:`t.order.timeInForce.${e}`,isI18nKey:!0}))),IA={name:"LimitOrderForm",components:{FuturesAvailableBalance:pD,FuturesFormActions:vD,FuturesMarginInfoList:BD,FuturesAdvancedOrderValue:HD,FuturesOrderValueV2:pO,FuturesOrderInfoV2:kO,FuturesTriggerTypeSelect:yD,FuturesChoose:om,BboButton:xO,TradeSlider:po,TradingInput:Wn,FuturesSizeInput:wO,LimitLastPriceBtn:AO,TpSlOrderFormOptions:tI,TpSlOrderWithPositioinWarningDialog:oI,MultipleModePositionLimitWarning:cI,PostOnlyCheckbox:dI,ReduceOnlyCheckbox:pI,TifSelector:gI,LeaderOrderValidationWarning:yI,IconCalculator2:WI,IconFee:Ca,OrderCalculatorDialog:MA},props:{infoStp:{type:String,default:"limit"},hedgeModeType:{type:String,default:""}},setup(){const e=KI(),t=QI(),i=Ge(),{shouldDisableOrder:r}=fI(),{checkPriceProtection:a}=xI(),n=ue(),{refresh:o,resolve:s,resolveFresh:l,options:u,selectedOption:c,setSelectedType:d}=VI({fetchOrderBook:e=>Ve.getOrderBookL2(e),symbol:()=>{var e;return(null==(e=Ta.getters["futures/marketData"])?void 0:e.symbol)||n.params.id},storageKey:He.BBO_FUTURES_SELECTION});return{orderCalculatorStore:e,orderFormApplyStore:t,futuresSettingStore:i,shouldDisableOrder:r,generateTriggerPriceTooltip:CI,TRIGGER_PRICE_TYPE:xr,checkPriceProtection:a,refreshBboOrderBook:o,resolveBbo:s,resolveBboFresh:l,bboOptions:u,bboSelection:c,setBboSelection:d}},data:()=>({enableVipProgram:mt.enableVipProgram,contractTypes:wA,timeInForce:OA,bboActive:!1,formData:{...DA},calculatorTpslSide:"",direction:null,contractType:wA[0],isPercentFlag:!1,i18nFormat:{br:"\n"},isShowTpSlOrderWarningDialog:!1,tpSlOrderWarningType:wm,marginRequired:{buy:0,sell:0},maxSize:{buy:0,sell:0},isLastPriceUpdate:!1}),computed:{...b(["loginState","futureOrderBookShortcut"]),...U("futures",["marketData","marketDetail","wallet","hasOpenPosition","hasLeaderPosition","openPosition","leaderPosition","currentMarketPositionMode","isOneWayMode","isHedgeMode","isMultipleMode","availableBalance","maxReduceOnlySize","isReachedMaxPositionSize","isUseShareLib","currentDisplayLeverage","isMarketOffHours"]),...b("futures",["futuresMarkPriceMap","fixedCurrency"]),...y(pt,["isLeaderMode"]),...b("orderBook",["lastPrice"]),...y(Ge,["sizeType","isUsdSizeType","isContractSizeType","isCryptoSizeType","orderFormType","rememberFuturesSizeTpsl","orderFormSettings"]),...y(Wd,["tradingViewWidgetInstance"]),orderCalculatorEntryAllowed(){return Go(this.$store)},roundedLastPrice(){return S(this.lastPrice).dp(this.marketDetail.priceFilter??2,S.ROUND_DOWN).toNumber()},shareLibPriceConfig(){return{markPrice:this.markPrice,lastPrice:this.roundedLastPrice,limitPrice:this.formData.price,triggerPrice:this.getTriggerPrice(this.infoStp)}},isLimit(){return this.infoStp===ni.LIMIT},markPrice(){return this.futuresMarkPriceMap[this.marketData.symbol]||0},tpSlBasePrice(){return this.bboActive?this.markPrice:this.formData.price},tpSlPriceError(){if(!this.bboActive)return"";const e=this.bboSelection.id,t=this.resolveBbo(e,zI),i=this.resolveBbo(e,$I);return null===t||null===i?this.$t("trading.bbo.noMatchingPrice"):""},isTriggerOnMarkPrice(){return this.formData.trigger===xr.MARK_PRICE},triggerOnPrice(){return this.isTriggerOnMarkPrice?this.markPrice:this.roundedLastPrice},marketName(){return this.$route.params.id},isLimitOrderType(){return this.infoStp===ni.LIMIT},isStopOrderType(){return this.infoStp===ni.LIMIT_STOP},isTakeProfitOrderType(){return this.infoStp===ni.LIMIT_TAKE_PROFIT},isHedgeOpen(){return this.isHedgeMode&&this.hedgeModeType===ka.OPEN},isHedgeClose(){return this.isHedgeMode&&this.hedgeModeType===ka.CLOSE},showTriggerPriceSelection(){return this.isStopOrderType||this.isTakeProfitOrderType},quoteCurrency(){return this.fixedCurrency},maxPriceLength(){return(this.lastPrice?this.lastPrice.toFixed(Number(this.marketData.priceFilter)).length:0)+2},totalAmount(){const e=Number(this.formData.price)||0,t=Number(this.contractUnitSize)||0,i=Number(this.marketDetail.contractSize)||0;return Number(S(e).times(t).times(i))},basicAuthPassedBuy(){const{price:e,stopPrice:t,triggerPrice:i,size:r}=this.formData;let a=!0;this.isHedgeClose&&!this.isPercentFlag?a=r<=this.maxSize.buy:this.marginRequired.buy>this.availableBalance&&(a=!1);const n=this.validPrice(e)&&this.validSize(this.contractUnitSize,e)&&a;return this.isLimitOrderType?n:this.isStopOrderType?!(t<this.triggerOnPrice)&&(n&&this.validPrice(t)):!!this.isTakeProfitOrderType&&(!(i>this.triggerOnPrice)&&(n&&this.validPrice(i)))},basicAuthPassedSell(){const{price:e,stopPrice:t,triggerPrice:i,size:r}=this.formData;let a=!0;this.isHedgeClose&&!this.isPercentFlag?a=r<=this.maxSize.sell:this.marginRequired.sell>this.availableBalance&&(a=!1);const n=this.validPrice(e)&&this.validSize(this.contractUnitSize,e)&&a;return this.isLimitOrderType?n:this.isStopOrderType?!(t>this.triggerOnPrice)&&(n&&this.validPrice(t)):!!this.isTakeProfitOrderType&&(!(i<this.triggerOnPrice)&&(n&&this.validPrice(i)))},disableBuySubmit(){return!this.loginState||!this.basicAuthPassedBuy||this.isModeReduceOnlyNotValid(xt.BUY)||this.isReachedMaxPositionSize||this.isBuyDisableLeadTrading},disableSellSubmit(){return!this.loginState||!this.basicAuthPassedSell||this.isModeReduceOnlyNotValid(xt.SELL)||this.isReachedMaxPositionSize||this.isSellDisableLeadTrading},symbol(){return this.marketData.symbol||this.$route.params.id},syncOrderBookShortcutTime(){return this.futureOrderBookShortcut.time},cryptoMinDecimalPlaces(){return pr(this.marketDetail.contractSize||0)},bboSideLimitPrice(){if(!this.bboActive)return null;const e=this.bboSelection.id;return{buy:this.resolveBbo(e,zI),sell:this.resolveBbo(e,$I)}},displayOrderValueInfo(){var e,t;const i=this.isPercentFlag?this.maxSize.buy:Number(this.formData.size),r=this.isPercentFlag?this.maxSize.sell:Number(this.formData.size),a=this.isPercentFlag?this.formData.percent/100:1,n=this.bboActive?Number(null==(e=this.bboSideLimitPrice)?void 0:e.buy)||1:this.formData.price||1,o=this.bboActive?Number(null==(t=this.bboSideLimitPrice)?void 0:t.sell)||1:this.formData.price||1;let s,l,u,c;if(this.isUsdSizeType&&(s=S(i).times(a).div(n).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),l=S(r).times(a).div(o).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),u=S(s).times(n).toFixed(2,S.ROUND_DOWN),c=S(l).times(o).toFixed(2,S.ROUND_DOWN)),this.isCryptoSizeType&&(s=S(i).times(a).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),l=S(r).times(a).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),u=S(s).times(n).toFixed(2,S.ROUND_DOWN),c=S(l).times(o).toFixed(2,S.ROUND_DOWN)),this.isContractSizeType){const e=Math.floor(i),t=Math.floor(r),d=Number(this.marketDetail.contractSize)||0;s=Math.floor(e*a).toString(),l=Math.floor(t*a).toString(),u=S(n).times(d).times(s).toFixed(2,S.ROUND_DOWN),c=S(o).times(d).times(l).toFixed(2,S.ROUND_DOWN)}return{buySize:s,sellSize:l,buyValue:u,sellValue:c}},marginBuySize(){return this.isContractSizeType?this.displayOrderValueInfo.buySize:qi(this.displayOrderValueInfo.buySize)},marginSellSize(){return this.isContractSizeType?this.displayOrderValueInfo.sellSize:q
1i(this.displayOrderValueInfo.sellSize)},contractUnitSize(){return Pa(this.formData.size,this.formData.price)},cryptoSize(){const{size:e,price:t}=this.formData;switch(this.sizeType.id){case Ke.CONTRACTS:return Qe(e);case Ke.USD:return sa(e,t);case Ke.CRYPTO:default:return e}},formSizeText(){return this.isUsdSizeType?this.$filters.formatNumber(this.formData.size,this.marketData.priceFilter):this.formData.size},estLimitPnl(){var e;const t=null==(e=this.openPosition)?void 0:e[0];if(!(t&&t.totalContracts&&this.formData.price&&this.contractUnitSize))return 0;const i=t.orderModeName===xt.BUY;return S(this.formData.price).minus(t.entryPrice).times(i?1:-1).times(Math.min(this.contractUnitSize,t.totalContracts)).times(this.marketDetail.contractSize).toNumber()},isShowReduceOnly(){return!this.isHedgeMode&&!this.isMultipleMode},isReduceOnlyDisabled(){return!!this.isOneWayMode&&(0===this.maxReduceOnlySize||""!==this.formData.size&&S(this.contractUnitSize).gt(this.maxReduceOnlySize))},isBuyDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!0)},isSellDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!1)},shouldShowLeaderWarning(){return this.isBuyDisableLeadTrading||this.isSellDisableLeadTrading}},watch:{"orderFormApplyStore.version"(){this.applyOrderCalculatorPayload()},isMarketOffHours:{handler(e){e&&(this.formData.postOnly=!0)},immediate:!0},$route(){this.init(),this.isLastPriceUpdate=!1},lastPrice(){this.isLastPriceUpdate||(this.isLastPriceUpdate=!0,this.init())},syncOrderBookShortcutTime(){const{type:e,price:t,size:i,total:r}=this.futureOrderBookShortcut;"price"===e?this.formData.price=t:"size"===e?this.formData.size=i:"total"===e&&(this.formData.price=t,this.formData.size=r)},infoStp(){this.contractType=wA[0],this.formData.size="",this.formData.percent=0,this.bboActive=!1,this.isPercentFlag=!1},"formData.price":{handler:function(){this.$refs.amountQuick&&this.$refs.amountQuick.triggerReset()}},"formData.percent":{handler(e){if(this.isPercentFlag){const{buy:t,sell:i}=this.maxSize,r=Math.max(t,i);this.formData.size=r*(e/100)}}},"formData.enableTpSl"(e){e&&(this.formData.reduceOnly=!1)},"formData.reduceOnly"(e){e&&(this.formData.enableTpSl=!1)},symbol(){this.formData.percent=0,this.formData.size="",this.isPercentFlag=!1,this.formData.enableTpSl=!1,this.formData.tpPrice="",this.formData.slPrice="",this.calculatorTpslSide="",this.bboActive&&this.updateBboPrice()},isShowReduceOnly(e){e||(this.formData.reduceOnly=!1)},currentDisplayLeverage(){this.triggerPercentCalculation()},isLeaderMode(){this.isPercentFlag&&this.formData.percent&&this.triggerPercentCalculation()}},created(){this.init()},methods:{openOrderCalculator(){var e;const t=(null==(e=this.$store.getters["futures/currentMargin"])?void 0:e[0])||{},i=e=>{const t=Number(e);return Number.isFinite(t)&&t>0?t:null};this.orderCalculatorStore.open({lastPrice:Number(this.lastPrice)||0,orderFormPrice:this.bboActive?null:i(this.formData.price),orderFormSize:i(this.formData.size),sizeUnit:this.sizeType.id,tpPrice:this.formData.enableTpSl?i(this.formData.tpPrice):null,slPrice:this.formData.enableTpSl?i(this.formData.slPrice):null,leverage:t.leverage||this.$store.getters["futures/maxLeverage"],marginMode:t.marginMode||ri.CROSS})},goFeeRatePage(){const e=this.$router.resolve({name:ai.VIP_PROGRAM,query:LA});window.open(e.href,"_blank")},applyOrderCalculatorPayload(){var e;const t=this.orderFormApplyStore.consume();if(t){if(t.sizeUnit!==this.sizeType.id){const i={[Ke.USD]:this.quoteCurrency,[Ke.CRYPTO]:null==(e=this.marketData)?void 0:e.baseCurrency,[Ke.CONTRACTS]:this.$t("futuresMain.contracts")}[t.sizeUnit];this.futuresSettingStore.setSizeType({id:t.sizeUnit,lang:i,isI18nKey:!1})}this.formData.price=String(t.price),null!==t.size&&(this.formData.size=String(t.size)),null!==t.tpPrice||null!==t.slPrice?(this.formData.enableTpSl=!0,this.formData.tpPrice=null!==t.tpPrice?String(t.tpPrice):"",this.formData.slPrice=null!==t.slPrice?String(t.slPrice):"",this.calculatorTpslSide=t.side):(this.formData.enableTpSl=!1,this.formData.tpPrice="",this.formData.slPrice="",this.calculatorTpslSide="")}},...v(["changeCurrentOrderPrice","changeCurrentOrderQty"]),...v("futures",["futuresOrder"]),triggerPercentCalculation(){const e=this.formData.percent;this.formData.percent=null,this.$nextTick((()=>{this.formData.percent=e}))},init(){this.formData.price=this.lastPrice?this.roundedLastPrice.toString():"",this.changeCurrentOrderPrice(this.formData.price);const e=this.contractUnitSize?parseInt(this.contractUnitSize):0;this.changeCurrentOrderQty(e)},changePriceInput(e){let t=String(e);t&&(this.lastPrice&&t.length>
1this.maxPriceLength&&(t=t.substring(0,this.maxPriceLength)),this.formData.price=t,this.changeCurrentOrderPrice(t))},changeQtyInput(e){e&&this.changeCurrentOrderQty(this.contractUnitSize)},validPrice(e){const{minValidPrice:t}=this.marketDetail;return e>=t},validSize(e,t){const{minOrderSize:i,maxOrderSize:r,contractSize:a,maxPositionsUSDValue:n}=this.marketDetail,o=S(n).div(t).div(a).dp(0,S.ROUND_DOWN).toNumber();return this.formData.postOnly?e>=i&&e<=o:e>=i&&e<=r},txType(e){switch(e){case ni.LIMIT_TAKE_PROFIT:return"TRIGGER";case ni.LIMIT_STOP:return"STOP";default:return e.toUpperCase()}},getTriggerPrice(e){switch(e){case ni.LIMIT_STOP:return this.formData.stopPrice;case ni.LIMIT_TAKE_PROFIT:return this.formData.triggerPrice;default:return null}},getFormData(){const{price:e,size:t,time:i,reduceOnly:r,postOnly:a,trigger:n,enableTpSl:o,tpPrice:s,tpPriceType:l,slPrice:u,slPriceType:c}=this.formData,d={type:"LIMIT",price:e,size:t,txType:this.txType(this.infoStp),triggerPrice:this.getTriggerPrice(this.infoStp),postOnly:a,reduceOnly:r||this.isHedgeClose,takeProfitPrice:o&&s?Number(s):null,takeProfitTrigger:o&&s?l.payloadName:null,stopLossPrice:o&&u?Number(u):null,stopLossTrigger:o&&u?c.payloadName:null};return this.isReduceOnlyDisabled&&(d.reduceOnly=!1),this.isLimitOrderType&&(d.time_in_force=i),this.showTriggerPriceSelection&&(d.trigger=n),d},buySubmit(){this.direction="BUY",this.formData.enableTpSl&&!this.isHedgeClose?this.tpSlSubmit(!0):this.submit()},sellSubmit(){this.direction="SELL",this.formData.enableTpSl&&!this.isHedgeClose?this.tpSlSubmit(!1):this.submit()},tpSlSubmit(e){if(this.$refs.tpSlOptions.validateTpSl(e))if(this.hasOpenPosition){const t=xm({positions:this.openPosition,orderMode:e?ot.BUY:ot.SELL,orderContractSize:this.contractUnitSize,isHedgeMode:this.isHedgeMode});t===wm?this.submit():(this.tpSlOrderWarningType=t,this.isShowTpSlOrderWarningDialog=!0)}else this.submit()},async submit(){const e=this.getFormData();if(this.bboActive){const t="BUY"===this.direction?zI:$I,i=await this.resolveBboFresh(this.bboSelection.id,t);if(null===i)return void this.$toastError({title:this.$t("trading.bbo.noMatchingPrice")});e.price=S(i).toFixed(this.marketDetail.priceFilter,"BUY"===this.direction?S.ROUND_DOWN:S.ROUND_UP)}const t="BUY"===this.direction?this.isHedgeOpen?this.marginSellSize:this.marginBuySize:this.isHedgeOpen?this.marginBuySize:this.marginSellSize,i={side:this.direction,symbol:this.symbol,...e,size:this.isHedgeClose?t:this.contractUnitSize,positionMode:this.currentMarketPositionMode.positionMode},r=await this.checkPriceProtection({isSpot:!1,isBuyAction:"BUY"===this.direction,symbol:this.symbol,orderPrice:i.price,triggerPrice:i.stopPrice||i.triggerPrice,priceFilter:this.marketData.priceFilter,quoteCurrency:this.quoteCurrency,tradingType:this.infoStp});if(!r.ok)return;r.protectionPrice&&(this.formData.price=r.protectionPrice,i.price=r.protectionPrice),this.resetFormData();const a=Number(i.price)||0,n=Number(this.marketDetail.contractSize)||0,o=Number(i.size)||0,s=Number(S(a).times(n).times(o));this.futuresOrder({orderData:i,orderValue:s}).then((e=>{if(e.error)throw e;this.$sendEvent(Kr.EVENT_WEB_TRADING_FUTURES_ORDER_FORM_SUBMITTED,{submitSuccess:!0,orderData:i,orderValue:s,formData:this.formData,tradingViewWidgetInstance:this.tradingViewWidgetInstance,errorCode:null})})).catch((e=>{this.$sendEvent(Kr.EVENT_WEB_TRADING_FUTURES_ORDER_FORM_SUBMITTED,{submitSuccess:!1,orderData:i,orderValue:s,formData:this.formData,tradingViewWidgetInstance:this.tradingViewWidgetInstance,errorCode:e.error.code})}))},resetFormData(){this.rememberFuturesSizeTpsl||(this.formData.size="",this.formData.percent=0,this.isPercentFlag=!1,this.formData.enableTpSl=!1,this.formData.tpPrice="",this.formData.slPrice="",this.formData.tpPriceType=sm.MARK,this.formData.slPriceType=sm.MARK)},isModeReduceOnlyNotValid(e){const t=this.isLeaderMode?this.hasLeaderPosition:this.hasOpenPosition;if(!this.isOneWayMode||!this.formData.reduceOnly||!t)return!1;return(this.isLeaderMode?this.leaderPosition[0].orderModeName:this.openPosition[0].orderModeName)===e&&S(this.contractUnitSize).lte(this.maxReduceOnlySize)},toggleBbo(){this.bboActive=!this.bboActive,this.bboActive?this.updateBboPrice():this.init()},setPriceMatch(e){this.setBboSelection(e),this.updateBboPrice()},async updateBboPrice(){if(!this.bboActive)return;await this.refreshBboOrderBook();const e=this.resolveBbo(this.bboSelection.id,zI);this.formData.price=e??""},handleQuick(){this.isPercentFlag=!0},handleSizeFocus(){this.isPercentFlag&&(this.isPercentFlag=!1,this.formData.percent=0,this.formData.size="")},updateMarginRequired(e){this.marginRequired=e},updateMaxSize(e){this.maxSize=e}}},xA={class:"futures-form-container"},_A={class:"form-input-container"},AA={class:"pre-line"},RA={key:0},FA={class:"pre-line"},EA={key:0},BA={class:"limit-price-wrapper"},zA={class:"darker"},$A={class:"lower darker"},NA={class:"setting-wrapper"},UA={class:"off-hours-tag"},HA={key:3,class:"est-pnl"},VA={class:"info-and-actions"},WA={key:0,class:"order-calculator-entry"};const qA=$n(IA,[["render",function(e,t,i,r,u,f){const v=a("Tooltip"),y=a("FuturesTriggerTypeSelect"),b=a("TradingInput"),S=a("FuturesChoose"),P=a("LimitLastPriceBtn"),k=a("BboButton"),T=a("FuturesSizeInput"),M=a("TradeSlider"),L=a("i18n-t"),w=a("FuturesAvailableBalance"),D=a("PostOnlyCheckbox"),O=a("ReduceOnlyCheckbox"),I=a("TifSelector"),x=a("TpSlOrderFormOptions"),_=a("MultipleModePositionLimitWarning"),A=a("FuturesFormActions"),R=a("IconCalculator2"),F=a("IconFee"),E=a("OrderCalculatorDialog"),B=a("FuturesOrderValueV2"),z=a("FuturesAdvancedOrderValue"),$=a("LeaderOrderValidationWarning"),N=a("FuturesOrderInfoV2"),U=a("FuturesMarginInfoList"),H=a("TpSlOrderWithPositioinWarningDialog");return o(),c("div",xA,[l("div",_A,[f.isStopOrderType?(o(),n(b,{key:0,value:u.formData.stopPrice,"onUpdate:value":t[2]||(t[2]=e=>u.formData.stopPrice=e),label:"stopPrice",enableThousandSeparator:"",hide
1Spin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice},te({prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.triggerPrice")},{tooltip:s((()=>[l("p",AA,m(r.generateTriggerPriceTooltip({orderType:"stop",priceType:f.isTriggerOnMarkPrice?r.TRIGGER_PRICE_TYPE.MARK_PRICE:r.TRIGGER_PRICE_TYPE.LAST_PRICE,$t:e.$t})),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(f.quoteCurrency)+")",1)])),append:s((()=>[e.isMobile?(o(),c("span",RA,m(f.quoteCurrency),1)):(o(),n(y,{key:1,value:u.formData.trigger,"onUpdate:value":t[1]||(t[1]=e=>u.formData.trigger=e)},null,8,["value"]))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(y,{value:u.formData.trigger,"onUpdate:value":t[0]||(t[0]=e=>u.formData.trigger=e)},null,8,["value"])])),key:"0"}:void 0]),1032,["value","step","min","placeholder"])):h("",!0),f.isTakeProfitOrderType?(o(),n(b,{key:1,value:u.formData.triggerPrice,"onUpdate:value":t[5]||(t[5]=e=>u.formData.triggerPrice=e),label:"triggerPrice",enableThousandSeparator:"",hideSpin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice},te({prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.triggerPrice")},{tooltip:s((()=>[l("p",FA,m(r.generateTriggerPriceTooltip({orderType:"takeProfit",priceType:f.isTriggerOnMarkPrice?r.TRIGGER_PRICE_TYPE.MARK_PRICE:r.TRIGGER_PRICE_TYPE.LAST_PRICE,$t:e.$t})),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(f.quoteCurrency)+")",1)])),append:s((()=>[e.isMobile?(o(),c("span",EA,m(f.quoteCurrency),1)):(o(),n(y,{key:1,value:u.formData.trigger,"onUpdate:value":t[4]||(t[4]=e=>u.formData.trigger=e)},null,8,["value"]))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(y,{value:u.formData.trigger,"onUpdate:value":t[3]||(t[3]=e=>u.formData.trigger=e)},null,8,["value"])])),key:"0"}:void 0]),1032,["value","step","min","placeholder"])):h("",!0),l("div",BA,[u.bboActive?(o(),n(S,{key:0,class:"bbo-select",items:r.bboOptions,form:r.bboSelection,returnObject:"","onUpdate:form":f.setPriceMatch},null,8,["items","form","onUpdate:form"])):(o(),n(b,{key:1,value:u.formData.price,"onUpdate:value":t[6]||(t[6]=e=>u.formData.price=e),label:"price",enableThousandSeparator:"",hideSpin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice,onInput:f.changePriceInput},te({prepend:s((()=>[d(v,{content:e.$t("t.price")},{tooltip:s((()=>[l("p",null,m(e.$t("futuresMain.trade.price.tip")),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(f.quoteCurrency)+")",1)])),content:s((()=>[d(P,{futures:"",onChange:f.changePriceInput},null,8,["onChange"])])),_:2},[e.isMobile?{name:"append",fn:s((()=>[l("span",null,m(f.quoteCurrency),1)])),key:"0"}:void 0]),1032,["value","step","min","placeholder","onInput"])),f.isLimitOrderType?(o(),n(k,{key:2,active:u.bboActive,onToggle:f.toggleBbo},null,8,["active","onToggle"])):h("",!0)]),d(T,{size:u.formData.size,"onUpdate:size":t[7]||(t[7]=e=>u.formData.size=e),hideSpin:"",price:u.formData.price,percent:u.formData.percent+" %",isPercent:u.isPercentFlag,maxSizeCalulatedPrice:Number(u.formData.price),percentPlaceholder:f.isHedgeClose?e.$t("t.position"):null,onFocus:f.handleSizeFocus,onInput:f.changeQtyInput},null,8,["size","price","percent","isPercent","maxSizeCalulatedPrice","percentPlaceholder","onFocus","onInput"]),d(M,{value:u.formData.percent,"onUpdate:value":t[8]||(t[8]=e=>u.formData.percent=e),onChange:f.handleQuick},null,8,["value","onChange"]),f.disableBuySubmit&&f.disableSellSubmit||!f.isStopOrderType&&!f.isTakeProfitOrderType?h("",!0):(o(),n(L,{key:2,keypath:"trading.hint.advanceLimit",class:"trade-explanation",tag:"div"},{priceType:s((()=>[l("span",null,m(f.isTriggerOnMarkPrice?e.$t("spot.order.market.markPrice"):e.$t("spot.order.market.lastPrice")),1)])),triggerPrice:s((()=>[l("span",null,m(f.isStopOrderType?u.formData.stopPrice:e.$filters.formatNumber(u.formData.triggerPrice,e.marketData.priceFilter))+" "+m(f.quoteCurrency),1)])),orderType:s((()=>[l("span",zA,m(e.$t("trading.limitOrder")),1)])),side:s((()=>[l("span",$A,m(f.disableBuySubmit||f.disableSellSubmit?f.disableBuySubmit?e.$t("t.sell"):e.$t("t.buy"):`${e.$t("t.buy")}/${e.$t("t.sell")}`),1)])),size:s((()=>[l("span",null,m(f.formSizeText)+" "+m(e.sizeType.lang),1)])),price:s((()=>[l("span",null,m(e.$filters.formatNumber(u.formData.price,e.marketData.priceFilter))+" "+m(f.quoteCurrency),1)])),_:1})),d(w,{class:"avbl-balance-area",showTransfer:!f.isHedgeClose},null,8,["showTransfer"]),l("div",NA,[d(D,{class:"form-checkbox",value:!!e.isMarketOffHours||u.formData.postOnly,"onUpdate:value":t[9]||(t[9]=t=>u.formData.postOnly=!!e.isMarketOffHours||t)},{default:s((()=>[e.isMarketOffHours?(o(),n(v,{key:0,placement:"bottom-start"},{content:s((()=>[l("span",UA,m(e.$t("rules.required")),1)])),tooltip:s((()=>[p(m(e.$t("order.post-only.required")),1)])),_:1})):h("",!0)])),_:1},8,["value"]),f.isShowReduceOnly?(o(),n(O,{key:0,value:u.formData.reduceOnly,"onUpdate:value":t[10]||(t[10]=e=>u.formData.reduceOnly=e),class:"form-checkbox",disabled:f.isReduceOnlyDisabled},null,8,["value","disabled"])):h("",!0),f.isLimitOrderType?(o(),n(I,{key:1,value:u.formData.time,"onUpdate:value":t[11]||(t[11]=e=>u.formData.time=e),class:"flex-box items-center form-checkbox"},null,8,["value"])):h("",!0),f.isHedgeClose?h("",!0):(o(),n(x,{key:2,ref:"tpSlOptions",enableTpSl:u.formData.enableTpSl,"onUpdate:enableTpSl":t[12]||(t[12]=e=>u.formData.enableTpSl=e),tpPrice:u.formData.tpPrice,"onUpdate:tpPrice":t[13]||(t[13]=e=>u.formData.tpPrice=e),tpPriceType:u.formData.tpPriceType,"onUpdate:tpPriceType":t[14]||(t[14]=e=>
1u.formData.tpPriceType=e),slPrice:u.formData.slPrice,"onUpdate:slPrice":t[15]||(t[15]=e=>u.formData.slPrice=e),slPriceType:u.formData.slPriceType,"onUpdate:slPriceType":t[16]||(t[16]=e=>u.formData.slPriceType=e),class:"form-checkbox tpsl-checkbox",symbol:f.symbol,price:f.tpSlBasePrice,cryptoSize:f.cryptoSize,buyQty:Number(f.contractUnitSize),sellQty:Number(f.contractUnitSize),priceError:f.tpSlPriceError,dialogDefaultSide:u.calculatorTpslSide},null,8,["enableTpSl","tpPrice","tpPriceType","slPrice","slPriceType","symbol","price","cryptoSize","buyQty","sellQty","priceError","dialogDefaultSide"])),u.formData.reduceOnly&&!f.isReduceOnlyDisabled?(o(),c("div",HA,[d(L,{keypath:"futuresMain.closeOrderPlacement.estPnl"},{value:s((()=>[l("span",{class:C(["pnl-num",{"brand-color-positive":f.estLimitPnl>=0,"brand-color-negative":f.estLimitPnl<0}])},m(e.$filters.formatNumber(f.estLimitPnl,{formatKey:2,signed:!0}))+" "+m(f.quoteCurrency),3)])),_:1})])):h("",!0)])]),l("div",VA,[d(_),d(A,{buyDisabled:f.disableBuySubmit,sellDisabled:f.disableSellSubmit,buySubmit:f.buySubmit,sellSubmit:f.sellSubmit,isOpen:f.isHedgeOpen,isClose:f.isHedgeClose},null,8,["buyDisabled","sellDisabled","buySubmit","sellSubmit","isOpen","isClose"]),f.isLimitOrderType&&f.orderCalculatorEntryAllowed?(o(),c("div",WA,[l("button",{type:"button",class:"entry-btn",onClick:t[17]||(t[17]=(...e)=>f.openOrderCalculator&&f.openOrderCalculator(...e))},[d(R,{width:"16",height:"16"}),p(" "+m(e.$t("trading.orderCalculator.calculator")),1)]),u.enableVipProgram?(o(),c(g,{key:0},[t[20]||(t[20]=l("span",{class:"divider"},"|",-1)),l("button",{type:"button",class:"entry-btn",onClick:t[18]||(t[18]=(...e)=>f.goFeeRatePage&&f.goFeeRatePage(...e))},[d(F,{width:"16",height:"16"}),p(" "+m(e.$t("trading.orderCalculator.feeRate")),1)])],64)):h("",!0),r.orderCalculatorStore.visible?(o(),n(E,{key:1})):h("",!0)])):h("",!0),e.isUseShareLib?(o(),n(B,{key:1,orderFormType:e.orderFormType,priceConfig:f.shareLibPriceConfig,sideLimitPrice:f.bboSideLimitPrice,contractOrderSize:f.contractUnitSize,orderFormSize:u.formData.size,orderFormPrice:u.formData.price,isReducePosition:u.formData.reduceOnly||f.isHedgeClose,onUpdateMarginRequired:f.updateMarginRequired},null,8,["orderFormType","priceConfig","sideLimitPrice","contractOrderSize","orderFormSize","orderFormPrice","isReducePosition","onUpdateMarginRequired"])):(o(),n(z,{key:2,orderValueInfo:f.displayOrderValueInfo,price:u.formData.price,sideLimitPrice:f.bboSideLimitPrice,buySize:f.contractUnitSize,sellSize:f.contractUnitSize,isClose:f.isHedgeClose,orderFormSize:u.formData.size,orderFormPrice:u.formData.price,onUpdateMarginRequired:f.updateMarginRequired},null,8,["orderValueInfo","price","sideLimitPrice","buySize","sellSize","isClose","orderFormSize","orderFormPrice","onUpdateMarginRequired"])),f.shouldShowLeaderWarning?(o(),n($,{key:3})):h("",!0),e.isUseShareLib?(o(),n(N,{key:4,priceConfig:f.shareLibPriceConfig,sideLimitPrice:f.bboSideLimitPrice,orderFormType:e.orderFormType,contractOrderSize:f.contractUnitSize,isClose:f.isHedgeClose,isReducePosition:u.formData.reduceOnly||f.isHedgeClose,onUpdateMaxSize:f.updateMaxSize},null,8,["priceConfig","sideLimitPrice","orderFormType","contractOrderSize","isClose","isReducePosition","onUpdateMaxSize"])):(o(),n(U,{key:5,price:u.formData.price,sideLimitPrice:f.bboSideLimitPrice,buySize:f.contractUnitSize,sellSize:f.contractUnitSize,isClose:f.isHedgeClose,onUpdateMaxSize:f.updateMaxSize},null,8,["price","sideLimitPrice","buySize","sellSize","isClose","onUpdateMaxSize"]))]),d(H,{visible:u.isShowTpSlOrderWarningDialog,"onUpdate:visible":t[19]||(t[19]=e=>u.isShowTpSlOrderWarningDialog=e),type:u.tpSlOrderWarningType,onConfirm:f.submit},null,8,["visible","type","onConfirm"])])}],["__scopeId","data-v-aa5d7918"]]);function GA({basePrice:e,trailValue:t,type:i,isBuy:r,priceDecimal:a}){const n=S(e),o=S(t),s=r?S.ROUND_DOWN:S.ROUND_UP;let l;if(i===Xi.DISTANCE)l=r?n.plus(o):n.minus(o);else{const e=o.div(100);l=r?n.times(S(1).plus(e)):n.times(S(1).minus(e))}return l.dp(a,s).toNumber()}const KA=new Set([ni.MARKET,ni.TWAP]),QA=new Set([ni.MARKET_STOP,ni.MARKET_TAKE_PROFIT,ni.MARKET_TRAILING_STOP]);const jA={key:0,class:"off-hours-desc"},YA=$n(A({__name:"OffHoursDescription",props:{orderType:{}},setup(e){const t=e,{offHoursMessage:i}=function(e){const{t:t}=G(),i=M((()=>KA.has(e.value))),r=M((()=>QA.has(e.value))),a=M((()=>{switch(e.value){case ni.MARKET:return t("t.market");case ni.TWAP:return t("trading.buySell.title.twap");case ni.MARKET_STOP:return t("trading.orderForm.orderTypes.stopMarket");case ni.MARKET_TAKE_PROFIT:return t("history.order.filter.type.takeProfitMarket");case ni.MARKET_TRAILING_STOP:return t("futuresMain.trade.trailingStop");case ni.OCO:return t("trading.buySell.title.oco");default:return""}})),n=M((()=>i.value?t("t.postOnlyRestrictedDesc",{orderType:a.value}):r.value?t("t.postOnlyConditionalDesc",{orderType:a.value}):"futures-grid"===e.value?t("t.postOnlyGridBotDesc"):e.value===ni.OCO?t("t.postOnlyRestrictedOCODesc"):""));return{isRestrictedOrderType:i,isConditionalOrderType:r,orderTypeName:a,offHoursMessage:n}}(Z(t,"orderType"));return(e,t)=>x(i)?(o(),c("div",jA,m(x(i)),1)):h("",!0)}}),[["__scopeId","data-v-ecd1a434"]]),ZA={name:"MarketOrderForm",components:{FuturesAvailableBalance:pD,FuturesFormActions:vD,FuturesMarginInfoList:BD,FuturesAdvancedOrderValue:HD,FuturesOrderValueV2:pO,FuturesOrderInfoV2:kO,TradingInput:Wn,TradeSlider:po,FuturesSizeInput:wO,FuturesTriggerTypeSelect:yD,TpSlOrderFormOptions:tI,TpSlOrderWithPositioinWarningDialog:oI,MultipleModePositionLimitWarning:cI,ReduceOnlyCheckbox:pI,LeaderOrderValidationWarning:yI,ActivationPriceCheckbox:BT,ActivationPriceInput:NT,TrailingStopDistancePercentageInput:FT,OffHoursDescription:YA},props:{infoStp:{type:String,default:"0"},hedgeModeType:{type:String,default:""}},setup(){const{shouldDisableOrder:e}=fI();return{shouldDisableOrder:e,generateTriggerPriceTooltip:CI,TRIGGER_PRICE_TYPE:xr}},data:()=>({OrderTypeList:{[ni.MARKET]:"LIMIT",[ni.MARKET_STOP]:"STOP",[ni.MARKET_TRAILING_STOP]:"TRAILING",[ni.MARKET_TAKE_PROFIT]:"TRIGGER"},formData:{size:"",trailValue:"",trailValueType:Xi.DISTANCE,triggerPrice:"",reduceOnly:!1,time:"GTC",closePosition:!1,percent:0,enableTpSl:!1,tpPrice:"",slPrice:"",tpPriceType:sm.MARK,slPriceType:sm.MARK,activationPrice:""}
1,direction:null,isPercentFlag:!1,isShowTpSlOrderWarningDialog:!1,tpSlOrderWarningType:0,marginRequired:{buy:0,sell:0},maxSize:{buy:0,sell:0},contractOrderSizeConvertFromUsdt:{buy:0,sell:0}}),computed:{...U("futures",["marketData","marketDetail","hasOpenPosition","hasLeaderPosition","openPosition","leaderPosition","currentMarketPositionMode","isOneWayMode","isHedgeMode","isMultipleMode","availableBalance","maxReduceOnlySize","isReachedMaxPositionSize","isUseShareLib","currentDisplayLeverage","isMarketOffHours"]),...b(["futureOrderBookShortcut","loginState"]),...b("futures",["futuresMarkPriceMap","fixedCurrency"]),...y(pt,["isLeaderMode"]),...b("orderBook",["lastPrice"]),...y(Ge,["sizeType","isUsdSizeType","isCryptoSizeType","orderFormType","rememberFuturesSizeTpsl","orderFormSettings"]),...y(Nn,["orderBook"]),roundedLastPrice(){return S(this.lastPrice).dp(this.priceFilter,S.ROUND_DOWN).toNumber()},shareLibPriceConfig(){const e={markPrice:this.markPrice,lastPrice:this.roundedLastPrice,limitPrice:this.formData.price,trailValue:String(this.formData.trailValue),triggerPrice:this.formData.triggerPrice};if(this.isTrailingStopOrderType){const t=this.isActivationPriceEnabled?this.formData.activationPrice:this.triggerOnPrice;e.usePrice=String(t)}return e},quoteCurrency(){return this.fixedCurrency},priceFilter(){return this.marketData.priceFilter??2},isMarketOrderType(){return this.infoStp===ni.MARKET},isStopOrderType(){return this.infoStp===ni.MARKET_STOP},isTrailingStopOrderType(){return this.infoStp===ni.MARKET_TRAILING_STOP},isTakeProfitOrderType(){return this.infoStp===ni.MARKET_TAKE_PROFIT},isHedgeOpen(){return this.isHedgeMode&&this.hedgeModeType===ka.OPEN},isHedgeClose(){return this.isHedgeMode&&this.hedgeModeType===ka.CLOSE},showTriggerPriceSelection(){return this.isStopOrderType||this.isTrailingStopOrderType||this.isTakeProfitOrderType},markPrice(){return this.futuresMarkPriceMap[this.marketData.symbol]||0},isTriggerOnMarkPrice(){return this.orderFormSettings.triggerOn===xr.MARK_PRICE},triggerOnPrice(){return this.isTriggerOnMarkPrice?this.markPrice:this.roundedLastPrice},futureOrderBookShortcutTime(){return this.futureOrderBookShortcut.time},combinedTriggerPrice:{get(){return this.formData.triggerPrice},set(e){this.formData.triggerPrice=e}},isTrailValuePercent(){return this.formData.trailValueType===Xi.PERCENTAGE},trailValueStep(){return this.isTrailValuePercent?.01:Number(this.marketDetail.minPriceIncrement)},trailValueMin(){return this.isTrailValuePercent?.1:Number(this.marketDetail.minValidPrice)},trailValueMax(){return this.isTrailValuePercent?99:1/0},trailValuePlaceholder(){return this.isTrailValuePercent?"0.1-99":this.marketDetail.minValidPrice},trailingBasePrice(){return this.isActivationPriceEnabled?this.formData.activationPrice:this.triggerOnPrice},trailingStopInfo(){return function({basePrice:e,trailValue:t,type:i,priceDecimal:r}){const a=1e6,n=GA({basePrice:e,trailValue:t,type:i,isBuy:!0,priceDecimal:r}),o=GA({basePrice:e,trailValue:t,type:i,isBuy:!1,priceDecimal:r});return{buy:Math.min(Math.max(n,0),a),sell:Math.min(Math.max(o,0),a),type:i}}({basePrice:this.trailingBasePrice,trailValue:Number(this.formData.trailValue)||0,type:this.formData.trailValueType,priceDecimal:this.marketDetail.priceFilter})},disableBuySubmit(){return!this.loginState||!this.basicAuthPassedBuy||this.isModeReduceOnlyNotValid(xt.BUY)||this.isReachedMaxPositionSize||this.isBuyDisableLeadTrading||this.isActivationPriceEmpty||this.isMarketOrderDisabledByOffHours},disableSellSubmit(){return!this.loginState||!this.basicAuthPassedSell||this.isModeReduceOnlyNotValid(xt.SELL)||this.isReachedMaxPositionSize||this.isSellDisableLeadTrading||this.isActivationPriceEmpty||this.isMarketOrderDisabledByOffHours},basicAuthPassedBuy(){const{triggerPrice:e,trailValue:t,size:i}=this.numberFormData;return(!this.isTrailingStopOrderType||0!=t)&&(!!wa("size",i)&&(!(!this.isMarketOrderType&&(this.isStopOrderType&&e<this.triggerOnPrice||this.isTakeProfitOrderType&&e>this.triggerOnPrice||!wa("price",e)))&&(this.isHedgeClose?this.isPercentFlag?0!==this.marginBuySize:this.formData.size<=this.maxSize.buy:!(this.marginRequired.buy>this.availableBalance))))},basicAuthPassedSell(){const{triggerPrice:e,trailValue:t,size:i}=this.numberFormData;return(!this.isTrailingStopOrderType||0!=t)&&(!!wa("size",i)&&(!(!this.isMarketOrderType&&(this.isStopOrderType&&e>this.triggerOnPrice||this.isTakeProfitOrderType&&e<this.triggerOnPrice||!wa("price",e)))&&(this.isHedgeClose?this.isPercentFlag?0!==this.marginSellSize:this.formData.size<=this.maxSize.sell:!(this.marginRequired.sell>this.availableBalance))))},numberFormData(){const{triggerPrice:e,trailValue:t}=this.formData;return{triggerPrice:Number(e),trailValue:Number(t),size:Number(this.contractUnitSize)}},symbol(){return this.marketData.symbol||this.$route.params.id},orderValueInfo(){return this.isUsdSizeType?this.usdOrderValueInfo:this.contractOrCryptoOrderValueInfo},usdOrderValueInfo(){const e=this.formData.percent/100,t=this.isPercentFlag?S(this.maxSize.buy).times(e).toNumber():this.formData.size,i=this.isPercentFlag?S(this.maxSize.sell).times(e).toNumber():this.formData.size,r=this.isMarketOrderType?null:this.isTrailingStopOrderType?this.trailingStopInfo.buy:this.combinedTriggerPrice,a=this.isMarketOrderType?null:this.isTrailingStopOrderType?this.trailingStopInfo.sell:this.combinedTriggerPrice,n=La(t,this.orderBook.asks,!0,r),o=La(i,this.orderBook.bids,!1,a);return{buySize:n.size,sellSize:o.size,buyValue:n.value,sellValue:o.value}},contractOrCryptoOrderValueInfo(){const e=this.formData.percent/100;let t=this.isPercentFlag?S(this.maxSize.buy).times(e).toNumber():this.formData.size,i=this.isPercentFlag?S(this.maxSize.sell).times(e).toNumber():this.formData.size;this.isCryptoSizeType?(t=qi(t),i=qi(i)):this.isPercentFlag&&(t=S(t).dp(0,S.ROUND_DOWN).toNumber(),i=S(i).dp(0,S.ROUND_DOWN).toNumber());const r=this.isMarketOrderType?null:this.isTrailingStopOrderType?this.trailingStopInfo.buy:this.combinedTriggerPrice,a=this.isMarketOrderType?null:this.isTrailingStopOrderType?this.trailingStopInfo.sell:this.combinedTriggerPrice,n=Ma(t,this.orderBook.asks,!0,r),o=Ma(i,this.orderBook.bids,!1,a);return{buySize:Math.min(t,n.size),sellSize:Math.min(i,o.size),buyValue:n.value,sellValue:o.value}},marginBuySize(){return this.isMarketOrderType?this.getMarketOrderTypeContractUnitSize(this.orderValueInfo.buySize):this.contractUnitSize},marginSellSize(){return this.isMarketOrderType?this.getMarketOrderTypeContractUnitSize(this.orderValueInfo.sellSize):this.contractUnitSize},contractUnitSize(){if(this.isMarketUsdReducePercentMode)return S(this.formData.size).dp(0,S.ROUND_DOWN).toNumber();const e=this.isMarketOrderType?this.markPrice:this.triggerOnPrice;return Pa(this.formData.size,e)},cryptoSize(){const{size:e}=this.formData;switch(this.sizeType.id){case Ke.CONTRACTS:return Qe(e);case Ke.USD:return sa(e,this.markPrice);case Ke.CRYPTO:default:return e}},submitSize(){if(this.isMarketUsdReducePercentMode)return this.contractUnitSize;const e="BUY"===this.direction;if(this.isHedgeClose&&!this.isUseShareLib){return e?this.marginBuySize:this.marginSellSize}let t=this.formData.size;if(this.isPercentFlag){const{buy:i,sell:r}=this.getBuySellMaxSize();t=(e?i:r)*(this.formData.percent/100)}if(this.isMarketOrderType&&this.isUsdSizeType){if(this.isUseShareLib)return e?this.contractOrderSizeConvertFromUsdt.buy:this.contractOrderSizeConvertFromUsdt.sell;const i=e?this.orderBook.asks:this.orderBook.bids;if(!(null==i?void 0:i.length))return pa(t,this.markPrice)}const i=this.isMarketOrderType?this.markPrice:this.triggerOnPrice;return Pa(t,i)},formSizeText(){return this.isUsdSizeType?this.$filters.formatNumber(this.formData.size,this.priceFilter):this.formData.size},priceForTpSlCalculate(){return this.isMarketOrderType?this.markPrice:this.formData.triggerPrice},supportReduceOnly(){return!this.isHedgeMode&&!this.isMultipleMode},isReduceMode(){return this.isOneWayMode&&this.formData.reduceOnly||this.isHedgeClose},isMarketUsdReducePercentMode(){return this.isMarketOrderType&&this.isUsdSizeType&&this.isReduceMode&&this.isPercentFlag},reduceMaxSize(){if(this.isOneWayMode&&this.formData.reduceOnly){const{totalContracts:e=0,orderModeName:t}=this.openPosition[0]||{},i="MODE_BUY"===t;return{buy:i?0:e,sell:i?e:0}}if(this.isHedgeClose){const e=this.openPosition.find((e=>"MODE_BUY"===e.orderModeName)),t=this.openPosition.find((e=>"MODE_SELL"===e.orderModeName));return{buy:(null==t?void 0:t.totalContracts)||0,sell:(null==e?void 0:e.totalContracts)||0}}return{buy:0,sell:0}},isReduceOnlyDisabled(){return!!this.isOneWayMode&&(0===this.maxReduceOnlySize||""!==this.formData.size&&S(this.contractUnitSize).gt(this.maxReduceOnlySize))},isBuyDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!0)},isSellDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!1)},shouldShowLeaderWarning(){return this.isBuyDisableLeadTrading||this.isSellDisableLeadTrading},trailingTriggerPrices(){return Number(this.trailingBasePrice)>0?[this.trailingStopInfo.buy,this.trailingStopInfo.sell].filter((e=>e>0)):[]},maxSizeCalulatedPrice(){return this.isStopOrderType||this.isTakeProfitOrderType?this.combinedTriggerPrice:this.isTrailingStopOrderType&&this.trailingTriggerPrices.length?Math.min(...this.trailingTriggerPrices):this.markPrice},minSizeCalulatedPrice(){return this.isStopOrderType||this.isTakeProfitOrderType?this.combinedTriggerPrice:this.isTrailingStopOrderType&&this.trailingTriggerPrices.length?Math.max(...this.trailingTriggerPrices):this.markPrice},activationPriceChecked(){return this.orderFormSettings.enableActivationPrice},activationPriceType(){return this.orderFormSettings.activationPriceTriggerOn},isActivationPriceEnabled(){return this.isTrailingStopOrderType&&this.activationPriceChecked&&this.formData.activationPrice},isActivationPriceEmpty(){return this.isTrailingStopOrderType&&this.activationPriceChecked&&""===this.formData.activationPrice},isMarketOrderDisabledByOffHours(){return this.isMarketOrderType&&this.isMarketOffHours}},watch:{hasOpenPosition:{handler(e){e||(this.formData.closePosition=!1)}},infoStp(){this.isMarketOrderType&&this.setTriggerPriceAsMarked(),this.isTrailingStopOrderType||(this.formData.closePosition=!1)},"formData.size":{handler(){const e=this.isStopOrderType?this.formData.triggerPrice:this.markPrice;this.changeCurrentOrderPrice(e),this.changeCurrentOrderQty(this.contractUnitSize)},deep:!0},futureOrderBookShortcutTime(){this.formData.size=this.futureOrderBookShortcut.size},$route(){this.setDefaultInputs(),this.setTriggerPriceAsMarked()},"orderFormSettings.triggerOn"(){this.setTriggerPriceAsMarked()},"formData.closePosition"(e){e&&(this.formData.size=String(this.openPosition.totalContracts))},"formData.reduceOnly"(){this.formData.percent=0,this.formData.size="",this.isPercentFlag=!1},"formData.percent":{handler(e){if(this.isPercentFlag){const{buy:t,sell:i}=this.getBuySellMaxSize(),r=Math.max(t,i);this.formData.size=r*(e/100)}}},symbol(){this.formData.percent=0,this.formData.size="",this.isPercentFlag=!1,this.formData.enableTpSl=!1,this.formData.tpPrice="",this.formData.slPrice=""},markPrice(){this.isMarketOrderType&&this.setTriggerPriceAsMarked()},supportReduceOnly(e){e||(this.formData.reduceOnly=!1)},currentDisplayLeverage(){const e=this.formData.percent;this.formData.percent=null,this.$nextTick((()=>{this.formData.percent=e}))}},created(){this.setDefaultInputs()},methods:{...v(["changeCurrentOrderPrice","changeCurrentOrderQty"]),...v("futures",["futuresOrder"]),handleActivationPriceCheckboxChange(e){Ge
1().updateOrderFormSettings({enableActivationPrice:e})},handleActivationPriceTypeChange(e){Ge().updateOrderFormSettings({activationPriceTriggerOn:e})},roundDown(e){if(!oi(e))return"";const[t,i]=e.toString().split(".");if(!i)return`${e}`;let r=this.priceFilter;return r>i.length&&(r=i.length),`${t}.${i.slice(0,r)}`},setDefaultInputs(){this.hasOpenPosition||(this.formData.closePosition=!1),this.formData.triggerPrice||this.setTriggerPriceAsMarked()},setTriggerPriceAsMarked(){this.combinedTriggerPrice=this.roundDown(this.triggerOnPrice)},buySubmit(){this.direction="BUY",this.formData.enableTpSl&&!this.isHedgeClose?this.tpSlSubmit(!0):this.submitForm()},sellSubmit(){this.direction="SELL",this.formData.enableTpSl&&!this.isHedgeClose?this.tpSlSubmit(!1):this.submitForm()},tpSlSubmit(e){if(this.$refs.tpSlOptions.validateTpSl(e))if(this.hasOpenPosition){const t=xm({positions:this.openPosition,orderMode:e?ot.BUY:ot.SELL,orderContractSize:this.contractUnitSize,isHedgeMode:this.isHedgeMode});t===wm?this.submitForm():(this.tpSlOrderWarningType=t,this.isShowTpSlOrderWarningDialog=!0)}else this.submitForm()},submitForm(){const e=this.getFormData(),t={side:this.direction,symbol:this.symbol,...e,positionMode:this.currentMarketPositionMode.positionMode,...this.activationPriceChecked&&{activationPrice:this.formData.activationPrice,activationPriceType:this.activationPriceType}};this.resetFormData();const i=this.roundedLastPrice||0,r=Number(this.marketDetail.contractSize)||0,a=Number(t.size)||0,n=Number(S(i).times(r).times(a));this.futuresOrder({orderData:t,orderValue:n})},getFormData(){const e={type:"MARKET",size:this.submitSize,reduceOnly:this.isReduceMode};if(this.isReduceOnlyDisabled&&(e.reduceOnly=!1),this.showTriggerPriceSelection&&(e.trigger=this.orderFormSettings.triggerOn),this.isTrailingStopOrderType){const t=Number(this.formData.trailValue);e.trailValue=this.formData.trailValueType===Xi.DISTANCE?t:S(t).div(100).toNumber(),e.trailValueType=this.formData.trailValueType,e.closePosition=this.formData.closePosition}else{this.isMarketOrderType||(e.triggerPrice=this.formData.triggerPrice),e.txType=this.OrderTypeList[this.infoStp];const{enableTpSl:t,tpPrice:i,tpPriceType:r,slPrice:a,slPriceType:n}=this.formData;e.takeProfitPrice=t&&i?Number(i):null,e.takeProfitTrigger=t&&i?r.payloadName:null,e.stopLossPrice=t&&a?Number(a):null,e.stopLossTrigger=t&&a?n.payloadName:null}return e},resetFormData(){this.rememberFuturesSizeTpsl||(this.formData.size="",this.formData.percent=0,this.isPercentFlag=!1,this.formData.enableTpSl=!1,this.formData.tpPrice="",this.formData.slPrice="",this.formData.tpPriceType=sm.MARK,this.formData.slPriceType=sm.MARK,this.formData.activationPrice=""),this.setDefaultInputs()},isModeReduceOnlyNotValid(e){const t=this.isLeaderMode?this.hasLeaderPosition:this.hasOpenPosition;if(!this.isOneWayMode||!this.formData.reduceOnly||!t)return!1;return(this.isLeaderMode?this.leaderPosition[0].orderModeName:this.openPosition[0].orderModeName)===e&&S(this.contractUnitSize).lte(this.maxReduceOnlySize)},handleQuick(){this.isPercentFlag=!0},getMarketOrderTypeContractUnitSize(e){return this.isUsdSizeType?qi(e):e},handleSizeFocus(){this.isPercentFlag&&(this.isPercentFlag=!1,this.formData.percent=0,this.formData.size="")},updateMarginRequired(e){this.marginRequired=e},updateMaxSize(e){this.maxSize=e},updateContractOrderSizeConvertFromUsdt(e){this.contractOrderSizeConvertFromUsdt=e},getBuySellMaxSize(){const{buy:e,sell:t}=this.isMarketUsdReducePercentMode?this.reduceMaxSize:this.maxSize;return{buy:e,sell:t}}}},XA={class:"futures-form-container"},JA={class:"form-input-container"},eR={class:"pre-line"},tR={key:0},iR={class:"darker"},rR={class:"lower darker"},aR={class:"setting-wrapper"},nR={key:2},oR={class:"info-and-actions"};const sR=$n(ZA,[["render",function(e,t,i,r,u,g){const f=a("OffHoursDescription"),v=a("Tooltip"),y=a("FuturesTriggerTypeSelect"),b=a("TradingInput"),S=a("TrailingStopDistancePercentageInput"),C=a("FuturesSizeInput"),P=a("TradeSlider"),k=a("i18n-t"),T=a("FuturesAvailableBalance"),M=a("ReduceOnlyCheckbox"),L=a("TpSlOrderFormOptions"),w=a("ActivationPriceCheckbox"),D=a("ActivationPriceInput"),O=a("MultipleModePositionLimitWarning"),I=a("FuturesFormActions"),x=a("FuturesOrderValueV2"),_=a("FuturesAdvancedOrderValue"),A=a("LeaderOrderValidationWarning"),R=a("FuturesOrderInfoV2"),F=a("FuturesMarginInfoList"),E=a("TpSlOrderWithPositioinWarningDialog");return o(),c("div",XA,[l("div",JA,[e.isMarketOffHours?(o(),n(f,{key:0,"order-type":i.infoStp},null,8,["order-type"])):h("",!0),g.isStopOrderType||g.isTakeProfitOrderType?(o(),n(b,{key:1,value:g.combinedTriggerPrice,"onUpdate:value":t[0]||(t[0]=e=>g.combinedTriggerPrice=e),label:"stopPrice",enableThousandSeparator:"",hide
1Spin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice},te({prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.triggerPrice")},{tooltip:s((()=>[l("p",eR,m(r.generateTriggerPriceTooltip({orderType:g.isTakeProfitOrderType?"takeProfit":"stop",priceType:g.isTriggerOnMarkPrice?r.TRIGGER_PRICE_TYPE.MARK_PRICE:r.TRIGGER_PRICE_TYPE.LAST_PRICE,$t:e.$t})),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(g.quoteCurrency)+")",1)])),append:s((()=>[e.isMobile?(o(),c("span",tR,m(g.quoteCurrency),1)):(o(),n(y,{key:1}))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(y)])),key:"0"}:void 0]),1032,["value","step","min","placeholder"])):h("",!0),g.isTrailingStopOrderType?(o(),n(S,{key:2,value:u.formData.trailValue,"onUpdate:value":t[1]||(t[1]=e=>u.formData.trailValue=e),type:u.formData.trailValueType,"onUpdate:type":t[2]||(t[2]=e=>u.formData.trailValueType=e),step:g.trailValueStep,min:g.trailValueMin,max:g.trailValueMax,placeholder:g.trailValuePlaceholder,currency:g.quoteCurrency,priceFilter:g.priceFilter},null,8,["value","type","step","min","max","placeholder","currency","priceFilter"])):h("",!0),d(C,{size:u.formData.size,"onUpdate:size":t[3]||(t[3]=e=>u.formData.size=e),hideSpin:"",max:Math.max(u.maxSize.buy,u.maxSize.sell),price:e.lastPrice,disableUsdTooltip:g.isMarketOrderType,percent:u.formData.percent+" %",isPercent:u.isPercentFlag,percentPlaceholder:g.isHedgeClose?e.$t("t.position"):null,maxSizeCalulatedPrice:Number(g.maxSizeCalulatedPrice),minSizeCalulatedPrice:Number(g.minSizeCalulatedPrice),usdMinDecimalPlaces:1,maxSizeCheckByCalulatedPrice:"",onFocus:g.handleSizeFocus},null,8,["size","max","price","disableUsdTooltip","percent","isPercent","percentPlaceholder","maxSizeCalulatedPrice","minSizeCalulatedPrice","onFocus"]),g.isMarketOrderType?(o(),n(P,{key:3,value:u.formData.percent,"onUpdate:value":t[4]||(t[4]=e=>u.formData.percent=e),onChange:g.handleQuick},null,8,["value","onChange"])):h("",!0),g.disableBuySubmit&&g.disableSellSubmit||!g.isStopOrderType&&!g.isTakeProfitOrderType?h("",!0):(o(),n(k,{key:4,keypath:"trading.hint.advanceMarket",class:"trade-explanation",tag:"div"},{priceType:s((()=>[l("span",null,m(g.isTriggerOnMarkPrice?e.$t("spot.order.market.markPrice"):e.$t("spot.order.market.lastPrice")),1)])),triggerPrice:s((()=>[l("span",null,m(e.$filters.formatNumber(g.combinedTriggerPrice,g.priceFilter))+" "+m(g.quoteCurrency),1)])),orderType:s((()=>[l("span",iR,m(e.$t("trading.marketOrder")),1)])),side:s((()=>[l("span",rR,m(g.disableBuySubmit||g.disableSellSubmit?g.disableBuySubmit?e.$t("t.sell"):e.$t("t.buy"):`${e.$t("t.buy")}/${e.$t("t.sell")}`),1)])),size:s((()=>[l("span",null,m(g.formSizeText)+" "+m(e.sizeType.lang),1)])),_:1})),d(T,{class:"avbl-balance-area",showTransfer:!g.isHedgeClose},null,8,["showTransfer"]),l("div",aR,[g.supportReduceOnly?(o(),n(M,{key:0,value:u.formData.reduceOnly,"onUpdate:value":t[5]||(t[5]=e=>u.formData.reduceOnly=e),class:"form-checkbox",disabled:g.isReduceOnlyDisabled},null,8,["value","disabled"])):h("",!0),g.isTrailingStopOrderType||g.isHedgeClose?h("",!0):(o(),n(L,{key:1,ref:"tpSlOptions",enableTpSl:u.formData.enableTpSl,"onUpdate:enableTpSl":t[6]||(t[6]=e=>u.formData.enableTpSl=e),tpPrice:u.formData.tpPrice,"onUpdate:tpPrice":t[7]||(t[7]=e=>u.formData.tpPrice=e),tpPriceType:u.formData.tpPriceType,"onUpdate:tpPriceType":t[8]||(t[8]=e=>u.formData.tpPriceType=e),slPrice:u.formData.slPrice,"onUpdate:slPrice":t[9]||(t[9]=e=>u.formData.slPrice=e),slPriceType:u.formData.slPriceType,"onUpdate:slPriceType":t[10]||(t[10]=e=>u.formData.slPriceType=e),class:"form-checkbox",symbol:g.symbol,price:g.priceForTpSlCalculate,cryptoSize:g.cryptoSize,buyQty:Number(g.marginBuySize),sellQty:Number(g.marginSellSize)},null,8,["enableTpSl","tpPrice","tpPriceType","slPrice","slPriceType","symbol","price","cryptoSize","buyQty","sellQty"])),g.isTrailingStopOrderType?(o(),c("div",nR,[d(w,{value:g.activationPriceChecked,orderType:"history.order.filter.type.trailingStopMarket",class:"form-checkbox","onUpdate:value":g.handleActivationPriceCheckboxChange},null,8,["value","onUpdate:value"]),d(D,{checked:g.activationPriceChecked,price:u.formData.activationPrice,step:Number(e.marketDetail.minPriceIncrement),quoteCurrency:g.quoteCurrency,priceType:g.activationPriceType,priceFilter:g.priceFilter,walletType:"futures","onUpdate:price":t[11]||(t[11]=e=>u.formData.activationPrice=Number(e)),"onUpdate:priceType":g.handleActivationPriceTypeChange},null,8,["checked","price","step","quoteCurrency","priceType","priceFilter","onUpdate:priceType"])])):h("",!0)])]),l("div",oR,[d(O),d(I,{buyDisabled:g.disableBuySubmit,sellDisabled:g.disableSellSubmit,buySubmit:g.buySubmit,sellSubmit:g.sellSubmit,isOpen:g.isHedgeOpen,isClose:g.isHedgeClose},null,8,["buyDisabled","sellDisabled","buySubmit","sellSubmit","isOpen","isClose"]),e.isUseShareLib?(o(),n(x,{key:0,orderFormType:e.orderFormType,priceConfig:g.shareLibPriceConfig,contractOrderSize:g.contractUnitSize,orderFormSize:u.formData.size,orderFormPrice:e.lastPrice,isReducePosition:u.formData.reduceOnly||g.isHedgeClose,isMarketUsdReducePercentMode:g.isMarketUsdReducePercentMode,isTrailingStopOrderType:g.isTrailingStopOrderType,trailingStopInfo:g.trailingStopInfo,onUpdateMarginRequired:g.updateMarginRequired,onUpdateContractOrderSizeConvertFromUsdt:g.updateContractOrderSizeConvertFromUsdt},null,8,["orderFormType","priceConfig","contractOrderSize","orderFormSize","orderFormPrice","isReducePosition","isMarketUsdReducePercentMode","isTrailingStopOrderType","trailingStopInfo","onUpdateMarginRequired","onUpdateContractOrderSizeConvertFromUsdt"])):(o(),n(_,{key:1,orderValueInfo:g.orderValueInfo,price:String(u.formData.triggerPrice),buySize:g.marginBuySize,sellSize:g.marginSellSize,isClose:g.isHedgeClose,isTrailingStopOrderType:g.isTrailingStopOrderType,trailingStopInfo:g.trailingStopInfo,hideLiqPrice:g.isTrailingStopOrderType,isMarketOrderType:g.isMarketOrderType,orderFormSize:u.formData.size,orderFormPrice:e.lastPrice,isMarketType:"",onUpdateMarginRequired:g.updateMarginRequired},null,8,["orderValueInfo","price","buySize","sellSize","isClose","isTrailingStopOrderType","trailingStopInfo","hideLiqPrice","isMarketOrderType","orderFormSize","orderFormPrice","onUpdateMarginRequired"])),g.shouldShowLeaderWarning?(o(),n(A,{key:2})):h("",!0),e.isUseShareLib?(o(),n(R,{key:3,orderFormType:e.orderFormType,priceConfig:g.shareLibPriceConfig,contractOrderSize:g.contractUnitSize,isClose:g.isHedgeClose,isReducePosition:u.formData.reduceOnly||g.isHedgeClose,isMarketUsdReducePercentMode:g.isMarketUsdReducePercentMode,isTrailingStopOrderType:g.isTrailingStopOrderType,trailingStopInfo:g.trailingStopInfo,onUpdateMaxSize:g.updateMaxSize},null,8,["orderFormType","priceConfig","contractOrderSize","isClose","isReducePosition","isMarketUsdReducePercentMode","isTrailingStopOrderType","trailingStopInfo","onUpdateMaxSize"])):(o(),n(F,{key:4,isMarketOrderType:g.isMarketOrderType,price:String(u.formData.triggerPrice),buySize:g.marginBuySize,sellSize:g.marginSellSize,isClose:g.isHedgeClose,hideExposure:g.isTrailingStopOrderType,isTrailingStopOrderType:g.isTrailingStopOrderType,trailingStopInfo:g.trailingStopInfo,onUpdateMaxSize:g.updateMaxSize},null,8,["isMarketOrderType","price","buySize","sellSize","isClose","hideExposure","isTrailingStopOrderType","trailingStopInfo","onUpdateMaxSize"])),d(E,{visible:u.isShowTpSlOrderWarningDialog,"onUpdate:visible":t[12]||(t[12]=e=>u.isShowTpSlOrderWarningDialog=e),type:u.tpSlOrderWarningType,onConfirm:g.submitForm},null,8,["visible","type","onConfirm"])])])}],["__scopeId","data-v-8402e27c"]]),lR={name:"IndexOrderForm",components:{FuturesFormInfo:lD,FuturesAvailableBalance:pD,FuturesAdvancedOrderValue:HD,FuturesFormActions:vD,FuturesMarginInfoList:BD,FuturesOrderValueV2:pO,FuturesOrderInfoV2:kO,TradingInput:Wn,FuturesSizeInput:wO,MultipleModePositionLimitWarning:cI,ReduceOnlyCheckbox:pI,LeaderOrderValidationWarning:yI},props:{hedgeModeType:{type:String,default:""}},setup(){const{shouldDisableOrder:e}=fI();return{shouldDisableOrder:e}},data:()=>({formData:{price:"",size:"",deviation:"0",stealth:"100",reduceOnly:!1},direction:null,deviationStealth:{step:.1,deviation:{value:0,min:-10,max:10,reg:/^[-]?\d*\.?\d?$/},stealth:{value:100,min:1,max:100,reg:/^\d+\.?\d?$/}},marginRequired:{buy:0,sell:0},maxSize:{buy:0,sell:0}}),computed:{...U(["isUnifiedWallet"]),...U("futures",["marketData","marketDetail","wallet","currentMarketPositionMode","hasOpenPosition","hasLeaderPosition","openPosition","leaderPosition","isOneWayMode","isHedgeMode","isMultipleMode","availableBalance","maxReduceOnlySize","isReachedMaxPositionSize","isUseShareLib"]),...b(["futureOrderBookShortcut"]),...b("futures",["futuresMarkPriceMap","futuresIndexPriceMap","fixedCurrency"]),...y(pt,["isLeaderMode"]),...b("orderBook",["lastPrice"]),...y(Ge,["orderFormType","rememberFuturesSizeTpsl"]),roundedLastPrice(){return S(this.lastPrice).dp(this.marketDetail.priceFilter??2,S.ROUND_DOWN).toNumber()},shareLibPriceConfig(){return{markPrice:this.markPrice,lastPrice:this.roundedLastPrice,limitPrice:this.formData.price,effectivePrice:this.effPrice}},quoteCurrency(){return this.fixedCurrency},priceFilter(){return this.marketData.priceFilter??""},isHedgeOpen(){return this.isHedgeMode&&this.hedgeModeType===ka.OPEN},isHedgeClose(){return this.isHedgeMode&&this.hedgeModeType===ka.CLOSE},totalAmount(){const e=Number(this.contractUnitSize)||0,t=Number(this.marketDetail.contractSize)||0;return Number(S(this.effPrice).times(e).times(t))},markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},indexPrice(){return this.futuresIndexPriceMap[this.symbol]||0},effPrice(){const e=Number(this.indexPrice)||0,t=Number(this.formData.deviation)||0;return Number(S(e).plus(S(e).times(t).div(100)))},syncOrderBookShortcutTime(){return this.futureOrderBookShortcut.time},maxPriceLength(){return(this.lastPrice?this.lastPrice.toFixed(Number(this.priceFilter)).length:0)+2},numberFormData(){const{price:e,deviation:t,stealth:i}=this.formData;return{price:Number(e),size:Number(this.contractUnitSize),deviation:Number(t),stealth:Number(i)}},disableBuySubmit(){const e=this.isHedgeClose?this.formData.size<=this.maxSize.buy:this.availableBalance>=this.marginRequired.buy;return!(this.basicAuthPassed&&this.availableBalance>0&&e)||this.isModeReduceOnlyNotValid(xt.BUY)||this.isReachedMaxPositionSize||this.isBuyDisableLeadTrading},disableSellSubmit(){const e=this.isHedgeClose?this.formData.size<=this.maxSize.sell:this.availableBalance>=this.marginRequired.sell;return!(this.basicAuthPassed&&this.availableBalance>0&&e)||this.isModeReduceOnlyNotValid(xt.SELL)||this.isReachedMaxPositionSize||this.isSellDisableLeadTrading},basicAuthPassed(){const{price:e,size:t,stealth:i}=this.numberFormData;return wa("price",e)&&wa("size",t)&&i},symbol(){return this.marketData.symbol||this.$route.params.id},contractUnitSize(){return Pa(this.formData.size,this.indexPrice)},displayOrderValueInfo(){const e=S(this.contractUnitSize||0).times(this.marketDetail.contractSize).toNumber(),t=S(e).times(this.effPrice).toNumber();return{buySize:e,sellSize:e,buyValue:t,sellValue:t}},isShowReduceOnly(){return!this.isHedgeMode&&!this.isMultipleMode},isReduceOnlyDisabled(){return!!this.isOneWayMode&&(0===this.maxReduceOnlySize||""!==this.formData.size&&S(this.contractUnitSize).gt(this.maxReduceOnlySize))},isBuyDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!0)},isSellDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!1)},shouldShowLeaderWarning(){return this.isBuyDisableLeadTrading||this.isSellDisableLeadTrading}},watch:{$route(){this.setDefaultInputs()},"formData.price":{handler(e){e.length>this.maxPriceLength&&(e=e.substring(0,this.maxPriceLength),this.formData.price=e);const t=Math.min(this.effPrice,e),i=Math.max(this.effPrice,e);this.changeCurrentOrderMaxMinPrice({buyPrice:t,sellPrice:i})},deep:!0},"formData.size":{handler(){this.changeCurrentOrderQty(this.contractUnitSize)},deep:!0},syncOrderBookShortcutTime(){const{type:e,price:t,size:i}=this.futureOrderBookShortcut;"price"===e?this.formData.price=t:"size"===e?this.formData.size=i:"total"===e&&(this.formData.price=t,this.formData.size=i)},isShowReduceOnly(e){e||(this.formData.reduceOnly=!1)}},created(){this.setDefaultInputs()},methods:{...v({changeCurrentOrderPrice:"changeCurrentOrderPrice",changeCurrentOrderQty:"changeCurrentOrderQty",changeCurrentOrderTriggerPrice:"changeCurrentOrderTriggerPrice",changeCurrentOrderMaxMinPrice:"changeCurrentOrderMaxMinPrice"}),...v("futures",["futuresOrder"]),setDefaultInputs(){this.formData.price=this.lastPrice?this.roundedLastPrice.toString():""},isPercentage(e,t){const i=t,r=this.deviationStealth[e].min,a=this.deviationStealth[e].max,n=this.deviationStealth[e].reg;i<r||i>a||!n.test(i)?this.formData[e]=this.deviationStealth[e].value:this.deviationStealth[e].value=i},onInputPrice(e){this.changeCurrentOrderPrice(String(e))},onInputSize(e){return e&&this.changeCurrentOrderQty(this.contractUnitSize),!1},selectInput(e){const{target:t}=e;e&&t.select()}
1,buySubmit(){this.direction="BUY",this.submitForm()},sellSubmit(){this.direction="SELL",this.submitForm()},async submitForm(){const e=this.getFormData(),t={side:this.direction,symbol:this.symbol,isPegOrder:!0,...e,positionMode:this.currentMarketPositionMode.positionMode};t.size=this.contractUnitSize,this.isReduceOnlyDisabled&&(t.reduceOnly=!1);const i=Number(this.effPrice),r=Number(this.marketDetail.contractSize)||0,a=Number(t.size)||0,n=Number(S(i).times(r).times(a));try{await this.futuresOrder({orderData:t,orderValue:n}),this.resetFormData()}catch(o){}},getFormData(){const{price:e,size:t,deviation:i,stealth:r,reduceOnly:a}=this.formData;return{price:e,size:t,deviation:i,stealth:r,reduceOnly:a||this.isHedgeClose}},resetFormData(){this.setDefaultInputs(),this.rememberFuturesSizeTpsl||(this.formData.size="")},isModeReduceOnlyNotValid(e){const t=this.isLeaderMode?this.hasLeaderPosition:this.hasOpenPosition;if(!this.isOneWayMode||!this.formData.reduceOnly||!t)return!1;return(this.isLeaderMode?this.leaderPosition[0].orderModeName:this.openPosition[0].orderModeName)===e&&S(this.contractUnitSize).lte(this.maxReduceOnlySize)},formatMarginNumber(e){return this.$filters.formatNumber(e,{roundMode:S.ROUND_UP})},updateMarginRequired(e){this.marginRequired=e},updateMaxSize(e){this.maxSize=e}}},uR={class:"futures-form-container"},cR={class:"form-input-container"},dR={class:"info-and-actions"},pR={key:3,class:"flex-box mb-8"};const hR=$n(lR,[["render",function(e,t,i,r,u,g){const f=a("FuturesFormInfo"),v=a("Tooltip"),y=a("TradingInput"),b=a("FuturesSizeInput"),S=a("FuturesOrderValueV2"),C=a("FuturesAdvancedOrderValue"),P=a("FuturesAvailableBalance"),k=a("MultipleModePositionLimitWarning"),T=a("FuturesFormActions"),M=a("LeaderOrderValidationWarning"),L=a("ReduceOnlyCheckbox"),w=a("FuturesOrderInfoV2"),D=a("FuturesMarginInfoList");return o(),c("div",uR,[l("div",cR,[d(f,{title:"futuresMain.trade.indexPrice",titleTooltip:"futuresMain.trade.indexPrice.tip",content:e.$filters.formatNumber(g.indexPrice,g.priceFilter),remark:g.quoteCurrency},null,8,["content","remark"]),d(f,{title:"futuresMain.trade.effectivePrice",titleTooltip:"futuresMain.trade.effectivePrice.tip",content:e.$filters.formatNumber(g.effPrice,g.priceFilter),remark:g.quoteCurrency},null,8,["content","remark"]),d(y,{value:u.formData.price,"onUpdate:value":t[0]||(t[0]=e=>u.formData.price=e),label:"price",enableThousandSeparator:"",hideSpin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice||0,maxlength:g.maxPriceLength,onInput:g.onInputPrice},te({prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.maxMinPrice")},{tooltip:s((()=>[l("p",null,m(e.$t("futuresMain.trade.maxMinPrice.tip")),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(g.quoteCurrency)+")",1)])),_:2},[e.isMobile?{name:"append",fn:s((()=>[l("span",null,m(g.quoteCurrency),1)])),key:"0"}:void 0]),1032,["value","step","min","placeholder","maxlength","onInput"]),d(b,{size:u.formData.size,"onUpdate:size":t[1]||(t[1]=e=>u.formData.size=e),hideSpin:"",max:Math.max(u.maxSize.buy,u.maxSize.sell),price:g.indexPrice,maxSizeCalulatedPrice:Number(g.indexPrice),onInput:g.onInputSize},null,8,["size","max","price","maxSizeCalulatedPrice","onInput"]),d(y,{value:u.formData.deviation,"onUpdate:value":t[2]||(t[2]=e=>u.formData.deviation=e),label:"percentage",type:"number",hideSpin:"",step:Number(u.deviationStealth.step),min:Number(u.deviationStealth.deviation.min),max:Number(u.deviationStealth.deviation.max),placeholder:0,maxlength:10,onInput:t[3]||(t[3]=e=>g.isPercentage("deviation",e))},{prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.percentage")},{tooltip:s((()=>[l("p",null,m(e.$t("futuresMain.trade.percentage.tip")),1)])),_:1},8,["content"])])),append:s((()=>t[7]||(t[7]=[p("%")]))),_:1},8,["value","step","min","max"]),d(y,{value:u.formData.stealth,"onUpdate:value":t[4]||(t[4]=e=>u.formData.stealth=e),label:"stealth",type:"number",hideSpin:"",step:Number(u.deviationStealth.step),min:Number(u.deviationStealth.stealth.min),max:Number(u.deviationStealth.stealth.max),placeholder:"1~100",onInput:t[5]||(t[5]=e=>g.isPercentage("stealth",e))},{prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.stealthMode")},{tooltip:s((()=>[l("p",null,m(e.$t("futuresMain.trade.stealthMode.tip")),1)])),_:1},8,["content"])])),append:s((()=>t[8]||(t[8]=[p("%")]))),_:1},8,["value","step","min","max"])]),l("div",dR,[e.isUseShareLib?(o(),n(S,{key:0,orderFormType:e.orderFormType,priceConfig:g.shareLibPriceConfig,contractOrderSize:g.contractUnitSize,orderFormSize:u.formData.size,orderFormPrice:u.formData.price,isReducePosition:u.formData.reduceOnly||g.isHedgeClose,onUpdateMarginRequired:g.updateMarginRequired},null,8,["orderFormType","priceConfig","contractOrderSize","orderFormSize","orderFormPrice","isReducePosition","onUpdateMarginRequired"])):(o(),n(C,{key:1,orderValueInfo:g.displayOrderValueInfo,price:String(g.effPrice),buySize:g.contractUnitSize,sellSize:g.contractUnitSize,isClose:g.isHedgeClose,orderFormSize:u.formData.size,orderFormPrice:u.formData.price,hideLiqPrice:"",onUpdateMarginRequired:g.updateMarginRequired},null,8,["orderValueInfo","price","buySize","sellSize","isClose","orderFormSize","orderFormPrice","onUpdateMarginRequired"])),d(P,{showTransfer:!g.isHedgeClose},null,8,["showTransfer"]),d(k),d(T,{buyDisabled:g.disableBuySubmit,sellDisabled:g.disableSellSubmit,buySubmit:g.buySubmit,sellSubmit:g.sellSubmit,isOpen:g.isHedgeOpen,isClose:g.isHedgeClose},null,8,["buyDisabled","sellDisabled","buySubmit","sellSubmit","isOpen","isClose"]),g.shouldShowLeaderWarning?(o(),n(M,{key:2})):h("",!0),e.isMobile?h("",!0):(o(),c("div",pR,[g.isShowReduceOnly?(o(),n(L,{key:0,value:u.formData.reduceOnly,"onUpdate:value":t[6]||(t[6]=e=>u.formData.reduceOnly=e),class:"form-checkbox",disabled:g.isReduceOnlyDisabled},null,8,["value","disabled"])):h("",!0)])),e.isUseShareLib?(o(),n(w,{key:4,orderFormType:e.orderFormType,priceConfig:g.shareLibPriceConfig,contractOrderSize:g.contractUnitSize,isClose:g.isHedgeClose,isReducePosition:u.formData.reduceOnly||g.isHedgeClose,onUpdateMaxSize:g.updateMaxSize},null,8,["orderFormType","priceConfig","contractOrderSize","isClose","isReducePosition","onUpdateMaxSize"])):(o(),n(D,{key:5,price:String(g.effPrice),buySize:g.contractUnitSize,sellSize:g.contractUnitSize,isClose:g.isHedgeClose,hideExposure:"",onUpdateMaxSize:g.updateMaxSize},null,8,["price","buySize","sellSize","isClose","onUpdateMaxSize"]))])])}],["__scopeId","data-v-c32a5b5c"]]),mR={name:"OcoOrderForm",components:{FuturesFormActions:vD,FuturesAvailableBalance:pD,FuturesAdvancedOrderValue:HD,FuturesMarginInfoList:BD,FuturesOrderValueV2:pO,FuturesOrderInfoV2:kO,TradingInput:Wn,FuturesSizeInput:wO,FuturesTriggerTypeSelect:yD,MultipleModePositionLimitWarning:cI,ReduceOnlyCheckbox:pI,LeaderOrderValidationWarning:yI,OffHoursDescription:YA},props:{hedgeModeType:{type:String,default:""}},setup(){const{shouldDisableOrder:e}=fI(),{checkPriceProtection:t}=xI();return{shouldDisableOrder:e,checkPriceProtection:t}},data:()=>({formData:{price:"",stop:"",limit:"",size:"",trigger:xr.default,reduceOnly:!1},i18nFormat:{br:"\n"},marginRequired:{buy:0,sell:0},maxSize:{buy:0,sell:0}}),computed:{...U(["isUnifiedWallet"]),...U("futures",["marketData","marketDetail","wallet","currentMarketPositionMode","isHedgeMode","isMultipleMode","availableBalance","isReachedMaxPositionSize","isUseShareLib","isMarketOffHours"]),...b("futures",["futuresMarkPriceMap","fixedCurrency"]),...b(["loginState"]),...b("orderBook",["lastPrice"]),...y(Ge,["sizeType","isUsdSizeType","orderFormType","rememberFuturesSizeTpsl"]),roundedLastPrice(){return S(this.lastPrice).dp(this.priceFilter,S.ROUND_DOWN).toNumber()},shareLibPriceConfig(){return{markPrice:this.markPrice,lastPrice:this.roundedLastPrice,limitPrice:this.formData.price,triggerPrice:this.formData.limit}},priceFilter(){return this.marketData.priceFilter??2},marketName(){return this.$route.params.id},markPrice(){return this.futuresMarkPriceMap[this.marketData.symbol]||0},useMarkPrice(){return this.formData.trigger===xr.MARK_PRICE},targetTriggerPrice(){return this.useMarkPrice?this.markPrice:this.roundedLastPrice},isHedgeOpen(){return this.isHedgeMode&&this.hedgeModeType===ka.OPEN},isHedgeClose(){return this.isHedgeMode&&this.hedgeModeType===ka.CLOSE},quoteCurrency(){return this.fixedCurrency},totalAmount(){const e=Number(this.formData.price)||0,t=Number(this.contractUnitSize)||0,i=Number(this.marketDetail.contractSize)||0;return Number(S(e).times(t).times(i))},basicAuthPassed(){const{price:e,stop:t,limit:i}=this.formData;return wa("price",e)&&wa("price",t)&&wa("price",i)&&wa("size",this.contractUnitSize)},inputAlert(){const{price:e,stop:t}=this.formData;return!!this.basicAuthPassed&&(e<=this.targetTriggerPrice&&t<=this.targetTriggerPrice||e>=this.targetTriggerPrice&&t>=this.targetTriggerPrice)},disableBuySubmit(){if(this.isBasicSubmitDisabled)return!0;return!(this.isHedgeClose?this.formData.size<=this.maxSize.buy:(this.availableBalance||0)>=this.marginRequired.buy)||(!this.validBuySubmit||this.isReachedMaxPositionSize||this.isBuyDisableLeadTrading)},disableSellSubmit(){if(this.isBasicSubmitDisabled)return!0;return!(this.isHedgeClose?this.formData.size<=this.maxSize.sell:this.availableBalance>=this.marginRequired.sell)||(!this.validSellSubmit||this.isReachedMaxPositionSize||this.isSellDisableLeadTrading)},validBuySubmit(){const{price:e,stop:t}=this.formData;return e<this.targetTriggerPrice&&t>this.targetTriggerPrice},validSellSubmit(){const{price:e,stop:t}=this.formData;return e>this.targetTriggerPrice&&t<this.targetTriggerPrice},symbol(){return this.marketData.symbol||this.$route.params.id},priceToCalculate(){return this.validBuySubmit?this.formData.limit:this.validSellSubmit?this.formData.price:""},maxSizeCalulatedPrice(){return Math.max(this.formData.price,this.formData.limit)},contractUnitSize(){return Pa(this.formData.size,this.priceToCalculate)},formSizeText(){return this.isUsdSizeType?this.$filters.formatNumber(this.formData.size,this.priceFilter):this.formData.size},displayOrderValueInfo(){const e=S(this.contractUnitSize||0).times(this.marketDetail.contractSize).toNumber();return{buySize:e,sellSize:e,buyValue:S(e).times(this.formData.limit).toNumber(),sellValue:S(e).times(this.formData.price).toNumber()}},isShowReduceOnly(){return!this.isHedgeMode&&!this.isMultipleMode},isBuyDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!0)},isSellDisableLeadTrading(){return this.shouldDisableOrder(this.contractUnitSize,!1)},shouldShowLeaderWarning(){return this.isBuyDisableLeadTrading||this.isSellDisableLeadTrading},isBasicSubmitDisabled(){return!this.loginState||!this.basicAuthPassed||this.isMarketOffHours}},watch:{$route(){this.setDefaultInputs()},"formData.trigger"(){this.setDefaultInputs()},isShowReduceOnly(e){e||(this.formData.reduceOnly=!1)}},created(){this.setDefaultInputs()},methods:{convertToContract:Pa,...u("futures",["setContractType"]),...v({changeCurrentOrderPrice:"changeCurrentOrderPrice",changeCurrentOrderQty:"changeCurrentOrderQty",messageError:"messageError"}),...v("futures",["futuresOrder"]),setDefaultInputs(){let e=this.roundDown(this.targetTriggerPrice?this.targetTriggerPrice.toString():"");const t=this.marketDetail.minPriceIncrement;if(""!==e){const i=S(e).mod(t);i.eq(0)||(e=Number(S(e).minus(i)))}this.formData.price=e,this.formData.stop=e,this.formData.limit=e},composedFormData:({price:e,amount:t,...i})=>({price:e,amount:t,...{type:"OCO",postOnly:!1,time_in_force:"GTC"},...i}),getFormData(){const{price:e,stop:t,limit:i,size:r,trigger:a,reduceOnly:n}=this.formData;return this.composedFormData({price:e,triggerPrice:t,stopPrice:i,size:r,trigger:a,reduceOnly:n||this.isHedgeClose})},buySubmit(){this.submit("BUY")},sellSubmit(){this.submit("SELL")},checkMinPriceIncrement(e){const{price:t,stopPrice:i,triggerPrice:r}=e,a=this.marketDetail.minPriceIncrement;return S(t).mod(a).eq(0)&&S(i).mod(a).eq(0)&&S(r).mod(a).eq(0)},async submit(e){const t=this.getFormData();if(t.size=this.contractUnitSize,!this.checkMinPriceIncrement(t))return void this.messageError(this.$t("futuresMain.notification.trade.error.invali
1d_minPriceIncrement",{0:this.marketDetail.minPriceIncrement}));const i={side:e,symbol:this.symbol,...t,positionMode:this.currentMarketPositionMode.positionMode},r=await this.checkPriceProtection({isSpot:!1,isBuyAction:"BUY"===e,symbol:this.symbol,orderPrice:i.price,triggerPrice:i.triggerPrice,limitPrice:i.stopPrice,priceFilter:this.priceFilter,quoteCurrency:this.quoteCurrency,tradingType:i.type});if(!r.ok)return;i.price=r.protectionPrice||i.price,i.stopPrice=r.triggerProtectionPrice||i.stopPrice;const a=Number(i.price)||0,n=Number(this.marketDetail.contractSize)||0,o=Number(i.size)||0,s=Number(S(a).times(n).times(o));try{await this.futuresOrder({orderData:i,orderValue:s}),this.resetFormData()}catch(l){}},resetFormData(){this.rememberFuturesSizeTpsl||(this.formData.size="")},roundDown(e){if(!oi(e))return"";const[t,i]=e.toString().split(".");if(!i)return e;let r=this.priceFilter;return r>i.length&&(r=i.length),`${t}.${i.slice(0,r)}`},updateMarginRequired(e){this.marginRequired=e},updateMaxSize(e){this.maxSize=e}}},gR={class:"futures-form-container"},fR={class:"form-input-container"},vR={class:"pre-line"},yR={class:"dotted-border"},bR={class:"pre-line"},SR={key:0},CR={class:"pre-line"},PR={class:"lower darker"},kR={class:"setting-wrapper"},TR={class:"info-and-actions"};const MR=$n(mR,[["render",function(e,t,i,r,u,g){const f=a("OffHoursDescription"),v=a("Tooltip"),y=a("TradingInput"),b=a("FuturesTriggerTypeSelect"),S=a("FuturesSizeInput"),C=a("i18n-t"),P=a("FuturesAvailableBalance"),k=a("ReduceOnlyCheckbox"),T=a("MultipleModePositionLimitWarning"),M=a("FuturesFormActions"),L=a("FuturesOrderValueV2"),w=a("FuturesAdvancedOrderValue"),D=a("LeaderOrderValidationWarning"),O=a("FuturesOrderInfoV2"),I=a("FuturesMarginInfoList");return o(),c("div",gR,[l("div",fR,[e.isMarketOffHours?(o(),n(f,{key:0,"order-type":"OCO"})):h("",!0),d(y,{value:u.formData.price,"onUpdate:value":t[0]||(t[0]=e=>u.formData.price=e),label:"price",enableThousandSeparator:"",hideSpin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice,errorShown:g.inputAlert},te({prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.ocoPrice")},{tooltip:s((()=>[l("p",vR,m(e.$t("trading.order.tooltip.ocoPrice",{priceType:g.useMarkPrice?e.$t("trading.mark"):e.$t("trading.last"),br:"\n"})),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(g.quoteCurrency)+")",1)])),_:2},[e.isMobile?{name:"append",fn:s((()=>[l("span",null,m(g.quoteCurrency),1)])),key:"0"}:void 0]),1032,["value","step","min","placeholder","errorShown"]),l("div",yR,[d(y,{value:u.formData.stop,"onUpdate:value":t[3]||(t[3]=e=>u.formData.stop=e),label:"stop",enableThousandSeparator:"",hideSpin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice,errorShown:g.inputAlert},te({prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.triggerPrice")},{tooltip:s((()=>[l("p",bR,m(e.$t("trading.order.tooltip.ocoTriggerPrice",{priceType:g.useMarkPrice?e.$t("trading.mark"):e.$t("trading.last"),br:"\n"})),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(g.quoteCurrency)+")",1)])),append:s((()=>[e.isMobile?(o(),c("span",SR,m(g.quoteCurrency),1)):(o(),n(b,{key:1,value:u.formData.trigger,"onUpdate:value":t[2]||(t[2]=e=>u.formData.trigger=e)},null,8,["value"]))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(b,{value:u.formData.trigger,"onUpdate:value":t[1]||(t[1]=e=>u.formData.trigger=e)},null,8,["value"])])),key:"0"}:void 0]),1032,["value","step","min","placeholder","errorShown"]),d(y,{value:u.formData.limit,"onUpdate:value":t[4]||(t[4]=e=>u.formData.limit=e),label:"limit",enableThousandSeparator:"",hideSpin:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minValidPrice),placeholder:e.marketDetail.minValidPrice,errorShown:g.inputAlert},te({prepend:s((()=>[d(v,{content:e.$t("futuresMain.trade.ocoLimit")},{tooltip:s((()=>[l("p",CR,m(e.$t("futuresMain.trade.ocoLimit.tip")),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(g.quoteCurrency)+")",1)])),_:2},[e.isMobile?{name:"append",fn:s((()=>[l("span",null,m(g.quoteCurrency),1)])),key:"0"}:void 0]),1032,["value","step","min","placeholder","errorShown"])]),d(S,{size:u.formData.size,"onUpdate:size":t[5]||(t[5]=e=>u.formData.size=e),hideSpin:"",max:Math.max(u.maxSize.buy,u.maxSize.sell),price:g.priceToCalculate,maxSizeCalulatedPrice:g.maxSizeCalulatedPrice},null,8,["size","max","price","maxSizeCalulatedPrice"]),g.disableBuySubmit&&g.disableSellSubmit?h("",!0):(o(),n(C,{key:1,keypath:"trading.order.description.oco",class:"trade-explanation",tag:"div"},{side:s((()=>[l("span",PR,m(g.disableBuySubmit||g.disableSellSubmit?g.disableBuySubmit?e.$t("t.sell"):e.$t("t.buy"):`${e.$t("t.buy")}/${e.$t("t.sell")}`),1)])),size:s((()=>[l("span",null,m(g.formSizeText),1)])),base:s((()=>[l("span",null,m(e.sizeType.lang),1)])),price:s((()=>[l("span",null,m(e.$filters.formatNumber(u.formData.price,g.priceFilter)),1)])),quote:s((()=>[l("span",null,m(g.quoteCurrency),1)])),priceType:s((()=>[l("span",null,m(g.useMarkPrice?e.$t("trading.mark"):e.$t("trading.last")),1)])),triggerPrice:s((()=>[l("span",null,m(e.$filters.formatNumber(u.formData.stop,g.priceFilter)),1)])),limit:s((()=>[l("span",null,m(e.$filters.formatNumber(u.formData.limit,g.priceFilter)),1)])),_:1})),d(P,{class:"avbl-balance-area",showTransfer:!g.isHedgeClose},null,8,["showTransfer"]),l("div",kR,[g.isShowReduceOnly?(o(),n(k,{key:0,value:u.formData.reduceOnly,"onUpdate:value":t[6]||(t[6]=e=>u.formData.reduceOnly=e),class:"form-checkbox"},null,8,["value"])):h("",!0)])]),l("div",TR,[d(T),d(M,{buyDisabled:g.disableBuySubmit,sellDisabled:g.disableSellSubmit,buySubmit:g.buySubmit,sellSubmit:g.sellSubmit,isOpen:g.isHedgeOpen,isClose:g.isHedgeClose},null,8,["buyDisabled","sellDisabled","buySubmit","sellSubmit","isOpen","isClose"]),e.isUseShareLib?(o(),n(L,{key:0,orderFormType:e.orderFormType,priceConfig:g.shareLibPriceConfig,contractOrderSize:g.contractUnitSize,orderFormSize:u.formData.size,orderFormPrice:u.formData.price,isReducePosition:u.formData.reduceOnly||g.isHedgeClose,onUpdateMarginRequired:g.updateMarginRequired},null,8,["orderFormType","priceConfig","contractOrderSize","orderFormSize","orderFormPrice","isReducePosition","onUpdateMarginRequired"])):(o(),n(w,{key:1,orderValueInfo:g.displayOrderValueInfo,price:Number(u.formData.price).toString(),buySize:g.convertToContract(u.formData.size,u.formData.limit),sellSize:g.convertToContract(u.formData.size,u.formData.price),isClose:g.isHedgeClose,orderFormSize:u.formData.size,orderFormPrice:u.formData.price,onUpdateMarginRequired:g.updateMarginRequired},null,8,["orderValueInfo","price","buySize","sellSize","isClose","orderFormSize","orderFormPrice","onUpdateMarginRequired"])),g.shouldShowLeaderWarning?(o(),n(D,{key:2})):h("",!0),e.isUseShareLib?(o(),n(O,{key:3,orderFormType:e.orderFormType,priceConfig:g.shareLibPriceConfig,contractOrderSize:g.contractUnitSize,isClose:g.isHedgeClose,isReducePosition:u.formData.reduceOnly||g.isHedgeClose,onUpdateMaxSize:g.updateMaxSize},null,8,["orderFormType","priceConfig","contractOrderSize","isClose","isReducePosition","onUpdateMaxSize"])):(o(),n(I,{key:4,price:Number(u.formData.price).toString(),buySize:g.convertToContract(u.formData.size,u.formData.limit),sellSize:g.convertToContract(u.formData.size,u.formData.price),isClose:g.isHedgeClose,onUpdateMaxSize:g.updateMaxSize},null,8,["price","buySize","sellSize","isClose","onUpdateMaxSize"]))])])}],["__scopeId","data-v-550ac467"]]);function LR(e){return`ISOLATED@${e}${tr}`}const wR={name:"InsufficientBalance",props:{config:{type:Object,required:!0},setTransferConfig:{type:Function,default:()=>{}}},data:()=>
1({dialog:{visible:!1,closed:!1},noticeIcon:"/static/img/D8om77h1.png",initFlag:!0,iCurrent:0,BigNumber:S}),computed:{...b({futuresCurrentWalletName:e=>e.futures.currentWalletName,futuresWalletList:e=>e.futures.walletList,futuresWalletMap:e=>e.futures.walletMap}),...b("futures",["fixedCurrency"]),...U(["getAccountValue","futuresBalance","isUnifiedWallet"]),...U("futures",{futuresMarketSymbol:"symbol",futuresWallet:"wallet",futuresMarginMode:"marginMode"}),quoteCurrency(){return this.fixedCurrency},requiredmentMemo(){return JSON.parse(this.config.requiredmentMemo)},marginRequirement(){const e=this.requiredmentMemo;let t="0";return t=e.params[e.params.length>1?1:0],t},nextStepWallet(){const e=this.requiredmentMemo.msgKey,t="trade.error.insufficient_balance2"===e;return"trade.error.insufficient_balance3"===e?this.futuresWalletMap[LR(this.futuresMarketSymbol)]:t||this.futuresWallet.isCrossWallet?this.futuresWalletMap[xi]:this.futuresWalletMap[LR(this.futuresMarketSymbol)]},getInsufficientWalletName(){if(this.isUnifiedWallet&&this.futuresMarginMode===ri.ISOLATED)return this.$t("futuresMain.unifiedWallet.walletName");const e=this.isUnifiedWallet?ti:this.nextStepWallet.activeWalletName;return this.$filters.walletName(e)},insufficientWalletAvailableBalance(){return this.isUnifiedWallet?this.futuresBalance("available"):this.nextStepWallet.availableBalance},getOriginWalletName(){const e=(this.futuresWallet.isCrossWallet?this.futuresWalletMap[xi]:this.futuresWalletMap[LR(this.futuresMarketSymbol)])||{};return this.$filters.walletName(e.activeWalletName)},isSameWallet(){return this.getInsufficientWalletName===this.getOriginWalletName},otherWallets(){const e=this.futuresWalletList.filter((e=>e!==this.futuresCurrentWalletName)).map((e=>({activeWalletName:e,availableBalance:this.futuresWalletMap[e].availableBalance})));return[{activeWalletName:"Spot Wallet",availableBalance:this.getAccountValue("available")},...e].filter((({availableBalance:e})=>e>=.01))}},mounted(){this.onCommand(this.otherWallets[0],0)},methods:{onCommand(e,t){this.iCurrent=t,this.setTransferConfig(e.activeWalletName,this.nextStepWallet.activeWalletName)}}},DR={class:"notice-title"},OR=["src"],IR={key:0},xR={key:1},_R={class:"notice-current-info"},AR={class:"notice-retange _l"},RR={class:"requirement-title"},FR={class:"requirement-value"},ER={class:"notice-retange _r"},BR={class:"requirement-title"},zR={class:"requirement-value"},$R={key:0,class:"wallet-dropdown"},NR=["onClick"],UR={class:"p2"},HR={class:"p3"};const VR=$n(wR,[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["insufficient-balance-body",e.$mq])},[l("div",DR,[l("img",{class:"notice-image",src:a.noticeIcon},null,8,OR),l("h2",null,m(e.$t("futuresMain.insufficientBalance.title")),1)]),l("div",{class:C(["notice-content",e.$mq])},[n.isSameWallet?(o(),c("p",IR,m(e.$t("futuresMain.insufficientBalance.description")),1)):(o(),c("p",xR,m(e.$t("futuresMain.insufficientBalance.description_3",{originWallet:n.getOriginWalletName,targetWallet:n.getInsufficientWalletName})),1)),l("div",_R,[l("div",AR,[l("span",RR,m(e.$t("futuresMain.insufficientBalance.margin")),1),l("span",FR,m(e.$filters.formatNumber(n.marginRequirement,{roundMode:a.BigNumber.ROUND_UP}))+" "+m(n.quoteCurrency),1)]),l("div",ER,[l("span",BR,m(e.$t("futuresMain.insufficientBalance.balance",{wallet:n.getInsufficientWalletName})),1),l("span",zR,m(e.$filters.formatNumber(n.insufficientWalletAvailableBalance,{roundMode:a.BigNumber.ROUND_UP}))+" "+m(n.quoteCurrency),1)])]),e.isUnifiedWallet?h("",!0):(o(),c(g,{key:2},[l("p",null,m(e.$t("futuresMain.insufficientBalance.transferAvailable")),1),n.otherWallets.length>0?(o(),c("ul",$R,[(o(!0),c(g,null,R(n.otherWallets,((i,r)=>(o(),c("li",{key:r,class:C({_cur:r===a.iCurrent}),onClick:e=>n.onCommand(i,r)},[t[0]||(t[0]=l("p",{class:"p1"},null,-1)),l("p",UR,m(e.$filters.walletName(i.activeWalletName)),1),l("p",HR,m(e.$filters.formatNumber(i.availableBalance,{postfix:` ${n.quoteCurrency}`})),1)],10,NR)))),128))])):h("",!0)],64))],2)],2)}],["__scopeId","data-v-3e59f0ca"]]),WR={name:"DepositRequired",setup:()=>({takerFee:ci().takerFee}),data:()=>
1({dialog:{visible:!1,closed:!1}}),computed:{...b({spotWsData:"spotWsData",currentOrder:"currentOrder"}),...b("futures",["fixedCurrency"]),...U(["getAccountValue"]),...U("futures",{futuresMarketData:"marketData",futuresMarketDetail:"marketDetail",futuresWallet:"wallet",initialMarginPercentage:"initialMarginPercentage"}),quoteCurrency(){return this.futuresMarketData.quoteCurrency||""},crossLeverage(){return Number(S(100).div(S(this.initialMarginPercentage()||1).times(100))).toFixed(2)},marginRequirement(){const e=this.currentOrder.nextLeverage||this.futuresWallet&&this.futuresWallet.leverage,t=0===e?this.crossLeverage:e,i=this.currentOrder.price*this.currentOrder.quantity*this.futuresMarketDetail.contractSize*(1+2*this.takerFee)/t;return this.futuresWallet.unrealisedProfitLoss>=0?i:i-this.futuresWallet.unrealisedProfitLoss}}},qR={class:"notice-title"},GR={class:"title"},KR={class:"notice-content"},QR={class:"notice-current-info"},jR={class:"notice-retange _l"},YR={class:"requirement-title"},ZR={class:"requirement-value"},XR={class:"notice-retange _r"},JR={class:"requirement-title"},eF={class:"requirement-value value-warning"};const tF=$n(WR,[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["deposit-required",e.$mq])},[l("div",qR,[t[0]||(t[0]=l("i",{class:"iconfont"},"î",-1)),l("h2",GR,m(e.$t("futuresMain.depositRequired.title")),1)]),l("div",KR,[l("p",null,[p(m(e.$t("futuresMain.depositRequired.description0"))+" ",1),l("strong",null,m(e.$t("futuresMain.depositRequired.description1")),1),p(" "+m(e.$t("futuresMain.depositRequired.description2")),1)]),l("div",QR,[l("div",jR,[l("span",YR,m(e.$t("futuresMain.depositRequired.margin")),1),l("span",ZR,m(e.$filters.formatNumber(n.marginRequirement,{postfix:` ${e.fixedCurrency}`})),1)]),l("div",XR,[l("span",JR,m(e.$t("futuresMain.depositRequired.spotWallet")),1),l("span",eF,m(e.$filters.formatNumber(e.getAccountValue("available")))+" "+m(n.quoteCurrency),1)])])])],2)}],["__scopeId","data-v-36da63b4"]]),iF={name:"TradingTypeTabItem",props:{text:{type:String,default:""},value:{type:[String,Number],default:""},active:{type:Boolean,default:!1}},emits:["click"]};const rF=e=>({[ni.LIMIT_STOP]:e("trading.orderForm.orderTypes.stopLimit"),[ni.MARKET_STOP]:e("trading.orderForm.orderTypes.stopMarket"),[ni.LIMIT_TAKE_PROFIT]:e("history.order.filter.type.takeProfitLimit"),[ni.MARKET_TAKE_PROFIT]:e("history.order.filter.type.takeProfitMarket"),[ni.MARKET_TRAILING_STOP]:e("history.order.filter.type.trailingStopMarket"),[ni.TWAP]:e("trading.buySell.title.twap"),[ni.OCO]:e("trading.buySell.title.oco"),[ni.INDEX]:e("trading.buySell.title.index"),[ni.LIMIT]:e("t.orderType_l"),[ni.MARKET]:e("t.orderType_m"),[ni.ADVANCED]:e("t.advanced")}),aF={name:"TradingTypeTab",components:{TradingTypeTabItem:$n(iF,[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["tab-item",{active:i.active}]),onClick:t[0]||(t[0]=t=>e.$emit("click",i.value))},m(i.text),3)}],["__scopeId","data-v-6a66eb07"]])},props:{active:{type:String,default:""},isFutures:{type:Boolean,default:!1}},emits:["onSelect"],computed:{spotTabList(){return[{value:0,lang:"t.orderType_l",position:"left",list:[{value:"LIMIT",lang:"trading.stop-take-profit.limit",tip:"trading.buySell.title.limit.tip"},{value:"STOP",lang:"trading.stop-take-profit.stop"},{value:"TRIGGER",lang:"trading.stop-take-profit.takeProfit"}]},{value:1,lang:"t.orderType_m",position:"center",list:[{value:"market",lang:"trading.stop-take-profit.market",tip:"trading.buySell.title.market.tip"},{value:"stop",lang:"trading.stop-take-profit.stop"},{value:"trailingStop",lang:"trading.stop-take-profit.trailingStop"},{value:"takeProfit",lang:"trading.stop-take-profit.takeProfit"}]},{value:-1,lang:"t.advanced",position:"right",newTag:!this.hasClickedNewTag,tabOrderKey:He.SPOT_TAB_ORDER,list:[{value:4,lang:"trading.buySell.title.twap",tip:"trading.buySell.title.twap.tip"},{value:3,lang:"trading.buySell.title.oco",tip:"trading.buySell.title.oco.tip"},{value:2,lang:"trading.buySell.title.index",tip:"trading.buySell.title.index.tip2"}]}]},futuresTabList(){return[{value:0,lang:"t.orderType_l",position:"left",list:[{value:"limit",lang:"futuresMain.trade.limit",tip:"futuresMain.trade.limit.tip"},{value:"stop",lang:"trading.stop-take-profit.stop"},{value:"takeProfit",lang:"trading.stop-take-profit.takeProfit"}]},{value:1,lang:"t.orderType_m",position:"center",list:[{value:"0",lang:"futuresMain.trade.market",tip:"futuresMain.trade.market.tip"},{value:"1",lang:"futuresMain.trade.stop"},{value:"2",lang:"futuresMain.trade.trailingStop"},{value:"3",lang:"futuresMain.trade.takeProfit"}]},{value:-1,lang:"t.advanced",position:"right",newTag:!this.hasClickedNewTag,tabOrderKey:He.FUTURES_TAB_ORDER,list:[{value:4,lang:"trading.buySell.title.twap",tip:"trading.buySell.title.twap.tip"},{value:2,lang:"futuresMain.trade.oco",tip:"futuresMain.trade.oco.tip"},{value:3,lang:"futuresMain.trade.index",tip:"futuresMain.trade.index.tip"}]}]}
1,tabList(){const e=rF(this.$t);return zt.tradingTypeTabs.map((t=>({key:t,lang:e[t]})))}},methods:{checkActive(e){return this.active===e},onSelect(e){this.$emit("onSelect",e)}}},nF={class:"tab-content card-shell__header"};const oF=$n(aF,[["render",function(e,t,i,r,s,l){const u=a("TradingTypeTabItem");return o(),c("div",nF,[(o(!0),c(g,null,R(l.tabList,(e=>(o(),n(u,{key:e.key,text:e.lang,value:e.key,active:i.active===e.key,onClick:t=>l.onSelect(e.key)},null,8,["text","value","active","onClick"])))),128))])}],["__scopeId","data-v-17cfced7"]]),sF={name:"TradingTypeSelect",props:{id:{type:String,default:Be()},name:{type:String,required:!0},options:{type:Array,default:()=>[]},value:{type:String,default:""}},emits:["change"],data:()=>({showMenu:!1}),computed:{displayText(){var e;const t=this.options.findIndex((e=>e.key===this.value));return(null==(e=this.options[t])?void 0:e.value)||""}},methods:{toggleMenu(){this.showMenu=!this.showMenu},handleClick({key:e}){this.$emit("change",e),this.closeMenu()},closeMenu(){this.showMenu=!1}}},lF={class:"select-wrapper"},uF={key:0,class:"options-wrapper"},cF=["onClick"];const dF=$n(sF,[["render",function(e,t,i,r,a,n){const s=H("click-outside");return B((o(),c("div",lF,[l("div",{class:"select",onClick:t[0]||(t[0]=(...e)=>n.toggleMenu&&n.toggleMenu(...e))},[l("span",{class:C(["flex-grow-1",{"tx-align--center":e.isMobile}])},m(n.displayText),3),l("span",null,[l("i",{class:C(a.showMenu?"el-icon-arrow-up":"el-icon-arrow-down")},null,2)])]),a.showMenu?(o(),c("div",uF,[(o(!0),c(g,null,R(i.options,(e=>(o(),c("div",{key:e.key,class:C(["option",{active:e.key===i.value}]),onClick:t=>n.handleClick(e)},m(e.value),11,cF)))),128))])):h("",!0)])),[[s,n.closeMenu]])}],["__scopeId","data-v-002221a2"]]),pF={name:"MarginModeDialog",components:{BrandDialog:pi,Icon:Rt},props:{show:{type:Boolean,default:!1}},emits:["update:show"],data:()=>({WALLET_MODE:ri,tab:ri.CROSS,showError1:!1,showError2:!1}),computed:{...U("futures",["symbol","marketData","currentMargin","hasOrders","hasPositions"]),...U(["isUnifiedWallet"]),isCross(){var e;return(null==(e=this.currentMargin[0])?void 0:e.marginMode)===ri.CROSS},isHedge(){var e;return(null==(e=this.currentMargin[0])?void 0:e.positionMode)===li.HEDGE},isSelectingCross(){return this.tab===ri.CROSS},positionModeText(){var e;switch(null==(e=this.currentMargin[0])?void 0:e.positionMode){case li.ONE_WAY:return this.$t("trading.oneWay");case li.HEDGE:return this.$t("trading.hedge");case li.ISOLATED:return this.$t("trading.multiple");default:return""}}},watch:{show(){this.initTab()}},created(){this.initTab()},methods:{...v("futures",["setLeverage"]),initTab(){this.tab=this.isCross?ri.CROSS:ri.ISOLATED},onClosed(){this.$emit("update:show",!1),this.showError1=!1,this.showError2=!1},onTabClick(e){var t;const i=this.isCross?ri.CROSS:ri.ISOLATED;this.tab=e,this.showError1=(this.hasOrders||this.hasPositions)&&e!==i,this.showError2=(null==(t=this.currentMargin[0])?void 0:t.positionMode)===li.ISOLATED&&e===ri.CROSS},async handleSave(){this.setLeverage({marginMode:this.tab}),this.onClosed()}}},hF={class:"margin-mode-dialog-body"},mF={class:"margin-mode-symbol-content mb-20"},gF={class:"margin-mode-market-name"},fF={class:"margin-mode-type"},vF={class:"margin-mode-content mb-20"},yF={class:"margin-mode-btns"},bF={class:"mode-name"},SF={class:"mode-name"},CF={key:2,class:"margin-mode-hint mb-20"},PF={key:0},kF={key:0,class:"margin-mode-error mb-20"},TF={key:1,class:"margin-mode-error mb-20"},MF={class:"footer-btns"};const LF=$n(pF,[["render",function(e,t,i,r,u,f){const v=a("Icon"),y=a("i18n-t"),b=a("BaseButton"),S=a("BrandDialog");return o(),n(S,{width:e.isMobile?"90%":"530px",visible:i.show,isBrandNewStyle:"",onClosed:f.onClosed},{header:s((()=>[p(m(e.$t("futuresMain.marginMode")),1)])),body:s((()=>[l("div",hF,[l("div",mF,[d(v,{name:e.marketData.baseCurrency,showName:!1,size:"24"},null,8,["name"]),l("div",gF,m(e.marketData.symbol),1),l("div",fF,m(f.positionModeText),1)]),l("div",vF,m(e.$t("futuresMain.marginMode.description")),1),l("div",yF,[l("div",{class:C(["margin-mode-btn",{active:u.tab===u.WALLET_MODE.CROSS}]),onClick:t[0]||(t[0]=e=>f.onTabClick(u.WALLET_MODE.CROSS))},[t[3]||(t[3]=l("div",{class:"margin-mode-radio"},[l("div",{class:"inner-circle"}
1)],-1)),l("div",bF,m(e.$t("futuresMain.trade.cross")),1)],2),l("div",{class:C(["margin-mode-btn",{active:u.tab===u.WALLET_MODE.ISOLATED}]),onClick:t[1]||(t[1]=e=>f.onTabClick(u.WALLET_MODE.ISOLATED))},[t[4]||(t[4]=l("div",{class:"margin-mode-radio"},[l("div",{class:"inner-circle"})],-1)),l("div",SF,m(e.$t("t.isolated")),1)],2)]),f.isSelectingCross?(o(),n(y,{key:0,keypath:"futuresMain.marginMode.cross.description",class:"margin-mode-content mb-20",tag:"div"},{mode:s((()=>[l("b",null,m(e.$t("futuresMain.trade.cross"))+" "+m(e.$t("futuresMain.marginMode"))+": ",1)])),_:1})):(o(),n(y,{key:1,keypath:"futuresMain.marginMode.isolate.description",class:"margin-mode-content mb-20",tag:"div"},{mode:s((()=>[l("b",null,m(e.$t("t.isolated"))+" "+m(e.$t("futuresMain.marginMode"))+":",1)])),_:1})),f.isSelectingCross?h("",!0):(o(),c("ol",CF,[e.isUnifiedWallet?(o(),c("li",PF,m(e.$t("futuresMain.marginMode.isolate.hint.1")),1)):h("",!0)])),e.isUnifiedWallet?(o(),c(g,{key:3},[u.showError1?(o(),c("div",kF,m(e.$t("futuresMain.marginMode.warning.1")),1)):h("",!0),u.showError2?(o(),c("div",TF,m(e.$t("futuresMain.marginMode.warning.2")),1)):h("",!0)],64)):h("",!0),l("div",MF,[d(b,{class:"primary w-100",size:"large",disabled:e.isUnifiedWallet&&(u.showError1||u.showError2),onClick:f.handleSave},{default:s((()=>[p(m(e.$t("t.save")),1)])),_:1},8,["disabled","onClick"]),l("div",{class:"cancel-btn w-100",onClick:t[2]||(t[2]=(...e)=>f.onClosed&&f.onClosed(...e))},m(e.$t("t.cancel")),1)])])])),_:1},8,["width","visible","onClosed"])}],["__scopeId","data-v-1e826aa6"]]),{enableFuturesTradingBot:wF}=mt,DF={name:"FuturesMarginModeSwitcher",components:{MarginModeDialog:LF,IconBot:ds,IconQuestionCircle2:qn,IconArrowBack:Oa,IconChevronDown:Ze},props:{tradeType:{type:String,default:Da.FUTURES}},emits:["update:tradeType"],data:()=>({FUTURES_POSITION_DIRECTION:fi,isOpenMarginModeDialog:!1}),computed:{...b(["isDefaultBrand","lang"]),...b("futures",["currentMarketSymbol"]),...y(pt,["isLeaderMode"]),...U(["isUnifiedWallet"]),...U("futures",["isHedgeMode","currentMargin","maxLeverage","isOneWayMode","unifiedGridBotLeverage","currentDisplayLeverage"]),isCross(){var e;return(null==(e=this.currentMargin[0])?void 0:e.marginMode)===ri.CROSS},botLeverage(){return this.isUnifiedWallet?this.unifiedGridBotLeverage:this.currentDisplayLeverage},hedgeLongMargin(){return this.currentMargin.find((e=>e.positionDirection===fi.LONG))},hedgeShortMargin(){return this.currentMargin.find((e=>e.positionDirection===fi.SHORT))},isGrid(){return this.tradeType===Da.GRID},isShowBotButton(){return!!wF&&(!this.isLeaderMode&&(!!this.isUnifiedWallet||this.isOneWayMode))}},watch:{currentMarketSymbol:{handler(){null!==this.currentMarketSymbol&&(wF&&this.getCurrentMarketBotLeverage(),this.syncOverCapLeverages())},immediate:!0}},methods:{...v("futures",["getCurrentMarketBotLeverage","syncOverCapLeverages"]),...f(Vn,["setLeverageDialog"]),openLeverageDialog(e){this.setLeverageDialog({show:!0,data:e})},handleGoBot(){this.$emit("update:tradeType",Da.GRID)},handleGoFutures(){this.$emit("update:tradeType",Da.FUTURES)},handleGoBotFaq(){const e=Ia(this.lang,"FUTURES_GRID_TRADING_BOT_FAQ");window.open(e)}}},OF={class:"selector-container"},IF={class:"settings-wrapper"},xF={class:"long"},_F={class:"short"},AF={key:1,class:"grid-bot-wrapper"},RF={class:"label"};const FF=$n(DF,[["render",function(e,t,i,r,s,u){var f,v;const y=a("IconChevronDown"),b=a("IconBot"),S=a("IconArrowBack"),C=a("IconQuestionCircle2"),P=a("MarginModeDialog");return o(),c("div",OF,[u.isGrid?(o(),c("div",AF,[l("div",{class:"action-btn left",onClick:t[5]||(t[5]=(...e)=>u.handleGoFutures&&u.handleGoFutures(...e))},[d(S,{width:"16",height:"16"})]),l("div",RF,[l("span",null,m(e.$t("t.futuresGrid")),1),e.isDefaultBrand?(o(),n(C,{key:0,class:"q-icon",onClick:u.handleGoBotFaq},null,8,["onClick"])):h("",!0)]),l("div",{class:"action-btn right",onClick:t[6]||(t[6]=t=>u.openLeverageDialog({...e.currentMargin[0],leverage:u.botLeverage,isUnifiedGrid:e.isUnifiedWallet}))},[p(m(e.$filters.formatNumber(u.botLeverage,{postfix:"x"}))+" ",1),d(y,{class:"down-icon"})])])):(o(),c(g,{key:0},[l("div",IF,[l("div",{class:"selector-block",onClick:t[0]||(t[0]=e=>s.isOpenMarginModeDialog=!0)},[p(m(u.isCross?e.$t("futuresMain.trade.cross"):e.$t("t.isolated"))+" ",1),d(y,{class:"down-icon"})]),e.isUnifiedWallet&&!u.isCross&&e.isHedgeMode?(o(),c(g,{key:0},[l("div",{key:"longLeverage",class:"selector-block",onClick:t[1]||(t[1]=e=>u.openLeverageDialog(u.hedgeLongMargin))},[l("span",xF,m(e.$filters.formatNumber((null==(f=u.hedgeLongMargin)?void 0:f.leverage)||"",{postfix:"x"})),1),d(y,{class:"down-icon"})]),l("div",{key:"shortLeverage",class:"selector-block",onClick:t[2]||(t[2]=e=>u.openLeverageDialog(u.hedgeShortMargin))},[l("span",_F,m(e.$filters.formatNumber((null==(v=u.hedgeShortMargin)?void 0:v.leverage)||"",{postfix:"x"})),1),d(y,{class:"down-icon"})])],64)):(o(),c("div",{key:1,class:"selector-block",onClick:t[3]||(t[3]=t=>u.openLeverageDialog(e.currentMargin[0]))},[p(m(e.$filters.formatNumber(e.currentDisplayLeverage,{postfix:"x"}))+" ",1),d(y,{class:"down-icon"})]))]),u.isShowBotButton?(o(),c("div",{key:0,class:"bot-btn",onClick:t[4]||(t[4]=(...e)=>u.handleGoBot&&u.handleGoBot(...e))},[d(b,{width:"20",height:"20"})])):h("",!0)],64)),d(P,{show:s.isOpenMarginModeDialog,"onUpdate:show":t[7]||(t[7]=e=>s.isOpenMarginModeDialog=e)},null,8,["show"])])}],["__scopeId","data-v-2b2f6f1a"]]),EF={name:"MobilePeriodInput",props:{inputHr:[String,Number],inputMin:[String,Number],min:[String,Number],max:[String,Number],alert:Boolean,rightHintText:String},emits:["input-hr","input-min"],data:()=>({touchDelayTimer:!1,autoSetValueTimer:!1,step:1,maxHr:24,maxMin:59}),computed:{decreaseHrButtonDisabled(){return isNaN(this.inputHr)||Number(this.inputHr)<=0},increaseHrButtonDisabled(){return isNaN(this.inputHr)||Number(this.inputHr)>=this.maxHr},decreaseMinButtonDisabled(){return isNaN(this.inputMin)||Number(this.inputMin)<=0},increaseMinButtonDisabled(){return isNaN(this.inputMin)||Number(this.inputMin)>=this.maxMin}},methods:{selectInput(e){e&&e.target.select()},compareToMin:(e,t)=>t>e?t:e,compareToMax:(e,t)=>t<e?t:e,adjustHrValue(e){let t=Number(this.inputHr)+Number(e);t=this.compareToMin(t,0),t=this.compareToMax(t,this.maxHr),this.setHrValue(t)},setHrValue(e){this.$emit("input-hr",e)},adjustMinValue(e){let t=Number(this.inputMin)+Number(e);t=this.compareToMin(t,0),t=this.compareToMax(t,this.maxMin),this.setMinValue(t)},setMinValue(e){this.$emit("input-min",e)}}},BF={class:"container"},zF={class:"input-label-wrapper"},$F={class:"input-label prepend"},NF={class:"input-wrapper"},UF={class:"flex-box justify-center items-center"},HF=["value","max","step"],VF=["value","max","step"],WF={class:"flex-center-center inner-ml-4 hr-btn-content"};const qF=$n(EF,[["render",function(e,t,i,r,n,u){const p=a("ToolTip");return o(),c("div",BF,[l("div",zF,[d(p,null,{content:s((()=>[l("div",null,[l("span",$F,m(e.$t("t.period")),1),t[11]||(t[11]=l("span",{class:"input-label append"},"(Hrs | Mins)",-1))])])),tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.period")),1)])),_:1}),t[12]||(t[12]=l("div",{class:"right-hint"},null,-1))]),l("div",NF,[l("div",UF,[l("div",{class:"spot-input-block",style:P(i.alert?"border: 1px solid red":"")}
1,[l("button",{ref:"decreaseButton",class:C(["step-button noselect",{disabled:u.decreaseHrButtonDisabled}]),onClick:t[0]||(t[0]=e=>u.adjustHrValue(-n.step))},t[13]||(t[13]=[l("i",{class:"action-icon el-icon-minus"},null,-1)]),2),l("input",{class:"input-block",type:"number",size:"1",placeholder:"0~24",value:i.inputHr,min:0,max:n.maxHr,step:n.step,onInput:t[1]||(t[1]=e=>u.setHrValue(e.target.value)),onFocus:t[2]||(t[2]=(...e)=>u.selectInput&&u.selectInput(...e))},null,40,HF),l("button",{ref:"increaseButton",class:C(["step-button noselect",{disabled:u.increaseHrButtonDisabled}]),onClick:t[3]||(t[3]=e=>u.adjustHrValue(n.step))},t[14]||(t[14]=[l("i",{class:"action-icon el-icon-plus"},null,-1)]),2)],4),t[17]||(t[17]=l("div",{class:"line"},null,-1)),l("div",{class:"spot-input-block",style:P(i.alert?"border: 1px solid red":"")},[l("button",{ref:"decreaseButton",class:C(["step-button noselect",{disabled:u.decreaseMinButtonDisabled}]),onClick:t[4]||(t[4]=e=>u.adjustMinValue(-n.step))},t[15]||(t[15]=[l("i",{class:"action-icon el-icon-minus"},null,-1)]),2),l("input",{class:"input-block",type:"number",size:"1",placeholder:"1~59",value:i.inputMin,min:1,max:n.maxMin,step:n.step,onInput:t[5]||(t[5]=e=>u.setMinValue(e.target.value)),onFocus:t[6]||(t[6]=(...e)=>u.selectInput&&u.selectInput(...e))},null,40,VF),l("button",{ref:"increaseButton",class:C(["step-button noselect",{disabled:u.increaseMinButtonDisabled}]),onClick:t[7]||(t[7]=e=>u.adjustMinValue(n.step))},t[16]||(t[16]=[l("i",{class:"action-icon el-icon-plus"},null,-1)]),2)],4)]),l("div",WF,[l("div",{class:"hr-btn",onClick:t[8]||(t[8]=e=>u.setHrValue(1))},"1 Hr"),l("div",{class:"hr-btn",onClick:t[9]||(t[9]=e=>u.setHrValue(12))},"12 Hr"),l("div",{class:"hr-btn",onClick:t[10]||(t[10]=e=>u.setHrValue(24))},"24 Hr")])])])}],["__scopeId","data-v-3d8cd2d6"]]),GF={name:"AdvancedOptionsBtn",props:{isShow:{type:Boolean,default:!1}}},KF={class:"twap-button tx-align--center"};const QF=$n(GF,[["render",function(e,t,i,r,a,n){return o(),c("div",KF,m(i.isShow?e.$t("trading.twap.hideAdvancedOptions"):e.$t("trading.twap.showAdvancedOptions")),1)}],["__scopeId","data-v-d8726787"]]),jF={name:"TwapReminderDialog",components:{Dialog:Mi},props:{closeDialog:{type:Function,default:()=>{}},isBuyAction:{type:Boolean,required:!0}},emits:["confirm"],data:()=>({notificationIcon:"data:image/svg+xml,%3csvg%20width='48'%20height='49'%20viewBox='0%200%2048%2049'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M24%2045.9983C35.598%2045.9983%2045%2036.5963%2045%2024.9983C45%2013.4003%2035.598%203.99829%2024%203.99829C12.402%203.99829%203%2013.4003%203%2024.9983C3%2036.5963%2012.402%2045.9983%2024%2045.9983ZM24%2048.9983C37.2548%2048.9983%2048%2038.2531%2048%2024.9983C48%2011.7435%2037.2548%200.998291%2024%200.998291C10.7452%200.998291%200%2011.7435%200%2024.9983C0%2038.2531%2010.7452%2048.9983%2024%2048.9983Z'%20fill='%23E6B230'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M23.1541%2017.1972C24.7501%2017.1972%2026.0446%2015.9028%2026.0446%2014.3067C26.0446%2012.7107%2024.7501%2011.4163%2023.1541%2011.4163C21.5568%2011.4163%2020.2637%2012.7107%2020.2637%2014.3067C20.2637%2015.9028%2021.5568%2017.1972%2023.1541%2017.1972Z'%20fill='%23E6B230'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M28.0308%2034.0827H26.4683V22.7935C26.4683%2021.8165%2025.6321%2021.0244%2024.6005%2021.0244H21.1686C20.137%2021.0244%2019.3008%2021.8165%2019.3008%2022.7935C19.3008%2023.7704%2020.137%2024.5624%2021.1686%2024.5624H22.7321V34.0827H21.1686C20.137%2034.0827%2019.3008%2034.8747%2019.3008%2035.8516C19.3008%2036.8284%2020.137%2037.6206%2021.1686%2037.6206H28.0308C29.0629%2037.6206%2029.8991%2036.8284%2029.8991%2035.8516C29.8991%2034.8747%2029.0629%2034.0827%2028.0308%2034.0827Z'%20fill='%23E6B230'/%3e%3c/svg%3e"}),methods:{handleConfirm(){this.$emit("confirm"),this.closeDialog()}}},YF={class:"tx-align--center"},ZF=["src"],XF={class:"title"},JF={class:"thick"},eE={class:"thick"},tE={class:"flex-box flex-column items-center flex-1"};const iE=$n(jF,[["render",function(e,t,i,r,u,c){const h=a("i18n-t"),g=a("BaseButton"),f=a("Dialog");return o(),n(f,{class:"twap-reminder-dialog",isBrandNewStyle:"",width:e.isLargeSize?"560px":"9
10%",fullStyle:e.isMobile,showHeaderBottomDivider:!1,onClosed:i.closeDialog},{body:s((()=>[l("div",null,[l("div",YF,[l("img",{src:u.notificationIcon},null,8,ZF),l("h2",XF,m(e.$t("trading.twap.dialog.title")),1)]),d(h,{keypath:"trading.twap.dialog.description",tag:"p",class:"description"},{pausePrice:s((()=>[l("span",JF,m(i.isBuyAction?e.$t("trading.twap.pauseAbovePrice"):e.$t("trading.twap.pauseBelowPrice")),1)])),maxDistanceThroughBook:s((()=>[l("span",eE,m(e.$t("trading.twap.maxDistanceThroughBook")),1)])),_:1})])])),footer:s((()=>[l("div",tE,[d(g,{class:"primary w-100",size:"large",onClick:c.handleConfirm},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["onClick"]),d(g,{class:"modify-btn",size:"extra-small",onClick:i.closeDialog},{default:s((()=>[p(m(e.$t("trading.twap.dialog.modifyOrder")),1)])),_:1},8,["onClick"])])])),_:1},8,["width","fullStyle","onClosed"])}],["__scopeId","data-v-a830daf1"]]),rE="/static/img/D5wdpcGK.jpg",aE={__name:"RandomizeSizeCheckbox",props:{value:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=Ge();D((()=>r.orderFormSettings),(({randomizeSize:e})=>{i("update:value",e)})),L((()=>{i("update:value",r.orderFormSettings.randomizeSize)}));const l=ea((async e=>{await r.updateOrderFormSettings({randomizeSize:e})}),500);return(t,i)=>{const r=a("ToolTip"),u=a("Checkbox");return o(),n(u,{value:e.value,name:"randomizeSize",onInput:x(l)},{default:s((()=>[d(r,{tooltip:t.$t("trading.twap.input.hint.randomizeSize")},{content:s((()=>[p(m(t.$t("trading.twap.randomizeSize")),1)])),_:1},8,["tooltip"])])),_:1},8,["value","onInput"])}}},nE={__name:"MakerFirstCheckbox",props:{value:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=Ge();D((()=>r.orderFormSettings),(({makerFirst:e})=>{i("update:value",e)})),L((()=>{i("update:value",r.orderFormSettings.makerFirst)}));const l=ea((async e=>{await r.updateOrderFormSettings({makerFirst:e})}),500);return(t,i)=>{const r=a("ToolTip"),u=a("Checkbox");return o(),n(u,{value:e.value,name:"makerFirst",onInput:x(l)},{default:s((()=>[d(r,{tooltip:t.$t("trading.twap.input.hint.makerFirst")},{content:s((()=>[p(m(t.$t("trading.twap.makerFirst")),1)])),_:1},8,["tooltip"])])),_:1},8,["value","onInput"])}}},{enableLastPriceDependentUI:oE}=zt,sE={size:"",percent:0,hr:"",min:"",maxSpread:"",maxIndividualOrderSize:"",maxDistanceThroughBook:"",pausePrice:"",randomizeSize:!1,makerFirst:!1,reduceOnly:!1,activationPrice:"",activationPriceType:Aa},lE={name:"TwapOrderForm",components:{TradeSlider:po,MobilePeriodInput:qF,AdvancedOptionsBtn:QF,FuturesAdvancedOrderValue:HD,FuturesAvailableBalance:pD,FuturesFormActions:vD,FuturesMarginInfoList:BD,TwapReminderDialog:iE,Tutorial:Gy,TradingInput:Wn,FuturesSizeInput:wO,ReduceOnlyCheckbox:pI,RandomizeSizeCheckbox:aE,MakerFirstCheckbox:nE,ActivationPriceCheckbox:BT,ActivationPriceInput:NT,OffHoursDescription:YA},inject:["adjustOrderFormHeight"],setup(){const{checkPriceProtection:e}=xI();return{checkPriceProtection:e,takerFee:ci().takerFee}},data:()=>({twapTutorialImg:rE,iconAlertImg:"data:image/svg+xml,%3csvg%20width='10'%20height='10'%20viewBox='0%200%2010%2010'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5%2010C2.23858%2010%207.57972e-07%207.76142%205.1656e-07%205C2.75149e-07%202.23858%202.23858%20-2.75149e-07%205%20-5.1656e-07C7.76142%20-7.57972e-07%2010%202.23858%2010%205C10%207.76142%207.76142%2010%205%2010ZM5.00031%209.35761C7.40695%209.35761%209.35791%207.40664%209.35791%205C9.35791%202.59337%207.40694%200.6424%205.00031%200.6424C2.59367%200.6424%200.642706%202.59337%200.642706%205C0.642707%207.40664%202.59367%209.35761%205.00031%209.35761ZM4.77905%205.71655L5.57739%205.29907L5.57739%202.20215C5.57739%202.02956%205.43748%201.88965%205.26489%201.88965L4.75098%201.88965C4.57839%201.88965%204.43848%202.02956%204.43848%202.20215L4.43848%205.40405C4.43848%205.57664%204.57839%205.71655%204.75098%205.71655L4.77905%205.71655ZM5.57739%207.16309C5.60913%207.09473%205.625%207.02271%205.625%206.94702C5.625%206.87134%205.60913%206.79932%205.57739%206.73096C5.54565%206.66504%205.50171%206.60767%205.44556%206.55884C5.3894%206.51001%205.32471%206.47095%205.25147%206.44165C5.17822%206.41235%205.09888%206.39771%205.01343%206.39771C4.92798%206.39771%204.84863%206.41235%204.77539
1%206.44165C4.69971%206.47095%204.63501%206.51001%204.5813%206.55884C4.52515%206.60767%204.4812%206.66504%204.44946%206.73096C4.41772%206.79932%204.40186%206.87134%204.40186%206.94702C4.40186%207.02271%204.41772%207.09473%204.44946%207.16309C4.4812%207.23145%204.52515%207.29004%204.5813%207.33887C4.63501%207.3877%204.69971%207.42676%204.77539%207.45605C4.84863%207.48535%204.92798%207.5%205.01343%207.5C5.09888%207.5%205.17822%207.48535%205.25147%207.45605C5.32471%207.42676%205.3894%207.3877%205.44556%207.33887C5.50171%207.29004%205.54565%207.23145%205.57739%207.16309Z'%20fill='white'/%3e%3c/svg%3e",FuturesSizeType:Ke,form:{...sE},showAdvancedOptions:!1,showReminderDialog:!1,loading:!1,isPercentFlag:!1,isBuyAction:!0,isOrderFormOnRightSide:!0,storageKey:$i.TRADING_FUTURES_TWAP_TUTORIAL,enableLastPriceDependentUI:oE}),computed:{...b(["futureOrderBookShortcut","loginState"]),...b("futures",["futuresMarkPriceMap","openPositionMap","fixedCurrency"]),...b("orderBook",["lastPrice"]),...U("futures",["marketData","marketDetail","hasOpenPosition","wallet","walletLeverage","availableBalance","currentDisplayLeverage","riskLimitSetting","isMarketOffHours"]),...y(Ge,["sizeType","sizeUnit","isUsdSizeType","isCryptoSizeType","isContractSizeType","rememberFuturesSizeTpsl","orderFormSettings"]),symbol(){return this.marketData.symbol||this.$route.params.id},markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},contractUnitSize(){return Pa(this.form.size,this.twapCalculationPrice)},quoteCurrency(){return this.fixedCurrency},openPosition(){var e;return null==(e=this.openPositionMap[this.symbol])?void 0:e[0]},isOpenPositionBuy(){var e;return"MODE_BUY"===(null==(e=this.openPosition)?void 0:e.orderModeName)},openPositionTotalContracts(){var e;return(null==(e=this.openPosition)?void 0:e.totalContracts)||0},isReduceOnly(){return this.form.reduceOnly&&""!==this.form.size},noOpenPositionWhenReduceOnly(){return this.isReduceOnly&&!this.hasOpenPosition},isSizeBiggerThanOpenPositionWhenReduceOnly(){return this.isReduceOnly&&this.contractUnitSize>this.openPositionTotalContracts},isSizeSmallerThanOpenPositionWhenReduceOnly(){return this.isReduceOnly&&this.contractUnitSize<=this.openPositionTotalContracts},disableSubmit(){return!this.loginState||!wa("size",this.contractUnitSize)||!this.timePeriod||this.isInputMaxIndividualOrderSizeError||this.isInputPausePriceError||this.noOpenPositionWhenReduceOnly||this.isSizeBiggerThanOpenPositionWhenReduceOnly||this.isActivationPriceEmpty||this.isMarketOffHours},disableSubmitBuy(){return this.disableSubmit||this.isSizeSmallerThanOpenPositionWhenReduceOnly&&this.isOpenPositionBuy},disableSubmitSell(){return this.disableSubmit||this.isSizeSmallerThanOpenPositionWhenReduceOnly&&!this.isOpenPositionBuy},marginBuySize(){return this.getMarketOrderTypeContractUnitSize(this.displayOrderValueInfo.buySize)},marginSellSize(){return this.getMarketOrderTypeContractUnitSize(this.displayOrderValueInfo.sellSize)},formattedMarkPrice(){const e=this.marketData.priceFilter??2,t=(this.lastPrice?this.lastPrice.toFixed(Number(e)).length:0)+2;let i=this.roundDown(this.markPrice,e);return i.length>t?i.substring(0,t):i},isInputMaxIndividualOrderSizeWarning(){const e=this.marketDetail.minOrderSize*this.timePeriod/this.contractUnitSize,t=15*Math.round(e/15),i=Math.ceil(this.timePeriod/t),r=this.contractUnitSize/i;return""!==this.form.maxIndividualOrderSize&&this.form.maxIndividualOrderSize<r},isInputMaxIndividualOrderSizeError(){return""!==this.form.maxIndividualOrderSize&&this.form.maxIndividualOrderSize<this.IndividualOrderSizeInfo.min},isInputPausePriceError(){return""!==this.form.pausePrice&&this.form.pausePrice<this.marketDetail.minPriceIncrement},contractMaxSize(){const e=S(1).div(this.walletLeverage||1).toNumber();return _a({availableBalance:this.availableBalance,contractSize:this.marketDetail.contractSize,orderPrice:this.triggerPrice||0,initialMargin:e,takerFees:this.takerFee,position:this.openPosition})},maxSize(){return{buy:Number(gt(this.contractMaxSize.buy,this.triggerPrice)),sell:Number(gt(this.contractMaxSize.sell,this.triggerPrice))}},minSize(){const{minOrderSize:e}=this.marketDetail;return Number(gt(e,this.triggerPrice))},availableBalanceMinDecimalPlaces(){return pr(this.availableBalance)},cryptoMinDecimalPlaces(){return pr(this.marketDetail.contractSize||0)},displayOrderValueInfo(){var e,t,i,r,a,n,o,s,l,u,c,d;const p=this.isPercentFlag?this.maxSize.buy:Number(this.form.size),h=this.isPercentFlag?this.maxSize.sell:Number(this.form.size),m=this.isPercentFlag?this.form.percent/100:1,g=this.twapCalculationPrice||1;let f,v,y,b;if(this.isUsdSizeType&&(f=null==(e=S(p))?void 0:e.times(m).div(g).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),v=null==(t=S(h))?void 0:t.t
1imes(m).div(g).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),y=null==(i=S(f))?void 0:i.times(g).toFixed(this.availableBalanceMinDecimalPlaces,S.ROUND_DOWN),b=null==(r=S(v))?void 0:r.times(g).toFixed(this.availableBalanceMinDecimalPlaces,S.ROUND_DOWN)),this.isCryptoSizeType&&(f=null==(a=S(p))?void 0:a.times(m).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),v=null==(n=S(h))?void 0:n.times(m).toFixed(this.cryptoMinDecimalPlaces,S.ROUND_DOWN),y=null==(o=S(f))?void 0:o.times(g).toFixed(this.availableBalanceMinDecimalPlaces,S.ROUND_DOWN),b=null==(s=S(v))?void 0:s.times(g).toFixed(this.availableBalanceMinDecimalPlaces,S.ROUND_DOWN)),this.isContractSizeType){const e=Math.floor(p),t=Math.floor(h),i=Number(this.marketDetail.contractSize)||0;f=Math.floor(e*m).toString(),v=Math.floor(t*m).toString(),y=Number(null==(u=null==(l=S(g))?void 0:l.times(i))?void 0:u.times(f).toNumber()),b=Number(null==(d=null==(c=S(g))?void 0:c.times(i))?void 0:d.times(v).toNumber())}return{buySize:f,sellSize:v,buyValue:y,sellValue:b}},IndividualOrderSizeInfo(){const{minOrderSize:e,minSizeIncrement:t,contractSize:i}=this.marketDetail,r=this.isContractSizeType?e:Qe(e),a=this.isContractSizeType?t:i;return{placeholder:r,currency:this.sizeUnit,step:a,min:r}},showAdvancedOptionsHint(){const{maxSpread:e,maxIndividualOrderSize:t,maxDistanceThroughBook:i,pausePrice:r}=this.form;return""!==e|""!==t|""!==i|""!==r},inputpPausePriceHint(){const e=this.$filters.formatNumber(this.form.pausePrice,"max8");return this.isInputPausePriceError?this.$t("trading.twap.input.error.pausePrice",{price:this.marketDetail.minPriceIncrement,currency:this.quoteCurrency}):this.$t("trading.twap.input.hint.pausePrice2",{pausePrice:e})},timePeriod(){return 60*(60*this.form.hr+this.form.min)},tutorialPlacement(){return this.isMobile?"bottom":this.isOrderFormOnRightSide?"left":"right"},activationPriceChecked(){return this.orderFormSettings.enableActivationPrice},activationPriceType(){return this.orderFormSettings.activationPriceTriggerOn},isActivationPriceEnabled(){return this.activationPriceChecked&&this.form.activationPrice},isActivationPriceEmpty(){return this.activationPriceChecked&&""===this.form.activationPrice},twapCalculationPrice(){return this.isActivationPriceEnabled?this.form.activationPrice:this.markPrice},triggerPrice(){return this.isActivationPriceEnabled?this.form.activationPrice:Number(this.formattedMarkPrice)}},watch:{triggerPrice:{immediate:!0,handler(e){this.changeCurrentOrderPrice(e),this.changeCurrentOrderQty(this.contractUnitSize)}},showAdvancedOptions(e){this.adjustOrderFormHeight(e,ni.TWAP)},"form.percent":{handler(e){if(this.isPercentFlag){const{buy:t,sell:i}=this.maxSize,r=Math.max(t,i);this.form.size=r*(e/100)}}},"orderFormSettings.activationPriceTriggerOn":{handler(e){this.form.activationPriceType=e},immediate:!0},sizeUnit(e){if(!this.form.maxIndividualOrderSize)return;const{contractSize:t}=this.marketDetail;let i;i=e===Ke.CONTRACTS?S(this.form.maxIndividualOrderSize).div(t).toNumber():S(this.form.maxIndividualOrderSize).times(t).toNumber(),this.form.maxIndividualOrderSize=i},symbol(){this.form.percent=0,this.form.size="",this.isPercentFlag=!1},currentDisplayLeverage(){const e=this.form.percent;this.form.percent=null,this.$nextTick((()=>{this.form.percent=e}))}},created(){this.checkTradingPageUI()},methods:{...v(["changeCurrentOrderPrice","changeCurrentOrderQty"]),...u("futures",["setRiskLimitPopupTrigger"]),handleActivationPriceCheckboxChange(e){Ge().updateOrderFormSettings({enableActivationPrice:e})},handleActivationPriceTypeChange(e){Ge().updateOrderFormSettings({activationPriceTriggerOn:e})},roundDown(e,t){if(!oi(e))return"";const[i,r]=e.toString().split(".");if(!r)return`${e}`;let a=t;return a>r.length&&(a=r.length),`${i}.${r.slice(0,a)}`},selectInput(e){const{target:t}=e;e&&t.select()},handleInputHr(e){const t=e.target.value;if(""!==t){if(!(t<0))return t>=24?(this.form.hr=24,void(this.form.min="")):void(Number.isInteger(t)||(this.form.hr=Math.round(t)));this.form.hr=0}},handleInputMin(e){const t=e.target.value;""!==t&&(t<0?this.form.min=0:(24===this.form.hr&&(this.form.hr=23),t>59?this.form.min=59:Number.isInteger(t)||(this.form.min=Math.round(t))))},async checkSubmit(e=!0){const{maxDistanceThroughBook:t,pausePrice:i}=this.form;this.isBuyAction=e;const r=await this.checkPriceProtection({isSpot:!1,isBuyAction:this.isBuyAction,symbol:this.symbol,maxDistanceThroughBook:this.form.maxDistanceThroughBook,tradingType:ni.TWAP});r.ok&&(r.maxDistanceThroughBook&&(this.form.maxDistanceThroughBook=r.maxDistanceThroughBook),t||i?this.showReminderDialog=!0:this.submitForm(
1))},async submitForm(){this.loading=!0;const e={symbol:this.symbol,side:this.isBuyAction?"BUY":"SELL",size:Number(this.contractUnitSize),timePeriod:this.timePeriod,makerFirst:this.form.makerFirst,randomizeSize:this.form.randomizeSize,reduceOnly:this.form.reduceOnly,maxSpread:this.form.maxSpread/100,maxDistanceThroughBook:this.form.maxDistanceThroughBook/100,pausePrice:Number(this.form.pausePrice)||"",subTwapMaxOrderSize:this.convertMaxOrderSizeToContracts(this.form.maxIndividualOrderSize)||"",...this.activationPriceChecked&&{activationPrice:this.form.activationPrice,activationPriceType:this.form.activationPriceType}},t=Object.entries(e).reduce(((e,[t,i])=>i?(e[t]=i,e):e),{});try{await Ve.submitTwapOrder(t,{wallet:this.wallet,sizeType:this.sizeType}),this.resetFormData()}catch(i){const{code:e,data:t}=i;if(33199128===e){const e=t[0],i=(this.riskLimitSetting.find((t=>t.riskLimitValue===Number(e)))||{}).riskLevel;this.setRiskLimitPopupTrigger({error:!0,targetStep:i})}}finally{this.loading=!1}},resetFormData(){this.rememberFuturesSizeTpsl||(this.form.size="",this.form.percent=0,this.form.activationPrice="",this.isPercentFlag=!1)},getMarketOrderTypeContractUnitSize(e){return this.isContractSizeType?e:qi(e)},handleInputMaxSpread(e){""!==e&&(this.form.maxSpread=e>99.9?99.9:e<.1?.1:Number(xa(e,3)))},handleInputMaxDistanceThroughBook(e){""!==e&&(this.form.maxDistanceThroughBook=e<.1?.1:Number(xa(e,1)))},handlePercentChange(){this.isPercentFlag=!0},handleInputMaxIndividualOrderSize(e){""!==e&&e<this.IndividualOrderSizeInfo.min&&(this.form.maxIndividualOrderSize=this.IndividualOrderSizeInfo.min)},closeDialog(){this.showReminderDialog=!1},checkTradingPageUI(){var e;const{x:t}=(null==(e=document.querySelector(".order-book-form"))?void 0:e.getBoundingClientRect())||{};void 0!==t&&t<=300&&(this.isOrderFormOnRightSide=!1)},handleSizeFocus(){this.isPercentFlag&&(this.isPercentFlag=!1,this.form.percent=0,this.form.size="")},convertMaxOrderSizeToContracts(e){return e&&!this.isContractSizeType?S(e).div(this.marketDetail.contractSize).toNumber():Number(e)}}},uE={class:"futures-form-container twap"},cE={class:"form-input-container"},dE=["src"],pE={key:1,class:"input--container"},hE={class:"flex-box items-center justify-between flex-wrap"},mE={class:"tooltip-title-wrapper"},gE={class:"flex-box"},fE={class:"margin-auto input-label"},vE={class:"margin-auto input-label"},yE={class:"flex-center-center inner-ml-4 hr-btn-content"},bE={class:"setting-wrapper"},SE={class:"w-100"},CE={class:"options-content mt-8"},PE={class:"info-and-actions"},kE={key:0,class:"advanced-option-hint error"},TE=["src"],ME={key:1,class:"advanced-option-hint"};const LE=$n(lE,[["render",function(e,t,i,r,u,g){const f=a("OffHoursDescription"),v=a("FuturesSizeInput"),y=a("TradeSlider"),b=a("MobilePeriodInput"),S=a("Tooltip"),P=a("Tutorial"),k=a("RandomizeSizeCheckbox"),T=a("MakerFirstCheckbox"),M=a("ReduceOnlyCheckbox"),L=a("ActivationPriceCheckbox"),w=a("ActivationPriceInput"),D=a("AdvancedOptionsBtn"),O=a("TradingInput"),I=a("FuturesAvailableBalance"),x=a("FuturesFormActions"),_=a("FuturesAdvancedOrderValue"),A=a("FuturesMarginInfoList"),R=a("TwapReminderDialog"),F=H("brand-number-onkeypress");return o(),c("div",uE,[l("div",cE,[e.isMarketOffHours?(o(),n(f,{key:0,"order-type":"TWAP"})):h("",!0),d(P,{mask:"",closeOnMaskClicked:"",storageKey:u.storageKey,buttonText:e.$t("trading.twap.tutorial.buttonText"),placement:g.tutorialPlacement,title:e.$t("trading.buySell.title.twap")},{tooltip:s((()=>[l("img",{class:"tutorial-img",alt:"twap tutorial",src:u.twapTutorialImg},null,8,dE),l("div",null,[p(m(e.$t("trading.twap.tutorial.tip1"))+" ",1),t[22]||(t[22]=l("br",null,null,-1)),t[23]||(t[23]=l("br",null,null,-1)),p(" "+m(e.$t("trading.twap.tutorial.tip2"))+" ",1),t[24]||(t[24]=l("br",null,null,-1)),t[25]||(t[25]=l("br",null,null,-1)),p(" "+m(e.$t("trading.twap.tutorial.tip3")),1)])])),default:s((()=>[l("div",null,[d(v,{size:u.form.size,"onUpdate:size":t[0]||(t[0]=e=>u.form.size=e),isTwap:"",price:g.triggerPrice,percent:u.form.percent+" %",isPercent:u.isPercentFlag,maxSizeCalulatedPrice:g.twapCalculationPrice,onFocus:g.handleSizeFocus},null,8,["size","price","percent","isPercent","maxSizeCalulatedPrice","onFocus"]),d(y,{value:u.form.percent,"onUpdate:value":t[1]||(t[1]=e=>u.form.percent=e),onChange:g.handlePercentChange},null,8,["value","onChange"]),e.isMobile?(o(),n(b,{key:0,"input-hr":u.form.hr,"input-min":u.form.min,onInputHr:t[2]||(t[2]=e=>u.form.hr=e),onInputMin:t[3]||(t[3]=e=>u.form.min=e)},null,8,["input-hr","input-min"])):(o(),c("div",pE,[l("div",hE,[l("div",mE,[d(S,{class:"_index_title",content:e.$t("t.period")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.period")),1)])),_:1},8,["content"])]),l("div",gE,[B(l("input",{ref:"inputFocus","onUpdate:modelValue":t[4]||(t[4]=e=>u.form.hr=e),type:"number",class:C(["border-none tx-align--right input input-period",{"xs-font-size":!1}]),placeholder:"0-24",pattern:"\\d*",step:1,max:24,min:0,onInput:t[5]||(t[5]=(...e)=>g.handleInputHr&&g.handleInputHr(...e)),onKeyup:t[6]||(t[6]=$(((...t)=>e.keyupEnter&&e.keyupEnter(...t)),["enter"]))},null,544),[[z,u.form.hr],[F]]),l("span",fE,m(e.$t("t.hr_s")),1),B(l("input",{ref:"inputFocus","onUpdate:modelValue":t[7]||(t[7]=e=>u.form.min=e),type:"number",class:C(["border-none tx-align--right input input-period",{"xs-font-size":!1}]),placeholder:"1-59",step:1,max:59,min:1,onInput:t[8]||(t[8]=(...e)=>g.handleInputMin&&g.handleInputMin(...e)),onKeyup:t[9]||(t[9]=$(((...t)=>e.keyupEnter&&e.keyupEnter(...t)),["enter"]))},null,544),[[z,u.form.min],[F]]),l("span",vE,m(e.$t("t.min_s")),1)])]),l("div",yE,[l("div",{class:"hr-btn",onClick:t[10
1]||(t[10]=e=>u.form.hr=1)},"1 Hr"),l("div",{class:"hr-btn",onClick:t[11]||(t[11]=e=>u.form.hr=12)},"12 Hr"),l("div",{class:"hr-btn",onClick:t[12]||(t[12]=e=>u.form.hr=24)},"24 Hr")])]))])])),_:1},8,["storageKey","buttonText","placement","title"]),l("div",bE,[d(k,{value:u.form.randomizeSize,"onUpdate:value":t[13]||(t[13]=e=>u.form.randomizeSize=e),class:"form-checkbox"},null,8,["value"]),d(T,{value:u.form.makerFirst,"onUpdate:value":t[14]||(t[14]=e=>u.form.makerFirst=e),class:"form-checkbox"},null,8,["value"]),d(M,{value:u.form.reduceOnly,"onUpdate:value":t[15]||(t[15]=e=>u.form.reduceOnly=e),class:"form-checkbox"},null,8,["value"]),l("div",SE,[d(L,{value:g.activationPriceChecked,"order-type":"history.order.filter.type.twap",class:"form-checkbox","onUpdate:value":g.handleActivationPriceCheckboxChange},null,8,["value","onUpdate:value"]),d(w,{checked:g.activationPriceChecked,price:u.form.activationPrice,quoteCurrency:g.quoteCurrency,priceType:g.activationPriceType,step:Number(e.marketDetail.minPriceIncrement),priceFilter:e.marketDetail.priceFilter,walletType:"futures","onUpdate:price":t[16]||(t[16]=e=>u.form.activationPrice=Number(e)),"onUpdate:priceType":g.handleActivationPriceTypeChange},null,8,["checked","price","quoteCurrency","priceType","step","priceFilter","onUpdate:priceType"])])]),d(D,{isShow:u.showAdvancedOptions,onClick:t[17]||(t[17]=e=>u.showAdvancedOptions=!u.showAdvancedOptions)},null,8,["isShow"]),B(l("div",CE,[d(O,{value:u.form.maxSpread,"onUpdate:value":t[18]||(t[18]=e=>u.form.maxSpread=e),label:"maxSpread",type:"number",step:.1,min:.
11,max:99.9,placeholder:"0.1-99.9",onInput:g.handleInputMaxSpread},{prepend:s((()=>[d(S,{content:e.$t("trading.twap.maxSpread")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.maxSpread")),1)])),_:1},8,["content"])])),append:s((()=>t[26]||(t[26]=[p("%")]))),_:1},8,["value","onInput"]),d(O,{value:u.form.maxIndividualOrderSize,"onUpdate:value":t[19]||(t[19]=e=>u.form.maxIndividualOrderSize=e),label:"maxIndividualOrderSize",enableThousandSeparator:"",step:Number(g.IndividualOrderSizeInfo.step),min:Number(g.IndividualOrderSizeInfo.min),placeholder:g.IndividualOrderSizeInfo.placeholder,tipShown:g.isInputMaxIndividualOrderSizeWarning,errorShown:g.isInputMaxIndividualOrderSizeError,errorContent:g.isInputMaxIndividualOrderSizeError?e.$t("trading.twap.input.error.maxIndividualOrderSize",{size:g.IndividualOrderSizeInfo.min,currency:g.IndividualOrderSizeInfo.currency}):e.$t("trading.twap.input.warning.pausePrice"),onInput:g.handleInputMaxIndividualOrderSize},{prepend:s((()=>[d(S,{class:C(["_index_title",{_index_title_custom:!e.isMobile}]),content:e.$t("trading.twap.maxIndividualOrderSize")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.maxIndividualOrderSize")),1)])),_:1},8,["class","content"])])),append:s((()=>[p(m(g.IndividualOrderSizeInfo.currency),1)])),_:1},8,["value","step","min","placeholder","tipShown","errorShown","errorContent","onInput"]),u.enableLastPriceDependentUI?(o(),n(O,{key:0,value:u.form.maxDistanceThroughBook,"onUpdate:value":t[20]||(t[20]=e=>u.form.maxDistanceThroughBook=e),label:"maxDistanceThroughBook",enableThousandSeparator:"",step:.1,min:.
11,placeholder:"â¥0.1",onInput:g.handleInputMaxDistanceThroughBook},{prepend:s((()=>[d(S,{class:C(["_index_title",{_index_title_custom:!e.isMobile}]),content:e.$t("trading.twap.maxDistanceThroughBook")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.maxDistanceThroughBook.v2",{baseOnText:e.$t("trading.twap.input.hint.maxDistanceThroughBook.futures")})),1)])),_:1},8,["class","content"])])),append:s((()=>t[27]||(t[27]=[p("%")]))),_:1},8,["value","onInput"])):h("",!0),d(O,{value:u.form.pausePrice,"onUpdate:value":t[21]||(t[21]=e=>u.form.pausePrice=e),label:"pausePrice",enableThousandSeparator:"",step:Number(e.marketDetail.minPriceIncrement),min:Number(e.marketDetail.minPriceIncrement),placeholder:`â¥${e.marketDetail.minPriceIncrement}`,tipShown:!!u.form.pausePrice,errorShown:g.isInputPausePriceError,errorContent:g.inputpPausePriceHint},{prepend:s((()=>[d(S,{class:C(["_index_title",{_index_title_custom:!e.isMobile}]),content:e.$t("trading.orders.pausePrice")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.pausePrice")),1)])),_:1},8,["class","content"])])),append:s((()=>[p(m(g.quoteCurrency),1)])),_:1},8,["value","step","min","placeholder","tipShown","errorShown","errorContent"])],512),[[N,u.showAdvancedOptions]])]),l("div",PE,[d(I,{class:"avbl-balance-area"}),d(x,{buyDisabled:g.disableSubmitBuy,sellDisabled:g.disableSubmitSell,buySubmit:g.checkSubmit,sellSubmit:()=>g.checkSubmit(!1)},null,8,["buyDisabled","sellDisabled","buySubmit","sellSubmit"]),d(_,{orderValueInfo:g.displayOrderValueInfo,price:g.triggerPrice,buySize:g.marginBuySize,sellSize:g.marginSellSize,orderFormSize:u.form.size,orderFormPrice:g.twapCalculationPrice||1,hideLiqPrice:""},null,8,["orderValueInfo","price","buySize","sellSize","orderFormSize","orderFormPrice"]),g.noOpenPositionWhenReduceOnly||g.isSizeBiggerThanOpenPositionWhenReduceOnly?(o(),c("div",kE,[l("img",{src:u.iconAlertImg},null,8,TE),l("span",null,m(g.noOpenPositionWhenReduceOnly?e.$t("trading.twap.reduceOnlyHint"):e.$t("trading.twap.reduceOnlyHint2")),1)])):h("",!0),g.showAdvancedOptionsHint?(o(),c("div",ME,m(e.$t("trading.twap.advancedOptionHint")),1)):h("",!0),d(A,{isMarketOrderType:"",price:g.triggerPrice,buySize:g.marginBuySize,sellSize:g.marginSellSize,hideExposure:""},null,8,["price","buySize","sellSize"])]),u.showReminderDialog?(o(),n(R,{key:0,closeDialog:g.closeDialog,isBuyAction:u.isBuyAction,onConfirm:g.submitForm},null,8,["closeDialog","isBuyAction","onConfirm"])):h("",!0)])}],["__scopeId","data-v-4e2d570f"]]),wE={name:"BotDisclaimerBlock",components:{IconInfoOutline:Fa,BrandDialog:pi,Checkbox:Ko},props:{marketType:{type:String,default:Ra.SPOT}},emits:["confirm"],data:()=>({isShowDialog:!1,isUnderstand:!1,disclaimerContent:{}}),computed:{...b(["lang"]),renderContent(){const e=this.marketType===Ra.FUTURES?"grid":"dca";return this.disclaimerContent[e]||this.disclaimerContent.default||[]}},watch:{lang(){this.getDisclaimer()}},created(){this.getDisclaimer()},methods:{handleSign(){this.isShowDialog=!0},handleConfirm(){this.$emit("confirm"),this.isShowDialog=!1},async getDisclaimer(){const{data:e}=await Cr.getDisclaimer(this.lang),t=this.marketType.toLowerCase();this.disclaimerContent=e.disclaimer[t]}}},DE={class:"bot-disclaimer-wrapper"},OE={class:"disclaimer-body"},IE={class:"title"},xE={class:"body-text"},_E={class:"check-wrapper"},AE={class:"w-100"};const RE=$n(wE,[["render",function(e,t,i,r,n,u){const h=a("IconInfoOutline"),f=a("Checkbox"),v=a("BaseButton"),y=a("BrandDialog");return o(),c("div",DE,[d(h,{width:"24",height:"24"}),l("p",null,m(e.$t("trading.bot.disclaimerInfo")),1),l("button",{class:"sign-btn",onClick:t[0]||(t[0]=(...e)=>u.handleSign&&u.handleSign(...e))},m(e.$t("t.signNow")),1),d(y,{visible:n.isShowDialog,"onUpdate:visible":t[3]||(t[3]=e=>n.isShowDialog=e),class:"bot-disclaimer-modal",width:e.isMobile?"90%":"800px",isBrandNewStyle:""},{header:s((()=>[p(m(e.$t("trading.bot.disclaimerTitle")),1)])),body:s((()=>[l("div",OE,[(o(!0),c(g,null,R(u.renderContent,((e,t)=>(o(),c("div",{key:t},[l("div",IE,m(e.title),1),l("p",xE,m(e.content),1)])))),128)),l("div",_E,[d(f,{value:n.isUnderstand,"onUpdate:value":t[1]||(t[1]=e=>n.isUnderstand=e)},{default:s((()=>[p(m(e.$t("t.fullyUnderstand")),1)])),_:1},8,["value"])])])])),footer:s((()=>[l("div",AE,[d(v,{type:"confirm",class:"primary block create-btn",disabled:!n.isUnderstand,onClick:u.handleConfirm},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["disabled","onClick"]),l("div",{class:"cancel-btn",onClick:t[2]||(t[2]=e=>n.isShowDialog=!1)},m(e.$t("t.cancel")),1)])])),_:1},8,["visible","width"])])}],["__scopeId","data-v-ed394791"]]),FE={class:"futures-grid-advanced-settings"},EE={class:"title"},BE={key:0,class:"content"},zE={class:"item"},$E={class:"item-left"},NE={key:0,class:"type-text"},UE={class:"icon-chevron-right-wrap"},HE={class:"item"},VE={class:"item-left"},WE={key:0,class:"type-text"},qE={class:"icon-chevron-right-wrap"},GE={key:0,class:"item"},KE={class:"item-left"},QE={class:"flex-box flex-column items-end"},jE={class:"flex-box items-center"},YE={key:0,class:"type-text"},ZE={class:"icon-chevron-right-wrap"},XE=$n({__name:"FuturesGridAdvancedSettings",props:{botDetail:{type:Object,default:()=>({})}},emits:["updateTPSLSettings","updateTrailingStopSettings"],setup(e,{emit:t}){const i=e,r=t,{t:a}=G(),{$openDialog:u}=ar(),f=_I(He.FUTURES_BOT_ADVANCED_SETTINGS,!0),v=T(!1),y=M((()=>{var e,t;return(null==(t=null==(e=i.botDetail)?void 0:e.detail)?void 0:t.exitCondition)||{top:{price:null,type:null},bottom:{price:null,type:null}}})),b=M((()=>k.value?y.value.bottom:y.value.top||{})),S=M((()=>k.value?y.value.top:y.value.bottom||{})),P=M((()=>i.botDetail.direction===Tr.NEUTRAL.value)),k=M((()=>i.botDetail.direction===Tr.SHORT.value)),L=M((()=>P.value?a("trading.bot.stopTopPrice"):a("trading.bot.takeProfitPrice"))),w=M((()=>P.value?a("trading.bot.stopBottomPrice"):a("trading.bot.stopLossPrice")));function D(e){const t=e.type===ui.MARK_PRICE?a("trading.mark"):a("trading.last");return{hasPrice:null!=e.price,text:e.price?Qt(e.price):a("t.notSet"),typeText:`(${t})`}}const O=M((()=>D(b.value))),I=M((()=>D(S.value))),_=M((()=>{var e,t;return(null==(t=null==(e=i.botDetail)?void 0:e.detail)?void 0:t.trailingStopInfo)||{}})),A=M((()=>null!=_.value.trailValue)),R=M((()=>{const{trailValue:e,trailValueType:t}=_.value;return t===Xi.DISTANCE?e?Qt(e):a("t.notSet"):e?`${e}%`:a("t.notSet")})),F=M((()=>
1{if(!_.value)return"";const{activationPriceChecked:e,activationPrice:t}=_.value;return e&&null!=t?`(${a("t.activationPrice")} ${Qt(t)})`:""}));function E(){v.value=!0}function B(e){r("updateTPSLSettings",{topPrice:e.top.price,bottomPrice:e.bottom.price,topTriggeredBy:e.top.type,bottomTriggeredBy:e.bottom.type})}async function z(){const e=await u(UM,{symbol:i.botDetail.symbol,direction:i.botDetail.direction,upperPrice:i.botDetail.detail.upperPrice,lowerPrice:i.botDetail.detail.lowerPrice,trailingStop:_.value.trailValue,trailingStopType:_.value.trailValueType,trailingStopActivationPriceChecked:_.value.activationPriceChecked,trailingStopActivationPrice:_.value.activationPrice,trailingStopActivationType:_.value.activationPriceType,isFromForm:!0});e&&r("updateTrailingStopSettings",e)}return(t,i)=>(o(),c(g,null,[l("div",FE,[l("div",{class:"header",onClick:i[0]||(i[0]=e=>f.value=!x(f))},[l("p",EE,m(t.$t("trading.bot.advancedSettings")),1),d(Ze,{class:C(["icon-chevron-down",{"is-open":x(f)}])},null,8,["class"])]),x(f)?(o(),c("div",BE,[l("div",zE,[l("div",$E,m(L.value),1),l("div",{class:"item-right",onClick:E},[l("span",{class:C(["price-text",{"has-price":O.value.hasPrice}])},m(O.value.text),3),O.value.hasPrice?(o(),c("span",NE,m(O.value.typeText),1)):h("",!0),l("div",UE,[d($e,{class:"icon-chevron-right"})])])]),l("div",HE,[l("div",VE,m(w.value),1),l("div",{class:"item-right",onClick:E},[l("span",{class:C(["price-text",{"has-price":I.value.hasPrice}])},m(I.value.text),3),I.value.hasPrice?(o(),c("span",WE,m(I.value.typeText),1)):h("",!0),l("div",qE,[d($e,{class:"icon-chevron-right"})])])]),P.value?h("",!0):(o(),c("div",GE,[l("div",KE,[d(ei,{tooltip:t.$t("trading.bot.trailingStop.tooltip")},{content:s((()=>[p(m(t.$t("futuresMain.trade.trailingStop")),1)])),_:1},8,["tooltip"])]),l("div",{class:"item-right",onClick:z},[l("div",QE,[l("div",jE,[A.value?(o(),n(Oi,{key:0,class:C(["icon-arrow-down",{short:k.value}])},null,8,["class"])):h("",!0),l("span",{class:C(["price-text",{"has-price":A.value}])},m(R.value),3)]),F.value?(o(),c("p",YE,m(F.value),1)):h("",!0)]),l("div",ZE,[d($e,{class:"icon-chevron-right"})])])]))])):h("",!0)]),d(gT,{visible:v.value,"onUpdate:visible":i[1]||(i[1]=e=>v.value=e),botDetail:e.botDetail,isFromForm:"",onConfirmUpdateSettings:B},null,8,["visible","botDetail"])],64))}},[["__scopeId","data-v-2479d3eb"]]),JE={class:"dialog-confirm-body"},eB={class:"title"},tB={class:"note"},iB={class:"info-area"},rB={class:"market-symbol-wrap"},aB={class:"tags"},nB={key:0,class:"info-row"},oB={class:"label"},sB={class:"value"},lB={class:"info-row"},uB={class:"label"},cB={class:"value"},dB={class:"info-row"},pB={class:"label"},hB={class:"value"},mB={class:"info-row"},gB={class:"label"},fB={class:"value"},vB={class:"info-row"},yB={class:"label"},bB={class:"value"},SB={class:"info-row"},CB={class:"label"},PB={class:"value"},kB={key:1,class:"info-line"},TB={key:2,class:"info-row"},MB={class:"label"},LB={class:"value"},wB={key:3,class:"info-row"},DB={class:"label"},OB={class:"value"},IB={key:4,class:"info-row trailing-stop-info-row"},xB={class:"label"},_B={class:"value trailing-stop-value"},AB={class:"flex-box items-center"},RB={key:0,class:"activation-price-text"},FB={key:5,class:"activation-price-text"},EB={class:"investment-wrapper"},BB={class:"investment"},zB=$n(A({__name:"FuturesGridConfirmDialog",props:ae({marketData:{},botDirection:{},botLeverage:{},priceFilter:{},isUnifiedWallet:{type:Boolean},walletMode:{},submitData:{},gridNumber:{},quoteCurrency:{},lowerProfitPercentage:{},higherProfitPercentage:{},topPriceLabel:{},topPriceText:{},bottomPriceLabel:{},bottomPriceText:{},stopCondition:{type:Boolean},topPrice:{},bottomPrice:{},trailValue:{},trailValueType:{},trailingStopActivationPriceText:{},isShort:{type:Boolean},isLoading:{type:Boolean},stepPrice:{},qtyPerOrder:{},investment:{},riskLimitLevel:{}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:ae(["confirm"],["update:visible"]),setup(e){const t=ne(e,"visible");return(e,i)=>{const r=a("BaseButton");return o(),n(mi,{visible:t.value,"onUpdate:visible":i[2]||(i[2]=e=>t.value=e),isNewStyle:""},{buttons:s((()=>[d(r,{type:"confirm",class:"primary block",size:"large",isLoading:e.isLoading,onClick:i[0]||(i[0]=t=>e.$emit("confirm"))},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["isLoading"]),l("div",{class:"cancel-btn",onClick:i[1]||(i[1]=e=>t.value=!1)},m(e.$t("t.cancel")),1)])),default:s((()=>[l("div",JE,[l("h2",eB,m(e.$t("trading.bot.futures.grid.create.confirm")),1),l("div",tB,m(e.$t("trading.bot.bot.create.review")),1),l("div",iB,[l("div",rB,[d(Rt,{name:e.marketData.baseCurrency,showName:!1,size:"24"},null,8,["name"]),l("span",null,m(e.marketData.symbol),1),l("div",aB,[d($f,{direction:e.botDirection,displayText:x(Qn)(e.botDirection)},null,8,["direction","displayText"]),d($f,{direction:e.botDirection,displayText:e.$filters.formatNumber(e.botLeverage,{postfix:"x"})},null,8,["direction","displayText"])])]),e.isUnifiedWallet?h("",!0):(o(),c("div",nB,[l("div",oB,m(e.$t("futuresMain.marginMode"))+":",1),l("div",sB,m(e.walletMode===x(ri).CROSS?e.$t("futuresMain.trade.cross"):e.$t("t.isolated")),1)])),l("div",lB,[l("div",uB,m(e.$t("strategy.priceRange")),1),l("div",cB,m(e.$filters.formatNumber(e.submitData.lowerPrice,e.priceFilter))+" - "+m(e.$filters.formatNumber(e.submitData.upperPrice,e.priceFilter))+" "+m(e.quoteCurrency),1)]),l("div",dB,[l("div",pB,m(e.$t("trading.bot.numberOfGrids")),1),l("div",hB,m(e.gridNumber),1)]),l("div",mB,[l("div",gB,m(e.$t("trading.bot.grid.profitPerGrid")),1),l("div",fB,m(e.lowerProfitPercentage)+"% - "+m(e.higherProfitPercentage)+"% ",1)]),l("div",vB,[l("div",yB,m(e.$t("trading.bot.stepPrice")),1),l("div",bB,m(e.stepPrice&&e.$filters.formatNumber(e.stepPrice,{preserveDecimals:!0}))+" "+m(e.quoteCurrency),1)]),l("div",SB,[l("div",CB,m(e.$t("t.qtyPerOrder")),1),l("div",PB,m(e.$filters.formatNumber(e.qtyPerOrder,{preserveDecimals:!0}))+" "+m(e.marketData.coin),1)]),d(ak,{class:"info-row",level:e.riskLimitLevel,symbol:e.marketData.symbol},null,8,["level","symbol"]),e.stopCondition||e.trailValue?(o(),c("div",kB)):h("",!0),e.topPrice?(o(),c("div",TB,[l("div",MB,m(e.topPriceLabel)+":",1),l("div",LB,m(e.topPriceText)+" "+m(e.quoteCurrency),1)])):h("",!0),e.bottomPrice?(o(),c("div",wB,[l("div",DB,m(e.bottomPriceLabel)+":",1),l("div",OB,m(e.bottomPriceText)+" "+m(e.quoteCurrency),1)])):h("",!0),e.trailValue?(o(),c("div",IB,[l("div",xB,m(e.$t("futuresMain.trade.trailingStop"))+":",1),l("div",_B,[l("div",AB,[e.trailValue?(o(),n(Oi,{key:0,class:C(["icon-arrow-down",{short:e.isShort}])},null,8,["class"])):h("",!0),l("span",{class:C(["price-text",{"has-price":e.trailValue}])},m(e.$filters.formatNumber(e.trailValue,2))+" "+m(e.trailValueType===x(Xi).DISTANCE?e.quoteCurrency:"%"),3)]),e.trailingStopActivationPriceText&&!e.isMobile?(o(),c("p",RB,m(e.trailingStopActivationPriceText),
11)):h("",!0)])])):h("",!0),e.trailingStopActivationPriceText&&e.isMobile?(o(),c("p",FB,m(e.trailingStopActivationPriceText),1)):h("",!0)])]),l("div",EB,[l("dl",BB,[l("dt",null,m(e.$t("t.investment")),1),l("dd",null,m(e.investment&&e.$filters.formatNumber(e.investment,2))+" "+m(e.quoteCurrency),1)]),l("p",null,m(e.$t("trading.bot.grid.confirm.autoTransfer",{amount:e.investment&&e.$filters.formatNumber(e.investment,2),currency:e.quoteCurrency})),1)])])),_:1},8,["visible"])}}}),[["__scopeId","data-v-8a61e411"]]),$B={class:"form-wrapper"},NB={class:"block"},UB={class:"flex-box items-center justify-between"},HB={class:"title"},VB={class:"tooltip-order-list"},WB={class:"block"},qB={class:"title"},GB={class:"setting-description"},KB={class:"block"},QB={class:"flex-box items-center justify-between"},jB={class:"title"},YB={class:"avbl"},ZB={class:"label"},XB={class:"value"},JB={class:"tooltip-order-list"},ez={class:"highlight"},tz={class:"highlight"},iz={key:0,class:"faq-footer"},rz=["href"],az={key:0,class:"adv-settings"},nz=$n(Object.assign({name:"FuturesGridForm"},{__name:"FuturesGridForm",props:{gridSide:{type:Number,required:!0}},setup(e){const t=e,i=k(),r=ue(),{t:u}=G(),g=Mr(),f=Nn(),v=Vn(),y=Ir(),{$sendEvent:b}=Ea(),P=ci(),w=$i.TOOLTIP_FUTURES_GRID1,O=$i.TOOLTIP_FUTURES_GRID2,I=$i.TOOLTIP_FUTURES_GRID3,_=$i.FUTURES_BOT_DISCLAIMER_SIGNED,{MAX_GRID_NUMBER:A}=Sr,R=se({settingOn:1,upperPrice:null,lowerPrice:null,upperRange:null,lowerRange:null,no:null,iniMargin:null}),E=se({stopCondition:!1,cancelOrders:!0,closePositions:!0,topPrice:null,bottomPrice:null,topTriggeredBy:sm.MARK,bottomTriggeredBy:sm.MARK,trailValue:null,trailValueType:Xi.DISTANCE,activationPriceChecked:!1,activationPrice:null,activationPriceType:ui.MARK_PRICE}),B=T(!1),z=T(!0),$=T(!1),N=T(!1),U=T({}),H=T(!1),V=T(!1),W=T(null),q=M((()=>i.state.lang)),K=M((()=>Ia(q.value,"FUTURES_GRID_TRADING_BOT_FAQ"))),Q=M((()=>i.state.loginState)),j=M((()=>i.state.isDefaultBrand)),Y=M((()=>i.state.orderBook.lastPrice)),X=M((()=>f.midPrice)),J=M((()=>i.state.futures.fixedCurrency)),ee=M((()=>i.state.futures.marketDetailMap)),te=M((()=>i.getters["futures/marketData"])),ie=M((()=>i.getters["futures/wallet"])),re=M((()=>i.getters["futures/marketDetail"])),ae=M((()=>i.getters["futures/currentFuturesMarkPrice"])),ne=M((()=>i.getters["futures/riskLimit"])),le=M((()=>i.getters["futures/currentSettleInCurrency"])),ce=M((()=>P.makerFee)),de=M((()=>i.getters["futures/walletLeverage"])),pe=M((()=>i.getters["futures/gridBotAvailableBalance"])),me=M((()=>i.getters["futures/marginMode"])),ge=M((()=>i.getters["futures/unifiedGridBotLeverage"])),fe=M((()=>i.getters.userName)),ve=M((()=>i.getters.isUnifiedWallet)),ye=M((()=>i.getters["futures/isMarketOffHours"])),be=M((()=>g.tradingBotInitData)),Se=M((()=>y.isMobile)),Ce=M((()=>t.gridSide===Tr.NEUTRAL.id)),Pe=M((()=>t.gridSide===Tr.LONG.id)),ke=M((()=>t.gridSide===Tr.SHORT.id)),Te=M((()=>J.value)),Me=M((()=>{var e;return(null==(e=re.value)?void 0:e.priceFilter)??2})),Le=M((()=>`${Qt(X.value,Me.value)} ${Te.value}`)),we=M((()=>Xn({upperPrice:De.value,lowerPrice:Oe.value,gridNumber:R.no,priceFilter:Me.value}))),De=M((()=>1===R.settingOn?R.upperPrice:X.value&&R.upperRange?S(X.value).times(S(100).plus(R.upperRange).div(100)).dp(Me.value,S.ROUND_DOWN).toNumber():null)),Oe=M((()=>1===R.settingOn?R.lowerPrice:X.value&&R.lowerRange?S(X.value).times(S(100).minus(R.lowerRange).div(100)).dp(Me.value,S.ROUND_DOWN).toNumber():null)),Ie=M((()=>{var e;return(null==(e=ee.value[te.value.symbol])?void 0:e.sizeFilter)||0})),xe=M((()=>null!==Ke.value?null:Ce.value?io({stepPrice:we.value,midPrice:X.value,gridNumber:R.no,lowerPrice:Oe.value,priceFilter:Me.value}):ro({stepPrice:we.value,upperPrice:De.value,lowerPrice:Oe.value,isLong:Pe.value,priceFilter:Me.value,gridNumber:R.no}))),_e=M((()=>S(R.iniMargin).times(Be.value).times(Ee()).div(xe.value).dp(Ie.value,S.ROUND_DOWN).toNumber())),Ae=M((()=>S(R.iniMargin).times(Be.value).toNumber())),Re=M((()=>{var e,t;return null==(t=null==(e=be.value.futures)?void 0:e.grid)?void 0:t.initialMarginAdjConf})),Fe=M((()=>{var e,t;return Number((null==(t=null==(e=be.value.futures)?void 0:e.grid)?void 0:t.maxRiskLimitLevel)||0)+1})),Ee=()=>Re.value?Ce.value?Re.value.neutral:Pe.value?Re.value.long:Re.value.short:null,Be=M((()=>ve.value?ge.value:de.value)),ze=M((()=>{const e=ao({sumOfGridPrices:xe.value,leverage:Be.value,marketDetail:re.value,adjConf:Ee()});return Math.max(e,Lr)})),$e=M((()=>{var e;return(null==(e=i.state.futures.riskLimitSettingMap)?void 0:e[te.value.symbol])||[]})),Ne=M((()=>{const{riskLimitValue:e}=$e.value.findLast((e=>e.maxLeverage>=Be.value))||{},t=ve.value?e??ne.value:ne.value;return no({sumOfGridPrices:xe.value,leverage:Be.value,marketDetail:re.value,gridNumber:R.no,riskLimitSize:t,adjConf:Ee(),isLong:Pe.value,upperPrice
1:De.value,markPrice:ae.value,stepPrice:we.value})})),Ue=M((()=>{const e=S(pe.value).dp(2,S.ROUND_DOWN).toNumber();return null===Ne.value?e:Math.min(e,Ne.value)})),{errorUpperPrice:He,errorLowerPrice:Ve,errorUpperRange:We,errorLowerRange:qe}=ZC({lowerPrice:Z(R,"lowerPrice"),upperPrice:Z(R,"upperPrice"),lowerRange:Z(R,"lowerRange"),upperRange:Z(R,"upperRange"),midPrice:X,priceFilter:Me}),Ge=M((()=>{var e;return to({upperPrice:De.value,lowerPrice:Oe.value,minPriceIncrement:null==(e=re.value)?void 0:e.minPriceIncrement,fee:ce.value})})),Ke=M((()=>{if(R.no){if(Ge.value&&R.no>Ge.value)return u("trading.bot.grid.errorGridNo1",{value:Ge.value});if(R.no>A||R.no<2)return""}return null})),Qe=M((()=>{if(R.iniMargin){if(R.iniMargin>pe.value)return"trading.bot.grid.errorIniMargin1";if(ze.value&&R.iniMargin<ze.value)return"trading.bot.grid.errorIniMargin2";if(R.iniMargin>Ue.value)return"trading.bot.grid.errorIniMargin3"}return null})),je=M((()=>E.topTriggeredBy.id===sm.MARK.id?ae.value:Y.value)),Ye=M((()=>E.bottomTriggeredBy.id===sm.MARK.id?ae.value:Y.value)),Ze=M((()=>Ce.value?u("trading.bot.stopTopPrice"):u("trading.bot.takeProfitPrice"))),Xe=M((()=>{const e=ke.value?U.value.bottomStop:U.value.topStop;return Qt(e,2)})),Je=M((()=>Ce.value?u("trading.bot.stopBottomPrice"):u("trading.bot.stopLossPrice"))),et=M((()=>{const e=ke.value?U.value.topStop:U.value.bottomStop;return Qt(e,2)})),tt=M((()=>{if(E.stopCondition){const e=E.topTriggeredBy.id===sm.MARK.id?u("futuresMain.openPosition.markPrice").toLowerCase():u("spot.order.market.lastPrice").toLowerCase(),t=Ce.value?u("trading.bot.stopTopPrice"):u("trading.bot.takeProfitPrice");if(S(E.topPrice).lte(je.value))return u("trading.bot.grid.errorStopTop1.v2",{price:t,priceType:e})}return null})),it=M((()=>
1{if(E.stopCondition){const e=E.bottomTriggeredBy.id===sm.MARK.id?u("futuresMain.openPosition.markPrice").toLowerCase():u("spot.order.market.lastPrice").toLowerCase(),t=Ce.value?u("trading.bot.stopBottomPrice"):u("trading.bot.stopLossPrice");if(S(E.bottomPrice).gte(Ye.value))return u("trading.bot.grid.errorStopBottom1.v2",{price:t,priceType:e})}return null})),rt=M((()=>Jn({stepPrice:we.value,upperPrice:De.value,fee:ce.value}))),at=M((()=>eo({stepPrice:we.value,lowerPrice:Oe.value,fee:ce.value}))),nt=M((()=>Se.value?"top":z.value?"left":"right")),ot=M((()=>$.value?Gy:"div")),st=M((()=>N.value?Gy:"div")),lt=M((()=>De.value&&Oe.value&&R.no&&R.iniMargin)),ut=M((()=>{const e=1===R.settingOn?!He.value&&!Ve.value:!We.value&&!qe.value,t=!E.stopCondition||!tt.value&&!it.value;return e&&t&&null===Ke.value&&null===Qe.value})),ct=M((()=>ve.value?me.value:ie.value.isCrossWallet?ri.CROSS:ri.ISOLATED)),dt=M((()=>Pe.value?Tr.LONG.value:ke.value?Tr.SHORT.value:Tr.NEUTRAL.value)),pt=M((()=>{var e;return{symbol:(null==(e=te.value)?void 0:e.symbol)||"",direction:dt.value,detail:{lowerPrice:R.lowerPrice,upperPrice:R.upperPrice,botStopAction:{cancelAllOrders:E.cancelOrders,closeAllPositions:E.closePositions},exitCondition:{top:{price:E.topPrice,type:E.topTriggeredBy.id===sm.MARK.id?ui.MARK_PRICE:ui.LAST_PRICE},bottom:{price:E.bottomPrice,type:E.bottomTriggeredBy.id===sm.MARK.id?ui.MARK_PRICE:ui.LAST_PRICE}},trailingStopInfo:{trailValue:E.trailValue,trailValueType:E.trailValueType,activationPriceChecked:E.activationPriceChecked,activationPrice:E.activationPrice,activationPriceType:E.activationPriceType}}}})),ht=M((()=>{const{activationPriceChecked:e,activationPrice:t,trailValue:i}=E;return i&&e&&null!=t?`(${u("t.activationPrice")} ${Qt(t,2)})`:""})),mt=M((()=>R.iniMargin&&Be.value&&xe.value&&Ee()?S(R.iniMargin).times(Be.value).times(Ee()).div(xe.value).toNumber():null)),gt=M((()=>
1mt.value&&R.no?S(mt.value).times(R.no).toNumber():null)),ft=M((()=>gt.value&&De.value&&we.value?Pe.value?S(gt.value).times(S(De.value).minus(we.value)).toNumber():S(gt.value).times(S.max(S(ae.value).times(Ii),De.value)).toNumber():null)),vt=M((()=>{if(!ft.value)return null;const{riskLevel:e}=$e.value.find((e=>e.riskLimitValue>=ft.value))||{riskLevel:$e.value.length};return Math.min(e,Fe.value)})),yt=e=>i.dispatch("messageCustom",e),bt=e=>{E.topPrice=e.topPrice,E.bottomPrice=e.bottomPrice,E.topTriggeredBy=lm(e.topTriggeredBy),E.bottomTriggeredBy=lm(e.bottomTriggeredBy),E.stopCondition=e.topPrice||e.bottomPrice||E.trailValue},St=M((()=>$e.value.find((e=>e.riskLevel===vt.value)))),{proxy:Ct}=he(),Pt=M((()=>{var e,t,i,r,a,n;return lt.value&&ut.value?xv({shareLib:Ct.$shareLib,wasmFunction:Fo,params:{newGridBot:{side:dt.value,investment:R.iniMargin,upperPrice:De.value,lowerPrice:Oe.value,gridNumber:R.no,midPrice:null==(e=X.value)?void 0:e.toString()},gridBotConfig:{leverage:Be.value,takerFee:null==(t=re.value.takerFees)?void 0:t.toString(),adjConf:null==(i=Ee())?void 0:i.toString(),fundingRate:null==(r=te.value.fundingRate)?void 0:r.toString(),maintenanceMarginRatio:null==(n=null==(a=St.value)?void 0:a.maintenanceMarginRate)?void 0:n.toString()}},defaultResult:{estimatedLongLiquidationPrice:"",estimatedShortLiquidationPrice:""}}):{estimatedLongLiquidationPrice:"",estimatedShortLiquidationPrice:""}})),kt=M((()=>S(Pt.value.estimatedLongLiquidationPrice).toFixed(Me.value,S.ROUND_UP))),Tt=M((()=>S(Pt.value.estimatedShortLiquidationPrice).toFixed(Me.value,S.ROUND_DOWN))),Mt=e=>{const{trailingStop:t,trailingStopType:i,trailingStopActivationPriceChecked:r,trailingStopActivationPrice:a,trailingStopActivationType:n}=e;E.trailValue=t||null,E.trailValueType=i,E.activationPriceChecked=r,E.activationPrice=a||null,E.activationPriceType=n,E.stopCondition=E.topPrice||E.bottomPrice||t},Lt=()=>{var e;e={from:ii,to:ve.value?ti:ie.value.activeWalletName},v.toggleTransferPopup(e)},wt=()=>{V.value=zi(_)},Dt=()=>{U.value={midPrice:X.value,upperPrice:De.value,lowerPrice:Oe.value,topStop:E.topPrice?S(E.topPrice).dp(Me.value,S.ROUND_DOWN).toNumber():null,bottomStop:E.bottomPrice?S(E.bottomPrice).dp(Me.value,S.ROUND_DOWN).toNumber():null,trailingStop:E.trailValue,trailingStopType:E.trailValueType,trailingStopActivationPriceChecked:E.activationPriceChecked,trailingStopActivationPrice:E.activationPrice,trailingStopActivationType:E.activationPriceType},B.value=!0},Ot=async()=>{const e={symbol:Ei(te.value.symbol),marketType:"FUTURES",botType:"GRID",config:{tradingDirection:dt.value,midPrice:String(U.value.midPrice),upperPrice:String(U.value.upperPrice),lowerPrice:String(U.value.lowerPrice),wallet:{mode:ct.value,leverage:String(Be.value)},gridNumber:Number(R.no),initialMargin:String(R.iniMargin),botStopAction:{cancelAllOrders:E.cancelOrders,closeAllPositions:E.closePositions},feeType:br.MAKER}};E.stopCondition&&(e.config.exitCondition={priceOutRange:{}},U.value.topStop&&(e.config.exitCondition.priceOutRange.top={price:String(U.value.topStop),type:E.topTriggeredBy.id===sm.MARK.id?ui.MARK_PRICE:ui.LAST_PRICE}),U.value.bottomStop&&(e.config.exitCondition.priceOutRange.bottom={price:String(U.value.bottomStop),type:E.bottomTriggeredBy.id===sm.MARK.id?ui.MARK_PRICE:ui.LAST_PRICE}),U.value.trailingStop&&(e.config.exitCondition.priceOutRange.trailingStop=DT(U.value.trailingStop,U.value.trailingStopType),e.config.exitCondition.priceOutRange.trailingStopType=U.value.trailingStopType,U.value.trailingStopActivationPrice&&(e.config.exitCondition.priceOutRange.trailingStopActivation={price:String(U.value.trailingStopActivationPrice),type:U.value.trailingStopActivationType}))),W.value&&(e.copyFromTradingBotId=W.value);try{H.value=!0,await Cr.createBot(e).then((()=>{b(Kr.EVENT_WEB_TRADING_BOT_GRID_BOT_CREATE_SUBMITTED,{payload:e,form:R,errorCode:null})})).catch((t=>{throw b(Kr.EVENT_WEB_TRADING_BOT_GRID_BOT_CREATE_SUBMITTED,{payload:e,form:R,errorCode:t.code}),t})),yt({subTitle:`[${te.value.symbol}]`,title:u("trading.bot.grid.successTitle"),success:!0}),Bt(e),It()}catch({code:t,data:i}){const e=`response-code.${t}`;let r=Ui(e)?u(e):`${u("defaultError")} [code: ${t}]`,a=u("trading.bot.grid.errorTitle"),n=`[${te.value.symbol}]`;t===Pr.MAX_BOTS_EXCEEDED&&(r=u(e)),t===Pr.USER_PERMISSION_DENIED&&(a=u(e),n="",r=""),t===Pr.TRADING_BOT_EXCEED_MAX_MARGIN_ERROR&&(a="",n=u("trading.copywise.exceedMax.title.v2"),r=u("trading.bot.grid.exceedMax.text",{maxNumber:i.maxInvestment,currency:Te.value})),t===Pr.TRADING_BOT_INSUFFICIENT_MARGIN_ERROR&&(a="",n=u("trading.copywise.belowMin.title"),r=u("trading.copywise.belowMin.text",{minNumber:i.minInvestment,currency:Te.value})),t===Pr.OFF_HOURS_RESTRICTED&&(a="",n=u("trading.copywise.offHours.bot.text"),r=""),yt({subTitle:n,title:a,body:r,error:!0})}finally{H.value=!1,B.value=!1}},It=()=>{R.upperPrice=null,R.lowerPrice=null,R.upperRange=null,R.lowerRange=null,R.no=null,R.iniMargin=null,E.topPrice=null,E.bottomPrice=null,E.topTriggeredBy=sm.MARK,E.bottomTriggeredBy=sm.MARK,E.stopCondition=!1,E.cancelOrders=!0,E.closePositions=!0,E.trailValue=null,E.trailValueType=Xi.DISTANCE,E.activationPriceChecked=!1,E.activationPrice=null,E.activationPriceType=ui.MARK_PRICE},xt=()=>{$.value=!0},_t=()=>{oe((()=>{Rt(1e3),N.value=!0}))},At=()=>{Rt(0)},Rt=(e=0)=>{const t=document.querySelector(".order-book-form .form-wrapper");t&&(t.scrollTop=e)},Ft=()=>{Bi(_),V.value=!0},Et=e=>{""!==e&&Number(e)<2&&(R.no=2)},Bt=e=>{const{symbol:t,config:i}=e,{tradingDirection:r=Ba.NEUTRAL}=i,a=E.stopCondition&&(U.value.topStop||U.value.bottomStop);Li(wi.TRADING_BOT_GRID_BOT_CREATED,{s1:r.toLowerCase(),s2:"futures",s3:t,s4:1===R.settingOn?"number":"percentage",s5:a?"true":"false",s6:E.topTriggeredBy.id===sm.MARK.id?"mark":"last",s7:E.bottomTriggeredBy.id===sm.MARK.id?"mark":"last",s8:E.closePositions?"true":"false",s9:E.cancelOrders?"true":"false"})};return D((()=>R.settingOn),(()=>{R.upperPrice=null,R.lowerPrice=null,R.upperRange=null,R.lowerRange=null})),D(fe,(()=>{wt()})),D((()=>E.closePositions),(e=>{e&&(E.cancelOrders=!0)})),D((()=>
1t.gridSide),(()=>{E.topPrice=null,E.bottomPrice=null,E.stopCondition=!1,E.trailValue=null,E.trailValueType=Xi.DISTANCE,E.activationPriceChecked=!1,E.activationPrice=null,E.activationPriceType=ui.MARK_PRICE})),zi(w)&&!zi(O)?xt():zi(O)&&!zi(I)&&_t(),wt(),(()=>{const{tradingBot:e,copyFromTradingBotId:t}=r.params;if(!e||!e.config)return;t&&(W.value=t);const{config:i}=e;R.upperPrice=i.upperPrice,R.lowerPrice=i.lowerPrice,R.no=Math.min(i.gridNumber,A)})(),L((()=>{(()=>{var e;const{x:t}=(null==(e=document.querySelector(".vue-grid-item .order-book-form"))?void 0:e.getBoundingClientRect())||{};void 0!==t&&t<=300&&(z.value=!1)})()})),(t,i)=>{const r=a("router-link"),u=a("i18n-t"),g=a("BaseButton");return o(),c("div",$B,[ye.value?(o(),n(YA,{key:0,"order-type":"futures-grid"})):h("",!0),d(x(Gy),{title:t.$t("trading.bot.grid.setRange"),placement:nt.value,mask:"",storageKey:x(w),onGotIt:xt},{tooltip:s((()=>[i[10]||(i[10]=l("img",{class:"w-100",src:"/static/img/F6DG0DyM.png",alt:"tutorial-img"},null,-1)),l("p",null,m(t.$t("trading.bot.grid.description")),1)])),default:s((()=>[l("div",NB,[l("div",UB,[l("div",HB,m(t.$t("trading.bot.rangeSettings")),1)]),d(ZP,{lowerPrice:R.lowerPrice,"onUpdate:lowerPrice":i[0]||(i[0]=e=>R.lowerPrice=e),lowerRange:R.lowerRange,"onUpdate:lowerRange":i[1]||(i[1]=e=>R.lowerRange=e),upperPrice:R.upperPrice,"onUpdate:upperPrice":i[2]||(i[2]=e=>R.upperPrice=e),upperRange:R.upperRange,"onUpdate:upperRange":i[3]||(i[3]=e=>R.upperRange=e),settingOn:R.settingOn,"onUpdate:settingOn":i[4]||(i[4]=e=>R.settingOn=e),errorUpperPrice:x(He),errorLowerPrice:x(Ve),errorUpperRange:x(We),errorLowerRange:x(qe),priceFilter:Me.value,quoteCurrency:Te.value,computedLowerPrice:Oe.value,computedUpperPrice:De.value,midPriceText:Le.value},null,8,["lowerPrice","lowerRange","upperPrice","upperRange","settingOn","errorUpperPrice","errorLowerPrice","errorUpperRange","errorLowerRange","priceFilter","quoteCurrency","computedLowerPrice","computedUpperPrice","midPriceText"])])])),_:1},8,["title","placement","storageKey"]),(o(),n(F(ot.value),{placement:nt.value,mask:"",title:t.$t("trading.bot.grid.gridSettings"),storageKey:x(O),onGotIt:_t},{tooltip:s((()=>[i[11]||(i[11]=l("img",{class:"w-100",src:"/static/img/CuXTX1_Z.png",alt:"tutorial-img"},null,-1)),l("ol",VB,[l("li",null,m(t.$t("trading.bot.grid.gsTooltip1")),1),l("li",null,m(t.$t("trading.bot.grid.gsTooltip2")),1),l("li",null,m(t.$t("trading.bot.grid.gsTooltip3")),1)])])),default:s((()=>[l("div",null,[l("div",WB,[l("div",qB,m(t.$t("trading.bot.gridsSetting")),1),d(x(Wn),{value:R.no,"onUpdate:value":i[5]||(i[5]=e=>R.no=e),label:t.$t("trading.bot.noOfGrids"),type:"number",min:1,max:x(A),step:1,errorShown:null!==Ke.value,errorMsg:Ke.value,maxDecimalPlaces:0,placeholder:`2 - ${x(A)}`,onBlur:Et},{prepend:s((()=>[d(x(ei),{content:t.$t("trading.bot.noOfGrids")},{tooltip:s((()=>[l("p",null,m(t.$t("trading.bot.noOfGridsInfo")),1)])),_:1},8,["content"])])),append:s((()=>[p(m(t.$t("trading.bot.grids")),1)])),_:1},8,["value","label","max","errorShown","errorMsg","placeholder"]),l("div",GB,[l("div",null,m(t.$t("trading.bot.grid.profitPerGrid"))+": "+m(`${rt.value}%`)+" ~ "+m(`${at.value}%`),1)])]),l("div",KB,[l("div",QB,[l("div",jB,m(t.$t("trading.bot.investment")),1),l("div",YB,[l("div",ZB,m(t.$t("trading.bot.avbl"))+":",1),l("div",XB,m(t.$filters.formatNumber(pe.value))+" "+m(le.value),1),d(x(Xd),{onTransferClick:Lt})])]),d(x(Wn),{value:R.iniMargin,"onUpdate:value":i[6]||(i[6]=e=>R.iniMargin=e),label:t.$t("futuresMain.changeRiskLimit.initialMargin"),enableThousandSeparator:"",min:0,max:Ue.value,step:.01,errorShown:!!Qe.value,maxDecimalPlaces:2,placeholder:`⥠${ze.value||""}`},{prepend:s((()=>[d(x(ei),{content:t.$t("futuresMain.changeRiskLimit.initialMargin")},{tooltip:s((()=>[l("p",null,m(t.$t("trading.bot.iniMarginInfo")),1)])),_:1},8,["content"])])),append:s((()=>[p(m(le.value),1)])),errorMsg:s((()=>[Qe.value?(o(),n(u,{key:0,keypath:Qe.value},{deposit:s((()=>[d(r,{to:{name:x(ai).DEPOSIT,params:{lang:q.value}}},{default:s((()=>[p(m(t.$t("t.deposit").toLowerCase()),1)])),_:1},8,["to"])])),value:s((()=>[p(m(ze.value),1)])),_:1},8,["keypath"])):h("",!0)])),_:1},8,["value","label","max","errorShown","placeholder"])])])])),_:1},40,["placement","title","storageKey"])),d(bk,{stepPrice:we.value,qtyPerOrder:_e.value,coin:te.value.coin,currentSettleInCurrency:le.value,gridSide:e.gridSide,investmentAfterLeverage:Ae.value,lowerPrice:Oe.value,upperPrice
1:De.value,estLongLiqPrice:kt.value,estShortLiqPrice:Tt.value,riskLimitLevel:vt.value},null,8,["stepPrice","qtyPerOrder","coin","currentSettleInCurrency","gridSide","investmentAfterLeverage","lowerPrice","upperPrice","estLongLiqPrice","estShortLiqPrice","riskLimitLevel"]),(o(),n(F(st.value),{placement:nt.value,mask:"",title:t.$t("trading.bot.stopConditions"),buttonText:t.$t("trading.bot.getStart"),storageKey:x(I),onGotIt:At},{tooltip:s((()=>[l("ol",JB,[d(u,{keypath:"trading.bot.grid.scTooltip1",tag:"li"},{option:s((()=>[l("span",ez,m(t.$t("trading.bot.cancelOrderOnStop")),1)])),_:1}),d(u,{keypath:"trading.bot.grid.scTooltip2",tag:"li"},{option:s((()=>[l("span",tz,m(t.$t("trading.bot.cancelPositionOnStop")),1)])),_:1})])])),footer:s((()=>[j.value?(o(),c("div",iz,[l("a",{class:"faq-btn",href:K.value,target:"_blank"},[d(x(cs)),l("span",null,m(t.$t("trading.bot.grid.faq")),1)],8,rz)])):h("",!0)])),default:s((()=>[d(x(XE),{botDetail:pt.value,onUpdateTPSLSettings:bt,onUpdateTrailingStopSettings:Mt},null,8,["botDetail"]),ve.value?h("",!0):(o(),c("div",az,[d(x(ei),{tooltip:t.$t("trading.bot.grid.closeAndCancelTooltip"),hasCursorQuestion:!1},{content:s((()=>[d(x(Ko),{value:E.cancelOrders,"onUpdate:value":i[7]||(i[7]=e=>E.cancelOrders=e),disabled:E.closePositions},{default:s((()=>[p(m(t.$t("trading.bot.cancelOrderOnStop")),1)])),_:1},8,["value","disabled"])])),_:1},8,["tooltip"]),d(x(ei),{tooltip:t.$t("trading.bot.grid.closeAndCancelTooltip"),hasCursorQuestion:!1},{content:s((()=>[d(x(Ko),{value:E.closePositions,"onUpdate:value":i[8]||(i[8]=e=>E.closePositions=e)},{default:s((()=>[p(m(t.$t("trading.bot.cancelPositionOnStop")),1)])),_:1},8,["value"])])),_:1},8,["tooltip"])])),d(g,{type:"confirm",class:C(["block create-btn",{primary:Ce.value,green:Pe.value,red:ke.value}]),disabled:!Q.value||!V.value||!lt.value||!ut.value||ye.value,onClick:Dt},{default:s((()=>[p(m(t.$t("msg.create"))+" ("+m(Pe.value?t.$t("t.long"):ke.value?t.$t("t.short"):t.$t("t.neutral"))+") ",1)])),_:1},8,["class","disabled"])])),_:1},40,["placement","title","buttonText","storageKey"])),Q.value&&!V.value?(o(),n(x(RE),{key:1,marketType:x(Ra).FUTURES,onConfirm:Ft},null,8,["marketType"])):h("",!0),d(zB,{visible:B.value,"onUpdate:visible":i[9]||(i[9]=e=>B.value=e),marketData:te.value,botDirection:dt.value,botLeverage:Be.value,priceFilter:Me.value,isUnifiedWallet:ve.value,walletMode:ct.value,submitData:U.value,gridNumber:R.no,quoteCurrency:Te.value,lowerProfitPercentage:rt.value,higherProfitPercentage:at.value,topPriceLabel:Ze.value,topPriceText:Xe.value,bottomPriceLabel:Je.value,bottomPriceText:et.value,stopCondition:E.stopCondition,topPrice:E.topPrice,bottomPrice:E.bottomPrice,trailValue:E.trailValue,trailValueType:E.trailValueType,trailingStopActivationPriceText:ht.value,isShort:ke.value,isLoading:H.value,stepPrice:we.value,qtyPerOrder:_e.value,investment:R.iniMargin,riskLimitLevel:vt.value,onConfirm:Ot},null,8,["visible","marketData","botDirection","botLeverage","priceFilter","isUnifiedWallet","walletMode","submitData","gridNumber","quoteCurrency","lowerProfitPercentage","higherProfitPercentage","topPriceLabel","topPriceText","bottomPriceLabel","bottomPriceText","stopCondition","topPrice","bottomPrice","trailValue","trailValueType","trailingStopActivationPriceText","isShort","isLoading","stepPrice","qtyPerOrder","investment","riskLimitLevel"])])}}}),[["__scopeId","data-v-36cc3989"]]),oz={class:"tabs-wrapper"},sz={class:"tab-tooltip-content"},lz={class:"tab-tooltip-content"},uz={class:"tab-tooltip-content"};const cz=$n({name:"FuturesGridTypeTabs",components:{Tooltip:ei},props:{value:{type:Number,required:!0}},emits:["update:value"],data:()=>({GRID_SIDES:Tr}),methods:{handleClick(e){this.$emit("update:value",e)}}},[["render",function(e,t,i,r,n,u){const p=a("Tooltip");return o(),c("div",oz,[d(p,{class:C(["tab long",{active:i.value===n.GRID_SIDES.LONG.id}]),tooltip:e.$t("trading.futures.grid.long.tooltip"),disable:e.isMobile,placement:"bottom",onClick:t[0]||(t[0]=e=>u.handleClick(n.GRID_SIDES.LONG.id))},{content:s((()=>[l("div",sz,m(e.$t("t.long")),1)])),_:1},8,["class","tooltip","disable"]),d(p,{class:C(["tab short",{active:i.value===n.GRI
1D_SIDES.SHORT.id}]),tooltip:e.$t("trading.futures.grid.short.tooltip"),disable:e.isMobile,placement:"bottom",onClick:t[1]||(t[1]=e=>u.handleClick(n.GRID_SIDES.SHORT.id))},{content:s((()=>[l("div",lz,m(e.$t("t.short")),1)])),_:1},8,["class","tooltip","disable"]),d(p,{class:C(["tab",{active:i.value===n.GRID_SIDES.NEUTRAL.id}]),tooltip:e.$t("trading.futures.grid.neutral.tooltip"),disable:e.isMobile,placement:"bottom",onClick:t[2]||(t[2]=e=>u.handleClick(n.GRID_SIDES.NEUTRAL.id))},{content:s((()=>[l("div",uz,m(e.$t("t.neutral")),1)])),_:1},8,["class","tooltip","disable"])])}],["__scopeId","data-v-c85c1a19"]]),dz={name:"HedgeModeTypeTabList",props:{value:{type:String,default:ka.OPEN}},emits:["update:value"],data:()=>({HEDGE_MODE_TYPES:ka}),computed:{...b(["isDefaultBrand","lang"]),tabs(){return[{id:ka.OPEN,lang:this.$t("trading.open")},{id:ka.CLOSE,lang:this.$t("trading.close")}]}},methods:{handleClick(e){this.$emit("update:value",e)}}},pz={class:"tabs-wrapper"},hz=["onClick"];const mz=$n(dz,[["render",function(e,t,i,r,a,n){return o(),c("div",pz,[(o(!0),c(g,null,R(n.tabs,(e=>(o(),c("div",{key:e.id,class:C(["tab",{active:i.value===e.id}]),onClick:t=>n.handleClick(e.id)},[l("span",null,m(e.lang),1)],10,hz)))),128))])}],["__scopeId","data-v-02f5c7f9"]]),{enableFuturesTradingBot:gz}=mt;const fz=$n({name:"FuturesOrder",components:{LimitOrderForm:qA,MarketOrder:sR,IndexOrder:hR,OcoOrderForm:MR,TradingTypeTab:oF,TradingTypeSelect:dF,FuturesMarginModeSwitcher:FF,TwapOrderForm:LE,FuturesGridTypeTabs:cz,HedgeModeTypeTabList:mz,FuturesGridForm:nz,BrandDialog:pi,InsufficientBalance:VR,DepositRequired:tF},inject:["adjustOrderFormHeight"],props:{boxFilled:{type:Boolean,default:!1}},data:()=>({TRADING_TYPES:ni,tradingType:0,balanceConfig:{visible:!1,requiredmentMemo:0},depositConfig:{visible:!1},transferConfig:{},infoStp:ni.LIMIT,advancedStp:ni.LIMIT_STOP,tradeType:Da.FUTURES,gridSide:Tr.LONG.id,hedgeModeType:ka.OPEN}),computed:{...b(["lang","cancelAllRequestId","currentOrder","loginState","isUnifiedWallet"]),...b("futures",["notification"]),...y(Vn,["showTransferPopup","hideInsufficientBalancePopup"]),...y(pt,["isLeaderMode"]),...U(["getAccountValue","futuresBalance","isUnifiedWallet"]),...U("futures",{futuresWallet:"wallet",isHedgeMode:"isHedgeMode",isOneWayMode:"isOneWayMode",marginMode:"marginMode"}),...ie(Ge),isFutures(){return this.tradeType===Da.FUTURES},isGrid(){return this.tradeType===Da.GRID},currentMarket(){return this.$route.params.id},advancedTypeOptions(){const e=rF(this.$t);return zt.futureAdvancedTradingTypeOptions.map((t=>({key:t,value:e[t]}))).filter((e=>{if(e.key===ni.TWAP){if(this.isLeaderMode)return!1;if(this.isHedgeMode)return!1;if(this.isUnifiedWallet&&this.marginMode===ri.ISOLATED)return!1}return!0}))},isAdvancedTradingTypeSelected(){return this.infoStp===ni.ADVANCED},formComponent(){const e={[ni.LIMIT]:qA,[ni.LIMIT_STOP]:qA,[ni.LIMIT_TAKE_PROFIT]:qA,[ni.MARKET]:sR,[ni.MARKET_STOP]:sR,[ni.MARKET_TAKE_PROFIT]:sR,[ni.MARKET_TRAILING_STOP]:sR,[ni.OCO]:MR,[ni.INDEX]:hR,[ni.TWAP]:LE},t=e[this.infoStp],i=e[this.advancedStp];return t||i||null},showGridTypeTab(){if(!this.isUnifiedWallet)return gz;const e=this.marginMode===ri.CROSS;return gz&&this.isOneWayMode&&e}},watch:{notification:{handler(e){const t=e.status;if(this.hideInsufficientBalancePopup||this.showTransferPopup||8!==t){if(6===t&&this.cancelAllRequestId===e.requestId)return!1}else{this.getAccountValue("available")+this.futuresBalance()<.01?this.depositConfig.visible=!0:(this.balanceConfig.visible=!0,this.balanceConfig.requiredmentMemo=e.memo)}},deep:!0},currentMarket:{handler(){this.trackOrderTypeClicked(!0)},flush:"post"},marginMode(e){this.isUnifiedWallet&&e===ri.ISOLATED&&(this.tradeType=Da.FUTURES,this.infoStp=ni.LIMIT)},advancedTypeOptions:{handler(e,t){t&&e[0].key===t[0].key||(this.advancedStp=e[0].key)},immediate:!0},tradeType:{handler(e){this.setIsShowGridBotForm(e===Da.GRID)},immediate:!0},isLeaderMode(e){e&&this.isGrid&&(this.tradeType=Da.FUTURES,this.infoStp=ni.LIMIT)},"futuresSettingStore.forceOrderFormToGridForm"(e){e&&(this.tradeType=Da.GRID,this.$refs.futuresOrderRef.scrollIntoView({behavior:"smooth"}),this.futuresSettingStore.setForceOrderFormToGridForm(!1))}},created(){this.trackOrderTypeClicked(!0),this.futuresSettingStore.getOrderFormSettings();
1const{tradeType:e,direction:t=Tr.NEUTRAL.value}=history.state;e&&(this.tradeType=e,this.gridSide=Object.values(Tr).find((e=>t===e.value)).id)},methods:{...f(Vn,["setEnableOrderFormTpSl","setIsShowGridBotForm","toggleTransferPopup"]),openWallet(){this.depositConfig.visible=!1,this.$router.push({path:"/"+this.lang+"/wallets"})},setTransferConfig(e,t){this.transferConfig={from:e,to:t}},openFuturesTransferPopup(){this.balanceConfig.visible=!1;const e=this.isUnifiedWallet?ti:this.currentOrder.nextStepWalletName||this.transferConfig.to||this.futuresWallet.activeWalletName;this.toggleTransferPopup({from:this.transferConfig.from,to:e})},cancelBalance(){this.balanceConfig.visible=!1},cancelDeposit(){this.depositConfig.visible=!1},trackOrderTypeClicked(e=!1){let t=this.infoStp;this.infoStp===ni.ADVANCED&&(t=this.advancedStp),Li(wi.TRADING_ORDER_TYPE_CLICKED,{s1:t,s2:"futures",s3:Ei(this.currentMarket),s4:"-",s5:e?"true":"false"})},handleTabSelect(e){this.infoStp=e,e===ni.ADVANCED?this.futuresSettingStore.setOrderFormType(this.advancedStp):this.futuresSettingStore.setOrderFormType(e),this.trackOrderTypeClicked(),this.adjustOrderFormHeight(),this.setEnableOrderFormTpSl(!1)},handleTradingTypeSelect(e){this.advancedStp=e,this.futuresSettingStore.setOrderFormType(e),this.trackOrderTypeClicked(),this.adjustOrderFormHeight(),this.setEnableOrderFormTpSl(!1)}}},[["render",function(e,t,i,r,l,u){const f=a("FuturesMarginModeSwitcher"),v=a("HedgeModeTypeTabList"),y=a("TradingTypeTab"),b=a("TradingTypeSelect"),S=a("FuturesGridTypeTabs"),P=a("FuturesGridForm"),k=a("InsufficientBalance"),T=a("BrandButton"),M=a("BrandDialog"),L=a("DepositRequired");return o(),c("div",{ref:"futuresOrderRef",class:C(["futures-order brand-card border-box flex-box flex-column card-shell order-book-form",{"box-fill":i.boxFilled}])},[e.loginState?(o(),n(f,{key:0,tradeType:l.tradeType,"onUpdate:tradeType":t[0]||(t[0]=e=>l.tradeType=e),class:"card-shell__header"},null,8,["tradeType"])):h("",!0),u.isFutures&&e.isHedgeMode?(o(),n(v,{key:1,value:l.hedgeModeType,"onUpdate:value":t[1]||(t[1]=e=>l.hedgeModeType=e)},null,8,["value"])):h("",!0),u.isFutures?(o(),c(g,{key:2},[d(y,{active:l.infoStp,onOnSelect:u.handleTabSelect},null,8,["active","onOnSelect"]),u.isAdvancedTradingTypeSelected?(o(),n(b,{key:0,name:"tradingtypeSelect",value:l.advancedStp,options:u.advancedTypeOptions,onChange:u.handleTradingTypeSelect},null,8,["value","options","onChange"])):h("",!0)],64)):h("",!0),u.isGrid?(o(),n(S,{key:3,value:l.gridSide,"onUpdate:value":t[2]||(t[2]=e=>l.gridSide=e)},null,8,["value"])):h("",!0),u.isFutures?(o(),n(F(u.formComponent),{key:e.futuresSettingStore.orderFormType,infoStp:u.isAdvancedTradingTypeSelected?l.advancedStp:l.infoStp,marketOrderType:l.infoStp,hedgeModeType:l.hedgeModeType},null,8,["infoStp","marketOrderType","hedgeModeType"])):(o(),n(P,{key:5,gridSide:l.gridSide},null,8,["gridSide"])),d(M,{visible:l.balanceConfig.visible,"onUpdate:visible":t[3]||(t[3]=e=>l.balanceConfig.visible=e),width:"412px",idPrefix:"insufficient_balance_dialog"},{body:s((()=>[d(k,{config:l.balanceConfig,setTransferConfig:u.setTransferConfig},null,8,["config","setTransferConfig"])])),footer:s((()=>[d(T,{class:"flex-1",type:"cancel",size:"big",onClick:u.cancelBalance},{default:s((()=>[p(m(e.$t("msg.cancel")),1)])),_:1},8,["onClick"]),d(T,{class:"flex-1",type:"confirm",size:"big",onClick:u.openFuturesTransferPopup},{default:s((()=>[p(m(e.$t("futuresMain.insufficientBalance.transfer")),1)])),_:1},8,["onClick"])])),_:1},8,["visible"]),d(M,{visible:l.depositConfig.visible,"onUpdate:visible":t[4]||(t[4]=e=>l.depositConfig.visible=e),width:"412px",idPrefix:"deposit_required_dialog"},{body:s((()=>[d(L)])),footer:s((()=>[d(T,{class:"flex-1",type:"cancel",onClick:u.cancelDeposit},{default:s((()=>[p(m(e.$t("msg.cancel")),1)])),_:1},8,["onClick"]),d(T,{class:"flex-1",type:"confirm",onClick:u.openWallet},{default:s((()=>[p(m(e.$t("futuresMain.depositRequired.deposit")),1)])),_:1},8,["onClick"])])),_:1},8,["visible"])],2)}],["__scopeId","data-v-5b384789"]]),vz={class:"scroll-selector"},yz=["onClick"],bz="transform 0.3s ease-in-out, width 0.3s ease-in-out, opacity 0.3s ease-in-out",Sz=$n(A({__name:"index",props:ae({list:{},isRoughCompare:{type:Boolean}},{value:{type:[String,Number],default:""},valueModifiers:{}}),emits:["update:value"],setup(e){const t=T(),i=T(!1),r=T(!1),a=T(!1),n=T(!1),s=T({transform:"translateX(0px)",width:"0px",opacity:"0",transition:bz}),u=ne(e,"value"),p=e;function h(){if(t.value){const e=t.value.clientWidth,r=t.value.scrollWidth;i.value=r<=e}}function f(){if(t.value){const{scrollLeft:e,scrollWidth:i,clientWidth:n}=t.value;r.value=e>0,a.value=e+n<i-1}}D((()=>p.list),(()=>{h(),f(),M(),k()})),D((()=>u.value),(()=>{M(),k()})),L((()=>{h(),f(),M(),k(),t.value&&(t.value.addEventListener("scroll",v),window.addEventListener("resize",S))}
1)),fe((()=>{t.value&&(t.value.removeEventListener("scroll",v),window.removeEventListener("resize",S))}));const v=Ne((function(){f()}),100);function y(e){t.value&&t.value.scrollBy({left:"pre"===e?-60:60,behavior:"smooth"})}function b(e){return p.isRoughCompare?Number(e.value)===Number(u.value):e.value===u.value}const S=Ne(k,100);function k(){oe((()=>{if(!t.value||!u.value)return;const e=function(){if(!t.value||!p.list.length)return null;const e=u.value;let i=null,r=1/0;const a=t.value.querySelectorAll(".scrollable-item");return p.list.forEach(((t,n)=>{const o=a[n];if(!o)return;let s;if("number"==typeof e&&"number"==typeof t.value)s=Math.abs(Number(t.value)-Number(e));else if("number"==typeof e&&"string"==typeof t.value){const i=Number(t.value);s=isNaN(i)?1/0:Math.abs(i-Number(e))}else if("string"==typeof e&&"number"==typeof t.value){const i=Number(e);s=isNaN(i)?1/0:Math.abs(Number(t.value)-i)}else s=t.value===e?0:1;s<r&&(r=s,i=o)})),i}();if(!e)return;const i=t.value,r=i.clientWidth,a=e.offsetLeft+e.offsetWidth/2-r/2;M(!1),n.value=!0,i.scrollTo({left:a,behavior:"smooth"}),setTimeout((()=>{n.value=!1}),500)}))}function M(e=!1){if(!t.value||!u.value)return void(s.value={transform:"translateX(0px)",width:"0px",opacity:"0",transition:e?"none":bz});const i=function(){if(!t.value||!p.list.length)return null;const e=u.value,i=t.value.querySelectorAll(".scrollable-item");for(let t=0;t<p.list.length;t++){const r=p.list[t],a=i[t];if(!a)continue;if(p.isRoughCompare?Number(r.value)===Number(e):r.value===e)return a}return null}();if(!i)return void(s.value={transform:"translateX(0px)",width:"0px",opacity:"0",transition:"none"});const r=i.offsetLeft,a=i.offsetWidth;s.value={transform:`translateX(${r}px)`,width:`${a}px`,opacity:"1",transition:e?"none":bz}}return(e,n)=>(o(),c("div",vz,[l("div",{ref_key:"scrollableArea",ref:t,class:C(["scrollable-area",{"center-content":i.value}])},[(o(!0),c(g,null,R(e.list,(e=>(o(),c("div",{key:e.value,class:C(["scrollable-item",{active:b(e)}]),onClick:t=>function(e){u.value=e.value}(e)},m(e.label),11,yz)))),128)),l("div",{ref:"indicator",class:"sliding-indicator",style:P(s.value)},null,4)],2),B(l("div",{class:"move-btn pre",onClick:n[0]||(n[0]=e=>y("pre"))},[d($e)],512),[[N,r.value]]),B(l("div",{class:"move-btn next",onClick:n[1]||(n[1]=e=>y("next"))},[d($e)],512),[[N,a.value]])]))}}),[["__scopeId","data-v-bc18f2d6"]]);const Cz=$n({name:"IconMinus3",components:{Icon:Ee}},[["render",function(e,t,i,r,u,c){const d=a("Icon");return o(),n(d,{width:"20",height:"20",viewBox:"0 0 20 20"},{default:s((()=>t[0]||(t[0]=[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20 9.6875C20 9.16973 19.5803 8.75 19.0625 8.75L0.9375 8.75C0.419734 8.75 -1.13162e-08 9.16973 0 9.6875C1.13162e-08 10.2053 0.419734 10.625 0.9375 10.625L19.0625 10.625C19.5803 10.625 20 10.2053 20 9.6875Z"},null,-1)]))),_:1,__:[0]})}]]),Pz={class:"body-wrapper"},kz={key:0,class:"warning-wrapper"},Tz={class:"warning-text"},Mz={class:"symbol-wrapper"},Lz={class:"symbol-name"},wz={class:"input-wrapper"},Dz={class:"input-label"},Oz={class:"input-block"},Iz={class:"input-value"},xz={class:"slider-wrapper"},_z={class:"result-wrapper"},Az={class:"result-item"},Rz={class:"title"},Fz={class:"label"},Ez={class:"value"},Bz={class:"result-divider"},zz={class:"circle"},$z={class:"result-item"},Nz={class:"title new"},Uz={class:"label"},Hz={class:"value"},Vz={class:"description-wrapper"},Wz=["href"],qz={class:"btn-wrapper"},Gz=$n(A({__name:"NewEditRiskLimitDialog",props:ae({recommend:{type:Number,default:null},isShowError:{type:Boolean,default:!1},symbol:{type:String,default:null}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(e){const t=ne(e,"visible"),i=e,r=k(),{t:u}=G(),f=pt(),v=M((()=>{var e,t;if(i.symbol){const a=(null==(t=null==(e=r.state.futures.marketMarginMap[i.symbol])?void 0:e[0])?void 0:t.riskLimitLevel)||za;return(r.getters["futures/riskLimitSetting"]||[]).find((e=>e.riskLevel===a))}return r.getters["futures/currentRiskLimitData"]})),y=M((()=>{var e;return(null==(e=v.value)?void 0:e.riskLevel)||1})),b=T(i.recommend||y.value),P=M((()=>i.symbol?r.state.futures.marketMap[i.symbol]||{}:r.getters["futures/marketData"])),L=M((()=>
1{if(i.symbol){return(f.isLeaderModeActive?r.state.futures.leaderMarketPositionMap:r.state.futures.marketPositionMap)[i.symbol]||{}}return r.getters["futures/currentMarketPositionMode"]})),w=M((()=>b.value!==y.value)),D=M((()=>i.symbol?r.state.futures.riskLimitSettingMap[i.symbol]:r.getters["futures/riskLimitSetting"])),O=M((()=>i.symbol?r.getters["futures/isRiskLimitExceedLimitMap"][i.symbol]:r.getters["futures/isRiskLimitExceedLimit"])),I=M((()=>D.value.map((e=>({label:Qt(e.riskLimitValue,{formatKey:"max4",compact:!0}),value:e.riskLimitValue}))))),_=M((()=>D.value.find((e=>e.riskLevel===b.value)))),A=M((()=>{var e,t,i,r;return[{label:`${u("trading.maxPositionSize")} (${ht})`,value:Qt((null==(e=v.value)?void 0:e.riskLimitValue)||0,{formatKey:"max4",compact:!0})},{label:u("futuresMain.changeRiskLimit.maintenanceMargin"),value:kr((null==(t=v.value)?void 0:t.maintenanceMarginRate)||0)},{label:u("futuresMain.changeRiskLimit.initialMargin"),value:kr((null==(i=v.value)?void 0:i.initialMarginRate)||0)},{label:u("futuresMain.changeRiskLimit.maxLeverage"),value:(null==(r=v.value)?void 0:r.maxLeverage)+"x"}]})),F=M((()=>r.state.futures.assignedMaxLeverage)),E=M((()=>{var e,t;return F.value?Math.max(S(1).div(F.value).toNumber(),(null==(e=_.value)?void 0:e.initialMarginRate)||0):null==(t=_.value)?void 0:t.initialMarginRate})),B=M((()=>{var e,t,i;const r=!w.value;return[{label:`${u("trading.maxPositionSize")} (${ht})`,value:r?"-":Qt((null==(e=_.value)?void 0:e.riskLimitValue)||0,{formatKey:"max4",compact:!0})},{label:u("futuresMain.changeRiskLimit.maintenanceMargin"),value:r?"-":kr((null==(t=_.value)?void 0:t.maintenanceMarginRate)||0)},{label:u("futuresMain.changeRiskLimit.initialMargin"),value:r?"-":kr(E.value||0)},{label:u("futuresMain.changeRiskLimit.maxLeverage"),value:r?"-":(null==(i=_.value)?void 0:i.maxLeverage)+"x"}]})),z=M((()=>Ia(r.state.lang,"RISK_LIMIT"))),$=e=>{var t;const i=null==(t=D.value.find((t=>t.riskLimitValue===e)))?void 0:t.riskLevel;i&&(b.value=i)},N=()=>{t.value=!1},U=()=>{w.value?(Ve.riskLimit(P.value.symbol,b.value,L.value.positionMode),N()):N()},H=()=>{var e;const t=Math.min(10,b.value+1),i=null==(e=D.value.find((e=>e.riskLevel===t)))?void 0:e.riskLimitValue;i&&$(i)},V=()=>{var e;const t=Math.max(1,b.value-1),i=null==(e=D.value.find((e=>e.riskLevel===t)))?void 0:e.riskLimitValue;i&&$(i)};return(e,r)=>{const f=a("i18n-t"),v=a("BrandButton");return o(),n(pi,{visible:t.value,"onUpdate:visible":r[0]||(r[0]=e=>t.value=e),width:e.isMobile?"100%":"530px",idPrefix:"edit-risk-limit-dialog",isBrandNewStyle:""},{header:s((()=>[p(m(e.$t("futuresMain.changeRiskLimit.riskLimit")),1)])),body:s((()=>{var t,r;return[l("div",Pz,[i.isShowError||O.value?(o(),c("div",kz,[d($a,{class:"icon-notification",width:"16",height:"19"}),l("div",Tz,m(e.$t("futures.riskLimit.errorMessage.exceedLimit",{market:P.value.symbol})),1)])):h("",!0),l("div",Mz,[d(Rt,{name:P.value.coin,"show-name":!1,size:"24"},null,8,["name"]),l("span",Lz,m(P.value.symbol),1)]),l("div",wz,[l("div",Dz,m(`${x(u)("trading.maxPositionSize")} (${x(ht)})`),1),l("div",Oz,[l("div",{class:"step-btn",onClick:V},[d(Cz)]),l("div",Iz,m(x(Qt)((null==(t=_.value)?void 0:t.riskLimitValue)||0,0)),1),l("div",{class:"step-btn",onClick:H},[d(Na,{width:"20",height:"20"})])])]),l("div",xz,[d(Sz,{value:(null==(r=_.value)?void 0:r.riskLimitValue)||0,list:I.value,"onUpdate:value":$},null,8,["value","list"])]),l("div",_z,[l("div",Az,[l("div",Rz,[l("span",null,m(e.$t("t.currentLevel")),1),l("span",{class:C(["tag",{red:y.value>1}])},m(y.value),3)]),(o(!0),c(g,null,R(A.value,((e,t)=>(o(),c("div",{key:t,class:"result-row"},[l("div",Fz,m(e.label),1),l("div",Ez,m(e.value),1)])))),128))]),l("div",Bz,[l("div",zz,[d(Oi)])]),l("div",$z,[l("div",Nz,[l("span",null,m(e.$t("t.newLevel")),1),w.value?(o(),c("span",{key:0,class:C(["tag",{red:b.value>1}])},m(b.value),3)):h("",!0)]),(o(!0),c(g,null,R(B.value,((e,t)=>(o(),c("div",{key:t,class:"result-row"},[l("div",Uz,m(e.label),1),l("div",Hz,m(e.value),1)])))),128))])]),l("div",Vz,[z.value?(o(),n(f,{key:0,keypath:"futuresMain.changeRiskLimit.detailIntro.2",tag:"span"},{link:s((()=>[l("a",{class:"faq-link",target:"_blank",href:z.value,rel:"noopener nofollow"},m(e.$t("futuresMain.changeRiskLimit.detailIntroLinkText")),9,Wz)])),_:1})):h("",!0)]),l("div",qz,[d(v,{type:"primary",size:"biggest",onClick:U},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1}),d(v,{class:"cancel-btn",size:"big",onClick:N},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})])])]})),_:1},8,["visible","width"])}}}),[["__scopeId","data-v-1e349808"]]),Kz={class:"font-16"},Qz=["href"],jz={class:"flex-box flex-column items-center w-100"},Yz={__name:"GeneralErrorDialog",props:{backHome:{type:Boolean,default:!0}},emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=le(),u=k(),c=e,h=M((()=>Ia(u.state.lang,"HOME")));function g(){c.backHome&&r.push({name:"home",params:{lang:u.state.lang}}),i("dialog:closed",null)}return(e,t)=>{const i=a("i18n-t"),r=a("BaseButton");
1return o(),n(x(Ha),{class:"general-error-dialog",width:"560px",height:"auto",isBrandNewStyle:"",genre:x(Ua).WARNING,onClosed:g},{title:s((()=>[p(m(e.$t("t.somethingWentWrong")),1)])),bottom:s((()=>[l("div",jz,[d(r,{class:"primary w-100 mb-16",size:"large",onClick:g},{default:s((()=>[p(m(e.$t("ok")),1)])),_:1})])])),default:s((()=>[l("div",Kz,[d(i,{keypath:"t.tryAgainContact"},{support:s((()=>[l("a",{href:h.value,target:"_blank"},m(e.$t("footer.supportCenter")),9,Qz)])),_:1})])])),_:1},8,["genre"])}}},Zz="/static/img/BtG8ZoCR.svg",Xz=async function(){return Va.get("/assessment/trading/quiz").then(Wa).catch(qa)},Jz=async function(e){return Va.post("/assessment/trading/quiz/answer",e).then(Wa).catch(qa)},e$=async function(){return Va.put("/assessment/trading/retry").then(Wa).catch(qa)},t$={NOT_LOGIN:{key:"NOT_LOGIN",isPassQuiz:!0},QUIZ_SUITABILITY_NO_ENABLED:{key:"QUIZ_SUITABILITY_NO_ENABLED",isPassQuiz:!0},QUIZ_SUITABILITY_PASS_QUIZ_DERIVATIVE_NOT_ENABLED:{key:"QUIZ_SUITABILITY_PASS_QUIZ_DERIVATIVE_NOT_ENABLED",isPassQuiz:!0},QUIZ_SUITABILITY_PASS_QUIZ_DERIVATIVE_PASS:{key:"QUIZ_SUITABILITY_PASS_QUIZ_DERIVATIVE_PASS",isPassQuiz:!0},QUIZ_DERIVATIVE_NEED_RETRY:{key:"QUIZ_DERIVATIVE_NEED_RETRY",isPassQuiz:!1},QUIZ_SUITABILITY_FAILED:{key:"QUIZ_SUITABILITY_FAILED",isPassQuiz:!1},QUIZ_SUITABILITY_NOT_PASS:{key:"QUIZ_SUITABILITY_NOT_PASS",isPassQuiz:!1},QUIZ_DERIVATIVE_NOT_PASS:{key:"QUIZ_DERIVATIVE_NOT_PASS",isPassQuiz:!1},QUIZ_UNEXPECTED_ERROR:{key:"QUIZ_UNEXPECTED_ERROR",isPassQuiz:!1}},i$=null,r$="FAILED",a$="PASSED",n$=null,o$="FAILED",s$="PASSED",l$="BEFORE_START",u$="QUIZ",c$="BEFORE_LEAVE",d$="FINISHED",p$="QUIT";class h${constructor(e){const{currentExam:t,quizId:i,content:r,options:a=[]}=e;this.currentExam=t,this.quizId=i,this.questionContent=r,this.options=a.map((e=>new m$(e))),this.selectedAnswer=null}}class m${constructor(e){const{optionId:t,content:i,styleClass:r=null}=e;this.optionContent=i,this.optionKey=t,this.styleClass=r}updateStyleClass(e){this.styleClass=e}}const g$=function(e,t={}){const{quizId:i="",content:{description:r="",options:a=[]}={}}=e;return{...t,quizId:i,content:r,options:a.map(((e,t)=>({optionId:t,content:e.description})))}},f$={key:0,class:"quiz-container font-16 flex-box flex-column items-center"},v$=["src"],y$={class:"quiz-introduction"},b$={class:"quiz-introduction-items"},S$={class:"one-chance-text"},C$={key:1,class:"quiz-container"},P$={class:"question-list"},k$={class:"flex-box flex-column items-center w-100"},T$={name:"FuturesTradeQuizPopup",components:{Radio:mr,RadioGroup:hr},data:()=>({RADIO_TYPE:gr,quizList:[]})},M$=$n(Object.assign(T$,{emits:["dialog:closed"],setup(e,{emit:t}){const i=G(),{$openDialog:r}=ar(),u=T(!1),h=T(!0),f=t,v=T([]),y=M((()=>!h.value&&v.value.some((e=>null===e.selectedAnswer)))),b=M((()=>h.value?i.t("t.start"):i.t("t.confirm")));async function S(){var e;if(u.value=!0,h.value){const{error:e,quizzes:t=[],...i}=await Xz().then((e=>e??{})).catch((e=>({error:e}))).finally((()=>{u.value=!1}));if(e||0===t.length)return await r(Yz,{backHome:!1}),C();const{currentExam:a}=i;v.value=t.map((e=>new h$(g$(e,{currentExam:a})))),h.value=!1}else{const t={exam:null==(e=v.value[0])?void 0:e.currentExam,answer:v.value.map((({selectedAnswer:e})=>Number(e)))},{error:i,...a}=await Jz(t).then((e=>e??{})).catch((e=>({error:e}))).finally((()=>{u.value=!1}));if(i)return await r(Yz,{backHome:!1}),C();const{isCorrect:n}=a;f("dialog:closed",{status:n?"success":"failed"})}}function C(){f("dialog:closed",{status:"quit"})}return(e,t)=>{const i=a("i18n-t"),r=a("BaseButton");return o(),n(x(pi),{class:"futures-trade-quiz-popup",width:"560px",height:"auto",fullStyle:e.isMobile,isBrandNewStyle:"",showClose:!u.value,closeOnPressEscape:!u.value,onClosed:C},{header:s((()=>[p(m(e.$t("suitabilityQuiz.title")),1)])),body:s((()=>[h.value?(o(),c("div",f$,[l("img",{class:"quiz-introduction-logo",src:x(Zz)},null,8,v$),l("div",y$,[l("ul",b$,[l("li",null,m(e.$t("suitabilityQuiz.description.1")),1),d(i,{keypath:"suitabilityQuiz.description.2",tag:"li"},{oneChance:s((()=>[l("span",S$,m(e.$t("msg.oneChance")),1)])),_:1})])])])):(o(),c("div",C$,[l("ol",P$,[(o(!0),c(g,null,R(v.value,(e=>(o(),c("li",{key:e.quizId,class:"quiz-question-block"},[l("span",null,m(e.questionContent),1),d(x(hr),{modelValue:e.selectedAnswer,"onUpdate:modelValue":t=>e.selectedAnswer=t,class:"quiz-option-wrap"},{default:s((()=>
1[(o(!0),c(g,null,R(e.options,(t=>(o(),n(x(mr),{key:`${e.quizId}-${t.optionKey}`,class:"quiz-options",type:x(gr).HOLLOW,label:String(t.optionKey),disabled:u.value},{default:s((()=>[p(m(t.optionContent),1)])),_:2},1032,["type","label","disabled"])))),128))])),_:2},1032,["modelValue","onUpdate:modelValue"])])))),128))])]))])),footer:s((()=>[l("div",k$,[d(r,{class:"primary w-100 mb-16",size:"large",disabled:y.value,isLoading:u.value,onClick:S},{default:s((()=>[p(m(b.value),1)])),_:1},8,["disabled","isLoading"]),d(r,{class:"back-button",size:"large",disabled:u.value,onClick:C},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1},8,["disabled"])])])),_:1},8,["fullStyle","showClose","closeOnPressEscape"])}}}),[["__scopeId","data-v-ad048149"]]),L$={name:"FuturesTradeQuizPopup",components:{BrandDialog:pi,MessageGenreIcon:Ga},emits:["dialog:closed"],data:()=>({Genre:Ua}),computed:{...b(["lang"]),popupHeight(){return this.isMobile?"100%":"auto"}},created(){this.setShowFirstTimeTradeQuiz(!0)},methods:{...f(Vn,["setShowFirstTimeTradeQuiz"]),contactSupport(){window.open(Ia(this.lang,"HOME"),"_blank","noopener")},handleClosed(){this.setShowFirstTimeTradeQuiz(!1),this.$emit("dialog:closed"),this.$router.push({name:"home",params:{lang:this.lang}})}}},w$={class:"body-container"},D$={class:"title weight-500 font-18"},O$={class:"description weight-500 font-16"},I$={class:"footer-container"};const x$=$n(L$,[["render",function(e,t,i,r,u,c){const h=a("MessageGenreIcon"),g=
1a("BaseButton"),f=a("BrandDialog");return o(),n(f,{class:"futures-trade-quiz-popup-futures-trade-quiz-failed-dialog",width:"560px",height:"382px",fullStyle:e.isMobile,isBrandNewStyle:"",onClosed:c.handleClosed},{header:s((()=>[p(m(e.$t("suitabilityQuiz.title")),1)])),body:s((()=>[l("div",w$,[d(h,{genre:u.Genre.WARNING},null,8,["genre"]),l("div",D$,m(e.$t("suitabilityQuiz.failed.title")),1),l("div",O$,m(e.$t("suitabilityQuiz.failed.description")),1)])])),footer:s((()=>[l("div",I$,[d(g,{class:"primary",size:"large",onClick:c.contactSupport},{default:s((()=>[p(m(e.$t("t.contactSupport")),1)])),_:1},8,["onClick"]),l("div",{class:"back-button",onClick:t[0]||(t[0]=(...e)=>c.handleClosed&&c.handleClosed(...e))},m(e.$t("t.cancel")),1)])])),_:1},8,["fullStyle","onClosed"])}],["__scopeId","data-v-d16dd627"]]),_$={__name:"FuturesTradeSuitabilityChecker",props:{criteriaQuizResult:{type:String,default:null}},emits:["dialog:closed"],setup(e,{emit:t}){const i=le(),r=k(),a=t,{$openDialog:s}=ar(),l=M((()=>r.state.lang)),u=e,c=()=>null;function d(e=null){a("dialog:closed",e)}return L((async()=>{switch(u.criteriaQuizResult){case i$:{const{status:e}=await s(M$);return"success"!==e?("quit"===e?i.push({name:"home",params:{lang:l.value}}):"failed"===e&&await s(x$),d({pass:!1,reason:t$.QUIZ_SUITABILITY_NOT_PASS})):d({pass:!0,reason:null})}case r$:return await s(x$),d({pass:!1,reason:t$.QUIZ_SUITABILITY_FAILED});case a$:return d({pass:!0,reason:null});default:return await s(Yz),d({pass:!1,reason:t$.QUIZ_UNEXPECTED_ERROR})}})),(e,t)=>(o(),n(c))}},A$={class:"quiz-container font-16 flex-box flex-column items-center"},R$=["src"],F$={class:"quiz-introduction flex-box flex-column items-center"},E$={class:"sub-title font-18 weight-500"},B$={class:"des"},z$={class:"flex-box flex-column items-center w-100"},$$=$n({__name:"BeforeStarted",emits:["dialog:closed"],setup(e,{emit:t}){const{$openDialog:i}=ar(),r=t,u=T(!1);async function h(){r("dialog:closed",u$)}function g(){r("dialog:closed",p$)}return L((async()=>{u.value=!0;const{error:e}=await e$().then((e=>e??{})).catch((e=>({error:e}))).finally((()=>{u.value=!1}));if(e)return await i(Yz),void r("dialog:closed",null)})),(e,t)=>{const i=a("BaseButton"),r=H("loading");return o(),n(x(pi),{class:"futures-trade-derivative-popup-before-started",width:"560px",height:"auto",fullStyle:e.isMobile,isBrandNewStyle:"",onClosed:g},{header:s((()=>[p(m(e.$t("derivative.title")),1)])),body:s((()=>[B((o(),c("div",A$,[l("img",{class:"quiz-introduction-logo",src:x(Zz)},null,8,R$),l("div",F$,[l("div",E$,m(e.$t("derivative.subTitle")),1),l("div",B$,m(e.$t("derivative.description")),1)])])),[[r,u.value]])])),footer:s((()=>[l("div",z$,[d(i,{class:"primary w-100 mb-16",size:"large",disabled:u.value,onClick:h},{default:s((()=>[p(m(e.$t("t.start")),1)])),_:1},8,["disabled"]),l("div",{class:"back-button",onClick:g},m(e.$t("t.cancel")),1)])])),_:1},8,["fullStyle"])}}},[["__scopeId","data-v-aa05bee0"]]),N$={class:"quiz-container font-16 flex-box flex-column items-center"},U$={class:"quiz-introduction flex-box flex-column items-center"},H$={class:"des"},V$={class:"flex-box flex-column items-center w-100"},W$=$n({__name:"BeforeLeave",emits:["dialog:closed"],setup(e,{emit:t}){const i=t;function r(){i("dialog:closed",!0)}function u(){i("dialog:closed",!1)}return(e,t)=>{const i=a("BaseButton");return o(),n(x(pi),{class:"futures-trade-derivative-popup-before-leave",width:"560px",height:"auto",isBrandNewStyle:"",onClosed:u},{header:s((()=>[p(m(e.$t("derivative.title")),1)])),body:s((()=>[l("div",N$,[l("div",U$,[l("div",H$,m(e.$t("derivative.message.beforeLeave")),1)])])])),footer:s((()=>[l("div",V$,[d(i,{class:"primary w-100 mb-16",size:"large",onClick:r},{default:s((()=>[p(m(e.$t("msg.discardProgress")),1)])),_:1}),l("div",{class:"back-button",onClick:u},m(e.$t("t.cancel")),1)])])),_:1})}}},[["__scopeId","data-v-41687d4a"]]),q$={class:"quiz-container"},G$={class:"quiz-question-block"},K$={class:"quiz-info mb-24 flex-box flex-row justify-between"},Q$={class:"question-count font-18 weight-500"},j$={class:"quiz-question-content"},Y$={class:"no"},Z$={key:0,class:"answer-explanation mt-16 font-16 weight-400"},X$={key:1,class:"error-message mt-16 font-16 weight-400"},J$={class:"flex-box flex-column items-center w-100"},eN=$n({__name:"Quiz",emits:["dialog:closed"],setup(e,{emit:t}){const i=T(!1),r=t,u=G(),{$openDialog:f}
1=ar(),v="QUIZING",y="WRONG",b="TIME_EXPIRED",S=T(new h$({})),P=M((()=>w.value===v&&null===S.value.selectedAnswer)),k=M((()=>w.value===v)),L=T(""),w=T(v),D=T(null),O=T(null),I=T(0);let _=null;function A(){window.clearTimeout(_)}const F=M((()=>`${u.t("t.question")}: ${u.t("kyc.container.pageNumber",{page:I.value??" ",totalPage:O.value??" "})}`)),E=M((()=>u.t("msg.timeRemainingWithSec",{sec:D.value??" "}))),B=M((()=>w.value===v?u.t("t.confirm"):u.t("t.try_again"))),z=M((()=>{if(i.value)return!0;switch(w.value){case y:case b:return!0}return!1}));async function $(){switch(w.value){case y:case b:return void V()}D.value=null,A(),i.value=!0;const e={exam:S.value.currentExam,answer:[S.value.selectedAnswer].map((e=>Number(e)))},{error:t,...a}=await Jz(e).then((e=>e??{})).catch((e=>({error:e}))).finally((()=>{i.value=!1}));if(t)return await f(Yz),H();const{isCorrect:n,isFinalQuiz:o,detail:s}=a;if(!n){const{correctAnswer:e=null,explanation:t=""}=s??{};return w.value=y,S.value.options.forEach((t=>{t.optionKey===Number(S.value.selectedAnswer)?t.updateStyleClass("is-wrong"):t.optionKey===e&&t.updateStyleClass("is-right")})),void(L.value=t)}if(!o)return U();r("dialog:closed",d$)}async function N(){return w.value===v?async function(){await f(W$)&&(A(),V())}():V()}async function U(){i.value=!0;const{error:e,quizzes:t=[],...r}=await Xz().then((e=>e??{})).catch((e=>({error:e}))).finally((()=>{i.value=!1}));if(e||0===t.length)return await f(Yz),H();const{currentExam:a,remainingTime:n,totalAmount:o}=r,s=t[0]??{};S.value=new h$(g$(s,{currentExam:a})),D.value=n,O.value=o,I.value=I.value+1,_=setInterval((()=>{D.value--,D.value<=0&&(w.value=b,D.value=0,A())}),1e3)}function H(){r("dialog:closed",null)}function V(){r("dialog:closed",l$)}return ve(U),(e,t)=>{const r=a("BaseButton");return o(),n(x(pi),{class:"futures-trade-derivative-popup-quiz",width:"560px",height:"auto",fullStyle:e.isMobile,showClose:k.value,closeOnPressEscape:k.value,isBrandNewStyle:"",onClosed:N},{header:s((()=>[p(m(e.$t("derivative.title")),1)])),body:s((()=>[l("div",q$,[l("div",G$,[l("div",K$,[l("div",Q$,m(F.value),1),l("div",{class:C(["time-remaining font-16 weight-400",{"error-message":w.value===b}])},m(E.value),3)]),l("span",j$,[p(m(S.value.questionContent)+" ",1),l("span",Y$,m(I.value)+".",1)]),d(x(hr),{modelValue:S.value.selectedAnswer,"onUpdate:modelValue":t[0]||(t[0]=e=>S.value.selectedAnswer=e),class:"quiz-option-wrap"},{default:s((()=>[(o(!0),c(g,null,R(S.value.options,(e=>(o(),n(x(mr),{key:`${S.value.quizId}-${e.optionKey}`,class:C(["quiz-options",e.styleClass]),type:x(gr).HOLLOW,label:String(e.optionKey),disabled:z.value},{default:s((()=>[p(m(e.optionContent),1)])),_:2},1032,["class","type","label","disabled"])))),128))])),_:1},8,["modelValue"]),L.value?(o(),c("div",Z$,m(L.value),1)):h("",!0),w.value===b?(o(),c("div",X$,m(e.$t("derivative.message.outOfTime")),1)):h("",!0)])])])),footer:s((()=>[l("div",J$,[d(r,{class:"primary w-100 mb-16",size:"large",disabled:P.value,isLoading:i.value,onClick:$},{default:s((()=>[p(m(B.value),1)])),_:1},8,["disabled","isLoading"]),k.value?(o(),c("div",{key:0,class:"back-button",onClick:N},m(e.$t("t.cancel")),1)):h("",!0)])])),_:1},8,["fullStyle","showClose","closeOnPressEscape"])}}},[["__scopeId","data-v-e2b8ac4b"]]),tN={class:"quiz-container font-16 flex-box flex-column items-center"},iN={class:"quiz-introduction flex-box flex-column items-center mt-8"},rN={class:"sub-title font-18 weight-500 mb-8"},aN={class:"des"},nN={class:"flex-box flex-column items-center w-100"},oN=$n({__name:"Finished",emits:["dialog:closed"],setup(e,{emit:t}){const i=t;function r(){i("dialog:closed",null)}return(e,t)=>{const i=a("BaseButton");return o(),n(x(pi),{class:"futures-trade-derivative-popup-finished",width:"560px",height:"auto",isBrandNewStyle:"",onClosed:r},{header:s((()=>[p(m(e.$t("derivative.title")),1)])),body:s((()=>[l("div",tN,[d(x(Ka),{class:"quiz-introduction-logo"}),l("div",iN,[l("div",rN,m(e.$t("futures.tradeQuizPopup.title")),1),l("div",aN,m(e.$t("derivative.pass.description")),1)])])])),footer:s((()=>[l("div",nN,[d(i,{class:"primary w-100 mb-16",size:"large",onClick:r},{default:s((()=>[p(m(e.$t("t.start")),1)])),_:1})])])),_:1})}}},[["__scopeId","data-v-a5eea9be"]]),sN={__name:"index",emits:["dialog:closed"],setup(e,{emit:t}){const{$openDialog:i}=ar(),r=t,a=()=>null;async function s(e){let t=null;switch(e){case l$:t=await i($$);break;case u$:t=await i(eN);break;case c$:t=await i(W$);break;case d$:return await i(oN),"success";case p$:return"quit";default:return null}return null===t?null:s(t)}return ve((async()=>{const e=await s(l$);r("dialog:closed",{status:e})})),(e,t)=>(o(),n(a))}},lN={__name:"FuturesDerivativeQuizChecker",props:{derivativesQuizResult:{type:String,default:null}},emits:["dialog:closed"],setup(e,{emit:t}){const i=()=>null,r=le(),a=k(),s=t,{$openDialog:l}=ar(),u=M((()=>a.state.lang)),c=e;function d(e=null){s("dialog:closed",e)}return L((async()=>{switch(c.derivativesQuizResult){case n$:{const{status:e}=await l(sN);return"success"!==e?(r.push({name:"home",params:{lang:u.value}}),d({pass:!1,reason:t$.QUIZ_DERIVATIVE_NOT_PASS})):d({pass:!0,reason:null})}case s$:return d({pass:!0,reason:null});case o$:return d({pass:!1,reason:t$.QUIZ_DERIVATIVE_NEED_RETRY});default:return await l(Yz),d({pass:!1,reason:t$.QUIZ_UNEXPECTED_ERROR})}})),(e,t)=>(o(),n(i))}}
1,uN={name:"FuturesDisclaimerContent",render:()=>null},cN={class:"disclaimer-body"},dN={class:"flex-box flex-column items-center w-100"},pN={class:"check-wrapper"},hN=$n({__name:"index",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=k(),u=M((()=>r.state.lang)),c=T(!1);function h(){c.value&&i("dialog:closed",{accepted:!0})}function g(){i("dialog:closed",{accepted:!1})}return(e,t)=>{const i=a("RouterLink"),r=a("i18n-t");return o(),n(pi,{class:"futures-disclaimer-dialog",width:"560px",height:"auto",fullStyle:e.isMobile,isBrandNewStyle:"",showClose:!1,closeOnPressEscape:!1,onClosed:g},{header:s((()=>[p(m(e.$t("futures.disclaimer.title")),1)])),body:s((()=>[l("div",cN,[_(e.$slots,"content",{},(()=>[d(uN)]),!0)])])),footer:s((()=>[l("div",dN,[l("div",pN,[d(Ko,{value:c.value,"onUpdate:value":t[0]||(t[0]=e=>c.value=e),isBrandNewStyle:""},{default:s((()=>[d(r,{keypath:"futures.disclaimer.acknowledge"},{conditionsAndRisks:s((()=>[d(i,{class:"info-link",target:"_blank",to:{name:x(ai).LEGAL_TERMS_AND_CONDITIONS,params:{lang:u.value}}},{default:s((()=>[p(m(e.$t("t.conditionsAndRisks.lowerCase")),1)])),_:1},8,["to"])])),_:1})])),_:1},8,["value"])]),d(di,{class:"primary w-100 mb-16",size:"large",disabled:!c.value,onClick:h},{default:s((()=>[p(m(e.$t("futures.disclaimer.accept")),1)])),_:1},8,["disabled"]),d(di,{class:"decline-button",size:"large",onClick:g},{default:s((()=>[p(m(e.$t("t.cancel")),1)])),_:1})])])),_:3},8,["fullStyle"])}}},[["__scopeId","data-v-7dbb5eb6"]]);var mN;function gN(e){return null==e}function fN(){}typeof window<"u"&&(null==(mN=null==window?void 0:window.navigator)?void 0:mN.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const vN=Object.freeze({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee9
10",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"});function yN(e,t=16){if("function"!=typeof e)return fN;const i=(...t)=>{e(...t)};if(t<=0)return bN(i);let r,a=0;return function(...e){const n=Date.now(),o=n-a;clearTimeout(r),o>=t?(a=n,i(...e)):r=setTimeout((()=>{a=Date.now(),i(...e)}),Math.max(0,t-o))}}function bN(e){if("function"!=typeof e)return e;let t,i,r=!1;return function(...a){return t=a,r||(r=!0,i=Promise.resolve().then((()=>(r=!1,i=void 0,e(...t))))),i}}Object.freeze(new Set(Object.keys(vN)));const SN=new Set,CN=new WeakMap;function PN(){SN.forEach((e=>{e(...CN.get(e))})),SN.clear()}function kN(e,...t){if("function"!=typeof e)return e;CN.set(e,t),!SN.has(e)&&(SN.add(e),1===SN.size&&Promise.resolve().then(PN))}const TN=Symbol("LAYOUT_KEY"),MN=Symbol("EMITTER_KEY");function LN(e){const t=Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=wN(e[i]);return t}function wN(e){return{...e}}function DN(e,t){return!(e===t||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function ON(e,t,i){const r=RN(e),a=BN(e),n=Array(e.length);for(let o=0,s=a.length;o<s;o++){let s=a[o];s.static||(s=IN(r,s,t,i),r.push(s)),n[e.findIndex((e=>e.i===s.i))]=s,s.moved=!1}return n}function IN(e,t,i,r){if(i)for(;t.y>0&&!_N(e,t);)t.y--;else if(r){const i=r[t.i].y;for(;t.y>i&&!_N(e,t);)t.y--}let a;for(;a=_N(e,t);)t.y=a.y+a.h;return t}function xN(e,t){for(let i=0,r=e.length;i<r;i++)if(e[i].i===t)return e[i]}function _N(e,t){for(let i=0,r=e.length;i<r;i++)if(DN(e[i],t))return e[i]}function AN(e,t){return e.filter((e=>DN(e,t)))}function RN(e){return e.filter((e=>e.static))}function FN(e,t,i,r,a=!1,n=!1){if(t.static)return e;const o=t.x,s=t.y,l=r&&t.y>r;"number"==typeof i&&(t.x=i),"number"==typeof r&&(t.y=r),t.moved=!0;let u=BN(e);l&&(u=u.reverse());const c=AN(u,t);if(n&&c.length)return t.x=o,t.y=s,t.moved=!1,e;for(let d=0,p=c.length;d<p;d++){const i=c[d];i.moved||t.y>i.y&&t.y-i.y>i.h/4||(e=i.static?EN(e,i,t,a):EN(e,t,i,a))}return e}function EN(e,t,i,r){if(r){const r={x:i.x,y:i.y,w:i.w,h:i.h};if(r.y=Math.max(t.y-i.h,0),!_N(e,r))return FN(e,i,void 0,r.y,!1)}return FN(e,i,void 0,i.y+1,!1)}function BN(e){return Array.from(e).sort((function(e,t){return e.y===t.y&&e.x===t.x?0:e.y>t.y||e.y===t.y&&e.x>t.x?1:-1}))}function zN(e){return function(e){var t;const i=(null==(t=e.target)?void 0:t.offsetParent)||document.body,r=e.offsetParent===document.body?{left:0,top:0}:i.getBoundingClientRect(),a=e.clientX+i.scrollLeft-r.left,n=e.clientY+i.scrollTop-r.top;return{x:a,y:n}}(e)}function $N(e,t,i,r){return function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)?{deltaX:i-e,deltaY:r-t,lastX:e,lastY:t,x:i,y:r}:{deltaX:0,deltaY:0,lastX:i,lastY:r,x:i,y:r}}function NN(e,t){if(!t[e])throw new Error("ResponsiveGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function UN(e,t,i,r,a,n,o){if(t[r])return LN(t[r]);let s=e;const l=HN(i),u=l.slice(l.indexOf(r));for(let c=0,d=u.length;c<d;c++){const e=u[c];if(t[e]){s=t[e];break}}return s=LN(s||[]),ON(function(e,t){const i=RN(e);for(let r=0,a=e.length;r<a;r++){const a=e[r];if(a.x+a.w>t.cols&&(a.x=t.cols-a.w),a.x<0&&(a.x=0,a.w=t.cols),a.static)for(;_N(i,a);)a.y++;else i.push(a)}return e}(s,{cols:n}),o)}function HN(e){return Object.keys(e).sort(((t,i)=>e[t]-e[i]))}function VN(){return typeof document<"u"?typeof document.dir<"u"?document.dir:document.getElementsByTagName("html")[0].getAttribute("dir"):"auto"}
1var WN,qN={exports:{}};function GN(){return WN||(WN=1,(e=qN).exports=function(){function t(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function i(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?t(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,m(r.key),r)}}function o(e,t,i){return t&&n(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,i){return(t=m(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,r=u(e);if(t){var a=u(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}(this,i)}}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(arguments.length<3?e:i):a.value}},h.apply(this,arguments)}function m(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}var g=function(e){return!(!e||!e.Window)&&e instanceof e.Window},f=void 0,v=void 0;function y(e){f=e;var t=e.document.createTextNode("");t.ownerDocument!==e.document&&"function"==typeof e.wrap&&e.wrap(t)===t&&(e=e.wrap(e)),v=e}function b(e){return g(e)?e:(e.ownerDocument||e).defaultView||v.window}"undefined"!=typeof window&&window&&y(window);var S=function(e){return!!e&&"object"===r(e)},C=function(e){return"function"==typeof e},P={window:function(e){return e===v||g(e)},docFrag:function(e){return S(e)&&11===e.nodeType},object:S,func:C,number:function(e){return"number"==typeof e},bool:function(e){return"boolean"==typeof e},string:function(e){return"string"==typeof e},element:function(e){if(!e||"object"!==r(e))return!1;var t=b(e)||v;return/object|function/.test("undefined"==typeof Element?"undefined":r(Element))?e instanceof Element||e instanceof t.Element:1===e.nodeType&&"string"==typeof e.nodeName},plainObject:function(e){return S(e)&&!!e.constructor&&/function Object\b/.test(e.constructor.toString())},array:function(e){return S(e)&&void 0!==e.length&&C(e.splice)}};function k(e){var t=e.interaction;if("drag"===t.prepared.name){var i=t.prepared.axis;"x"===i?(t.coords.cur.page.y=t.coords.start.page.y,t.coords.cur.client.y=t.coords.start.client.y,t.coords.velocity.client.y=0,t.co
vendor: 23,362 bytes, line 1
1ords.velocity.page.y=0):"y"===i&&(t.coords.cur.page.x=t.coords.start.page.x,t.coords.cur.client.x=t.coords.start.client.x,t.coords.velocity.client.x=0,t.coords.velocity.page.x=0)}}function T(e){var t=e.iEvent,i=e.interaction;if("drag"===i.prepared.name){var r=i.prepared.axis;if("x"===r||"y"===r){var a="x"===r?"y":"x";t.page[a]=i.coords.start.page[a],t.client[a]=i.coords.start.client[a],t.delta[a]=0}}}var M={id:"actions/drag",install:function(e){var t=e.actions,i=e.Interactable,r=e.defaults;i.prototype.draggable=M.draggable,t.map.drag=M,t.methodDict.drag="draggable",r.actions.drag=M.defaults},listeners:{"interactions:before-action-move":k,"interactions:action-resume":k,"interactions:action-move":T,"auto-start:check":function(e){var t=e.interaction,i=e.interactable,r=e.buttons,a=i.options.drag;if(a&&a.enabled&&(!t.pointerIsDown||!/mouse|pointer/.test(t.pointerType)||0!=(r&i.options.drag.mouseButtons)))return e.action={name:"drag",axis:"start"===a.lockAxis?a.startAxis:a.lockAxis},!1}},draggable:function(e){return P.object(e)?(this.options.drag.enabled=!1!==e.enabled,this.setPerAction("drag",e),this.setOnEvents("drag",e),/^(xy|x|y|start)$/.test(e.lockAxis)&&(this.options.drag.lockAxis=e.lockAxis),/^(xy|x|y)$/.test(e.startAxis)&&(this.options.drag.startAxis=e.startAxis),this):P.bool(e)?(this.options.drag.enabled=e,this):this.options.drag},beforeMove:k,move:T,defaults:{startAxis:"xy",lockAxis:"xy"},getCursor:function(){return"move"},filterEventType:function(e){return 0===e.search("drag")}},L=M,w={init:function(e){var t=e;w.document=t.document,w.DocumentFragment=t.DocumentFragment||D,w.SVGElement=t.SVGElement||D,w.SVGSVGElement=t.SVGSVGElement||D,w.SVGElementInstance=t.SVGElementInstance||D,w.Element=t.Element||D,w.HTMLElement=t.HTMLElement||w.Element,w.Event=t.Event,w.Touch=t.Touch||D,w.PointerEvent=t.PointerEvent||t.MSPointerEvent},document:null,DocumentFragment:null,SVGElement:null,SVGSVGElement:null,SVGElementInstance:null,Element:null,HTMLElement:null,Event:null,Touch:null,PointerEvent:null};function D(){}var O=w,I={init:function(e){var t=O.Element,i=e.navigator||{};I.supportsTouch="ontouchstart"in e||P.func(e.DocumentTouch)&&O.document instanceof e.DocumentTouch,I.supportsPointerEvent=!1!==i.pointerEnabled&&!!O.PointerEvent,I.isIOS=/iP(hone|od|ad)/.test(i.platform),I.isIOS7=/iP(hone|od|ad)/.test(i.platform)&&/OS 7[^\d]/.test(i.appVersion),I.isIe9=/MSIE 9/.test(i.userAgent),I.isOperaMobile="Opera"===i.appName&&I.supportsTouch&&/Presto/.test(i.userAgent),I.prefixedMatchesSelector="matches"in t.prototype?"matches":"webkitMatchesSelector"in t.prototype?"webkitMatchesSelector":"mozMatchesSelector"in t.prototype?"mozMatchesSelector":"oMatchesSelector"in t.prototype?"oMatchesSelector":"msMatchesSelector",I.pEventTypes=I.supportsPointerEvent?O.PointerEvent===e.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,I.wheelEvent=O.document&&"onmousewheel"in O.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null},x=I;function _(e,t){if(e.contains)return e.contains(t);for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function A(e,t){for(;P.element(e);){if(F(e,t))return e;e=R(e)}return null}function R(e){var t=e.parentNode;if(P.docFrag(t)){for(;(t=t.host)&&P.docFrag(t););return t}return t}function F(e,t){return v!==f&&(t=t.replace(/\/deep\//g," ")),e[x.prefixedMatchesSelector](t)}var E=function(e){return e.parentNode||e.host};function B(e,t){for(var i,r=[],a=e;(i=E(a))&&a!==t&&i!==a.ownerDocument;)r.unshift(a),a=i;return r}function z(e,t,i){for(;P.element(e);){if(F(e,t))return!0;if((e=R(e))===i)return F(e,t)}return!1}function $(e){return e.correspondingUseElement||e}function N(e){var t=e instanceof O.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return t&&{left:t.left,right:t.right,top:t.top,bottom:t.bottom,width:t.width||t.right-t.left,height:t.height||t.bottom-t.top}}function U(e){var t,i=N(e);if(!x.isIOS7&&i){var r={x:(t=(t=b(e))||v).scrollX||t.document.documentElement.scrollLeft,y:t.scrollY||t.document.documentElement.scrollTop};i.left+=r.x,i.right+=r.x,i.top+=r.y,i.bottom+=r.y}return i}function H(e){for(var t=[];e;)t.push(e),e=R(e);return t}function V(e){return!!P.string(e)&&(O.document.querySelector(e),!0)}function W(e,t){for(var i in t)e[i]=t[i];return e}function q(e,t,i){return"parent"===e?R(i):"self"===e?t.getRect(i):A(i,e)}function G(e,t,i,r){var a=e;return P.string(a)?a=q(a,t,i):P.func(a)&&(a=a.apply(void 0,r)),P.element(a)&&(a=U(a)),a}function K(e){return e&&{x:"x"in e?e.x:e.left,y:"y"in e?e.y:e.top}}function Q(e){return!e||"x"in e&&"y"in e||((e=W({},e)).x=e.left||0,e.y=e.top||0,e.width=e.width||(e.right||0)-e.x,e.height=e.height||(e.bottom||0)-e.y),e}function j(e,t,i){e.left&&(t.left+=i.x),e.right&&(t.right+=i.x),e.top&&(t.top+=i.y),e.bottom&&(t.bottom+=i.y),t.width=t.right-t.left,t.height=t.bottom-t.top}function Y(e,t,i){var r=i&&e.options[i];return K(G(r&&r.origin||e.options.origin,e,t,[e&&t]))||{x:0,y:0}}function Z(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return!0},r=arguments.length>3?arguments[3]:void 0;if(r=r||{},P.string(e)&&-1!==e.search(" ")&&(e=X(e)),P.array(e))return e.forEach((function(e){return Z(e,t,i,r)})),r;if(P.object(e)&&(t=e,e=""),P.func(t)&&i(e))r[e]=r[e]||[],r[e].push(t);else if(P.array(t))for(var a=0,n=t;a<n.length;a++){var o=n[a];Z(e,o,i,r)}else if(P.object(t))for(var s in t)Z(X(s).map((function(t){return"".concat(e).concat(t)})),t[s],i,r);return r}function X(e){return e.trim().split(/ +/)}var J=function(e,t){return Math.sqrt(e*e+t*t)},ee=["webkit","moz"];function te(e,t){e.__set||(e.__set={});var i=function(i){if(ee.some((function(e){return 0===i.indexOf(e)})))return 1;"function"!=typeof e[i]&&"__set"!==i&&Object.defineProperty(e,i,{get:function(){return i in e.__set?e.__set[i]:e.__set[i]=t[i]},set:function(t){e.__set[i]=t},configurable:!0})};for(var r in t)i(r);return e}function ie(e,t){e.page=e.page||{},e.page.x=t.page.x,e.page.y=t.page.y,e.client=e.client||{},e.client.x=t.client.x,e.client.y=t.client.y,e.timeStamp=t.timeStamp}function re(e){e.page.x=0,e.page.y=0,e.client.x=0,e.client.y=0}function ae(e){return e instanceof O.Event||e instanceof O.Touch}function ne(e,t,i){return e=e||"page",(i=i||{}).x=t[e+"X"],i.y=t[e+"Y"],i}function oe(e,t){return t=t||{x:0,y:0},x.isOperaMobile&&ae(e)?(ne("screen",e,t),t.x+=window.scrollX,t.y+=window.scrollY):ne("page",e,t),t}function se(e){return P.number(e.pointerId)?e.pointerId:e.identifier}function le(e,t,i){var r,a,n=t.length>1?ce(t):t[0];oe(n,e.page),r=n,a=(a=e.client)||{},x.isOperaMobile&&ae(r)?ne("screen",r,a):ne("client",r,a),e.timeStamp=i}function ue(e){var t=[];return P.array(e)?(t[0]=e[0],t[1]=e[1]):"touchend"===e.type?1===e.touches.length?(t[0]=e.touches[0],t[1]=e.changedTouches[0]):0===e.touches.length&&(t[0]=e.changedTouches[0],t[1]=e.changedTouches[1]):(t[0]=e.touches[0],t[1]=e.touches[1]),t}function ce(e){for(var t={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0},i=0;i<e.length;i++){var r=e[i];for(var a in t)t[a]+=r[a]}for(var n in t)t[n]/=e.length;return t}function de(e){if(!e.length)return null;var t=ue(e),i=Math.min(t[0].pageX,t[1].pageX),r=Math.min(t[0].pageY,t[1].pageY),a=Math.max(t[0].pageX,t[1].pageX),n=Math.max(t[0].pageY,t[1].pageY);return{x:i,y:r,left:i,top:r,right:a,bottom:n,width:a-i,height:n-r}}function pe(e,t){var i=t+"X",r=t+"Y",a=ue(e),n=a[0][i]-a[1][i],o=a[0][r]-a[1][r];return J(n,o)}function he(e,t){var i=t+"X",r=t+"Y",a=ue(e),n=a[1][i]-a[0][i],o=a[1][r]-a[0][r];return 180*Math.atan2(o,n)/Math.PI}function me(e){return P.string(e.pointerType)?e.pointerType:P.number(e.pointerType)?[void 0,void 0,"touch","pen","mouse"][e.pointerType]:/touch/.test(e.type||"")||e instanceof O.Touch?"touch":"mouse"}function ge(e){var t=P.func(e.composedPath)?e.composedPath():e.path;return[$(t?t[0]:e.target),$(e.currentTarget)]}var fe=function(){function e(t){a(this,e),this.immediatePropagationStopped=!1,this.propagationStopped=!1,this._interaction=t}return o(e,[{key:"preventDefault",value:function(){}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"stopImmediatePropagation",value:function(){this.immediatePropagationStopped=this.propagationStopped=!0}}]),e}();Object.defineProperty(fe.prototype,"interaction",{get:function(){return this._interaction._proxy},set:function(){}});var ve=function(e,t){for(var i=0;i<t.length;i++){var r=t[i];e.push(r)}return e},ye=function(e){return ve([],e)},be=function(e,t){for(var i=0;i<e.length;i++)if(t(e[i],i,e))return i;return-1},Se=function(e,t){return e[be(e,t)]},Ce=function(e){l(i,e);var t=p(i);function i(e,r,n){var o;a(this,i),(o=t.call(this,r._interaction)).dropzone=void 0,o.dragEvent=void 0,o.relatedTarget=void 0,o.draggable=void 0,o.propagationStopped=!1,o.immediatePropagationStopped=!1;var s="dragleave"===n?e.prev:e.cur,l=s.element,u=s.dropzone;return o.type=n,o.target=l,o.currentTarget=l,o.dropzone=u,o.dragEvent=r,o.relatedTarget=r.target,o.draggable=r.interactable,o.timeStamp=r.timeStamp,o}return o(i,[{key:"reject",value:function(){var e=this,t=this._interaction.dropState;if("dropactivate"===this.type||this.dropzone&&t.cur.dropzone===this.dropzone&&t.cur.element===this.target)if(t.prev.dropzone=this.dropzone,t.prev.element=this.target,t.rejected=!0,t.events.enter=null,this.stopImmediatePropagation(),"dropactivate"===this.type){var r=t.activeDrops,a=be(r,(function(t){var i=t.dropzone,r=t.element;return i===e.dropzone&&r===e.target}));t.activeDrops.splice(a,1);var n=new i(t,this.dragEvent,"dropdeactivate");n.dropzone=this.dropzone,n.target=this.target,this.dropzone.fire(n)}else this.dropzone.fire(new i(t,this.dragEvent,"dragleave"))}},{key:"preventDefault",value:function(){}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"stopImmediatePropagation",value:function(){this.immediatePropagationStopped=this.propagationStopped=!0}}]),i}(fe);function Pe(e,t){for(var i=0,r=e.slice();i<r.length;i++){var a=r[i],n=a.dropzone,o=a.element;t.dropzone=n,t.target=o,n.fire(t),t.propagationStopped=t.immediatePropagationStopped=!1}}function ke(e,t){for(var i=function(e,t){for(var i=[],r=0,a=e.interactables.list;r<a.length;r++){var n=a[r];if(n.options.drop.enabled){var o=n.options.drop.accept;if(!(P.element(o)&&o!==t||P.string(o)&&!F(t,o)||P.func(o)&&!o({dropzone:n,draggableElement:t})))for(var s=0,l=n.getAllElements();s<l.length;s++){var u=l[s];u!==t&&i.push({dropzone:n,element:u,rect:n.getRect(u)})}}}return i}(e,t),r=0;r<i.length;r++){var a=i[r];a.rect=a.dropzone.getRect(a.element)}return i}function Te(e,t,i){for(var r=e.dropState,a=e.interactable,n=e.element,o=[],s=0,l=r.activeDrops;s<l.length;s++){var u=l[s],c=u.dropzone,d=u.element,p=u.rect,h=c.dropCheck(t,i,a,n,d,p);o.push(h?d:null)}var m=function(e){for(var t,i,r,a=[],n=0;n<e.length;n++){var o=e[n],s=e[t];if(o&&n!==t)if(s){var l=E(o),u=E(s);if(l!==o.ownerDocument)if(u!==o.ownerDocument)if(l!==u){a=a.length?a:B(s);var c=void 0;if(s instanceof O.HTMLElement&&o instanceof O.SVGElement&&!(o instanceof O.SVGSVGElement)){if(o===u)continue;c=o.ownerSVGElement}else c=o;for(var d=B(c,s.ownerDocument),p=0;d[p]&&d[p]===a[p];)p++;var h=[d[p-1],d[p],a[p]];if(h[0])for(var m=h[0].lastChild;m;){if(m===h[1]){t=n,a=d;break}if(m===h[2])break;m=m.previousSibling}}else r=s,(parseInt(b(i=o).getComputedStyle(i).zIndex,10)||0)>=(parseInt(b(r).getComputedStyle(r).zIndex,10)||0)&&(t=n);else t=n}else t=n}return t}(o);return r.activeDrops[m]||null}function Me(e,t,i){var r=e.dropState,a={enter:null,leave:null,activate:null,deactivate:null,move:null,drop:null};return"dragstart"===i.type&&(a.activate=new Ce(r,i,"dropactivate"),a.activate.target=null,a.activate.dropzone=null),"dragend"===i.type&&(a.deactivate=new Ce(r,i,"dropdeactivate"),a.deactivate.target=null,a.deactivate.dropzone=null),r.rejected||(r.cur.element!==r.prev.element&&(r.prev.dropzone&&(a.leave=new Ce(r,i,"dragleave"),i.dragLeave=a.leave.target=r.prev.element,i.prevDropzone=a.leave.dropzone=r.prev.dropzone),r.cur.dropzone&&(a.enter=new Ce(r,i,"dragenter"),i.dragEnter=r.cur.element,i.dropzone=r.cur.dropzone)),"dragend"===i.type&&r.cur.dropzone&&(a.drop=new Ce(r,i,"drop"),i.dropzone=r.cur.dropzone,i.relatedTarget=r.cur.element),"dragmove"===i.type&&r.cur.dropzone&&(a.move=new Ce(r,i,"dropmove"),i.dropzone=r.cur.dropzone)),a}function Le(e,t){var i=e.dropState,r=i.activeDrops,a=i.cur,n=i.prev;t.leave&&n.dropzone.fire(t.leave),t.enter&&a.dropzone.fire(t.enter),t.move&&a.dropzone.fire(t.move),t.drop&&a.dropzone.fire(t.drop),t.deactivate&&Pe(r,t.deactivate),i.prev.dropzone=a.dropzone,i.prev.element=a.element}function we(e,t){var i=e.interaction,r=e.iEvent,a=e.event;if("dragmove"===r.type||"dragend"===r.type){var n=i.dropState;t.dynamicDrop&&(n.activeDrops=ke(t,i.element));var o=r,s=Te(i,o,a);n.rejected=n.rejected&&!!s&&s.dropzone===n.cur.dropzone&&s.element===n.cur.element,n.cur.dropzone=s&&s.dropzone,n.cur.element=s&&s.element,n.events=Me(i,0,o)}}var De={id:"actions/drop",install:function(e){var t=e.actions,i=e.interactStatic,r=e.Interactable,a=e.defaults;e.usePlugin(L),r.prototype.dropzone=function(e){return function(e,t){if(P.object(t)){if(e.options.drop.enabled=!1!==t.enabled,t.listeners){var i=Z(t.listeners),r=Object.keys(i).reduce((function(e,t){return e[/^(enter|leave)/.test(t)?"drag".concat(t):/^(activate|deactivate|move)/.test(t)?"drop".concat(t):t]=i[t],e}),{}),a=e.options.drop.listeners;a&&e.off(a),e.on(r),e.options.drop.listeners=r}return P.func(t.ondrop)&&e.on("drop",t.ondrop),P.func(t.ondropactivate)&&e.on("dropactivate",t.ondropactivate),P.func(t.ondropdeactivate)&&e.on("dropdeactivate",t.ondropdeactivate),P.func(t.ondragenter)&&e.on("dragenter",t.ondragenter),P.func(t.ondragleave)&&e.on("dragleave",t.ondragleave),P.func(t.ondropmove)&&e.on("dropmove",t.ondropmove),/^(pointer|center)$/.test(t.overlap)?e.options.drop.overlap=t.overlap:P.number(t.overlap)&&(e.options.drop.overlap=Math.max(Math.min(1,t.overlap),0)),"accept"in t&&(e.options.drop.accept=t.accept),"checker"in t&&(e.options.drop.checker=t.checker),e}return P.bool(t)?(e.options.drop.enabled=t,e):e.options.drop}(this,e)},r.prototype.dropCheck=function(e,t,i,r,a,n){return function(e,t,i,r,a,n,o){var s=!1;if(!(o=o||e.getRect(n)))return!!e.options.drop.checker&&e.options.drop.checker(t,i,s,e,n,r,a);var l=e.options.drop.overlap;if("pointer"===l){var u=Y(r,a,"drag"),c=oe(t);c.x+=u.x,c.y+=u.y;var d=c.x>o.left&&c.x<o.right,p=c.y>o.top&&c.y<o.bottom;s=d&&p}var h=r.getRect(a);if(h&&"center"===l){var m=h.left+h.width/2,g=h.top+h.height/2;s=m>=o.left&&m<=o.right&&g>=o.top&&g<=o.bottom}return h&&P.number(l)&&(s=Math.max(0,Math.min(o.right,h.right)-Math.max(o.left,h.left))*Math.max(0,Math.min(o.bottom,h.bottom)-Math.max(o.top,h.top))/(h.width*h.height)>=l),e.options.drop.checker&&(s=e.options.drop.checker(t,i,s,e,n,r,a)),s}(this,e,t,i,r,a,n)},i.dynamicDrop=function(t){return P.bool(t)?(e.dynamicDrop=t,i):e.dynamicDrop},W(t.phaselessTypes,{dragenter:!0,dragleave:!0,dropactivate:!0,dropdeactivate:!0,dropmove:!0,drop:!0}),t.methodDict.drop="dropzone",e.dynamicDrop=!1,a.actions.drop=De.defaults},listeners:{"interactions:before-action-start":function(e){var t=e.interaction;"drag"===t.prepared.name&&(t.dropState={cur:{dropzone:null,element:null},prev:{dropzone:null,element:null},rejected:null,events:null,activeDrops:[]})},"interactions:after-action-start":function(e,t){var i=e.interaction,r=(e.event,e.iEvent);if("drag"===i.prepared.name){var a=i.dropState;a.activeDrops=[],a.events={},a.activeDrops=ke(t,i.element),a.events=Me(i,0,r),a.events.activate&&(Pe(a.activeDrops,a.events.activate),t.fire("actions/drop:start",{interaction:i,dragEvent:r}))}},"interactions:action-move":we,"interactions:after-action-move":function(e,t){var i=e.interaction,r=e.iEvent;if("drag"===i.prepared.name){var a=i.dropState;Le(i,a.events),t.fire("actions/drop:move",{interaction:i,dragEvent:r}),a.events={}}},"interactions:action-end":function(e,t){if("drag"===e.interaction.prepared.name){var i=e.interaction,r=e.iEvent;we(e,t),Le(i,i.dropState.events),t.fire("actions/drop:end",{interaction:i,dragEvent:r})}},"interactions:stop":function(e){var t=e.interaction;if("drag"===t.prepared.name){var i=t.dropState;i&&(i.activeDrops=null,i.events=null,i.cur.dropzone=null,i.cur.element=null,i.prev.dropzone=null,i.prev.element=null,i.rejected=!1)}}},getActiveDrops:ke,getDrop:Te,getDropEvents:Me,fireDropEvents:Le,filterEventType:function(e){return 0===e.search("drag")||0===e.search("drop")},defaults:{enabled:!1,accept:null,overlap:"pointer"}},Oe=De;function Ie(e){var t=e.interaction,i=e.iEvent,r=e.phase;if("gesture"===t.prepared.name){var a=t.pointers.map((function(e){return e.pointer})),n="start"===r,o="end"===r,s=t.interactable.options.deltaSource;if(i.touches=[a[0],a[1]],n)i.distance=pe(a,s),i.box=de(a),i.scale=1,i.ds=0,i.angle=he(a,s),i.da=0,t.gesture.startDistance=i.distance,t.gesture.startAngle=i.angle;else if(o||t.pointers.length<2){var l=t.prevEvent;i.distance=l.distance,i.box=l.box,i.scale=l.scale,i.ds=0,i.angle=l.angle,i.da=0}else i.distance=pe(a,s),i.box=de(a),i.scale=i.distance/t.gesture.startDistance,i.angle=he(a,s),i.ds=i.scale-t.gesture.scale,i.da=i.angle-t.gesture.angle;t.gesture.distance=i.distance,t.gesture.angle=i.angle,P.number(i.scale)&&i.scale!==1/0&&!isNaN(i.scale)&&(t.gesture.scale=i.scale)}}var xe={id:"actions/gesture",before:["actions/drag","actions/resize"],install:function(e){var t=e.actions,i=e.Interactable,r=e.defaults;i.prototype.gesturable=function(e){return P.object(e)?(this.options.gesture.enabled=!1!==e.enabled,this.setPerAction("gesture",e),this.setOnEvents("gesture",e),this):P.bool(e)?(this.options.gesture.enabled=e,this):this.options.gesture},t.map.gesture=xe,t.methodDict.gesture="gesturable",r.actions.gesture=xe.defaults},listeners:{"interactions:action-start":Ie,"interactions:action-move":Ie,"interactions:action-end":Ie,"interactions:new":function(e){e.interaction.gesture={angle:0,distance:0,scale:1,startAngle:0,startDistance:0}},"auto-start:check":function(e){if(!(e.interaction.pointers.length<2)){var t=e.interactable.options.gesture;if(t&&t.enabled)return e.action={name:"gesture"},!1}}},defaults:{},getCursor:function(){return""},filterEventType:function(e){return 0===e.search("gesture")}},_e=xe;function Ae(e,t,i,r,a,n,o){if(!t)return!1;if(!0===t){var s=P.number(n.width)?n.width:n.right-n.left,l=P.number(n.height)?n.height:n.bottom-n.top;if(o=Math.min(o,Math.abs(("left"===e||"right"===e?s:l)/2)),s<0&&("left"===e?e="right":"right"===e&&(e="left")),l<0&&("top"===e?e="bottom":"bottom"===e&&(e="top")),"left"===e){var u=s>=0?n.left:n.right;return i.x<u+o}if("top"===e){var c=l>=0?n.top:n.bottom;return i.y<c+o}if("right"===e)return i.x>(s>=0?n.right:n.left)-o;if("bottom"===e)return i.y>(l>=0?n.bottom:n.top)-o}return!!P.element(r)&&(P.element(t)?t===r:z(r,t,a))}function Re(e){var t=e.iEvent,i=e.interaction;if("resize"===i.prepared.name&&i.resizeAxes){var r=t;i.interactable.options.resize.square?("y"===i.resizeAxes?r.delta.x=r.delta.y:r.delta.y=r.delta.x,r.axes="xy"):(r.axes=i.resizeAxes,"x"===i.resizeAxes?r.delta.y=0:"y"===i.resizeAxes&&(r.delta.x=0))}}var Fe,Ee,Be={id:"actions/resize",before:["actions/drag"],install:function(e){var t=e.actions,i=e.browser,r=e.Interactable,a=e.defaults;Be.cursors=i.isIe9?{x:"e-resize",y:"s-resize",xy:"se-resize",top:"n-resize",left:"w-resize",bottom:"s-resize",right:"e-resize",topleft:"se-resize",bottomright:"se-resize",topright:"ne-resize",bottomleft:"ne-resize"}:{x:"ew-resize",y:"ns-resize",xy:"nwse-resize",top:"ns-resize",left:"ew-resize",bottom:"ns-resize",right:"ew-resize",topleft:"nwse-resize",bottomright:"nwse-resize",topright:"nesw-resize",bottomleft:"nesw-resize"},Be.defaultMargin=i.supportsTouch||i.supportsPointerEvent?20:10,r.prototype.resizable=function(t){return function(e,t,i){return P.object(t)?(e.options.resize.enabled=!1!==t.enabled,e.setPerAction("resize",t),e.setOnEvents("resize",t),P.string(t.axis)&&/^x$|^y$|^xy$/.test(t.axis)?e.options.resize.axis=t.axis:null===t.axis&&(e.options.resize.axis=i.defaults.actions.resize.axis),P.bool(t.preserveAspectRatio)?e.options.resize.preserveAspectRatio=t.preserveAspectRatio:P.bool(t.square)&&(e.options.resize.square=t.square),e):P.bool(t)?(e.options.resize.enabled=t,e):e.options.resize}(this,t,e)},t.map.resize=Be,t.methodDict.resize="resizable",a.actions.resize=Be.defaults},listeners:{"interactions:new":function(e){e.interaction.resizeAxes="xy"},"interactions:action-start":function(e){!function(e){var t=e.iEvent,i=e.interaction;if("resize"===i.prepared.name&&i.prepared.edges){var r=t,a=i.rect;i._rects={start:W({},a),corrected:W({},a),previous:W({},a),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},r.edges=i.prepared.edges,r.rect=i._rects.corrected,r.deltaRect=i._rects.delta}}(e),Re(e)},"interactions:action-move":function(e){!function(e){var t=e.iEvent,i=e.interaction;if("resize"===i.prepared.name&&i.prepared.edges){var r=t,a=i.interactable.options.resize.invert,n="reposition"===a||"negate"===a,o=i.rect,s=i._rects,l=s.start,u=s.corrected,c=s.delta,d=s.previous;if(W(d,u),n){if(W(u,o),"reposition"===a){if(u.top>u.bottom){var p=u.top;u.top=u.bottom,u.bottom=p}if(u.left>u.right){var h=u.left;u.left=u.right,u.right=h}}}else u.top=Math.min(o.top,l.bottom),u.bottom=Math.max(o.bottom,l.top),u.left=Math.min(o.left,l.right),u.right=Math.max(o.right,l.left);for(var m in u.width=u.right-u.left,u.height=u.bottom-u.top,u)c[m]=u[m]-d[m];r.edges=i.prepared.edges,r.rect=u,r.deltaRect=c}}(e),Re(e)},"interactions:action-end":function(e){var t=e.iEvent,i=e.interaction;if("resize"===i.prepared.name&&i.prepared.edges){var r=t;r.edges=i.prepared.edges,r.rect=i._rects.corrected,r.deltaRect=i._rects.delta}},"auto-start:check":function(e){var t=e.interaction,i=e.interactable,r=e.element,a=e.rect,n=e.buttons;if(a){var o=W({},t.coords.cur.page),s=i.options.resize;if(s&&s.enabled&&(!t.pointerIsDown||!/mouse|pointer/.test(t.pointerType)||0!=(n&s.mouseButtons))){if(P.object(s.edges)){var l={left:!1,right:!1,top:!1,bottom:!1};for(var u in l)l[u]=Ae(u,s.edges[u],o,t._latestPointer.eventTarget,r,a,s.margin||Be.defaultMargin);l.left=l.left&&!l.right,l.top=l.top&&!l.bottom,(l.left||l.right||l.top||l.bottom)&&(e.action={name:"resize",edges:l})}else{var c="y"!==s.axis&&o.x>a.right-Be.defaultMargin,d="x"!==s.axis&&o.y>a.bottom-Be.defaultMargin;(c||d)&&(e.action={name:"resize",axes:(c?"x":"")+(d?"y":"")})}return!e.action&&void 0}}}},defaults:{square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},cursors:null,getCursor:function(e){var t=e.edges,i=e.axis,r=e.name,a=Be.cursors,n=null;if(i)n=a[r+i];else if(t){for(var o="",s=0,l=["top","bottom","left","right"];s<l.length;s++){var u=l[s];t[u]&&(o+=u)}n=a[o]}return n},filterEventType:function(e){return 0===e.search("resize")},defaultMargin:null},ze=Be,$e={id:"actions",install:function(e){e.usePlugin(_e),e.usePlugin(ze),e.usePlugin(L),e.usePlugin(Oe)}},Ne=0,Ue={request:function(e){return Fe(e)},cancel:function(e){return Ee(e)},init:function(e){if(Fe=e.requestAnimationFrame,Ee=e.cancelAnimationFrame,!Fe)for(var t=["ms","moz","
1webkit","o"],i=0;i<t.length;i++){var r=t[i];Fe=e["".concat(r,"RequestAnimationFrame")],Ee=e["".concat(r,"CancelAnimationFrame")]||e["".concat(r,"CancelRequestAnimationFrame")]}Fe=Fe&&Fe.bind(e),Ee=Ee&&Ee.bind(e),Fe||(Fe=function(t){var i=Date.now(),r=Math.max(0,16-(i-Ne)),a=e.setTimeout((function(){t(i+r)}),r);return Ne=i+r,a},Ee=function(e){return clearTimeout(e)})}},He={defaults:{enabled:!1,margin:60,container:null,speed:300},now:Date.now,interaction:null,i:0,x:0,y:0,isScrolling:!1,prevTime:0,margin:0,speed:0,start:function(e){He.isScrolling=!0,Ue.cancel(He.i),e.autoScroll=He,He.interaction=e,He.prevTime=He.now(),He.i=Ue.request(He.scroll)},stop:function(){He.isScrolling=!1,He.interaction&&(He.interaction.autoScroll=null),Ue.cancel(He.i)},scroll:function(){var e=He.interaction,t=e.interactable,i=e.element,r=e.prepared.name,a=t.options[r].autoScroll,n=Ve(a.container,t,i),o=He.now(),s=(o-He.prevTime)/1e3,l=a.speed*s;if(l>=1){var u={x:He.x*l,y:He.y*l};if(u.x||u.y){var c=We(n);P.window(n)?n.scrollBy(u.x,u.y):n&&(n.scrollLeft+=u.x,n.scrollTop+=u.y);var d=We(n),p={x:d.x-c.x,y:d.y-c.y};(p.x||p.y)&&t.fire({type:"autoscroll",target:i,interactable:t,delta:p,interaction:e,container:n})}He.prevTime=o}He.isScrolling&&(Ue.cancel(He.i),He.i=Ue.request(He.scroll))},check:function(e,t){var i;return null==(i=e.options[t].autoScroll)?void 0:i.enabled},onInteractionMove:function(e){var t=e.interaction,i=e.pointer;if(t.interacting()&&He.check(t.interactable,t.prepared.name))if(t.simulation)He.x=He.y=0;else{var r,a,n,o,s=t.interactable,l=t.element,u=t.prepared.name,c=s.options[u].autoScroll,d=Ve(c.container,s,l);if(P.window(d))o=i.clientX<He.margin,r=i.clientY<He.margin,a=i.clientX>d.innerWidth-He.margin,n=i.clientY>d.innerHeight-He.margin;else{var p=N(d);o=i.clientX<p.left+He.margin,r=i.clientY<p.top+He.margin,a=i.clientX>p.right-He.margin,n=i.clientY>p.bottom-He.margin}He.x=a?1:o?-1:0,He.y=n?1:r?-1:0,He.isScrolling||(He.margin=c.margin,He.speed=c.speed,He.start(t))}}};function Ve(e,t,i){return(P.string(e)?q(e,t,i):e)||b(i)}function We(e){return P.window(e)&&(e=window.document.body),{x:e.scrollLeft,y:e.scrollTop}}var qe={id:"auto-scroll",install:function(e){var t=e.defaults,i=e.actions;e.autoScroll=He,He.now=function(){return e.now()},i.phaselessTypes.autoscroll=!0,t.perAction.autoScroll=He.defaults},listeners:{"interactions:new":function(e){e.interaction.autoScroll=null},"interactions:destroy":function(e){e.interaction.autoScroll=null,He.stop(),He.interaction&&(He.interaction=null)},"interactions:stop":He.stop,"interactions:action-move":function(e){return He.onInteractionMove(e)}}};function Ge(e,t){var i=!1;return function(){return i||(v.console.warn(t),i=!0),e.apply(this,arguments)}}function Ke(e,t){return e.name=t.name,e.axis=t.axis,e.edges=t.edges,e}function Qe(e){return P.bool(e)?(this.options.styleCursor=e,this):null===e?(delete this.options.styleCursor,this):this.options.styleCursor}function je(e){return P.func(e)?(this.options.actionChecker=e,this):null===e?(delete this.options.actionChecker,this):this.options.actionChecker}var Ye={id:"auto-start/interactableMethods",install:function(e){var t=e.Interactable;t.prototype.getAction=function(t,i,r,a){var n,o,s,l,u,c,d,p=(o=i,s=r,l=a,u=e,c=(n=this).getRect(l),d={action:null,interactable:n,interaction:s,element:l,rect:c,buttons:o.buttons||{0:1,1:4,3:8,4:16}[o.button]},u.fire("auto-start:check",d),d.action);return this.options.actionChecker?this.options.actionChecker(t,i,p,this,a,r):p},t.prototype.ignoreFrom=Ge((function(e){return this._backCompatOption("ignoreFrom",e)}),"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),t.prototype.allowFrom=Ge((function(e){return this._backCompatOption("allowFrom",e)}),"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),t.prototype.actionChecker=je,t.prototype.styleCursor=Qe}};function Ze(e,t,i,r,a){return t.testIgnoreAllow(t.options[e.name],i,r)&&t.options[e.name].enabled&&tt(t,i,e,a)?e:null}function Xe(e,t,i,r,a,n,o){for(var s=0,l=r.length;s<l;s++){var u=r[s],c=a[s],d=u.getAction(t,i,e,c);
vendor: 42,862 bytes, line 1
1if(d){var p=Ze(d,u,c,n,o);if(p)return{action:p,interactable:u,element:c}}}return{action:null,interactable:null,element:null}}function Je(e,t,i,r,a){var n=[],o=[],s=r;function l(e){n.push(e),o.push(s)}for(;P.element(s);){n=[],o=[],a.interactables.forEachMatch(s,l);var u=Xe(e,t,i,n,o,r,a);if(u.action&&!u.interactable.options[u.action.name].manualStart)return u;s=R(s)}return{action:null,interactable:null,element:null}}function et(e,t,i){var r=t.action,a=t.interactable,n=t.element;r=r||{name:null},e.interactable=a,e.element=n,Ke(e.prepared,r),e.rect=a&&r.name?a.getRect(n):null,at(e,i),i.fire("autoStart:prepared",{interaction:e})}function tt(e,t,i,r){var a=e.options,n=a[i.name].max,o=a[i.name].maxPerElement,s=r.autoStart.maxInteractions,l=0,u=0,c=0;if(!(n&&o&&s))return!1;for(var d=0,p=r.interactions.list;d<p.length;d++){var h=p[d],m=h.prepared.name;if(h.interacting()){if(++l>=s)return!1;if(h.interactable===e){if((u+=m===i.name?1:0)>=n)return!1;if(h.element===t&&(c++,m===i.name&&c>=o))return!1}}}return s>0}function it(e,t){return P.number(e)?(t.autoStart.maxInteractions=e,this):t.autoStart.maxInteractions}function rt(e,t,i){var r=i.autoStart.cursorElement;r&&r!==e&&(r.style.cursor=""),e.ownerDocument.documentElement.style.cursor=t,e.style.cursor=t,i.autoStart.cursorElement=t?e:null}function at(e,t){var i=e.interactable,r=e.element,a=e.prepared;if("mouse"===e.pointerType&&i&&i.options.styleCursor){var n="";if(a.name){var o=i.options[a.name].cursorChecker;n=P.func(o)?o(a,i,r,e._interacting):t.actions.map[a.name].getCursor(a)}rt(e.element,n||"",t)}else t.autoStart.cursorElement&&rt(t.autoStart.cursorElement,"",t)}var nt={id:"auto-start/base",before:["actions"],install:function(e){var t=e.interactStatic,i=e.defaults;e.usePlugin(Ye),i.base.actionChecker=null,i.base.styleCursor=!0,W(i.perAction,{manualStart:!1,max:1/0,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}),t.maxInteractions=function(t){return it(t,e)},e.autoStart={maxInteractions:1/0,withinInteractionLimit:tt,cursorElement:null}},listeners:{"interactions:down":function(e,t){var i=e.interaction,r=e.pointer,a=e.event,n=e.eventTarget;i.interacting()||et(i,Je(i,r,a,n,t),t)},"interactions:move":function(e,t){var i,r,a,n,o,s;r=t,a=(i=e).interaction,n=i.pointer,o=i.event,s=i.eventTarget,"mouse"!==a.pointerType||a.pointerIsDown||a.interacting()||et(a,Je(a,n,o,s,r),r),function(e,t){var i=e.interaction;if(i.pointerIsDown&&!i.interacting()&&i.pointerWasMoved&&i.prepared.name){t.fire("autoStart:before-start",e);var r=i.interactable,a=i.prepared.name;a&&r&&(r.options[a].manualStart||!tt(r,i.element,i.prepared,t)?i.stop():(i.start(i.prepared,r,i.element),at(i,t)))}}(e,t)},"interactions:stop":function(e,t){var i=e.interaction,r=i.interactable;r&&r.options.styleCursor&&rt(i.element,"",t)}},maxInteractions:it,withinInteractionLimit:tt,validateAction:Ze},ot={id:"auto-start/dragAxis",listeners:{"autoStart:before-start":function(e,t){var i=e.interaction,r=e.eventTarget,a=e.dx,n=e.dy;if("drag"===i.prepared.name){var o=Math.abs(a),s=Math.abs(n),l=i.interactable.options.drag,u=l.startAxis,c=o>s?"x":o<s?"y":"xy";if(i.prepared.axis="start"===l.lockAxis?c[0]:l.lockAxis,"xy"!==c&&"xy"!==u&&u!==c){i.prepared.name=null;for(var d=r,p=function(e){if(e!==i.interactable){var a=i.interactable.options.drag;if(!a.manualStart&&e.testIgnoreAllow(a,d,r)){var n=e.getAction(i.downPointer,i.downEvent,i,d);if(n&&"drag"===n.name&&function(e,t){if(!t)return!1;var i=t.options.drag.startAxis;return"xy"===e||"xy"===i||i===e}(c,e)&&nt.validateAction(n,e,d,r,t))return e}}};P.element(d);){var h=t.interactables.forEachMatch(d,p);if(h){i.prepared.name="drag",i.interactable=h,i.element=d;break}d=R(d)}}}}}};function st(e){var t=e.prepared&&e.prepared.name;if(!t)return null;var i=e.interactable.options;return i[t].hold||i[t].delay}var lt={id:"auto-start/hold",install:function(e){var t=e.defaults;e.usePlugin(nt),t.perAction.hold=0,t.perAction.delay=0},listeners:{"interactions:new":function(e){e.interaction.autoStartHoldTimer=null},"autoStart:prepared":function(e){var t=e.interaction,i=st(t);i>0&&(t.autoStartHoldTimer=setTimeout((function(){t.start(t.prepared,t.interactable,t.element)}),i))},"interactions:move":function(e){var t=e.interaction,i=e.duplicate;t.autoStartHoldTimer&&t.pointerWasMoved&&!i&&(clearTimeout(t.autoStartHoldTimer),t.autoStartHoldTimer=null)},"autoStart:before-start":function(e){var t=e.interaction;st(t)>0&&(t.prepared.name=null)}},getHoldDuration:st},ut={id:"auto-start",install:function(e){e.usePlugin(nt),e.usePlugin(lt),e.usePlugin(ot)}},ct=function(e){return/^(always|never|auto)$/.test(e)?(this.options.preventDefault=e,this):P.bool(e)?(this.options.preventDefault=e?"always":"never",this):this.options.preventDefault};function dt(e){var t=e.interaction,i=e.event;t.interactable&&t.interactable.checkAndPreventDefault(i)}var pt={id:"core/interactablePreventDefault",install:function(e){var t=e.Interactable;t.prototype.preventDefault=ct,t.prototype.checkAndPreventDefault=function(t){return function(e,t,i){var r=e.options.preventDefault;if("never"!==r)if("always"!==r){if(t.events.supportsPassive&&/^touch(start|move)$/.test(i.type)){var a=b(i.target).document,n=t.getDocOptions(a);if(!n||!n.events||!1!==n.events.passive)return}/^(mouse|pointer|touch)*(down|start)/i.test(i.type)||P.element(i.target)&&F(i.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||i.preventDefault()}else i.preventDefault()}(this,e,t)},e.interactions.docEvents.push({type:"dragstart",listener:function(t){for(var i=0,r=e.interactions.list;i<r.length;i++){var a=r[i];if(a.element&&(a.element===t.target||_(a.element,t.target)))return void a.interactable.checkAndPreventDefault(t)}}})},listeners:["down","move","up","cancel"].reduce((function(e,t){return e["interactions:".concat(t)]=dt,e}),{})};function ht(e,t){if(t.phaselessTypes[e])return!0;for(var i in t.map)if(0===e.indexOf(i)&&e.substr(i.length)in t.phases)return!0;return!1}function mt(e){var t={};for(var i in e){var r=e[i];P.plainObject(r)?t[i]=mt(r):P.array(r)?t[i]=ye(r):t[i]=r}return t}var gt=function(){function e(t){a(this,e),this.states=[],this.startOffset={left:0,right:0,top:0,bottom:0},this.startDelta=void 0,this.result=void 0,this.endResult=void 0,this.startEdges=void 0,this.edges=void 0,this.interaction=void 0,this.interaction=t,this.result=ft(),this.edges={left:!1,right:!1,top:!1,bottom:!1}}return o(e,[{key:"start",value:function(e,t){var i,r,a,n,o,s=e.phase,l=this.interaction,u=(n=(a=l).interactable.options[a.prepared.name],(o=n.modifiers)&&o.length?o:["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map((function(e){var t=n[e];return t&&t.enabled&&{options:t,methods:t._methods}})).filter((function(e){return!!e})));this.prepareStates(u),this.startEdges=W({},l.edges),this.edges=W({},this.startEdges),this.startOffset=(r=t,(i=l.rect)?{left:r.x-i.left,top:r.y-i.top,right:i.right-r.x,bottom:i.bottom-r.y}:{left:0,top:0,right:0,bottom:0}),this.startDelta={x:0,y:0};var c=this.fillArg({phase:s,pageCoords:t,preEnd:!1});return this.result=ft(),this.startAll(c),this.result=this.setAll(c)}},{key:"fillArg",value:function(e){var t=this.interaction;return e.interaction=t,e.interactable=t.interactable,e.element=t.element,e.rect||(e.rect=t.rect),e.edges||(e.edges=this.startEdges),e.startOffset=this.startOffset,e}},{key:"startAll",value:function(e){for(var t=0,i=this.states;t<i.length;t++){var r=i[t];r.methods.start&&(e.state=r,r.methods.start(e))}}},{key:"setAll",value:function(e){var t=e.phase,i=e.preEnd,r=e.skipModifiers,a=e.rect,n=e.edges;e.coords=W({},e.pageCoords),e.rect=W({},a),e.edges=W({},n);for(var o=r?this.states.slice(r):this.states,s=ft(e.coords,e.rect),l=0;l<o.length;l++){var u,c=o[l],d=c.options,p=W({},e.coords),h=null;null!=(u=c.methods)&&u.set&&this.shouldDo(d,i,t)&&(e.state=c,h=c.methods.set(e),j(e.edges,e.rect,{x:e.coords.x-p.x,y:e.coords.y-p.y})),s.eventProps.push(h)}W(this.edges,e.edges),s.delta.x=e.coords.x-e.pageCoords.x,s.delta.y=e.coords.y-e.pageCoords.y,s.rectDelta.left=e.rect.left-a.left,s.rectDelta.right=e.rect.right-a.right,s.rectDelta.top=e.rect.top-a.top,s.rectDelta.bottom=e.rect.bottom-a.bottom;var m=this.result.coords,g=this.result.rect;if(m&&g){var f=s.rect.left!==g.left||s.rect.right!==g.right||s.rect.top!==g.top||s.rect.bottom!==g.bottom;s.changed=f||m.x!==s.coords.x||m.y!==s.coords.y}return s}},{key:"applyToInteraction",value:function(e){var t=this.interaction,i=e.phase,r=t.coords.cur,a=t.coords.start,n=this.result,o=this.startDelta,s=n.delta;"start"===i&&W(this.startDelta,n.delta);for(var l=0,u=[[a,o],[r,s]];l<u.length;l++){var c=u[l],d=c[0],p=c[1];d.page.x+=p.x,d.page.y+=p.y,d.client.x+=p.x,d.client.y+=p.y}var h=this.result.rectDelta,m=e.rect||t.rect;m.left+=h.left,m.right+=h.right,m.top+=h.top,m.bottom+=h.bottom,m.width=m.right-m.left,m.height=m.bottom-m.top}},{key:"setAndApply",value:function(e){var t=this.interaction,i=e.phase,r=e.preEnd,a=e.skipModifiers,n=this.setAll(this.fillArg({preEnd:r,phase:i,pageCoords:e.modifiedCoords||t.coords.cur.page}));if(this.result=n,!n.changed&&(!a||a<this.states.length)&&t.interacting())return!1;if(e.modifiedCoords){var o=t.coords.cur.page,s={x:e.modifiedCoords.x-o.x,y:e.modifiedCoords.y-o.y};n.coords.x+=s.x,n.coords.y+=s.y,n.delta.x+=s.x,n.delta.y+=s.y}this.applyToInteraction(e)}},{key:"beforeEnd",value:function(e){var t=e.interaction,i=e.event,r=this.states;if(r&&r.length){for(var a=!1,n=0;n<r.length;n++){var o=r[n];e.state=o;var s=o.options,l=o.methods,u=l.beforeEnd&&l.beforeEnd(e);if(u)return this.endResult=u,!1;a=a||!a&&this.shouldDo(s,!0,e.phase,!0)}a&&t.move({event:i,preEnd:!0})}}},{key:"stop",value:function(e){var t=e.interaction;if(this.states&&this.states.length){var i=W({states:this.states,interactable:t.interactable,element:t.element,rect:null},e);this.fillArg(i);for(var r=0,a=this.states;r<a.length;r++){var n=a[r];i.state=n,n.methods.stop&&n.methods.stop(i)}this.states=null,this.endResult=null}}},{key:"prepareStates",value:function(e){this.states=[];for(var t=0;t<e.length;t++){var i=e[t],r=i.options,a=i.methods,n=i.name;this.states.push({options:r,methods:a,index:t,name:n})}return this.states}},{key:"restoreInteractionCoords",value:function(e){var t=e.interaction,i=t.coords,r=t.rect,a=t.modification;if(a.result){for(var n=a.startDelta,o=a.result,s=o.delta,l=o.rectDelta,u=0,c=[[i.start,n],[i.cur,s]];u<c.length;u++){var d=c[u],p=d[0],h=d[1];p.page.x-=h.x,p.page.y-=h.y,p.client.x-=h.x,p.client.y-=h.y}r.left-=l.left,r.right-=l.right,r.top-=l.top,r.bottom-=l.bottom}}},{key:"shouldDo",value:function(e,t,i,r){return!(!e||!1===e.enabled||r&&!e.endOnly||e.endOnly&&!t||"start"===i&&!e.setStart)}},{key:"copyFrom",value:function(e){this.startOffset=e.startOffset,this.startDelta=e.startDelta,this.startEdges=e.startEdges,this.edges=e.edges,this.states=e.states.map((function(e){return mt(e)})),this.result=ft(W({},e.result.coords),W({},e.result.rect))}},{key:"destroy",value:function(){for(var e in this)this[e]=null}}]),e}();function ft(e,t){return{rect:t,coords:e,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}function vt(e,t){var i=e.defaults,r={start:e.start,set:e.set,beforeEnd:e.beforeEnd,stop:e.stop},a=function(e){var a=e||{};for(var n in a.enabled=!1!==a.enabled,i)n in a||(a[n]=i[n]);var o={options:a,methods:r,name:t,enable:function(){return a.enabled=!0,o},disable:function(){return a.enabled=!1,o}};return o};return t&&"string"==typeof t&&(a._defaults=i,a._methods=r),a}function yt(e){var t=e.iEvent,i=e.interaction.modification.result;i&&(t.modifiers=i.eventProps)}var bt={id:"modifiers/base",before:["actions"],install:function(e){e.defaults.perAction.modifiers=[]},listeners:{"interactions:new":function(e){var t=e.interaction;t.modification=new gt(t)},"interactions:before-action-start":function(e){var t=e.interaction,i=e.interaction.modification;i.start(e,t.coords.start.page),t.edges=i.edges,i.applyToInteraction(e)},"interactions:before-action-move":function(e){var t=e.interaction,i=t.modification,r=i.setAndApply(e);return t.edges=i.edges,r},"interactions:before-action-end":function(e){var t=e.interaction,i=t.modification,r=i.beforeEnd(e);return t.edges=i.startEdges,r},"interactions:action-start":yt,"interactions:action-move":yt,"interactions:action-end":yt,"interactions:after-action-start":function(e){return e.interaction.modification.restoreInteractionCoords(e)},"interactions:after-action-move":function(e){return e.interaction.modification.restoreInteractionCoords(e)},"interactions:stop":function(e){return e.interaction.modification.stop(e)}}},St={base:{preventDefault:"auto",deltaSource:"page"},perAction:{enabled:!1,origin:{x:0,y:0}},actions:{}},Ct=function(e){l(i,e);var t=p(i);function i(e,r,n,o,s,l,u){var c;a(this,i),(c=t.call(this,e)).relatedTarget=null,c.screenX=void 0,c.screenY=void 0,c.button=void 0,c.buttons=void 0,c.ctrlKey=void 0,c.shiftKey=void 0,c.altKey=void 0,c.metaKey=void 0,c.page=void 0,c.client=void 0,c.delta=void 0,c.rect=void 0,c.x0=void 0,c.y0=void 0,c.t0=void 0,c.dt=void 0,c.duration=void 0,c.clientX0=void 0,c.clientY0=void 0,c.velocity=void 0,c.speed=void 0,c.swipe=void 0,c.axes=void 0,c.preEnd=void 0,s=s||e.element;var p=e.interactable,h=(p&&p.options||St).deltaSource,m=Y(p,s,n),g="start"===o,f="end"===o,v=g?d(c):e.prevEvent,y=g?e.coords.start:f?{page:v.page,client:v.client,timeStamp:e.coords.cur.timeStamp}:e.coords.cur;return c.page=W({},y.page),c.client=W({},y.client),c.rect=W({},e.rect),c.timeStamp=y.timeStamp,f||(c.page.x-=m.x,c.page.y-=m.y,c.client.x-=m.x,c.client.y-=m.y),c.ctrlKey=r.ctrlKey,c.altKey=r.altKey,c.shiftKey=r.shiftKey,c.metaKey=r.metaKey,c.button=r.button,c.buttons=r.buttons,c.target=s,c.currentTarget=s,c.preEnd=l,c.type=u||n+(o||""),c.interactable=p,c.t0=g?e.pointers[e.pointers.length-1].downTime:v.t0,c.x0=e.coords.start.page.x-m.x,c.y0=e.coords.start.page.y-m.y,c.clientX0=e.coords.start.client.x-m.x,c.clientY0=e.coords.start.client.y-m.y,c.delta=g||f?{x:0,y:0}:{x:c[h].x-v[h].x,y:c[h].y-v[h].y},c.dt=e.coords.delta.timeStamp,c.duration=c.timeStamp-c.t0,c.velocity=W({},e.coords.velocity[h]),c.speed=J(c.velocity.x,c.velocity.y),c.swipe=f||"inertiastart"===o?c.getSwipe():null,c}return o(i,[{key:"getSwipe",value:function(){var e=this._interaction;if(e.prevEvent.speed<600||this.timeStamp-e.prevEvent.timeStamp>150)return null;var t=180*Math.atan2(e.prevEvent.velocityY,e.prevEvent.velocityX)/Math.PI;t<0&&(t+=360);var i=112.5<=t&&t<247.5,r=202.5<=t&&t<337.5;return{up:r,down:!r&&22.5<=t&&t<157.5,left:i,right:!i&&(292.5<=t||t<67.5),angle:t,speed:e.prevEvent.speed,velocity:{x:e.prevEvent.velocityX,y:e.prevEvent.velocityY}}}},{key:"preventDefault",value:function(){}},{key:"stopImmediatePropagation",value:function(){this.immediatePropagationStopped=this.propagationStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}}]),i}(fe);Object.defineProperties(Ct.prototype,{pageX:{get:function(){return this.page.x},set:function(e){this.page.x=e}},pageY:{get:function(){return this.page.y},set:function(e){this.page.y=e}},clientX:{get:function(){return this.client.x},set:function(e){this.client.x=e}},clientY:{get:function(){return this.client.y},set:function(e){this.client.y=e}},dx:{get:function(){return this.delta.x},set:function(e){this.delta.x=e}},dy:{get:function(){return this.delta.y},set:function(e){this.delta.y=e}},velocityX:{get:function(){return this.velocity.x},set:function(e){this.velocity.x=e}},velocityY:{get:function(){return this.velocity.y},set:function(e){this.velocity.y=e}}});var Pt,kt=o((function e(t,i,r,n,o){a(this,e),this.id=void 0,this.pointer=void 0,this.event=void 0,this.downTime=void 0,this.downTarget=void 0,this.id=t,this.pointer=i,this.event=r,this.downTime=n,this.downTarget=o})),Tt=((Pt={}).interactable="",Pt.element="",Pt.prepared="",Pt.pointerIsDown="",Pt.pointerWasMoved="",Pt._proxy="",Pt),Mt=function(e){return e.start="",e.move="",e.end="",e.stop="",e.interacting="",e}({}),Lt=0,wt=function(){function e(t){var i=this,r=t.pointerType,n=t.scopeFire;a(this,e),this.interactable=null,this.element=null,this.rect=null,this._rects=void 0,this.edges=null,this._scopeFire=void 0,this.prepared={name:null,axis:null,edges:null},this.pointerType=void 0,this.pointers=[],this.downEvent=null,this.downPointer={},this._latestPointer={pointer:null,event:null,eventTarget:null},this.prevEvent=null,this.pointerIsDown=!1,this.pointerWasMoved=!1,this._interacting=!1,this._ending=!1,this._stopped=!0,this._proxy=void 0,this.simulation=null,this.doMove=Ge((function(e){this.move(e)}),"The interaction.doMove() method has been renamed to interaction.move()"),this.coords={start:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},prev:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},cur:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},delta:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},velocity:{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}},this._id=Lt++,this._scopeFire=n,this.pointerType=r;var o=this;this._proxy={};var s=function(e){Object.defineProperty(i._proxy,e,{get:function(){return o[e]}})};for(var l in Tt)s(l);var u=function(e){Object.defineProperty(i._proxy,e,{value:function(){return o[e].apply(o,arguments)}})};for(var c in Mt)u(c);this._scopeFire("interactions:new",{interaction:this})}return o(e,[{key:"pointerMoveTolerance",get:function(){return 1}},{key:"pointerDown",value:function(e,t,i){var r=this.updatePointer(e,t,i,!0),a=this.pointers[r];this._scopeFire("interactions:down",{pointer:e,event:t,eventTarget:i,pointerIndex:r,pointerInfo:a,type:"down",interaction:this})}},{key:"start",value:function(e,t,i){return!(this.interacting()||!this.pointerIsDown||this.pointers.length<("gesture"===e.name?2:1)||!t.options[e.name].enabled)&&(Ke(this.prepared,e),this.interactable=t,this.element=i,this.rect=t.getRect(i),this.edges=this.prepared.edges?W({},this.prepared.edges):{left:!0,right:!0,top:!0,bottom:!0},this._stopped=!1,this._interacting=this._doPhase({interaction:this,event:this.downEvent,phase:"start"})&&!this._stopped,this._interacting)}},{key:"pointerMove",value:function(e,t,i){this.simulation||this.modification&&this.modification.endResult||this.updatePointer(e,t,i,!1);var r,a,n=this.coords.cur.page.x===this.coords.prev.page.x&&this.coords.cur.page.y===this.coords.prev.page.y&&this.coords.cur.client.x===this.coords.prev.client.x&&this.coords.cur.client.y===this.coords.prev.client.y;this.pointerIsDown&&!this.pointerWasMoved&&(r=this.coords.cur.client.x-this.coords.start.client.x,a=this.coords.cur.client.y-this.coords.start.client.y,this.pointerWasMoved=J(r,a)>this.pointerMoveTolerance);var o,s,l,u=this.getPointerIndex(e),c={pointer:e,pointerIndex:u,pointerInfo:this.pointers[u],event:t,type:"move",eventTarget:i,dx:r,dy:a,duplicate:n,interaction:this};n||(o=this.coords.velocity,s=this.coords.delta,l=Math.max(s.timeStamp/1e3,.001),o.page.x=s.page.x/l,o.page.y=s.page.y/l,o.client.x=s.client.x/l,o.client.y=s.client.y/l,o.timeStamp=l),this._scopeFire("interactions:move",c),n||this.simulation||(this.interacting()&&(c.type=null,this.move(c)),this.pointerWasMoved&&ie(this.coords.prev,this.coords.cur))}},{key:"move",value:function(e){e&&e.event||re(this.coords.delta),(e=W({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},e||{})).phase="move",this._doPhase(e)}},{key:"pointerUp",value:function(e,t,i,r){var a=this.getPointerIndex(e);-1===a&&(a=this.updatePointer(e,t,i,!1));var n=/cancel$/i.test(t.type)?"cancel":"up";this._scopeFire("interactions:".concat(n),{pointer:e,pointerIndex:a,pointerInfo:this.pointers[a],event:t,eventTarget:i,type:n,curEventTarget:r,interaction:this}),this.simulation||this.end(t),this.removePointer(e,t)}},{key:"documentBlur",value:function(e){this.end(e),this._scopeFire("interactions:blur",{event:e,type:"blur",interaction:this})}},{key:"end",value:function(e){var t;this._ending=!0,e=e||this._latestPointer.event,this.interacting()&&(t=this._doPhase({event:e,interaction:this,phase:"end"})),this._ending=!1,!0===t&&this.stop()}},{key:"currentAction",value:function(){return this._interacting?this.prepared.name:null}},{key:"interacting",value:function(){return this._interacting}},{key:"stop",value:function(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}},{key:"getPointerIndex",value:function(e){var t=se(e);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:be(this.pointers,(function(e){return e.id===t}))}},{key:"getPointerInfo",value:function(e){return this.pointers[this.getPointerIndex(e)]}},{key:"updatePointer",value:function(e,t,i,r){var a,n,o,s=se(e),l=this.getPointerIndex(e),u=this.pointers[l];return r=!1!==r&&(r||/(down|start)$/i.test(t.type)),u?u.pointer=e:(u=new kt(s,e,t,null,null),l=this.pointers.length,this.pointers.push(u)),le(this.coords.cur,this.pointers.map((function(e){return e.pointer})),this._now()),a=this.coords.delta,n=this.coords.prev,o=this.coords.cur,a.page.x=o.page.x-n.page.x,a.page.y=o.page.y-n.page.y,a.client.x=o.client.x-n.client.x,a.client.y=o.client.y-n.client.y,a.timeStamp=o.timeStamp-n.timeStamp,r&&(this.pointerIsDown=!0,u.downTime=this.coords.cur.timeStamp,u.downTarget=i,te(this.downPointer,e),this.interacting()||(ie(this.coords.start,this.coords.cur),ie(this.coords.prev,this.coords.cur),this.downEvent=t,this.pointerWasMoved=!1)),this._updateLatestPointer(e,t,i),this._scopeFire("interactions:update-pointer",{pointer:e,event:t,eventTarget:i,down:r,pointerInfo:u,pointerIndex:l,interaction:this}),l}},{key:"removePointer",value:function(e,t){var i=this.getPointerIndex(e);if(-1!==i){var r=this.pointers[i];this._scopeFire("interactions:remove-pointer",{pointer:e,event:t,eventTarget:null,pointerIndex:i,pointerInfo:r,interaction:this}),this.pointers.splice(i,1),this.pointerIsDown=!1}}},{key:"_updateLatestPointer",value:function(e,t,i){this._latestPointer.pointer=e,this._latestPointer.event=t,this._latestPointer.eventTarget=i}},{key:"destroy",value:function(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}},{key:"_createPreparedEvent",value:function(e,t,i,r){return new Ct(this,e,this.prepared.name,t,this.element,i,r)}},{key:"_fireEvent",value:function(e){var t;null==(t=this.interactable)||t.fire(e),(!this.prevEvent||e.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=e)}},{key:"_doPhase",value:function(e){var t=e.event,i=e.phase,r=e.preEnd,a=e.type,n=this.rect;if(n&&"move"===i&&(j(this.edges,n,this.coords.delta[this.interactable.options.deltaSource]),n.width=n.right-n.left,n.height=n.bottom-n.top),!1===this._scopeFire("interactions:before-action-".concat(i),e))return!1;var o=e.iEvent=this._createPreparedEvent(t,i,r,a);return this._scopeFire("interactions:action-".concat(i),e),"start"===i&&(this.prevEvent=o),this._fireEvent(o),this._scopeFire("interactions:after-action-".concat(i),e),!0}},{key:"_now",value:function(){return Date.now()}}]),e}();function Dt(e){Ot(e.interaction)}function Ot(e){if(!(t=e).offset.pending.x&&!t.offset.pending.y)return!1;var t,i=e.offset.pending;return xt(e.coords.cur,i),xt(e.coords.delta,i),j(e.edges,e.rect,i),i.x=0,i.y=0,!0}function It(e){var t=e.x,i=e.y;this.offset.pending.x+=t,this.offset.pending.y+=i,this.offset.total.x+=t,this.offset.total.y+=i}function xt(e,t){var i=e.page,r=e.client,a=t.x,n=t.y;i.x+=a,i.y+=n,r.x+=a,r.y+=n}Mt.offsetBy="";var _t={id:"offset",before:["modifiers","pointer-events","actions","inertia"],install:function(e){e.Interaction.prototype.offsetBy=It},listeners:{"interactions:new":function(e){e.interaction.offset={total:{x:0,y:0},pending:{x:0,y:0}}},"interactions:update-pointer":function(e){var t;(t=e.interaction).pointerIsDown&&(xt(t.coords.cur,t.offset.total),t.offset.pending.x=0,t.offset.pending.y=0)},"interactions:before-action-start":Dt,"interactions:before-action-move":Dt,"interactions:before-action-end":function(e){var t=e.interaction;if(Ot(t))return t.move({offset:!0}),t.end(),!1},"interactions:stop":function(e){var t=e.interaction;t.offset.total.x=0,t.offset.total.y=0,t.offset.pending.x=0,t.offset.pending.y=0}}},At=function(){function e(t){a(this,e),this.active=!1,this.isModified=!1,this.smoothEnd=!1,this.allowResume=!1,this.modification=void 0,this.modifierCount=0,this.modifierArg=void 0,this.startCoords=void 0,this.t0=0,this.v0=0,this.te=0,this.targetOffset=void 0,this.modifiedOffset=void 0,this.currentOffset=void 0,this.lambda_v0=0,this.one_ve_v0=0,this.timeout=void 0,this.interaction=void 0,this.interaction=t}return o(e,[{key:"start",value:function(e){var t=this.interaction,i=Rt(t);if(!i||!i.enabled)return!1;var r=t.coords.velocity.client,a=J(r.x,r.y),n=this.modification||(this.modification=new gt(t));if(n.copyFrom(t.modification),this.t0=t._now(),this.allowResume=i.allowResume,this.v0=a,this.currentOffset={x:0,y:0},this.startCoords=t.coords.cur.page,this.modifierArg=n.fillArg({pageCoords:this.startCoords,preEnd:!0,phase:"inertiastart"}),this.t0-t.coords.cur.timeStamp<50&&a>i.minSpeed&&a>i.endSpeed)this.startInertia();else{if(n.result=n.setAll(this.modifierArg),!n.result.changed)return!1;this.startSmoothEnd()}return t.modification.result.rect=null,t.offsetBy(this.targetOffset),t._doPhase({interaction:t,event:e,phase:"inertiastart"}),t.offsetBy({x:-this.targetOffset.x,y:-this.targetOffset.y}),t.modification.result.rect=null,this.active=!0,t.simulation=this,!0}},{key:"startInertia",value:function(){var e=this,t=this.interaction.coords.velocity.client,i=Rt(this.interaction),r=i.resistance,a=-Math.log(i.endSpeed/this.v0)/r;this.targetOffset={x:(t.x-a)/r,y:(t.y-a)/r},this.te=a,this.lambda_v0=r/this.v0,this.one_ve_v0=1-i.endSpeed/this.v0;var n=this.modification,o=this.modifierArg;o.pageCoords={x:this.startCoords.x+this.targetOffset.x,y:this.startCoords.y+this.targetOffset.y},n.result=n.setAll(o),n.result.changed&&(this.isModified=!0,this.modifiedOffset={x:this.targetOffset.x+n.result.delta.x,y:this.targetOffset.y+n.result.delta.y}),this.onNextFrame((function(){return e.inertiaTick()}))}},{key:"startSmoothEnd",value:function(){var e=this;this.smoothEnd=!0,this.isModified=!0,this.targetOffset={x:this.modification.result.delta.x,y:this.modification.result.delta.y},this.onNextFrame((function(){return e.smoothEndTick()}))}},{key:"onNextFrame",value:function(e){var t=this;this.timeout=Ue.request((function(){t.active&&e()}))}},{key:"inertiaTick",value:function(){var e,t,i,r,a,n,o,s=this,l=this.interaction,u=Rt(l).resistance,c=(l._now()-this.t0)/1e3;if(c<this.te){var d,p=1-(Math.exp(-u*c)-this.lambda_v0)/this.one_ve_v0;this.isModified?(e=0,t=0,i=this.targetOffset.x,r=this.targetOffset.y,a=this.modifiedOffset.x,n=this.modifiedOffset.y,d={x:Ft(o=p,e,i,a),y:Ft(o,t,r,n)}):d={x:this.targetOffset.x*p,y:this.targetOffset.y*p};var h={x:d.x-this.currentOffset.x,y:d.y-this.currentOffset.y};this.currentOffset.x+=h.x,this.currentOffset.y+=h.y,l.offsetBy(h),l.move(),this.onNextFrame((function(){return s.inertiaTick()}))}else l.offsetBy({x:this.modifiedOffset.x-this.currentOffset.x,y:this.modifiedOffset.y-this.currentOffset.y}),this.end()}},{key:"smoothEndTick",value:function(){var e=this,t=this.interaction,i=t._now()-this.t0,r=Rt(t).smoothEndDuration;if(i<r){var a={x:Et(i,0,this.targetOffset.x,r),y:Et(i,0,this.targetOffset.y,r)},n={x:a.x-this.currentOffset.x,y:a.y-this.currentOffset.y};this.currentOffset.x+=n.x,this.currentOffset.y+=n.y,t.offsetBy(n),t.move({skipModifiers:this.modifierCount}),this.onNextFrame((function(){return e.smoothEndTick()}))}else t.offsetBy({x:this.targetOffset.x-this.currentOffset.x,y:this.targetOffset.y-this.currentOffset.y}),this.end()}},{key:"resume",value:function(e){var t=e.pointer,i=e.event,r=e.eventTarget,a=this.interaction;a.offsetBy({x:-this.currentOffset.x,y:-this.currentOffset.y}),a.updatePointer(t,i,r,!0),a._doPhase({interaction:a,event:i,phase:"resume"}),ie(a.coords.prev,a.coords.cur),this.stop()}},{key:"end",value:function(){this.interaction.move(),this.interaction.end(),this.stop()}},{key:"stop",value:function(){this.active=this.smoothEnd=!1,this.interaction.simulation=null,Ue.cancel(this.timeout)}}]),e}();function Rt(e){var t=e.interactable,i=e.prepared;return t&&t.options&&i.name&&t.options[i.name].inertia}function Ft(e,t,i,r){var a=1-e;return a*a*t+2*a*e*i+e*e*r}function Et(e,t,i,r){return-i*(e/=r)*(e-2)+t}var Bt={id:"inertia",before:["modifiers","actions"],install:function(e){var t=e.defaults;e.usePlugin(_t),e.usePlugin(bt),e.actions.phases.inertiastart=!0,e.actions.phases.resume=!0,t.perAction.inertia={enabled:!1,resistance:10,minSpeed:100,endSpeed:10,allowResume:!0,smoothEndDuration:300}},listeners:{"interactions:new":function(e){var t=e.interaction;t.inertia=new At(t)},"interactions:before-action-end":function(e){var t=e.interaction,i=e.event;return(!t._interacting||t.simulation||!t.inertia.start(i))&&null},"interactions:down":function(e){var t=e.interaction,i=e.eventTarget,r=t.inertia;if(r.active)for(var a=i;P.element(a);){if(a===t.element){r.resume(e);break}a=R(a)}},"interactions:stop":function(e){var t=e.interaction.inertia;t.active&&t.stop()},"interactions:before-action-resume":function(e){var t=e.interaction.modification;t.stop(e),t.start(e,e.interaction.coords.cur.page),t.applyToInteraction(e)},"interactions:before-action-inertiastart":function(e){return e.interaction.modification.setAndApply(e)},"interactions:action-resume":yt,"interactions:action-inertiastart":yt,"interactions:after-action-inertiastart":function(e){return e.interaction.modification.restoreInteractionCoords(e)},"interactions:after-action-resume":function(e){return e.interaction.modification.restoreInteractionCoords(e)}}};function zt(e,t){for(var i=0;i<t.length;i++){var r=t[i];if(e.immediatePropagationStopped)break;r(e)}}var $t=function(){function e(t){a(this,e),this.options=void 0,this.types={},this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.global=void 0,this.options=W({},t||{})}return o(e,[{key:"fire",value:function(e){var t,i=this.global;(t=this.types[e.type])&&zt(e,t),!e.propagationStopped&&i&&(t=i[e.type])&&zt(e,t)}},{key:"on",value:function(e,t){var i=Z(e,t);for(e in i)this.types[e]=ve(this.types[e]||[],i[e])}},{key:"off",value:function(e,t){var i=Z(e,t);for(e in i){var r=this.types[e];if(r&&r.length)for(var a=0,n=i[e];a<n.length;a++){var o=n[a],s=r.indexOf(o);-1!==s&&r.splice(s,1)}}}},{key:"getRect",value:function(e){return null}}]),e}(),Nt=function(){function e(t){a(this,e),this.currentTarget=void 0,this.originalEvent=void 0,this.type=void 0,this.originalEvent=t,te(this,t)}return o(e,[{key:"preventOriginalDefault",value:function(){this.originalEvent.preventDefault()}},{key:"stopPropagation",value:function(){this.originalEvent.stopPropagation()}},{key:"stopImmediatePropagation",value:function(){this.originalEvent.stopImmediatePropagation()}}]),e}();function Ut(e){return P.object(e)?{capture:!!e.capture,passive:!!e.passive}:{capture:!!e,passive:!1}}function Ht(e,t){return e===t||("boolean"==typeof e?!!t.capture===e&&0==!!t.passive:!!e.capture==!!t.capture&&!!e.passive==!!t.passive)}var Vt={id:"events",install:function(e){var t,i=[],r={},a=[],n={add:o,remove:s,addDelegate:function(e,t,i,n,s){var c=Ut(s);if(!r[i]){r[i]=[];for(var d=0;d<a.length;d++){var p=a[d];o(p,i,l),o(p,i,u,!0)}}var h=r[i],m=Se(h,(function(i){return i.selector===e&&i.context===t}));m||(m={selector:e,context:t,listeners:[]},h.push(m)),m.listeners.push({func:n,options:c})},removeDelegate:function(e,t,i,a,n){var o,c=Ut(n),d=r[i],p=!1;if(d)for(o=d.length-1;o>=0;o--){var h=d[o];if(h.selector===e&&h.context===t){for(var m=h.listeners,g=m.length-1;g>=0;g--){var f=m[g];if(f.func===a&&Ht(f.options,c)){m.splice(g,1),m.length||(d.splice(o,1),s(t,i,l),s(t,i,u,!0)),p=!0;break}}if(p)break}}},delegateListener:l,delegateUseCapture:u,delegatedEvents:r,documents:a,targets:i,supportsOptions:!1,supportsPassive:!1};function o(e,t,r,a){if(e.addEventListener){var o=Ut(a),s=Se(i,(function(t){return t.eventTarget===e}));s||(s={eventTarget:e,events:{}},i.push(s)),s.events[t]||(s.events[t]=[]),Se(s.events[t],(function(e){return e.func===r&&Ht(e.options,o)}))||(e.addEventListener(t,r,n.supportsOptions?o:o.capture),s.events[t].push({func:r,options:o}))}}function s(e,t,r,a){if(e.addEventListener&&e.removeEventListener){var o=be(i,(function(t){return t.eventTarget===e})),l=i[o];if(l&&l.events)if("all"!==t){var u=!1,c=l.events[t];if(c){if("all"===r){for(var d=c.length-1;d>=0;d--){var p=c[d];s(e,t,p.func,p.options)}return}for(var h=Ut(a),m=0;m<c.length;m++){var g=c[m];if(g.func===r&&Ht(g.options,h)){e.removeEventListener(t,r,n.supportsOptions?h:h.capture),c.splice(m,1),0===c.length&&(delete l.events[t],u=!0);break}}}u&&!Object.keys(l.events).length&&i.splice(o,1)}else for(t in l.events)l.events.hasOwnProperty(t)&&s(e,t,"all")}}function l(e,t){for(var i=Ut(t),a=new Nt(e),n=r[e.type],o=ge(e)[0],s=o;P.element(s);){for(var l=0;l<n.length;l++){var u=n[l],c=u.selector,d=u.context;if(F(s,c)&&_(d,o)&&_(d,s)){var p=u.listeners;a.currentTarget=s;for(var h=0;h<p.length;h++){var m=p[h];Ht(m.options,i)&&m.func(a)}}}s=R(s)}}function u(e){return l(e,!0)}return null==(t=e.document)||t.createElement("div").addEventListener("test",null,{get capture(){return n.supportsOptions=!0},get passive(){return n.supportsPassive=!0}}),e.events=n,n}},Wt={methodOrder:["simulationResume","mouseOrPen","hasPointer","idle"],search:function(e){for(var t=0,i=Wt.methodOrder;t<i.length;t++){var r=i[t],a=Wt[r](e);if(a)return a}return null},simulationResume:function(e){var t=e.pointerType,i=e.eventType,r=e.eventTarget,a=e.scope;if(!/down|start/i.test(i))return null;for(var n=0,o=a.interactions.list;n<o.length;n++){var s=o[n],l=r;if(s.simulation&&s.simulation.allowResume&&s.pointerType===t)for(;l;){if(l===s.element)return s;l=R(l)}}return null},mouseOrPen:function(e){var t,i=e.pointerId,r=e.pointerType,a=e.eventType,n=e.scope;if("mouse"!==r&&"pen"!==r)return null;for(var o=0,s=n.interactions.list;o<s.length;o++){var l=s[o];if(l.pointerType===r){if(l.simulation&&!qt(l,i))continue;if(l.interacting())return l;t||(t=l)}}if(t)return t;for(var u=0,c=n.interactions.list;u<c.length;u++){var d=c[u];if(!(d.pointerType!==r||/down/i.test(a)&&d.simulation))return d}return null},hasPointer:function(e){for(var t=e.pointerId,i=0,r=e.scope.interactions.list;i<r.length;i++){var a=r[i];if(qt(a,t))return a}return null},idle:function(e){for(var t=e.pointerType,i=0,r=e.scope.interactions.list;i<r.length;i++){var a=r[i];if(1===a.pointers.length){var n=a.interactable;if(n&&(!n.options.gesture||!n.options.gesture.enabled))continue}else if(a.pointers.length>=2)continue;if(!a.interacting()&&t===a.pointerType)return a}return null}};function qt(e,t){return e.pointers.some((function(e){return e.id===t}))}var Gt=Wt,Kt=["pointerDown","pointerMove","pointerUp","updatePointer","removePointer","windowBlur"];function Qt(e,t){return function(i){var r=t.interactions.list,a=me(i),n=ge(i),o=n[0],s=n[1],l=[];if(/^touch/.test(i.type)){t.prevTouchTime=t.now();for(var u=0,c=i.changedTouches;u<c.length;u++){var d=c[u],p={pointer:d,pointerId:se(d),pointerType:a,eventType:i.type,eventTarget:o,curEventTarget:s,scope:t},h=jt(p);l.push([p.pointer,p.eventTarget,p.curEventTarget,h])}}else{var m=!1;if(!x.supportsPointerEvent&&/mouse/.test(i.type)){for(var g=0;g<r.length&&!m;g++)m="mouse"!==r[g].pointerType&&r[g].pointerIsDown;m=m||t.now()-t.prevTouchTime<500||0===i.timeStamp}if(!m){var f={pointer:i,pointerId:se(i),pointerType:a,eventType:i.type,curEventTarget:s,eventTarget:o,scope:t},v=jt(f);l.push([f.pointer,f.eventTarget,f.curEventTarget,v])}}for(var y=0;y<l.length;y++){var b=l[y],S=b[0],C=b[1],P=b[2];b[3][e](S,i,C,P)}}}function jt(e){var t=e.pointerType,i=e.scope,r={interaction:Gt.search(e),searchDetails:e};return i.fire("interactions:find",r),r.interaction||i.interactions.new({pointerType:t})}function Yt(e,t){var i=e.doc,r=e.scope,a=e.options,n=r.interactions.docEvents,o=r.events,s=o[t];for(var l in r.browser.isIOS&&!a.events&&(a.events={passive:!1}),o.delegatedEvents)s(i,l,o.delegateListener),s(i,l,o.delegateUseCapture,!0);for(var u=a&&a.events,c=0;c<n.length;c++){var d=n[c];s(i,d.type,d.listener,u)}}var Zt={id:"core/interactions",install:function(e){for(var t={},i=0;i<Kt.length;i++){var r=Kt[i];t[r]=Qt(r,e)}var n,s=x.pEventTypes;function u(){for(var t=0,i=e.interactions.list;t<i.length;t++){var r=i[t];if(r.pointerIsDown&&"touch"===r.pointerType&&!r._interacting)for(var a=function(){var t=o[n];e.documents.some((function(e){return _(e.doc,t.downTarget)}))||r.removePointer(t.pointer,t.event)},n=0,o=r.pointers;n<o.length;n++)a()}}(n=O.PointerEvent?[{type:s.down,listener:u},{type:s.down,listener:t.pointerDown},{type:s.move,listener:t.pointerMove},{type:s.up,listener:t.pointerUp},{type:s.cancel,listener:t.pointerUp}]:[{type:"mousedown",listener:t.pointerDown},{type:"mousemove",listener:t.pointerMove},{type:"mouseup",listener:t.pointerUp},{type:"touchstart",listener:u},{type:"touchstart",listener:t.pointerDown},{type:"touchmove",listener:t.pointerMove},{type:"touchend",listener:t.pointerUp},{type:"touchcancel",listener:t.pointerUp}]).push({type:"blur",listener:function(t){for(var i=0,r=e.interactions.list;i<r.length;i++)r[i].documentBlur(t)}}),e.prevTouchTime=0,e.Interaction=function(t){l(r,t);var i=p(r);function r(){return a(this,r),i.apply(this,arguments)}return o(r,[{key:"pointerMoveTolerance",get:function(){return e.interactions.pointerMoveTolerance},set:function(t){e.interactions.pointerMoveTolerance=t}},{key:"_now",value:function(){return e.now()}}]),r}(wt),e.interactions={list:[],new:function(t){t.scopeFire=function(t,i){return e.fire(t,i)};var i=new e.Interaction(t);return e.interactions.list.push(i),i},listeners:t,docEvents:n,pointerMoveTolerance:1},e.usePlugin(pt)},listeners:{"scope:add-document":function(e){return Yt(e,"add")},"scope:remove-document":function(e){return Yt(e,"remove")},"interactable:unset":function(e,t){for(var i=e.interactable,r=t.interactions.list.length-1;r>=0;r--){var a=t.interactions.list[r];a.interactable===i&&(a.stop(),t.fire("interactions:destroy",{interaction:a}),a.destroy(),t.interactions.list.length>2&&t.interactions.list.splice(r,1))}}},onDocSignal:Yt,doOnInteractions:Qt,methodNames:Kt},Xt=Zt,Jt=function(e){return e[e.On=0]="On",e[e.Off=1]="Off",e}(Jt||{}),ei=function(){function e(t,i,r,n){a(this,e),this.target=void 0,this.options=void 0,this._actions=void 0,this.events=new $t,this._context=void 0,this._win=void 0,this._doc=void 0,this._scopeEvents=void 0,this._actions=i.actions,this.target=t,this._context=i.context||r,this._win=b(V(t)?this._context:t),this._doc=this._win.document,this._scopeEvents=n,this.set(i)}return o(e,[{key:"_defaults",get:function(){return{base:{},perAction:{},actions:{}}}},{key:"setOnEvents",value:function(e,t){return P.func(t.onstart)&&this.on("".concat(e,"start"),t.onstart),P.func(t.onmove)&&this.on("".concat(e,"move"),t.onmove),P.func(t.onend)&&this.on("".concat(e,"end"),t.onend),P.func(t.oninertiastart)&&this.on("".concat(e,"inertiastart"),t.oninertiastart),this}},{key:"updatePerActionListeners",value:function(e,t,i){var r,a=this,n=null==(r=this._actions.map[e])?void 0:r.filterEventType,o=function(e){return(null==n||n(e))&&ht(e,a._actions)};(P.array(t)||P.object(t))&&this._onOff(Jt.Off,e,t,void 0,o),(P.array(i)||P.object(i))&&this._onOff(Jt.On,e,i,void 0,o)}},{key:"setPerAction",value:function(e,t){var i=this._defaults;for(var r in t){var a=r,n=this.options[e],o=t[a];"listeners"===a&&this.updatePerActionListeners(e,n.listeners,o),P.array(o)?n[a]=ye(o):P.plainObject(o)?(n[a]=W(n[a]||{},mt(o)),P.object(i.perAction[a])&&"enabled"in i.perAction[a]&&(n[a].enabled=!1!==o.enabled)):P.bool(o)&&P.object(i.perAction[a])?n[a].enabled=o:n[a]=o}}},{key:"getRect",value:function(e){return e=e||(P.element(this.target)?this.target:null),P.string(this.target)&&(e=e||this._context.querySelector(this.target)),U(e)}},{key:"rectChecker",value:function(e){var t=this;return P.func(e)?(this.getRect=function(i){var r=W({},e.apply(t,i));return"width"in r||(r.width=r.right-r.left,r.height=r.bottom-r.top),r},this):null===e?(delete this.getRect,this):this.getRect}},{key:"_backCompatOption",value:function(e,t){if(V(t)||P.object(t)){for(var i in this.options[e]=t,this._actions.map)this.options[i][e]=t;return this}return this.options[e]}},{key:"origin",value:function(e){return this._backCompatOption("origin",e)}},{key:"deltaSource",value:function(e){return"page"===e||"client"===e?(this.options.deltaSource=e,this):this.options.deltaSource}},{key:"getAllElements",value:function(){var e=this.target;return P.string(e)?Array.from(this._context.querySelectorAll(e)):P.func(e)&&e.getAllElements?e.getAllElements():P.element(e)?[e]:[]}},{key:"context",value:function(){return this._context}},{key:"inContext",value:function(e){return this._context===e.ownerDocument||_(this._context,e)}},{key:"testIgnoreAllow",value:function(e,t,i){return!this.testIgnore(e.ignoreFrom,t,i)&&this.testAllow(e.allowFrom,t,i)}},{key:"testAllow",value:function(e,t,i){return!e||!!P.element(i)&&(P.string(e)?z(i,e,t):!!P.element(e)&&_(e,i))}},{key:"testIgnore",value:function(e,t,i){return!(!e||!P.element(i))&&(P.string(e)?z(i,e,t):!!P.element(e)&&_(e,i))}},{key:"fire",value:function(e){return this.events.fire(e),this}},{key:"_onOff",value:function(e,t,i,r,a){P.object(t)&&!P.array(t)&&(r=i,i=null);var n=Z(t,i,a);for(var o in n){"wheel"===o&&(o=x.wheelEvent);for(var s=0,l=n[o];s<l.length;s++){var u=l[s];ht(o,this._actions)?this.events[e===Jt.On?"on":"off"](o,u):P.string(this.target)?this._scopeEvents[e===Jt.On?"addDelegate":"removeDelegate"](this.target,this._context,o,u,r):this._scopeEvents[e===Jt.On?"add":"remove"](this.target,o,u,r)}}return this}},{key:"on",value:function(e,t,i){return this._onOff(Jt.On,e,t,i)}},{key:"off",value:function(e,t,i){return this._onOff(Jt.Off,e,t,i)}},{key:"set",value:function(e){var t=this._defaults;for(var i in P.object(e)||(e={}),this.options=mt(t.base),this._actions.methodDict){var r=i,a=this._actions.methodDict[r];this.options[r]={},this.setPerAction(r,W(W({},t.perAction),t.actions[r])),this[a](e[r])}for(var n in e)"getRect"!==n?P.func(this[n])&&this[n](e[n]):this.rectChecker(e.getRect);return this}},{key:"unset",value:function(){if(P.string(this.target))for(var e in this._scopeEvents.delegatedEvents)for(var t=this._scopeEvents.delegatedEvents[e],i=t.length-1;i>=0;i--){var r=t[i],a=r.selector,n=r.context,o=r.listeners;a===this.target&&n===this._context&&t.splice(i,1);for(var s=o.length-1;s>=0;s--)this._scopeEvents.removeDelegate(this.target,this._context,e,o[s][0],o[s][1])}else this._scopeEvents.remove(this.target,"all")}}]),e}(),ti=function(){function e(t){var i=this;a(this,e),this.list=[],this.selectorMap={},this.scope=void 0,this.scope=t,t.addListeners({"interactable:unset":function(e){var t=e.interactable,r=t.target,a=P.string(r)?
vendor: 4,831 bytes, line 1
1i.selectorMap[r]:r[i.scope.id],n=be(a,(function(e){return e===t}));a.splice(n,1)}})}return o(e,[{key:"new",value:function(e,t){t=W(t||{},{actions:this.scope.actions});var i=new this.scope.Interactable(e,t,this.scope.document,this.scope.events);return this.scope.addDocument(i._doc),this.list.push(i),P.string(e)?(this.selectorMap[e]||(this.selectorMap[e]=[]),this.selectorMap[e].push(i)):(i.target[this.scope.id]||Object.defineProperty(e,this.scope.id,{value:[],configurable:!0}),e[this.scope.id].push(i)),this.scope.fire("interactable:new",{target:e,options:t,interactable:i,win:this.scope._win}),i}},{key:"getExisting",value:function(e,t){var i=t&&t.context||this.scope.document,r=P.string(e),a=r?this.selectorMap[e]:e[this.scope.id];if(a)return Se(a,(function(t){return t._context===i&&(r||t.inContext(e))}))}},{key:"forEachMatch",value:function(e,t){for(var i=0,r=this.list;i<r.length;i++){var a=r[i],n=void 0;if((P.string(a.target)?P.element(e)&&F(e,a.target):e===a.target)&&a.inContext(e)&&(n=t(a)),void 0!==n)return n}}}]),e}(),ii=function(){function e(){var t,i,r=this;a(this,e),this.id="__interact_scope_".concat(Math.floor(100*Math.random())),this.isInitialized=!1,this.listenerMaps=[],this.browser=x,this.defaults=mt(St),this.Eventable=$t,this.actions={map:{},phases:{start:!0,move:!0,end:!0},methodDict:{},phaselessTypes:{}},this.interactStatic=(t=this,(i=function e(i,r){var a=t.interactables.getExisting(i,r);return a||((a=t.interactables.new(i,r)).events.global=e.globalEvents),a}).getPointerAverage=ce,i.getTouchBBox=de,i.getTouchDistance=pe,i.getTouchAngle=he,i.getElementRect=U,i.getElementClientRect=N,i.matchesSelector=F,i.closest=A,i.globalEvents={},i.version="1.10.27",i.scope=t,i.use=function(e,t){return this.scope.usePlugin(e,t),this},i.isSet=function(e,t){return!!this.scope.interactables.get(e,t&&t.context)},i.on=Ge((function(e,t,i){if(P.string(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),P.array(e)){for(var r=0,a=e;r<a.length;r++){var n=a[r];this.on(n,t,i)}return this}if(P.object(e)){for(var o in e)this.on(o,e[o],t);return this}return ht(e,this.scope.actions)?this.globalEvents[e]?this.globalEvents[e].push(t):this.globalEvents[e]=[t]:this.scope.events.add(this.scope.document,e,t,{options:i}),this}),"The interact.on() method is being deprecated"),i.off=Ge((function(e,t,i){if(P.string(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),P.array(e)){for(var r=0,a=e;r<a.length;r++){var n=a[r];this.off(n,t,i)}return this}if(P.object(e)){for(var o in e)this.off(o,e[o],t);return this}var s;return ht(e,this.scope.actions)?e in this.globalEvents&&-1!==(s=this.globalEvents[e].indexOf(t))&&this.globalEvents[e].splice(s,1):this.scope.events.remove(this.scope.document,e,t,i),this}),"The interact.off() method is being deprecated"),i.debug=function(){return this.scope},i.supportsTouch=function(){return x.supportsTouch},i.supportsPointerEvent=function(){return x.supportsPointerEvent},i.stop=function(){for(var e=0,t=this.scope.interactions.list;e<t.length;e++)t[e].stop();return this},i.pointerMoveTolerance=function(e){return P.number(e)?(this.scope.interactions.pointerMoveTolerance=e,this):this.scope.interactions.pointerMoveTolerance},i.addDocument=function(e,t){this.scope.addDocument(e,t)},i.removeDocument=function(e){this.scope.removeDocument(e)},i),this.InteractEvent=Ct,this.Interactable=void 0,this.interactables=new ti(this),this._win=void 0,this.document=void 0,this.window=void 0,this.documents=[],this._plugins={list:[],map:{}},this.onWindowUnload=function(e){return r.removeDocument(e.target)};var n=this;this.Interactable=function(e){l(i,e);var t=p(i);function i(){return a(this,i),t.apply(this,arguments)}return o(i,[{key:"_defaults",get:function(){return n.defaults}},{key:"set",value:function(e){return h(u(i.prototype),"set",this).call(this,e),n.fire("interactable:set",{options:e,interactable:this}),this}},{key:"unset",value:function(){h(u(i.prototype),"unset",this).call(this);var e=n.interactables.list.indexOf(this);e<0||(n.interactables.list.splice(e,1),n.fire("interactable:unset",{interactable:this}))}}]),i}(ei)}return o(e,[{key:"addListeners",value:function(e,t){this.listenerMaps.push({id:t,map:e})}},{key:"fire",value:function(e,t){for(var i=0,r=this.listenerMaps;i<r.length;i++){var a=r[i].map[e];if(a&&!1===a(t,this,e))return!1}}},{key:"init",value:function(e){return this.isInitialized?this:(i=e,(t=this).isInitialized=!0,P.window(i)&&y(i),O.init(i),x.init(i),Ue.init(i),t.window=i,t.document=i.document,t.usePlugin(Xt),t.usePlugin(Vt),t);var t,i}},{key:"pluginIsInstalled",value:function(e){var t=e.id;return t?!!this._plugins.map[t]:-1!==this._plugins.list.indexOf(e)}},{key:"usePlugin",value:function(e,t){if(!this.isInitialized)return this;if(this.pluginIsInstalled(e))return this;if(e.id&&(this._plugins.map[e.id]=e),this._plugins.list.push(e),e.install&&e.
vendor: 3,321 bytes, line 1
1install(this,t),e.listeners&&e.before){for(var i=0,r=this.listenerMaps.length,a=e.before.reduce((function(e,t){return e[t]=!0,e[ri(t)]=!0,e}),{});i<r;i++){var n=this.listenerMaps[i].id;if(n&&(a[n]||a[ri(n)]))break}this.listenerMaps.splice(i,0,{id:e.id,map:e.listeners})}else e.listeners&&this.listenerMaps.push({id:e.id,map:e.listeners});return this}},{key:"addDocument",value:function(e,t){if(-1!==this.getDocIndex(e))return!1;var i=b(e);t=t?W({},t):{},this.documents.push({doc:e,options:t}),this.events.documents.push(e),e!==this.document&&this.events.add(i,"unload",this.onWindowUnload),this.fire("scope:add-document",{doc:e,window:i,scope:this,options:t})}},{key:"removeDocument",value:function(e){var t=this.getDocIndex(e),i=b(e),r=this.documents[t].options;this.events.remove(i,"unload",this.onWindowUnload),this.documents.splice(t,1),this.events.documents.splice(t,1),this.fire("scope:remove-document",{doc:e,window:i,scope:this,options:r})}},{key:"getDocIndex",value:function(e){for(var t=0;t<this.documents.length;t++)if(this.documents[t].doc===e)return t;return-1}},{key:"getDocOptions",value:function(e){var t=this.getDocIndex(e);return-1===t?null:this.documents[t].options}},{key:"now",value:function(){return(this.window.Date||Date).now()}}]),e}();function ri(e){return e&&e.replace(/\/.*$/,"")}var ai=new ii,ni=ai.interactStatic,oi="undefined"!=typeof globalThis?globalThis:window;ai.init(oi);var si=Object.freeze({__proto__:null,edgeTarget:function(){},elements:function(){},grid:function(e){var t=[["x","y"],["left","top"],["right","bottom"],["width","height"]].filter((function(t){var i=t[0],r=t[1];return i in e||r in e})),i=function(i,r){for(var a=e.range,n=e.limits,o=void 0===n?{left:-1/0,right:1/0,top:-1/0,bottom:1/0}:n,s=e.offset,l=void 0===s?{x:0,y:0}:s,u={range:a,grid:e,x:null,y:null},c=0;c<t.length;c++){var d=t[c],p=d[0],h=d[1],m=Math.round((i-l.x)/e[p]),g=Math.round((r-l.y)/e[h]);u[p]=Math.max(o.left,Math.min(o.right,m*e[p]+l.x)),u[h]=Math.max(o.top,Math.min(o.bottom,g*e[h]+l.y))}return u};return i.grid=e,i.coordFields=t,i}}),li={id:"snappers",install:function(e){var t=e.interactStatic;t.snappers=W(t.snappers||{},si),t.createSnapGrid=t.snappers.grid}},ui={start:function(e){var t=e.state,r=e.rect,a=e.edges,n=e.pageCoords,o=t.options,s=o.ratio,l=o.enabled,u=t.options,c=u.equalDelta,d=u.modifiers;"preserve"===s&&(s=r.width/r.height),t.startCoords=W({},n),t.startRect=W({},r),t.ratio=s,t.equalDelta=c;var p=t.linkedEdges={top:a.top||a.left&&!a.bottom,left:a.left||a.top&&!a.right,bottom:a.bottom||a.right&&!a.top,right:a.right||a.bottom&&!a.left};if(t.xIsPrimaryAxis=!(!a.left&&!a.right),t.equalDelta){var h=(p.left?1:-1)*(p.top?1:-1);t.edgeSign={x:h,y:h}}else t.edgeSign={x:p.left?-1:1,y:p.top?-1:1};if(!1!==l&&W(a,p),null!=d&&d.length){var m=new gt(e.interaction);m.copyFrom(e.interaction.modification),m.prepareStates(d),t.subModification=m,m.startAll(i({},e))}},set:function(e){var t=e.state,r=e.rect,a=e.coords,n=t.linkedEdges,o=W({},a),s=t.equalDelta?ci:di;if(W(e.edges,n),s(t,t.xIsPrimaryAxis,a,r),!t.subModification)return null;var l=W({},r);j(n,l,{x:a.x-o.x,y:a.y-o.y});var u=t.subModification.setAll(i(i({},e),{},{rect:l,edges:n,pageCoords:a,prevCoords:a,prevRect:l})),c=u.delta;return u.changed&&(s(t,Math.abs(c.x)>Math.abs(c.y),u.coords,u.rect),W(a,u.coords)),u.eventProps}
vendor: 5,266 bytes, line 1
1,defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};function ci(e,t,i){var r=e.startCoords,a=e.edgeSign;t?i.y=r.y+(i.x-r.x)*a.y:i.x=r.x+(i.y-r.y)*a.x}function di(e,t,i,r){var a=e.startRect,n=e.startCoords,o=e.ratio,s=e.edgeSign;if(t){var l=r.width/o;i.y=n.y+(l-a.height)*s.y}else{var u=r.height*o;i.x=n.x+(u-a.width)*s.x}}var pi=vt(ui,"aspectRatio"),hi=function(){};hi._defaults={};var mi=hi;function gi(e,t,i){return P.func(e)?G(e,t.interactable,t.element,[i.x,i.y,t]):G(e,t.interactable,t.element)}var fi={start:function(e){var t=e.rect,i=e.startOffset,r=e.state,a=e.interaction,n=e.pageCoords,o=r.options,s=o.elementRect,l=W({left:0,top:0,right:0,bottom:0},o.offset||{});if(t&&s){var u=gi(o.restriction,a,n);if(u){var c=u.right-u.left-t.width,d=u.bottom-u.top-t.height;c<0&&(l.left+=c,l.right+=c),d<0&&(l.top+=d,l.bottom+=d)}l.left+=i.left-t.width*s.left,l.top+=i.top-t.height*s.top,l.right+=i.right-t.width*(1-s.right),l.bottom+=i.bottom-t.height*(1-s.bottom)}r.offset=l},set:function(e){var t,i=e.coords,r=e.interaction,a=e.state,n=a.options,o=a.offset,s=gi(n.restriction,r,i);if(s){var l=(!(t=s)||"left"in t&&"top"in t||((t=W({},t)).left=t.x||0,t.top=t.y||0,t.right=t.right||t.left+t.width,t.bottom=t.bottom||t.top+t.height),t);i.x=Math.max(Math.min(l.right-o.right,i.x),l.left+o.left),i.y=Math.max(Math.min(l.bottom-o.bottom,i.y),l.top+o.top)}},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}},vi=vt(fi,"restrict"),yi={top:1/0,left:1/0,bottom:-1/0,right:-1/0},bi={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function Si(e,t){for(var i=0,r=["top","left","bottom","right"];i<r.length;i++){var a=r[i];a in e||(e[a]=t[a])}return e}var Ci={noInner:yi,noOuter:bi,start:function(e){var t,i=e.interaction,r=e.startOffset,a=e.state,n=a.options;n&&(t=K(gi(n.offset,i,i.coords.start.page))),t=t||{x:0,y:0},a.offset={top:t.y+r.top,left:t.x+r.left,bottom:t.y-r.bottom,right:t.x-r.right}},set:function(e){var t=e.coords,i=e.edges,r=e.interaction,a=e.state,n=a.offset,o=a.options;if(i){var s=W({},t),l=gi(o.inner,r,s)||{},u=gi(o.outer,r,s)||{};Si(l,yi),Si(u,bi),i.top?t.y=Math.min(Math.max(u.top+n.top,s.y),l.top+n.top):i.bottom&&(t.y=Math.max(Math.min(u.bottom+n.bottom,s.y),l.bottom+n.bottom)),i.left?t.x=Math.min(Math.max(u.left+n.left,s.x),l.left+n.left):i.right&&(t.x=Math.max(Math.min(u.right+n.right,s.x),l.right+n.right))}},defaults:{inner:null,outer:null,offset:null,endOnly:!1,enabled:!1}},Pi=vt(Ci,"restrictEdges"),ki=W({get elementRect(){return{top:0,left:0,bottom:1,right:1}},set elementRect(e){}},fi.defaults),Ti=vt({start:fi.start,set:fi.set,defaults:ki},"restrictRect"),Mi={width:-1/0,height:-1/0},Li={width:1/0,height:1/0},wi=vt({start:function(e){return Ci.start(e)},set:function(e){var t=e.interaction,i=e.state,r=e.rect,a=e.edges,n=i.options;if(a){var o=Q(gi(n.min,t,e.coords))||Mi,s=Q(gi(n.max,t,e.coords))||Li;i.options={endOnly:n.endOnly,inner:W({},Ci.noInner),outer:W({},Ci.noOuter)},a.top?(i.options.inner.top=r.bottom-o.height,i.options.outer.top=r.bottom-s.height):a.bottom&&(i.options.inner.bottom=r.top+o.height,i.options.outer.bottom=r.top+s.height),a.left?(i.options.inner.left=r.right-o.width,i.options.outer.left=r.right-s.width):a.right&&(i.options.inner.right=r.left+o.width,i.options.outer.right=r.left+s.width),Ci.set(e),i.options=n}},defaults:{min:null,max:null,endOnly:!1,enabled:!1}},"restrictSize"),Di={start:function(e){var t,i,r,a=e.interaction,n=e.interactable,o=e.element,s=e.rect,l=e.state,u=e.startOffset,c=l.options,d=c.offsetWithOrigin?(r=(i=e).interaction.element,K(G(i.state.options.origin,null,null,[r]))||Y(i.interactable,r,i.interaction.prepared.name)):{x:0,y:0};if("startCoords"===c.offset)t={x:a.coords.start.page.x,y:a.coords.start.page.y};else{var p=G(c.offset,n,o,[a]);(t=K(p)||{x:0,y:0}).x+=d.x,t.y+=d.y}var h=c.relativePoints;l.offsets=s&&h&&h.length?h.map((function(e,i){return{index:i,relativePoint:e,x:u.left-s.width*e.x+t.x,y:u.top-s.height*e.y+t.y}})):[{index:0,relativePoint:null,x:t.x,y:t.y}]},set:function(e){var t=e.interaction,i=e.coords,r=e.state,a=r.options,n=r.offsets,o=Y(t.interactable,t.element,t.prepared.name),s=W({},i),l=[];a.offsetWithOrigin||(s.x-=o.x,s.y-=o.y);for(var u=0,c=n;u<c.length;u++)for(var d=c[u],p=s.x-d.x,h=s.y-d.y,m=0,g=a.targets.length;m<g;m++){var f=a.targets[m],v=void 0;(v=P.func(f)?f(p,h,t._proxy,d,m):f)&&l.push({x:(P.number(v.x)?v.x:p)+d.x,y:(P.number(v.y)?v.y:h)+d.y,range:P.number(v.range)?v.range:a.range,source:f,index:m,offset:d})}for(var y={target:null,inRange:!1,distance:0,range:0,delta:{x:0,y:0}},b=0;b<l.length;b++){var S=l[b],C=S.range,k=S.x-s.x,T=S.y-s.y,M=J(k,T),L=M<=C;C===1/0&&y.inRange&&y.range!==1/0&&(L=!1),y.target&&!(L?y.inRange&&C!==1/0?M/C<y.distance/y.range:C===1/0&&y.range!==1/0||M<y.distance:!y.inRange&&M<y.distance)||(y.target=S,y.distance=M,y.range=C,y.inRange=L,y.delta.x=k,y.delta.y=T)}return y.inRange&&(i.x=y.target.x,i.y=y.target.y),r.closest=y,y},defaults:{range:1/0,targets:null,offset:null,offsetWithOrigin:!0,origin:null,relativePoints:null,endOnly:!1,enabled:!1}},Oi=vt(Di,"snap"),Ii={start:function(e){var t=e.state,i=e.edges,r=t.options;if(!i)return null;e.state={options:{targets:null,relativePoints:[{x:i.left?0:1,y:i.top?0:1}],offset:r.offset||"self",origin:{x:0,y:0},range:r.range}}
1,t.targetFields=t.targetFields||[["width","height"],["x","y"]],Di.start(e),t.offsets=e.state.offsets,e.state=t},set:function(e){var t=e.interaction,i=e.state,r=e.coords,a=i.options,n=i.offsets,o={x:r.x-n[0].x,y:r.y-n[0].y};i.options=W({},a),i.options.targets=[];for(var s=0,l=a.targets||[];s<l.length;s++){var u=l[s],c=void 0;if(c=P.func(u)?u(o.x,o.y,t):u){for(var d=0,p=i.targetFields;d<p.length;d++){var h=p[d],m=h[0],g=h[1];if(m in c||g in c){c.x=c[m],c.y=c[g];break}}i.options.targets.push(c)}}var f=Di.set(e);return i.options=a,f},defaults:{range:1/0,targets:null,offset:null,endOnly:!1,enabled:!1}},xi=vt(Ii,"snapSize"),_i={aspectRatio:pi,restrictEdges:Pi,restrict:vi,restrictRect:Ti,restrictSize:wi,snapEdges:vt({start:function(e){var t=e.edges;return t?(e.state.targetFields=e.state.targetFields||[[t.left?"left":"right",t.top?"top":"bottom"]],Ii.start(e)):null},set:Ii.set,defaults:W(mt(Ii.defaults),{targets:void 0,range:void 0,offset:{x:0,y:0}})},"snapEdges"),snap:Oi,snapSize:xi,spring:mi,avoid:mi,transform:mi,rubberband:mi},Ai={id:"modifiers",install:function(e){var t=e.interactStatic;for(var i in e.usePlugin(bt),e.usePlugin(li),t.modifiers=_i,_i){var r=_i[i],a=r._defaults,n=r._methods;a._methods=n,e.defaults.perAction[i]=a}}},Ri=function(e){l(i,e);var t=p(i);function i(e,r,n,o,s,l){var u;if(a(this,i),te(d(u=t.call(this,s)),n),n!==r&&te(d(u),r),u.timeStamp=l,u.originalEvent=n,u.type=e,u.pointerId=se(r),u.pointerType=me(r),u.target=o,u.currentTarget=null,"tap"===e){var c=s.getPointerIndex(r);u.dt=u.timeStamp-s.pointers[c].downTime;var p=u.timeStamp-s.tapTime;u.double=!!s.prevTap&&"doubletap"!==s.prevTap.type&&s.prevTap.target===u.target&&p<500}else"doubletap"===e&&(u.dt=r.timeStamp-s.tapTime,u.double=!0);return u}return o(i,[{key:"_subtractOrigin",value:function(e){var t=e.x,i=e.y;return this.pageX-=t,this.pageY-=i,this.clientX-=t,this.clientY-=i,this}},{key:"_addOrigin",value:function(e){var t=e.x,i=e.y;return this.pageX+=t,this.pageY+=i,this.clientX+=t,this.clientY+=i,this}},{key:"preventDefault",value:function(){this.originalEvent.preventDefault()}}]),i}(fe),Fi={id:"pointer-events/base",before:["inertia","modifiers","auto-start","actions"],install:function(e){e.pointerEvents=Fi,e.defaults.actions.pointerEvents=Fi.defaults,W(e.actions.phaselessTypes,Fi.types)},listeners:{"interactions:new":function(e){var t=e.interaction;t.prevTap=null,t.tapTime=0},"interactions:update-pointer":function(e){var t=e.down,i=e.pointerInfo;!t&&i.hold||(i.hold={duration:1/0,timeout:null})},"interactions:move":function(e,t){var i=e.interaction,r=e.pointer,a=e.event,n=e.eventTarget;e.duplicate||i.pointerIsDown&&!i.pointerWasMoved||(i.pointerIsDown&&zi(e),Ei({interaction:i,pointer:r,event:a,eventTarget:n,type:"move"},t))},"interactions:down":function(e,t){!function(e,t){for(var i=e.interaction,r=e.pointer,a=e.event,n=e.eventTarget,o=e.pointerIndex,s=i.pointers[o].hold,l=H(n),u={interaction:i,pointer:r,event:a,eventTarget:n,type:"hold",targets:[],path:l,node:null},c=0;c<l.length;c++){var d=l[c];u.node=d,t.fire("pointerEvents:collect-targets",u)}if(u.targets.length){for(var p=1/0,h=0,m=u.targets;h<m.length;h++){var g=m[h].eventable.options.holdDuration;g<p&&(p=g)}s.duration=p,s.timeout=setTimeout((function(){Ei({interaction:i,eventTarget:n,pointer:r,event:a,type:"hold"},t)}),p)}}(e,t),Ei(e,t)},"interactions:up":function(e,t){var i,r,a,n,o,s;zi(e),Ei(e,t),r=t,a=(i=e).interaction,n=i.pointer,o=i.event,s=i.eventTarget,a.pointerWasMoved||Ei({interaction:a,eventTarget:s,pointer:n,event:o,type:"tap"},r)},"interactions:cancel":function(e,t){zi(e),Ei(e,t)}},PointerEvent:Ri,fire:Ei,collectEventTargets:Bi,defaults:{holdDuration:600,ignoreFrom:null,allowFrom:null,origin:{x:0,y:0}},types:{down:!0,move:!0,up:!0,cancel:!0,tap:!0,doubletap:!0,hold:!0}};function Ei(e,t){var i=e.interaction,r=e.pointer,a=e.event,n=e.eventTarget,o=e.type,s=e.targets,l=void 0===s?Bi(e,t):s,u=new Ri(o,r,a,n,i,t.now());t.fire("pointerEvents:new",{pointerEvent:u});for(var c={interaction:i,pointer:r,event:a,eventTarget:n,targets:l,type:o,pointerEvent:u},d=0;d<l.length;d++){var p=l[d];for(var h in p.props||{})u[h]=p.props[h];var m=Y(p.eventable,p.node);
1if(u._subtractOrigin(m),u.eventable=p.eventable,u.currentTarget=p.node,p.eventable.fire(u),u._addOrigin(m),u.immediatePropagationStopped||u.propagationStopped&&d+1<l.length&&l[d+1].node!==u.currentTarget)break}if(t.fire("pointerEvents:fired",c),"tap"===o){var g=u.double?Ei({interaction:i,pointer:r,event:a,eventTarget:n,type:"doubletap"},t):u;i.prevTap=g,i.tapTime=g.timeStamp}return u}function Bi(e,t){var i=e.interaction,r=e.pointer,a=e.event,n=e.eventTarget,o=e.type,s=i.getPointerIndex(r),l=i.pointers[s];if("tap"===o&&(i.pointerWasMoved||!l||l.downTarget!==n))return[];for(var u=H(n),c={interaction:i,pointer:r,event:a,eventTarget:n,type:o,path:u,targets:[],node:null},d=0;d<u.length;d++){var p=u[d];c.node=p,t.fire("pointerEvents:collect-targets",c)}return"hold"===o&&(c.targets=c.targets.filter((function(e){var t,r;return e.eventable.options.holdDuration===(null==(t=i.pointers[s])||null==(r=t.hold)?void 0:r.duration)}))),c.targets}function zi(e){var t=e.interaction,i=e.pointerIndex,r=t.pointers[i].hold;r&&r.timeout&&(clearTimeout(r.timeout),r.timeout=null)}var $i=Object.freeze({__proto__:null,default:Fi});function Ni(e){var t=e.interaction;t.holdIntervalHandle&&(clearInterval(t.holdIntervalHandle),t.holdIntervalHandle=null)}var Ui={id:"pointer-events/holdRepeat",install:function(e){e.usePlugin(Fi);var t=e.pointerEvents;t.defaults.holdRepeatInterval=0,t.types.holdrepeat=e.actions.phaselessTypes.holdrepeat=!0},listeners:["move","up","cancel","endall"].reduce((function(e,t){return e["pointerEvents:".concat(t)]=Ni,e}),{"pointerEvents:new":function(e){var t=e.pointerEvent;"hold"===t.type&&(t.count=(t.count||0)+1)},"pointerEvents:fired":function(e,t){var i=e.interaction,r=e.pointerEvent,a=e.eventTarget,n=e.targets;if("hold"===r.type&&n.length){var o=n[0].eventable.options.holdRepeatInterval;o<=0||(i.holdIntervalHandle=setTimeout((function(){t.pointerEvents.fire({interaction:i,eventTarget:a,type:"hold",pointer:r,event:r},t)}),o))}}})},Hi={id:"pointer-events/interactableTargets",install:function(e){var t=e.Interactable;t.prototype.pointerEvents=function(e){return W(this.events.options,e),this};var i=t.prototype._backCompatOption;t.prototype._backCompatOption=function(e,t){var r=i.call(this,e,t);return r===this&&(this.events.options[e]=t),r}},listeners:{"pointerEvents:collect-targets":function(e,t){var i=e.targets,r=e.node,a=e.type,n=e.eventTarget;t.interactables.forEachMatch(r,(function(e){var t=e.events,o=t.options;t.types[a]&&t.types[a].length&&e.testIgnoreAllow(o,r,n)&&i.push({node:r,eventable:t,props:{interactable:e}})}))},"interactable:new":function(e){var t=e.interactable;t.events.getRect=function(e){return t.getRect(e)}},"interactable:set":function(e,t){var i=e.interactable,r=e.options;W(i.events.options,t.pointerEvents.defaults),W(i.events.options,r.pointerEvents||{})}}},Vi={id:"pointer-events",install:function(e){e.usePlugin($i),e.usePlugin(Ui),e.usePlugin(Hi)}},Wi={id:"reflow",install:function(e){var t=e.Interactable;e.actions.phases.reflow=!0,t.prototype.reflow=function(t){return function(e,t,i){for(var r=e.getAllElements(),a=i.window.Promise,n=a?[]:null,o=function(){var o=r[s],l=e.getRect(o);if(!l)return 1;var u,c=Se(i.interactions.list,(function(i){return i.interacting()&&i.interactable===e&&i.element===o&&i.prepared.name===t.name}));if(c)c.move(),n&&(u=c._reflowPromise||new a((function(e){c._reflowResolve=e})));else{var d=Q(l),p=function(e){return{coords:e,get page(){return this.coords.page},get client(){return this.coords.client},get timeStamp(){return this.coords.timeStamp},get pageX(){return this.coords.page.x},get pageY(){return this.coords.page.y},get clientX(){return this.coords.client.x},get clientY(){return this.coords.client.y},get pointerId(){return this.coords.pointerId},get target(){return this.coords.target},get type(){return this.coords.type},get pointerType(){return this.coords.pointerType},get buttons(){return this.coords.buttons},preventDefault:function(){}}}({page:{x:d.x,y:d.y},client:{x:d.x,y:d.y},timeStamp:i.now()});u=function(e,t,i,r,a){var n=e.interactions.new({pointerType:"reflow"}),o={interaction:n,event:a,pointer:a,eventTarget:i,phase:"reflow"};n.interactable=t,n.element=i,n.prevEvent=a,n.updatePointer(a,a,i,!0),re(n.coords.delta),Ke(n.prepared,r),n._doPhase(o);var s=e.window.Promise,l=s?new s((function(e){n._reflowResolve=e})):void 0;return n._reflowPromise=l,n.start(r,t,i),n._interacting?(n.move(o),n.end(a)):(n.stop(),n._reflowResolve()),n.removePointer(a,a),l}(i,e,o,t,p)}n&&n.push(u)},s=0;s<r.length&&!o();s++);return n&&a.all(n).then((function(){return e}))}(this,t,e)}},listeners:{"interactions:stop":function(e,t){var i,r,a=e.interaction;"reflow"===a.pointerType&&(a._reflowResolve&&a._reflowResolve(),i=t.interactions.list,r=a,i.splice(i.indexOf(r),1))}}};if(ni.use(pt),ni.use(_t),ni.use(Vi),ni.use(Bt),ni.use(Ai),ni.use(ut),ni.use($e),ni.use(qe),ni.use(Wi),ni.default=ni,"object"===r(e)&&e)try{e.exports=ni}catch(Pt){}return ni.default=ni,ni}()),qN.exports;var e}const KN=bs(GN()),QN=A({__name:"grid-item",props:{isDraggable:{type:Boolean,default:void 0},isResizable:{type:Boolean,default:void 0},isBounded:{type:Boolean,default:void 0},static:{type:Boolean,default:!1},minH:{default:1},minW:{default:1},maxH:{default:1/0},maxW:{default:1/0},x:{},y:{},w:{},h:{},i:{},dragIgnoreFrom:{default:"a, button"},dragAllowFrom:{default:void 0},resizeIgnoreFrom:{default:"a, button"},preserveAspectRatio:{type:Boolean,default:!1},dragOption:{default:()=>({})},resizeOption:{default:()=>({})}},emits:["container-resized","resize","resized","move","moved"],setup(e,{expose:t,emit:i}){const r=e,a=i,n=ye(TN),s=ye(MN);if(!n)throw new Error("[grid-layout-plus]: missing layout store, GridItem must under a GridLayout.");const l=T(null),u=se({cols:1,containerWidth:100,rowHeight:30,margin:[10,10],maxRows:1/0,draggable:void 0,resizable:void 0,bounded:void 0,transformScale:1,useCssTransforms:!0,useStyleCursor:!0,isDragging:!1,dragging:{top:-1,left:-1}
1,isResizing:!1,resizing:{width:-1,height:-1},style:{},rtl:!1});let d=!1,p=!1,m=NaN,g=NaN,f=NaN,v=NaN,y=-1,b=-1,S=-1,k=-1,O=r.x,I=r.y,x=r.w,A=r.h;const R=T(),F=se({i:Z(r,"i"),state:u,wrapper:R,calcXY:ne});function E(e){!function(e){u.containerWidth=e}(e)}function B(){ce()}function z(e){gN(r.isDraggable)&&(u.draggable=e)}function $(e){gN(r.isResizable)&&(u.resizable=e)}function N(e){gN(r.isBounded)&&(u.bounded=e)}function U(e){u.transformScale=e}function H(e){u.rowHeight=e}function V(e){u.maxRows=e}function W(){u.rtl="rtl"===VN(),ce()}function q(e){u.cols=Math.floor(e)}n.increaseItem(F),ve((()=>{u.rtl="rtl"===VN()})),L((()=>{n.responsive&&n.lastBreakpoint?u.cols=NN(n.lastBreakpoint,n.cols):u.cols=n.colNum,u.rowHeight=n.rowHeight,u.containerWidth=null!==n.width?n.width:100,u.margin=void 0!==n.margin?n.margin.map(Number):[10,10],u.maxRows=n.maxRows,gN(r.isDraggable)?u.draggable=n.isDraggable:u.draggable=r.isDraggable,gN(r.isResizable)?u.resizable=n.isResizable:u.resizable=r.isResizable,gN(r.isBounded)?u.bounded=n.isBounded:u.bounded=r.isBounded,u.transformScale=n.transformScale,u.useCssTransforms=n.useCssTransforms,u.useStyleCursor=n.useStyleCursor,be((()=>{O=r.x,I=r.y,A=r.h,x=r.w,kN(ee)})),s.on("updateWidth",E),s.on("compact",B),s.on("setDraggable",z),s.on("setResizable",$),s.on("setBounded",N),s.on("setTransformScale",U),s.on("setRowHeight",H),s.on("setMaxRows",V),s.on("directionchange",W),s.on("setColNum",q)})),w((()=>{s.off("updateWidth",E),s.off("compact",B),s.off("setDraggable",z),s.off("setResizable",$),s.off("setBounded",N),s.off("setTransformScale",U),s.off("setRowHeight",H),s.off("setMaxRows",V),s.off("directionchange",W),s.off("setColNum",q),l.value&&(l.value.unset(),l.value=null),n.decreaseItem(F)})),t({state:u,wrapper:R});const G=typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes("android"),K=M((()=>u.resizable&&!r.static)),Q=M((()=>n.isMirrored?!u.rtl:u.rtl)),j=M((()=>(u.draggable||u.resizable)&&!r.static)),Y=function(e,t="vgl"){const i=()=>`${t}-${e}`;return{b:i,be:e=>`${i()}__${e}`,bm:e=>`${i()}--${e}`,bem:(e,t)=>`${i()}__${e}--${t}`}}("item"),X=M((()=>({[Y.b()]:!0,[Y.bm("resizable")]:K.value,[Y.bm("static")]:r.static,[Y.bm("resizing")]:u.isResizing,[Y.bm("dragging")]:u.isDragging,[Y.bm("transform")]:u.useCssTransforms,[Y.bm("rtl")]:Q.value,[Y.bm("no-touch")]:G&&j.value}))),J=M((()=>[Y.be("resizer"),Q.value&&Y.bem("resizer","rtl")].filter(Boolean)));function ee(){r.x+r.w>u.cols?(O=0,x=r.w>u.cols?u.cols:r.w):(O=r.x,x=r.w);const e=ae(O,I,x,A);let t;u.isDragging&&(e.top=u.dragging.top,Q.value?e.right=u.dragging.left:e.left=u.dragging.left),u.isResizing&&(e.width=u.resizing.width,e.height=u.resizing.height),t=u.useCssTransforms?Q.value?function(e,t,i,r){const a="translate3d("+-1*t+"px,"+e+"px, 0)";return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:i+"px",height:r+"px",position:"absolute"}}(e.top,e.right,e.width,e.height):function(e,t,i,r){const a="translate3d("+t+"px,"+e+"px, 0)";return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:i+"px",height:r+"px",position:"absolute"}}(e.top,e.left,e.width,e.height):Q.value?function(e,t,i,r){return{top:e+"px",right:t+"px",width:i+"px",height:r+"px",position:"absolute"}}(e.top,e.right,e.width,e.height):function(e,t,i,r){return{top:e+"px",left:t+"px",width:i+"px",height:r+"px",position:"absolute"}}(e.top,e.left,e.width,e.height),u.style=t}function te(){const e={};for(const t of["width","height"]){const i=u.style[t].match(/^(\d+)px$/);if(!i)return;e[t]=i[1]}a("container-resized",r.i,r.h,r.w,e.height,e.width)}function ie(e){if(r.static)return;const t=e.type;if("resizestart"===t&&u.isResizing||"resizestart"!==t&&!u.isResizing)return;const i=zN(e);if(gN(i))return;const{x:n,y:o}=i,l={width:0,height:0};let c;switch(t){case"resizestart":ge(),y=x,b=A,c=ae(O,I,x,A),l.width=c.width,l.height=c.height,u.resizing=l,u.isResizing=!0;break;case"resizemove":{!e.edges.right&&!e.edges.left&&(f=n),!e.edges.top&&!e.edges.bottom&&(v=o);const t=$N(f,v,n,o);Q.value?l.width=u.resizing.width-t.deltaX/u.transformScale:l.width=u.resizing.width+t.deltaX/u.transformScale,l.height=u.resizing.height+t.deltaY/u.transformScale,u.resizing=l;break}case"resizeend":c=ae(O,I,x,A),l.width=c.width,l.height=c.height,u.resizing={width:-1,height:-1},u.isResizing=!1}c=function(e,t,i=!1){const r=oe();let a=Math.round((t+u.margin[0])/(r+u.margin[0])),n=0;return n=i?Math.ceil((e+u.margin[1])/(u.rowHeight+u.margin[1])):Math.round((e+u.margin[1])/(u.rowHeight+u.margin[1])),a=Math.max(Math.min(a,u.cols-O),0),n=Math.max(Math.min(n,u.maxRows-I),0),{w:a,h:n}}
1(l.height,l.width),c.w<r.minW&&(c.w=r.minW),c.w>r.maxW&&(c.w=r.maxW),c.h<r.minH&&(c.h=r.minH),c.h>r.maxH&&(c.h=r.maxH),c.h<1&&(c.h=1),c.w<1&&(c.w=1),f=n,v=o,(x!==c.w||A!==c.h)&&a("resize",r.i,c.h,c.w,l.height,l.width),"resizeend"===e.type&&(y!==x||b!==A)&&a("resized",r.i,c.h,c.w,l.height,l.width),s.emit("resizeEvent",e.type,r.i,O,I,c.h,c.w)}function re(e){if(r.static||u.isResizing)return;const t=e.type;if("dragstart"===t&&u.isDragging||"dragstart"!==t&&!u.isDragging)return;const i=zN(e);if(gN(i))return;const{x:n,y:o}=i,l=e.target;if(!l.offsetParent)return;const c={top:0,left:0};switch(t){case"dragstart":{S=O,k=I;const e=l.offsetParent.getBoundingClientRect(),t=l.getBoundingClientRect(),i=t.left/u.transformScale,r=e.left/u.transformScale,a=t.right/u.transformScale,n=e.right/u.transformScale,o=t.top/u.transformScale,s=e.top/u.transformScale;Q.value?c.left=-1*(a-n):c.left=i-r,c.top=o-s,u.dragging=c,u.isDragging=!0;break}case"dragmove":{const e=$N(m,g,n,o);if(Q.value?c.left=u.dragging.left-e.deltaX/u.transformScale:c.left=u.dragging.left+e.deltaX/u.transformScale,c.top=u.dragging.top+e.deltaY/u.transformScale,u.bounded){const e=l.offsetParent.clientHeight-le(r.h,u.rowHeight,u.margin[1]);c.top=ue(c.top,0,e);const t=oe(),i=u.containerWidth-le(r.w,t,u.margin[0]);c.left=ue(c.left,0,i)}u.dragging=c;break}case"dragend":{const e=l.offsetParent.getBoundingClientRect(),t=l.getBoundingClientRect(),i=t.left/u.transformScale,r=e.left/u.transformScale,a=t.right/u.transformScale,n=e.right/u.transformScale,o=t.top/u.transformScale,s=e.top/u.transformScale;Q.value?c.left=-1*(a-n):c.left=i-r,c.top=o-s,u.dragging={top:-1,left:-1},u.isDragging=!1;break}}let d;Q.value,d=ne(c.top,c.left),m=n,g=o,(O!==d.x||I!==d.y)&&a("move",r.i,d.x,d.y),"dragend"===e.type&&(S!==O||k!==I)&&a("moved",r.i,d.x,d.y),s.emit("dragEvent",e.type,r.i,d.x,d.y,A,x)}function ae(e,t,i,r){const a=oe();let n;return n=Q.value?{right:Math.round(a*e+(e+1)*u.margin[0]),top:Math.round(u.rowHeight*t+(t+1)*u.margin[1]),width:i===1/0?i:Math.round(a*i+Math.max(0,i-1)*u.margin[0]),height:r===1/0?r:Math.round(u.rowHeight*r+Math.max(0,r-1)*u.margin[1])}:{left:Math.round(a*e+(e+1)*u.margin[0]),top:Math.round(u.rowHeight*t+(t+1)*u.margin[1]),width:i===1/0?i:Math.round(a*i+Math.max(0,i-1)*u.margin[0]),height:r===1/0?r:Math.round(u.rowHeight*r+Math.max(0,r-1)*u.margin[1])},n}function ne(e,t){const i=oe();let r=Math.round((t-u.margin[0])/(i+u.margin[0])),a=Math.round((e-u.margin[1])/(u.rowHeight+u.margin[1]));return r=Math.max(Math.min(r,u.cols-x),0),a=Math.max(Math.min(a,u.maxRows-A),0),{x:r,y:a}}function oe(){return(u.containerWidth-u.margin[0]*(u.cols+1))/u.cols}function le(e,t,i){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*i):e}function ue(e,t,i){return Math.max(Math.min(e,i),t)}function ce(){ee()}function de(){!l.value&&R.value&&(l.value=KN(R.value),u.useStyleCursor||l.value.styleCursor(!1))}D((()=>r.isDraggable),(e=>{u.draggable=e})),D((()=>r.static),(()=>{kN(he),kN(ge)})),D((()=>u.draggable),(()=>{kN(he)})),D((()=>r.isResizable),(e=>{u.resizable=e})),D((()=>r.isBounded),(e=>{u.bounded=e})),D((()=>u.resizable),(()=>{kN(ge)})),D((()=>u.rowHeight),(()=>{kN(ee),kN(te)})),D([()=>u.cols,()=>u.containerWidth],(()=>{kN(ge),kN(ee),kN(te)})),D([()=>r.minH,()=>r.maxH,()=>r.minW,()=>r.maxW],(()=>{kN(ge)})),D(Q,(()=>{kN(ge),kN(ee)})),D([()=>n.margin,()=>n.margin[0],()=>n.margin[1]],(()=>{const e=n.margin;!e||e[0]===u.margin[0]&&e[1]===u.margin[1]||(u.margin=e.map(Number),kN(ee),kN(te))}));const pe=yN(re);function he(){if(de(),l.value)if(u.draggable&&!r.static){const e={ignoreFrom:r.dragIgnoreFrom,allowFrom:r.dragAllowFrom,...r.dragOption};l.value.draggable(e),d||(d=!0,l.value.on("dragstart dragmove dragend",(e=>{"dragmove"===e.type?pe(e):re(e)})))}else l.value.draggable({enabled:!1})}const me=yN(ie);function ge(){if(de(),l.value)if(u.resizable&&!r.static){const e=ae(0,0,r.maxW,r.maxH),t=ae(0,0,r.minW,r.minH),i={edges:{left:!!Q.value&&`.${J.value[0]}`,right:!Q.value&&`.${J.value[0]}`,bottom:`.${J.value[0]}`,top:!1},ignoreFrom:r.resizeIgnoreFrom,restrictSize:{min:{height:t.height*u.transformScale,width:t.width*u.transformScale},max:{height:e.height*u.transformScale,width:e.width*u.transformScale}},...r.resizeOption};r.preserveAspectRatio&&(i.modifiers=[KN.modifiers.aspectRatio({ratio:"preserve"})]),l.value.resizable(i),p||(p=!0,l.value.on("resizestart resizemove resizeend",(e=>{"resizemove"===e.type?me(e):ie(e)})))}else l.value.resizable({enabled:!1})}return(e,t)=>(o(),c("section",{ref_key:"wrapper",ref:R,class:C(X.value),style:P(u.style)}
1,[_(e.$slots,"default"),K.value?(o(),c("span",{key:0,class:C(J.value)},null,2)):h("",!0)],6))}}),jN=typeof window<"u";var YN;function ZN(e){return null!=e}jN&&null!=(YN=null==window?void 0:window.navigator)&&YN.userAgent&&/iP(ad|hone|od)/.test(window.navigator.userAgent);const XN=Object.freeze({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee9
10",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"});Object.freeze(new Set(Object.keys(XN)));const JN=jN&&("ontouchstart"in window||(typeof navigator<"u"&&(navigator.maxTouchPoints||navigator.msMaxTouchPoints)||0)>0)?"pointerdown":"click";const eU=new Set;jN&&document.addEventListener(JN,(e=>{const t=e.target,i=e.composedPath&&e.composedPath();eU.forEach((e=>{e!==t&&(i?!i.includes(e):!e.contains(t))&&(!e.__transferElement||e.__transferElement!==t&&!e.__transferElement.contains(t))&&function(e,t,i=window.Event){const{type:r,bubbles:a=!1,cancelable:n=!1,...o}=t;if(!ZN(r)||""===r)return!1;let s;ZN(i)?s=new i(r,{bubbles:a,cancelable:n}):(s=document.createEvent("HTMLEvents"),s.initEvent(r,a,n)),Object.assign(s,o),e.dispatchEvent(s)}(e,{type:"clickoutside"})}))}),!0);const tU=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]];let iU;if(jN)for(const kY of tU)if(kY[1]in document){iU=kY;break}M((()=>!1));const rU=new Set,aU=new WeakMap;if(jN&&iU){const e=iU[2],t=iU[4];document.addEventListener(t,(()=>{if(rU.forEach((e=>{e.value=!1})),document[e]){const t=aU.get(document[e]);t&&(t.value=!0)}}),!1)}const nU=new Map;nU.set("x",0),nU.set("y",0);var oU,sU,lU=[],uU="ResizeObserver loop completed with undelivered notifications.";(sU=oU||(oU={})).BORDER_BOX="border-box",sU.CONTENT_BOX="content-box",sU.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box";var cU,dU=function(e){return Object.freeze(e)},pU=function(){return function(e,t){this.inlineSize=e,this.blockSize=t,dU(this)}}(),hU=function(){function e(e,t,i,r){return this.x=e,this.y=t,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,dU(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),mU=function(e){return e instanceof SVGElement&&"getBBox"in e},gU=function(e){if(mU(e)){var t=e.getBBox(),i=t.width,r=t.height;return!i&&!r}var a=e,n=a.offsetWidth,o=a.offsetHeight;return!(n||o||e.getClientRects().length)},fU=function(e){var t;if(e instanceof Element)return!0;var i=null===(t=null==e?void 0:e.ownerDocument)||void 0===t?void 0:t.defaultView;return!!(i&&e instanceof i.Element)},vU=typeof window<"u"?window:{},yU=new WeakMap,bU=/auto|scroll/,SU=/^tb|vertical/,CU=/msie|trident/i.test(vU.navigator&&vU.navigator.userAgent),PU=function(e){return parseFloat(e||"0")},kU=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=!1),new pU((i?t:e)||0,(i?e:t)||0)},TU=dU({devicePixelContentBoxSize:kU(),borderBoxSize:kU(),contentBoxSize:kU(),contentRect:new hU(0,0,0,0)}),MU=function(e,t){if(void 0===t&&(t=!1),yU.has(e)&&!t)return yU.get(e);if(gU(e))return yU.set(e,TU),TU;var i=getComputedStyle(e),r=mU(e)&&e.ownerSVGElement&&e.getBBox(),a=!CU&&"border-box"===i.boxSizing,n=SU.test(i.writingMode||""),o=!r&&bU.test(i.overflowY||""),s=!r&&bU.test(i.overflowX||""),l=r?0:PU(i.paddingTop),u=r?0:PU(i.paddingRight),c=r?0:PU(i.paddingBottom),d=r?0:PU(i.paddingLeft),p=r?0:PU(i.borderTopWidth),h=r?0:PU(i.borderRightWidth),m=r?0:PU(i.borderBottomWidth),g=d+u,f=l+c,v=(r?0:PU(i.borderLeftWidth))+h,y=p+m,b=s?e.offsetHeight-y-e.clientHeight:0,S=o?e.offsetWidth-v-e.clientWidth:0,C=a?g+v:0,P=a?f+y:0,k=r?r.width:PU(i.width)-C-S,T=r?r.height:PU(i.height)-P-b,M=k+g+S+v,L=T+f+b+y,w=dU({devicePixelContentBoxSize:kU(Math.round(k*devicePixelRatio),Math.round(T*devicePixelRatio),n),borderBoxSize:kU(M,L,n),c
1ontentBoxSize:kU(k,T,n),contentRect:new hU(d,l,k,T)});return yU.set(e,w),w},LU=function(e,t,i){var r=MU(e,i),a=r.borderBoxSize,n=r.contentBoxSize,o=r.devicePixelContentBoxSize;switch(t){case oU.DEVICE_PIXEL_CONTENT_BOX:return o;case oU.BORDER_BOX:return a;default:return n}},wU=function(){return function(e){var t=MU(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=dU([t.borderBoxSize]),this.contentBoxSize=dU([t.contentBoxSize]),this.devicePixelContentBoxSize=dU([t.devicePixelContentBoxSize])}}(),DU=function(e){if(gU(e))return 1/0;for(var t=0,i=e.parentNode;i;)t+=1,i=i.parentNode;return t},OU=function(){var e=1/0,t=[];lU.forEach((function(i){if(0!==i.activeTargets.length){var r=[];i.activeTargets.forEach((function(t){var i=new wU(t.target),a=DU(t.target);r.push(i),t.lastReportedSize=LU(t.target,t.observedBox),a<e&&(e=a)})),t.push((function(){i.callback.call(i.observer,r,i.observer)})),i.activeTargets.splice(0,i.activeTargets.length)}}));for(var i=0,r=t;i<r.length;i++){(0,r[i])()}return e},IU=function(e){lU.forEach((function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach((function(i){i.isActive()&&(DU(i.target)>e?t.activeTargets.push(i):t.skippedTargets.push(i))}))}))},xU=function(){var e=0;for(IU(e);lU.some((function(e){return e.activeTargets.length>0}));)e=OU(),IU(e);return lU.some((function(e){return e.skippedTargets.length>0}))&&function(){var e;"function"==typeof ErrorEvent?e=new ErrorEvent("error",{message:uU}):((e=document.createEvent("Event")).initEvent("error",!1,!1),e.message=uU),window.dispatchEvent(e)}(),e>0},_U=[],AU=function(e){if(!cU){var t=0,i=document.createTextNode("");new MutationObserver((function(){return _U.splice(0).forEach((function(e){return e()}))})).observe(i,{characterData:!0}),cU=function(){i.textContent="".concat(t?t--:t++)}}_U.push(e),cU()},RU=0,FU={attributes:!0,characterData:!0,childList:!0,subtree:!0},EU=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],BU=function(e){return void 0===e&&(e=0),Date.now()+e},zU=!1,$U=function(){function e(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return e.prototype.run=function(e){var t=this;if(void 0===e&&(e=250),!zU){zU=!0;var i=BU(e);!function(e){AU((function(){requestAnimationFrame(e)}))}((function(){var r=!1;try{r=xU()}finally{if(zU=!1,e=i-BU(),!RU)return;r?t.run(1e3):e>0?t.run(e):t.start()}}))}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var e=this,t=function(){return e.observer&&e.observer.observe(document.body,FU)};document.body?t():vU.addEventListener("DOMContentLoaded",t)},e.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),EU.forEach((function(t){return vU.addEventListener(t,e.listener,!0)})))},e.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),EU.forEach((function(t){return vU.removeEventListener(t,e.listener,!0)})),this.stopped=!0)},e}(),NU=new $U,UU=function(e){!RU&&e>0&&NU.start(),!(RU+=e)&&NU.stop()},HU=function(){function e(e,t){this.target=e,this.observedBox=t||oU.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var e=LU(this.target,this.observedBox,!0);return function(e){return!mU(e)&&!function(e){switch(e.tagName){case"INPUT":if("image"!==e.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(e)&&"inline"===getComputedStyle(e).display}(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},e}(),VU=function(){return function(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t}}(),WU=new WeakMap,qU=function(e,t){for(var i=0;i<e.length;i+=1)if(e[i].target===t)return i;return-1},GU=function(){function e(){}return e.connect=function(e,t){var i=new VU(e,t);WU.set(e,i)},e.observe=function(e,t,i){var r=WU.get(e),a=0===r.observationTargets.length;qU(r.observationTargets,t)<0&&(a&&lU.push(r),r.observationTargets.push(new HU(t,i&&i.box)),UU(1),NU.schedule())},e.unobserve=function(e,t){var i=WU.get(e),r=qU(i.observationTargets,t),a=1===i.observationTargets.length;r>=0&&(a&&lU.splice(lU.indexOf(i),1),i.observationTargets.splice(r,1),UU(-1))},e.disconnect=function(e){var t=this,i=WU.get(e);
1i.observationTargets.slice().forEach((function(i){return t.unobserve(e,i.target)})),i.activeTargets.splice(0,i.activeTargets.length)},e}(),KU=function(){function e(e){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof e)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");GU.connect(this,e)}return e.prototype.observe=function(e,t){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!fU(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");GU.observe(this,e,t)},e.prototype.unobserve=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!fU(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");GU.unobserve(this,e)},e.prototype.disconnect=function(){GU.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();const QU=new WeakMap;const jU=new(jN&&window.ResizeObserver||KU)((function(e){for(let t=0,i=e.length;t<i;++t){const i=e[t],r=QU.get(i.target);"function"==typeof r&&r(i)}}));function YU(e,t){QU.set(e,t),jU.observe(e)}function ZU(e){QU.has(e)&&(jU.unobserve(e),QU.delete(e))}const XU=T(!1);M((()=>XU.value));const JU="__theme_style__",eH="__theme_observer__",tH=se(new Map),iH=new Map;D(tH,(()=>{if(!jN)return;iH.clear();const e=document.head.querySelector(`#${JU}`);e&&document.head.removeChild(e);const t=document.createElement("style");let i=`.${eH} { width: 1px }`,r=1;for(const[a,[n,o]]of tH.entries())i+=` html.${n} .${eH}, .${o} .${eH} { width: ${++r}px }`,iH.set(r,a);t.textContent=i,t.id=JU,document.head.appendChild(t)}));const rH=A({__name:"grid-layout",props:{autoSize:{type:Boolean,default:!0},colNum:{default:12},rowHeight:{default:150},maxRows:{default:1/0},margin:{default:()=>[10,10]},isDraggable:{type:Boolean,default:!0},isResizable:{type:Boolean,default:!0},isMirrored:{type:Boolean,default:!1},isBounded:{type:Boolean,default:!1},useCssTransforms:{type:Boolean,default:!0},verticalCompact:{type:Boolean,default:!0},restoreOnDrag:{type:Boolean,default:!1},layout:{},responsive:{type:Boolean,default:!1},responsiveLayouts:{default:()=>({})},transformScale:{default:1},breakpoints:{default:()=>({lg:1200,md:996,sm:768,xs:480,xxs:0})},cols:{default:()=>({lg:12,md:10,sm:6,xs:4,xxs:2})},preventCollision:{type:Boolean,default:!1},useStyleCursor:{type:Boolean,default:!0}},emits:["layout-before-mount","layout-mounted","layout-updated","breakpoint-changed","update:layout","layout-ready"],setup(e,{expose:t,emit:i}){const r=e,a=i,l=se({width:-1,mergedStyle:{},lastLayoutLength:0,isDragging:!1,placeholder:{x:0,y:0,w:0,h:0,i:""},layouts:{},lastBreakpoint:null,originalLayout:null}),u=new Map,p=T(r.layout),h=T(),{observeResize:m,unobserveResize:f}={observeResize:YU,unobserveResize:ZU},v=function(){const e=new Map;return{on(t,i){const r=e.get(t);(null==r?void 0:r.add(i))||e.set(t,new Set([i]))},off(t,i){const r=e.get(t);r&&r.delete(i)},clear(t){const i=e.get(t);i&&i.clear()},clearAll(){e.clear()},emit(t,...i){const r=e.get(t);r&&r.forEach((e=>{e(...i)}))}}}();function y(){if(!gN(p.value)&&!gN(l.originalLayout)){if(p.value.length!==l.originalLayout.length){const e=function(e,t){const i=new Set(t.map((e=>e.i))),r=new Set(e.map((e=>e.i))),a=e.filter((e=>!i.has(e.i))),n=t.filter((e=>!r.has(e.i)));return a.concat(n)}(p.value,l.originalLayout);if(e.length>0)if(p.value.length>l.originalLayout.length)l.originalLayout=l.originalLayout.concat(e);else{const t=new Set(e.map((e=>e.i)));l.originalLayout=l.originalLayout.filter((e=>!t.has(e.i)))}l.lastLayoutLength=p.value.length,x()}ON(p.value,r.verticalCompact),v.emit("updateWidth",l.width),b(),a("layout-updated",p.value)}}function b(){l.mergedStyle={height:C()}}function S(){h.value&&(l.width=h.value.offsetWidth),v.emit("resizeEvent")}function C(){if(!r.autoSize)return;const e=parseFloat(r.margin[1]);return function(e){let t,i=0;for(let r=0,a=e.length;r<a;r++)t=e[r].y+e[r].h,t>i&&(i=t);return i}(p.value)*(r.rowHeight+e)+e+"px"}let k;function M(e,t,i,n,o,s){let u=xN(p.value,t);gN(u)&&(u={h:0,w:0,x:0,y:0,i:""}),"dragstart"===e&&!r.verticalCompact&&(k=p.value.reduce(((e,{i:t,x:i,y:r})=>({...e,[t]:{x:i,y:r}})),{})),"dragmove"===e||"dragstart"===e?(l.placeholder.i=t,l.placeholder.x=u.x,l.placeholder.y=u.y,l.placeholder.w=s,l.placeholder.h=o,oe((()=>{l.isDragging=!0})),v.emit("updateWidth",l.width)):oe((()=>{l.isDragging=!1})),p.value=FN(p.value,u,i,n,!0,r.preventCollision),r.restoreOnDrag?(u.static=!0,ON(p.value,r.verticalCompact,k),u.static=!1):ON(p.value,r.verticalCompact),v.emit("compact"),b(),"dragend"===e&&(k=void 0,a("layout-updated",p.value))}function I(e,t,i,n,o,s){let u,c=xN(p.value,t);if(gN(c)&&(c={h:0,w:0,x:0,y:0,i:""}),r.preventCollision){const e=AN(p.value,{...c,w:s,h:o}).filter((e=>e.i!==c.i));if(u=e.length>0,u){let t=1/0,i=1/0;e.forEach((e=>{e.x>c.x&&(t=Math.min(t,e.x)),e.y>c.y&&(i=Math.min(i,e.y))})),Number.isFinite(t)&&(c.w=t-c.x),Number.isFinite(i)&&(c.h=i-c.y)}}u||(c.w=s,c.h=o),"resizestart"===e||"resizemove"===e?(l.placeholder.i=t,l.placeholder.x=i,l.placeholder.y=n,l.placeholder.w=c.w,l.placeholder.h=c.h,oe((()=>{l.isDragging=!0})),v.emit("updateWidth",l.width)):e&&oe((()=>{l.isDragging=!1})),r.responsive&&function(){const e=function(e,t){const i=HN(e);let r=i[0];for(let a=1,n=i.length;a<n;a++){const n=i[a];t>e[n]&&(r=n)}return r}
1(r.breakpoints,l.width);if(e===l.lastBreakpoint)return;const t=NN(e,r.cols);!gN(l.lastBreakpoint)&&!l.layouts[l.lastBreakpoint]&&(l.layouts[l.lastBreakpoint]=LN(p.value));const i=UN(l.originalLayout,l.layouts,r.breakpoints,e,l.lastBreakpoint,t,r.verticalCompact);l.layouts[e]=i,l.lastBreakpoint!==e&&a("breakpoint-changed",e,i),p.value=i,a("update:layout",i),l.lastBreakpoint=e,v.emit("setColNum",t)}(),ON(p.value,r.verticalCompact),v.emit("compact"),b(),"resizeend"===e&&a("layout-updated",p.value)}function x(){l.layouts=Object.assign({},r.responsiveLayouts)}return v.on("resizeEvent",(function(e,t,i,r,a,n){I(e,t,i,r,a,n)})),v.on("dragEvent",(function(e,t,i,r,a,n){M(e,t,i,r,a,n)})),ve((()=>{a("layout-before-mount",p.value)})),L((()=>{a("layout-mounted",p.value),oe((()=>{(function(e,t){t=t||"Layout";const i=["x","y","w","h"],r=[];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let a=0,n=e.length;a<n;a++){const n=e[a];for(let e=0;e<i.length;e++)if("number"!=typeof n[i[e]])throw new Error("VueGridLayout: "+t+"["+a+"]."+i[e]+" must be a number!");if(void 0===n.i||null===n.i)throw new Error("VueGridLayout: "+t+"["+a+"].i cannot be null!");if("number"!=typeof n.i&&"string"!=typeof n.i)throw new Error("VueGridLayout: "+t+"["+a+"].i must be a string or number!");if(r.indexOf(n.i)>=0)throw new Error("VueGridLayout: "+t+"["+a+"].i must be unique!");if(r.push(n.i),void 0!==n.static&&"boolean"!=typeof n.static)throw new Error("VueGridLayout: "+t+"["+a+"].static must be a boolean!")}})(p.value),l.originalLayout=p.value,oe((()=>{x(),h.value&&m(h.value,function(e,t=100){if("function"!=typeof e)return fN;const i=(...t)=>{e(...t)};if(t<=0)return bN(i);let r;return function(...e){clearTimeout(r),r=setTimeout((()=>{i(...e)}),t)}}(S,16)),ON(p.value,r.verticalCompact),a("layout-updated",p.value),b(),S()}))}))})),w((()=>{v.clearAll(),h.value&&f(h.value)})),D((()=>l.width),((e,t)=>{oe((()=>{v.emit("updateWidth",e),-1===t&&oe((()=>{a("layout-ready",p.value)})),b()}))})),D((()=>[r.layout,r.layout.length]),(()=>{p.value=r.layout,y()})),D((()=>r.colNum),(e=>{v.emit("setColNum",e)})),D((()=>r.rowHeight),(e=>{v.emit("setRowHeight",e)})),D((()=>r.isDraggable),(e=>{v.emit("setDraggable",e)})),D((()=>r.isResizable),(e=>{v.emit("setResizable",e)})),D((()=>r.isBounded),(e=>{v.emit("setBounded",e)})),D((()=>r.transformScale),(e=>{v.emit("setTransformScale",e)})),D((()=>r.responsive),(e=>{e||(a("update:layout",l.originalLayout),v.emit("setColNum",r.colNum)),S()})),D((()=>r.maxRows),(e=>{v.emit("setMaxRows",e)})),D([()=>r.margin,()=>r.margin[1]],b),Se(TN,se({...Ce(r),...Ce(l),increaseItem:function(e){u.set(e.i,e)},decreaseItem:function(e){u.delete(e.i)}})),Se(MN,v),t({state:l,getItem:function(e){return u.get(e)},resizeEvent:I,dragEvent:M,layoutUpdate:y}),(e,t)=>(o(),c("div",{ref_key:"wrapper",ref:h,class:"vgl-layout",style:P(l.mergedStyle)},[e.$slots.default?_(e.$slots,"default",{key:0}):(o(!0),c(g,{key:1},R(p.value,(t=>(o(),n(QN,O({key:t.i,ref_for:!0},t),{default:s((()=>[_(e.$slots,"item",{item:t})])),_:2},1040)))),128)),B(d(QN,{class:"vgl-item--placeholder",x:l.placeholder.x,y:l.placeholder.y,w:l.placeholder.w,h:l.placeholder.h,i:l.placeholder.i},null,8,["x","y","w","h","i"]),[[N,l.isDragging]])],4))}});function aH(){const e=window.innerWidth;for(const t of lH)if(sH[t]<e)return t;return Qa.XXTRA_SMALL}function nH(e,t=4,i){const r={};for(const a of lH)r[a]=e.map(((e,r)=>{const{id:n,isResizable:o,customClass:s}=e,l=e.layout[a]||e.layout.md||e.layout;return l.dragAllowFrom?{...l,id:n,i:r,customClass:s}:{...l,i:r,id:n,minW:l.w<4?l.w:l.minW||4,minH:l.h<t?l.h:l.minH||t,dragAllowFrom:i,isResizable:o,customClass:s}}));return r}!function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.vgl-layout{--vgl-placeholder-bg: red;--vgl-placeholder-opacity: 20%;--vgl-placeholder-z-index: 2;--vgl-item-resizing-z-index: 3;--vgl-item-resizing-opacity: 60%;--vgl-item-dragging-z-index: 3;--vgl-item-dragging-opacity: 100%;--vgl-resizer-size: 10px;--vgl-resizer-border-color: #444;--vgl-resizer-border-width: 2px;position:relative;box-sizing:border-box;transition:height .2s ease}.vgl-item{position:absolute;box-sizing:border-box;transition:.2s ease;transition-property:left,top,right}.vgl-item--placeholder{z-index:var(--vgl-placeholder-z-index, 2);-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:var(--vgl-placeholder-bg, red);opacity:var(--vgl-placeholder-opacity, 20%);transition-duration:.1s}.vgl-item--no-touch{touch-action:none}.vgl-item--transform{right:auto;left:0;transition-property:transform}.vgl-item--transform.vgl-item--rtl{right:0;left:auto}.vgl-item--resizing{z-index:var(--vgl-item-resizing-z-index, 3);-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--vgl-item-resizing-opacity, 60%)}.vgl-item--dragging{z-index:var(--vgl-item-dragging-z-index, 3);-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--vgl-item-dragging-opacity, 100%);transition:none}.vgl-item__resizer{position:absolute;right:0;bottom:0;box-sizing:border-box;width:var(--vgl-resizer-size);height:var(--vgl-resizer-size);cursor:se-resize}.vgl-item__resizer:before{position:absolute;top:0;right:3px;bottom:3px;left:0;content:"";border:0 solid var(--vgl-resizer-border-color);border-right-width:var(--vgl-resizer-border-width);border-bottom-width:var(--vgl-resizer-border-width)}.vgl-item__resizer--rtl{right:auto;left:0;cursor:sw-resize}.vgl-item__resizer--rtl:before{top:0;right:0;bottom:3px;left:3px;border-right-width:0;border-bottom-width:var(--vgl-resizer-border-width);border-left-width:var(--vgl-resizer-border-width)}')),document.head.appendChild(e)}}catch(t){}}();const oH=Object.freeze({[Qa.LARGE]:40,[Qa.MEDIUM]:24,[Qa.SMALL]:18,[Qa.XTRA_SMALL]:6,[Qa.XXTRA_SMALL]:1}),sH=Object.freeze({[Qa.LARGE]:2559,[Qa.MEDIUM]:1439,[Qa.SMALL]:1023,[Qa.XTRA_SMALL]:767,[Qa.XXTRA_SMALL]:425}),lH=[Qa.LARGE,Qa.MEDIUM,Qa.SMALL,Qa.XTRA_SMALL,Qa.XXTRA_SMALL],uH=$n({name:"GridShell",props:{itemList:{type:Array,default:()=>[]},rowHeight:{type:Number,default:32},minRowHeight:{type:Number,default:4},dragAllowFrom:{type:String,default:""},isResizable:{type:Boolean,default:!0},isDraggable:{type:Boolean,default:!0}},setup(e,{emit:t,slots:i}){const r=T(nH(e.itemList,e.minRowHeight,e.dragAllowFrom)),a=T(e.itemList),n=T(aH()),o=T(!1),s=T(!1);let l=null;D((()=>e.itemList),(()=>{r.value=nH(e.itemList,e.minRowHeight,e.dragAllowFrom)}));const u=M((()=>{const e={};return r.value[n.value].forEach((t=>{e[t.id]=t})),e})),c=()=>{o.value||(clearTimeout(l),l=setTimeout((()=>{o.value=!0,l=null}),50))},d=()=>{const e=aH();o.value=!1,n.value=e},p=()=>{o.value=!1},h=()=>{s.value=!0},m=D((()=>r.value[n.value]),(e=>{r.value={...r.value,[n.value]:e}})),g=()=>{s.value=!1,a.value=function(e){const t=[],i=e[Qa.MEDIUM];for(let r=0;r<i.length;r++){const a=i[r].id,n={};for(const t of lH){const{...i}=e[t][r];n[t]=i}t.push({id:a,layout:n})}return t}(r.value),t("layouted",a.value)},f=()=>{t("update:moved",!0)},v=()=>{var e;const r=[],a={};
1return null==(e=i.default)||e.call(i).forEach((e=>{var t;const i=(null==(t=e.props)?void 0:t["data-grid-id"])||e.key;null!=i&&(a[i]||(a[i]=[],r.push(i)),a[i].push(e))})),r.map((e=>{const i=u.value[e];if(!i)return null;const{w:r,h:n,customClass:o}=i,s=[];return r&&n||s.push("is-not-showed"),o&&s.push(o),ke(QN,{key:i.id,class:s,...i,margin:[5,5],onResize:h,onResized:(i,r,a)=>((e,i,r)=>{t(`resized:${e}`,i,r)})(e,r,a),onMoved:f},{default:()=>a[e]})}))};return L((()=>{window.addEventListener("resize",d),window.addEventListener("orientationchange",p),c()})),Pe((()=>{c()})),w((()=>{window.removeEventListener("resize",d),window.removeEventListener("orientationchange",p)})),()=>ke(rH,{class:["grid-shell",{preparing:!o.value,resizing:s.value}],layout:r.value[n.value],onUpdateLayout:m,rowHeight:e.rowHeight,colNum:oH[n.value],breakpoints:sH,margin:[5,5],isDraggable:o.value&&e.isDraggable,isResizable:o.value&&e.isResizable,onLayoutUpdated:g,useCssTransforms:!1},{default:({gridItemProps:e})=>v()})}},[["__scopeId","data-v-0b403553"]]),cH={class:"market-tab__name","data-testid":"market-tab-name"},dH={class:"market-tab__amount","data-testid":"market-tab-amount"},pH=$n(A({__name:"MarketTab",props:{tradingType:{},currencySymbol:{},isShowCloseBtn:{type:Boolean,default:!0}},setup(e){const t=e,{spotTradeDefaultQuoteCurrency:i}=mt,r=k(),n=ue(),s=le(),{convertToDisplaySymbol:u}=Je(),h=ja(),f=qe(),v=Bt(),y=M((()=>r.state.lang)),b=M((()=>r.state.currencyMap)),S=M((()=>r.state.futures.marketMap)),P=M((()=>r.state.futures.futuresLastPriceMap)),T=M((()=>r.state.futures.futuresLastDataMap)),L=M((()=>r.state.futures.fixedCurrency)),w=M((()=>r.state.orderBook.lastPrice)),D=M((()=>r.state.orderBook.lastPriceSymbol)),O=M((()=>v.marketStatsMap)),I=M((()=>f.isSpot)),_=M((()=>h.getTabList(t.tradingType))),A=M((()=>t.tradingType===It.SPOT)),R=M((()=>{if(A.value){return`${u(t.currencySymbol)}/${U.value}`}return t.currencySymbol})),F=M((()=>{if(A.value){const e=`${t.currencySymbol}-${U.value}`;return{...O.value[e]||{},priceFilter:{formatKey:f.getExchangeInfoBySymbol(e).priceDecimal??0,currency:U.value}}}return S.value[t.currencySymbol]||{}})),E=M((()=>{const e=n.params.id;return A.value?e.split("-")[0]===t.currencySymbol:n.params.id===t.currencySymbol})),B=M((()=>{var e;if(A.value){const r=dt(),a=`${t.currencySymbol}-${U.value}`;if(E.value&&D.value===a&&w.value)return{...F.value,price:w.value};const n=r.getSpotLastPrice(a);if(n)return{...F.value,price:n};const o=f.getSpotBaseCurrencyFromMarketSymbol(t.currencySymbol)===i?1:r.getSpotLastPrice(`${t.currencySymbol}-${i}`),s=r.getSpotIndexPrice(`${U.value}-${i}`)||(null==(e=b.value[U.value])?void 0:e.usdRate)||0,l=o&&s?o/s:0;return{...F.value,price:l}}if(E.value&&D.value===t.currencySymbol&&w.value)return{...T.value[t.currencySymbol],price:w.value};const r=P.value[t.currencySymbol];return{...T.value[t.currencySymbol],price:r||0}})),z=M((()=>B.value.price)),$=M((()=>B.value.gains)),N=M((()=>{const e=t.tradingType===It.FUTURES?"futuresId":"tradingId",i=t.tradingType===It.FUTURES?t.currencySymbol:`${t.currencySymbol}-${U.value}`;return{name:e,params:{lang:y.value,id:i}}})),U=M((()=>A.value?f.getMarketBySymbol(t.currencySymbol).displayQuote||i:L.value));function H(){const e=_.value.findIndex((e=>e===t.currencySymbol));h.removeTab(t.tradingType,t.currencySymbol);const r=_.value[e]||_.value[e-1];if(r){const e=I.value?f.getMarketBySymbol(r).displayQuote||i:"";!function(e=""){if(!e)return;e!==n.params.id&&s.push({name:I.value?"tradingId":"futuresId",params:{lang:y.value,id:e}})}(I.value?`${r}-${e}`:r)}}return(e,t)=>{const i=a("RouterLink");return o(),c("div",{class:C(["market-tab",{active:E.value}]),"data-testid":"market-tab"},[d(i,{class:"market-tab__router-link",to:N.value},null,8,["to"]),l("div",{class:C(["market-tab__close-wrap flex-center-center",{hidden:!e.isShowCloseBtn}]),"data-testid":"market-tab-close",onClick:H},[d(ze,{class:"market-tab__close-icon"})],2),l("span",cH,m(R.value),1),l("span",dH,[isNaN(z.value)?(o(),c(g,{key:0},[p("-")],64)):(o(),c(g,{key:1},[p(m(x(Qt)(z.value,F.value.priceFilter)),1)],64))]),l("span",{class:C(["market-tab__percent",{"brand-color-positive":$.value>0,"brand-color-negative":$.value<0}]),"data-testid":"market-tab-percent"},[null==$.value||isNaN($.value)?(o(),c(g,{key:0},[p(" - ")],64)):(o(),c(g,{key:1},[p(m(x(Qt)($.value,{formatKey:2,signed:!0,postfix:"%"})),1)],64))],2)],2)}}}),[["__scopeId","data-v-83ca77f9"]]),hH=A({__name:"MarketList",props:{tradingType:{},list:{default:()=>[]}},setup(e){const t=e,i=Te("marketListRef"),r=T(!1),a=T(!1);let s=0;const l=M((()=>t.list.length>1));function u(e){r.value=e,r.value?document.addEventListener("wheel",m):(a.value=!1,document.removeEventListener("wheel",m))}function d(e){a.value=!0,s=e.clientX}function p(e){const t=i.value;t&&a.value&&(t.scrollLeft+=s-e.clientX,s=e.clientX)}function h(){a.value=!1}function m(e){const t=i.value;t&&(t.scrollLeft+=e.deltaY)}return w((()=>{document.removeEventListener("wheel",m)})),(e,t)=>(o(),c("div",{ref_key:"marketListRef",ref:i,class:"market-list",onMouseover:t[0]||(t[0]=e=>u(!0)),onMouseleave:t[1]||(t[1]=e=>u(!1)),onMousedown:E(d,["prevent"]),onMousemove:E(p,["prevent"]),onMouseup:E(h,["prevent"])},[(o(!0),c(g,null,R(e.list,(t=>(o(),n(pH,{key:t,tradingType:e.tradingType,currencySymbol:t,isShowCloseBtn:l.value},null,8,["tradingType","currencySymbol","isShowCloseBtn"])))),128))],544))}}),mH=$n(hH,[["__scopeId","data-v-357a9ce0"]]),gH={class:"market-bar"},fH={key:0,class:"market-bar-actions"},vH=$n(A({__name:"MarketBar",props:{tradingType:{}},setup(e){const t=e,i=k(),r=ue(),a=ja(),{isLeaderMode:n}=Q(pt()),{marketList:s,marketMap:l}=Q(qe()),u=M((()=>i.state.loginState)),p=M((()=>i.getters.isUnifiedWallet)),m=M((()=>i.getters.isEnableCFD)),g=M((()=>i.state.futures.marketList)),f=M((()=>i.state.futures.marketMap)),v=M((()=>i.state.futures.marketDetailMap)),y=M((()=>a.getTabList(t.tradingType))),b=M((()=>t.tradingType===It.SPOT)),S=M((()=>(b.value?Ya(r.params.id).marketCurrency:r.params.id)||!1)),C=M((()=>s.value.map((e=>w(e))).filter((e=>{const{display:t=!1}=l.value[e]||{};return t})).sort(((e,t)=>{const i=l.value[e]||{},r=l.value[t]||{};return i.displayOrder-r.displayOrder})).slice(0,20))),P=M((()=>g.value.filter((e=>{const{display:t=!1}=f.value[e]||{};return t&&I(e)})).sort(((e,t)=>{const i=f.value[e]||{},r=f.value[t]||{};return i.displayOrder-r.displayOrder})))),T=M((()=>b.value?C.value:P.value)),L=M((()=>b.value?l.value:f.value));function w(e){return b.value?e.split("-")[0]:e}function O(e){const{categoryId:t}=f.value[e]||{};return!!(m.value&&p.value||t===Za.CRYPTO)}function I(e){return b.value?!!l.value[e]:u.value?function(e){const t=v.value[e];if(!t)return!1;if(!O(e))return!1;const{supportCopyTrading:i=!1}=t;return!n.value||i}(e):!!f.value[e]}return D(u,(()=>{a.resetTabList(t.tradingType)})),D(T,(e=>{if(u.value)e.length>0&&a.syncFromMarketMap({tradingType:t.tradingType,defaultList:e,marketMap:L.value}),S.value&&!I(S.value)||a.checkNowPageIDIsExistMarketTab(t.tradingType,S.value);else{if(0===e.length)return;a.initFromLocalStorage({tradingType:t.tradingType,defaultList:e,marketMap:L.value,currentMarketSymbol
1:S.value})}}),{immediate:!0}),D((()=>r.params.id),(e=>{if(!e)return;const i=w(e);!u.value||b.value||O(e)?y.value.includes(i)||a.addTab(t.tradingType,i):a.removeTab(t.tradingType,i)})),(e,t)=>(o(),c("div",gH,[d(mH,{tradingType:e.tradingType,list:y.value},null,8,["tradingType","list"]),u.value?(o(),c("div",fH,[d(Qo,{class:"market-bar-faq",tradingType:e.tradingType},null,8,["tradingType"]),d(jo,{class:"market-bar-setting"})])):h("",!0)]))}}),[["__scopeId","data-v-d231b4c2"]]),yH={id:"depth-chart",layout:{[Qa.LARGE]:{x:0,y:59,w:6,h:6},[Qa.MEDIUM]:{x:0,y:51,w:6,h:6},[Qa.SMALL]:{x:0,y:43,w:5,h:6},[Qa.XTRA_SMALL]:{x:4,y:27,w:2,h:6},[Qa.XXTRA_SMALL]:{x:0,y:13,w:1,h:6}},hideLayout:{x:0,y:0,w:0,h:0}},bH={id:"depth-chart",layout:{[Qa.LARGE]:{x:0,y:59,w:6,h:6},[Qa.MEDIUM]:{x:0,y:51,w:6,h:6},[Qa.SMALL]:{x:0,y:43,w:5,h:6},[Qa.XTRA_SMALL]:{x:4,y:27,w:2,h:6},[Qa.XXTRA_SMALL]:{x:0,y:13,w:1,h:6}},hideLayout:{x:0,y:0,w:0,h:0}},SH={id:"contract-detail",layout:{[Qa.LARGE]:{x:34,y:55,w:6,h:16},[Qa.MEDIUM]:{x:18,y:47,w:6,h:16},[Qa.SMALL]:{x:13,y:44,w:5,h:16},[Qa.XTRA_SMALL]:{x:4,y:47,w:2,h:16},[Qa.XXTRA_SMALL]:{x:0,y:83,w:1,h:16}},hideLayout:{x:0,y:0,w:0,h:0}},CH=SH,PH={id:"order-fund",layout:{[Qa.LARGE]:{x:34,y:50,w:6,h:5,minH:5},[Qa.MEDIUM]:{x:18,y:42,w:6,h:5,minH:5},[Qa.SMALL]:{x:13,y:39,w:5,h:5,minH:5},[Qa.XTRA_SMALL]:{x:4,y:42,w:2,h:5,minH:5},[Qa.XXTRA_SMALL]:{x:0,y:78,w:1,h:5,minH:5}},customClass:"order-fund-block",hideLayout:{x:0,y:0,w:0,h:0}},kH=PH,TH={id:"recent-trade",layout:{[Qa.LARGE]:{x:28,y:27,w:6,h:14},[Qa.MEDIUM]:{x:16,y:27,w:4,h:14},[Qa.SMALL]:{x:10,y:27,w:4,h:16},[Qa.XTRA_SMALL]:{x:0,y:0,w:2,h:13}},hideLayout:{x:0,y:0,w:0,h:0}},MH={id:"recent-trade",layout:{[Qa.LARGE]:{x:28,y:27,w:6,h:14},[Qa.MEDIUM]:{x:16,y:27,w:4,h:14},[Qa.SMALL]:{x:10,y:27,w:4,h:16},[Qa.XTRA_SMALL]:{x:0,y:0,w:2,h:13}},hideLayout:{x:0,y:0,w:0,h:0}},LH={...{DEPTH_CHART_LAYOUT:yH,ARABIC_DEPTH_CHART_LAYOUT:bH,CONTRACT_DETAIL_LAYOUT:SH,ARABIC_CONTRACT_DETAIL_LAYOUT:CH,RECENT_TRADE_LAYOUT:TH,ARABIC_RECENT_TRADE_LAYOUT:MH,RESIZABLE_ITEM_LIST:[{id:"order-book",layout:{[Qa.LARGE]:{x:28,y:3,w:6,h:37},[Qa.MEDIUM]:{x:14,y:3,w:4,h:29},[Qa.SMALL]:{x:9,y:3,w:4,h:24},[Qa.XTRA_SMALL]:{x:0,y:14,w:4,h:15},[Qa.XXTRA_SMALL]:{x:0,y:0,w:1,h:15}},isMobileChartMode:{x:0,y:23,w:1,h:20}},{id:"futures-order",layout:{[Qa.LARGE]:{x:34,y:0,w:6,h:40},[Qa.MEDIUM]:{x:18,y:0,w:6,h:32},[Qa.SMALL]:{x:13,y:0,w:5,h:29},[Qa.XTRA_SMALL]:{x:4,y:0,w:2,h:32},[Qa.XXTRA_SMALL]:{x:0,y:23,w:1,h:32}},customClass:"futures-order-block"},{id:"order-management",layout:{[Qa.LARGE]:{x:0,y:27,w:34,minW:12,h:26},[Qa.MEDIUM]:{x:0,y:27,w:18,minW:12,h:26},[Qa.SMALL]:{x:0,y:27,w:13,h:28},[Qa.XTRA_SMALL]:{x:0,y:39,w:4,h:23},[Qa.XXTRA_SMALL]:{x:0,y:48,w:1,h:23}}},{id:"market-info",layout:{[Qa.LARGE]:{x:0,y:0,w:34,minW:12,h:3,maxH:3},[Qa.MEDIUM]:{x:0,y:0,w:18,minW:12,h:3,maxH:3},[Qa.SMALL]:{x:0,y:0,w:13,h:3,maxH:3},[Qa.XTRA_SMALL]:{x:0,y:0,w:4,h:3,maxH:3},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:0,w:1,h:8},customClass:"market-chart-block"},{id:"trading-view",layout:{[Qa.LARGE]:{x:0,y:3,w:28,minW:12,h:37,minH:18},[Qa.MEDIUM]:{x:0,y:3,w:14,minW:12,h:29,minH:18},[Qa.SMALL]:{x:0,y:3,w:9,h:24,minH:18},[Qa.XTRA_SMALL]:{x:0,y:3,w:4,h:17},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:3,w:1,h:20}},yH,TH,PH],ARABIC_RESIZABLE_ITEM_LIST:[{id:"order-book",layout:{[Qa.LARGE]:{x:28,y:3,w:6,h:37},[Qa.MEDIUM]:{x:14,y:3,w:4,h:29},[Qa.SMALL]:{x:9,y:3,w:4,h:24},[Qa.XTRA_SMALL]:{x:0,y:14,w:4,h:15},[Qa.XXTRA_SMALL]:{x:0,y:0,w:1,h:15}},isMobileChartMode:{x:0,y:23,w:1,h:20}},{id:"futures-order",layout:{[Qa.LARGE]:{x:34,y:0,w:6,h:40},[Qa.MEDIUM]:{x:18,y:0,w:6,h:32},[Qa.SMALL]:{x:13,y:0,w:5,h:29},[Qa.XTRA_SMALL]:{x:4,y:0,w:2,h:32},[Qa.XXTRA_SMALL]:{x:0,y:23,w:1,h:32}}},{id:"order-management",layout:{[Qa.LARGE]:{x:0,y:40,w:34,minW:12,h:26},[Qa.MEDIUM]:{x:0,y:27,w:18,minW:12,h:26},[Qa.SMALL]:{x:0,y:27,w:13,h:28},[Qa.XTRA_SMALL]:{x:0,y:39,w:4,h:23},[Qa.XXTRA_SMALL]:{x:0,y:48,w:1,h:23}}},{id:"market-info",layout:{[Qa.LARGE]:{x:0,y:0,w:34,minW:12,h:3,maxH:3},[Qa.MEDIUM]:{x:0,y:0,w:18,minW:12,h:3,maxH:3},[Qa.SMALL]:{x:0,y:0,w:13,h:3,maxH:3},[Qa.XTRA_SMALL]:{x:0,y:0,w:4,h:3,maxH:3},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:0,w:1,h:8},customClass:"market-chart-block"},{id:"trading-view",layout:{[Qa.LARGE]:{x:0,y:3,w:28,minW:12,h:37,minH:18},[Qa.MEDIUM]:{x:0,y:3,w:14,minW:12,h:29,minH:18},[Qa.SMALL]:{x:0,y:3,w:9,h:24,minH:18},[Qa.XTRA_SMALL]:{x:0,y:3,w:4,h:17},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:3,w:1,h:20}},bH,MH,kH],FUTURES_RESIZABLE_ITEM_LIST:[{id:"contract-info",layout:{[Qa.LARGE]:{x:0,y:0,w:0,h:0},[Qa.MEDIUM]:{x:0,y:0,w:0,h:0},[Qa.XTRA_SMALL]:{x:4,y:27,w:2,h:10},[Qa.XXTRA_SMALL]:{x:0,y:99,w:1,h:10}}},{id:"wallet-status",layout:{[Qa.LARGE]:{x:34,y:40,w:6,h:10},[Qa.MEDIUM]:{x:18,y:32,w:6,h:10},[Qa.SMALL]:{x:13,y:29,w:5,h:10},[Qa.XTRA_SMALL]:{x:4,y:32,w:2,h:10},[Qa.XXTRA_SMALL]:{x:0,y:68,w:1,h:10}}},SH],ARABIC_FUTURES_RESIZABLE_ITEM_LIST:[{id:"contract-info",layout:{[Qa.LARGE]:{x:20,y:0,w:0,h:0},[Qa.MEDIUM]:{x:20,y:0,w:0,h:0},[Qa.XTRA_SMALL]:{x:0,y:27,w:2,h:10},[Qa.XXTRA_SMALL]:{x:0,y:99,w:1,h:10}}},{id:"wallet-status",layout:{[Qa.LARGE]:{x:34,y:40,w:6,h:10},[Qa.MEDIUM]:{x:18,y:32,w:6,h:10},[Qa.SMALL]:{x:13,y:29,w:5,h:10},[Qa.XTRA_SMALL]:{x:4,y:32,w:2,h:10},[Qa.XXTRA_SMALL]:{x:0,y:68,w:1,h:10}}},CH],ORDER_FUND_LAYOUT:PH,ARABIC_ORDER_FUND_LAYOUT:kH,LAYOUT_GENERATOR:{"open-position":(e=5,t={})=>({[Qa.LARGE]:{...t[Qa.LARGE],h:e},[Qa.MEDIUM]:{...t[Qa.MEDIUM],h:e},[Qa.SMALL]:{...t[Qa.SMALL],h:e},[Qa.XTRA_SMALL]:{...t[Qa.XTRA_SMALL],h:e},[Qa.XXTRA_SMALL]:{...t[Qa.XXTRA_SMALL],h:e}}),"margin-leverage":(e=4,t={})=>({[Qa.LARGE]:{...t[Qa.LARGE],h:e},[Qa.MEDIUM]:{...t[Qa.MEDIUM],h:e},[Qa.SMALL]:{...t[Qa.SMALL],h:e},[Qa.XTRA_SMALL]:{...t[Qa.XTRA_SMALL],h:e},[Qa.XXTRA_SMALL]:{...t[Qa.XXTRA_SMALL],h:e}}
1),"wallet-status":(e=8,t={})=>({[Qa.LARGE]:{...t[Qa.LARGE],h:e},[Qa.MEDIUM]:{...t[Qa.MEDIUM],h:e},[Qa.SMALL]:{...t[Qa.SMALL],h:e},[Qa.XTRA_SMALL]:{...t[Qa.XTRA_SMALL],h:e},[Qa.XXTRA_SMALL]:{...t[Qa.XXTRA_SMALL],h:e}}),"contract-detail":(e=8,t={})=>({[Qa.LARGE]:{...t[Qa.LARGE],h:e},[Qa.MEDIUM]:{...t[Qa.MEDIUM],h:e},[Qa.SMALL]:{...t[Qa.SMALL],h:e},[Qa.XTRA_SMALL]:{...t[Qa.XTRA_SMALL],h:e},[Qa.XXTRA_SMALL]:{...t[Qa.XXTRA_SMALL],h:e}})},RESET_LAYOUT_GENERATOR:{"wallet-status":(e=8,t={})=>({[Qa.LARGE]:{...t[Qa.LARGE],h:t[Qa.LARGE].h<e?e:t[Qa.LARGE].h},[Qa.MEDIUM]:{...t[Qa.MEDIUM],h:t[Qa.MEDIUM].h<e?e:t[Qa.MEDIUM].h},[Qa.SMALL]:{...t[Qa.SMALL],h:t[Qa.SMALL].h<e?e:t[Qa.SMALL].h},[Qa.XTRA_SMALL]:{...t[Qa.XTRA_SMALL],h:t[Qa.XTRA_SMALL].h<e?e:t[Qa.XTRA_SMALL].h},[Qa.XXTRA_SMALL]:{...t[Qa.XXTRA_SMALL],h:t[Qa.XXTRA_SMALL].h<e?e:t[Qa.XXTRA_SMALL].h}})},DEPTH_CHART_GRID_ID:{default:"depth-chart"}}},{allowApplyHigherFuturesLeverage:wH}=zt,DH=[1,2,3,5,10,20,30,50,75,100],OH={name:"LeverageDialog",components:{BrandDialog:pi,TradingInput:Wn,Icon:Rt,IconMinus:Cz,IconAddThin:Na,ScrollSelector:Sz},setup(){const{showRiskLimitDialog:e}=mh();return{showRiskLimitDialog:e}},data:()=>({isFocusing:!1,allowApplyHigherFuturesLeverage:wH,customLeverage:"",isLoading:!1}),computed:{...b("futures",["marketMap","botLeverageMap","marketMarginMap","riskLimitSettingMap"]),...y(Vn,["isShowLeverageDialog","leverageDialogData"]),...b(["userConfig"]),...y(pt,["isLeaderModeActive"]),...U(["isUnifiedWallet"]),...U("futures",["isMultipleMode"]),symbol(){var e;return(null==(e=this.leverageDialogData)?void 0:e.symbol)||""},riskLimitLevel(){var e,t;return this.isLeaderModeActive?za:(null==(t=null==(e=this.marketMarginMap[this.symbol])?void 0:e[0])?void 0:t.riskLimitLevel)||za},maxLeverage(){var e;if(this.isUnifiedGrid)return Number(null==(e=this.botLeverageMap[this.symbol])?void 0:e.maxLeverage);const t=(this.riskLimitSettingMap[this.symbol]||[]).find((e=>e.riskLevel===this.riskLimitLevel));
1return(null==t?void 0:t.maxLeverage)||1},marketData(){return this.marketMap[this.symbol]},isCross(){const{marginTypeName:e,marginMode:t}=this.leverageDialogData||{};return e===Ci.CROSS||t===ri.CROSS},isLong(){var e;return(null==(e=this.leverageDialogData)?void 0:e.positionDirection)===fi.LONG},isHedge(){var e;return(null==(e=this.leverageDialogData)?void 0:e.positionMode)===li.HEDGE},isUnifiedGrid(){var e;return(null==(e=this.leverageDialogData)?void 0:e.isUnifiedGrid)||!1},availableLeverageScale(){const e=DH.filter((e=>e<=this.maxLeverage));return e.includes(this.maxLeverage)||e.push(this.maxLeverage),e.map((e=>({label:`${e}x`,value:e})))}},watch:{isShowLeverageDialog(e){this.initLeverage(),e&&this.focusInput()},isFocusing(e){e?this.customLeverage=Number(this.customLeverage).toString():this.checkAndSetValidLeverage(Number(this.customLeverage))},maxLeverage(e){Number(this.customLeverage)>Number(e)&&(this.customLeverage=e)}},created(){this.initLeverage()},methods:{...v(["updateUserConfigByKey"]),...v("futures",["setLeverage"]),...f(Vn,["setLeverageDialog"]),...u("futures",["setBotLeverageMap"]),focusInput(){setTimeout((()=>{const e=this.$refs.leverageInput;(null==e?void 0:e.focusInput)&&e.focusInput()}),100)},async requireHigherLeverage(){try{await Va.put("/trading/applyLeverage").catch(qa),this.$toastSuccess({title:this.$t("msg.receivedApplication"),toastType:"normal"})}catch(e){}},initLeverage(){var e;const t=(null==(e=this.leverageDialogData)?void 0:e.leverage)||this.maxLeverage;this.checkAndSetValidLeverage(Number(t))},onClosed(){this.setLeverageDialog({show:!1})},onScaleChange(e){this.checkAndSetValidLeverage(Number(e))},handleFocus(){this.isFocusing=!0},handleBlur(){this.isFocusing=!1},adjustLeverage(e=!0){const t=e?"plus":"minus",i=S(this.customLeverage)[t](1).toNumber();this.checkAndSetValidLeverage(i)},checkAndSetValidLeverage(e){e>this.maxLeverage?e=this.maxLeverage:Number(e)<1&&(e=1),this.customLeverage=S(e).toFixed(2)},async handleSave(){var e,t,i;const r={leverage:this.customLeverage,positionDirection:null==(e=this.leverageDialogData)?void 0:e.positionDirection,positionMode:null==(t=this.leverageDialogData)?void 0:t.positionMode};if(r.marginMode=this.isCross?ri.CROSS:ri.ISOLATED,(null==(i=this.leverageDialogData)?void 0:i.positionId)&&(r.positionId=this.leverageDialogData.positionId,r.symbol=this.symbol),this.isUnifiedGrid){const e=this.symbol,t=this.customLeverage;try{this.isLoading=!0,await Cr.updateMarketLeverage({symbol:e,leverage:t}),this.setBotLeverageMap({symbol:e,data:{leverage:t,maxLeverage:String(this.maxLeverage)}})}catch(a){}finally{this.isLoading=!1}this.onClosed()}else this.setLeverage(r),this.onClosed()}}},IH={class:"margin-mode-dialog-body"},xH={class:"margin-mode-symbol-content mb-20"},_H={class:"margin-mode-market-name"},AH={key:1,class:"margin-mode-type"},RH={class:"leverage-block"},FH={class:"title"},EH={class:"leverage-input-wrapper"},BH={class:"leverage-input-area"},zH={class:"leverage-slider-wrapper"},$H={class:"margin-mode-hint"},NH={key:0},UH={key:1},HH={class:"footer-btns"};const VH=$n(OH,[["render",function(e,t,i,r,u,f){const v=a("Icon"),y=a("IconMinus"),b=a("TradingInput"),S=a("IconAddThin"),P=a("ScrollSelector"),k=a("i18n-t"),T=a("BaseButton"),M=a("BrandDialog");return e.isShowLeverageDialog?(o(),n(M,{key:0,width:e.isMobile?"90%":"530px",visible:e.isShowLeverageDialog,isBrandNewStyle:"",onClosed:f.onClosed},{header:s((()=>[p(m(e.$t("futuresMain.order.leverage")),1)])),body:s((()=>[l("div",IH,[l("div",xH,[f.marketData?(o(),c(g,{key:0},[d(v,{name:f.marketData.baseCurrency,showName:!1,size:"24"},null,8,["name"]),l("div",_H,m(f.marketData.symbol),1)],64)):h("",!0),f.isUnifiedGrid?h("",!0):(o(),c("div",AH,m(f.isCross?e.$t("futuresMain.trade.cross"):e.$t("t.isolated")),1)),!f.isCross&&f.isHedge?(o(),c("div",{key:2,class:C(["margin-mode-type",f.isLong?"long":"short"])},m(f.isLong?e.$t("t.long"):e.$t("t.short")),3)):h("",!0)]),l("div",RH,[l("div",FH,m(e.$t("futuresMain.trade.leverage")),1),l("div",EH,[l("div",{class:"operation-wrapper",onClick:t[0]||(t[0]=e=>f.adjustLeverage(!1))},[d(y,{width:"20",height:"20"})]),l("label",BH,[d(b,{ref:"leverageInput",value:u.customLeverage,"onUpdate:value":t[1]||(t[1]=e=>u.customLeverage=e),type:"number",step:.01,maxDecimalPlaces:2,desktopStyle:"",hide
1Spin:"",max:f.maxLeverage,onFocus:f.handleFocus,onBlur:f.handleBlur},null,8,["value","max","onFocus","onBlur"]),t[6]||(t[6]=l("span",{class:"symbol"},"x",-1))]),l("div",{class:"operation-wrapper",onClick:t[2]||(t[2]=e=>f.adjustLeverage(!0))},[d(S,{width:"20",height:"20"})])]),l("div",zH,[d(P,{value:u.customLeverage,list:f.availableLeverageScale,isRoughCompare:"","onUpdate:value":f.onScaleChange},null,8,["value","list","onUpdate:value"])])]),l("ol",$H,[f.riskLimitLevel>1?(o(),c("li",NH,[p(m(e.$t("futuresMain.leverag.hint.maxLeverage",{maxLeverage:f.maxLeverage}))+" ",1),l("span",{class:"update-leverage-link",onClick:t[3]||(t[3]=(...e)=>r.showRiskLimitDialog&&r.showRiskLimitDialog(...e))},m(e.$t("futuresMain.leverage.adjustRiskLimit")),1)])):h("",!0),f.isUnifiedGrid?h("",!0):(o(),c("li",UH,m(e.isMultipleMode?e.$t("futuresMain.leverage.hint.3"):e.$t("futuresMain.leverage.hint.1")),1)),u.allowApplyHigherFuturesLeverage?(o(),n(k,{key:2,keypath:"futuresMain.leverage.hint.requireHigherLeverage",tag:"li"},{link:s((()=>[l("span",{class:"update-leverage-link",onClick:t[4]||(t[4]=(...e)=>f.requireHigherLeverage&&f.requireHigherLeverage(...e))},m(e.$t("t.link")),1)])),_:1})):h("",!0)]),l("div",HH,[d(T,{class:"primary w-100",size:"large",isLoading:u.isLoading,onClick:f.handleSave},{default:s((()=>[p(m(e.$t("t.save")),1)])),_:1},8,["isLoading","onClick"]),l("div",{class:"cancel-btn w-100",onClick:t[5]||(t[5]=(...e)=>f.onClosed&&f.onClosed(...e))},m(e.$t("t.cancel")),1)])])])),_:1},8,["width","visible","onClosed"])):h("",!0)}],["__scopeId","data-v-4bb81d46"]]);function WH(){const e=k(),t=ue(),i=le(),r=pt(),{updateSymbol:a}=ho(mo,{isTradePageMode:!0}),n=M((()=>e.state.loginState)),o=M((()=>e.getters.isUnifiedWallet)),s=M((()=>e.getters.isEnableCFD)),l=M((()=>e.state.useNewSymbolNaming)),u=M((()=>t.params.id)),c=M((()=>{const t=l.value?"BTC-PERP":"BTCPFC";return e.state.futures.marketMap[t]?t:e.state.futures.marketList[0]})),d=M((()=>{const t=e.state.futures.marketMap;if(t[u.value])return t[u.value];const i=u.value.includes("-");if(l.value){return function(t){const{marketMap:i,marketList:r}=e.state.futures,a=[];for(let e=0,n=r.length;e<n;e++){const n=i[r[e]];if((null==n?void 0:n.coin)===t){if(!n.isTimeBasedContract)return n;a.push(n.symbol)}}return a.sort(),a[0]}(u.value.split("-")[0])||t[Ei(u.value)]}if(i){const[e,i]=u.value.split("-");if("PERP"===i)return t[`${e}PFC`];const r=i.slice(0,2);return t[`${e}${Xa(i.slice(2,4))}${r}`]}})),p=M((()=>r.isLeaderMode&&!e.state.futures.marketDetailMap[d.value.symbol].supportCopyTrading)),h=M((()=>d.value.categoryId!==Za.CRYPTO&&(!s.value||n.value&&!o.value))),m=M((()=>!d.value||d.value.marketClosed||h.value||p.value)),g=M((()=>0===e.state.futures.marketList.length?null:m.value?c.value:d.value.symbol));w((()=>{e.commit("futures/setCurrentMarketSymbol",null)})),D([g,u],(([r])=>{null!==r&&(a(r),e.commit("futures/setCurrentMarketSymbol",r),r!==t.params.id&&i.replace({name:Yo,params:{lang:e.state.lang,id:r},query:t.query}))}),{immediate:!0})}const qH=A({__name:"DoKycFirstDialog",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=le(),a=ue();function l(){r.push({name:Ja.VERIFICATION,params:{...a.params}}),i("dialog:closed",null)}function u(){i("dialog:closed",null)}return(e,t)=>(o(),n(pi,{class:"do-kyc-first-dialog",showClose:"",isBrandNewStyle:"",width:"560px",onClosed:u},{header:s((()=>[p(m(e.$t("futures.kycFirstDialog.title")),1)])),body:s((()=>[p(m(e.$t("futures.kycFirstDialog.content")),1)])),footer:s((()=>[d(va,{size:"biggest",onClick:l},{default:s((()=>[p(m(e.$t("t.verifyMyAccount")),1)])),_:1})])),_:1}))}}),GH=["clip-path"],KH=["id"],QH={__name:"IconClock2",props:{width:{type:[Number,String],default:12},height:{type:[Number,String],default:12}},setup(e){const t=Be();return(i,r)=>(o(),n(Ee,{width:e.width,height:e.height,viewBox:"0 0 12 12",fill:"none","aria-label":"icon-clock-2"},{default:s((()=>[l("g",{"clip-path":`url(#${x(t)})`},r[0]||(r[0]=[l("path",{d:"M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12Z",fill:"var(--custom-clock2-bg, var(--content-neutral-400))"},null,-1),l("path",{d:"M6.00201 3L6.00171 6.0022L8.12156 8.12205",stroke:"var(--custom-clock2-pointer, var(--compbg-neutral-400))","stroke-width":"1.2","stroke-linejoin":"bevel"},null,-1)]),8,GH),l("defs",null,[l("clipPath",{id:x(t)},r[1]||(r[1]=[l("rect",{width:"12",height:"12",fill:"white"},null,-1)]),8,KH)])])),_:1},8,["width","height"]))}},jH={__name:"IconFlag",props:{width:{type:[Number,String],default:12},height:{type:[Number,String],default:12}},setup:e=>(t,i)=>(o(),n(Ee,{width:e.width,height:e.height,viewBox:"0 0 12 12",fill:"none","aria-label":"icon-flag"},{default:s((()=>i[0]||(i[0]=[l("path",{d:"M3 11H4M3 11V5.5M3 11H2M3 1.5V1",stroke:"#7E8F9F","stroke-width":"1.5","stroke-linejoin":"bevel"},null,-1),l("path",{d:"M2 11H3H4",stroke:"#7E8F9F","stroke-width":"1.5","stroke-linejoin":"bevel"},null,-1),l("path",{d:"M3 1.5V5.5L10 3.5L3 1.5Z",fill:"var(--custom-flag-color, var(--content-neutral-400))",stroke:"#7E8F9F","stroke-width":"1.5","stroke-linejoin":"bevel"},null,-1)]))),_:1,__:[0]},8,["width","height"]))},YH={class:"logo-container"},ZH=["src"],XH={class:"tags-container"},JH={class:"tag"},eV={class:"value"},tV={class:"tag"},iV={class:"value"},rV={class:"tag"},aV={class:"value"},nV={class:"content"},oV={class:"rules-container"},sV="-",lV=A({__name:"AssessmentQuizStart",emits:["dialog:closed"],setup(e,{emit:t}){const{enableFuturesComingSoon:i}=mt,r=t,a=en(),{passThreshold:u,attemptsAllowed:c,attemptWindowH
1ours:h,timeLimit:g,maxLeverage:f,isTier2:v}=Q(a),y=M((()=>v.value?ya("futures.assessmentTest.quiz2.title"):ya("futures.assessmentTest.quiz.title"))),b=M((()=>({correctPersent:null!==u.value?Math.round(100*u.value):sV,attemptsTimes:c.value??sV,hours:h.value??sV,timeLimitMins:null!==g.value?Math.round(g.value/60):sV,leverage:f.value??sV})));function S(){r("dialog:closed",an.PROCESSING)}function C(){r("dialog:closed",null)}return(e,t)=>(o(),n(pi,{class:"assessment-quiz-start",isBrandNewStyle:"",width:"560px",showClose:"",closeOnPressEscape:"",onClosed:C},{header:s((()=>[p(m(e.$t(y.value)),1)])),body:s((()=>[l("div",YH,[l("img",{class:"quiz-introduction-logo",src:x(Zz)},null,8,ZH)]),l("div",XH,[d(tn,null,{default:s((()=>[l("div",JH,[d(rn,{width:"12",height:"12"}),l("span",null,m(e.$t("t.passMark")),1),l("span",eV,m(b.value.correctPersent)+"%",1)])])),_:1}),d(tn,null,{default:s((()=>[l("div",tV,[d(QH),l("span",null,m(e.$t("t.timeLimit")),1),l("span",iV,m(b.value.timeLimitMins)+m(e.$t("t.mins_time")),1)])])),_:1}),d(tn,null,{default:s((()=>[l("div",rV,[d(jH),l("span",null,m(e.$t("t.attempts")),1),l("span",aV,m(e.$t("t.attemptsTimesByHours",b.value)),1)])])),_:1})]),l("div",nV,m(e.$t("futures.assessmentTest.start.content",b.value)),1),l("div",oV,[l("ul",null,[l("li",null,m(e.$t("futures.assessmentTest.start.detail.1")),1),l("li",null,m(e.$t("futures.assessmentTest.start.detail.2",b.value)),1),l("li",null,m(e.$t("futures.assessmentTest.start.detail.3",b.value)),1)])])])),footer:s((()=>[d(va,{class:"start-button",size:"bigger",disabled:x(i),onClick:S},{default:s((()=>[p(m(x(i)?e.$t("t.comingSoon"):e.$t("t.start")),1)])),_:1},8,["disabled"])])),_:1}))}}),uV={class:"quiz-container font-16 flex-box flex-column items-center"},cV={class:"quiz-introduction flex-box flex-column items-center"},dV={class:"des"},pV={class:"flex-box flex-column items-center w-100"},hV=$n(A({__name:"BeforeLeave",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=T(!1);function u(){r.value||(r.value=!0,nn().then((()=>{i("dialog:closed",!0)})).catch((e=>{})).finally((()=>{r.value=!1})))}function c(){r.value||i("dialog:closed",!1)}return(e,t)=>{const i=a("BaseButton");return o(),n(pi,{class:"assessment-test-before-leave",width:"560px",height:"auto",isBrandNewStyle:"",onClosed:c},{header:s((()=>[p(m(e.$t("futures.assessmentTest.quiz.title")),1)])),body:s((()=>[l("div",uV,[l("div",cV,[l("div",dV,m(e.$t("derivative.message.beforeLeave")),1)])])])),footer:s((()=>[l("div",pV,[d(i,{class:"primary w-100 mb-16",size:"large",isLoading:r.value,onClick:u},{default:s((()=>[p(m(e.$t("msg.discardProgress")),1)])),_:1},8,["isLoading"]),l("div",{class:C(["back-button",{disabled:r.value}]),onClick:c},m(e.$t("t.cancel")),3)])])),_:1})}}}),[["__scopeId","data-v-b0bcb428"]]),mV={class:"quiz-container"},gV={class:"quiz-question-block"},fV={class:"quiz-info mb-24 flex-box flex-row justify-between"},vV={class:"question-count font-18 weight-500"},yV={class:"time-remaining font-16 weight-400"},bV={class:"quiz-question-content"},SV={class:"no"},CV={class:"text"},PV={class:"option-letter"},kV={key:0,class:"error-message mt-16 font-16 weight-500"},TV=$n(A({__name:"AssessmentTestQuiz",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=G(),{$openDialog:u}=ar(),f=en(),{isTier2:v}=Q(f),y=Ir(),b=Z(y,"isMobile"),S=M((()=>v.value?ya("futures.assessmentTest.quiz2.title"):ya("futures.assessmentTest.quiz.title"))),P="QUIZING",k="REVEALED",L="TIME_EXPIRED";function D(e,t){const i=function(e){const t=[...e];for(let i=t.length-1;i>0;i--){const e=Math.floor(Math.random()*(i+1));[t[i],t[e]]=[t[e],t[i]]}return t}(e.content.options.map(((e,t)=>({originalKey:t,optionContent:e.description})))).map(((e,t)=>({optionKey:t+1,originalKey:e.originalKey,optionContent:e.optionContent})));return{quizId:e.quizId,questionContent:e.content.description,options:i,selectedAnswer:null,currentExam:t}}const O=T(!1),I=T({quizId:null,questionContent:"",options:[],selectedAnswer:null,currentExam:null}),_=T(P),A=T(null),F=T(null),E=T(0),B=T(!1),z=T(!1),$=T(!1);let N=null;function U(){null!==N&&(clearInterval(N),N=null)}w(U);const H=M((()=>_.value===P)),V=M((()=>!!O.value||_.value===P&&null===I.value.selectedAnswer)),W=M((()=>
1{if(O.value)return!0;switch(_.value){case k:case L:return!0}return!1})),q=M((()=>`${r.t("t.question")}: ${r.t("kyc.container.pageNumber",{page:E.value??" ",totalPage:F.value??" "})}`)),K=M((()=>{if(null===A.value)return"";const e=Math.floor(A.value/60),t=A.value%60;return`${e}m${String(t).padStart(2,"0")}s`})),j=M((()=>{switch(_.value){case P:return r.t("t.confirm");case k:return r.t("t.next");case L:return r.t("t.endAssessment")}return""}));function Y(e){$.value||($.value=!0,U(),i("dialog:closed",e))}function X(){Y(an.GENERAL_ERROR)}async function J(){O.value=!0,await on().then((e=>{const t=e.quizzes[0];if(!t)return X();I.value=D(t,e.currentExam),E.value=e.quizNumber,F.value=e.totalAmount,A.value=e.remainingTime,_.value=P,B.value=!1,null===N&&(N=setInterval((()=>{null!==A.value&&(A.value--,A.value<=0&&(A.value=0,_.value=L,U()))}),1e3))})).catch((e=>{if(e===sn.ASSESSMENT_QUIZ_EXPIRED)return U(),_.value=L,void(A.value=0);X()})).finally((()=>{O.value=!1}))}async function ee(){switch(_.value){case P:return void(await async function(){const e=I.value.selectedAnswer,t=I.value.currentExam;if(null===e||null===t)return;O.value=!0;const i=Number(e),r=I.value.options.find((e=>e.optionKey===i)),a=null==r?void 0:r.originalKey;if(void 0===a)return O.value=!1,X();await ln({exam:t,quizNumber:E.value,answer:[a]}).then((e=>{const t=e.answer;I.value.options.forEach((e=>{e.originalKey===t?e.styleClass="is-right":e.optionKey===i&&(e.styleClass="is-wrong")})),_.value=k,B.value=e.isFinalQuiz,e.isFinalQuiz&&(z.value=!0===e.passed,f.finalCorrectCount=e.correctCount,f.finalTotalAmount=e.totalAmount,U())})).catch((e=>{if(e===sn.ASSESSMENT_QUIZ_EXPIRED)return U(),_.value=L,void(A.value=0);X()})).finally((()=>{O.value=!1}))}());case k:return void(B.value?Y(z.value?an.QUIZ_PASSED:an.QUIZ_FAILED):await J());case L:return void Y(an.TIME_EXPIRED)}}async function te(){if($.value)return;if(_.value!==P)return;await u(hV)&&Y(an.ABANDONED)}return ve((()=>{f.finalCorrectCount=null,f.finalTotalAmount=null,J()})),(e,t)=>{const i=a("BaseButton");return o(),n(pi,{class:"assessment-test-quiz",width:"560px",height:"auto",fullStyle:b.value,showClose:H.value,closeOnPressEscape:H.value,isBrandNewStyle:"",onClosed:te},{header:s((()=>[p(m(e.$t(S.value)),1)])),body:s((()=>[l("div",mV,[l("div",gV,[l("div",fV,[l("div",vV,m(q.value),1),l("div",yV,m(e.$t("t.timeRemaining"))+": "+m(K.value),1)]),l("span",bV,[l("span",SV,m(E.value)+".",1),l("span",CV,m(I.value.questionContent),1)]),d(x(hr),{modelValue:I.value.selectedAnswer,"onUpdate:modelValue":t[0]||(t[0]=e=>I.value.selectedAnswer=e),class:"quiz-option-wrap"},{default:s((()=>[(o(!0),c(g,null,R(I.value.options,(e=>(o(),n(x(mr),{key:`${I.value.quizId}-${e.optionKey}`,class:C(["quiz-options",e.styleClass]),type:x(gr).HOLLOW,label:String(e.optionKey),disabled:W.value},{default:s((()=>{return[l("span",PV,m((t=e.optionKey,String.fromCharCode("A".charCodeAt(0)+t-1)))+". ",1),p(" "+m(e.optionContent),1)];var t})),_:2},1032,["class","type","label","disabled"])))),128))])),_:1},8,["modelValue"]),_.value===L?(o(),c("div",kV,m(e.$t("t.youreOutOfTime")),1)):h("",!0)])])])),footer:s((()=>[d(i,{class:"primary w-100",size:"large",disabled:V.value,isLoading:O.value,onClick:ee},{default:s((()=>[p(m(j.value),1)])),_:1},8,["disabled","isLoading"])])),_:1},8,["fullStyle","showClose","closeOnPressEscape"])}}}),[["__scopeId","data-v-4785ad06"]]),MV={class:"lock-body flex-box flex-column items-center"},LV={class:"logo-container"},wV=["src"],DV={class:"description font-16"},OV={class:"countdown tabular-nums"},IV={class:"segment"},xV={class:"value"},_V={class:"label"},AV={class:"segment"},RV={class:"value"},FV={class:"label"},EV={class:"segment"},BV={class:"value"},zV={class:"label"},$V=$n(A({__name:"LockDialog",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=le(),u=ue(),c=en(),{lockedRemainingSeconds:h,attemptsAllowed:g}=Q(c),f=T(h.value??0);let v=null;function y(){null!==v&&(clearInterval(v),v=null)}ve((()=>{f.value<=0||(v=setInterval((()=>{f.value--,f.value<=0&&(f.value=0,y())}),1e3))})),w(y);const b=M((()=>Math.floor(f.value/3600))),S=M((()=>Math.floor(f.value%3600/60))),C=M((()=>f.value%60));function P(){r.push({name:"trading",params:{...u.params}}),i("dialog:closed",null)}function k(){i("dialog:closed",null)}return(e,t)=>{const i=a("BaseButton");return o(),n(pi,{class:"assessment-test-lock-dialog",width:"560px",height:"auto",isBrandNewStyle:"",showClose:"",onClosed:k},{header:s((()=>[p(m(e.$t("futures.assessmentTest.lock.title")),1)])),body:s((()=>[l("div",MV,[l("div",LV,[l("img",{class:"quiz-introduction-logo",src:x(Zz)},null,8,wV)]),l("div",DV,[l("div",null,m(e.$t("futures.assessmentTest.lock.attemptsUsed",{attemptsAllowed:x(g)??"-"})),1),l("div",null,m(e.$t("futures.assessmentTest.lock.nextAvailable")),1)]),l("div",OV,[l("div",IV,[l("div",xV,m(b.value),1),l("div",_V,m(e.$t("t.hrs")),1)]),t[0]||(t[0]=l("div",{class:"colon"},":",-1)),l("div",AV,[l("div",RV,m(S.value),1),l("div",FV,m(e.$t("t.min")),1)]),t[1]||(t[1]=l("div",{class:"colon"},":",-1)),l("div",EV,[l("div",BV,m(C.value),1),l("div",zV,m(e.$t("t.sec")),1)])])])])),footer:s((()=>[d(i,{class:"trade-spot-btn primary w-100",size:"large",onClick:P},{default:s((()=>[p(m(e.$t("t.tradeSpotForNow")),1)])),_:1})])),_:1})}}}),[["__scopeId","data-v-59afc9fb"]]),NV={class:"f1-welcome-body"},UV={class:"logo-container"},HV={class:"description"},VV={class:"leverage-info"},WV={class:"next-steps"},qV={class:"step-title"},GV={class:"step-desc"},KV={class:"step-title"},QV={class:"step-desc"},jV=$n(A({__name:"F1WelcomeDialog",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=k();function u(){i("dialog:closed",null)}function c(){i("dialog:closed",null)}return ve((()=>
1{r.dispatch("futures/getMarketRiskLimitSetting")})),(e,t)=>{const i=a("BaseButton");return o(),n(pi,{class:"assessment-test-f1-welcome-dialog",width:"560px",height:"auto",isBrandNewStyle:"",onClosed:u},{header:s((()=>[p(m(e.$t("futures.assessmentTest.f1Welcome.title")),1)])),body:s((()=>[l("div",NV,[l("div",UV,[d(Ka,{class:"quiz-introduction-logo"})]),l("div",HV,m(e.$t("futures.assessmentTest.f1Welcome.description")),1),l("div",VV,m(e.$t("futures.assessmentTest.f1Welcome.leverageInfo",x(un))),1),l("ol",WV,[l("li",null,[l("div",qV,m(e.$t("futures.assessmentTest.f1Welcome.step1.title",x(un))),1),l("div",GV,m(e.$t("futures.assessmentTest.f1Welcome.step1.desc")),1)]),l("li",null,[l("div",KV,m(e.$t("futures.assessmentTest.f1Welcome.step2.title",x(un))),1),l("div",QV,m(e.$t("futures.assessmentTest.f1Welcome.step2.desc")),1)])])])])),footer:s((()=>[d(i,{class:"trade-btn primary w-100",size:"large",onClick:c},{default:s((()=>[p(m(e.$t("t.startTrading")),1)])),_:1})])),_:1})}}}),[["__scopeId","data-v-1f1ebafb"]]),YV={class:"f2-welcome-body"},ZV={class:"logo-container"},XV={class:"description"},JV=$n(A({__name:"F2WelcomeDialog",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=k();function u(){i("dialog:closed",null)}function c(){i("dialog:closed",null)}return ve((()=>{r.dispatch("futures/getMarketRiskLimitSetting")})),(e,t)=>{const i=a("BaseButton");return o(),n(pi,{class:"assessment-test-f2-welcome-dialog",width:"560px",height:"auto",isBrandNewStyle:"",onClosed:u},{header:s((()=>[p(m(e.$t("futures.assessmentTest.f2Welcome.title")),1)])),body:s((()=>[l("div",YV,[l("div",ZV,[d(Ka,{class:"quiz-introduction-logo"})]),l("div",XV,m(e.$t("futures.assessmentTest.f2Welcome.description")),1)])])),footer:s((()=>[d(i,{class:"trade-btn primary w-100",size:"large",onClick:c},{default:s((()=>[p(m(e.$t("t.tradeNow")),1)])),_:1})])),_:1})}}}),[["__scopeId","data-v-6c2688f5"]]),eW={class:"almost-there-body"},tW={class:"logo-container"},iW={class:"title"},rW={class:"description"},aW=$n(A({__name:"AlmostThereDialog",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=en(),{finalCorrectCount:u,finalTotalAmount:c,passThreshold:h}=Q(r),g=M((()=>null===u.value||null===c.value?"-":0===c.value?0:Math.round(u.value/c.value*100))),f=M((()=>null===h.value?"-":Math.round(100*h.value)));function v(){i("dialog:closed",!1)}function y(){i("dialog:closed",!0)}return(e,t)=>{const i=a("BaseButton");return o(),n(pi,{class:"assessment-test-almost-there-dialog",width:"560px",height:"auto",isBrandNewStyle:"",onClosed:v},{header:s((()=>t[0]||(t[0]=[p(m(""))]))),body:s((()=>[l("div",eW,[l("div",tW,[d(cn,{class:"quiz-introduction-logo"})]),l("div",iW,m(e.$t("t.almostThere.exclamation")),1),l("div",rW,m(e.$t("futures.assessmentTest.almostThere.description",{score:g.value,threshold:f.value})),1)])])),footer:s((()=>[d(i,{class:"try-again-btn primary w-100",size:"large",onClick:y},{default:s((()=>[p(m(e.$t("t.tryAgain")),1)])),_:1})])),_:1})}}}),[["__scopeId","data-v-cb2dce6e"]]);const nW=$n({},[["render",function(e,t){return m("")}]]),oW={class:"header-container w-100"},sW={class:"disclosure-body"},lW={class:"content-scroll"},uW={class:"acknowledge-list"},cW=$n(A({__name:"RiskDisclosureSignDialog",emits:["dialog:closed"],setup(e,{emit:t}){const i=t,r=Ir(),u=Z(r,"isMobile"),h=[{key:"read",i18nKey:ya("futures.assessmentTest.riskDisclosure.acknowledge.1")},{key:"margin",i18nKey:ya("futures.assessmentTest.riskDisclosure.acknowledge.2")},{key:"assessed",i18nKey:ya("futures.assessmentTest.riskDisclosure.acknowledge.3")}],f=se(Object.fromEntries(h.map((e=>[e.key,!1])))),v=M((()=>h.every((e=>f[e.key])))),y=k(),b=M((()=>y.getters.isNightTheme));function S(){v.value&&i("dialog:closed",!0)}function C(){i("dialog:closed",!1)}return(e,t)=>{const i=a("BaseButton");return o(),n(pi,{class:"risk-disclosure-sign-dialog",width:"560px",height:"auto",fullStyle:u.value,isBrandNewStyle:"",showClose:"",closeOnPressEscape:!1,onClosed:C},{header:s((()=>[l("div",oW,[b.value?(o(),n(ms,{key:0})):(o(),n(ms,{key:1}))])])),body:s((()=>[l("div",sW,[l("div",lW,[d(nW)]),l("div",uW,[(o(),c(g,null,R(h,(t=>l("div",{key:t.key,class:"acknowledge-item"},[d(Ko,{value:f[t.key],"onUpdate:value":e=>f[t.key]=e,isBrandNewStyle:""},{default:s((()=>[p(m(e.$t(t.i18nKey)),1)])),_:2},1032,["value","onUpdate:value"])]))),64))])])])),footer:s((()=>[d(i,{class:"primary w-100",size:"large",disabled:!v.value,onClick:S},{default:s((()=>[p(m(e.$t("t.acknowledge")),1)])),_:1},8,["disabled"])])),_:1},8,["fullStyle"])}}}),[["__scopeId","data-v-96365c50"]]),dW=A({__name:"AssessmentTestFlowEntrance",emits:["dialog:closed"],setup(e,{emit:i}){const r=i,{$openDialog:a}=ar(),n=le(),o=k(),s=en(),{isNotSupport:l,isCompleted:u,isInit:c,isLock:d,isF1Pass:p,isProcessing:h,isTier1:g,isTier2:f}=Q(s),{reset:v,fetchStatus:y}=s,b=M((()=>o.state.loginState));ve((async function(){if(!b.value)return await a(qH),r("dialog:closed",null);let e=null;for(;;){if(!(await y().then((()=>!0)).catch((e=>(v(),!1))))){e=await a(Yz);break}switch(!0){case u.value:e=new S(an.COMPLETED);break;case p.value:e=new S(null);break;case l.value:e=await a(qH);break;case d.value:e=await a($V);break;case c.value:case h.value:{if(!(await P())){e=new S(null);break}const t=await C();if((null==t?void 0:t.result)===an.TIME_EXPIRED||(null==t?void 0:t.result)===an.ABANDONED)continue;if((null==t?void 0:t.result)===an.QUIZ_PASSED){g.value?await a(jV):f.value&&await a(JV),e=t;break}
1if((null==t?void 0:t.result)===an.QUIZ_FAILED){if(!0===await a(aW))continue;e=t;break}e=t;break}}break}r("dialog:closed",e)}));class S{constructor(e){t(this,"result"),this.result=e}}async function C(){if(!h.value){if(null===await a(lV))return null}const e=await a(TV);return e===an.GENERAL_ERROR&&await a(Yz),new S(e)}async function P(){if(!(await dn().then((()=>!0)).catch((e=>!1))))return await a(Yz),!1;if(zi($i.FUTURES_DISCLAIMER_SIGNED))return!0;if(!0!==await a(cW))return n.push({name:ai.HOME}),!1;return!!(await Bi($i.FUTURES_DISCLAIMER_SIGNED).then((()=>!0)).catch((e=>!1)))||(await a(Yz),!1)}return(e,t)=>m("")}}),{enableFuturesSuitabilityQuiz:pW,enableFuturesDerivativeQuiz:hW,enableAssessmentTest:mW,enableFuturesDisclaimer:gW,disableLinkOnTrading:fW,futureMetaTitleV2:vW,enableFuturesMetaBySymbol:yW}=mt,{DEPTH_CHART_LAYOUT:bW,ARABIC_DEPTH_CHART_LAYOUT:SW,RECENT_TRADE_LAYOUT:CW,ARABIC_RECENT_TRADE_LAYOUT:PW,RESIZABLE_ITEM_LIST:kW,ARABIC_RESIZABLE_ITEM_LIST:TW,FUTURES_RESIZABLE_ITEM_LIST:MW,ARABIC_FUTURES_RESIZABLE_ITEM_LIST:LW,LAYOUT_GENERATOR:wW,RESET_LAYOUT_GENERATOR:DW,DEPTH_CHART_GRID_ID:OW,CONTRACT_DETAIL_LAYOUT:IW,ARABIC_CONTRACT_DETAIL_LAYOUT:xW,ORDER_FUND_LAYOUT:_W,ARABIC_ORDER_FUND_LAYOUT:AW}=LH,{enableRecentTrades:RW}=zt;function FW(e,t,i){const r=e.findIndex((e=>e.id===i));if(r<0)return e;const a={...e[r]},n={...a.layout};Object.entries(t).forEach((e=>{const[t,i]=e;n[t]={...n[t],...i}})),a.layout=n,e[r]=a}function EW(e,t,i,r){const a=e,n=a.findIndex((e=>e.id===t));if(n<0)return e;const o={...a[n]};return a[n]=o,o.layout=r(i,o.layout),e}let BW={};const zW={[Qa.LARGE]:36,[Qa.MEDIUM]:33,[Qa.SMALL]:33,[Qa.XTRA_SMALL]:35,[Qa.XXTRA_SMALL]:35},$W={[Qa.LARGE]:36,[Qa.MEDIUM]:36,[Qa.SMALL]:37,[Qa.XTRA_SMALL]:40,[Qa.XXTRA_SMALL]:42},NW={[Qa.LARGE]:35,[Qa.MEDIUM]:28,[Qa.SMALL]:29,[Qa.XTRA_SMALL]:32,[Qa.XXTRA_SMALL]:32},UW={[Qa.LARGE]:35,[Qa.MEDIUM]:32,[Qa.SMALL]:33,[Qa.XTRA_SMALL]:35,[Qa.XXTRA_SMALL]:38},HW={[Qa.LARGE]:35,[Qa.MEDIUM]:36,[Qa.SMALL]:35,[Qa.XTRA_SMALL]:35,[Qa.XXTRA_SMALL]:38},VW={[ni.LIMIT]:zW,[ni.LIMIT_STOP]:$W,[ni.LIMIT_TAKE_PROFIT]:$W,[ni.MARKET]:NW,[ni.MARKET_STOP]:UW,[ni.MARKET_TRAILING_STOP]:HW,[ni.MARKET_TAKE_PROFIT]:UW,[ni.OCO]:HW,[ni.INDEX]:HW,[ni.TWAP]:{[Qa.LARGE]:36,[Qa.MEDIUM]:36,[Qa.SMALL]:37,[Qa.XTRA_SMALL]:40,[Qa.XXTRA_SMALL]:42}},WW={name:"TradingFutures",components:{UnifiedWalletUpgradeNotification:Ts,FuturesOrder:fz,DepthChartCard:Sc,RecentTradesCard:Jl,MarketInfoCard:ld,TradingViewCard:Zd,WalletStatusCard:zp,ContractDetail:Rw,NewEditRiskLimitDialog:Gz,GridShell:uH,MarketBar:vH,OrderManagement:nw,OrderBookRecentTradesCard:ou,FundingCard:eD,LeverageDialog:VH,LeaderSwitcher:Zo,FullKycNotification:pn},provide(){return{...RD.provideContext({component:this.loginPromotionComponent}),getActionType:()=>this.actionType,tabsActionUpdate:this.tabsActionUpdate,adjustOrderFormHeight:this.adjustOrderFormHeight}},inheritAttrs:!1,props:{loginPromotionComponent:{type:Object,default:()=>({})}},setup(){const e=G(),t=k(),i=ue();WH();const r=Un(),a=M((()=>t.state.orderBook.lastPrice)),n=M((()=>i.params.id)),o=M((()=>t.getters["futures/symbol"])),s=M((()=>t.state.futures.marketMap)),l=M((()=>t.state.orderBook.lastPriceChange));const u=M((()=>{const t=e.t("brand.name"),r=(u=l.value)?u>0?"â²":"â¼":"";var u;const c=function(e){var t;const i=null==(t=s.value[o.value])?void 0:t.priceFilter;return Qt(e,i)||""}(a.value),d={price:c,gainsSymbol:r,futuresMarketSymbol:o.value,brandName:t,marketSymbol:n.value};if(yW){const t=`router.futures.${o.value}`;return Ui(t)?e.t(t):e.t("router.futures",d)}return vW?vn({$route:i,mapKey:"updateTitle",payload:d}):`${r}${c} (${n.value}) ${e.t(`router.${i.meta.key}`,{brandName:t})}`})),c=M((()=>{if(yW){const t=`router.futures.description.${o.value}`;return Ui(t)?e.t(t):e.t("router.futures.description")}return yn({$route:i,payload:{futuresMarketSymbol:o.value}}).replace(/\s+/," ")})),d=bn({title:u,description:c});return Me({title:u,meta:d}),{tradingDepthStore:r,lastPrice:a,lastPriceChange:l}},data:()=>({TRADING_TYPE:It,disableLinkOnTrading:fW,enableRecentTrades:RW,children:[],showUpgradeNotification:!0,showEditRiskLimitPopup:!1,isShowRiskLimitError:!1,positionHeight:0,walletRow:0,depthChartResizeTrigger:"",orderBookHeight:0,marketInfoWidth:0,orderManagementResizeTrigger:"",preservedLayoutList:[],storedLayoutList:[],actionType:0,gridShellList:[],isLeaderUiStatus:fn,riskLimitPopupSymbol:null}),computed:{...b({isLogin:"loginState",showDepthChart:e=>e.userConfig.depthChart,showContractDetails:e=>e.userConfig.contractDetails,layoutLocked:e=>e.userConfig.gridLayoutLocked,freezeGridLayout:e=>e.freezeGridLayout,isTradingViewFullScreen:"isTradingViewFullScreen",isMobileChartMode:"isMobileChartMode",triggerLayoutReset:"triggerLayoutReset",lang:"lang",accountInfo:"accountInfo",useNewSymbolNaming:"useNewSymbolNaming",separateRecentTrade:e=>e.userConfig.separateRecentTrade||!1,apiResponseCode:"apiResponseCode",apiResponseExtraData:"apiResponseExtraData"}),...b("futures",{notification:"notification",riskLimitPopupTrigger:"riskLimitPopupTrigger",marketMap:"marketMap"}),...y(Vn,["enableOrderFormTpSl"]),...y(pt,["isLeaderMode"]),...U(["isAccountInfoExist","isUnifiedWallet"]),...U("futures",{isFutures:"isFutures",futuresMarketSymbol
1:"symbol",futuresMarketData:"marketData",futuresWallet:"wallet"}),...y(qe,["isSpot"]),...U(["isArabic","userName","isUnifiedWallet","isEnableUnifiedWalletUpgrade"]),...y(Ge,["sizeType"]),isMdSize(){return"md"===this.$mq},marketSymbol(){return this.$route.params.id},showRecentTradesCard(){return RW&&this.separateRecentTrade&&(!this.isMobile||this.isMobileChartMode)},rowHeight:()=>16,rawLayoutList(){const e=this.isMobile?[]:["contract-info"];let t=Array.from(this.resizableItemList);return t=t.concat(this.futuresResizableItemList).filter((t=>!e.includes(t.id))),t},depthChartGridId:()=>OW.default,hideDepthChart(){return!this.showDepthChart&&!this.isMobile},layoutList:{get(){const e=this.rawLayoutList.map((e=>{const{id:t,layout:i}=e,r=this.storedLayoutList.find((e=>e.id===t));return r?{...e,id:t,layout:{...i,...r.layout}}:{...e}}));EW(e,"wallet-status",this.walletRow,DW["wallet-status"]);const t=[{id:this.depthChartGridId,hide:this.hideDepthChart,defaultConfig:this.isArabic?SW:bW},{id:"contract-detail",hide:!this.showContractDetails,defaultConfig:this.isArabic?xW:IW},{id:"recent-trade",hide:!this.showRecentTradesCard,defaultConfig:this.isArabic?PW:CW},{id:"order-fund",hide:fW||!this.isLogin||this.isLeaderMode,defaultConfig:this.isArabic?AW:_W}];for(let i=0;i<t.length;i++){const{id:r,hide:a,defaultConfig:n}=t[i],o=this.storedLayoutList.find((({id:e})=>e===r))||{},s=e.findIndex((({id:e})=>e===r)),l={...n,layout:o&&!a?o.layout:n.layout};e[s].hide=o.hide,e[s].temp=o.temp,a&&!o.hide?e[s]={...l,hide:!0,temp:e[s].layout,layout:{[Qa.LARGE]:n.hideLayout,[Qa.MEDIUM]:n.hideLayout,[Qa.SMALL]:n.hideLayout,[Qa.XTRA_SMALL]:n.hideLayout,[Qa.XXTRA_SMALL]:n.hideLayout}}:!a&&o.hide&&o.temp&&(e[s].hide=!1,e[s].layout=o.temp)}return e},set(e){this.preservedLayoutList=e,this.storedLayoutList=e,this.enableOrderFormTpSl||es(this.$route.name,this.langKey,this.userName,e)}},langKey(){return this.isArabic?"ar":""},resizableItemList(){return this.isArabic?TW:kW},futuresResizableItemList(){return this.isArabic?LW:MW},defaultOrderFormLayout(){const{layout:e}=this.resizableItemList.find((e=>"futures-order"===e.id));return e},notToggledOrderFormLayout(){var e;const t={};for(const i of Object.values(Qa)){const r=(null==(e=BW[i])?void 0:e.h)||this.defaultOrderFormLayout[i].h;t[i]={h:r}}return t},showUpgradeUnifiedWalletNotification(){return this.isEnableUnifiedWalletUpgrade&&!this.isUnifiedWallet&&this.showUpgradeNotification}},watch:{isAccountInfoExist:{handler:async function(e){if(this.isFutures){if(e){if(!(await this.futuresDisclaimerFlow()))return;await this.futuresQuizFlow()}await this.futureAssessmentTestFlow()}},immediate:!0},isLogin(){this.isFutures&&!this.isLogin&&(this.showEditRiskLimitPopup=!1,Ot(!1))},triggerLayoutReset(){this.storedLayoutList=[]},"futuresMarketData.symbol"(e){this.isFutures&&e&&this.futuresUpdateLastMarketSymbol(e)},apiResponseCode(e){[hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE,hn.ORDER_PRICE_TWAP_ARGS_OUTSIDE_ALLOWED_RANGE,hn.ORDER_PRICE_TRIGGER_ARGS_OUTSIDE_ALLOWED_RANGE].includes(e)&&this.handlePriceProtectionMessage(e)},notification(e){const{status:t,type:i,error:r}=e;if(20===t&&[93,94].includes(i)&&(this.getMarginSetting(),this.isUnifiedWallet||this.getOpenPositionList()),20===t&&129===i&&this.getMarketPositionMode(),8===t&&94===i)return void this.messageError(this.$t("trading.futures.riskLimit.insufficientError"));let a;try{a="string"==typeof r?JSON.parse(r):r}catch{a=null}(null==a?void 0:a.code)!==hn.RPI_ORDER_CANCEL&&([gn.ORDER_CANCELED,gn.ORDER_REJECTED,gn.ORDER_REFUNDED].includes(t)&&(null==a?void 0:a.code)===hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE?this.handlePriceProtectionMessage(a.code,a.extraData):this.messageSuccess(e))},showEditRiskLimitPopup(e){e||(this.isShowRiskLimitError=!1,this.riskLimitPopupTarget=null,this.riskLimitPopupSymbol=null)},hideDepthChart(){this.depthChartResizeTrigger=`store_resized_${Date.now()}`},isMobile(e){e||this.setMobileChartMode(!1)},storedLayoutList(e){mn(e,this.preservedLayoutList)||(this.orderBookHeight=0,this.marketInfoWidth=0,this.depthChartResizeTrigger=`store_resized_${Date.now()}`,this.createGridShellList())},lang(){this.storedLayoutList=Jo(this.$route.name,this.langKey,this.userName)},userName(e,t){!t&&e&&(this.storedLayoutList=Jo(this.$route.name,this.langKey,this.userName))},riskLimitPopupTrigger({error:e=!1,targetStep:t,symbol:i}){this.isShowRiskLimitError=e,this.riskLimitPopupTarget=t,this.riskLimitPopupSymbol
1=i,this.showEditRiskLimitPopup=!0},isMobileChartMode(){this.createGridShellList()},positionHeight(){this.createGridShellList()},showDepthChart(){this.depthChartResizeTrigger=`store_resized_${Date.now()}`,this.createGridShellList()},showContractDetails(){this.createGridShellList()},isLeaderMode(){this.createGridShellList()}},created(){var e,t,i;if(this.storedLayoutList=Jo(this.$route.name,this.langKey,this.userName),BW=(null==(e=this.storedLayoutList.find((e=>"futures-order"===e.id)))?void 0:e.layout)||{},this.storedLayoutList){const e=this.storedLayoutList.findIndex((e=>"depth-chart"===e.id)),{w:r,x:a,y:n}=(null==(i=null==(t=this.storedLayoutList[e])?void 0:t.layout)?void 0:i.xs)||{};if(8===a&&21===n&&16===r){const t=JSON.parse(JSON.stringify(this.storedLayoutList));t[e].layout.xs={...t[e].layout.xs,h:10,w:2,x:0,y:27},this.storedLayoutList=t}}this.toggleLocalStorageWatcher(),this.isFutures&&this.futuresMarketData.symbol&&this.futuresUpdateLastMarketSymbol(this.futuresMarketData.symbol)},async mounted(){this.adjustOrderFormHeight()},beforeUnmount(){this.toggleLocalStorageWatcher(!1)},methods:{...u(["setMobileChartMode"]),...f(Vn,["setShowFirstTimeTradeQuiz","setShowFeatureVerificationCheckDialog"]),...v(["messageSuccess","messageCustom","messageError","changeActiveWallet","updateUserConfigByKey"]),...v("futures",{futuresUpdateLastMarketSymbol:"updateLastMarketSymbol",getOpenPositionList:"getOpenPositionList",getMarketPositionMode:"getMarketPositionMode",getMarginSetting:"getMarginSetting"}),async futuresDisclaimerFlow(){if(!gW)return!0;if(!this.isLogin)return!0;if(await dn(),zi($i.FUTURES_DISCLAIMER_SIGNED))return!0;const{accepted:e=!1,closedByRouteChanged:t=!1}=await this.$openDialog(hN)??{closedByRouteChanged:!0};return!t&&(e?(Bi($i.FUTURES_DISCLAIMER_SIGNED),!0):(this.$router.push({name:ai.HOME,params:{lang:this.lang}}),!1))},async futuresQuizFlow(){if(!this.isLogin)return t$.NOT_LOGIN;if(!pW)return t$.QUIZ_SUITABILITY_NO_ENABLED;const{error:e,...t}=await async function(){return Va.get("/assessment/trading/status").then(Wa).catch(qa)}().then((e=>e??{})).catch((e=>({error:e})));if(e)return await this.$openDialog(Yz),t$.QUIZ_UNEXPECTED_ERROR;const{status:i,examStatus:{criteriaQuizResult:r=null,derivativesQuizResult:a=null}={}}=t;if("NOT_SUPPORT"===i||r===a$&&a===s$)return t$.QUIZ_SUITABILITY_PASS_QUIZ_DERIVATIVE_PASS;this.setShowFirstTimeTradeQuiz(!0),await async function e({retryLeftTimes:t=1}={}){var i;const n=await this.$openDialog(_$,{criteriaQuizResult:r});if(!n.pass)return n.reason;if(!hW)return t$.QUIZ_SUITABILITY_PASS_QUIZ_DERIVATIVE_NOT_ENABLED;const o=await this.$openDialog(lN,{derivativesQuizResult:a});if((null==(i=o.reason)?void 0:i.key)===t$.QUIZ_DERIVATIVE_NEED_RETRY.key){if(0===t)return t$.QUIZ_DERIVATIVE_NEED_RETRY;const{retryError:i}=await e$().then((e=>e??{})).catch((e=>({retryError:e})));return i?t$.QUIZ_UNEXPECTED_ERROR:e.call(this,{retryLeftTimes:t-1})}return o.pass?t$.QUIZ_SUITABILITY_PASS_QUIZ_DERIVATIVE_PASS:o.reason}.call(this),this.setShowFirstTimeTradeQuiz(!1),await this.$nextTick(),this.$store.getters["tutorial/tutorialMap"][Qy].showed=!1},async futureAssessmentTestFlow(){if(!mW)return an.NOT_ENABLE;const{result:e=null}=await this.$openDialog(dW)??{};return e},onStorageChange(e){e.key===Xo(this.$route.name,this.langKey,this.userName)&&e.oldValue!==e.newValue&&(this.storedLayoutList=JSON.parse(e.newValue)||[])},toggleLocalStorageWatcher(e=!0){e&&window.addEventListener("storage",this.onStorageChange),!e&&window.removeEventListener("storage",this.onStorageChange)},onHeightChange(e,t){const i=(Math.ceil(e/21)||8)+2,r=EW(Array.from(this.layoutList),t,i,wW[t]);"wallet-status"===t&&(this.walletRow=i),this.layoutList=r,this.createGridShellList()},onPositionHeightChange(e){this.positionHeight=e},onGridLayouted(e){if(this.isMobileChartMode)return;const t=this.layoutList.map(((t,i)=>({...t,...e[i]})));this.layoutList=t},throttleDepthChartResize:nt((function(e,t){this.depthChartResizeTrigger=`${e}_${t}`}),200),onOrderBookResized(e){this.orderBookHeight=e},onMarketInfoResized(e,t){this.marketInfoWidth=t},onOrderManagementResized(e,t){this.orderManagementResizeTrigger=`${e}:${t}`},toggleDepthChart(){this.updateUserConfigByKey({key:"depthChart",value:!this.showDepthChart}),this.createGridShellList()},tabsActionUpdate(e){this.actionType=e.value},calculateHeight(e,t,i,r,a){var n;return(null==(n=e[i])?void 0:n.h)||(a?Math.max(r,t[i].h):t[i].h)},adjustOrderFormHeight(e=!1,t){let i=Array.from(this.layoutList),r={};if(e)for(const a of Object.values(Qa))r[a]={h:Math.max(VW[t][a]+(this.enableOrderFormTpSl?8:0),this.notToggledOrderFormLayout[a].h)};else r=this.notToggledOrderFormLayout;FW(i,r,"futures-order"),this.layoutList=i,this.createGridShellList()},handlePriceProtectionMessage(e,t){const i=t||this.apiResponseExtraData,r=e===hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE?this.$t("t.canceled"):this.$t("t.rejected"),a={[hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE]:()=>this.$t("futuresMain.notification.priceProtection.orderPrice.outsideAllowedRange",{side:i[0],currency:i[1],state:i[2],price:i[3],quote:i[4]}),[hn.ORDER_PRICE_TWAP_ARGS_OUTSIDE_ALLOWED_RANGE]:()=>this.$t("futuresMain.notification.priceProtection.orderPrice.twapArgsOutsideAllowedRange",{ratio:i[0]}),[hn.ORDER_PRICE_TRIGGER_ARGS_OUTSIDE_ALLOWED_RANGE]:()=>this.$t("futuresMain.notification.priceProtection.orderPrice.triggerArgsOutsideAllowedRange",{ratio:i[0]})}[e]();
1this.messageCustom({title:`${this.$t("t.order")} ${r}`,body:a,error:!0})},createGridShellList(){this.$nextTick((()=>{const e={x:0,y:0,w:0,h:0};let t=Array.from(this.layoutList);t=EW(t,"open-position",(Math.ceil(this.positionHeight/21)||3)+2,wW["open-position"]),this.isMobileChartMode&&(t=t.map((t=>{const i={...t.layout};return i[Qa.XXTRA_SMALL]=t.isMobileChartMode||e,{...t,layout:i}}))),this.isMobile&&FW(t,{[Qa.XXTRA_SMALL]:{h:this.showDepthChart?10:2}},this.depthChartGridId),this.gridShellList=t}))},hideUnifiedWalletUpgradeNotification(){this.showUpgradeNotification=!1}}};const qW=$n(WW,[["render",function(e,t,i,r,u,p){const m=a("FullKycNotification"),f=a("UnifiedWalletUpgradeNotification"),v=a("LeaderSwitcher"),y=a("MarketBar"),b=a("OrderBookRecentTradesCard"),S=a("FuturesOrder"),C=a("FundingCard"),P=a("ContractDetail"),k=a("WalletStatusCard"),T=a("TradingViewCard"),M=a("RecentTradesCard"),L=a("DepthChartCard"),w=a("OrderManagement"),D=a("MarketInfoCard"),I=a("GridShell"),x=a("NewEditRiskLimitDialog"),_=a("LeverageDialog");return o(),c(g,null,[d(m,{class:"full-kyc-notification"}),l("div",O({class:["trade-container tabular-nums",{"chart-fullscreen":e.isTradingViewFullScreen}]},e.$attrs),[p.showUpgradeUnifiedWalletNotification?(o(),n(f,{key:0,onHideNotification:p.hideUnifiedWalletUpgradeNotification},null,8,["onHideNotification"])):h("",!0),e.isLargeSize&&e.accountInfo.isLeader&&u.isLeaderUiStatus(e.accountInfo.leaderStatus)?(o(),n(v,{key:1})):h("",!0),e.isLargeSize?(o(),n(y,{key:2,tradingType:u.TRADING_TYPE.FUTURES},null,8,["tradingType"])):h("",!0),d(I,{itemList:u.gridShellList,dragAllowFrom:".card-shell__header",isDraggable:!e.layoutLocked&&!e.freezeGridLayout&&!e.isMobile,isResizable:!e.layoutLocked&&!e.freezeGridLayout&&!e.isMobile,rowHeight:p.rowHeight,minRowHeight:4,onLayouted:p.onGridLayouted,"onResized:depthChart":p.throttleDepthChartResize,"onResized:orderBook":p.onOrderBookResized,"onResized:marketInfo":p.onMarketInfoResized,"onResized:orderManagement":p.onOrderManagementResized},{default:s((()=>[d(b,{key:"order-book",boxFilled:!0,resizeTrigger:u.orderBookHeight,isEnableRecentTrades:u.enableRecentTrades},null,8,["resizeTrigger","isEnableRecentTrades"]),d(S,{key:"futures-order",boxFilled:!0}),u.disableLinkOnTrading?h("",!0):(o(),n(C,{key:"order-fund",boxFilled:"",isFutures:""})),d(P,{key:"contract-detail","data-grid-id":"contract-detail",class:"contract-detail",boxFilled:"",onHeight:p.onHeightChange},null,8,["onHeight"]),d(k,{key:"wallet-status",ref:"walletStatus",class:"wallet-status",boxFilled:!0,onHeight:p.onHeightChange},null,8,["onHeight"]),d(T,{key:"trading-view",isFutures:"","data-grid-id":"trading-view",boxFilled:!0}),d(M,{key:"recent-trade","data-grid-id":"recent-trade",class:"recent-trades",boxFilled:!0}),d(L,{key:"depth-card","data-grid-id":p.depthChartGridId,class:"depth-chart",showHeader:e.isMobile,resizeTrigger:u.depthChartResizeTrigger,boxFilled:!0,showDepthChart:e.showDepthChart,toggleDepthChart:p.toggleDepthChart},null,8,["data-grid-id","showHeader","resizeTrigger","showDepthChart","toggleDepthChart"]),d(w,{key:"order-management",class:"order-management",boxFilled:!0,resizeTrigger:u.orderManagementResizeTrigger,onHeight:p.onPositionHeightChange},null,8,["resizeTrigger","onHeight"]),d(D,{key:"market-info","data-grid-id":"market-info",class:"market-info",boxFilled:!0,resizeTrigger:u.marketInfoWidth},null,8,["resizeTrigger"])])),_:1},8,["itemList","isDraggable","isResizable","rowHeight","onLayouted","onResized:depthChart","onResized:orderBook","onResized:marketInfo","onResized:orderManagement"]),u.showEditRiskLimitPopup?(o(),n(x,{key:3,visible:u.showEditRiskLimitPopup,"onUpdate:visible":t[0]||(t[0]=e=>u.showEditRiskLimitPopup=e),recommend:e.riskLimitPopupTarget,isShowError:u.isShowRiskLimitError,symbol:u.riskLimitPopupSymbol},null,8,["visible","recommend","isShowError","symbol"])):h("",!0),d(_)],16)],64)}],["__scopeId","data-v-14c306af"]]),GW=Object.freeze(Object.defineProperty({__proto__:null,default:qW},Symbol.toStringTag,{value:"Module"})),KW={SPOT:"SPOT",DCA:"TRADINGBOT_DCA"},QW="SPOT_TRADINGBOT_TAB_READ_",jW={name:"SpotTradeTypeTabList",props:{modelValue:{type:String,default:KW.SPOT}},emits:["update:modelValue"],data:()=>({SPOT_TRADE_TYPES:KW,viewed:{[KW.SPOT]:!0,[KW.DCA]:!1}}),computed:{...y(qe,["marketSymbol"]),tabs(){return[{key:KW.SPOT,text:this.$t("t.spot"),isViewed:!0},{key:KW.DCA,text:this.$t("trading.bot.DCA"),isViewed:!1}]}},watch:{marketSymbol(){this.handleClick(KW.SPOT)},tabs:{immediate:!0,handler(e){e.forEach((e=>
1{this.getIsNew(e.key)}))}}},methods:{async handleClick(e){this.$emit("update:modelValue",e);if(await this.getIsNew(e)){Bi($i[QW+e])}},getIsNew(e){const t=zi(QW+e);return t&&(this.viewed[e]=!0),!t}}},YW={class:"tabs-wrapper"},ZW=["onClick"];const XW=$n(jW,[["render",function(e,t,i,r,a,n){return o(),c("div",YW,[(o(!0),c(g,null,R(n.tabs,(e=>(o(),c("div",{key:e.key,class:C(["tab",{active:i.modelValue===e.key,isNew:!a.viewed[e.key]}]),onClick:t=>n.handleClick(e.key)},m(e.text),11,ZW)))),128))])}],["__scopeId","data-v-39f172c1"]]),JW={class:"brand-card-header spot-order-type-list"},eq=$n(A({__name:"SpotOrderTypeTabList",props:{actionData:{},selected:{},update:{type:Function}},setup:e=>(e,t)=>(o(),c("div",JW,[l("div",{class:C(["spot-order-type-tab buy",{selected:e.selected===e.actionData[0].value}]),onClick:t[0]||(t[0]=t=>e.update(e.actionData[0]))},m(e.$t(e.actionData[0].lang)),3),l("div",{class:C(["spot-order-type-tab sell",{selected:e.selected===e.actionData[1].value}]),onClick:t[1]||(t[1]=t=>e.update(e.actionData[1]))},m(e.$t(e.actionData[1].lang)),3)]))}),[["__scopeId","data-v-a06210ba"]]),tq={data:()=>({mixinLock:!1}),computed:{orderData(){return{price:Number(this.ruleForm.price)||0,size:Number(this.ruleForm.size)||0}},isSmallPriceFont(){return!this.isMobile&&Number(this.exchangeInfo.minPriceIncrement)<1e-7}},watch:{"ruleForm.type"(e){"0"===e?this.ruleForm.triggerPrice="":this.ruleForm.time_in_force&&(this.ruleForm.time_in_force="GTC")}},methods:{minSize(e){return"price"===e?this.exchangeInfo.minValidPrice:this.exchangeInfo.minOrderSize},computedIncrement(e,t){const i="price"===e?this.exchangeInfo.minPriceIncrement:this.exchangeInfo.minSizeIncrement,r="price"===e?this.exchangeInfo.priceDecimal:this.exchangeInfo.sizeDecimal;if(t>i){let e=1;for(let t=0;t<r;t++)e*=10;e<1&&(e=1);const a=i*e*Math.floor(t*e/(i*e))/e;let n=t.toString().split(".")[1];return n=n&&n.length||0,a.toFixed(n<r?n:r)}return t},keyupDown(e){""===this.ruleForm[e]&&38===event.keyCode&&(this.mixinLock=!0)},isZero(e,t){const i=this.ruleForm[e];this.$nextTick((()=>{this.mixinLock?(this.mixinLock=!1,this.ruleForm[e]=Sn(this.minSize(t))):i&&(this.ruleForm[e]=Sn(i))}))},stpTitleSet(e){return{[ni.LIMIT_STOP]:this.$t("trading.stop-take-profit.stopPrice"),[ni.LIMIT_TAKE_PROFIT]:this.$t("trading.stop-take-profit.triggerPrice")}[e]}}},iq={price:"",size:"",trailValue:"",trailValueType:Xi.DISTANCE,triggerPrice:"",percent:0,triggerPriceType:is,activationPrice:"",activationPriceType:is},rq={setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},data:()=>({ruleForm:{...iq},needConfirmEstimateValue:!1,isSizeUnderMin:!1,isTotalUnderMin:!1}),computed:{...b({fiatCurrencyList:"fiatCurrencyList"}),...b("orderBook",["lastPrice"]),...y(Nn,["orderBook","bestAskPrice"]),...y(ts,["rememberSpotOrderSize"]),...y(dt,{spotIndexPrice:"currentMarketIndexPrice"}),...y(Wd,["tradingViewWidgetInstance"]),...y(qe,["exchangeInfo","marketSymbol","marketCurrency","marketQuoteCurrency","marketCurrencyData","marketQuoteCurrencyData","getMarketSymbolFromBaseCurrency","getBalanceByOrderAction"]),isMarketAction(){return this.infoStp===ni.MARKET},isStopAction(){return this.infoStp===ni.MARKET_STOP},isTakeProfitAction(){return this.infoStp===ni.MARKET_TAKE_PROFIT},isTrailingStopAction(){return this.infoStp===ni.MARKET_TRAILING_STOP},showAmountQuick(){return this.isBuyAction&&this.isMarketAction||!this.isBuyAction&&this.isMarketAction},showTriggerPrice(){return this.isStopAction||this.isTakeProfitAction},showTrailValue(){return this.isTrailingStopAction},balance(){return this.getBalanceByOrderAction(this.isBuyAction?"buy":"sell")},balanceCurrency(){return this.isBuyAction?this.marketQuoteCurrencyData:this.marketCurrencyData},priceFilter(){return this.exchangeInfo.priceDecimal},tradingKey(){return this.isBuyAction?"price":"size"},isSmallStep(){return!this.isMobile&&this.tradingKeyInfo.step<1e-7},tradingKeyInfo(){return{title:this.$t(this.isBuyAction?"trading.buySell.totalPrice":"t.size"),step:this.isBuyAction?this.exchangeInfo.minPriceIncrement:this.exchangeInfo.minSizeIncrement,min:this.isBuyAction?this.exchangeInfo.minValidPrice:this.exchangeInfo.minOrderSize,currency:this.balanceCurrency.displayName}},tradingPriceInfo(){return{title:this.$t(this.isBuyAction?"trading.buySell.totalPrice":"trading.buySell.estTotal"),step:this.exchangeInfo.minPriceIncrement,min:this.exchangeInfo.minValidPrice,currency:this.marketQuoteCurrencyData.displayName}},tradingSizeInfo(){return{title:this.isBuyAction?this.$t("trading.buySell.estSize"):this.$t("t.size"),step:this.exchangeInfo.minSizeIncrement,min:this.exchangeInfo.minOrderSize,currency:this.marketCurrencyData.displayName}},triggerPriceInfo(){return{title:this.$t("trading.stop-take-profit.triggerPrice"),step:this.exchangeInfo.minPriceIncrement,min:this.exchangeInfo.minValidPrice,currency:this.marketQuoteCurrencyData.displayName}},isTrailValuePercent(){return this.ruleForm.trailValueType===Xi.PERCENTAGE},trailValueStep(){return this.isTrailValuePercent?.01:Number(this.exchangeInfo.minPriceIncrement)},trailValueMin(){return this.isTrailValuePercent?.1:Number(this.exchangeInfo.minValidPrice)},trailValueMax(){return this.isTrailValuePercent?99:1/0},trailValuePlaceholder(){return this.isTrailValuePercent?"0.1-99":this.exchangeInfo.minValidPrice},trailingStopTriggerPrice(){return GA({basePrice:this.trailingStopBasePrice,trailValue:Number(this.ruleForm.trailValue)||0,type:this.ruleForm.trailValueType,isBuy:this.isBuyAction,priceDecimal:this.exchangeInfo.priceDecimal})},trailingStopTriggerPriceInfo(){return{title:this.$t("trading.stop-take-profit.stopPrice"),numeral:this.$filters.formatNumber(this.trailingStopTriggerPrice,this.priceFilter),comparison:this.isBuyAction?"â¥":"â¤",currency:this.marketQuoteCurrencyData.displayName}},side(){return this.isBuyAction?"BUY":"SELL"},txType(){return this.isStopAction||this.isTrailingStopAction?"STOP":this.isTakeProfitAction?"TRIGGER":"LIMIT"},indexPrice(){return this.spotIndexPrice},normalEstimateTotal(){if(this.isBuyAction)return this.needConfirmEstimateValue=!1,this.indexPrice>0?S(this.orderData.price).div(this.indexPrice).toNumber():0;const{size:e}=this.orderData,t=this.orderBook.bids||[],i=t.findIndex((t=>t.total>=e));if(-1===i)return this.needConfirmEstimateValue=!0,this.indexPrice>0?S(this.indexPrice).times(this.orderData.size).toNumber():0;if(this.needConfirmEstimateValue=!1,0===i)return S(e).times(t[0].price).toNumber();const r=i-1,a=t.slice(0,i).reduce(((e,t)=>S(t.size).times(t.price).plus(e)),0),n=S(e).minus(t[r].total).times(t[i].price),o=a.plus(n);return Number(o)},trailingStopEstimateTotal(){const e=Number(this.ruleForm[this.tradingKey])||0;return isNaN(e)||this.indexPrice<=0?0:this.isBuyAction?S(e).div(this.indexPrice).toNumber():S(this.indexPrice).times(e).toNumber()},estimateTotalNumeral(){return this.isTrailingStopAction?this.$filters.formatNumber(this.trailingStopEstimateTotal,this.estimateTotalFilter):this.$filters.formatNumber(this.normalEstimateTotal,this.estimateTotalFilter)},estimateTotalCurrency(){return this.isBuyAction?this.marketCurrencyData.displayName:this.marketQuoteCurrencyData.displayName},estimateTotalTitle(){if(this.isTrailingStopAction)return this.$t("futuresMain.trade.estimateTotal");{const e=" â";return this.isBuyAction?this.$t("trading.buySell.estAmount")+e:this.$t("trading.buySell.estTotal")+e}},estimateTotalFilter(){return this.isBuyAction?this.exchangeInfo.sizeDecimal
1:this.exchangeInfo.priceDecimal},submitText(){return this.isBuyAction?this.$t("trading.buySell.button.buy"):this.$t("trading.buySell.button.sell")},isFormValid(){const e=this.ruleForm[this.tradingKey];if(this.isPositive(this.balance)&&this.isPositive(e)&&e<=this.balance&&e>=this.tradingKeyInfo.min){const{triggerPrice:e,trailValue:t}=this.ruleForm;if(this.isMarketAction)return!0;if((this.isStopAction||this.isTakeProfitAction)&&this.isPositive(e)&&e>=this.triggerPriceInfo.min)return!0;if(this.isTrailingStopAction&&this.isPositive(t)&&""!==t)return this.ruleForm.trailValueType===Xi.PERCENTAGE?t<=99:t>=Number(this.exchangeInfo.minValidPrice)}return!1},minTotal(){if(void 0===this.exchangeInfo.minOrderSize)return 0;const e=S.ROUND_UP,t=Number(S(this.exchangeInfo.minOrderSize).times(this.indexPrice).toFixed(this.exchangeInfo.priceDecimal,e)),i=Number(this.exchangeInfo.minValidPrice);return t>i?t:i},sizeUnderMinText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketCurrencyData.shortName));return this.$t("trading.buySell.minOrderQuantity",{value:`${this.exchangeInfo.minOrderSize} ${e}`})},totalUnderMinText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketQuoteCurrencyData.shortName));return this.$t("trading.buySell.minOrderQuantity",{value:`${this.minTotal} ${e}`})},isActivationPriceEnabled(){return this.isTrailingStopAction&&this.activationPriceChecked&&this.ruleForm.activationPrice},isActivationPriceEmpty(){return this.isTrailingStopAction&&this.activationPriceChecked&&""===this.ruleForm.activationPrice},roundedLastPrice(){return S(this.lastPrice).dp(this.exchangeInfo.priceDecimal,S.ROUND_DOWN).toNumber()},trailingStopBasePrice(){return this.isActivationPriceEnabled?this.ruleForm.activationPrice:this.ruleForm.triggerPriceType===_r.LAST_PRICE?this.roundedLastPrice:this.indexPrice},trailingStopPriceForCalculation(){return this.isActivationPriceEnabled?this.trailingStopTriggerPrice:zt.enableLastPriceDependentUI?this.roundedLastPrice:this.trailingStopBasePrice}},watch:{marketSymbol(){this.resetRuleForm()}},methods:{resetRuleForm(){this.ruleForm={...iq}},resetFormAfterSubmit(){this.rememberSpotOrderSize||(this.ruleForm.price="",this.ruleForm.size="",this.ruleForm.activationPrice="")},acceptedRuleForm(){const e=[this.tradingKey,"triggerPriceType"];return this.isStopAction||this.isTakeProfitAction?e.push("triggerPrice"):this.isTrailingStopAction&&(e.push("trailValue"),e.push("trailValueType"),this.isActivationPriceEnabled&&(e.push("activationPrice"),e.push("activationPriceType"))),this.ruleForm.price=S(this.ruleForm.price).div(this.exchangeInfo.minPriceIncrement).integerValue().times(this.exchangeInfo.minPriceIncrement).toNumber(),e.reduce(((e,t)=>(e[t]="trailValue"===t?this.ruleForm.trailValueType===Xi.DISTANCE?this.ruleForm.trailValue:S(this.ruleForm.trailValue).div(100).toNumber():this.ruleForm[t],e)),{})},requestData(){return{side:this.side,type:"MARKET",txType:this.txType,symbol:this.marketSymbol,infoStp:this.infoStp,...this.acceptedRuleForm()}},submitOrder(){const e=this.requestData();return new Promise((t=>{const i=this.isBuyAction?S(this.orderData.price).times(this.marketQuoteCurrencyData.usdRate).toNumber():S(this.normalEstimateTotal).times(this.marketQuoteCurrencyData.usdRate).toNumber();Jt.submitOrder(e,i).then((()=>{this.resetFormAfterSubmit(),this.$sendEvent(Kr.EVENT_WEB_TRADING_SPOT_ORDER_FORM_SUBMITTED,{submitSuccess:!0,submitData:e,tradingViewWidgetInstance:this.tradingViewWidgetInstance,errorCode:null}),t(!0)})).catch((i=>{this.$sendEvent(Kr.EVENT_WEB_TRADING_SPOT_ORDER_FORM_SUBMITTED,{submitSuccess:!1,submitData:e,tradingViewWidgetInstance:this.tradingViewWidgetInstance,errorCode:i}),t(!1)}))}))},handleQuick(e){let t=this.balance*(e/100);if(this.isBuyAction){t-=t%this.exchangeInfo.minPriceIncrement;const e=this.exchangeInfo.priceDecimal,i=this.$filters.formatNumber(t,e);this.ruleForm.price=(null==i?void 0:i.replace(/,/g,""))||0,this.selectedPrice=this.ruleForm.price,this.autoSize(this.ruleForm.price)}else{t-=t%this.exchangeInfo.minSizeIncrement;const e=this.exchangeInfo.sizeDecimal,i=this.$filters.formatNumber(t,e);this.ruleForm.size=(null==i?void 0:i.replace(/,/g,""))||0,this.selectedSize=this.ruleForm.size,this.autoTotal(this.ruleForm.size)}},isPositive:e=>e&&Number(e)>0,autoTotal(e){if(this.isTotalUnderMin=!1,""!==e&&e<this.exchangeInfo.minOrderSize?this.isSizeUnderMin=!0:this.isSizeUnderMin=!1,!e)return void(this.ruleForm.price="");this.needConfirmEstimateValue=!1;const t=this.isBuyAction?S.ROUND_UP:S.ROUND_DOWN;if(this.isTrailingStopAction){const i=this.trailingStopPriceForCalculation;return void(this.ruleForm.price=i>0?Number(S(i).times(e).toFixed(this.exchangeInfo.priceDecimal,t)):0)}if(this.isStopAction||this.isTakeProfitAction){if(!this.ruleForm.triggerPrice)return;return void(this.ruleForm.price=Number(S(this.ruleForm.triggerPrice).times(e).toFixed(this.exchangeInfo.priceDecimal,t)))}if(this.isBuyAction){const i=this.bestAskPrice||0;return void(this.ruleForm.price=i>0?Number(S(i).times(e).toFixed(this.exchangeInfo.priceDecimal,t)):0)}const i=this.orderBook.bids||[],r=i?i.findIndex((t=>t.total>=e)):-1;if(-1===r)return this.isBuyAction||(this.needConfirmEstimateValue=!0),void(this.ruleForm.price=this.indexPrice>0?Number(S(this.indexPrice).times(e).toFixed(this.exchangeInfo.priceDecimal,t)):0);if(0===r)return void(this.ruleForm.price=Number(S(e).times(i[0].price).toFixed(this.exchangeInfo.priceDecimal,t)));const a=r-1,n=i.slice(0,r).reduce(((e,t)=>S(t.size).times(t.price).plus(e)),0),o=S(e).minus(i[a].total).times(i[r].price),s=n.plus(o);this.ruleForm.price=Number(s.toFixed(this.exchangeInfo.priceDecimal,t))},autoSize(e){if(this.isSizeUnderMin=!1,""!==e&&e<this.minTotal?this.isTotalUnderMin=!0:this.isTotalUnderMin=!1,!e)return void(this.ruleForm.size="");const t=S.ROUND_DOWN;if(this.needConfirmEstimateValue=!1,this.isTrailingStopAction){const i=this.trailingStopPriceForCalculation;this.ruleForm.size=i>0?Number(S(e).div(i).toFixed(this.exchangeInfo.sizeDecimal,t)):0}else if(this.isStopAction||this.isTakeProfitAction){if(!this.ruleForm.triggerPrice)return;this.ruleForm.size=Number(S(e).div(this.ruleForm.triggerPrice).toFixed(this.exchangeInfo.sizeDecimal,t))}else if(this.isBuyAction){const i=this.bestAskPrice||0;this.ruleForm.size=i>0?Number(S(e).div(i).toFixed(this.exchangeInfo.sizeDecimal,t)):0}else{const i=this.orderBook.bids||[];let r=0,a=-1;for(let t=0;t<i.length;t++){const{price:n,size:o}=i[t];if(r+=n*o,r>=e){a=t;break}}if(-1===a)return this.needConfirmEstimateValue=!0,void(this.ruleForm.size=this.indexPrice>0?Number(S(e).div(this.indexPrice).toFixed(this.exchangeInfo.sizeDecimal,t)):0);if(0===a)return void(this.ruleForm.size=Number(S(e).div(i[0].price).toFixed(this.exchangeInfo.sizeDecimal,t)));let n=S(0),o=0;for(let t=0;t<i.length;t++){const r=S(i[t].price).times(i[t].size);if(n+r>=e){o=t;break}n=n.plus(r)}const s=S(e).minus(n).div(i[o].price);this.ruleForm.size=Number(s.plus(i[o-1].total).toFixed(this.exchangeInfo.sizeDecimal,t))}},autoPercent(){const e=this.isBuyAction?this.ruleForm.price:this.ruleForm.size;try{if(!e)return void(this.ruleForm.percent=0);const t=S(e).div(this.balance).times(100).dp(0,S.ROUND_HALF_UP).toNumber();Number.isNaN(t)||(this.ruleForm.percent=t>100?100:t)}catch(t){this.ruleForm.percent=0}}}},{disableLinkOnTrading:aq,enableWalletSpot:nq,enableWalletFutures:oq}=mt,sq={name:"SpotOrderFormBalance",components:{TransferIconWithTooltip:Xd},props:{type:{type:String,default:"buy"}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},computed:{...b(["loginState"]),...U(["isUnifiedWallet"]),...y(qe,{marketCurrencyData:"marketCurrencyData",marketQuoteCurrencyData:"marketQuoteCurrencyData",getMarketSymbolFromBaseCurrency:"getMarketSymbolFromBaseCurrency",getBalanceByOrderAction:"getBalanceByOrderAction"}),...y(qe,{spotExchangeInfo:"exchangeInfo"}),isBuy(){return"buy"===this.type},isShowTransfer(){return!aq&&nq&&oq&&this.loginState},typeClass(){return this.isBuy?"_buy":"_sell"},balanceCurrency(){const e=this.isBuy?this.marketQuoteCurrencyData:this.marketCurrencyData;return(null==e?void 0:e.shortName)||""},displayName(){const e=this.isBuy?this.marketQuoteCurrencyData.displayName:this.getMarketSymbolFromBaseCurrency(this.balanceCurrency);return this.convertToDisplaySymbol(e)},balance(){const e=this.getBalanceByOrderAction(this.type),{priceDecimal:t,sizeDecimal
1:i}=this.spotExchangeInfo,r=this.isBuy?t:i;return this.$filters.formatNumber(e,{formatKey:r,currency:this.balanceCurrency})}},methods:{...f(Vn,["toggleTransferPopup"]),openWalletTransferPopup(){this.toggleTransferPopup({from:this.isUnifiedWallet?ti:xi,to:ii,showTopUpOptions:!0,currency:this.balanceCurrency})}}},lq={class:"trading__balance"},uq={class:"_fl"},cq={class:"_available"},dq={class:"available__amount"},pq={class:"currency-short-name"};const hq=$n(sq,[["render",function(e,t,i,r,s,u){const d=a("TransferIconWithTooltip");return o(),c("div",lq,[l("div",{class:C(["_bs",u.typeClass])},[l("p",uq,m(e.$t("trading.buySell.balance")),1),l("div",cq,[l("p",dq,[l("span",null,m(u.balance),1)]),l("span",pq,m(u.displayName),1)]),u.isShowTransfer?(o(),n(d,{key:0,class:"transfer-entry",onTransferClick:u.openWalletTransferPopup},null,8,["onTransferClick"])):h("",!0)],2)])}],["__scopeId","data-v-67bb993a"]]),mq={class:"actions"},gq={class:"action"},fq={class:"action"};const vq=$n({name:"ConfirmOrderDialog",components:{BrandDialog:pi,FuturesButton:hD},props:{header:{type:String,required:!0},body:{type:String,required:!0},closeDialog:Function,submit:Function}},[["render",function(e,t,i,r,u,c){const h=a("FuturesButton"),g=a("BrandDialog");return o(),n(g,{width:"412px",idPrefix:"trading_confirm_order_dialog",onClosed:i.closeDialog},{header:s((()=>[p(m(i.header),1)])),body:s((()=>[p(m(i.body),1)])),footer:s((()=>[l("div",mq,[l("div",gq,[d(h,{cancel:!0,handleClick:i.closeDialog},{default:s((()=>[p(m(e.$t("msg.cancel")),1)])),_:1},8,["handleClick"])]),l("div",fq,[d(h,{confirm:!0,handleClick:i.submit},{default:s((()=>[p(m(e.$t("futuresMain.orderPlacement.execute")),1)])),_:1},8,["handleClick"])])])])),_:1},8,["onClosed"])}],["__scopeId","data-v-b39599bf"]]);const yq=$n({name:"EstimatedSymbol",props:{inSymbol:{type:String,default:""},toSymbol:{type:String,default:""}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},computed:{...y(qe,["getMarketSymbolFromBaseCurrency"])}},[["render",function(e,t,i,r,u,c){const d=a("Tooltip");return o(),n(d,{class:"tooltip-wrap",content:"â"},{tooltip:s((()=>[l("p",null,m(e.$t("trading.buySell.convertValue",{in:r.convertToDisplaySymbol(e.getMarketSymbolFromBaseCurrency(i.inSymbol)),to:r.convertToDisplaySymbol(e.getMarketSymbolFromBaseCurrency(i.toSymbol))})),1)])),_:1})}],["__scopeId","data-v-bbcb939d"]]),bq={name:"EstimatedHintBlock",props:{storageKey:{type:String,required:!0},inSymbol:{type:String,default:""},toSymbol:{type:String,default:""}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},data:()=>({show:!1}),computed:{...y(qe,["getMarketSymbolFromBaseCurrency"])},watch:{storageKey(e){this.show=!zi($i[e]),Bi($i[e])}},created(){this.show=!zi($i[this.storageKey])},mounted(){Bi(this.storageKey)}},Sq={key:0,class:"total-hint"};const Cq=$n(bq,[["render",function(e,t,i,r,a,n){return a.show?(o(),c("div",Sq,m(e.$t("trading.buySell.convertValue",{in:r.convertToDisplaySymbol(e.getMarketSymbolFromBaseCurrency(i.inSymbol)),to:r.convertToDisplaySymbol(e.getMarketSymbolFromBaseCurrency(i.toSymbol))})),1)):h("",!0)}],["__scopeId","data-v-5269b249"]]),Pq=$n({__name:"SpotTriggerTypeSelect",props:{value:{type:String,default:is}},emits:["update:value"],setup(e,{emit:t}){const{enableLastPriceDependentUI:i}=zt,r=t,a=ts(),s=M((()=>[{id:_r.INDEX_PRICE,lang:"futuresMain.trade.index",fullName:"futuresMain.trade.indexPrice",isI18nKey:!0},...i?[{id:_r.LAST_PRICE,lang:"trading.last",fullName:"spot.order.market.lastPrice",isI18nKey:!0}]:[]]));D((()=>a.orderFormSettings),(({triggerOn:e})=>{r("update:value",e)})),L((()=>{r("update:value",a.orderFormSettings.triggerOn)}));const l=ea((async e=>{await a.updateOrderFormSettings({triggerOn:e})}),500);return(e,t)=>(o(),n(x(om),{class:"size-type",items:s.value,form:x(a).orderFormSettings.triggerOn,"onUpdate:form":x(l)},null,8,["items","form","onUpdate:form"]))}},[["__scopeId","data-v-13cfc58a"]]),{brandToken:kq}=mt;let Tq;const Mq={name:"OrderMarket",components:{Balance:hq,TradeSlider:po,ConfirmOrderDialog:vq,EstimatedSymbol:yq,EstimatedHintBlock:Cq,SpotTriggerTypeSelect:Pq,TradingInput:Wn,MarketHintTooltip:qc,ActivationPriceCheckbox:BT,ActivationPriceInput:NT,TrailingStopDistancePercentageInput:FT},props:{isBuyAction:{type:Boolean,required:!0},infoStp:{type:String,required:!0}},setup(){const{convertToDisplaySymbol:e}=Je(),{showIdVerificationRequiredDialog:t}=hs();return{convertToDisplaySymbol:e,showIdVerificationRequiredDialog:t,generateTriggerPriceTooltip:CI,SPOT_TRIGGER_PRICE_TYPE:_r,TRADING_TYPES:ni}},data:()=>({...tq.data(),...rq.data(),selectedPrice:0,selectedSize:0,discountLockupValue:.4,loading:!1,isAuto:!0,i18nFormat:{br:"\n"},showDialog:!1,lastInputParam:""}),computed:{...tq.computed,...rq.computed,...b(["loginState"]),...y(ts,["orderFormSettings"]),...y(qe,["marketData","marketQuoteCurrency"]),displayMarketName(){return this.convertToDisplaySymbol(this.marketData.symbol)},estimatedHintKey(){return $i[`TRADING_ESTIMATED_HINT_${this.infoStp}`]},tradingKeyTabindex(){return this.isBuyAction?"1":"3"},triggerPriceTabindex(){return this.isBuyAction?"2":"4"},estimateTotalTooltip(){return this.isTrailingStopAction||this.isBuyAction?this.$t("trading.buySell.estAmountTooltip"):this.$t("trading.buySell.estSellAmountTooltip")},submitButtonType(){return this.isBuyAction?"success":"danger"},submitDisabled(){return!!(this.isSizeUnderMin||this.isTotalUnderMin||this.isTriggerPriceError||this.isActivationPriceEmpty)||!this.isFormValid},convertedCurrency(){return this.isBuyAction?this.tradingSizeInfo.currency:this.tradingPriceInfo.currency},targetCurrency(){return this.isBuyAction?this.tradingPriceInfo.currency:this.tradingSizeInfo.currency},isTriggerPriceError(){const{triggerPrice:e}=this.ruleForm;return!!e&&(this.isStopAction?this.isBuyAction?e<this.lastPrice:e>this.lastPrice:!!this.isTakeProfitAction&&(this.isBuyAction?e>this.lastPrice:e<this.lastPrice))},triggerPriceErrorText(){const e=this.orderFormSettings.triggerOn===_r.INDEX_PRICE,t=e?this.$t("trading.buySell.triggerPrice.hint.higherIndex"):this.$t("trading.buySell.triggerPrice.hint.higher"),i=e?this.$t("trading.buySell.triggerPrice.hint.lowerIndex"):this.$t("trading.buySell.triggerPrice.hint.lower");return this.isStopAction?this.isBuyAction?t:i:this.isTakeProfitAction?this.isBuyAction?i:t:""},triggerPriceTooltip(){const e=this.isStopAction?"stop":"takeProfit",t=this.orderFormSettings.triggerOn;return this.generateTriggerPriceTooltip({orderType:e,priceType:t,$t:this.$t})},orderDescriptionKey(){return this.isStopAction||this.isTakeProfitAction?"trading.order.description.order":""},activationPriceChecked(){return this.orderFormSettings.enableActivationPrice},activationPriceType(){return this.orderFormSettings.activationPriceTriggerOn}},watch:{...tq.watch,...rq.watch,marketCurrency(e){this.isBuyAction&&(this.ruleForm.price="",this.isAuto=!0,e!==kq&&this.inputFocus())},"ruleForm.price":{handler:function(){this.loginState&&this.autoPercent()}},isBuyAction(){"size"===this.lastInputParam?this.autoTotal(this.ruleForm.size):this.autoSize(this.ruleForm.price)},lastInputParam(e){clearInterval(Tq),Tq=setInterval((()=>{"size"===e?this.autoTotal(this.ruleForm.size):this.autoSize(this.ruleForm.price)}),3e3)},infoStp(){this.lastInputParam&&("size"===this.lastInputParam?this.autoTotal(this.ruleForm.size):this.autoSize(this.ruleForm.price))},"orderFormSettings.activationPriceTriggerOn":{handler(e){this.ruleForm.activationPriceType=e},immediate:!0}},mounted(){this.isBuyAction&&this.inputFocus()},beforeUnmount(){clearInterval(Tq)},methods:{e2eID:Gi,...v("trading",["beforeSpotTradingBehaviorFn"]),...tq.methods,...rq.methods,handleActivationPriceCheckboxChange(e){ts().updateOrderFormSettings({enableActivationPrice:e})},handleActivationPriceTypeChange(e){ts().updateOrderFormSettings({activationPriceTriggerOn:e})}
1,keyupEnter(){!this.submitDisabled&&this.submitForm()},async submitForm(){if(this.showIdVerificationRequiredDialog(Jr.TRADING_SPOT.BUY))return;await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:this.isBuyAction?Zt.CLICK_BUY_ORDER_BTN:Zt.CLICK_SELL_ORDER_BTN})&&(this.submitDisabled||(this.needConfirmEstimateValue?this.showDialog=!0:this.doSubmit()))},doSubmit(){this.closeDialog(),this.loading=!0,this.submitOrder().then((e=>{this.loading=!1,e&&this.inputFocus()}))},inputFocus(){this.$refs.inputFocus&&this.$refs.inputFocus.focus()},closeDialog(){this.showDialog=!1},sizeInputHandler(e){this.lastInputParam="size",this.isBuyAction||(this.ruleForm.size=xa(e,this.exchangeInfo.sizeDecimal)),this.isZero("size","size"),this.autoTotal(this.ruleForm.size)},totalInputHandler(e){this.lastInputParam="total",this.isBuyAction&&(this.ruleForm.price=xa(e,this.exchangeInfo.priceDecimal)),this.isZero("price","price"),this.autoSize(this.ruleForm.price)},triggerPriceInputHandler(e){e?"size"===this.lastInputParam?this.autoTotal(this.ruleForm.size):this.autoSize(this.ruleForm.price):"size"===this.lastInputParam?this.ruleForm.price="":this.ruleForm.size=""}}},Lq={class:"spot-form-container"},wq={class:"top-content"},Dq={class:"pre-line"},Oq={key:0},Iq={key:0},xq={key:1,class:"trailing-stop-trigger-mobile-row"},_q={class:"pre"},Aq={class:"title"},Rq={class:"remark"},Fq={class:"back"},Eq={class:"value"},Bq=["innerHTML"],zq={key:3,class:"activation-wrapper"},$q={class:"darker"},Nq={class:"darker"},Uq={class:"lower darker"},Hq={class:"__form_item"};const Vq=$n(Mq,[["render",function(e,t,i,r,u,f){const v=a("Tooltip"),y=a("SpotTriggerTypeSelect"),b=a("TradingInput"),S=a("TrailingStopDistancePercentageInput"),C=a("EstimatedSymbol"),P=a("MarketHintTooltip"),k=a("TradeSlider"),T=a("ActivationPriceCheckbox"),M=a("ActivationPriceInput"),L=a("i18n-t"),w=a("EstimatedHintBlock"),D=a("balance"),O=a("BrandButton"),I=a("ConfirmOrderDialog");return o(),c("div",Lq,[l("div",wq,[e.showTriggerPrice?(o(),n(b,{key:0,id:f.e2eID("order_trigger_price_input"),value:e.ruleForm.triggerPrice,"onUpdate:value":t[2]||(t[2]=t=>e.ruleForm.triggerPrice=t),label:"triggerPrice",enableThousandSeparator:"",enablePlaceZero:"",hideSpin:"",step:Number(e.triggerPriceInfo.step),min:Number(e.triggerPriceInfo.min),placeholder:e.triggerPriceInfo.min,errorShown:f.isTriggerPriceError,errorContent:f.triggerPriceErrorText,onInput:f.triggerPriceInputHandler},te({prepend:s((()=>[d(v,{class:"_index_title",content:e.triggerPriceInfo.title},{tooltip:s((()=>[l("p",Dq,m(f.triggerPriceTooltip),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(e.triggerPriceInfo.currency)+")",1)])),append:s((()=>[e.isMobile?(o(),c("span",Oq,m(e.triggerPriceInfo.currency),1)):(o(),n(y,{key:1,value:e.ruleForm.triggerPriceType,"onUpdate:value":t[1]||(t[1]=t=>e.ruleForm.triggerPriceType=t)},null,8,["value"]))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(y,{value:e.ruleForm.triggerPriceType,"onUpdate:value":t[0]||(t[0]=t=>e.ruleForm.triggerPriceType=t)},null,8,["value"])])),key:"0"}:void 0]),1032,["id","value","step","min","placeholder","errorShown","errorContent","onInput"])):h("",!0),e.showTrailValue?(o(),c(g,{key:1},[e.isMobile?(o(),c("div",xq,[l("div",_q,[l("div",Aq,m(`${e.trailingStopTriggerPriceInfo.title} ${e.trailingStopTriggerPriceInfo.comparison}`),1),l("div",Rq,"("+m(e.triggerPriceInfo.currency)+")",1)]),l("div",Fq,[l("div",Eq,m(e.trailingStopTriggerPriceInfo.numeral),1),d(y,{value:e.ruleForm.triggerPriceType,"onUpdate:value":t[5]||(t[5]=t=>e.ruleForm.triggerPriceType=t)},null,8,["value"])])])):(o(),n(b,{key:0,id:f.e2eID("order_trail_value_input"),label:"triggerPrice",hideSpin:"",value:e.trailingStopTriggerPriceInfo.numeral,step:Number(e.triggerPriceInfo.step),enablePlaceZero:"",disabled:"",colorWhite:"",bgTransparent:""},te({prepend:s((()=>[p(m(`${e.trailingStopTriggerPriceInfo.title} ${e.trailingStopTriggerPriceInfo.comparison}`),1)])),remark:s((()=>[p("("+m(e.triggerPriceInfo.currency)+")",1)])),append:s((()=>[e.isMobile?(o(),c("span",Iq,m(e.triggerPriceInfo.currency),1)):(o(),n(y,{key:1,value:e.ruleForm.triggerPriceType,"onUpdate:value":t[4]||(t[4]=t=>e.ruleForm.triggerPriceType=t)},null,8,["value"]))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(y,{value:e.ruleForm.triggerPriceType,"onUpdate:value":t[3]||(t[3]=t=>e.ruleForm.triggerPriceType=t)},null,8,["value"])])),key:"0"}:void 0]),1032,["id","value","step"])),d(S,{value:e.ruleForm.trailValue,"onUpdate:value":t[6]||(t[6]=t=>e.ruleForm.trailValue=t),type:e.ruleForm.trailValueType,"onUpdate:type":t[7]||(t[7]=t=>e.ruleForm.trailValueType=t),step:e.trailValueStep,min:e.trailValueMin,max:e.trailValueMax,placeholder:e.trailValuePlaceholder,currency:e.marketQuoteCurrencyData.displayName,priceFilter:e.priceFilter},null,8,["value","type","step","min","max","placeholder","currency","priceFilter"])],64)):h("",!0),d(b,{id:f.e2eID("order_amount_input"),value:e.ruleForm.size,"onUpdate:value":t[8]||(t[8]=t=>
1e.ruleForm.size=t),label:"size",enableThousandSeparator:"",hideSpin:"",step:Number(e.tradingSizeInfo.step),min:Number(e.tradingSizeInfo.min),placeholder:e.tradingSizeInfo.min,errorShown:e.isSizeUnderMin,errorContent:e.sizeUnderMinText,onInput:f.sizeInputHandler},{prepend:s((()=>[d(v,{class:"_index_title",content:e.$t("t.size")},{tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.size_tip",{a:e.exchangeInfo.minOrderSize,b:e.exchangeInfo.maxOrderSize,c:e.exchangeInfo.minSizeIncrement})},null,8,Bq)])),_:1},8,["content"]),B(d(C,{inSymbol:f.convertedCurrency,toSymbol:f.targetCurrency},null,8,["inSymbol","toSymbol"]),[[N,i.isBuyAction]])])),append:s((()=>[d(P,null,{default:s((()=>[p(m(f.displayMarketName),1)])),_:1})])),_:1},8,["id","value","step","min","placeholder","errorShown","errorContent","onInput"]),e.isMarketAction?(o(),n(k,{key:2,value:e.ruleForm.percent,"onUpdate:value":t[9]||(t[9]=t=>e.ruleForm.percent=t),disabled:!e.loginState,onChange:t[10]||(t[10]=t=>e.handleQuick(t))},null,8,["value","disabled"])):h("",!0),d(b,{id:f.e2eID("order_total_input"),value:e.ruleForm.price,"onUpdate:value":t[11]||(t[11]=t=>e.ruleForm.price=t),label:"price",enableThousandSeparator:"",hideSpin:"",step:Number(e.tradingPriceInfo.step),min:Number(e.tradingPriceInfo.min),placeholder:e.minTotal,errorShown:e.isTotalUnderMin,errorContent:e.totalUnderMinText,onInput:f.totalInputHandler},{prepend:s((()=>[d(v,{class:"_index_title total-amount",content:i.isBuyAction?e.$t("trading.buySell.totalPrice"):e.$t("trading.buySell.total")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.buySell.totalPriceTooltip")),1)])),_:1},8,["content"]),B(d(C,{inSymbol:f.convertedCurrency,toSymbol:f.targetCurrency},null,8,["inSymbol","toSymbol"]),[[N,!i.isBuyAction]])])),append:s((()=>[p(m(e.tradingPriceInfo.currency),1)])),_:1},8,["id","value","step","min","placeholder","errorShown","errorContent","onInput"]),i.infoStp===r.TRADING_TYPES.MARKET_TRAILING_STOP?(o(),c("div",zq,[d(T,{value:f.activationPriceChecked,orderType:"history.order.filter.type.trailingStopMarket","onUpdate:value":f.handleActivationPriceCheckboxChange},null,8,["value","onUpdate:value"]),d(M,{checked:f.activationPriceChecked,price:e.ruleForm.activationPrice,step:Number(e.tradingPriceInfo.step),quoteCurrency:e.marketQuoteCurrency,priceType:f.activationPriceType,priceFilter:e.priceFilter,walletType:"spot","onUpdate:price":t[12]||(t[12]=t=>e.ruleForm.activationPrice=Number(t)),"onUpdate:priceType":f.handleActivationPriceTypeChange},null,8,["checked","price","step","quoteCurrency","priceType","priceFilter","onUpdate:priceType"])])):h("",!0),f.submitDisabled||!e.isStopAction&&!e.isTakeProfitAction?h("",!0):(o(),n(L,{key:4,keypath:f.orderDescriptionKey,class:"trade-explanation",tag:"div"},{priceType:s((()=>[l("span",$q,m(e.orderFormSettings.triggerOn===r.SPOT_TRIGGER_PRICE_TYPE.INDEX_PRICE?e.$t("futuresMain.trade.index"):e.$t("trading.last")),1)])),triggerPrice:s((()=>[l("span",null,m(e.$filters.formatNumber(e.ruleForm.triggerPrice,e.exchangeInfo.priceDecimal)),1)])),quote:s((()=>[l("span",null,m(e.triggerPriceInfo.currency),1)])),orderType:s((()=>[l("span",Nq,m(e.$t("trading.marketOrder")),1)])),side:s((()=>[l("span",Uq,m(i.isBuyAction?e.$t("t.buy"):e.$t("t.sell")),1)])),amount:s((()=>[l("span",null,m(i.isBuyAction?e.$filters.formatNumber(e.ruleForm.price,e.exchangeInfo.priceDecimal):e.ruleForm.size),1)])),base:s((()=>[l("span",null,m(i.isBuyAction?e.tradingPriceInfo.currency:e.tradingSizeInfo.currency),1)])),_:1},8,["keypath"])),d(w,{storageKey:f.estimatedHintKey,inSymbol:f.convertedCurrency,toSymbol:f.targetCurrency},null,8,["storageKey","inSymbol","toSymbol"])]),l("div",null,[d(D,{type:i.isBuyAction?"buy":"sell"},null,8,["type"]),l("div",Hq,[d(O,{class:"__btn",size:"mediumFontBig",type:f.submitButtonType,disabled:f.submitDisabled,loading:u.loading,onClick:t[13]||(t[13]=e=>f.submitForm())},{default:s((()=>[p(m(e.submitText),1)])),_:1},8,["type","disabled","loading"])])]),u.showDialog?(o(),n(I,{key:0,header:e.$t("futuresMain.orderPlacement.header"),body:e.$t("order.confirm.estimation"),closeDialog:f.closeDialog,submit:f.doSubmit},null,8,["header","body","closeDialog","submit"])):h("",!0)])}],["__scopeId","data-v-cca8d75e"]]),Wq={__name:"PostOnlyCheckbox",props:{value:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=ts();D((()=>r.orderFormSettings),(({postOnly:e})=>{i("update:value",e)})),L((()=>{i("update:value",r.orderFormSettings.postOnly)}));const l=ea((async e=>{await r.updateOrderFormSettings({postOnly:e})}),500);return(t,i)=>{const r=a("Checkbox");return o(),n(r,{value:e.value,class:"form-checkbox",name:"postOnly",onInput:x(l)},{default:s((()=>[p(m(t.$t("order.post-only")),1)])),_:1},8,["value","onInput"])}}},qq={class:"tif"},Gq=$n({__name:"TifSelector",props:{value:{type:String,default:"GTC"}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=ts();D((()=>r.orderFormSettings),(({timeInForce:e})=>{i("update:value",e)}));const n=M((()=>ga.map((e=>({id:e,isI18nKey:!0,lang:`t.order.timeInForce.${e}`,fullName:`t.order.timeInForce.${e}`})))));L((()=>{i("update:value",r.orderFormSettings.timeInForce)}
1));const u=ea((async e=>{await r.updateOrderFormSettings({timeInForce:e})}),500);return(t,i)=>{const r=a("ToolTip");return o(),c("div",qq,[d(r,{tooltip:t.$t("trading.buySell.timeInForce")},{content:s((()=>i[0]||(i[0]=[l("span",{class:"tif-text"},"TIF",-1)]))),_:1},8,["tooltip"]),d(x(hI),{value:e.value,typeList:n.value,"onUpdate:value":x(u)},null,8,["value","typeList","onUpdate:value"])])}}},[["__scopeId","data-v-000095a6"]]),{brandToken:Kq}=mt,Qq={type:ni.LIMIT,txType:ni.LIMIT,symbol:"",price:"",size:"",stopPrice:"",triggerPrice:"",time_in_force:"GTC",postOnly:!1,percent:0,triggerPriceType:is},jq={name:"OrderLimit",components:{Balance:hq,EstimatedSymbol:yq,EstimatedHintBlock:Cq,SpotTriggerTypeSelect:Pq,TradeSlider:po,TradingInput:Wn,LimitLastPriceBtn:AO,MarketHintTooltip:qc,PostOnlyCheckbox:Wq,FuturesChoose:om,BboButton:xO,TifSelector:Gq},props:{isBuyAction:{type:Boolean,required:!0},infoStp:{type:String,required:!0}},setup(){const{convertToDisplaySymbol:e}=Je(),{showIdVerificationRequiredDialog:t}=hs(),{checkPriceProtection:i}=xI(),r=qe(),{refresh:a,resolve:n,resolveFresh:o,options:s,selectedOption:l,setSelectedType:u}=VI({fetchOrderBook:e=>Jt.getOrderBookL2(e),symbol:()=>r.marketSymbol,rpi:!1,storageKey:He.BBO_SPOT_SELECTION});return{convertToDisplaySymbol:e,checkPriceProtection:i,showIdVerificationRequiredDialog:t,generateTriggerPriceTooltip:CI,SPOT_TRIGGER_PRICE_TYPE:_r,refreshBboOrderBook:a,resolveBbo:n,resolveBboFresh:o,bboOptions:s,bboSelection:l,setBboSelection:u}},data:()=>({...tq.data(),discountLockupValue:.4,bboActive:!1,ruleForm:JSON.parse(JSON.stringify(Qq)),totalValue:"",loading:!1,isAuto:!0,selectedPrice:0,selectedSize:0,i18nFormat:{br:"\n"},isTotalUnderMin:!1,isLastPriceUpdate:!1}),computed:{...tq.computed,...b(["loginState","isTradingCountry","futureOrderBookShortcut"]),...b("orderBook",["lastPrice"]),...y(ts,["rememberSpotOrderSize","orderFormSettings"]),...y(dt,{spotLastPrice:"currentMarketLastPrice",spotIndexPrice:"currentMarketIndexPrice"}),...y(Wd,["tradingViewWidgetInstance"]),...y(qe,["marketSymbol","marketCurrency","marketCurrencyData","marketQuoteCurrencyData","exchangeInfo","marketData","getMarketSymbolFromBaseCurrency","getBalanceByOrderAction"]),displayMarketName(){return this.convertToDisplaySymbol(this.marketData.symbol)},formattedLastPrice(){const e=S(this.spotLastPrice||this.spotIndexPrice||this.lastPrice),t=this.exchangeInfo.minPriceIncrement||1,i=this.isBuyAction?S.ROUND_FLOOR:S.ROUND_CEIL,r=e.div(t).integerValue(i).times(t).toNumber();return xa(r,this.exchangeInfo.priceDecimal)},balance(){return this.getBalanceByOrderAction(this.isBuyAction?"buy":"sell")},estimatedHintKey(){return $i[`TRADING_ESTIMATED_HINT_${this.infoStp}`]},syncOrderBookShortcutTime(){return this.futureOrderBookShortcut.time},isDisableSubmit(){return!!this.isTriggerPriceError||(this.isBuyAction?this.isDisableBuySubmit:this.isDisableSellSubmit)},isDisableBuySubmit(){const e=Number(S(this.orderData.price).times(this.orderData.size)),t=this.ruleForm.triggerPrice;return!e||(!(!this.isSizeOverLimit&&!this.isTotalUnderMin)||!(this.isTradingCountry&&this.balance>0&&e>0&&e<=this.balance&&(this.isLimit||t>0)))},isDisableSellSubmit(){const e=this.ruleForm.price,t=this.ruleForm.size,i=this.ruleForm.triggerPrice;return!this.totalValue||(!(!this.isSizeOverLimit&&!this.isTotalUnderMin)||!(this.isTradingCountry&&this.balance>0&&e>0&&t>0&&t<=this.balance&&(this.isLimit||i>0)))},generateTimeInForceList:()=>ga.map((e=>({id:e,lang:`t.order.timeInForce.${e}`}))),minTotal(){if(void 0===this.exchangeInfo.minOrderSize)return 0;const e=S.ROUND_UP,t=Number(this.ruleForm.price)||0,i=Number(S(this.exchangeInfo.minOrderSize).times(t).toFixed(this.exchangeInfo.priceDecimal,e)),r=Number(this.exchangeInfo.minValidPrice);return i>r?i:r},totalUnderMinText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketQuoteCurrencyData.shortName));return this.$t("trading.buySell.minOrderQuantity",{value:`${this.minTotal} ${e}`})},isLimit(){return this.infoStp===ni.LIMIT},isStop(){return this.infoStp===ni.LIMIT_STOP},isTakeProfit(){return this.infoStp===ni.LIMIT_TAKE_PROFIT},isTriggerPriceError(){const{triggerPrice:e}=this.ruleForm;if(!e)return!1;const t=S(this.lastPrice).dp(this.exchangeInfo.priceDecimal,S.ROUND_DOWN).toNumber();return this.isStop?this.isBuyAction?e<t:e>t:!!this.isTakeProfit&&(this.isBuyAction?e>t:e<t)},triggerPriceErrorText(){const e=this.orderFormSettings.triggerOn===_r.INDEX_PRICE,t=e?this.$t("trading.buySell.triggerPrice.hint.higherIndex"):this.$t("trading.buySell.triggerPrice.hint.higher"),i=e?this.$t("trading.buySell.triggerPrice.hint.lowerIndex"):this.$t("trading.buySell.triggerPrice.hint.lower");return this.isStop?this.isBuyAction?t:i:this.isTakeProfit?this.isBuyAction?i:t:""},triggerPriceTooltip(){const e=this.isStop?"stop":"takeProfit",t=this.orderFormSettings.triggerOn;return this.generateTriggerPriceTooltip({orderType:e,priceType:t,$t:this.$t})},isSizeOverLimit(){const{size:e}=this.ruleForm,{minOrderSize:t,maxOrderSize:i}=this.exchangeInfo;return""!==e&&(e<t||e>i)},sizeOverWarningText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketCurrencyData.short
1Name)),t=this.ruleForm.size<this.exchangeInfo.minOrderSize?"trading.buySell.minOrderQuantity":"trading.buySell.maxOrderQuantity",i=this.ruleForm.size<this.exchangeInfo.minOrderSize?this.exchangeInfo.minOrderSize:this.exchangeInfo.maxOrderSize;return this.$t(t,{value:`${i} ${e}`})},orderDescriptionKey(){return this.isStop||this.isTakeProfit?"trading.order.description.order":""}},watch:{...tq.watch,formattedLastPrice(e){Number(e)&&!this.isLastPriceUpdate&&(this.isLastPriceUpdate=!0,this.initReset())},syncOrderBookShortcutTime(){const{type:e,price:t,size:i,total:r}=this.futureOrderBookShortcut;"price"===e?this.ruleForm.price=t:"size"===e?this.ruleForm.size=i:"total"===e&&(this.ruleForm.price=t,this.ruleForm.size=r),this.autoTotal({price:this.ruleForm.price,size:this.ruleForm.size})},marketCurrency(e){this.ruleForm.price="",this.ruleForm.size="",this.autoTotal({price:this.ruleForm.price,size:this.ruleForm.size}),e!==Kq&&this.inputFocus(),this.isAuto=!0},marketSymbol(){this.initReset(),this.isLastPriceUpdate=!1,this.bboActive&&this.updateBboPrice()},totalValue(){this.loginState&&this.autoPercent()},isBuyAction(e){this.ruleForm.side=e?"BUY":"SELL",this.bboActive&&this.updateBboPrice()},infoStp(){this.bboActive=!1,this.initReset()}},created(){this.initReset()},methods:{e2eID:Gi,...v("trading",["beforeSpotTradingBehaviorFn"]),...tq.methods,handleQuick(e){const t=this.spotLastPrice.toFixed(this.exchangeInfo.priceDecimal);let i;this.ruleForm.price=Number(this.ruleForm.price)<this.exchangeInfo.minValidPrice?t:this.ruleForm.price,this.selectedPrice=this.ruleForm.price;const r=S(e).div(100);i=this.isBuyAction?S(this.marketQuoteCurrencyData.available).div(this.ruleForm.price).times(r):S(this.balance).times(r),i=i.minus(i.mod(this.exchangeInfo.minSizeIncrement)).toNumber();const a=this.$filters.formatNumber(i,this.exchangeInfo.sizeDecimal);this.ruleForm.size=(null==a?void 0:a.replace(/,/g,""))||0,this.autoTotal({price:this.ruleForm.price,size:this.ruleForm.size}),this.selectedSize=this.ruleForm.size},sizeInputHandler(e){this.ruleForm.size=xa(e.target.value,this.exchangeInfo.sizeDecimal),this.isZero("size","size"),this.autoTotal({price:this.ruleForm.price,size:this.ruleForm.size})},mobileSizeInputHandler(e){this.ruleForm.size=e,this.$nextTick((()=>{this.ruleForm.size=xa(e,this.exchangeInfo.sizeDecimal),this.autoTotal({price:this.ruleForm.price,size:this.ruleForm.size})}))},autoTotal({price:e,size:t}){this.totalValue=e&&t?Number(S(e).times(t).toFixed(this.exchangeInfo.priceDecimal,S.ROUND_DOWN)):"",this.isTotalUnderMin=!1},autoSize({price:e,total:t}){this.ruleForm.size=e&&t?Number(S(t).div(e).toFixed(this.exchangeInfo.sizeDecimal,S.ROUND_DOWN)):"",""!==t&&t<this.minTotal?this.isTotalUnderMin=!0:this.isTotalUnderMin=!1},autoPercent(){const e=this.isBuyAction?this.marketQuoteCurrencyData.available/this.ruleForm.price:this.marketCurrencyData.available,t=Math.round(this.ruleForm.size/e*100);Number.isNaN(t)||(this.ruleForm.percent=t)},keyupEnter(){this.isDisableSubmit||this.submitForm()},async submitForm(){if(this.showIdVerificationRequiredDialog(Jr.TRADING_SPOT.BUY))return;if(!(await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:this.isBuyAction?Zt.CLICK_BUY_ORDER_BTN:Zt.CLICK_SELL_ORDER_BTN})))return;if(this.bboActive){const e=this.isBuyAction?zI:$I,t=await this.resolveBboFresh(this.bboSelection.id,e);if(null===t)return void this.$toastError({title:this.$t("trading.bbo.noMatchingPrice")});this.ruleForm.price=S(t).toFixed(this.exchangeInfo.priceDecimal,this.isBuyAction?S.ROUND_DOWN:S.ROUND_UP),this.autoTotal({price:this.ruleForm.price,size:this.ruleForm.size})}const e=await this.checkPriceProtection({isSpot:!0,isBuyAction:this.isBuyAction,symbol:this.marketData.symbol,orderPrice:this.ruleForm.price,triggerPrice:this.ruleForm.triggerPrice,priceFilter:this.exchangeInfo.priceDecimal,quoteCurrency:this.marketQuoteCurrencyData.displayName,tradingType:this.infoStp});if(!e.ok)return;e.protectionPrice&&(this.ruleForm.price=e.protectionPrice);let t=this.infoStp;switch(t){case ni.LIMIT_TAKE_PROFIT:t="TRIGGER";break;case ni.LIMIT_STOP:t="STOP";break;default:t=this.infoStp}this.ruleForm.symbol=this.marketSymbol,this.ruleForm.txType=t,this.loading=!0;const i=Number(S(this.totalValue).times(this.marketQuoteCurrencyData.usdRate)),r={...this.ruleForm,infoStp:this.infoStp};Jt.submitOrder(r,i).then((()=>{this.$sendEvent(Kr.EVENT_WEB_TRADING_SPOT_ORDER_FORM_SUBMITTED,{submitSuccess:!0,submitData:r,tradingViewWidgetInstance:this.tradingViewWidgetInstance,errorCode:null}),this.inputFocus(),this.resetFormAfterSubmit()})).catch((e=>{throw this.$sendEvent(Kr.EVENT_WEB_TRADING_SPOT_ORDER_FORM_SUBMITTED,{submitSuccess:!1,submitData:r,tradingViewWidgetInstance:this.tradingViewWidgetInstance,errorCode:e.code}),e})).finally((()=>{this.loading=!1}))},initReset(){this.ruleForm.side=this.isBuyAction?"BUY":"SELL",this.ruleForm.price=this.formattedLastPrice||"",this.ruleForm.triggerPrice="",this.totalValue="",this.isTotalUnderMin=!1}
1,resetFormAfterSubmit(){this.rememberSpotOrderSize||(this.ruleForm.size="",this.totalValue="")},inputFocus(){this.$refs.inputFocus&&this.$refs.inputFocus.focus()},handleLastPriceChange(){this.ruleForm.price=this.formattedLastPrice,this.autoTotal({price:this.formattedLastPrice,size:this.ruleForm.size})},toggleBbo(){this.bboActive=!this.bboActive,this.bboActive?this.updateBboPrice():this.handleLastPriceChange()},setPriceMatch(e){this.setBboSelection(e),this.updateBboPrice()},async updateBboPrice(){if(!this.bboActive)return;await this.refreshBboOrderBook();const e=this.isBuyAction?zI:$I,t=this.resolveBbo(this.bboSelection.id,e);this.ruleForm.price=null==t?"":S(t).toFixed(this.exchangeInfo.priceDecimal,this.isBuyAction?S.ROUND_DOWN:S.ROUND_UP),this.autoTotal({price:this.ruleForm.price,size:this.ruleForm.size})}}},Yq={class:"spot-form-container"},Zq={class:"top-content"},Xq={class:"pre-line"},Jq={key:0},eG={class:"limit-price-wrapper"},tG=["innerHTML"],iG=["innerHTML"],rG=["textContent"],aG={class:"darker"},nG={class:"darker"},oG={class:"lower darker"},sG={class:"postOnly"},lG={class:"checkbox-group"},uG={class:"__form_item"};const cG=$n(jq,[["render",function(e,t,i,r,u,g){const f=a("Tooltip"),v=a("SpotTriggerTypeSelect"),y=a("TradingInput"),b=a("FuturesChoose"),S=a("LimitLastPriceBtn"),C=a("BboButton"),P=a("MarketHintTooltip"),k=a("TradeSlider"),T=a("EstimatedSymbol"),M=a("i18n-t"),L=a("EstimatedHintBlock"),w=a("PostOnlyCheckbox"),D=a("TifSelector"),O=a("balance"),I=a("BrandButton");return o(),c("div",Yq,[l("div",Zq,[g.isLimit?h("",!0):(o(),n(y,{key:0,id:g.e2eID("order_trigger_price_input"),value:u.ruleForm.triggerPrice,"onUpdate:value":t[2]||(t[2]=e=>u.ruleForm.triggerPrice=e),label:"triggerPrice",enableThousandSeparator:"",enablePlaceZero:"",hideSpin:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minValidPrice),placeholder:e.exchangeInfo.minValidPrice,errorShown:g.isTriggerPriceError,errorContent:g.triggerPriceErrorText},te({prepend:s((()=>[d(f,{class:"_index_title",content:e.stpTitleSet(i.infoStp)},{tooltip:s((()=>[l("p",Xq,m(g.triggerPriceTooltip),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(e.marketQuoteCurrencyData.displayName)+")",1)])),append:s((()=>[e.isMobile?(o(),c("span",Jq,m(e.marketQuoteCurrencyData.displayName),1)):(o(),n(v,{key:1,value:u.ruleForm.triggerPriceType,"onUpdate:value":t[1]||(t[1]=e=>u.ruleForm.triggerPriceType=e)},null,8,["value"]))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(v,{value:u.ruleForm.triggerPriceType,"onUpdate:value":t[0]||(t[0]=e=>u.ruleForm.triggerPriceType=e)},null,8,["value"])])),key:"0"}:void 0]),1032,["id","value","step","min","placeholder","errorShown","errorContent"])),l("div",eG,[u.bboActive?(o(),n(b,{key:0,class:"bbo-select",items:r.bboOptions,form:r.bboSelection,returnObject:"","onUpdate:form":g.setPriceMatch},null,8,["items","form","onUpdate:form"])):(o(),n(y,{key:1,id:g.e2eID("order_price_input"),value:u.ruleForm.price,"onUpdate:value":t[3]||(t[3]=e=>u.ruleForm.price=e),label:"price",enableThousandSeparator:"",hideSpin:"",enablePlaceZero:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minValidPrice),placeholder:e.exchangeInfo.minValidPrice,onInput:t[4]||(t[4]=e=>g.autoTotal({price:e,size:u.ruleForm.size}))},te({prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("t.price")},{tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.price_tip",{a:e.exchangeInfo.minValidPrice,b:e.exchangeInfo.minPriceIncrement})},null,8,tG)])),_:1},8,["content"])])),remark:s((()=>[p(" ("+m(e.marketQuoteCurrencyData.displayName)+") ",1)])),content:s((()=>[d(S,{isBuy:i.isBuyAction,onChange:g.handleLastPriceChange},null,8,["isBuy","onChange"])])),_:2},[e.isMobile?{name:"append",fn:s((()=>[p(m(e.marketQuoteCurrencyData.displayName),1)])),key:"0"}:void 0]),1032,["id","value","step","min","placeholder"])),d(C,{active:u.bboActive,onToggle:g.toggleBbo},null,8,["active","onToggle"])]),d(y,{id:g.e2eID("order_amount_input"),value:u.ruleForm.size,"onUpdate:value":t[5]||(t[5]=e=>
1u.ruleForm.size=e),label:"size",enableThousandSeparator:"",hideSpin:"",min:0,step:Number(e.exchangeInfo.minSizeIncrement),placeholder:e.exchangeInfo.minOrderSize,errorShown:g.isSizeOverLimit,errorContent:g.sizeOverWarningText,onInput:g.mobileSizeInputHandler},{prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("t.size")},{tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.size_tip",{a:e.exchangeInfo.minOrderSize,b:e.exchangeInfo.maxOrderSize,c:e.exchangeInfo.minSizeIncrement})},null,8,iG)])),_:1},8,["content"])])),append:s((()=>[d(P,null,{default:s((()=>[p(m(g.displayMarketName),1)])),_:1})])),_:1},8,["id","value","step","placeholder","errorShown","errorContent","onInput"]),d(k,{value:u.ruleForm.percent,"onUpdate:value":t[6]||(t[6]=e=>u.ruleForm.percent=e),disabled:!e.loginState,onChange:t[7]||(t[7]=e=>g.handleQuick(e))},null,8,["value","disabled"]),d(y,{id:g.e2eID("order_total_input"),value:u.totalValue,"onUpdate:value":t[8]||(t[8]=e=>u.totalValue=e),label:"total",enableThousandSeparator:"",hideSpin:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minValidPrice),placeholder:g.minTotal,errorShown:u.isTotalUnderMin,errorContent:g.totalUnderMinText,onInput:t[9]||(t[9]=e=>g.autoSize({price:u.ruleForm.price,total:e}))},{prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("trading.buySell.total")},{tooltip:s((()=>[l("p",{textContent:m(e.$t("trading.buySell.limit.totalTooltip"))},null,8,rG)])),_:1},8,["content"]),d(T,{inSymbol:e.marketQuoteCurrencyData.shortName,toSymbol:e.marketCurrencyData.shortName},null,8,["inSymbol","toSymbol"])])),append:s((()=>[p(m(e.marketQuoteCurrencyData.displayName),1)])),_:1},8,["id","value","step","min","placeholder","errorShown","errorContent"]),g.isDisableSubmit||!g.isStop&&!g.isTakeProfit?h("",!0):(o(),n(M,{key:1,keypath:"trading.order.description.order",class:"trade-explanation",tag:"div"},{priceType:s((()=>[l("span",aG,m(e.orderFormSettings.triggerOn===r.SPOT_TRIGGER_PRICE_TYPE.INDEX_PRICE?e.$t("futuresMain.trade.index"):e.$t("trading.last")),1)])),triggerPrice:s((()=>[l("span",null,m(e.$filters.formatNumber(u.ruleForm.triggerPrice,e.exchangeInfo.priceDecimal)),1)])),quote:s((()=>[l("span",null,m(e.marketQuoteCurrencyData.displayName),1)])),orderType:s((()=>[l("span",nG,m(e.$t("trading.limitOrder")),1)])),side:s((()=>[l("span",oG,m(i.isBuyAction?e.$t("t.buy"):e.$t("t.sell")),1)])),size:s((()=>[l("span",null,m(u.ruleForm.size),1)])),base:s((()=>[l("span",null,m(e.marketCurrencyData.displayName),1)])),priceInfo:s((()=>[p(m(e.$t("futuresMain.closeOrderPlacement.content3"))+" ",1),l("span",null,m(e.$filters.formatNumber(u.ruleForm.price,e.exchangeInfo.priceDecimal))+" "+m(e.marketQuoteCurrencyData.displayName),1)])),_:1})),d(L,{storageKey:g.estimatedHintKey,inSymbol:e.marketQuoteCurrencyData.shortName,toSymbol:e.marketCurrencyData.shortName},null,8,["storageKey","inSymbol","toSymbol"]),l("div",sG,[l("div",lG,[d(w,{value:u.ruleForm.postOnly,"onUpdate:value":t[10]||(t[10]=e=>u.ruleForm.postOnly=e)},null,8,["value"])]),g.isLimit?(o(),n(D,{key:0,value:u.ruleForm.time_in_force,"onUpdate:value":t[11]||(t[11]=e=>u.ruleForm.time_in_force=e)},null,8,["value"])):h("",!0)])]),l("div",null,[t[12]||(t[12]=l("div",{class:"form-division"},null,-1)),d(O,{type:i.isBuyAction?"buy":"sell"},null,8,["type"]),l("div",uG,[d(I,{class:"__btn",size:"mediumFontBig",type:i.isBuyAction?"success":"danger",disabled:g.isDisableSubmit,loading:u.loading,onClick:g.submitForm},{default:s((()=>[p(m(e.$t(i.isBuyAction?"trading.buySell.button.buy":"trading.buySell.button.sell")),1)])),_:1},8,["type","disabled","loading","onClick"])])])])}],["__scopeId","data-v-5ee3f445"]]),dG={name:"BrandTooltip",props:{title:{type:String,default:""},type:{type:String,default:""}},computed:{...y(qe,["exchangeInfo"]),mixMaxTipContent(){return"1-min"===this.type?this.$t("trading.buySell.index.minPrice"):"1-max"===this.type?this.$t("trading.buySell.index.maxPrice"):""}}},pG=["innerHTML"],hG=["innerHTML"],mG=["innerHTML"],gG=["innerHTML"],fG=["innerHTML"];const vG={type:"PEG",symbol:"",price:"",size:"",total:"",stealth:"100",deviation:"0"};let yG;const bG={name:"OrderIndex",components:{BrandTooltip:$n(dG,[["render",function(e,t,i,r,u,d){const g=a("Tooltip");
1return o(),c("div",null,["1-min"===i.type||"1-max"===i.type?(o(),n(g,{key:0},{content:s((()=>[p(m(d.mixMaxTipContent),1)])),tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.price_tip",{a:e.exchangeInfo.minValidPrice,b:e.exchangeInfo.minPriceIncrement})},null,8,pG)])),_:1})):"2"===i.type?(o(),n(g,{key:1},{content:s((()=>[p(m(e.$t("trading.buySell.index.percentage")),1)])),tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.index.percentage_tip")},null,8,hG)])),_:1})):"3"===i.type?(o(),n(g,{key:2},{content:s((()=>[p(m(e.$t("t.size")),1)])),tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.size_tip",{a:e.exchangeInfo.minOrderSize,b:e.exchangeInfo.maxOrderSize,c:e.exchangeInfo.minSizeIncrement})},null,8,mG)])),_:1})):"4"===i.type?(o(),n(g,{key:3},{content:s((()=>[p(m(e.$t("trading.buySell.index.stealthVisibility")),1)])),tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.index.stealthVisibility_tip")},null,8,gG)])),_:1})):"5"===i.type?(o(),n(g,{key:4},{content:s((()=>[p(m(e.$t("trading.buySell.total")),1)])),tooltip:s((()=>[l("p",{innerHTML:e.$t("trading.buySell.index.totalTooltip")},null,8,fG)])),_:1})):h("",!0)])}]]),Balance:hq,EstimatedSymbol:yq,EstimatedHintBlock:Cq,TradingInput:Wn,MarketHintTooltip:qc},props:{isBuyAction:{type:Boolean,default:!0},infoStp:{type:String,required:!0}},setup(){const{convertToDisplaySymbol:e}=Je(),{showIdVerificationRequiredDialog:t}=hs();return{convertToDisplaySymbol:e,showIdVerificationRequiredDialog:t}},data:()=>({...tq.data(),ruleForm:{},loading:!1,isAuto:!0,deviationStealth:{step:.1,deviation:{value:0,min:-10,max:10,reg:/^[-]?\d*\.?\d?$/},stealth:{value:100,min:1,max:100,reg:/^\d+\.?\d?$/}},lastInputParam:"",isSizeUnderMin:!1,isTotalUnderMin:!1,estimatedHintKey:$i.TRADING_ESTIMATED_HINT_INDEXS}),computed:{...tq.computed,...b({futureOrderBookShortcut:"futureOrderBookShortcut"}),...y(ts,["rememberSpotOrderSize"]),...y(dt,{spotIndexPrice:"currentMarketIndexPrice"}),...y(qe,["exchangeInfo","marketData","getMarketSymbolFromBaseCurrency","getBalanceByOrderAction","marketSymbol","marketCurrencyData","marketQuoteCurrencyData","marketCurrency"]),displayMarketName(){return this.convertToDisplaySymbol(this.marketData.symbol)},syncOrderBookShortcutTime(){return this.futureOrderBookShortcut.time},balance(){return this.getBalanceByOrderAction(this.isBuyAction?"buy":"sell")},isDisableSubmit(){const e=this.ruleForm.deviation,t=this.ruleForm.price,i=this.ruleForm.size,r=this.ruleForm.stealth,a=this.ruleForm.total,n=this.balance>0&&e&&t>0&&i>0&&a>0&&r>0&&this.total<=this.balance,o=this.balance>0&&e&&t>0&&i>0&&a>0&&r>0&&i<=this.balance;return!(!this.isSizeUnderMin&&!this.isTotalUnderMin)||(!this.isBuyAction||!n)&&!(!this.isBuyAction&&o)},effPrice(){const e=Number(this.ruleForm.deviation)||0;return Number(S(this.spotIndexPrice).plus(S(this.spotIndexPrice).times(e).div(100)))},finalEffectivePrice(){return this.orderData.price<=this.effPrice?this.orderData.price:this.effPrice},finalEffectiveSellPrice(){return this.orderData.price>=this.effPrice?this.orderData.price:this.effPrice},total(){let e=0;return e=this.effPrice>this.ruleForm.price?this.ruleForm.price:this.effPrice,e=Number(e)||0,Number(S(e).times(this.orderData.size))},buttonType(){return this.isBuyAction?"success":"danger"},tooltipType(){return this.isBuyAction?"1-max":"1-min"},minTotal(){if(void 0===this.exchangeInfo.minOrderSize)return 0;const e=S.ROUND_UP;return Number(S(this.exchangeInfo.minOrderSize).times(this.spotIndexPrice).toFixed(this.exchangeInfo.priceDecimal,e))},sizeUnderMinText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketCurrencyData.shortName));return this.$t("trading.buySell.minOrderQuantity",{value:`${this.exchangeInfo.minOrderSize} ${e}`})},totalUnderMinText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketQuoteCurrencyData.shortName));return this.$t("trading.buySell.minOrderQuantity",{value:`${this.minTotal} ${e}`})}},watch:{...tq.watch,syncOrderBookShortcutTime(){const{type:e,price:t,size:i,total:r}=this.futureOrderBookShortcut;"price"===e?this.ruleForm.price=t:"size"===e?this.ruleForm.size=i:"total"===e&&(this.ruleForm.price=t,this.ruleForm.size=r)},$route(){this.initReset()},isBuyAction(e){this.ruleForm.side=e?"BUY":"SELL","size"===this.lastInputParam?this.autoTotal(this.ruleForm.size):this.autoSize(this.ruleForm.price)},lastInputParam(e){clearInterval(yG),yG=setInterval((()=>{this.calculateParamByType(e)}),3e3)},effPrice(){this.calculateParamByType(this.lastInputParam)}},created(){this.initReset()},mounted(){this.inputFocus()},beforeUnmount(){clearInterval(yG)},methods:{...v("trading",["beforeSpotTradingBehaviorFn"]),...tq.methods,isPercentage(e,t){let i=t;const r=this.deviationStealth[e].min,a=this.deviationStealth[e].max,n=this.deviationStealth[e].reg;""!==t?(n.test(i)&&(i=Math.min(i,a),i=Math.max(i,r),this.deviationStealth[e].value=i.toString()),this.ruleForm[e]=this.deviationStealth[e].value):this.deviationStealth[e].value=""},keyupEnter(){!this.isDisableSubmit&&this.submitForm("ruleForm")}
1,async submitForm(){if(this.showIdVerificationRequiredDialog(Jr.TRADING_SPOT.BUY))return;if(!(await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:this.isBuyAction?Zt.CLICK_BUY_ORDER_BTN:Zt.CLICK_SELL_ORDER_BTN})))return;this.ruleForm.symbol=this.marketSymbol,this.loading=!0;const e=Number(S(this.total).times(this.marketQuoteCurrencyData.usdRate)),t={...this.ruleForm,infoStp:this.infoStp};Jt.submitOrder(t,e).then((()=>{this.inputFocus(),this.resetFormAfterSubmit(),this.isAuto=!0})).finally((()=>{this.loading=!1}))},initReset(){this.ruleForm=JSON.parse(JSON.stringify(vG)),this.ruleForm.side=this.isBuyAction?"BUY":"SELL",this.ruleForm.price=this.spotIndexPrice.toFixed(1)||""},resetFormAfterSubmit(){this.rememberSpotOrderSize||(this.ruleForm.size="",this.ruleForm.total="")},inputFocus(){this.$refs.inputFocus&&this.$refs.inputFocus.focus()},autoTotal(e){if(!e)return this.ruleForm.total="",void(this.isSizeUnderMin=!1);const t=S.ROUND_DOWN;let i=0;i=this.effPrice>this.ruleForm.price?this.ruleForm.price:this.effPrice,i=Number(i)||0,this.ruleForm.total=Number(S(i).times(e).toFixed(this.exchangeInfo.priceDecimal,t)),this.isTotalUnderMin=!1,""!==e&&e<this.exchangeInfo.minOrderSize?this.isSizeUnderMin=!0:this.isSizeUnderMin=!1},autoSize(e){if(!e)return this.ruleForm.size="",void(this.isTotalUnderMin=!1);const t=S.ROUND_DOWN;let i=0;i=this.effPrice>this.ruleForm.price?this.ruleForm.price:this.effPrice,i=Number(i)||0,this.ruleForm.size=Number(S(e).div(i).toFixed(this.exchangeInfo.sizeDecimal,t)),this.isSizeUnderMin=!1,""!==e&&e<this.minTotal?this.isTotalUnderMin=!0:this.isTotalUnderMin=!1},sizeInputHandler(e){this.lastInputParam="size",this.ruleForm.size=xa(e,this.exchangeInfo.sizeDecimal),this.isZero("size","size"),this.autoTotal(this.ruleForm.size)},totalInputHandler(e){this.lastInputParam="total",this.autoSize(e)},calculateParamByType(e){"size"===e?this.autoTotal(this.ruleForm.size):this.autoSize(this.ruleForm.total)},priceInputHandler(){this.isZero("price","price"),this.calculateParamByType(this.lastInputParam)}}},SG={class:"spot-form-container"},CG={class:"top-content"},PG={class:"flex-box justify-between items-center"},kG=["innerHTML"],TG={class:"_index_title"},MG={class:"_index_disable"},LG={class:"flex-box justify-between items-center"},wG={class:"_index_title"},DG={class:"_index_disable"},OG={class:"tooltip-title-wrapper inline-flex"},IG={class:"__form_item"};const xG=$n(bG,[["render",function(e,t,i,r,n,u){const h=a("Tooltip"),g=a("BrandTooltip"),f=a("TradingInput"),v=a("MarketHintTooltip"),y=a("EstimatedSymbol"),b=a("EstimatedHintBlock"),S=a("balance"),P=a("BrandButton");return o(),c("div",SG,[l("div",CG,[l("div",PG,[d(h,{delay:"100"},{tooltip:s((()=>[l("span",{innerHTML:e.$t("trading.buySell.index.indexPriceTooltip",{brandName:e.$t("brand.name")})},null,8,kG)])),content:s((()=>[l("p",TG,m(e.$t("trading.buySell.indexprice")),1)])),_:1}),l("p",MG,[l("span",{class:C({"xs-font-size":e.isSmallPriceFont})},m(e.$filters.formatNumber(e.spotIndexPrice,e.exchangeInfo.priceDecimal)),3),p(" "+m(e.marketQuoteCurrencyData.displayName),1)])]),l("div",LG,[d(h,{tooltip:e.$t("trading.buySell.index.effectivePriceTooltip")},{content:s((()=>[l("p",wG,m(e.$t("trading.buySell.effPrice")),1)])),_:1},8,["tooltip"]),l("p",DG,[l("span",{class:C({"xs-font-size":e.isSmallPriceFont})},m(e.$filters.formatNumber(i.isBuyAction?u.finalEffectivePrice:u.finalEffectiveSellPrice,e.exchangeInfo.priceDecimal)),3),p(" "+m(e.marketQuoteCurrencyData.displayName),1)])]),d(f,{value:n.ruleForm.price,"onUpdate:value":t[0]||(t[0]=e=>n.ruleForm.price=e),label:"price",enableThousandSeparator:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minValidPrice),placeholder:e.exchangeInfo.minValidPrice,onInput:u.priceInputHandler},{prepend:s((()=>[d(g,{type:u.tooltipType,class:"_index_title"},null,8,["type"])])),append:s((()=>[p(m(e.marketQuoteCurrencyData.displayName),1)])),_:1},8,["value","step","min","placeholder","onInput"]),d(f,{value:n.ruleForm.size,"onUpdate:value":t[1]||(t[1]=e=>n.ruleForm.size=e),label:"size",enableThousandSeparator:"",step:Number(e.exchangeInfo.minSizeIncrement),min:Number(e.exchangeInfo.minOrderSize),placeholder:e.exchangeInfo.minOrderSize,errorShown:n.isSizeUnderMin,errorContent:u.sizeUnderMinText,onInput:u.sizeInputHandler},{prepend:s((()=>[d(g,{type:"3",class:"_index_title"})])),append:s((()=>[d(v,null,{default:s((()=>[p(m(u.displayMarketName),1)])),_:1})])),_:1},8,["value","step","min","placeholder","errorShown","errorContent","onInput"]),d(f,{value:n.ruleForm.total,"onUpdate:value":t[2]||(t[2]=e=>n.ruleForm.total=e),label:"total",enableThousandSeparator:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minValidPrice),placeholder:u.minTotal,errorShown:n.isTotalUnderMin,errorContent:u.totalUnderMinText,onInput:u.totalInputHandler},{prepend:s((()=>[l("div",OG,[d(g,{type:"5",class:"_index_title"}
1),d(y,{inSymbol:e.marketQuoteCurrencyData.shortName,toSymbol:e.marketCurrencyData.shortName},null,8,["inSymbol","toSymbol"])])])),append:s((()=>[p(m(e.marketQuoteCurrencyData.displayName),1)])),_:1},8,["value","step","min","placeholder","errorShown","errorContent","onInput"]),d(b,{storageKey:n.estimatedHintKey,inSymbol:e.marketQuoteCurrencyData.shortName,toSymbol:e.marketCurrencyData.shortName},null,8,["storageKey","inSymbol","toSymbol"]),d(f,{value:n.ruleForm.deviation,"onUpdate:value":t[3]||(t[3]=e=>n.ruleForm.deviation=e),label:"deviation",type:"number",step:Number(n.deviationStealth.step),min:n.deviationStealth.deviation.min,max:n.deviationStealth.deviation.max,placeholder:"-10~10",onInput:t[4]||(t[4]=e=>u.isPercentage("deviation",e))},{prepend:s((()=>[d(g,{type:"2",class:"_index_title"})])),append:s((()=>t[8]||(t[8]=[p("%")]))),_:1},8,["value","step","min","max"]),d(f,{value:n.ruleForm.stealth,"onUpdate:value":t[5]||(t[5]=e=>n.ruleForm.stealth=e),label:"stealth",type:"number",step:Number(n.deviationStealth.step),min:n.deviationStealth.stealth.min,max:n.deviationStealth.stealth.max,placeholder:"1~100",onInput:t[6]||(t[6]=e=>u.isPercentage("stealth",e))},{prepend:s((()=>[d(g,{type:"4",class:"_index_title force-width"})])),append:s((()=>t[9]||(t[9]=[p("%")]))),_:1},8,["value","step","min","max"])]),l("div",null,[d(S,{type:i.isBuyAction?"buy":"sell"},null,8,["type"]),l("div",IG,[d(P,{class:"__btn",type:u.buttonType,size:"mediumFontBig",disabled:u.isDisableSubmit,loading:n.loading,onClick:t[7]||(t[7]=e=>u.submitForm("ruleForm"))},{default:s((()=>[p(m(i.isBuyAction?e.$t("trading.buySell.button.buy"):e.$t("trading.buySell.button.sell")),1)])),_:1},8,["type","disabled","loading"])])])])}],["__scopeId","data-v-631c921f"]]),_G={price:"",stop:"",limit:"",size:"",total:"",triggerPriceType:is},AG={setup(){const{convertToDisplaySymbol:e}=Je(),{showIdVerificationRequiredDialog:t}=hs(),{checkPriceProtection:i}=xI();return{convertToDisplaySymbol:e,showIdVerificationRequiredDialog:t,checkPriceProtection:i}},data:()=>({formData:{..._G},symbols:{br:"<br>"},isSizeUnderMin:!1,isTotalUnderMin:!1}),computed:{...b("orderBook",["lastPrice"]),...y(Nn,["orderBook"]),...y(ts,["rememberSpotOrderSize"]),...y(dt,{spotLastPrice:"currentMarketLastPrice",spotIndexPrice:"currentMarketIndexPrice"}),...y(qe,["exchangeInfo","marketData","marketSymbol","marketCurrency","marketQuoteCurrency","marketCurrencyData","marketQuoteCurrencyData","getMarketSymbolFromBaseCurrency","getBalanceByOrderAction"]),totalAmount(){return Number(S(this.numberFormData.price).times(this.numberFormData.size))},balance(){return this.getBalanceByOrderAction(this.isBuyAction?"buy":"sell")},inputAlert(){const{price:e,stop:t}=this.formData;return!!this.basicAuthPassed&&(e<=this.indexPrice&&t<=this.indexPrice||e>=this.indexPrice&&t>=this.indexPrice)},fixedSpotMarketLastPrice(){return this.spotLastPrice.toFixed(this.exchangeInfo.priceDecimal)},isSmallPriceFont(){return!this.isMobile&&this.exchangeInfo.minPriceIncrement<1e-7},indexPrice(){return this.spotIndexPrice},lastPriceData(){return S(this.spotLastPrice||this.lastPrice).dp(this.exchangeInfo.priceDecimal,S.ROUND_DOWN).toNumber()},numberFormData(){const{price:e,stop:t,limit:i,size:r,total:a}=this.formData;return{price:Number(e)||0,stop:Number(t)||0,limit:Number(i)||0,size:Number(r)||0,total:Number(a)||0}},disableSubmit(){return!this.basicAuthPassed||(!(!this.isSizeUnderMin&&!this.isTotalUnderMin)||(this.isBuyAction?!this.validBuySubmit:!this.validSellSubmit))},basicAuthPassed(){const{price:e,stop:t,limit:i,size:r,total:a}=this.numberFormData;return e&&e>0&&t&&t>0&&i&&i>0&&r&&r>0&&a&&a>0},validBuySubmit(){const{price:e,stop:t}=this.numberFormData;return e<this.indexPrice&&t>this.indexPrice&&this.totalAmount<=this.balance},validSellSubmit(){const{price:e,stop:t,size:i}=this.numberFormData;return e>this.indexPrice&&t<this.indexPrice&&i<=this.balance},minTotal(){if(void 0===this.exchangeInfo.minOrderSize)return 0;const e=S.ROUND_UP,t=this.isBuyAction?this.numberFormData.limit:this.numberFormData.price,i=Number(S(this.exchangeInfo.minOrderSize).times(t).toFixed(this.exchangeInfo.priceDecimal,e)),r=Number(this.exchangeInfo.minValidPrice);return i>r?i:r},sizeUnderMinText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketCurrencyData.short
1Name));return this.$t("trading.buySell.minOrderQuantity",{value:`${this.exchangeInfo.minOrderSize} ${e}`})},totalUnderMinText(){const e=this.convertToDisplaySymbol(this.getMarketSymbolFromBaseCurrency(this.marketQuoteCurrencyData.shortName));return this.$t("trading.buySell.minOrderQuantity",{value:`${this.minTotal} ${e}`})}},watch:{"orderBook.symbol":{immediate:!0,handler(){this.setDefaultLimit()}},marketSymbol(){this.resetFormData(),this.setDefaultInputs()},isBuyAction(){this.resetFormData(),this.setDefaultLimit()}},methods:{setDefaultLimit(){this.formData.limit=this.lastPriceData||0},setDefaultInputs(){this.spotLastPrice&&(this.formData.price=this.fixedSpotMarketLastPrice,this.formData.stop=this.fixedSpotMarketLastPrice,this.formData.limit=this.fixedSpotMarketLastPrice)},removeGroupSeparator:e=>e.toString().replace(/,/g,""),async submit(){if(this.showIdVerificationRequiredDialog(Jr.TRADING_SPOT.BUY))return;const e=await this.checkPriceProtection({isSpot:!0,isBuyAction:this.isBuyAction,symbol:this.marketData.symbol,orderPrice:this.numberFormData.price,limitPrice:this.numberFormData.limit,triggerPrice:this.numberFormData.stop,priceFilter:this.exchangeInfo.priceDecimal,quoteCurrency:this.marketQuoteCurrency,tradingType:ni.OCO});e.ok&&(this.numberFormData.price=e.protectionPrice||this.numberFormData.price,this.numberFormData.limit=e.triggerProtectionPrice||this.numberFormData.limit,this.ocoOrder(),this.resetFormAfterSubmit())},ocoOrder(){const{price:e,size:t,stop:i,limit:r}=this.numberFormData,a={...this.basicData(),size:t,price:e,stopPrice:r,triggerPrice:i,triggerPriceType:this.formData.triggerPriceType};this.order(a)},basicData(){return{side:this.isBuyAction?"BUY":"SELL",type:"OCO",txType:"LIMIT",symbol
1:this.marketSymbol,price:"",size:"",stopPrice:"",triggerPrice:"",time_in_force:"GTC",postOnly:!1,infoStp:this.infoStp}},order(e){const t=Number(S(this.totalAmount).times(this.marketQuoteCurrencyData.usdRate));Jt.submitOrder(e,t)},resetFormData(){this.formData={..._G}},resetFormAfterSubmit(){this.rememberSpotOrderSize||(this.formData.size="",this.formData.total="")},autoTotal(){const e=S.ROUND_DOWN,t=this.isBuyAction?this.numberFormData.limit:this.numberFormData.price;this.formData.total=Number(S(t).times(this.numberFormData.size).toFixed(this.exchangeInfo.priceDecimal,e)),this.isTotalUnderMin=!1,""!==this.formData.size&&this.formData.size<this.exchangeInfo.minOrderSize?this.isSizeUnderMin=!0:this.isSizeUnderMin=!1},autoSize(){const e=S.ROUND_DOWN,t=this.isBuyAction?this.numberFormData.limit:this.numberFormData.price;this.formData.size=t?Number(S(this.numberFormData.total).div(t).toFixed(this.exchangeInfo.sizeDecimal,e)):"",this.isSizeUnderMin=!1,""!==this.formData.total&&this.formData.total<this.minTotal?this.isTotalUnderMin=!0:this.isTotalUnderMin=!1}}},RG={name:"OrderOco",components:{Balance:hq,EstimatedSymbol:yq,EstimatedHintBlock:Cq,SpotTriggerTypeSelect:Pq,TradingInput:Wn,MarketHintTooltip:qc},props:{isBuyAction:{type:Boolean,required:!0},infoStp:{type:String,required:!0}},setup:()=>({...AG.setup()}),data:()=>({...AG.data(),i18nFormat:{br:"\n"},estimatedHintKey:$i.TRADING_ESTIMATED_HINT_OCO,priceTypeMap:{indexPrice:"futuresMain.trade.index",markPrice:"trading.mark",lastPrice:"trading.last"}}),computed:{...AG.computed,...y(ts,["orderFormSettings"]),displayMarketName(){return this.convertToDisplaySymbol(this.marketData.symbol)},i18nButtonText(){return"trading.buySell.button."+(this.isBuyAction?"buy":"sell")},buttonType(){return this.isBuyAction?"success":"danger"}},watch:{...AG.watch},methods:{e2eID:Gi,...AG.methods,sizeInputHandler(e){this.formData.size=xa(e,this.exchangeInfo.sizeDecimal),this.autoTotal()}}},FG={class:"spot-form-container"},EG={class:"top-content"},BG={class:"pre-line"},zG={class:"dotted-border"},$G={class:"pre-line"},NG={key:0},UG=["textContent"],HG=["textContent"],VG={key:0,class:"rules"},WG={class:"lower darker"},qG={class:"darker"},GG={class:"__form_item"};const KG=$n(RG,[["render",function(e,t,i,r,u,g){const f=a("Tooltip"),v=a("TradingInput"),y=a("SpotTriggerTypeSelect"),b=a("MarketHintTooltip"),S=a("EstimatedSymbol"),C=a("i18n-t"),P=a("EstimatedHintBlock"),k=a("Balance"),T=a("BrandButton");return o(),c("div",FG,[l("div",EG,[d(v,{id:g.e2eID("order_price_input"),value:e.formData.price,"onUpdate:value":t[0]||(t[0]=t=>e.formData.price=t),label:"price",enableThousandSeparator:"",enablePlaceZero:"",hideSpin:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.formData.price?e.exchangeInfo.minValidPrice:e.lastPrice),placeholder:e.exchangeInfo.minValidPrice,errorShown:e.inputAlert,onInput:e.autoTotal},te({prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("futuresMain.trade.ocoPrice")},{tooltip:s((()=>[l("p",BG,m(e.$t("trading.order.tooltip.ocoPrice",{priceType:e.$t(u.priceTypeMap[e.orderFormSettings.triggerOn]||"futuresMain.trade.index"),br:"\n"})),1)])),_:1},8,["content"])])),remark:s((()=>[p("("+m(e.marketQuoteCurrencyData.displayName)+")",1)])),_:2},[e.isMobile?{name:"append",fn:s((()=>[p(m(e.marketQuoteCurrencyData.displayName),1)])),key:"0"}:void 0]),1032,["id","value","step","min","placeholder","errorShown","onInput"]),l("div",zG,[d(v,{id:g.e2eID("order_trigger_price_input"),value:e.formData.stop,"onUpdate:value":t[3]||(t[3]=t=>e.formData.stop=t),label:"stop",enableThousandSeparator:"",enablePlaceZero:"",hideSpin:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.formData.stop?e.exchangeInfo.minValidPrice:e.lastPrice),placeholder:e.exchangeInfo.minValidPrice,errorShown:e.inputAlert,onInput:e.autoTotal},te({prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("futuresMain.trade.triggerPrice")},{tooltip:s((()=>[l("p",$G,m(e.$t("trading.order.tooltip.ocoTriggerPrice",{priceType:e.$t(u.priceTypeMap[e.orderFormSettings.triggerOn]||"futuresMain.trade.index"),br:"\n"})),1)])),_:1},8,["content"])])),remark:s((()=>[p(" ("+m(e.marketQuoteCurrencyData.displayName)+") ",1)])),append:s((()=>[e.isMobile?(o(),c("span",NG,m(e.marketQuoteCurrencyData.displayName),1)):(o(),n(y,{key:1,value:e.formData.triggerPriceType,"onUpdate:value":t[2]||(t[2]=t=>e.formData.triggerPriceType=t)},null,8,["value"]))])),_:2},[e.isMobile?{name:"content",fn:s((()=>[d(y,{value:e.formData.triggerPriceType,"onUpdate:value":t[1]||(t[1]=t=>e.formData.triggerPriceType=t)},null,8,["value"])])),key:"0"}:void 0]),1032,["id","value","step","min","placeholder","errorShown","onInput"]),d(v,{id:g.e2eID("order_limit_input"),value:e.formData.limit,"onUpdate:value":t[4]||(t[4]=t=>e.formData.limit=t),label:"limit",enableThousandSeparator:"",enablePlaceZero:"",hideSpin:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minValidPrice),placeholder:e.lastPrice,onInput:e.autoTotal}
1,te({prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("futuresMain.trade.ocoLimit")},{tooltip:s((()=>[l("p",{textContent:m(e.$t("futuresMain.trade.ocoLimit.tip"))},null,8,UG)])),_:1},8,["content"])])),remark:s((()=>[p(" ("+m(e.marketQuoteCurrencyData.displayName)+") ",1)])),_:2},[e.isMobile?{name:"append",fn:s((()=>[p(m(e.marketQuoteCurrencyData.displayName),1)])),key:"0"}:void 0]),1032,["id","value","step","min","placeholder","onInput"])]),d(v,{id:g.e2eID("order_amount_input"),value:e.formData.size,"onUpdate:value":t[5]||(t[5]=t=>e.formData.size=t),label:"size",enableThousandSeparator:"",step:Number(e.exchangeInfo.minSizeIncrement),min:Number(e.exchangeInfo.minOrderSize),placeholder:e.exchangeInfo.minOrderSize,errorShown:e.isSizeUnderMin,errorContent:e.sizeUnderMinText,onInput:g.sizeInputHandler},{prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("t.size")},{tooltip:s((()=>[l("p",{textContent:m(e.$t("futuresMain.trade.spotOcoQuantity.tip"))},null,8,HG)])),_:1},8,["content"])])),append:s((()=>[d(b,null,{default:s((()=>[p(m(g.displayMarketName),1)])),_:1})])),_:1},8,["id","value","step","min","placeholder","errorShown","errorContent","onInput"]),d(v,{id:g.e2eID("order_total_input"),value:e.formData.total,"onUpdate:value":t[6]||(t[6]=t=>e.formData.total=t),label:"total",enableThousandSeparator:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minValidPrice),placeholder:e.minTotal,errorShown:e.isTotalUnderMin,errorContent:e.totalUnderMinText,onInput:e.autoSize},{prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("t.total")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.buySell.limit.totalTooltip")),1)])),_:1},8,["content"]),d(S,{inSymbol:e.marketQuoteCurrencyData.shortName,toSymbol:e.marketCurrencyData.shortName},null,8,["inSymbol","toSymbol"])])),append:s((()=>[p(m(e.marketQuoteCurrencyData.displayName),1)])),_:1},8,["id","value","step","min","placeholder","errorShown","errorContent","onInput"]),e.inputAlert?(o(),c("div",VG,[p(m(e.$t("trading.buySell.rules"))+" ",1),t[7]||(t[7]=l("br",null,null,-1)),l("span",null,m(i.isBuyAction?e.$t("trading.buySell.buyRule"):e.$t("trading.buySell.sellRule")),1)])):h("",!0),e.disableSubmit?h("",!0):(o(),n(C,{key:1,keypath:"trading.order.description.oco",class:"trade-explanation",tag:"div"},{side:s((()=>[l("span",WG,m(i.isBuyAction?e.$t("t.buy"):e.$t("t.sell")),1)])),size:s((()=>[l("span",null,m(e.formData.size),1)])),base:s((()=>[l("span",null,m(e.marketCurrencyData.displayName),1)])),price:s((()=>[l("span",null,m(e.$filters.formatNumber(e.formData.price,e.exchangeInfo.priceDecimal)),1)])),quote:s((()=>[l("span",null,m(e.marketQuoteCurrencyData.displayName),1)])),priceType:s((()=>[l("span",qG,m(e.$t(u.priceTypeMap[e.orderFormSettings.triggerOn]||"futuresMain.trade.index")),1)])),triggerPrice:s((()=>[l("span",null,m(e.$filters.formatNumber(e.formData.stop,e.exchangeInfo.priceDecimal)),1)])),limit:s((()=>[l("span",null,m(e.$filters.formatNumber(e.formData.limit,e.exchangeInfo.priceDecimal)),1)])),_:1})),d(P,{storageKey:u.estimatedHintKey,inSymbol:e.marketQuoteCurrencyData.shortName,toSymbol:e.marketCurrencyData.shortName},null,8,["storageKey","inSymbol","toSymbol"])]),l("div",null,[d(k,{type:i.isBuyAction?"buy":"sell"},null,8,["type"]),l("div",GG,[d(T,{class:"__btn",size:"mediumFontBig",type:g.buttonType,disabled:e.disableSubmit,onClick:e.submit},{default:s((()=>[p(m(e.$t(g.i18nButtonText)),1)])),_:1},8,["type","disabled","onClick"])])])])}],["__scopeId","data-v-cc5a52e0"]]),QG={name:"DcaConfirmationDialog",components:{WarningConfirmDialog:mi},props:{show:{type:Boolean,default:!1},form:{type:Object,default:()=>({})},isBuyAction:{type:Boolean,required:!0},cycle:{type:String,default:""},totalInvestment:{type:String,default:""},currency:{type:String,required:!0}},emits:["update:show","confirm"],setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},computed:{...y(qe,{spotMarketData:"marketData",getMarketSymbolFromBaseCurrency:"getMarketSymbolFromBaseCurrency"}),visible:{get(){return this.show},set(e){return this.$emit("update:show",e)}},isSubDailyPeriod(){const{orderBase:e}=this.form;return e===Cn.MINS_15||e===Cn.MINS_30||e===Cn.HOURLY},cycleText(){const{orderTime:e}=this.form,t=this.isBuyAction?this.$t("t.buy"):this.$t("t.sell");let i="";if(this.isSubDailyPeriod)i=`${this.$t("t.every").toLowerCase()} ${this.cycle}`;else{const t=`0${e}`.slice(-2)+":00";i=`${this.cycle} at ${t}`}return`${t} ${i}`}},methods:{handleConfirm(){this.$emit("confirm"),this.visible=!1}}},jG={class:"dialog-confirm-body"},YG={class:"title"},ZG={class:"note"},XG={class:"info-area"},JG={class:"info-row"},eK={class:"label"},tK={class:"value"},iK={class:"info-row"},rK={class:"label"},aK={class:"value"},nK={class:"info-row"},oK={class:"label"},sK={class:"value"},lK={class:"info-row"},uK={class:"label"},cK={class:"value"},dK={class:"info-row"},pK={class:"label"},hK={class:"value"},mK={class:"info-row"},gK={class:"label"},fK={class:"value"},vK={class:"info-row"},yK={class:"label"},bK={class:"value"};const SK=$n(QG,[["render",function(e,t,i,r,u,c){const h=a("BaseButton"),g=a("WarningConfirmDialog");return o(),n(g,{visible:c.visible,"onUpdate:visible":t[1]||(t[1]=e=>c.visible=e),isNewStyle:""},{buttons:s((()=>[d(h,{type:"confirm",class:"primary block",size:"large",onClick:c.handleConfirm},{default:s((()=>[p(m(e.$t("t.confirm")),1)])),_:1},8,["onClick"]),l("div",{class:"cancel-btn",onClick:t[0]||(t[0]=e=>c.visible=!1)},m(e.$t("t.cancel")),1)])),default:s((()=>[l("div",jG,[l("h2",YG,m(e.$t("trading.spot.dca.dialog.title",{action:i.isBuyAction?e.$t("t.buy"):e.$t("t.sell")})),1),l("div",ZG,m(e.$t("trading.spot.dca.dialog.description"))+":",1),l("div",XG,[l("div",JG,[l("div",eK,m(e.$t("futuresMain.tradeHistory.marketName"))+": ",1),l("div",tK,m(r.convertToDisplaySymbol(e.getMarketSymbolFromBaseCurrency(e.spotMarketData.baseCurrency)))+"/"+m(e.spotMarketData.displayQuote),1)]),l("div",iK,[l("div",rK,m(e.$t("t.cycle"))+":",1),l("div",aK,m(c.cycleText),1)]),l("div",nK,[l("div",oK,m(e.$t("trading.spot.dca.investmentPerPeriod"))+": ",1),l("div",sK,m(i.form.investmentPerPeriod)+" "+m(i.currency),1)]),l("div",lK,[l("div",uK,m(e.$t("trading.spot.dca.noOfInvestment"))+":",1),l("div",cK,m(i.form.numberOfInvestment||e.$t("t.continuously")),1)]),l("div",dK,[l("div",pK,m(e.$t("trading.spot.dca.dialog.totalInvestment"))+": ",1),l("div",hK,m(i.totalInvestment)+" "+m(i.currency),1)]),l("div",mK,[l("div",gK,m(e.$t("t.slippage"))+":",1),l("div",fK,m(`${i.form.slippage}${i.form.slippage?" %":""}`),1)]),l("div",vK,[l("div",yK,m(e.$t("trading.spot.dca.dialog.depositAfterText"))+": ",1),l("div",bK,m(i.form.isDepositIntoEarn?e.$t("t.enable"):e.$t("t.disable")),1)])])])])),_:1},8,["visible"])}],["__scopeId","data-v-23225696"]]),{enableWalletSpot:CK,enableWalletFutures:PK,enableEarn:kK}=mt,TK="TIMES",MK="NO_LIMIT",LK="1",wK=$i.SPOT_DCA_DISCLAIMER_SIGNED,DK={name:"OrderDca",components:{TradingInput:Wn,Radio:UP,Checkbox:Ko,TransferIconWithTooltip:Xd,Icon:Rt,DcaConfirmationDialog:SK,TradingInputAppendSelect:hI,Tutorial:Gy,BotDisclaimerBlock:RE},props:{isBuyAction:{type:Boolean,default:!0}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},data:()=>({SPOT_DCA_PERIOD_TYPE:Cn,TRADING_TYPE:Ra,TOOLTIP_STORAGE_KEY_1:$i.TOOLTIP_SPOT_DCA1,TOOLTIP_STORAGE_KEY_2:$i.TOOLTIP_SPOT_DCA2,earnList:[],form:{orderBase:Cn.DAILY,orderDate:"1",orderWeekday:LK,orderTime:"",numberOfInvestment:"",numberOfInvestmentType:TK,investmentPerPeriod:"",isDepositIntoEarn:!1,slippage:""},isShowAdvOptions:!1,isShowConfirmDialog:!1,copyFromTradingBotId:null,isOrderFormOnRightSide:!0,showTutorial2:!1,isAlreadySignedDisclaimer:!1}),computed:{...b(["loginState","lang"]),...y(Nn,["bestAskPrice"]),...y(qe,{spotMarketCurrency:"marketCurrency",spotMarketQuoteCurrency:"marketQuoteCurrency",spotMarketQuoteCurrencyData:"marketQuoteCurrencyData",
1spotMarketCurrencyData:"marketCurrencyData",getMarketSymbolFromBaseCurrency:"getMarketSymbolFromBaseCurrency",getExchangeInfoBySymbol:"getExchangeInfoBySymbol",spotMarketSymbol:"marketSymbol",spotExchangeInfo:"exchangeInfo"}),...U(["userName","isUnifiedWallet"]),isSubDailyPeriod(){return this.form.orderBase===Cn.MINS_15||this.form.orderBase===Cn.MINS_30||this.form.orderBase===Cn.HOURLY},isShowTransfer(){return CK&&PK&&this.loginState},tutorialPlacement(){return this.isMobile?"top":this.isOrderFormOnRightSide?"left":"right"},Tutorial2WrapperComponent(){return this.showTutorial2?Gy:"div"},balanceCurrency(){return this.isBuyAction?this.spotMarketQuoteCurrencyData:this.spotMarketCurrencyData},displayCurrency(){var e;const t=this.isBuyAction?this.spotMarketQuoteCurrencyData.displayName:this.getMarketSymbolFromBaseCurrency(null==(e=this.balanceCurrency)?void 0:e.shortName);return this.convertToDisplaySymbol(t)},spotBalance(){const e=this.getExchangeInfoBySymbol(this.spotMarketSymbol),{multiplier:t}=e,i=this.balanceCurrency.available||0;return this.isBuyAction?i:S(i).div(t).toNumber()},dynamicDecimal(){const{priceDecimal:e,sizeDecimal:t}=this.spotExchangeInfo;return this.isBuyAction?e:t},formatSpotBalance(){return this.$filters.formatNumber(this.spotBalance,this.dynamicDecimal)},isOverBalance(){return S(this.spotBalance).lt(this.form.investmentPerPeriod||0)},orderFrequencyTypeList(){const e=vi(this.$t("t.min_time"));return[{id:Cn.MINS_15,lang:`15 ${e}`,fullName:`15 ${e}`},{id:Cn.MINS_30,lang:`30 ${e}`,fullName:`30 ${e}`},{id:Cn.HOURLY,isI18nKey:!0,lang:"t.hourly",fullName:"t.hourly"},{id:Cn.DAILY,isI18nKey:!0,lang:"t.daily",fullName:"t.daily"},{id:Cn.WEEKLY,isI18nKey:!0,lang:"t.weekly",fullName:"t.weekly"},{id:Cn.MONTHLY,isI18nKey:!0,lang:"t.monthly",fullName:"t.monthly"}]},weekdayTypeList(){const e=Re(new Date,0);return[...Array(7)].map(((t,i)=>{const r=Hr[this.lang](xe(e,i),"eeee");return{id:String(i),isI18nKey:!1,lang:r,fullName:r}}))},dateTypeList(){const e=_e(Ae(new Date,0));return[...Array(28)].map(((t,i)=>{const r=Hr[this.lang](xe(e,i),"do");return{id:String(i+1),isI18nKey:!1,lang:r,fullName:r}}))},investmentTimeTypeList:()=>[{id:TK,isI18nKey:!0,lang:"t.times",fullName:"t.times"},{id:MK,isI18nKey:!0,lang:"t.continuously",fullName:"t.continuously"}],isInvestmentTypeNoLimit(){return this.form.numberOfInvestmentType===MK},earnCurrency(){return this.isBuyAction?this.spotMarketCurrency:this.spotMarketQuoteCurrency},earnRate(){const e=this.earnList.find((e=>e.currency===this.earnCurrency));return(null==e?void 0:e.rate)||""},totalInvestment(){const{numberOfInvestment:e,investmentPerPeriod:t}=this.form,i=S(e||0).times(t||0).toNumber();return this.$filters.formatNumber(i,this.dynamicDecimal)},totalInvestmentText(){return this.form.numberOfInvestmentType===MK?this.$t("trading.spot.dca.totalInvestment",{amount:this.$t("t.continuously"),currency:""}):this.$t("trading.spot.dca.totalInvestment",{amount:`â¦${this.totalInvestment} ${this.displayCurrency}â©`,currency:""})},minInvestment(){const{minOrderSize:e,minPriceIncrement:t}=this.spotExchangeInfo,i=S(e).times(10);if(this.isBuyAction){const e=this.bestAskPrice||0;return S.max(S(e).times(i),t).dp(this.dynamicDecimal,S.ROUND_UP).toNumber()}return i.dp(this.dynamicDecimal,S.ROUND_UP).toNumber()},errorShownInvestmentPerPeriod(){return!this.isOverBalance&&(""!==this.form.investmentPerPeriod&&this.form.investmentPerPeriod<this.minInvestment)},errorShownSlippage(){return""!==this.form.slippage&&(this.form.slippage<.1||this.form.slippage>100)},createBtnDisabled(){const{numberOfInvestment:e,numberOfInvestmentType:t,investmentPerPeriod:i,orderTime:r}=this.form,a=t===TK&&""===e,n=!this.isSubDailyPeriod&&""===r;return!this.loginState||!this.isAlreadySignedDisclaimer||n||""===i||a||this.errorShownInvestmentPerPeriod||this.isOverBalance||this.errorShownSlippage},nextOrderTime(){const{orderBase:e,orderWeekday:t,orderDate:i,orderTime:r=0}=this.form,a=new Date;let n=new Date;if(n.setHours(r),e===Cn.WEEKLY&&n.setDate(n.getDate()+(t-n.getDay())),e===Cn.MONTHLY){const e=i>=1&&i<=28?i:(i%28+28)%28+1;n.setDate(e)}if(De(n,a))return n;switch(e){case Cn.DAILY:n=xe(n,1);break;case Cn.WEEKLY:n=Ie(n,1);break;case Cn.MONTHLY:n=Oe(n,1)}return n},cycleText(){const{orderBase:e,orderWeekday:t,orderDate:i}=this.form;let r="",a="",n="";switch(e){case Cn.MINS_15:r=`15 ${this.$t("t.min_time")}`;break;case Cn.MINS_30:r=`30 ${this.$t("t.min_time")}`;break;case Cn.HOURLY:r=this.$t("t.hour_time");break;case Cn.DAILY:r=this.$t("t.daily");break;case Cn.WEEKLY:a=this.weekdayTypeList.find((e=>e.id===t)),r=`${this.$t("t.weekly")}(${null==a?void 0:a.lang})`;break;case Cn.MONTHLY:n=this.dateTypeList.find((e=>e.id===i)),r=`${this.$t("t.monthly")}(${null==n?void 0:n.lang})`}return r},firstDcaText(){if(!this.form.orderTime)return"";if(this.isSubDailyPeriod)return"";const e=Le(this.nextOrderTime),t=we(this.nextOrderTime);let i=e?"":`(${t?this.$t("t.tomorrow"):Hr[this.lang](this.nextOrderTime,"MMM d")})`;return this.$t("trading.spot.dca.firstDcaHint",{cycle:i,localTime:`0${this.form.orderTime}`.slice(-2)+":00"})}},watch:{isInvestmentTypeNoLimit(e){e&&(this.form.numberOfInvestment="")},isBuyAction(){this.form.investmentPerPeriod=""},earnRate(){this.form.isDepositIntoEarn=!1},userName(){this.checkSignedStatus()}},created(){this.initFormFromParams(),this.checkTradingPageUI(),this.checkSignedStatus()},mounted(){this.getEarnList()},methods:{...v(["messageCustom"]),...f(Vn,["toggleTransferPopup"]),...v("trading",["beforeSpotTradingBehaviorFn"]),async handleCreateDcaBot(){await this.beforeSpotTradingBehaviorFn({appContext:this._.a
1ppContext,tradeBehavior:this.isBuyAction?Zt.CLICK_CREATE_DCA_BUY_BTN:Zt.CLICK_CREATE_DCA_SELL_BTN})&&(this.isShowConfirmDialog=!0)},openWalletTransferPopup(){var e;this.toggleTransferPopup({from:this.isUnifiedWallet?ti:xi,to:ii,showTopUpOptions:!0,currency:null==(e=this.balanceCurrency)?void 0:e.shortName})},initFormFromParams(){var e,t;const{tradingBot:i,copyFromTradingBotId:r}=this.$route.params;if(!i||!i.config)return;r&&(this.copyFromTradingBotId=r);const{config:a}=i,n={hour:(null==(e=a.cycle)?void 0:e.executeAt)||0,timezone:-(new Date).getTimezoneOffset()/60};void 0!==a.cycle.weekday&&(n.day=a.cycle.weekday),a.cycle.date&&(n.date=a.cycle.date);const o=Tn(n,!1);this.form.orderBase=(null==(t=a.cycle)?void 0:t.period)||"",this.form.orderTime=o.getHours(),this.form.isDepositIntoEarn=a.flexibleEarn||!1,this.form.investmentPerPeriod=a.investmentPerPeriod||"",this.form.numberOfInvestment=a.numberOfInvestment||"",this.form.numberOfInvestmentType=a.numberOfInvestment?TK:MK,this.form.slippage=a.slippage||"",this.form.orderWeekday=a.cycle.weekday?String(o.getDay()):"0",this.form.orderDate=a.cycle.date?String(o.getDate()):"1"},async getEarnList(){if(kK)try{const e=await rs();this.earnList=e.filter((({type:e})=>e===kn.FLEXIBLE))}catch{this.earnList=[]}},async createBot(){const e=`[${this.convertToDisplaySymbol(this.spotMarketSymbol).split("-").join("/")}]`;try{const{orderBase:t,orderTime:i,orderWeekday:r,investmentPerPeriod:a,numberOfInvestment:n,isDepositIntoEarn:o,slippage:s,orderDate:l}=this.form,u={period:t,timezoneOffsetInMin:this.isSubDailyPeriod?0:-(new Date).getTimezoneOffset(),...!this.isSubDailyPeriod&&{executeAt:Number(i)},...t===Cn.WEEKLY&&{weekday:Number(r)},...t===Cn.MONTHLY&&{date:Number(l)}},c={symbol:this.spotMarketCurrency,marketType:Ra.SPOT,botType:Pn.DCA,config:{tradingDirection:this.isBuyAction?"LONG":"SHORT",cycle:u,investmentPerPeriod:a,numberOfInvestment:Number(n)||null,flexibleEarn:o,slippage:s||null},quoteCurrency:this.spotMarketQuoteCurrency};this.copyFromTradingBotId&&(c.copyFromTradingBotId=this.copyFromTradingBotId),await Cr.createBot(c).then((()=>{this.$sendEvent(Kr.EVENT_WEB_TRADING_BOT_DCA_BOT_CREATE_SUBMITTED,{payload:c,errorCode:null})})).catch((e=>{this.$sendEvent(Kr.EVENT_WEB_TRADING_BOT_DCA_BOT_CREATE_SUBMITTED,{payload:c,errorCode:e.code})})),this.messageCustom({subTitle:e,title:this.$t("trading.spot.dca.createBot.success"),success:!0}),this.resetForm()}catch({code:t}){if(t===Pr.USER_PERMISSION_DENIED){const e=`response-code.${t}`;return void this.messageCustom({title:this.$t(e),subTitle:"",body:"",error:!0})}this.messageCustom({subTitle:e,title:this.$t("trading.spot.dca.createBot.fail"),body:this.$t("trading.spot.dca.createBot.fail.message"),error:!0})}},resetForm(){this.form.orderBase=Cn.DAILY,this.form.orderDate="1",this.form.orderWeekday=LK,this.form.orderTime="",this.form.numberOfInvestment="",this.form.numberOfInvestmentType=TK,this.form.investmentPerPeriod="",this.form.isDepositIntoEarn=!1,this.form.slippage=""},checkTradingPageUI(){var e;const{x:t}=(null==(e=document.querySelector(".vue-grid-item .order-form-block"))?void 0:e.getBoundingClientRect())||{};t<=300&&(this.isOrderFormOnRightSide=!1)},handleClickGot1(){this.showTutorial2=!0},checkSignedStatus(){this.isAlreadySignedDisclaimer=zi(wK)},handleSign(){Bi(wK),this.isAlreadySignedDisclaimer=!0}}},OK={class:"spot-form-container"},IK={class:"top-content"},xK={class:"flex-box items-center justify-between"},_K={class:"title"},AK={class:"decimal-list"},RK={class:"flex-box items-center justify-between inventment"},FK={class:"title"},EK={class:"avbl"},BK={class:"label"},zK={class:"value"},$K={class:"hint m-8"},NK={key:0,class:"hint m-8 warning"},UK={class:"currency-info"},HK={class:"currency-info__text"},VK={class:"adv-area"},WK={class:"adv-wrapper"},qK={key:0,class:"adv-settings"},GK={class:"hint-block mt-4"};const KK=$n(DK,[["render",function(e,t,i,r,u,g){const f=a("TradingInputAppendSelect"),v=a("TradingInput"),y=a("Tutorial"),b=a("TransferIconWithTooltip"),S=a("Icon"),P=a("Tooltip"),k=a("Checkbox"),T=a("BaseButton"),M=a("BotDisclaimerBlock"),L=a("DcaConfirmationDialog");return o(),c("div",OK,[l("div",IK,[d(y,{title:e.$t("trading.spot.dca.tooltip1.title"),mask:"",placement:g.tutorialPlacement,storageKey:u.TOOLTIP_STORAGE_KEY_1,onGotIt:g.handleClickGot1},{tooltip:s((()=>[l("p",null,m(e.$t("trading.spot.dca.tooltip1.des")),1)])),default:s((()=>[l("div",null,[l("div",xK,[l("div",_K,m(e.$t("trading.spot.dca.recurringPeriod")),1)]),d(v,{label:"orderBase",disabled:""},{prepend:s((()=>[p(m(e.$t("trading.spot.dca.orderBaseOnEvery")),1)])),append:s((()=>[d(f,{value:u.form.orderBase,"onUpdate:value":t[0]||(t[0]=e=>u.form.orderBase=e),typeList:g.orderFrequencyTypeList},null,8,["value","typeList"])])),_:1}),u.form.orderBase===u.SPOT_DCA_PERIOD_TYPE.MONTHLY?(o(),n(v,{key:0,label:"orderDate",disabled:""},{prepend:s((()=>
1[p(m(e.$t("trading.spot.dca.dateOfTheMonth")),1)])),append:s((()=>[d(f,{value:u.form.orderDate,"onUpdate:value":t[1]||(t[1]=e=>u.form.orderDate=e),typeList:g.dateTypeList},null,8,["value","typeList"])])),_:1})):h("",!0),u.form.orderBase===u.SPOT_DCA_PERIOD_TYPE.WEEKLY?(o(),n(v,{key:1,label:"orderWeekday",disabled:""},{prepend:s((()=>[p(m(e.$t("trading.spot.dca.orderWeekday")),1)])),append:s((()=>[d(f,{value:u.form.orderWeekday,"onUpdate:value":t[2]||(t[2]=e=>u.form.orderWeekday=e),typeList:g.weekdayTypeList},null,8,["value","typeList"])])),_:1})):h("",!0),g.isSubDailyPeriod?h("",!0):(o(),n(v,{key:2,value:u.form.orderTime,"onUpdate:value":t[3]||(t[3]=e=>u.form.orderTime=e),label:"orderTime",type:"number",placeholder:"01",min:0,max:23,maxDecimalPlaces:0},{prepend:s((()=>[p(m(e.$t("trading.spot.dca.orderTime")),1)])),append:s((()=>t[11]||(t[11]=[p(": 00")]))),_:1},8,["value"]))])])),_:1},8,["title","placement","storageKey","onGotIt"]),(o(),n(F(g.Tutorial2WrapperComponent),{placement:g.tutorialPlacement,storageKey:u.TOOLTIP_STORAGE_KEY_2,mask:"",title:u.showTutorial2?e.$t("trading.spot.dca.tooltip2.title"):"",buttonText:e.$t("trading.bot.getStart")},{tooltip:s((()=>[l("ul",AK,[l("li",null,m(e.$t("trading.spot.dca.tooltip2.des1")),1),l("li",null,m(e.$t("trading.spot.dca.tooltip2.des2")),1)])])),default:s((()=>[l("div",null,[l("div",RK,[l("div",FK,m(e.$t("trading.bot.investment")),1),l("div",EK,[l("div",BK,m(e.$t("trading.bot.avbl"))+":",1),l("div",zK,m(g.formatSpotBalance)+" "+m(g.displayCurrency),1),g.isShowTransfer?(o(),n(b,{key:0,onTransferClick:g.openWalletTransferPopup},null,8,["onTransferClick"])):h("",!0)])]),d(v,{value:u.form.numberOfInvestment,"onUpdate:value":t[5]||(t[5]=e=>u.form.numberOfInvestment=e),label:"numberOfInvestment",enableThousandSeparator:"",placeholder:g.isInvestmentTypeNoLimit?"":"â¥1",disabled:g.isInvestmentTypeNoLimit,maxDecimalPlaces:0,step:1,min:1},{prepend:s((()=>[p(m(e.$t("trading.spot.dca.noOfInvestment")),1)])),append:s((()=>[d(f,{value:u.form.numberOfInvestmentType,"onUpdate:value":t[4]||(t[4]=e=>u.form.numberOfInvestmentType=e),typeList:g.investmentTimeTypeList},null,8,["value","typeList"])])),_:1},8,["value","placeholder","disabled"]),d(v,{value:u.form.investmentPerPeriod,"onUpdate:value":t[6]||(t[6]=e=>u.form.investmentPerPeriod=e),label:"investmentPerPeriod",enableThousandSeparator:"",placeholder:`â¥${g.minInvestment}`,min:0,step:i.isBuyAction?Number(e.spotExchangeInfo.minPriceIncrement):Number(e.spotExchangeInfo.minSizeIncrement),errorShown:g.errorShownInvestmentPerPeriod},{prepend:s((()=>[p(m(e.$t("trading.spot.dca.investmentPerPeriod")),1)])),append:s((()=>[p(m(g.displayCurrency),1)])),errorMsg:s((()=>[p(m(g.errorShownInvestmentPerPeriod?e.$t("trading.spot.dca.investmentWarning",{currency:g.displayCurrency,amount:g.minInvestment}):""),1)])),_:1},8,["value","placeholder","step","errorShown"]),l("div",$K,m(g.totalInvestmentText),1)])])),_:1},8,["placement","storageKey","title","buttonText"])),g.isOverBalance?(o(),c("div",NK,m(e.$t("trading.spot.dca.avblWarning")),1)):h("",!0),g.earnRate?(o(),n(k,{key:1,value:u.form.isDepositIntoEarn,"onUpdate:value":t[7]||(t[7]=e=>u.form.isDepositIntoEarn=e),class:"form-checkbox",name:"is-deposit-into-earn"},{default:s((()=>[d(P,null,{content:s((()=>[l("div",null,[p(m(i.isBuyAction?e.$t("trading.spot.dca.deposit.buying"):e.$t("trading.spot.dca.deposit.selling"))+" ",1),t[12]||(t[12]=l("br",null,null,-1)),p(" "+m(e.$t("earn.yesterdayApy"))+": ",1),l("div",UK,[d(S,{name:g.earnCurrency,showName:!1,size:"12"},null,8,["name"]),l("span",HK,m(g.earnCurrency)+" "+m(g.earnRate)+"% ",1)])])])),tooltip:s((()=>[l("p",null,m(e.$t("trading.spot.dca.deposit.tip")),1)])),_:1})])),_:1},8,["value"])):h("",!0),l("div",VK,[l("div",WK,[l("div",{class:"btn",onClick:t[8]||(t[8]=e=>u.isShowAdvOptions=!u.isShowAdvOptions)},m(u.isShowAdvOptions?e.$t("t.hideAdvSettings"):e.$t("t.showAdvSettings")),1)]),u.isShowAdvOptions?(o(),c("div",qK,[d(v,{value:u.form.slippage,"onUpdate:value":t[9]||(t[9]=e=>u.form.slippage=e),label:"slippage",placeholder:"0.1-99.9",type:"number",max:99.9,min:.1,step:.1,maxDecimalPlaces:1,errorShown:g.errorShownSlippage},{prepend:s((()=>[d(P,{content:e.$t("t.slippage")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.spot.dca.slippage.tip")),1)])),_:1},8,["content"])])),append:s((()=>t[13]||(t[13]=[p("%")]))),_:1},8,["value","errorShown"]),l("div",GK,m(e.$t("t.notice"))+": "+m(e.$t("trading.spot.dca.slippageWarning")),1),t[14]||(t[14]=l("div",{class:"dotted-line"},null,-1))])):h("",!0)]),d(T,{type:"confirm",class:C(["block create-btn",i.isBuyAction?"green":"red"]),disabled:g.createBtnDisabled,onClick:g.handleCreateDcaBot},{default:s((()=>[p(m(e.$t("trading.spot.dca.createDcaBot"))+" ("+m(i.isBuyAction?e.$t("t.buy"):e.$t("t.sell"))+") ",1)])),_:1},8,["class","disabled","onClick"]),B(l("div",{class:"hint-block"},m(g.firstDcaText),513),[[N,u.form.orderTime&&!g.isSubDailyPeriod]]),e.loginState&&!u.isAlreadySignedDisclaimer?(o(),n(M,{key:2,class:"mt-16",marketType:u.TRADING_TYPE.SPOT,onConfirm:g.handleSign},null,8,["marketType","onConfirm"])):h("",!0)]),u.isShowConfirmDialog?(
1o(),n(L,{key:0,show:u.isShowConfirmDialog,"onUpdate:show":t[10]||(t[10]=e=>u.isShowConfirmDialog=e),form:u.form,totalInvestment:g.totalInvestment,currency:g.displayCurrency,cycle:g.cycleText,isBuyAction:i.isBuyAction,onConfirm:g.createBot},null,8,["show","form","totalInvestment","currency","cycle","isBuyAction","onConfirm"])):h("",!0)])}],["__scopeId","data-v-c63320a9"]]),QK={class:"tif-text"},jK={__name:"RandomizeSizeCheckbox",props:{value:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=ts();D((()=>r.orderFormSettings),(({randomizeSize:e})=>{i("update:value",e)})),L((()=>{i("update:value",r.orderFormSettings.randomizeSize)}));const u=ea((async e=>{await r.updateOrderFormSettings({randomizeSize:e})}),500);return(t,i)=>{const r=a("ToolTip"),c=a("Checkbox");return o(),n(c,{value:e.value,name:"randomizeSize",onInput:x(u)},{default:s((()=>[d(r,{tooltip:t.$t("trading.twap.input.hint.randomizeSize")},{content:s((()=>[l("span",QK,m(t.$t("trading.twap.randomizeSize")),1)])),_:1},8,["tooltip"])])),_:1},8,["value","onInput"])}}},YK={class:"tif-text"},ZK={__name:"MakerFirstCheckbox",props:{value:{type:Boolean,default:!1}},emits:["update:value"],setup(e,{emit:t}){const i=t,r=ts();D((()=>r.orderFormSettings),(({makerFirst:e})=>{i("update:value",e)})),L((()=>{i("update:value",r.orderFormSettings.makerFirst)}));const u=ea((async e=>{await r.updateOrderFormSettings({makerFirst:e})}),500);return(t,i)=>{const r=a("ToolTip"),c=a("Checkbox");return o(),n(c,{value:e.value,name:"makerFirst",onInput:x(u)},{default:s((()=>[d(r,{tooltip:t.$t("trading.twap.input.hint.makerFirst")},{content:s((()=>[l("span",YK,m(t.$t("trading.twap.makerFirst")),1)])),_:1},8,["tooltip"])])),_:1},8,["value","onInput"])}}},{enableLastPriceDependentUI:XK}=zt,JK={size:"",percent:0,total:"",hr:"",min:"",maxSpread:"",maxIndividualOrderSize:"",maxDistanceThroughBook:"",pausePrice:"",randomizeSize:!1,makerFirst:!1,activationPriceChecked:!1,activationPrice:"",activationPriceType:is},eQ={name:"TWAP",components:{EstimatedSymbol:yq,TradeSlider:po,Balance:hq,TwapReminderDialog:iE,MobilePeriodInput:qF,Tutorial:Gy,EstimatedHintBlock:Cq,AdvancedOptionsBtn:QF,TradingInput:Wn,MarketHintTooltip:qc,RandomizeSizeCheckbox:jK,MakerFirstCheckbox:ZK,ActivationPriceCheckbox:BT,ActivationPriceInput:NT},props:{isBuyAction:{type:Boolean,required:!0},infoStp:{type:String,required:!0}},emits:["onAdvancedToggle"],setup(){const{convertToDisplaySymbol:e}=Je(),{showIdVerificationRequiredDialog:t}=hs(),{checkPriceProtection:i}=xI();return{convertToDisplaySymbol:e,showIdVerificationRequiredDialog:t,checkPriceProtection:i,SPOT_TRIGGER_PRICE_TYPE:_r}},data:()=>({twapTutorialImg:rE,loading:!1,showAdvancedOptions:!1,showReminderDialog:!1,form:{...JK},isInputSizeError:!1,isInputTotalError:!1,isOrderFormOnRightSide:!0,tutorialStorageKey:$i.TRADING_SPOT_TWAP_TUTORIAL,estimatedHintKey:$i.TRADING_ESTIMATED_HINT_TWAP,enableLastPriceDependentUI:XK}),computed:{...b(["loginState"]),...b("orderBook",["lastPrice"]),...y(Nn,["orderBook","bestAskPrice"]),...y(ts,["rememberSpotOrderSize","orderFormSettings"]),...y(dt,{spotIndexPrice:"currentMarketIndexPrice"}),...U(["userName"]),...y(qe,["exchangeInfo","marketCurrencyData","marketQuoteCurrency","marketQuoteCurrencyData","marketSymbol","marketData","getMarketSymbolFromBaseCurrency","getBalanceByOrderAction"]),displayMarketName(){return this.convertToDisplaySymbol(this.marketData.symbol)},balance(){return this.getBalanceByOrderAction(this.isBuyAction?"buy":"sell")},tradingSizeInfo(){return{title:this.isBuyAction?this.$t("trading.buySell.estSize"):this.$t("t.size"),step:this.exchangeInfo.minSizeIncrement,min:this.exchangeInfo.minOrderSize,currency:this.marketCurrencyData.displayName}},tradingPriceInfo(){return{title:this.$t(this.isBuyAction?"trading.buySell.totalPrice":"trading.buySell.estTotal"),step:this.exchangeInfo.minPriceIncrement,min:this.exchangeInfo.minValidPrice,currency:this.marketQuoteCurrencyData.displayName}},convertedCurrency(){return this.isBuyAction?this.tradingSizeInfo.currency:this.tradingPriceInfo.currency},targetCurrency(){return this.isBuyAction?this.tradingPriceInfo.currency:this.tradingSizeInfo.currency},minTotal(){if(void 0===this.exchangeInfo.minOrderSize)return 0;const e=S.ROUND_UP,t=Number(S(this.exchangeInfo.minOrderSize).times(this.spotIndexPrice).toFixed(this.exchangeInfo.priceDecimal,e)),i=Number(this.exchangeInfo.minValidPrice);return t>i?t:i},showAdvancedOptionsHint(){const{maxSpread:e,maxIndividualOrderSize:t,maxDistanceThroughBook:i,pausePrice:r}=this.form;return""!==e|""!==t|""!==i|""!==r},IndividualOrderSizeInfo(){return this.isBuyAction?{placeholder:this.minTotal,currency:this.tradingPriceInfo.currency,step:this.tradingPriceInfo.step,min:this.minTotal}:{placeholder:this.tradingSizeInfo.min,currency:this.tradingSizeInfo.currency,step:this.tradingSizeInfo.step,min:this.tradingSizeInfo.min}},isInputMaxIndividualOrderSizeError(){return""!==this.form.maxIndividualOrderSize&&this.form.maxIndividualOrderSize<this.IndividualOrderSizeInfo.min},isMaxIndividualOrderSizeWarning(){const{size:e,total:t,maxIndividualOrderSize:i}=this.form,r=this.isBuyAction?this.exchangeInfo.minValidPrice:this.exchangeInfo.minOrderSize,a=this.isBuyAction?t:e,n=r*this.timePeriod/a,o=n%15==0?n:15*Math.ceil(n/15),s=Math.ceil(this.timePeriod/o);return""!==i&&i<a/s},isInputPausePriceError(){return""!==this.form.pausePrice&&this.form.pausePrice<this.exchangeInfo.minPriceIncrement},timePeriod(){return 60*(60*this.form.hr+this.form.min)},disabledSubmit(){const e=this.balance,t=this.isBuyAction?this.form.total:this.form.size,i=this.isBuyAction?this.isInputTotalError:this.isInputSizeError;return!e||""===t||t>e||i||0===this.timePeriod||this.isInputMaxIndividualOrderSizeError||this.isInputPausePriceError||this.isActivationPriceEmpty},tutorialPlacement(){return this.isMobile?"bottom":this.isOrderFormOnRightSide?"left"
1:"right"},activationPriceChecked(){return this.orderFormSettings.enableActivationPrice},activationPriceType(){return this.orderFormSettings.activationPriceTriggerOn},isActivationPriceEnabled(){return this.activationPriceChecked&&this.form.activationPrice},isActivationPriceEmpty(){return this.activationPriceChecked&&""===this.form.activationPrice}},watch:{"form.size":{handler:function(e){this.loginState&&""!==e?this.checkSizeValid():this.isInputSizeError=!1}},"form.total":{handler:function(e){this.loginState&&""!==e?(this.autoPercent(),this.checkTotalValid()):this.isInputTotalError=!1}},"form.activationPrice":{handler:function(){this.calculateSizeAndTotal()}},activationPriceChecked:{handler:function(){this.calculateSizeAndTotal()}},isBuyAction:{handler(e){e?(this.isInputSizeError=!1,this.checkTotalValid()):(this.isInputTotalError=!1,this.checkSizeValid())}},showAdvancedOptions(e){this.$emit("onAdvancedToggle",e)},"orderFormSettings.activationPriceTriggerOn":{handler(e){this.form.activationPriceType=e},immediate:!0}},created(){this.checkTradingPageUI()},methods:{...v("trading",["beforeSpotTradingBehaviorFn"]),handleActivationPriceCheckboxChange(e){ts().updateOrderFormSettings({enableActivationPrice:e})},handleActivationPriceTypeChange(e){ts().updateOrderFormSettings({activationPriceTriggerOn:e})},keyupEnter(){},handleInputSize(){this.autoTotal()},handleInputTotal(){this.autoSize()},handleInputHr(e){const t=e.target.value;if(""!==t){if(!(t<0))return t>=24?(this.form.hr=24,void(this.form.min="")):void(Number.isInteger(t)||(this.form.hr=Math.round(t)));this.form.hr=0}},handleInputMin(e){const t=e.target.value;""!==t&&(t<0?this.form.min=0:(24===this.form.hr&&(this.form.hr=23),t>59?this.form.min=59:Number.isInteger(t)||(this.form.min=Math.round(t))))},handlePercentChange(e){e=S(e).div(100),this.isBuyAction?(this.form.total=S(this.balance).times(e).toFixed(this.exchangeInfo.priceDecimal,S.ROUND_DOWN),this.autoSize()):(this.form.size=S(this.balance).times(e).toFixed(this.exchangeInfo.sizeDecimal,S.ROUND_DOWN),this.autoTotal())},checkTotalValid(){const{total:e}=this.form;this.isInputTotalError=""!==e&&e<this.minTotal},checkSizeValid(){const{size:e}=this.form;this.isInputSizeError=""!==e&&e<this.tradingSizeInfo.min},autoSize(){const{total:e}=this.form;if(!e)return void(this.form.size="");const t=(this.isActivationPriceEnabled?this.form.activationPrice:this.bestAskPrice)||0;this.form.size=t>0?Number(S(e).div(t).toFixed(this.exchangeInfo.sizeDecimal,S.ROUND_DOWN)):0},autoTotal(){const{size:e}=this.form;if(!e||!this.balance)return void(this.form.total="");if(this.isActivationPriceEnabled){const t=this.isBuyAction?S.ROUND_DOWN:S.ROUND_UP;return void(this.form.total=Number(S(this.form.activationPrice).times(e).toFixed(this.exchangeInfo.priceDecimal,t)))}const t=this.orderBook.bids,i=t?t.findIndex((t=>t.total>=e)):-1;if(-1===i)return void(this.form.total=this.spotIndexPrice>0?Number(S(this.spotIndexPrice).times(e).toFixed(this.exchangeInfo.priceDecimal,S.ROUND_DOWN)):0);if(0===i)return void(this.form.total=e>0?Number(S(e).times(t[0].price).toFixed(this.exchangeInfo.priceDecimal,S.ROUND_DOWN)):0);const r=i-1,a=t.slice(0,i).reduce(((e,t)=>S(t.size).times(t.price).plus(e)),0),n=S(e).minus(t[r].total).times(t[i].price),o=a.plus(n);this.form.total=Number(o.toFixed(this.exchangeInfo.priceDecimal,S.ROUND_DOWN))},autoPercent(){const e=this.isBuyAction?this.form.total:this.form.size;this.form.percent=Math.round(S(e).div(this.balance||1).times(100).toNumber())},closeDialog(){this.showReminderDialog=!1},async checkSubmit(){if(this.showIdVerificationRequiredDialog(Jr.TRADING_SPOT.BUY))return;if(!(await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:this.isBuyAction?Zt.CLICK_BUY_ORDER_BTN:Zt.CLICK_SELL_ORDER_BTN})))return;const e=await this.checkPriceProtection({isSpot:!0,isBuyAction:this.isBuyAction,symbol:this.marketData.symbol,maxDistanceThroughBook:this.form.maxDistanceThroughBook,tradingType:ni.TWAP});if(!e.ok)return;e.maxDistanceThroughBook&&(this.form.maxDistanceThroughBook=e.maxDistanceThroughBook);const{maxDistanceThroughBook:t,pausePrice:i}=this.form;
1t||i?this.showReminderDialog=!0:this.submitForm()},async submitForm(){this.loading=!0;const e={type:"TWAP",infoStp:this.infoStp,side:this.isBuyAction?"BUY":"SELL",size:this.isBuyAction?Number(this.form.total):Number(this.form.size),symbol:this.marketSymbol,timePeriod:this.timePeriod,makerFirst:this.form.makerFirst,randomizeSize:this.form.randomizeSize,maxSpread:this.form.maxSpread/100,maxDistanceThroughBook:this.form.maxDistanceThroughBook/100,pausePrice:Number(this.form.pausePrice)||"",subTwapMaxOrderSize:Number(this.form.maxIndividualOrderSize)||"",...this.activationPriceChecked&&{activationPrice:this.form.activationPrice,activationPriceType:this.form.activationPriceType}},t=Object.entries(e).reduce(((e,[t,i])=>i?(e[t]=i,e):e),{});try{await Jt.submitTwapOrder(t),this.resetFormAfterSubmit()}finally{this.loading=!1}},resetFormAfterSubmit(){this.rememberSpotOrderSize||(this.form.size="",this.form.total="",this.form.percent=0,this.form.activationPrice="")},checkTradingPageUI(){var e;const{x:t}=(null==(e=document.querySelector(".order-form-block .order-form"))?void 0:e.getBoundingClientRect())||{};void 0!==t&&t<=300&&(this.isOrderFormOnRightSide=!1)},calculateSizeAndTotal(){this.form.total?this.autoSize():this.form.size&&this.autoTotal()}}},tQ={class:"spot-form-container"},iQ=["src"],rQ={key:1,class:"input--container"},aQ={class:"flex-box items-center justify-between flex-wrap"},nQ={class:"tooltip-title-wrapper"},oQ={class:"flex-box ml-8"},sQ={class:"margin-auto input-label"},lQ={class:"margin-auto input-label"},uQ={class:"flex-center-center inner-ml-4 hr-btn-content"},cQ={class:"postOnly"},dQ={class:"options-content"},pQ={class:"__form_item"},hQ={key:0,class:"advanced-option-hint"};const mQ=$n(eQ,[["render",function(e,t,i,r,u,g){const f=a("Tooltip"),v=a("EstimatedSymbol"),y=a("MarketHintTooltip"),b=a("TradingInput"),S=a("TradeSlider"),P=a("MobilePeriodInput"),k=a("Tutorial"),T=a("EstimatedHintBlock"),M=a("RandomizeSizeCheckbox"),L=a("MakerFirstCheckbox"),w=a("ActivationPriceCheckbox"),D=a("ActivationPriceInput"),O=a("AdvancedOptionsBtn"),I=a("Balance"),x=a("BrandButton"),_=a("TwapReminderDialog"),A=H("brand-number-onkeypress");return o(),c("div",tQ,[l("div",null,[d(k,{mask:"",closeOnMaskClicked:"",storageKey:u.tutorialStorageKey,buttonText:e.$t("trading.twap.tutorial.buttonText"),placement:g.tutorialPlacement,title:e.$t("trading.buySell.title.twap")},{tooltip:s((()=>[l("img",{class:"tutorial-img",alt:"twap tutorial",src:u.twapTutorialImg},null,8,iQ),l("div",null,[p(m(e.$t("trading.twap.tutorial.tip1"))+" ",1),t[22]||(t[22]=l("br",null,null,-1)),t[23]||(t[23]=l("br",null,null,-1)),p(" "+m(e.$t("trading.twap.tutorial.tip2"))+" ",1),t[24]||(t[24]=l("br",null,null,-1)),t[25]||(t[25]=l("br",null,null,-1)),p(" "+m(e.$t("trading.twap.tutorial.tip3")),1)])])),default:s((()=>[l("div",null,[d(b,{value:u.form.size,"onUpdate:value":t[0]||(t[0]=e=>u.form.size=e),label:"size",enableThousandSeparator:"",step:Number(g.tradingSizeInfo.step),min:Number(g.tradingSizeInfo.min),placeholder:g.tradingSizeInfo.min,errorShown:u.isInputSizeError,errorContent:e.$t("trading.twap.input.error.size",{min:g.tradingSizeInfo.min,currency:r.convertToDisplaySymbol(g.tradingSizeInfo.currency)}),onInput:g.handleInputSize},{prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("t.size")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.size")),1)])),_:1},8,["content"]),B(d(v,{inSymbol:g.convertedCurrency,toSymbol:g.targetCurrency},null,8,["inSymbol","toSymbol"]),[[N,i.isBuyAction]])])),append:s((()=>[d(y,null,{default:s((()=>[p(m(g.displayMarketName),1)])),_:1})])),_:1},8,["value","step","min","placeholder","errorShown","errorContent","onInput"]),d(S,{value:u.form.percent,"onUpdate:value":t[1]||(t[1]=e=>u.form.percent=e),disabled:!e.loginState,onChange:g.handlePercentChange},null,8,["value","disabled","onChange"]),d(b,{value:u.form.total,"onUpdate:value":t[2]||(t[2]=e=>u.form.total=e),label:"total",enableThousandSeparator:"",step:Number(g.tradingPriceInfo.step),min:Number(g.tradingPriceInfo.min),placeholder:g.minTotal,errorShown:u.isInputTotalError,errorContent:e.$t("trading.twap.input.error.total",{min:g.minTotal,currency:r.convertToDisplaySymbol(g.tradingPriceInfo.currency)}),onInput:g.handleInputTotal},{prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("trading.buySell.total")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.size")),1)])),_:1},8,["content"]),B(d(v,{inSymbol:g.convertedCurrency,toSymbol:g.targetCurrency},null,8,["inSymbol","toSymbol"]),[[N,!i.isBuyAction]])])),append:s((()=>[p(m(r.convertToDisplaySymbol(g.tradingPriceInfo.currency)),1)])),_:1},8,["value","step","min","placeholder","errorShown","errorContent","onInput"]),e.isMobile?(o(),n(P,{key:0,"input-hr":u.form.hr,"input-min":u.form.min,onInputHr:t[3]||(t[3]=e=>u.form.hr=e),onInputMin:t[4]||(t[4]=e=>u.form.min=e)},null,8,["input-hr","input-min"])):(o(),c("div",rQ,[l("div",aQ,[l("div",nQ,[d(f,{class:"_index_title",content:e.$t("t.period")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.period")),1)])),_:1},8,["content"])]),l("div",oQ,[B(l("input",{ref:"inputFocus","onUpdate:modelValue":t[5]||(t[5]=e=>u.form.hr=e),type:"number",class:C(["border-none tx-align--right input input-period",{"xs-font-size":!1}]),placeholder:"0-24",pattern:"\\d*",step:1,max:24,min:0,onInput:t[6]||(t[6]=(...e)=>g.handleInputHr&&g.handleInputHr(...e)),onKeyup:t[7]||(t[7]=$(((...e)=>g.keyupEnter&&g.keyupEnter(...e)),["enter"]))},null,544),[[z,u.form.hr],[A]]),l("span",sQ,m(e.$t("t.hr_s")),1),B(l("input",{ref:"inputFocus","onUpdate:modelValue":t[8]||(t[8]=e=>u.form.min=e),type:"number",class:C(["border-none tx-align--right input input-period",{"xs-font-size":!1}]),placeholder:"1-59",step:1,max:59,min:1,onInput:t[9]||(t[9]=(...e)=>g.handleInputMin&&g.handleInputMin(...e)),onKeyup:t[10]||(t[10]=$(((...e)=>g.keyupEnter&&g.keyupEnter(...e)),["enter"]))},null,544),[[z,u.form.min],[A]]),l("span",lQ,m(e.$t("t.min_s")),1)])]),l("div",uQ,[l("div",{class:"hr-btn",onClick:t[11]||(t[11]=e=>u.form.hr=1)},"1 Hr"),l("div",{class:"hr-btn",onClick:t[12]||(t[12]=e=>u.form.hr=12)},"12 Hr"),l("div",{class:"hr-btn",onClick:t[13]||(t[13]=e=>u.form.hr=24)},"24 Hr")])]))])])),_:1},8,["storageKey","buttonText","placement","title"]),d(T,{storageKey:u.estimatedHintKey,inSymbol:g.convertedCurrency,toSymbol:g.targetCurrency},null,8,["storageKey","inSymbol","toSymbol"]),l("div",cQ,[d(M,{value:u.form.randomizeSize,"onUpdate:value":t[14]||(t[14]=e=>u.form.randomizeSize=e)},null,8,["value"]),d(L,{value:u.form.makerFirst,"onUpdate:value":t[15]||(t[15]=e=>u.form.makerFirst=e)},null,8,["value"]),d(w,{value:g.activationPriceChecked,"order-type":"history.order.filter.type.twap","onUpdate:value":g.handleActivationPriceCheckboxChange},null,8,["value","onUpdate:value"])]),d(D,{checked:g.activationPriceChecked,price:u.form.activationPrice,quoteCurrency:e.marketQuoteCurrency,priceType:g.activationPriceType,priceFilter:e.exchangeInfo.priceDecimal,step:Number(e.exchangeInfo.minPriceIncrement),walletType:"spot","onUpdate:price":t[16]||(t[16]=e=>u.form.activationPrice=Number(e)),"onUpdate:priceType":g.handleActivationPriceTypeChange},null,8,["checked","price","quoteCurrency","priceType","priceFilter","step","onUpdate:priceType"]),d(O,{isShow:u.showAdvancedOptions,onClick:t[17]||(t[17]=e=>u.showAdvancedOptions=!u.showAdvancedOptions)},null,8,["isShow"]),B(l("div",dQ,[d(b,{value:u.form.maxSpread,"onUpdate:value":t[18]||(t[18]=e=>u.form.maxSpread=e),label:"maxSpread",type:"number",step:.1,min:.
11,max:99.9,placeholder:"0.1-99.9"},{prepend:s((()=>[d(f,{class:"_index_title",content:e.$t("trading.twap.maxSpread")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.maxSpread")),1)])),_:1},8,["content"])])),append:s((()=>t[26]||(t[26]=[p("%")]))),_:1},8,["value"]),d(b,{value:u.form.maxIndividualOrderSize,"onUpdate:value":t[19]||(t[19]=e=>u.form.maxIndividualOrderSize=e),label:"maxIndividualOrderSize",enableThousandSeparator:"",step:Number(g.IndividualOrderSizeInfo.step),min:Number(g.IndividualOrderSizeInfo.min),placeholder:g.IndividualOrderSizeInfo.placeholder,tipShown:g.isMaxIndividualOrderSizeWarning,errorShown:g.isInputMaxIndividualOrderSizeError,errorContent:g.isInputMaxIndividualOrderSizeError?e.$t("trading.twap.input.error.maxIndividualOrderSize",{size:g.IndividualOrderSizeInfo.min,currency:r.convertToDisplaySymbol(e.getMarketSymbolFromBaseCurrency(g.IndividualOrderSizeInfo.currency))}):e.$t("trading.twap.input.warning.pausePrice")},{prepend:s((()=>[d(f,{class:C(["_index_title",{_index_title_custom:!e.isMobile}]),content:e.$t("trading.twap.maxIndividualOrderSize")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.maxIndividualOrderSize")),1)])),_:1},8,["class","content"])])),append:s((()=>[p(m(r.convertToDisplaySymbol(e.getMarketSymbolFromBaseCurrency(g.IndividualOrderSizeInfo.currency))),1)])),_:1},8,["value","step","min","placeholder","tipShown","errorShown","errorContent"]),u.enableLastPriceDependentUI?(o(),n(b,{key:0,value:u.form.maxDistanceThroughBook,"onUpdate:value":t[20]||(t[20]=e=>u.form.maxDistanceThroughBook=e),label:"maxDistanceThroughBook",enableThousandSeparator:"",step:.1,min:.
11,placeholder:"â¥0.1"},{prepend:s((()=>[d(f,{class:C(["_index_title",{_index_title_custom:!e.isMobile}]),content:e.$t("trading.twap.maxDistanceThroughBook")},{tooltip:s((()=>[l("p",null,m(e.$t("trading.twap.input.hint.maxDistanceThroughBook.v2",{baseOnText:i.isBuyAction?e.$t("trading.twap.input.hint.maxDistanceThroughBook.buy"):e.$t("trading.twap.input.hint.maxDistanceThroughBook.sell")})),1)])),_:1},8,["class","content"])])),append:s((()=>t[27]||(t[27]=[p("%")]))),_:1},8,["value"])):h("",!0),d(b,{value:u.form.pausePrice,"onUpdate:value":t[21]||(t[21]=e=>u.form.pausePrice=e),label:"pausePrice",enableThousandSeparator:"",step:Number(e.exchangeInfo.minPriceIncrement),min:Number(e.exchangeInfo.minPriceIncrement),placeholder:`â¥${e.exchangeInfo.minPriceIncrement}`,errorShown:g.isInputPausePriceError,errorContent:e.$t("trading.twap.input.error.pausePrice",{price:e.exchangeInfo.minPriceIncrement,currency:r.convertToDisplaySymbol(g.tradingPriceInfo.currency)})},{prepend:s((()=>[d(f,{class:C(["_index_title",{_index_title_custom:!e.isMobile}]),content:i.isBuyAction?e.$t("trading.twap.pauseAbovePrice"):e.$t("trading.twap.pauseBelowPrice")},{tooltip:s((()=>[l("p",null,m(i.isBuyAction?e.$t("trading.twap.input.hint.pauseAbovePrice"):e.$t("trading.twap.input.hint.pauseBelowPrice")),1)])),_:1},8,["class","content"])])),append:s((()=>[p(m(r.convertToDisplaySymbol(g.tradingPriceInfo.currency)),1)])),_:1},8,["value","step","min","placeholder","errorShown","errorContent"])],512),[[N,u.showAdvancedOptions]])]),l("div",null,[d(I,{type:i.isBuyAction?"buy":"sell"},null,8,["type"]),l("div",pQ,[d(x,{class:"__btn",size:"mediumFontBig",type:i.isBuyAction?"success":"danger",disabled:g.disabledSubmit,loading:u.loading,onClick:g.checkSubmit},{default:s((()=>[p(m(i.isBuyAction?e.$t("trading.buySell.button.buy"):e.$t("trading.buySell.button.sell")),1)])),_:1},8,["type","disabled","loading","onClick"])]),g.showAdvancedOptionsHint?(o(),c("div",hQ,m(e.$t("trading.twap.advancedOptionHint")),1)):h("",!0)]),u.showReminderDialog?(o(),n(_,{key:0,closeDialog:g.closeDialog,isBuyAction:i.isBuyAction,onConfirm:g.submitForm},null,8,["closeDialog","isBuyAction","onConfirm"])):h("",!0)])}],["__scopeId","data-v-da5f0301"]]),{enableSpotTradingBot:gQ,enableSpotDcaBot:fQ}=mt,vQ=new Date("2021-04-22T11:00:00Z").getTime();function yQ(e){return`0${e}`.slice(-2)}const bQ={name:"SpotOrderForm",components:{SpotTradeTypeTabList:XW,SpotOrderTypeTabList:eq,OrderMarket:Vq,OrderLimit:cG,OrderIndex:xG,OrderOco:KG,OrderTwap:mQ,TradingTypeTab:oF,TradingTypeSelect:dF,OrderDca:KK},inject:["getActionType","tabsActionUpdate"],props:{boxFilled:{type:Boolean,default:!1}},emits:["toggleAdvancedOption"],setup:()=>({spotSettingStore:ts()}),data:()=>({enableSpotDcaBot:fQ,TRADING_TYPES:ni,actionData:[{value:0,lang:"trading.buySell.buy"},{value:1,lang:"trading.buySell.sell"}],infoStp:ni.LIMIT,advancedStp:ni.LIMIT_STOP,timer:!1,showCountdownOverlay:Date.now()<vQ,countdownTime:"",tradeType:KW.SPOT,enableSpotTradingBot:gQ,isLoading:!1}),computed:{...b(["clickPriceUpdate","marketStatus"]),...y(qe,["marketCurrency"]),isSpot(){return this.tradeType===KW.SPOT},advancedTypeOptions(){const e=rF(this.$t);return zt.spotAdvancedTradingTypeOptions.map((t=>({key:t,value:e[t]})))},isAdvancedTradingTypeSelected(){return this.infoStp===ni.ADVANCED},formComponent(){const e={[ni.LIMIT]:cG,[ni.LIMIT_STOP]:cG,[ni.LIMIT_TAKE_PROFIT]:cG,[ni.MARKET]:Vq,[ni.MARKET_STOP]:Vq,[ni.MARKET_TAKE_PROFIT]:Vq,[ni.MARKET_TRAILING_STOP]:Vq,[ni.OCO]:KG,[ni.INDEX]:xG,[ni.TWAP]:mQ},t=e[this.infoStp],i=e[this.advancedStp];return t||i||null},isBuyAction(){return this.actionType===Gt.BUY},isShowComingSoonOverlay(){return this.showCountdownOverlay||!this.isBuyAction&&"FLY"===this.marketCurrency&&!this.marketStatus.activeSell},actionType(){return this.getActionType()},currentMarket(){return this.$route.params.id}},watch:{clickPriceUpdate(){this.infoStp===ni.MARKET&&(this.infoStp=ni.LIMIT)},marketCurrency(){this.setCountdownTimer()},actionType(){this.trackOrderTypeClicked()},currentMarket(){this.trackOrderTypeClicked(!0)}},created(){this.setCountdownTimer(),this.trackOrderTypeClicked(!0),this.spotSettingStore.getOrderFormSettings();const{tradeType:e}=history.state||{};e&&(this.tradeType=e===Pn.DCA?KW.DCA:e)},beforeUnmount(){clearInterval(this.timer)},methods:{setCountdownTimer(){clearInterval(this.timer),"FLY"===this.marketCurrency?(this.updateCountdownTime(),this.timer=setInterval(this.updateCountdownTime,1e3)):this.showCountdownOverlay=!1},updateCountdownTime(){const e=Date.now();if(e>=vQ-1e3)return void(this.showCountdownOverlay=!1);this.showCountdownOverlay=!0;let[t,i,r,a]=Mn(vQ,e);i=24*t+i,this.countdownTime=`${yQ(i)}:${yQ(r)}:${yQ(a)}`},handleTabSelect(e){this.infoStp=e,this.trackOrderTypeClicked()},loadingHandler(e){this.isLoading=e},handleAdvancedToggle(e){this.$emit("toggleAdvancedOption",e)},trackOrderTypeClicked(e=!1){if(!this.currentMarket)return;let t=this.infoStp;this.infoStp===ni.ADVANCED&&(t=this.advancedStp),Li(wi.TRADING_ORDER_TYPE_CLICKED,{s1:t,s2:"spot",s3:this.currentMarket.replace("-","/"),s4:this.isBuyAction?"buy":"sell",s5:e?"true":"false"})},handleTradingTypeSelect(e){this.advancedStp=e,this.trackOrderTypeClicked()}}},SQ={key:3,class:"countdown-overlay"},CQ={key:0};const PQ=$n(bQ,[["render",function(e,t,i,r,s,u){const p=a("SpotTradeTypeTabList"),f=a("SpotOrderTypeTabList"),v=a("TradingTypeTab"),y=a("TradingTypeSelect"),b=a("OrderDca"),S=H("loading");return B((o(),c("div",{class:C(["brand-card border-box flex-box flex-column card-shell order-form",{"box-fill":i.boxFilled}])},[s.enableSpotDcaBot?(o(),n(p,{key:0,modelValue:s.tradeType,"onUpdate:modelValue":t[0]||(t[0]=e=>s.tradeType=e),class:"card-shell__header"},null,8,["modelValue"])):h("",!0),d(f,{class:"card-shell__header",selected:u.actionType,actionData:s.actionData,update:u.tabsActionUpdate},null,8,["selected","actionData","update"]),u.isSpot?(o(),c(g,{key:1},[d(v,{active:s.infoStp,onOnSelect:u.handleTabSelect},null,8,["active","onOnSelect"]),u.isAdvancedTradingTypeSelected?(o(),n(y,{key:0,name:"tradingtypeSelect",value:s.advancedStp,options:u.advancedTypeOptions,onChange:u.handleTradingTypeSelect}
1,null,8,["value","options","onChange"])):h("",!0),(o(),n(F(u.formComponent),{isBuyAction:u.isBuyAction,infoStp:u.isAdvancedTradingTypeSelected?s.advancedStp:s.infoStp,onOnAdvancedToggle:u.handleAdvancedToggle},null,40,["isBuyAction","infoStp","onOnAdvancedToggle"]))],64)):(o(),n(b,{key:2,isBuyAction:u.isBuyAction},null,8,["isBuyAction"])),u.isShowComingSoonOverlay?(o(),c("div",SQ,[t[1]||(t[1]=l("div",null,"Coming Soon",-1)),s.showCountdownOverlay?(o(),c("div",CQ,m(s.countdownTime),1)):h("",!0)])):h("",!0)],2)),[[S,s.isLoading,"streamingLight"]])}],["__scopeId","data-v-8490641c"]]),kQ=q("spotBotStore",{state:()=>({dcaBotList:[]}),actions:{setDcaBotList(e){this.dcaBotList=e},async fetchDcaBotList(e={}){try{const{data:t}=await Cr.getTradingBots({...e,marketType:"SPOT",botType:Ln.DCA});return this.setDcaBotList(t.tradingBots||[]),t}catch(t){this.setDcaBotList([])}},async closeDcaBot(e){try{await Cr.closeBot(e),await this.fetchDcaBotList()}catch(t){}}}}),{enableSpotDcaBot:TQ}=mt,{tradingTypeTabs:MQ,spotAdvancedTradingTypeOptions:LQ}=zt,wQ={name:"HistoryTabs",components:{FlashingBall:$p},props:{currentTab:{type:String,default:wn.ORDERS}},emits:["update:currentTab"],data:()=>({enableSpotDcaBot:TQ}),computed:{...b(["spotWsData"]),...y(kQ,["dcaBotList"]),tabsData(){const e=MQ.includes(ni.TWAP)||LQ.includes(ni.TWAP),{allOrderPending:t,allTwapOrder:i}=this.spotWsData;return[{id:wn.ORDERS,value:0,lang:"trading.orders.title.order",count:t.length},{id:wn.ORDER_FILLS,value:1,lang:"trading.orders.title.filled"},{id:wn.TWAP_ORDERS,value:2,lang:"trading.orders.title.twapOrders",count:i.length,disabled:!e},{id:wn.DCA_BOTS,value:3,lang:"t.bot",count:this.dcaBotList.length,isDcaBot:!0,disabled:!TQ},{id:wn.FUNDS,value:4,lang:"t.holdings"}].filter((e=>!e.disabled))},selectItem(){return this.tabsData.find((e=>e.id===this.currentTab))}},methods:{handleClick(e){this.$emit("update:currentTab",e)}}},DQ=["onClick"];const OQ=$n(wQ,[["render",function(e,t,i,r,s,l){const u=a("FlashingBall");return o(),c("div",{class:C(["history-tabs",e.$mq])},[(o(!0),c(g,null,R(l.tabsData,(t=>(o(),c("div",{key:t.id,class:C(["tab",{active:i.currentTab===t.id}]),onClick:e=>l.handleClick(t.id)},[t.isDcaBot&&e.dcaBotList.length>0?(o(),n(u,{key:0,active:""})):h("",!0),p(" "+m(e.$t(t.lang))+" ",1),void 0!==t.count?(o(),c(g,{key:1},[p("("+m(t.count)+")",1)],64)):h("",!0)],10,DQ)))),128))],2)}],["__scopeId","data-v-e3884fb6"]]);const IQ=$n({name:"OrderListHeader",components:{SortableHeaderCell:dr},props:{headerTitles:{type:Array,default:function(){return[]}},cancelAllButtonWidth:{type:String,default:null},sortKey:{type:[Boolean,String],default:null}},methods:{getClass(e){const t=[];
1return"orderType"===e.id&&t.push("type-column"),"market"===e.id&&t.push("market-column"),e.textAlign&&t.push(`align-${e.textAlign}`),t}}},[["render",function(e,t,i,r,u,d){const p=a("SortableHeaderCell"),h=a("HeaderRow");return o(),n(h,{class:"row"},{default:s((()=>[(o(!0),c(g,null,R(i.headerTitles,(t=>(o(),n(p,O({ref_for:!0},e.$attrs,{key:t.id,currentSortKey:i.sortKey,class:d.getClass(t),title:t}),{content:s((()=>[l("span",null,m(e.$t(t.lang))+" "+m(t.more),1)])),_:2},1040,["currentSortKey","class","title"])))),128))])),_:1})}],["__scopeId","data-v-72d67709"]]);const xQ=$n({name:"OrderType",props:{order:{type:String,default:void 0}},computed:{classes(){return void 0===this.order?[]:["B"===this.order.orderMode?"buy-type":"sell-type"]}}},[["render",function(e,t,i,r,a,n){return o(),c("div",{class:C(["spot-order-type",n.classes])},m(e.$filters.orderType(i.order)),3)}],["__scopeId","data-v-4fb44875"]]),_Q={name:"OrderListRow",components:{OrderType:xQ,EditableCell:Db,IconBot:ds},props:{order:{type:Object,default:function(){return{}}},direction:{type:String,required:!0},index:{type:Number,required:!0},anyRowEditing:{type:Boolean,default:!1}},emits:["mouseleave","mouseover","update:disableEditableCell","update:anyRowEditing"],setup(){const{showSpotPriceLimitReachedNotification:e}=as(),{convertToDisplaySymbol:t}=Je(),{fiatRateMap:i}=Q(In());return{showSpotPriceLimitReachedNotification:e,convertToDisplaySymbol:t,fiatRateMap:i}},data:()=>({getMarketSymbolFromMarketName:On,trailingStopTriggerPriceBackup:{},amendData:{type:"",value:""},currentRowEditing:!1}),computed:{...b({lang:"lang",fiatCurrencyList:"fiatCurrencyList",spotWsData:"spotWsData"}),...y(qe,["getExchangeInfoBySymbol"]),...y(qe,{spotExchangeInfo:"exchangeInfo"}),...U(["isArabic"]),...y(qe,["marketQuoteCurrency","getMarketSymbolFromBaseCurrency","getDisplayNameBySymbol"]),marketSymbol(){return this.getMarketSymbolFromBaseCurrency(this.order.crypto)},displayMarketName(){return this.convertToDisplaySymbol(this.order.symbol)},displayName(){return this.getDisplayNameBySymbol(this.order.crypto)},orderMarketRoute(){return this.isFromTradingBot?{name:ai.TRADING_BOT,params:{lang:this.lang}}:{name:"tradingId",params:{lang:this.lang,id:`${this.marketSymbol}-${this.order.currency}`},state:{noScrollTop:this.isMobile}}},originalCurrencyMarketInfo(){return this.getExchangeInfoBySymbol(this.order.symbol)},originalCurrencyPriceFormat(){return{formatKey:this.getExchangeInfoBySymbol(this.order.symbol).priceDecimal??"max8",currency:this.order.currency}},originalCurrencySizeFormat(){return{formatKey:this.getExchangeInfoBySymbol(this.order.symbol).sizeDecimal??"max8"}},valuePriceFormat(){return this.originalCurrencySizeFormat},isLimitOrder(){return this.order.orderType===ct.LIMIT},isMarketOrder(){return this.order.orderType===ct.MARKET},isIndexOrder(){return this.order.orderType===ct.PEG},isTrailingStopOrder(){return 0!==this.order.trailValue},isWaitingForActivation(){return this.order.activationPrice&&0===Number(this.order.triggerPrice)},isBuyOrder(){return this.order.orderMode===st.BUY},triggerPriceType(){return this.order.triggerUseLastPrice?this.$t("trading.last"):this.$t("futuresMain.trade.index")},orderValue(){const{originalSize:e,price:t}=this.order;return e&&t?S(e).times(t).toNumber():""},formattedActivationPrice(){if(this.order.activationPrice){const e=this.fiatRateMap[this.order.currency],t=e?S(this.order.activationPrice).times(e).toNumber():this.order.activationPrice;return this.$filters.formatNumber(t,this.originalCurrencyPriceFormat)}return"-"},isFromTradingBot(){return!!this.order.vendorName},showLinkMarketLine(){return`${this.order.crypto}-${this.order.currency}`!==this.$route.params.id||this.isFromTradingBot},isTwap(){return this.order.orderDetailType===Hi.TWAP},orderSize(){const{size:e,fillSize:t}=this.order;return S(e).plus(t).toNumber()}},methods:{...v(["messageError"]),...v("trading",["beforeSpotTradingBehaviorFn"]),formatTrailValue(e,t){if(t===Xi.PERCENTAGE)return`${e>=0?"+":""}${100*e}%`;const i=this.$filters.formatNumber(e,this.originalCurrencyPriceFormat);return e>=0?`+${i}`:i}
1,triggerPriceString(e){const{orderMode:t,triggerOriginalPrice:i,trailValue:r}=e;let a=i;const n=i-r,o=this.indexPrice;if(t===st.BUY){if(o<n){a-=r*~~((n-o)/r)}}else if(o>n){a+=r*~~((o-n)/r)}return this.$filters.formatNumber(a,this.originalCurrencyPriceFormat)},triggerOrderPriceString(e){const{price:t,trailValue:i}=e;let r=`${this.$t("trading.stop-take-profit.trigger")}: ${this.triggerPriceString(e)}`;return this.isMarketOrder&&i&&(r+=` | ${this.$filters.formatNumber(this.indexPrice,this.originalCurrencyPriceFormat)}`),this.isMarketOrder||(r+=` | ${this.$filters.formatNumber(t,this.originalCurrencyPriceFormat)}`),r},isPegPrice(e){let t="",i=0;const r=dt(),a=Number(r.getSpotIndexPrice(`${e.crypto}-${Dn}`));if(a){const r=a+a*e.deviation;e.orderMode===st.BUY?(t+="Max:",i=e.price<=r?e.price:r):e.orderMode===st.SELL&&(t+="Min:",i=e.price>=r?e.price:r),t+=` ${this.$filters.formatNumber(e.price,this.originalCurrencyPriceFormat)}`,t+=` | <span style="font-weight: 700">${this.$filters.formatNumber(i,this.originalCurrencyPriceFormat)} (USD)</span>`}return t},async amendSubmit(){var e,t;try{await Jt.amendOrder(this.amendData),this.cancelEdit(),this.resetData(),this.$emit("update:anyRowEditing",!1)}catch(i){(null==(t=null==(e=i.response)?void 0:e.data)?void 0:t.code)===hn.ORDER_LIMIT_REACHED&&this.showSpotPriceLimitReachedNotification({base:this.marketSymbol,quote:this.order.currency})}},getAmendData:(e,t,i)=>({orderID:e.orderID,type:t,value:i,symbol:e.symbol}),amendOrderCallback({order:e,type:t,newValue:i,cancelEdit:r}){this.amendData={orderID:e.orderID,type:t,value:"SIZE"===t?S(i).minus(e.fillSize).toNumber():i,symbol:e.symbol},this.cancelEdit=r,this.amendSubmit()},resetData(){this.amendData={type:null,value:null},this.cancelEdit=()=>{}},async onEditModeChange(e){if(e){if(!(await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:Zt.EDIT_EXIST_ORDER})))return}this.currentRowEditing=e,this.$emit("update:anyRowEditing",e)}}},AQ={class:"market-column-content"},RQ={class:"market"},FQ=["innerHTML"],EQ={class:"currency"},BQ={class:"trigger-type"},zQ={key:0,class:"flex-box"},$Q={class:"currency"};const NQ={name:"Orders",components:{OrderListHeader:IQ,OrderListRow:$n(_Q,[["render",function(e,t,i,r,u,f){const v=a("RouterLink"),y=a("IconBot"),b=a("Cell"),S=a("OrderType"),P=a("EditableCell"),k=a("ToolTip"),T=a("Row");return o(),n(T,{class:C(["order-list-row",[i.direction]]),index:i.index,onMouseover:t[0]||(t[0]=t=>e.$emit("mouseover",t)),onMouseleave:t[1]||(t[1]=t=>e.$emit("mouseleave",t))},{default:s((()=>[d(b,{textAlign:"left",class:"market-column"},{default:s((()=>[l("div",AQ,[d(v,{class:"market-link",to:f.orderMarketRoute},{default:s((()=>[l("span",{class:C(["crypto",{underline:f.showLinkMarketLine}])},m(f.displayMarketName),3),l("span",RQ,m(f.displayName),1)])),_:1},8,["to"]),f.isFromTradingBot?(o(),n(y,{key:0,class:"bot-icon"})):h("",!0)])])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[d(S,{order:i.order},null,8,["order"])])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[f.isIndexOrder?(o(),c("p",{key:0,innerHTML:f.isPegPrice(i.order)},null,8,FQ)):f.isMarketOrder?(o(),c(g,{key:1},[p(m(e.$t("futuresMain.trade.market")),1)],64)):f.isTrailingStopOrder?(o(),c(g,{key:2},[p("-")],64)):(o(),n(P,O({key:3},e.$attrs,{fieldData:e.$filters.formatNumber(i.order.price,f.originalCurrencyPriceFormat),orderInfo:i.order,marketInfo:f.originalCurrencyMarketInfo,priceFormat:f.originalCurrencyPriceFormat,checkAction:f.amendOrderCallback,type:"PRICE",disable:i.anyRowEditing,hide:f.isFromTradingBot||f.isTwap,marketRoute:f.orderMarketRoute,onEditModeChange:f.onEditModeChange}),null,16,["fieldData","orderInfo","marketInfo","priceFormat","checkAction","disable","hide","marketRoute","onEditModeChange"]))])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[f.isWaitingForActivation?(o(),c(g,{key:0},[p("-")],64)):f.isTrailingStopOrder?(o(),c(g,{key:1},[d(k,null,{content:s((()=>[p(m(e.$filters.formatNumber(i.order.triggerOriginalPrice,f.originalCurrencyPriceFormat)),1)])),tooltip:s((()=>[l("div",null,m(e.$t("futuresMain.activeOrders.trailValue"))+": "+m(f.formatTrailValue(i.order.trailValue,i.order.trailValueType)),1)])),_:1}),l("span",EQ,m(i.order.currency),1),l("span",BQ,"("+m(f.triggerPriceType)+")",1)],64)):i.order.triggerOrderType?(o(),n(P,O({key:2},e.$attrs,{fieldData:e.$filters.formatNumber(i.order.triggerOriginalPrice,f.originalCurrencyPriceFormat),orderInfo:i.order,marketInfo:f.originalCurrencyMarketInfo,priceFormat:f.originalCurrencyPriceFormat,checkAction:f.amendOrderCallback,type:"TRIGGERPRICE",disable:i.anyRowEditing,hide:i.order.triggered||f.isFromTradingBot,onEditModeChange:f.onEditModeChange}),null,16,["fieldData","orderInfo","marketInfo","priceFormat","checkAction","disable","hide","onEditModeChange"])):(o(),c(g,{key:3},[p("-")],64))])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatNumber(i.order.fillSize,f.originalCurrencySizeFormat)),1
1)])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[f.isMarketOrder&&f.isBuyOrder?(o(),c(g,{key:0},[p("-")],64)):(o(),n(P,O({key:1},e.$attrs,{fieldData:e.$filters.formatNumber(f.orderSize,f.originalCurrencySizeFormat),orderInfo:i.order,marketInfo:f.originalCurrencyMarketInfo,priceFormat:f.originalCurrencySizeFormat,checkAction:f.amendOrderCallback,type:"SIZE",disable:i.anyRowEditing,hide:f.isFromTradingBot||f.isTwap,onEditModeChange:f.onEditModeChange}),null,16,["fieldData","orderInfo","marketInfo","priceFormat","checkAction","disable","hide","onEditModeChange"]))])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[f.isMarketOrder&&f.isBuyOrder?(o(),c("div",zQ,[d(P,O(e.$attrs,{fieldData:e.$filters.formatNumber(f.orderSize,f.valuePriceFormat),orderInfo:i.order,marketInfo:f.originalCurrencyMarketInfo,priceFormat:f.valuePriceFormat,checkAction:f.amendOrderCallback,postfix:i.order.currency,type:"SIZE",disable:i.anyRowEditing,hide:f.isFromTradingBot||f.isTwap||i.order.activationPrice,onEditModeChange:f.onEditModeChange}),null,16,["fieldData","orderInfo","marketInfo","priceFormat","checkAction","postfix","disable","hide","onEditModeChange"])])):i.order.triggerOrder&&!i.order.triggered?(o(),c(g,{key:1},[p("-")],64)):(o(),c(g,{key:2},[p(m(e.$filters.formatNumber(f.orderValue,f.originalCurrencyPriceFormat))+" ",1),l("span",$Q,m(i.order.currency),1)],64))])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[f.isTwap?(o(),c(g,{key:0},[p(m(e.$t("trading.twap.openOrder.status")),1)],64)):i.order.triggerOrderType?(o(),c(g,{key:1},[p(m(i.order.triggered?e.$t("msg.triggerOrderType.trigger"):e.$t("msg.triggerOrderType.not-trigger")),1)],64)):f.isLimitOrder?(o(),c(g,{key:2},[0===i.order.validTill?(o(),c(g,{key:0},[p(m(e.$t("t.order.timeInForce.GTC")),1)],64)):(o(),c(g,{key:1},[p(m(e.$filters.formatDate(i.order.validTill)),1)],64))],64)):(o(),c(g,{key:3},[p(m(e.$t("t.order.timeInForce.GTC")),1)],64))])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[p(m(f.formattedActivationPrice),1)])),_:1}),d(b,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.order.time)),1)])),_:1})])),_:1},8,["class","index"])}],["__scopeId","data-v-bb9dcf5c"]]),CancelPanel:tC,CloseAllConfirmDialog:hy,NoDataAvailable:it,ChaseOrderConfirmDialog:sS},setup(){const e=xn(),t=ts(),{isChaseDialogVisible:i,chasingOrderMap:r,requestChase:a,confirmChase:n}=lS({isConfirmationOn:()=>t.orderFormSettings.chaseOrderConfirmation,disableConfirmation:()=>t.updateOrderFormSettings({chaseOrderConfirmation:!1}),amendOrder:e=>Jt.amendOrder(e)});return{spotSocketStore:e,isChaseDialogVisible:i,chasingOrderMap:r,requestChase:a,confirmChase:n}},data:()=>({isLoading:!0,requestAnimationFrameId:!1,anyRowEditing:!1,sortKey:null,sortOrder:!1,cancelOrderMap:{},currentHoverRow:"",scrollTicking:!1,touchElement:null,isShowShadow:!1,isShowCancelAllDialog:!1,cancelPanelObserver:null}),computed:{...b({spotWsData:"spotWsData",isLogin:"loginState"}),openOrderLoadedCount(){return this.spotSocketStore.openOrderLoadedCount},...y(qe,{marketSymbol:"marketSymbol",marketQuoteCurrency:"marketQuoteCurrency"}),...U(["isNightTheme"]),...y(ts,["showCurrentSymbolInOrderHistory"]),headerTitles(){return[{id:"market",lang:"trading.orders.markets",textAlign:"left",sortable:this.isAllOrders},{id:"orderType",lang:"trading.orders.type",textAlign:"left",sortable:!0},{id:"price",lang:"t.price",textAlign:"left"},{id:"triggerPrice",lang:"trading.stop-take-profit.stopPrice",textAlign:"left"},{id:"filledSize",lang:"trading.orders.filledSize",textAlign:"left"},{id:"totalSize",lang:"trading.orders.totalSize",textAlign:"left"},{id:"value",lang:"trading.orders.value",textAlign:"left"},{id:"status",lang:"trading.orders.status",textAlign:"left"},{id:"activationPrice",lang:"t.activationPrice",textAlign:"left"},{id:"time",lang:"trading.orders.date",textAlign:"left",sortable:!0}]},isAllOrders(){return!this.showCurrentSymbolInOrderHistory},ordersData(){const e=this.isAllOrders?this.spotWsData.allOrderPending:this.spotWsData.orderPending;return this.sortKey?JSON.parse(JSON.stringify(e)).sort(((e,t)=>{if("orderType"===this.sortKey){const{orderType:i,orderMode:r,triggerOrderType:a}=e,{orderType:n,orderMode:o,triggerOrderType:s}=t,l=`${i}_${r}_${a}`,u=`${n}_${o}_${s}`;return"asc"===this.sortOrder?l.localeCompare(u):u.localeCompare(l)}return"market"===this.sortKey?"asc"===this.sortOrder?e.marketName.localeCompare(t.marketName):t.marketName.localeCompare(e.marketName):"asc"===this.sortOrder?e[this.sortKey]-t[this.sortKey]:t[this.sortKey]-e[this.sortKey]})):e},emptyOrderData(){return!this.ordersData||0===this.ordersData.length}},watch:{marketSymbol(){this.islogin&&(this.isLoading=!0)},openOrderLoadedCount(){this.isLoading=!1},isLogin:{immediate:!0,handler(e){e||(this.isLoading=!1)}}},mounted(){this.$nextTick((()=>{var e;this.tableWrapper=this.$refs.tableWrapper,this.initPanelEvents(this.tableWrapper),this.tableWrapper.addEventListener("scroll",this.checkShowShadow),(null==(e=this.$refs.cancelPanel)?void 0:e.$refs.panel)?(this.cancelPanel=this.$refs.cancelPanel.$refs.panel,this.initPanelEvents(this.cancelPanel)):(this.cancelPanelObserver=new MutationObserver((e=>{e.forEach((e=>{var t;"childList"===e.type&&(this.cancelPanel=null==(t=this.$refs.cancelPanel)?void 0:t.$refs.panel,this.cancelPanel&&this.initPanelEvents(this.cancelPanel))}))})),this.cancelPanelObserver.observe(this.$el,{childList:!0,subtree:!0})),this.gridWrapperObserver=new MutationObserver(this.checkShowShadow),this.gridWrapperObserver.observe(this.tableWrapper.parentNode,{attributes:!0,childList:!0,subtree:!0}),this.checkShowShadow()}))},beforeUnmount(){cancelAnimationFrame(this.requestAnimationFrameId),clearTimeout(this.timeout),this.removePanelEvents(this.tableWrapper),this.removePanelEvents(this.cancelPanel),this.tableWrapper.removeEventListener("scroll",this.checkShowShadow),this.gridWrapperObserver&&this.gridWrapperObserver.disconnect(),this.cancelPanelObserver&&this.cancelPanelObserver.disconnect()},methods:{...v("trading",["beforeSpotTradingBehaviorFn"]),initPanelEvents(e){null==e||e.addEventListener("scroll",this.syncScroll),null==e||e.addEventListener("touchstart",this.setTouchElement),null==e||e.addEventListener("touchmove",this.syncScroll),null==e||e.addEventListener("touchend",this.syncScroll)},removePanelEvents(e){null==e||e.removeEventListener("scroll",this.syncScroll),null==e||e.removeEventListener("touchstart",this.setTouchElement),null==e||e.removeEventListener("touchmove",this.syncScroll),null==e||e.removeEventListener("touchend",this.syncScroll)},setSortData({key:e,order:t}){this.sortKey=e,this.sortOrder=t},handleConfirmCancelAll(){const e=this.isAllOrders?"":this.marketSymbol;
1Jt.cancelAllOrders({symbol:e})},async deleteAll(){await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:Zt.CLICK_CANCEL_ALL_BTN})&&(this.isShowCancelAllDialog=!0)},getMode:e=>"B"===e?"buy":"S"===e?"sell":void 0,async toggleCloseOrder(e){if(!this.cancelOrderMap[e]){if(!(await this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:Zt.CLICK_CANCEL_ORDER_BTN})))return}this.cancelOrderMap[e]=!this.cancelOrderMap[e]},confirmCloseOrder(e){Jt.cancelOrder(e).then((()=>{delete this.cancelOrderMap[e.orderID]}))},canChaseOrder(e){const t=e.orderType===ct.LIMIT,i=!!e.triggerOrderType,r=0!==e.trailValue,a=!!e.vendorName,n=e.orderDetailType===Hi.TWAP;return t&&!i&&!r&&!a&&!n},chaseOrder(e){this.requestChase({orderID:e.orderID,symbol:e.symbol,side:e.orderMode===st.BUY?"BUY":"SELL"})},setCurrentHoverRow(e){this.currentHoverRow=e},setTouchElement(e){const t=e.target,i=t.parentElement,r=t.getAttribute("class")||"",a=i.getAttribute("class")||"";r.includes("cancel")||a.includes("cancel")?this.touchElement=this.cancelPanel:this.touchElement=this.tableWrapper,this.syncScroll(e)},syncScroll(e){this.scrollTicking||(this.requestAnimationFrameId=requestAnimationFrame((()=>{let t,i;const r=this.tableWrapper.scrollHeight-this.tableWrapper.clientHeight;e.type.includes("touch")?(i=this.touchElement===this.tableWrapper?this.cancelPanel:this.tableWrapper,t=this.touchElement.scrollTop):(i="table-wrapper"===e.target.className?this.cancelPanel:this.tableWrapper,t=e.target.scrollTop),clearTimeout(this.timeout),i&&(i.removeEventListener("scroll",this.syncScroll),i.scrollTop=t,this.timeout=setTimeout((()=>{i.addEventListener("scroll",this.syncScroll)}),100)),t>r&&this.cancelPanel&&(this.cancelPanel.scrollTop=r),this.scrollTicking=!1}))),this.scrollTicking=!0},checkShowShadow(){const e=this.$refs.tableWrapper,{scrollLeft:t,scrollWidth:i,clientWidth:r}=e,a=t+r===i;this.isShowShadow=!a}}},UQ={class:"orders-wrapper"},HQ={ref:"tableWrapper",class:"table-wrapper"},VQ={key:0,class:"highlight"},WQ={class:"highlight"},qQ={class:"highlight"};const GQ=$n(NQ,[["render",function(e,t,i,r,u,f){const v=a("OrderListHeader"),y=a("OrderListRow"),b=a("NoDataAvailable"),S=a("DataTable"),P=a("CancelPanel"),k=a("ChaseOrderConfirmDialog"),T=a("i18n-t"),M=a("CloseAllConfirmDialog"),L=H("loading");return B((o(),c("div",UQ,[l("div",HQ,[d(S,{isEmpty:f.emptyOrderData},{header:s((()=>[d(v,{headerTitles:f.headerTitles,sortKey:u.sortKey,onSort:f.setSortData},null,8,["headerTitles","sortKey","onSort"])])),body:s((()=>[(o(!0),c(g,null,R(f.ordersData,((e,i)=>(o(),n(y,{key:`${e.displayCurrency}-${e.orderID}`,anyRowEditing:u.anyRowEditing,"onUpdate:anyRowEditing":t[0]||(t[0]=e=>u.anyRowEditing=e),index:i,direction:f.getMode(e.orderMode),order:e,onMouseover:t=>f.setCurrentHoverRow(e.orderID),onMouseleave:t[1]||(t[1]=e=>f.setCurrentHoverRow(""))},null,8,["anyRowEditing","index","direction","order","onMouseover"])))),128))])),empty:s((()=>[d(b,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["isEmpty"])],512),d(P,{ref:"cancelPanel",class:C(["cancel-panel",{shadow:u.isShowShadow}]),hasOpenOrder:!f.emptyOrderData,openOrderList:f.ordersData,cancelOrderMap:u.cancelOrderMap,toggleCloseOrder:f.toggleCloseOrder,confirmCloseOrder:f.confirmCloseOrder,deleteAll:f.deleteAll,currentHoverRow:u.currentHoverRow,chaseOrder:f.chaseOrder,canChaseOrder:f.canChaseOrder,chasingOrderMap:r.chasingOrderMap},null,8,["class","hasOpenOrder","openOrderList","cancelOrderMap","toggleCloseOrder","confirmCloseOrder","deleteAll","currentHoverRow","chaseOrder","canChaseOrder","chasingOrderMap"]),d(k,{visible:r.isChaseDialogVisible,"onUpdate:visible":t[2]||(t[2]=e=>r.isChaseDialogVisible=e),onConfirm:r.confirmChase},null,8,["visible","onConfirm"]),d(M,{visible:u.isShowCancelAllDialog,"onUpdate:visible":t[3]||(t[3]=e=>u.isShowCancelAllDialog=e),onConfirm:f.handleConfirmCancelAll},{title:s((()=>[p(m(e.$t("msg.cancel"))+" ",1),l("span",{class:C(f.isAllOrders&&"highlight")},m(e.$t("msg.all")),3),f.isAllOrders?h("",!0):(o(),c("span",VQ,m(" ")+m(e.marketSymbol.replace("-","/")),1
1)),p(" "+m(e.$t("order.orders"))+"? ",1)])),message:s((()=>[d(T,{keypath:f.isAllOrders?"msg.confirmCancelAll.allMarkets":"msg.confirmCancelAll",tag:"span"},te({_:2},[f.isAllOrders?{name:"all",fn:s((()=>[l("span",WQ,m(e.$t("msg.all").toLowerCase()),1)])),key:"0"}:{name:"symbol",fn:s((()=>[l("span",qQ,m(e.marketSymbol.replace("-","/")),1)])),key:"1"}]),1032,["keypath"])])),_:1},8,["visible","onConfirm"])])),[[L,u.isLoading,"streamingLight"]])}],["__scopeId","data-v-4e572a54"]]);const KQ=$n({name:"FillsOrderListHeader",components:{SortableHeaderCell:dr},props:{headerTitles:{type:Array,default:function(){return[]}},cancelAllButtonWidth:{type:String,default:null},sortKey:{type:[Boolean,String],default:null}},methods:{getClass(e){const t=[];return e.textAlign&&t.push(`align-${e.textAlign}`),t}}},[["render",function(e,t,i,r,u,d){const p=a("SortableHeaderCell"),h=a("HeaderRow");return o(),n(h,{class:"fills-order-header"},{default:s((()=>[(o(!0),c(g,null,R(i.headerTitles,(t=>(o(),n(p,O({ref_for:!0},e.$attrs,{key:t.id,currentSortKey:i.sortKey,class:d.getClass(t),title:t}),{content:s((()=>[l("span",null,m(e.$t(t.lang))+" "+m(t.more),1)])),_:2},1040,["currentSortKey","class","title"])))),128))])),_:1})}],["__scopeId","data-v-afa5f5ca"]]),{enableOrderHistoryFixDecimalPrice:QQ}=mt,jQ={name:"FillsOrderListRow",components:{OrderType:xQ,IconTriangleAlert:gs},props:{orderItem:{type:Object,default:function(){return{}}},direction:{type:String,required:!0},index:{type:Number,required:!0}},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},data:()=>({SPOT_ORDER_MODE:st,SPOT_ORDER_TYPE:ct}),computed:{...b(["fiatCurrencyList","spotWsData","defaultBaseCurrencyShortName"]),...y(qe,{getSpotExchangeInfoByQuote:"getExchangeInfoByQuote",getMarketSymbolFromBaseCurrency:"getMarketSymbolFromBaseCurrency",getDisplayNameBySymbol:"getDisplayNameBySymbol"}),isTwapMarketBuy(){const{orderDetailType:e,orderMode:t,orderType:i}=this.orderItem;return e===Hi.TWAP&&t===this.SPOT_ORDER_MODE.BUY&&i===this.SPOT_ORDER_TYPE.MARKET},displayMarketSymbol(){const e=this.getMarketSymbolFromBaseCurrency(this.orderItem.baseCurrency);return this.convertToDisplaySymbol(e)},displayFeeSymbol(){const e=this.getMarketSymbolFromBaseCurrency(this.orderItem.feeCurrency);return this.convertToDisplaySymbol(e)},isBuy(){return"B"===this.orderItem.orderMode},formatSetting(){const e=this.isBuy?S.ROUND_UP:S.ROUND_DOWN;return{formatKey:QQ?this.getPriceDecimal(this.orderItem.currency):"max8",roundMode:QQ?e:S.ROUND_HALF_UP,currency:this.orderItem.currency}},originalUserPriceFormat(){return{formatKey:this.getPriceDecimal(this.orderItem.currency),currency:this.orderItem.currency}},showVoidTag(){return!0===this.orderItem.void},displayName(){return this.getDisplayNameBySymbol(this.orderItem.crypto)}},methods:{getOrderValue(e){const{price:t,amount:i}=e;return S(t).times(i).toNumber()},getPriceDecimal(e){return this.getSpotExchangeInfoByQuote(e).priceDecimal},getSizeDecimal(e){return this.getSpotExchangeInfoByQuote(e).sizeDecimal},getFeeDecimal(e){const{orderMode:t,currency:i}=e,r=t===st.BUY?"baseFeeDecimal":"quoteFeeDecimal";return this.getSpotExchangeInfoByQuote(i)[r]}}},YQ={class:"market-pair"},ZQ={class:"market"},XQ={class:"order-type-content"},JQ={key:0,class:"void-tag"},ej={class:"currency"},tj={class:"currency"},ij={class:"currency"},rj={class:"currency"};const aj=$n(jQ,[["render",function(e,t,i,r,u,f){const v=a("Cell"),y=a("OrderType"),b=a("IconTriangleAlert"),S=a("Row");return o(),n(S,{class:C(["fills-order-list-row",[i.direction]]),index:i.index},{default:s((()=>[d(v,{textAlign:"left"},{default:s((()=>[l("span",YQ,[p(m(`${f.displayMarketSymbol}-${i.orderItem.quoteCurrency}`)+" ",1),l("span",ZQ,m(f.displayName),1)])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[l("div",XQ,[d(y,{order:i.orderItem},null,8,["order"]),f.showVoidTag?(o(),c("div",JQ,[d(b),p(" "+m(e.$t("t.void")),1)])):h("",!0)])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderType===u.SPOT_ORDER_TYPE.MARKET?(o(),c(g,{key:0},[p(m(e.$t("t.orderType_m")),1)],64)):(o(),c(g,{key:1},[p(m(e.$filters.formatNumber(i.orderItem.originalUserPrice,f.originalUserPriceFormat))+" ",1),l("span",ej,m(i.orderItem.currency),1)],64))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatNumber(i.orderItem.price,f.formatSetting))+" ",1),l("span",tj,m(i.orderItem.currency),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderType===u.SPOT_ORDER_TYPE.MARKET&&i.orderItem.orderMode===u.SPOT_ORDER_MODE.BUY?(o(),c(g,{key:0},[p(" - ")],64)):(o(),c(g,{key:1},[p(m(e.$filters.formatNumber(i.orderItem.originalAmount,f.getSizeDecimal(i.orderItem.currency))),1)],64))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatNumber(i.orderItem.amount,f.getSizeDecimal(i.orderItem.currency))),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatNumber(i.orderItem.feeAmount,f.getFeeDecimal(i.orderItem)))+" ",1),l("span",ij,m(f.displayFeeSymbol),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatNumber(f.getOrderValue(i.orderItem),f.formatSetting))+" ",1),l("span",rj,m(i.orderItem.currency),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.orderItem.transactionTime)),1)])),_:1})])),_:1},8,["class","index"])}],["__scopeId","data-v-0d1059ff"]]),{enableGstAndTds:nj}=mt,oj=[{id:"market",lang:"trading.orders.markets",textAlign:"left"},{id:"orderType",lang:"trading.orders.type",textAlign:"left",sortable:!0},{id:"originalUserPrice",lang:"trading.orders.originalPrice",textAlign:"left"},{id:"fillPrice",lang:"t.fillPrice",textAlign:"left"},{id:"originalSize",lang:"trading.orders.originalSize",textAlign:"left"},{id:"filledSize",lang:"trading.orders.filledSize",textAlign:"left"},{id:"fee",lang:nj?"t.feesAndTaxes":"trading.orders.fee",textAlign:"left"},{id:"value",lang:"trading.orders.value",textAlign:"left"},{id:"transactionTime",lang:"trading.orders.date",textAlign:"left",sortable:!0}],sj={name:"FillsOrders",components:{FillsOrderListHeader:KQ,FillsOrderListRow:aj,NoD
1ataAvailable:it},data:()=>({isLoading:!1,headerTitles:oj,sortKey:!1,sortOrder:!1}),computed:{...b({spotWsData:"spotWsData",isLogin:"loginState"}),...y(qe,["marketSymbol","currentSpotMarketBaseCurrency"]),...U(["isNightTheme"]),ordersData(){const e=this.spotWsData.orderTrade.filter((({orderType:e})=>"O"!==e));return this.sortKey&&this.sortOrder?e.sort(((e,t)=>{if("orderType"===this.sortKey){const{orderType:i,orderMode:r,triggerOrderType:a}=e,{orderType:n,orderMode:o,triggerOrderType:s}=t,l=`${i}_${r}_${a}`,u=`${n}_${o}_${s}`;return"asc"===this.sortOrder?l.localeCompare(u):u.localeCompare(l)}return"asc"===this.sortOrder?e[this.sortKey]-t[this.sortKey]:t[this.sortKey]-e[this.sortKey]})):e},emptyOrderData(){return!this.ordersData||0===this.ordersData.length}},watch:{marketSymbol(){this.islogin&&(this.isLoading=!0)},ordersData(){const e=this.ordersData[0]?this.ordersData[0].baseCurrency:"";this.currentSpotMarketBaseCurrency!==e&&0!==this.ordersData.length||(this.isLoading=!1)}},methods:{setSortData({key:e,order:t}){this.sortKey=e,this.sortOrder=t},getMode:e=>e===st.BUY?"buy":e===st.SELL?"sell":void 0}},lj={class:"fills-orders-wrapper"},uj={ref:"tableWrapper",class:"table-wrapper"};const cj=$n(sj,[["render",function(e,t,i,r,u,p){const h=a("FillsOrderListHeader"),m=a("FillsOrderListRow"),f=a("NoDataAvailable"),v=a("DataTable"),y=H("loading");return B((o(),c("div",lj,[l("div",uj,[d(v,{emptyText:e.$t("msg.noData"),isEmpty:p.emptyOrderData,"fix-header":""},{header:s((()=>[d(h,{headerTitles:u.headerTitles,sortKey:u.sortKey,onSort:p.setSortData},null,8,["headerTitles","sortKey","onSort"])])),body:s((()=>[(o(!0),c(g,null,R(p.ordersData,((e,t)=>(o(),n(m,{key:`${e.orderId}_${e.tradeId}`,index:t,direction:p.getMode(e.orderMode),orderItem:e},null,8,["index","direction","orderItem"])))),128))])),empty:s((()=>[d(f,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["emptyText","isEmpty"])],512)])),[[y,u.isLoading,"streamingLight"]])}],["__scopeId","data-v-a18f4a8c"]]),{enableLastPriceDependentUI:dj}=zt,pj={name:"TwapOrderListRow",components:{OrderType:xQ},props:{orderItem:{type:Object,default:function(){return{}}},direction:{type:String,required:!0},index:{type:Number,required:!0}},emits:["mouseover","mouseleave"],setup(){const{convertToDisplaySymbol:e}=Je(),{fiatRateMap:t}=Q(In());return{convertToDisplaySymbol:e,fiatRateMap:t}},data:()=>({SPOT_ORDER_MODE:st,SPOT_ORDER_TYPE:ct,enableLastPriceDependentUI:dj}),computed:{...b(["lang"]),...y(qe,["getExchangeInfoBySymbol"]),...y(qe,["getExchangeInfoByQuote","getMarketSymbolFromBaseCurrency","getDisplayNameBySymbol"]),dynamicCurrency(){return this.orderItem.orderMode===st.BUY?this.orderItem.displayCurrency:this.orderItem.crypto},lasting(){const e=(new Date).getTime(),t=de(e,this.orderItem.time);return`${t?`${t}H `:""}${pe(e,this.orderItem.time)%60}M`},period(){const e=this.orderItem.orderDetail.timePeriod,t=Math.floor(e/60),i=Math.floor(t/60);return`${i?`${i}H `:""}${t%60}M`},marketSymbol(){return this.getMarketSymbolFromBaseCurrency(this.orderItem.crypto)},displayMarketName(){return this.convertToDisplaySymbol(this.marketSymbol)},displayName(){return this.getDisplayNameBySymbol(this.orderItem.crypto)},orderMarketRoute(){return{name:"tradingId",params:{lang:this.lang,id:`${this.marketSymbol}-${this.orderItem.currency}`},state:{noScrollTop:this.isMobile}}},showLinkMarketLine(){return`${this.orderItem.crypto}-${this.orderItem.currency}`!==this.$route.params.id},averageFillPrice(){const{symbol:e}=this.orderItem,t=this.getExchangeInfoBySymbol(e).priceDecimal??0;return S(this.orderItem.averageFillPrice).toFixed(t+1,S.ROUND_DOWN)},filled(){const e=this.$filters.formatNumber(this.orderItem.fillSize,"max8"),t=this.$filters.formatNumber(this.orderItem.originalSize,"max8"),i=Math.max(pr(e),pr(t));return`${S(this.orderItem.fillSize).toFixed(i,S.ROUND_DOWN)} / ${S(this.orderItem.originalSize).toFixed(i,S.ROUND_DOWN)}`},formattedActivationPrice(){const{symbol:e}=this.orderItem,t=this.getExchangeInfoBySymbol(e).priceDecimal??"max8";if(this.orderItem.activationPrice){const e=this.fiatRateMap[this.orderItem.currency],i=e?S(this.orderItem.activationPrice).times(e).toNumber():this.orderItem.activationPrice;return this.$filters.formatNumber(i,{formatKey:t,currency:this.orderItem.currency})}return"-"}},methods:{getOrderValue(e){const{price:t,amount:i}=e;return S(t).times(i).toNumber()},getFeeDecimal(e){const{orderMode:t,currency:i}=e,r=t===st.BUY?"baseFeeDecimal":"quoteFeeDecimal";return this.getExchangeInfoByQuote(i)[r]}}},hj={class:"market-column-content"},mj={class:"market"},gj={class:"currency"},fj={class:"currency"},vj={class:"currency"},yj={class:"currency"};const bj=$n(pj,[["render",function(e,t,i,r,u,f){const v=a("Cell"),y=a("RouterLink"),b=a("OrderType"),S=a("Row");return o(),n(S,{class:C(["twap-order-list-row",[i.direction]]),index:i.index,onMouseover:t[0]||(t[0]=t=>e.$emit("mouseover",t)),onMouseleave:t[1]||(t[1]=t=>e.$emit("mouseleave",t))},{default:s((()=>[d(v,{textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.orderItem.time)),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[l("div",hj,[d(y,{class:"market-link",to:f.orderMarketRoute},{default:s((()=>[l("span",{class:C(["crypto",{underline:f.showLinkMarketLine}])},m(f.displayMarketName),3),l("span",mj,m(f.displayName),1)])),_:1},8,["to"])])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[d(b,{order:i.orderItem},null,8,["order"])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.filled)+" ",1),l("span",gj,m(f.dynamicCurrency),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.averageFillPrice)+" ",1),l("span",fj,m(i.orderItem.displayCurrency),1)])),_:1}),d(v,{textAlign:"left",class:"duration-column"},{default:s((()=>[p(m(f.lasting)+" / "+m(f.period),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(f.formattedActivationPrice),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(i.orderItem.orderDetail.randomizeSize?"â":"-"),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[p(m(i.orderItem.orderDetail.makerFirst?"â":"-"),1)])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.maxSpread?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(100*i.orderItem.orderDetail.maxSpread,"max8"))+" ",1),t[2]||(t[2]=l("span",{class:"currency"},"%",-1))],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1}),u.enableLastPriceDependentUI?(o(),n(v,{key:0,textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.maxDistanceThroughBook?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(100*i.orderItem.orderDetail.maxDistanceThroughBook,"max8"))+" ",1),t[3]||(t[3]=l("span",{class:"currency"},"%",-1))],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1})):h("",!0),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.subTwapMaxOrderSize?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(i.orderItem.orderDetail.subTwapMaxOrderSize,"max8"))+" ",1),l("span",vj,m(f.dynamicCurrency),1)],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[i.orderItem.orderDetail.pausePrice?(o(),c(g,{key:0},[p(m(e.$filters.formatNumber(i.orderItem.orderDetail.pausePrice,{formatKey:"max8",currency:i.orderItem.displayCurrency}))+" ",1),l("span",yj,m(i.orderItem.displayCurrency),1)],64)):(o(),c(g,{key:1},[p("-")],64))])),_:1})])),_:1},8,["class","index"])}],["__scopeId","data-v-1e235b16"]]),{enableLastPriceDependentUI:Sj}=zt,Cj=[{id:"time",lang:"t.time",textAlign:"left",sortable:!0},{id:"market",lang:"trading.orders.markets",textAlign:"left"},{id:"side",lang:"t.side",textAlign:"left"},{id:"filled",lang:"futuresMain.activeOrders.filled",textAlign:"left",tooltip:"trading.orders.hint.filled"},{id:"avgFilledPrice",lang:"trading.orders.avgFilledPrice",textAlign:"left"},{id:"lastingPeriod",lang:"trading.orders.lastingPeriod",textAlign:"left",tooltip:"trading.orders.hint.lasting"},{id:"activationPrice",lang:"t.activationPrice",textAlign:"left"},{id:"randomizeSize",lang:"trading.twap.randomizeSize",textAlign:"left"},{id:"makerFirst",lang:"trading.twap.makerFirst",textAlign:"left"},{id:"maxSpread",lang:"trading.twap.maxSpread",textAlign:"left"},...Sj?[{id:"maxDistanceThroughBook",lang:"trading.twap.maxDistanceThroughBook",textAlign:"left"}]:[],{id:"maxIndividualOrderSize",lang:"trading.twap.maxIndividualOrderSize",textAlign:"left"},{id:"pausePrice",lang:"trading.orders.pausePrice",textAlign:"left"}],Pj={name:"TwapOrders",components:{TwapOrderListHeader:iC,TwapOrderListRow:bj,CancelPanel:tC,NoDataAvailable:it},data:()=>({isLoading:!1,headerTitles:Cj,requestAnimationFrameId:!1,sortKey:!1,sortOrder:!1,cancelOrderMap:{},currentHoverRow:"",scrollTicking:!1,touchElement:null,isShowShadow:!1,isShowCancellAllDialog:!1,cancelPanelObserver:null}),computed:{...b(["spotWsData"]),...U(["isNightTheme"]),...y(qe,["marketSymbol"]),...y(ts,["showCurrentSymbolInTwap"]),ordersData(){const e=this.spotWsData.allTwapOrder,t=this.showCurrentSymbolInTwap?e.filter((e=>e.symbol===this.marketSymbol)):e;return this.sortKey?JSON.parse(JSON.stringify(t)).sort(((e,t)=>{if("orderType"===this.sortKey){const{orderType:i,orderMode:r,triggerOrderType:a}=e,{orderType:n,orderMode:o,triggerOrderType:s}=t,l=`${i}_${r}_${a}`,u=`${n}_${o}_${s}`;return"asc"===this.sortOrder?l.localeCompare(u):u.localeCompare(l)}return"market"===this.sortKey?"asc"===this.sortOrder?e.marketName.localeCompare(t.marketName):t.marketName.localeCompare(e.marketName):"asc"===this.sortOrder?e[this.sortKey]-t[this.sortKey]:t[this.sortKey]-e[this.sortKey]})):[...t].sort(((e,t)=>t.time-e.time))},emptyOrderData(){return!this.ordersData||0===this.ordersData.length}},mounted(){this.$nextTick((()=>{var e;this.tableWrapper=this.$refs.tableWrapper,this.initPanelEvents(this.tableWrapper),this.tableWrapper.addEventListener("scroll",this.checkShowShadow),(null==(e=this.$refs.cancelPanel)?void 0:e.$refs.panel)?(this.cancelPanel=this.$refs.cancelPanel.$refs.panel,this.initPanelEvents(this.cancelPanel)):(this.cancelPanelObserver=new MutationObserver((e=>{e.forEach((e=>{var t;"childList"===e.type&&(this.cancelPanel=null==(t=this.$refs.cancelPanel)?void 0:t.$refs.panel,this.cancelPanel&&this.initPanelEvents(this.cancelPanel))}))})),this.cancelPanelObserver.observe(this.$el,{childList:!0,subtree:!0})),this.gridWrapperObserver=new MutationObserver(this.checkShowShadow),this.gridWrapperObserver.observe(this.tableWrapper.parentNode,{attributes:!0,childList:!0,subtree:!0}),this.checkShowShadow()}))},beforeUnmount(){cancelAnimationFrame(this.requestAnimationFrameId),clearTimeout(this.timeout),this.removePanelEvents(this.tableWrapper),this.removePanelEvents(this.cancelPanel),this.tableWrapper.removeEventListener("scroll",this.checkShowShadow),this.gridWrapperObserver&&this.gridWrapperObserver.disconnect(),this.cancelPanelObserver&&this.cancelPanelObserver.disconnect()},methods:{...v("trading",["beforeSpotTradingBehaviorFn"]),initPanelEvents(e){e.addEventListener("scroll",this.syncScroll),e.addEventListener("touchstart",this.setTouchElement),e.addEventListener("touchmove",this.syncScroll),e.addEventListener("touchend",this.syncScroll)},removePanelEvents(e){e.removeEventListener("scroll",this.syncScroll),e.removeEventListener("touchstart",this.setTouchElement),e.removeEventListener("touchmove",this.syncScroll),e.removeEventListener("touchend",this.syncScroll)},setSortData({key:e,order:t}){this.sortKey=e,this.sortOrder=t},deleteAll(){},getMode:e=>e===st.BUY?"buy":e===st.SELL?"sell":void 0,async toggleCloseOrder(e){if(!this.cancelOrderMap[e]){if(!(await this.beforeSpotTradingBehaviorFn({appContext:this._.a
1ppContext,tradeBehavior:Zt.CLICK_CANCEL_ORDER_BTN})))return}this.cancelOrderMap[e]=!this.cancelOrderMap[e]},confirmCloseOrder(e){Jt.cancelOrderV3_2(e).then((()=>{delete this.cancelOrderMap[e.orderID]}))},setCurrentHoverRow(e){this.currentHoverRow=e},setTouchElement(e){const t=e.target,i=t.parentElement,r=t.getAttribute("class")||"",a=i.getAttribute("class")||"";r.includes("cancel")||a.includes("cancel")?this.touchElement=this.cancelPanel:this.touchElement=this.tableWrapper,this.syncScroll(e)},syncScroll(e){this.scrollTicking||(this.requestAnimationFrameId=requestAnimationFrame((()=>{let t,i;const r=this.tableWrapper.scrollHeight-this.tableWrapper.clientHeight;e.type.includes("touch")?(i=this.touchElement===this.tableWrapper?this.cancelPanel:this.tableWrapper,t=this.touchElement.scrollTop):(i="table-wrapper"===e.target.className?this.cancelPanel:this.tableWrapper,t=e.target.scrollTop),clearTimeout(this.timeout),i&&(i.removeEventListener("scroll",this.syncScroll),i.scrollTop=t,this.timeout=setTimeout((()=>{i.addEventListener("scroll",this.syncScroll)}),100)),t>r&&(this.cancelPanel.scrollTop=r),this.scrollTicking=!1}))),this.scrollTicking=!0},checkShowShadow(){const e=this.$refs.tableWrapper,{scrollLeft:t,scrollWidth:i,clientWidth:r}=e,a=t+r===i;this.isShowShadow=!a}}},kj={class:"orders-wrapper"},Tj={ref:"tableWrapper",class:"table-wrapper"};const Mj=$n(Pj,[["render",function(e,t,i,r,u,p){const h=a("TwapOrderListHeader"),m=a("TwapOrderListRow"),f=a("NoDataAvailable"),v=a("DataTable"),y=a("CancelPanel"),b=H("loading");return B((o(),c("div",kj,[l("div",Tj,[d(v,{emptyText:e.$t("msg.noData"),isEmpty:p.emptyOrderData,"fix-header":""},{header:s((()=>[d(h,{headerTitles:u.headerTitles,sortKey:u.sortKey,onSort:p.setSortData},null,8,["headerTitles","sortKey","onSort"])])),body:s((()=>[(o(!0),c(g,null,R(p.ordersData,((e,i)=>(o(),n(m,{key:`${e.displayCurrency}-${e.orderID}`,index:i,direction:p.getMode(e.orderMode),orderItem:e,onMouseover:t=>p.setCurrentHoverRow(e.orderID),onMouseleave:t[0]||(t[0]=e=>p.setCurrentHoverRow(""))},null,8,["index","direction","orderItem","onMouseover"])))),128))])),empty:s((()=>[d(f,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["emptyText","isEmpty"])],512),d(y,{ref:"cancelPanel",class:C(["cancel-panel",{shadow:u.isShowShadow}]),hasOpenOrder:!p.emptyOrderData,openOrderList:p.ordersData,cancelOrderMap:u.cancelOrderMap,toggleCloseOrder:p.toggleCloseOrder,confirmCloseOrder:p.confirmCloseOrder,deleteAll:p.deleteAll,currentHoverRow:u.currentHoverRow,enableCancelAll:!1},null,8,["class","hasOpenOrder","openOrderList","cancelOrderMap","toggleCloseOrder","confirmCloseOrder","deleteAll","currentHoverRow"])])),[[b,u.isLoading,"streamingLight"]])}],["__scopeId","data-v-e654c16d"]]),{enableEarn:Lj}=mt;const wj=$n({name:"SpotDcaHeaderRow",props:{hideActions:{type:Boolean,default:!1}},computed:{headerList(){return[{id:"frontBar",textAlign:"left",class:"front-bar-header-cell"},{id:"symbol",lang:this.$t("futuresMain.symbol"),textAlign:"left"},{id:"cycle",lang:this.$t("t.cycle"),textAlign:"left"},{id:"executedInvestment",lang:this.$t("trading.bot.executedInvestment"),textAlign:"left"},{id:"executedTimes",lang:this.$t("trading.bot.executedTimes"),textAlign:"left"},{id:"unrealizedPNL",lang:this.$t("futuresMain.marginBalanace.unrealizedPNL"),textAlign:"left"},{id:"duration",lang:this.$t("t.duration"),textAlign:"left"},{id:"createTime",lang:this.$t("t.createTime"),textAlign:"left"},{id:"subscribeEarn",lang:this.$t("trading.bot.dca.subscribeEarn"),textAlign:"left",isDisabled:!Lj},{id:"status",lang:this.$t("t.status"),textAlign:"left"},{id:"actions",isDisabled:this.hideActions}].filter((e=>!e.isDisabled))}}},[["render",function(e,t,i,r,l,u){const d=a("Cell"),h=a("HeaderRow",!0);return o(),n(h,null,{default:s((()=>[(o(!0),c(g,null,R(u.headerList,(e=>(o(),n(d,{key:e.id,textAlign:e.textAlign,class:C(e.class)},{default:s((()=>[p(m(e.lang),1)])),_:2},1032,["textAlign","class"])))),128))])),_:1})}],["__scopeId","data-v-3ce9aab2"]]),{enableEarn:Dj}=mt,Oj={name:"SpotDcaListRow",components:{FrontBarCell:rh,SymbolLink:ah,DirectionTag:$f,PnL:Vk,DetailButton:iL,ShareButton:rL,CloseButton:aL},props:{data:{type:Object,required:!0},index:{type:Number,required:!0},isHistory:{type:Boolean,default:!1},hideInlineActions:{type:Boolean,default:!1}},emits:["clickShareBot","clickCloseBot"],data:()=>({enableEarn:Dj,BotStatus:Fr}),computed:{...b(["lang"]),...y(qe,["getExchangeInfoBySymbol"]),isLong(
1){return"LONG"===this.data.direction},investmentCurrency(){return this.isLong?this.data.quoteCurrency:this.data.baseCurrency},investmentFormat(){const e=this.getExchangeInfoBySymbol(this.marketName),{priceDecimal:t=0,sizeDecimal:i=0}=e||{};return{formatKey:String(this.isLong?t:i),currency:this.investmentCurrency}},marketName(){var e,t;return`${null==(e=this.data)?void 0:e.symbol}-${null==(t=this.data)?void 0:t.quoteCurrency}`},textAlign(){return this.isHistory?"right":"left"}},methods:{getCycleDisplayText:go,getBotStatusText:so,getCloseReasonText(e,t){return[Fr.DEACTIVATED,Fr.CLOSED].includes(e)?this.$te(Er[t])?this.$t(Er[t]):t:"-"},goToDetail(e,t){this.$router.push({name:ai.SPOT_DCA_BOT_DETAIL,params:{lang:this.lang,id:e,botId:t}})}}},Ij={class:"unit"},xj={class:"total-times"},_j={class:"actions-wrap"};const Aj=$n(Oj,[["render",function(e,t,i,r,u,c){const g=a("FrontBarCell"),f=a("SymbolLink"),v=a("Cell"),y=a("DirectionTag"),b=a("PnL"),S=a("DetailButton"),P=a("ShareButton"),k=a("CloseButton"),T=a("Row");return o(),n(T,{index:i.index},{default:s((()=>[d(g,{direction:i.data.direction},null,8,["direction"]),d(v,{textAlign:"left"},{default:s((()=>[d(f,{symbol:c.marketName,isSpot:""},null,8,["symbol"])])),_:1}),d(v,{textAlign:"left"},{default:s((()=>[d(y,{direction:i.data.direction,displayText:c.getCycleDisplayText(i.data.detail.cycle,i.data.direction)},null,8,["direction","displayText"])])),_:1}),d(v,{textAlign:c.textAlign},{default:s((()=>[p(m(e.$filters.formatNumber(i.data.detail.totalInvestment,c.investmentFormat))+" ",1),l("span",Ij,m(c.investmentCurrency),1)])),_:1},8,["textAlign"]),d(v,{textAlign:c.textAlign},{default:s((()=>[p(m(i.data.detail.investmentCount)+" / ",1),l("span",xj,m(i.data.detail.numberOfInvestment||"-"),1)])),_:1},8,["textAlign"]),d(v,{textAlign:c.textAlign},{default:s((()=>[d(b,{pnl:i.data.unrealizedProfit,roi:i.data.unrealizedRoi,unit:i.data.quoteCurrency},null,8,["pnl","roi","unit"])])),_:1},8,["textAlign"]),d(v,{textAlign:"left"},{default:s((()=>[p(m(i.data.duration),1)])),_:1}),i.isHistory?(o(),n(v,{key:0,textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.data.closedAt,"yyyy-MM-dd HH:mm")),1)])),_:1})):(o(),n(v,{key:1,textAlign:"left"},{default:s((()=>[p(m(e.$filters.formatDate(i.data.createdAt,"yyyy-MM-dd HH:mm")),1)])),_:1})),u.enableEarn?(o(),n(v,{key:2,textAlign:"left"},{default:s((()=>[p(m(i.data.detail.flexibleEarn?e.$t("t.enable"):e.$t("t.disable")),1)])),_:1})):h("",!0),d(v,{textAlign:"left"},{default:s((()=>[l("span",{class:C({"brand-color-negative":i.data.state===u.BotStatus.DEACTIVATED})},m(c.getBotStatusText(i.data.state)),3)])),_:1}),i.isHistory?(o(),n(v,{key:3,textAlign:"left"},{default:s((()=>[l("span",{class:C({"brand-color-negative":i.data.state===u.BotStatus.DEACTIVATED})},m(c.getCloseReasonText(i.data.state,i.data.reason)),3)])),_:1})):h("",!0),i.hideInlineActions?h("",!0):(o(),n(v,{key:4,textAlign:"left"},{default:s((()=>[l("div",_j,[d(S,{onClick:t[0]||(t[0]=e=>c.goToDetail(c.marketName,i.data.tradingBotId))}),d(P,{onClick:t[1]||(t[1]=t=>e.$emit("clickShareBot",i.data))}),i.isHistory?h("",!0):(o(),n(k,{key:0,onClick:t[2]||(t[2]=t=>e.$emit("clickCloseBot",i.data))},{default:s((()=>[p(m(e.$t("trading.bot.closeBot")),1)])),_:1}))])])),_:1}))])),_:1},8,["index"])}],["__scopeId","data-v-be409c9c"]]),Rj={ref:"panel",class:"dca-actions-panel"},Fj={class:"actions-wrap"};const Ej={name:"DcaBots",components:{BotDataTable:$n({name:"SpotDcaBotDataTable",components:{SpotDcaHeaderRow:wj,SpotDcaListRow:Aj,NoDataAvailable:it,ActionsPanel:$n(A({__name:"ActionsPanel",props:{dataList:{},currentHoverRow:{default:""}},emits:["clickShareBot","clickCloseBot"],setup(e,{emit:t}){const i=t,r=k(),a=le(),n=M((()=>r.state.lang));return(e,t)=>(o(),c("div",Rj,[t[0]||(t[0]=l("div",{class:"panel-header"},null,-1)),(o(!0),c(g,null,R(e.dataList,(t=>(o(),c("div",{key:t.tradingBotId,class:C(["action-row",{hover:t.tradingBotId===e.currentHoverRow}])},[l("div",Fj,[d(iL,{onClick:e=>(e=>{a.push({name:ai.SPOT_DCA_BOT_DETAIL,params:{lang:n.value,id:`${e.symbol}-${e.quoteCurrency}`,botId:e.tradingBotId}})})(t)},null,8,["onClick"]),d(rL,{onClick:e=>i("clickShareBot",t)},null,8,["onClick"]),d(aL,{onClick:e=>i("clickCloseBot",t)},{default:s((()=>[p(m(e.$t("trading.bot.closeBot")),1)])),_:2}
1,1032,["onClick"])])],2)))),128))],512))}}),[["__scopeId","data-v-1df01825"]]),TableWithActionsPanel:gy},props:{dataList:{type:Array,default:()=>[]}},emits:["clickShareBot","clickCloseBot"],data:()=>({currentHoverRow:""}),computed:{...U(["isNightTheme"])},methods:{setCurrentHoverRow(e){this.currentHoverRow=e}}},[["render",function(e,t,i,r,l,u){const p=a("SpotDcaHeaderRow"),h=a("SpotDcaListRow"),m=a("NoDataAvailable"),f=a("DataTable"),v=a("ActionsPanel"),y=a("TableWithActionsPanel");return o(),n(y,{style:{"--table-wrapper-height":"100%"}},te({table:s((()=>[d(f,{isEmpty:!i.dataList.length},{header:s((()=>[d(p,{hideActions:""})])),body:s((()=>[(o(!0),c(g,null,R(i.dataList,((i,r)=>(o(),n(h,O({ref_for:!0},e.$attrs,{key:i.tradingBotId,data:i,index:r,hideInlineActions:"",onMouseover:e=>u.setCurrentHoverRow(i.tradingBotId),onMouseleave:t[0]||(t[0]=e=>u.setCurrentHoverRow(""))}),null,16,["data","index","onMouseover"])))),128))])),empty:s((()=>[d(m,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["isEmpty"])])),_:2},[i.dataList.length?{name:"actions",fn:s((()=>[d(v,{dataList:i.dataList,currentHoverRow:l.currentHoverRow,onClickShareBot:t[1]||(t[1]=t=>e.$emit("clickShareBot",t)),onClickCloseBot:t[2]||(t[2]=t=>e.$emit("clickCloseBot",t))},null,8,["dataList","currentHoverRow"])])),key:"0"}:void 0]),1024)}],["__scopeId","data-v-2ae19a96"]]),SharePnlDialog:Kn,ConfirmCloseDialog:PC},setup(){const{convertToDisplaySymbol:e}=Je();return{convertToDisplaySymbol:e}},data:()=>({showShareDialog:!1,shareInfo:{},showConfirmCloseDialog:!1,botToClose:{}}),computed:{...y(kQ,["dcaBotList"]),...y(ts,["showCurrentSymbolInBot"]),...y(qe,["marketSymbol"]),displayedBotList(){return this.showCurrentSymbolInBot?this.dcaBotList.filter((e=>`${e.symbol}-${e.quoteCurrency}`===this.marketSymbol)):this.dcaBotList}},methods:{...f(kQ,["closeDcaBot"]),handleClickShareBot(e){const{symbol:t,quoteCurrency:i,direction:r,detail:{totalInvestment:a,totalIncome:n},totalRoi:o}=e,s=fo({isLong:"LONG"===r,totalInvestment:a,totalIncome:n}),l=this.convertToDisplaySymbol(t);this.shareInfo={...e,percentage:o,symbolText:`${l}-${i}`,averageEntryPrice:s},this.showShareDialog=!0},handleClickCloseBot(e){this.showConfirmCloseDialog=!0,this.botToClose=e},async handleConfirmCloseBot(){this.showConfirmCloseDialog=!1;const{tradingBotId:e}=this.botToClose;await this.closeDcaBot(e)}}},Bj={class:"dca-bots-wrapper"};const zj=$n(Ej,[["render",function(e,t,i,r,s,l){const u=a("BotDataTable"),p=a("SharePnlDialog"),m=a("ConfirmCloseDialog");return o(),c("div",Bj,[d(u,{dataList:l.displayedBotList,onClickShareBot:l.handleClickShareBot,onClickCloseBot:l.handleClickCloseBot},null,8,["dataList","onClickShareBot","onClickCloseBot"]),s.showShareDialog?(o(),n(p,{key:0,show:s.showShareDialog,"onUpdate:show":t[0]||(t[0]=e=>s.showShareDialog=e),position:s.shareInfo,isBotSharing:""},null,8,["show","position"])):h("",!0),d(m,{visible:s.showConfirmCloseDialog,"onUpdate:visible":t[1]||(t[1]=e=>s.showConfirmCloseDialog=e),title:e.$t("trading.bot.stopConfirm.title"),description:e.$t("trading.bot.stopConfirm.desc",{symbol:s.botToClose.symbol}),closeBtnText:e.$t("trading.bot.closeBot"),onConfirmClose:l.handleConfirmCloseBot}
1,null,8,["visible","title","description","closeBtnText","onConfirmClose"])])}],["__scopeId","data-v-ca898b85"]]);const $j=$n({name:"FundsOrderListHeader",components:{SortableHeaderCell:dr},props:{headerTitles:{type:Array,default:function(){return[]}},sortKey:{type:[Boolean,String],required:!1}},methods:{getClass(e){const t=[];return e.textAlign&&t.push(`align-${e.textAlign}`),t}}},[["render",function(e,t,i,r,u,d){const h=a("Tooltip"),f=a("SortableHeaderCell"),v=a("HeaderRow");return o(),n(v,{class:"order-header"},{default:s((()=>[(o(!0),c(g,null,R(i.headerTitles,(t=>(o(),n(f,O({ref_for:!0},e.$attrs,{key:t.id,currentSortKey:i.sortKey,class:d.getClass(t),title:t}),{content:s((()=>[l("span",null,[t.tooltip?(o(),n(h,{key:0,content:e.$t(t.lang),tooltip:e.$t(t.tooltip)},null,8,["content","tooltip"])):(o(),c(g,{key:1},[p(m(`${e.$t(t.lang)} ${t.subLang?`(${t.subLang})`:""}`),1)],64))])])),_:2},1040,["currentSortKey","class","title"])))),128))])),_:1})}],["__scopeId","data-v-5be2c821"]]),{spotTradeDefaultQuoteCurrency:Nj}=mt,Uj={name:"FundsOrderListRow",props:{orderItem:{type:Object,default:function(){return{}}},index:{type:Number,required:!0},valueCurrency:{type:String,default:""}},computed:{...b(["lang"]),...y(qe,["marketMap"]),...y(qe,["getMarketSymbolFromBaseCurrency"]),orderMarketRoute(){var e,t;let i=this.getMarketSymbolFromBaseCurrency(this.orderItem.shortName),r=Nj;if(!this.marketMap[i]){if(!(null==(t=null==(e=this.marketMap[Nj])?void 0:e.quoteMarkets)?void 0:t.includes(i)))return!1;r=i,i=Nj}const a=this.marketMap[i].quoteMarkets,n=a.includes(r)?r:a[0];return{name:"tradingId",params:{lang:this.lang,id:`${i}-${n}`},state:{noScrollTop:this.isMobile}}},showLinkMarketLine(){const e=Ya(this.$route.params.id).marketCurrency;return this.orderItem.shortName!==e}}},Hj={class:"market"},Vj={class:"crypto"},Wj={class:"market"},qj={class:"currency"},Gj={class:"currency"};const Kj={name:"FundsOrders",components:{FundsOrderListHeader:$j,FundsOrderListRow:$n(Uj,[["render",function(e,t,i,r,u,h){const f=a("RouterLink"),v=a("Cell"),y=a("Row");return o(),n(y,{class:"order-list-row",index:i.index},{default:s((()=>[d(v,{textAlign:"left"},{default:s((()=>[h.orderMarketRoute?(o(),n(f,{key:0,class:"market-link",to:h.orderMarketRoute},{default:s((()=>[l("span",{class:C(["crypto",{underline:h.showLinkMarketLine}])},m(i.orderItem.shortName),3),l("span",Hj,m(i.orderItem.name),1)])),_:1},8,["to"])):(o(),c(g,{key:1},[l("span",Vj,m(i.orderItem.shortName),1),l("span",Wj,m(i.orderItem.name),1)],64))])),_:1}),d(v,null,{default:s((()=>[p(m(e.$filters.formatNumber(i.orderItem.total,"max8"))+" ",1),l("span",qj,m(i.orderItem.shortName),1)])),_:1}),d(v,null,{default:s((()=>[p(m(e.$filters.formatNumber(i.orderItem.available,"max8"))+" ",1),l("span",Gj,m(i.orderItem.shortName),1)])),_:1}),d(v,null,{default:s((()=>[p(m(e.$filters.formatNumber(i.orderItem.value,{formatKey:"max2",currency:i.valueCurrency})),1)])),_:1})])),_:1},8,["index"])}],["__scopeId","data-v-90b7ba77"]]),NoDataAvailable:it},props:{hideLowValueFunds:{type:Boolean,required:!0},showCurrentSymbol:{type:Boolean,default:!1}},data:()=>({isLoading:!1,sortKey:"value",sortOrder:"desc"}),computed:{...b(["cryptoCurrencyList","currencyMap"]),...y(_n,["displayCurrency"]),...y(qe,["marketQuoteCurrency","marketCurrency"]),...U(["isNightTheme"]),headerTitles(){return[{id:"shortName",lang:"t.coin",textAlign:"left",sortable:!0},{id:"total",lang:"wallets.totalBalance",sortable:!0},{id:"available",lang:"t.availableBalance",sortable:!0},{id:"value",lang:"t.value",sortable:!0,subLang:this.displayCurrency}]},ordersData(){const e=this.cryptoCurrencyList.map((e=>{const t=this.currencyMap[e],i=this.getInversePrice(e),r=void 0!==i?S(t.total).times(i).toNumber():"--";return{...t,value:r}})).filter((e=>{if(this.showCurrentSymbol)return e.symbol===this.marketCurrency||e.shortName===this.marketQuoteCurrency;const t=!this.hideLowValueFunds||e.value>=1;return e.value>0&&t}));if(this.sortKey){const t="desc"===this.sortOrder;e.sort(((e,i)=>{if(e.symbol===this.marketCurrency)return-1;if(i.symbol===this.marketCurrency)return 1;const r=e[this.sortKey],a=i[this.sortKey];
1return"shortName"===this.sortKey?r<a?t?1:-1:r>a?t?-1:1:0:t?a-r:r-a}))}return e},emptyOrderData(){return!this.ordersData||0===this.ordersData.length}},watch:{displayCurrency:{immediate:!0,async handler(e){if(e){this.isLoading=!0;try{await this.updateInversePriceMap(e)}finally{this.isLoading=!1}}}}},methods:{...f(_n,["updateInversePriceMap","getInversePrice"]),setSortData({key:e,order:t}){this.sortKey=e,this.sortOrder=t}}},Qj={class:"orders-wrapper"},jj={ref:"tableWrapper",class:"table-wrapper"};const Yj=$n(Kj,[["render",function(e,t,i,r,u,p){const h=a("FundsOrderListHeader"),m=a("FundsOrderListRow"),f=a("NoDataAvailable"),v=a("DataTable"),y=H("loading");return B((o(),c("div",Qj,[l("div",jj,[d(v,{emptyText:e.$t("msg.noData"),isEmpty:p.emptyOrderData,"fix-header":""},{header:s((()=>[d(h,{headerTitles:p.headerTitles,sortKey:u.sortKey,onSort:p.setSortData},null,8,["headerTitles","sortKey","onSort"])])),body:s((()=>[(o(!0),c(g,null,R(p.ordersData,((t,i)=>(o(),n(m,{key:t.displayName,index:i,orderItem:t,valueCurrency:e.displayCurrency},null,8,["index","orderItem","valueCurrency"])))),128))])),empty:s((()=>[d(f,{isIconDark:e.isNightTheme,isLoginRequired:!0},null,8,["isIconDark"])])),_:1},8,["emptyText","isEmpty"])],512)])),[[y,u.isLoading,"streamingLight"]])}],["__scopeId","data-v-a86bbec9"]]),{disableLinkOnTrading:Zj,enableOrderHistorySpotOrder:Xj,enableSpotDcaBot:Jj}=mt,eY={name:"OrderHistory",components:{HistoryTabs:OQ,OpenOrders:GQ,FillsOrders:cj,TwapOrders:Mj,DcaBots:zj,FundsOrders:Yj,NotLogIn:An,IconHistory:cr},props:{boxFilled:{type:Boolean,default:!1}},data:()=>({disableLinkOnTrading:Zj,enableOrderHistorySpotOrder:Xj,currentTab:wn.ORDERS,hideLowValueFunds:!0,botListIntervalId:null}),computed:{...b(["loginState","spotWsData","userConfig","lang"]),...y(qe,["marketSymbol"]),...y(ts,["showCurrentSymbolInOrderHistory","showCurrentSymbolInTwap","showCurrentSymbolInBot","showCurrentSymbolInFunds"]),isFunds(){return this.currentTab===wn.FUNDS},isDcaBots(){return this.currentTab===wn.DCA_BOTS},isOrders(){return this.currentTab===wn.ORDERS},isTwap(){return this.currentTab===wn.TWAP_ORDERS},showCurrentPairCheckbox(){return this.isOrders||this.isTwap||this.isDcaBots||this.isFunds},currentPairChecked(){return this.isTwap?this.showCurrentSymbolInTwap:this.isDcaBots?this.showCurrentSymbolInBot:this.isFunds?this.showCurrentSymbolInFunds:this.showCurrentSymbolInOrderHistory},dataList(){switch(this.currentTab){case wn.ORDERS:return GQ;case wn.ORDER_FILLS:return cj;case wn.TWAP_ORDERS:return Mj;case wn.DCA_BOTS:return zj;case wn.FUNDS:return Yj;default:return null}}},created(){this.loginState&&Jj&&(this.fetchDcaBotList(),this.botListIntervalId=setInterval((()=>{this.fetchDcaBotList({hideCode:!0})}),5e3))},beforeUnmount(){clearInterval(this.botListIntervalId)},methods:{...v(["updateUserConfigByKey"]),...f(kQ,["fetchDcaBotList"]),...f(ts,["setShowCurrentSymbolInOrderHistory","setShowCurrentSymbolInTwap","setShowCurrentSymbolInBot","setShowCurrentSymbolInFunds"]),handleCurrentPairChange(e){this.isTwap?this.setShowCurrentSymbolInTwap(e):this.isDcaBots?this.setShowCurrentSymbolInBot(e):this.isFunds?this.setShowCurrentSymbolInFunds(e):this.setShowCurrentSymbolInOrderHistory(e)},handleClickGoHistory(){this.isDcaBots?this.goBotHistory():this.goTradingHistory()},goBotHistory(){this.$router.push({name:ai.TRADING_BOT_HISTORY,params:{lang:this.lang},state:{tradingBotType:Ur.SPOT_DCA}})},goTradingHistory(){this.$router.push({name:this.enableOrderHistorySpotOrder&&this.currentTab!==wn.ORDER_FILLS?"spotOpenOrder":"spotTradeHistory",params:{lang:this.lang}})}}},tY={class:"order-history-header no-select card-shell__header"},iY={class:"function-wrapper"},rY={key:0,class:"current-pair-checkbox"},aY={key:1,class:"hide-low-funds"},nY={class:"related-table"};const oY=$n(eY,[["render",function(e,t,i,r,u,g){const f=a("HistoryTabs"),v=a("Checkbox"),y=a("IconHistory");return o(),c("div",{class:C(["brand-card card-shell",{"box-fill":i.boxFilled}])},[l("div",tY,[d(f,{currentTab:u.currentTab,"onUpdate:currentTab":t[0]||(t[0]=e=>u.currentTab=e),class:"order-history-tabs"},null,8,["currentTab"]),l("div",iY,[g.showCurrentPairCheckbox?(o(),c("div",rY,[d(v,{value:g.currentPairChecked,name:"currentTradingPair","onUpdate:value":g.handleCurrentPairChange},{default:s((()=>[p(m(e.$t("trading.orders.currentTradingPair")),1)])),_:1},8,["value","onUpdate:value"])])):h("",!0),g.isFunds?(o(),c("div",aY,[d(v,{value:u.hideLowValueFunds,"onUpdate:value":t[1]||(t[1]=e=>u.hideLowValueFunds=e),name:"hideLowValueFunds"},{default:s((()=>[p(m(e.$t("wallets.hideSmallBalances")),1)])),_:1},8,["value"])])):h("",!0),g.isFunds||u.disableLinkOnTrading?h("",!0):(o(),c("div",{key:2,class:"go-history-wrapper",onClick:t[2]||(t[2]=(...e)=>g.handleClickGoHistory&&g.handleClickGoHistory(...e))},[d(y,{class:"icon-history"}),p(" "+m(g.isDcaBots?e.$t("trading.bot.history"):e.$t("msg.openOrder.tradeHistory")),1)]))])]),l("div",nY,[(o(),n(Fe,null,[(o(),n(F(g.dataList),{hideLowValueFunds:u.hideLowValueFunds,showCurrentSymbol:g.currentPairChecked}
1,null,8,["hideLowValueFunds","showCurrentSymbol"]))],1024))])],2)}],["__scopeId","data-v-ecb27871"]]),sY={...{RESIZABLE_ITEM_LIST:[{id:"order-form",layout:{[Qa.LARGE]:{x:34,y:0,w:6,h:40},[Qa.MEDIUM]:{x:18,y:0,w:6,h:32},[Qa.SMALL]:{x:13,y:0,w:5,h:30},[Qa.XTRA_SMALL]:{x:4,y:0,w:2,h:32},[Qa.XXTRA_SMALL]:{x:0,y:24,w:1,h:30}},customClass:"order-form-block"},{id:"order-fund",layout:{[Qa.LARGE]:{x:34,y:35,w:6,h:5,minH:5},[Qa.MEDIUM]:{x:18,y:27,w:6,h:5,minH:5},[Qa.SMALL]:{x:13,y:21,w:5,h:5,minH:5},[Qa.XTRA_SMALL]:{x:4,y:27,w:2,h:5,minH:5},[Qa.XXTRA_SMALL]:{x:0,y:24,w:1,h:5,minH:5}},customClass:"order-fund-block"},{id:"order-book",layout:{[Qa.LARGE]:{x:28,y:0,w:6,minW:5,h:40},[Qa.MEDIUM]:{x:14,y:0,w:4,minW:4,h:32},[Qa.SMALL]:{x:9,y:0,w:4,h:26},[Qa.XTRA_SMALL]:{x:2,y:0,w:2,h:12},[Qa.XXTRA_SMALL]:{x:0,y:0,w:1,h:14}}},{id:"order-depth-chart",layout:{[Qa.LARGE]:{x:0,y:55,w:6,h:8},[Qa.MEDIUM]:{x:0,y:46,w:6,h:8},[Qa.SMALL]:{x:0,y:33,w:5,h:8},[Qa.XTRA_SMALL]:{x:0,y:42,w:2,h:10},[Qa.XXTRA_SMALL]:{x:0,y:14,w:1,h:10}},hideLayout:{x:0,y:0,w:0,h:0}},{id:"market-info",layout:{[Qa.LARGE]:{x:0,y:0,w:28,minW:12,h:3,maxH:3},[Qa.MEDIUM]:{x:0,y:0,w:14,minW:12,h:3,maxH:3},[Qa.SMALL]:{x:0,y:0,w:9,h:3,maxH:3},[Qa.XTRA_SMALL]:{x:0,y:12,w:4,h:3,maxH:3},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:0,w:1,h:5,maxH:5},customClass:"market-chart-block"},{id:"trading-view",layout:{[Qa.LARGE]:{x:0,y:3,w:28,minW:12,h:37,minH:22},[Qa.MEDIUM]:{x:0,y:3,w:14,minW:12,h:29,minH:22},[Qa.SMALL]:{x:0,y:3,w:9,h:23,minH:22},[Qa.XTRA_SMALL]:{x:0,y:15,w:4,h:17},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:5,w:1,h:18}},{id:"history",layout:{[Qa.LARGE]:{x:0,y:30,w:34,h:25},[Qa.MEDIUM]:{x:0,y:30,w:18,h:25},[Qa.SMALL]:{x:0,y:26,w:13,h:25},[Qa.XTRA_SMALL]:{x:0,y:30,w:6,h:23},[Qa.XXTRA_SMALL]:{x:0,y:46,w:1,h:23}}},{id:"recent-trade",layout:{[Qa.LARGE]:{x:34,y:40,w:6,h:25},[Qa.MEDIUM]:{x:18,y:32,w:6,h:25},[Qa.SMALL]:{x:13,y:23,w:5,h:16},[Qa.XTRA_SMALL]:{x:0,y:0,w:2,h:12},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:23,w:1,h:10},hideLayout:{x:0,y:0,w:0,h:0}}],ARABIC_RESIZABLE_ITEM_LIST:[{id:"order-form",layout:{[Qa.LARGE]:{x:34,y:0,w:6,h:40},[Qa.MEDIUM]:{x:18,y:0,w:6,h:32},[Qa.SMALL]:{x:13,y:0,w:5,h:30},[Qa.XTRA_SMALL]:{x:4,y:0,w:2,h:32},[Qa.XXTRA_SMALL]:{x:0,y:13,w:1,h:30}},customClass:"order-form-block"},{id:"order-fund",layout:{[Qa.LARGE]:{x:34,y:35,w:6,h:5,minH:5},[Qa.MEDIUM]:{x:18,y:27,w:6,h:5,minH:5},[Qa.SMALL]:{x:13,y:21,w:5,h:5,minH:5},[Qa.XTRA_SMALL]:{x:4,y:27,w:2,h:5,minH:5},[Qa.XXTRA_SMALL]:{x:0,y:24,w:1,h:5,minH:5}},customClass:"order-fund-block"},{id:"order-book",layout:{[Qa.LARGE]:{x:28,y:0,w:6,minW:5,h:40},[Qa.MEDIUM]:{x:14,y:0,w:4,minW:4,h:32},[Qa.SMALL]:{x:9,y:0,w:4,h:26},[Qa.XTRA_SMALL]:{x:2,y:0,w:2,h:10},[Qa.XXTRA_SMALL]:{x:0,y:0,w:1,h:14}}},{id:"market-info",layout:{[Qa.LARGE]:{x:0,y:0,w:28,minW:12,h:3,maxH:3},[Qa.MEDIUM]:{x:0,y:0,w:14,minW:12,h:3,maxH:22},[Qa.SMALL]:{x:0,y:0,w:9,h:3,maxH:3},[Qa.XTRA_SMALL]:{x:0,y:10,w:4,h:3,maxH:3},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:0,w:1,h:5,maxH:5},customClass:"market-chart-block"},{id:"trading-view",layout:{[Qa.LARGE]:{x:0,y:3,w:28,minW:12,h:37,minH:22},[Qa.MEDIUM]:{x:0,y:3,w:14,minW:12,h:29,minH:22},[Qa.SMALL]:{x:0,y:3,w:9,h:23,minH:22},[Qa.XTRA_SMALL]:{x:0,y:15,w:4,h:19},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:5,w:1,h:18}},{id:"history",layout:{[Qa.LARGE]:{x:0,y:40,w:34,h:25},[Qa.MEDIUM]:{x:0,y:30,w:18,h:25},[Qa.SMALL]:{x:0,y:26,w:13,h:25},[Qa.XTRA_SMALL]:{x:0,y:26,w:6,h:23},[Qa.XXTRA_SMALL]:{x:0,y:36,w:1,h:23}}},{id:"recent-trade",layout:{[Qa.LARGE]:{x:34,y:40,w:6,h:25},[Qa.MEDIUM]:{x:18,y:32,w:6,h:25},[Qa.SMALL]:{x:13,y:26,w:5,h:16},[Qa.XTRA_SMALL]:{x:0,y:0,w:2,h:10},[Qa.XXTRA_SMALL]:{x:0,y:0,w:0,h:0}},isMobileChartMode:{x:0,y:23,w:1,h:10},hideLayout:{x:0,y:0,w:0,h:0}}]}},{spotTradeDefaultSymbol:lY,spotTradeDefaultQuoteCurrency:uY}=mt,cY=Object.keys(zt.symbolPrefixDisplayMap);const{RESIZABLE_ITEM_LIST:dY,ARABIC_RESIZABLE_ITEM_LIST:pY}=sY,{disableLinkOnTrading:hY,spotMetaTitleV2:mY,enableSpotMetaBySymbol:gY}=mt,{enableRecentTrades:fY}=zt;function vY(e,t,i){const r=e.findIndex((e=>e.id===i));if(r<0)return e;const a={...e[r]},n={...a.layout};Object.entries(t).forEach((e=>{const[t,i]=e;n[t]={...n[t],...i}})),a.layout=n,e[r]=a}let yY={};const bY={name:"TradingSpot",components:{OrderForm:PQ,OrderBookCard:Bl,MarketInfoCard:ld,TradingViewCard:Zd,DepthChartCard:Sc,Fun
1dingCard:eD,OrderHistory:oY,RecentTradesCard:Jl,GridShell:uH,MarketBar:vH,FullKycNotification:pn},provide(){return{getActionType:()=>this.actionType,tabsActionUpdate:this.tabsActionUpdate}},beforeRouteUpdate(e,t,i){this.timerUpdateMarketStatus(this),i()},setup(){const e=G(),t=k(),i=ue();!function(){const e=k(),t=qe(),i=ue(),r=le(),{updateSymbol:a}=ho(vo,{isTradePageMode:!0}),n=M((()=>Rn(i.params.id))),o=M((()=>Fn(i.params.id))),s=M((()=>{const{marketMap:e,marketList:i}=t,r=e[lY],a=r&&!r.marketClosed?r:e[i[0]],n=a.quoteMarkets.includes(uY)?uY:a.quoteMarkets[0];return`${a.symbol}-${n}`})),l=M((()=>{const{marketMap:e,marketList:i}=t,r=e[n.value];if(r)return r;if(cY.length>0)for(let t=0,a=cY.length;t<a;t++){const i=`${cY[t]}${n.value}`;if(e[i])return e[i]}for(let t=0,a=i.length;t<a;t++){const r=e[i[t]];if(r.coin===n.value)return r}})),u=M((()=>!l.value||l.value.marketClosed)),c=M((()=>l.value.quoteCurrency)),d=M((()=>l.value.displayQuote)),p=M((e=>{if(!l.value)return null;const t=l.value.quoteMarkets??[];return e&&e.size===t.length&&t.every((t=>e.has(t)))?e:new Set(t)})),h=M((()=>l.value.symbol)),m=M((()=>
1{if(0===t.marketList.length)return null;if(u.value)return s.value;if(!p.value.has(o.value)){if(0===p.value.size)return null;const t=En({symbol:h.value,displayQuote:d.value,quoteCurrency:c.value,validQuoteSet:p.value,isLogin:e.state.loginState,defaultBaseCurrencyShortName:e.state.defaultBaseCurrencyShortName});return`${h.value}-${t}`}return`${h.value}-${o.value}`}));w((()=>{t.setCurrentMarketSymbol(null)})),D(m,(n=>{null!==n&&(a(n),t.fetchExchangeInfo(n),t.setCurrentMarketSymbol(n),n!==i.params.id&&r.replace({name:"tradingId",params:{lang:e.state.lang,id:n},query:i.query}))}),{immediate:!0})}();const r=Un(),a=ja(),{convertToDisplaySymbol:n}=Je(),o=qe(),{getExchangeInfoBySymbol:s}=o,{marketSymbol:l,marketCurrency:u,marketQuoteCurrency:c}=Q(o),d=M((()=>t.state.orderBook.lastPrice)),p=M((()=>t.state.orderBook.lastPriceChange));const h=M((()=>{return(e=p.value)?e>0?"â²":"â¼":"";var e})),m=M((()=>function(e){const t=s(l.value).priceDecimal;return Qt(e,t)||""}(d.value))),g=M((()=>ns.digitalCurrency(u.value))),f=M((()=>{const t={price:m.value,gainsSymbol:h.value,marketCurrency:u.value,marketQuoteCurrency:c.value,marketName:g.value,brandName:e.t("brand.name")};if(gY){const i=`router.trading.${l.value}`;return Ui(i)?e.t(i):e.t("router.trading",t)}return mY?vn({$route:i,mapKey:"updateTitle",payload:t}):`${h.value}${m.value} (${l.value}) ${e.t(`router.${i.meta.key}`,{brandName:e.t("brand.name")})}`})),v=M((()=>
1{if(gY){const t=`router.trading.description.${l.value}`;return Ui(t)?e.t(t):e.t("router.trading.description")}return yn({$route:i,payload:{marketCurrency:u.value,marketQuoteCurrency:c.value,marketName:g.value,brandName:e.t("brand.name")}}).replace(/\s+/," ")})),y=bn({title:f,description:v});Me({title:f,meta:y});const b=M((()=>t.getters.isSubAccount)),S=he().appContext;return D(b,(()=>{t.dispatch("trading/beforeSpotTradingBehaviorFn",{appContext:S,tradeBehavior:Zt.ENTER_TRADING_PAGE})}),{once:!0}),{convertToDisplaySymbol:n,tradingDepthStore:r,marketTabStore:a,lastPrice:d,lastPriceChange:p}},data:()=>({TRADING_TYPE:It,disableLinkOnTrading:hY,enableRecentTrades:fY,notificationSerialId:0,notificationMap:{},autoScrollTrigger:!1,storedLayoutList:[],orderBookHeight:0,marketInfoWidth:0,moved:!1,timer:null,actionType:0,isHideOrderDepthChart:!1,orderDepthChartResizeTrigger:"",gridShellList:[]}),computed:{...b({accountInfo:"accountInfo",NOTIFICATION:"notification",spotWsData:"spotWsData",loginState:"loginState",currencyMap:"currencyMap",cryptoCurrencyList:"cryptoCurrencyList",quoteCurrencies:"quoteCurrencies",defaultBaseCurrencyShortName:"defaultBaseCurrencyShortName",isCnDomain:"isCnDomain",layoutLocked:e=>e.userConfig.spotLayoutLocked,triggerLayoutReset:"triggerLayoutReset",isMobileChartMode:"isMobileChartMode",lang:"lang",showDepthChart:e=>e.userConfig[He.DEPTH_CHART],apiResponseCode:"apiResponseCode",apiResponseExtraData:"apiResponseExtraData"}),...y(qe,{marketSymbol:"marketSymbol",marketCurrency:"marketCurrency",marketQuoteCurrency:"marketQuoteCurrency",getExchangeInfoBySymbol:"getExchangeInfoBySymbol",getMarketInfo:"getMarketInfo",currentMarketSymbol:"currentMarketSymbol"}),...U(["isArabic","userName"]),rowHeight:()=>16,layoutList:{get(){return this.resizableItemList.reduce(((e,t)=>{const i=this.storedLayoutList.find((e=>e.id===t.id));let r=!1;switch(t.id){case"order-depth-chart":r=this.hideDepthChart;break;case"order-fund":r=hY||!this.loginState}const a={};return i&&(a.id=i.id,a.layout={...i.layout}),r||e.push({...t,...a}),e}),[])},set(e){this.preservedLayoutList=e,this.storedLayoutList=e,es(this.$route.name,this.langKey,this.userName,e)}},langKey(){return this.isArabic?"ar":""},resizableItemList(){return this.isArabic?pY:dY},hideDepthChart(){return!this.showDepthChart&&!this.isMobile}},watch:{$mq(){this.isMobile||this.setMobileChartMode(!1)},apiResponseCode(e){[hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE,hn.ORDER_PRICE_TWAP_ARGS_OUTSIDE_ALLOWED_RANGE,hn.ORDER_PRICE_TRIGGER_ARGS_OUTSIDE_ALLOWED_RANGE].includes(e)&&this.handlePriceProtectionMessage(e)},NOTIFICATION(e){this.pushNotification(e)},currentMarketSymbol:{handler(e){if(!e)return;const[t,i]=e.split("-");this.setMarketDisplayQuote(t,i)},immediate:!0},marketSymbol:{handler(){this.removeNotification(),this.spotUpdateLastMarketSymbol(this.marketSymbol)},flush:"post"},triggerLayoutReset(){this.storedLayoutList=[]},storedLayoutList(e){mn(e,this.preservedLayoutList)||(this.orderBookHeight=0,this.marketInfoWidth=0,this.triggerOrderDepthChartResize(),this.createGridShellList())},lang(){this.storedLayoutList=Jo(this.$route.name,this.langKey,this.userName)},userName(){this.storedLayoutList=Jo(this.$route.name,this.langKey,this.userName)},hideDepthChart(){this.triggerOrderDepthChartResize()},isMobileChartMode(){this.createGridShellList()},positionHeight(){this.createGridShellList()},showDepthChart(){this.triggerOrderDepthChartResize(),this.createGridShellList()}},created(){this.timerUpdateMarketStatus(this),this.initLayout(),this.marketSymbol&&this.spotUpdateLastMarketSymbol(this.marketSymbol)},async mounted(){this.adjustOrderFormHeight(),this.beforeSpotTradingBehaviorFn({appContext:this._.appContext,tradeBehavior:Zt.ENTER_TRADING_PAGE})},beforeUnmount(){this.removeNotification(),this.toggleLocalStorageWatcher(!1),clearInterval(this.timer)},methods:{...u(["setMobileChartMode"]),...f(qe,{updateMarketDisplayQuote:"updateMarketDisplayQuote",spotUpdateLastMarketSymbol:"updateLastMarketSymbol"}),...v({initialMarketList:"initialMarketList",updateMarketStatus:"updateMarketStatus",updateUserConfigByKey:"updateUserConfigByKey",messageCustom:"messageCustom"}),...v("trading",["beforeSpotTradingBehaviorFn"]),initLayout(){const e=Jo(this.$route.name,this.langKey,this.userName);for(let t=0;t<e.length;t++){const i=e[t];if("order-form"===i.id)yY=i.layout;
1else if("order-book"===i.id){const r=dY.find((({id:e})=>e===i.id)).layout;e[t].layout={...i.layout,xxs:r.xxs};break}}this.storedLayoutList=e},generateNotificationSerialId(){return this.notificationSerialId=this.notificationSerialId+1,this.notificationSerialId},pushNotification(e={}){let{status:t=!1,marketName:i=!1,error:r}=e,a=null;if(t){try{a=JSON.parse(r)}catch(sU){a=null}if([gn.ORDER_CANCELED,gn.ORDER_REJECTED,gn.ORDER_REFUNDED].includes(t)&&(null==a?void 0:a.code)===hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE)return void this.handlePriceProtectionMessage(a.code,a.extraData);const n=i?`[${this.convertToDisplaySymbol(i)}] `:"",o=`${this.generateNotificationSerialId()}${n}${t}`;this.notificationMap[o]=zn({spot:!0,data:e,hideInfoBody:!0,showClose:!1,error:/^(1)$/.test(t)||15===t,onClose:()=>{delete this.notificationMap[o]}})}},removeNotification(){Object.values(this.notificationMap).forEach((e=>{e&&e.close()}))},triggerAutoScroll(){this.autoScrollTrigger=!this.autoScrollTrigger},onGridLayouted(e){if(this.isMobileChartMode)return;const t=this.layoutList.map(((t,i)=>({...t,...e[i]})));this.layoutList=t},throttledOnOrderDepthChartResize:nt((function(e,t){this.orderDepthChartResizeTrigger=`${e}_${t}`}),200),onStorageChange(e){e.key===Xo(this.$route.name,this.langKey,this.userName)&&e.oldValue!==e.newValue&&(this.storedLayoutList=JSON.parse(e.newValue)||[])},toggleLocalStorageWatcher(e=!0){e?window.addEventListener("storage",this.onStorageChange):window.removeEventListener("storage",this.onStorageChange)},onOrderBookResized(e){this.orderBookHeight=e},onMarketInfoResized(e,t){this.marketInfoWidth=t},resetMoved(){this.moved=!1},timerUpdateMarketStatus(e){e.timer&&clearInterval(e.timer),"FLY"===e.marketCurrency&&(e.updateMarketStatus(e.marketCurrency),e.timer=setInterval((()=>{e.updateMarketStatus(e.marketCurrency)}),6e4))},tabsActionUpdate(e){this.actionType=e.value},toggleDepthChart(){this.updateUserConfigByKey({key:"depthChart",value:!this.showDepthChart}),this.createGridShellList()},triggerOrderDepthChartResize(){this.orderDepthChartResizeTrigger=`store_resized_${Date.now()}`},adjustOrderFormHeight(e=!1){var t,i,r,a,n;let o=Array.from(this.layoutList);const{layout:s}=this.resizableItemList.find((e=>"order-form"===e.id)),l=(null==(t=yY[Qa.LARGE])?void 0:t.h)||s[Qa.LARGE].h,u=(null==(i=yY[Qa.MEDIUM])?void 0:i.h)||s[Qa.MEDIUM].h,c=(null==(r=yY[Qa.SMALL])?void 0:r.h)||s[Qa.SMALL].h,d=(null==(a=yY[Qa.XTRA_SMALL])?void 0:a.h)||s[Qa.XTRA_SMALL].h,p=(null==(n=yY[Qa.XXTRA_SMALL])?void 0:n.h)||s[Qa.XXTRA_SMALL].h;vY(o,{[Qa.LARGE]:{h:e?Math.max(40,l):l},[Qa.MEDIUM]:{h:e?Math.max(35,u):u},[Qa.SMALL]:{h:e?Math.max(35,c):c},[Qa.XTRA_SMALL]:{h:e?Math.max(32,d):d},[Qa.XXTRA_SMALL]:{h:e?Math.max(41,p):p}},"order-form"),this.layoutList=o,this.createGridShellList()},async setMarketDisplayQuote(e,t){Bn(e,t),this.loginState?(await this.marketTabStore.waitForPendingSend(),await this.marketTabStore.sendTabDisplay({[`${e}-USD`]:{displayQuote:t}}),this.initialMarketList()):this.updateMarketDisplayQuote(e,t)},createGridShellList(){this.$nextTick((()=>{let e=Array.from(this.layoutList);this.isMobileChartMode&&(e=this.layoutList.map((e=>{const t={...e.layout};return t[Qa.XXTRA_SMALL]=e.isMobileChartMode||{x:0,y:0,w:0,h:0},{...e,layout:t}}))),vY(e,{[Qa.XXTRA_SMALL]:{h:this.showDepthChart?10:2}},"order-depth-chart");const t=this.resizableItemList.find((e=>"order-form"===e.id)).layout;e.map((e=>{if(!this.loginState&&"order-form"===e.id){const i={[Qa.LARGE]:40,[Qa.MEDIUM]:32,[Qa.SMALL]:26,[Qa.XTRA_SMALL]:32,[Qa.XXTRA_SMALL]:30};Object.keys(t).forEach((r=>{e.layout[r].h===t[r].h&&(e.layout[r].h=i[r])}))}return e})),this.gridShellList=e}))},handlePriceProtectionMessage(e,t){const i=t||this.apiResponseExtraData,r=e===hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE?this.$t("t.canceled"):this.$t("t.rejected"),a={[hn.ORDER_PRICE_OUTSIDE_ALLOWED_RANGE]:()=>this.$t("futuresMain.notification.priceProtection.orderPrice.outsideAllowedRange",{side:i[0],currency:i[1],state:i[2],price:i[3],quote:i[4]}),[hn.ORDER_PRICE_TWAP_ARGS_OUTSIDE_ALLOWED_RANGE]:()=>this.$t("futuresMain.notification.priceProtection.orderPrice.twapArgsOutsideAllowedRange",{ratio:i[0]}),[hn.ORDER_PRICE_TRIGGER_ARGS_OUTSIDE_ALLOWED_RANGE]:()=>this.$t("futuresMain.notification.priceProtection.orderPrice.triggerArgsOutsideAllowedRange",{ratio:i[0]})}[e]();
1this.messageCustom({title:`${this.$t("t.order")} ${r}`,body:a,error:!0})}}},SY={class:"spot-trade-container tabular-nums"};const CY=$n(bY,[["render",function(e,t,i,r,u,p){const m=a("FullKycNotification"),g=a("MarketBar"),f=a("OrderForm"),v=a("FundingCard"),y=a("DepthChartCard"),b=a("TradingViewCard"),S=a("RecentTradesCard"),C=a("OrderHistory"),P=a("MarketInfoCard"),k=a("OrderBookCard"),T=a("GridShell");return o(),c("div",null,[d(m,{class:"full-kyc-notification"}),l("div",SY,[e.isMobile?h("",!0):(o(),n(g,{key:0,tradingType:u.TRADING_TYPE.SPOT},null,8,["tradingType"])),d(T,{moved:u.moved,"onUpdate:moved":t[0]||(t[0]=e=>u.moved=e),itemList:u.gridShellList,dragAllowFrom:".card-shell__header",isDraggable:!e.layoutLocked&&!e.isMobile,isResizable:!e.layoutLocked&&!e.isMobile,rowHeight:p.rowHeight,minRowHeight:4,onLayouted:p.onGridLayouted,"onResized:orderBook":p.onOrderBookResized,"onResized:marketInfo":p.onMarketInfoResized,"onResized:orderDepthChart":p.throttledOnOrderDepthChartResize},{default:s((()=>[d(f,{key:"order-form",boxFilled:!0,onToggleAdvancedOption:p.adjustOrderFormHeight},null,8,["onToggleAdvancedOption"]),u.disableLinkOnTrading?h("",!0):(o(),n(v,{key:"order-fund",boxFilled:""})),d(y,{key:"order-depth-chart",class:"order-depth-chart depth-chart",boxFilled:"",showHeader:e.isMobile,showDepthChart:e.showDepthChart,resizeTrigger:u.orderDepthChartResizeTrigger,toggleDepthChart:p.toggleDepthChart},null,8,["showHeader","showDepthChart","resizeTrigger","toggleDepthChart"]),d(b,{key:"trading-view",boxFilled:!0}),u.enableRecentTrades?(o(),n(S,{key:"recent-trade",class:"recent-trades",boxFilled:!0})):h("",!0),d(C,{key:"history",boxFilled:!0}),d(P,{key:"market-info",class:"market-info",boxFilled:!0,resizeTrigger:u.marketInfoWidth},null,8,["resizeTrigger"]),d(k,{key:"order-book",class:"order-book",boxFilled:!0,resizeTrigger:u.orderBookHeight,moved:u.moved,resetMoved:p.resetMoved},null,8,["resizeTrigger","moved","resetMoved"])])),_:1},8,["moved","itemList","isDraggable","isResizable","rowHeight","onLayouted","onResized:orderBook","onResized:marketInfo","onResized:orderDepthChart"])])])}],["__scopeId","data-v-dd9f5750"]]),PY=Object.freeze(Object.defineProperty({__proto__:null,default:CY},Symbol.toStringTag,{value:"Module"}));export{HL as A,lL as B,PC as C,$f as D,Ev as E,$p as F,oh as I,ak as R,AC as S,UM as T,QC as a,xI as b,gT as c,kC as d,IT as e,fT as f,OT as g,$k as h,gy as i,tL as j,Aj as k,LA as l,fu as m,vu as n,gu as o,Gy as p,Vp as q,JP as r,_I as s,xv as t,_T as u,Fh as v,og as w,qd as x,GW as y,PY as z}; 2//# sourceMappingURL=BOOzV_OZ.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.