1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[645],{20645:(e,t,i)=>{i.r(t),i.d(t,{TradingDepthView:()=>f});var s=i(75615),l=i(76919),a=i(19215),r=i(27216),n=i(31753),o=i(20349),c=i(61930),d=i(75041),p=i(49494),h=i(28538),x=i(51005),m=i(19749);let f=l.forwardRef((e,t)=>{var i,f;let{depthData:u}=e,{t:k}=(0,m.useT)("shared"),g=l.useRef(null),[,{toggleFullscreen:j}]=(0,a.A)(g),y=(0,r.A)(g),b=(null!=(i=null==y?void 0:y.width)?i:0)>0&&(null!=(f=null==y?void 0:y.height)?f:0)>0;l.useImperativeHandle(t,()=>({toggleFullscreen:j}),[j]);let T=l.useMemo(()=>{if(!u||!u.bids||!u.asks)return{bidsData:[],asksData:[],minPrice:0,maxPrice:0,midPrice:0};let{asks:e,bids:t}=u,i=t.length>0?t[t.length-1].price:0,s=e.length>0?e[0].price:0,l=t.map(e=>({price:e.price,bidTotal:e.total,askTotal:null})),a=e.map(e=>({price:e.price,bidTotal:null,askTotal:e.total})),r=t.length>0?t[0].price:0;return{bidsData:l,asksData:a,minPrice:r,maxPrice:e.length>0?e[e.length-1].price:0,midPrice:(i+s)/2}},[u]),v=l.useMemo(()=>{let{bidsData:e,asksData:t}=T,i=e.sort((e,t)=>t.price-e.price),s=t.sort((e,t)=>t.price-e.price);if(0===i.length||0===s.length)return[...i,...s].sort((e,t)=>e.price-t.price);let l=i[0],a=s[s.length-1];return[...i,{price:(l.price+a.price)/2,bidTotal:0,askTotal:0},...s].sort((e,t)=>e.price-t.price)},[T]);return u&&u.bids&&u.asks?T.bidsData&&0!==T.bidsData.length||T.asksData&&0!==T.asksData.length?(0,s.jsx)("div",{ref:g,className:"h-full w-full bg-bg-25",style:{minHeight:300},children:b?(0,s.jsx)(n.u,{width:"100%",height:"100%",minWidth:1,minHeight:1,children:(0,s.jsxs)(o.Q,{data:v,margin:{top:10,right:30,left:10,bottom:5},children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"bidGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#00c383",stopOpacity:.6}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#00c383",stopOpacity:.05})]}),(0,s.jsxs)("linearGradient",{id:"askGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#f14b3f",stopOpacity:.6}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#f14b3f",stopOpacity:.05})]})]}),(0,s.jsx)(c.d,{strokeDasharray:"3 3",stroke:"var(--color-line-50)"}),(0,s.jsx)(d.W,{dataKey:"price",type:"number",domain:[T.minPrice,T.maxPrice],tickFormatter:e=>e,tick:{fontSize:12,fill:"#666"},stroke:"var(--color-line-50)"}),(0,s.jsx)(p.h,{tickFormatter:e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toFixed(0),tick:{fontSize:12,fill:"#666"},stroke:"var(--color-line-50)"}),(0,s.jsx)(h.m,{content:(0,s.jsx)(e=>{let{active:t,payload:i}=e;if(t&&i&&i.length){let e=i[0].payload,t=null!==e.bidTotal&&e.bidTotal>0,l=null!==e.askTotal&&e.askTotal>0;return t||l?(0,s.jsxs)("div",{className:"rounded-lg border bg-white p-2 shadow-md",children:[(0,s.jsxs)("p",{className:"text-xs text-gray-600",children:[k("price"),": ",(0,s.jsx)("span",{className:"font-medium text-gray-900",children:e.price})]}),t&&(0,s.jsxs)("p",{className:"text-xs text-gray-600",children:[k("bidTotal"),":"," ",(0,s.jsx)("span",{className:"font-medium",style:{color:"#00c383"},children:e.bidTotal})]}),l&&(0,s.jsxs)("p",{className:"text-xs text-gray-600",children:[k("askTotal"),":"," ",(0,s.jsx)("span",{className:"font-medium",style:{color:"#f14b3f"},children:e.askTotal})]})]}):null}return null},{})}),(0,s.jsx)(x.Gk,{type:"monotone",dataKey:"bidTotal",stroke:"#00c383",strokeWidth:2,fill:"url(#bidGradient)",isAnimationActive:!1}),(0,s.jsx)(x.Gk,{type:"monotone",dataKey:"askTotal",stroke:"#f14b3f",strokeWidth:2,fill:"url(#askGradient)",isAnimationActive:!1})]})}):null}):(0,s.jsx)("div",{ref:g,className:"flex h-full min-h-[300px] w-full items-center justify-center",children:(0,s.jsx)("div",{className:"text-sm text-gray-500",children:k("noData")})}):(0,s.jsx)("div",{ref:g,className:"flex h-full min-h-[300px] w-full items-center justify-center",children:(0,s.jsx)("div",{className:"text-sm text-gray-500",children:k("loading")})})});f.displayName="TradingDepthView"}}]);
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.