PageSourceSearch

https://stonksup.io/assets/SectorDashboardPopup-BWgrQnD4.js

js stonksup.io collected 2026-10-02 01:58:07 UTC 31,398 bytes, 1 lines download raw bytes

1import{B as H,K as Ie,N as Ee,r as p,O as te,P as ze,j as t,D as Ae,E as me,F as C,R as ae,S as De,Q as Ne,T as Oe,J as de}from"./index-XMYwAgiZ.js";const Be=["1D","5D","1M","3M","6M","YTD","1Y"],ke=["Leading","Improving","Weakening","Lagging"],Me=["Improving","Leading","Lagging","Weakening"],T=27,ye=7,be=["#5481EC","#00D5A5","#E3B23C","#CD3D69","#9B6BFF","#4FC3F7","#FF8A65","#81C784"],He={"1D":"1日","5D":"5日","1M":"1月","3M":"3月","6M":"6月",YTD:"今年以来","1Y":"1年"};function Se(e,n){return e(`dashboard.sector.period.${n}`,He[n])}const D={fontVariantNumeric:"tabular-nums"},ue=30,ge={border:"none",fontFamily:"inherit",cursor:"pointer"};function X(e,n=1){return e==null||!Number.isFinite(e)?"--":`${e>=0?"+":""}${e.toFixed(n)}%`}function V(e,n){return n==null?e.fg5:n>0?e.gain:n<0?e.loss:e.fg4}function xe(e){const n=e.trim().replace("#","");if(n.length!==6)return null;const r=Number.parseInt(n.slice(0,2),16),s=Number.parseInt(n.slice(2,4),16),h=Number.parseInt(n.slice(4,6),16);return[r,s,h].every(Number.isFinite)?[r,s,h]:null}function ee(e,n){const r=xe(e);return r?`rgba(${r[0]},${r[1]},${r[2]},${n})`:`rgba(128,128,128,${n})`}function he(e,n,r){const s=xe(e)??[128,128,128],h=xe(n)??[128,128,128],a=Math.max(0,Math.min(1,r)),o=s.map((c,l)=>Math.round(c+(h[l]-c)*a));return`rgb(${o[0]},${o[1]},${o[2]})`}function we(e){const n=e.length;if(!n)return{leading:[],watch:[],lagging:[]};const r=Math.max(1,Math.ceil(n/3));return{leading:e.slice(0,Math.min(r,n)),watch:e.slice(Math.min(r,n),Math.max(0,n-r)),lagging:e.slice(Math.max(0,n-r))}}function _e(e,n){const r=[...e].sort((s,h)=>(h.perf[n]??-999)-(s.perf[n]??-999));return we(r)}function Le(e,n){const r=_e(e,n);return[...r.leading.map(s=>({item:s,status:"leading"})),...r.watch.map(s=>({item:s,status:"watch"})),...r.lagging.map(s=>({item:s,status:"lagging"}))]}function Ye(e,n){const r=e.perf[n],s=[...e.subsectors].sort((h,a)=>{const o=h.perf[n]??-999,c=a.perf[n]??-999;return r==null?c-o:c-r-(o-r)});return we(s)}function Ue(e,n){const r=Ye(e,n);return[...r.leading.map(s=>({item:s,status:"leading"})),...r.watch.map(s=>({item:s,status:"watch"})),...r.lagging.map(s=>({item:s,status:"lagging"}))]}function Xe(e,n){const r=s=>e.length<=s?e:e.slice(e.length-s);switch(n){case"1D":return r(2);case"5D":return r(6);case"1M":return r(22);case"3M":return r(90);default:return e}}function Ve(e,n){if(e.length<2)return[];const r=new Date(e[e.length-1].date),s=new Date(r);if(n==="6M")s.setMonth(s.getMonth()-6);else if(n==="YTD")s.setFullYear(r.getFullYear(),0,1);else if(n==="1Y")s.setFullYear(s.getFullYear()-1);else return e;const h=e.filter(a=>new Date(a.date)>=s);return h.length>=2?h:e}function Ge(e,n){return n.map((r,s)=>({date:`point-${s+1}`,prices:{[e]:r}}))}function qe(e,n){return n.map(r=>({date:r.date,prices:{[e]:r.close}}))}function Ke(e,n){return n.map(r=>{const s=r.prices[e];return s==null?null:{date:r.date,prices:{[e]:s}}}).filter(r=>!!r)}function Je(e,n){var o;if(e.length<2)return e;const r=c=>e.length<=c?e:e.slice(e.length-c);if(n==="1D")return r(2);if(n==="5D")return r(6);if(n==="1M")return r(22);if(n==="3M")return r(63);if(n==="6M")return r(126);if(n==="1Y")return r(252);const s=(o=e[e.length-1])!=null&&o.date?new Date(e[e.length-1].date):null;if(!s||Number.isNaN(s.getTime()))return e;const h=new Date(s);h.setUTCFullYear(s.getUTCFullYear(),0,1);const a=e.filter(c=>{const l=new Date(c.date);return!Number.isNaN(l.getTime())&&l>=h});return a.length>=2?a:e.slice(Math.max(0,e.length-2))}function Qe(e,n=""){const r=e||n;if(!r)return"";if(!/[T\s]\d{1,2}:\d{2}/.test(r))return r.split("T")[0].split(" ")[0];const h=new Date(r);if(!Number.isFinite(h.getTime()))return r;const a=new Date(h.getTime()-5*60*60*1e3),o=c=>String(c).padStart(2,"0");return`${a.getUTCFullYear()}-${o(a.getUTCMonth()+1)}-${o(a.getUTCDate())} ${o(a.getUTCHours())}:${o(a.getUTCMinutes())}`}function Ze({T:e,value:n}){const{t:r}=H(),s=Qe(n??"");return s?t.jsx("div",{style:{color:e.fg5,fontSize:11.5,lineHeight:1.35,...D},children:r("dashboard.sector.updatedEst","Updated {{date}} EST").replace("{{date}}",s)}):null}function fe({T:e,title:n,style:r}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,margin:"18px 0 10px",...r},children:[t.jsx("span",{style:{width:3,height:16,borderRadius:2,background:e.blue,flexShrink:0}}),t.jsx("span",{style:{fontSize:13.5,fontWeight:C.w700,color:e.fg1,letterSpacing:0},children:n})]})}function We({T:e,children:n,style:r}){return t.jsx("div",{style:{marginTop:-6,marginBottom:10,fontSize:11.5,lineHeight:1.3,color:e.fg5,...r},children:n})}function F(e){return e.hairline.includes("255")?"rgba(255,255,255,0.09)":"rgba(0,0,0,0.10)"}function Re(e){return{padding:"8px 8px",fontSize:13,fontWeight:C.w400,lineHeight:1.35,whiteSpace:"nowrap",borderBottom:`1px solid ${F(e)}`}}function Te(e){return{...Re(e),color:e.fg3,fontSize:11,fontWeight:C.w500,letterSpacing:".04em",textTransform:"uppercase",background:e.bgControl}}function ie({T:e,children:n,style:r}){return t.jsx("div",{style:{borderRadius:ae.sm,background:e.bgCardAlt,border:`1px solid ${e.hairline}`,minWidth:0,overflow:"hidden",...r},children:n})}function et({T:e,status:n}){const{t:r}=H(),s=tt(e,n,r);return t.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:68,height:21,padding:"0 8px",borderRadius:ae.xs,background:nt(e,n),border:"none",color:"#fff",fontSize:10.5,fontWeight:C.w400,whiteSpace:"nowrap"},children:s.label})}function tt(e,n,r){return n==="leading"?{label:r("dashboard.sector.statusLeading","Leading"),color:e.gain}:n==="watch"?{label:r("dashboard.sector.statusNeutralWatch","Neutral Watch"),color:e.neutral}:{label:r("dashboard.sector.statusLagging","Lagging"),color:e.loss}}function nt(e,n){return n==="leading"?he(de(e,"#052b24",e.gainBg),e.gain,.64):n==="watch"?he(de(e,"#302801","#FBF3DA"),e.neutral,.58):he(de(e,"#2e0714",e.lossBg),e.loss,.64)}function rt({T:e,selected:n,onSelect:r,compact:s=!1}){const{t:h}=H();return t.jsx(Oe,{T:e,options:Be.map(a=>({value:a,label:Se(h,a)})),selected:n,onSelect:r,compact:s,ariaLabel:h("dashboard.sector.periodAria","Sector performance peri
1od")})}function st({T:e,selected:n,onSelect:r}){const{t:s}=H();return t.jsx("div",{style:{margin:"-3px 0 10px"},children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[t.jsx("span",{style:{color:e.fg5,fontSize:12,lineHeight:"28px"},children:s("dashboard.sector.periodLabel","Period")}),t.jsx(rt,{T:e,selected:n,onSelect:r,compact:!0})]})})}function ot({closes:e,color:n,width:r=72,height:s=28,fill:h=!1,responsive:a=!1}){if(e.length<2)return t.jsx("span",{style:{width:r,height:s,display:"block"}});const o=Math.min(...e),l=Math.max(...e)-o||1,u=e.map((j,v)=>{const d=v/Math.max(e.length-1,1)*r,$=s-(j-o)/l*(s-4)-2;return[d,$]}).map(([j,v])=>`${j.toFixed(1)},${v.toFixed(1)}`).join(" "),b=`0,${s} ${u} ${r},${s}`;return t.jsxs("svg",{width:a?"100%":r,height:s,viewBox:a?`0 0 ${r} ${s}`:void 0,preserveAspectRatio:"none",style:{display:"block",flexShrink:0,overflow:"visible"},children:[h&&t.jsx("polygon",{points:b,fill:ee(n,.16)}),t.jsx("polyline",{points:u,fill:"none",stroke:n,strokeWidth:h?2.2:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function q(e){return De[e]??Ne}function it({T:e,sectors:n,period:r,selectedTicker:s,panelHeight:h,onSelect:a}){const{t:o}=H(),[c,l]=p.useState(null),f=p.useMemo(()=>Le(n,r),[n,r]),u=s==null;return t.jsxs(ie,{T:e,style:{width:280,height:h,boxSizing:"border-box",flexShrink:0,display:"flex",flexDirection:"column",alignSelf:"flex-start"},children:[t.jsx("button",{onClick:()=>a(null),onMouseEnter:()=>{l("__all__")},onMouseLeave:()=>{l(null)},style:{...ge,display:"flex",alignItems:"center",gap:8,width:"100%",height:ue,padding:"0 9px",boxSizing:"border-box",background:u?e.bgControl:c==="__all__"?F(e):"transparent",borderBottom:`1px solid ${F(e)}`,borderLeft:u?`3px solid ${e.blue}`:"3px solid transparent",color:u?e.fg1:e.fg3,fontSize:12,fontWeight:u?C.w600:C.w400,lineHeight:1.2,textAlign:"left"},children:o("dashboard.sector.allSectors","All Sectors")}),f.map(({item:b})=>{const j=s===b.ticker,v=c===b.ticker,d=b.perf[r];return t.jsxs("button",{onClick:()=>a(b),onMouseEnter:()=>{l(b.ticker)},onMouseLeave:()=>{l(null)},style:{...ge,display:"flex",alignItems:"center",gap:6,width:"100%",height:ue,padding:"0 9px",boxSizing:"border-box",background:j?e.bgControl:v?F(e):"transparent",borderBottom:`1px solid ${F(e)}`,borderLeft:j?`3px solid ${e.blue}`:"3px solid transparent",color:j?e.fg1:e.fg3,fontSize:12,fontWeight:j?C.w500:C.w400,lineHeight:1.2,textAlign:"left",transition:"background .12s"},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:q(b.ticker),flexShrink:0}}),t.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:te(o,b.sector)}),t.jsx("span",{style:{flexShrink:0,color:V(e,d),fontSize:11.5,...D},children:X(d)}),t.jsx("img",{src:"/icons/nav-arrow-right.svg",width:14,height:14,style:{filter:"invert(0.5)",flexShrink:0},alt:""})]},b.ticker)})]})}function lt({T:e,points:n,symbols:r,height:s,variant:h="multi",highlightedSymbol:a,perfOverrides:o}){var J,se;const{t:c}=H(),l=p.useRef(null),[f,u]=p.useState(null),[b,j]=p.useState(0),[v,d]=p.useState(640);p.useEffect(()=>{const i=l.current;if(!i)return;const x=()=>{const A=Math.max(240,Math.round(i.getBoundingClientRect().width));d(G=>G===A?G:A)};x();const M=new ResizeObserver(x);return M.observe(i),()=>M.disconnect()},[]);const $=Math.max(h==="single"?232:240,s),y=v,N=h==="single"?38:44,k=h==="single"?10:8,_=12,L=32,S=p.useMemo(()=>r.map(i=>{var A;const x=(A=n.find(G=>G.prices[i]!=null))==null?void 0:A.prices[i];if(!x)return null;const M=n.map(G=>(G.prices[i]??x)/x*100);return{symbol:i,values:M}}).filter(i=>!!i&&i.values.length>1),[r,n]);if(!S.length||n.length<2)return t.jsx("div",{style:{height:s,display:"grid",placeItems:"center",color:e.fg5,fontSize:12},children:c("dashboard.sector.selectSeries","Select at least one series.")});let I=97,O=103;for(const i of S)for(const x of i.values)I=Math.min(I,x),O=Math.max(O,x);const E=(O-I)*.08||1;I-=E,O+=E;const W=y-N-k,Q=$-_-L,P=i=>N+i/Math.max(n.length-1,1)*W,w=i=>_+(1-(i-I)/Math.max(1,O-I))*Q,Y=at(I,O,5),z=n.length<=25?5:n.length<=65?10:n.length<=130?21:n.length<=260?42:126,m=new Set,g=n.length-1;if(g>=0){m.add(0),m.add(g);const i=Math.max(2,Math.ceil(z/2));for(let x=z;x<g-i;x+=z)m.add(x)}const R=[...S].sort((i,x)=>x.values[x.values.length-1]-i.values[i.values.length-1]),B=i=>{const x=l.current;if(!x)return;const M=x.getBoundingClientRect(),A=i.clientX-M.left,G=A;j(A);const ce=G-N;if(ce<-5||ce>W+5){u(null);return}
1const Fe=Math.max(0,Math.min(1,ce/W));u(Math.round(Fe*(n.length-1)))},U=f!=null?R.map(i=>{const x=(i.values[f]??100)-100,M=f===n.length-1&&o&&i.symbol in o?o[i.symbol]:null;return{symbol:i.symbol,delta:M??x,color:q(i.symbol)}}).sort((i,x)=>x.delta-i.delta):[],K=f!=null&&n[f]?je(n[f].date,n.length):"",ne=Math.ceil(U.length/2),le=b<(((J=l.current)==null?void 0:J.clientWidth)??600)*.55,re=i=>a?i===a?1:.2:1,Z=i=>a&&i===a||h==="single"?2.2:1.35;return t.jsxs("div",{ref:l,style:{position:"relative",display:"flex",flexDirection:"column",height:s,minHeight:0},onMouseMove:B,onMouseLeave:()=>u(null),children:[t.jsxs("svg",{viewBox:`0 0 ${y} ${$}`,width:"100%",height:$,preserveAspectRatio:"xMidYMid meet",style:{display:"block",flexShrink:0,overflow:"visible",cursor:f!=null?"crosshair":void 0},children:[Y.map(i=>t.jsxs("g",{children:[t.jsx("line",{x1:N,x2:N+W,y1:w(i),y2:w(i),stroke:F(e),strokeWidth:1}),t.jsx("text",{x:N-9,y:w(i)+3.5,textAnchor:"end",fill:Math.abs(i-100)<.01?e.fg3:e.fg4,fontSize:"11",fontWeight:"500",children:Math.abs(i-100)<.01?"0%":`${i>100?"+":""}${(i-100).toFixed(0)}%`})]},i)),t.jsx("line",{x1:N,x2:N+W,y1:w(100),y2:w(100),stroke:e.fg4,strokeDasharray:"4 4",opacity:.78}),n.map((i,x)=>m.has(x)?t.jsx("text",{x:P(x),y:$-12,textAnchor:"middle",fill:e.fg4,fontSize:"10.5",fontWeight:"500",children:je(i.date,n.length)},i.date):null),[...R].reverse().map(i=>{const x=i.values.map((M,A)=>`${A===0?"M":"L"} ${P(A).toFixed(1)} ${w(M).toFixed(1)}`).join(" ");return t.jsx("path",{d:x,fill:"none",stroke:q(i.symbol),strokeWidth:Z(i.symbol),strokeLinecap:"round",strokeLinejoin:"round",opacity:re(i.symbol)},i.symbol)}),a&&R.find(i=>i.symbol===a)&&(()=>{const i=R.find(M=>M.symbol===a),x=i.values.map((M,A)=>`${A===0?"M":"L"} ${P(A).toFixed(1)} ${w(M).toFixed(1)}`).join(" ");return t.jsx("path",{d:x,fill:"none",stroke:q(i.symbol),strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})(),[...R].reverse().map(i=>t.jsx("circle",{cx:P(i.values.length-1),cy:w(i.values[i.values.length-1]),r:a===i.symbol?4.5:3.5,fill:q(i.symbol),stroke:e.bgCard,strokeWidth:"1",opacity:re(i.symbol)},`${i.symbol}-dot`)),f!=null&&t.jsxs(t.Fragment,{children:[t.jsx("line",{x1:P(f),x2:P(f),y1:_,y2:_+Q,stroke:e.fg5,strokeWidth:.7,strokeDasharray:"3 2"}),R.map(i=>{const x=i.values[f];return x==null?null:t.jsx("circle",{cx:P(f),cy:w(x),r:a===i.symbol?4:2.5,fill:q(i.symbol),stroke:e.bgCard,strokeWidth:"0.8",opacity:re(i.symbol)},`${i.symbol}-xh`)})]})]}),f!=null&&U.length>0&&t.jsxs("div",{style:{position:"absolute",top:4,...le?{left:b+14}:{right:(((se=l.current)==null?void 0:se.clientWidth)??0)-b+14},background:ee(e.bgCard,.95),border:`1px solid ${e.hairline}`,borderRadius:ae.xs,padding:"7px 10px",pointerEvents:"none",zIndex:10,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsx("div",{style:{color:e.fg5,fontSize:10,marginBottom:5,...D},children:K}),t.jsx("div",{style:{display:"flex",gap:14},children:[U.slice(0,ne),U.slice(ne)].map((i,x)=>t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:1.5},children:i.map(M=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,fontSize:10.5,lineHeight:1.4,fontWeight:M.symbol===a?C.w600:C.w400,opacity:a&&M.symbol!==a?.4:1},children:[t.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:M.color,flexShrink:0}}),t.jsx("span",{style:{color:e.fg4,minWidth:28},children:M.symbol}),t.jsx("span",{style:{color:V(e,M.delta),...D},children:X(M.delta)})]},M.symbol))},x))})]})]})}function at(e,n,r){const s=Math.max(1,(n-e)/r),h=10**Math.floor(Math.log10(s)),a=s/h,o=(a<1.5?1:a<3?2:a<7?5:10)*h,c=[];for(let l=Math.ceil(e/o)*o;l<=n+.001;l+=o)c.push(l);return c}function je(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e.startsWith("point-")?e.replace("point-","Point "):e.slice(5,10)||e;const s=r.toLocaleString("en-US",{month:"short"});return n<=65?`${s} ${r.getDate()}`:n<=260?s:`${s} '${String(r.getFullYear()).slice(2)}`}function oe(e,n){return n==="Leading"?e("dashboard.sector.rotationLeading","Leading"):n==="Improving"?e("dashboard.sector.rotationImproving","Improving"):n==="Weakening"?e("dashboard.sector.rotationWeakening","Weakening"):e("dashboard.sector.rotationLagging","Lagging")}function Ce(e,n){return n==="Leading"?e("dashboard.sector.rotationEmptyLeading","No sector has positive 3M and positive 1M right now."):n==="Improving"?e("dashboard.sector.rotationEmptyImproving","No sector has negative 3M but positive 1M right now."):n==="Weakening"?e("dashboard.sector.rotationEmptyWeakening","No sector has positive 3M but negative 1M right now."):e("dashboard.sector.rotationEmptyLagging","No sector has negative 3M and negative 1M right now.")}function ve(e){return e!=null&&Number.isFinite(e)?e:0}function ct(e){let n=1,r=1;return{frames:e.map(h=>{const a=h.closes.filter(Number.isFinite),o={x:ve(h.m3),y:ve(h.m1)},c=[];for(let f=0;f<T;f++){const u=a.length-T+f;let b=o;if(u>=0&&u<a.length){const j=a[u],v=a[Math.max(0,u-63)],d=a[Math.max(0,u-21)];j>0&&v>0&&d>0&&(b={x:(j/v-1)*100,y:(j/d-1)*100}
1)}c.push(b),n=Math.max(n,Math.abs(b.x)),r=Math.max(r,Math.abs(b.y))}const l=o;return c[c.length-1]=l,n=Math.max(n,Math.abs(l.x)),r=Math.max(r,Math.abs(l.y)),{ticker:h.ticker,label:h.label,detailLabel:h.detailLabel??h.label,color:h.color,points:c}}),xRange:Math.max(2,n*1.35),yRange:Math.max(2,r*1.35)}}function $e({T:e,entries:n,height:r=340}){const{t:s}=H(),h=p.useRef(null),[a,o]=p.useState(720),[c,l]=p.useState(T-1),[f,u]=p.useState(null),[b,j]=p.useState(null);p.useEffect(()=>{const g=h.current;if(!g)return;const R=()=>{const U=Math.max(320,Math.round(g.getBoundingClientRect().width));o(K=>K===U?K:U)};R();const B=new ResizeObserver(R);return B.observe(g),()=>B.disconnect()},[]);const{frames:v,xRange:d,yRange:$}=p.useMemo(()=>ct(n),[n]);if(!n.length||!v.length)return t.jsx("div",{style:{height:180,display:"grid",placeItems:"center",color:e.fg5,fontSize:12},children:s("dashboard.sector.noRotationData","No rotation data available.")});const y=14,N=14,k=16,_=22,L=a-y-N,S=r-k-_,I=g=>y+(g+d)/(d*2)*L,O=g=>k+(1-(g+$)/($*2))*S,E=I(0),W=O(0),Q=c===T-1?s("dashboard.sector.today","Today"):s("dashboard.sector.daysAgo","{{count}} days ago").replace("{{count}}",String(T-1-c)),P=g=>oe(s,g),w=e.fg4,Y=f??b,z=Y?v.find(g=>g.ticker===Y):null,m=(z==null?void 0:z.points[c])??null;return t.jsxs("div",{ref:h,style:{minWidth:0,width:"100%",maxWidth:780,margin:"0 auto"},children:[t.jsxs("svg",{width:"100%",height:r,viewBox:`0 0 ${a} ${r}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible",cursor:"crosshair"},children:[t.jsx("rect",{x:y,y:k,width:L,height:S,fill:e.bgCardAlt}),t.jsx("rect",{x:E,y:k,width:y+L-E,height:W-k,fill:ee(e.gain,.08)}),t.jsx("rect",{x:y,y:k,width:E-y,height:W-k,fill:ee(e.blue,.08)}),t.jsx("rect",{x:E,y:W,width:y+L-E,height:k+S-W,fill:ee(e.neutral,.08)}),t.jsx("rect",{x:y,y:W,width:E-y,height:k+S-W,fill:ee(e.loss,.08)}),[.25,.75].map(g=>t.jsxs("g",{children:[t.jsx("line",{x1:y+g*L,y1:k,x2:y+g*L,y2:k+S,stroke:F(e),strokeWidth:1,strokeDasharray:"4 4"}),t.jsx("line",{x1:y,y1:k+g*S,x2:y+L,y2:k+g*S,stroke:F(e),strokeWidth:1,strokeDasharray:"4 4"})]},g)),t.jsx("line",{x1:y,y1:W,x2:y+L,y2:W,stroke:e.fg4,strokeWidth:1.2,opacity:.75}),t.jsx("line",{x1:E,y1:k,x2:E,y2:k+S,stroke:e.fg4,strokeWidth:1.2,opacity:.75}),t.jsx("rect",{x:y,y:k,width:L,height:S,fill:"none",stroke:F(e),strokeWidth:1}),t.jsx("text",{x:y+L-8,y:k+16,textAnchor:"end",fill:w,fontSize:11,fontWeight:600,children:P("Leading")}),t.jsx("text",{x:y+8,y:k+16,fill:w,fontSize:11,fontWeight:600,children:P("Improving")}),t.jsx("text",{x:y+L-8,y:k+S-9,textAnchor:"end",fill:w,fontSize:11,fontWeight:600,children:P("Weakening")}),t.jsx("text",{x:y+8,y:k+S-9,fill:w,fontSize:11,fontWeight:600,children:P("Lagging")}),t.jsx("text",{x:y+L-8,y:W-7,textAnchor:"end",fill:e.fg5,fontSize:10,children:s("dashboard.sector.axis3M","3M trend")}),t.jsx("text",{x:E+7,y:k+S-7,fill:e.fg5,fontSize:10,children:s("dashboard.sector.axis1M","1M momentum")}),v.map(g=>{const R=!Y||Y===g.ticker,B=R?1:.16,U=g.points,K=U[c],ne=I(K.x),le=O(K.y),re=Math.max(1,c-ye+1);return t.jsxs("g",{onClick:()=>u(Z=>Z===g.ticker?null:g.ticker),onMouseEnter:()=>j(g.ticker),onMouseLeave:()=>j(null),children:[U.slice(re,c+1).map((Z,J,se)=>{if(J===0)return null;const i=se[J-1],x=se.length-1-J;return t.jsx("line",{x1:I(i.x),y1:O(i.y),x2:I(Z.x),y2:O(Z.y),stroke:g.color,strokeWidth:R?2:1.2,strokeOpacity:(.24+(1-x/ye)*.5)*B,strokeLinecap:"round"},`${g.ticker}-${J}`)}),t.jsx("circle",{cx:ne,cy:le,r:R?6.5:4.5,fill:g.color,opacity:.92*B,stroke:e.bgCard,strokeWidth:1.2}),t.jsx("text",{x:ne,y:le+17,textAnchor:"middle",fill:e.fg2,fontSize:R?11:9.5,fontWeight:R?700:600,opacity:B,style:{pointerEvents:"none"},children:g.label})]},g.ticker)})]}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:12,alignItems:"center",margin:"4px 4px 0"},children:[t.jsx("input",{type:"range",min:0,max:T-1,value:c,onChange:g=>l(Number(g.currentTarget.value)),style:{width:"100%",accentColor:e.blue},"aria-label":s("dashboard.sector.rotationPlayback","Rotation playback")}),t.jsx("span",{style:{color:e.fg5,fontSize:11,minWidth:64,textAlign:"right",...D},children:Q})]}),z&&m&&t.jsxs("div",{style:{marginTop:8,padding:"8px 10px",borderRadius:ae.xs,background:e.bgControl,color:e.fg3,fontSize:12,lineHeight:1.35,display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:z.color}}),t.jsx("strong",{style:{color:e.fg1,fontWeight:C.w600},children:z.detailLabel}),t.jsx("span",{style:{color:e.fg5},children:z.ticker}),t.jsx("span",{children:P(pe(m.x,m.y))}),t.jsxs("span",{style:{color:V(e,m.x),...D},children:[s("dashboard.sector.axis3MShort","3M")," ",X(m.x)]}),t.jsxs("span",{style:{color:V(e,m.y),...D},children:[s("dashboard.sector.axis1MShort","1M")," ",X(m.y)]}),f&&t.jsx("button",{onClick:()=>u(null),style:{...ge,marginLeft:"auto",color:e.fg4,background:"transparent",fontSize:12},children:s("dashboard.sector.clearSelection","Clear")})]})]})}function dt({T:e,sectors:n,period:r}){const{t:s}
1=H(),h=p.useMemo(()=>n.map(o=>({ticker:o.ticker,label:o.ticker,detailLabel:te(s,o.sector),color:q(o.ticker),m3:o.perf["3M"],m1:o.perf["1M"],closes:o.closes})),[n,s]),a=p.useMemo(()=>{const o={Leading:[],Improving:[],Weakening:[],Lagging:[]};for(const c of n)o[pe(c.perf["3M"]??0,c.perf["1M"]??0)].push(c);for(const c of ke)o[c].sort((l,f)=>(f.perf["1M"]??-999)-(l.perf["1M"]??-999));return o},[n]);return t.jsxs("section",{children:[t.jsx(fe,{T:e,title:s("dashboard.sector.sectorRotation","Sector Rotation")}),t.jsx(We,{T:e,children:s("dashboard.sector.rotationCaptionWithPeriod","quadrants use 3M trend and 1M momentum; returns shown use the selected period")}),t.jsx(ie,{T:e,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(300px, 0.92fr) minmax(420px, 1.08fr)",gap:0,alignItems:"stretch"},children:[t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(140px, 1fr))",gap:0,borderRight:`1px solid ${F(e)}`},children:Me.map((o,c)=>t.jsxs("div",{style:{padding:"10px 11px",borderRight:c%2===0?`1px solid ${F(e)}`:"none",borderBottom:c<2?`1px solid ${F(e)}`:"none",minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,color:e.fg3,fontSize:12.5,fontWeight:C.w400,marginBottom:10},children:[t.jsx(Pe,{T:e,label:o,title:oe(s,o)}),t.jsx("span",{children:oe(s,o)}),t.jsx("span",{style:{color:e.fg5,fontWeight:C.w400,marginLeft:"auto",...D},children:a[o].length})]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a[o].length?a[o].map(l=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:8,alignItems:"baseline",color:e.fg3,fontSize:12.5,lineHeight:1.25},children:[t.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:te(s,l.sector)}),t.jsx("span",{style:{color:V(e,l.perf[r]),...D},children:X(l.perf[r])})]},l.ticker)):t.jsx("div",{style:{color:e.fg5,fontSize:12,fontStyle:"italic",lineHeight:1.35},children:Ce(s,o)})})]},o))}),t.jsx("div",{style:{padding:"8px 8px 10px",minWidth:0},children:t.jsx($e,{T:e,entries:h,height:320})})]})})]})}function ht({T:e,sector:n,period:r}){const{t:s}=H(),h=p.useMemo(()=>n.subsectors.map((o,c)=>({ticker:o.ticker,label:o.ticker||o.name,detailLabel:o.name,color:be[c%be.length],m3:o.perf["3M"],m1:o.perf["1M"],closes:o.closes})),[n.subsectors]),a=p.useMemo(()=>{const o={Leading:[],Improving:[],Weakening:[],Lagging:[]};for(const c of n.subsectors)o[pe(c.perf["3M"]??0,c.perf["1M"]??0)].push(c);for(const c of ke)o[c].sort((l,f)=>(f.perf["1M"]??-999)-(l.perf["1M"]??-999));return o},[n.subsectors]);return h.length<3?null:t.jsxs("section",{children:[t.jsx(fe,{T:e,title:s("dashboard.sector.subsectorRotation","Subsector Rotation")}),t.jsx(We,{T:e,children:s("dashboard.sector.rotationGraphSubtitle","3M trend on the horizontal axis and 1M momentum on the vertical axis")}),t.jsx(ie,{T:e,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(300px, 0.92fr) minmax(420px, 1.08fr)",gap:0,alignItems:"stretch"},children:[t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(140px, 1fr))",gap:0,borderRight:`1px solid ${F(e)}`},children:Me.map((o,c)=>t.jsxs("div",{style:{padding:"10px 11px",borderRight:c%2===0?`1px solid ${F(e)}`:"none",borderBottom:c<2?`1px solid ${F(e)}`:"none",minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,color:e.fg3,fontSize:12.5,fontWeight:C.w400,marginBottom:10},children:[t.jsx(Pe,{T:e,label:o,title:oe(s,o)}),t.jsx("span",{children:oe(s,o)}),t.jsx("span",{style:{color:e.fg5,fontWeight:C.w400,marginLeft:"auto",...D},children:a[o].length})]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a[o].length?a[o].map(l=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:8,alignItems:"baseline",color:e.fg3,fontSize:12.5,lineHeight:1.25},children:[t.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.ticker||l.name}),t.jsx("span",{style:{color:V(e,l.perf[r]),...D},children:X(l.perf[r])})]}
1,l.ticker)):t.jsx("div",{style:{color:e.fg5,fontSize:12,fontStyle:"italic",lineHeight:1.35},children:Ce(s,o).replace("sector","subsector").replace("Sector","Subsector")})})]},o))}),t.jsx("div",{style:{padding:"8px 8px 10px",minWidth:0},children:t.jsx($e,{T:e,entries:h,height:320})})]})})]})}function Pe({T:e,label:n,title:r}){const s=ut(e,n);return t.jsx("span",{title:r??n,"aria-label":r??n,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",background:s,verticalAlign:"middle"}})}function ut(e,n){return n==="Leading"?e.gain:n==="Improving"?e.blue:n==="Weakening"?e.neutral:e.loss}function pe(e,n){return e>=0&&n>=0?"Leading":e<0&&n>=0?"Improving":e>=0&&n<0?"Weakening":"Lagging"}function gt({T:e,rows:n,period:r,sectorReturn:s,sectorTicker:h}){const{t:a}=H(),[o,c]=p.useState(null);if(!n.length)return null;const l=Re(e),f=Te(e);return t.jsx(ie,{T:e,children:t.jsx("div",{style:{overflowX:"auto"},children:t.jsxs("table",{style:{width:"100%",minWidth:620,borderCollapse:"collapse",tableLayout:"fixed"},children:[t.jsxs("colgroup",{children:[t.jsx("col",{style:{width:"32%"}}),t.jsx("col",{style:{width:90}}),t.jsx("col",{style:{width:"22%"}}),t.jsx("col",{style:{width:76}}),t.jsx("col",{style:{width:90}})]}),t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{style:{...f,textAlign:"left"},children:a("dashboard.sector.colSubsector","Subsector")}),t.jsx("th",{style:{...f,textAlign:"left"},children:a("dashboard.sector.colStatus","Status")}),t.jsx("th",{style:{...f,textAlign:"left"},children:a("dashboard.sector.colTrend","Trend")}),t.jsx("th",{style:{...f,textAlign:"right"},children:a("dashboard.sector.colReturn","Return")}),t.jsxs("th",{style:{...f,textAlign:"right"},children:[a("dashboard.sector.colVs","vs")," ",h]})]})}),t.jsx("tbody",{children:n.map(({item:u,status:b})=>{const j=u.perf[r],v=j!=null&&s!=null?j-s:null,d=u.closes.length>=2&&u.closes[u.closes.length-1]>=u.closes[0]?e.gain:e.loss,$=o===u.ticker;return t.jsxs("tr",{onMouseEnter:()=>c(u.ticker),onMouseOver:()=>c(u.ticker),onMouseLeave:()=>c(null),style:{background:$?e.bgControl:"transparent"},children:[t.jsxs("td",{style:{...l,color:e.fg2,overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx("span",{children:u.ticker}),t.jsx("span",{style:{fontSize:11,marginLeft:7},children:u.name})]}),t.jsx("td",{style:l,children:t.jsx(et,{T:e,status:b})}),t.jsx("td",{style:l,children:t.jsx(ot,{closes:u.closes,color:d,width:96,height:24})}),t.jsx("td",{style:{...l,color:V(e,j),textAlign:"right",...D},children:X(j)}),t.jsx("td",{style:{...l,color:V(e,v),textAlign:"right",...D},children:X(v)})]},u.ticker)})})]})})})}
1function ft({T:e,onDetailChange:n,initialDetailSymbol:r}){const{t:s}=H(),{data:h,isLoading:a,isError:o}=Ie(),c=Ee(),[l,f]=p.useState("1M"),[u,b]=p.useState(()=>r??null);p.useEffect(()=>{b(r??null)},[r]);const j=p.useCallback(()=>{b(null),n==null||n(null,null)},[n]),v=(h==null?void 0:h.sectors)??[],d=u?v.find(m=>m.ticker===u||m.sector===u||te(s,m.sector)===u)??null:null,$=!!d&&(l==="6M"||l==="YTD"||l==="1Y"),y=ze((d==null?void 0:d.ticker)??"",$);p.useEffect(()=>{u&&d&&d.ticker!==u&&b(d.ticker)},[u,d]),p.useEffect(()=>{u&&v.length>0&&!d&&j()},[j,v.length,d,u]);const N=p.useCallback(m=>{m?(b(m.ticker),n==null||n(te(s,m.sector),j)):j()},[j,n,s]),k=p.useMemo(()=>Le(v,l),[v,l]),_=p.useMemo(()=>Je(c.data??[],l),[c.data,l]),L=p.useMemo(()=>d?Xe(d.closes,l):[],[l,d]),S=p.useMemo(()=>{var g;if(!d)return null;if($){const R=(g=y.data)!=null&&g.length?Ve(y.data,l):[],B=qe(d.ticker,R);return B.length>=2?B:null}const m=Ke(d.ticker,_);return m.length>=2?m:null},[l,_,y.data,$,d]),I=p.useMemo(()=>{if(!d)return null;const m=Ge(d.ticker,L);return m.length>=2?m:null},[d,L]),E=S??I??_,W=p.useMemo(()=>k.map(m=>m.item.ticker),[k]),Q=p.useMemo(()=>d?Ue(d,l):[],[d,l]),P=p.useMemo(()=>{const m={};if(d)m[d.ticker]=d.perf[l]??null;else for(const g of v)m[g.ticker]=g.perf[l]??null;return m},[l,v,d]),w=ue*(k.length+1),Y=Math.max(d?260:300,w-(d?72:24)),z=d?$?y.isLoading&&!S:c.isLoading&&!S:c.isLoading;return a?t.jsx(Ae,{T:e,rows:6}):o||!h?t.jsx(me,{T:e,msg:s("dashboard.sector.loadFailed","Failed to load sector data.")}):v.length?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[t.jsx(Ze,{T:e,value:h.asOf}),t.jsx(fe,{T:e,title:s("dashboard.sector.sectorPerformance","Sector Performance"),style:{marginBottom:-4}}),t.jsx(st,{T:e,selected:l,onSelect:f}),t.jsxs("div",{style:{display:"flex",gap:12,minHeight:0,alignItems:"flex-start"},children:[t.jsx(it,{T:e,sectors:v,period:l,selectedTicker:u,panelHeight:w,onSelect:N}),t.jsx("div",{style:{flex:"1 1 0",minWidth:0,display:"flex",flexDirection:"column"},children:t.jsxs(ie,{T:e,style:{height:w,boxSizing:"border-box",padding:12,background:e.bgCard,overflow:"visible",display:"flex",flexDirection:"column"},children:[d&&t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:12,alignItems:"start",marginBottom:8},children:[t.jsxs("div",{style:{minWidth:0,display:"flex",alignItems:"center",gap:10},children:[t.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:q(d.ticker),flexShrink:0}}),t.jsxs("div",{style:{minWidth:0},children:[t.jsx("div",{style:{fontSize:15,fontWeight:C.w400,color:e.fg1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:te(s,d.sector)}),t.jsx("div",{style:{fontSize:11,color:e.fg5,marginTop:1},children:d.ticker})]})]}),t.jsxs("div",{style:{textAlign:"right"},children:[t.jsx("div",{style:{color:V(e,d.perf[l]),fontSize:18,fontWeight:C.w400,...D},children:X(d.perf[l])}),t.jsx("div",{style:{marginTop:2,color:e.fg5,fontSize:11},children:s("dashboard.sector.periodPerformance","{{period}} performance").replace("{{period}}",Se(s,l))})]})]}),z&&t.jsx("div",{style:{height:Y,display:"grid",placeItems:"center",color:e.fg5,fontSize:12},children:s("dashboard.sector.loadingRelative","Loading relative performance...")}),!d&&c.isError&&t.jsx("div",{style:{height:Y,display:"grid",placeItems:"center",color:e.fg5,fontSize:12},children:s("dashboard.sector.relativeUnavailable","Relative performance unavailable.")}),!z&&(d||!c.isError)&&t.jsx(lt,{T:e,points:E,symbols:d?[d.ticker]:W,height:Y,variant:d?"single":"multi",perfOverrides:P})]})})]}),d&&d.subsectors.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(gt,{T:e,rows:Q,period:l,sectorReturn:d.perf[l]??null,sectorTicker:d.ticker}),t.jsx(ht,{T:e,sector:d,period:l})]}),!d&&t.jsx(dt,{T:e,sectors:v,period:l})]}):t.jsx(me,{T:e,msg:s("dashboard.sector.noData","No sector data available.")})}export{ft as default};

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.