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]="36949200-f10f-4e2f-869c-385231c65d0b",e._sentryDebugIdIdentifier="sentry-dbid-36949200-f10f-4e2f-869c-385231c65d0b")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[314],{15637:(e,t,r)=>{r.d(t,{B:()=>i});let i=(0,r(41809).v)(e=>({closeEditorResetVersion:0,resetCloseEditors:()=>e(e=>({closeEditorResetVersion:e.closeEditorResetVersion+1}))}))},25704:(e,t,r)=>{r.d(t,{U6:()=>m,aW:()=>d,aw:()=>c,cP:()=>l,wC:()=>u});var i=r(749),n=r(3529),a=r(17883),s=r(68924);function l(e){let t=e.trim().toUpperCase();return t?t.endsWith("-SWAP")?t:t.endsWith("-USDT")?(0,n.Qx)(t,"-"):t.endsWith("USDT")?(0,n.Qx)(t,""):"":""}function o(e){var t;return(0,a.ql)(null!=(t=null==e?void 0:e.contractScope)?t:null==e?void 0:e.contractType)}function c(e){let{currentStrategyMode:t,nextStrategyMode:r,symbol:n,symbolConfig:a}=e;return r!==t&&n?r!==i.n1.Grid||o(a)?{status:"allowed"}:{status:"blocked"}:{status:"noop"}}function d(e){window.history.replaceState({},"",e)}function u(e){window.history.pushState({},"",e)}function m(e){let{locale:t,strategyMode:r,symbol:a,symbolConfig:c}=e,d=l(a);if(!d)return{inputSymbol:a,status:"invalid"};if(r===i.n1.Grid&&!o(c))return{serviceSymbol:d,status:"blocked"};let u=(0,n.A2)(d,"-"),m=(0,n.A2)(d,""),p=null==c?void 0:c.precision;return{compactSymbol:m,displaySymbol:u,href:(0,s.Cv)(t,d,r),..."number"==typeof p?{orderBookPrecision:p}:{},serviceSymbol:d,status:"allowed",strategyMode:r}}},25829:(e,t,r)=>{r.d(t,{vw:()=>c});var i=r(79237),n=r(90477),a=r(4487),s=r(38113);let l=(0,a.F)(["flex","items-center","justify-center","py-[2px]","rounded-r1","text-t12","whitespace-nowrap","transition-colors","w-fit","gap-s1","h-[22px]"],{variants:{variant:{neutral:["bg-bt2","text-t1","px-s2"],yellow:["bg-p4/10","text-p4","px-s2"],red:["bg-p3/10","text-p3","px-s2"],green:["bg-p2/10","text-p2","px-s2"],primary:["bg-p1","text-black","pl-s2","pr-s1","rtl:pl-s1","rtl:pr-s2"],pending:["bg-p4/10","text-p4","px-s2"],warning:["bg-p3/10","text-p3","px-s2"],completed:["bg-p2/10","text-p2","px-s2"],filter:["px-s2"]}},defaultVariants:{variant:"neutral"}}),o=(0,a.F)(["inline-flex","items-start","px-s3","py-s1","rounded-rb5","transition-colors","cursor-pointer","bg-bg2","hover:bg-gradient-to-r","hover:from-bb2","hover:to-bg6","text-t1","text-t12"],{variants:{selected:{true:"",false:""}},compoundVariants:[{selected:!0,class:"bg-gradient-to-r from-bg2 to-bg6"}],defaultVariants:{selected:!1}}),c=s.forwardRef((e,t)=>{let{className:r,variant:a="neutral",icon:s,children:c,theme:d="light",selected:u=!1,...m}=e;if("filter"===a)return(0,i.jsx)("div",{className:o({selected:u}),children:(0,i.jsx)("div",{ref:t,className:(0,n.Q)(l({variant:a}),r),...m,children:(0,i.jsx)("span",{children:c})})});let p="primary"===a?"right":"left";return(0,i.jsxs)("div",{ref:t,className:(0,n.Q)(l({variant:a}),r),...m,children:[s&&"left"===p&&(0,i.jsx)("span",{className:"inline-flex shrink-0 items-center justify-center",children:s}),(0,i.jsx)("span",{children:c}),s&&"right"===p&&(0,i.jsx)("span",{className:"inline-flex shrink-0 items-center justify-center",children:s})]})});c.displayName="Tag"},40314:(e,t,r)=>{r.d(t,{Fn:()=>ef,P8:()=>eo,Q$:()=>eb,SR:()=>eu,TF:()=>ev,Vk:()=>ey,_H:()=>en,aJ:()=>X,c_:()=>el,em:()=>ew,hG:()=>$,jc:()=>ee,jr:()=>ea,sC:()=>em,v:()=>eh,wX:()=>ej});var i=r(79237),n=r(7370),a=r(62309),s=r(57091),l=r(46540),o=r(25829),c=r(30511),d=r(70659),u=r(93924),m=r(69938),p=r(56044),x=r(66960),y=r(31508),h=r(51430),b=r(25825),g=r(96620),f=r(64951),v=r(19490),N=r(3529),j=r(90477),w=r(5257),P=r(12733),k=r(51025),C=r(66850),S=r(61841),T=r(89719),L=r(92063),q=r(10022),Q=r(40882),M=r(81407),_=r(31483),I=r(18006),z=r(14275),E=r(4390);r(77222);var F=r(38113),A=r(79043),B=r(92413),R=r(42384),D=r(27644),W=r(50791),K=r(50965),O=r(95496),U=r(97867),J=r(15637),V=r(2437),Y=r(25704),G=r(70464),Z=r(32837);let H=["realizedPNL","closedPnl","fundingFee","tradingFee"],$="text-c12 text-t3 font-normal whitespace-nowrap",X="text-c12 text-t1 cursor-default whitespace-nowrap",ee="text-c12 cursor-default whitespace-nowrap",et="text-t3 hover:text-t1 size-3.5 shrink-0 cursor-pointer";function er(e){return e>0?"text-p2":e<0?"text-p3":"text-t1"}function ei(e){let t=Number(e);return Number.isFinite(t)?t:0}function en(e){var t,r;let i=ei(e.pnl),n=ei(e.roe),a=(0,v.iT)(null!=(t=e.pnl)?t:0),s=null==(r=e.roe)||""===String(r).trim()?"--":(0,v.BY)(r,2)||"--";return{pnlClassName:er(i),pnlText:a,roeClassName:er(n),roeText:"(".concat(s,")")}}function ea(e){var t;let r=(0,B.T)(),{toggleSymbol:i}
1=(0,R.k)(),n=(0,W.xO)(),a=(0,N.A2)(e.symbol||"","")||"--",s="short"===e.side?"text-p3":"text-p2",l="short"===e.side?"border-p3":"border-p2",o=e.leverage?"".concat(e.leverage,"X"):"--",c=0>=Number(null!=(t=e.separatedPositionId)?t:0);return{symbolText:a,leverageText:o,borderTone:l,leverageTone:s,canEditLeverage:c,handleSwitchSymbol:(0,F.useCallback)(()=>{if(!e.symbol)return;let t=(0,Y.cP)(e.symbol);t&&t!==(0,Y.cP)(r)&&i(t)},[r,e.symbol,i]),handleOpenLeverage:(0,F.useCallback)(()=>{e.symbol&&n.showLayer({item:e})},[e,n])}}function es(e){let t=Number(e);return Number.isFinite(t)?t>0?"text-p2":t<0?"text-p3":"text-t1":"text-t1"}function el(e){let{$t:t}=(0,x.B)(),r=(0,V.r)(e=>e.columnOptions),n=(0,F.useMemo)(()=>e.some(e=>void 0!==e.recallPrice&&null!==e.recallPrice&&""!=="".concat(e.recallPrice)),[e]);return(0,F.useMemo)(()=>{let e={symbol:()=>({title:(0,i.jsx)("span",{className:$,children:t("Symbol")}),key:"symbol",dataIndex:"symbol",width:120,fixed:"left",render:(e,t)=>(0,i.jsx)(ep,{item:t})}),quantity:()=>({title:(0,i.jsx)("span",{className:$,children:t("Available/Holding")}),key:"quantity",width:124,render:(e,t)=>(0,i.jsxs)("span",{className:X,children:["".concat((0,M.ac)(t.displayAvailableQuantity),"/").concat((0,M.ac)(t.displayQuantity)),t.unit?(0,i.jsx)("span",{className:"text-c12 text-t3 ml-1",children:t.unit}):null]})}),avgPrice:()=>({title:(0,i.jsx)("span",{className:$,children:t("Entry Price")}),key:"avgPrice",width:78,render:(e,t)=>(0,i.jsx)("span",{className:X,children:(0,M.ac)(t.avgPrice)})}),positionMargin:()=>({title:(0,i.jsx)("span",{className:$,children:t("Margin")}),key:"positionMargin",width:94,render:(e,t)=>(0,i.jsx)(eb,{item:t})}),markPrice:()=>({title:(0,i.jsx)("span",{className:$,children:t("Mark Price")}),key:"markPrice",width:86,render:(e,t)=>(0,i.jsx)("span",{className:X,children:(0,M.ac)(t.markPrice)})}),unrealisedPnl:()=>({title:(0,i.jsx)(em,{}),key:"unrealisedPnl",width:144,render:(e,t)=>(0,i.jsx)(ex,{item:t})}),realisedPnl:()=>({title:(0,i.jsx)("span",{className:$,children:t("Realized PNL")}),key:"realisedPnl",width:100,render:(e,t)=>(0,i.jsx)(ef,{value:t.realisedPnl,positionId:t.id})}),liquidationPrice:()=>({title:(0,i.jsx)("span",{className:$,children:t("Liq Price")}),key:"liquidationPrice",width:78,render:(e,t)=>(0,i.jsx)(ev,{value:t.liquidationPrice,symbol:t.symbol})}),marketClose:()=>({title:(0,i.jsx)("span",{className:$,children:t("Market")}),key:"marketClose",width:108,render:(e,t)=>(0,i.jsx)(ej,{item:t})}),operation:()=>({title:(0,i.jsx)("span",{className:$,children:t("Operation")}),key:"operation",width:290,render:(e,t)=>(0,i.jsx)(eP,{item:t})}),reverse:()=>({title:(0,i.jsx)("span",{className:$,children:t("Reverse")}),key:"reverse",width:88,render:(e,t)=>(0,i.jsx)(ew,{item:t})}),tpsl:()=>({title:(0,i.jsx)("span",{className:$,children:t("TP/SL")}),key:"tpsl",width:70,render:(e,t)=>(0,i.jsx)(ek,{item:t})}),positionTPSL:()=>({title:(0,i.jsx)(eu,{label:t("Position TP/SL"),tooltip:t("This setting applies to the entire position. When TP/SL trigger price is reached, market/limit order will be created to close the entire position.")}),key:"positionTPSL",width:108,render:(e,t)=>(0,i.jsx)(eC,{item:t})}),weight:()=>({title:(0,i.jsx)(eu,{label:t("ADL"),tooltip:t("This indicator shows your position in the auto-deleverage queue.If all lights are lit,in the event of a liquidation,your position may be reduced.")}),key:"weight",width:60,render:(e,t)=>(0,i.jsx)(ey,{item:t})})},a=r.filter(e=>!e.hidden).map(t=>e[t.key]());if(!n)return a;let s={title:(0,i.jsx)(eu,{label:t("Coupon Recall Price"),tooltip:t("The system will recall your coupon and close your position if the coupon recall price is hit first, or execute forced liquidation if the liquidation price is hit first. Monitor both prices closely to manage your risk.")}),key:"recallPrice",width:126,render:(e,t)=>(0,i.jsx)("span",{className:X,children:(0,M.ac)(t.recallPrice)})},l=a.findIndex(e=>"marketClose"===e.key),o=[...a];return o.splice(l,0,s),o},[t,n,r])}function eo(e){let{$t:t}=(0,x.B)(),{Header:r,PnlRoe:n,Actions:a}=e.renderers;return[{title:t("Symbol"),key:"symbol",dataIndex:"symbol",mobile:{slot:"header",label:(e,t)=>
1(0,i.jsx)(r,{item:t}),value:()=>null,labelClassName:"min-w-0 flex-1",valueClassName:"hidden"}},{title:t("Available/Holding"),key:"quantity",render:(e,t)=>(0,i.jsxs)("span",{className:"text-cm12 text-t1",children:["".concat((0,M.ac)(t.displayAvailableQuantity),"/").concat((0,M.ac)(t.displayQuantity)),t.unit?(0,i.jsx)("span",{className:"ml-1",children:t.unit}):null]}),mobile:{slot:"item"}},{title:t("Entry Price"),key:"avgPrice",render:(e,t)=>(0,i.jsx)("span",{className:"text-cm12 text-t1",children:(0,M.ac)(t.avgPrice)}),mobile:{slot:"item"}},{title:t("Margin"),key:"positionMargin",render:(e,t)=>(0,i.jsx)(eb,{item:t}),mobile:{slot:"item"}},{title:t("Mark Price"),key:"markPrice",render:(e,t)=>(0,i.jsx)("span",{className:"text-cm12 text-t1",children:(0,M.ac)(t.markPrice)}),mobile:{slot:"item"}},{title:t("Unrealized PNL(ROE)"),key:"unrealisedPnl",render:(e,t)=>(0,i.jsx)(n,{item:t}),mobile:{slot:"item"}},{title:t("Liq Price"),key:"liquidationPrice",render:(e,t)=>(0,i.jsx)(ev,{value:t.liquidationPrice,symbol:t.symbol}),mobile:{slot:"item"}},{title:t("Actions"),key:"actions",render:(e,t)=>(0,i.jsx)(a,{item:t}),mobile:{slot:"actions",label:null,value:(e,t)=>(0,i.jsx)(a,{item:t})}}]}function ec(e){let t=Number(e);return Number.isFinite(t)?t:0}function ed(e,t){let r=Math.max(0,ec(t));return""===e||null==e?"":String(Math.min(Math.max(0,ec(e)),r))}function eu(e){let{label:t,tooltip:r}=e;return(0,i.jsx)(l.Tooltip,{className:"text-cm12 md:text-cm12 max-w-[300px] md:max-w-[300px]",content:(0,i.jsx)("div",{children:r}),side:"top",children:(0,i.jsx)("span",{className:"".concat($," border-t4 cursor-help border-b border-dashed"),children:t})})}function em(){let{$t:e,locale:t}=(0,x.B)(),r=(0,k.k)(e=>{var t,r;return null!=(r=null==(t=e.user)?void 0:t.userId)?r:0}),n=(0,T.TY)(e=>e.patchConfigs),a="1"===(0,T.wc)()?"1":"0",[s,o]=(0,F.useState)(a),c=(0,I.useMutation)({mutationFn:e=>(0,w.J_)({locale:t,body:{settingKey:"unpnl_base_price",settingValue:e}}),onSuccess:(e,t)=>{(null==e?void 0:e.code)===200&&(n({basePrice:t}),q.ZC.getState().refreshCharts())}});(0,F.useEffect)(()=>{c.isPending||o(a)},[a,c.isPending]);let d=function(e,t){let r="1"===e?"1":"0",i={value:"1",label:t("Mark Price"),description:t("Use mark price to calculate Unrealized profit & loss and Return on Equity."),active:"1"===r},n={value:"0",label:t("Last Price"),description:t("Use the last price to calculate unrealized profit and loss and Return on Equity."),active:"0"===r};return{label:t("Unrealized PNL(ROE)"),title:t("Choose a benchmark"),description:("1"===r?i:n).description,options:[i,n]}}(s,e),u=(0,F.useCallback)(e=>{if(!c.isPending&&e!==s){if(o(e),!r){n({basePrice:e}),q.ZC.getState().refreshCharts();return}c.mutate(e)}},[s,n,c,r]);return(0,i.jsx)(l.Tooltip,{className:"text-cm12 md:text-cm12 max-w-[300px] md:max-w-[300px]",content:(0,i.jsxs)("div",{className:"w-[260px]",children:[(0,i.jsx)("div",{className:"text-cm12 text-t1 mb-[6px] font-medium",children:d.title}),(0,i.jsx)("div",{className:"text-c12 text-t4 mb-4",children:d.description}),(0,i.jsx)("div",{className:"flex items-center gap-5",children:d.options.map(e=>(0,i.jsxs)("button",{type:"button",disabled:c.isPending,onClick:()=>u(e.value),className:"flex cursor-pointer items-center gap-2 disabled:cursor-not-allowed disabled:opacity-60",children:[(0,i.jsx)("span",{className:"flex size-3 shrink-0 items-center justify-center rounded-full border ".concat(e.active?"border-p1":"border-t5"),children:(0,i.jsx)("span",{className:"size-1.5 rounded-full ".concat(e.active?"bg-p1":"bg-transparent")})}),(0,i.jsx)("span",{className:"text-cm12 ".concat(e.active?"text-p1-dark":"text-t2"),children:e.label})]},e.value))})]}),side:"top",children:(0,i.jsx)("span",{className:"".concat($," border-t4 cursor-help border-b border-dashed"),children:d.label})})}function ep(e){let{item:t}=e,{$t:r,locale:a}=(0,x.B)(),{borderTone:s,canEditLeverage:l,handleOpenLeverage:c,handleSwitchSymbol:d,leverageText:u,leverageTone:m,symbolText:p}=ea(t);return(0,i.jsxs)("div",{className:(0,j.cn)("-my-[10px] flex h-14 min-w-0 flex-col justify-center","fa"===a?"border-r-4 pr-2":"border-l-4 pl-2",s),children:[(0,i.jsxs)("div",{className:"flex items-center gap-px",children:[(0,i.jsxs)("button",{type:"button",className:"text-m12 text-t1 hover:text-t1 -m-1 inline-flex min-h-6 cursor-pointer items-center gap-px rounded px-1 whitespace-nowrap",onClick:d,children:[(0,i.jsx)("span",{children:p}),(0,i.jsx)("span",{className:"text-t3",children:r("Perp")})]}),"trader"===t.tradeType?(0,i.jsx)(o.vw,{variant:"yellow",children:r("Leading Trade")}):null,"follower"===t.tradeType?(0,i.jsx)(o.vw,{variant:"yellow",children:r("Copy Trade")}):null]}),(0,i.jsx)("div",{className:"mt-[3px] flex items-center",children:l?(0,i.jsxs)("button",{type:"button",className:"-m-1 inline-flex min-h-6 cursor-pointer items-center gap-1 rounded p-1",onClick:c,children:[(0,i.jsx)("span",{className:(0,j.cn)("text-c12 font-medium",m),children:u}),(0,i.jsx)(n.q,{className:et})]}):(0,i.jsx)("span",{className:(0,j.cn)("text-c12 font-medium",m),children:u})})]})}function ex(e){let{item:t}=e,r=(0,W.J5)(),n=(0,z.useQueryClient)(),s=en(t),l=(0,F.useCallback)(()=>{r.showLayer({item:t})},[t,r]),o=(0,F.useCallback)(()=>{let{user:e,userLoadFromStorage:t}=k.k.getState();
1t&&n.prefetchQuery((0,L.z)(null==e?void 0:e.userId)),r.preload().catch(()=>void 0)},[r,n]);return(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)("div",{className:"mr-1 flex flex-col",children:[(0,i.jsx)("span",{className:"direction-ltr ".concat(ee," ").concat(s.pnlClassName),children:s.pnlText}),(0,i.jsx)("span",{className:"direction-ltr text-c12 ".concat(s.roeClassName),children:s.roeText})]}),(0,i.jsx)(a.l,{className:et,onClick:l,onMouseEnter:o})]})}function ey(e){var t;let{item:r,barClassName:n}=e,a=null!=(t=r.weight)?t:0,s=0;return a>0&&a<20?s=1:a>=20&&a<40?s=2:a>=40&&a<60?s=3:a>=60&&a<80?s=4:a>=80&&(s=5),(0,i.jsx)("div",{className:"flex w-fit items-center gap-[2px]",children:[1,2,3,4,5].map(e=>(0,i.jsx)("span",{className:(0,j.cn)("inline-block h-[10px] w-1 rounded-[1px]",n),style:{background:e>s?"var(--color-bg6)":"var(--color-p1)"}},e))})}function eh(e,t){return"crossed"===e?t("Cross"):"fixed"===e?t("Isolated"):"separated"===e?t("Split"):"--"}function eb(e){let{item:t}=e,{$t:r}=(0,x.B)(),a=(0,W.r4)(),s="fixed"===t.marginMode,o=(0,F.useCallback)(()=>{a.showLayer({item:t})},[t,a]);return(0,i.jsxs)("div",{className:"flex items-center gap-1 max-md:justify-end max-md:gap-2",children:[(0,i.jsxs)("div",{className:"flex flex-col max-md:flex-row max-md:items-center max-md:gap-2",children:[(0,i.jsx)("span",{className:(0,j.cn)(X,"max-md:text-cm12 max-md:text-t1"),children:(0,M.ac)(t.positionMargin)}),(0,i.jsx)("span",{className:"text-c12 text-t3 max-md:text-cm12 max-md:text-t1",children:eh(t.marginMode,r)})]}),s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"max-md:hidden",children:(0,i.jsx)(l.Tooltip,{lazyContent:!0,content:(0,i.jsx)("div",{className:"max-w-[300px] text-sm",children:r("Click here to increase or decrease the margin assigned to this position")}),side:"top",children:(0,i.jsx)(n.q,{className:et,onClick:o})})}),(0,i.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 hidden size-4 items-center justify-center max-md:flex",onClick:o,children:(0,i.jsx)(n.q,{className:"size-3.5"})})]}):null]})}function eg(e){var t;let{positionId:r}=e,{$t:n,locale:a}=(0,x.B)(),s=(0,k.k)(e=>{var t,r;return null!=(r=null==(t=e.user)?void 0:t.userId)?r:0}),l=(0,E.useQuery)({queryKey:["position-realised-pnl-detail",a,s,r],enabled:!!a&&!!s&&!!r,staleTime:1e4,gcTime:1e4,retry:!1,queryFn:async()=>{var e;return null!=(e=(await (0,C.lT)({locale:a,params:{positionId:r,userId:Number(s)}})).data)?e:null}}),o=(t=l.data,H.map(e=>{var r;return{key:e,valueText:(r=null==t?void 0:t[e],"".concat((0,M.ac)(r)," USDT")),trendClassName:es(null==t?void 0:t[e])}})),d={realizedPNL:n("Realized PNL"),closedPnl:n("Closed PNL"),fundingFee:n("Funding Fee"),tradingFee:n("Trading Fee")};return l.isLoading?(0,i.jsx)("div",{className:"flex min-h-[112px] w-[288px] items-center justify-center py-2",children:(0,i.jsx)(c.t,{size:"s"})}):(0,i.jsxs)("div",{className:"w-[288px]",children:[(0,i.jsx)("div",{className:"text-b14 text-t1 mb-3 font-semibold",children:n("Realized PNL")}),o.map(e=>(0,i.jsxs)("div",{className:"mb-3 flex items-center justify-between last:mb-0",children:[(0,i.jsx)("span",{className:"text-c12 text-t3",children:d[e.key]}),(0,i.jsx)("span",{className:"direction-ltr text-c12 whitespace-nowrap ".concat(e.trendClassName),children:e.valueText})]},e.key)),(0,i.jsxs)("div",{className:"text-c12 text-t4 border-t4 mt-3 border-t border-dashed pt-3",children:[n("Realized profit and loss since opening the position, calculated based on the last price."),(0,i.jsx)("br",{}),n("Realized PNL=Closed PNL+ Funding Fee + Trading Fee")]})]})}function ef(e){let{value:t,positionId:r}=e,n={text:(0,M.ac)(t),trendClassName:es(t)};return(0,i.jsx)(l.Tooltip,{className:"max-w-[320px] md:max-w-[320px]",content:r?(0,i.jsx)(eg,{positionId:r}):void 0,disabled:!r,lazyContent:!0,side:"top",children:(0,i.jsx)("span",{className:"direction-ltr text-c12 cursor-help whitespace-nowrap ".concat(n.trendClassName," border-t4 border-b border-dashed"),children:n.text})})}function ev(e){let{value:t,symbol:r}=e,{isExecuting:n}=(0,A.p)(r);return(0,i.jsx)("span",{className:"text-c12 text-p1-dark",children:n?"--":(0,M.ac)(t)})}function eN(e){let{$t:t,locale:r}=(0,x.B)(),i=(0,T.QA)().usdt_user_confirm||"11111111",n=(0,P.bZ)(e=>e.symbolsConfigBySymbol),a=(0,F.useMemo)(()=>e.symbol?e.symbol.endsWith("-SWAP")?e.symbol:(0,N.Qx)(e.symbol,"-"):"",[e.symbol]),s=a?g.p.USDT.SIMPLE_TICKER(a):"",l=e.symbol?n[e.symbol]:void 0,o=Number((null==l?void 0:l.multiplier)||0),c=function(e){let t=[e.last,e.markPrice,e.avgPrice].find(e=>null!=e&&""!==String(e).trim());return void 0===t?"":String(t)}(e),d=Number(c||0),u=String((0,T.TY)(e=>e.configs.tradeUnit||"0")),m=String((0,T.TY)(e=>e.configs.usdtCost||"0")),[p,y]=(0,F.useState)(!1),h=(0,F.useCallback)(n=>{var a;if(!e.symbol||!e.side)return;let l=function(e){if(!e)return 0;let t=(0,f.u)(e),r=b.G.getState().topicData[t],i=Number((null==r?void 0:r.last)||0);return Number.isFinite(i)?i:0}(s)||d,c=n.useFullQuantityCont?Math.max(0,ec(n.quantityContLimit)):(a={displayQuantity:n.displayQuantity,quantityContLimit:n.quantityContLimit,tradeUnit:u,usdtCost:m,multiplier:o,calcPrice:l||Number(n.orderPrice||0)||Number(e.avgPrice||0)},Math.min(Math.max(0,(0,G.DG)({quantity:Math.max(0,ec(a.displayQuantity)),tradeUnit:a.tradeUnit,usdtCost:a.usdtCost,multiplier:a.multiplier,price:a.calcPrice})),Math.max(0,ec(a.quantityContLimit))));c&&(0,Z.Ie)({$t:t,confirmStr:i,item:e,lastPrice:d,locale:r,request:{orderType:n.orderType,quantity:c,orderPrice:"limit"===n.orderType?n.orderPrice||String(l||""):void 0,displayQuantityText:n.displayQuantityText,lastPrice:l,multiplier:o}
1,setLoading:y})},[t,i,e.avgPrice,e,e.side,e.symbol,d,r,o,s,u,m]);return{defaultPrice:c,lastPrice:d,loading:p,requestSubmit:h}}function ej(e){let{item:t,label:r,buttonClassName:n}=e,{$t:a}=(0,x.B)(),s=eN(t),l=(0,F.useCallback)(()=>{s.requestSubmit({orderType:"market",displayQuantity:Number(t.displayQuantity||t.quantity||0),quantityContLimit:Number(t.quantity||0),displayQuantityText:(0,v.iT)(Number(t.displayQuantity||t.quantity||0)),useFullQuantityCont:!0})},[s,t.displayQuantity,t.quantity]);return(0,i.jsx)(d.$,{variant:"secondary",size:"s",loading:s.loading,disabled:s.loading,onClick:l,className:(0,j.cn)("text-c12 h-8 px-3 whitespace-nowrap",n),children:r||a("Flash Close")})}function ew(e){let{item:t,buttonClassName:r}=e,{$t:n,locale:a}=(0,x.B)(),[s,l]=(0,F.useState)(!1),o=(0,T.QA)(),c=(0,Q.ru)(o.usdt_user_confirm),m=(0,k.k)(e=>{var t,r;return null!=(r=null==(t=e.user)?void 0:t.userId)?r:0}),p=(0,F.useCallback)(async()=>{if(t.id){l(!0);try{await (0,S.ly)({locale:a,params:{positionId:Number(t.id),userId:Number(m),source:"web"}}),u.toast.success(n("Success")),await (0,O.j6)()}catch(t){var e;(0,y.d)(t)&&10307===Number((null==(e=t.data)?void 0:e.code)||0)&&(0,W.NK)(K.k.InsufficientBalance)}finally{l(!1)}}},[n,t.id,a,m]);return(0,i.jsx)(d.$,{variant:"secondary",size:"s",loading:s,disabled:s,onClick:()=>{if((0,Q.R4)(c,4))return void(0,W.NK)(K.k.PositionReverseConfirmDialog,{onConfirm:async e=>{e&&(0,Z.L4)(a,c,4),await p()}});p()},className:(0,j.cn)("text-c12 h-8 px-3 whitespace-nowrap",r),children:n("Reverse")})}function eP(e){let{item:t}=e,{$t:r}=(0,x.B)(),n=(0,J.B)(e=>e.closeEditorResetVersion),{rawUnit:a,precision:s}=(0,D.A)({symbol:t.symbol||""}),[o,c]=(0,F.useState)(void 0),[u,y]=(0,F.useState)(void 0),[b,g]=(0,F.useState)("limit"),[f,N]=(0,F.useState)(!1),[w,P]=(0,F.useState)(!1),[k,C]=(0,F.useState)(!1),[S,T]=(0,F.useState)(!1),L=eN(t),q=L.defaultPrice,Q=String(t.displayAvailableQuantity||t.availableQuantity||t.quantity||""),M=(0,F.useRef)(Q),_=null!=o?o:q,I=null!=u?u:Q,z=function(e,t){let r=Math.max(0,ec(e)),i=Math.max(0,ec(t));return 0===i&&0===r?0:0===i&&r>0?100:Math.min(Math.floor(100*r/i),100)}(I,Q),E="1"===a?0:s,A=f||w;return(0,F.useEffect)(()=>{let e=M.current;e!==Q&&(y(t=>(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return void 0===e?void 0:r.preserveCurrent?e:ed(e,t)===ed(t,t)?void 0:e})(t,e,{preserveCurrent:S||w})),M.current=Q)},[Q,w,S]),(0,F.useEffect)(()=>{c(void 0),y(void 0),g("limit"),N(!1),P(!1),C(!1),T(!1)},[n]),(0,i.jsxs)("div",{"data-position-operation-active":A?"true":void 0,className:"flex items-center gap-2",children:[(0,i.jsxs)(m.Popover,{open:f,onOpenChange:N,children:[(0,i.jsx)(l.Tooltip,{onOpenChange:C,className:"text-cm12 md:text-cm12",content:r("Price"),delayDuration:80,lazyContent:!0,side:"top",sideOffset:16,children:(0,i.jsx)(m.PopoverTrigger,{asChild:!0,children:(0,i.jsx)("input",{type:"text",value:_,placeholder:"market"===b?r("Market"):"",onFocus:()=>{C(!0),c(e=>null!=e?e:q)},onBlur:()=>C(!1),onChange:e=>{c(e.target.value),g("limit")},onClick:()=>{c(e=>null!=e?e:q)},className:"border-l1 bg-bg3 text-t1 placeholder:text-t4 focus:border-p1 text-c12 h-8 w-[108px] rounded border px-3 outline-none"})})}),f?(0,i.jsxs)(m.PopoverContent,{align:"start",side:"bottom",sideOffset:8,showArrow:!1,onOpenAutoFocus:e=>e.preventDefault(),className:"bg-m3 border-l1 rounded-r2 shadow-2 py-s3 px-s2 flex w-[108px] flex-col",children:[(0,i.jsx)("button",{type:"button",className:(0,j.cn)("text-bm14 hover:bg-bg3 rounded-r1 px-s2 flex h-10 w-full cursor-pointer items-center text-left","market"===b?"bg-bg3 text-p1-dark":"text-t1"),onClick:()=>{g("market"),c(""),N(!1)},children:r("Market")}),(0,i.jsx)("button",{type:"button",className:(0,j.cn)("text-bm14 hover:bg-bg3 rounded-r1 mt-1 flex h-10 w-full cursor-pointer items-center px-2 text-left","limit"===b?"bg-bg3 text-p1-dark":"text-t1"),onClick:()=>{g("limit"),c(q),N(!1)},children:r("Last Price")})]}):null]}),(0,i.jsxs)(m.Popover,{open:w,onOpenChange:P,children:[(0,i.jsx)(l.Tooltip,{onOpenChange:T,className:"text-cm12 md:text-cm12",content:r("Quantity"),delayDuration:80,lazyContent:!0,side:"top",sideOffset:16,children:(0,i.jsx)(m.PopoverTrigger,{asChild:!0,children:(0,i.jsx)("input",{type:"text",value:I,onFocus:()=>{T(!0),y(e=>null!=e?e:Q)},onBlur:()=>{T(!1),y(ed(I,Q))},onChange:e=>y(e.target.value),onClick:()=>{y(e=>null!=e?e:Q)},className:"border-l1 bg-bg3 text-t1 placeholder:text-t4 focus:border-p1 text-c12 h-8 w-[108px] rounded border px-3 outline-none"})})}),w?(0,i.jsx)(m.PopoverContent,{align:"start",side:"bottom",sideOffset:8,showArrow:!1,onOpenAutoFocus:e=>e.preventDefault(),className:"bg-m3 border-l1 rounded-r1 shadow-2 w-[230px] p-3",children:(0,i.jsx)(p.Slider,{value:z,onValueChange:e=>{let t=Number(Q||0);y(String((0,h.n7)(e/100*t,E)))},SliderBarclassName:"bg-bg6",marks:[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}]})}):null]}),(0,i.jsx)(d.$,{variant:"secondary",size:"s",loading:L.loading,disabled:L.loading,onClick:()=>
1{if(!t.symbol||!t.quantity)return;let e=function(e,t){let r=Math.max(0,ec(e)),i=Math.max(0,ec(t));return i?Math.min(r,i):r}(I,Q);e&&L.requestSubmit({orderType:b,displayQuantity:e,quantityContLimit:Number("market"===b?t.quantity:t.availableQuantity),orderPrice:_,displayQuantityText:(0,v.iT)(e),useFullQuantityCont:100===z})},className:"text-c12 h-8 px-2 whitespace-nowrap",children:r("Close_r_1")})]})}function ek(e){var t;let{item:r}=e,{$t:n,locale:a}=(0,x.B)(),l=r.tradeType,o=r.entireTpsl||{},c=o.tp||{},d=o.sl||{},u=r.partialTpsls,m=null!=(t=null==u?void 0:u.length)?t:0,p=()=>{let e={triggerPrice_TP:c.triggerPrice,triggerPrice_SL:d.triggerPrice,triggerWay_TP:c.triggerWay,triggerWay_SL:d.triggerWay,orderPrice_TP:c.orderPrice,orderPrice_SL:d.orderPrice,orderType_TP:c.orderType,orderType_SL:d.orderType},t={...r,contQuantity:r.quantity};(0,W.NK)(K.k.PlanCloseOrder,{param:"common"===l?null:_.uj.CopyTrade,TPSLType:_.zb.Normal,isEdit:!1,onSubmitSuccess:()=>(0,U.nJ)({locale:a,symbol:r.symbol}),modelState:{values:e,position:t}})};return"follower"===r.tradeType?"--":(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[m>0?(0,i.jsx)("span",{className:"".concat(X," cursor-pointer underline underline-offset-2"),onClick:()=>{(0,W.NK)(K.k.PlanListLayer,{positionId:r.id,tradeType:r.tradeType,position:r})},children:m}):(0,i.jsx)("span",{className:"".concat(X," text-t1 cursor-pointer"),onClick:p,children:n("Add")}),(0,i.jsx)(s.X,{className:et,onClick:p})]})}function eC(e){let{item:t}=e,{locale:r}=(0,x.B)(),a=t.tradeType,s=t.entireTpsl||{},l=s.tp||{},o=s.sl||{},c=l.triggerPrice,d=o.triggerPrice;return(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsx)("span",{className:"text-c12 text-p2",children:c?(0,M.ac)(c):"--"}),(0,i.jsx)("span",{className:"text-c12 text-p3",children:d?(0,M.ac)(d):"--"})]}),(0,i.jsx)(n.q,{className:et,onClick:()=>{let e={triggerPrice_TP:l.triggerPrice,triggerPrice_SL:o.triggerPrice,triggerWay_TP:l.triggerWay,triggerWay_SL:o.triggerWay,orderPrice_TP:l.orderPrice,orderPrice_SL:o.orderPrice,orderType_TP:l.orderType,orderType_SL:o.orderType},i={...t,contQuantity:t.quantity};(0,W.NK)(K.k.PlanCloseOrder,{param:"common"===a?null:_.uj.CopyTrade,TPSLType:_.zb.EntirePosition,onSubmitSuccess:()=>(0,U.nJ)({locale:r,symbol:t.symbol}),modelState:{values:e,position:i}})}})]})}},42384:(e,t,r)=>{r.d(t,{k:()=>N});var i=r(93924),n=r(66960),a=r(20449),s=r(26212),l=r(12733),o=r(51025),c=r(10022),d=r(14275),u=r(38113),m=r(25704),p=r(82352),x=r(43129),y=r(10522),h=r(77962),b=r(95496),g=r(43487),f=r(84605),v=r(22675);function N(){let{$t:e,locale:t}=(0,n.B)(),r=(0,d.useQueryClient)(),N=(0,x.J)(e=>e.strategyMode),j=(0,x.J)(e=>e.setStrategyMode),w=(0,l.bZ)(e=>e.symbolsConfigBySymbol),P=(0,c.ZC)(e=>
1e.changeSymbol),k=(0,o.k)(e=>{var t,r;return null!=(r=null==(t=e.user)?void 0:t.userId)?r:null}),C=(0,u.useCallback)(e=>{let{locale:t,serviceSymbol:i,userId:n}=e,a=i.split("-")[0]||"",s=[r.invalidateQueries({queryKey:(0,p.Sv)(t,i)}),r.invalidateQueries({queryKey:["usdt-bot-api","strategy-recommend",t,i]}),r.invalidateQueries({queryKey:["usdt-bot-api","globalConfigs",t]}),r.invalidateQueries({queryKey:["futures-tradingview-overview-coin",t,a]}),r.invalidateQueries({queryKey:["futures-tradingview-overview-latest-price",t,a]}),r.invalidateQueries({queryKey:["futures-tradingview-overview-rates",t]})];n&&s.push(r.invalidateQueries({queryKey:(0,p.Jg)(t,n)}),r.invalidateQueries({queryKey:(0,p.sJ)(t,i)}),r.invalidateQueries({queryKey:(0,p.xc)(t,i)}),r.invalidateQueries({queryKey:(0,p.Ll)(t,i,n)}),r.invalidateQueries({queryKey:["core-grid-running-strategies",t,n]}),r.invalidateQueries({queryKey:["core-grid-history-strategies",t,n]})),Promise.all(s),l.bZ.getState().ensureContractTier({locale:t})},[r]);return{toggleSymbol:(0,u.useCallback)(r=>{let n=(0,m.cP)(r),l=n?w[n]:void 0,o=(0,m.U6)({locale:t,strategyMode:N,symbol:r,symbolConfig:l});if("invalid"===o.status)return!1;if("blocked"===o.status)return(0,i.toast)({type:"error",title:e("The selected pair does not support grid trading.")}),!1;s.ep.setCurrent(o.serviceSymbol),(0,m.aW)(o.href),j(o.strategyMode),P(o.serviceSymbol),y.Mr.getState().initialize(o.displaySymbol,{longLeverage:a.$3.getLongLeverage(o.serviceSymbol),shortLeverage:a.$3.getShortLeverage(o.serviceSymbol)}),h.N.getState().initialize(o.serviceSymbol),h.N.getState().syncRuntime({serviceSymbol:o.serviceSymbol,displaySymbol:o.compactSymbol,baseAsset:o.serviceSymbol.split("-")[0]||"",recommendations:[],recommendationsLoading:!1,computeData:{},minMargin:0,sliderPercent:0,perGridProfitText:"--",validationError:"",..."number"==typeof o.orderBookPrecision?{contractPrecision:o.orderBookPrecision}:{}});var c=o.serviceSymbol;let d=[];return b.yx.getState().hideOther&&d.push((0,b.j6)({symbol:c}
1)),v.a5.getState().hideOther&&d.push((0,v.WJ)({symbol:c})),g.dw.getState().hideOther&&d.push(g.dw.getState().loadData({symbol:c})),f.hv.getState().hideOther&&d.push((0,f.JH)({symbol:c})),d.length&&Promise.all(d),C({locale:t,serviceSymbol:o.serviceSymbol,userId:k}),!0},[e,P,t,C,j,N,w,k])}}},68924:(e,t,r)=>{r.d(t,{Cv:()=>s,Gj:()=>l,KN:()=>u,Kg:()=>d,Wf:()=>m,lX:()=>o,pp:()=>c});var i=r(749),n=r(3529);function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_self";if("_blank"===t)return void window.open(e,"_blank","noopener,noreferrer");window.location.href=e}function s(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.n1.Standard,a=new URLSearchParams({strategyMode:r}),s=t.endsWith("-SWAP")?(0,n.A2)(t,"-"):t;return"/".concat(e,"/futures/").concat(s,"?").concat(a.toString())}function l(e,t){let r=t.endsWith("-SWAP")?(0,n.A2)(t,"-"):t;return"/".concat(e,"/futures/data/mark-price?symbol=").concat(encodeURIComponent(r))}function o(e,t){let r=t.endsWith("-SWAP")?(0,n.A2)(t,"-"):t;return"/".concat(e,"/futures/data/funding-rate?symbol=").concat(encodeURIComponent(r))}function c(e,t){return"/".concat(e,"/futures/grid/").concat(encodeURIComponent(String(t)))}function d(e,t){a(c(e,t),"_blank")}function u(e){a("/".concat(e,"/wallet/deposit"))}function m(){a("/contract/simul/")}},79043:(e,t,r)=>{r.d(t,{p:()=>o});var i=r(12733),n=r(52030),a=r(38113),s=r(76656),l=r(92413);function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(0,l.j)(e),{startTime:o,endTime:c}=(0,i.bZ)((0,s.k)(e=>{let t=e.symbolsConfigBySymbol[r];return{startTime:null==t?void 0:t.rebaseStartTime,endTime:null==t?void 0:t.rebaseEndTime}})),[d,u]=(0,a.useState)(Date.now);(0,a.useEffect)(()=>{let e,r=()=>u(Date.now()),i=()=>{let t=Date.now(),n=t<Number(o||0)?o:t<Number(c||0)?c:0;r(),n&&(e=window.setTimeout(i,n-t+25))};if(t>0&&o&&c){let r=()=>{let t=Date.now();u(t),t>=c&&e&&(window.clearInterval(e),e=void 0)};r(),Date.now()<c&&(e=window.setInterval(r,t))}else i();let n=()=>{document.hidden||r()};return document.addEventListener("visibilitychange",n),()=>{e&&window.clearInterval(e),document.removeEventListener("visibilitychange",n)}},[c,o,t]);let m=(0,n.Ev)({rebaseStartTime:o,rebaseEndTime:c},d);return{phase:m,startTime:o,endTime:c,now:d,isBefore:"before"===m,isExecuting:"executing"===m}}},81407:(e,t,r)=>{r.d(t,{Iz:()=>l,N:()=>d,Tz:()=>n,Uy:()=>s,ac:()=>a,iN:()=>o,r6:()=>c});var i=r(19490);function n(e,t){if(!u(e))return"--";let r=String(e);return t[r]||r}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--";return u(e)&&(0,i.iT)(e)||t}function s(e){return u(e)?"".concat(String(e),"X"):"--"}function l(e){let{marketLabel:t,orderPrice:r,orderType:i}=e;if(!i)return a(r);let n=i.toLowerCase();return"planmarket"===n?"--":n.includes("market")?t:a(r)}function o(e){let{takeProfit:t,stopLoss:r}=e;return"".concat(a(t),"/").concat(a(r))}function c(e){let t=Number(e);return t?(0,i.yS)({value:t,unit:"ms",format:"YYYY-MM-DD HH:mm:ss"}):"--"}function d(e){if(!e)return"text-t1";let t=e.toLowerCase();return"openlong"===t||"closeshort"===t?"text-p2":"openshort"===t||"closelong"===t?"text-p3":"text-t1"}function u(e){return null!=e&&""!==String(e).trim()}}}]);
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.