1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7497],{97497:function(e,t,r){r.r(t),r.d(t,{default:function(){return b}});var l=r(57437),n=r(2265),i=r(42586),a=r(34298),s=r(71096),o=r.n(s),c=r(16206),p=r.n(c),u=r(5524),d=r.n(u);o().extend(p()),o().extend(d());var m=r(77360),h=r.n(m),x=r(49089);function f(e,t,r,l,n,i){"line"===i?(null==t||t.applyOptions({visible:!0}),null==r||r.applyOptions({visible:!1}),null==l||l.applyOptions({visible:!1}),e.priceScale("right").applyOptions({visible:!0,textColor:"#2563eb"}),n?(n.applyOptions({visible:!0}),e.priceScale("left").applyOptions({visible:!0,textColor:"#dc2626"})):e.priceScale("left").applyOptions({visible:!1})):(null==t||t.applyOptions({visible:!1}),null==r||r.applyOptions({visible:!0}),null==l||l.applyOptions({visible:!0}),null==n||n.applyOptions({visible:!1}),e.priceScale("left").applyOptions({visible:!1}),e.priceScale("right").applyOptions({visible:!0,textColor:"#000000"}))}o().extend(p()),o().extend(h());var b=e=>{let{chartData:t,nseCode:r}=e,s=(0,n.useRef)(null),c=(0,n.useRef)(null),p=(0,n.useRef)(null),u=(0,n.useRef)(null),d=(0,n.useRef)(null),m=(0,n.useRef)(null),h=(0,n.useRef)(null),[b,g]=(0,n.useState)("line"),[v,y]=(0,n.useState)("1Y"),[C,S]=(0,n.useState)(!0),w=e=>{g(e)},D=e=>{y(e)},N=e=>({"1D":1,"1W":5,"1M":20,"1Y":252,"3Y":756,"5Y":1260,ALL:999999})[e]||252,j=(0,n.useMemo)(()=>{var e,l;if(!(null==t?void 0:t.stockPriceInformation)||0===t.stockPriceInformation.length)return{candleData:[],scripData:[],volumeData:[],sensexData:[],companyScrip:"Price",hasData:!1};let n=(null==t?void 0:null===(e=t.stockPriceInformation)||void 0===e?void 0:e[0])||[],i=(null==t?void 0:null===(l=t.stockPriceInformation)||void 0===l?void 0:l[1])||[],a=[],s=[];if(["3Y","5Y","ALL"].includes(v)){let e=n&&0!==n.length?function(e){let t=new Map;e.forEach(e=>{let r=o()(e.date).startOf("isoWeek").format("YYYY-MM-DD");t.has(r)||t.set(r,[]),t.get(r).push(e)});let r=[];return Array.from(t.entries()).sort((e,t)=>e[0].localeCompare(t[0])).forEach(e=>{let[t,l]=e;if(0===l.length)return;let n=l.map(e=>Number(e.open)||0),i=l.map(e=>Number(e.high)||0),a=l.map(e=>Number(e.low)||0),s=l.map(e=>Number(e.close)||0);r.push({time:t,open:n[0],high:Math.max(...i),low:Math.min(...a),close:s[s.length-1]})}),console.log("weekly candles",r),r}(n):[],t=n&&0!==n.length?function(e){let t=new Map;e.forEach(e=>{let r=o()(e.date).startOf("isoWeek").format("YYYY-MM-DD");t.has(r)||t.set(r,[]),t.get(r).push(e)});let r=[];return Array.from(t.entries()).sort((e,t)=>e[0].localeCompare(t[0])).forEach(e=>{let[t,l]=e;if(0===l.length)return;let n=l.reduce((e,t)=>e+(Number(t.volume_eur)||0),0),i=Number(l[0].open)||0,a=Number(l[l.length-1].close)||0;r.push({time:t,value:n,color:i<a?"rgba(22, 163, 74, 0.5)":"rgba(220, 38, 38, 0.5)"})}),r}(n):[],r=Math.ceil(N(v)/5);a=e.slice(Math.max(0,e.length-r)),s=t.slice(Math.max(0,t.length-r))}else{let e=N(v),t=n.slice(Math.max(0,n.length-e));a=t.map(e=>(new Date(e.date).toISOString().split("T")[0],{time:e.date.split("T")[0],open:Number(e.open)||0,high:Number(e.high)||0,low:Number(e.low)||0,close:Number(e.close)||0})),s=t.map(e=>{new Date(e.date).toISOString().split("T")[0];let t=Number(e.open)||0,r=Number(e.close)||0;return{time:e.date.split("T")[0],value:Number(e.volume_eur)||0,color:r>=t?"rgba(22, 163, 74, 0.8)":"rgba(220, 38, 38, 0.8)"}})}let c=N(v),p=[],u=[];u="1D"===v?(p=((null==t?void 0:t.stockLineChartInfo)||[]).map(e=>({time:Math.floor(new Date(e.time).getTime()/1e3)+19800,value:Number(e.value)||0}))).slice(10):(p=(n||[]).map(e=>({time:e.date.split("T")[0],value:Number(e.close)||0}))).slice(Math.max(0,p.length-c));let d=(i||[]).map(e=>({time:e.date.split("T")[0],value:Number(e.close)||0}));return{candleData:a,scripData:u,volumeData:s,sensexData:d.slice(Math.max(0,d.length-c)),companyScrip:r,hasData:a.length>0||u.length>0}},[t,v]);(0,n.useEffect)(()=>{if(!s.current||!j.hasData)return;c.current&&(c.current.remove(),c.current=null);let e=(0,a.C2)(s.current,{layout:{textColor:"#000000",background:{color:"#ffffff"},fontFamily:"Inter, sans-serif"},width:s.current.clientWidth,height:450,timeScale:{timeVisible:!0,secondsVisible:!1,ignoreWhitespaceIndices:!0,rightOffset:5,barSpacing:6,lockVisibleTimeRangeOnResize:!1},leftPriceScale:{visible:!1,textColor:"#2563eb",scaleMargins:{top:.1,bottom:.1},borderVisible:!1},rightPriceScale:{visible:!0,textColor:"#000000",scaleMargins:{top:.1,bottom:.1},borderVisible:!1}});c.current=e;let t=e.addSeries(a.$Y,{upColor:"#16a34a",downColor:"#dc2626",borderUpColor:"#16a34a",borderDownColor:"#dc2626",wickUpColor:"#16a34a",wickDownColor:"#dc2626"});
1p.current=t,t.setData(j.candleData);let r=e.addSeries(a.Jv,{color:"rgba(100, 149, 237, 0.5)",priceScaleId:"volume"});d.current=r,r.setData(j.volumeData),e.priceScale("volume").applyOptions({scaleMargins:{top:.7,bottom:0}});let l=e.addSeries(a.eh,{color:" #2563eb",lineWidth:2,title:j.companyScrip,priceScaleId:"right"});u.current=l,j.scripData.length>0&&l.setData(j.scripData);let n=null;j.sensexData.length>0&&"1D"!==v?(n=e.addSeries(a.eh,{color:"#dc2626",lineWidth:2,title:"Sensex",priceScaleId:"left"}),m.current=n,n.setData(j.sensexData)):m.current=null,f(e,l,t,r,n,b),requestAnimationFrame(()=>{e.timeScale().fitContent()});let i=()=>{s.current&&c.current&&(c.current.applyOptions({width:s.current.clientWidth}),requestAnimationFrame(()=>{var e;null===(e=c.current)||void 0===e||e.timeScale().fitContent()}))};return window.addEventListener("resize",i),S(!1),()=>{window.removeEventListener("resize",i),c.current&&(c.current.remove(),c.current=null)}},[j]),(0,n.useEffect)(()=>{c.current&&("1D"===v&&g("line"),requestAnimationFrame(()=>{var e;null===(e=c.current)||void 0===e||e.timeScale().fitContent()}))},[v]),(0,n.useEffect)(()=>{if(!c.current||!h.current)return;let e=c.current,t=p.current,r=d.current,l=e=>{if("candle"!==b||!e.point||!t){h.current.style.display="none";return}let l=e.seriesData.get(t);if(l){let{open:t,high:n,low:i,close:a}=l,s=e.seriesData.get(r),o=e=>"number"==typeof e?e.toFixed(2):"N/A";h.current.innerHTML='\n <div style="font-size:12px;line-height:1.6;">\n <div><strong>O:</strong> â¹'.concat(o(t),"</div>\n <div><strong>H:</strong> â¹").concat(o(n),"</div>\n <div><strong>L:</strong> â¹").concat(o(i),"</div>\n <div><strong>C:</strong> â¹").concat(o(a),"</div>\n ").concat(s?"<div><strong>Vol:</strong> ".concat((s.value/1e6).toFixed(2),"M</div>"):"","\n </div>"),h.current.style.display="block",h.current.style.left=e.point.x+10+"px",h.current.style.top=e.point.y+"px"}else h.current.style.display="none"};return e.subscribeCrosshairMove(l),()=>{e.unsubscribeCrosshairMove(l)}},[b,j]),(0,n.useEffect)(()=>{if(!c.current)return;let e=c.current,t=u.current;f(e,t,p.current,d.current,m.current,b),requestAnimationFrame(()=>{var e;null===(e=c.current)||void 0===e||e.timeScale().fitContent()})},[b]);let k=(0,i.useTranslations)("CompanyProfileTabs");return(0,l.jsx)("section",{className:"shadow-lg p-2 mt-5",id:"chart",style:{minHeight:"550px"},children:(0,l.jsxs)("div",{id:"2",children:[(0,l.jsxs)("div",{className:"d-flex align-items-center gap-3 flex-wrap mb-2 mt-2 ps-2",children:[(0,l.jsx)("div",{className:"d-flex align-items-center",children:(0,l.jsxs)("div",{className:"d-flex gap-2 align-items-center",children:[(0,l.jsx)("span",{className:"fw-bold text-dark",children:"BSE"}),(0,l.jsx)("button",{type:"button",onClick:()=>w("line"),className:"btn ".concat("line"===b?"btn-primary":"btn-outline-primary"," p-2 pt-1 pb-1"),children:(0,l.jsx)(x.Op,{size:20})}),"1D"!==v&&(0,l.jsx)("button",{type:"button",onClick:()=>w("candle"),className:"btn ".concat("candle"===b?"btn-primary":"btn-outline-primary"," p-2 pt-1 pb-1"),children:(0,l.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",children:[(0,l.jsx)("line",{x1:"6",y1:"4",x2:"6",y2:"20",stroke:"currentColor"}),(0,l.jsx)("rect",{x:"4",y:"8",width:"4",height:"6",fill:"currentColor"}),(0,l.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"22",stroke:"currentColor"}),(0,l.jsx)("rect",{x:"10",y:"10",width:"4",height:"10",fill:"currentColor"}),(0,l.jsx)("line",{x1:"18",y1:"4",x2:"18",y2:"20",stroke:"currentColor"}),(0,l.jsx)("rect",{x:"16",y:"8",width:"4",height:"6",fill:"currentColor"})]})})]})}),(0,l.jsx)("div",{className:"d-flex align-items-center",style:{flexWrap:"wrap"},children:["1D","1W","1M","1Y","3Y","5Y","ALL"].map(e=>(0,l.jsx)("button",{onClick:()=>D(e),className:"rounded me-1 fw-bold",style:{padding:"2px 10px",border:"1px solid #2563eb",backgroundColor:v===e?"#2563eb":"#fff",color:v===e?"white":"#000",fontSize:"12px",cursor:"pointer"},children:e},e))})]}),j.hasData?(0,l.jsxs)(l.Fragment,{children:["line"===b&&(0,l.jsx)("div",{style:{marginBottom:"10px",paddingTop:"5px"},children:(0,l.jsxs)("div",{style:{display:"flex",gap:"20px",justifyContent:"center",alignItems:"center"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,l.jsx)("div",{style:{width:"20px",height:"2px",backgroundColor:"#2563eb"}}),(0,l.jsx)("span",{className:"text-dark",style:{fontSize:"12px"},children:j.companyScrip})]}),j.sensexData.length>0&&(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,l.jsx)("div",{style:{width:"20px",height:"2px",backgroundColor:"#dc2626"}}),(0,l.jsx)("span",{className:"text-dark",style:{fontSize:"12px"},children:"SENSEX"})]})]})}
1),(0,l.jsxs)("div",{className:"position-relative",children:[C&&(0,l.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,l.jsx)("span",{className:"visually-hidden",children:"Loading chart..."})}),(0,l.jsx)("div",{ref:s}),"line"!==b&&(0,l.jsx)("div",{className:"text-dark rounded border p-1 d-block bg-white ps-2",ref:h,style:{position:"absolute",top:0,left:0,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:10,pointerEvents:"none"}})]})]}):C?null:(0,l.jsx)("p",{className:"text-dark text-center pt-2",children:k("CompanyErrorMsg")})]})})}}}]);
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.