1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d1aa083c-163e-416c-9a43-86628ed0aa00",e._sentryDebugIdIdentifier="sentry-dbid-d1aa083c-163e-416c-9a43-86628ed0aa00")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7115],{47285:(e,t,r)=>{r.d(t,{A:()=>s});var i=r(66960),a=r(83054),l=r(12733),n=r(89719);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{symbol:t=""}=e,{$t:r}=(0,i.B)(),{tradeUnit:s="0",usdtCost:o="0"}=(0,n.TY)(e=>e.configs),c=t.split("-")[0],u="1"===s?r("Cont"):"2"===s?"USDT":c||"",d=(0,l.bZ)(e=>e.symbolsConfigBySymbol),m=1,g=0,P=d[t];return P&&("0"===s||"2"===s)&&(m=Number(P.multiplier)||0)&&(g="2"===s?P.precision:(0,a.DF)(m)),{rawUnit:s,unit:u,minQunatity:m,precision:g,getQuantity:(e,t,r)=>{let i=m,l=g;if(t){let e=d[t];e&&("0"===s||"2"===s)&&(i=Number(e.multiplier)||0)&&(l="2"===s?e.precision:(0,a.DF)(i))}return(0,a.SD)({quantityCont:e,tradeUnit:s,multiplier:i,price:r,quantityPrecision:l})},usdtCost:o}}},51662:(e,t,r)=>{r.d(t,{m:()=>n});var i=r(79237),a=r(38113),l=r(65375);let n=a.forwardRef((e,t)=>(0,i.jsx)(l.B,{ref:t,viewBox:"0 0 1066 1024",...e,children:(0,i.jsx)("path",{d:"M518.101333 128a384 384 0 1 0 0 768 384 384 0 0 0 0-768z m-469.333333 384c0-259.2 210.133333-469.333333 469.333333-469.333333s469.333333 210.133333 469.333334 469.333333-210.133333 469.333333-469.333334 469.333333-469.333333-210.133333-469.333333-469.333333z m469.333333-213.333333a42.666667 42.666667 0 0 1 42.666667 42.666666v170.666667a42.666667 42.666667 0 1 1-85.333333 0V341.333333a42.666667 42.666667 0 0 1 42.666666-42.666666z m-42.666666 384a42.666667 42.666667 0 0 1 42.666666-42.666667h0.426667a42.666667 42.666667 0 1 1 0 85.333333h-0.426667a42.666667 42.666667 0 0 1-42.666666-42.666666z"})}));n.displayName="AlertCircleIcon"},65745:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ep});var i=r(79237),a=r(51662),l=r(27442),n=r(61554),s=r(13603),o=r(46540),c=r(70659),u=r(53951),d=r(82586),m=r(24626),g=r(56044),P=r(97450),p=r(47285),b=r(66960),y=r(14600),T=r(44031),h=r(19490),x=r(12733),v=r(38113);function f(e){var t;let{value:r,onChange:a=()=>{},unit:l="0",max:n,className:s,precision:o=0,prefix:c,suffix:u,wrapperClassName:d,...m}=e,g=(0,x.bZ)(e=>e.contractType),P=g===x.h$.BTC||g===x.h$.USDT&&"1"===l;return(0,i.jsx)(T.Input,{size:"m",className:s,wrapperClassName:d,value:null!=(t=function(e,t){if(Number.isNaN(Number(e)))return null;let r=parseInt(String(e),10);return Number.isNaN(r)?null:t?r:e}(null!=r?r:null,P))?t:"",onChange:e=>{var t;let r;return t=e.target.value,void(0>Number(r=Number.isNaN(Number(r=P?parseInt(t,10):t))?null:r)&&(r=0),1e10>Number(r)&&(("0"===l||"2"===l)&&(r=function(e,t){if(e){var r;let i=(e=e.toString().replace(/^0+(\d+)/,"$1")).split(".");(i.length>1&&(null==(r=i[1])?void 0:r.length)||0)>=t&&(e=(0,h.Yv)(Number(e),t))}return e}(r,o)),a(r)))},onBlur:e=>{let t;return t=e.target.value,void(void 0!==n&&(t=Number(t)<=Number(n)?t:Number(n)),a(t))},leftSlot:c,rightSlot:u,...m})}var _=r(32523),N=r(31073),L=r(31483);function S(e){let{value:t,onChange:r}=e,{$t:a}=(0,b.B)(),l=a("Market Order"),n=a("Limit Order"),s=t===L.Cf.PlanLimit?n:l;return(0,i.jsxs)(N.Select,{value:t,responsive:!1,onValueChange:e=>r(e),children:[(0,i.jsx)(N.SelectTrigger,{size:"s",className:"text-cm12 text-t1 [&_svg]:text-t3 [&>span:last-child]:ml-s1 h-5 w-auto min-w-0 rounded-none border-none bg-transparent px-0 py-0 shadow-none focus:border-transparent focus:ring-0 data-[state=open]:border-transparent data-[state=open]:ring-0 [&_svg]:size-3 [&>span:first-child]:truncate","aria-label":s,children:(0,i.jsx)(N.SelectValue,{})}),(0,i.jsxs)(N.SelectContent,{align:"end",className:"min-w-[140px]",children:[(0,i.jsx)(N.SelectItem,{value:L.Cf.PlanMarket,size:"s",className:"text-c12",children:l}),(0,i.jsx)(N.SelectItem,{value:L.Cf.PlanLimit,size:"s",className:"text-c12",children:n})]})]})}var C=r(38455);function k(){let{$t:e}=(0,b.B)();return{triggerWayLabelMap:{[L.Pr.Latest]:e("Last_1"),[L.Pr.Mark]:e("Mark")},planTriggerWayLabelMap:{[L.Pr.Latest]:e("Last Price_1"),[L.Pr.Mark]:e("Mark Price_1")},ordersTriggerWayLabelMap:{[L.Pr.Latest]:e("last price"),[L.Pr.Mark]:e("mark price")}}}function j(e){let{item:t}=e,r="text-p2",{sideLabelMap:a,directionLabelMap:l}=function(){let{$t:e}=(0,b.B)();return{sideLabelMap:{long:e("Long"),short:e("Short")},directionLabelMap:{openLong:e("Open Long_2"),openShort:e("Open Short_2"),closeLong:e("Close Long_2"),closeShort:e("Close Short_2")}}}();t.side?r=t.side===L.DR.Short?"text-p3":"text-p2":t.direction&&(r=t.direction===L.$A.OpenLong||t.direction===L.$A.CloseShort?"text-p2":"text-p3");let n=a[t.side]||l[t.direction]||"--";return t.symbol||t.side||t.direction||t.leverage?(0,i.jsxs)("div",{className:"mt-s1 flex items-center text-sm",children:[(0,i.jsx)("div",{className:"text-t3",children:t.displaySymbol||(0,C.Ky)(t.symbol||"")}),(0,i.jsx)("div",{className:"bg-l3 mx-s3 h-3.5 w-px"}),(0,i.jsxs)("div",{className:r,children:[n," ",t.leverage?"".concat(t.leverage,"X"):""]})]}):null}var w=r(52293);function q(e){let{$t:t}=(0,b.B)(),{isDemoTrading:r=!1,order:a={},position:l={},stopLossRate:n=""}=e,s=l.marketSymbol||l.symbol||"",o=(0,x.bZ)(e=>e.contractType||x.h$.USDT),c=(0,x.bZ)(e=>
1s?e.symbolsConfigBySymbol[s]:void 0),u=(0,w.ls)(e=>s?e.symbolsConfigBySymbol[s]:void 0),d=r?x.h$.XUSDT:o,m=r?u:c,{ordersTriggerWayLabelMap:g}=k(),P=Number(a.quantity)||0,p=Number(a.orderPrice_SL)||0;"market"===String(a.orderType_SL)&&(p=Number(a.lastPrice)||0);let y=Number(a.triggerPrice_SL)||0;p=a.orderType_SL===L.Cf.PlanMarket?y:p;let T=Number(l.avgPrice)||0,v=Number(null==m?void 0:m.multiplier)||0,f=0,_=0;p&&T&&(f=(p-T)*P*v,_=(T-p)*P*v);let N={long:Number(f>0?(0,h.Yv)(f,2):(0,h.v5)(f,2)),short:Number(_>0?(0,h.Yv)(_,2):(0,h.v5)(_,2))},S=l.side||(l.direction===L.$A.CloseLong?L.DR.Long:L.DR.Short),C=N[S]>0?"+".concat((0,h.iT)(N[S])):0!==Number(N[S])?(0,h.iT)(N[S]):"--",j=n&&Number(n)>0?"+".concat(n,"%"):n?"".concat(n,"%"):"--";return y<=0?null:(0,i.jsx)("div",{className:"text-cm12 text-t3 leading-4",dangerouslySetInnerHTML:{__html:t("When {0} reaches {1}, it will trigger a {2}, and the EST.PNL will be {3}",{0:g[a.triggerWay_SL||L.Pr.Mark],1:'<span class="text-t1">'.concat((0,h.iT)(y)||"--"," ").concat(d,"</span>"),2:t(a.orderType_SL===L.Cf.PlanLimit?"limit order":"market order"),3:'<span class="text-t1">'.concat(C," ").concat(d," (").concat(j,")</span>")})}})}function z(e){let{$t:t}=(0,b.B)(),{isDemoTrading:r=!1,order:a={},position:l={},takeProfitRate:n=""}=e,s=l.marketSymbol||l.symbol||"",o=(0,x.bZ)(e=>e.contractType||x.h$.USDT),c=(0,x.bZ)(e=>s?e.symbolsConfigBySymbol[s]:void 0),u=(0,w.ls)(e=>s?e.symbolsConfigBySymbol[s]:void 0),d=r?x.h$.XUSDT:o,m=r?u:c,{ordersTriggerWayLabelMap:g}=k(),P=Number(a.quantity)||0,p=Number(a.orderPrice_TP)||0;"market"===String(a.orderType_TP)&&(p=Number(a.lastPrice)||0);let y=Number(a.triggerPrice_TP)||0;p=a.orderType_TP===L.Cf.PlanMarket?y:p;let T=Number(l.avgPrice)||0,v=Number(null==m?void 0:m.multiplier)||0,f=0,_=0;p&&T&&(f=(p-T)*P*v,_=(T-p)*P*v);let N={long:Number(f>0?(0,h.Yv)(f,2):(0,h.v5)(f,2)),short:Number(_>0?(0,h.Yv)(_,2):(0,h.v5)(_,2))},S=l.side||(l.direction===L.$A.CloseLong?L.DR.Long:L.DR.Short),C=N[S]>0?"+".concat((0,h.iT)(N[S])):0!==Number(N[S])?(0,h.iT)(N[S]):"--",j=n&&Number(n)>0?"+".concat(n,"%"):n?"".concat(n,"%"):"--";return y<=0?null:(0,i.jsx)("div",{className:"text-cm12 text-t3 leading-4",dangerouslySetInnerHTML:{__html:t("When {0} reaches {1}, it will trigger a {2}, and the EST.PNL will be {3}",{0:g[a.triggerWay_TP||L.Pr.Mark],1:'<span class="text-t1">'.concat((0,h.iT)(y)||"--"," ").concat(d,"</span>"),2:t(a.orderType_TP===L.Cf.PlanLimit?"limit order":"market order"),3:'<span class="text-t1">'.concat(C," ").concat(d," (").concat(j,")</span>")})}})}var R=r(64318),M=r(93924),W=r(47387),A=r(41760),I=r(96620),D=r(89719),E=r(99498),Q=r(749),B=r(122);function O(e){return e.side===L.DR.Long||e.direction===L.$A.CloseLong}function U(e){return e.side===L.DR.Short||e.direction===L.$A.CloseShort}function $(e){let{price:t,position:r}=e,i=Number(r.avgPrice||0),a=Number(r.leverage||0);if(0>=Number(t)||!i||!a)return{rate:"",rateAbout:""};let l=0;return(O(r)?l=new B.A(t).sub(i).mul(a).mul(100).div(i).toNumber():U(r)&&(l=new B.A(i).sub(t).mul(a).mul(100).div(i).toNumber()),l)?{rate:(0,h.ll)(l,1).toString(),rateAbout:(0,h.ll)(l,2).toString()}:{rate:"",rateAbout:""}}function K(e){let t,{rate:r,position:i,pricePrecision:a,minPriceChange:l}=e,n=Number(i.avgPrice||0),s=Number(i.leverage||0);if(!n||!s||!Number.isFinite(r)||0===Number(r))return;let o=new B.A(n),c=new B.A(s),u=new B.A(r),d=o.div(c).mul(u).div(100);if(O(i)?t=o.add(d):U(i)&&(t=o.sub(d)),!t)return;let m=t.isNegative()?new B.A(0):t;return l.endsWith("5")?(0,Q.Xt)(m.toString(),a,l,"DOWN"):(0,h.Yv)(m.toString(),a)}function F(e){let{value:t,availableQuantity:r}=e,i=Number(null!=r?r:0);return i>0?Number(new B.A(Number(t||0)).mul(100).div(new B.A(i)).toFixed(0,B.A.ROUND_CEIL)):0}function V(e){let{percent:t,availableQuantity:r,quantityPrecision:i}=e,a=Number(null!=r?r:0);return(0,h.Yv)(new B.A(t||0).div(100).mul(a).toString(),i)}function Y(e){let{availableQuantity:t,inputQuantity:r,...i}=e;return!function(e){let{TPSLType:t,tabType:r}=e;return[L.zb.EntirePosition,L.zb.CopyTrade,L.zb.KlineEntirePositionTakeProfit,L.zb.KlineEntirePositionStopLoss].includes(t)||t===L.zb.Normal&&r===L.Ll.Position}(i)?Number(null!=r?r:0):Number(null!=t?t:0)}function Z(e){return e.direction?e.direction:e.side===L.DR.Long?L.$A.CloseLong:L.$A.CloseShort}function X(e,t){return[L.zb.EntirePosition,L.zb.KlineEntirePositionTakeProfit,L.zb.KlineEntirePositionStopLoss].includes(e)||e===L.zb.Normal&&t===L.Ll.Position}function H(e,t){return"tp"===e?t.side===L.DR.Long||"closeLong"===t.direction?"â¥":"â¤":t.side===L.DR.Short||"closeShort"===t.direction?"â¥":"â¤"}function G(e){return null==e||""===e?"--":(0,h.iT)(String(e))}let J=[{value:0,label:"0%",displayValue:0},{value:20,label:"20%",displayValue:20},{value:100,label:"500%",displayValue:500}];function ee(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=Number(e||0);if(!Number.isFinite(r))return 0;let i=Math.max(0,Math.min(t?r<0?-r:0:r,500));return i<=20?i:20+(i-20)/480*80}function et(e){let t=Math.max(0,Math.min(e,100));return t<=20?t:20+(t-20)/80*480}function er(e){return!Number.isFinite(e)||e<=0?"":e.toFixed(1).replace(/\.?0+$/,"")}function ei(e){return 0===e||"0"===e?void 0:null!=e?e:void 0}function ea(e,t,r,i){let{$t:a}=(0,b.B)(),{planTriggerWayLabelMap:l}=k(),n=r.side===L.DR.Long||r.direction===L.$A.CloseLong;return t===L.Tt.TakeProfit?{bool:n?Number(e.triggerPrice_TP)>0&&Number(e.triggerPrice_TP)-Number(i)>0:Number(e.triggerPrice_TP)>0&&Number(e.triggerPrice_TP)-Number(i)<0,msg:e.orderType_TP===L.Cf.PlanLimit?a(n?"The trigger price must be higher than {triggerWay}":"The trigger price must be lower than {triggerWay}",{triggerWay:l[e.triggerWay_TP]}):a(n?"Take Profit price must be higher than {triggerWay}":"Take profit price must be lower than {triggerWay}",{triggerWay:l[e.triggerWay_TP]})}:{bool:n?Number(e.triggerPrice_SL)>0&&Number(e.triggerPrice_SL)-Number(i)<0:Number(e.triggerPrice_SL)>0&&Number(e.triggerPrice_SL)-Number(i)>0,msg:e.orderType_SL===L.Cf.PlanLimit?a(n?"The trigger price must be lower than {triggerWay}":"The trigger price must be higher than {triggerWay}",{triggerWay:l[e.triggerWay_SL]}):a(n?"Stop loss price must be lower than {triggerWay}":"Stop loss price must be higher than {triggerWay}",{triggerWay:l[e.triggerWay_SL]})}}var el=r(5257),en=r(95696),es=r(4390),eo=r(18006),ec=r(77222),eu=r(83054);function ed(){let{tradeUnit:e="0",usdtCost:t="0"}=(0,D.TY)(e=>e.configs),r=(0,x.bZ)(e=>e.symbolsConfigBySymbol);return{getCont:(i,a,l,n,s)=>{let o=1,c=r[a]||{};if(("0"===e||"2"===e)&&(o=Number(c.multiplier)||1),"1"===e)return B.A.div(i||0,1).toDecimalPlaces(0,B.A.ROUND_DOWN).toNumber();return(0,eu.KP)({quantity:i,tradeUnit:e,multiplier:o,price:l,usdtCost:t,costOne:n,isCalculator:s})}}}function em(e){return e===L.Cf.PlanLimit?L.Cf.PlanLimit:L.Cf.PlanMarket}let eg={orderPrice_SL:"",orderPrice_TP:"",orderType_SL:L.Cf.PlanMarket,orderType_TP:L.Cf.PlanMarket,quantityPrecent_SL:"",quantityPrecent_TP:"",quantity_SL:"",quantity_TP:"",stopLossRate:"",stopLossRateAbout:"",takeProfitRate:"",takeProfitRateAbout:"",triggerPrice_SL:"",triggerPrice_TP:"",triggerWay_SL:L.Pr.Mark,triggerWay_TP:L.Pr.Mark};function eP(e,t,r){var i,a,l,n,s,o,c,u,d,m,g,P;let p=null!=(l=null==e?void 0:e.param)?l:null,b=null!=(n=null==e?void 0:e.TPSLType)?n:L.zb.None,y=null!=(s=null==e?void 0:e.isDemoTrading)&&s,T=null!=(o=null==e?void 0:e.isEdit)&&o,h=null!=(c=null==e?void 0:e.isKline)&&c,x=null==e?void 0:e.modelState,v=null!=(u=null==x?void 0:x.position)?u:{},f=null!=(d=null==(i=v.entireTpsl)?void 0:i.tp)?d:{},_=null!=(m=null==(a=v.entireTpsl)?void 0:a.sl)?m:{},N=v.tpslType||L.Ll.Position,S=function(e){let{values:t,isEdit:r,isKline:i,TPSLType:a,tabType:l,tpTriggerWay:n,slTr
1iggerWay:s}=e,o=r||i||a===L.zb.EntirePosition||a===L.zb.Normal&&l===L.Ll.Position;return{values:{orderType_TP:t.orderType_TP||L.Cf.PlanMarket,triggerWay_TP:t.triggerWay_TP||n||L.Pr.Mark,orderPrice_TP:t.orderPrice_TP||"",triggerPrice_TP:o&&t.triggerPrice_TP||"",orderType_SL:t.orderType_SL||L.Cf.PlanMarket,triggerWay_SL:t.triggerWay_SL||s||L.Pr.Mark,orderPrice_SL:t.orderPrice_SL||"",triggerPrice_SL:o&&t.triggerPrice_SL||""}}}({values:null!=(g=null==x?void 0:x.values)?g:{},isEdit:T,isKline:h,TPSLType:b,tabType:N,tpTriggerWay:t,slTriggerWay:r}),C={...eg,...null!=(P=null==x?void 0:x.values)?P:{},...S.values},k=$({price:Number(C.orderType_TP===L.Cf.PlanMarket?C.triggerPrice_TP:C.orderPrice_TP),position:v}),j=$({price:Number(C.orderType_SL===L.Cf.PlanMarket?C.triggerPrice_SL:C.orderPrice_SL),position:v});return{param:p,TPSLType:b,isDemoTrading:y,isEdit:T,isKline:h,modelState:x,position:v,tp:f,sl:_,tabType:N,values:{...C,takeProfitRate:k.rate,takeProfitRateAbout:k.rateAbout,stopLossRate:j.rate,stopLossRateAbout:j.rateAbout},tpChecked:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e===L.zb.EntirePosition?!t.planId&&!r.planId||!!t.planId:[L.zb.Normal,L.zb.CopyTrade,L.zb.NormalTakeProfit,L.zb.CopyTradeTakeProfit,L.zb.KlineEntirePositionTakeProfit].includes(e)}(b,f,_),slChecked:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e===L.zb.EntirePosition?!t.planId&&!r.planId||!!r.planId:[L.zb.Normal,L.zb.CopyTrade,L.zb.NormalStopLoss,L.zb.CopyTradeStopLoss,L.zb.KlineEntirePositionStopLoss].includes(e)}(b,f,_),notShowConfirm:!!(null==x?void 0:x.notShowConfirm)}}function ep(){var e,t,r,T,h,N,C,w,Q,B,O,U,eu;let{$t:eg}=(0,b.B)(),ep=(0,R.i)(),eb=null!=(h=null==(e=ep.params)?void 0:e.TPSLType)?h:L.zb.None,ey=null!=(N=null==(t=ep.params)?void 0:t.isKline)&&N,eT=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{openParams:t}=e,{$t:r}=(0,b.B)(),i=(0,R.i)(),a=W.hv.get("tpTriggerWay"),l=W.hv.get("slTriggerWay"),n=eP(t,a,l),{param:s,TPSLType:o,isDemoTrading:c,isEdit:u,isKline:d,modelState:m,position:g,tp:y,sl:T}=n,h=n.tabType,[f,_]=(0,E.A)(n.values),[N,S]=(0,v.useState)(h),[C,k]=(0,v.useState)(n.tpChecked),[j,w]=(0,v.useState)(n.slChecked),[q,z]=(0,v.useState)(!1),[Q,B]=(0,v.useState)(n.notShowConfirm),O=(0,D.TY)(e=>e.configs),U=(0,D.TY)(e=>e.patchConfigs),H=g.marketSymbol||g.symbol||"",{precision:G}=(0,p.A)({symbol:H}),J=(0,P.D)(),ee=(0,x.bZ)(e=>H?e.symbolsConfigBySymbol[H]:void 0),et=(0,A.N1)(H?I.p.USDT.SIMPLE_TICKER(H):""),er=Number((null==et?void 0:et.last)||0),eu=Number((null==et?void 0:et.markPrice)||0),eg=(null==ee?void 0:ee.precision)||1,ep=String((null==ee?void 0:ee.minPriceChange)||"0.5"),eb=function(e){let{values:t,lastPrice:r}=e;return t.orderType_TP===L.Cf.Limit||t.orderType_TP===L.Cf.PostOnly?Number(t.orderPrice_TP)||r:t.orderType_TP===L.Cf.PlanLimit?Number(t.orderPrice_TP)||Number(t.triggerPrice_TP)||r:t.orderType_TP===L.Cf.PlanMarket&&Number(t.triggerPrice_TP)||r}({values:f,lastPrice:er}),ey=function(e){let{values:t,lastPrice:r}=e;return t.orderType_SL===L.Cf.Limit||t.orderType_SL===L.Cf.PostOnly?Number(t.orderPrice_SL)||r:t.orderType_SL===L.Cf.PlanLimit?Number(t.orderPrice_SL)||Number(t.triggerPrice_SL)||r:t.orderType_SL===L.Cf.PlanMarket&&Number(t.triggerPrice_SL)||r}({values:f,lastPrice:er}),eT=function(e){let{values:t,lastPrice:r,markPrice:i}=e;return t.triggerWay_TP===L.Pr.Latest?r:i}({values:f,lastPrice:er,markPrice:eu}),eh=function(e){let{values:t,lastPrice:r,markPrice:i}=e;return t.triggerWay_SL===L.Pr.Latest?r:i}({values:f,lastPrice:er,markPrice:eu}),{availableTPSLQuantity:ex,fetchAvailableTPSLQuantity:ev,submitPlanCloseOrder:ef,saveUserConfirm:e_}=function(e){let{isDemoTrading:t,position:r}=e,i=(0,ec.useParams)(),a="string"==typeof(null==i?void 0:i.locale)?i.locale:"en_US",l=(0,v.useRef)(L.Ll.Position),{data:n,refetch:s}=(0,es.useQuery)({queryKey:["plan-close-order","availableTPSLQuantity",a,t,r.symbol,r.separatedPositionId,r.planId],enabled:!1,queryFn:async()=>
1{if(!r.symbol)return;let e=function(e){let{symbol:t,tpslType:r,position:i}=e;return{symbol:t,direction:Z(i)===L.$A.CloseLong?L.$A.CloseLong:L.$A.CloseShort,tpslType:r,separatedPositionId:ei(i.separatedPositionId),planId:i.planId||""}}({symbol:r.symbol,tpslType:l.current,position:r}),i=await (0,en.gy)({locale:a,...t?{isDemoTrading:t}:{},params:e});return(null==i?void 0:i.code)===200?i.data:void 0}}),o=async e=>(l.current=e,(await s()).data),c=(0,eo.useMutation)({mutationFn:async e=>{let{params:r}=e;return(0,en.I3)({locale:a,...t?{isDemoTrading:t}:{},params:r})}});return{availableTPSLQuantity:n,fetchAvailableTPSLQuantity:o,submitPlanCloseOrder:(e,t)=>c.mutateAsync({params:e,param:t}),saveUserConfirm:(0,eo.useMutation)({mutationFn:e=>(0,el.J_)({locale:a,body:{settingKey:"usdt_user_confirm",settingValue:e}})}).mutateAsync,submitPending:c.isPending}}({isDemoTrading:c,position:g}),eN=X(o,N),{availableQuantity_TP:eL,availableQuantity_SL:eS,available_TP:eC,available_SL:ek,quantity_TP:ej,quantity_SL:ew,quantityCompare_TP:eq,quantityCompare_SL:ez}=function(e){let{TPSLType:t,tabType:r,values:i,symbol:a,calcPrice_TP:l,calcPrice_SL:n,availableQuantity_TP_Cont:s,availableQuantity_SL_Cont:o}=e,c=(0,P.D)(),{getCont:u}=ed(),d=c(null!=s?s:void 0,a,l),m=c(null!=o?o:void 0,a,n),g=Number(d)||0,p=Number(m)||0,b=Y({TPSLType:t,tabType:r,availableQuantity:d,inputQuantity:i.quantity_TP}),y=Y({TPSLType:t,tabType:r,availableQuantity:m,inputQuantity:i.quantity_SL});return{availableQuantity_TP:d,availableQuantity_SL:m,available_TP:g,available_SL:p,quantity_TP:b,quantity_SL:y,quantityCompare_TP:Number(u(b,a,l)||0),quantityCompare_SL:Number(u(y,a,n)||0)}}({TPSLType:o,tabType:N,values:f,symbol:H,calcPrice_TP:eb,calcPrice_SL:ey,availableQuantity_TP_Cont:null==ex?void 0:ex.tpQty,availableQuantity_SL_Cont:null==ex?void 0:ex.slQty}),eR=function(e){var t,r;let{getCont:i}=ed(),{values:a,position:l,tpChecked:n,slChecked:s,tabType:o,TPSLType:c,positionType:u,tp:d,sl:m,quantity_TP:g,quantity_SL:P,calcPrice_TP:p,calcPrice_SL:b,isKline:y}=e,T=c===L.zb.EntirePosition||c===L.zb.Normal&&o===L.Ll.Position,h=l.marketSymbol||l.symbol||"",x=Number(l.contQuantity)||0,v=y?x:Number(i(u?g:null!=(t=a.quantity_TP)?t:void 0,h,p))||0,f=y?x:Number(i(u?P:null!=(r=a.quantity_SL)?r:void 0,h,b))||0;return{symbol:l.symbol||"",direction:Z(l),separatedPositionId:ei(l.separatedPositionId),tpPlanId:T?(null==d?void 0:d.planId)||"":l.planId||"",tpOrderType:em(a.orderType_TP),tpTpslType:u?L.Ll.Position:L.Ll.Normal,tpTriggerPrice:n?a.triggerPrice_TP:null,tpOrderPrice:a.orderPrice_TP||"",tpQuantity:v,tpTriggerWay:a.triggerWay_TP,tpRemove:!!T&&null!=d&&!!d.planId&&!n,slPlanId:T?(null==m?void 0:m.planId)||"":l.planId||"",slOrderType:em(a.orderType_SL),slTpslType:u?L.Ll.Position:L.Ll.Normal,slTriggerPrice:s?a.triggerPrice_SL:null,slOrderPrice:a.orderPrice_SL||"",slQuantity:f,slTriggerWay:a.triggerWay_SL,slRemove:!!T&&null!=m&&!!m.planId&&!s}}({values:f,position:g,tpChecked:C,slChecked:j,tabType:N,TPSLType:o,positionType:eN,tp:y,sl:T,quantity_TP:ej,quantity_SL:ew,calcPrice_TP:eb,calcPrice_SL:ey,isKline:d}),eM=ea(f,L.Tt.TakeProfit,g,eT),eW=ea(f,L.Tt.StopLoss,g,eh),eA=function(e){let{tpChecked:t,slChecked:r,values:i,quantityCompare_TP:a,quantityCompare_SL:l,orderPriceUtils_TP:n,orderPriceUtils_SL:s}=e;if(t&&!r)return!((i.orderType_TP===L.Cf.PlanLimit&&Number(i.orderPrice_TP)>0||i.orderType_TP===L.Cf.PlanMarket)&&a>0&&n.bool);if(!t&&r)return!((i.orderType_SL===L.Cf.PlanLimit&&Number(i.orderPrice_SL)>0||i.orderType_SL===L.Cf.PlanMarket)&&l>0&&s.bool);if(t&&r){let e=!((i.orderType_TP===L.Cf.PlanLimit&&Number(i.orderPrice_TP)>0||i.orderType_TP===L.Cf.PlanMarket)&&a>0&&n.bool),t=!((i.orderType_SL===L.Cf.PlanLimit&&Number(i.orderPrice_SL)>0||i.orderType_SL===L.Cf.PlanMarket)&&l>0&&s.bool);return e||t}}({tpChecked:C,slChecked:j,values:f,quantityCompare_TP:eq,quantityCompare_SL:ez,orderPriceUtils_TP:eM,orderPriceUtils_SL:eW}),eI=X(o,h)?L.Ll.Position:L.Ll.Normal;(0,v.useEffect)(()=>{if(!t)return;let e=eP(t,a,l);S(e.tabType),_(e.values),k(e.tpChecked),w(e.slChecked),B(e.notShowConfirm),z(!1)},[t,_]),(0,v.useEffect)(()=>{g.symbol&&ev(eI)},[eI,g.symbol,g.separatedPositionId,g.planId]);let eD=e=>{let t="-"===e?"":e,r=0!==Number(t)?K({rate:Number(t),position:g,pricePrecision:eg,minPriceChange:ep}):void 0,i=V({percent:Number(f.quantityPrecent_TP||0),availableQuantity:J((null==ex?void 0:ex.tpQty)||0,H,0!==Number(t)&&t?r:er),quantityPrecision:G});if(f.orderType_TP===L.Cf.PlanMarket)return void _({triggerPrice_TP:r,takeProfitRate:t,takeProfitRateAbout:t,quantity_TP:i});_({triggerPrice_TP:r,orderPrice_TP:r,takeProfitRate:t,takeProfitRateAbout:t,quantity_TP:i})},eE=e=>{let t=null==e||""===e?"-":String(e),r=0!==Number(t)&&"-"!==t?K({rate:Number(t),position:g,pricePrecision:eg,minPriceChange:ep}):void 0,i=V({percent:Number(f.quantityPrecent_SL||0),availableQuantity:J((null==ex?void 0:ex.slQty)||0,H,"-"===t?er:r),quantityPrecision:G});if(f.orderType_SL===L.Cf.PlanMarket)return void _({triggerPrice_SL:r,stopLossRate:t,stopLossRateAbout:t,quantity_SL:i});_({triggerPrice_SL:r,orderPrice_SL:r,stopLossRate:t,stopLossRateAbout:t,quantity_SL:i})},eQ=(e,t)=>{let r=$({price:Number(e||0),position:g});if(f.orderType_TP===L.Cf.PlanMarket&&_({takeProfitRate:r.rate,takeProfitRateAbout:r.rateAbout}),_({triggerPrice_TP:e}),!t){let t=J((null==ex?void 0:ex.tpQty)||0,H,r.rate?null!=e?e:void 0:er);_({quantity_TP:V({percent:Number(f.quantityPrecent_TP||0),availableQuantity:t,quantityPrecision:G})})}},eB=(e,t)=>{let r=$({price:Number(e||0),position:g});if(f.orderType_TP===L.Cf.PlanLimit&&_({takeProfitRate:r.rate,takeProfitRateAbout:r.rateAbout}),_({orderPrice_TP:e}),!t){let t=J((null==ex?void 0:ex.tpQty)||0,H,r.rate?null!=e?e:void 0:er);_({quantity_TP:V({percent:Number(f.quantityPrecent_TP||0),availableQuantity:t,quantityPrecision:G})})}},eO=(e,t)=>{let r=$({price:Number(e||0),position:g});if(f.orderType_SL===L.Cf.PlanMarket&&_({stopLossRate:r.rate,stopLossRateAbout:r.rateAbout}),_({triggerPrice_SL:e}),!t){let t=J((null==ex?void 0:ex.slQty)||0,H,r.rate?null!=e?e:void 0:er);_({quantity_SL:V({percent:Number(f.quantityPrecent_SL||0),availableQuantity:t,quantityPrecision:G})})}},eU=(e,t)=>{let r=$({price:Number(e||0),position:g});if(f.orderType_SL===L.Cf.PlanLimit&&_({stopLossRate:r.rate,stopLossRateAbout:r.rateAbout}),_({orderPrice_SL:e}),!t){let t=J((null==ex?void 0:ex.slQty)||0,H,r.rate?null!=e?e:void 0:er);_({quantity_SL:V({percent:Number(f.quantityPrecent_SL||0),availableQuantity:t,quantityPrecision:G})})}},e$=e=>{_({quantityPrecent_TP:F({value:e,availableQuantity:eC}),quantity_TP:e})},eK=e=>{_({quantityPrecent_SL:F({value:e,availableQuantity:ek}),quantity_SL:e})};(0,v.useEffect)(()=>{var e,t;if(!u)return void e$(eC);e$(null!=(t=null==m||null==(e=m.values)?void 0:e.quantity_TP)?t:f.quantity_TP)},[null==ex?void 0:ex.tpQty,N]),(0,v.useEffect)(()=>{var e,t;if(!u)return void eK(ek);eK(null!=(t=null==m||null==(e=m.values)?void 0:e.quantity_SL)?t:f.quantity_SL)},[null==ex?void 0:ex.slQty,N]),(0,v.useEffect)(()=>
1{if(f.orderType_TP===L.Cf.PlanMarket)return void eQ(f.triggerPrice_TP,!0);eB(f.orderPrice_TP,!0)},[f.orderType_TP,N]),(0,v.useEffect)(()=>{if(f.orderType_SL===L.Cf.PlanMarket)return void eO(f.triggerPrice_SL,!0);eU(f.orderPrice_SL,!0)},[f.orderType_SL,N]);let eF=()=>{var e;let a={values:{quantity_TP:null,quantity_SL:null,orderPrice_TP:null,orderPrice_SL:null,triggerPrice_TP:null,triggerPrice_SL:null,orderType_TP:L.Cf.PlanMarket,orderType_SL:L.Cf.PlanMarket}};(0,M.toast)({type:"success",title:r("Order placed successfully")}),i.close(),_(a.values);let l=null==t||null==(e=t.onSubmitSuccess)?void 0:e.call(t);l&&"function"==typeof l.catch&&l.catch(e=>{console.error("[PlanCloseOrder] æäº¤æååå·æ°æ°æ®å¤±è´¥:",e)})},eV=async()=>{z(!0);try{if(Q){let e=function(e,t,r){let i,a=(3===(i=e||"11111111").length&&(i+="11111"),4===i.length&&(i+="1111"),5===i.length&&(i+="111"),i.slice(0,8));return"".concat(a.substring(0,6)).concat(r?"1":"0").concat(a.substring(7))}(O.usdt_user_confirm,6,!1);U({usdt_user_confirm:e}),B(!1),e_(e)}let e=await ef(eR,s);return(null==e?void 0:e.code)===200&&eF(),e}catch(e){console.error("Unhandled async action error",e);return}finally{z(!1)}};return{param:s,TPSLType:o,isDemoTrading:c,isEdit:u,isKline:d,values:f,valuesChange:_,position:g,tp:y,sl:T,availableTPSLQuantity:ex,lastPrice:er,markPrice:eu,calcPrice_TP:eb,calcPrice_SL:ey,basePrice_TP:eT,basePrice_SL:eh,availableQuantity_TP:eL,availableQuantity_SL:eS,available_TP:eC,available_SL:ek,quantity_TP:ej,quantity_SL:ew,quantityCompare_TP:eq,quantityCompare_SL:ez,orderPriceUtils_TP:eM,orderPriceUtils_SL:eW,submitDisabled:eA,tabType:N,setTabType:S,changeType:e=>{let t=function(e){var t,r,i,a;let{type:l,param:n,entireTpsl:s}=e,o=null==s?void 0:s.tp,c=null==s?void 0:s.sl,u=l===L.Ll.Position;return{values:{triggerPrice_TP:u&&null!=(t=null==o?void 0:o.triggerPrice)?t:null,triggerPrice_SL:u&&null!=(r=null==c?void 0:c.triggerPrice)?r:null,orderPrice_TP:u&&null!=(i=null==o?void 0:o.orderPrice)?i:null,orderPrice_SL:u&&null!=(a=null==c?void 0:c.orderPrice)?a:null,orderType_TP:u&&(null==o?void 0:o.orderType)||L.Cf.PlanMarket,orderType_SL:u&&(null==c?void 0:c.orderType)||L.Cf.PlanMarket},TPSLType:u?L.zb.EntirePosition:n?L.zb.CopyTrade:L.zb.Normal}}({type:e,param:s,entireTpsl:g.entireTpsl});S(e),eD(),eE(),_(t.values),ev(e)},submit:eV,onClose:()=>{var e;i.close(),_({triggerPrice_TP:null,triggerPrice_SL:null,orderPrice_TP:null,orderPrice_SL:null,quantity_TP:null,quantity_SL:null}),null==t||null==(e=t.onClose)||e.call(t)},submitSuccess:eF,orderTypeChangeTP:e=>{_(function(e){let{type:t,isEdit:r,isKline:i,positionType:a,values:l,position:n,entireTpsl:s}=e,o=null==s?void 0:s.tp;return{orderType_TP:t,orderPrice_TP:r?i?l.triggerPrice_TP:n.orderPrice:a&&(null==o?void 0:o.orderPrice)||l.triggerPrice_TP}}({type:e,isEdit:u,isKline:d,positionType:eN,values:f,position:g,entireTpsl:g.entireTpsl}))},orderTypeChangeSL:e=>{_(function(e){let{type:t,isEdit:r,isKline:i,positionType:a,values:l,position:n,entireTpsl:s}=e,o=null==s?void 0:s.sl;return{orderType_SL:t,orderPrice_SL:r?i?l.triggerPrice_SL:n.orderPrice:a&&(null==o?void 0:o.orderPrice)||l.triggerPrice_SL}}({type:e,isEdit:u,isKline:d,positionType:eN,values:f,position:g,entireTpsl:g.entireTpsl}))},triggerPriceChangeTP:eQ,orderPriceChangeTP:eB,triggerPriceChangeSL:eO,orderPriceChangeSL:eU,onTpRateChange:eD,onSlRateChange:eE,stopLossRateFocus:e=>{e||_({stopLossRate:"-"})},stopLossRateBlur:e=>{"-"!==e&&e||_({stopLossRate:""})},triggerWayChangeTP:()=>{let e={triggerWay_TP:{triggerWay_TP:f.triggerWay_TP}.triggerWay_TP===L.Pr.Latest?L.Pr.Mark:L.Pr.Latest};_(e),W.hv.set({tpTriggerWay:e.triggerWay_TP})},triggerWayChangeSL:()=>{let e={triggerWay_SL:{triggerWay_SL:f.triggerWay_SL}.triggerWay_SL===L.Pr.Latest?L.Pr.Mark:L.Pr.Latest};_(e),W.hv.set({slTriggerWay:e.triggerWay_SL})},checkTP:e=>{k(e)},checkSL:e=>{w(e)},onTpQuantityChange:e$,onSlQuantityChange:eK,onSliderChangeTP:e=>{_({quantity_TP:V({percent:e,availableQuantity:eC,quantityPrecision:G}),quantityPrecent_TP:e})},onSliderChangeSL:e=>{_({quantity_SL:V({percent:e,availableQuantity:ek,quantityPrecision:G}),quantityPrecent_SL:e})},tpChecked:C,setTpChecked:k,slChecked:j,setSlChecked:w,loading:q,setLoading:z,notShowConfirm:Q,toggleConfirm:()=>B(e=>!e),positionType:eN}}({openParams:ep.params}),{rawUnit:eh,unit:ex,precision:ev}
1=(0,p.A)({symbol:eT.position.symbol||""}),ef=(0,P.D)(),e_=function(e,t){let{$t:r}=(0,b.B)();switch(e){case L.zb.EntirePosition:return"".concat(r("TP"),"/").concat(r("SL"),"-").concat(r("Entire Position"));case L.zb.Normal:case L.zb.CopyTrade:return"".concat(r("TP"),"/").concat(r("SL"));case L.zb.NormalTakeProfit:case L.zb.CopyTradeTakeProfit:return t?"".concat(r("TP"),"-").concat(r("Fixed Qty")):"".concat(r("TP"),"-").concat(r("Partial Position"));case L.zb.NormalStopLoss:case L.zb.CopyTradeStopLoss:return t?"".concat(r("SL"),"-").concat(r("Fixed Qty")):"".concat(r("SL"),"-").concat(r("Partial Position"));case L.zb.KlineEntirePositionTakeProfit:return"".concat(r("TP"),"-").concat(r("Entire Position"));case L.zb.KlineEntirePositionStopLoss:return"".concat(r("SL"),"-").concat(r("Entire Position"));default:return""}}(eb,ey),eN=function(e){let{$t:t}=(0,b.B)();return t(e.orderType_TP===L.Cf.PlanMarket?"Take Profit Price":"Trigger Price")}({orderType_TP:eT.values.orderType_TP}),eL=function(e){let{$t:t}=(0,b.B)();return t(e.orderType_SL===L.Cf.PlanMarket?"Stop Loss Price":"Trigger Price")}({orderType_SL:eT.values.orderType_SL}),{triggerWayLabelMap:eS}=k(),eC=eS[eT.values.triggerWay_TP],ek=eS[eT.values.triggerWay_SL],ej=ee(String(eT.values.takeProfitRate||"")),ew=ee(String(eT.values.stopLossRate||""),!0),eq=(U=eT.isKline,eu=eT.tabType,!U&&[L.zb.NormalTakeProfit,L.zb.NormalStopLoss,L.zb.CopyTradeTakeProfit,L.zb.CopyTradeStopLoss].includes(eb)||eb===L.zb.Normal&&eu===L.Ll.Normal),ez=eb===L.zb.EntirePosition?"".concat(eg("TP"),"/").concat(eg("SL")):e_,eR="mt-s2 pr-1",eM="!bg-bg6",eW="!text-[14px] md:!text-[14px]",eA=(0,i.jsxs)("div",{className:"w-full",children:[(0,i.jsxs)("div",{className:"text-cm12 text-t1",children:[eg("Entire Position"),":"]}),(0,i.jsx)("div",{className:"text-cm12 text-t3 mt-1",children:eg("The TP/SL applies to the entire position. the order quantity changes with the position size.")}),(0,i.jsxs)("div",{className:"text-cm12 text-t1 mt-s2",children:[eg("Partial Position"),":"]}),(0,i.jsx)("div",{className:"text-cm12 text-t3 mt-1",children:eg("The order quantity doesnât change with the position size, you can place multiple orders.")})]}),eI=(0,i.jsx)("span",{className:"text-c12 text-t1",children:eg("Please select at least one option to proceed")});return(0,i.jsx)(u.Dialog,{open:ep.visible,onOpenChange:e=>{e||eT.onClose()},title:ez,footer:(0,i.jsxs)("div",{className:"gap-s2 grid grid-cols-2",children:[(0,i.jsx)(c.$,{variant:"secondary",size:"m",className:"h-10",onClick:()=>eT.onClose(),children:eg("Cancel")}),(0,i.jsx)(c.$,{size:"m",className:"h-10",disabled:!!eT.submitDisabled||eT.loading,loading:eT.loading,onClick:()=>{eT.submit()},children:eg("Confirm")})]}),variant:"drawer",className:"!py-s6 !h-[90dvh] !max-h-[90dvh] !w-full !max-w-none !overflow-hidden !px-0 md:!h-[min(720px,calc(100dvh-80px))] md:!max-h-[calc(100dvh-80px)] md:!w-[420px] md:!max-w-[calc(100vw-32px)]",headerClassName:"gap-s2 px-s6 !pt-0 !pb-0",footerClassName:"!mt-4 shrink-0 px-s6",bodyClassName:"!mt-0 flex min-h-0 flex-1 flex-col overflow-hidden px-0 !py-0 pt-0 md:mt-s1",children:(0,i.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,i.jsx)("div",{className:"px-s6",children:(0,i.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,i.jsx)(j,{item:eT.position}),(0,i.jsxs)("div",{className:"bg-bg2 mt-s4 rounded-r2 px-s4 py-s4",children:[(0,i.jsxs)("div",{className:"text-cm12 flex items-center justify-between",children:[(0,i.jsx)("div",{className:"text-t3",children:eg("Entry Price_1")}),(0,i.jsx)("div",{className:"text-t1",children:G(eT.position.avgPrice)})]}),(0,i.jsxs)("div",{className:"text-cm12 mt-s1 flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"text-t3",children:[eg("Last Price_1"),"/",eg("Mark Price_1")]}),(0,i.jsxs)("div",{className:"text-t1",children:[G(eT.lastPrice),"/",G(eT.markPrice)]})]}),eT.isKline&&eT.position.tpslType===L.Ll.Normal?(0,i.jsxs)("div",{className:"text-cm12 mt-s2 flex items-center justify-between",children:[(0,i.jsx)("div",{className:"text-t3",children:eg("Quantity_2")}),(0,i.jsxs)("div",{className:"text-t1",children:[G(ef(eT.position.contQuantity||0,eT.position.symbol||"",eT.position.planType===L.Tt.TakeProfit?eT.calcPrice_TP:eT.calcPrice_SL))," ",ex]})]}):null]}),eb===L.zb.Normal?(0,i.jsxs)("div",{className:"after:border-l1 mt-s4 gap-s2 relative flex items-center justify-between after:pointer-events-none after:absolute after:right-0 after:bottom-[1px] after:left-0 after:border-b after:content-['']",children:[(0,i.jsx)("div",{className:"min-w-0",children:(0,i.jsx)(s.Tabs,{variant:"text",size:"s",value:eT.tabType,onValueChange:e=>eT.changeType(e),children:(0,i.jsxs)(s.TabsList,{className:"w-auto",underlineClassName:"border-transparent",children:[(0,i.jsx)(s.TabsTrigger,{value:L.Ll.Position,className:eW,children:eg("Entire Position")}),(0,i.jsx)(s.TabsTrigger,{value:L.Ll.Normal,className:eW,children:eg("Partial Position")})]})})}),(0,i.jsx)(o.Tooltip,{content:eA,side:"bottom",align:"end",className:"w-[280px] max-w-[calc(100vw-var(--spacing-s8))]",children:(0,i.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 shrink-0 cursor-pointer",children:(0,i.jsx)(a.m,{className:"h-4 w-4"})})})]}):null]})}),(0,i.jsx)(d.ScrollArea,{className:"mt-s4 min-h-0 flex-1 pr-0",viewportClassName:"pr-0",children:(0,i.jsxs)("div",{className:"mx-s6",children:[(0,i.jsxs)("div",{className:"mb-s3 flex items-center justify-between",children:[eT.isEdit?eT.tpChecked?(0,i.jsx)("div",{className:"text-cm12 text-t1",children:eg("Take Profit")}):null:(0,i.jsx)(o.Tooltip,{content:eI,disabled:eT.slChecked,children:(0,i.jsx)("span",{className:"inline-flex",children:(0,i.jsx)(m.Checkbox,{checked:eT.tpChecked,disabled:!eT.slChecked,onChange:e=>eT.checkTP("checked"in e.target&&e.target.checked),children:(0,i.jsx)("span",{className:"text-cm12 text-t1",children:eg("Take Profit")})})})}),eT.tpChecked&&!eT.param?(0,i.jsx)(S,{value:eT.values.orderType_TP,onChange:eT.orderTypeChangeTP}):null]}),eT.tpChecked?(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsxs)("div",{className:"gap-s2 grid grid-cols-[minmax(0,1fr)_96px] md:grid-cols-[1fr_108px]",children:[(0,i.jsx)(_.ho,{placeholder:eN,symbol:eT.position.symbol||"",value:null!=(C=eT.values.triggerPrice_TP)?C:"",onCh
1ange:e=>eT.triggerPriceChangeTP(e),className:"h-10",inputClassName:"text-b14 text-left",prefix:eT.values.triggerPrice_TP?(0,i.jsx)("span",{className:"text-bm14 text-t1",children:H("tp",eT.position)}):null,suffix:(0,i.jsxs)("button",{type:"button",className:"text-bm14 text-t1 hover:text-t1 inline-flex cursor-pointer items-center gap-1",onClick:()=>eT.triggerWayChangeTP(),children:[eC,(0,i.jsx)(l.y,{className:"size-[12px]"})]})}),(0,i.jsx)(y.Q,{size:"m",placeholder:eg("Gain"),value:eT.values.takeProfitRate,className:"text-b14",maxDecimal:1,onChange:e=>eT.onTpRateChange(String(null!=e?e:"")),wrapperClassName:"h-10 !px-s3",rightSlot:(0,i.jsx)("span",{className:"text-c12 text-t3",children:"%"})})]}),Number(eT.values.triggerPrice_TP||0)>0&&(null==(r=eT.orderPriceUtils_TP)?void 0:r.bool)===!1?(0,i.jsx)("div",{className:"text-c12 text-p3 mt-s2",children:eT.orderPriceUtils_TP.msg}):null,eT.values.orderType_TP===L.Cf.PlanMarket?(0,i.jsx)(g.Slider,{className:eR,value:ej,marks:J,showIndicator:!0,showIndicatorOnDragging:!0,SliderBarclassName:eM,onValueChange:e=>eT.onTpRateChange(er(et(e)))}):eT.values.orderType_TP===L.Cf.PlanLimit?(0,i.jsx)(_.ho,{placeholder:eg("Limit Price"),symbol:eT.position.symbol||"",value:null!=(w=eT.values.orderPrice_TP)?w:"",onChange:e=>eT.orderPriceChangeTP(e),className:"mt-s2 h-10",inputClassName:"text-b14 text-right",prefix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:eg("Limit Price")}),suffix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:"USDT"})}):null,eq?(0,i.jsxs)("div",{className:"mt-s4 flex flex-col",children:[(0,i.jsx)(f,{value:eT.values.quantity_TP,unit:eh,precision:ev,max:Number(eT.available_TP)||0,onChange:e=>eT.onTpQuantityChange(e),wrapperClassName:"h-10",className:"text-b14",prefix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:eg("Quantity_2")}),suffix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:ex})}),(0,i.jsxs)("div",{className:"text-c12 mt-s2 ".concat(eT.quantity_TP>eT.available_TP?"text-p3":"text-t3"),children:[eg("Avail.Size_2"),": ",G(eT.available_TP)," ",ex]}),(0,i.jsx)(g.Slider,{className:eR,value:Number(eT.values.quantityPrecent_TP||0),marks:[0,25,50,75,100],showIndicator:!0,showIndicatorOnDragging:!0,SliderBarclassName:eM,onValueChange:eT.onSliderChangeTP})]}):null,Number(eT.values.triggerPrice_TP||0)>0?(0,i.jsx)("div",{className:"mt-s3",children:(0,i.jsx)(z,{isDemoTrading:eT.isDemoTrading,takeProfitRate:eT.values.takeProfitRateAbout,position:eT.position,order:{...eT.values,quantity:eT.quantityCompare_TP,lastPrice:eT.lastPrice}})}):null]}):null,(0,i.jsxs)("div",{className:"mt-s4 mb-s3 flex items-center justify-between",children:[eT.isEdit?eT.slChecked?(0,i.jsx)("div",{className:"text-cm12 text-t1",children:eg("Stop Loss")}):null:(0,i.jsx)(o.Tooltip,{content:eI,disabled:eT.tpChecked,children:(0,i.jsx)("span",{className:"inline-flex",children:(0,i.jsx)(m.Checkbox,{checked:eT.slChecked,disabled:!eT.tpChecked,onChange:e=>eT.checkSL("checked"in e.target&&e.target.checked),children:(0,i.jsx)("span",{className:"text-cm12 text-t1",children:eg("Stop Loss")})})})}),eT.slChecked&&!eT.param?(0,i.jsx)(S,{value:eT.values.orderType_SL,onChange:eT.orderTypeChangeSL}):null]}),eT.slChecked?(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsxs)("div",{className:"gap-s2 grid grid-cols-[minmax(0,1fr)_96px] md:grid-cols-[1fr_108px]",children:[(0,i.jsx)(_.ho,{placeholder:eL,symbol:eT.position.symbol||"",value:null!=(Q=eT.values.triggerPrice_SL)?Q:"",onChange:e=>eT.triggerPriceChangeSL(e),className:"h-10",inputClassName:"text-b14 text-left",prefix:eT.values.triggerPrice_SL?(0,i.jsx)("span",{className:"text-bm14 text-t1",children:H("sl",eT.position)}):null,suffix:(0,i.jsxs)("button",{type:"button",className:"text-bm14 text-t1 hover:text-t1 inline-flex cursor-pointer items-center gap-1",onClick:()=>eT.triggerWayChangeSL(),children:[ek,(0,i.jsx)(l.y,{className:"size-[12px]"})]})}),(0,i.jsx)(y.Q,{size:"m",placeholder:eg("Loss"),value:null!=(B=eT.values.stopLossRate)?B:"",className:"text-b14",maxDecimal:1,onFocus:e=>eT.stopLossRateFocus(e.target.value),onBlur:e=>eT.stopLossRateBlur(e.target.value),onChange:e=>eT.onSlRateChange(String(null!=e?e:"")),wrapperClassName:"h-10 !px-s3",rightSlot:(0,i.jsx)("span",{className:"text-c12 text-t3",children:"%"})})]}),Number(eT.values.triggerPrice_SL||0)>0&&(null==(T=eT.orderPriceUtils_SL)?void 0:T.bool)===!1?(0,i.jsx)("div",{className:"text-c12 text-p3 mt-s2",children:eT.orderPriceUtils_SL.msg}):null,eT.values.orderType_SL===L.Cf.PlanMarket?(0,i.jsx)(g.Slider,{className:eR,value:ew,marks:J,showIndicator:!0,showIndicatorOnDragging:!0,SliderBarclassName:eM,onValueChange:e=>{let t=er(et(e));eT.onSlRateChange(t?"-".concat(t):void 0)},onPointerUp:()=>eT.stopLossRateBlur(eT.values.stopLossRate)}):eT.values.orderType_SL===L.Cf.PlanLimit?(0,i.jsx)(_.ho,{placeholder:eg("Limit Price"),symbol:eT.position.symbol||"",value:null!=(O=eT.values.orderPrice_SL)?O:"",onChange:e=>eT.orderPriceChangeSL(e),className:"mt-s2 h-10",inputClassName:"text-b14 text-right",prefix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:eg("Limit Price")}),suffix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:"USDT"})}):null,eq?(0,i.jsxs)("div",{className:"mt-s4 flex flex-col",children:[(0,i.jsx)(f,{value:eT.values.quantity_SL,unit:eh,precision:ev,max:Number(eT.available_SL)||0,onChange:e=>eT.onSlQuantityChange(e),wrapperClassName:"h-10",className:"text-b14",prefix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:eg("Quantity_2")}),suffix:(0,i.jsx)("span",{className:"text-c12 text-t3",children:ex})}),(0,i.jsxs)("div",{className:"text-c12 mt-s2 ".concat(eT.quantity_SL>eT.available_SL?"text-p3":"text-t3"),children:[eg("Avail.Size_2"),": ",G(eT.available_SL)," ",ex]}),(0,i.jsx)(g.Slider,{className:eR,value:Number(eT.values.quantityPrecent_SL||0),marks:[0,25,50,75,100],showIndicator:!0,showIndicatorOnDragging:!0,SliderBarclassName:eM,onValueChange:eT.onSliderChangeSL})]}):null,Number(eT.values.triggerPrice_SL||0)>0?(0,i.jsx)("div",{className:"mt-s3",children:(0,i.jsx)(q,{isDemoTrading:eT.isDemoTrading,stopLossRate:eT.values.stopLossRateAbout,position:eT.position,order:{...eT.values,quantity:eT.quantityCompare_SL,lastPrice:eT.lastPrice}})}):null,(0,i.jsxs)("div",{className:"mt-s3 bg-p4/10 text-p4 text-cm12 gap-s2 rounded-r3 p-s3 flex items-start",children:[(0,i.jsx)(n.M,{className:"size-5 shrink-0"}),(0,i.jsx)("span",{children:eg("The stop loss price should not be too close to the liquidation price, in case of failure of stop loss trigger.")})]})]}):null,eT.isKline?(0,i.jsx)("div",{className:"mt-s5",children:(0,i.jsx)(m.Checkbox,{checked:eT.notShowConfirm,onChange:()=>eT.toggleConfirm(),children:(0,i.jsx)("span",{className:"text-c12 text-t3",children:eg('No remindersï¼Can be reset in "Order Confirmation"ï¼')})})}):null]})})]})})}}}]);
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.