1import{k as i,j as d}from"./main-CMUma0Uu.js";import{R as v,e as E,u as R,i as A,a as P,b as D,c as N,d as T,f as O}from"./core-CS4JAAsu.js";import{i as Y}from"./install-D9vr_GJe.js";import"./index-C148XJoK.js";R([A,P,D,N,T,Y,O]);const c='"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',$=[{id:"3Y",label:"3Y",days:3*365},{id:"5Y",label:"5Y",days:5*365},{id:"10Y",label:"10Y",days:10*365},{id:"ALL",label:"All",days:null}],n="#d4af37",x="#c0c7d0";function I({gold:s,silver:r,goldCurrent:g,silverCurrent:b}){const C=i.useRef(null),[f,z]=i.useState("5Y"),[y,S]=i.useState(null),M=i.useMemo(()=>{const t=s[s.length-1]?.date??"1900-01-01",e=r[r.length-1]?.date??"1900-01-01";return t>e?t:e},[s,r]),w=i.useMemo(()=>{const t=s[0]?.date??"1900-01-01",e=r[0]?.date??"1900-01-01";return t<e?t:e},[s,r]),m=i.useMemo(()=>{const t=$.find(o=>o.id===f);if(!t||t.days==null)return{start:0,end:100};const e=Date.parse(M),a=Date.parse(w),l=e-t.days*864e5,u=e-a;return u<=0?{start:0,end:100}:{start:Math.max(0,(l-a)/u*100),end:100}},[f,M,w]),L=i.useMemo(()=>{const t="rgba(184,184,196,0.95)",e="rgba(138,138,152,0.85)",a="rgba(34,34,46,0.9)",l="rgba(34,34,46,0.55)",u=s.map(o=>[o.date,Math.round(o.netPctOi*10)/10]),k=r.map(o=>[o.date,Math.round(o.netPctOi*10)/10]);return{backgroundColor:"transparent",animation:!0,animationDuration:350,textStyle:{fontFamily:c,color:t},grid:{left:54,right:22,top:30,bottom:56},legend:{top:0,left:54,textStyle:{color:e,fontFamily:c,fontSize:10},itemWidth:14,itemHeight:3},xAxis:{type:"time",axisLine:{lineStyle:{color:a}},axisLabel:{color:e,fontSize:10},splitLine:{show:!1}},yAxis:{type:"value",axisLine:{show:!1},axisLabel:{color:e,fontSize:10,formatter:o=>`${o}%`},splitLine:{lineStyle:{color:l,type:"dashed"}},name:"MM net long (% of OI)",nameTextStyle:{color:e,fontSize:10,padding:[0,0,8,0],align:"left"},nameGap:14},tooltip:{trigger:"axis",confine:!0,backgroundColor:"rgba(12,12,18,0.96)",borderColor:a,borderWidth:1,textStyle:{color:t,fontSize:12},padding:[10,12],formatter:o=>{const p=o;if(!Array.isArray(p)||p.length===0)return"";const F=p[0].axisValueLabel??p[0].data[0],j=p.map(h=>`<div style="display:flex; justify-content:space-between; gap:12px; margin-top:2px"> 2 <span style="color:${h.color}">${h.seriesName}</span> 3 <span style="font-weight:600">${h.data[1].toFixed(1)}%</span> 4 </div>`).join("");return`<div style="min-width:160px"> 5 <div style="font-size:11px; color:${e}; margin-bottom:4px">${F}</div> 6 ${j} 7 </div>`}},dataZoom:[{type:"inside",start:y?.start??m.start,end:y?.end??m.end},{type:"slider",height:22,bottom:12,start:y?.start??m.start,end:y?.end??m.end,borderColor:a,fillerColor:"rgba(212,175,55,0.12)",handleStyle:{color:n,borderColor:n},moveHandleStyle:{color:n,opacity:.6},dataBackground:{areaStyle:{color:"rgba(212,175,55,0.15)"},lineStyle:{color:n,opacity:.4}},selectedDataBackground:{areaStyle:{color:"rgba(212,175,55,0.28)"},lineStyle:{color:n}},textStyle:{color:e,fontSize:10}}],series:[{name:"Gold",type:"line",showSymbol:!1,data:u,lineStyle:{color:n,width:1.6},markLine:{silent:!0,symbol:"none",lineStyle:{type:"dashed",width:1,opacity:.6,color:n},label:{position:"insideEndTop",fontFamily:c,fontSize:10,color:n,formatter:`Now ${g.toFixed(1)}%`},data:[{yAxis:Math.round(g*10)/10}]}},{name:"Silver",type:"line",showSymbol:!1,data:k,lineStyle:{color:x,width:1.6},markLine:{silent:!0,symbol:"none",lineStyle:{type:"dashed",width:1,opacity:.6,color:x},label:{position:"insideEndBottom",fontFamily:c,fontSize:10,color:x,formatter:`Now ${b.toFixed(1)}%`},data:[{yAxis:Math.round(b*10)/10}]}}]}},[s,r,g,b,m,y]);return d.jsxs("div",{className:"nd-chart-card",children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:10,flexWrap:"wrap"},children:[d.jsx("div",{style:{fontFamily:c,fontSize:10.5,textTransform:"uppercase",letterSpacing:"0.1em",color:"var(--nd-ink-mute)"},children:"Managed Money net long · CFTC Disaggregated · weekly since 2006"}),d.jsx("div",{style:{display:"flex",gap:2,background:"var(--nd-bg-card-2)",border:"1px solid var(--nd-line)",borderRadius:999,padding:2},children:$.map(t=>d.jsx("button",{type:"button",onClick:()=>{z(t.id),S(null)},style:{padding:"4px 12px",border:"none",borderRadius:999,background:t.id===f?n:"transparent",color:t.id===f?"#1a1106":"var(--nd-ink-soft)",fontFamily:c,fontSize:11,fontWeight:600,letterSpacing:"0.04em",cursor:"pointer",transition:"background 160ms, color 160ms"},children:t.label},t.id))})]}),d.jsx(v,{ref:t=>{C.current=t},echarts:E,option:L,style:{height:340,width:"100%"},notMerge:!1,lazyUpdate:!0,onEvents:{dataZoom:t=>{const e=t.batch?.[0]??t,a=typeof e?.start=="number"?e.start:null,l=typeof e?.end=="number"?e.end:null;a!=null&&l!=null&&S({start:a,end:l})}}})]})}export{I as CotPositioningChart};
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.