vendor: 4,189 bytes, line 1
1import{w as Vs,v as Bs,x as Wi,y as Us,z as ft,C as Vn,D as et,E as Di,I as Li,u as W,j as e,f as wl,b as Ol,o as Oi}from"./index-murwRuWa.js";import{R as Vt,S as Sl,T as Pi,F as Hi,c as _l,a as Bt,b as Tl,d as Gs}from"./ResizableHeight-ByK59Oys.js";import{a as Vi,c as $,e as Et}from"./vendor-react-F6dc2xmi.js";import{M as k,T as t,L as Ne,x as $t,y as Ct,N as Ys,O as Bi,B as H,P as Ui,Q as Pl,R as Gi,S as Yi,U as Xi,V as Ut,W as ee,I as ie,v as R,X as Ki,Y as je,b as El,Z as Xs,_ as $n,$ as qi,a0 as Qi,a1 as Zi,a2 as Ks,a3 as Ji,A as qs,a4 as Cn,a5 as Fe,a6 as $l,a7 as An,a8 as Cl,a9 as er,aa as tr,ab as nr,ac as lr,ad as Qs,ae as Rn,af as sr,ag as ir,ah as rr,ai as or,aj as ar,ak as Zs,al as dr,am as cr,an as pr,ao as ur,ap as mr,aq as hr,ar as gr,as as xr,at as fr,au as yr,av as br,aw as vr,ax as Hl,ay as jr,az as kr,aA as wr,aB as Sr,aC as _r,aD as Tr,aE as Er,aF as $r,aG as Cr,aH as Ar,aI as Vl,aJ as Rr,aK as Fr,aL as Js,u as fn,aM as Al,z as Nr,w as cl,aN as Ir,aO as Mr,l as zr,r as Wr,aP as Dr,aQ as Lr,aR as Or,aS as Pr,aT as Hr,aU as Vr,aV as Br,aW as Ur,aX as Gr,aY as Yr,i as pl,G as ei,aZ as Rt,a_ as Xr,a$ as Kr,b0 as qr,b1 as Rl,b2 as ti,b3 as Qr,b4 as Fn,b5 as Zr,b6 as Jr,b7 as eo,b8 as to,b9 as no,ba as lo,bb as so,bc as io}from"./Dashboard-_PQWhkHs.js";import{u as Fl,a as Kt}from"./useViewportWidth-77IqJ-pc.js";import{u as ro}from"./useFillHeight-CM3xhH7W.js";import{e as oo,U as ao,g as co,Y as po,C as Nn,s as lt,a as X,R as Oe,h as In,H as Mn,I as ul,c as uo,i as mo,m as ho,b as yt,j as ni,u as yn,P as bn}from"./ResearchPage-C5vT1pcQ.js";import{F as go}from"./FundamentalsModal-DyBTo225.js";import{RankStrip as li}from"./LuxViz-BCsHltiF.js";import{e as xo}from"./etClock-CgaPUsSi.js";import"./vendor-supabase-dggxtVzG.js";import"./index-PFWa_JFi.js";import"./vendor-charts-Ca5EIYA2.js";import"./KLineChart-Cd4Ycfqg.js";import"./userPrefs-DFfkHQRE.js";import"./studyParams-CMPXgB6R.js";import"./LanguageSwitcher-DRSftq1N.js";import"./appleMaterials-DdVvy1Jy.js";import"./symbols-BJWUEnLG.js";var Bn,Bl;function fo(){return Bl||(Bl=1,Bn={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),Bn}var yo=fo();const bo=Vi(yo);var vo=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Ul(n){var l={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},s=n.match(/<\/?([^\s]+?)[/\s>]/);if(s&&(l.name=s[1],(bo[s[1]]||n.charAt(n.length-2)==="/")&&(l.voidElement=!0),l.name.startsWith("!--"))){var i=n.indexOf("-->");return{type:"comment",comment:i!==-1?n.slice(4,i):""}}for(var o=new RegExp(vo),r=null;(r=o.exec(n))!==null;)if(r[0].trim())if(r[1]){var a=r[1].trim(),p=[a,""];a.indexOf("=")>-1&&(p=a.split("=")),l.attrs[p[0]]=p[1],o.lastIndex--}else r[2]&&(l.attrs[r[2]]=r[3].trim().substring(1,r[3].length-1));return l}var jo=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,ko=/^\s*$/,wo=Object.create(null);function si(n,l){switch(l.type){case"text":return n+l.content;case"tag":return n+="<"+l.name+(l.attrs?(function(s){var i=[];for(var o in s)i.push(o+'="'+s[o]+'"');return i.length?" "+i.join(" "):""})(l.attrs):"")+(l.voidElement?"/>":">"),l.voidElement?n:n+l.children.reduce(si,"")+"</"+l.name+">";case"comment":return n+"<!--"+l.comment+"-->"}}var So={parse:function(n,l){l||(l={}),l.components||(l.components=wo);var s,i=[],o=[],r=-1,a=!1;if(n.indexOf("<")!==0){var p=n.indexOf("<");i.push({type:"text",content:p===-1?n:n.substring(0,p)})}return n.replace(jo,function(d,c){if(a){if(d!=="</"+s.name+">")return;a=!1}var u,h=d.charAt(1)!=="/",m=d.startsWith("<!--"),y=c+d.length,b=n.charAt(y);if(m){var f=Ul(d);return r<0?(i.push(f),i):((u=o[r]).children.push(f),i)}if(h&&(r++,(s=Ul(d)).type==="tag"&&l.components[s.name]&&(s.type="component",a=!0),s.voidElement||a||!b||b==="<"||s.children.push({type:"text",content:n.slice(y,n.indexOf("<",y))}),r===0&&i.push(s),(u=o[r-1])&&u.children.push(s),o[r]=s),(!h||s.voidElement)&&(r>-1&&(s.voidElement||s.name===d.slice(2,-1))&&(r--,s=r===-1?i:o[r]),!a&&b!=="<"&&b)){u=r===-1?i:o[r].children;var w=n.indexOf("<",y),v=n.slice(y,w===-1?void 0:w);ko.test(v)&&(v=" "),(w>-1&&r+u.length>=0||v!==" ")&&u.push({type:"text",content:v})}}),i}
1,stringify:function(n){return n.reduce(function(l,s){return l+si("",s)},"")}};const pn=(n,l)=>{if(!n)return!1;const s=n.props?.children??n.children;return l?s.length>0:!!s},Ot=n=>{if(!n)return[];const l=n.props?.children??n.children;return n.props?.i18nIsDynamicList?Ze(l):l},_o=n=>Array.isArray(n)&&n.every($.isValidElement),Ze=n=>Array.isArray(n)?n:[n],To=(n,l)=>{const s={...l};return s.props={...l.props,...n.props},s},Eo=n=>{const l={};if(!n)return l;const s=i=>{Ze(i).forEach(r=>{ft(r)||(pn(r)?s(Ot(r)):et(r)&&!$.isValidElement(r)&&Object.assign(l,r))})};return s(n),l},ml=(n,l,s,i)=>{if(!n)return"";let o="";const r=Ze(n),a=l?.transSupportBasicHtmlNodes?l.transKeepBasicHtmlNodesFor??[]:[];return r.forEach((p,d)=>{if(ft(p)){o+=`${p}`;return}if($.isValidElement(p)){const{props:c,type:u}=p,h=Object.keys(c).length,m=a.indexOf(u)>-1,y=c.children;if(!y&&m&&!h){o+=`<${u}/>`;return}if(!y&&(!m||h)||c.i18nIsDynamicList){o+=`<${d}></${d}>`;return}if(m&&h<=1){const f=ft(y)?y:ml(y,l,s,i);o+=`<${u}>${f}</${u}>`;return}const b=ml(y,l,s,i);o+=`<${d}>${b}</${d}>`;return}if(p===null){Vn(s,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:i});return}if(et(p)){const{format:c,...u}=p,h=Object.keys(u);if(h.length===1){const m=c?`${h[0]}, ${c}`:h[0];o+=`{{${m}}}`;return}Vn(s,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:i,child:p});return}Vn(s,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:i,child:p})}),o},$o=(n,l=[],s={})=>{if(!n)return n;const i=Object.keys(s),o=[...l,...i];let r="",a=0;for(;a<n.length;)if(n[a]==="<"){let p=!1;const d=n.slice(a).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(d){const c=d[1];(/^\d+$/.test(c)||o.includes(c))&&(p=!0,r+=d[0],a+=d[0].length)}if(!p){const c=n.slice(a).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(c){const u=c[1];(/^\d+$/.test(u)||o.includes(u))&&(p=!0,r+=c[0],a+=c[0].length)}}p||(r+="<",a+=1)}else r+=n[a],a+=1;return r},Co=(n,l,s,i,o,r,a)=>{if(s==="")return[];const p=o.transKeepBasicHtmlNodesFor||[],d=s&&new RegExp(p.map(g=>`<${g}`).join("|")).test(s);if(!n&&!l&&!d&&!a)return[s];const c=l??{},u=g=>{Ze(g).forEach(j=>{ft(j)||(pn(j)?u(Ot(j)):et(j)&&!$.isValidElement(j)&&Object.assign(c,j))})};u(n);const h=$o(s,p,c),m=So.parse(`<0>${h}</0>`),y={...c,...r},b=(g,x,j)=>{const _=Ot(g),E=w(_,x.children,j);return _o(_)&&E.length===0||g.props?.i18nIsDynamicList?_:E},f=(g,x,j,_,E)=>{g.dummy?(g.children=x,j.push($.cloneElement(g,{key:_},E?void 0:x))):j.push(...$.Children.map([g],T=>{if(T.type===$.Fragment||T.props?.i18nIsDynamicList!==void 0){const C={key:_};return T&&T.props&&Object.keys(T.props).forEach(I=>{I==="children"||I==="i18nIsDynamicList"||(C[I]=T.props[I])}),$.createElement(T.type,C,E?null:x)}const S={key:_};return T&&T.props&&Object.keys(T.props).forEach(C=>{C==="ref"||C==="children"||(S[C]=T.props[C])}),$.cloneElement(T,S,E?null:x)}))},w=(g,x,j)=>{const _=Ze(g),E=Ze(x),T={};return E.reduce((S,C,I)=>{const F=C.children?.[0]?.content&&i.services.interpolator.interpolate(C.children[0].content,y,i.language);if(C.type==="tag"){let A=_[parseInt(C.name,10)];!A&&l&&(A=l[C.name]),j.length===1&&!A&&(A=j[0][C.name]),A||(A={});const P={...C.attrs};a&&Object.keys(P).forEach(B=>{const te=P[B];ft(te)&&(P[B]=Di(te))});const V=Object.keys(P).length!==0?To({props:P},A):A,J=$.isValidElement(V),Q=J&&pn(C,!0)&&!C.voidElement,U=d&&et(V)&&V.dummy&&!J,D=et(l)&&Object.hasOwnProperty.call(l,C.name);if(ft(V)){const B=i.services.interpolator.interpolate(V,y,i.language);S.push(B)}else if(pn(V)||Q){const B=b(V,C,j);f(V,B,S,I)}else if(U){const B=w(_,C.children,j);f(V,B,S,I)}else if(Number.isNaN(parseFloat(C.name)))if(D){const B=b(V,C,j);f(V,B,S,I,C.voidElement)}else if(o.transSupportBasicHtmlNodes&&p.indexOf(C.name)>-1)if(C.voidElement)S.push($.createElement(C.name,{key:`${C.name}-${I}`}));else{const B=T[C.name]||0;T[C.name]=B+1;let te,xe=0;for(let Y=0;Y<_.length;Y+=1){const fe=_[Y];if($.isValidElement(fe)&&fe.type===C.name){if(xe===B){te=fe;break}xe+=1}
1}const me=te?Ze(Ot(te)):_,be=w(me,C.children,j);S.push($.createElement(C.name,{key:`${C.name}-${I}`},be))}else if(C.voidElement)S.push(`<${C.name} />`);else{const B=w(_,C.children,j);S.push(`<${C.name}>${B}</${C.name}>`)}else if(et(V)&&!J){const B=C.children[0]?F:null;B&&S.push(B)}else f(V,F,S,I,C.children.length!==1||!F)}else if(C.type==="text"){const A=o.transWrapTextNodes,P=typeof o.unescape=="function"?o.unescape:Bs().unescape,V=a?P(i.services.interpolator.interpolate(C.content,y,i.language)):i.services.interpolator.interpolate(C.content,y,i.language);A?S.push($.createElement(A,{key:`${C.name}-${I}`},V)):S.push(V)}return S},[])},v=w([{dummy:!0,children:n||[]}],m,Ze(n||[]));return Ot(v[0])},ii=(n,l,s)=>{const i=n.key||l,o=$.cloneElement(n,{key:i});if(!o.props||!o.props.children||s.indexOf(`${l}/>`)<0&&s.indexOf(`${l} />`)<0)return o;function r(){return $.createElement($.Fragment,null,o)}return $.createElement(r,{key:i})},Ao=(n,l)=>n.map((s,i)=>ii(s,i,l)),Ro=(n,l)=>{const s={};return Object.keys(n).forEach(i=>{Object.assign(s,{[i]:ii(n[i],i,l)})}),s},Fo=(n,l,s,i)=>n?Array.isArray(n)?Ao(n,l):et(n)?Ro(n,l):(Vs(s,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:i}),null):null,No=n=>!et(n)||Array.isArray(n)?!1:Object.keys(n).reduce((l,s)=>l&&Number.isNaN(Number.parseFloat(s)),!0);function Io({children:n,count:l,parent:s,i18nKey:i,context:o,tOptions:r={},values:a,defaults:p,components:d,ns:c,i18n:u,t:h,shouldUnescape:m,...y}){const b=u||Us();if(!b)return Vs(b,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:i}),n;const f=h||b.t.bind(b)||(te=>te),w={...Bs(),...b.options?.react};let v=c||f.ns||b.options?.defaultNS;v=ft(v)?[v]:v||["translation"];const{transDefaultProps:g}=w,x=g?.tOptions?{...g.tOptions,...r}:r,j=m??g?.shouldUnescape,_=g?.values?{...g.values,...a}:a,E=g?.components?{...g.components,...d}:d,T=ml(n,w,b,i),S=p||x?.defaultValue||T||w.transEmptyNodeValue||(typeof i=="function"?Wi(i):i),{hashTransKey:C}=w,I=i||(C?C(T||S):T||S);b.options?.interpolation?.defaultVariables?a=_&&Object.keys(_).length>0?{..._,...b.options.interpolation.defaultVariables}:{...b.options.interpolation.defaultVariables}:a=_;const F=Eo(n);F&&typeof F.count=="number"&&l===void 0&&(l=F.count);const A=a||l!==void 0&&!b.options?.interpolation?.alwaysFormat||!n?x.interpolation:{interpolation:{...x.interpolation,prefix:"#$?",suffix:"?$#"}},P={...x,context:o||x.context,count:l,...a,...A,defaultValue:S,ns:v};let V=I?f(I,P):S;V===I&&S&&(V=S);const J=Fo(E,V,b,i);let Q=J||n,U=null;No(J)&&(U=J,Q=n);const D=Co(Q,U,V,b,w,P,j),B=s??w.defaultTransParent;return B?$.createElement(B,y,D):D}function qt({children:n,count:l,parent:s,i18nKey:i,context:o,tOptions:r={},values:a,defaults:p,components:d,ns:c,i18n:u,t:h,shouldUnescape:m,...y}){const{i18n:b,defaultNS:f}=$.useContext(Li)||{},w=u||b||Us(),v=h||w?.t.bind(w);return Io({children:n,count:l,parent:s,i18nKey:i,context:o,tOptions:r,values:a,defaults:p,components:d,ns:c||v?.ns||f||w?.options?.defaultNS,i18n:w,t:h,shouldUnescape:m,...y})}const Ft=n=>{const l=Number(n);return isFinite(l)&&l!==0?l:null};function Mo({symbol:n}){const{t:l}=W(),[s,i]=$.useState(null),[o,r]=$.useState(null),[a,p]=$.useState(null),d=$.useRef(null),c=$.useRef(null),u=String(n||"").toUpperCase();$.useEffect(()=>{let T=!0;i(null),p(null);const S=()=>{Ne(u).then(I=>{T&&i(I)}).catch(()=>{}),$t(u).then(I=>{T&&p(I)}).catch(()=>{}),Ct(u,"5m",14).then(I=>{if(!T)return;const F=(I?.candles||[]).filter(Q=>isFinite(Number(Q.high??Q.h)));if(!F.length){r(null);return}const A=Q=>new Date(Q*1e3).toLocaleDateString("en-CA",{timeZone:"America/New_York"}),P=A(Number(F[F.length-1].ts??F[F.length-1].t));let V=null,J=null;for(const Q of F){if(A(Number(Q.ts??Q.t))!==P)continue;const U=Number(Q.high??Q.h),D=Number(Q.low??Q.l);V=V==null?U:Math.max(V,U),J=J==null?D:Math.min(J,D)}r(V!=null&&J!=null&&V>J?V-J:null)}).catch(()=>{})};S();const C=setInterval(S,12e3);return()=>{T=!1,clearInterval(C)}},[u]);const h=s?.gex||{},m=Ft(s?.spot),y=Ft(h.flip_strike),b=Ft(h.call_wall),f=Ft(h.put_wall),w=Ft(a?.expected_move_pct),v=m&&(y||b||f);if($.useEffect(()=>{const T=c.current,S=d.current;if(!T||!S||!v)return;const C=Math.min(window.devicePixelRatio||1,2),I=S.clientWidth,F=56;T.width=I*C,T.height=F*C,T.style.height=`${F}px`;const A=T.getContext("2d");A.setTransform(C,0,0,C,0,0),A.clearRect(0,0,I,F);
1const P=w?m*w/100:null,V=[m,y,b,f].filter(Boolean);let J=Math.min(...V,P?m-P*1.3:1/0),Q=Math.max(...V,P?m+P*1.3:-1/0);const U=(Q-J)*.06||m*.005;J-=U,Q+=U;const D=me=>10+(me-J)/(Q-J)*(I-20),B=30;P&&(A.fillStyle="rgba(210,162,76,0.08)",A.fillRect(D(m-P),14,D(m+P)-D(m-P),30),A.font=`8.5px ${k}`,A.fillStyle="rgba(120,129,143,0.85)",A.fillText(`±1 EM (${w.toFixed(2)}%)`,D(m-P)+3,12)),A.strokeStyle="rgba(255,255,255,0.12)",A.beginPath(),A.moveTo(10,B),A.lineTo(I-10,B),A.stroke();const te=(me,be,Y,fe)=>{if(!me)return;A.strokeStyle=be,A.lineWidth=2,A.beginPath(),A.moveTo(D(me),B-9),A.lineTo(D(me),B+9),A.stroke(),A.lineWidth=1,A.font=`8.5px ${k}`,A.fillStyle=be;const ke=`${Y} ${me.toFixed(me>1e3?0:2)}`,we=A.measureText(ke).width;A.fillText(ke,Math.max(4,Math.min(I-we-4,D(me)-we/2)),fe?10:52)};te(f,"rgba(240,82,79,0.9)","PUT WALL",!1),te(b,"rgba(55,209,131,0.9)","CALL WALL",!1),y&&(A.setLineDash([4,4]),te(y,"rgba(242,169,59,0.95)","γ-FLIP",!0),A.setLineDash([])),A.beginPath(),A.arc(D(m),B,4,0,6.284),A.fillStyle="#E8E4DA",A.fill(),A.beginPath(),A.arc(D(m),B,7.5,0,6.284),A.strokeStyle="rgba(210,162,76,0.9)",A.stroke(),A.font=`700 10px ${k}`,A.fillStyle="#E8E4DA";const xe=m.toFixed(m>1e3?1:2);A.fillText(xe,Math.max(4,Math.min(I-60,D(m)+10)),B-8)},[v,m,y,b,f,w]),!v)return null;const g=w?m*w/100:null,x=T=>T&&g?Math.abs(T-m)/g:null,j=y?m>=y?l("markets.structureStrip.aboveFlip"):l("markets.structureStrip.belowFlip"):null,_=g&&o?o/(2*g)*100:null,E=[j,_!=null?l("markets.structureStrip.emBudget",{defaultValue:"EM BUDGET {{pct}}%",pct:Math.round(_)}):null,x(b)!=null?l("markets.structureStrip.emToCallWall",{em:x(b).toFixed(1)}):null,x(f)!=null?l("markets.structureStrip.emToPutWall",{em:x(f).toFixed(1)}):null].filter(Boolean);return e.jsxs("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,padding:"2px 6px 4px",marginBottom:6,background:"#10141A"},title:l("markets.structureStrip.canvasTitle"),children:[e.jsx("div",{ref:d,children:e.jsx("canvas",{ref:c,style:{display:"block",width:"100%"}})}),E.length>0&&e.jsxs("div",{style:{fontFamily:k,fontSize:9,color:t.dim,letterSpacing:"0.04em",padding:"0 4px"},children:[u," · ",E.join(" · ")]})]})}function tt({id:n,rows:l,style:s,gap:i=12,stackBelow:o=768,layoutEpoch:r=0}){const a=Fl(),p=oo(n),d=l.filter(b=>!b.hidden),c=l.map(b=>b.hidden?"0":"1").join(""),u=d.length===l.length;if(!d.length)return null;if(a<o)return e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:i,minWidth:0},children:d.map(b=>e.jsx("div",{style:{minWidth:0,maxWidth:"100%",overflowX:"hidden"},children:b.node},b.id))});const h=`${p.key}:${c}:${r}`,m=u?p.defaultLayout:void 0,y=u?p.onLayoutChanged:void 0;return e.jsx(ao,{orientation:"vertical",defaultLayout:m,onLayoutChanged:y,style:{height:"100%",minHeight:0,minWidth:0,...s},children:d.map((b,f)=>{const w=b.id||`row-${l.indexOf(b)}`;return e.jsxs($.Fragment,{children:[f>0&&e.jsx(co,{axis:"vertical"}),e.jsx(po,{id:w,defaultSize:b.defaultSize,minSize:b.minSize||"10%",style:{minHeight:0,minWidth:0,overflow:"hidden"},children:b.node})]},w)})},h)}function zo(n){const l=Date.parse(n);if(!Number.isFinite(l))return"";const s=Math.max(0,Math.round((Date.now()-l)/6e4));return s<60?`${s}m`:s<2160?`${Math.round(s/60)}h`:`${Math.round(s/1440)}d`}function Wo({symbol:n,onClose:l}){const{t:s}=W(),[i,o]=$.useState(null),[r,a]=$.useState(!0);$.useEffect(()=>{let d=!1;return a(!0),Ys(n,40).then(c=>{d||o(c)}).catch(()=>{}).finally(()=>{d||a(!1)}),()=>{d=!0}},[n]),$.useEffect(()=>{const d=c=>{c.key==="Escape"&&l?.()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[l]);const p=(i?.articles||i?.news||[]).filter(d=>d?.title);return Et.createPortal(e.jsx("div",{onMouseDown:d=>{d.target===d.currentTarget&&l?.()},style:{position:"fixed",inset:0,zIndex:300,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"6vh"},children:e.jsxs("div",{style:{width:"min(680px, 94vw)",maxHeight:"82vh",overflowY:"auto",background:t.bg,border:`1px solid ${t.border2}`,borderRadius:10,padding:"14px 16px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[e.jsx(Nn,{sym:n,size:18}),e.jsx("span",{style:{fontFamily:k,fontSize:14,fontWeight:900,color:t.text},children:n}),e.jsx("span",{style:{fontSize:11,fontWeight:800,letterSpacing:"0.1em",color:t.muted},children:s("markets.newsModal.title",{defaultValue:"NEWS"})}),e.jsx("button",{className:"sa-x",onClick:l,style:{marginLeft:"auto",background:"none",border:"none",color:t.dim,fontSize:16,cursor:"pointer"},children:"â"})]}),r&&e.jsx("div",{style:{fontFamily:k,fontSize:11,color:t.dim,padding:"18px 0"},children:s("markets.newsModal.loading",{defaultValue:"loading headlines..."})}),!r&&p.length===0&&e.jsx("div",{style:{fontFamily:k,fontSize:11,color:t.dim,padding:"18px 0"},children:s("markets.newsModal.empty",{defaultValue:"no recent headlines for this symbol from our news feeds"})}),(()=>{const d=p.filter(m=>m.about!==!1&&m.about!==void 0?m.about:!1),c=p.filter(m=>!m.about),u=p.some(m=>m.about!==void 0),h=({a:m,dim:y})=>e.jsxs("a",{href:m.url||"#",target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",display:"block",padding:"8px 10px",opacity:y?.62:1,background:t.panel,border:`1px solid ${t.border}`,borderRadius:8},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"baseline",marginBottom:2},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.gold,fontWeight:800},children:zo(m.published)}),e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.dim},children:m.source})]}),e.jsx("div",{style:{fontSize:12.5,color:t.text,lineHeight:1.35},children:m.title})]});return u?e.jsxs("div",{style:{display:"grid",gap:8},children:[d.length>0&&e.jsxs("div",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.1em",color:t.gold},children:[s("markets.newsModal.about",{defaultValue:"ABOUT"})," ",n," · ",d.length]}),d.map((m,y)=>e.jsx(h,{a:m},"a"+y)),c.length>0&&e.jsxs("div",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.1em",color:t.dim,marginTop:4},title:s("markets.newsModal.mentionsTip",{defaultValue:"Provider-tagged articles that mention this symbol among many tickers"}),children:[s("markets.newsModal.mentions",{defaultValue:"MENTIONS"})," · ",c.length]}),c.map((m,y)=>e.jsx(h,{a:m,dim:!0},"m"+y))]}):e.jsx("div",{style:{display:"grid",gap:8},children:p.map((m,y)=>e.jsx(h,{a:m},y))})})(),e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.dim,marginTop:10},children:s("markets.newsModal.honesty",{defaultValue:"Headlines from our licensed feeds; links open the original source. Not investment advice."})})]})}),document.body)}if(typeof document<"u"&&!document.getElementById("sa-ch-style")){const n=document.createElement("style");n.id="sa-ch-style",n.textContent=".sa-ch-scroll{scrollbar-width:none;-ms-overflow-style:none}.sa-ch-scroll::-webkit-scrollbar{display:none;height:0}.sa-ch-btn{transition:border-color .12s,color .12s}.sa-ch-btn:hover{border-color:#D2A24C !important;color:#D2A24C !important}",document.head.appendChild(n)}const Gl=n=>({fontFamily:k,fontSize:10.5,fontWeight:700,padding:"3px 7px",borderRadius:5,cursor:"pointer",whiteSpace:"nowrap",border:"1px solid transparent",background:n?"rgba(210,162,76,0.16)":t.panel2,color:n?t.gold:t.muted}),Do=n=>({fontFamily:k,fontSize:10.5,padding:"3px 6px",borderRadius:5,cursor:"pointer",border:`1px solid ${n?t.blue:"transparent"}`,background:n?"rgba(57,141,255,0.14)":t.panel2,color:n?t.blue:t.muted});function Lo(n){return!n||n<=0?"":n>=1e12?`${(n/1e12).toFixed(1)}T`:n>=1e9?`${(n/1e9).toFixed(0)}B`:n>=1e6?`${(n/1e6).toFixed(0)}M`:""}function Oo({tf:n,tfs:l,onTf:s}){const[i,o]=$.useState(!1),[r,a]=$.useState(null),p=$.useRef(null),d=()=>{const u=p.current;u&&a(u.getBoundingClientRect())};$.useEffect(()=>{if(!i)return;d();const u=()=>d(),h=m=>{p.current&&!p.current.contains(m.target)&&o(!1)};return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),document.addEventListener("mousedown",h),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u),document.removeEventListener("mousedown",h)}},[i]);const c=i&&r?Et.createPortal(e.jsx("div",{style:{position:"fixed",top:r.bottom+4,left:Math.max(8,r.right-126
1),width:126,zIndex:4e3,background:"#0E1218",border:`1px solid ${t.border2}`,borderRadius:8,boxShadow:"0 10px 30px rgba(0,0,0,0.6)",padding:5,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:4},children:l.map(u=>e.jsx("button",{onMouseDown:h=>{h.preventDefault(),s?.(u),o(!1)},style:{...Do(n===u),padding:"5px 0",textAlign:"center"},children:u},u))}),document.body):null;return e.jsxs("div",{style:{position:"relative",flexShrink:0},children:[e.jsxs("button",{ref:p,onClick:()=>{o(u=>!u),d()},"aria-label":"Timeframe",style:{fontFamily:k,fontSize:11,fontWeight:700,padding:"3px 7px",borderRadius:5,cursor:"pointer",border:`1px solid ${t.blue}`,background:"rgba(57,141,255,0.14)",color:t.blue,display:"flex",alignItems:"center",gap:4},children:[n,e.jsx("span",{style:{fontSize:8,opacity:.75},children:"â¾"})]}),c]})}function Nl({symbol:n,tf:l,onSymbol:s,onTf:i,presets:o=[],tfs:r=[],searchable:a=!0,searchApi:p=!0,universe:d=null,right:c=null,placeholder:u="Searchâ¦"}){const{t:h}=W(),[m,y]=$.useState(!1),[b,f]=$.useState(!1),[w,v]=$.useState(""),[g,x]=$.useState(!1),[j,_]=$.useState([]),[E,T]=$.useState(0),[S,C]=$.useState(null),I=$.useRef(null),F=$.useRef(null),A=$.useRef(null),P=$.useCallback(()=>{const U=F.current;U&&C(U.getBoundingClientRect())},[]);$.useEffect(()=>{if(!g)return;const U=w.trim().toUpperCase();if(!p){const D=(d||[]).filter(B=>!U||B.symbol.toUpperCase().startsWith(U)||(B.name||"").toUpperCase().includes(U));_(D.slice(0,40)),T(0);return}return clearTimeout(A.current),A.current=setTimeout(async()=>{try{const D=await Bi(U,14);_(Array.isArray(D?.results)?D.results:[])}catch{_([])}T(0)},150),()=>clearTimeout(A.current)},[w,g,p,d]),$.useEffect(()=>{if(!g)return;P();const U=()=>P();window.addEventListener("scroll",U,!0),window.addEventListener("resize",U);const D=B=>{I.current&&!I.current.contains(B.target)&&x(!1)};return document.addEventListener("mousedown",D),()=>{window.removeEventListener("scroll",U,!0),window.removeEventListener("resize",U),document.removeEventListener("mousedown",D)}},[g,P]);const V=U=>{const D=(U||"").trim().toUpperCase();D&&s?.(D),v(""),x(!1),_([]),F.current?.blur()},J=U=>{U.key==="Enter"?(U.preventDefault(),V(j[E]?.symbol||w)):U.key==="ArrowDown"?(U.preventDefault(),T(D=>Math.min(D+1,j.length-1))):U.key==="ArrowUp"?(U.preventDefault(),T(D=>Math.max(D-1,0))):U.key==="Escape"&&(x(!1),F.current?.blur())},Q=g&&S&&j.length>0?Et.createPortal(e.jsx("div",{style:{position:"fixed",top:S.bottom+4,left:S.left,width:Math.max(S.width,220),maxHeight:320,overflowY:"auto",zIndex:4e3,background:"#0E1218",border:`1px solid ${t.border2}`,borderRadius:8,boxShadow:"0 10px 30px rgba(0,0,0,0.6)",padding:4},children:j.map((U,D)=>e.jsxs("div",{onMouseDown:B=>{B.preventDefault(),V(U.symbol)},onMouseEnter:()=>T(D),style:{display:"flex",alignItems:"baseline",gap:8,padding:"5px 8px",borderRadius:5,cursor:"pointer",background:D===E?"rgba(57,141,255,0.14)":"transparent"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:12,fontWeight:800,color:t.text,minWidth:52},children:U.symbol}),e.jsx("span",{style:{fontSize:11,color:t.muted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:U.name||""}),U.mcap?e.jsx("span",{style:{fontFamily:k,fontSize:9.5,color:t.dim},children:Lo(U.mcap)}):null]},U.symbol))}),document.body):null;return e.jsxs("div",{className:"sa-ch-scroll",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"nowrap",minWidth:0,overflowX:"auto",padding:"5px 9px",borderBottom:`1px solid ${t.border}`,flexShrink:0},children:[e.jsx(Nn,{sym:n,size:16}),e.jsx("span",{style:{fontFamily:k,fontSize:13,fontWeight:800,color:t.text,letterSpacing:"0.02em",flexShrink:0},children:n}),a&&e.jsxs("div",{ref:I,style:{position:"relative",display:"flex",alignItems:"center",flexShrink:1,minWidth:80},children:[e.jsx("span",{style:{position:"absolute",left:7,color:t.dim,fontSize:11,pointerEvents:"none"},children:"â"}),e.jsx("input",{ref:F,value:w,onChange:U=>{v(U.target.value),g||x(!0)},onFocus:()=>{x(!0),P()},onKeyDown:J,placeholder:u,"aria-label":"Search symbol",style:{width:"100%",minWidth:0,maxWidth:148,background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"4px 8px 4px 20px",fontSize:11,fontFamily:k,textTransform:"uppercase"}})]}),r.length>0&&e.jsx(Oo,{tf:l,tfs:r,onTf:i}),c,e.jsx("div",{style:{flex:"1 1 auto",minWidth:0}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0},children:[e.jsx("button",{className:"sa-ch-btn",onClick:()=>y(!0),title:h("markets.chartHeader.fundamentalsTip",{defaultValue:"Full company fundamentals for this symbol"}
1),style:{...Gl(!1),border:`1px solid ${t.border2}`,flexShrink:0},children:h("markets.chartHeader.fundamentals",{defaultValue:"Fundamentals"})}),e.jsx("button",{className:"sa-ch-btn",onClick:()=>f(!0),title:h("markets.chartHeader.newsTip",{defaultValue:"Recent headlines for this symbol"}),style:{...Gl(!1),border:`1px solid ${t.border2}`,flexShrink:0},children:h("markets.chartHeader.news",{defaultValue:"News"})})]}),m&&e.jsx(go,{symbol:n,onClose:()=>y(!1)}),b&&e.jsx(Wo,{symbol:n,onClose:()=>f(!1)}),Q]})}const Po={strong_bull:"#D2A24C",weak_bull:"#5E7FA3",neutral:"#e6b800",weak_bear:"#f9a8d4",strong_bear:"#D2A24C"};function vn({symbol:n,assetClass:l=""}){const{t:s}=W(),i={strong_bull:s("markets.terminal.gonogoStrongBull"),weak_bull:s("markets.terminal.gonogoWeakBull"),neutral:s("markets.terminal.gonogoNeutral"),weak_bear:s("markets.terminal.gonogoWeakBear"),strong_bear:s("markets.terminal.gonogoStrongBear")},{data:o}=H(()=>Ui(n,"1d",l),3e4,[n,l]),r=o&&o.state;if(!r)return null;const a=Po[r]||t.muted;return e.jsxs("span",{title:s("markets.terminal.gonogoTitle",{score:o.score,verdict:o.go?s("markets.terminal.gonogoTrending"):s("markets.terminal.gonogoRange")}),style:{display:"inline-flex",alignItems:"center",fontSize:10,fontWeight:800,color:a,border:`1px solid ${a}`,borderRadius:6,padding:"3px 8px",marginLeft:8,lineHeight:1.2,whiteSpace:"nowrap",flexShrink:0},children:[o.go?"â ":"â ",i[r],e.jsx("span",{style:{marginLeft:5,color:t.dim,fontWeight:700},children:"1D"})]})}const Ho=new Set(["SPY","QQQ","IWM","DIA","VOO","VTI","SMH","SOXL","SOXS","TQQQ","SQQQ","ARKK","XLF","XLE","XLK","XLV","XLI","XLP","XLY","XLU","XLB","XLRE","XLC","GLD","SLV","TLT","HYG","LQD","USO","UNG","VXX","UVXY","SVXY","EEM","EFA","FXI","KWEB","GDX","XBI","IBIT","KRE","XRT","SPXL","SPXS","UPRO"]),Vo=n=>Ho.has(String(n||"").toUpperCase()),Bo=["Consumer Discretionary","Industrials","Information Technology","Real Estate","Health Care","Energy","Financials","Materials","Consumer Staples","Communication Services","Utilities"],Uo={AAPL:"Information Technology",MSFT:"Information Technology",NVDA:"Information Technology",AMD:"Information Technology",INTC:"Information Technology",MU:"Information Technology",AVGO:"Information Technology",CRM:"Information Technology",ORCL:"Information Technology",ADBE:"Information Technology",QCOM:"Information Technology",TSM:"Information Technology",PLTR:"Information Technology",SMCI:"Information Technology",DELL:"Information Technology",MRVL:"Information Technology",IBM:"Information Technology",MSTR:"Information Technology",MARA:"Information Technology",RIOT:"Information Technology",SHOP:"Information Technology",META:"Communication Services",GOOGL:"Communication Services",GOOG:"Communication Services",NFLX:"Communication Services",T:"Communication Services",DIS:"Communication Services",SNAP:"Communication Services",VZ:"Communication Services",AMZN:"Consumer Discretionary",TSLA:"Consumer Discretionary",NIO:"Consumer Discretionary",F:"Consumer Discretionary",GM:"Consumer Discretionary",BABA:"Consumer Discretionary",RIVN:"Consumer Discretionary",LCID:"Consumer Discretionary",AMC:"Consumer Discretionary",GME:"Consumer Discretionary",DKNG:"Consumer Discretionary",CCL:"Consumer Discretionary",HD:"Consumer Discretionary",NKE:"Consumer Discretionary",SBUX:"Consumer Discretionary",MCD:"Consumer Discretionary",ABNB:"Consumer Discretionary",LOW:"Consumer Discretionary",BAC:"Financials",JPM:"Financials",WFC:"Financials",C:"Financials",GS:"Financials",COIN:"Financials",SOFI:"Financials",PYPL:"Financials",V:"Financials",MA:"Financials",RKT:"Financials",MS:"Financials",BA:"Industrials",CAT:"Industrials",UBER:"Industrials",GE:"Industrials",XOM:"Energy",CVX:"Energy",OXY:"Energy",SLB:"Energy",WMT:"Consumer Staples",COST:"Consumer Staples",KO:"Consumer Staples",PG:"Consumer Staples",UNH:"Health Care",JNJ:"Health Care",PFE:"Health Care",LLY:"Health Care",MRNA:"Health Care"},ri=n=>Uo[String(n||"").toUpperCase()]||null,Go=n=>n==="sweep"?"magenta":n==="block"?"white":"yellow";function Yl(n){if(!n)return!1;const l=new Date(n+"T00:00:00Z");if(isNaN(l))return!1;const i=1+(5-new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),1)).getUTCDay()+7)%7+14;return l.getUTCDate()!==i}function Yo(n,l){if(!n)return!1;const s=new Date(n+(n.length<=10?"T00:00:00Z":""));if(isNaN(s))return!1;const i=(s-Date.now())/864e5;return i>=-1&&i<=l}const un={puts:!0,calls:!0,colorsOff:[],aboveAsk:!1,belowBid:!1,atAboveAsk:!1,atBelowBid:!1,addMultileg:!0,onlyMultileg:!1,priceLte050:!1,priceLte5:!1,ctr100:!1,ctr500:!1,ctr5000:!1,stock:!0,etf:!0,prem50k:!1,prem100k:!1,prem200k:!1,prem500k:!1,prem1m:!1,mktCapLt075T:!1,itm:!1,otm:!1,sweepOnly:!1,weeklyOnl
1y:!1,excludeWeekly:!1,only0dte:!1,exclude0dte:!1,unusualOnly:!1,earningsOnly:!1,showExDiv:!1,sectorsOff:[],expStart:"",expEnd:"",wlOmit:!1,wlOnly:!1};function Un(n){let l=0;n.puts&&n.calls||l++,n.colorsOff?.length&&l++,(n.aboveAsk||n.belowBid||n.atAboveAsk||n.atBelowBid)&&l++,(n.onlyMultileg||!n.addMultileg)&&l++,(n.priceLte050||n.priceLte5)&&l++,(n.ctr100||n.ctr500||n.ctr5000)&&l++,n.stock&&n.etf||l++,(n.prem50k||n.prem100k||n.prem200k||n.prem500k||n.prem1m||n.mktCapLt075T)&&l++;for(const s of["itm","otm","sweepOnly","weeklyOnly","excludeWeekly","only0dte","exclude0dte","unusualOnly","earningsOnly","showExDiv"])n[s]&&l++;return n.sectorsOff?.length&&l++,(n.expStart||n.expEnd)&&l++,(n.wlOmit||n.wlOnly)&&l++,l}function Xo(n,l,s=[],i={}){if(!l)return n;const o=l.prem1m?1e6:l.prem500k?5e5:l.prem200k?2e5:l.prem100k?1e5:l.prem50k?5e4:0,r=l.ctr5000?5e3:l.ctr500?500:l.ctr100?100:0,a=l.priceLte050?.5:l.priceLte5?5:null,p=l.aboveAsk||l.belowBid||l.atAboveAsk||l.atBelowBid,d=new Set((s||[]).map(c=>String(c).toUpperCase()));return n.filter(c=>{const u=String(c.underlying).toUpperCase(),h=i[u]||{},m=String(c.cp).toUpperCase().startsWith("C");if(m&&!l.calls||!m&&!l.puts||l.colorsOff?.length&&l.colorsOff.includes(Go(c.classification)))return!1;if(p){const y=c.side==="at_or_above_ask",b=c.side==="at_or_below_bid";if(!(l.aboveAsk&&y||l.atAboveAsk&&y||l.belowBid&&b||l.atBelowBid&&b))return!1}if(l.onlyMultileg&&c.classification!=="multileg"||!l.addMultileg&&c.classification==="multileg"||a!=null&&Number(c.premium||0)/(Number(c.size||0)*100||1)>a||r&&Number(c.size||0)<r)return!1;if(!(l.stock&&l.etf)){const y=Vo(u);if(y&&!l.etf||!y&&!l.stock)return!1}if(o&&Number(c.premium||0)<o||l.mktCapLt075T&&!(h.market_cap&&h.market_cap<75e10)||l.sweepOnly&&c.classification!=="sweep"||l.unusualOnly&&!(c.is_golden_sweep||c.classification==="sweep"||c.classification==="block")||l.only0dte&&Number(c.dte)!==0||l.exclude0dte&&Number(c.dte)===0||l.weeklyOnly&&!Yl(c.expiry)||l.excludeWeekly&&Yl(c.expiry)||l.earningsOnly&&!Yo(h.next_earnings,14)||l.showExDiv&&!h.has_dividend)return!1;if((l.itm||l.otm)&&c.spot!=null&&c.strike!=null){const y=m?c.spot>c.strike:c.spot<c.strike;if(l.itm&&!l.otm&&!y||l.otm&&!l.itm&&y)return!1}if(l.sectorsOff?.length){const y=ri(u);if(y&&l.sectorsOff.includes(y))return!1}return!(l.expStart&&c.expiry<l.expStart||l.expEnd&&c.expiry>l.expEnd||l.wlOnly&&!d.has(u)||l.wlOmit&&d.has(u))})}const ce=({on:n,label:l,onClick:s,note:i})=>e.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",gap:8,padding:"3px 0",width:"100%",background:"none",border:"none",cursor:"pointer",color:t.text,fontSize:12.5,textAlign:"left"},children:[e.jsx("span",{style:{width:15,height:15,borderRadius:4,flexShrink:0,border:`1.5px solid ${n?t.green:t.border2}`,background:n?t.green:"transparent",display:"flex",alignItems:"center",justifyContent:"center",color:"#000",fontSize:11,fontWeight:900},children:n?"â":""}),e.jsxs("span",{children:[l,i&&e.jsxs("span",{style:{color:t.dim,fontSize:10},children:[" · ",i]})]})]}),De=({title:n,children:l})=>e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,color:t.muted,letterSpacing:.5,marginBottom:6,textTransform:"uppercase"},children:n}),l]});function Ko({value:n,onSave:l,onClose:s,view:i="flow"}){const{t:o}=W(),[r,a]=$.useState({...un,...n}),[p,d]=$.useState([]),[c,u]=$.useState(""),h=x=>a(j=>({...j,[x]:!j[x]})),m=(x,j)=>a(_=>({..._,[x]:_[x].includes(j)?_[x].filter(E=>E!==j):[..._[x],j]})),y={background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"6px 8px",fontFamily:k,fontSize:12,width:"100%"},b={background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"6px 8px",fontFamily:k,fontSize:12},f=()=>Pl(i).then(x=>d(x?.filters||[])).catch(()=>{});$.useEffect(()=>{let x=!0;return Pl(i).then(j=>{x&&d(j?.filters||[])}).catch(()=>{}),()=>{x=!1}},[i]);const w=x=>{const j=p.find(_=>_.name===x);j&&a({...un,...j.filter_json||{}})},v=async()=>{const x=c.trim();if(x)try{await Gi(i,x,r),u(""),await f()}catch{}},g=async x=>{if(x)try{await Yi(i,x),await f()}catch{}};return Et.createPortal(e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},onClick:s,children:e.jsxs("div",{onClick:x=>x.stopPropagation(),style:{width:920,maxWidth:"94vw",maxHeight:"90vh",overflow:"auto",background:t.panel,border:`1px solid ${t.border2}`,borderRadius:12,padding:22,color:t.text},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:18},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800},children:o("markets.flowFilters.title")}),e.jsx("button",{className:"sa-x",onClick:s,style:{marginLeft:"auto",background:"none",border:"none",color:t.muted,fontSize:20,cursor:"pointer"},children:"Ã"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:28},children:[e.jsxs("div",{children:[e.jsxs(De,{title:o("markets.flowFilters.sectionOptionType"),children:[e.jsx(ce,{on:r.puts,label:o("markets.flowFilters.puts"),onClick:()=>h("puts")}),e.jsx(ce,{on:r.calls,label:o("markets.flowFilters.calls"),onClick:()=>h("calls")})]}),e.jsxs(De,{title:o("markets.flowFilters.sectionFlowColors"),children:[e.jsx(ce,{on:!r.colorsOff.includes("yellow"),label:o("markets.flowFilters.yellow"),note:"single/split",onClick:()=>m("colorsOff","yellow")}),e.jsx(ce,{on:!r.colorsOff.includes("white"),label:o("markets.flowFilters.white"),note:"block",onClick:()=>m("colorsOff","white")}),e.jsx(ce,{on:!r.colorsOff.includes("magenta"),label:o("markets.flowFilters.magenta"),note:"sweep",onClick:()=>m("colorsOff","magenta")})]}),e.jsxs(De,{title:o("markets.flowFilters.sectionBidAsk"),children:[e.jsx(ce,{on:r.aboveAsk,label:o("markets.flowFilters.aboveAsk"),onClick:()=>h("aboveAsk")}),e.jsx(ce,{on:r.belowBid,label:o("markets.flowFilters.belowBid"),onClick:()=>h("belowBid")}),e.jsx(ce,{on:r.atAboveAsk,label:o("markets.flowFilters.atOrAboveAsk"),onClick:()=>h("atAboveAsk")}),e.jsx(ce,{on:r.atBelowBid,label:o("markets.flowFilters.atOrBelowBid"),onClick:()=>h("atBelowBid")})]}
1),e.jsxs(De,{title:o("markets.flowFilters.sectionDetails"),children:[e.jsx(ce,{on:r.addMultileg,label:o("markets.flowFilters.addMultileg"),onClick:()=>h("addMultileg")}),e.jsx(ce,{on:r.onlyMultileg,label:o("markets.flowFilters.onlyMultileg"),onClick:()=>h("onlyMultileg")}),e.jsx(ce,{on:r.priceLte050,label:o("markets.flowFilters.contractLeHalf"),onClick:()=>h("priceLte050")}),e.jsx(ce,{on:r.priceLte5,label:o("markets.flowFilters.contractLeFive"),onClick:()=>h("priceLte5")}),e.jsx(ce,{on:r.ctr100,label:o("markets.flowFilters.ge100Contracts"),onClick:()=>h("ctr100")}),e.jsx(ce,{on:r.ctr500,label:o("markets.flowFilters.ge500Contracts"),onClick:()=>h("ctr500")}),e.jsx(ce,{on:r.ctr5000,label:o("markets.flowFilters.ge5000Contracts"),onClick:()=>h("ctr5000")})]})]}),e.jsxs("div",{children:[e.jsxs(De,{title:o("markets.flowFilters.sectionSecurityType"),children:[e.jsx(ce,{on:r.stock,label:o("markets.flowFilters.stock"),onClick:()=>h("stock")}),e.jsx(ce,{on:r.etf,label:o("markets.flowFilters.etf"),onClick:()=>h("etf")})]}),e.jsxs(De,{title:o("markets.flowFilters.sectionValue"),children:[e.jsx(ce,{on:r.prem50k,label:o("markets.flowFilters.ge50k"),onClick:()=>h("prem50k")}),e.jsx(ce,{on:r.prem100k,label:o("markets.flowFilters.ge100k"),onClick:()=>h("prem100k")}),e.jsx(ce,{on:r.prem200k,label:o("markets.flowFilters.ge200k"),onClick:()=>h("prem200k")}),e.jsx(ce,{on:r.prem500k,label:o("markets.flowFilters.ge500k"),onClick:()=>h("prem500k")}),e.jsx(ce,{on:r.prem1m,label:o("markets.flowFilters.ge1mil"),onClick:()=>h("prem1m")}),e.jsx(ce,{on:r.mktCapLt075T,label:o("markets.flowFilters.ltSmallCap"),onClick:()=>h("mktCapLt075T")})]}),e.jsxs(De,{title:o("markets.flowFilters.sectionOther"),children:[e.jsx(ce,{on:r.itm,label:o("markets.flowFilters.inTheMoney"),onClick:()=>h("itm")}),e.jsx(ce,{on:r.otm,label:o("markets.flowFilters.outTheMoney"),onClick:()=>h("otm")}),e.jsx(ce,{on:r.sweepOnly,label:o("markets.flowFilters.sweepOnly"),onClick:()=>h("sweepOnly")}),e.jsx(ce,{on:r.weeklyOnly,label:o("markets.flowFilters.weeklyOnly"),onClick:()=>h("weeklyOnly")}),e.jsx(ce,{on:r.excludeWeekly,label:o("markets.flowFilters.excludeWeekly"),onClick:()=>h("excludeWeekly")}),e.jsx(ce,{on:r.only0dte,label:o("markets.flowFilters.only0dte"),onClick:()=>h("only0dte")}),e.jsx(ce,{on:r.exclude0dte,label:o("markets.flowFilters.exclude0dte"),onClick:()=>h("exclude0dte")}),e.jsx(ce,{on:r.unusualOnly,label:o("markets.flowFilters.unusualOnly"),onClick:()=>h("unusualOnly")}),e.jsx(ce,{on:r.earningsOnly,label:o("markets.flowFilters.earningsOnly"),note:"â¤14d",onClick:()=>h("earningsOnly")}),e.jsx(ce,{on:r.showExDiv,label:o("markets.flowFilters.showExDiv"),note:"pays div",onClick:()=>h("showExDiv")})]})]}),e.jsxs("div",{children:[e.jsx(De,{title:o("markets.flowFilters.sectionSectors"),children:Bo.map(x=>e.jsx(ce,{on:!r.sectorsOff.includes(x),label:x,onClick:()=>m("sectorsOff",x)},x))}),e.jsxs(De,{title:o("markets.flowFilters.sectionExpiration"),children:[e.jsx("div",{style:{fontSize:10,color:t.muted,marginBottom:2},children:o("markets.flowFilters.startDate")}),e.jsx("input",{type:"date",value:r.expStart,onChange:x=>a(j=>({...j,expStart:x.target.value})),style:y}),e.jsx("div",{style:{fontSize:10,color:t.muted,margin:"6px 0 2px"},children:o("markets.flowFilters.endDate")}),e.jsx("input",{type:"date",value:r.expEnd,onChange:x=>a(j=>({...j,expEnd:x.target.value})),style:y})]}),e.jsxs(De,{title:o("markets.flowFilters.sectionWatchList"),children:[e.jsx(ce,{on:r.wlOmit,label:o("markets.flowFilters.omit"),onClick:()=>h("wlOmit")}),e.jsx(ce,{on:r.wlOnly,label:o("markets.flowFilters.only"),onClick:()=>h("wlOnly")})]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:16,borderTop:`1px solid ${t.border2}`,paddingTop:16,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11,color:t.muted,fontWeight:800,letterSpacing:.5},children:o("markets.flowFilters.presets")}),e.jsxs("select",{value:"",onChange:x=>w(x.target.value),style:b,children:[e.jsx("option",{value:"",children:o("markets.flowFilters.loadPreset")}),p.map(x=>e.jsx("option",{value:x.name,children:x.name},x.id))]}),e.jsx("input",{value:c,onChange:x=>u(x.target.value),placeholder:o("markets.flowFilters.presetNamePlaceholder"),style:{...b,width:120}}),e.jsx("button",{onClick:v,style:Qt(t.blue,"rgba(57,141,255,0.14)"),children:o("markets.flowFilters.savePreset")}),p.length>0&&e.jsxs("select",{value:"",onChange:x=>g(x.target.value),style:b,children:[e.jsx("option",{value:"",children:"Deleteâ¦"}),p.map(x=>e.jsx("option",{value:x.name,children:x.name},x.id))]}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:()=>l(r),style:Qt(t.green,"rgba(110,210,90,0.18)"),children:o("markets.flowFilters.apply")}),e.jsx("button",{onClick:()=>a(un),style:Qt(t.muted,"transparent"),children:o("markets.flowFilters.reset")}),e.jsx("button",{onClick:s,style:Qt(t.muted,"transparent"),children:o("markets.flowFilters.cancel")})]})]})}),document.body)}const Qt=(n,l)=>({fontSize:13,fontWeight:700,padding:"7px 18px",borderRadius:7,cursor:"pointer",border:`1px solid ${n}`,background:l,color:n});function oi({limit:n=12}){const{t:l}=W(),{data:s,lastUpdated:i}=H(()=>Xi(n),3e3,[n]),o=s&&s.pressure||[];if(!o.length)return null;const r=Math.max(...o.map(c=>Number(c.ts)||0)),a=r>0?r/1e6:null,p=Math.min(a??1/0,i??1/0),d=isFinite(p)?Date.now()-p:1/0;return e.jsxs("div",{style:{border:`1px solid ${t.border2}`,borderRadius:8,background:t.panel2,padding:"8px 10px",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:7},children:[e.jsx("span",{style:{fontSize:11,fontWeight:800,color:t.text},children:l("markets.pressureStrip.title")}),e.jsx("span",{style:{fontSize:9.5,color:t.dim,marginLeft:6},children:l("markets.pressureStrip.subtitle")}),e.jsx("span",{style:{marginLeft:"auto"},children:e.jsx(Ut,{ageMs:d,staleS:12})})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"7px 10px"},children:o.map(c=>e.jsx(qo,{d:c},c.symbol))})]})}function qo({d:n}){const{t:l}=W(),s=Math.max(-100,Math.min(100,Number(n.pressure)||0)),i=s>=0,o=i?t.green:t.red,r=Math.abs(s)/2,a=l("markets.pressureStrip.tooltip",{symbol:n.symbol,pressure:s>0?`+${s}
1`:String(s),bull:Math.round(n.bull_premium||0).toLocaleString(),bear:Math.round(n.bear_premium||0).toLocaleString(),prints:n.prints});return e.jsxs("div",{style:{width:134,fontSize:10},title:a,children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:2},children:[e.jsx("span",{style:{fontWeight:800,color:t.text},children:n.symbol}),e.jsxs("span",{style:{fontFamily:k,color:o,fontWeight:700},children:[s>0?"+":"",s]})]}),e.jsxs("div",{style:{position:"relative",height:6,background:t.bg,borderRadius:3,overflow:"hidden"},children:[e.jsx("div",{style:{position:"absolute",left:"50%",top:0,bottom:0,width:1,background:t.border}}),e.jsx("div",{style:{position:"absolute",top:0,bottom:0,background:o,left:i?"50%":`${50-r}%`,width:`${r}%`}})]})]})}const zn={fontFamily:k,fontSize:8.5,letterSpacing:"0.14em",color:t.dim,display:"flex",alignItems:"center",gap:5},Gt={fontFamily:k,fontSize:11.5,fontWeight:800,marginTop:5,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function Qo({bullPct:n,net:l}){const{t:s}=W(),i=Math.max(0,Math.min(100,Number(n)||0)),o=(l??0)>=0,r=Math.abs(i-50);return e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:zn,children:[s("markets.flowPulse.flowSentiment")," ",e.jsx(ie,{topic:"flow-beam",title:s("markets.flowPulse.infoBeamTitle"),what:s("markets.flowPulse.infoBeamWhat"),how:s("markets.flowPulse.infoBeamHow"),size:12})]}),e.jsxs("div",{style:{position:"relative",height:14,marginTop:6,background:t.elev,borderRadius:4,overflow:"hidden"},children:[e.jsx("div",{style:{position:"absolute",left:"50%",top:0,bottom:0,width:2,background:t.border2,zIndex:2}}),e.jsx("div",{style:{position:"absolute",top:2,bottom:2,borderRadius:3,left:i>=50?"50%":`${50-r}%`,width:`${r}%`,background:i>=50?"linear-gradient(90deg, rgba(55,209,131,0.25), rgba(55,209,131,0.85))":"linear-gradient(270deg, rgba(240,82,79,0.25), rgba(240,82,79,0.85))"}}),e.jsx("div",{style:{position:"absolute",top:0,bottom:0,width:2,left:`calc(${i}% - 1px)`,background:t.gold,boxShadow:"0 0 6px rgba(210,162,76,0.8)",zIndex:3}})]}),e.jsxs("div",{style:{...Gt,color:o?t.green:t.red},children:[s(o?"markets.flowPulse.bull":"markets.flowPulse.bear")," ",Math.round(i),"%",e.jsxs("span",{style:{color:t.dim,fontWeight:400},children:[" · net ",l>=0?"+":"",ee(l||0)]})]})]})}function Zo({pcr:n}){const{t:l}=W(),s=n!=null?Math.max(0,Math.min(2,Number(n))):null,i=s==null?"â":s<=.8?l("markets.flowPulse.callHeavy"):s>=1.2?l("markets.flowPulse.putHeavy"):l("markets.flowPulse.balanced"),o=s==null?t.dim:s<=.8?t.green:s>=1.2?t.red:t.muted;return e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:zn,children:["PUT / CALL ",e.jsx(ie,{topic:"flow-pc",title:l("markets.flowPulse.infoPcTitle"),what:l("markets.flowPulse.infoPcWhat"),how:l("markets.flowPulse.infoPcHow"),size:12})]}),e.jsxs("div",{style:{position:"relative",height:14,marginTop:6,borderRadius:4,overflow:"hidden",display:"flex"},children:[e.jsx("div",{style:{width:"40%",background:"rgba(55,209,131,0.16)"}}),e.jsx("div",{style:{width:"20%",background:"rgba(210,162,76,0.14)"}}),e.jsx("div",{style:{width:"40%",background:"rgba(240,82,79,0.16)"}}),[.8,1.2].map(r=>e.jsx("div",{style:{position:"absolute",top:0,bottom:0,width:1,left:`${r/2*100}%`,background:t.border2}},r)),s!=null&&e.jsx("div",{style:{position:"absolute",top:0,bottom:0,width:2,left:`calc(${s/2*100}% - 1px)`,background:t.gold,boxShadow:"0 0 6px rgba(210,162,76,0.8)"}})]}),e.jsxs("div",{style:{...Gt,color:o},children:[s!=null?R(n,2):"â",e.jsxs("span",{style:{color:t.dim,fontWeight:400},children:[" · ",i,s!=null&&(s<=.8||s>=1.2)?" · extreme = contrarian":""]})]})]})}function Jo({callP:n,putP:l}){const{t:s}=W(),i=Math.max(0,Number(n)||0),o=Math.max(0,Number(l)||0),r=i+o,a=r>0?i/r*100:50;return e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:zn,children:[s("markets.flowPulse.premiumTraded")," ",e.jsx(ie,{topic:"flow-split",title:s("markets.flowPulse.infoSplitTitle"),what:s("markets.flowPulse.infoSplitWhat"),how:s("markets.flowPulse.infoSplitHow"),size:12})]}),e.jsx("div",{style:{position:"relative",height:14,marginTop:6,borderRadius:4,overflow:"hidden",display:"flex",background:t.elev},children:r>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:`${a}%`,background:"linear-gradient(90deg, rgba(55,209,131,0.8), rgba(55,209,131,0.45))"}}),e.jsx("div",{style:{width:`${100-a}%`,background:"linear-gradient(90deg, rgba(240,82,79,0.45), rgba(240,82,79,0.8))"}})]})}),e.jsxs("div",{style:{...Gt,color:t.text},children:[ee(r),e.jsxs("span",{style:{color:t.green,fontWeight:700},children:[" C ",ee(i)]}),e.jsxs("span",{style:{color:t.red,fontWeight:700},children:[" P ",ee(o)]})]})]})}function ea({k:n,stats:l}){const{t:s}=W(),i=l?.maxP;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:14,marginBottom:8,background:"#10141A",border:"1px solid rgba(210,162,76,0.14)",borderRadius:10,padding:"9px 14px 10px"},children:[e.jsx(Qo,{bullPct:n?.bullPct,net:n?.net}),e.jsx(Zo,{pcr:n?.pcr}),e.jsx(Jo,{callP:n?.callP,putP:n?.putP}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:zn,children:s("markets.flowPulse.prints")}),e.jsxs("div",{style:{...Gt,marginTop:7,color:i?i.cp==="P"?t.red:t.green:t.dim},children:[i?`${i.sym} ${i.cp} ${ee(i.prem)}`:"â",e.jsx("span",{style:{color:t.dim,fontWeight:400},children:" · biggest"})]}),e.jsxs("div",{style:{...Gt,marginTop:3,color:(l?.golden||0)>0?t.gold:t.dim},children:[String(l?.golden??0),e.jsx("span",{style:{color:t.dim,fontWeight:400},children:" · golden sweeps"})]})]})]})}const qe={fontFamily:k,fontSize:8.5,letterSpacing:"0.14em",color:t.dim,display:"flex",alignItems:"center",gap:5},st={fontFamily:k,fontSize:12,fontWeight:800,marginTop:5,whiteSpace:"nowrap"},it={fontFamily:k,fontSize:8.5,color:t.dim,marginTop:3};function ai({ctx:n,sue:l}){const s=n?.internals||{},i=n?.intermarket||{},o=n?.vol_structure||{},r=n?.rel_strength||{},a=n?.iv_skew||{},p=n?.risk_regime||{},d=l||{},c=n?.short||{},u=y=>y==null?t.dim:y>0?t.green:y<0?t.red:t.muted,h=(y,b=1)=>y==null?"â":`${y>0?"+":""}${R(y,b)}`,m=o.vrp_state==="rich"?t.gold:o.vrp_state==="cheap"?t.blue:t.dim;return e.jsxs("div",{style:{background:"#10141A",border:"1px solid rgba(210,162,76,0.14)",borderRadius:10,padding:"9px 14px",marginBottom:8},children:[e.jsxs("div",{style:{...qe,marginBottom:8},children:["MARKET CONTEXT",e.jsx(ie,{topic:"mkt-context",title:"Market Context",size:12,what:"High-end confirmation reads for this underlying: the VOLATILITY RISK PREMIUM (options vol rich vs cheap), broad-market BREADTH ($ADD/$VOLD), the INTERMARKET risk backdrop (VIX + term structure + dollar), RELATIVE STRENGTH vs SPY, 25-delta IV SKEW, and EARNINGS SUE â plus a composite RISK-ON/OFF regime dial.",how:"Read the REGIME first (it says what environment you are in). VRP rich = options expensive, favors premium-selling / fading vol; cheap = convexity underpriced. Rel-strength leaders + confirming breadth/intermarket raise conviction. EARNINGS SUE (·TS) is a TIME-SERIES
1surprise from free SEC EDGAR actuals vs a seasonal-random-walk expectation (Bernard-Thomas PEAD method), NOT analyst consensus, and it lands with the 10-Q/10-K filing (after the announcement). Context to size and time by, not a standalone trade."}),p.available&&e.jsxs("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:10,fontWeight:800,color:p.read==="RISK-ON"?t.green:p.read==="RISK-OFF"?t.red:t.gold},children:["REGIME · ",p.read," ",p.pct]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(155px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:qe,children:"VOL RISK PREMIUM"}),e.jsx("div",{style:{...st,color:m},children:o.available?`${h(o.vrp)} · ${(o.vrp_state||"").toUpperCase()}`:"â"}),e.jsx("div",{style:it,children:o.available?`IV ${R(o.iv_30d,1)} vs HV ${R(o.hv_30d,1)} · IVR ${o.iv_rank!=null?Math.round(o.iv_rank):"â"}`:""})]}),e.jsxs("div",{children:[e.jsxs("div",{style:qe,children:["BREADTH",s.scope?` · ${s.scope}`:""]}),e.jsx("div",{style:{...st,color:u(s.lean)},children:s.available?s.lean>0?"UP":s.lean<0?"DOWN":"MIXED":"â"}),e.jsx("div",{style:it,children:s.available?`adv ${s.adv!=null?Math.round(s.adv):"â"} / dec ${s.dec!=null?Math.round(s.dec):"â"}${s.dix_z!=null?` · DIX z ${h(s.dix_z,1)}`:""}`:s.note||""})]}),e.jsxs("div",{children:[e.jsx("div",{style:qe,children:"INTERMARKET"}),e.jsx("div",{style:{...st,color:u(i.lean)},children:i.available?(i.read||"â").toUpperCase():"â"}),e.jsx("div",{style:it,children:i.available?`VIX ${R(i.vix,1)} ${i.vix_state||""}${i.vix_term_state?" · "+i.vix_term_state:""} · $ ${R(i.dxy,1)}${i.credit?` · credit ${i.credit.read}`:""}`:""})]}),e.jsxs("div",{children:[e.jsx("div",{style:qe,children:"REL STRENGTH vs SPY"}),e.jsx("div",{style:{...st,color:u(r.lean)},children:r.available?`${h(r.rs_3m)}% 3M ${r.rs_trend>0?"â":r.rs_trend<0?"â":""}`:r.note==="benchmark"?"BENCHMARK":"â"}),e.jsx("div",{style:it,children:r.available?`1M ${h(r.rs_1m)} · 6M ${h(r.rs_6m)}`:""})]}),e.jsxs("div",{children:[e.jsx("div",{style:qe,children:"IV SKEW (25Î)"}),e.jsx("div",{style:{...st,color:a.skew>3?t.gold:a.skew<-1.5?t.blue:t.dim},children:a.available?`${h(a.skew)} · ${(a.state||"").toUpperCase()}`:"â"}),e.jsx("div",{style:it,children:a.available?`put ${R(a.put_iv_25,1)} vs call ${R(a.call_iv_25,1)} · ${a.dte}d`:""})]}),e.jsxs("div",{children:[e.jsxs("div",{style:qe,children:["EARNINGS SUE ",e.jsx("span",{style:{color:t.dim,opacity:.7},children:"· TS"})]}),e.jsx("div",{style:{...st,color:d.sue>.5?t.green:d.sue<-.5?t.red:t.dim},children:d.available?`${h(d.sue,2)} · ${(d.state||"").toUpperCase()}`:"â"}),e.jsx("div",{style:it,children:d.available?`EPS ${R(d.latest_eps,2)} · Îyoy ${h(d.yoy_eps_chg,2)} · ${d.as_of||""}`:""})]}),e.jsxs("div",{children:[e.jsx("div",{style:qe,children:"SHORT INTEREST"}),e.jsx("div",{style:{...st,color:c.crowded?t.red:c.available?t.text:t.dim},children:c.available&&c.days_to_cover!=null?`DTC ${R(c.days_to_cover,1)}${c.crowded?" · CROWDED":""}`:"â"}),e.jsx("div",{style:it,children:c.available?`short-vol ${c.short_ratio!=null?Math.round(c.short_ratio*100):"â"}%${c.sv_elevated?"â":""}${c.si_chg_pct!=null?` · SIÎ ${h(c.si_chg_pct)}
1%`:""}`:""})]})]})]})}const Xl=n=>n==null?"â":n>=1e3?n.toFixed(0):n.toFixed(2);function ta({data:n}){const{t:l}=W(),s=n||{},i=s.calibration,o=s.band_lo!=null&&s.band_hi!=null&&s.spot!=null,r=s.band_source==="warehouse_iv_1d"?l("markets.moveForecast.srcEod",{defaultValue:"LAST EOD IV"}):l("markets.moveForecast.srcLive",{defaultValue:"ATM STRADDLE"});return e.jsxs("div",{style:{margin:"0 2px 10px",padding:"10px 12px",background:t.panel,border:`1px solid ${t.line}`,borderRadius:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:6},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.12em",color:t.muted},children:l("markets.moveForecast.title",{defaultValue:"MOVE FORECAST · NEXT SESSION"})}),e.jsx(ie,{topic:"move forecast",size:14}),o&&e.jsx("span",{style:{fontFamily:k,fontSize:7.5,fontWeight:800,letterSpacing:"0.08em",color:s.band_source==="warehouse_iv_1d"?"#E0C27A":t.dim,background:s.band_source==="warehouse_iv_1d"?"rgba(210,162,76,0.10)":"transparent",border:`1px solid ${s.band_source==="warehouse_iv_1d"?"rgba(210,162,76,0.3)":t.line}`,borderRadius:4,padding:"1px 6px"},children:r}),s.gamma_regime&&e.jsx("span",{style:{fontFamily:k,fontSize:7.5,fontWeight:800,letterSpacing:"0.08em",color:s.gamma_regime==="amplified"?t.red:t.green,border:`1px solid ${t.line}`,borderRadius:4,padding:"1px 6px"},children:s.gamma_regime==="amplified"?l("markets.moveForecast.regimeAmp",{defaultValue:"âγ AMPLIFIED"}):l("markets.moveForecast.regimeSup",{defaultValue:"+γ SUPPRESSED"})})]}),o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,marginBottom:6},children:[e.jsxs("span",{style:{fontFamily:k,fontSize:18,fontWeight:800,color:t.text},children:["±",Number(s.expected_move_pct).toFixed(2),"%"]}),e.jsxs("span",{style:{fontFamily:k,fontSize:10,color:t.dim},children:[Xl(s.band_lo)," â ",Xl(s.band_hi)]})]}),e.jsxs("div",{style:{position:"relative",height:14,margin:"2px 0 8px"},children:[e.jsx("div",{style:{position:"absolute",left:0,right:0,top:6,height:2,background:t.line,borderRadius:1}}),e.jsx("div",{style:{position:"absolute",left:"8%",right:"8%",top:4,height:6,background:"linear-gradient(90deg, rgba(210,162,76,0.25), rgba(210,162,76,0.06) 50%, rgba(210,162,76,0.25))",border:"1px solid rgba(210,162,76,0.35)",borderRadius:3}}),e.jsx("div",{style:{position:"absolute",left:"50%",top:0,width:2,height:14,background:t.text,transform:"translateX(-1px)"}})]}),s.calibrated&&e.jsxs("div",{style:{fontFamily:k,fontSize:8.5,color:t.dim,margin:"0 0 8px"},title:l("markets.moveForecast.measuredTip",{defaultValue:"Measured on 9 years of our own options warehouse: what the priced move actually realized"}),children:[e.jsx("span",{style:{color:"#E0C27A",fontWeight:800},children:l("markets.moveForecast.measured",{defaultValue:"MEASURED"})})," ","±",Number(s.calibrated.typical_move_pct).toFixed(2),"% ",l("markets.moveForecast.typical",{defaultValue:"typical"})," · ",l("markets.moveForecast.p80",{defaultValue:"80% of days inside"})," ±",Number(s.calibrated.p80_move_pct).toFixed(2),"%"," · ",l("markets.moveForecast.held",{defaultValue:"priced band held"})," ",Math.round(100*(s.calibrated.straddle_coverage||0)),"%"," ","(n=",s.calibrated.n_days,s.calibrated.source==="index_etf_default"?" · "+l("markets.moveForecast.etfDefault",{defaultValue:"ETF-derived"}):"",")"]})]}):e.jsx("div",{style:{fontFamily:k,fontSize:9.5,color:t.dim,margin:"4px 0 8px"},children:l("markets.moveForecast.noBand",{defaultValue:"no implied band yet: populates while the name trades and is enriched"})}),i?e.jsxs("div",{style:{display:"grid",gap:3},children:[e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.muted},children:l("markets.moveForecast.recHit",{defaultValue:"RECEIPTS ({{n}} sessions {{from}} â {{to}}): band held {{pct}}% of days",n:i.n_days,from:i.from,to:i.to,pct:(i.hit_rate_1sd*100).toFixed(1)})}),i.iv_premium_ratio!=null&&e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.muted},children:l("markets.moveForecast.recPremium",{defaultValue:"options overprice the typical move Ã{{r}} (median implied ÷ median realized)",r:i.iv_premium_ratio})}),i.neg_gamma_hit_rate!=null&&e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.muted},children:l("markets.moveForecast.recNegGamma",{defaultValue:"on âγ days ({{n}}): band held {{pct}}%, moves ran Ã{{amp}} larger",n:i.neg_gamma_days,pct:(i.neg_gamma_hit_rate*100).toFixed(1),amp:i.neg_gamma_move_amplification??"â"})})]}):e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.dim},children:l("markets.moveForecast.calibPending",{defaultValue:"calibration pending: this symbolâs options history is still downloading"})}),e.jsx("div",{style:{fontFamily:k,fontSize:7.5,color:t.dim,marginTop:6,opacity:.8},children:l("markets.moveForecast.honesty",{defaultValue:"size of the move only: options do not reliably predict direction, and this panel never claims one"})})]})}const jn=(n,l=!1)=>
1{if(!n)return"â";try{const s=new Date(n);return Number.isNaN(s.getTime())?String(n).slice(0,10):s.toLocaleString("en-US",l?{month:"short",day:"numeric",timeZone:"America/New_York"}:{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:"America/New_York"})}catch{return String(n)}},na=n=>n==null?t.dim:n>=1.2?t.red:n<=.8?t.green:t.muted,Gn=n=>n?.type==="regime_transition"?t.red:n?.type==="fresh_wall"?t.amber:n?.type==="wall_migration"?t.blue:t.muted,la=n=>{const l=Number(n);if(!Number.isFinite(l))return"â";const s=Math.abs(l);return s>=1e9?`${l>=0?"+":"â"}${(s/1e9).toFixed(1)}B`:s>=1e6?`${l>=0?"+":"â"}${(s/1e6).toFixed(1)}M`:s>=1e3?`${l>=0?"+":"â"}${(s/1e3).toFixed(0)}K`:`${l>=0?"+":"â"}${s.toFixed(0)}`},sa=({item:n})=>{const l={gex:`GEX ${ee(n.value)}`,oi:`OI ${je(n.value)}`,oi_change:`ÎOI ${la(n.value)}`,live_flow:`FLOW ${ee(n.value)}`},s=n.type==="oi_change"?Number(n.value)>=0?t.green:t.red:n.type==="live_flow"?Number(n.value)>=0?t.green:t.red:t.dim;return e.jsx("span",{style:{fontFamily:k,fontSize:8,color:s,border:`1px solid ${t.border2}`,borderRadius:4,padding:"1px 4px",whiteSpace:"nowrap"},children:l[n.type]||n.type})},Yn=({title:n,levels:l,color:s})=>e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:8.5,fontWeight:800,letterSpacing:"0.1em",color:s,marginBottom:4},children:n}),e.jsxs("div",{style:{display:"grid",gap:4},children:[(l||[]).map((i,o)=>e.jsxs("div",{style:{padding:"5px 7px",borderRadius:6,background:o===0?`${s}0D`:"rgba(255,255,255,0.015)",border:`1px solid ${o===0?`${s}55`:t.border}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[e.jsx("span",{style:{fontFamily:k,color:o===0?s:t.text,fontSize:12,fontWeight:800},children:R(i.strike,2)}),e.jsxs("span",{style:{fontFamily:k,color:t.dim,fontSize:8.5},children:[i.distance_pct>=0?"+":"",R(i.distance_pct,2),"% · score ",R(i.score,0)]})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3,marginTop:3},children:(i.evidence||[]).slice(0,4).map((r,a)=>e.jsx(sa,{item:r},`${r.type}-${a}`))})]},`${n}-${i.strike}`)),!l?.length&&e.jsx("span",{style:{fontSize:9,color:t.dim},children:"awaiting matched surface"})]})]}),Kl=({label:n,value:l,put:s,call:i,asOf:o,basis:r,source:a})=>e.jsxs("div",{title:`${r||"measured"}${a?` · ${a}`:""} · put ${s==null?"â":je(s)} / call ${i==null?"â":je(i)} · as of ${jn(o,!0)}`,style:{border:`1px solid ${t.border}`,borderRadius:7,padding:"6px 8px",minWidth:116},children:[e.jsx("div",{style:{fontSize:8,fontWeight:800,color:t.dim,letterSpacing:"0.08em"},children:n}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,marginTop:1},children:[e.jsx("span",{style:{fontFamily:k,fontSize:15,fontWeight:800,color:na(l)},children:l==null?"â":R(l,2)}),e.jsx("span",{style:{fontFamily:k,fontSize:8,color:t.dim},children:jn(o,!0)})]})]});function di({symbol:n="SPY",compact:l=!1}){const{data:s}=H(()=>Ki(String(n||"SPY").toUpperCase()).catch(()=>null),6e4,[n]);if(!s)return null;const i=s.brief||{},o=s.ratios?.open_interest||{},r=s.ratios?.session_volume||{},a=s.coverage||{},p=Number(i.confidence||0),d=p>=75?t.green:p>=45?t.amber:t.dim;return e.jsxs("section",{"aria-label":`${s.underlying||n} positioning change`,style:{border:`1px solid ${t.border}`,borderLeft:`3px solid ${d}`,borderRadius:9,background:t.panel,padding:l?"8px 10px":"10px 12px",marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:9,fontWeight:900,letterSpacing:"0.13em",color:"#D2A24C"},children:["POSITIONING CHANGE · ",s.underlying||String(n).toUpperCase()]}),e.jsx(ie,{topic:"positioning change",size:14}),e.jsxs("span",{style:{fontFamily:k,fontSize:8,color:t.dim},children:[jn(s.compare_to)," â ",jn(s.as_of)]}),e.jsxs("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:8,color:d,border:`1px solid ${d}55`,borderRadius:5,padding:"2px 6px"},children:["MATCH ",R(p,0),"%"]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:l?"minmax(0,1fr)":"minmax(0,1fr) auto",gap:10,alignItems:"start",marginTop:6},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:13,color:t.text,fontWeight:800,lineHeight:1.35},children:i.headline}),e.jsxs("div",{style:{display:"flex",gap:5,flexWrap:"wrap",marginTop:5},children:[(s.events||[]).slice(0,l?2:4).map((c,u)=>e.jsx("span",{title:`${c.basis||""}`,style:{color:Gn(c),background:`${Gn(c)}10`,border:`1px solid ${Gn(c)}55`,borderRadius:5,padding:"2px 6px",fontFamily:k,fontSize:8.5},children:c.title},`${c.type}-${c.side||""}-${u}`)),!s.events?.length&&e.jsx("span",{style:{color:t.dim,fontFamily:k,fontSize:8.5},children:"no material structure transition measured"})]})]}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.jsx(Kl,{label:"OI PUT / CALL",value:o.ratio,put:o.put,call:o.call,asOf:o.as_of,basis:o.basis,source:o.source}),e.jsx(Kl,{label:"SESSION VOL P/C",value:r.ratio,put:r.put,call:r.call,asOf:r.as_of,basis:r.basis,source:r.source})]})]}),!l&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1.2fr) minmax(0,1fr)",gap:10,marginTop:8},children:[e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,paddingTop:6},children:[(i.facts||[]).map((c,u)=>e.jsxs("div",{style:{color:t.muted,fontSize:10.5,lineHeight:1.5},children:[e.jsx("span",{style:{color:c.type.includes("oi_")?t.blue:t.amber},children:"â¢"})," ",c.text]},`${c.type}-${u}`)),!i.facts?.length&&e.jsx("div",{style:{color:t.dim,fontSize:10},children:"Prior-close evidence is still building."})]}),e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,paddingTop:6,fontSize:10.5,lineHeight:1.5},children:[e.jsxs("div",{style:{color:t.text},children:[e.jsx("span",{style:{color:t.blue,fontWeight:800},children:"CONDITION"})," · ",i.scenario]}),e.jsxs("div",{style:{color:t.muted,marginTop:2},children:[e.jsx("span",{style:{color:t.red,fontWeight:800},children:"INVALIDATION"})," · ",i.invalidation]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(180px,1fr))",gap:8,borderTop:`1px solid ${t.border}`,marginTop:8,paddingTop:7},children:[e.jsx(Yn,{title:"SUPPORTS",levels:s.levels?.supports,c
1olor:t.green}),e.jsx(Yn,{title:"MAGNETS",levels:s.levels?.magnets,color:t.blue}),e.jsx(Yn,{title:"CEILINGS",levels:s.levels?.ceilings,color:t.red})]})]}),e.jsxs("div",{style:{marginTop:7,paddingTop:5,borderTop:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",fontFamily:k,fontSize:7.8,color:t.dim},children:[e.jsx("span",{children:"ÎOI = official daily OI, not intraday"}),e.jsx("span",{children:"·"}),e.jsx("span",{children:"ÎGEX = current/last measured vs prior close"}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:["OI matched ",R(a.open_interest?.match_pct,0),"% · GEX matched ",R(a.gex_surface?.match_pct,0),"%"]}),e.jsx("span",{children:"· no participant identity inferred"})]})]})}const ql=n=>`${n.ts_ns}|${n.streamer_symbol}|${n.size}|${n.price}`,ia=n=>n==="sweep"?t.magenta:n==="block"?t.blue:n==="multileg"?t.amber:t.muted,hl="#e6c200",gl="#D2A24C",ra=(n,l)=>l||n==="yellow"?hl:n==="purple"?gl:null,kn=n=>{if(n.dte!=null)return Number(n.dte);if(!n.expiry)return null;const l=new Date(String(n.expiry)+"T00:00:00Z");return isNaN(l)?null:Math.max(0,Math.round((l-Date.now())/864e5))},ci=n=>{const l=Number(n.spot),s=Number(n.strike);return!l||!s?null:(String(n.cp).toUpperCase().startsWith("C")?(s-l)/l:(l-s)/l)*100},wn=n=>{if(n.sentiment)return n.sentiment;const l=String(n.cp).toUpperCase().startsWith("C");return n.side==="at_or_above_ask"?l?"bullish":"bearish":n.side==="at_or_below_bid"?l?"bearish":"bullish":"neutral"},pi=n=>{const l=Number(n.heat)||0,s=wn(n);return s==="bullish"?l:s==="bearish"?-l:0},oa=(n,l)=>{const s=l[String(n.underlying).toUpperCase()]?.iv??n.iv;return s!=null?Number(s):null},Zt=[{k:"time",label:"TIME",align:"right",v:n=>n.ts_ns||0},{k:"tick",label:"TICK",align:"left",v:n=>n.underlying||""},{k:"exp",label:"EXP",align:"right",v:n=>n.expiry||""},{k:"dte",label:"DTE",align:"right",v:n=>kn(n)??9e9},{k:"strike",label:"STRIKE",align:"right",v:n=>Number(n.strike)||0},{k:"cp",label:"C/P",align:"right",v:n=>n.cp||""},{k:"side",label:"SIDE",align:"right",v:n=>n.side||""},{k:"spot",label:"SPOT",align:"right",v:n=>Number(n.spot)||0},{k:"otm",label:"OTM%",align:"right",v:n=>ci(n)??9e9},{k:"size",label:"SIZE",align:"right",v:n=>Number(n.size)||0},{k:"oi",label:"OI",align:"right",v:n=>Number(n.oi)||0},{k:"vol",label:"VOL",align:"right",v:n=>Number(n.day_volume)||0},{k:"price",label:"PRICE",align:"right",v:n=>Number(n.price)||0},{k:"prem",label:"PREM",align:"right",v:n=>Number(n.premium)||0},{k:"iv",label:"IV",align:"right",v:n=>Number(n.iv)||0},{k:"ivrank",label:"IV RANK",align:"right",v:n=>n.iv_rank!=null?Number(n.iv_rank):-1},{k:"type",label:"TYPE",align:"right",v:n=>n.classification||""},{k:"heat",label:"SCORE",align:"right",v:n=>pi(n)}],aa=[{label:"ð $1M+",key:"prem1m"},{label:"â¡ Sweeps",key:"sweepOnly"},{label:"0DTE",key:"only0dte"},{label:"ð¥ Unusual",key:"unusualOnly"}];function da({symbol:n="SPY",preset:l=null,vis:s=null}){const{t:i}=W(),o=Kt(),[r,a]=$.useState([]),[p,d]=$.useState(!1),c=p?String(n).toUpperCase():"all",[u,h]=$.useState("notable"),m=`sa_flow_filters_${l||"flow"}`,[y,b]=$.useState(()=>{let z=null;try{z=JSON.parse(localStorage.getItem(m)||"null")}catch{z=null}return{...un,...z||{},...l==="0dte"?{only0dte:!0}:{}}});$.useEffect(()=>{try{localStorage.setItem(m,JSON.stringify(y))}catch{}},[m,y]);const[f,w]=$.useState(!1),[v,g]=$.useState({k:"time",dir:-1}),{accessToken:x}=wl(),{items:j,connected:_}=El(u==="all"?Xs(c,x):null,"flow",{max:500}),{data:E,lastUpdated:T}=H(()=>$n(p?{limit:300,underlying:c}:{limit:300}),2500,[p,c]);$.useEffect(()=>{if(u!=="all")return;let z=!0;return qi({scope:c,limit:250}).then(N=>{z&&a(N?.tape||[])}).catch(()=>{}),()=>{z=!1}},[c,u]);const S=$.useMemo(()=>{if(u==="notable")return(E?.notable||[]).map(Z=>({...Z,size:Z.total_size??Z.size,premium:Z.total_premium??Z.premium}));const z=new Set,N=[];for(const G of[...j,...r]){const Z=ql(G);z.has(Z)||(z.add(Z),N.push(G))}return N},[u,E,j,r]),C=(()=>{try{return JSON.parse(localStorage.getItem("sa_markets_watchlist")||"[]")}catch{return[]}})(),I=$.useMemo(()=>[...new Set(S.map(z=>
1String(z.underlying||"").toUpperCase()).filter(Boolean))].sort().slice(0,200).join(","),[S]),{data:F}=H(()=>I?Qi(I):Promise.resolve({meta:{}}),3e4,[I]),A=$.useMemo(()=>F?.meta||{},[F]),P=$.useMemo(()=>Xo(S,y,C,A),[S,y,C,A]),V=$.useMemo(()=>{const z=Zt.find(G=>G.k===v.k)||Zt[0],N=[...P];return N.sort((G,Z)=>{const se=z.v(G),le=z.v(Z);return se<le?-v.dir:se>le?v.dir:0}),N.slice(0,300)},[P,v]),J=$.useMemo(()=>{let z=0,N=0,G=0,Z=0,se=0,le=0;for(const K of P){const M=Number(K.premium||0),ne=Number(K.size||0);String(K.cp).toUpperCase().startsWith("C")?(z+=M,se+=ne):(N+=M,le+=ne);const ue=wn(K);ue==="bullish"?G+=M:ue==="bearish"&&(Z+=M)}const de=G+Z;return{callP:z,putP:N,bull:G,bear:Z,net:G-Z,bullPct:de?G/de*100:50,pcr:se?le/se:null}},[P]),Q=$.useMemo(()=>{let z=null,N=0;for(const G of P){const Z=Number(G.premium||0);(!z||Z>z.prem)&&(z={prem:Z,sym:String(G.underlying||"").toUpperCase(),cp:String(G.cp||"").toUpperCase().startsWith("C")?"C":"P"}),(G.golden||String(G.classification||"").toLowerCase().includes("golden"))&&N++}return{maxP:z,golden:N,n:P.length}},[P]),{data:U,lastUpdated:D}=H(()=>p?Ne(c):Promise.resolve(null),3e3,[p,c]),{data:B}=H(()=>Zi(p?c:"ALL").catch(()=>null),12e4,[p,c]),te=B?.openclose,{data:xe}=H(()=>Ks(String(n||"SPY").toUpperCase()).catch(()=>null),3e4,[n]),{data:me}=H(()=>Ji(String(n||"SPY").toUpperCase()).catch(()=>null),6e4,[n]),{data:be}=H(()=>qs(String(n||"SPY").toUpperCase()).catch(()=>null),36e5,[n]),Y=$.useMemo(()=>{const z=p?U:null,N=ue=>ue==null?null:Number(ue),G=N(z?.bullish_premium),Z=N(z?.bearish_premium),se=N(z?.call_premium),le=N(z?.put_premium),de=N(z?.put_call_ratio),K=N(z?.net_premium);if(!(z&&(K!=null||G!=null||se!=null||de!=null)))return{authoritative:!1,net:J.net,bullPct:J.bullPct,pcr:J.pcr,callP:J.callP,putP:J.putP};const ne=K??(G||0)-(Z||0),oe=(G||0)+(Z||0);return{authoritative:!0,lastSession:!!z?.last_session,net:ne,bullPct:oe?(G||0)/oe*100:ne>=0?100:0,pcr:de,callP:se??J.callP,putP:le??J.putP}},[p,U,J]),fe=$.useMemo(()=>{if(Y.authoritative){const z=U?.updated?Date.parse(U.updated):NaN,N=Math.min(isFinite(z)?z:1/0,D??1/0);return isFinite(N)?Date.now()-N:1/0}return T?Date.now()-T:1/0},[Y.authoritative,U,D,T]),ke=z=>g(N=>N.k===z?{k:z,dir:-N.dir}:{k:z,dir:["tick","exp","cp","side","type"].includes(z)?1:-1}),we=$.useMemo(()=>{const z=Y.pcr;if(z==null&&Y.net==null)return null;const N=Y.net>=0?"bullish":"bearish",G=z==null?"":z>=1.2?"a put-heavy tape (hedging demand: extremes often precede bounces)":z<=.8?"a call-heavy tape (upside chasing: crowded when extreme)":"a balanced put/call tape",Z=Q.maxP?` Largest single bet: ${Q.maxP.sym} ${Q.maxP.cp==="P"?"puts":"calls"} ${ee(Q.maxP.prem)}.`:"";let se="";if(p&&U?.gex&&Number(U?.spot)>0){const le=U.gex,de=Number(U.spot),K=le.regime,M=Number(le.call_wall),ne=Number(le.put_wall),oe=Number(le.flip_strike),ue=On=>Math.abs((On/de-1)*100),Ie=[];K==="positive"?(Ie.push("dealers in γ+ (moves damped)"),isFinite(M)&&M>de&&ue(M)<1.5?Ie.push(`capped into the ${R(M,0)} call wall (+${R(ue(M),1)}%)`):isFinite(ne)&&ne<de&&ue(ne)<1.5&&Ie.push(`cushioned by the ${R(ne,0)} put wall (â${R(ue(ne),1)}%)`)):K==="negative"?(Ie.push("dealers in γâ (moves amplify)"),isFinite(oe)&&Ie.push(`flip back at ${R(oe,0)} (${de>=oe?"+":"â"}${R(ue(oe),1)}%)`)):isFinite(oe)&&ue(oe)<.6&&Ie.push(`sitting ON the γ-flip at ${R(oe,0)}: regime undecided`),Ie.length&&(se=` Structure: ${Ie.join(", ")}.`)}return`Aggressor premium is net ${N} (${Y.net>=0?"+":""}${ee(Y.net)}) into ${G}.${se}${Z}`},[Y,Q,p,U]);return $.useEffect(()=>(lt(we),()=>lt(null)),[we]),e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"auto",minHeight:o?0:"100%"},children:[f&&e.jsx(Ko,{value:y,view:l||"flow",onSave:z=>{b(z),w(!1)},onClose:()=>w(!1)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4,gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:10,fontWeight:800,color:t.muted,fontFamily:"Inter",letterSpacing:.4},children:[i("markets.optionsFlow.header")," ",e.jsx(ie,{topic:"flow",size:15})]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:9.5,color:t.dim,fontFamily:"Inter"},children:Y.authoritative?`${c} engine agg`:"window"}),Y.lastSession||fe>1800*1e3?e.jsx("span",{style:{fontFamily:k,fontSize:8,fontWeight:800,letterSpacing:"0.08em",color:"#E0C27A",background:"rgba(210,162,76,0.10)",border:"1px solid rgba(210,162,76,0.3)",borderRadius:4,padding:"1px 6px"},children:i("markets.optionsFlow.lastSessionChip",{defaultValue:"LAST SESSION"})}):e.jsx(Ut,{ageMs:fe,staleS:15})]})]}),e.jsx(X,{id:"pulse",vis:s,children:e.jsx(ea,{k:Y,stats:Q})}),e.jsx(X,{id:"marketctx",vis:s,children:e.jsx(ai,{ctx:xe,sue:be})}),e.jsx(X,{id:"forecast",vis:s,children:e.jsx(ta,{data:me})}),e.jsx(X,{id:"positioningchange",vis:s,children:e.jsx(di,{symbol:n,compact:!0})}),te&&(te.opened_prem_share??te.opened_share)!=null&&e.jsx(X,{id:"openclose",vis:s,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,margin:"0 2px 8px",flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontFamily:k,fontSize:8.5,fontWeight:800,letterSpacing:"0.1em",color:"#E0C27A",background:"rgba(210,162,76,0.10)",border:"1px solid rgba(210,162,76,0.3)",borderRadius:5,padding:"2px 8px"},title:i("markets.optionsFlow.openCloseTitle",{defaultValue:"yesterday's premium graded by the next day's open-interest change per contract; sweeps graded separately; coverage-limited to our chain warehouse"}),children:[i("markets.optionsFlow.openCloseChip",{defaultValue:"YESTERDAY {{pct}}
1% OF PREMIUM OPENED NEW RISK",pct:Math.round((te.opened_prem_share??te.opened_share)*100)}),te.sweep_opened_share!=null?` · ${i("markets.optionsFlow.openCloseSweeps",{defaultValue:"sweeps {{pct}}%",pct:Math.round(te.sweep_opened_share*100)})}`:""]}),e.jsxs("span",{style:{fontFamily:k,fontSize:8,color:t.dim},children:[te.coverage!=null?i("markets.optionsFlow.openCloseCoverage",{defaultValue:"OI-matched coverage {{pct}}%",pct:Math.round(te.coverage*100)}):i("markets.optionsFlow.openCloseMkt",{defaultValue:"{{n}} underlyings graded",n:te.n_underlyings})," · ",te.date]})]})}),e.jsx(X,{id:"flowsignals",vis:s,children:e.jsx(Vt,{assetClass:"options"})}),e.jsx(X,{id:"intel",vis:s,children:e.jsx(ha,{rows:S,meta:A})}),e.jsx(X,{id:"pressure",vis:s,children:e.jsx(oi,{})}),e.jsxs(X,{id:"tape",vis:s,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8,flexWrap:"wrap"},children:[e.jsx(ie,{topic:"tape",size:15}),e.jsx("button",{onClick:()=>h(z=>z==="notable"?"all":"notable"),style:Jt(t.amber,u!=="notable"),children:i(u==="notable"?"markets.optionsFlow.notableToggle":"markets.optionsFlow.allPrintsToggle")}),e.jsx("button",{onClick:()=>d(z=>!z),title:i("markets.tooltips.scopeToSymbol"),style:Jt(t.blue,p),children:p?String(n).toUpperCase():i("markets.optionsFlow.all")}),aa.map(z=>e.jsx("button",{onClick:()=>b(N=>({...N,[z.key]:!N[z.key]})),style:Jt(t.green,!!y[z.key]),children:z.label},z.key)),e.jsxs("button",{onClick:()=>w(!0),style:Jt(t.green,!!Un(y)),children:["â Filters",Un(y)?` (${Un(y)})`:""]}),e.jsx(ca,{}),e.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:t.muted,display:"flex",alignItems:"center",gap:6},children:[e.jsx(Cn,{on:u==="notable"?!!T&&Date.now()-T<1e4:_}),u==="notable"?i("markets.optionsFlow.notable"):_?"LIVE":i("markets.optionsFlow.connecting")," · ",V.length]})]}),e.jsx("div",{tabIndex:0,"aria-label":i("markets.optionsFlow.flowTapeAria"),style:{flex:"none",minHeight:o?320:360,maxHeight:o?"70vh":"60vh",overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{position:"sticky",top:0,background:t.panel2,zIndex:1},children:e.jsx("tr",{children:Zt.map(z=>e.jsxs("th",{onClick:()=>ke(z.k),title:Fe(z.label)?`${Fe(z.label)} · ${i("markets.optionsFlow.clickToSort")}`:i("markets.optionsFlow.clickToSort"),style:{textAlign:z.align,padding:"6px 8px",cursor:"pointer",color:v.k===z.k?t.text:t.muted,fontFamily:"Inter",fontSize:10,fontWeight:700,letterSpacing:.4,borderBottom:`1px solid ${t.border2}`,userSelect:"none"},children:[z.label,v.k===z.k?v.dir<0?" â¾":" â´":""]},z.k))})}),e.jsxs("tbody",{children:[V.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:Zt.length,style:{padding:24,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:i("markets.optionsFlow.noFlowYet")})}),V.map((z,N)=>{const G=$l(z.cp),Z=wn(z),se=z.is_golden_sweep?"rgba(214,90,219,0.12)":z.classification==="sweep"?"rgba(214,90,219,0.05)":Z==="bullish"?"rgba(110,210,90,0.04)":Z==="bearish"?"rgba(255,91,85,0.04)":"transparent",le=ci(z),de=oa(z,A),K=ra(z.oi_status,z.is_golden_sweep);return e.jsxs("tr",{style:{background:se,borderBottom:"1px solid rgba(255,255,255,0.03)",borderLeft:K?`3px solid ${K}`:"3px solid transparent"},children:[e.jsx(_e,{children:An(z.ts_ns)}),e.jsxs(_e,{align:"left",color:G,bold:!0,children:[z.underlying,(()=>{const M=A?.[String(z.underlying||"").toUpperCase()]?.next_earnings;if(!M)return null;const ne=Math.round((new Date(String(M)+"T00:00:00Z")-Date.now())/864e5);return ne>=0&&ne<=5?e.jsxs("span",{title:i("markets.optionsFlow.erSoon",{d:ne}),style:{color:"#D2A24C",fontSize:9,marginLeft:3,fontWeight:800},children:["E",ne===0?"0":`-${ne}`]}):null})()]}),e.jsx(_e,{children:z.expiry}),e.jsx(_e,{color:kn(z)===0?t.amber:t.muted,children:kn(z)??"â"}),e.jsx(_e,{children:R(z.strike,1)}),e.jsx(_e,{color:G,bold:!0,children:String(z.cp).toUpperCase()}),e.jsx(ma,{side:z.side}),e.jsx(_e,{color:Number(z.spot)>0?t.text:t.muted,children:Number(z.spot)>0?R(z.spot,2):"â"}),e.jsx(_e,{color:le==null?t.muted:le<0?t.blue:t.dim,children:le==null?"â":`${le>0?"+":""}${le.toFixed(1)}`}),e.jsx(_e,{children:je(z.size)}),e.jsx(_e,{color:t.muted,children:z.oi!=null?je(z.oi):"â"}),e.jsx(_e,{color:z.opening?t.green:t.text,bold:!!z.opening,title:z.opening?i("markets.optionsFlow.volumeOiTooltip"):"",children:z.day_volume!=null?`${je(z.day_volume)}${z.opening?" â":""}`:"â"}),e.jsx(_e,{children:z.price!=null?R(z.price,2):"â"}),e.jsx(_e,{bold:!0,children:ee(z.premium)}),e.jsx(_e,{children:de!=null?R(de*100,1):"â"}),e.jsx(pa,{ivRank:z.iv_rank}),e.jsxs(_e,{color:ia(z.classification),children:[(z.classification||"").toUpperCase(),z.is_golden_sweep?"â
":""]}),e.jsx(ua,{score:pi(z)})]},ql(z)+N)})]})]})})]})]})}const ca=()=>{const{t:n}=W();return e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,
1color:t.dim,border:`1px solid ${t.border2}`,borderRadius:6,padding:"3px 8px",fontFamily:"Inter"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:t.dim,display:"inline-block"}}),e.jsx("span",{children:n("markets.optionsFlow.oiClosing")})]}),e.jsx("span",{style:{color:t.border2},children:"|"}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:hl,display:"inline-block"}}),e.jsx("span",{style:{color:hl},children:n("markets.optionsFlow.oiOpening")})]}),e.jsx("span",{style:{color:t.border2},children:"|"}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:gl,display:"inline-block"}}),e.jsx("span",{style:{color:gl},children:n("markets.optionsFlow.oiMultiOpen")})]})]})},Jt=(n,l)=>({fontSize:11,padding:"4px 10px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${l?n:t.border2}`,background:l?`${n}22`:"transparent",color:l?n:t.muted}),_e=({children:n,align:l="right",color:s=t.text,bold:i=!1})=>e.jsx("td",{style:{textAlign:l,padding:"4px 8px",color:s,fontWeight:i?700:400,whiteSpace:"nowrap"},children:n}),pa=({ivRank:n})=>{if(n==null)return e.jsx(_e,{color:t.muted,children:"â"});const l=Math.round(n*100),s=l>=70?t.amber:l>=40?t.text:t.muted;return e.jsx(_e,{color:s,children:l})},ua=({score:n})=>{const l=Math.max(-100,Math.min(100,Math.round(Number(n)||0))),s=Math.abs(l),i=l>0?t.green:l<0?t.red:t.dim,o=s>=80?`0 0 6px ${i}`:"none",r=16,a=Math.round(s/100*r);return e.jsx("td",{style:{textAlign:"right",padding:"4px 8px",whiteSpace:"nowrap"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsxs("span",{"aria-hidden":!0,style:{position:"relative",width:r*2,height:5,borderRadius:2,background:"rgba(255,255,255,0.06)",overflow:"hidden",display:"inline-block"},children:[e.jsx("span",{style:{position:"absolute",left:r,top:0,bottom:0,width:1,background:"rgba(255,255,255,0.18)"}}),s>0&&e.jsx("span",{style:{position:"absolute",top:0,bottom:0,left:l>0?r:r-a,width:a,background:i,opacity:.85}})]}),e.jsx("span",{style:{color:i,fontWeight:s>=60?700:400,textShadow:o,minWidth:30,textAlign:"right",display:"inline-block"},children:l>0?`+${l}`:l})]})})},ma=({side:n})=>{const l=n==="at_or_above_ask"?2:n==="at_or_below_bid"?0:1,s=l===2?t.green:l===0?t.red:t.muted,i=[1,13,25][l];return e.jsx("td",{style:{textAlign:"right",padding:"4px 8px",whiteSpace:"nowrap"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsxs("span",{"aria-hidden":!0,style:{position:"relative",width:30,height:7,display:"inline-block"},children:[e.jsx("span",{style:{position:"absolute",left:0,right:0,top:3,height:1,background:"rgba(255,255,255,0.14)"}}),e.jsx("span",{style:{position:"absolute",left:0,top:1,width:1,height:5,background:"rgba(255,91,85,0.5)"}}),e.jsx("span",{style:{position:"absolute",left:14,top:1,width:1,height:5,background:"rgba(255,255,255,0.25)"}}),e.jsx("span",{style:{position:"absolute",right:0,top:1,width:1,height:5,background:"rgba(110,210,90,0.5)"}}),e.jsx("span",{style:{position:"absolute",left:i,top:.5,width:5,height:5,borderRadius:3,background:s,boxShadow:`0 0 4px ${s}`}})]}),e.jsx("span",{style:{color:s,minWidth:24,display:"inline-block"},children:Cl(n)})]})})};function ha({rows:n,meta:l}){const{t:s}=W(),i=$.useMemo(()=>{const p=Date.now()*1e6,d=p-15*6e10,c=p-60*6e10,u=p-30*6e10,h={},m={};let y=0,b=0;const f=[0,0,0,0];for(const j of n||[]){const _=Number(j.ts_ns);if(!(_>c))continue;const E=String(j.underlying||"").toUpperCase(),T=Number(j.total_premium??j.premium)||0,S=wn(j),C=S==="bullish"?T:S==="bearish"?-T:0,I=h[E]||(h[E]={s15:0,g15:0,sPrior:0,gPrior:0});if(_>d?(I.s15+=C,I.g15+=T):(I.sPrior+=C,I.gPrior+=T),_>d){const F=Number(j.strike);if(isFinite(F)){const A=`${E} ${R(F,F>=1e3?0:1)}${String(j.cp||"").toUpperCase().startsWith("C")?"C":"P"}`,P=m[A]||(m[A]={n:0,prem:0});P.n+=1,P.prem+=T}}if(_>u){b+=T;const F=String(j.classification||"").toLowerCase();(F==="sweep"||F==="block"||j.is_golden_sweep)&&(y+=T);const A=kn(j);A!=null&&(f[A===0?0:A<=7?1:A<=30?2:3]+=T)}}const w=Object.entries(h).map(([j,_])=>{const E=_.gPrior/3,T=_.sPrior!==0&&Math.sign(_.s15)!==Math.sign(_.sPrior)&&Math.abs(_.s15)>4e5,S=E>0?_.g15/E:_.g15>1e6?9:0;return{u:j,s15:_.s15,flip:T,surge:S,g15:_.g15}}).filter(j=>j.flip||j.surge>=2.5&&j.g15>=8e5).sort((j,_)=>Math.abs(_.s15)-Math.abs(j.s15)).slice(0,6),v=Object.entries(m).filter(([,j])=>j.n>=3&&j.prem>=25e4).sort((j,_)=>_[1].prem-j[1].prem).slice(0,4),g=b>0?y/b*100:null,x=f.reduce((j,_)=>j+_,0);return{shocks:w,repeats:v,instPct:g,dteBuckets:f,dteTot:x}},[n]),o=p=>{const d=l?.[p]?.next_earnings;if(!d)return null;const c=Math.round((new Date(String(d)+"T00:00:00Z")-Date.now())/864e5);return c>=0&&c<=5?c:null};if(!i.shocks.length&&!i.repeats.length&&i.instPct==null)return null;const r=["0DTE","â¤7d","â¤30d",">30d"],a=[t.amber,"#D2A24C",t.blue,t.muted];return e.jsxs("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,background:t.panel,padding:"7px 10px",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:9,fontWeight:800,color:"#D2A24C",fontFamily:"Inter",letterSpacing:.6},children:s("markets.optionsFlow.intelTitle")}),e.jsx(ie,{size:12,title:s("markets.optionsFlow.intelGuideTitle"),what:s("markets.optionsFlow.intelGuideWhat"),how:s("markets.optionsFlow.intelGuideHow")}),i.instPct!=null&&e.jsx("span",{style:{fontFamily:k,fontSize:9.5,color:i.instPct>=60?t.blue:t.muted,fontWeight:700},children:s("markets.optionsFlow.instShare",{pct:Math.round(i.instPct)})}),i.dteTot>0&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,marginLeft:"auto"},children:[e.jsx("span",{style:{display:"inline-flex",width:110,height:7,borderRadius:3,overflow:"hidden",border:`1px solid ${t.border2}`},children:i.dteBuckets.map((p,d)=>e.jsx("span",{style:{width:`${p/i.dteTot*100}%`,background:a[d],opacity:.85}},d))}),e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim,whiteSpace:"nowrap"},children:i.dteBuckets.map((p,d)=>`${r[d]} ${Math.round(p/i.dteTot*100)}%`).join(" · ")})]})]}),i.shocks.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,flexWrap:"wrap",marginTop:5},children:[e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim,letterSpacing:"0.1em"},children:s("markets.optionsFlow.shocksLabel")}),i.shocks.map(p=>{const d=p.s15>=0,c=o(p.u);return e.jsxs("span",{title:p.flip?s("markets.optionsFlow.shockFlipTitle"):s("markets.optionsFlow.shockSurgeTitle"),style:{fontFamily:k,fontSize:10,padding:"2px 8px",borderRadius:999,border:`1px solid ${d?t.green:t.red}55`,background:`${d?t.green:t.red}12`,color:d?t.green:t.red,whiteSpace:"nowrap"},children:[d?"â²":"â¼"," ",e.jsx("b",{children:p.u})," ",p.flip?"â² ":"",ee(Math.abs(p.s15)),"/15m",c!=null&&e.jsxs("span",{style:{color:"#D2A24C"},children:[" E",c===0?"0":`-${c}`]})]},p.u)})]}),i.repeats.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,flexWrap:"wrap",marginTop:5},children:[e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim,letterSpacing:"0.1em"},children:s("markets.optionsFlow.repeatLabel")}),i.repeats.map(([p,d])=>e.jsxs("span",{style:{fontFamily:k,fontSize:10,padding:"2px 8px",borderRadius:999,border:`1px solid ${t.blue}55`,background:`${t.blue}12`,color:t.blue,whiteSpace:"nowrap"},children:[e.jsx("b",{children:p})," Ã",d.n," · ",ee(d.prem)]},p))]})]})}const ui=n=>n==null?"â":n>=1e6?`$${(n/1e6).toFixed(1)}M`:n>=1e3?`$${(n/1e3).toFixed(0)}K`:`$${n.toFixed(0)}`,mi=n=>n>0?`about 1 in ${Math.max(1,Math.round(1/n))} days`:"",hi=n=>Math.min(.99,n*2);function Ql(n,l){const s=[...n||[]].sort((a,p)=>p.score-a.score),i=s[2]?.score??0,o=(l||[]).map(a=>s.find(p=>p.strike===a)).filter(a=>a&&a.score>=i/1.05),r=s.filter(a=>!o.includes(a));return[...o,...r].slice(0,3).sort((a,p)=>p.score-a.score)}function ga({d:n}){const l=n.spot,s=n.realistic_sigma_pct;if(!l||!s)return null;const i=l*(1-s*1.6/100),o=l*(1+s*1.6/100),r=u=>`${Math.max(0,Math.min(100,(u-i)/(o-i)*100))}%`,a=Math.max(1,...[...n.calls||[],...n.puts||[]].map(u=>u.flow_premium_usd||0)),p=u=>4+Math.sqrt((u.flow_premium_usd||0)/a)*7,d=(u,h)=>{const m=Math.sqrt((u.flow_premium_usd||0)/a)*18;return m?e.jsx("div",{style:{position:"absolute",left:r(u.strike),width:5,height:m,transform:"translateX(-50%)",to
1p:h?`calc(50% - ${m}px)`:"50%",background:h?"rgba(94,170,120,0.35)":"rgba(200,90,80,0.35)",borderRadius:1,transition:"left 0.8s ease"}},`b${h?"c":"p"}${u.strike}`):null},c=(u,h,m)=>e.jsxs("div",{style:{position:"absolute",left:r(u.strike),top:m?6:"auto",bottom:m?"auto":6,transform:"translateX(-50%)",display:"flex",flexDirection:m?"column":"column-reverse",alignItems:"center",gap:1,transition:"left 0.8s ease"},title:`${u.strike} · P(BE) ${u.p_breakeven!=null?`${Math.round(u.p_breakeven*100)}% (${mi(u.p_breakeven)})`:"â"} · touches breakeven ~${Math.round(hi(u.p_itm)*100)}% · ${ui(u.flow_premium_usd)} traded today`,children:[e.jsx("span",{style:{fontFamily:k,fontSize:7,fontWeight:h<3?800:400,color:h<3?m?t.green:t.red:t.dim},children:u.strike}),e.jsx("span",{style:{width:p(u),height:p(u),borderRadius:"50%",background:m?"rgba(94,170,120,0.8)":"rgba(200,90,80,0.8)",border:h<3?"1.5px solid rgba(210,162,76,0.9)":"1px solid transparent"}}),e.jsx("span",{style:{fontFamily:k,fontSize:6.5,color:h<3?t.muted:t.dim},children:u.p_breakeven!=null?`${Math.round(u.p_breakeven*100)}%`:""})]},`${m?"c":"p"}${u.strike}`);return e.jsxs("div",{style:{position:"relative",height:74,margin:"4px 0 10px"},children:[e.jsx("div",{style:{position:"absolute",top:24,bottom:24,left:r(l*(1-s/100)),width:`calc(${r(l*(1+s/100))} - ${r(l*(1-s/100))})`,background:"rgba(210,162,76,0.08)",border:"1px solid rgba(210,162,76,0.25)",borderRadius:4,transition:"left 0.8s ease, width 0.8s ease"}}),e.jsx("div",{style:{position:"absolute",left:0,right:0,top:"50%",height:2,background:t.line}}),e.jsx("div",{style:{position:"absolute",left:r(l),top:14,bottom:14,width:2,background:t.text,transform:"translateX(-1px)",transition:"left 0.8s ease"}}),e.jsx("div",{style:{position:"absolute",left:r(l),top:0,transform:"translateX(-50%)",fontFamily:k,fontSize:7.5,fontWeight:800,color:t.text,transition:"left 0.8s ease"},children:l>=1e3?l.toFixed(0):l.toFixed(2)}),(n.calls||[]).map(u=>d(u,!0)),(n.puts||[]).map(u=>d(u,!1)),(n.calls||[]).map((u,h)=>c(u,h,!0)),(n.puts||[]).map((u,h)=>c(u,h,!1))]})}function Zl({rows:n,isCall:l,d:s,t:i}){const o=n||[];return e.jsxs("div",{style:{flex:1,minWidth:280},children:[e.jsx("div",{style:{fontFamily:k,fontSize:8,fontWeight:800,letterSpacing:"0.1em",color:l?t.green:t.red,marginBottom:3},children:l?i("markets.strikeAdvisor.sideCalls",{defaultValue:"â² IF YOUR VIEW IS UP · TOP 3 CALLS"}):i("markets.strikeAdvisor.sidePuts",{defaultValue:"â¼ IF YOUR VIEW IS DOWN · TOP 3 PUTS"})}),e.jsxs("table",{style:{borderCollapse:"collapse",width:"100%"},children:[e.jsx("thead",{children:e.jsx("tr",{children:[i("markets.strikeAdvisor.colStrike",{defaultValue:"strike"}),i("markets.strikeAdvisor.colPrem",{defaultValue:"prem"}),"P(ITM)","P(BE)",i("markets.strikeAdvisor.colPay",{defaultValue:"@1Ï"}),i("markets.strikeAdvisor.colBleed",{defaultValue:"bleed/hr"}),i("markets.strikeAdvisor.colFlow",{defaultValue:"$ today"}),""].map((r,a)=>e.jsx("th",{style:{fontFamily:k,fontSize:7,color:t.dim,textAlign:"right",padding:"1px 4px",letterSpacing:"0.04em"},children:r},a))})}),e.jsx("tbody",{children:o.map((r,a)=>e.jsxs("tr",{style:{background:a===0?"rgba(210,162,76,0.06)":"transparent"},children:[e.jsx("td",{style:{fontFamily:k,fontSize:9.5,fontWeight:800,color:t.text,textAlign:"right",padding:"2px 4px"},children:r.strike}),e.jsx("td",{style:{fontFamily:k,fontSize:9,color:t.text,textAlign:"right",padding:"2px 4px"},children:r.premium}),e.jsxs("td",{style:{fontFamily:k,fontSize:9,color:t.muted,textAlign:"right",padding:"2px 4px"},children:[Math.round(r.p_itm*100),"%"]}),e.jsx("td",{style:{fontFamily:k,fontSize:9,fontWeight:800,color:(r.p_breakeven??0)>=.35?t.green:(r.p_breakeven??0)>=.2?t.amber:t.red,textAlign:"right",padding:"2px 4px"},children:e.jsx("span",{title:r.p_breakeven!=null?`${mi(r.p_breakeven)}; touches ~${Math.round(hi(r.p_itm)*100)}%`:"",children:r.p_breakeven!=null?`${Math.round(r.p_breakeven*100)}%`:"â"})}),e.jsxs("td",{style:{fontFamily:k,fontSize:9,color:r.payoff_at_1sigma_pct>=0?t.green:t.red,textAlign:"right",padding:"2px 4px"},children:[r.payoff_at_1sigma_pct>=0?"+":"",r.payoff_at_1sigma_pct,"%"]}),e.jsx("td",{style:{fontFamily:k,fontSize:9,color:t.amber,textAlign:"right",padding:"2px 4px"},children:r.theta_bleed_pct_per_hour!=null?`â${r.theta_bleed_pct_per_hour}%`:"â"}),e.jsx("td",{style:{fontFamily:k,fontSize:9,color:t.muted,textAlign:"right",padding:"2px 4px"},children:ui(r.flow_premium_usd)}),e.jsx("td",{style:{fontFamily:k,fontSize:8.5,color:t.red,padding:"2px 4px"}
1,title:r.beyond_band?i("markets.strikeAdvisor.beyondTip",{defaultValue:"needs a move beyond the calibrated band (the band held {{pct}}% of days)",pct:s.band_hit_rate!=null?Math.round(s.band_hit_rate*100):"â"}):"",children:r.beyond_band?"â ":""})]},r.strike))})]})]})}function xa({symbol:n="SPY"}){const{t:l}=W(),{data:s}=H(()=>er(n).catch(()=>null),15e3,[n]),i=s||{},o=$.useRef({calls:[],puts:[]}),r=Ql(i.calls,o.current.calls),a=Ql(i.puts,o.current.puts);o.current={calls:r.map(d=>d.strike),puts:a.map(d=>d.strike)};const p=r.length>0||a.length>0;return e.jsxs("div",{style:{padding:12,borderRadius:10,border:`1px solid ${t.border}`,background:t.panel,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginBottom:4},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.12em",color:t.muted},children:l("markets.strikeAdvisor.title",{defaultValue:"STRIKE ADVISOR · YOUR VIEW, OUR MATH"})}),e.jsx(ie,{topic:"strike advisor",size:14}),p&&e.jsx("span",{style:{fontFamily:k,fontSize:7.5,color:"#E0C27A",background:"rgba(210,162,76,0.10)",border:"1px solid rgba(210,162,76,0.3)",borderRadius:4,padding:"1px 6px"},children:l("markets.strikeAdvisor.bandChip",{defaultValue:"realistic band ±{{r}}% (implied ±{{em}}% ÷ Ã{{ratio}} measured) · {{m}}min to close",r:i.realistic_sigma_pct,em:i.em_pct,ratio:i.overpricing_ratio,m:i.minutes_to_close})})]}),p?e.jsxs(e.Fragment,{children:[e.jsx(ga,{d:i}),e.jsxs("div",{style:{display:"flex",gap:16,flexWrap:"wrap"},children:[e.jsx(Zl,{rows:a,isCall:!1,d:i,t:l}),e.jsx(Zl,{rows:r,isCall:!0,d:i,t:l})]}),e.jsx("div",{style:{fontFamily:k,fontSize:7.5,color:t.dim,marginTop:6,opacity:.85},children:l("markets.strikeAdvisor.honestyBoth",{defaultValue:"both sides re-rank live as price moves; dot size = todayâs traded premium at that strike; the direction stays yours and nothing here predicts it"})})]}):e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim},children:i.note||l("markets.strikeAdvisor.cold",{defaultValue:"the advisor wakes with the session (chain caches are live during market hours)"})})]})}function fa(){const{t:n}=W(),{data:l}=H(()=>tr().catch(()=>null),3e5,[]),s=l?.earned||[];return e.jsx("div",{style:{padding:"8px 12px",borderRadius:10,border:`1px solid ${t.border}`,background:t.panel,marginBottom:10},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.12em",color:t.muted},children:n("markets.earnedCalls.title",{defaultValue:"EARNED CALLS · DIRECTION IS EARNED, NEVER PROMISED"})}),e.jsx(ie,{topic:"earned calls",size:14}),s.length===0?e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim},children:n("markets.earnedCalls.empty",{defaultValue:"no setup currently holds a qualifying public record: that is honesty, not failure"})}):s.map(i=>e.jsxs("span",{style:{fontFamily:k,fontSize:8,fontWeight:800,color:"#E0C27A",background:"rgba(210,162,76,0.10)",border:"1px solid rgba(210,162,76,0.3)",borderRadius:4,padding:"1px 7px"},title:n("markets.earnedCalls.cellTip",{defaultValue:"p(win) {{p}}% over {{n}} graded signals across {{d}} days",p:Math.round(i.p_win*100),n:i.n_eff,d:i.n_days??"â"}),children:[i.cell," · ",Math.round(i.p_win*100),"%"]},i.cell))]})})}const Xe=n=>{const l=Number(n||0),s=Math.abs(l),i=l<0?"-":"";return s>=1e9?`${i}${(s/1e9).toFixed(1)}B`:s>=1e6?`${i}${(s/1e6).toFixed(0)}M`:s>=1e3?`${i}${(s/1e3).toFixed(0)}K`:s?`${i}${s.toFixed(0)}`:""},ya=(n,l)=>{const s=Number(n||0);if(!s||!l)return"transparent";const i=Math.min(.9,.12+.78*(Math.abs(s)/l));return s>0?`rgba(55,209,131,${i.toFixed(2)})`:`rgba(240,82,79,${i.toFixed(2)})`},xl=n=>n&&n.length===8?`${n.slice(4,6)}/${n.slice(6,8)}`:n,ct={net_gex:["GEX","dealer gamma: green pins, red accelerates"],delta_gex:["ÎGEX","change in modeled GEX versus the prior persisted close"],delta_oi:["ÎOI","official daily open-interest change; this is not an intraday estimate"],dex:["DEX","delta exposure: hedge-equivalent share exposure parked at the strike"],vanna_ex:["VANNA","IV-move hedging: why vol crush can create mechanical drift"],charm_ex:["CHARM","time-decay hedging: drift toward concentrated strikes into expiry"]};function ba({data:n,maxHeight:l=420,lens:s="net_gex"}){const{t:i}=W(),o=n?.strikes||[],r=n?.expirations||[],a=n?.cells||[],p=n?.spot,d=Math.max(1,...a.map(g=>Math.abs(Number(g[s]||0)))),c={},u={},h={};for(const g of a)g[s]!=null&&(c[`${g.strike}|${g.expiry}`]=g[s]),g.prem!=null&&(u[`${g.strike}|${g.expiry}`]=g.prem),g.chg_pct!=null&&(h[`${g.strike}|${g.expiry}`]=g.chg_pct);const m=ct[s]?.[0]||String(s).toUpperCase(),y=Number(n?.max_abs_prem)||Math.max(1,...Object.values(u).map(g=>Math.abs(Number(g)||0))),b=n?.prem_by_expiration||{},f=Object.keys(u).length>0||Object.keys(b).length>0,w={};for(const g of n?.by_expiration||[])w[g.expiry]=g.net_gex;const v=p&&o.length?o.reduce((g,x)=>Math.abs(x-p)<Math.abs(g-p)?x:g,o[0]):null;return!o.length||!r.length?e.jsx("div",{style:{padding:18,textAlign:"center",color:t.dim,fontSize:12,border:`1px solid ${t.border}`,borderRadius:8},children:i("markets.gexSurface.noSurfaceYet")}):e.jsx("div",{style:{overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8,maxHeight:l},children:e.jsxs("table",{style:{borderCollapse:"collapse",fontFamily:k,fontSize:10,width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{position:"sticky",left:0,top:0,background:t.panel2,padding:"4px 6px",color:t.muted,fontSize:9,textAlign:"right",zIndex:3},children:i("markets.gexSurface.strikeHeader")}),r.map(g=>e.jsxs("th",{style:{position:"sticky",top:0,background:t.panel2,padding:"4px 5px",textAlign:"center",whiteSpace:"nowrap",borderBottom:`1px solid ${t.border2}`,zIndex:2},children:[e.jsx("div",{style:{color:t.text,fontWeight:700},children:xl(g.expiry)}),e.jsx("div",{style:{color:t.dim,fontSize:8},children:g.dte!=null?`${g.dte}d`:""})]},g.expiry))]})}),e.jsx("tbody",{children:o.map(g=>{const x=g===v;return e.jsxs("tr",{children:[e.jsx("td",{style:{position:"sticky",left:0,background:t.panel2,padding:"2px 6px",textAlign:"right",color:x?t.amber:t.muted,fontWeight:x?800:400,borderLeft:`2px solid ${x?t.amber:"transparent"}`,zIndex:1},children:R(g,0)}),r.map(j=>{const _=c[`${g}|${j.expiry}`],E=u[`${g}|${j.expiry}`],T=h[`${g}|${j.expiry}`],S=_!=null&&Math.abs(Number(_))>=d*.999,C=_!=null&&Math.abs(Number(_))/d>.45;return e.jsxs("td",{title:_!=null?`${R(g,0)} · ${xl(j.expiry)} · ${m} ${Xe(_)}${T!=null?` · straddle premium repricing ${T>=0?"+":""}${T}%`:""}${E!=null?` · live flow $${Xe(E)}`:""}`:void 0,style:{padding:"2px 4px 1px",textAlign:"center",whiteSpace:"nowrap",background:ya(_,d),color:_!=null?C?"#0A0D11":t.text:t.dim,border:S?`2px s
1olid ${t.amber}`:"1px solid rgba(0,0,0,0.18)",fontWeight:S?800:400},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"baseline",justifyContent:"center",gap:5},children:[e.jsx("span",{children:_!=null?Xe(_):""}),T!=null?e.jsxs("span",{title:"P = straddle premium repricing versus its prior close",style:{fontWeight:700,color:C?T>=0?"#0b5d33":"#6b1714":T>=0?"#37D183":"#F0524F"},children:["P ",T>=0?"+":"â",(()=>{const I=Math.abs(T);return I>=1e3?`${(I/1e3).toFixed(1)}k`:I>=100?Math.round(I):I.toFixed(1)})(),"%"]}):null]}),E!=null?e.jsx("div",{style:{height:3,borderRadius:2,margin:"1px auto 0",width:`${Math.max(14,Math.round(100*Math.min(1,Math.abs(Number(E))/y)))}%`,background:Number(E)>0?"#37D183":"#F0524F",boxShadow:`0 0 4px ${Number(E)>0?"rgba(55,209,131,0.8)":"rgba(240,82,79,0.8)"}`}}):null]},j.expiry)})]},g)})}),e.jsxs("tfoot",{children:[e.jsxs("tr",{children:[e.jsx("td",{style:{position:"sticky",left:0,background:t.panel,padding:"3px 6px",textAlign:"right",color:t.muted,fontWeight:700,fontSize:9,borderTop:`1px solid ${t.border2}`},children:s==="delta_oi"?"Σ ÎOI":s==="delta_gex"?"Σ ÎGEX":i("markets.gexSurface.netFooter")}),r.map(g=>{const x=s==="net_gex"?w[g.expiry]:s==="delta_oi"||s==="delta_gex"?n?.by_expiration_delta?.[g.expiry]?.[s]:n?.by_expiration_ex?.[g.expiry]?.[s];return e.jsx("td",{title:`${m} total for this expiration`,style:{padding:"3px 4px",textAlign:"center",whiteSpace:"nowrap",color:x>=0?t.green:t.red,fontWeight:800,borderTop:`1px solid ${t.border2}`},children:x!=null?Xe(x):""},g.expiry)})]}),f?e.jsxs("tr",{children:[e.jsx("td",{title:"net sentiment-signed premium per expiration (the Heat Map read, same columns)",style:{position:"sticky",left:0,background:t.panel,padding:"3px 6px",textAlign:"right",color:t.muted,fontWeight:700,fontSize:9},children:"FLOW $"}),r.map(g=>{const x=b[g.expiry];return e.jsx("td",{style:{padding:"2px 4px",textAlign:"center",whiteSpace:"nowrap",color:x==null?t.dim:x>=0?t.green:t.red,fontWeight:700,fontSize:9.5},children:x!=null?Xe(x):""},g.expiry)})]}):null]})]})})}function va({data:n}){const{t:l}=W(),s=n?.by_expiration||[];if(!s.length)return null;const i=Math.max(1,...s.map(o=>Math.abs(Number(o.net_gex||0))));return e.jsxs("div",{style:{marginTop:12},children:[e.jsx("div",{style:{fontSize:11,color:t.muted,marginBottom:6,fontWeight:700},children:l("markets.gexSurface.gammaByExpTitle")}),e.jsx("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,padding:8},children:s.map(o=>{const r=Number(o.net_gex||0),a=Math.abs(r)/i*50,p=Math.abs(r)>=i*.999;return e.jsxs("div",{title:`net ${Xe(r)} · call ${Xe(o.call_gex)} / put ${Xe(o.put_gex)}`,style:{display:"flex",alignItems:"center",gap:6,fontSize:11,fontFamily:k,padding:"1px 0"},children:[e.jsxs("span",{style:{width:84,textAlign:"right",color:p?t.amber:t.muted,fontWeight:p?800:400,whiteSpace:"nowrap"},children:[xl(o.expiry)," · ",o.dte,"d"]}),e.jsxs("div",{style:{flex:1,display:"flex",justifyContent:"center",height:12},children:[e.jsx("div",{style:{width:"50%",display:"flex",justifyContent:"flex-end"},children:r<0&&e.jsx("div",{style:{width:`${a*2}%`,height:10,background:t.red,borderRadius:2}})}),e.jsx("div",{style:{width:1,background:t.border2}}),e.jsx("div",{style:{width:"50%"},children:r>0&&e.jsx("div",{style:{width:`${a*2}%`,height:10,background:t.green,borderRadius:2}})})]}),e.jsx("span",{style:{width:64,textAlign:"left",color:r>=0?t.green:t.red},children:Xe(r)})]},o.expiry)})})]})}const ja=[["net_gex",...ct.net_gex],["delta_gex",...ct.delta_gex],["delta_oi",...ct.delta_oi],["dex",...ct.dex],["vanna_ex",...ct.vanna_ex],["charm_ex",...ct.charm_ex]];function gi({symbol:n="SPY",showBars:l=!0,maxHeight:s=420,replayTs:i=null}){const{t:o}=W(),{data:r}=H(()=>i?nr(n,i):lr(n),i?3e5:3e4,[n,i]),[a,p]=$.useState("net_gex");$.useEffect(()=>{i&&(a==="delta_gex"||a==="delta_oi")&&p("net_gex")},[i,a]);const d=i&&r?.replay_ts?(()=>{try{return new Date(r.replay_ts).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:"America/New_York"})}catch{return null}})():null,c=!i&&r?.basis==="last_measured"&&r?.replay_ts?(()=>
1{try{return new Date(r.replay_ts).toLocaleString("en-US",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:"America/New_York"})}catch{return null}})():null,u=r?.delta_meta?.compare_to?(()=>{try{return new Date(r.delta_meta.compare_to).toLocaleString("en-US",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:"America/New_York"})}catch{return null}})():null;return e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("div",{style:{fontSize:11,color:t.muted,marginBottom:6,fontWeight:700,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[o("markets.gexSurface.sectionTitle")," ",e.jsx(ie,{topic:"gex surface",size:14}),d&&e.jsxs("span",{style:{fontFamily:k,fontSize:9.5,fontWeight:800,letterSpacing:"0.08em",padding:"2px 8px",borderRadius:5,color:"#E0C27A",background:"rgba(210,162,76,0.16)",border:"1px solid rgba(210,162,76,0.4)"},children:["â² ",o("markets.gexReplay.replayAt",{defaultValue:"REPLAY"})," ",d," ET"]}),c&&e.jsxs("span",{style:{fontFamily:k,fontSize:9.5,fontWeight:800,letterSpacing:"0.08em",padding:"2px 8px",borderRadius:5,color:"#E0C27A",background:"rgba(210,162,76,0.16)",border:"1px solid rgba(210,162,76,0.4)"},children:[o("markets.gexSurface.lastMeasured",{defaultValue:"LAST MEASURED"})," ",c," ET"]}),!i&&e.jsx("span",{title:u?`ÎGEX compares with ${u} ET; ÎOI compares official daily snapshots`:"Delta lenses require a prior-close surface and two daily OI observations",style:{fontFamily:k,fontSize:8.5,color:u?t.blue:t.dim,border:`1px solid ${u?`${t.blue}55`:t.border2}`,borderRadius:5,padding:"2px 6px"},children:u?`Î vs ${u} ET`:"Î awaiting prior close"}),e.jsx("span",{style:{marginLeft:"auto",display:"inline-flex",gap:4},children:ja.filter(([h])=>!i||h!=="delta_gex"&&h!=="delta_oi").map(([h,m,y])=>e.jsx("button",{onClick:()=>p(h),title:y,style:{fontFamily:k,fontSize:9.5,fontWeight:700,letterSpacing:"0.06em",padding:"2px 9px",borderRadius:5,cursor:"pointer",border:`1px solid ${a===h?"rgba(210,162,76,0.5)":t.border2}`,background:a===h?"rgba(210,162,76,0.14)":"transparent",color:a===h?"#E0C27A":t.muted},children:m},h))})]}),e.jsx(ba,{data:r,maxHeight:s,lens:a}),e.jsx("div",{style:{fontSize:10,color:t.dim,marginTop:6},children:o("markets.gexSurface.sectionNote")}),l&&e.jsx(va,{data:r})]})}const pt=(n,l)=>({fontFamily:k,fontSize:n,color:l}),Jl={...pt(8,t.dim),letterSpacing:"0.12em",textTransform:"uppercase"},ka=[["2m",2],["5m",5],["15m",15],["1h",60]],Wn=n=>{const l=n?.length?n[n.length-1].t:null;return ka.map(([s,i])=>[s,l==null?null:(n||[]).filter(o=>o.t>l-i*60).reduce((o,r)=>o+(r.delta||0),0)])},Il=n=>{if(!n.length||n.some(([,i])=>i==null))return null;const l=n.filter(([,i])=>i>0).length,s=n.filter(([,i])=>i<0).length;return l===4?"up":s===4?"down":"mixed"};function wa({permit:n,symbol:l,title:s=null,footer:i=null,laneNames:o=null}){const{t:r}=W();if(!n)return e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("div",{style:{...Jl,display:"flex",alignItems:"center",gap:5},children:[s||"KNIFE GUARD · TRADE PERMIT",l?` · ${l}`:"",e.jsx(ie,{size:12,title:r("markets.knifeGuard.infoTitle"),what:r("markets.knifeGuard.infoWhat"),how:r("markets.knifeGuard.infoHow")})]}),e.jsx("div",{style:{...pt(9,t.dim),marginTop:8,lineHeight:1.6},children:"permit waiting on current price, bars, and flow"})]});const a=(p,d)=>e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-start",marginTop:6,padding:"7px 9px",borderRadius:7,background:`${d.c}12`,border:`1px solid ${d.c}55`},children:[e.jsx("span",{style:{...pt(10,t.text),fontWeight:900,minWidth:34,whiteSpace:"nowrap"},children:p}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{...pt(10,d.c),fontWeight:900,letterSpacing:"0.08em"},children:[d.state==="FORBIDDEN"?"â FORBIDDEN":d.state==="WAIT"?"â WAIT":"â ALLOWED",e.jsx("span",{style:{...pt(9,t.dim),fontWeight:400,marginLeft:6},children:d.why})]}),d.state!=="ALLOWED"&&e.jsxs("div",{style:{...pt(9,t.dim),marginTop:3,lineHeight:1.7},children:["unlocks:"," ",d.checks.map(([c,u],h)=>e.jsxs("span",{style:{color:u?t.green:t.dim,marginRight:8,whiteSpace:"nowrap",display:"inline-block"},children:[u?"â":"â"," ",c]},h))]})]})]});return e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("div",{style:{...Jl,display:"flex",alignItems:"center",gap:5},children:[s||"KNIFE GUARD · TRADE PERMIT",l?` · ${l}`:"",e.jsx(ie,{size:12,title:r("markets.knifeGuard.infoTitle"),what:r("markets.knifeGuard.infoWhat"),how:r("markets.knifeGuard.infoHow")})]}),a(o&&o[0]||"BUY",n.buy),a(o&&o[1]||"SELL",n.sell),e.jsx("div",{style:{...pt(8,t.dim),marginTop:4,lineHeight:1.5},children:i||e.jsxs(e.Fragment,{children:["behavioral gate â ",n.mode==="price"?"PRICE-TREND mode (no tape flow on this feed) · velocity à structure":"flow à velocity à structure à regime"," · gates YOUR hand, never the engine · display heuristic"]})})]})}const re=(n,l)=>({fontFamily:k,fontSize:n,color:l}),We={...re(8.5,t.dim),letterSpacing:"0.12em",textTransform:"uppercase",fontFamily:"Inter",fontWeight:800},Tt={background:t.panel,border:`1px solid ${t.border}`,borderRadius:10,padding:"10px 12px"}
1,Sa=new Intl.DateTimeFormat("en-US",{timeZone:"America/New_York",hour12:!1,weekday:"short",hour:"2-digit",minute:"2-digit",second:"2-digit"});function _a(){const n={};for(const s of Sa.formatToParts(new Date))n[s.type]=s.value;return{dow:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].indexOf(n.weekday),h:Number(n.hour)%24,m:Number(n.minute),s:Number(n.second)}}const Ke=570,Yt=960;function xi(){const{dow:n,h:l,m:s,s:i}=_a(),o=l*60+s+i/60,r=n>=1&&n<=5;if(r&&o>=Ke&&o<Yt)return{open:!0,minsToClose:Yt-o,minsToOpen:null,mins:o,dow:n};let a=null;if(r&&o<Ke)a=Ke-o;else{let p=n===5?3:n===6?2:1;!r&&n===0&&(p=1),a=p*1440-o+Ke}return{open:!1,minsToClose:null,minsToOpen:a,mins:o,dow:n}}function fi(n,l){return l?n<630?"open":n<840?"midday":n<930?"power":"close":n<Ke?"pre":"after"}const vt={pre:"#8e99a4",open:"#6ed25a",midday:"#5E7FA3",power:"#FFAA00",close:"#ff5b55",after:"#8e99a4"},es=n=>{if(n==null||!isFinite(n))return"â";const l=Math.max(0,Math.round(n*60)),s=Math.floor(l/3600),i=Math.floor(l%3600/60),o=l%60;return s>0?`${s}:${String(i).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${i}:${String(o).padStart(2,"0")}`},Ta=["SPXW","SPX","XSP","NDXP","RUTW","VIXW"];function Ea({symbol:n}){const{t:l}=W(),[,s]=$.useState(0);$.useEffect(()=>{const h=setInterval(()=>s(m=>m+1),1e3);return()=>clearInterval(h)},[]);const i=xi(),o=fi(i.mins,i.open),r=vt[o],a=!i.open&&Ta.includes(String(n||"").toUpperCase()),p=[["pre",l("markets.zerodte.deck.phasePre")],["open",l("markets.zerodte.deck.phaseOpen")],["midday",l("markets.zerodte.deck.phaseMidday")],["power",l("markets.zerodte.deck.phasePower")],["close",l("markets.zerodte.deck.phaseClose")],["after",l("markets.zerodte.deck.phaseAfter")]],d={pre:"thetaPre",open:"thetaOpen",midday:"thetaMidday",power:"thetaPower",close:"thetaClose",after:"thetaAfter"}[o],c=i.open?Math.min(1,Math.max(0,(i.mins-Ke)/(Yt-Ke))):i.mins>=Yt?1:0,u=[["open",60/390],["midday",210/390],["power",90/390],["close",30/390]];return e.jsxs("div",{style:{...Tt,padding:"8px 12px",display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsxs("div",{style:{minWidth:150},children:[e.jsxs("div",{style:{...We,display:"flex",alignItems:"center",gap:5},children:[l("markets.zerodte.deck.clockTitle"),e.jsx(ie,{size:12,title:l("markets.zerodte.deck.guideClockTitle"),what:l("markets.zerodte.deck.guideClockWhat"),how:l("markets.zerodte.deck.guideClockHow"),extra:l("markets.zerodte.deck.guideHonesty")})]}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{...re(22,i.open?i.minsToClose<=45?t.red:t.text:t.dim),fontWeight:800},children:i.open?es(i.minsToClose):es(i.minsToOpen)}),e.jsx("span",{style:{...re(9.5,t.dim)},children:i.open?l("markets.zerodte.deck.toClose"):l("markets.zerodte.deck.toOpen")})]})]}),e.jsx("div",{style:{display:"flex",gap:4,alignItems:"center",flexWrap:"wrap"},children:p.map(([h,m])=>e.jsx("span",{style:{fontSize:9.5,padding:"3px 8px",borderRadius:5,fontWeight:o===h?800:500,border:`1px solid ${o===h?vt[h]:t.border2}`,background:o===h?`${vt[h]}22`:"transparent",color:o===h?vt[h]:t.dim,boxShadow:o===h&&h==="power"?`0 0 8px ${vt[h]}55`:"none"},children:m},h))}),e.jsxs("div",{style:{flex:1,minWidth:220},children:[e.jsxs("div",{style:{position:"relative",height:8,borderRadius:4,overflow:"hidden",display:"flex",border:`1px solid ${t.border2}`},children:[u.map(([h,m])=>e.jsx("div",{style:{width:`${m*100}%`,background:`${vt[h]}${o===h?"66":"22"}`}},h)),e.jsx("div",{style:{position:"absolute",left:`${c*100}%`,top:0,bottom:0,width:2,background:t.text,boxShadow:`0 0 6px ${t.text}`}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",...re(8,t.dim),marginTop:2},children:[e.jsx("span",{children:"09:30"}),e.jsx("span",{children:"10:30"}),e.jsx("span",{children:"14:00"}),e.jsx("span",{children:"15:30"}),e.jsx("span",{children:"16:00 ET"})]})]}),e.jsxs("div",{style:{maxWidth:300},children:[e.jsxs("div",{style:{...re(9.5,r),fontWeight:700},children:["θ · ",l(`markets.zerodte.deck.${d}`)]}),e.jsx("div",{style:{...re(8.5,t.dim),marginTop:1},children:i.open?l("markets.zerodte.deck.expiresToday"):l(a?"markets.zerodte.deck.gthNote":"markets.zerodte.deck.closedNote")})]})]})}const en=(n,l,s,i)=>n!=null&&l!=null&&s?Math.abs(n-l)/s<=i:!1;function $a(n,l){const{spot:s,flip:i,cw:o,pw:r,magnet:a,netGex:p,emLo:d,emHi:c,hiroUp:u,open:h,minsToClose:m,phase:y}=l||{},b=(S,C)=>n(`markets.zerodte.deck.${S}`,C),f=(S,C,I,F=[])=>({state:S,c:C,why:I,checks:F});if(!h){const S=f("WAIT",t.amber,b("whyClosed"),[[b("checkRthOpens"),!1]]);return{buy:S,sell:S,mode:"flow"}}
1if(m!=null&&m<=45){const S=f("FORBIDDEN",t.red,b("whyThetaCliff",{m:Math.max(1,Math.round(m))}),[[b("checkNextSession"),!1]]);return{buy:S,sell:S,mode:"flow"}}if(!s||i==null&&o==null&&r==null){const S=f("WAIT",t.amber,b("noMap"));return{buy:S,sell:S,mode:"flow"}}const w=i!=null?s>=i:p!=null?p>=0:!0,v=en(s,i,s,.001),g=y==="power"||y==="close"?` · ${b("thetaTail")}`:"",x=S=>R(S,s>=1e3?0:2),j=[b("checkDealerBuy"),u===!0],_=[b("checkDealerSell"),u===!1];let E;v?E=f("WAIT",t.amber,b("whyAtFlip",{f:x(i)}),[[b("checkHoldAbove",{f:x(i)}),s>i],j]):w?en(s,o,s,.0025)?E=f("WAIT",t.amber,b("whyAtCallWall",{cw:x(o)}),[[b("checkBreakHold",{l:x(o)}),s>o],j]):c!=null&&s>=c?E=f("WAIT",t.amber,b("whyBeyondEmHigh"),[[b("checkBackInside"),s<c],j]):E=f("ALLOWED",t.green,b("allowedWithPin",{cw:o!=null?x(o):"â"})+g):E=f("FORBIDDEN",t.red,b("whyBelowFlip"),[[b("checkReclaimFlip",{f:i!=null?x(i):"â"}),!1],j]);let T;return v?T=f("WAIT",t.amber,b("whyAtFlip",{f:x(i)}),[[b("checkLoseFlipChk",{f:x(i)}),s<i],_]):w?en(s,o,s,.0025)?T=f("ALLOWED",t.green,b("allowedFade",{m:a!=null?x(a):i!=null?x(i):"â"})+g):T=f("WAIT",t.amber,b("whyPinDips"),[[b("checkLoseFlipChk",{f:i!=null?x(i):"â"}),!1],_]):en(s,r,s,.0025)?T=f("WAIT",t.amber,b("whyAtPutWall",{pw:x(r)}),[[b("checkBreakBelow",{l:x(r)}),s<r],_]):d!=null&&s<=d?T=f("WAIT",t.amber,b("whyBeyondEmLow"),[[b("checkBackInside"),s>d],_]):T=f("ALLOWED",t.green,b("allowedAmplify")+g),{buy:E,sell:T,mode:"flow"}}function yi(n,l){const s=Date.now()*1e6,i=h=>{if(h?.dte!=null)return Number(h.dte)===0;if(!h?.expiry)return!1;const m=new Date(String(h.expiry)+"T00:00:00Z");return!isNaN(m)&&Math.max(0,Math.round((m-Date.now())/864e5))===0},o=h=>{const m=String(h.cp||"").toUpperCase().startsWith("C");return h.side==="at_or_above_ask"?m?1:-1:h.side==="at_or_below_bid"?m?-1:1:0},r=(n||[]).filter(i),a=h=>{let m=0,y=0;for(const b of r){if(!(Number(b.ts_ns)>s-h*6e10))continue;const f=Number(b.total_premium??b.premium)||0,w=o(b);w>0?m+=f:w<0&&(y+=f)}return{bull:m,bear:y}},p=a(15),d=a(60);let c=null;{const h={};for(const y of r){if(!(Number(y.ts_ns)>s-30*6e10))continue;const b=Number(y.strike);isFinite(b)&&(h[b]=(h[b]||0)+(Number(y.total_premium??y.premium)||0))}const m=Object.entries(h).sort((y,b)=>b[1]-y[1])[0];m&&m[1]>0&&(c={strike:Number(m[0]),prem:m[1]})}let u=null;{const h=r.filter(m=>Number(m.ts_ns)>s-27e11&&l&&isFinite(Number(m.strike))&&Math.abs(Number(m.strike)-l)/l<.006&&Number(m.bid)>0&&Number(m.ask)>Number(m.bid)).map(m=>(Number(m.ask)-Number(m.bid))/((Number(m.ask)+Number(m.bid))/2)*100).sort((m,y)=>m-y);h.length>=3&&(u={pct:h[Math.floor(h.length/2)],n:h.length})}return{bias15:p,bias60:d,battleground:c,spreadTax:u}}function bi(n){const l=String(n||"").toUpperCase(),{data:s,lastUpdated:i}=H(()=>Ne(n),3e3,[n]),{data:o}=H(()=>$t(n),3e4,[n]),{data:r}=H(()=>Qs(n,300),45e3,[n]),{data:a}=H(()=>Ct(n,"5m",96),3e4,[n]),{data:p}=H(()=>$n({limit:300,underlying:l}),1e4,[l]),{data:d}=H(()=>Rn(n),6e4,[n]),c=$.useMemo(()=>{const m=s&&s.gex||{},y=s&&s.gex_0dte||{},b=y.net_gex!=null?y:m,f=s?.spot??null,w=s&&s.vol||{},v=o?.expected_move_pct,g=v!=null&&f?f*(1-Math.abs(v)/100):null,x=v!=null&&f?f*(1+Math.abs(v)/100):null,j=v!=null&&f?f*Math.abs(v)/100:null,_=o?.straddle_price!=null?Number(o.straddle_price):null,E=Array.isArray(r?.series)?r.series:[];let T=null;if(E.length>=2){const K=Number(E[E.length-1].cum),M=Number(E[E.length-1].t)-900,ne=[...E].reverse().find(ue=>Number(ue.t)<=M)||E[0],oe=K-Number(ne.cum);isFinite(oe)&&(T=oe>=0)}const S=xi(),C=Date.now()/1e3,I=S.dow>=1&&S.dow<=5&&S.mins>=Ke?Math.min(S.mins,Yt)-Ke:0,F=(Array.isArray(a?.candles)?a.candles:[]).map(K=>({t:Number(K.ts??K.t),h:Number(K.high??K.h??K.close??K.c),l:Number(K.low??K.l??K.close??K.c),c:Number(K.close??K.c)})).filter(K=>isFinite(K.c)&&I>0&&K.t>=C-I*60-300),A=F.map(K=>K.c),P=F.map(K=>K.h).filter(isFinite),V=F.map(K=>K.l).filter(isFinite),J=P.length?Math.max(...P):null,Q=V.length?Math.min(...V):null,U=A.length>=7?Math.abs(A[A.length-1]-A[A.length-7]):null,D=S.open&&S.minsToClose>5&&_!=null&&_>0?_/(S.minsToClose/30):null,B=U!=null&&D!=null&&D>0?U/D:null,te=J!=null&&Q!=null&&j!=null&&j>0?Math.max(0,Math.min(200,(J-Q)/(2*j)*100)):null,xe=y.net_gex!=null?Math.abs(Number(y.net_gex)):null,me=m.net_gex!=null?Math.abs(Number(m.net_gex)):null,be=xe!=null&&me!=null&&me>0?Math.max(0,Math.min(100,xe/me*100)):null;let Y=null;if(A.length>=13){const K=[];for(let M=1;M<A.length;M++)A[M-1]>0&&K.push(Math.log(A[M]/A[M-1]));if(K.length>=12){const M=K.reduce((oe,ue)=>oe+ue,0)/K.length,ne=K.reduce((oe,ue)=>oe+(ue-M)*(ue-M),0)/K.length;Y=Math.sqrt(ne)*Math.sqrt(19656)*100}}const fe=w.atm_iv!=null?Number(w.atm_iv)*100:null,ke=fe!=null&&Y!=null&&Y>.5?fe/Y:null,we=Array.isArray(p?.notable)?p.notable:[],{bias15:z,bias60:N,battleground:G,spreadTax:Z}=yi(we,f),se=(d?.by_strike||[]).filter(K=>K&&K.strike!=null),le=se.length?Math.max(...se.map(K=>Math.abs(Number(K.net_gex||0)))):0,de=K=>{if(K==null||!se.length||le<=0)return null;let M=null,ne=1/0;for(const oe of se){const ue=Math.abs(Number(oe.strike)-K);ue<ne&&(ne=ue,M=oe)}return!M||f&&ne/f>.002?null:Math.abs(Number(M.net_gex||0))/le};return{agg:s,lastUpdated:i,spot:f,flip:b.flip_strike??null,cw:b.call_wall??null,pw:b.put_wall??null,magnet:y.magnet??null,netGex:b.net_gex??null,regimePos:b.net_gex!=null?b.net_gex>=0:null,maxPain:s?.max_pain??null,charmPin:s?.charm?.pin_strike??null,charmNet:s?.charm?.net_charm??null,emLo:g,emHi:x,emPct:v??null,emPts:j,straddle:_,hiroUp:T,open:S.open,minsToClose:S.minsToClose,phase:fi(S.mins,S.open),dayHigh:J,dayLow:Q,paceActual:U,paceRequired:D,thetaRatio:B,fuelPct:te,cliffPct:be,g0abs:xe,gAllabs:me,rvPct:Y,ivPct:fe,vrpRatio:ke,bias15:z,bias60:N,battleground:G,spreadTax:Z,wallStrength:{cw:de(b.call_wall),pw:de(b.put_wall)}}},[s,o,r,a,p,d,i]),u=$.useRef({t:0,vals:null});if(c.spot!=null)return u.current={t:Date.now(),vals:{spot:c.spot,flip:c.flip,cw:c.cw,pw:c.pw,magnet:c.magnet,netGex:c.netGex,regimePos:c.regimePos,maxPain:c.maxPain,charmPin:c.charmPin,charmNet:c.charmNet,cliffPct:c.cliffPct,g0abs:c.g0abs,gAllabs:c.gAllabs,ivPct:c.ivPct,vrpRatio:c.vrpRatio,wallStrength:c.wallStrength}},c;const h=(Date.now()-u.current.t)/1e3;return u.current.vals&&h<=180?{...c,...u.current.vals,heldStale:!0,heldAgeS:Math.round(h)}:c}function Ca(n){const l=String(n||"").toUpperCase(),{data:s}=H(()=>$n({limit:300,underlying:l}),1e4,[l]),{data:i}=H(()=>Ne(n),2e4,[n]);return $.useMemo(()=>
1yi(Array.isArray(s?.notable)?s.notable:[],i?.spot??null),[s,i])}function Aa({d:n}){const{t:l}=W(),s=n.flip!=null&&n.spot?50+50*Math.tanh((n.spot-n.flip)/n.spot*100/.6):null,i=n.flip!=null&&n.spot&&Math.abs(n.spot-n.flip)/n.spot<=.001,o=s==null?l("markets.zerodte.deck.regimeUnknown"):i?l("markets.zerodte.deck.regimeAt"):n.spot>=n.flip?l("markets.zerodte.deck.regimeAbove"):l("markets.zerodte.deck.regimeBelow"),r=s==null?t.dim:i?t.amber:n.spot>=n.flip?t.green:t.red;return e.jsxs("div",{children:[e.jsxs("div",{style:{...We,display:"flex",alignItems:"center",gap:5},children:[l("markets.zerodte.deck.regimeTitle"),e.jsx(ie,{size:12,title:l("markets.zerodte.deck.guideRegimeTitle"),what:l("markets.zerodte.deck.guideRegimeWhat"),how:l("markets.zerodte.deck.guideRegimeHow"),extra:l("markets.zerodte.deck.guideHonesty")})]}),e.jsx("div",{style:{position:"relative",height:12,borderRadius:6,marginTop:4,background:`linear-gradient(90deg, ${t.red}33, ${t.amber}22, ${t.green}33)`,border:`1px solid ${t.border2}`},children:s!=null&&e.jsx("div",{style:{position:"absolute",left:`${Math.max(2,Math.min(98,s))}%`,top:-2,bottom:-2,width:3,background:r,borderRadius:2,boxShadow:`0 0 6px ${r}`}})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",...re(8,t.dim),marginTop:2},children:[e.jsx("span",{style:{color:t.red},children:l("markets.zerodte.deck.amplify")}),e.jsx("span",{style:{color:t.green},children:l("markets.zerodte.deck.pin")})]}),e.jsx("div",{style:{...re(9.5,r),marginTop:3,lineHeight:1.4},children:o})]})}function Ra({d:n}){const{t:l}=W(),s=n.netGex,i=s!=null?Math.min(1,Math.log10(1+Math.abs(s)/1e8)/Math.log10(51)):0,o=s==null?t.dim:s>=0?t.green:t.red,r=n.charmPin!=null&&n.spot?n.charmPin>=n.spot?"â":"â":null;return e.jsxs("div",{style:{display:"flex",gap:12,marginTop:10},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:We,children:l("markets.zerodte.deck.netGex")}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:3},children:[e.jsx("div",{style:{flex:1,height:6,background:t.border2,borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${Math.round(i*100)}%`,height:"100%",background:o}})}),e.jsx("span",{style:{...re(10.5,o),fontWeight:800,whiteSpace:"nowrap"},children:s!=null?ee(s):"â"})]})]}),e.jsxs("div",{style:{minWidth:108},children:[e.jsx("div",{style:We,children:l("markets.zerodte.deck.charm")}),e.jsx("div",{style:{...re(10.5,n.charmPin!=null?t.amber:t.dim),fontWeight:800,marginTop:3},children:n.charmPin!=null?e.jsxs(e.Fragment,{children:[r," ",l("markets.zerodte.deck.charmToward",{strike:R(n.charmPin,0)})]}):l("markets.zerodte.deck.charmFlat")})]})]})}function Fa({d:n}){const{t:l}=W(),s=n.spot!=null&&n.spot>=1e3?0:2,i=[["callWall",n.cw,t.green],["emHigh",n.emHi,t.blue],["magnet",n.magnet,t.amber],["maxPain",n.maxPain,"#D2A24C"],["flip",n.flip,t.amber],["emLow",n.emLo,t.blue],["putWall",n.pw,t.red]].filter(([,a])=>a!=null&&isFinite(Number(a))).map(([a,p,d])=>({k:a,v:Number(p),c:d})).sort((a,p)=>p.v-a.v);if(!i.length||n.spot==null)return e.jsx("div",{style:{...re(9.5,t.dim),marginTop:10},children:l("markets.zerodte.deck.noLevels")});const o=i.findIndex(a=>a.v<=n.spot),r=[...i];return r.splice(o===-1?i.length:o,0,{k:"spot",v:n.spot,c:t.text,isSpot:!0}),e.jsxs("div",{style:{marginTop:10},children:[e.jsx("div",{style:We,children:l("markets.zerodte.deck.levels")}),e.jsx("div",{style:{marginTop:4},children:r.map(a=>{const p=a.isSpot?null:a.v-n.spot,d=a.isSpot?null:p/n.spot*100;return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,padding:"2px 4px",borderRadius:4,background:a.isSpot?"rgba(255,255,255,0.07)":"transparent"},children:[e.jsx("span",{style:{...re(9,a.c),width:74,fontFamily:"Inter",fontWeight:a.isSpot?900:700,letterSpacing:.3},children:l(`markets.zerodte.deck.lvl_${a.k}`)}),e.jsx("span",{style:{...re(10.5,a.c),fontWeight:a.isSpot?900:700},children:R(a.v,s)}),!a.isSpot&&e.jsxs("span",{style:{...re(9,p>=0?t.green:t.red),marginLeft:"auto"},children:[p>=0?"+":"",R(p,s)," · ",d>=0?"+":"",d.toFixed(2),"%",n.emPts>0?` · ${(Math.abs(p)/n.emPts).toFixed(1)}EM`:""]}),a.isSpot&&e.jsx("span",{style:{...re(8.5,t.dim),marginLeft:"auto"},children:l("markets.zerodte.deck.youAreHere")})]},a.k+a.v)})})]})}function vi(n,l){if(!n||!n.spot||n.flip==null&&n.cw==null&&n.pw==null)return null;const s=(p,d)=>l(`markets.zerodte.deck.${p}`,d),i=n.spot>=1e3?0:2,o=[];(n.flip!=null?n.spot>=n.flip:n.regimePos??!0)?o.push(s("readPin",{pw:n.pw!=null?R(n.pw,i):"â",cw:n.cw!=null?R(n.cw,i):"â",m:n.magnet!=null?R(n.magnet,i):n.maxPain!=null?R(n.maxPain,i):"â"})):o.push(s("readAmplify",{f:n.flip!=null?R(n.flip,i):"â"}));const a=[["lvl_callWall",n.cw],["lvl_putWall",n.pw],["lvl_flip",n.flip],["lvl_emHigh",n.emHi],["lvl_emLow",n.emLo]].filter(([,p])=>p!=null).map(([p,d])=>({k:p,v:Number(d),dist:Math.abs(Number(d)-n.spot)/n.spot})).sort((p,d)=>p.dist-d.dist)[0];return a&&a.dist<=.0015&&o.push(s("readNear",{name:l(`markets.zerodte.deck.${a.k}`),lvl:R(a.v,i)}
1)),(n.phase==="power"||n.phase==="close")&&n.charmPin!=null&&o.push(s("readTime",{pin:R(n.charmPin,0)})),o.join(" ")}function Na({d:n}){const{t:l}=W(),s=vi(n,l)||l("markets.zerodte.deck.readWaiting");return e.jsxs("div",{style:{marginTop:10,borderTop:`1px dashed ${t.border2}`,paddingTop:8},children:[e.jsx("div",{style:{...We,color:t.gold},children:l("markets.zerodte.deck.readTitle")}),e.jsx("div",{style:{fontSize:11.5,color:t.text,lineHeight:1.5,marginTop:3},children:s})]})}function ji({symbol:n,d:l,fill:s=!1}){const{t:i}=W(),o=(l.spot!=null&&l.spot>=1e3,2),r=$.useMemo(()=>{try{return $a(i,l)}catch{return null}},[i,l]);return e.jsxs("div",{style:{...Tt,...s?{width:"100%",flex:1,minHeight:0}:{width:292,flexShrink:0},overflowY:"auto",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{fontSize:16,fontWeight:900,color:t.text},children:String(n||"").toUpperCase()}),e.jsx("span",{style:{...re(19,t.text),fontWeight:800,marginLeft:"auto"},children:l.spot!=null?R(l.spot,o):"â"})]}),e.jsx("div",{style:{...re(8.5,t.dim),marginBottom:8},children:i("markets.zerodte.deck.railSub")}),l.heldStale&&e.jsx("div",{style:{...re(8,t.gold),fontWeight:800,marginBottom:6},children:i("markets.zerodte.deck.lastMeasured",{s:l.heldAgeS})}),e.jsx(Aa,{d:l}),e.jsx(Ra,{d:l}),e.jsx(ki,{d:l}),e.jsx(Fa,{d:l}),e.jsx("div",{style:{marginTop:12},children:r&&e.jsx(wa,{permit:r,symbol:String(n||"").toUpperCase(),title:i("markets.zerodte.deck.permitTitle"),laneNames:[i("markets.zerodte.deck.laneCalls"),i("markets.zerodte.deck.lanePuts")],footer:i("markets.zerodte.deck.permitFooter")})}),e.jsx(Na,{d:l})]})}function Ia({d:n}){const{t:l}=W(),s=n.spot!=null&&n.spot>=1e3?0:2,i=[["putWall",n.pw,t.red,"â¼"],["flip",n.flip,t.amber,"â"],["magnet",n.magnet,t.amber,"â"],["maxPain",n.maxPain,"#D2A24C","·"],["callWall",n.cw,t.green,"â²"]].filter(([,m])=>m!=null&&isFinite(Number(m))).map(([m,y,b,f])=>({k:m,v:Number(y),c:b,g:f})),o=[...i.map(m=>m.v),n.spot,n.emLo,n.emHi].filter(m=>m!=null&&isFinite(m));if(!o.length||n.spot==null)return e.jsxs("div",{style:{...Tt},children:[e.jsxs("div",{style:{...We,display:"flex",alignItems:"center",gap:5},children:[l("markets.zerodte.deck.beamTitle"),e.jsx(ie,{size:12,title:l("markets.zerodte.deck.guideBeamTitle"),what:l("markets.zerodte.deck.guideBeamWhat"),how:l("markets.zerodte.deck.guideBeamHow"),extra:l("markets.zerodte.deck.guideHonesty")})]}),e.jsx("div",{style:{...re(10,t.dim),padding:"14px 0"},children:l("markets.zerodte.deck.noLevels")})]});const r=Math.min(...o),a=Math.max(...o),p=Math.max((a-r)*.06,n.spot*8e-4),d=r-p,c=a+p,u=m=>`${((m-d)/(c-d)*100).toFixed(2)}%`,h=[...i].sort((m,y)=>m.v-y.v);return e.jsxs("div",{style:{...Tt},children:[e.jsxs("div",{style:{...We,display:"flex",alignItems:"center",gap:5},children:[l("markets.zerodte.deck.beamTitle"),e.jsx(ie,{size:12,title:l("markets.zerodte.deck.guideBeamTitle"),what:l("markets.zerodte.deck.guideBeamWhat"),how:l("markets.zerodte.deck.guideBeamHow"),extra:l("markets.zerodte.deck.guideHonesty")}),n.emPct!=null&&e.jsxs("span",{style:{...re(9,t.blue),marginLeft:"auto"},children:[l("markets.zerodte.deck.emBand")," ±",Math.abs(n.emPct).toFixed(1),"%"]})]}),e.jsxs("div",{style:{position:"relative",height:86,marginTop:6},children:[e.jsx("div",{style:{position:"absolute",left:0,right:0,top:42,height:6,borderRadius:3,background:t.border2}}),n.emLo!=null&&n.emHi!=null&&e.jsx("div",{style:{position:"absolute",top:38,height:14,borderRadius:4,left:u(n.emLo),width:`calc(${u(n.emHi)} - ${u(n.emLo)})`,background:"rgba(57,141,255,0.16)",border:"1px solid rgba(57,141,255,0.35)"}}),h.map((m,y)=>{const b=y%2===0;return e.jsxs("div",{children:[(()=>{const f=m.k==="callWall"?n.wallStrength?.cw:m.k==="putWall"?n.wallStrength?.pw:null,w=f!=null?14+Math.round(20*f):22,v=f!=null&&f>=.6?4:2;return e.jsx("div",{style:{position:"absolute",left:u(m.v),top:45-w/2,width:v,height:w,background:m.c,transform:"translateX(-1px)"}})})(),e.jsxs("div",{style:{position:"absolute",left:u(m.v),top:b?2:62,transform:"translateX(-50%)",textAlign:"center",whiteSpace:"nowrap"},children:[e.jsxs("div",{style:{...re(8.5,m.c),fontFamily:"Inter",fontWeight:800,letterSpacing:.3},children:[m.g," ",l(`markets.zerodte.deck.lvl_${m.k}`)]}),e.jsx("div",{style:{...re(9.5,m.c),fontWeight:700},children:R(m.v,s)}),(()=>{const f=m.k==="callWall"?n.wallStrength?.cw:m.k==="putWall"?n.wallStrength?.pw:null;return f==null?null:f>=.6?e.jsx("div",{style:{...re(7.5,m.c),fontWeight:900,letterSpacing:"0.08em"},children:l("markets.zerodte.deck.wallFortress")}):f<=.15?e.jsx("div",{style:{...re(7.5,t.dim)},children:l("markets.zerodte.deck.wallThin")}):null})()]})]},m.k+m.v)}),[["emLow",n.emLo],["emHigh",n.emHi]].filter(([,m])=>m!=null).map(([m,y])=>e.jsx("div",{style:{position:"absolute",left:u(y),top:36,width:1,height:18,background:"rgba(57,141,255,0.8)"}},m)),e.jsx("div",{style:{position:"absolute",left:u(n.spot),top:28,width:3,height:34,background:t.text,transform:"translateX(-1.5px)",borderRadius:2,boxShadow:`0 0 8px ${t.text}`}}),e.jsx("div",{style:{position:"absolute",left:u(n.spot),top:14,transform:"translateX(-50%)",whiteSpace:"nowrap",background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:4,padding:"1px 6px"},children:e.jsxs("span",{style:{...re(10,t.text),fontWeight:900},children:[l("markets.zerodte.deck.lvl_spot")," ",R(n.spot,s)]})})]}),(()=>{const m=n.flip!=null&&n.spot!=null?l(n.spot>=n.flip?"markets.structureStrip.aboveFlip":"markets.structureStrip.belowFlip"):null,y=f=>f!=null&&n.spot!=null&&n.emPts?Math.abs(f-n.spot)/n.emPts:null,b=[m,y(n.cw)!=null?l("markets.structureStrip.emToCallWall",{em:y(n.cw).toFixed(1)}):null,y(n.pw)!=null?l("markets.structureStrip.emToPutWall",{em:y(n.pw).toFixed(1)}
1):null].filter(Boolean);return b.length?e.jsx("div",{style:{...re(9,t.amber),marginTop:4,letterSpacing:"0.04em"},children:b.join(" · ")}):null})(),e.jsxs("div",{style:{display:"flex",gap:14,...re(8.5,t.dim),marginTop:2,flexWrap:"wrap"},children:[n.pw!=null&&e.jsxs("span",{children:[l("markets.zerodte.deck.lvl_putWall")," ",R(n.spot-n.pw,s)," ",l("markets.zerodte.deck.below")]}),n.cw!=null&&e.jsxs("span",{children:[l("markets.zerodte.deck.lvl_callWall")," ",R(n.cw-n.spot,s)," ",l("markets.zerodte.deck.above")]}),n.flip!=null&&e.jsxs("span",{children:[l("markets.zerodte.deck.lvl_flip")," ",n.spot>=n.flip?R(n.spot-n.flip,s)+" "+l("markets.zerodte.deck.below"):R(n.flip-n.spot,s)+" "+l("markets.zerodte.deck.above")]})]})]})}function Ma(n,l){const s=(d,c)=>n(`markets.zerodte.deck.${d}`,c),i=l.spot!=null&&l.spot>=1e3?0:2,o=d=>d!=null?R(d,i):"â",r=l.flip!=null&&l.spot!=null?l.spot>=l.flip:l.regimePos??null,a=d=>d!=null&&l.spot?Math.abs(d-l.spot)/l.spot:null,p=[];{const d=a(l.cw),c=a(l.pw),u=d!=null&&(c==null||d<=c)?"cw":c!=null?"pw":null,h=u==="cw"?d:c,m=u==="cw"?l.cw:l.pw,y=l.magnet??l.flip??l.maxPain;u==null||l.spot==null?p.push({k:"wallFade",state:"OFF",note:s("noLevels"),play:"",c:t.dim}):r===!0&&h<=.0025?p.push({k:"wallFade",state:"ARMED",note:s("scWallArmed",{w:o(m)}),play:u==="cw"?s("scWallPlayPuts",{target:o(y)}):s("scWallPlayCalls",{target:o(y)}),c:u==="cw"?t.red:t.green}):p.push({k:"wallFade",state:"STANDBY",note:r===!1?s("scWallNeedsPin"):s("scWallStandby",{w:o(m),d:(h*100).toFixed(2)}),play:s("scWallPlayGeneric"),c:t.dim})}{const d=a(l.flip);l.flip==null||l.spot==null?p.push({k:"flipBreak",state:"OFF",note:s("regimeUnknown"),play:"",c:t.dim}):d<=.003?p.push({k:"flipBreak",state:"ARMED",note:s("scFlipArmed",{f:o(l.flip)}),play:s("scFlipPlay",{f:o(l.flip)}),c:t.amber}):p.push({k:"flipBreak",state:"STANDBY",note:s("scFlipStandby",{f:o(l.flip),d:(d*100).toFixed(2)}),play:s("scFlipPlayGeneric"),c:t.dim})}{const d=l.charmPin!=null&&(l.emLo==null||l.charmPin>=l.emLo)&&(l.emHi==null||l.charmPin<=l.emHi),c=l.phase==="power"||l.phase==="close";l.charmPin==null?p.push({k:"pinDrift",state:"OFF",note:s("charmFlat"),play:"",c:t.dim}):c&&r===!0&&d?p.push({k:"pinDrift",state:"ARMED",note:s("scPinArmed",{pin:R(l.charmPin,0)}),play:s("scPinPlay",{pin:R(l.charmPin,0)}),c:t.amber}):p.push({k:"pinDrift",state:"STANDBY",note:s("scPinStandby",{pin:R(l.charmPin,0)}),play:s("scPinPlayGeneric"),c:t.dim})}if(l.emLo==null||l.emHi==null||l.spot==null)p.push({k:"emEdge",state:"OFF",note:s("emUnknown"),play:"",c:t.dim});else if(l.spot>=l.emHi||l.spot<=l.emLo){const d=l.spot>=l.emHi;p.push({k:"emEdge",state:"ARMED",note:s("scEmArmed",{edge:o(d?l.emHi:l.emLo)}),play:r===!0?s(d?"scEmPlayFadeHigh":"scEmPlayFadeLow",{target:o(l.magnet??l.flip)}):s("scEmPlayBreak"),c:r===!0?t.blue:t.red})}else p.push({k:"emEdge",state:"STANDBY",note:s("scEmStandby",{lo:o(l.emLo),hi:o(l.emHi)}),play:s("scEmPlayGeneric"),c:t.dim});return p}function za({d:n}){const{t:l}=W(),s=$.useMemo(()=>{try{return Ma(l,n)}catch{return[]}},[l,n]),i=(r,a)=>({fontSize:8.5,fontWeight:900,letterSpacing:"0.1em",padding:"2px 7px",borderRadius:4,color:r==="ARMED"?a:t.dim,border:`1px solid ${r==="ARMED"?a:t.border2}`,background:r==="ARMED"?`${a}1e`:"transparent"}),o={wallFade:"scWallName",flipBreak:"scFlipName",pinDrift:"scPinName",emEdge:"scEmName"};return e.jsxs("div",{style:{...Tt},children:[e.jsxs("div",{style:{...We,display:"flex",alignItems:"center",gap:5,marginBottom:6},children:[l("markets.zerodte.deck.scenarioTitle"),e.jsx(ie,{size:12,title:l("markets.zerodte.deck.guideScenTitle"),what:l("markets.zerodte.deck.guideScenWhat"),how:l("markets.zerodte.deck.guideScenHow"),extra:l("markets.zerodte.deck.guideHonesty")}),e.jsx("span",{style:{...re(8,t.dim),marginLeft:"auto"},children:l("markets.zerodte.deck.shadowTag")})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:8},children:s.map(r=>e.jsxs("div",{style:{background:t.panel2,border:`1px solid ${r.state==="ARMED"?r.c:t.border2}`,borderRadius:8,padding:"8px 10px",opacity:r.state==="OFF"?.55:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:900,color:t.text,letterSpacing:.4},children:l(`markets.zerodte.deck.${o[r.k]}`)}),e.jsx("span",{style:{marginLeft:"auto",...i(r.state,r.c)},children:l(`markets.zerodte.deck.state${r.state}`)})]}),e.jsx("div",{style:{...re(9.5,r.state==="ARMED"?t.text:t.dim),marginTop:4,lineHeight:1.45,fontFamily:"Inter"},children:r.note}),r.play&&e.jsx("div",{style:{...re(9.5,r.c),marginTop:4,fontWeight:700,lineHeight:1.4},children:r.play})]},r.k))})]})}function Wa({d:n}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx(Ia,{d:n}),e.jsx(za,{d:n})]})}function tn({title:n,guideKey:l,children:s}){const{t:i}=W();return e.jsxs("div",{style:{background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:8,padding:"8px 10px",minWidth:0},children:[e.jsxs("div",{style:{...We,display:"flex",alignItems:"center",gap:5},children:[n,e.jsx(ie,{size:11,title:i(`markets.zerodte.deck.${l}Title`),what:i(`markets.zerodte.deck.${l}What`),how:i(`markets.zerodte.deck.${l}How`),extra:i("markets.zerodte.deck.guideHonesty")})]}),s]})}const nn=(n,l)=>e.jsx("div",{style:{height:6,background:t.border2,borderRadius:3,overflow:"hidden",marginTop:5},children:e.jsx("div",{style:{width:`${Math.max(0,Math.min(100,n||0))}%`,height:"100%",background:l}})});function Da({d:n}){const{t:l}=W(),s=(w,v)=>l(`markets.zerodte.deck.${w}`,v),i=n.spot!=null&&n.spot>=1e3?1:2,o=n.thetaRatio,r=o==null?t.dim:o<.7?t.red:o<=1.3?t.amber:t.green,a=o==null?"â":o<.7?s("vThetaDecay"):o<=1.3?s("vThetaNeck"):s("vThetaMovers"),p=n.fuelPct,d=p==null?t.dim:p<50?t.green:p<85?t.amber:t.red,c=p==null?"":p<50?s("vFuelEarly"):p<85?s("vFuelBurning"):s("vFuelEmpty"),u=n.cliffPct,h=u==null?t.dim:u>=60?t.red:u>=30?t.amber:t.green,m=u==null?"":u>=60?s("vCliffHigh"):u>=30?s("vCliffMid"):s("vCliffLow"),y=n.vrpRatio,b=y==null?t.dim:y>1.25?t.red:y>=.8?t.amber:t.green,f=y==null?n.ivPct!=null?s("vVrpWarming"):"â":y>1.25?s("vVrpRich"):y>=.8?s("vVrpFair"):s("vVrpCheap");return e.jsx("div",{style:{...Tt,padding:"8px 12px"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(230px, 1fr))",gap:8},children:[e.jsxs(tn,{title:s("vThetaTitle"),guideKey:"guideTheta",children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginTop:3},children:[e.jsx("span",{style:{...re(13,r),fontWeight:900},children:a}),o!=null&&e.jsxs("span",{style:{...re(9,t.dim)},children:["Ã",o.toFixed(2)]})]}),nn(o==null?0:o/2*100,r),e.jsx("div",{style:{...re(8.5,t.dim),marginTop:3},children:n.paceRequired!=null?s("vThetaSub",{need:R(n.paceRequired,i),get:n.paceActual!=null?R(n.paceActual,i):"â"}):n.open?s("vWaitingBars"):s("vClosed")})]}),e.jsxs(tn,{title:s("vFuelTitle"),guideKey:"guideFuel",children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginTop:3},children:[e.jsx("span",{style:{...re(13,d),fontWeight:900},children:p!=null?`${Math.round(p)}%`:"â"}),e.jsx("span",{style:{...re(9,d)},children:c})]}),nn(p,d),e.jsx("div",{style:{...re(8.5,t.dim),marginTop:3},children:n.dayHigh!=null&&n.dayLow!=null&&n.emPts!=null&&n.emPts>0?s("vFuelSub",{range:R(n.dayHigh-n.dayLow,i),band:R(2*n.emPts,i)}):n.open?s("vWaitingBars"):s("vClosed")})]}),e.jsxs(tn,{title:s("vCliffTitle"),guideKey:"guideCliff",children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginTop:3},children:[e.jsx("span",{style:{...re(13,h),fontWeight:900},children:u!=null?`${Math.round(u)}%`:"â"}),e.jsx("span",{style:{...re(9,h)},children:m})]}),nn(u,h),e.jsx("div",{style:{...re(8.5,t.dim),marginTop:3},children:n.g0abs!=null&&n.gAllabs!=null&&n.gAllabs>0?s("vCliffSub",{today:ee(n.g0abs),all:ee(n.gAllabs)}):s("noMap")})]}),e.jsxs(tn,{title:s("vVrpTitle"),guideKey:"guideVrp",children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginTop:3},children:[e.jsx("span",{style:{...re(13,b),fontWeight:900},children:f}),y!=null&&e.jsxs("span",{style:{...re(9,t.dim)},children:["Ã",y.toFixed(2)]})]}),nn(y==null?0:y/2*100,b),e.jsx("div",{style:{...re(8.5,t.dim),marginTop:3},children:n.ivPct!=null?s("vVrpSub",{iv:n.ivPct.toFixed(1),rv:n.rvPct
1!=null?n.rvPct.toFixed(1):"â¦"}):s("noMap")})]})]})})}function ki({d:n}){const{t:l}=W(),s=(r,a)=>l(`markets.zerodte.deck.${r}`,a),i=(r,a)=>{const p=a.bull+a.bear,d=p>0?a.bull/p*100:null;return e.jsxs("div",{style:{marginTop:4},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",...re(8.5,t.dim)},children:[e.jsx("span",{children:r}),e.jsxs("span",{children:[e.jsx("span",{style:{color:t.green},children:ee(a.bull)})," / ",e.jsx("span",{style:{color:t.red},children:ee(a.bear)})]})]}),e.jsxs("div",{style:{height:5,borderRadius:3,overflow:"hidden",display:"flex",background:t.border2,marginTop:2},children:[d!=null&&e.jsx("div",{style:{width:`${d}%`,background:t.green}}),d!=null&&e.jsx("div",{style:{flex:1,background:t.red}})]})]})},o=!n.bias60||n.bias60.bull+n.bias60.bear<=0;return e.jsxs("div",{style:{marginTop:10},children:[e.jsxs("div",{style:{...We,display:"flex",alignItems:"center",gap:5},children:[s("tapeTitle"),e.jsx(ie,{size:11,title:l("markets.zerodte.deck.guideTapeTitle"),what:l("markets.zerodte.deck.guideTapeWhat"),how:l("markets.zerodte.deck.guideTapeHow"),extra:l("markets.zerodte.deck.guideHonesty")})]}),o?e.jsx("div",{style:{...re(9,t.dim),marginTop:4},children:s("tapeQuiet")}):e.jsxs(e.Fragment,{children:[i(s("tape15"),n.bias15),i(s("tape60"),n.bias60),n.battleground&&e.jsx("div",{style:{...re(9,t.amber),marginTop:5,fontWeight:700},children:s("tapeFight",{strike:R(n.battleground.strike,0),prem:ee(n.battleground.prem)})}),n.spreadTax&&e.jsx("div",{style:{...re(8.5,t.dim),marginTop:3},children:s("tapeSpread",{pct:n.spreadTax.pct.toFixed(1),n:n.spreadTax.n})})]})]})}const wi=[["S&P",["SPXW","SPY","XSP"]],["NDX",["QQQ","NDXP"]],["RUT",["IWM","RUTW"]],["VOL",["VIXW"]]];wi.flatMap(([,n])=>n);const Si=(n,l)=>({fontSize:11,padding:"4px 10px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${l?n:t.border2}`,background:l?`${n}22`:"transparent",color:l?n:t.muted});function _i({symbol:n,onSym:l,vertical:s=!1,grow:i=!0,plain:o=!1}){const{t:r}=W(),a=wi.map(([p,d])=>e.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:9,color:t.dim,fontWeight:700,letterSpacing:.3,width:s?32:"auto",flexShrink:0},title:r("markets.zerodte.groupTitle",{label:p}),children:p}),d.map(c=>e.jsx("button",{onClick:()=>l(c),style:Si(t.blue,n===c),children:c},c))]},p));return s?e.jsxs("div",{style:{...i?{flex:1,minHeight:0}:{flexShrink:0},overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8,background:t.panel,display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{padding:"6px 10px",background:t.panel2,borderBottom:`1px solid ${t.border2}`,fontFamily:k,fontSize:10,fontWeight:800,letterSpacing:"0.12em",color:t.amber,flexShrink:0},children:r("markets.zerodte.universeRailTitle")}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:10},children:[a,e.jsx("span",{style:{fontSize:9,color:t.dim,lineHeight:1.5},children:r("markets.zerodte.universeRailNote")})]})]}):e.jsx("div",{style:{display:"flex",gap:10,marginLeft:o?0:"auto",flexWrap:"wrap",alignItems:"center"},children:a})}function La({symbol:n}){const l=bi(n);return e.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:e.jsx(ji,{fill:!0,symbol:n,d:l})})}const ts=n=>`${n.ts_ns}|${n.streamer_symbol}|${n.size}|${n.price}`,Oa=n=>n==="sweep"?t.magenta:n==="block"?t.blue:n==="multileg"?t.amber:t.muted,Pa="#e6c200",Ha="#D2A24C",Va=(n,l)=>l||n==="yellow"?Pa:n==="purple"?Ha:null,ns=n=>{if(n.dte!=null)return Number(n.dte);if(!n.expiry)return null;const l=new Date(String(n.expiry)+"T00:00:00Z");return isNaN(l)?null:Math.max(0,Math.round((l-Date.now())/864e5))},Ba=n=>{if(n.sentiment)return n.sentiment;const l=String(n.cp).toUpperCase().startsWith("C");return n.side==="at_or_above_ask"?l?"bullish":"bearish":n.side==="at_or_below_bid"?l?"bearish":"bullish":"neutral"},Xn=(n,l)=>!n||!l?null:(Number(n)-Number(l))/Number(l)*100,Ua=n=>n==null?"":` (${n>=0?"+":""}${n.toFixed(1)}%)`,Te=({children:n,align:l="right",color:s=t.text,bold:i=!1})=>e.jsx("td",{style:{textAlign:l,padding:"4px 8px",color:s,fontWeight:i?700:400,whiteSpace:"nowrap"},children:n}),Ga=({heat:n})=>{const l=n==null?0:Number(n),s=l>=80?t.red:l>=60?t.amber:l>=30?t.muted:t.dim,i=l>=80?`0 0 6px ${t.red}`:"none";return e.jsx("td",{style:{textAlign:"right",padding:"4px 8px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{color:s,fontWeight:l>=60?700:400,textShadow:i},children:l})})},Ya=({ivRank:n})=>{if(n==null)return e.jsx(Te,{color:t.muted,children:"â"});const l=Math.round(n*100),s=l>=70?t.amber:l>=40?t.text:t.muted;return e.jsx(Te,{color:s,children:l})},ls=({label:n,color:l,prominent:s,children:i})=>{const o=Fe(n);return e.jsxs("div",{title:o||void 0,style:{background:t.panel,border:`1px solid ${t.border}`,borderLeft:`3px solid ${l}`,borderRadius:8,padding:"10px 14px",flex:1,cursor:"default"}
1,children:[e.jsx("div",{style:{fontSize:10,color:t.muted,fontWeight:700,letterSpacing:.4,marginBottom:4},children:n}),s?e.jsx("div",{style:{fontSize:16,fontWeight:800,color:l,fontFamily:k,marginBottom:4},children:s}):null,e.jsx("div",{style:{fontSize:11,color:t.text,lineHeight:1.5},children:i})]})};function Xa({symbol:n}){const{t:l}=W(),{data:s,lastUpdated:i}=H(()=>Ne(n),3e3,[n]),[o,r]=$.useState("0dte"),a=s&&s.gex||{},p=s&&s.gex_0dte||{},d=p.net_gex!=null,c=o==="0dte"&&d,u=c?p:a,h=s?.spot,m=s&&s.vol||{},y=u.regime||(u.net_gex>0?"positive":u.net_gex<0?"negative":null),b=y==="positive"?t.green:y==="negative"?t.red:t.muted,f=l(y==="positive"?"markets.zerodte.positiveGamma":y==="negative"?"markets.zerodte.negativeGamma":"markets.zerodte.gammaUnknown"),w=u.flip_strike,v=u.net_gex,g=p.magnet,x=p.pin_score,j=Xn(w,h),_=i?Date.now()-i:1/0,E=x==null?t.dim:x>=70?t.green:x>=40?t.amber:t.muted,T=x==null?"":x>=70?"STRONG PIN":x>=40?"moderate":"weak / no pin",S=m.atm_iv!=null?m.atm_iv*100:null,C=m.iv_rank!=null?m.iv_rank<=1?m.iv_rank*100:m.iv_rank:null,I=F=>({fontSize:9.5,fontWeight:800,padding:"2px 8px",cursor:"pointer",letterSpacing:.3,border:`1px solid ${F?t.amber:t.border2}`,background:F?`${t.amber}22`:"transparent",color:F?t.amber:t.dim});return e.jsxs("div",{style:{background:t.panel,border:`1px solid ${t.border}`,borderLeft:`3px solid ${b}`,borderRadius:10,padding:"12px 16px",height:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:10,color:t.muted,fontWeight:700,letterSpacing:.4},children:[l("markets.zerodte.dealerGammaRegime",{symbol:n}),c&&e.jsx("span",{style:{color:t.amber},children:" · 0DTE-only"})]}),e.jsx("div",{style:{fontSize:18,fontWeight:800,color:b},children:f})]}),d&&e.jsxs("div",{title:"0DTE-only = today's expiry (the true pin target); ALL EXP = every cached expiration blended",style:{display:"flex",marginLeft:4},children:[e.jsx("button",{onClick:()=>r("0dte"),style:{...I(o==="0dte"),borderRadius:"5px 0 0 5px"},children:"0DTE"}),e.jsx("button",{onClick:()=>r("all"),style:{...I(o==="all"),borderRadius:"0 5px 5px 0",borderLeft:"none"},children:"ALL EXP"})]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8},children:[v!=null&&e.jsxs("span",{style:{fontSize:11,color:v>=0?t.green:t.red,fontFamily:k,fontWeight:700},children:["Net GEX ",ee(v)]}),e.jsx(Ut,{ageMs:_,staleS:15})]})]}),e.jsxs("div",{style:{display:"flex",gap:14,flexWrap:"wrap",alignItems:"baseline",fontFamily:k,fontSize:10.5},children:[g!=null&&e.jsxs("span",{style:{color:t.amber,fontWeight:700},children:[l(c?"markets.zerodte.magnet0dte":"markets.zerodte.magnetWeekly")," ",R(g,0),x!=null&&e.jsxs("span",{style:{color:E},children:[" · pin ",x," ",T]})]}),w!=null&&Math.abs(j??99)<.3&&e.jsxs("span",{style:{color:t.amber,fontWeight:800},children:["â¡ ",l("markets.zerodte.gammaFlipStat")," ",R(w,2)," â regime shift zone"]}),S!=null&&e.jsxs("span",{style:{color:t.blue,fontWeight:700},children:["ATM IV ",S.toFixed(1),"%",C!=null&&` · IVR ${C.toFixed(0)} ${C>=50?l("markets.zerodte.rich"):l("markets.zerodte.cheap")}`]}),s?.net_premium!=null&&e.jsxs("span",{style:{color:s.net_premium>=0?t.green:t.red,fontWeight:700},title:l("markets.zerodte.netFlowCustomer"),children:[l("markets.zerodte.netFlowLabel")," ",s.net_premium>=0?l("markets.zerodte.bullish"):l("markets.zerodte.bearish")," ",ee(Math.abs(s.net_premium)),s.put_call_ratio!=null&&` · P/C ${Number(s.put_call_ratio).toFixed(2)}`]}),s?.max_pain!=null&&e.jsxs("span",{style:{color:t.amber,fontWeight:700},title:l("markets.zerodte.maxPainNote"),children:[l("markets.zerodte.maxPainLabel")," ",R(s.max_pain,0),Xn(s.max_pain,h)!=null&&` · ${Ua(Xn(s.max_pain,h))} ${l("markets.zerodte.fromSpot")}`]}),e.jsx("span",{style:{color:t.dim},children:l("markets.zerodte.levelsOnMap")})]})]})}function Ka({symbol:n}){const{t:l}=W(),{data:s}=H(()=>Rn(n),3e4,[n]),{data:i}=H(()=>$t(n),3e4,[n]),{data:o}=H(()=>Ne(n),3e3,[n]),r=s&&(s.gex||{})||{},a=o?.spot,p=(s?.by_strike||[]).filter(g=>g&&g.strike!=null).sort((g,x)=>g.strike-x.strike),d=22;let c=p;if(a&&p.length>d*2){let g=0,x=1/0;p.forEach((j,_)=>{const E=Math.abs(Number(j.strike)-a);E<x&&(x=E,g=_)}),c=p.slice(Math.max(0,g-d),Math.min(p.length,g+d+1))}const u=Math.max(1,...c.map(g=>Math.abs(Number(g.net_gex||0)))),h=o?.gex?.call_wall||r.call_wall,m=o?.gex?.put_wall||r.put_wall,y=o?.gex?.flip_strike||r.flip_strike,b=i?.expected_move_pct,f=b!=null&&a?a*(1-Math.abs(b)/100):null,w=b!=null&&a?a*(1+Math.abs(b)/100):null,v=g=>f==null||w==null?!1:g>=f&&g<=w;return e.jsxs("div",{style:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:10,padding:12,height:"100%",overflow:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{fontSize:11,fontWeight:700,color:t.muted},children:l("markets.zerodte.netGexByStrike")}),e.jsx(ie,{topic:"net gex",size:14}
1),b!=null&&e.jsxs("span",{style:{fontSize:10,color:t.blue,fontFamily:k},children:["EM band: ±",Math.abs(b).toFixed(1),"% shaded"]}),i?.note&&e.jsx("span",{style:{fontSize:9.5,color:t.dim},children:i.note})]}),e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:[{labelKey:"markets.zerodte.deck.lvl_spot",color:t.text},{labelKey:"markets.zerodte.deck.lvl_callWall",color:t.green},{labelKey:"markets.zerodte.deck.lvl_putWall",color:t.red},{labelKey:"markets.zerodte.deck.lvl_flip",color:t.amber},{labelKey:"markets.zerodte.lvl_emBand",color:t.blue}].map(({labelKey:g,color:x})=>e.jsxs("span",{style:{fontSize:9.5,color:x,fontFamily:"Inter",display:"flex",alignItems:"center",gap:3},children:[e.jsx("span",{style:{display:"inline-block",width:8,height:2,background:x}}),l(g)]},g))}),c.length===0?e.jsx("div",{style:{padding:20,textAlign:"center",color:t.dim,fontSize:12},children:l("markets.zerodte.noGexData",{symbol:n})}):c.map(g=>{const x=Number(g.net_gex||0),j=Math.abs(x)/u*50,_=Number(g.strike),E=a&&Math.abs(_-a)<Math.abs(c[1]?.strike-c[0]?.strike||1)*.6,T=h&&_===h,S=m&&_===m,C=y&&_===y,F=v(_)?"rgba(57,141,255,0.06)":"transparent",A=T?t.green:S?t.red:C?t.amber:E?t.text:t.muted,P=T||S||C||E?800:400;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,fontFamily:k,padding:"1px 0",background:F,borderRadius:2},children:[e.jsxs("span",{style:{width:58,textAlign:"right",color:A,fontWeight:P},children:[R(g.strike,0),E?" â":T?" â²":S?" â¼":C?" â":""]}),e.jsxs("div",{style:{flex:1,display:"flex",justifyContent:"center",height:12},children:[e.jsx("div",{style:{width:"50%",display:"flex",justifyContent:"flex-end"},children:x<0&&e.jsx("div",{style:{width:`${j*2}%`,height:10,background:t.red,borderRadius:2}})}),e.jsx("div",{style:{width:1,background:t.border2}}),e.jsx("div",{style:{width:"50%"},children:x>0&&e.jsx("div",{style:{width:`${j*2}%`,height:10,background:t.green,borderRadius:2}})})]}),e.jsx("span",{style:{width:64,textAlign:"left",color:x>=0?t.green:t.red},children:ee(x)})]},g.strike)}),e.jsx("div",{style:{fontSize:10,color:t.dim,marginTop:8},children:l("markets.zerodte.squeezeMetricsNote")})]})}function qa({symbol:n,dteMode:l}){const{t:s}=W(),{data:i}=H(()=>Ne(n),3e3,[n]),o=i?.charm||null,r=i?.vanna||null,a=o?.net_charm,p=o?.pin_strike;let d="â",c="";if(a!=null){const f=a>0?"positive":"negative",w=p?` â pin bias ${R(p,0)}`:"";d=`${f.toUpperCase()}${w}`,c=s(l==="0dte"?"markets.zerodte.charmDayNote":"markets.zerodte.charmWeeklyNote")}else c=s("markets.zerodte.charmNoData",{symbol:n});const u=r?.net_vanna;let h="â",m="";if(u!=null){const f=u<0;h=s(f?"markets.zerodte.vannaShort":"markets.zerodte.vannaLong"),m=s(f?"markets.zerodte.vannaShortNote":"markets.zerodte.vannaLongNote")}else m=s("markets.zerodte.vannaNoData",{symbol:n});const y=a==null?t.dim:a>0?t.green:t.red,b=u==null?t.dim:u<0?t.green:t.red;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,height:"100%"},children:[e.jsxs("div",{style:{fontSize:11,fontWeight:700,color:t.muted,paddingBottom:4},children:[s("markets.zerodte.charmVannaHeader")," ",e.jsx(ie,{topic:"charm",size:14}),l==="0dte"&&e.jsx("span",{style:{marginLeft:8,fontSize:9.5,color:t.amber,fontWeight:400},children:s("markets.zerodte.charmZeroDteNote")})]}),e.jsx(ls,{label:s("markets.zerodte.charmLabel"),color:y,prominent:a!=null?d:null,children:a==null?e.jsxs("span",{style:{color:t.dim},children:["waiting for data â ",c]}):e.jsxs(e.Fragment,{children:[p&&e.jsxs("div",{style:{marginBottom:4},children:[e.jsx("span",{style:{color:t.text},children:"EOD pin bias â "}),e.jsx("span",{style:{color:t.amber,fontFamily:k,fontWeight:800,fontSize:14},children:R(p,0)})]}),e.jsx("div",{style:{color:t.muted,fontSize:10.5},children:c})]})}),e.jsx(ls,{label:s("markets.zerodte.vannaLabel"),color:b,prominent:u!=null?h:null,children:u==null?e.jsxs("span",{style:{color:t.dim},children:["waiting for data â ",m]}):e.jsx("div",{style:{color:t.muted,fontSize:10.5},children:m})})]})}const ss=[{k:"time",label:"TIME"},{k:"tick",label:"TICK"},{k:"exp",label:"EXP"},{k:"dte",label:"DTE"},{k:"strike",label:"STRIKE"},{k:"cp",label:"C/P"},{k:"side",label:"SIDE"},{k:"spot",label:"SPOT"},{k:"size",label:"SIZE"},{k:"price",label:"PRICE"},{k:"prem",label:"PREM"},{k:"iv",label:"IV"},{k:"ivrank",label:"IV RANK"},{k:"type",label:"TYPE"},{k:"heat",label:"HEAT"}];
1function Qa({symbol:n,dteMode:l}){const{t:s}=W(),[i,o]=$.useState("notable"),r=l==="0dte"?0:5,a=String(n).toUpperCase(),{accessToken:p}=wl(),{items:d,connected:c}=El(i==="all"?Xs(a,p):null,"flow",{max:500}),{data:u,lastUpdated:h}=H(()=>$n({limit:300,underlying:a}),2500,[a]),m=$.useMemo(()=>{if(i==="notable")return(u?.notable||[]).map(g=>({...g,size:g.total_size??g.size,premium:g.total_premium??g.premium}));const w=new Set,v=[];for(const g of[...d]){const x=ts(g);w.has(x)||(w.add(x),v.push(g))}return v},[i,u,d]),y=$.useMemo(()=>m.filter(w=>{const v=ns(w);return v==null?!1:l==="0dte"?v===0:v<=r}),[m,l,r]),b=$.useMemo(()=>[...y].sort((w,v)=>Number(v.ts_ns||0)-Number(w.ts_ns||0)).slice(0,200),[y]),f=i==="notable"?!!h&&Date.now()-h<1e4:c;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:11,fontWeight:700,color:t.muted},children:[s(l==="0dte"?"markets.zerodte.zeroDteFlow":"markets.zerodte.weeklyFlow")," · ",a]}),e.jsx("button",{onClick:()=>o(w=>w==="notable"?"all":"notable"),style:Si(t.amber,i!=="notable"),children:s(i==="notable"?"markets.zerodte.notableFlow":"markets.zerodte.allPrints")}),e.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:t.muted,display:"flex",alignItems:"center",gap:6},children:[e.jsx(Cn,{on:f}),s(i==="notable"?"markets.zerodte.modeNotable":c?"markets.zerodte.modeLive":"markets.zerodte.connecting")," · ",b.length]})]}),e.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{position:"sticky",top:0,background:t.panel2,zIndex:1},children:e.jsx("tr",{children:ss.map(w=>e.jsx("th",{style:{textAlign:"right",padding:"6px 8px",color:t.muted,fontFamily:"Inter",fontSize:10,fontWeight:700,letterSpacing:.4,borderBottom:`1px solid ${t.border2}`},children:w.label},w.k))})}),e.jsxs("tbody",{children:[b.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:ss.length,style:{padding:24,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:i==="notable"?s("markets.zerodte.noNotableFlow",{dteLabel:s(l==="0dte"?"markets.zerodte.zeroDteDteLabel":"markets.zerodte.weeklyDteLabel"),scope:a}):s("markets.zerodte.noFlowPrints",{dteLabel:s(l==="0dte"?"markets.zerodte.zeroDteDteLabel":"markets.zerodte.weeklyDteLabel")})})}),b.map((w,v)=>{const g=$l(w.cp),x=Ba(w),j=ns(w),_=w.is_golden_sweep?"rgba(214,90,219,0.12)":w.classification==="sweep"?"rgba(214,90,219,0.05)":x==="bullish"?"rgba(110,210,90,0.04)":x==="bearish"?"rgba(255,91,85,0.04)":"transparent",E=Va(w.oi_status,w.is_golden_sweep);return e.jsxs("tr",{style:{background:_,borderBottom:"1px solid rgba(255,255,255,0.03)",borderLeft:E?`3px solid ${E}`:"3px solid transparent"},children:[e.jsx(Te,{children:An(w.ts_ns)}),e.jsx(Te,{align:"left",color:g,bold:!0,children:w.underlying}),e.jsx(Te,{children:w.expiry}),e.jsx(Te,{color:j===0?t.amber:t.muted,children:j??"â"}),e.jsx(Te,{children:R(w.strike,1)}),e.jsx(Te,{color:g,bold:!0,children:String(w.cp).toUpperCase()}),e.jsx(Te,{color:w.side==="at_or_above_ask"?t.green:w.side==="at_or_below_bid"?t.red:t.muted,children:Cl(w.side)}),e.jsx(Te,{color:Number(w.spot)>0?t.text:t.muted,children:Number(w.spot)>0?R(w.spot,2):"â"}),e.jsx(Te,{children:je(w.size)}),e.jsx(Te,{children:w.price!=null?R(w.price,2):"â"}),e.jsx(Te,{bold:!0,children:ee(w.premium)}),e.jsx(Te,{children:w.iv!=null?R(Number(w.iv)*100,1):"â"}),e.jsx(Ya,{ivRank:w.iv_rank}),e.jsxs(Te,{color:Oa(w.classification),children:[(w.classification||"").toUpperCase(),w.is_golden_sweep?"â
":""]}),e.jsx(Ga,{heat:w.heat})]},ts(w)+v)})]})]})})]})}function Za({symbol:n}){const{t:l}=W(),{data:s}=H(()=>$t(n),3e4,[n]),i=s?.expected_move_pct,o=s?.straddle_price,r=s?.dte,a=s?.spot,p=s?.note,d=i!=null&&a?a*(1-Math.abs(i)/100):null,c=i!=null&&a?a*(1+Math.abs(i)/100):null,u=a!=null&&a>=1e3?0:2;return e.jsx("div",{style:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:8,padding:"10px 14px",marginBottom:8,display:"flex",alignItems:"center",gap:16,flexWrap:"wrap"},children:e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:10,
1color:t.muted,fontWeight:700,letterSpacing:.4},children:l("markets.zerodte.expectedMoveHeader")}),i!=null?e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,marginTop:2,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:18,fontWeight:800,color:t.blue,fontFamily:k},children:["±",Math.abs(i).toFixed(1),"%"]}),d!=null&&c!=null&&e.jsxs("span",{style:{fontSize:14,fontWeight:700,fontFamily:k},children:[e.jsx("span",{style:{color:t.red},children:R(d,u)}),e.jsx("span",{style:{color:t.dim,fontWeight:400},children:" ⷠ"}),e.jsx("span",{style:{color:t.green},children:R(c,u)}),e.jsx("span",{style:{fontSize:9.5,color:t.dim,fontWeight:400,marginLeft:4},children:l("markets.zerodte.expectedRange")})]}),o!=null&&e.jsxs("span",{style:{fontSize:12,color:t.muted,fontFamily:k},children:["$",R(o,2)," straddle"]}),r!=null&&e.jsxs("span",{style:{fontSize:11,color:t.dim},children:["· DTE ",r]})]}):e.jsx("div",{style:{fontSize:13,color:t.dim,marginTop:2},children:p||l("markets.zerodte.emUnavailable")}),i!=null&&e.jsx("div",{style:{fontSize:9.5,color:t.dim,marginTop:2},children:l("markets.zerodte.emBandShrinks")})]})})}
1function Ja({symbol:n}){const{t:l}=W(),{data:s,lastUpdated:i}=H(()=>Qs(n,300),45e3,[n]),o=$.useMemo(()=>{const f=s?.series;return!Array.isArray(f)||f.length===0?[]:f.map(w=>({t:Number(w.t),cum:Number(w.cum)})).filter(w=>isFinite(w.cum))},[s]),r=o.length>0?o[o.length-1].cum:null,a=r!=null&&r>=0,p=90,d=8,c=$.useMemo(()=>{if(o.length<2)return null;const f=o.map(F=>F.cum),w=Math.min(...f),g=Math.max(...f)-w||1,x=1e3,j=p-d*2,_=F=>d+j*(1-(F-w)/g),E=_(0),T=Math.max(d,Math.min(p-d,E)),S=o.map((F,A)=>{const P=A/(o.length-1)*x,V=_(F.cum);return{x:P,y:V,cum:F.cum}}),C=S.map(F=>`${F.x.toFixed(1)},${F.y.toFixed(1)}`).join(" "),I=`${C} ${1e3.toFixed(1)},${T.toFixed(1)} 0,${T.toFixed(1)}`;return{pts:S,allPolyStr:C,polyFillStr:I,zeroYClamped:T,W:x}},[o]),u=i?Date.now()-i:1/0;if(o.length===0)return e.jsxs("div",{style:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:10,padding:"10px 14px",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[e.jsx("span",{style:{fontSize:11,fontWeight:700,color:t.muted,letterSpacing:.4},children:l("markets.zerodte.miniHiroHeader")}),e.jsx(Ut,{ageMs:u,staleS:60})]}),e.jsx("div",{style:{fontSize:11,color:t.dim,fontStyle:"italic"},children:l("markets.zerodte.hiroWaiting")}),e.jsx("div",{style:{fontSize:10,color:t.dim,marginTop:4},children:l("markets.zerodte.hiroNote")})]});const h=a?t.green:t.red,m=a?`${t.green}28`:`${t.red}28`,y=r==null?"â":a?l("markets.zerodte.hiroDealersBuying",{amount:ee(r)}):l("markets.zerodte.hiroDealersSelling",{amount:ee(r)}),b=a?t.green:t.red;return e.jsxs("div",{style:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:10,padding:"10px 14px",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11,fontWeight:700,color:t.muted,letterSpacing:.4},children:l("markets.zerodte.miniHiroHeader")}),e.jsx("span",{style:{fontSize:14,fontWeight:800,color:b,fontFamily:k},children:y}),e.jsx("span",{style:{marginLeft:"auto"},children:e.jsx(Ut,{ageMs:u,staleS:60})})]}),c&&e.jsxs("svg",{viewBox:`0 0 ${c.W} ${p}`,preserveAspectRatio:"none",style:{width:"100%",height:p,display:"block",borderRadius:4},"aria-label":`HIRO cumulative dealer delta chart for ${n}`,children:[e.jsx("line",{x1:"0",y1:c.zeroYClamped.toFixed(1),x2:c.W,y2:c.zeroYClamped.toFixed(1),stroke:t.border2,strokeWidth:"1",strokeDasharray:"4,4"}),e.jsx("polygon",{points:c.polyFillStr,fill:m,stroke:"none"}),e.jsx("polyline",{points:c.allPolyStr,fill:"none",stroke:h,strokeWidth:"1.5",strokeLinejoin:"round"}),(()=>{const f=c.pts[c.pts.length-1];return e.jsx("circle",{cx:f.x.toFixed(1),cy:f.y.toFixed(1),r:"3",fill:h,stroke:t.bg,strokeWidth:"1.5"})})()]}),e.jsxs("div",{style:{fontSize:10,color:t.dim,marginTop:4},children:[l("markets.zerodte.hiroNote"),l("markets.zerodte.hiroNoteExtra")]})]})}const ed=[{id:"open",label:"OPEN",start:930,end:1e3,color:"#6ed25a",note:"gap fill / first-print auction â gamma hedging lag, high vol",theta:"~2%/hr",action:"IV highest (overnight repricing) â directional 9:45â10:30; premium is rich"},{id:"mid",label:"MID-MORNING",start:1e3,end:1130,color:"#5E7FA3",note:"trend or fade â 1st gamma pin test; charm light",theta:"moderate, linear",action:"premium-sell window opens; watch IV-vs-RV spread"},{id:"lunch",label:"LUNCH",start:1130,end:1330,color:"#8e99a4",note:"low-volume drift â gamma suppresses; pin often holds",theta:"moderate",action:"low-vol drift â fade the walls into the magnet if positive γ"},{id:"afternoon",label:"AFTERNOON",start:1330,end:1400,color:"#5E7FA3",note:"repositioning ahead of power hour",theta:"accelerating",action:"reposition for power hour; take winners at ~50%"},{id:"power",label:"POWER HOUR",start:1400,end:1600,color:"#FFAA00",note:"gamma 10à · charm pin into the close",highlight:!0,theta:"10à · steepest erosion",action:"charm pin into close â exit by ~3:00 ET; final hour illiquid, avoid new entries"}];function td(){try{const n=new Date().toLocaleString("en-US",{timeZone:"America/Ne
1w_York"}),l=new Date(n),s=l.getDay();if(s===0||s===6)return null;const i=l.getHours()*100+l.getMinutes();if(i<930||i>=1600)return null;for(const o of ed)if(i>=o.start&&i<o.end)return o;return null}catch{return null}}function nd(n,l,s){if(n==null||!s)return null;const i=l?(s-l)/s*100:n>0?5:-5,o=50+35*Math.tanh(i/.7);return Math.round(Math.max(5,Math.min(95,o)))}function ld(n,l,s,i){if(!n||!l||!n.regime)return null;const{regime:o,flip_strike:r,call_wall:a,put_wall:p,magnet:d}=n,c=s==="power",u=m=>m&&Math.abs(m-l)/l<.0025;if(o==="positive"){let m;return u(a)?m=i("markets.zerodte.biasCallWall",{cw:R(a,0),magnet:d?R(d,0):"mid"}):u(p)?m=i("markets.zerodte.biasPutWall",{pw:R(p,0),magnet:d?R(d,0):"mid"}):m=i("markets.zerodte.biasRangeBound",{pw:p?R(p,0):"â",cw:a?R(a,0):"â",magnetStr:d?R(d,0)+" ":""}),c&&(m+=i("markets.zerodte.biasCharmPin")),{tag:i("markets.zerodte.biasRangePin"),color:t.green,text:m}}let h=i("markets.zerodte.biasTrending");return r&&(h+=i("markets.zerodte.biasFlipWatch",{flip:R(r,0)})),c&&(h+=i("markets.zerodte.biasAccelerate")),{tag:i("markets.zerodte.biasTrendBreakout"),color:t.red,text:h}}function sd({symbol:n}){const{t:l}=W(),{data:s}=H(()=>Ne(n),3e3,[n]),i=s&&s.gex_0dte||s&&s.gex||{},o=s?.spot,r=td(),a=nd(i.net_gex,i.flip_strike,o),p=ld(i,o,r?.id,l);if(!p&&a==null)return null;const d=a==null?t.dim:a>=65?t.green:a>=45?t.amber:t.red,c=a==null?"â":a>=65?l("markets.zerodte.stabStable"):a>=45?l("markets.zerodte.stabTransition"):l("markets.zerodte.stabUnstable");return e.jsxs("div",{style:{background:t.panel,border:`1px solid ${t.border}`,borderLeft:`3px solid ${p?p.color:t.border2}`,borderRadius:10,padding:"10px 14px",display:"flex",alignItems:"center",gap:18,flexWrap:"wrap"},children:[a!=null&&e.jsxs("div",{style:{minWidth:156},children:[e.jsxs("div",{style:{fontSize:10,color:t.muted,fontWeight:700,letterSpacing:.4},children:[l("markets.zerodte.stability")," ",e.jsx("span",{style:{fontSize:9,color:t.dim,fontStyle:"italic",fontWeight:400},children:l("markets.zerodte.nextMoveRisk")})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:3},children:[e.jsx("div",{style:{flex:1,height:6,background:t.border2,borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${a}%`,height:"100%",background:d}})}),e.jsx("span",{style:{fontSize:13,fontWeight:800,color:d,fontFamily:k},children:a})]}),e.jsx("div",{style:{fontSize:9.5,color:d,marginTop:1},children:c})]}),p&&e.jsxs("div",{style:{flex:1,minWidth:260},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:800,color:p.color,letterSpacing:.4},children:[l("markets.zerodte.tacticalBias"),p.tag]}),e.jsx("div",{style:{fontSize:11.5,color:t.text,marginTop:2,lineHeight:1.35},children:p.text})]})]})}function id({symbol:n}){const{t:l}=W(),{data:s}=H(()=>sr(n),6e4,[n]),i=$.useMemo(()=>(s?.snapshots||[]).filter(c=>c&&Array.isArray(c.strikes)&&c.strikes.length),[s]),o=$.useMemo(()=>{if(!i.length)return null;const c=i[i.length-1].spot,u=c?c*.03:1/0,h=new Set;for(const f of i)for(const[w]of f.strikes)(!c||Math.abs(w-c)<=u)&&h.add(w);const m=[...h].sort((f,w)=>w-f);if(!m.length)return null;const y=i.map(f=>({ts:f.ts,spot:f.spot,m:new Map(f.strikes.map(([w,v])=>[w,v]))}));let b=0;for(const f of i)for(const[,w]of f.strikes)b=Math.max(b,Math.abs(w));return{strikes:m,cols:y,maxAbs:b||1,latestSpot:c}},[i]),r={background:t.panel,border:`1px solid ${t.border}`,borderRadius:10,padding:"10px 14px",marginBottom:8},a=e.jsxs("div",{style:{fontSize:11,fontWeight:700,color:t.muted,letterSpacing:.4,marginBottom:6},children:[l("markets.zerodte.heatmapTitle")," ",e.jsx("span",{style:{fontSize:9.5,color:t.dim,fontWeight:400,fontStyle:"italic"},children:l("markets.zerodte.heatmapSub")})]});if(!o)return e.jsxs("div",{style:r,children:[a,e.jsx("div",{style:{fontSize:11,color:t.dim,fontStyle:"italic"},children:l("markets.zerodte.heatmapBuilding")})]});const p=c=>{if(c==null)return"transparent";const u=Math.min(1,Math.abs(c)/o.maxAbs);return`rgba(${c>=0?"110,210,90":"255,90,90"}, ${(.1+.85*u).toFixed(3)})`},d=c=>c?o.strikes.reduce((u,h)=>Math.abs(h-c)<Math.abs(u-c)?h:u,o.strikes[0]):null;return e.jsxs("div",{style:r,children:[a,e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",flexShrink:0},children:o.strikes.map(c=>e.jsx("div",{style:{flex:1,minHeight:5,fontSize:8.5,color:t.dim,fontFamily:k,lineHeight:"1",display:"flex",alignItems:"center",paddingRight:4},children:R(c,0)},c))}),e.jsx("div",{style:{flex:1,display:"flex",gap:1,height:Math.max(120,o.strikes.length*6)},children:o.cols.map((c,u)=>{const h=d(c.spot);return e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:o.strikes.map(m=>{const y=c.m.get(m);return e.jsx("div",{title:y!=null?`${R(m,0)} · ${y}M GEX @ ${String(c.ts).slice(11,16)}`:"",style:{flex:1,minHeight:5,background:p(y),boxShadow:m===h?`inset 0 0 0 1px ${t.text}`:"none"}},m)})},u)})})]}),e.jsxs("div",{style:{fontSize:9,color:t.dim,marginTop:5},children:[e.jsx("span",{style:{color:t.green},children:"â "})," ",l("markets.zerodte.gexSupport"),"  ",e.jsx("span",{style:{color:t.red},children:"â "})," ",l("markets.zerodte.gexAccelerate"),"  · ",l("markets.zerodte.timeArrow"),"  · ",l("markets.zerodte.boxedSpot")]})]})}
1function rd({symbol:n="SPY",setSymbol:l,setInput:s,hostedRail:i=!1,vis:o=null,dteMode:r,setDteMode:a}){const{t:p}=W(),[d,c]=$.useState("0dte"),u=r??d,h=a??c,m=bi(n),y=vi(m,p);$.useEffect(()=>(lt(y),()=>lt(null)),[y]);const b=f=>{l?.(f),s?.(f)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",flexShrink:0},children:[e.jsx("div",{style:{display:"flex",background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:7,padding:3,gap:2},children:[["0dte","0DTE"],["weekly","WEEKLY"]].map(([f,w])=>e.jsx("button",{onClick:()=>h(f),style:{fontSize:11.5,padding:"5px 14px",borderRadius:5,cursor:"pointer",fontWeight:800,border:"none",background:u===f?t.amber:"transparent",color:u===f?"#0A0D11":t.muted},children:w},f))}),e.jsx("span",{style:{fontSize:10,color:t.dim},children:p(u==="0dte"?"markets.zerodte.dte0desc":"markets.zerodte.dteWeeklyDesc")}),!i&&e.jsx(_i,{symbol:n,onSym:b})]}),e.jsx(X,{id:"clock",vis:o,style:{flexShrink:0},children:e.jsx(Ea,{symbol:n})}),e.jsxs("div",{style:{display:"flex",gap:10,flex:1,minHeight:0},children:[!i&&e.jsx(ji,{symbol:n,d:m}),e.jsxs("div",{style:{flex:1,minWidth:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:10},children:[e.jsx(X,{id:"map",vis:o,style:{flexShrink:0},children:e.jsx(Wa,{d:m})}),e.jsx(X,{id:"advisor",vis:o,children:e.jsx(xa,{symbol:n})}),e.jsx(X,{id:"earnedcalls",vis:o,children:e.jsx(fa,{})}),e.jsx(Oe,{id:"sa-0dte-regime-cols-v1",stackBelow:900,layoutEpoch:o?.layoutEpoch,style:{flex:"none"},columns:[{id:"regime",defaultSize:"56%",minSize:"30%",hidden:o?.isHidden("regime"),node:e.jsx(X,{id:"regime",vis:o,children:e.jsx(Xa,{symbol:n})})},{id:"tactical",defaultSize:"44%",minSize:"28%",hidden:o?.isHidden("tactical"),node:e.jsx(X,{id:"tactical",vis:o,children:e.jsx(sd,{symbol:n})})}]}),e.jsx(X,{id:"hiro",vis:o,style:{flexShrink:0},children:e.jsx(Ja,{symbol:n})}),e.jsx(X,{id:"dials",vis:o,style:{flexShrink:0},children:e.jsx(Da,{d:m})}),e.jsx(Oe,{id:"sa-0dte-evidence-cols-v1",stackBelow:900,layoutEpoch:o?.layoutEpoch,style:{flex:"none",minHeight:340},columns:[{id:"ladder",defaultSize:"67%",minSize:"38%",hidden:o?.isHidden("ladder"),node:e.jsx(X,{id:"ladder",vis:o,style:{height:"100%",minHeight:0},children:e.jsx(Ka,{symbol:n})})},{id:"charmvanna",defaultSize:"33%",minSize:"22%",hidden:o?.isHidden("charmvanna"),node:e.jsx(X,{id:"charmvanna",vis:o,style:{height:"100%",minHeight:0},children:e.jsx(qa,{symbol:n,dteMode:u})})}]}),e.jsx(X,{id:"heatmap",vis:o,style:{flexShrink:0},children:e.jsx(id,{symbol:n})}),e.jsx(X,{id:"emdetail",vis:o,style:{flexShrink:0},children:e.jsx(Za,{symbol:n})}),e.jsx(X,{id:"pressure0dte",vis:o,style:{flexShrink:0},children:e.jsx(oi,{})}),e.jsx(X,{id:"gexsurface",vis:o,style:{flexShrink:0},children:e.jsx(gi,{symbol:n,maxHeight:300})}),e.jsx(X,{id:"tape0dte",vis:o,style:{height:440,flexShrink:0},children:e.jsx(Qa,{symbol:n,dteMode:u})})]})]})]})}const mn=1e3,fl=168,hn=6,Ti=6,ut=16,od=20,is=mn-hn-Ti,jt=fl-ut-od,ln=n=>{try{return new Date(n*1e3).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:"America/New_York"})}catch{return""}};function ad({symbol:n="SPY",onPin:l=null,pinnedTs:s=null}){const{t:i}=W(),{data:o}=H(()=>ir(n),6e4,[n]),r=$.useRef(null),[a,p]=$.useState(null),d=$.useMemo(()=>(o?.points||[]).filter(x=>x&&x.t&&x.net_gex!=null&&x.spot!=null).sort((x,j)=>x.t-j.t),[o]),c=$.useMemo(()=>{if(!s||d.length===0)return null;let x=0,j=1/0;for(let _=0;_<d.length;_++){const E=Math.abs(d[_].t-s);E<j&&(j=E,x=_)}return x},[s,d]),u=$.useMemo(()=>{if(d.length<2)return null;const x=d[0].t,j=d[d.length-1].t||x+1,_=d.map(Q=>Q.net_gex),E=d.map(Q=>Q.spot),T=Math.min(..._,0),S=Math.max(..._,0),C=Math.min(...E),I=Math.max(...E),F=(S-T)*.08||1,A=(I-C)*.12||.5;return{x:Q=>hn+(Q-x)/(j-x||1)*is,yG:Q=>ut+jt-(Q-(T-F))/(S+F-(T-F)||1)*jt,yS:Q=>ut+jt-(Q-(C-A))/(I+A-(C-A)||1)*jt,t0:x,t1:j}},[d]),h=x=>{if(!u||!r.current||d.length<2)return;const j=r.current.getBoundingClientRect(),_=(x.clientX-j.left)/j.width*mn,E=u.t0+(_-hn)/is*(u.t1-u.t0);let T=0,S=1/0;for(let C=0;C<d.length;C++){const I=Math.abs(d[C].t-E);I<S&&(S=I,T=C)}p(T)},m=()=>{l&&a!=null&&d[a]&&l(d[a].t)};if(d.length<2)return e.jsx("div",{style:{padding:"10px 12px",color:t.dim,fontFamily:k,fontSize:11},children:i("markets.gexReplay.empty",{defaultValue:"GEX replay builds intraday â snapshots recorded every ~5 min while the market trades."})});const y=d.map(x=>`${u.x(x.t).toFixed(1)},${u.yG(x.net_gex).toFixed(1)}`).join(" "),b=d.map(x=>`${u.x(x.t).toFixed(1)},${u.yS(x.spot).toFixed(1)}`).join(" "),f=a!=null?d[a]:c!=null?d[c]:d[d.length-1],w=u.x(f.t),v=(f.net_gex||0)>=0,g=[0,.25,.5,.75,1].map(x=>u.t0+x*(u.t1-u.t0));return e.jsxs("div",{style:{padding:"4px 6px 8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[e.jsxs("span",{style:{fontFamily:k,fontSize:10,letterSpacing:"0.14em",color:t.gold,display:"flex",alignItems:"center",gap:6},children:[i("markets.gexReplay.title",{defaultValue:"GEX REPLAY · NET-GEX vs PRICE"}),e.jsx(ie,{title:"GEX Replay",size:13,what:i("markets.gexReplay.what",{defaultValue:"Net dealer gamma (bars) and price (line) on one intraday time axis, from ~5-min snapshots. Hover to scrub each moment."}),how:i("markets.gexReplay.how",{defaultValue:"Line up gamma shifts with the candles above: net-GEX flipping toward/through zero, or walls sliding, often coincides with acceleration or a stall. A study aid, not a signal."})})]}
1),e.jsx("span",{style:{fontFamily:k,fontSize:10,color:t.dim,display:"inline-flex",alignItems:"center",gap:8},children:c!=null?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{color:"#E0C27A"},children:["â² ",i("markets.gexReplay.pinned",{defaultValue:"PINNED"})," ",ln(d[c].t)," ET"]}),e.jsx("button",{onClick:()=>l&&l(null),style:{fontFamily:k,fontSize:9,fontWeight:800,padding:"1px 7px",borderRadius:4,cursor:"pointer",color:t.green,background:"rgba(55,209,131,0.14)",border:`1px solid ${t.green}`},children:"â LIVE"})]}):a!=null?`â² ${ln(f.t)} ET · ${i("markets.gexReplay.clickPin",{defaultValue:"click to pin"})}`:i("markets.gexReplay.hint",{defaultValue:"hover to preview · click to pin the surface"})})]}),e.jsxs("svg",{ref:r,viewBox:`0 0 ${mn} ${fl}`,preserveAspectRatio:"none",style:{width:"100%",height:168,display:"block",cursor:l?"pointer":"crosshair"},onMouseMove:h,onMouseLeave:()=>p(null),onClick:m,children:[e.jsx("line",{x1:hn,x2:mn-Ti,y1:u.yG(0),y2:u.yG(0),stroke:t.border2,strokeWidth:"1",strokeDasharray:"3 3"}),g.map((x,j)=>e.jsxs("g",{children:[e.jsx("line",{x1:u.x(x),x2:u.x(x),y1:ut,y2:ut+jt,stroke:"rgba(255,255,255,0.04)",strokeWidth:"1"}),e.jsx("text",{x:u.x(x),y:fl-6,fill:t.dim,fontSize:"9",fontFamily:k,textAnchor:j===0?"start":j===g.length-1?"end":"middle",children:ln(x)})]},j)),e.jsx("polyline",{points:y,fill:"none",stroke:t.gold,strokeWidth:"1.6",opacity:"0.9"}),e.jsx("polyline",{points:b,fill:"none",stroke:"#F2F0EA",strokeWidth:"1.4",opacity:"0.85"}),e.jsx("line",{x1:w,x2:w,y1:ut,y2:ut+jt,stroke:t.blue,strokeWidth:"1",opacity:"0.8"}),e.jsx("circle",{cx:w,cy:u.yG(f.net_gex),r:"3.2",fill:v?t.green:t.red}),e.jsx("circle",{cx:w,cy:u.yS(f.spot),r:"3.2",fill:"#F2F0EA"})]}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:12,marginTop:4,fontFamily:k,fontSize:10.5},children:[e.jsx(rt,{label:i("markets.gexReplay.time",{defaultValue:"TIME"}),value:`${ln(f.t)} ET`,color:t.text}),e.jsx(rt,{label:"NET GEX",value:f.net_gex!=null?ee(f.net_gex):"â",color:v?t.green:t.red}),e.jsx(rt,{label:"SPOT",value:f.spot!=null?R(f.spot,2):"â",color:t.text}),e.jsx(rt,{label:"FLIP",value:f.flip!=null?R(f.flip,0):i("markets.gexReplay.oor",{defaultValue:"out of range"}),color:t.amber}),e.jsx(rt,{label:"CALL WALL",value:f.call_wall!=null?R(f.call_wall,0):"â",color:t.green}),e.jsx(rt,{label:"PUT WALL",value:f.put_wall!=null?R(f.put_wall,0):"â",color:t.red}),f.regime&&e.jsx(rt,{label:"REGIME",value:String(f.regime).toUpperCase(),color:String(f.regime).includes("neg")?t.red:t.green})]})]})}function rt({label:n,value:l,color:s}){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"baseline",gap:5},children:[e.jsx("span",{style:{color:t.dim,letterSpacing:"0.1em"},children:n}),e.jsx("b",{style:{color:s},children:l})]})}const dd=n=>{if(n==null)return"â";const l=Math.abs(n),s=l>=1e9?`${(n/1e9).toFixed(2)}B`:l>=1e6?`${(n/1e6).toFixed(1)}M`:`${(n/1e3).toFixed(0)}K`;return n>=0?`+${s}`:s.startsWith("-")?s:`-${s}`};function cd({data:n}){const{t:l}=W(),s=n||{},i=s.net_ddoi_gex!=null,o=i?[...s.strikes||[]].sort((a,p)=>Math.abs(p.ddoi_gex)-Math.abs(a.ddoi_gex)).slice(0,6).sort((a,p)=>a.strike-p.strike):[],r=Math.max(1,...o.flatMap(a=>[Math.abs(a.ddoi_gex),Math.abs(a.naive_gex)]));return e.jsxs("div",{style:{padding:12,borderRadius:10,border:`1px solid ${t.border}`,background:t.panel,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:6},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.12em",color:t.muted},children:l("markets.ddoi.title",{defaultValue:"DDOI · DEALER BOOK (FLOW-SIGNED)"})}),e.jsx(ie,{topic:"ddoi",size:14}),i&&s.signed_share!=null&&e.jsx("span",{style:{fontFamily:k,fontSize:7.5,color:"#E0C27A",background:"rgba(210,162,76,0.10)",border:"1px solid rgba(210,162,76,0.3)",borderRadius:4,padding:"1px 6px"},children:l("markets.ddoi.coverage",{defaultValue:"signed {{vol}}% of volume · {{oi}}% of OI · since {{from}}",vol:Math.round(s.signed_share*100),oi:s.oi_signed_share!=null?Math.round(s.oi_signed_share*100):"â",from:s.window_start||"â"})})]}),i?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",gap:18,flexWrap:"wrap",marginBottom:8}
1,children:[["ddoi",s.net_ddoi_gex,s.ddoi_flip],["naive",s.net_naive_gex,s.naive_flip]].map(([a,p,d])=>e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:k,fontSize:7.5,color:t.dim,letterSpacing:"0.08em"},children:a==="ddoi"?l("markets.ddoi.netMeasured",{defaultValue:"NET GEX · MEASURED BOOK"}):l("markets.ddoi.netNaive",{defaultValue:"NET GEX · NAIVE CONVENTION"})}),e.jsxs("div",{style:{fontFamily:k,fontSize:14,fontWeight:800,color:p>0?t.green:p<0?t.red:t.muted},children:[dd(p),e.jsx("span",{style:{fontSize:8.5,color:t.dim,fontWeight:400,marginLeft:6},children:d!=null?l("markets.ddoi.flipAt",{defaultValue:"flip {{s}}",s:d}):""})]})]},a))}),s.signs_disagree&&e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.amber,marginBottom:8},children:l("markets.ddoi.disagree",{defaultValue:"â the measured book DISAGREES with the naive sign: treat naive-GEX regime reads with caution today"})}),e.jsxs("div",{style:{display:"grid",gap:3},children:[o.map(a=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"52px 1fr 1fr",gap:6,alignItems:"center"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.muted,textAlign:"right"},children:a.strike}),["ddoi_gex","naive_gex"].map(p=>e.jsx("div",{style:{position:"relative",height:8,background:"rgba(120,120,120,0.08)",borderRadius:2},children:e.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:a[p]>=0?"50%":`${50-Math.abs(a[p])/r*50}%`,width:`${Math.abs(a[p])/r*50}%`,background:a[p]>=0?"rgba(94,170,120,0.65)":"rgba(200,90,80,0.65)",borderRadius:2,opacity:p==="naive_gex"?.45:1}})},p))]},a.strike)),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"52px 1fr 1fr",gap:6},children:[e.jsx("span",{}),e.jsx("span",{style:{fontFamily:k,fontSize:7,color:t.dim},children:l("markets.ddoi.colMeasured",{defaultValue:"measured"})}),e.jsx("span",{style:{fontFamily:k,fontSize:7,color:t.dim},children:l("markets.ddoi.colNaive",{defaultValue:"naive (faded)"})})]})]})]}):e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim},children:s.note||l("markets.ddoi.empty",{defaultValue:"no signed book yet for this name"})})]})}const rs=n=>n==null?"â":`${(n*100).toFixed(1)}%`;function pd({data:n}){const{t:l}=W(),s=n||{},i=s.call_wall_hold_rate!=null,o=({label:r,hold:a,bench:p,edge:d,dist:c})=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"86px repeat(4, minmax(70px, 1fr))",gap:6,alignItems:"baseline"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:8.5,fontWeight:800,color:t.muted},children:r}),e.jsx("span",{style:{fontFamily:k,fontSize:11,fontWeight:800,color:t.text},children:rs(a)}),e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.dim},children:rs(p)}),e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,color:d>.005?t.green:d<-.005?t.red:t.muted},children:d!=null?`${d>=0?"+":""}${(d*100).toFixed(1)}pt`:"â"}),e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.dim},children:c!=null?`${c>=0?"+":""}${c.toFixed(1)}%`:"â"})]});return e.jsxs("div",{style:{padding:12,borderRadius:10,border:`1px solid ${t.border}`,background:t.panel,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:6},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.12em",color:t.muted},children:l("markets.wallReceipts.title",{defaultValue:"WALL RECEIPTS · DOES THE WALL HOLD?"})}),e.jsx(ie,{topic:"wall receipts",size:14}),i&&e.jsx("span",{style:{fontFamily:k,fontSize:7.5,color:"#E0C27A",background:"rgba(210,162,76,0.10)",border:"1px solid rgba(210,162,76,0.3)",borderRadius:4,padding:"1px 6px"},children:l("markets.wallReceipts.basisChip",{defaultValue:"EOD NAIVE-OI WALLS · {{n}} SESSIONS {{from}} â {{to}}",n:s.n_days,from:s.from,to:s.to})})]}),i?e.jsxs("div",{style:{display:"grid",gap:4},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"86px repeat(4, minmax(70px, 1fr))",gap:6},children:[e.jsx("span",{}),[l("markets.wallReceipts.colHeld",{defaultValue:"held"}),l("markets.wallReceipts.colBench",{defaultValue:"same-dist band"}),l("markets.wallReceipts.colEdge",{defaultValue:"edge"}
1),l("markets.wallReceipts.colDist",{defaultValue:"typical dist"})].map(r=>e.jsx("span",{style:{fontFamily:k,fontSize:7,color:t.dim,letterSpacing:"0.06em"},children:r},r))]}),e.jsx(o,{label:l("markets.wallReceipts.callWall",{defaultValue:"CALL WALL"}),hold:s.call_wall_hold_rate,bench:s.call_bench_hold_rate,edge:s.call_edge,dist:s.med_call_dist_pct}),e.jsx(o,{label:l("markets.wallReceipts.putWall",{defaultValue:"PUT WALL"}),hold:s.put_wall_hold_rate,bench:s.put_bench_hold_rate,edge:s.put_edge,dist:s.med_put_dist_pct}),e.jsx("div",{style:{fontFamily:k,fontSize:7.5,color:t.dim,marginTop:4,opacity:.8},children:l("markets.wallReceipts.honesty",{defaultValue:"edge = wall vs a band at the same median distance every day; near zero means strike placement adds nothing beyond distance"})})]}):e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim},children:s.note||l("markets.wallReceipts.empty",{defaultValue:"no wall history yet: this symbol is still downloading"})})]})}function ud({symbol:n="SPY",vis:l=null}){const{t:s}=W(),[i,o]=$.useState(null),{data:r}=H(()=>Rn(n),3e4,[n]),{data:a}=H(()=>Ne(n),3e4,[n]),{data:p}=H(()=>rr(n).catch(()=>null),6e4,[n]),{data:d}=H(()=>or(n).catch(()=>null),3e5,[n]),c=r&&(r.gex||{})||{},u=c.regime||(r?.net_gex>0?"positive":r?.net_gex<0?"negative":null),h=r?.net_gex,m=Number(a?.spot)||null,y=(r?.by_strike||[]).filter(x=>x&&x.strike!=null).sort((x,j)=>x.strike-j.strike),b=22;let f=y,w=-1;if(m&&y.length){let x=1/0;
1if(y.forEach((j,_)=>{const E=Math.abs(Number(j.strike)-m);E<x&&(x=E,w=_)}),y.length>b*2){const j=Math.max(0,w-b);f=y.slice(j,Math.min(y.length,w+b+1)),w-=j}}const v=Math.max(1,...f.map(x=>Math.abs(Number(x.net_gex||0)))),g=u==="positive"?t.green:u==="negative"?t.red:t.muted;return e.jsxs("div",{style:{height:"100%",overflow:"auto"},children:[e.jsx(X,{id:"positioningchange",vis:l,children:e.jsx(di,{symbol:n})}),e.jsx(X,{id:"gexregime",vis:l,children:e.jsxs("div",{style:{padding:12,borderRadius:10,border:`1px solid ${t.border}`,background:t.panel,borderLeft:`3px solid ${g}`,marginBottom:10},children:[e.jsxs("div",{style:{fontSize:12,color:t.muted,display:"flex",alignItems:"center",gap:6},children:[s("markets.gexStudies.dealerRegimeTitle",{symbol:n})," ",e.jsx(ie,{topic:"net gex",size:15})]}),e.jsxs("div",{style:{fontSize:20,fontWeight:800,color:g},children:[u?u.toUpperCase():s("markets.gexStudies.noData")," ",u==="positive"?s("markets.gexStudies.positiveRegimeNote"):u==="negative"?s("markets.gexStudies.negativeRegimeNote"):""]}),u&&e.jsxs("div",{style:{fontSize:10.5,color:t.muted,marginTop:5,fontFamily:k,lineHeight:1.65},children:[u==="negative"?`moves RUN here · upside: reclaim + hold ${c.magnet!=null?R(c.magnet,0):"the magnet"} opens ${c.call_wall!=null?R(c.call_wall,0):"the call wall"} · downside: losing ${c.put_wall!=null?R(c.put_wall,0):"the put wall"} area accelerates INTO the wall · fade nothing`:`pin regime · price gravitates to ${c.magnet!=null?R(c.magnet,0):"the magnet"} · fading edges toward the pin works · ${c.call_wall!=null?R(c.call_wall,0):"â"} caps · ${c.put_wall!=null?R(c.put_wall,0):"â"} floors`," · display heuristic"]})]})}),e.jsx(X,{id:"ddoi",vis:l,children:e.jsx(cd,{data:p})}),e.jsx(X,{id:"wallreceipts",vis:l,children:e.jsx(pd,{data:d})}),(()=>{const x=j=>{const _=Number(m),E=Number(j);if(!_||!E||!isFinite(_)||!isFinite(E))return"";const T=(E-_)/_*100;return` · ${T>=0?"+":""}${T.toFixed(1)}%`};return e.jsx(X,{id:"gexstats",vis:l,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(5,1fr)",gap:8,marginBottom:12},children:[e.jsx(Nt,{label:s("markets.gexStudies.statNetGex"),value:h!=null?ee(h):"â",color:h>=0?t.green:t.red}),e.jsx(Nt,{label:s("markets.gexStudies.statGammaFlip"),value:c.flip_strike!=null?`${R(c.flip_strike,2)}${x(c.flip_strike)}`:h!=null&&h<0?"above range":h!=null&&h>0?"below range":"â",color:t.amber}),e.jsx(Nt,{label:s("markets.gexStudies.statPin",{defaultValue:"Pin / Magnet"}),value:c.magnet!=null?`${R(c.magnet,0)}${x(c.magnet)}`:"â",color:t.blue}),e.jsx(Nt,{label:s("markets.gexStudies.statCallWall"),value:c.call_wall!=null?`${R(c.call_wall,0)}${x(c.call_wall)}`:"â",color:t.green}),e.jsx(Nt,{label:s("markets.gexStudies.statPutWall"),value:c.put_wall!=null?`${R(c.put_wall,0)}${x(c.put_wall)}`:"â",color:t.red})]})})})(),e.jsx(X,{id:"gexreplay",vis:l,children:e.jsx("div",{style:{padding:4,borderRadius:10,border:`1px solid ${t.border}`,background:t.panel,marginBottom:10},children:e.jsx(ad,{symbol:n,onPin:o,pinnedTs:i})})}),e.jsx(X,{id:"gexsurface2",vis:l,children:e.jsx(gi,{symbol:n,replayTs:i})}),e.jsxs(X,{id:"gexladder",vis:l,children:[e.jsxs("div",{style:{fontSize:11,color:t.muted,marginBottom:6,fontWeight:700,display:"flex",alignItems:"baseline",gap:8},children:[s("markets.gexStudies.netGexByStrikeTitle"),m&&y.length>f.length&&e.jsx("span",{style:{fontWeight:400,color:t.dim,fontFamily:k,fontSize:10},children:s("markets.gexStudies.ladderWindowNote",{n:f.length,m:y.length,spot:R(m,2)})})]}),e.jsxs("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,padding:8},children:[f.length===0&&e.jsx("div",{style:{padding:20,textAlign:"center",color:t.dim},children:s("markets.gexStudies.noGexYet",{symbol:n})}),f.map((x,j)=>{const _=Number(x.net_gex||0),E=Math.abs(_)/v*50,T=Number(x.strike),S=j===w,C=c.call_wall!=null&&T===Number(c.call_wall),I=c.put_wall!=null&&T===Number(c.put_wall),F=c.flip_strike!=null&&Math.abs(T-Number(c.flip_strike))<.51;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,fontFamily:k,padding:"1px 4px",background:S?"rgba(210,162,76,0.08)":"transparent",border:S?"1px solid rgba(210,162,76,0.4)":"1px solid transparent",borderRadius:4},children:[e.jsx("span",{style:{width:56,textAlign:"right",color:S?"#E8E4DA":t.muted,fontWeight:S?800:400},children:R(T,0)}),e.jsxs("div",{style:{flex:1,display:"flex",justifyContent:"center",height:12},children:[e.jsx("div",{style:{width:"50%",display:"flex",justifyContent:"flex-end"},children:_<0&&e.jsx("div",{style:{width:`${E*2}%`,height:10,background:t.red,borderRadius:2}})}),e.jsx("div",{style:{width:1,background:F?t.amber:t.border2}}),e.jsx("div",{style:{width:"50%"},children:_>0&&e.jsx("div",{style:{width:`${E*2}%`,height:10,background:t.green,borderRadius:2}})})]}),e.jsx("span",{style:{width:64,textAlign:"left",color:_>=0?t.green:t.red},children:ee(_)}),e.jsx("span",{style:{width:78,fontSize:9,letterSpacing:"0.06em",textAlign:"left",color:S?t.amber:C?t.green:I?t.red:F?t.amber:"transparent"},children:S?`â ${s("markets.gexStudies.tagSpot")}`:C?`â² ${s("markets.gexStudies.tagCallWall")}`:I?`â¼ ${s("markets.gexStudies.tagPutWall")}`:F?`â ${s("markets.gexStudies.tagFlip")}`:""})]},x.strike)})]}
1),e.jsx("div",{style:{fontSize:10,color:t.dim,marginTop:8},children:s("markets.gexStudies.squeezemetricsNote")})]})]})}const Nt=({label:n,value:l,color:s})=>{const i=Fe(n);return e.jsxs("div",{title:i||void 0,style:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:8,padding:"8px 12px",cursor:"default"},children:[e.jsx("div",{style:{fontSize:10,color:t.muted,fontWeight:700,display:"inline-block",borderBottom:i?"1px dotted rgba(255,255,255,0.22)":void 0,paddingBottom:i?1:0},children:n}),e.jsx("div",{style:{fontSize:16,fontWeight:800,color:s,fontFamily:k},children:l})]})},md={gap_up:t.green,gap_down:t.red,volume_surge:t.blue,new_52w_high:t.green,new_52w_low:t.red,price_spike:t.green,rapid_decline:t.red,orb_breakout:t.green,orb_breakdown:t.red,premarket_mover:t.amber,halt:t.magenta},hd=["all","halt","gap_up","gap_down","volume_surge","new_52w_high","new_52w_low","orb_breakout","premarket_mover","price_spike"];function gd(){const{t:n}=W(),[l,s]=$.useState("all"),[i,o]=$.useState(!1),r=$.useRef(0),{accessToken:a}=wl(),{items:p,connected:d}=El(ar(a),"alerts",{max:400}),{data:c,lastUpdated:u,error:h}=H(()=>Zs({limit:150}),15e3,[]),m=$.useMemo(()=>c?.alerts||[],[c]),y=!!(!h&&c?.feed?.fresh&&u&&Date.now()-u<3e4);$.useEffect(()=>{if(i&&p.length>r.current&&r.current>0)try{const v=window.AudioContext||window.webkitAudioContext,g=new v,x=g.createOscillator(),j=g.createGain();x.connect(j),j.connect(g.destination),x.frequency.value=880,j.gain.value=.06,x.start(),x.stop(g.currentTime+.12),setTimeout(()=>g.close(),300)}catch{}r.current=p.length},[p,i]);const b=$.useMemo(()=>{const v=new Set,g=[];for(const x of[...p,...m]){const j=`${x.symbol}|${x.alert_type}|${x.ts||x.message}`;v.has(j)||(v.add(j),g.push(x))}return l==="all"?g:g.filter(x=>x.alert_type===l)},[p,m,l]),f=$.useMemo(()=>{const v=b[0]?.ts||m[0]?.ts;if(!v)return null;try{const g=j=>new Date(j).toLocaleDateString("en-CA",{timeZone:"America/New_York"}),x=g(v);return x!==g(Date.now())?x:null}catch{return null}},[b,m]),w=v=>{try{return new Date(v).toLocaleTimeString("en-US",{timeZone:"America/New_York",hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8,flexWrap:"wrap"},children:[hd.map(v=>e.jsx("button",{onClick:()=>s(v),style:{fontSize:11,padding:"4px 9px",borderRadius:6,cursor:"pointer",border:`1px solid ${l===v?"rgba(210,162,76,0.5)":t.border2}`,background:l===v?"rgba(210,162,76,0.14)":"transparent",color:l===v?"#E0C27A":t.muted,fontWeight:600},children:v.replace(/_/g," ")},v)),e.jsx("button",{onClick:()=>o(v=>!v),title:n("markets.alertStream.audioTooltip"),style:{fontSize:11,padding:"4px 9px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${i?t.amber:t.border2}`,background:i?"rgba(255,170,0,0.14)":"transparent",color:i?t.amber:t.muted},children:i?"ð ON":"ð OFF"}),e.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:t.muted,display:"flex",alignItems:"center",gap:6},children:[f&&e.jsx("span",{style:{fontFamily:k,fontSize:10,fontWeight:700,color:"#E0C27A",background:"rgba(210,162,76,0.12)",border:"1px solid rgba(210,162,76,0.35)",borderRadius:5,padding:"2px 7px"},children:n("markets.dollarFlow.lastSessionChip",{date:f})}),e.jsx(Cn,{on:d&&y&&!f})," ",d&&y?n("markets.alertStream.live"):d?"FEED STALE":n("markets.alertStream.connecting")," · ",b.length]})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:[b.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.dim},children:n("markets.alertStream.noAlerts")}),b.map((v,g)=>{const x=md[v.alert_type]||t.muted;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"7px 10px",borderBottom:"1px solid rgba(255,255,255,0.03)",fontSize:12},children:[e.jsx("span",{style:{width:96,fontSize:10,fontWeight:700,color:x,textTransform:"uppercase"},children:(v.alert_type||"").replace(/_/g," ")}),e.jsx("span",{style:{width:56,fontWeight:800,color:t.text,fontFamily:k},children:v.symbol}),e.jsx("span",{style:{width:64,textAlign:"right",color:t.muted,fontFamily:k},children:v.price!=null?R(v.price,2):""}),e.jsx("span",{style:{width:64,textAlign:"right",color:v.change_pct>=0?t.green:t.red,fontFamily:k},children:v.change_pct!=null?dr(v.change_pct):""}),e.jsx("span",{style:{flex:1,color:t.muted},children:v.message}),v.severity==="high"&&e.jsx("span",{style:{fontSize:9,color:x,border:`1px solid ${x}`,borderRadius:4,padding:"1px 4px"},children:"HIGH"}),v.ts&&e.jsx("span",{style:{width:44,textAlign:"right",color:t.dim,fontFamily:k,fontSize:10.5},children:w(v.ts)})]},g)})]})]})}const xd=["SPY","QQQ","IWM","SPXW"],Ei=(n,l=300,s=3e4)=>{const{data:i}=H(()=>cr(n,l),s,[n]);return $.useMemo(()=>(Array.isArray(i?.series)?i.series:[]).map(r=>({t:Number(r.t),cum:Number(r.cum??r.net)})).filter(r=>isFinite(r.t)&&isFinite(r.cum)),[i])},fd=n=>{try{return new Date(n*1e3).toLocaleTimeString("en-US",{timeZone:"America/Ne
1w_York",hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}};function yd({symbol:n}){const{t:l}=W(),s=Ei(n,300,3e4),{data:i}=H(()=>Ct(n,"5m",120),6e4,[n]),o=$.useMemo(()=>{if(s.length<3)return null;const p=1200,d=360,c=74,u=22,h=14,m=s[0].t,y=s[s.length-1].t||m+1,b=s.map(A=>A.cum);let f=Math.min(...b,0),w=Math.max(...b,0);const v=(w-f)*.08||1;f-=v,w+=v;const g=A=>(A-m)/(y-m)*(p-c),x=A=>h+(d-h-u)*(1-(A-f)/(w-f)),j=s.map(A=>`${g(A.t).toFixed(1)},${x(A.cum).toFixed(1)}`).join(" "),_=x(0),E=`0,${_.toFixed(1)} ${j} ${g(y).toFixed(1)},${_.toFixed(1)}`,T=(i?.candles||[]).map(A=>({t:Number(A.ts??A.t),c:Number(A.close??A.c)})).filter(A=>isFinite(A.t)&&isFinite(A.c)&&A.t>=m&&A.t<=y);let S=null;if(T.length>2){const A=T.map(Q=>Q.c),P=Math.min(...A),J=Math.max(...A)-P||1;S=T.map(Q=>`${g(Q.t).toFixed(1)},${(h+(d-h-u)*(1-(Q.c-P)/J)).toFixed(1)}`).join(" ")}let C=null;if(s.length>7&&T.length>7){const A=s[s.length-1].cum-s[s.length-7].cum,P=T[T.length-1].c-T[T.length-7].c;Math.abs(A)>1e5&&(C=A>0==P>0?{k:"confirm",c:t.green,txt:l("markets.hiro.verdictConfirm")}:{k:"diverge",c:t.amber,txt:l("markets.hiro.verdictDiverge")})}const I=s[s.length-1],F=[0,.25,.5,.75,1].map(A=>m+(y-m)*A);return{W:p,H:d,padR:c,X:g,Y:x,line:j,area:E,zeroY:_,priceLine:S,verdict:C,last:I,ticks:F,lo:f,hi:w}},[s,i,l]);if(!o)return e.jsx("div",{style:{padding:40,textAlign:"center",color:t.dim,fontSize:12},children:l("markets.hiro.waiting")});const r=o,a=r.last.cum>=0;return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:20,fontWeight:800,color:a?t.green:t.red},children:ee(r.last.cum)}),e.jsx("span",{style:{fontSize:10.5,color:t.muted},children:l("markets.hiro.cumLabel")}),r.verdict&&e.jsx("span",{style:{fontFamily:k,fontSize:10,fontWeight:800,color:r.verdict.c,border:`1px solid ${r.verdict.c}`,borderRadius:5,padding:"2px 8px"},children:r.verdict.txt}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:9.5,color:t.dim},children:l("markets.hiro.legend")})]}),e.jsxs("svg",{viewBox:`0 0 ${r.W} ${r.H}`,width:"100%",role:"img","aria-label":`HIRO ${n}`,children:[[.25,.5,.75].map(p=>{const d=14+(r.H-36)*p;return e.jsx("line",{x1:"0",y1:d,x2:r.W-r.padR,y2:d,stroke:t.border2,strokeWidth:"0.5",opacity:"0.5"},p)}),e.jsx("polygon",{points:r.area,fill:a?"rgba(55,209,131,0.10)":"rgba(240,82,79,0.10)"}),e.jsx("line",{x1:"0",y1:r.zeroY,x2:r.W-r.padR,y2:r.zeroY,stroke:t.slate,strokeWidth:"1",strokeDasharray:"4 4"}),r.priceLine&&e.jsx("polyline",{points:r.priceLine,fill:"none",stroke:"rgba(232,228,218,0.45)",strokeWidth:"1.2",strokeDasharray:"2 4"}),e.jsx("polyline",{points:r.line,fill:"none",stroke:a?t.green:t.red,strokeWidth:"2"}),e.jsx("circle",{cx:r.X(r.last.t),cy:r.Y(r.last.cum),r:"3.5",fill:t.gold}),e.jsx("rect",{x:r.W-r.padR+4,y:r.Y(r.last.cum)-9,width:r.padR-8,height:"15",rx:"3",fill:t.gold}),e.jsx("text",{x:r.W-r.padR/2,y:r.Y(r.last.cum)+3,fill:"#0B0C0E",fontSize:"9.5",fontWeight:"700",fontFamily:"monospace",textAnchor:"middle",children:ee(r.last.cum)}),r.ticks.map((p,d)=>e.jsx("text",{x:r.X(p),y:r.H-6,fill:t.dim,fontSize:"9.5",fontFamily:"monospace",textAnchor:d===0?"start":d===4?"end":"middle",children:fd(p)},d))]})]})}function bd({sym:n}){const{t:l}=W(),s=Ei(n,300,6e4),i=s.length?s[s.length-1].cum:null,o=$.useMemo(()=>{if(s.length<3)return null;const a=s.map(u=>u.cum),p=Math.min(...a,0),c=Math.max(...a,0)-p||1;return s.map((u,h)=>`${h/(s.length-1)*220},${(30*(1-(u.cum-p)/c)+3).toFixed(1)}`).join(" ")},[s]),r=i!=null&&i>=0;return e.jsxs("div",{style:{flex:1,minWidth:170,border:`1px solid ${t.border2}`,borderRadius:8,padding:"8px 12px",background:t.panel2},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{fontFamily:k,fontSize:12,fontWeight:800,color:t.text},children:n}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:11.5,fontWeight:700,color:i==null?t.dim:r?t.green:t.red},children:i==null?l("markets.hiro.quiet"):ee(i)})]}),e.jsx("svg",{viewBox:"0 0 220 36",width:"100%",height:"36",children:o?e.jsx("polyline",{points:o,fill:"none",stroke:r?t.green:t.red,strokeWidth:"1.5"}):e.jsx("line",{x1:"0",y1:"18",x2:"220",y2:"18",stroke:t.border2,strokeWidth:"1",strokeDasharray:"3 4"})})]})}
1function vd({symbol:n="SPY",vis:l=null}){const{t:s}=W(),i=String(n||"SPY").toUpperCase();return e.jsx(X,{id:"hiroview",vis:l,style:{height:"100%",minHeight:0},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,height:"100%",minHeight:0,overflow:"auto"},children:[e.jsxs("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,background:t.panel,padding:"10px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsxs("span",{style:{fontFamily:k,fontSize:11,fontWeight:800,letterSpacing:"0.14em",color:t.gold},children:["HIRO · ",i]}),e.jsx(ie,{size:13,title:s("markets.hiro.infoTitle"),what:s("markets.hiro.infoWhat"),how:s("markets.hiro.infoHow")}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:9,color:t.dim},children:s("markets.hiro.subtitle")})]}),e.jsx(yd,{symbol:i})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:k,fontSize:9.5,fontWeight:700,letterSpacing:"0.12em",color:t.muted,marginBottom:6},children:s("markets.hiro.compositesTitle")}),e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:xd.map(o=>e.jsx(bd,{sym:o},o))})]}),e.jsx("div",{style:{fontSize:9.5,color:t.dim,lineHeight:1.5},children:s("markets.hiro.honesty")})]})})}const os=n=>{const l=Number(n);return!isFinite(l)||l<=0?"â":l>=1e12?`$${(l/1e12).toFixed(1)}T`:l>=1e9?`$${(l/1e9).toFixed(1)}B`:`$${(l/1e6).toFixed(0)}M`},Le={bmo:{l:"BMO",c:"#4DC9E6"},amc:{l:"AMC",c:"#A78BFA"},tbd:{l:"TBD",c:"#64748B"}};
1function jd(){const{t:n}=W(),{data:l}=H(()=>Ol("/api/equities/earnings-hub",{days:10}),3e5,[]),{hover:s,show:i,hide:o}=In(),[r,a]=$.useState(null),{data:p}=H(()=>r?Ol(`/api/equities/earnings-move/${r}`).catch(()=>null):Promise.resolve(null),6e5,[r]),d=$.useMemo(()=>l?.days||[],[l]),c=l?.receipts,u=$.useMemo(()=>{const h=[];for(const m of d)for(const y of m.names||[])y.em_pct!=null&&h.push({...y,date:m.date});return h.sort((m,y)=>(y.em_pct||0)-(m.em_pct||0)).slice(0,8)},[d]);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,height:"100%",minHeight:0,overflow:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontFamily:k,fontSize:11,fontWeight:800,letterSpacing:"0.14em",color:t.gold},children:n("markets.earningsHub.title")}),e.jsx(ie,{size:13,title:n("markets.earningsHub.infoTitle"),what:n("markets.earningsHub.infoWhat"),how:n("markets.earningsHub.infoHow")}),r&&e.jsx(kd,{sym:r,d:p,onClose:()=>a(null),t:n}),c&&e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:9.5,color:"#E0C27A",border:"1px solid rgba(210,162,76,0.35)",background:"rgba(210,162,76,0.10)",borderRadius:5,padding:"2px 8px"},title:n("markets.earningsHub.receiptsTooltip"),children:n("markets.earningsHub.receiptsChip",{n:c.n,em:c.avg_em_pct,real:c.avg_realized_pct,exceed:Math.round((c.exceeded_em_share||0)*100)})})]}),u.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:k,fontSize:9.5,fontWeight:700,letterSpacing:"0.12em",color:t.muted,marginBottom:6},children:n("markets.earningsHub.screenerTitle")}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:u.map(h=>e.jsxs("div",{style:{border:"1px solid rgba(210,162,76,0.3)",borderRadius:8,padding:"7px 12px",background:"rgba(210,162,76,0.05)",minWidth:128},children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"baseline"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:12.5,fontWeight:800,color:t.text},children:h.symbol}),e.jsx("span",{style:{fontSize:8.5,fontWeight:800,color:(Le[h.timing]||Le.tbd).c},children:(Le[h.timing]||Le.tbd).l})]}),e.jsxs("div",{style:{fontFamily:k,fontSize:15,fontWeight:800,color:t.amber},children:["±",R(h.em_pct,1),"%"]}),e.jsxs("div",{style:{fontSize:9,color:t.dim,fontFamily:k},children:[h.date," · ",os(h.mcap)]})]},`${h.symbol}${h.date}`))})]}),e.jsxs("div",{style:{display:"flex",gap:10,overflowX:"auto",paddingBottom:6},children:[d.filter(h=>(h.names||[]).length).map(h=>e.jsxs("div",{style:{minWidth:250,flex:"0 0 auto",border:`1px solid ${t.border}`,borderRadius:8,background:t.panel,overflow:"hidden"},children:[e.jsx("div",{style:{padding:"6px 10px",background:t.panel2,borderBottom:`1px solid ${t.border2}`,fontFamily:k,fontSize:10,fontWeight:800,letterSpacing:"0.1em",color:t.gold},children:h.date}),e.jsx("div",{style:{maxHeight:430,overflowY:"auto"},children:(h.names||[]).slice(0,24).map(m=>e.jsxs("div",{onClick:()=>a(m.symbol),style:{display:"flex",alignItems:"center",gap:7,padding:"5px 10px",borderBottom:"1px solid rgba(255,255,255,0.03)",cursor:"pointer",background:r===m.symbol?"rgba(210,162,76,0.08)":"transparent"},onMouseEnter:y=>i(m.symbol,{date:h.date,name:m.name,mcap:m.mcap,sessionLabel:(Le[m.timing]||Le.tbd).l},y.currentTarget.getBoundingClientRect()),onMouseLeave:o,children:[e.jsx("span",{style:{fontSize:8.5,fontWeight:800,width:26,color:(Le[m.timing]||Le.tbd).c},children:(Le[m.timing]||Le.tbd).l}),e.jsx("span",{style:{fontFamily:k,fontSize:11.5,fontWeight:800,color:t.text,width:52},children:m.symbol}),e.jsx("span",{style:{fontSize:9.5,color:t.dim,fontFamily:k,width:48,textAlign:"right"},children:os(m.mcap)}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:10.5,fontWeight:700,color:m.em_pct!=null?t.amber:t.dim},children:m.em_pct!=null?`±${R(m.em_pct,1)}%`:"â"}),m.iv_rank!=null&&e.jsxs("span",{style:{fontFamily:k,fontSize:9,color:m.iv_rank>=50?t.red:t.blue},children:["IVR ",Math.round(m.iv_rank<=1?m.iv_rank*100:m.iv_rank)]})]},m.symbol))})]},h.date)),!d.some(h=>(h.names||[]).length)&&e.jsx("div",{style:{padding:30,color:t.dim,fontSize:12},children:n("markets.earningsHub.empty")})]}),e.jsx("div",{style:{fontSize:9.5,color:t.dim,lineHeight:1.5},children:n("markets.earningsHub.honesty")}),s&&e.jsx(Mn,{hover:s})]})}function kd({sym:n,d:l,onClose:s,t:i}){const o=l?.latest,r=l?.receipts;return e.jsxs("div",{style:{border:"1px solid rgba(210,162,76,0.3)",borderRadius:8,background:t.panel,padding:"8px 12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9.5,fontWeight:800,letterSpacing:"0.1em",color:t.gold},children:i("markets.earningsHub.emdTitle",{defaultValue:"{{sym}} · EARNINGS MOVE, DECOMPOSED",sym:n})}),e.jsx(ie,{topic:"earnings move",size:13}),e.jsx("button",{className:"sa-x",onClick:s,style:{marginLeft:"auto",background:"none",border:"none",color:t.dim,cursor:"pointer",fontSize:12},children:"Ã"})]}),l?e.jsxs(e.Fragment,{children:[o?e.jsx("div",{style:{fontFamily:k,fontSize:10.5,color:t.text,marginBottom:3},children:i("markets.earningsHub.emdLatest",{defaultValue:"pure event move priced ±{{ev}}% (front {{f}}% IV vs base {{b}}%, exp {{exp}}, as of {{asof}})",ev:o.implied_earnings_move_pct,f:(o.front_iv*100).toFixed(0),b:(o.back_iv*100).toFixed(0),exp:o.front_exp,asof:o.asof})}):e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim,marginBottom:3},children:i("markets.earningsHub.emdNoLatest",{defaultValue:"no live term structure in the warehouse yet"})}),r?e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.muted},children:i("markets.earningsHub.emdReceipts",{defaultValue:"RECEIPTS ({{n}} past events): priced ±{{imp}}% vs actual ±{{act}}% · overpriced Ã{{r}} · actual exceeded {{ex}}%",n:r.n_events,imp:r.median_implied_pct,act:r.median_actual_pct,r:r.overpricing_ratio??"â",ex:Math.round((r.exceeded_share||0)*100)})}):e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim},children:i("markets.earningsHub.emdNoReceipts",{defaultValue:"receipts pending: not enough past events in this symbolâs downloaded history yet"})})]}):e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim},children:i("markets.earningsHub.emdLoading",{defaultValue:"computing from the options warehouseâ¦"})})]})}const wd=1e4,It=["0","1","2"],Sd=(n,l)=>{if(!n.length||l==null)return null;let s=n[0],i=1/0;for(const o of n){const r=Math.abs(o-l);r<i&&(i=r,s=o)}return s};function _d({underlying:n="SPY",vis:l=null}){const{t:s}=W(),[i,o]=$.useState(""),r=(i.trim().toUpperCase()||n).toUpperCase(),{data:a,loading:p}=H(()=>pr(r),wd,[r]),d=$.useMemo(()=>a?.cells??{},[a]),c=a?.spot??null,u=$.useMemo(()=>a?.strikes??[],[a]),h=$.useMemo(()=>[...u].sort((g,x)=>x-g),[u]),m=$.useMemo(()=>Sd(h,c),[h,c]),y=$.useMemo(()=>{const g=Object.values(d).map(x=>Math.abs(Number(x)));return Math.max(1,...g)},[d]),b=(g,x,j)=>`${g}|${x}|${j}`,f=(g,x,j)=>{const _=b(g,x,j),E=Number(d[_]||0),T=Math.min(1,Math.abs(E)/y);return!d[_]&&E===0?{background:"transparent",color:t.dim,border:`1px solid ${t.border}`}:{background:E>0?`rgba(110,210,90,${.1+T*.65})`:`rgba(255,91,85,${.1+T*.65})`,color:T>.55?"#000":E>0?t.green:t.red,border:`1px solid ${t.border}`}},w=g=>g===m,v=!p&&h.length===0;return e.jsx(X,{id:"heatmapview",vis:l,style:{height:"100%",minHeight:0},children:e.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10,flexShrink:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,color:t.text},children:s("markets.heatmap.title")}
1),e.jsx("span",{style:{fontSize:10,color:t.muted},children:s("markets.heatmap.subtitle")}),e.jsx("input",{value:i,onChange:g=>o(g.target.value.toUpperCase()),placeholder:n,maxLength:8,spellCheck:!1,style:{marginLeft:"auto",width:72,background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,fontSize:12,fontFamily:k,padding:"4px 8px",outline:"none",textTransform:"uppercase"}}),e.jsxs("span",{style:{fontSize:10,color:t.muted},children:[r,c?` · spot ${R(c,2)}`:""]})]}),!v&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"64px repeat(3,1fr) 12px repeat(3,1fr)",gap:2,marginBottom:3,flexShrink:0},children:[e.jsx("div",{style:{fontSize:9,color:t.dim}}),It.map(g=>e.jsx("div",{style:{fontSize:9,fontWeight:800,color:t.green,fontFamily:"Inter",letterSpacing:.5,textAlign:"center",textTransform:"uppercase"},children:s(g==="0"?"markets.heatmap.callThisWk":g==="1"?"markets.heatmap.callNextWk":"markets.heatmap.callTwoPlus")},`ch-c${g}`)),e.jsx("div",{style:{fontSize:9,color:t.dim}}),It.map(g=>e.jsx("div",{style:{fontSize:9,fontWeight:800,color:t.red,fontFamily:"Inter",letterSpacing:.5,textAlign:"center",textTransform:"uppercase"},children:s(g==="0"?"markets.heatmap.putThisWk":g==="1"?"markets.heatmap.putNextWk":"markets.heatmap.putTwoPlus")},`ch-p${g}`))]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:[v&&e.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:t.dim,fontSize:12,textAlign:"center",padding:24},children:s("markets.heatmap.noData",{underlying:r})}),p&&!h.length&&e.jsx("div",{style:{height:80,display:"flex",alignItems:"center",justifyContent:"center",color:t.dim,fontSize:12},children:s("markets.heatmap.loading")}),h.map(g=>{const x=w(g);if(!x&&!["C","P"].some(T=>It.some(S=>!!d[b(g,T,S)])))return null;const j=x?"rgba(230,194,0,0.07)":"transparent",_=x?"#e6c200":t.muted;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"64px repeat(3,1fr) 12px repeat(3,1fr)",gap:2,marginBottom:1,background:j,borderRadius:4},children:[e.jsxs("div",{style:{textAlign:"right",paddingRight:8,fontSize:11,fontFamily:k,fontWeight:x?800:600,color:_,display:"flex",alignItems:"center",justifyContent:"flex-end"},children:[x&&e.jsx("span",{style:{fontSize:8,color:"#e6c200",marginRight:3,fontFamily:"Inter"},children:"ATM"}),R(g,0)]}),It.map(E=>{const T=b(g,"C",E),S=Number(d[T]||0),C=f(g,"C",E);return e.jsx("div",{title:d[T]?`C${E} ${R(g,0)}: ${ee(S)}`:"",style:{...C,borderRadius:3,padding:"3px 4px",textAlign:"center",fontSize:10,fontFamily:k,minWidth:0,minHeight:18,display:"flex",alignItems:"center",justifyContent:"center"},children:d[T]?ee(Math.abs(S)):""},`C${E}`)}),e.jsx("div",{style:{width:1,background:t.border2,margin:"0 auto",alignSelf:"stretch"}}),It.map(E=>{const T=b(g,"P",E),S=Number(d[T]||0),C=f(g,"P",E);return e.jsx("div",{title:d[T]?`P${E} ${R(g,0)}: ${ee(S)}`:"",style:{...C,borderRadius:3,padding:"3px 4px",textAlign:"center",fontSize:10,fontFamily:k,minWidth:0,minHeight:18,display:"flex",alignItems:"center",justifyContent:"center"},children:d[T]?ee(Math.abs(S)):""},`P${E}`)})]},g)})]}),h.length>0&&e.jsxs("div",{style:{flexShrink:0,display:"flex",gap:16,marginTop:8,fontSize:9,color:t.dim,fontFamily:"Inter"},children:[e.jsxs("span",{children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:2,background:"rgba(110,210,90,0.5)",marginRight:4,verticalAlign:"middle"}}),s("markets.heatmap.legendCallHeavy")]}),e.jsxs("span",{children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:2,background:"rgba(255,91,85,0.5)",marginRight:4,verticalAlign:"middle"}}),s("markets.heatmap.legendPutHeavy")]}),e.jsxs("span",{children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:2,background:"rgba(230,194,0,0.15)",border:"1px solid rgba(230,194,0,0.4)",marginRight:4,verticalAlign:"middle"}}),s("markets.heatmap.legendAtm")]}),e.jsx("span",{style:{marginLeft:"auto"},children:s("markets.heatmap.legendBuckets")})]})]})})}const Td=15e3,Mt=560,kt=120,Se={top:12,right:12,bottom:24,left:52};function Ed({underlying:n="SPY",bucket_s:l=300}){const{t:s}=W(),{data:i,loading:o}=H(()=>ur(n,l),Td,[n,l]),r=$.useMemo(()=>i?.series??[],[i]),a=r.length?Number(r[r.length-1].cum):null,p=r.reduce((f,w)=>f+Number(w.net||0),0),d=a==null?!0:a>=0,{areaPath:c,linePath:u,zeroY:h,yTicks:m}=$.useMemo(()=>
1{if(!r.length)return{areaPath:"",linePath:"",zeroY:null,yTicks:[]};const f=r.map(V=>Number(V.cum)),w=Math.min(...f,0),v=Math.max(...f,0),g=v-w||1,x=Mt-Se.left-Se.right,j=kt-Se.top-Se.bottom,_=V=>Se.left+V/Math.max(r.length-1,1)*x,E=V=>Se.top+(1-(V-w)/g)*j,T=E(0),S=r.map((V,J)=>`${_(J).toFixed(1)},${E(Number(V.cum)).toFixed(1)}`),C=_(0).toFixed(1),I=_(r.length-1).toFixed(1),F=`M ${C},${T.toFixed(1)} L ${S.join(" L ")} L ${I},${T.toFixed(1)} Z`,A=`M ${S.join(" L ")}`,P=[{v:w,y:E(w)},{v:0,y:T},{v,y:E(v)}].filter((V,J,Q)=>Q.findIndex(U=>Math.abs(U.y-V.y)<4)===J);return{areaPath:F,linePath:A,zeroY:T,yTicks:P}},[r]),y=d?t.green:t.red,b=`df-fill-${n}`;return e.jsxs("div",{style:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:10,padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:8},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:11,fontWeight:800,color:t.text,letterSpacing:.3},children:[s("markets.dollarFlow.title"),e.jsx("span",{style:{marginLeft:8,fontSize:9,fontWeight:600,color:t.muted,textTransform:"uppercase",letterSpacing:.5},children:s("markets.dollarFlow.subtitle")}),i?.stale&&r.length>0&&e.jsx("span",{style:{marginLeft:8,fontSize:9,fontWeight:800,letterSpacing:.5,padding:"2px 7px",borderRadius:5,color:"#E0C27A",background:"rgba(210,162,76,0.12)",border:"1px solid rgba(210,162,76,0.35)"},children:s("markets.dollarFlow.lastSessionChip",{date:i.session_date||""})})]}),e.jsxs("div",{style:{fontSize:10,color:t.muted,marginTop:2},children:[n.toUpperCase()," · ",Math.round(l/60),"m buckets"]})]}),e.jsxs("div",{style:{textAlign:"right"},children:[e.jsx("div",{style:{fontSize:20,fontWeight:800,color:y,fontFamily:k,lineHeight:1},children:a==null?"â":ee(a)}),e.jsxs("div",{style:{fontSize:10,color:t.muted,marginTop:2},children:[s("markets.dollarFlow.netLabel")," ",e.jsxs("span",{style:{color:p>=0?t.green:t.red,fontWeight:700},children:[p>=0?"+":"",ee(p)]})]})]})]}),o&&!r.length?e.jsx("div",{style:{height:kt,display:"flex",alignItems:"center",justifyContent:"center",color:t.dim,fontSize:12},children:s("markets.dollarFlow.loading")}):r.length?e.jsxs("svg",{viewBox:`0 0 ${Mt} ${kt}`,width:"100%",height:kt,style:{display:"block",overflow:"visible"},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:b,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:y,stopOpacity:d?.35:.4}),e.jsx("stop",{offset:"100%",stopColor:y,stopOpacity:.04})]})}),m.map(f=>e.jsxs("g",{children:[e.jsx("line",{x1:Se.left,y1:f.y,x2:Mt-Se.right,y2:f.y,stroke:f.v===0?t.border2:t.border,strokeWidth:f.v===0?1.2:.7,strokeDasharray:f.v===0?"":"3 3"}),e.jsx("text",{x:Se.left-4,y:f.y+3.5,textAnchor:"end",fill:f.v===0?t.muted:t.dim,fontSize:9,fontFamily:"Inconsolata, monospace",children:ee(f.v)})]},f.v)),h!=null&&e.jsx("line",{x1:Se.left,y1:h,x2:Mt-Se.right,y2:h,stroke:t.border2,strokeWidth:1}),e.jsx("path",{d:c,fill:`url(#${b})`}),e.jsx("path",{d:u,fill:"none",stroke:y,strokeWidth:1.8,strokeLinejoin:"round",strokeLinecap:"round"}),r.length>0&&(()=>{const f=Mt-Se.left-Se.right,w=r.map(E=>Number(E.cum)),v=Math.min(...w,0),x=Math.max(...w,0)-v||1,j=Se.left+f,_=Se.top+(1-(w[w.length-1]-v)/x)*(kt-Se.top-Se.bottom);return e.jsx("circle",{cx:j,cy:_,r:3,fill:y})})()]}):e.jsx("div",{style:{height:kt,display:"flex",alignItems:"center",justifyContent:"center",color:t.dim,fontSize:12,textAlign:"center"},children:s("markets.dollarFlow.noData")})]})}function $d({symbol:n="SPY",vis:l=null}){const{t:s}=W(),{data:i}=H(()=>mr(n),6e4,[n]),o=i?.spot,r=(i?.strikes||[]).slice().sort((m,y)=>y.strike-m.strike),a=24;let p=r;if(o&&r.length>a*2){let m=0,y=1/0;r.forEach((b,f)=>{const w=Math.abs(Number(b.strike)-o);w<y&&(y=w,m=f)}),p=r.slice(Math.max(0,m-a),Math.min(r.length,m+a+1))}const d=Math.max(1,...p.flatMap(m=>[m.call_oi||0,m.put_oi||0])),c=o?p.reduce((m,y)=>Math.abs(y.strike-o)<Math.abs((m?.strike??1e9)-o)?y:m,null):null,u=(m,y,b)=>m?{txt:je(m),c:y?b:t.muted,w:y?700:400}:{txt:"â",c:"rgba(120,129,143,0.35)",w:400};if(!p.length)return e.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:t.dim,textAlign:"center",padding:24},children:s("markets.oiVolume.noChain",{symbol:n})});const h=({v:m,color:y,align:b})=>e.jsx("div",{style:{display:"flex",justifyContent:b,height:11},children:e.jsx("div",{style:{width:`${Math.min(m,d)/d*100}%`,height:9,background:y,borderRadius:2,opacity:.5}})});return e.jsx(X,{id:"oivolview",vis:l,style:{height:"100%",minHeight:0},children:e.jsxs("div",{style:{height:"100%",overflow:"auto"},children:[e.jsxs("div",{style:{fontSize:11,color:t.muted,marginBottom:6},children:[n," · ",s("markets.oiVolume.subtitle"),o?` · ${s("markets.oiVolume.spotSuffix",{spot:R(o,2)})}`:""]}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:k,fontSize:11},children:[e.jsx("thead",{children:e.jsx("tr",{children:[s("markets.oiVolume.colCallVol"),s("markets.oiVolume.colCallOi"),"",s("markets.oiVolume.colStrike"),"",s("markets.oiVolume.colPutOi"),s("markets.oiVolume.colPutVol")].map((m,y)=>e.jsx("th",{style:{padding:"4px 6px",color:t.muted,fontFamily:"Inter",fontSize:9,textAlign:y<3?"right":y===3?"center":"left"},children:m}
1,y))})}),e.jsx("tbody",{children:p.map(m=>{const y=c&&m.strike===c.strike;return(()=>{const b=u(m.call_vol,!1),f=u(m.call_oi,!0,t.green),w=u(m.put_oi,!0,t.red),v=u(m.put_vol,!1);return e.jsxs("tr",{style:{background:y?"rgba(210,162,76,0.09)":"transparent",borderBottom:"1px solid rgba(255,255,255,0.03)",outline:y?"1px solid rgba(210,162,76,0.4)":"none"},children:[e.jsx("td",{style:{textAlign:"right",padding:"2px 6px",color:b.c,fontWeight:b.w},children:b.txt}),e.jsx("td",{style:{textAlign:"right",padding:"2px 6px",color:f.c,fontWeight:f.w},children:f.txt}),e.jsx("td",{style:{width:80},children:e.jsx(h,{v:m.call_oi||0,color:t.green,align:"flex-end"})}),e.jsxs("td",{style:{textAlign:"center",padding:"2px 6px",color:y?t.amber:t.text,fontWeight:800},children:[R(m.strike,0),y?" â":""]}),e.jsx("td",{style:{width:80},children:e.jsx(h,{v:m.put_oi||0,color:t.red,align:"flex-start"})}),e.jsx("td",{style:{textAlign:"left",padding:"2px 6px",color:w.c,fontWeight:w.w},children:w.txt}),e.jsx("td",{style:{textAlign:"left",padding:"2px 6px",color:v.c,fontWeight:v.w},children:v.txt})]},m.strike)})()})})]})]})})}const as=["TIME","TICK","EXP","STRIKE","C/P","SIDE","SPOT","SIZE","PREM","TYPE","IV"],Cd=n=>n==="sweep"?t.magenta:n==="block"?t.blue:n==="multileg"?t.amber:t.muted,ze=({children:n,align:l="right",color:s=t.text,bold:i=!1})=>e.jsx("td",{style:{textAlign:l,padding:"4px 8px",color:s,fontWeight:i?700:400,whiteSpace:"nowrap"},children:n});function Ad({rows:n=[],emptyNote:l}){const{t:s}=W(),i=l??s("markets.flowTable.emptyDefault");return e.jsx("div",{tabIndex:0,"aria-label":s("markets.flowTable.ariaLabel"),style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{position:"sticky",top:0,background:t.panel2,zIndex:1},children:e.jsx("tr",{children:as.map(o=>e.jsx("th",{title:Fe(o)||void 0,style:{textAlign:o==="TICK"?"left":"right",padding:"6px 8px",color:t.muted,cursor:Fe(o)?"help":"default",fontFamily:"Inter",fontSize:10,fontWeight:700,letterSpacing:.4,borderBottom:`1px solid ${t.border2}`},children:o},o))})}),e.jsxs("tbody",{children:[n.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:as.length,style:{padding:24,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:i})}),n.map((o,r)=>{const a=$l(o.cp),p=o.is_golden_sweep?"rgba(214,90,219,0.10)":o.classification==="sweep"?"rgba(214,90,219,0.05)":"transparent";return e.jsxs("tr",{style:{background:p,borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[e.jsx(ze,{children:An(o.ts_ns)}),e.jsx(ze,{align:"left",color:a,bold:!0,children:o.underlying}),e.jsx(ze,{children:o.expiry}),e.jsx(ze,{children:R(o.strike,1)}),e.jsx(ze,{color:a,bold:!0,children:String(o.cp).toUpperCase()}),e.jsx(ze,{color:o.side==="at_or_above_ask"?t.green:o.side==="at_or_below_bid"?t.red:t.muted,children:Cl(o.side)}),e.jsx(ze,{children:R(o.spot,2)}),e.jsx(ze,{children:je(o.size)}),e.jsx(ze,{bold:!0,children:ee(o.premium)}),e.jsxs(ze,{color:Cd(o.classification),children:[(o.classification||"").toUpperCase(),o.is_golden_sweep?"â
":""]}),e.jsx(ze,{children:o.iv!=null?R(o.iv*100,1):"â"})]},(o.ts_ns||r)+"|"+r)})]})]})})}const zt=()=>new Date().toISOString().slice(0,10),Kn=n=>new Date(Date.now()-n*864e5).toISOString().slice(0,10);function Rd({symbol:n="",vis:l=null}){const{t:s}=W(),[i,o]=$.useState(n),[r,a]=$.useState(Kn(5)),[p,d]=$.useState(zt()),[c,u]=$.useState(null),[h,m]=$.useState(!1),y=$.useRef(!1);$.useEffect(()=>{y.current||(y.current=!0,b())},[]);const b=async(v=r,g=p)=>{m(!0);try{const x=await hr({underlying:i.trim().toUpperCase()||void 0,start:v,end:g,limit:1e3});u(x?.flow||[])}catch{u([])}finally{m(!1)}},f=(v,g,x)=>e.jsx("button",{onClick:()=>{a(g),d(x),b(g,x)},style:ds(!1),children:v}),w={background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"5px 9px",fontFamily:k,fontSize:12};return e.jsx(X,{id:"histview",vis:l,style:{height:"100%",minHeight:0},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10,flexWrap:"wrap"},children:[e.jsx("input",{value:i,onChange:v=>o(v.target.value),placeholder:s("markets.historical.symPlaceholder"),style:{...w,width:110,textTransform:"uppercase"}}),e.jsx("input",{type:"date",value:r,onChange:v=>a(v.target.value),style:w}),e.jsx("span",{style:{color:t.dim},children:"â"}),e.jsx("input",{type:"date",value:p,onChange:v=>d(v.target.value),style:w}),e.jsx("button",{onClick:()=>b(),style:ds(!0),children:s("markets.historical.loadBtn")}),f(s("markets.historical.presetToday"),zt(),zt()),f(s("markets.historical.presetLast5d"),Kn(5),zt()),f(s("markets.historical.presetLast30d"),Kn(30),zt()),h&&e.jsx("span",{style:{color:t.muted,fontSize:12},children:s("markets.historical.loading")})]}),c===null?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:t.dim},children:s("markets.historical.pickRange")}):e.jsx(Ad,{rows:c,emptyNote:s("markets.historical.noFlowNote")})]})})}const ds=n=>({fontSize:12,padding:"5px 12px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${n?t.green:t.border2}`,background:n?"rgba(110,210,90,0.15)":"transparent",color:n?t.green:t.muted}),$i="sa_markets_watchlist",cs="My Watchlist",Fd=()=>{try{return JSON.parse(localStorage.getItem($i)||'["SPY","QQQ","NVDA","TSLA","AAPL"]')}catch{return[]}};function Nd(){const{t:n}=W(),[l,s]=$.useState(Fd),[i,o]=$.useState(""),[r,a]=$.useState({}),[p,d]=$.useState(!1);$.useEffect(()=>{localStorage.setItem($i,JSON.stringify(l))},[l]),$.useEffect(()=>{let m=!0;return gr().then(y=>{const b=y?.watchlists||[],f=b.find(w=>w.name===cs)||b[0];m&&f&&Array.isArray(f.symbols)&&f.symbols.length&&s(f.symbols)}).catch(()=>{}).finally(()=>{m&&d(!0)}),()=>{m=!1}},[]),$.useEffect(()=>{if(!p)return;const m=setTimeout(()=>
1{xr(cs,l).catch(()=>{})},600);return()=>clearTimeout(m)},[l,p]),$.useEffect(()=>{let m=!0;const y=async()=>{const f={};await Promise.all(l.map(async w=>{try{f[w]=await Ne(w)}catch{}})),m&&a(f)};y();const b=setInterval(y,15e3);return()=>{m=!1,clearInterval(b)}},[l]);const c=m=>{m.preventDefault();const y=i.trim().toUpperCase();y&&!l.includes(y)&&s([...l,y]),o("")},u=m=>s(l.filter(y=>y!==m)),h={background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"5px 9px",fontFamily:k,fontSize:12,textTransform:"uppercase",width:110};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[e.jsxs("form",{onSubmit:c,style:{display:"flex",gap:6,marginBottom:10,alignItems:"center"},children:[e.jsx("input",{value:i,onChange:m=>o(m.target.value),placeholder:n("markets.watchlist.addPlaceholder"),style:h}),e.jsx("button",{type:"submit",style:{fontSize:12,padding:"5px 12px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${t.gold}`,background:"rgba(210,162,76,0.14)",color:t.gold},children:n("markets.watchlist.addButton")}),(()=>{const m=Object.values(r).filter(y=>y?.stale&&y?.session).map(y=>y.session).sort().pop();return m?e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:10,fontWeight:700,color:"#E0C27A",background:"rgba(210,162,76,0.12)",border:"1px solid rgba(210,162,76,0.35)",borderRadius:5,padding:"2px 7px"},children:n("markets.dollarFlow.lastSessionChip",{date:m})}):null})()]}),e.jsx("div",{style:{overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{background:t.panel2},children:e.jsx("tr",{children:["SYMBOL","SPOT","NET PREM","CALL $","PUT $","P/C",""].map((m,y)=>e.jsx("th",{style:{textAlign:y===0?"left":"right",padding:"6px 8px",color:t.muted,fontFamily:"Inter",fontSize:10,fontWeight:700,borderBottom:`1px solid ${t.border2}`},children:m},y))})}),e.jsxs("tbody",{children:[l.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,style:{padding:20,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:n("markets.watchlist.empty")})}),l.map(m=>{const y=r[m]||{};return e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[e.jsx("td",{style:{padding:"5px 8px",fontWeight:800,color:t.text},children:m}),e.jsx("td",{style:{textAlign:"right",padding:"5px 8px",color:t.muted},children:y.spot!=null?R(y.spot,2):"â"}),e.jsx("td",{style:{textAlign:"right",padding:"5px 8px",color:(y.net_premium||0)>=0?t.green:t.red},children:y.net_premium!=null?ee(y.net_premium):"â"}),e.jsx("td",{style:{textAlign:"right",padding:"5px 8px",color:t.green},children:y.call_premium!=null?ee(y.call_premium):"â"}),e.jsx("td",{style:{textAlign:"right",padding:"5px 8px",color:t.red},children:y.put_premium!=null?ee(y.put_premium):"â"}),e.jsx("td",{style:{textAlign:"right",padding:"5px 8px",color:t.muted},children:y.put_call_ratio!=null?R(y.put_call_ratio,2):"â"}),e.jsx("td",{style:{textAlign:"right",padding:"5px 8px"},children:e.jsx("button",{className:"sa-x",onClick:()=>u(m),style:{color:t.dim,background:"transparent",border:"none",cursor:"pointer",fontSize:14},children:"Ã"})})]},m)}),l.length>0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,style:{padding:"6px 10px",fontSize:10,color:t.dim,fontFamily:"Inter",fontStyle:"italic",borderTop:`1px solid ${t.border}`},children:n("markets.watchlist.hintAddMore")})})]})]})})]})}const Pt=[{k:"price_above",label:"Price above",i18nKey:"markets.alerts.kindPriceAbove",param:"price",ph:"price, e.g. 500",module:"price"},{k:"price_below",label:"Price below",i18nKey:"markets.alerts.kindPriceBelow",param:"price",ph:"price, e.g. 480",module:"price"},{k:"gex_flip",label:"GEX flip cross",i18nKey:"markets.alerts.kindGexFlip",param:null,module:"gex"},{k:"flow_sweep",label:"Sweep",i18nKey:"markets.alerts.kindSweep",param:"min_premium",ph:"min premium $, e.g. 50000",module:"flow"},{k:"flow_golden",label:"Golden sweep",i18nKey:"markets.alerts.kindGoldenSweep",param:"min_premium",ph:"min premium $, e.g. 1000000",module:"flow"},{k:"flow_block",label:"Block",i18nKey:"markets.alerts.kindBlock",param:"min_premium",ph:"min premium $, e.g. 100000",module:"flow"},{k:"unusual",label:"Unusual net premium",i18nKey:"markets.alerts.kindUnusualPremium",param:"min_net_premium",ph:"min net premium $, e.g. 5000000",module:"flow"}],qn=n=>Pt.filter(l=>l.module===n||l.module==="price");function Id(n){const l=n.filter_json||{},s=Pt.find(o=>o.k===n.kind),i=s?s.label:n.kind;return n.kind==="price_above"?`price ⥠${l.price}`:n.kind==="price_below"?`price ⤠${l.price}`:n.kind==="gex_flip"?"GEX flip cross":l.min_premium?`${i}
1 ⥠$${Number(l.min_premium).toLocaleString()}`:l.min_net_premium?`${i} ⥠$${Number(l.min_net_premium).toLocaleString()}`:i}function Md({module:n=null,presetSymbol:l=""}={}){const{t:s}=W(),[i,o]=$.useState(()=>n&&qn(n).find(M=>M.module===n)?.k||"price_above"),[r,a]=$.useState(()=>String(l||"").toUpperCase()),[p,d]=$.useState(!1),[c,u]=$.useState(""),[h,m]=$.useState("in_app"),[y,b]=$.useState(""),[f,w]=$.useState(!1),[v,g]=$.useState(0),[x,j]=$.useState(""),[_,E]=$.useState(!1),[T,S]=$.useState(""),[C,I]=$.useState(!1),[F,A]=$.useState(""),[P,V]=$.useState(!1);$.useEffect(()=>{let M=!0;return fr().then(ne=>{!M||!ne||(ne.telegram_chat_id&&j(String(ne.telegram_chat_id)),I(!!ne.discord_webhook_set),A(ne.discord_webhook_hint||""))}).catch(()=>{}),()=>{M=!1}},[]);const J=async()=>{try{await Hl({telegram_chat_id:x.trim()}),E(!0),setTimeout(()=>E(!1),2e3)}catch(M){b(String(M.message||M).replace(/^API \d+: /,""))}},Q=async()=>{try{const M=await Hl({telegram_chat_id:x.trim(),discord_webhook_url:T.trim()});I(!!M?.discord_webhook_set),S(""),V(!0),setTimeout(()=>V(!1),2e3)}catch(M){b(String(M.message||M).replace(/^API \d+: /,""))}},U=async()=>{try{const M=await jr();M?.url?window.open(M.url,"_blank","noopener"):M?.code&&b(`Open your Telegram bot and send: /start ${M.code}`)}catch(M){b(String(M.message||M).replace(/^API \d+: /,""))}},D=Pt.find(M=>M.k===i)||Pt[0],{data:B}=H(()=>yr(),12e3,[v]),{data:te}=H(()=>br({limit:40}),1e4,[v]),xe=B&&B.rules||[],me=$.useMemo(()=>te&&te.events||[],[te]),be=te&&te.unread||0,[Y,fe]=$.useState(()=>typeof Notification<"u"&&Notification.permission==="granted"),ke=$.useRef(null);$.useEffect(()=>{if(!me.length)return;const M=me[0]?.id;if(ke.current==null){ke.current=M;return}if(Y&&typeof Notification<"u"&&Notification.permission==="granted"){for(const ne of me)if(ke.current!=null&&ne.id>ke.current)try{new Notification(`â ${ne.symbol||"Alert"} â ${ne.title||ne.kind||"alert fired"}`,{body:ne.message||"",tag:`sa-alert-${ne.id}`,silent:!1})}catch{}}ke.current=Math.max(M||0,ke.current||0)},[me,Y]);const we=async()=>{try{const M=await Notification.requestPermission();fe(M==="granted")}catch{}},z=async M=>{M.preventDefault(),b("");const ne={kind:i,symbol:r.trim().toUpperCase()||null,channel:h,filter_json:{}};if(D.param){const oe=parseFloat(c);if(!isFinite(oe)){b(`Enter a value for ${D.label}`);return}ne.filter_json[D.param]=oe}w(!0);try{await kr(ne),a(""),u(""),g(oe=>oe+1)}catch(oe){b(String(oe.message||oe).replace(/^API \d+: /,""))}w(!1)},N=$.useMemo(()=>{if(!n)return xe;const M=new Set(qn(n).map(ne=>ne.k));return xe.filter(ne=>M.has(ne.kind))},[xe,n]),G=async M=>{try{await wr(M.id,!M.active),g(ne=>ne+1)}catch{}},Z=async M=>{try{await Sr(M.id),g(ne=>ne+1)}catch{}},se=async()=>{try{await _r(),g(M=>M+1)}catch{}},le={background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"6px 9px",fontFamily:k,fontSize:12},de={flex:1,minWidth:300,minHeight:240,display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:8,overflow:"hidden"},K={padding:"8px 12px",borderBottom:`1px solid ${t.border2}`,fontFamily:k,fontWeight:800,fontSize:12,color:t.text,background:t.panel2,display:"flex",alignItems:"center",justifyContent:"space-between"};return e.jsxs("div",{style:{display:"flex",gap:12,height:"100%",minHeight:0,flexWrap:"wrap",alignContent:"flex-start"},children:[e.jsxs("div",{style:{flexBasis:"100%",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",padding:"8px 10px",border:`1px solid ${t.border}`,borderRadius:8,background:t.panel2,fontSize:12},children:[e.jsx("span",{style:{fontWeight:800,color:t.muted,letterSpacing:.5,fontFamily:k},children:s("markets.alerts.deliveryHeader")}),e.jsx("span",{style:{color:t.dim},children:s("markets.alerts.telegramLabel")}),e.jsx("input",{value:x,onChange:M=>j(M.target.value),placeholder:s("markets.alerts.telegramPlaceholder"),style:{...le,width:150}}),e.jsx("button",{onClick:J,style:{fontSize:11,padding:"5px 12px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${t.gold}`,background:"rgba(210,162,76,0.14)",color:t.gold},children:s("markets.alerts.save")}),_&&e.jsx("span",{style:{color:t.green,fontSize:11},children:s("markets.alerts.saved")}),e.jsx("button",{onClick:U,title:s("markets.tooltips.linkViaTelegram"),style:{fontSize:11,padding:"5px 12px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${t.border2}`,background:"transparent",color:t.muted},children:s("markets.alerts.linkViaBotButton")}),e.jsx("span",{style:{color:t.dim,fontSize:11},children:s("markets.alerts.emailHint")}),e.jsx("span",{style:{color:t.dim},children:s("markets.alerts.discordHook")}),e.jsx("input",{type:"password",value:T,onChange:M=>S(M.target.value),placeholder:C?F||"â¢â¢â¢â¢â¢â¢â¢â¢":s("markets.alerts.discordHookPh"),title:s("markets.alerts.discordHookHelp"),style:{...le,width:230}}),e.jsx("button",{onClick:Q,style:{fontSize:11,padding:"5px 12px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${t.gold}`,background:"rgba(210,162,76,0.14)",color:t.gold},children:s("markets.alerts.save")}),P&&e.jsx("span",{style:{color:t.green,fontSize:11},children:s("markets.alerts.discordHookSet")}),C&&!P&&e.jsx("span",{style:{color:t.green,fontSize:11},children:"â"})]}),e.jsxs("div",{style:de,children:[e.jsxs("div",{style:K,children:[e.jsx("span",{children:s("markets.alerts.alertRulesHeader")}),e.jsxs("span",{style:{display:"inline-flex",gap:6,alignItems:"center"},children:[n&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>d(!1),style:{fontSize:10,padding:"2px 8px",borderRadius:5,cursor:"pointer",fontWeight:700,border:`1px solid ${p?t.border2:t.gold}`,background:p?"transparent":"rgba(210,162,76,0.14)",color:p?t.muted:t.gold},children:[s("markets.alerts.scopeBoard")," (",N.length,")"]}),e.jsxs("button",{onClick:()=>d(!0),style:{fontSize:10,padding:"2px 8px",borderRadius:5,cursor:"pointer",fontWeight:700,border:`1px solid ${p?t.gold:t.border2}`,background:p?"rgba(210,162,76,0.14)":"transparent",color:p?t.gold:t.muted},children:[s("markets.alerts.scopeAll")," (",xe.length,")"]})]}),!n&&e.jsx("span",{style:{color:t.muted,fontWeight:600},children:xe.length})]})]}),e.jsxs("form",{onSubmit:z,style:{padding:10,display:"flex",flexDirection:"column",gap:6,borderBottom:`1px solid ${t.border2}`},children:[e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("select",{value:i,onChange:M=>o(M.target.value),style:{...le,flex:1},children:(n&&!p?qn(n):Pt).map(M=>e.jsx("option",{value:M.k,children:M.i18nKey?s(M.i18nKey):M.label},M.k))}),e.jsx("input",{value:r,onChange:M=>a(M.target.value),placeholder:s("markets.alerts.symbolPlaceholder"),style:{...le,width:92,textTransform:"uppercase"}})]}),D.param&&e.jsx("input",{value:c,onChange:M=>u(M.target.value),placeholder:D.ph,style:le}),e.jsxs("select",{value:h,onChange:M=>m(M.target.value),style:le,children:[e.jsx("option",{value:"in_app",children:s("markets.alerts.deliverInApp")}),e.jsx("option",{value:"email",children:s("markets.alerts.deliverEmail")}),e.jsx("option",{value:"telegram",children:s("markets.alerts.deliverTelegram")}),e.jsx("option",{value:"discord",children:s("markets.alerts.deliverDiscord")})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("button",{type:"submit",disabled:f,style:{fontSize:12,padding:"6px 14px",borderRadius:6,cursor:"pointer",fontWeight:800,border:`1px solid ${t.gold}`,background:"rgba(210,162,76,0.14)",color:t.gold,opacity:f?.6:1},children:s("markets.alerts.addAlert")}),y&&e.jsx("span",{style:{color:t.red,fontSize:11},children:y})]})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:[(n&&!p?N:xe).length===0&&e.jsxs("div",{style:{padding:"12px 14px"}
1,children:[e.jsx("div",{style:{fontSize:10,color:t.dim,fontFamily:"Inter",marginBottom:7,letterSpacing:.3},children:s("markets.myAlerts.templatesHint")}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[{label:s("markets.myAlerts.tpl1"),kind:"price_above",symbol:"SPY",param:"760"},{label:s("markets.myAlerts.tpl2"),kind:"price_below",symbol:"QQQ",param:"700"},{label:s("markets.myAlerts.tpl3"),kind:"price_above",symbol:"NVDA",param:"220"}].map(M=>e.jsx("button",{onClick:()=>{o(M.kind),a(M.symbol),u(M.param)},style:{fontSize:10,padding:"3px 9px",borderRadius:5,cursor:"pointer",fontWeight:700,border:"1px solid rgba(210,162,76,0.3)",background:"rgba(210,162,76,0.06)",color:t.muted,fontFamily:"Inter"},children:M.label},M.label))})]}),(n&&!p?N:xe).map(M=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",borderBottom:"1px solid rgba(255,255,255,0.03)",fontSize:12,fontFamily:k},children:[e.jsx("span",{style:{fontWeight:800,color:M.active?t.text:t.dim,minWidth:52},children:M.symbol||"MKT"}),e.jsx("span",{style:{flex:1,color:t.muted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Id(M)}),e.jsx("button",{onClick:()=>G(M),title:s("markets.alerts.toggleActive"),style:{fontSize:10,padding:"3px 7px",borderRadius:5,cursor:"pointer",fontWeight:700,border:`1px solid ${M.active?t.green:t.border2}`,background:M.active?"rgba(110,210,90,0.14)":"transparent",color:M.active?t.green:t.muted},children:M.active?s("markets.alerts.on"):s("markets.alerts.off")}),e.jsx("button",{className:"sa-x",onClick:()=>Z(M),title:s("markets.alerts.delete"),style:{color:t.dim,background:"transparent",border:"none",cursor:"pointer",fontSize:15},children:"Ã"})]},M.id))]})]}),e.jsxs("div",{style:de,children:[e.jsxs("div",{style:K,children:[e.jsxs("span",{children:[s("markets.alerts.myAlertsHeader"),be>0&&e.jsxs("span",{style:{color:t.amber},children:[" (",be,")"]})]}),e.jsx("button",{onClick:Y?()=>fe(!1):we,title:s("markets.alerts.browserNotifTooltip"),style:{fontSize:10,padding:"3px 8px",borderRadius:5,cursor:"pointer",fontWeight:700,border:`1px solid ${Y?"rgba(210,162,76,0.5)":t.border2}`,background:Y?"rgba(210,162,76,0.14)":"transparent",color:Y?"#E0C27A":t.muted},children:Y?"ð "+s("markets.alerts.browserNotifOn"):"ð "+s("markets.alerts.browserNotifOff")}),be>0&&e.jsx("button",{onClick:se,style:{fontSize:10,padding:"3px 8px",borderRadius:5,cursor:"pointer",fontWeight:700,border:`1px solid ${t.border2}`,background:"transparent",color:t.muted},children:s("markets.alerts.markRead")})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:[me.length===0&&e.jsx("div",{style:{padding:18,textAlign:"center",color:t.dim,fontSize:12,fontFamily:"Inter"},children:s("markets.alerts.noAlertsFired")}),me.map(M=>e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(255,255,255,0.03)",borderLeft:M.read_at?"2px solid transparent":`2px solid ${t.amber}`,fontSize:12},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[e.jsx("span",{style:{fontWeight:800,color:t.text,fontFamily:k},children:M.title}),e.jsx("span",{style:{color:t.dim,fontSize:10,whiteSpace:"nowrap"},children:vr(Date.now()-new Date(M.fired_at).getTime())})]}),M.detail&&e.jsx("div",{style:{color:t.muted,marginTop:2,fontFamily:k},children:M.detail})]},M.id))]})]})]})}const ae=(n=11,l=t.muted)=>({fontFamily:k,fontSize:n,color:l,fontVariantNumeric:"tabular-nums"}),pe=(n,l=1)=>n==null||!isFinite(Number(n))?"â":Number(n).toFixed(l),zd={ES:.25,NQ:.25,YM:1,RTY:.1,CL:.01,NG:.001,RB:1e-4,HO:1e-4,GC:.1,SI:.005,HG:5e-4,PL:.1,ZB:.03125,ZN:.015625,ZF:.0078125,ZT:.00390625,UB:.03125,"6E":5e-5,"6B":1e-4,"6J":5e-7,"6A":5e-5,"6C":5e-5,"6S":5e-5,ZC:.25,ZS:.25,ZW:.25,MBT:5,MET:.5},Wd=n=>{const l=String(zd[String(n||"").toUpperCase()]??.01);return l.includes(".")&&l.replace(/0+$/,"").split(".")[1]?.length||0},gt=(n,l)=>pe(l,Wd(n?.symbol)),Dd=(n,l)=>l==null||!isFinite(Number(l))?"â":`${Number(l)>=0?"+":""}${gt(n,l)}`,Ge=(n,l=2)=>n==null||!isFinite(Number(n))?"â":`${Number(n)>=0?"+":""}${Number(n).toFixed(l)}%`,Sn=n=>{const l=Number(n?.entry??n?.entry_spot),s=Number(n?.outcome_ret_pct);if(!(l>0)||n?.outcome_ret_pct==null||!isFinite(s))return null;const i=String(n?.direction).toUpperCase()==="SHORT"?-1:1;return l*(1+i*s/100)},ps=n=>{const l=Number(n?.entry),s=Number(n?.pnl_pts);if(!(l>0)||n?.pnl_pts==null||!isFinite(s))return null;const i=String(n?.direction).toUpperCase()==="SHORT"?-1:1;return l+i*s},Ld={lbl:"CLOSED @",align:"right",sortKey:n=>Sn(n)??-1/0,cell:n=>{const l=Sn(n);return l==null?{text:"â",color:t.dim}:{text:pe(l,l>=100?2:4),color:t.text,bold:!0}}},Od={lbl:"CLOSED @",align:"right",sortKey:n=>ps(n)??-1/0,cell:n=>{const l=ps(n);return l==null?{text:"â",color:t.dim}
1:{text:gt(n,l),color:t.text,bold:!0}}},Pd={lbl:"CLOSED @",align:"right",sortKey:n=>Sn(n)??-1/0,cell:n=>{const l=Sn(n),s=n.contract,i=s&&Number(s.opt_entry);let o=s&&s.opt_exit!=null&&isFinite(Number(s.opt_exit))?Number(s.opt_exit):null,r=!1;if(o==null&&i>0){const a=Tn(n);a!=null&&isFinite(a)&&(o=i*(1+a/100),r=!0)}if(o!=null&&isFinite(o)){const a=s.expiry?`${Number(String(s.expiry).slice(5,7))}/${Number(String(s.expiry).slice(8,10))}`:"";return{text:`${s.strike}${s.right}${a?` ${a}`:""} ${r?"â":""}$${pe(o,2)}`,color:t.gold,bold:!0,title:`${s.strike}${s.right} closed ${r?"â":"at"} $${pe(o,2)}${l!=null?` · underlying ${pe(l,2)}`:""}`}}return l==null?{text:"â",color:t.dim}:{text:pe(l,2),color:t.text,bold:!0}}},Qn=n=>{try{return new Date(n).toLocaleDateString("en-CA",{timeZone:"America/New_York"})}catch{return null}},Ci=n=>{try{return new Date(n).toLocaleTimeString("en-US",{timeZone:"America/New_York",hour:"2-digit",minute:"2-digit",hour12:!1})}catch{return""}},Ai=n=>{try{return new Date(n).toLocaleDateString("en-US",{timeZone:"America/New_York",month:"short",day:"numeric"})}catch{return""}},Zn=n=>{const l=String(n.direction||"").toUpperCase();return{text:l||"â",color:l==="LONG"?t.green:l==="SHORT"?t.red:t.slate,bold:!0}},_n=n=>n?new Date(n).getTime():null,yl=n=>n.premium_outcome&&n.premium_outcome.at||n.outcome_at||n.measured_at||n.resolved_at||null,us=n=>{const l=_n(n.created_at),s=_n(yl(n));return l!=null&&s!=null&&s>=l?s-l:null},Hd=n=>{if(n==null)return"â";const l=Math.max(0,Math.round(n/6e4));if(l<60)return`${l}m`;const s=Math.floor(l/60),i=l%60;if(s<24)return i?`${s}h ${i}m`:`${s}h`;const o=Math.floor(s/24),r=s%24;return r?`${o}d ${r}h`:`${o}d`},sn={lbl:"OPENED (ET)",sortKey:n=>_n(n.created_at)??-1/0,cell:n=>({text:`${Ai(n.created_at)} ${Ci(n.created_at)}`,color:t.text})},rn={lbl:"CLOSED (ET)",sortKey:n=>_n(yl(n))??-1/0,cell:n=>{const l=yl(n);return l?{text:`${Ai(l)} ${Ci(l)}`,color:t.muted}:{text:"â live",color:t.gold}}},Jn={lbl:"HELD",align:"right",sortKey:n=>us(n)??-1/0,cell:n=>({text:Hd(us(n)),color:t.slate})},Vd=[["24h","24H"],["7d","7D"],["30d","30D"],["all","ALL"]],Bd=[["all","ALL"],["open","OPEN"],["closed","CLOSED"]],Ud=["S","M","T","W","T","F","S"],Gd=n=>n.outcome==="target_first"?{c:t.green,label:"â TARGET",win:!0}:n.outcome==="trail_exit"?{c:t.green,label:"â TRAIL",win:!0}:n.outcome==="stop_first"?{c:t.red,label:"â STOP",win:!1}:n.outcome==="expired"?{c:t.dim,label:"â EXPIRED",win:null}:n.entry==null?{c:t.slate,label:"â CONTEXT",win:null}:{c:t.gold,label:"â LIVE",win:null},ms=n=>{const l=Gd(n);return n.record_status!=="archived_legacy"?l:{c:t.slate,label:`ARCHIVED · ${l.label.replace(/^[ââââ]\s*/,"")}`,win:null}},Yd=n=>n.outcome==="tp"?{c:t.green,label:"â TP",win:!0}:n.outcome==="sl"?{c:t.red,label:"â SL",win:!1}:n.outcome==="flat"?{c:t.dim,label:"â FLAT",win:null}:{c:t.gold,label:"â LIVE",win:null},on=n=>{const l=n&&n.premium_outcome;if(l&&l.kind){const s=Number(l.ret_pct);if(l.kind==="tp")return{c:t.green,label:"â PREM TP",win:!0};if(l.kind==="sl")return{c:t.red,label:"â PREM SL",win:!1};if(l.kind==="trail")return{c:t.green,label:"⤳ PREM TRAIL",win:isFinite(s)?s>=0:!0}}return Yd(n)},el=n=>l=>{const s=n(l);return{text:s.label,color:s.c,bold:!0}},Ht=n=>n==null?t.dim:n>=50?t.green:t.red,Je=n=>n==null?t.dim:n>=0?t.green:t.red,Xd=n=>{const l=n&&n.contract,s=l&&Math.abs(Number(l.delta_est)),i=l&&Number(l.opt_entry),o=Number(n?.entry_spot??n?.entry);return s>0&&i>0&&o>0?s*o/i:null},Tn=n=>{const l=n&&n.premium_outcome,s=l&&Number(l.ret_pct);if(l&&l.ret_pct!=null&&isFinite(s))return s;const i=n&&n.contract,o=i&&Number(i.opt_ret_real_pct);if(i&&i.opt_ret_real_pct!=null&&isFinite(o))return o;const r=i&&i.path&&Number(i.path.last);if((n?.outcome==="flat"||n?.outcome==="expired")&&i&&i.path&&i.path.last!=null&&isFinite(r))return r;if(n?.outcome!=="tp"&&n?.outcome!=="sl")return null;const a=Xd(n),p=Number(n?.outcome_ret_pct);return a!=null&&isFinite(p)?p*a:null},hs=n=>{const l=n&&n.contract;return!!(l&&l.opt_ret_real_pct!=null&&isFinite(Number(l.opt_ret_real_pct)))},Kd=n=>{const l=Number(n?.entry??n?.entry_spot),s=Number(n?.outcome_ret_pct);return l>0&&n?.outcome_ret_pct!=null&&isFinite(s)?l*s/100:null},Ml=(n,l=2)=>n==null||!isFinite(Number(n))?"â":`${Number(n)>=0?"+$":"-$"}${Math.abs(Number(n)).toFixed(l)}`,qd=n=>n==="options"?{lbl:"OPT P&L %",align:"right",sortKey:l=>{const s=Tn(l);return s??-1/0},cell:l=>{const s=Tn(l),i=l.premium_outcome;if(s!=null&&i&&i.ret_pct!=null){const r=String(i.kind||"").toUpperCase();return{text:`${Ge(s)}`,color:s>=0?t.green:t.red,bold:!0,title:`PREMIUM ${r} exit â SL/TP/trail resolved on the contract premium (~15s samples)`}}const o=l.contract;if(s!=null&&!hs(l)&&(l.outcome==="flat"||l.outcome==="expired")&&o&&o.path&&o.path.last!=null)return{text:Ge(s),color:s>=0?t.green:t.red,title:"REAL premium at fuse end (last ~15s sample) â held-to-expiry result"};if(s!=null&&hs(l)){const r=l.contract;return{text:Ge(s),color:s>=0?t.green:t.red,bold:!0,title:`REAL premium: $${pe(r.opt_entry,2)} â $${pe(r.opt_exit,2)} (live mids at birth/resolution) · underlying ${Ge(l.outcome_ret_pct)}`}}return s!=null?{text:Ge(s),color:s>=0?t.green:t.red,bold:!0,title:`Î-estimated premium return (theta excluded) · underlying ${Ge(l.outcome_ret_pct)}`}:l.outcome==="flat"||l.outcome==="expired"?{text:"â",color:t.dim,title:"flat/expired with no sampled premium â no honest estimate (theta unknown)"}:{text:Ge(l.outcome_ret_pct),color:Je(l.outcome_ret_pct==null?null:Number(l.outcome_ret_pct)),title:"underlying % (no recommended contract on this card)"}}}:{lbl:"P&L %",align:"right",sortKey:l=>l.outcome_ret_pct==null?-1/0:Number(l.outcome_ret_pct),cell:l=>{const s=l.outcome_ret_pct==null?null:Number(l.outcome_ret_pct),i=Kd(l);return s==null?{text:"â",color:t.dim}:{text:Ge(s),color:s>=0?t.green:t.red,bold:!0,title:i==null?void 0:`${Ml(i)} per share`}}},Wt=1500,gs={user:{fetch:async()=>{const n=await Cr(),l=(n?.trades||[]).map(i=>({...i,created_at:i.entry_at,resolved_at:i.exit_at})),s=n?.stats||{};return{signals:l,stats:{fired:s.n_total,closed:s.n_closed,open:s.n_open,expectancy_usd:s.expectancy_usd,win_rate:s.win_rate,profit_factor:s.profit_factor,net_usd:s.net_usd,avg_r:s.avg_r,n_r:s.n_r,plan_rate:s.discipline?.plan_rate,n_stated:s.discipline?.n_stated,stop_rate:s.discipline?.stop_rate,min_stats_n:s.min_stats_n}}},scopeLabel:()=>"MY TRADES",outcome:n=>n.net_usd==null?{c:t.gold,label:"· OPEN",win:null}:Number(n.net_usd)>0?{c:t.green,label:"â WIN",win:!0}:Number(n.net_usd)<0?{c:t.red,label:"â LOSS",win:!1}:{c:t.dim,label:"FLAT",win:null},net:{val:n=>n.net_usd!=null?Number(n.net_usd):null,lbl:"NET $",dp:2,sfx:"$"},entryForm:!0,stats:[{k:"fired",lbl:"TRADES"},{k:"closed",lbl:"CLOSED"},{k:"expectancy_usd",lbl:"EXPECTANCY $",c:t.gold},{k:"win_rate",lbl:"WIN RATE",pct:!0,dyn:Ht},{k:"profit_factor",lbl:"PF"},{k:"plan_rate",lbl:"PLAN â",pct:!0},{k:"stop_rate",lbl:"STOP SET",pct:!0}],columns:[sn,rn,{lbl:"SYM",cell:n=>({text:n.symbol||"â",color:t.text,bold:!0})},{lbl:"SRC",cell:n=>n.source==="copy"?{text:"COPY",color:t.slate}:{text:"MANUAL",color:t.muted}},{lbl:"SIDE",cell:n=>String(n.side)==="short"?{text:"SHORT",color:t.red}:{text:"LONG",color:t.green}},{lbl:"QTY",align:"right",sortKey:n=>Number(n.qty)||0,cell:n=>({text:pe(n.qty,2),color:t.muted})},{lbl:"ENTRY",align:"right",cell:n=>({text:pe(n.entry_price,2),color:t.text})},{lbl:"EXIT",align:"right",cell:n=>n.exit_price!=null?{text:pe(n.exit_price,2),color:t.text}:{text:"â live",color:t.gold}},{lbl:"R",align:"right",sortKey:n=>n.r_multiple==null?-1e9:Number(n.r_multiple),cell:n=>n.r_multiple==null?{text:"â",color:t.dim}:{text:`${Number(n.r_multiple)>=0?"+":""}${pe(n.r_multiple,2)}R`,color:Number(n.r_multiple)>=0?t.green:t.red}},{lbl:"PLAN",cell:n=>n.followed_plan===!0?{text:"â",color:t.green}:n.followed_plan===!1?{text:"â",color:t.red}:{text:"â",color:t.dim}},{lbl:"SETUP",cell:n=>({text:n.setup||"â",color:t.muted})}]},crypto:{fetch:(n,l,s,i)=>$r(n,l,s,i),scopeLabel:n=>n||"ALL CRYPTO PERPS",outcome:on,stats:[{k:"fired",lbl:"FIRED"},{k:"tp",lbl:"â TP",c:t.green},{k:"sl",lbl:"â SL",c:t.red},{k:"expired",lbl:"EXPIRED",c:t.dim},{k:"pending",lbl:"LIVE",c:t.gold},{k:"win_rate",lbl:"WIN RATE",pct:!0,dyn:Ht},{k:"avg_ret",lbl:"AVG RET",pct:!0,dyn:Je}],columns:[sn,rn,Ld,Jn,{lbl:"SYM",cell:n=>({text:String(n.symbol||"").replace("_USDT",""),color:t.text,bold:!0})},{lbl:"SETUP",cell:n=>({text:n.setup})},{lbl:"TIER",sortKey:n=>({prime:2,watch:1})[n.tier]||0,cell:n=>n.tier==="prime"?{text:"PRIME",color:t.gold,bold:!0}:n.tier==="watch"?{text:"WATCH",color:t.slate}:{text:n.tier?"muted":"â",color:t.dim}},{lbl:"P(WIN)",align:"right",sortKey:n=>n.p_win==null?-1:Number(n.p_win),cell:n=>n.p_win==null?{text:"â",color:t.dim}:{text:`${Math.round(Number(n.p_win)*100)}%`,color:Number(n.p_win)>=.5?t.green:Number(n.p_win)>=.35?t.gold:t.red}},{lbl:"DIR",cell:Zn},{lbl:"ENTRY",align:"right",cell:n=>({text:n.entry!=null?String(n.entry):"â",color:t.text})},{lbl:"TARGET",align:"right",cell:n=>({text:n.target!=null?String(n.target):"â",color:t.green})},{lbl:"STOP",align:"right",cell:n=>
1({text:n.stop!=null?String(n.stop):"â",color:t.red})},{lbl:"R:R",align:"right",cell:n=>({text:n.rr!=null?pe(n.rr,1):"â"})},{lbl:"OUTCOME",cell:el(on)},{lbl:"RET %",align:"right",sortKey:n=>n.outcome_ret_pct==null?-1/0:Number(n.outcome_ret_pct),cell:n=>n.outcome_ret_pct==null?{text:"â",color:t.dim}:{text:pe(n.outcome_ret_pct,2),color:Number(n.outcome_ret_pct)>=0?t.green:t.red}}]},futures:{fetch:Tr,scopeLabel:n=>n||"ALL 28 FUTURES",outcome:ms,stats:[{k:"fired",lbl:"FIRED"},{k:"directional",lbl:"DIRECTIONAL"},{k:"independent_decisions",lbl:"INDEP DECISIONS"},{k:"correlated_cards_excluded",lbl:"CORRELATED"},{k:"target",lbl:"â TARGET",c:t.green},{k:"trail",lbl:"â TRAIL",c:t.green},{k:"stop",lbl:"â STOP",c:t.red},{k:"expired",lbl:"EXPIRED",c:t.dim},{k:"pending",lbl:"LIVE",c:t.gold},{k:"win_rate",lbl:"BARRIER SUCCESS %",pct:!0,c:t.muted},{k:"profitable_outcome_rate_gross",lbl:"GROSS POSITIVE %",pct:!0,c:t.text},{k:"avg_r",lbl:"INDEP AVG R",num:2,dyn:Je},{k:"total_r",lbl:"INDEP TOTAL R",num:1,dyn:Je},{k:"avg_mfe_r",lbl:"AVG MFE R",c:t.green,num:2},{k:"avg_mae_r",lbl:"AVG MAE R",c:t.red,num:2}],net:{key:"pnl_pts",lbl:"GROSS PTS",dp:1,statKey:"total_pnl"},columns:[sn,rn,Od,Jn,{lbl:"SYM",cell:n=>({text:n.symbol,color:t.text,bold:!0})},{lbl:"SETUP",cell:n=>({text:n.setup})},{lbl:"RECORD",sortKey:n=>n.record_status==="current"?1:0,cell:n=>n.record_status==="archived_legacy"?{text:`ARCHIVE R${n.logic_rev||"?"}`,color:t.slate,bold:!0}:{text:`CURRENT R${n.logic_rev||3}`,color:t.blue,bold:!0}},{lbl:"TIER",sortKey:n=>({prime:2,watch:1})[n.tier]||0,cell:n=>n.record_status==="archived_legacy"?{text:"â",color:t.dim}:n.tier==="prime"?{text:"PRIME",color:t.gold,bold:!0}:n.tier==="watch"?{text:"WATCH",color:t.slate}:{text:"MUTED",color:t.dim}},{lbl:"P(WIN)",align:"right",sortKey:n=>n.p_win==null?-1:Number(n.p_win),cell:n=>n.p_win==null?{text:"â",color:t.dim}:{text:`${Math.round(Number(n.p_win)*100)}%`,color:Number(n.p_win)>=.5?t.green:Number(n.p_win)>=.35?t.gold:t.red}},{lbl:"DIR",cell:Zn},{lbl:"ENTRY",align:"right",cell:n=>({text:gt(n,n.entry),color:t.text})},{lbl:"TARGET",align:"right",cell:n=>({text:gt(n,n.target),color:t.green})},{lbl:"STOP",align:"right",cell:n=>({text:gt(n,n.stop),color:t.red})},{lbl:"R:R",align:"right",cell:n=>({text:n.rr!=null?pe(n.rr,1):"â"})},{lbl:"OUTCOME",cell:el(ms)},{lbl:"P&L pts",align:"right",sortKey:n=>n.pnl_pts==null?-1/0:Number(n.pnl_pts),cell:n=>({text:Dd(n,n.pnl_pts),color:n.pnl_pts==null?t.dim:Number(n.pnl_pts)>=0?t.green:t.red,bold:!0})},{lbl:"MFE",align:"right",cell:n=>({text:gt(n,n.mfe_pts),color:t.green})},{lbl:"MAE",align:"right",cell:n=>({text:gt(n,n.mae_pts),color:t.red})}]},flow:{fetch:(n,l,s,i,o,r)=>Er(n,l,s,i,o,r),scopeLabel:n=>n==="stocks"?"EQUITIES":"OPTIONS",outcome:on,stats:[{k:"fired",lbl:"FIRED"},{k:"tp",lbl:"â TP",c:t.green},{k:"sl",lbl:"â SL",c:t.red},{k:"flat",lbl:"FLAT",c:t.dim},{k:"pending",lbl:"LIVE",c:t.gold},{k:"win_rate",lbl:"WIN RATE",pct:!0,dyn:Ht},{k:"avg_ret",lbl:"AVG RET",pct:!0,dyn:Je}],columns:[sn,rn,Pd,Jn,{lbl:"SYM",cell:n=>({text:n.symbol,color:t.text,bold:!0})},{lbl:"SETUP",cell:n=>({text:n.setup})},{lbl:"TIER",sortKey:n=>({prime:2,watch:1})[n.tier]||0,cell:n=>n.tier==="prime"?{text:"PRIME",color:t.gold,bold:!0}:n.tier==="watch"?{text:"WATCH",color:t.slate}:{text:n.tier?"muted":"â",color:t.dim}},{lbl:"P(WIN)",align:"right",sortKey:n=>n.p_win==null?-1:Number(n.p_win),cell:n=>n.p_win==null?{text:"â",color:t.dim}:{text:`${Math.round(Number(n.p_win)*100)}%`,color:Number(n.p_win)>=.5?t.green:Number(n.p_win)>=.35?t.gold:t.red}},{lbl:"DIR",cell:Zn},{lbl:"CONTRACT",optionsOnly:!0,cell:n=>{const l=n.contract;if(!l||l.strike==null)return{text:"â",color:t.dim};const s=l.expiry?`${Number(String(l.expiry).slice(5,7))}/${Number(String(l.expiry).slice(8,10))}`:"";return{text:`${l.strike}${l.right} ${s} $${pe(l.opt_entry,2)}`,color:t.gold,bold:!0}}},{lbl:"ENTRY",align:"right",cell:n=>({text:pe(n.entry??n.entry_spot,2),color:t.text})},{lbl:"TARGET",align:"right",cell:n=>({text:pe(n.target,2),color:t.green})},{lbl:"STOP",align:"right",cell:n=>({text:pe(n.stop,2),color:t.red})},{lbl:"OUTCOME",cell:el(on)},{retFlow:!0,lbl:"RET %",align:"right",sortKey:n=>n.outcome_ret_pct==null?-1/0:Number(n.outcome_ret_pct),cell:n=>({text:Ge(n.outcome_ret_pct),color:Je(n.outcome_ret_pct==null?null:Number(n.outcome_ret_pct))})}]}};function Qd({kind:n="futures",scope:l,allowAll:s=!1,dte:i=null,dteLabel:o=null,onClose:r,inline:a=!1}){const{t:p}
1=W(),d=gs[n]||gs.futures,[c,u]=$.useState("7d"),[h,m]=$.useState("all"),[y,b]=$.useState("list"),[f,w]=$.useState({i:null,dir:"desc"}),[v,g]=$.useState(null),[x,j]=$.useState(0),[_,E]=$.useState(!0),[T,S]=$.useState(null),[C,I]=$.useState(0),[F,A]=$.useState("chart"),P=[["all","ALL",null],["focus","â
SPY·QQQ·SPX","SPY,QQQ,SPX,SPXW,XSP,XSPW"],["spy","SPY","SPY"],["qqq","QQQ","QQQ"],["spx","SPX","SPX,SPXW,XSP,XSPW"]],[V,J]=$.useState("all"),Q=(P.find(([N])=>N===V)||P[0])[2],U=n==="futures"&&s&&F==="all"?null:l,D=$.useMemo(()=>n==="flow"&&U==="options"?{lbl:"NET OPT %",dp:2,val:Tn,sfx:"%",approx:!0}:n==="flow"&&U==="stocks"?{key:"outcome_ret_pct",lbl:"NET %",dp:2,sfx:"%"}:d.net||{key:"outcome_ret_pct",lbl:"NET %",dp:2},[n,d,U]);$.useEffect(()=>{let N=!0;return E(!0),d.fetch(U,c,Wt,h,i,Q).then(G=>{N&&(g(G),E(!1))}).catch(()=>{N&&E(!1)}),()=>{N=!1}},[d,U,c,h,i,Q,x]),$.useEffect(()=>{if(a)return;const N=G=>{G.key==="Escape"&&r()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[r,a]);const B=$.useMemo(()=>v?.signals||[],[v]),te=v?.stats||{},xe=$.useMemo(()=>{if(Array.isArray(v?.daily)&&v.daily.length&&!D.val){const G={};for(const Z of v.daily)G[Z.day]={fired:Z.fired,w:Z.w,l:Z.l,pnl:Z.pnl,pn:Z.pn};return G}const N={};for(const G of B){const Z=Qn(G.created_at);if(!Z)continue;const se=N[Z]||(N[Z]={fired:0,w:0,l:0,pnl:0,pn:0});se.fired++;const le=D.val?D.val(G):Number(G[D.key]);le!=null&&isFinite(Number(le))&&(se.pnl+=Number(le),se.pn++);const de=d.outcome(G);de.win===!0?se.w++:de.win===!1&&se.l++}return N},[B,d,D,v]),me=$.useMemo(()=>T?B.filter(N=>Qn(N.created_at)===T):B,[B,T]),be=$.useMemo(()=>d.columns.filter(N=>!N.optionsOnly||U==="options").map(N=>N.retFlow?qd(U):N),[d,U]),Y=$.useMemo(()=>{const N=f.i!=null?be[f.i]:null;if(!N||!N.sortKey)return me;const G=[...me];return G.sort((Z,se)=>{const le=N.sortKey(Z),de=N.sortKey(se);return f.dir==="asc"?le-de:de-le}),G},[me,f,be]),fe=N=>w(G=>G.i===N?{i:N,dir:G.dir==="desc"?"asc":"desc"}:{i:N,dir:"desc"}),ke=$.useMemo(()=>{const N=new Date,G=new Date(N.toLocaleString("en-US",{timeZone:"America/New_York"})),Z=new Date(G.getFullYear(),G.getMonth()+C,1),se=Z.getFullYear(),le=Z.getMonth(),de=new Date(se,le,1).getDay(),K=new Date(se,le+1,0).getDate(),M=Qn(N.toISOString()),ne=[];for(let oe=0;oe<de;oe++)ne.push(null);for(let oe=1;oe<=K;oe++){const ue=`${se}-${String(le+1).padStart(2,"0")}-${String(oe).padStart(2,"0")}`;ne.push({d:oe,key:ue,today:ue===M})}return{cells:ne,label:Z.toLocaleDateString("en-US",{month:"long",year:"numeric"})}},[C]),we=(N,G,Z,se)=>e.jsx("button",{onClick:G,style:{fontFamily:k,fontSize:10,fontWeight:700,letterSpacing:"0.08em",padding:"4px 10px",borderRadius:6,cursor:"pointer",border:`1px solid ${N?t.gold:t.border2}`,color:N?t.gold:t.dim,background:N?"rgba(210,162,76,0.14)":"transparent"},children:Z},se),z=e.jsxs("div",{onClick:a?void 0:N=>N.stopPropagation(),style:a?{height:"100%",minHeight:480,display:"flex",flexDirection:"column",background:t.panel,border:`1px solid ${t.border2}`,borderRadius:12,overflow:"hidden"}:{width:"min(1340px, 97vw)",maxHeight:"92vh",display:"flex",flexDirection:"column",background:t.panel,border:`1px solid ${t.border2}`,borderRadius:14,boxShadow:"0 30px 90px rgba(0,0,0,0.7)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",padding:"12px 16px",borderBottom:`1px solid ${t.border2}`},children:[e.jsxs("span",{style:{...ae(11,t.gold),letterSpacing:"0.2em",fontWeight:800},children:[p("markets.signals.journalTitle",{defaultValue:"SIGNAL JOURNAL"})," · ",d.scopeLabel(U),o?` · ${o}`:""]}),e.jsx("span",{style:{...ae(8.5,t.blue),border:`1px solid ${t.border2}`,borderRadius:999,padding:"2px 7px"},children:"MUTED · PERMANENT"}),n==="futures"&&s&&e.jsxs("span",{style:{display:"flex",gap:4},children:[we(F==="chart",()=>{A("chart"),S(null)},`${l||"CHART"} ONLY`,"scope-chart"),we(F==="all",()=>{A("all"),S(null)},"ALL FUTURES","scope-all")]}),n==="flow"&&U==="options"&&e.jsx("span",{style:{display:"flex",gap:4},children:P.map(([N,G])=>we(V===N,()=>{J(N),S(null)},G,"sym-"+N))}),e.jsx("span",{style:{display:"flex",gap:4,marginLeft:"auto"},children:Vd.map(([N,G])=>we(c===N,()=>{u(N),S(null)},G,N))}),!a&&e.jsx("button",{onClick:r,"aria-label":"Close",style:{background:"transparent",border:`1px solid ${t.border2}`,borderRadius:6,color:t.muted,fontSize:18,cursor:"pointer",lineHeight:1,width:30,height:28},children:"Ã"})]}),e.jsxs("div",{style:{display:"flex",gap:18,flexWrap:"wrap",alignItems:"center",padding:"11px 16px",borderBottom:`1px solid ${t.border2}`,background:t.panel2},children:[d.stats.map(N=>{if(N.k==="avg_ret"&&D.val){let le=0,de=0;for(const oe of B){const ue=D.val(oe);ue!=null&&isFinite(Number(ue))&&(le+=Number(ue),de++)}const K=de?le/de:null,M=D.approx===!0||B.length>=Wt,ne=K==null?"â":D.sfx==="$"?`${M?"â":""}${Ml(K,2)}`:`${M?"â":""}${K>=0?"+":""}${pe(K,1)}%`;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[e.jsx("span",{style:{...ae(8,t.dim),letterSpacing:"0.14em"},children:D.sfx==="$"?"AVG $/SH":"AVG OPT %"}),e.jsx("span",{style:{...ae(15,K==null?t.dim:K>=0?t.green:t.red),fontWeight:800},children:ne})]},N.k)}const G=te[N.k],Z=G==null?"â":N.pct?`${pe(G,0)}%`:N.num!=null?pe(G,N.num):G,se=N.dyn?N.dyn(G):N.c||t.text;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[e.jsx("span",{style:{...ae(8,t.dim),letterSpacing:"0.14em"},children:N.lbl}),e.jsx("span",{style:{...ae(15,se),fontWeight:800},children:Z})]},N.k)}),(()=>{const N=D.statKey!=null?te?.[D.statKey]:null;let G=0,Z=0;for(const K of B){const M=D.val?D.val(K):K[D.key];M!=null&&isFinite(Number(M))&&(G+=Number(M),Z++)}const se=B.length>=Wt,le=N!=null?Number(N):Z?G:null;if(le==null)return null;const de=D.approx===!0||N==null&&se;return e.jsxs("div",{title:p("markets.signals.netTip",{defaultValue:"Sum of realized P&L over every resolved signal in this window â the how-much beside the win rate's how-often."}),style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[e.jsx("span",{style:{...ae(8,t.dim),letterSpacing:"0.14em"},children:D.lbl}),e.jsx("span",{style:{...ae(15,le>=0?t.green:t.red),fontWeight:800},children:`${de?"â":""}${le>=0?"+":""}${pe(le,D.dp)}`})]})})(),te?.tiers?.prime?.n>0&&e.jsxs("div",{title:p("markets.signals.primeJournalTip",{defaultValue:"The PRIME tier's record over this window: calibrated top-tier signals only, shown beside the firehose so the curation stays honest."}),style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[e.jsx("span",{style:{...ae(8,t.gold),letterSpacing:"0.14em",fontWeight:800},children:"PRIME"}),e.jsxs("span",{style:{...ae(15,t.text),fontWeight:800},children:[te.tiers.prime.n,te.tiers.prime.win_rate!=null&&e.jsxs("span",{style:{color:Ht(te.tiers.prime.win_rate)},children:[" · ",pe(te.tiers.prime.win_rate,0),"%"]})]})]}),e.jsxs("span",{style:{display:"flex",gap:4,marginLeft:"auto",alignItems:"center",flexWrap:"wrap"},children:[Bd.map(([N,G])=>we(h===N,()=>m(N),G,"st-"+N)),e.jsx("span",{style:{width:1,height:16,background:t.border2,margin:"0 5px"}}),we(y==="list",()=>{b("list")},p("markets.signals.jList",{defaultValue:"LIST"}),"list"),we(y==="cal",()=>b("cal"),p("markets.signals.jCalendar",{defaultValue:"CALENDAR"}),"cal")]})]}),n==="futures"&&te?.diagnostics&&(()=>{const N=te.diagnostics,G=N.execution_cost_coverage||{},Z=N.independence||{},se=N.session_clustered_win_rate_ci95_pct||N.win_rate_ci95_pct,le=[["PROFIT FACTOR",pe(N.profit_factor_gross,2),t.text],["PAYOFF",pe(N.payoff_ratio_gross,2),t.text],["MAX DD",N.max_drawdown_r_gross==null?"â":`${pe(N.max_drawdown_r_gross,2)}R`,t.red],["MAX LOSS STREAK",N.max_consecutive_losses??"â",t.red],["DECISION WR",N.decision_win_rate==null?"â":`${pe(N.decision_win_rate,1)}%`,Ht(N.decision_win_rate)],["CLUSTERED 95%",se?`${pe(se[0],0)}â${pe(se[1],0)}%`:"â",t.slate],["AVG AFTER SPREAD",N.avg_r_after_observed_spread_floor==null?"â":`${Number(N.avg_r_after_observed_spread_floor)>=0?"+":""}${pe(N.avg_r_after_observed_spread_floor,3)}R`,Je(N.avg_r_after_observed_spread_floor)],["COST COVERAGE",G.pct==null?"â":`${pe(G.pct,0)}% · ${G.covered}/${G.eligible}
1`,t.slate],["SESSIONÃSYMBOL",Z.session_symbol_clusters??"â",Z.minimum_20_session_symbol_clusters_met?t.green:t.gold],["BRIER",pe(N.brier_score,3),t.slate]];return e.jsxs("div",{style:{display:"flex",gap:16,flexWrap:"wrap",alignItems:"center",padding:"8px 16px",borderBottom:`1px solid ${t.border2}`,background:"rgba(255,255,255,0.012)"},title:N.net_model_note,children:[le.map(([de,K,M])=>e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"baseline",fontFamily:k},children:[e.jsx("span",{style:{fontSize:7.5,color:t.dim,letterSpacing:"0.1em"},children:de}),e.jsx("b",{style:{fontSize:10,color:M},children:K})]},de)),e.jsxs("span",{style:{...ae(7.5,t.dim),marginLeft:"auto"},children:[N.sample_state?.replace(/_/g," ")," · INDEPENDENT ENTRY CLUSTERS · NET = OBSERVED SPREAD FLOOR ONLY"]})]})})(),n!=="futures"&&(()=>{const N=[];for(const ye of B){const ve=D.val?D.val(ye):ye[D.key];ve!=null&&isFinite(Number(ve))&&N.push(Number(ve))}if(N.length<5)return null;const G=N.filter(ye=>ye>0),Z=N.filter(ye=>ye<0),se=ye=>ye.reduce((ve,Hn)=>ve+Hn,0),le=Z.length?se(G)/Math.abs(se(Z)):null,de=G.length&&Z.length?se(G)/G.length/Math.abs(se(Z)/Z.length):null,K=se(N)/N.length;let M=0,ne=0;for(let ye=B.length-1;ye>=0;ye--){const ve=D.val?D.val(B[ye]):B[ye][D.key];ve==null||!isFinite(Number(ve))||(Number(ve)<0?(ne++,M=Math.max(M,ne)):ne=0)}let oe=null,ue=null;for(const ye of Object.keys(xe)){const ve=xe[ye];!ve||!(ve.pn>0)||((oe==null||ve.pnl>oe)&&(oe=ve.pnl),(ue==null||ve.pnl<ue)&&(ue=ve.pnl))}const Ie=D.approx===!0||B.length>=Wt?"â":"",On=D.sfx??(D.key==="outcome_ret_pct"?"%":""),Pn=(ye,ve=2)=>ye==null?"â":`${Ie}${ye>=0?"+":""}${pe(ye,ve)}${On}`,zi=[["PROFIT FACTOR",le==null?"â":`${Ie}${pe(le,2)}`,le==null?t.dim:le>=1?t.green:t.red],["PAYOFF",de==null?"â":`${Ie}${pe(de,2)}`,t.text],["EXPECTANCY",Pn(K),Je(K)],["MAX LOSS STREAK",M||"â",t.red],["BEST DAY",oe==null?"â":Pn(oe,1),t.green],["WORST DAY",ue==null?"â":Pn(ue,1),t.red]];return e.jsxs("div",{style:{display:"flex",gap:16,flexWrap:"wrap",alignItems:"center",padding:"8px 16px",borderBottom:`1px solid ${t.border2}`,background:"rgba(255,255,255,0.012)"},title:"computed over the loaded window on the per-asset P&L chain (premium % for options, price % for equities)",children:[zi.map(([ye,ve,Hn])=>e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"baseline",fontFamily:k},children:[e.jsx("span",{style:{fontSize:7.5,color:t.dim,letterSpacing:"0.1em"},children:ye}),e.jsx("b",{style:{fontSize:10,color:Hn},children:ve})]},ye)),e.jsx("span",{style:{...ae(7.5,t.dim),marginLeft:"auto"},children:"LOADED WINDOW · PER-ASSET P&L CHAIN"})]})})(),n==="futures"&&Number(te.archived_excluded||0)>0&&e.jsxs("div",{style:{...ae(9,t.slate),padding:"7px 16px",lineHeight:1.5,borderBottom:`1px solid ${t.border2}`,background:"rgba(100,116,139,0.07)"},children:[te.archived_excluded," archived pre-R3 record",Number(te.archived_excluded)===1?"":"s"," available in this window · excluded from FIRED, win rate, P&L, and calibration because their signal geometry contract was superseded"]}),d.entryForm&&e.jsx(Zd,{signals:B,onSaved:()=>j(N=>N+1)}),e.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:y==="cal"?16:0},children:_?e.jsx("div",{style:{...ae(12,t.dim),padding:40,textAlign:"center"},children:p("markets.signals.jLoading",{defaultValue:"loading the recordâ¦"})}):B.length?y==="cal"?e.jsx(Jd,{month:ke,byDay:xe,dayFilter:T,net:D,truncated:!(Array.isArray(v?.daily)&&v.daily.length&&!D.val)&&B.length>=Wt,onPrev:()=>I(N=>N-1),onNext:()=>I(N=>N+1),onDay:N=>{S(N),b("list")},t:p}):e.jsx(ec,{rows:Y,columns:be,dayFilter:T,clearDay:()=>S(null),sort:f,onSort:fe,t:p}):e.jsx("div",{style:{...ae(12,t.dim),padding:40,textAlign:"center"},children:p("markets.signals.jEmpty",{defaultValue:"no signals in this window"})})})]});return a?z:Et.createPortal(e.jsx("div",{onClick:r,style:{position:"fixed",inset:0,zIndex:9e3,background:"rgba(4,6,9,0.72)",backdropFilter:"blur(3px)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:z}),document.body)}function Zd({signals:n,onSaved:l}){const{t:s}=W(),[i,o]=$.useState({symbol:"",side:"long",qty:"",entry_price:"",exit_price:"",stop_price:"",setup:""}),[r,a]=$.useState(""),[p,d]=$.useState(!1),c=g=>x=>o(j=>({...j,[g]:x.target.value})),u={background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"5px 8px",fontFamily:k,fontSize:11},h=async g=>{g.preventDefault(),a(""),d(!0);
1try{const x=new Date().toISOString(),j={symbol:i.symbol.trim().toUpperCase(),side:i.side,qty:Number(i.qty),entry_price:Number(i.entry_price),entry_at:x,setup:i.setup.trim()||null,stop_price:i.stop_price?Number(i.stop_price):null};i.exit_price&&(j.exit_price=Number(i.exit_price),j.exit_at=x),await Ar(j),o({symbol:"",side:"long",qty:"",entry_price:"",exit_price:"",stop_price:"",setup:""}),l()}catch(x){a(String(x.message||x).replace(/^API \d+: /,""))}d(!1)},m=(n||[]).filter(g=>g.source==="manual"&&g.exit_price==null),[y,b]=$.useState({}),f=async g=>{const x=Number(y[g]);if(!(!x||x<=0))try{await Vl(g,{exit_price:x,exit_at:new Date().toISOString()}),l()}catch{}},w=async(g,x)=>{try{await Vl(g,{followed_plan:x}),l()}catch{}},v=async g=>{try{await Rr(g),l()}catch{}};return e.jsxs("div",{style:{borderBottom:`1px solid ${t.border2}`,padding:"8px 16px",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("form",{onSubmit:h,style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{...ae(9,t.gold),letterSpacing:"0.14em",fontWeight:800},children:s("markets.journal.logTrade",{defaultValue:"LOG TRADE"})}),e.jsx("input",{value:i.symbol,onChange:c("symbol"),placeholder:"SYM",required:!0,style:{...u,width:64,textTransform:"uppercase"}}),e.jsxs("select",{value:i.side,onChange:c("side"),style:u,children:[e.jsx("option",{value:"long",children:"LONG"}),e.jsx("option",{value:"short",children:"SHORT"})]}),e.jsx("input",{value:i.qty,onChange:c("qty"),placeholder:s("markets.journal.qty",{defaultValue:"qty"}),required:!0,inputMode:"decimal",style:{...u,width:62}}),e.jsx("input",{value:i.entry_price,onChange:c("entry_price"),placeholder:s("markets.journal.entry",{defaultValue:"entry"}),required:!0,inputMode:"decimal",style:{...u,width:76}}),e.jsx("input",{value:i.exit_price,onChange:c("exit_price"),placeholder:s("markets.journal.exitOpt",{defaultValue:"exit (blank = open)"}),inputMode:"decimal",style:{...u,width:116}}),e.jsx("input",{value:i.stop_price,onChange:c("stop_price"),placeholder:s("markets.journal.stopOpt",{defaultValue:"stop (for R)"}),inputMode:"decimal",style:{...u,width:90}}),e.jsx("input",{value:i.setup,onChange:c("setup"),placeholder:s("markets.journal.setupOpt",{defaultValue:"setup / note"}),style:{...u,width:130}}),e.jsx("button",{type:"submit",disabled:p,style:{fontSize:11,padding:"5px 12px",borderRadius:6,cursor:"pointer",fontWeight:800,border:`1px solid ${t.gold}`,background:"rgba(210,162,76,0.14)",color:t.gold,opacity:p?.6:1},children:s("markets.journal.add",{defaultValue:"ADD"})}),r&&e.jsx("span",{style:{...ae(10,t.red)},children:r}),e.jsx("span",{style:{...ae(8.5,t.dim),marginLeft:"auto"},children:s("markets.journal.rNote",{defaultValue:"R needs a recorded stop â no stop, no R, on purpose"})})]}),m.length>0&&e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("span",{style:{...ae(8.5,t.dim),letterSpacing:"0.12em"},children:s("markets.journal.openStrip",{defaultValue:"OPEN (manual):"})}),m.map(g=>e.jsxs("span",{style:{display:"inline-flex",gap:4,alignItems:"center",border:`1px solid ${t.border2}`,borderRadius:6,padding:"2px 6px"},children:[e.jsx("b",{style:{...ae(10,t.text)},children:g.symbol}),e.jsx("span",{style:{...ae(9,g.side==="short"?t.red:t.green)},children:g.side==="short"?"S":"L"}),e.jsx("input",{value:y[g.id]||"",onChange:x=>b(j=>({...j,[g.id]:x.target.value})),placeholder:"close @",inputMode:"decimal",style:{...u,width:66,padding:"2px 5px",fontSize:10}}),e.jsx("button",{onClick:()=>f(g.id),style:{fontSize:9,padding:"2px 6px",borderRadius:4,cursor:"pointer",fontWeight:700,border:`1px solid ${t.green}`,background:"rgba(110,210,90,0.12)",color:t.green},children:s("markets.journal.close",{defaultValue:"CLOSE"})}),e.jsx("button",{title:s("markets.journal.planYes",{defaultValue:"followed my plan"}),onClick:()=>w(g.id,!0),style:{fontSize:9,padding:"2px 5px",borderRadius:4,cursor:"pointer",border:`1px solid ${g.followed_plan===!0?t.green:t.border2}`,background:"transparent",color:g.followed_plan===!0?t.green:t.dim},children:"â"}),e.jsx("button",{title:s("markets.journal.planNo",{defaultValue:"broke my plan"}),onClick:()=>w(g.id,!1),style:{fontSize:9,padding:"2px 5px",borderRadius:4,cursor:"pointer",border:`1px solid ${g.followed_plan===!1?t.red:t.border2}`,background:"transparent",color:g.followed_plan===!1?t.red:t.dim},children:"â"}),e.jsx("button",{onClick:()=>v(g.id),style:{fontSize:12,border:"none",background:"transparent",color:t.dim,cursor:"pointer"},children:"Ã"})]},g.id))]})]})}function Jd({month:n,byDay:l,dayFilter:s,onPrev:i,onNext:o,onDay:r,net:a,truncated:p,t:d}){const c=(g,x)=>e.jsx("button",{onClick:g,style:{background:"transparent",border:`1px solid ${t.border2}`,borderRadius:6,color:t.muted,fontSize:13,cursor:"pointer",width:30,height:26,lineHeight:1},children:x}),u=a?.sfx??(a?.key==="outcome_ret_pct"?"%":""),h=g=>u==="$"?Ml(g,a?.dp??2):`${g>=0?"+":""}${pe(g,Math.abs(g)>=100?0:a?.dp??1)}${u}`,m=[];for(let g=0;g<n.cells.length;g+=7)m.push(n.cells.slice(g,g+7));const y=g=>
1{const x={fired:0,w:0,l:0,pnl:0,pn:0,days:0};for(const j of g){const _=j&&l[j.key];_&&(x.days++,x.fired+=_.fired,x.w+=_.w,x.l+=_.l,_.pn>0&&(x.pnl+=_.pnl,x.pn+=_.pn))}return x},b={minHeight:92,borderRadius:9,padding:"6px 8px",textAlign:"left",display:"flex",flexDirection:"column",justifyContent:"space-between"},f=(()=>{const g={net:0,pn:0,days:0,green:0,red:0,fired:0,winSum:0,winDays:0,lossSum:0,lossDays:0,best:null,worst:null,maxAbs:0};for(const x of n.cells){const j=x&&l[x.key];j&&(g.days++,g.fired+=j.fired,j.pn>0&&(g.net+=j.pnl,g.pn+=j.pn,g.maxAbs=Math.max(g.maxAbs,Math.abs(j.pnl)),j.pnl>0?(g.green++,g.winSum+=j.pnl,g.winDays++):j.pnl<0&&(g.red++,g.lossSum+=j.pnl,g.lossDays++),(g.best==null||j.pnl>g.best)&&(g.best=j.pnl),(g.worst==null||j.pnl<g.worst)&&(g.worst=j.pnl)))}return g})(),w=g=>{if(!f.maxAbs)return"1c";const x=Math.min(1,Math.abs(g)/f.maxAbs);return["12","1c","26","33"][Math.min(3,Math.floor(x*4))]},v=(g,x,j)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{style:{...ae(7.5,t.dim),letterSpacing:"0.12em"},children:g}),e.jsx("span",{style:{...ae(13,j||t.text),fontWeight:800},children:x})]},g);return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:14,marginBottom:10},children:[c(i,"â¹"),e.jsx("span",{style:{...ae(12,t.text),fontWeight:800,letterSpacing:"0.08em",minWidth:150,textAlign:"center"},children:n.label}),c(o,"âº")]}),f.days>0&&e.jsxs("div",{style:{display:"flex",gap:22,flexWrap:"wrap",alignItems:"flex-end",padding:"8px 12px",marginBottom:10,borderRadius:9,border:`1px solid ${t.border2}`,background:"rgba(255,255,255,0.015)"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{style:{...ae(7.5,t.dim),letterSpacing:"0.12em"},children:"MONTH NET"}),e.jsx("span",{style:{...ae(19,f.pn>0?f.net>=0?t.green:t.red:t.dim),fontWeight:900},children:f.pn>0?h(f.net):"â"})]}),v("TRADED DAYS",f.days),v("GREEN / RED",e.jsxs("span",{children:[e.jsx("span",{style:{color:t.green},children:f.green}),e.jsx("span",{style:{color:t.dim},children:" / "}),e.jsx("span",{style:{color:t.red},children:f.red})]})),v("DAY WIN %",f.green+f.red?`${Math.round(100*f.green/(f.green+f.red))}%`:"â",f.green>=f.red?t.green:t.red),v("AVG WIN DAY",f.winDays?h(f.winSum/f.winDays):"â",t.green),v("AVG LOSS DAY",f.lossDays?h(f.lossSum/f.lossDays):"â",t.red),v("BEST DAY",f.best!=null?h(f.best):"â",t.green),v("WORST DAY",f.worst!=null?h(f.worst):"â",t.red),v("SIGNALS",f.fired)]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr) 0.85fr",gap:6},children:[Ud.map((g,x)=>e.jsx("div",{style:{...ae(8.5,t.dim),textAlign:"center",letterSpacing:"0.1em",paddingBottom:2},children:g},x)),e.jsx("div",{style:{...ae(8.5,t.gold),textAlign:"center",letterSpacing:"0.1em",paddingBottom:2},children:"WEEK"}),m.map((g,x)=>e.jsxs($.Fragment,{children:[g.map((j,_)=>{if(!j)return e.jsx("div",{style:{...b,background:"transparent"}},_);const E=l[j.key],T=E&&E.pn>0,S=E?T?E.pnl>0?t.green:E.pnl<0?t.red:t.slate:E.w-E.l>0?t.green:E.w-E.l<0?t.red:t.slate:null,C=s===j.key,I=E&&(E.w||E.l)?Math.round(100*E.w/(E.w+E.l)):null;return e.jsxs("button",{onClick:()=>E&&r(j.key),disabled:!E,style:{...b,cursor:E?"pointer":"default",border:`1px solid ${C?t.gold:j.today?t.blue:S?`${S}55`:t.border2}`,background:S?`${S}${T?w(E.pnl):"1c"}`:"rgba(255,255,255,0.015)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline"},children:[e.jsx("span",{style:{...ae(9.5,E?t.muted:t.dim),fontWeight:700},children:j.d}),E&&e.jsxs("span",{style:{...ae(8.5,t.dim)},children:[E.fired," ",E.fired===1?"sig":"sigs"]})]}),E?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{...ae(T?15:11,T?E.pnl>=0?t.green:t.red:t.dim),fontWeight:900,letterSpacing:"-0.02em"},children:T?h(E.pnl):"â"}),e.jsxs("span",{style:{...ae(8.5,t.dim)},children:[e.jsxs("span",{style:{color:t.green},children:[E.w,"W"]})," ",e.jsxs("span",{style:{color:t.red},children:[E.l,"L"]}),I!=null&&e.jsxs("span",{style:{color:I>=50?t.green:t.muted},children:[" · ",I,"%"]})]})]}):e.jsx("span",{})]},_)}),(()=>{const j=y(g),_=j.pn>0?j.pnl>0?t.green:j.pnl<0?t.red:t.slate:null,E=j.w||j.l?Math.round(100*j.w/(j.w+j.l)):null;return e.jsxs("div",{style:{...b,border:`1px dashed ${_?`${_}55`:t.border2}`,background:_?`${_}12`:"rgba(255,255,255,0.01)"},children:[e.jsx("span",{style:{...ae(8,t.dim),letterSpacing:"0.1em"},children:j.days?`${j.fired} sigs`:""}
1),j.days?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{...ae(13,j.pn>0?j.pnl>=0?t.green:t.red:t.dim),fontWeight:900},children:j.pn>0?h(j.pnl):"â"}),e.jsxs("span",{style:{...ae(8,t.dim)},children:[e.jsxs("span",{style:{color:t.green},children:[j.w,"W"]})," ",e.jsxs("span",{style:{color:t.red},children:[j.l,"L"]}),E!=null&&e.jsxs("span",{style:{color:E>=50?t.green:t.muted},children:[" · ",E,"%"]})]})]}):e.jsx("span",{})]},"wk"+x)})()]},"w"+x))]}),e.jsxs("div",{style:{...ae(8.5,t.dim),marginTop:12,textAlign:"center",lineHeight:1.6},children:[d("markets.signals.jCalHint2",{defaultValue:"day net P&L leads each cell · tint = P&L sign · dashed column = weekly rollup · click a day for its signals"}),p&&e.jsx("div",{style:{color:t.gold,marginTop:2},children:d("markets.signals.jCalTruncated",{defaultValue:"row limit reached â the oldest days shown may be partially loaded"})})]})]})}function ec({rows:n,columns:l,dayFilter:s,clearDay:i,sort:o,onSort:r,t:a}){const p=(c,u)=>{const h=!!c.sortKey,m=o&&o.i===u;return e.jsxs("th",{onClick:h?()=>r(u):void 0,style:{...ae(8,m?t.gold:t.dim),letterSpacing:"0.1em",textAlign:c.align||"left",padding:"7px 10px",position:"sticky",top:0,background:t.panel,borderBottom:`1px solid ${t.border2}`,zIndex:1,cursor:h?"pointer":"default",userSelect:"none",whiteSpace:"nowrap"},children:[c.lbl,m?o.dir==="asc"?" â²":" â¼":h?" â
":""]},u)},d={padding:"6px 10px",borderBottom:`1px solid ${t.border2}`,whiteSpace:"nowrap"};return e.jsxs("div",{children:[s&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:t.panel2},children:[e.jsxs("span",{style:{...ae(10,t.gold)},children:[a("markets.signals.jFiltered",{defaultValue:"showing"})," ",s]}),e.jsx("button",{onClick:i,style:{...ae(9,t.muted),background:"transparent",border:`1px solid ${t.border2}`,borderRadius:5,padding:"2px 8px",cursor:"pointer"},children:a("markets.signals.jClear",{defaultValue:"clear Ã"})})]}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:820},children:[e.jsx("thead",{children:e.jsx("tr",{children:l.map((c,u)=>p(c,u))})}),e.jsx("tbody",{children:n.map(c=>e.jsx("tr",{title:c.record_status==="archived_legacy"?"Archived audit record â excluded from current statistics and calibration":void 0,style:{opacity:c.record_status==="archived_legacy"?.64:1},children:l.map((u,h)=>{const m=u.cell(c);return e.jsx("td",{title:m.title||void 0,style:{...d,...ae(10.5,m.color||t.muted),textAlign:u.align||"left",fontWeight:m.bold?700:400},children:m.text},h)})},c.id))})]})})]})}const gn=n=>{const l=Number(n);return isFinite(l)?l:null},He=n=>{const l=gn(n);return l!==null&&l!==0?l:null};function xs({symbol:n}){const{t:l}=W(),s=String(n||"").toUpperCase(),{data:i}=H(()=>Ne(s),12e3,[s]),{data:o}=H(()=>$t(s),3e4,[s]),{data:r}=H(()=>Fr(s).catch(()=>null),3e5,[s]),a=r?.vrp,p=!i||i.spot==null&&!(i.gex&&i.gex.net_gex!=null),{data:d}=H(()=>p?Js(s):Promise.resolve(null),6e4,[s,p]),c=p&&d&&d.available,u=c?{net_gex:d.net_gexp,regime:d.regime,flip_strike:d.flip,call_wall:d.call_wall,put_wall:d.put_wall}:i?.gex||{},h=i?.vol||{},m=He(c?d.spot:i?.spot),y=gn(u.net_gex),b=u.regime||(y>0?"positive":y<0?"negative":null),f=He(u.flip_strike),w=He(u.call_wall),v=He(u.put_wall),g=He(c?d.em_pct:o?.expected_move_pct),x=He(i?.put_call_ratio),j=gn(i?.net_premium),_=He(i?.max_pain),E=h.iv_rank!=null?h.iv_rank<=1?h.iv_rank*100:gn(h.iv_rank):null,T=h.atm_iv!=null?h.atm_iv*100:null,S=A=>A&&m?(A-m)/m*100:null,C=A=>A==null?"â":`${A.toFixed(A>1e3?0:2)} · ${S(A)>=0?"+":""}${S(A).toFixed(2)}%`,I=x==null?null:x>=1.2?l("markets.vitals.putHeavy"):x<=.8?l("markets.vitals.callHeavy"):l("markets.vitals.balanced"),F=({label:A,value:P,color:V,title:J})=>e.jsxs("div",{title:J,style:{display:"flex",alignItems:"baseline",gap:8,padding:"3px 0",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,letterSpacing:"0.1em",color:t.dim,width:74,flexShrink:0},children:A}),e.jsx("span",{style:{fontFamily:k,fontSize:12,fontWeight:700,color:V||t.text,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:P??"â"})]});return e.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:8,overflow:"hidden",background:t.panel},children:[e.jsxs("div",{style:{padding:"6px 10px",background:t.panel2,borderBottom:`1px solid ${t.border2}
1`,display:"flex",alignItems:"center",gap:6,flexShrink:0},children:[e.jsxs("span",{style:{fontFamily:k,fontSize:10,fontWeight:800,letterSpacing:"0.12em",color:t.amber},children:[l("markets.vitals.title")," · ",s]}),e.jsx(ie,{size:12,title:l("markets.vitals.infoTitle"),what:l("markets.vitals.infoWhat"),how:l("markets.vitals.infoHow")}),c&&d.level_date&&e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:8.5,fontWeight:700,color:"#E0C27A",background:"rgba(210,162,76,0.12)",border:"1px solid rgba(210,162,76,0.35)",borderRadius:4,padding:"1px 6px"},title:l("markets.vitals.uniTooltip"),children:l("markets.dollarFlow.lastSessionChip",{date:d.level_date})})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"4px 10px 8px"},children:[!i&&e.jsx("div",{style:{padding:"10px 0",fontSize:11,color:t.dim},children:l("markets.vitals.noAgg",{symbol:s})}),e.jsx(F,{label:l("markets.vitals.spot"),value:m!=null?m.toFixed(m>1e3?1:2):null}),e.jsx(F,{label:l("markets.vitals.gammaRegime"),value:b==="positive"?l("markets.vitals.posDampen"):b==="negative"?l("markets.vitals.negAmplify"):null,color:b==="positive"?t.green:b==="negative"?t.red:t.text}),e.jsx(F,{label:l("markets.vitals.netGex"),value:y!=null?ee(y):null,color:y>0?t.green:y<0?t.red:t.text}),e.jsx(F,{label:l("markets.vitals.flip"),value:f!=null?C(f):y!=null&&y<0?l("markets.vitals.flipAboveRange",{defaultValue:"above range"}):y!=null&&y>0?l("markets.vitals.flipBelowRange",{defaultValue:"below range"}):null,color:t.amber}),e.jsx(F,{label:l("markets.vitals.callWall"),value:w!=null?C(w):null,color:t.green}),e.jsx(F,{label:l("markets.vitals.putWall"),value:v!=null?C(v):null,color:t.red}),e.jsx(F,{label:l("markets.vitals.em"),value:g!=null?`±${g.toFixed(2)}%${m?` · ±${(m*g/100).toFixed(m>1e3?0:2)}`:""}`:null}),e.jsx(F,{label:l("markets.vitals.pcRatio"),value:x!=null?`${x.toFixed(2)}${I?` · ${I}`:""}`:null,color:x>=1.2?t.red:x<=.8?t.green:t.text}),e.jsx(F,{label:l("markets.vitals.netPrem"),value:j!=null?`${j>=0?"+":""}${ee(j)}`:null,color:j>0?t.green:j<0?t.red:t.text}),a&&a.verdict&&e.jsx(F,{label:l("markets.vitals.vrp",{defaultValue:"VOL RICH/CHEAP"}),value:a.stale?`${l("markets.vitals.vrpStale",{defaultValue:"stale · no current read"})} · ${a.asof}`:`${l("markets.vitals.vrpVal",{defaultValue:"{{verdict}} · IV30 {{iv}} vs RV20 {{rv}} (p{{p}})",verdict:a.verdict.toUpperCase(),iv:R(a.iv30,0),rv:R(a.rv20,0),p:R(a.spread_pctile,0)})} · ${a.asof}`,color:a.stale?t.dim:a.verdict==="rich"?t.red:a.verdict==="cheap"?t.green:t.text}),e.jsx(F,{label:l("markets.vitals.iv"),value:E!=null||T!=null?[E!=null?l("markets.vitals.ivRankVal",{n:E.toFixed(0)}):null,T!=null?`ATM ${T.toFixed(1)}%`:null].filter(Boolean).join(" · "):null}),e.jsx(F,{label:l("markets.vitals.maxPain"),value:_!=null?_.toFixed(_>1e3?0:2):null,title:l("markets.vitals.maxPainNote")})]})]})}const St="#37d183",_t="#f0524f",mt="#78818f",Ye="#D2A24C",bl="#4dc9e6",tc=["SCALP","INTRADAY","MOMENTUM","SWING","POSITION"];function nc(n){const l=n?.flow;if(!l||l.score==null||l.stale||l.verdict==="NEUTRAL")return!1;const s=o=>o==="GREEN"?1:o==="RED"?-1:0,i=s(n.horizons?.[0]?.verdict)+s(n.horizons?.[1]?.verdict);return i!==0&&s(l.verdict)*i<0}function lc(n,l){const[s,i]=$.useState(null);return $.useEffect(()=>{let o=!0;const r=()=>n().then(p=>{o&&i(p)}).catch(()=>{});r();const a=setInterval(r,3e4);return()=>{o=!1,clearInterval(a)}},l),s}function zl({data:n,symbol:l,onClose:s}){return $.useEffect(()=>{const i=o=>{o.key==="Escape"&&s()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[s]),e.jsx("div",{onClick:s,style:{position:"fixed",inset:0,zIndex:95,background:"rgba(6,8,11,0.78)",display:"flex",alignItems:"center",justifyContent:"center",padding:18},children:e.jsxs("div",{onClick:i=>i.stopPropagation(),style:{width:"min(980px, 96vw)",maxHeight:"92vh",overflowY:"auto",background:"#0E1219",border:`1px solid ${Ye}55`,borderRadius:14,padding:"16px 20px",boxShadow:"0 18px 60px rgba(0,0,0,0.55)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{fontFamily:k,fontSize:11.5,letterSpacing:"0.16em",color:Ye,fontWeight:800},children:["THE STACK · ",l]}),n?.last_session?e.jsx("span",{style:{fontFamily:k,fontSize:9,color:Ye,border:`1px solid ${Ye}66`,borderRadius:999,padding:"1px 8px"},children:"LAST SESSION"}):null,n?.horizons?.some(i=>i.stale_tfs?.length)?e.jsx("span",{style:{fontFamily:k,fontSize:9,color:Ye,border:`1px solid ${Ye}66`,borderRadius:999,padding:"1px 8px"},children:"LAST MEASURED"}):null,n?.arcs?.basis==="reconstructed"?e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.muted,border:`1px solid ${t.border2}`,borderRadius:999,padding:"1px 8px"},children:"RECONSTRUCTED"}):null,e.jsx("span",{style:{fontFamily:k,fontSize:9,color:bl,border:`1px solid ${bl}55`,borderRadius:999,padding:"1px 8px"},children:"FLOW = COINCIDENT"}),e.jsx("button",{className:"sa-x",onClick:s,"aria-label":"close",style:{marginLeft:"auto",fontFamily:k,fontSize:12,color:t.muted,background:"transparent",border:`1px solid ${t.border2}`,borderRadius:6,padding:"1px 8px",cursor:"pointer"},children:"â"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(260px, 1fr)",gap:16,alignItems:"center",marginTop:8},children:[e.jsx(Sl,{data:n,size:430}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{fontFamily:k,fontSize:11.5,color:t.text,lineHeight:1.6,borderLeft:`2px solid ${Ye}66`,paddingLeft:10},children:n?.read}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:(n?.horizons||[]).map(i=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontFamily:k,fontSize:10},children:[e.jsx("span",{style:{width:68,letterSpacing:"0.12em",color:t.dim},children:i.key}),e.jsx("span",{style:{width:52,fontWeight:700,color:i.verdict==="GREEN"?St:i.verdict==="RED"?_t:mt},children:i.verdict}),e.jsx(Pi,{h:i}),e.jsxs("span",{style:{color:t.muted,fontSize:9,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[i.no_data?"no data":`${i.score>=0?"+":""}${i.score}`,i.dissent_tf?` · ${i.dissent_tf} dissents`:""]})]},i.key))}),e.jsx(Hi,{flow:n?.flow}),e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.muted,letterSpacing:"0.05em",lineHeight:1.7},children:"measured from live TF indicators · cells = each timeframe's own score · state descriptor, not a forecast · full panel lives in Research: The Field"})]})]})]})})}
1function sc({symbol:n,data:l,loading:s=!1,error:i=null,fill:o=!1}){const r=fn("ELITE"),[a,p]=$.useState(!1),d=n?String(n).toUpperCase():null,c=l!==void 0,u=lc(()=>!c&&d&&r?Al(d):Promise.resolve(null),[d,r,c]),h=c?l:u;if(!d)return null;if(!r)return e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.muted,border:`1px dashed ${t.border2}`,borderRadius:8,padding:"6px 10px",letterSpacing:"0.08em"},children:"THE STACK · 5-horizon alignment · ELITE"});if(s||i)return e.jsxs("div",{"data-testid":"futures-stack-strip-state","data-state":i?"error":"loading","data-symbol":d,style:{marginBottom:10,fontFamily:k},children:[e.jsxs("div",{style:{fontSize:10,letterSpacing:"0.14em",color:t.dim,fontWeight:700,marginBottom:5},children:["THE STACK · ",d," ",e.jsx(ul,{id:"S1"})]}),e.jsx("div",{style:{border:`1px solid ${i?Ye+"66":t.border}`,borderRadius:8,padding:"9px 12px",color:i?Ye:t.muted,fontSize:8.5,letterSpacing:"0.08em"},children:i?"STACK FEED RETRYING":"LOADING ALIGNMENT"})]});if(!h||h.coverage==="none"||!h.horizons?.length)return null;const m=h.alignment??0;return e.jsxs("div",{"data-testid":"futures-stack-strip-state","data-state":"ready","data-symbol":d,style:o?{height:"100%",minHeight:0,display:"flex",flexDirection:"column"}:{marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,fontFamily:k,fontSize:10,letterSpacing:"0.14em",color:t.dim,fontWeight:700,textTransform:"uppercase",margin:"0 0 5px"},children:["THE STACK · ",d,e.jsx(ul,{id:"S1"})]}),e.jsxs("div",{onClick:()=>p(!0),title:"open THE STACK",style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",...o?{flex:1,minHeight:0,padding:"2px 0"}:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:10,padding:"8px 12px"}},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:3,minWidth:0,...o?{height:"100%",justifyContent:"space-evenly"}:{}},children:[h.horizons.map((y,b)=>{const f=y.verdict==="GREEN"?1:y.verdict==="RED"?-1:0,w=f>0?St:f<0?_t:mt,v=Math.min(1,Math.abs(y.score||0)/.6);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{style:{fontFamily:k,fontSize:7.5,letterSpacing:"0.14em",color:t.muted,width:56,flex:"none"},children:tc[b]}),e.jsx("span",{style:{flex:1,height:5,borderRadius:3,background:"#161c25",position:"relative",overflow:"hidden"},children:e.jsx("i",{style:{position:"absolute",inset:0,width:`${Math.round((.25+.75*v)*100)}%`,background:w,opacity:f===0?.3:.85,borderRadius:3,display:"block"}})}),e.jsx("span",{style:{display:"inline-flex",gap:3,flex:"none",width:21,justifyContent:"flex-end"},children:(y.triad||[]).map(g=>{const x=y.tf_scores?.[g],j=y.stale_tfs?.includes(g);return e.jsx("i",{title:`${g}: ${x==null?"n/a":(x>=0?"+":"")+x}${j?" · last":""}`,style:{width:5,height:5,borderRadius:"50%",display:"block",background:x==null?"transparent":x>0?St:x<0?_t:mt,border:x==null?`1px solid ${mt}66`:"none",opacity:j?.55:1}},g)})})]},y.key)}),h.flow&&h.flow.score!=null?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{style:{fontFamily:k,fontSize:7.5,letterSpacing:"0.14em",color:bl,width:56,flex:"none"},children:"FLOW"}),e.jsx("span",{style:{flex:1,height:3.5,borderRadius:3,background:"#161c25",position:"relative",overflow:"hidden"},children:e.jsx("i",{style:{position:"absolute",inset:0,width:`${Math.round((.2+.8*Math.min(1,Math.abs(h.flow.score)))*100)}%`,background:h.flow.verdict==="GREEN"?St:h.flow.verdict==="RED"?_t:mt,opacity:h.flow.stale?.25:.9,borderRadius:3,display:"block"}})}),e.jsx("span",{style:{display:"inline-flex",gap:3,flex:"none",width:21,justifyContent:"flex-end"},children:e.jsx("i",{title:`flow ${h.flow.stale?"· last":"· live"}`,style:{width:5,height:5,borderRadius:"50%",display:"block",background:h.flow.verdict==="GREEN"?St:h.flow.verdict==="RED"?_t:mt,opacity:h.flow.stale?.55:1}})})]}):null]}),e.jsxs("div",{style:{fontFamily:k,textAlign:"center",flex:"none",width:52},children:[e.jsxs("div",{style:{fontSize:21,fontWeight:800,lineHeight:1,color:m>0?St:m<0?_t:mt},children:[m>0?"+":"",m]}),e.jsxs("div",{style:{fontSize:7,letterSpacing:"0.16em",color:t.muted,marginTop:2},children:["STACK",nc(h)?e.jsx("span",{style:{color:"#F2A93B"},children:" â "}):""]})]})]}),a?e.jsx(zl,{data:h,symbol:d,onClose:()=>p(!1)}):null]})}const fs="#D2A24C",ic=["1m","5m","15m","1h","4h","1d","1w"];function vl({symbol:n}
1){const l=fn("ELITE"),s=n?String(n).toUpperCase():null,[i,o]=$.useState(null),[r,a]=$.useState(!1);if($.useEffect(()=>{if(!s||!l){o(null);return}let h=!0;const m=()=>Al(s).then(b=>{h&&o(b)}).catch(()=>{});m();const y=setInterval(m,3e4);return()=>{h=!1,clearInterval(y)}},[s,l]),!s)return null;const p={height:"100%",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:6,background:t.panel,border:`1px solid ${t.border}`,borderRadius:8,padding:10},d=e.jsxs("div",{style:{fontFamily:k,fontSize:8.5,color:t.dim,letterSpacing:"0.12em",fontWeight:700,display:"flex",alignItems:"center",gap:5,flexShrink:0},children:["THE STACK · ALIGNMENT · ",s," ",e.jsx(ul,{id:"S1"}),i?.last_session?e.jsx("span",{style:{fontFamily:k,fontSize:7,color:fs,border:`1px solid ${fs}66`,borderRadius:999,padding:"0 6px",marginLeft:"auto"},children:"LAST SESSION"}):null]});if(!l)return e.jsxs("div",{style:{...p,overflowY:"hidden"},children:[d,e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.muted,border:`1px dashed ${t.border2}`,borderRadius:8,padding:"6px 10px",letterSpacing:"0.08em"},children:"5-horizon alignment dial · ELITE"})]});const c=!i||!i.horizons?.length||i.coverage==="none",u={};for(const h of i?.horizons||[])for(const m of h.triad||[])!(m in u)&&h.tf_scores?.[m]!=null&&(u[m]={score:h.tf_scores[m],stale:h.stale_tfs?.includes(m)});return e.jsxs("div",{style:p,"data-testid":"stack-alignment-card","data-symbol":s,children:[d,c?e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.muted,lineHeight:1.5},children:i?`stack coverage: none for ${s}`:"loading alignment..."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>a(!0),title:"open THE STACK",style:{width:"100%",flex:1,minHeight:120,cursor:"pointer"},children:e.jsx(Sl,{data:i,fill:!0,bare:!0,linkedCursor:!0})}),e.jsx("div",{style:{display:"flex",flexWrap:"nowrap",gap:3,flexShrink:0},children:ic.map(h=>{const m=u[h]?.score,y=u[h]?.stale,b=m==null?"rgba(120,129,143,0.10)":m>0?`rgba(55,209,131,${.18+.5*Math.min(1,m)})`:m<0?`rgba(240,82,79,${.18+.5*Math.min(1,-m)})`:"rgba(120,129,143,0.20)";return e.jsx("span",{title:`${h}: ${m==null?"n/a":(m>=0?"+":"")+m}${y?" · last measured":""}`,style:{flex:1,textAlign:"center",fontFamily:k,fontSize:9,fontWeight:700,padding:"3px 2px",borderRadius:3,whiteSpace:"nowrap",border:y?`1px dashed ${t.border2}`:"none",color:m==null?t.dim:m>0?t.green:m<0?t.red:t.muted,background:b},children:h},h)})})]}),r?e.jsx(zl,{data:i,symbol:s,onClose:()=>a(!1)}):null]})}const Ve={minWidth:0},Be={fontFamily:k,fontSize:8.5,letterSpacing:"0.14em",color:t.dim,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Ue={fontFamily:k,fontSize:11.5,fontWeight:800,marginTop:4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Ri={position:"relative",height:10,marginTop:5,borderRadius:3,background:t.elev,overflow:"hidden"},rc={"Information Technology":"XLK",Technology:"XLK",Financials:"XLF","Health Care":"XLV",Healthcare:"XLV",Energy:"XLE",Industrials:"XLI","Consumer Discretionary":"XLY","Consumer Staples":"XLP",Materials:"XLB",Utilities:"XLU","Real Estate":"XLRE","Communication Services":"XLC"},tl=(n,l)=>n.length>=l?n.slice(-l).reduce((s,i)=>s+i,0)/l:null;function oc(n,l){const s=(n||[]).filter(S=>isFinite(Number(S.close)));if(s.length<30)return null;const i=s.map(S=>Number(S.close)),o=s.map(S=>Number(S.high)),r=s.map(S=>Number(S.low)),a=s.map(S=>Number(S.volume)||0),p=s.map(S=>Number(S.open)),d=l?.last??i[i.length-1],c=Math.min(252,s.length),u=Math.max(...o.slice(-c)),h=Math.min(...r.slice(-c)),m=S=>new Date(S*1e3).toLocaleDateString("en-CA",{timeZone:"America/New_York"}),y=new Date().toLocaleDateString("en-CA",{timeZone:"America/New_York"}),b=m(s[s.length-1].ts)===y,f=b?a.slice(0,-1):a,w=f.length>=20?f.slice(-20).reduce((S,C)=>S+C,0)/20:null,v=b?Math.max(a[a.length-1],Number(l?.volume)||0):Number(l?.volume)||null,g=w&&v?v/w:null;let x=null;{const S=Number(l?.volume)||0;if(w&&S>0){const C=new Date(new Date().toLocaleString("en-US",{timeZone:"America/New_York"})),I=C.getDay(),F=C.getHours()*60+C.getMinutes()-570;if(I>=1&&I<=5&&F>15&&F<390){const A=Math.max(.05,Math.min(1,F/390));x=S/(w*A)}}}const j=s.length>=2?(p[p.length-1]/i[i.length-2]-1)*100:null;let _=null;if(j!=null&&Math.abs(j)>=.15&&s.length>=60){const S=j/100;let C=0,I=0;const F=b?s.length-1:s.length;for(let A=1;A<F;
1A++){const P=p[A]/i[A-1]-1;if(!isFinite(P)||P===0||Math.sign(P)!==Math.sign(S))continue;const V=Math.abs(P);V<Math.max(.0015,Math.abs(S)*.5)||V>Math.abs(S)*2.5||(C++,(S>0?r[A]<=i[A-1]:o[A]>=i[A-1])&&I++)}C>=8&&(_={pct:I/C*100,n:C})}let E=null;if(s.length>=15){const S=[];for(let C=s.length-14;C<s.length;C++)S.push(Math.max(o[C]-r[C],Math.abs(o[C]-i[C-1]),Math.abs(r[C]-i[C-1])));E=S.reduce((C,I)=>C+I,0)/S.length}let T=null;if(i.length>=21){const S=[];for(let F=i.length-20;F<i.length;F++)S.push(Math.log(i[F]/i[F-1]));const C=S.reduce((F,A)=>F+A,0)/S.length,I=S.reduce((F,A)=>F+(A-C)*(A-C),0)/(S.length-1);T=Math.sqrt(I*252)*100}return{last:d,hi52:u,lo52:h,rvol:g,rvolPace:x,gap:j,gapStudy:_,atr:E,hv20:T,lastIsToday:b,sma20:tl(i,20),sma50:tl(i,50),sma200:tl(i,200)}}function nl({lo:n,hi:l,marks:s=[],cursor:i}){const o=l-n||1,r=a=>`${Math.max(0,Math.min(100,(a-n)/o*100)).toFixed(1)}%`;return e.jsxs("div",{style:Ri,children:[s.map((a,p)=>a.v!=null&&e.jsx("span",{style:{position:"absolute",top:0,bottom:0,width:2,left:r(a.v),background:a.c,opacity:.9}},p)),i!=null&&e.jsx("span",{style:{position:"absolute",top:0,bottom:0,width:2,left:r(i),background:t.gold,boxShadow:"0 0 6px rgba(210,162,76,0.85)",zIndex:2}})]})}const ll=({label:n,on:l})=>e.jsxs("span",{style:{fontFamily:k,fontSize:8.5,fontWeight:800,padding:"2px 6px",borderRadius:4,color:l==null?t.dim:l?t.green:t.red,border:`1px solid ${l==null?t.border2:l?"rgba(55,209,131,0.5)":"rgba(240,82,79,0.5)"}`},children:[n," ",l==null?"â":l?"â²":"â¼"]});function ys({symbol:n,q:l}){const{t:s}=W(),{data:i}=H(()=>Ct(n,"1d",280),3e5,[n]),{data:o}=H(()=>Ne(n),3e4,[n]),{data:r}=H(()=>Rn(n),6e4,[n]),{data:a}=H(()=>Nr(n).catch(()=>null),12e4,[n]),p=a?.short,d=$.useMemo(()=>oc(i?.candles,l),[i,l]),c=d?.last??l?.last,u=o?.gex,h=u&&(u.call_wall!=null||u.put_wall!=null)?u:r||{},m=h?.put_wall,y=h?.call_wall,b=h?.flip_strike,f=m!=null&&y!=null&&c!=null,w=f?Math.min(m,c)*.995:null,v=f?Math.max(y,c)*1.005:null,g=d&&c?(c/d.hi52-1)*100:null,x=d?.rvolPace??d?.rvol,j=x==null?t.dim:x>=2?t.red:x>=1.3?t.gold:t.muted,_=rc[ri(n)||""]||null,{data:E}=H(()=>cl("SPY"),3e4,[]),{data:T}=H(()=>_&&_!==n?cl(_):Promise.resolve(null),3e4,[_,n]),S=l?.change_pct!=null&&E?.change_pct!=null&&n!=="SPY"?l.change_pct-E.change_pct:null,C=l?.change_pct!=null&&T?.change_pct!=null?l.change_pct-T.change_pct:null,I=(()=>{if(!d||c==null)return null;const F=[];if(x!=null&&(x>=2?F.push(s("markets.equityVitals.readCrowd",{defaultValue:"crowd is here ({{x}}à volume pace)",x:R(x,1)})):x>=1.3?F.push(s("markets.equityVitals.readElevated",{defaultValue:"volume elevated ({{x}}Ã)",x:R(x,1)})):x<.7&&F.push(s("markets.equityVitals.readAsleep",{defaultValue:"volume asleep ({{x}}Ã): moves here carry less meaning",x:R(x,1)}))),g!=null&&g>-1.5)F.push(s("markets.equityVitals.readAtHigh",{defaultValue:"pressing the 52-week high"}));else if(d.lo52&&c/d.lo52-1<.015)F.push(s("markets.equityVitals.readAtLow",{defaultValue:"sitting on the 52-week low"}));else{const A=[d.sma20,d.sma50,d.sma200].filter(V=>V!=null&&c>V).length,P=[d.sma20,d.sma50,d.sma200].filter(V=>V!=null).length;P===3&&A===3?F.push(s("markets.equityVitals.readTrendUp",{defaultValue:"trend aligned up (above the 20/50/200d)"})):P===3&&A===0&&F.push(s("markets.equityVitals.readTrendDown",{defaultValue:"trend aligned down (below the 20/50/200d)"}))}if(d.gap!=null&&Math.abs(d.gap)>=1.5){const A=`${d.gap>0?"+":""}${R(d.gap,1)}%`;F.push(d.gapStudy?s("markets.equityVitals.readGapStudy",{defaultValue:"gap {{g}}: similar gaps filled {{p}}% of the time (n={{n}})",g:A,p:Math.round(d.gapStudy.pct),n:d.gapStudy.n}):s("markets.equityVitals.readGap",{defaultValue:"gap {{g}}",g:A}))}return F.length<3&&C!=null&&Math.abs(C)>=1&&_&&F.push(C>0?s("markets.equityVitals.readLeadingSector",{defaultValue:"leading its sector by {{x}}pp today",x:R(C,1)}):s("markets.equityVitals.readLaggingSector",{defaultValue:"lagging its sector by {{x}}pp today",x:R(Math.abs(C),1)})),F.length?F.slice(0,3).join(" · "):null})();return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(148px, 1fr))",gap:14,background:"#10141A",border:"1px solid rgba(210,162,76,0.14)",borderRadius:10,padding:"9px 14px 10px",flexShrink:0},children:[I&&e.jsxs("div",{style:{gridColumn:"1 / -1",display:"flex",alignItems:"baseline",gap:8,minWidth:0},children:[e.jsx("span",{style:{fontFamily:k,fontSize:8.5,fontWeight:800,letterSpacing:"0.14em",color:t.gold,flexShrink:0},children:s("markets.equityVitals.readLabel",{defaultValue:"THE READ"})}),e.jsxs("span",{style:{fontSize:11,color:"rgba(232,228,218,0.82)",lineHeight:1.45,minWidth:0},children:[n," · ",I]}),e.jsx("span",{style:{fontSize:8,color:t.dim,flexShrink:0,fontFamily:k},children:s("markets.equityVitals.readSuffix",{defaultValue:"RULE-BASED · NOT ADVICE"})})]}),p&&p.short_ratio!=null&&e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelShort",{defaultValue:"SHORT VOL · FINRA"})}),e.jsx(nl,{lo:0,hi:1,cursor:p.short_ratio}),e.jsxs("div",{style:{...Ue,color:p.pctile60>=80?t.amber:t.text},children:[R(p.short_ratio*100,0),"%",e.jsxs("span",{style:{color:t.dim,fontWeight:400},children:[" p",R(p.pctile60,0),p.days_to_cover!=null?` · DTC ${R(p.days_to_cover,1)}`:""]})]})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.label52Week")}),e.jsx(nl,{lo:d?.lo52??0,hi:d?.hi52??1,cursor:d?c:null}),e.jsxs("div",{style:{...Ue,color:g==null?t.dim:g>-3?t.green:t.text},children:[g!=null?`${R(g,1)}%`:"â",e.jsxs("span",{style:{color:t.dim,fontWeight:400},children:[" ",s("markets.equityVitals.offHigh")]})]})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelRvol")}),e.jsxs("div",{style:Ri,children:[d?.rvol!=null&&e.jsx("span",{style:{position:"absolute",top:2,bottom:2,left:0,borderRadius:2,width:`${Math.min(100,d.rvol/3*100)}%`,background:`linear-gradient(90deg, ${j}44, ${j}cc)`}}),e.jsx("span",{style:{position:"absolute",top:0,bottom:0,width:1,left:"33.3%",background:t.border2}})]}),e.jsxs("div",{style:{...Ue,color:j},children:[d?.rvolPace!=null?e.jsxs(e.Fragment,{children:[R(d.rvolPace,2),"Ã",e.jsxs("span",{style:{color:t.dim,fontWeight:400},children:[" ",s("markets.equityVitals.vsPace")]})]}):d?.rvol!=null?`${R(d.rvol,2)}Ã`:"â",d&&!d.lastIsToday&&d?.rvolPace==null&&e.jsx("span",{style:{color:t.dim,fontWeight:400},children:s("markets.equityVitals.lastSession")})]}),d?.rvolPace!=null&&d?.rvol!=null&&e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.dim,marginTop:2},children:s("markets.equityVitals.ofFullDay",{r:R(d.rvol,2)})})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelGap")}),e.jsx("div",{style:{...Ue,marginTop:12,color:d?.gap==null?t.dim:d.gap>=0?t.green:t.red},children:d?.gap!=null?`${d.gap>=0?"+":""}${R(d.gap,2)}%`:"â"}),d?.gapStudy&&e.jsx("div",{style:{fontFamily:k,fontSize:8.5,color:t.dim,marginTop:3},children:s("markets.equityVitals.gapFillOdds",{pct:Math.round(d.gapStudy.pct),n:d.gapStudy.n})})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelAtr")}),e.jsxs("div",{style:{...Ue,marginTop:12,color:t.text},children:[d?.atr!=null&&c?`${R(d.atr/c*100,2)}%`:"â",d?.atr!=null&&e.jsxs("span",{style:{color:t.dim,fontWeight:400},children:[" · $",R(d.atr,2)]})]})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelHv")}),e.jsxs("div",{style:{...Ue,marginTop:12,color:t.text},children:[d?.hv20!=null?`${R(d.hv20,0)}%`:"â",l?.iv_rank!=null&&e.jsx("span",{style:{color:t.gold,fontWeight:700},children:s("markets.equityVitals.ivrSuffix",{ivr:Math.min(100,Math.round(l.iv_rank*100))})})]})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelTrend")}),e.jsxs("div",{style:{display:"flex",gap:4,marginTop:9,flexWrap:"wrap"},children:[e.jsx(ll,{label:"20D",on:d?.sma20!=null&&c!=null?c>=d.sma20:null}),e.jsx(ll,{label:"50D",on:d?.sma50!=null&&c!=null?c>=d.sma50:null}),e.jsx(ll,{label:"200D",on:d?.sma200!=null&&c!=null?c>=d.sma200:null})]})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelLeadership")}),e.jsx("div",{style:{...Ue,marginTop:12,color:S==null?t.dim:S>.3?t.green:S<-.3?t.red:t.muted},children:S==null?"â":e.jsxs(e.Fragment,{children:[S>.3?s("markets.equityVitals.leading"):S<-.3?s("markets.equityVitals.lagging"):s("markets.equityVitals.inline"),e.jsxs("span",{style:{color:t.dim,fontWeight:400}
1,children:[" ",S>=0?"+":"",R(S,2),"% vs SPY",_&&C!=null?` · ${C>=0?"+":""}${R(C,2)}% vs ${_}`:""]})]})})]}),e.jsxs("div",{style:Ve,children:[e.jsx("div",{style:Be,children:s("markets.equityVitals.labelWalls")}),f?e.jsxs(e.Fragment,{children:[e.jsx(nl,{lo:w,hi:v,cursor:c,marks:[{v:m,c:"rgba(240,82,79,0.9)"},{v:b,c:"rgba(210,162,76,0.7)"},{v:y,c:"rgba(55,209,131,0.9)"}]}),e.jsxs("div",{style:{...Ue},children:[e.jsx("span",{style:{color:t.red},children:R(m,0)}),b!=null&&e.jsxs("span",{style:{color:t.gold},children:[" · ",R(b,0)]}),e.jsxs("span",{style:{color:t.green},children:[" · ",R(y,0)]})]})]}):e.jsxs("div",{style:{...Ue,marginTop:12,color:t.dim},children:["â ",e.jsx("span",{style:{fontWeight:400},children:s("markets.equityVitals.noOptionsStructure")})]})]})]})}const At={border:`1px solid ${t.border}`,borderRadius:8,background:t.panel,overflow:"hidden",display:"flex",flexDirection:"column",minHeight:0},Dn={padding:"6px 10px",fontFamily:k,fontSize:9.5,letterSpacing:"0.14em",color:t.gold,borderBottom:`1px solid ${t.border2}`,flexShrink:0,display:"flex",alignItems:"center",gap:8},ac=["1m","2m","4m","5m","8m","10m","15m","30m","1h","4h","1d","1w"],dc=["SPY","QQQ","IWM","AAPL","NVDA","TSLA","AMZN","META"],bs=n=>new Date(n*1e3).toLocaleDateString("en-US",{timeZone:"America/New_York"}),Fi=n=>n?new Date(n).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",timeZone:"America/New_York"}):"â";function ot({label:n,children:l}){return e.jsxs("div",{style:{borderTop:`1px solid ${t.border2}`,paddingTop:6,marginTop:7},children:[e.jsx("div",{style:{fontFamily:k,fontSize:8.5,letterSpacing:"0.12em",color:t.dim},children:n}),e.jsx("div",{style:{fontFamily:k,fontSize:13,fontWeight:700,color:t.text,marginTop:1},children:l})]})}function cc({symbol:n}){const l=Ca(n);return e.jsx(ki,{d:l})}function pc({symbol:n}){const{t:l}=W(),s=String(n||"").toUpperCase(),{data:i}=H(()=>Ne(s).catch(()=>null),3e4,[s]),o=!i||i.spot==null&&!(i.gex&&i.gex.net_gex!=null),{data:r}=H(()=>o?Js(s).catch(()=>null):Promise.resolve(null),6e4,[s,o]),a=o&&r&&r.available,p=a?{net_gex:r.net_gexp,regime:r.regime,flip_strike:r.flip,call_wall:r.call_wall,put_wall:r.put_wall}:i?.gex||{},d=a?r.spot:i?.spot,c=p.net_gex!=null?Number(p.net_gex):null,u=p.regime||(c>0?"positive":c<0?"negative":null);if(c==null&&u==null)return null;const h=b=>b!=null&&d?(b-d)/d*100:null,m=b=>{if(b==null)return"â";const f=h(b);return`${R(b,b>1e3?0:2)}${f!=null?` · ${f>=0?"+":""}${R(f,2)}%`:""}`},y=(b,f)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:6,fontFamily:k,fontSize:9.5,lineHeight:1.9},children:[e.jsx("span",{style:{color:t.dim,letterSpacing:"0.08em"},children:b}),e.jsx("span",{style:{textAlign:"right"},children:f})]});return e.jsxs("div",{style:{borderTop:`1px solid ${t.border2}`,paddingTop:8,marginTop:10},children:[e.jsxs("div",{style:{fontFamily:k,fontSize:8,color:t.dim,letterSpacing:"0.12em",fontWeight:800,display:"flex",gap:5},children:[l("markets.equitiesScan.dealerStructure",{defaultValue:"DEALER STRUCTURE"}),a&&e.jsx("span",{style:{color:t.gold,fontSize:7,border:`1px solid ${t.gold}66`,borderRadius:999,padding:"0 5px"},children:"EOD"})]}),y(l("markets.vitals.gammaRegime",{defaultValue:"γ REGIME"}),e.jsx("span",{style:{color:u==="positive"?t.green:u==="negative"?t.red:t.muted,fontWeight:700},children:u==="positive"?l("markets.vitals.posDampen",{defaultValue:"POSITIVE · dampen"}):u==="negative"?l("markets.vitals.negAmplify",{defaultValue:"NEGATIVE · amplify"}):"â"})),y(l("markets.vitals.netGex",{defaultValue:"NET GEX"}),e.jsx("span",{style:{color:c>0?t.green:c<0?t.red:t.muted},children:c!=null?ee(c):"â"})),y(l("markets.equitiesScan.gammaFlip",{defaultValue:"γ-FLIP"}),e.jsx("span",{style:{color:t.text},children:m(p.flip_strike)})),y(l("markets.equitiesScan.callWall",{defaultValue:"CALL WALL"}),e.jsx("span",{style:{color:t.green},children:m(p.call_wall)})),y(l("markets.equitiesScan.putWall",{defaultValue:"PUT WALL"}),e.jsx("span",{style:{color:t.red},children:m(p.put_wall)}))]})}function vs({symbol:n,q:l,em:s}){const{t:i}=W(),o=(l?.change_pct||0)>=0,r=l?.iv_rank!=null?Math.max(0,Math.min(100,Math.round(l.iv_rank*100))):null;return e.jsxs("div",{style:{...At,padding:"12px 12px 14px",overflowY:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(Nn,{sym:n,size:22}),e.jsx("span",{style:{fontSize:20,fontWeight:900,color:t.text,letterSpacing:"0.02em"},children:n})]}),e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim,lineHeight:1.4,minHeight:24,overflow:"hidden"},children:(l?.name||"").toUpperCase()}),e.jsx("div",{style:{fontFamily:k,fontSize:23,fontWeight:800,color:t.text,marginTop:4},children:l?.last!=null?R(l.last,2):"â"}),e.jsxs("div",{style:{fontFamily:k,fontSize:12,fontWeight:700,color:l?.change_pct!=null?o?t.green:t.red:t.dim},children:[l?.change!=null?`${o?"+":""}${R(l.change,2)}`:"â"," · ",l?.change_pct!=null?`${o?"+":""}${R(l.change_pct,2)}%`:"â"]}),l?.earnings_date&&e.jsxs("div",{style:{marginTop:9,fontFamily:k,fontSize:10,
1color:t.gold,border:"1px solid rgba(210,162,76,0.5)",background:"rgba(210,162,76,0.07)",borderRadius:6,padding:"4px 8px",lineHeight:1.5},children:["ER · ",l.earnings_date,s?.expected_move_pct!=null&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),"EM ±",R(s.expected_move_pct,1),"%"]})]}),e.jsxs(ot,{label:i("markets.equitiesScan.labelIvRank"),children:[e.jsx("span",{style:{color:t.gold},children:r??"â"}),e.jsx("div",{style:{height:5,borderRadius:3,background:t.elev,marginTop:4,overflow:"hidden"},children:r!=null&&e.jsx("div",{style:{height:"100%",width:`${r}%`,background:`linear-gradient(90deg, ${t.gold}88, ${t.gold})`,borderRadius:3}})})]}),e.jsx(ot,{label:i("markets.equitiesScan.labelBeta"),children:l?.beta!=null?R(l.beta,2):"â"}),e.jsx(ot,{label:i("markets.equitiesScan.labelDividend"),children:l?.dividend?R(l.dividend,2):"N/A"}),e.jsx(ot,{label:i("markets.equitiesScan.labelVolume"),children:uo(l?.volume)}),l?.regime&&e.jsxs(ot,{label:i("markets.equitiesScan.labelRegime",{defaultValue:"REGIME"}),children:[e.jsx("span",{style:{color:l.regime==="trending_up"?t.green:l.regime==="trending_down"?t.red:t.muted},children:String(l.regime).toUpperCase()}),l.regime_confidence!=null&&e.jsxs("span",{style:{color:t.dim,fontSize:9},children:[" · ",Math.round(l.regime_confidence)]})]}),l?.range_budget?.used_pct!=null&&(()=>{const a=Number(l.range_budget.used_pct),p=a>=100?t.red:a>=75?t.gold:t.green;return e.jsxs(ot,{label:i("markets.equitiesScan.labelRangeBudget",{defaultValue:"RANGE BUDGET"}),children:[e.jsxs("span",{style:{color:p},children:[R(a,0),"%"]}),e.jsxs("span",{style:{color:t.dim,fontSize:9},children:[" ",i("markets.equitiesScan.rangeBudgetOf",{defaultValue:"of 20d range"})]}),e.jsx("div",{style:{height:5,borderRadius:3,background:t.elev,marginTop:4,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.min(100,a)}%`,background:p,borderRadius:3,opacity:.85}})})]})})(),l?.alert_price!=null&&e.jsx(ot,{label:i("markets.equitiesScan.labelAlert"),children:e.jsxs("span",{style:{color:t.blue},children:[R(l.alert_price,2)," · ",Fi(l.alert_time)]})}),e.jsx(pc,{symbol:n}),e.jsx(cc,{symbol:n})]})}
1function js({symbol:n,q:l,em:s}){const{t:i}=W(),{data:o}=H(()=>Ct(n,"5m",96),6e4,[n]),r=o?.candles||[];let a=null,p=null;if(r.length){const y=bs(r[r.length-1].ts);for(const b of r){if(bs(b.ts)!==y)continue;const f=Number(b.high),w=Number(b.low);isFinite(f)&&(a=a==null?f:Math.max(a,f)),isFinite(w)&&(p=p==null?w:Math.min(p,w))}}const d=l?.last,c=l?.prev_close??d,u=s?.expected_move_pct,h=u!=null&&c?c*u/100:null;let m;if(h&&c){const y=c-h,b=c+h;let f=Math.min(y,p??y,d??y),w=Math.max(b,a??b,d??b);const v=(w-f)*.06||1;f-=v,w+=v;const g=_=>`${((_-f)/(w-f)*100).toFixed(1)}%`,x=a!=null&&p!=null?(a-p)/(2*h)*100:null,j=x==null?["â",t.dim]:x<35?[i("markets.equitiesScan.coilCoiling"),t.blue]:x<=100?[i("markets.equitiesScan.coilNormal"),t.muted]:[i("markets.equitiesScan.coilStretched"),t.red];m=e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{position:"relative",height:36,margin:"6px 4px 0"},children:[e.jsx("span",{style:{position:"absolute",left:g(c-h),top:0,transform:"translateX(-50%)",fontFamily:k,fontSize:8,color:t.blue},children:"â1Ï"}),e.jsx("span",{style:{position:"absolute",left:g(c+h),top:0,transform:"translateX(-50%)",fontFamily:k,fontSize:8,color:t.blue},children:"+1Ï"}),e.jsx("div",{style:{position:"absolute",top:13,height:10,borderRadius:5,border:`1px solid ${t.border2}`,background:"linear-gradient(90deg, rgba(240,82,79,0.14), rgba(77,201,230,0.15) 30%, rgba(77,201,230,0.15) 70%, rgba(55,209,131,0.14))",left:g(y),width:`calc(${g(b)} - ${g(y)})`}}),a!=null&&p!=null&&e.jsx("div",{style:{position:"absolute",top:15,height:6,borderRadius:3,background:"rgba(232,228,218,0.32)",left:g(p),width:`calc(${g(a)} - ${g(p)})`}}),d!=null&&e.jsx("div",{style:{position:"absolute",top:9,width:2,height:18,background:t.gold,boxShadow:"0 0 8px rgba(210,162,76,0.8)",left:g(d)}})]}),e.jsxs("div",{style:{fontFamily:k,fontSize:9.5,color:t.muted,padding:"6px 6px 8px"},children:[x!=null?i("markets.equitiesScan.coilRange",{pct:Math.round(x),emPct:R(u,1)}):i("markets.equitiesScan.coilEmOnly",{emPct:R(u,1)})," ",e.jsx("span",{style:{color:j[1],fontWeight:700},children:j[0]})]})]})}else m=e.jsx("div",{style:{fontFamily:k,fontSize:9.5,color:t.dim,padding:"12px 8px",lineHeight:1.7},children:a!=null&&p!=null?e.jsxs(e.Fragment,{children:[i("markets.equitiesScan.coilDayRange",{lo:R(p,2),hi:R(a,2)}),e.jsx("br",{}),i("markets.equitiesScan.coilNoEm")]}):i("markets.equitiesScan.coilArmsEmpty")});return e.jsxs("div",{style:At,children:[e.jsx("div",{style:Dn,children:i("markets.equitiesScan.coilTitle")}),m]})}function ks({onSymbol:n}){const{t:l}=W(),{data:s}=H(()=>Ir(),15e3,[]),{hover:i,show:o,hide:r}=In(),a=(s?.gainers||[]).slice(0,6),p=(s?.losers||[]).slice(0,6),d=Math.max(a.length,p.length),c=Math.max(1e-9,...a.map(m=>Math.abs(m.change_pct||0)),...p.map(m=>Math.abs(m.change_pct||0))),u=Math.max(1,...a.map(m=>m.dollar_volume||0),...p.map(m=>m.dollar_volume||0)),h=(m,y)=>{if(!m)return e.jsx("span",{});const b=Math.max(8,Math.abs(m.change_pct||0)/c*100),f=.45+.55*((m.dollar_volume||0)/u),w=y==="pos"?t.green:t.red,v=Math.min(97,b);return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{r(),n?.(m.symbol)},onKeyDown:g=>{g.key==="Enter"&&(r(),n?.(m.symbol))},onMouseEnter:g=>o(m.symbol,{},g.currentTarget.getBoundingClientRect()),onMouseLeave:r,onBlur:r,title:`${m.symbol} â ${l("markets.equitiesScan.clickToLoadChart")}`,style:{position:"relative",height:15,cursor:"pointer",minWidth:0},children:[e.jsx("div",{style:{position:"absolute",top:2,bottom:2,borderRadius:3,width:`${v}%`,opacity:f,[y==="pos"?"left":"right"]:0,background:y==="pos"?"linear-gradient(90deg, rgba(55,209,131,0.75), rgba(55,209,131,0.15))":"linear-gradient(270deg, rgba(240,82,79,0.75), rgba(240,82,79,0.15))"}}),e.jsxs("span",{style:{position:"absolute",[y==="pos"?"right":"left"]:2,top:0,lineHeight:"15px",fontFamily:k,fontSize:9,fontWeight:700,color:w,whiteSpace:"nowrap",textShadow:"0 0 4px rgba(10,13,17,0.95), 0 1px 6px rgba(10,13,17,0.9)"},children:[m.symbol," ",m.change_pct!=null?`${m.change_pct>=0?"+":""}${R(m.change_pct,1)}%`:""]})]})};return e.jsxs("div",{style:At,children:[i&&e.jsx(Mn,{hover:i}),e.jsxs("div",{style:Dn,children:[l("markets.equitiesScan.ladderTitle"),s?.stale&&s?.session&&e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:8.5,fontWeight:700,letterSpacing:"0.06em",color:"#E0C27A",background:"rgba(210,162,76,0.12)",border:"1px solid rgba(210,162,76,0.35)",borderRadius:4,padding:"1px 6px"},children:l("markets.dollarFlow.lastSessionChip",{date:s.session})})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"7px 10px",display:"flex",flexDirection:"column",gap:4},children:[d===0&&e.jsx("div",{style:{fontFamily:k,fontSize:9.5,color:t.dim,padding:"8px 2px"},children:l("markets.equitiesScan.ladderArmsEmpty")}),Array.from({length:d}).map((m,y)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1fr) 14px minmax(0,1fr)",alignItems:"center",gap:4},children:[h(p[y],"neg"),e.jsx("span",{style:{width:2,height:13,background:t.border2,justifySelf:"center"}}),h(a[y],"pos")]},y))]})]})}const uc=(n,l)=>({fontFamily:k,fontSize:9.5,fontWeight:700,padding:"2px 7px",borderRadius:5,cursor:"pointer",background:l?"rgba(210,162,76,0.16)":t.panel2,border:`1px solid ${l||n===2?t.gold:n===1?"rgba(210,162,76,0.5)":t.border2}`,color:l||n===2?t.gold:n===1?t.text:t.muted,boxShadow:n===2?"0 0 12px rgba(210,162,76,0.4)":n===1?"0 0 7px rgba(210,162,76,0.18)":"none"});function ws({active:n,onSymbol:l}){const{t:s}=W(),{data:i}=H(()=>Mr({per_day:8}),12e4,[]),o=(i?.days||[]).slice(0,10),r=i?.meta||{},{hover:a,show:p,hide:d}=In(),c=new Date().toLocaleDateString("en-CA",{timeZone:"America/Ne
1w_York"}),u=(h,m,y,b=6)=>e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,alignContent:"flex-start"},children:[(m||[]).slice(0,b).map(f=>{const w=r[f]||{},v=n&&String(n).toUpperCase()===String(f).toUpperCase();return e.jsxs("button",{onClick:()=>{d(),l?.(f)},onMouseEnter:g=>p(f,{date:h.date,sessionLabel:y,name:w.name,mcap:w.mcap},g.currentTarget.getBoundingClientRect()),onMouseLeave:d,onFocus:g=>p(f,{date:h.date,sessionLabel:y,name:w.name,mcap:w.mcap},g.currentTarget.getBoundingClientRect()),onBlur:d,title:`${f} â ${s("markets.equitiesScan.clickToLoadChart")}`,style:{...uc(ho(w.mcap),v),display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(Nn,{sym:f,size:12}),f]},f)}),(m||[]).length>b&&e.jsxs("span",{title:(m||[]).slice(b).join(" · "),style:{fontFamily:k,fontSize:9,color:t.dim,alignSelf:"center"},children:["+",m.length-b]})]});return e.jsxs("div",{style:{...At,flex:"0 0 auto"},children:[a&&e.jsx(Mn,{hover:a}),e.jsx("div",{style:Dn,children:s("markets.equitiesScan.earningsHorizonTitle")}),e.jsxs("div",{style:{display:"flex",overflowX:"auto",minHeight:0},onScroll:d,children:[o.length===0&&e.jsx("div",{style:{fontFamily:k,fontSize:9.5,color:t.dim,padding:"14px 12px"},children:s("markets.equitiesScan.earningsNone")}),o.map(h=>{const m=h.date===c;return e.jsxs("div",{style:{flex:"0 0 128px",minWidth:128,borderLeft:`1px dashed ${t.border2}`,padding:"6px 8px 8px",display:"flex",flexDirection:"column",gap:0},children:[e.jsxs("div",{style:{fontFamily:k,fontSize:8.5,letterSpacing:"0.08em",fontWeight:800,color:m?t.gold:t.blue,marginBottom:5,whiteSpace:"nowrap"},children:[m?"â ":"",mo(h.date).toUpperCase()]}),e.jsxs("div",{style:{minHeight:56,display:"flex",flexDirection:"column",gap:3},children:[e.jsx("span",{style:{fontFamily:k,fontSize:7.5,letterSpacing:"0.12em",color:t.dim},children:s("markets.equitiesScan.bmoShort")}),u(h,h.bmo,s("markets.equitiesScan.bmoLabel"))]}),e.jsx("div",{style:{borderTop:`1px solid ${t.border2}`,margin:"5px -8px"}}),e.jsxs("div",{style:{minHeight:56,display:"flex",flexDirection:"column",gap:3},children:[e.jsx("span",{style:{fontFamily:k,fontSize:7.5,letterSpacing:"0.12em",color:t.dim},children:s("markets.equitiesScan.amcShort")}),u(h,h.amc,s("markets.equitiesScan.amcLabel"))]}),(h.tbd||[]).length>0&&e.jsxs("div",{style:{marginTop:4,opacity:.65},children:[e.jsxs("span",{style:{fontFamily:k,fontSize:7.5,letterSpacing:"0.12em",color:t.dim},children:[s("markets.equitiesScan.tbdShort")," "]}),u(h,h.tbd,s("markets.equitiesScan.tbdLabel"),3)]})]},h.date)})]}),e.jsx("div",{style:{fontFamily:k,fontSize:8,letterSpacing:"0.08em",color:t.dim,padding:"4px 10px 6px",borderTop:`1px solid ${t.border2}`},children:s("markets.equitiesScan.earningsHint")})]})}function mc(n){const l=String(n.alert_type||n.kind||"").toLowerCase(),s=[],i=(o,r)=>{s.some(([a])=>a===o)||s.push([o,r])};return l.includes("halt")&&i("HALT",t.red),l.includes("gap")&&i("GAP",t.gold),(l.includes("vol")||l.includes("spike")||l.includes("surge"))&&i("RVOL",t.blue),l.includes("52w")&&i(l.includes("low")?"52W â¼":"52W â²",l.includes("low")?t.red:t.green),(l.includes("orb")||l.includes("opening"))&&i("ORB",t.gold),(l.includes("premarket")||l.startsWith("pre"))&&i("PRE",t.slate),!s.length&&l&&i(l.replace(/_/g," ").toUpperCase().slice(0,10),t.slate),s}function hc({sym:n,cacheRef:l}){const s=$.useRef(null),[i,o]=$.useState(null);return $.useEffect(()=>{let r=!0;const a=l.current.get(n);return a&&Date.now()-a.t<3e5?(o(a.c),()=>{r=!1}):(Ct(n,"5m",12).then(p=>{if(!r)return;const d=(p?.candles||[]).map(c=>Number(c.close)).filter(c=>isFinite(c));l.current.set(n,{t:Date.now(),c:d}),o(d)}).catch(()=>{r&&o([])}),()=>{r=!1})},[n,l]),$.useEffect(()=>{const r=s.current;if(!r||!i||i.length<3)return;const a=r.getContext("2d");a.clearRect(0,0,r.width,r.height);const p=Math.min(...i),d=Math.max(...i),c=d-p||1;a.strokeStyle=i[i.length-1]>=i[0]?"rgba(55,209,131,0.85)":"rgba(240,82,79,0.85)",a.beginPath(),i.forEach((u,h)=>{const m=h/(i.length-1)*(r.width-2)+1,y=r.height-2-(u-p)/c*(r.height-4);h?a.lineTo(m,y):a.moveTo(m,y)}),a.stroke()},[i]),i&&i.length<3?null:e.jsx("canvas",{ref:s,width:52,height:14,style:{flexShrink:0}})}function Ss({onSymbol:n}){const{t:l}=W(),{data:s}=H(()=>Zs({limit:60}),8e3,[]),i=s&&(s.alerts||s.recent)||[],o=$.useRef(new Map),{hover:r,show:a,hide:p}=In();return e.jsxs("div",{style:{...At,flex:1},children:[r&&e.jsx(Mn,{hover:r}),e.jsxs("div",{style:Dn,children:[l("markets.equitiesScan.tapeTitleSuffix")," ",e.jsx("span",{style:{marginLeft:"auto",color:t.dim},children:i.length})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto"},onScroll:p,children:[i.length===0&&e.jsx("div",{style:{fontFamily:k,fontSize:9.5,color:t.dim,padding:"14px 12px"},children:l("markets.equitiesScan.tapeArmsEmpty")}
1),i.map((d,c)=>{const u=d.change_pct,h=d.price!=null?d.price:d.last;return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{p(),n?.(d.symbol)},onKeyDown:m=>{m.key==="Enter"&&(p(),n?.(d.symbol))},style:{display:"flex",alignItems:"center",gap:6,padding:"3.5px 10px",fontFamily:k,fontSize:10.5,borderBottom:"1px solid rgba(31,39,51,0.6)",cursor:"pointer"},children:[e.jsx("span",{style:{width:34,color:t.dim,fontSize:9.5,flexShrink:0},children:Fi(d.ts||d.created_at)}),e.jsx("span",{onMouseEnter:m=>a(d.symbol,{},m.currentTarget.getBoundingClientRect()),onMouseLeave:p,style:{width:44,fontWeight:800,flexShrink:0,color:u>0?t.green:u<0?t.red:t.text},children:d.symbol}),e.jsx("span",{style:{width:48,textAlign:"right",color:t.muted,flexShrink:0},children:h!=null?R(h,2):"â"}),e.jsx("span",{style:{width:46,textAlign:"right",flexShrink:0,color:u>0?t.green:u<0?t.red:t.dim},children:u!=null?`${u>=0?"+":""}${R(u,1)}%`:"â"}),e.jsxs("span",{style:{display:"flex",gap:3,flexShrink:1,minWidth:0,overflow:"hidden"},children:[mc(d).map(([m,y])=>e.jsx("span",{style:{fontSize:7.5,letterSpacing:"0.06em",borderRadius:3,padding:"0 4px",color:y,border:`1px solid ${y}66`,whiteSpace:"nowrap"},children:m},m)),d.volatility!=null&&e.jsxs("span",{style:{fontSize:7.5,color:t.dim,alignSelf:"center",whiteSpace:"nowrap"},children:[R(d.volatility,1),"%"]})]}),e.jsx("span",{style:{marginLeft:"auto",flexShrink:0},children:c<12&&e.jsx(hc,{sym:d.symbol,cacheRef:o})})]},c)})]})]})}function gc({symbol:n,tf:l,q:s,onSymbol:i,onSetTf:o,phone:r=!1,narrow:a=!1,vis:p=null}){const{t:d}=W(),{data:c}=H(()=>$t(n),6e4,[n]),{data:u}=H(()=>Ks(String(n||"SPY").toUpperCase()).catch(()=>null),3e4,[n]),{data:h}=H(()=>qs(String(n||"SPY").toUpperCase()).catch(()=>null),36e5,[n]),m=e.jsxs("div",{style:{...At,height:"100%"},children:[e.jsx(Nl,{symbol:n,tf:l,onSymbol:i,onTf:o,presets:dc,tfs:ac,searchable:!0,right:e.jsxs(e.Fragment,{children:[c?.expected_move_pct!=null?e.jsx("span",{style:{color:t.blue,fontFamily:k,fontSize:10.5},children:d("markets.equitiesScan.expectedMoveChip",{pct:R(c.expected_move_pct,1)})}):null,e.jsx(vn,{symbol:n})]})}),e.jsx("div",{style:{flex:1,minHeight:0},onMouseLeave:_l,children:e.jsx(Bt,{symbol:n,tf:l,height:"100%",prefScope:"equities",onReady:Tl})})]});return r?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsx(vs,{symbol:n,q:s,em:c}),e.jsx("div",{style:{height:300,display:"flex",flexDirection:"column",flexShrink:0},children:m}),e.jsx(ys,{symbol:n,q:s}),e.jsx("div",{style:{height:300,display:"flex",flexDirection:"column",flexShrink:0},children:e.jsx(vl,{symbol:n})}),e.jsx(js,{symbol:n,q:s,em:c}),e.jsx("div",{style:{height:190,display:"flex",flexShrink:0},children:e.jsx(ks,{onSymbol:i})}),e.jsx(ws,{active:n,onSymbol:i}),e.jsx("div",{style:{height:340,display:"flex",flexShrink:0},children:e.jsx(Ss,{onSymbol:i})})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,height:"100%",minHeight:0},children:e.jsx(Oe,{id:"sa-equities-cols",style:{flex:1,minHeight:0},layoutEpoch:p.layoutEpoch,columns:[{hidden:p.isHidden("rail")&&p.isHidden("stackdial"),node:e.jsx(tt,{id:"sa-equities-rail-rows-v1",layoutEpoch:p?.layoutEpoch,rows:[{id:"rail",defaultSize:"64%",minSize:"30%",hidden:p?.isHidden("rail"),node:e.jsx(X,{id:"rail",vis:p,style:{height:"100%",minHeight:0,overflow:"auto"},children:e.jsx(vs,{symbol:n,q:s,em:c})})},{id:"stackdial",defaultSize:"36%",minSize:"16%",hidden:p?.isHidden("stackdial"),node:e.jsx(X,{id:"stackdial",vis:p,style:{height:"100%",minHeight:0},children:e.jsx(vl,{symbol:n})})}]}),defaultSize:a?"13%":"12%",minSize:"8%"},{hidden:p.isHidden("chart")&&p.isHidden("marketctx")&&p.isHidden("vitals")&&p.isHidden("setups"),node:e.jsx(tt,{id:"sa-equities-center-rows-v1",layoutEpoch:p?.layoutEpoch,rows:[{id:"chart",defaultSize:"62%",minSize:"32%",hidden:p?.isHidden("chart"),node:e.jsx(X,{id:"chart",vis:p,style:{height:"100%",minHeight:0,overflow:"hidden"},children:m})},{id:"marketctx",defaultSize:"15%",minSize:"10%",hidden:p?.isHidden("marketctx"),node:e.jsx(X,{id:"marketctx",vis:p,style:{height:"100%",minHeight:0,overflow:"auto"},children:e.jsx(ai,{ctx:u,sue:h})})},{id:"vitals",defaultSize:"11%",minSize:"9%",hidden:p?.isHidden("vitals"),node:e.jsx(X,{id:"vitals",vis:p,style:{height:"100%",minHeight:0,overflow:"auto"},children:e.jsx(ys,{symbol:n,q:s})})},{id:"setups",defaultSize:"12%",minSize:"10%",hidden:p?.isHidden("setups"),node:e.jsx(X,{id:"setups",vis:p,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,height:"100%",minHeight:0},children:[e.jsx(js,{symbol:n,q:s,em:c}),e.jsx(ks,{onSymbol:i})]})})}]}),defaultSize:a?"65%":"66%",minSize:"30%"},{hidden:p.isHidden("earnings")&&p.isHidden("tape"),node:e.jsx(tt,{id:"sa-equities-right-rows-v1",layoutEpoch:p?.layoutEpoch,rows:[{id:"earnings",defaultSize:"38%",minSize:"22%",hidden:p?.isHidden("earnings"),node:e.jsx(X,{id:"earnings",vis:p,style:{height:"100%",minHeight:0,overflow:"auto"},children:e.jsx(ws,{active:n,onSymbol:i})})},{id:"tape",defaultSize:"62%",minSize:"28%",hidden:p?.isHidden("tape"),node:e.jsx(X,{id:"tape",vis:p,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsx(Ss,{onSymbol:i})})}]}),defaultSize:"22%",minSize:"12%"}]})})}const wt=n=>n==null?null:`$${(n/1e9).toFixed(0)}B`,_s=n=>n==null?null:`${n>0?"+":""}${Number(n).toFixed(1)}%`;
1function Ts({symbol:n="SPY",tf:l="5m",onSetSymbol:s,onSetTf:i,vis:o=null}){const{t:r}=W(),{data:a}=H(()=>cl(n),6e3,[n]),p=$.useMemo(()=>a||{},[a]),d=Fl(),c=Kt(),u=d<1536,h=f=>s?.(f),{data:m}=H(()=>zr().catch(()=>null),6e4,[]),{data:y}=H(()=>Wr().catch(()=>null),3e5,[]),b=$.useMemo(()=>{if(!m?.n)return null;const f=[],w=m.up_dvol,v=m.down_dvol;if(w&&v){const x=w/v;x>=1.5?f.push(r("markets.equitiesScan.flowReadIn",{defaultValue:"money flowing IN ({{up}} up vs {{dn}} down $vol)",up:wt(w),dn:wt(v)})):x<=.67?f.push(r("markets.equitiesScan.flowReadOut",{defaultValue:"money flowing OUT ({{up}} up vs {{dn}} down $vol)",up:wt(w),dn:wt(v)})):f.push(r("markets.equitiesScan.flowReadFlat",{defaultValue:"dollar flow balanced ({{up}} up vs {{dn}} down)",up:wt(w),dn:wt(v)}))}m.advancing!=null&&m.declining!=null&&f.push(r("markets.equitiesScan.flowReadBreadth",{defaultValue:"breadth {{a}} adv / {{d}} dec",a:m.advancing,d:m.declining}));const g=y?.groups||[];if(g.length>=2){const x=[...g].filter(E=>E?.perf?.["1D"]!=null).sort((E,T)=>T.perf["1D"]-E.perf["1D"]),j=x[0],_=x[x.length-1];j&&j.perf["1D"]>0&&f.push(r("markets.equitiesScan.flowReadBuyers",{defaultValue:"buyers in {{s}} {{p}}",s:j.sector,p:_s(j.perf["1D"])})),_&&_!==j&&_.perf["1D"]<0&&f.push(r("markets.equitiesScan.flowReadSellers",{defaultValue:"selling in {{s}} {{p}}",s:_.sector,p:_s(_.perf["1D"])}))}return((m.new_high||0)>=20||(m.new_low||0)>=20)&&f.push(r("markets.equitiesScan.flowReadHighsLows",{defaultValue:"{{h}} new highs vs {{l}} lows",h:m.new_high??0,l:m.new_low??0})),f.length?f.slice(0,4).join(" · "):null},[m,y,r]);return $.useEffect(()=>(lt(b),()=>lt(null)),[b]),e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:e.jsx(gc,{symbol:n,tf:l,q:p,onSymbol:h,onSetTf:i,phone:c,narrow:u,vis:o})})}const xc=[{id:"rail",label:"Instrument Rail"},{id:"stackdial",label:"The Stack · Alignment (dial)"},{id:"chart",label:"Chart",group:"Center"},{id:"marketctx",label:"Market Context (VRP · RS · skew)",group:"Center"},{id:"vitals",label:"Equity Vitals",group:"Center"},{id:"setups",label:"Coil + Diverging Ladder",group:"Center"},{id:"earnings",label:"Earnings Horizon",group:"Right"},{id:"tape",label:"Evidence Tape",group:"Right"},{id:"sigfeed",label:"Command Rail",group:"Signals rail"}],fc=["rrp:sa-equities-shell-cols-v1","rrp:sa-equities-cols","rrp:sa-equities-rail-rows-v1","rrp:sa-equities-center-rows-v1","rrp:sa-equities-right-rows-v1","rrp:sa-equities-signal-rows-v1"],sl={insider_buy:["Insider Buy",t.green],pos_news:["News +","rgba(232,228,218,0.8)"],new_13f:["New 13F",t.gold],options_bullish:["Options Flow",t.amber]},yc={pos_news:"rgba(255,255,255,0.06)",new_13f:"rgba(210,162,76,0.12)"},bc=n=>n>=4?t.green:n>=3?"#e6d24a":n>=2?t.amber:t.muted,vc={insider_buy:"markets.whatsMoving.sigInsiderBuy",pos_news:"markets.whatsMoving.sigNewsPlus"};function jc(){const{t:n}=W(),[l,s]=$.useState(2),{data:i}=H(()=>Dr({limit:120,min_signals:1}),6e4,[]),r=(i&&i.movers||[]).filter(a=>(a.n_signals||0)>=l);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:800,color:t.text,display:"flex",alignItems:"center",gap:6},children:[n("markets.whatsMoving.title")," ",e.jsx(ie,{topic:"whats moving",size:14})]}),e.jsxs("div",{style:{fontSize:11,color:t.dim},children:[n("markets.whatsMoving.confluencePrefix"),i?.scan_date?` · ${i.scan_date}`:""]}),e.jsx("div",{style:{marginLeft:"auto",display:"flex",gap:4},children:[1,2,3].map(a=>e.jsx("button",{onClick:()=>s(a),style:{fontSize:11,padding:"3px 9px",borderRadius:5,cursor:"pointer",fontWeight:700,border:`1px solid ${l===a?t.gold:t.border2}`,background:l===a?"rgba(210,162,76,0.14)":"transparent",color:l===a?t.gold:t.muted},children:n("markets.whatsMoving.nPlusSignals",{n:a})},a))})]}),e.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{position:"sticky",top:0,background:t.panel2,zIndex:1},children:e.jsx("tr",{children:["SYMBOL","SCORE","SIGNALS","DETAIL"].map((a,p)=>e.jsx("th",{style:{textAlign:p===0||p===2?"left":"right",padding:"6px 10px",color:t.muted,fontFamily:"Inter",fontSize:10,fontWeight:700,borderBottom:`1px solid ${t.border2}`},children:a},a))})}),e.jsxs("tbody",{children:[r.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,style:{padding:24,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:n("markets.whatsMoving.emptyState",{minSig:l})})}),r.map(a=>{const p=a.components||{},d=(a.signals||[]).map(c=>{const u=p[c]||{};return`${sl[c]?sl[c][0]:c}${u.n?`Ã${u.n}`:""}${u.last?` (${u.last})`:""}`}).join(" · ");return e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[e.jsx("td",{style:{padding:"5px 10px",fontWeight:900,color:t.text},children:a.symbol}),e.jsx("td",{style:{padding:"5px 10px",textAlign:"right",fontWeight:900,color:b
1c(a.score)},children:a.score}),e.jsx("td",{style:{padding:"5px 10px"},children:e.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:(a.signals||[]).map(c=>{const[u,h]=sl[c]||[c,t.muted],m=vc[c],y=yc[c]||"transparent";return e.jsx("span",{style:{fontSize:9.5,fontWeight:800,fontFamily:"Inter",color:h,background:y,border:`1px solid ${c==="pos_news"?"rgba(232,228,218,0.2)":c==="new_13f"?"rgba(210,162,76,0.3)":h}`,borderRadius:4,padding:"1px 6px"},children:m?n(m):u},c)})})}),e.jsx("td",{style:{padding:"5px 10px",textAlign:"right",color:t.muted,fontSize:11},children:d})]},a.symbol)})]})]})})]})}let il=20260711;const Qe=()=>(il=(il*1664525+1013904223)%4294967296,il/4294967296),kc=()=>{const n=[["SPY",754.2],["QQQ",725.9],["NVDA",210.4],["TSLA",408.6],["AAPL",314.2],["META",675.8],["AMZN",226.4],["MSFT",505.1]],l=[];let s=Date.now()*1e6;for(let r=0;r<16;r++){const[a,p]=n[Math.floor(Qe()*n.length)],d=Math.round((15+Qe()*260)*1e3/100)*100,c=+(p*(1+(Qe()-.5)*.002)).toFixed(2),u=d*c;s-=(30+Qe()*240)*1e9,l.push({ts_ns:s,underlying:a,price:c,size:d,notional:u,pct_vs_spot:+((Qe()-.5)*.22).toFixed(2),is_block:u>=5e6})}const i=[];for(let r=0;r<13;r++){const a=+(757-r*.75).toFixed(2),p=(a-754)/2.2;i.push({price:a,volume:Math.round(24e5*Math.exp(-p*p)+Qe()*22e4)})}const o=n.map(([r],a)=>({underlying:r,notional:Math.round((340-a*34+Qe()*40)*1e6),blocks:Math.max(0,Math.round(9-a*1.1+Qe()*2))})).sort((r,a)=>a.notional-r.notional);return{tape:l,levels:i,poc:754.75,summary:o}},an=kc(),rl=({label:n})=>e.jsx("span",{style:{position:"absolute",top:6,right:8,zIndex:2,fontFamily:k,fontSize:8.5,fontWeight:800,letterSpacing:"0.18em",color:"rgba(210,162,76,0.85)",padding:"2px 7px",borderRadius:4,background:"rgba(11,12,14,0.85)",border:"1px dashed rgba(210,162,76,0.5)",pointerEvents:"none"},children:n});function wc({symbol:n="SPY",onGoTape:l=null,vis:s=null}){const{t:i}=W(),[o,r]=$.useState(!0),[a,p]=$.useState(!1),d=String(n).toUpperCase(),c=o?d:"all",{data:u}=H(()=>Lr({scope:c,limit:150,blocks_only:a}),4e3,[c,a]),{data:h}=H(()=>Or(d),8e3,[d]),{data:m}=H(()=>Pr(18),8e3,[]),y=u?.tape||[],b=(h||{}).levels||[],f=m?.symbols||[],w=y.length===0&&b.length===0&&f.length===0&&u!==void 0,v=w?an.tape:y,g=(w?an.levels:b).slice().sort((C,I)=>I.price-C.price),x=w?an.summary:f,j=Math.max(1,...g.map(C=>C.volume)),_=w?an.poc:(h||{}).poc,E=v.reduce((C,I)=>C+(Number(I.notional)||0),0),T=v.filter(C=>C.is_block).length,S=i("markets.darkpool.sampleTag");return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[w&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap",marginBottom:10,padding:"10px 14px",borderRadius:10,background:"rgba(210,162,76,0.06)",border:"1px solid rgba(210,162,76,0.35)"},children:[e.jsxs("div",{style:{minWidth:260,flex:1},children:[e.jsxs("div",{style:{fontFamily:k,fontSize:11,fontWeight:800,letterSpacing:"0.14em",color:"#D2A24C",display:"flex",alignItems:"center",gap:8},children:["â ",i("markets.darkpool.previewTitle"),e.jsx(ie,{topic:"dark pool",size:14})]}),e.jsx("div",{style:{fontSize:11.5,color:"#A7AFBC",lineHeight:1.55,marginTop:4,maxWidth:860},children:i("markets.darkpool.previewBody")})]}),l&&e.jsxs("button",{onClick:l,style:{flexShrink:0,fontSize:11.5,fontWeight:800,letterSpacing:"0.06em",padding:"9px 16px",borderRadius:8,cursor:"pointer",color:"#D2A24C",background:"rgba(210,162,76,0.14)",border:"1px solid #D2A24C"},children:[i("markets.darkpool.previewCta")," â"]})]}),e.jsx(X,{id:"dpkpis",vis:s,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:8,marginBottom:8},children:[e.jsx(dn,{label:i("markets.darkpool.kpiDollar"),value:ee(E),color:t.magenta,sample:w&&S}),e.jsx(dn,{label:i("markets.darkpool.kpiBlocks"),value:je(T),color:t.amber,sample:w&&S}),e.jsx(dn,{label:`${d} POC`,value:_!=null?R(_,2):"â",color:t.blue,sample:w&&S}),e.jsx(dn,{label:i("markets.darkpool.kpiPrints"),value:je(v.length),color:t.text,sample:w&&S})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8,flexWrap:"wrap"},children:[e.jsx(ie,{topic:"dark pool",size:15}),e.jsx("button",{onClick:()=>r(C=>!C),style:Es(t.blue,o),children:o?d:"ALL"}),e.jsx("button",{onClick:()=>p(C=>!C),style:Es(t.amber,a),children:i("markets.darkpool.blocksOnly")}),e.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:t.muted,display:"flex",alignItems:"center",gap:6},children:[e.jsx(Cn,{on:!w&&v.length>0})," ",w?i("markets.darkpool.previewStatus"):`${i("markets.darkpool.offExchange")} · ${v.length}`]})]}),e.jsx(Oe,{id:"sa-darkpool-cols-v1",layoutEpoch:s?.layoutEpoch,style:{flex:1,minHeight:0},columns:[{id:"tape",defaultSize:"60%",minSize:"35%",hidden:s?.isHidden("dptape"),node:e.jsx(X,{id:"dptape",vis:s,style:{height:"100%",minWidth:0,minHeight:0},children:e.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8,position:"relative"},children:[w&&e.jsx(rl,{label:S}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{position:"sticky",top:0,background:t.panel2,zIndex:1},children:e.jsx("tr",{children:["TIME","TICK","PRICE","SIZE","NOTIONAL","%SPOT",""].map((C,I)=>e.jsx("th",{style:{textAlign:I===1?"left":"right",padding:"6px 8px",color:t.muted,fontFamily:"Inter",fontSize:10,fontWeight:700,borderBottom:`1px solid ${t.border2}`},children:C},C+I))})}),e.jsxs("tbody",{children:[v.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:7,style:{padding:24,textAlign:"center",color:t.dim,fontFamily:"Inter",lineHeight:1.5},children:[i("markets.darkpool.noDataLine1"),e.jsx("br",{}),i("markets.darkpool.noDataLine2")]})}),v.map((C,I)=>e.jsxs("tr",{style:{background:C.is_block?"rgba(255,170,0,0.07)":"transparent",borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[e.jsx(at,{children:An(C.ts_ns)}),e.jsx(at,{align:"left",bold:!0,color:t.magenta,children:C.underlying}),e.jsx(at,{children:R(C.price,2)}),e.jsx(at,{children:je(C.size)}),e.jsx(at,{bold:!0,children:ee(C.notional)}),e.jsx(at,{color:C.pct_vs_spot>0?t.green:C.pct_vs_spot<0?t.red:t.muted,children:C.pct_vs_spot!=null?`${C.pct_vs_spot>0?"+":""}${R(C.pct_vs_spot,2)}`:"â"}),e.jsx(at,{color:t.amber,children:C.is_block?"â£":""})]},(C.ts_ns||0)+"|"+I))]})]})]})})},{id:"context",defaultSize:"40%",minSize:"25%",hidden:s?.isHidden("dpprofile")&&s?.isHidden("dpleaders"),node:e.jsx(tt,{id:"sa-darkpool-right-rows-v1",layoutEpoch:s?.layoutEpoch,rows:[{id:"profile",defaultSize:"52%",minSize:"25%",hidden:s?.isHidden("dpprofile"),node:e.jsx(X,{id:"dpprofile",vis:s,style:{height:"100%",minHeight:0},children:e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8,padding:"8px 10px",position:"relative"},children:[w&&e.jsx(rl,{label:S}),e.jsxs("div",{style:{fontSize:11,fontWeight:800,color:t.text,marginBottom:6},children:[w?"SPY":d," · ",i("markets.darkpool.volumeProfile")]}),g.length===0&&e.jsx("div",{style:{color:t.dim,fontSize:12,fontFamily:"Inter"},children:"â"}),g.map(C=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,fontFamily:k,marginBottom:1},children:[e.jsx("span",{style:{width:56,textAlign:"right",color:C.price===_?t.amber:t.muted,fontWeight:C.price===_?800:400},children:R(C.price,2)}),e.jsx("div",{style:{flex:1,height:11,background:"#10141A",borderRadius:2},children:e.jsx("div",{style:{width:`${C.volume/j*100}%`,height:"100%",background:C.price===_?t.amber:t.magenta,borderRadius:2,opacity:.8}})}),e.jsx("span",{style:{width:52,textAlign:"right",color:t.dim},children:je(C.volume)})]},C.price))]})})},{id:"leaders",defaultSize:"48%",minSize:"25%",hidden:s?.isHidden("dpleaders"),node:e.jsx(X,{id:"dpleaders",vis:s,style:{height:"100%",minHeight:0},children:e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8,padding:"8px 10px",position:"relative"},children:[w&&e.jsx(rl,{label:S}),e.jsx("div",{style:{fontSize:11,fontWeight:800,color:t.text,marginBottom:6},children:i("markets.darkpool.topNames")}),x.length===0&&e.jsx("div",{style:{color:t.dim,fontSize:12,fontFamily:"Inter"},children:"â"}),x.map(C=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,fontFamily:k,padding:"2px 0"},children:[e.jsx("span",{style:{width:52,fontWeight:800,color:t.magenta},children:C.underlying}),e.jsx("span",{style:{marginLeft:"auto",color:t.text},children:ee(C.notional)}),e.jsx("span",{style:{width:44,textAlign:"right",color:t.amber,fontSize:11},children:C.blocks?`${C.blocks}â£`:""})]},C.underlying))]})})}]})}]})]})}const Es=(n,l)=>({fontSize:11,padding:"4px 10px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${l?n:t.border2}`,background:l?`${n}22`:"transparent",color:l?n:t.muted}),at=({children:n,align:l="right",color:s=t.text,bold:i=!1})=>e.jsx("td",{style:{textAlign:l,padding:"4px 8px",color:s,fontWeight:i?700:400,whiteSpace:"nowrap"},children:n}),dn=({label:n,value:l,color:s,sample:i=!1})=>{const o=Fe(n);return e.jsxs("div",{title:o||void 0,style:{background:t.panel,border:`1px solid ${t.border}`,borderRadius:8,padding:"8px 12px",cursor:"default",position:"relative"},children:[i&&e.jsx("span",{style:{position:"absolute",top:5,right:7,fontFamily:k,fontSize:7.5,fontWeight:800,letterSpacing:"0.16em",color:"rgba(210,162,76,0.55)"},children:i}
1),e.jsx("div",{style:{fontSize:10,color:t.muted,fontWeight:700,letterSpacing:.4,display:"inline-block",borderBottom:o?"1px dotted rgba(255,255,255,0.22)":void 0,paddingBottom:o?1:0},children:n}),e.jsx("div",{style:{fontSize:18,fontWeight:800,color:s,fontFamily:k},children:l})]})},Sc=[["skew","SKEW (crash bid)"],["cpiv","CPIV (call-put IV)"],["iv_innov","ÎIV (innovation)"]];function _c(){const{t:n}=W(),{data:l}=H(()=>Hr().catch(()=>null),3e5,[]),s=l||{},i=s.names||[],o=i.length>0,r=(a,p)=>i.filter(d=>d[`${a}_rank`]===p).slice(0,8).map(d=>d.symbol).join(" ");return e.jsxs("div",{style:{padding:12,borderRadius:10,border:`1px solid ${t.border}`,background:t.panel,marginTop:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:6},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.12em",color:t.muted},children:n("markets.xsection.title",{defaultValue:"CROSS-SECTIONAL IV SCREEN"})}),e.jsx(ie,{topic:"iv screen",size:14}),o&&e.jsx("span",{style:{fontFamily:k,fontSize:7.5,color:t.dim,border:`1px solid ${t.line}`,borderRadius:4,padding:"1px 6px"},children:n("markets.xsection.snapChip",{defaultValue:"{{n}} names · {{date}} · NOT VALIDATED (record accruing)",n:i.length,date:s.snap_date})})]}),o?e.jsxs("div",{style:{display:"grid",gap:6},children:[Sc.map(([a,p])=>{const d=(s.record||{})[a]||{},c=d[1],u=d[10];return e.jsxs("div",{children:[e.jsxs("div",{style:{fontFamily:k,fontSize:8,fontWeight:800,color:t.muted,letterSpacing:"0.08em"},children:[p,c&&u&&c.n>=30&&e.jsx("span",{style:{fontWeight:400,color:t.dim,marginLeft:8},children:n("markets.xsection.recordLine",{defaultValue:"record (+1d): low {{lo}}bp vs high {{hi}}bp · n {{n}}",lo:Math.round((c.avg_fwd_1d||0)*1e4),hi:Math.round((u.avg_fwd_1d||0)*1e4),n:c.n+u.n})})]}),e.jsxs("div",{style:{fontFamily:k,fontSize:8.5,color:t.text,display:"flex",gap:12,flexWrap:"wrap"},children:[e.jsxs("span",{children:[e.jsx("span",{style:{color:t.blue},children:n("markets.xsection.lowLabel",{defaultValue:"LOW"})})," ",r(a,1)||"â"]}),e.jsxs("span",{children:[e.jsx("span",{style:{color:t.amber},children:n("markets.xsection.highLabel",{defaultValue:"HIGH"})})," ",r(a,10)||"â"]})]})]},a)}),e.jsx("div",{style:{fontFamily:k,fontSize:7.5,color:t.dim,opacity:.8},children:n("markets.xsection.honesty",{defaultValue:"academic cross-sectional signals with the forward record accruing in public; a research screen, not trade advice"})})]}):e.jsx("div",{style:{fontFamily:k,fontSize:9,color:t.dim},children:s.note||n("markets.xsection.empty",{defaultValue:"first snapshot pending (daily 18:40 ET)"})})]})}const $s=n=>String(n).toUpperCase().startsWith("C")?t.green:t.red;function Tc({vis:n=null}={}){const{t:l}=W(),{data:s}=H(()=>Vr(40),6e3,[]),{data:i}=H(()=>Br(40),8e3,[]),{data:o}=H(()=>
1Ur(40),12e3,[]),r=s?.stats||[],a=i?.contracts||[],p=o?.contracts||[];return e.jsxs(X,{id:"statsview",vis:n,style:{height:"100%",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:10},children:[r.length>4&&(()=>{const d=r.map(h=>({key:h.underlying||h.symbol,value:(h.net_premium??h.net_flow)!=null?(h.net_premium??h.net_flow)/1e6:null})).filter(h=>h.value!=null);if(d.length<5)return null;const c=Math.ceil(Math.max(20,...d.map(h=>Math.abs(h.value)))),u=d.filter(h=>h.value>0).length;return e.jsx("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,padding:"4px 6px",flexShrink:0},children:e.jsx(li,{items:d,min:-c,max:c,zones:[-c/10,c/10],zoneColors:["rgba(240,82,79,0.10)","rgba(156,163,175,0.05)","rgba(55,209,131,0.10)"],dotColors:["rgba(240,82,79,0.85)","rgba(156,163,175,0.8)","rgba(55,209,131,0.85)"],unit:"M",height:80,label:l("markets.optionsStats.rankLabel",{pos:u,total:d.length}),info:l("markets.optionsStats.rankInfo")})})})(),e.jsx("div",{style:{flex:1.1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{position:"sticky",top:0,background:t.panel2,zIndex:1},children:e.jsx("tr",{children:["SYMBOL","NET $ FLOW","CALL $","PUT $","P/C","GEX"].map((d,c)=>e.jsx("th",{style:{textAlign:c===0?"left":"right",padding:"6px 10px",color:t.muted,fontFamily:"Inter",fontSize:10,fontWeight:700,borderBottom:`1px solid ${t.border2}`},children:d},d))})}),e.jsxs("tbody",{children:[r.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,style:{padding:20,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:l("markets.optionsStats.noData")})}),r.map(d=>e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[e.jsx("td",{style:{padding:"4px 10px",fontWeight:800,color:t.text},children:d.underlying}),e.jsx(Dt,{color:d.net_premium>=0?t.green:t.red,bold:!0,children:d.net_premium!=null?ee(d.net_premium):"â"}),e.jsx(Dt,{color:t.green,children:d.call_premium!=null?ee(d.call_premium):"â"}),e.jsx(Dt,{color:t.red,children:d.put_premium!=null?ee(d.put_premium):"â"}),e.jsx(Dt,{color:d.put_call_ratio>1?t.red:t.green,children:d.put_call_ratio!=null?R(d.put_call_ratio,2):"â"}),e.jsx(Dt,{color:d.gex==null?t.muted:d.gex>=0?t.blue:t.amber,children:d.gex!=null?ee(d.gex):"â"})]},d.underlying))]})]})}),e.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",gap:10},children:[e.jsx(Cs,{title:l("markets.optionsStats.panelVolOi"),cols:["SYMBOL","CONTRACT","VOL/OI","VOL"],rows:a,render:d=>[e.jsx("b",{style:{color:$s(d.cp)},children:d.underlying}),`${d.expiry} ${R(d.strike,0)}${d.cp}`,e.jsxs("b",{style:{color:d.vol_oi>=5?t.amber:t.text},children:[R(d.vol_oi,1),"Ã"]}),je(d.volume)]}),e.jsx(Cs,{title:l("markets.optionsStats.panelOiChange"),cols:["SYMBOL","CONTRACT","Î OI","OI"],rows:p,render:d=>[e.jsx("b",{style:{color:$s(d.cp)},children:d.underlying}),`${d.expiry} ${R(d.strike,0)}${d.cp}`,e.jsxs("b",{style:{color:d.oi_change>=0?t.green:t.red},children:[d.oi_change>=0?"+":"",je(d.oi_change)]}),je(d.oi)]})]})]}),e.jsx(_c,{})]})}const Cs=({title:n,cols:l,rows:s,render:i})=>e.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:[e.jsx("div",{style:{padding:"6px 10px",background:t.panel2,fontSize:11,fontWeight:800,color:t.text,borderBottom:`1px solid ${t.border2}`,position:"sticky",top:0},children:n}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11.5,fontFamily:k},children:[e.jsx("thead",{children:e.jsx("tr",{children:l.map((o,r)=>e.jsx("th",{style:{textAlign:r===0?"left":"right",padding:"4px 10px",color:t.muted,fontFamily:"Inter",fontSize:9.5,fontWeight:700},children:o},o))})}),e.jsxs("tbody",{children:[s.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:l.length,style:{padding:16,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:"â"})}),s.map((o,r)=>e.jsx("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.03)"},children:i(o).map((a,p)=>e.jsx("td",{style:{textAlign:p===0?"left":"right",padding:"3px 10px",color:t.text,whiteSpace:"nowrap"},children:a},p))},r))]})]})]}),Dt=({children:n,color:l=t.text,bold:s=!1})=>e.jsx("td",{style:{textAlign:"right",padding:"4px 10px",color:l,fontWeight:s?700:400,whiteSpace:"nowrap"},children:n});function ol({data:n,color:l,label:s,fmt:i}){const o=Math.max(1,...n.map(a=>a.v||0)),r=n.length?n[n.length-1].v:null;return e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6,marginBottom:3},children:[e.jsx("span",{title:Fe(s)||void 0,style:{fontSize:10,fontWeight:700,color:t.muted,fontFamily:"Inter",cursor:Fe(s)?"help":void 0,borderBottom:Fe(s)?"1px dotted rgba(255,255,255,0.22)":void 0},children:s}),e.jsx("span",{style:{fontSize:12,fontWeight:800,color:l,fontFamily:k},children:r!=null?i(r):"â"})]}),e.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:1,height:46,background:"#10141A",borderRadius:3,padding:"0 1px"},children:n.map((a,p)=>e.jsx("div",{title:`${a.date}: ${i(a.v)}`,style:{flex:1,height:`${Math.max(2,a.v/o*100)}%`,background:l,opacity:p===n.length-1?1:.55,borderRadius:1}},p))})]})}
1function Ec({symbol:n="SPY",vis:l=null}){const{t:s}=W(),{data:i}=H(()=>Gr(50),8e3,[]),o=i?.volatility||[],[r,a]=$.useState(String(n).toUpperCase());$.useEffect(()=>a(String(n).toUpperCase()),[n]);const{data:p}=H(()=>Yr(r,90),15e3,[r]),d=p?.series||[],c=o.find(u=>u.underlying===r);return e.jsx(X,{id:"volview",vis:l,style:{height:"100%",minHeight:0},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:10},children:[o.length>3&&e.jsx("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,padding:"4px 6px",flexShrink:0},children:e.jsx(li,{items:o.map(u=>({key:u.underlying,value:u.iv_rank!=null?u.iv_rank*100:null})),selected:r,max:100,zones:[33,66],height:84,label:s("markets.volatility.crossSection"),info:s("markets.volatility.crossSectionInfo")})}),e.jsx("div",{style:{flex:1.3,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:k},children:[e.jsx("thead",{style:{position:"sticky",top:0,background:t.panel2,zIndex:1},children:e.jsx("tr",{children:["SYMBOL","IV RANK","IV 30d","HV 30d","IV/HV","EXP MOVE","TERM"].map((u,h)=>e.jsx("th",{style:{textAlign:h===0?"left":"right",padding:"6px 10px",color:t.muted,fontFamily:"Inter",fontSize:10,fontWeight:700,borderBottom:`1px solid ${t.border2}`},children:u},u))})}),e.jsxs("tbody",{children:[o.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,style:{padding:20,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:s("markets.volatility.noData")})}),o.map(u=>{const h=u.iv_rank!=null?u.iv_rank*100:null;return e.jsxs("tr",{onClick:()=>a(u.underlying),style:{cursor:"pointer",background:u.underlying===r?"rgba(57,141,255,0.10)":"transparent",borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[e.jsx("td",{style:{padding:"4px 10px",fontWeight:800,color:t.text},children:u.underlying}),e.jsx(Lt,{color:h==null?t.muted:h>=66?t.red:h>=33?t.amber:t.green,bold:!0,children:h!=null?`${h.toFixed(0)}%`:"â"}),e.jsx(Lt,{children:u.iv_30d!=null?R(u.iv_30d,1):"â"}),e.jsx(Lt,{color:t.muted,children:u.hv_30d!=null?R(u.hv_30d,1):"â"}),e.jsx(Lt,{color:u.iv_hv==null?t.muted:u.iv_hv>=1.3?t.red:u.iv_hv<=1?t.green:t.text,bold:!0,children:u.iv_hv!=null?`${u.iv_hv.toFixed(2)}Ã`:"â"}),e.jsx(Lt,{children:u.expected_move_pct!=null?`±${(u.expected_move_pct*100).toFixed(1)}%`:"â"}),e.jsx("td",{style:{padding:"4px 10px",textAlign:"right",color:t.dim,fontSize:10},children:(u.term_regime||"").replace("EXTREME_","").replace("_"," ")})]},u.underlying)})]})]})}),e.jsxs("div",{style:{flex:1,minHeight:0,border:`1px solid ${t.border}`,borderRadius:8,padding:"10px 12px",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{fontSize:12,fontWeight:800,color:t.text,marginBottom:8,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[r," · ",s("markets.volatility.histTitle")," ",e.jsx(ie,{topic:"volatility",size:14}),e.jsxs("span",{style:{fontSize:10,color:t.dim,fontWeight:400},children:["· ",s("markets.volatility.warehouseDays",{count:d.length})]})]}),e.jsxs("div",{style:{display:"flex",gap:18,alignItems:"center"},children:[c&&e.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[e.jsx(As,{value:c.iv_rank!=null?c.iv_rank*100:null,max:100,label:"IV RANK",suffix:"%"}),e.jsx(As,{value:c.iv_hv,max:3,label:"IV / HV",suffix:"Ã",mid:!0})]}),d.length===0?e.jsx("div",{style:{color:t.dim,fontSize:12,fontFamily:"Inter"},children:s("markets.volatility.noHistory",{sym:r})}):e.jsxs("div",{style:{display:"flex",gap:16,flex:1,minWidth:0},children:[e.jsx(ol,{data:d.map(u=>({date:u.date,v:(u.iv||0)*100})),color:t.gold,label:"IMPLIED VOL %",fmt:u=>u.toFixed(1)}),e.jsx(ol,{data:d.map(u=>({date:u.date,v:u.oi||0})),color:t.blue,label:"OPEN INTEREST",fmt:je}),e.jsx(ol,{data:d.map(u=>({date:u.date,v:u.volume||0})),color:t.green,label:"VOLUME",fmt:je})]})]})]})]})})}function As({value:n,label:l,max:s=100,suffix:i="",mid:o=!1}){const r=n==null?null:Math.max(0,Math.min(s,n)),a=r==null?0:r/s,p=r==null?t.muted:o?r>=1.3?t.red:r<=.9?t.green:t.amber:a>=.66?t.red:a>=.33?t.amber:t.green,d=(180-a*180)*Math.PI/180,c=50,u=50,h=38,m=c+h*Math.cos(d),y=u-h
1*Math.sin(d);return e.jsxs("svg",{viewBox:"0 0 100 64",width:"104",height:"66",style:{cursor:Fe(l)?"help":void 0},children:[Fe(l)&&e.jsx("title",{children:Fe(l)}),e.jsx("path",{d:`M ${c-h},${u} A ${h},${h} 0 0 1 ${c+h},${u}`,fill:"none",stroke:"rgba(255,255,255,0.10)",strokeWidth:"7",strokeLinecap:"round"}),r!=null&&e.jsx("path",{d:`M ${c-h},${u} A ${h},${h} 0 0 1 ${m},${y}`,fill:"none",stroke:p,strokeWidth:"7",strokeLinecap:"round"}),r!=null&&e.jsx("circle",{cx:m,cy:y,r:"3.5",fill:p}),e.jsx("text",{x:c,y:u-6,textAnchor:"middle",fontSize:"15",fontWeight:"800",fill:p,fontFamily:"monospace",children:r==null?"â":`${r.toFixed(r<10?2:0)}${i}`}),e.jsx("text",{x:c,y:61,textAnchor:"middle",fontSize:"7.5",fontWeight:"700",fill:t.muted,fontFamily:"Inter",children:l})]})}const Lt=({children:n,color:l=t.text,bold:s=!1})=>e.jsx("td",{style:{textAlign:"right",padding:"4px 10px",color:l,fontWeight:s?700:400,whiteSpace:"nowrap"},children:n}),$c=n=>{try{return xo(n,{seconds:!1})}catch{return""}},Cc=n=>{try{return new Date(n).toLocaleDateString([],{month:"short",day:"numeric"})}catch{return""}};function Ac({symbol:n="SPY"}){const{t:l}=W(),s=String(n).toUpperCase(),[i,o]=$.useState("all"),{data:r}=H(()=>Ys(i==="sym"?s:null,60),2e4,[i,s]),a=r&&r.articles||[];return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:t.text},children:l("markets.news.title")}),e.jsx("button",{onClick:()=>o("all"),style:Rs(i==="all"),children:"ALL"}),e.jsx("button",{onClick:()=>o("sym"),style:Rs(i==="sym"),children:s}),e.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:t.muted},children:l("markets.news.headlineCount",{count:a.length})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${t.border}`,borderRadius:8},children:[a.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.dim,fontFamily:"Inter"},children:i==="sym"?l("markets.news.noHeadlinesSym",{sym:s}):l("markets.news.noHeadlines")}),a.map((p,d)=>e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[e.jsxs("span",{style:{fontSize:10,color:t.dim,fontFamily:k},children:[Cc(p.published)," ",$c(p.published)]}),(p.symbols||[]).slice(0,5).map(c=>e.jsx("span",{style:{fontSize:9.5,fontWeight:800,color:"rgba(232,228,218,0.7)",background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:3,padding:"0 5px"},children:c},c)),e.jsx("span",{style:{marginLeft:"auto",fontSize:9.5,color:t.dim,textTransform:"uppercase"},children:p.source})]}),e.jsx("a",{href:p.url,target:"_blank",rel:"noopener noreferrer",style:{fontSize:13,color:t.text,textDecoration:"none",fontWeight:600,lineHeight:1.3},onMouseEnter:c=>c.target.style.color=t.green,onMouseLeave:c=>c.target.style.color=t.text,children:p.title}),p.summary?e.jsx("div",{style:{fontSize:11.5,color:t.muted,marginTop:3,fontFamily:"Inter"},children:String(p.summary).slice(0,220)}):null]},d))]})]})}const Rs=n=>({fontSize:11,padding:"3px 12px",borderRadius:6,cursor:"pointer",fontWeight:700,border:`1px solid ${n?t.gold:t.border2}`,background:n?"rgba(210,162,76,0.14)":"transparent",color:n?t.gold:t.muted}),En=n=>{const l=Math.max(0,Math.round(n));return l<100?`${l}m`:l<2880?`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`:`${Math.round(l/1440)}D`},Rc=[{id:"spine",label:"Session Spine"},{id:"rail",label:"Instrument Rail"},{id:"stackdial",label:"Stack Dial",group:"Instrument Rail"},{id:"chart",label:"Chart",group:"Chart column"},{id:"context",label:"Context · Confluence",group:"Chart column"},{id:"console",label:"The Console",group:"Chart column"},{id:"terrain",label:"Terrain",group:"Terrain column"},{id:"stopmap",label:"Stop Map",group:"Terrain column"},{id:"flowstack",label:"Flow Stack + Delta Tape",group:"Terrain column"},{id:"signals",label:"Command Rail",group:"Signals column"},{id:"deck",label:"Deck Rack"},{id:"parttwo",label:"Positioning Strip"}],Fc=["rrp:sa-futures-cols-v3","rrp:sa-futures-left-rows-v1","rrp:sa-futures-center-rows-v1","rrp:sa-futures-terrain-rows-v1","rrp:sa-futures-command-rows-v1","h:sa-futures-workspace-h-v1"],O=(n,l=2)=>n==null?"â":R(n,l),xt=n=>n==null?"â":je(n),Re={ES:{name:"E-MINI S&P 500",exch:"CME",cat:"Index",micro:"MES",pv:[50,5]},NQ:{name:"E-MINI NASDAQ-100",exch:"CME",cat:"Index",micro:"MNQ",pv:[20,2]},YM:{name:"E-MINI DOW",exch:"CBOT",cat:"Index",micro:"MYM",pv:[5,.5]},RTY:{name:"E-MINI RUSSELL 2000",exch:"CME",cat:"Index",micro:"M2K",pv:[50,5]},CL:{name:"CRUDE OIL · WTI",exch:"NYMEX",cat:"Energy",micro:"MCL",pv:[1e3,100]},NG:{name:"NATURAL GAS",exch:"NYMEX",cat:"Energy",micro:null,pv:[1e4,null]},RB:{name:"RBOB GASOLINE",exch:"NYMEX",cat:"Energy",micro:null,pv:[42e3,null]},HO:{name:"HEATING OIL",exch:"NYMEX",cat:"Energy",micro:null,pv:[42e3,null]},GC:{name:"GOLD",exch:"COMEX",cat:"Metals",micro:"MGC",pv:[100,10]},SI:{name:"SILVER",exch:"COMEX",cat:"Metals",micro:null,pv:[5e3,null]},HG:{name:"COPPER",exch:"COMEX",cat:"Metals",micro:"MHG",pv:[25e3,2500]},PL:{name:"PLATINUM",exch:"NYMEX",cat:"Metals",micro:null,pv:[50,null]},ZB:{name:"30Y T-BOND",exch:"CBOT",cat:"Rates",micro:null,pv:[1e3,null]},ZN:{name:"10Y T-NOTE",exch:"CBOT",cat:"Rates",micro:null,pv:[1e3,null]},ZF:{name:"5Y T-NOTE",exch:"CBOT",cat:"Rates",micro:null,pv:[1e3,null]},ZT:{name:"2Y T-NOTE",exch:"CBOT",cat:"Rates",micro:null,pv:[2e3,
1null]},UB:{name:"ULTRA T-BOND",exch:"CBOT",cat:"Rates",micro:null,pv:[1e3,null]},"6E":{name:"EURO FX",exch:"CME",cat:"FX",micro:"M6E",pv:[125e3,12500]},"6B":{name:"BRITISH POUND",exch:"CME",cat:"FX",micro:"M6B",pv:[62500,6250]},"6J":{name:"JAPANESE YEN",exch:"CME",cat:"FX",micro:null,pv:[125e5,null]},"6A":{name:"AUSTRALIAN DOLLAR",exch:"CME",cat:"FX",micro:"M6A",pv:[1e5,1e4]},"6C":{name:"CANADIAN DOLLAR",exch:"CME",cat:"FX",micro:null,pv:[1e5,null]},"6S":{name:"SWISS FRANC",exch:"CME",cat:"FX",micro:null,pv:[125e3,null]},ZC:{name:"CORN",exch:"CBOT",cat:"Grains",micro:null,pv:[50,null]},ZS:{name:"SOYBEANS",exch:"CBOT",cat:"Grains",micro:null,pv:[50,null]},ZW:{name:"WHEAT",exch:"CBOT",cat:"Grains",micro:null,pv:[50,null]},MBT:{name:"MICRO BITCOIN",exch:"CME",cat:"Crypto",micro:null,pv:[.1,null]},MET:{name:"MICRO ETHER",exch:"CME",cat:"Crypto",micro:null,pv:[.1,null]}},Xt=Object.keys(Re),Nc=["ES","NQ","CL","GC"],Ic=["ES","NQ","YM","RTY","CL","NG","GC","SI","HG","ZB","ZN","6E","6J","MBT"],Mc=["1m","2m","4m","5m","8m","10m","15m","30m","1h","2h","4h","8h","1d","1w"],zc=[...Xt.map(n=>({symbol:n,name:Re[n].name})),...Xt.filter(n=>Re[n].micro).map(n=>({symbol:Re[n].micro,name:`MICRO ${Re[n].name}`}))],Wc=Object.fromEntries(Xt.filter(n=>Re[n].micro).map(n=>[Re[n].micro,n])),Wl=n=>Wc[n]||n,al={"1m":48,"5m":120,"10m":120,"15m":240,"30m":240,"1h":336,"4h":1080,"1d":4800,"1w":24*400},Fs={"1m":3e3,"5m":1500,"10m":800,"15m":1e3,"30m":500,"1h":400,"4h":300,"1d":400,"1w":300},Dc=3e4,Ns=[];Object.fromEntries(Xt.map(n=>[n,Re[n].name]));Object.fromEntries(Xt.map(n=>[n,Re[n].exch]));const Lc={F:"JAN",G:"FEB",H:"MAR",J:"APR",K:"MAY",M:"JUN",N:"JUL",Q:"AUG",U:"SEP",V:"OCT",X:"NOV",Z:"DEC"},Oc={FADE:t.gold,DRIVE:t.green,TRAP_RICH:t.amber,EVENT_LOCK:t.red,NO_TRADE:t.dim};function ht(n,l,s){const[i,o]=$.useState(null);return $.useEffect(()=>{let r=!0;o(null);const a=()=>n().then(d=>{r&&o(d)}).catch(()=>{});a();const p=setInterval(a,l);return()=>{r=!1,clearInterval(p)}},s),i}function Pc(n,l,s){const[i,o]=$.useState({data:null,lastUpdated:null,error:null});return $.useEffect(()=>{let r=!0;o({data:null,lastUpdated:null,error:null});const a=()=>n().then(d=>{r&&o({data:d,lastUpdated:Date.now(),error:null})}).catch(d=>{r&&o(c=>({...c,error:d||!0}))});a();const p=setInterval(a,l);return()=>{r=!1,clearInterval(p)}},s),i}function Hc(n){const[l,s]=$.useState(null);return $.useEffect(()=>{if(!n||typeof EventSource>"u")return;let i=null,o=null,r=0,a=!1;s(null);const p=()=>{if(a||o)return;const c=Math.min(1e3*2**r,Dc);r+=1,o=setTimeout(()=>{o=null,d()},c+Math.random()*c*.25)},d=async()=>{if(!a)try{const c=encodeURIComponent(String(n).toUpperCase()),u=await Oi(`/api/futures/stream/${c}`);if(a)return;i=new EventSource(u),i.onopen=()=>{r=0},i.addEventListener("futures_trade",h=>{try{const m=JSON.parse(h.data),y=Number(m?.price),b=Number(m?.timestamp_ms),f=Date.now()-b;Number.isFinite(y)&&y>0&&Number.isFinite(b)&&f>=-2e3&&f<=5e3&&s(m)}catch{}}),i.onerror=()=>{try{i?.close()}catch{}i=null,p()}}catch{p()}};return d(),()=>{a=!0,o&&clearTimeout(o);try{i?.close()}catch{}}},[n]),l}function Vc(){const[n,l]=$.useState(()=>new Date);$.useEffect(()=>{const o=setInterval(()=>l(new Date),1e3);return()=>clearInterval(o)},[]);const s=new Intl.DateTimeFormat("en-US",{timeZone:"America/New_York",hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short"}).formatToParts(n),i=o=>Number((s.find(r=>r.type===o)||{}).value);return{h:i("hour")%24,m:i("minute"),s:i("second"),label:`${s.find(o=>o.type==="hour").value}:${s.find(o=>o.type==="minute").value}:${s.find(o=>o.type==="second").value}`}}const ge={fontFamily:k,fontSize:9,letterSpacing:"0.16em",color:t.gold,marginBottom:6},L=(n=11,l=t.muted)=>({fontFamily:k,fontSize:n,color:l,fontVariantNumeric:"tabular-nums"}),$e={background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:7,padding:10,minWidth:0},he=(n=t.dim,l=!1)=>({fontFamily:k,fontSize:8.5,letterSpacing:"0.08em",padding:"2px 8px",borderRadius:999,border:`1px solid ${n}`,color:l?t.bg:n,background:l?n:"transparent",whiteSpace:"nowrap"}),q=({note:n="â"})=>e.jsx("div",{style:{...L(9.5,t.dim),padding:"3px 0",lineHeight:1.6},children:n}),Bc={spine:{t:"Session Spine",w:"The 23-hour futures clock: Globex overnight shading, the regular session (RTH) band, the 17:00 ET maintenance hatch, and the overnight high/low marked at the exact times they printed.",h:"Glance here first: where are we in the day, how far from the overnight extremes, and which countdown chips (event / maintenance / roll) are live."},governor:{t:"Playbook Governor",w:"One word that gates the whole day, computed from the auction state: FADE (edges get sold), DRIVE (go with the break), TRAP_RICH (mixed tape full of stop-traps), EVENT_LOCK / NO_TRADE.",h:"Only the signal families the governor lists as legal should be traded â the full read lives in the §14 box at the bottom of the board."},settle:{t:"Settlement (Anchor)",w:"Yesterday's official exchange settlement price â the institutional P&L anchor, not just a last trade.",h:"The day's +/â is measured from settle. Funds defend it; crossing settle often changes behavior."}
1,vpin:{t:"VPIN · Toxicity",w:'How one-sided and "informed" recent volume is (0â1, with its session percentile). High VPIN = urgent, informed flow is active.',h:"High toxicity: expect slippage, size down, trust breakouts over fades. Low: calmer, mean-reversion conditions."},lambda:{t:"Kyle's λ · Impact",w:"How much price moves per contract traded â a live thinness read on the order book, shown as a percentile.",h:"THIN (p85+): moves are cheap to push â bursts overshoot and stops run further than usual. Thick book: moves need real volume behind them."},atr:{t:"ATR %",w:"The typical 15-minute range as a percent of price â this board's yardstick for distance.",h:"The Gauntlet gate distances and the Knife Guard falling-knife threshold are all measured in this ATR unit."},rangeBudget:{t:"Range Budget",w:"How much of this contract's TYPICAL day (20-session average daily range) has already printed. The fuel gauge for the move.",h:"Under 75%: the day still has fuel, breakouts can travel. Over 110%: the statistical day is spent â chasing here is buying someone elseâs exit, and mean-reversion setups dominate. Pair it with the Knife Guard before countering."},stopmap:{t:"Stop Map",w:"Estimated resting-stop clusters: beyond the overnight extremes, initial balance, prior-day extremes and the nearest roun
1d numbers. Buy stops sit above price (fuel for rallies), sell stops below (fuel for drops). Estimates from structure, not order-book data.",h:"Price is drawn to dense pools: a sweep through one often accelerates, then either continues (real breakout) or reclaims (trap â see the trap gauge). Put your own stop where the map is EMPTY, not inside a pool everyone shares."},regime:{t:"Regime",w:"The engine's market-state label: trending up / trending down / low-vol range / high-vol / transition.",h:"Context, not a trigger: trend regimes favor continuation setups; range regimes favor fading the edges."},gamma:{t:"γ Regime (Dealer Gamma)",w:"Whether option dealers are long gamma (γ+, they DAMPEN moves by fading) or short gamma (γâ, they AMPLIFY moves by chasing) â mapped from the index options book onto this future.",h:"γ+ favors fading the edges; γâ means breaks RUN â widen stops, expect follow-through. Direction still comes from the tape; γ only sets HOW price moves."},crossflow:{t:"Cross-Market Flow",w:"All four books side by side â each row shows that contractâs 2m/5m/15m/1h flow dots and an alignment arrow.",h:"All green together = broad risk-on money. ES/NQ red while GC runs green = rotation, not one-way direction. Click any row to switch the whole board."},chart:{t:"Chart · Level Map + VWAPÏ",w:"Price (5M or 1M) on the full session map: value area (VAH/VPOC/VAL), overnight + initial-balance extremes, dealer walls / γ-flip / expected-move rails when the options surface is live, and the session VWAP with ±1Ï/2Ï bands from real traded volume.",h:"The lineâs last point is the LIVE price. Dashed gold/red/green lines are the active signalâs entry / stop / target. VWAP STANCE (top-left) says how stretched from fair value price is â beyond ±1.5Ï, chasing is buying the stretch."},gauntlet:{t:"The Gauntlet · Runway Map",w:"Every obstacle price must chew through in each direction â walls, value edges, session extremes, stop pools â laid out by real distance and priced in ATR units. The shaded zone is one honest move (1 ATR).",h:"CLEANER PATH counts the gates within 1.5 ATR each way: fewer gates = more room to run if you are right. Trade toward the open runway, not into the crowd."},terrain:{t:"Terrain Ladder + Hedge Nowcast",w:"Every level that matters on one ladder: spot (gold), dealer walls and γ-flip from the options book, value area, session and overnight extremes. HEDGE NOWCAST = the net futures dealers must trade today off their option books (+ = forced buying).",h:"The field of play: which level is price approaching, and who defends it. Several levels stacked together make a much stronger gate."},flowstack:{t:"Flow Stack · Cumulative δ",w:"Net buying minus selling per window (2m / 5m / 15m / 1h) plus the SESSION row â the professional anchor: cumulative delta since the Globex open (18:00 ET), the same convention Sierra Chart and NinjaTrader use. δ (delta) = volume executed at the ask (+) minus at the bid (â). With the VENUE chip lit, every number is the exchangeâs own complete per-minute aggressor split (bid volume + ask volume equals total volume exactly) â true contract counts, not a sample. The dot is the sign, the beam is the strength. The chip below reads the tape like Wyckoff: delta is the EFFORT, the price change is the RESULT.",h:"4/4 green = money net flowing IN on every horizon (trend confirmation); 4/4 red = distribution; MIXED = chop, no flow trend to join. Read the SESSION spark as a SHAPE against price: price making a higher high while session δ makes a lower high = absorption (a divergence â fade fuel); both rising together = a funded trend. The effort chip grades the last 15 minutes: DRIVE = price moves WITH strong delta (join it); AIR = price moves on no delta (hollow, do not chase); ABSORPTION = heavy delta, no movement (a passive player soaking it up). TAPE SAMPLE chip = venue series unavailable, numbers fall back to the print tape, which under-counts at busy hours â trust direction, not magnitude. Gold LAST SESSION = market closed, showing the prior session."},tape:{t:"Delta Tape · Aggressor",w:"Every real trade print: time, size, price, and WHO was aggressive â AT ASK (buyer paid up) vs AT BID (seller hit down). Institutional-size rows highlight gold; δ on the right is the running session delta.",h:'"Terrain locates, tape decides": at a key level, watch whether prints keep hitting the ask (sellers losing) or the bid. EXPAND for more depth.'},rail:{t:"Command Rail · Signals",w:"Futures-native permanent MUTED setups. Every card carries entry / stop / target, R:R, geometry QA, source freshness and a Decision Passport built from independent forward episodes.",h:"NEED is the gross break-even hurdle from geometry, MODEL is the empirical target-first estimate, LOW is
1its conservative bound, and EXP is realized R. Missing evidence stays visibly UNPROVEN; stale data is blocked. Muted means no execution or alertsânot hidden."},dossier:{t:"Signal Dossier",w:"Click any active, closed, or dormant Command Rail card to open its audit view: tracked state, public setup logic, current NEED-vs-NOW gates, invalidation, lifecycle, exact same-symbol receipts, and other open muted signals.",h:"A tracked signal is not a broker position. Use the dossier to understand why the engine is waiting or what invalidates a live thesis. Results are signal records shown in normalized R, ticks, and dollars; proprietary weights and raw model vectors stay private."},receipts:{t:"Receipts · 30D",w:"Each setupâs forward track record â number of signals, direction hit-rate, average best/worst excursion â measured daily after the close.",h:"This is how a setup EARNS trust: nothing becomes advisory until its receipts clear the statistical gate (DSR/PBO). No receipts, no faith. Every cardâs score is already blended with this record, so an unproven setup canât wear borrowed authority."},conviction:{t:"Conviction · Receipts on the Card",w:"Each cardâs score is not just the setupâs structural read â it is that read BLENDED with the setupâs own measured forward record (an empirical-Bayes update). The receipts chip shows the setupâs direction hit-rate and sample size; the â²/â¼ shows how far the record moved the raw structural score.",h:"A green receipts chip with a real sample size is a setup that has EARNED its score; âunprovenâ means there is no forward record yet, so the number is the structural read only â treat it as a hypothesis, not an edge. The little context tags (session phase, γ regime, DTE bucket) are what the card was born in, so the track record can be sliced by them."},siblingDivergence:{t:"Sibling Divergence (ESâNQ)",w:"A cross-market tell: one index future prints a NEW session high or low while its sibling REFUSES to confirm it, and the siblingâs tape is leaning the other way. An unconfirmed extreme tends to mean-revert toward value.",h:"Fires only in the FADE / TRAP_RICH playbooks; target is the value-area point of control. The siblingâs cumulative delta must actively disagree with the extremeânot just fail to make its own. Permanently recorded and calibrated like every setup; execution and alerts stay muted."},stackedSignal:{t:"Confluence (Stacked Setups)",w:"When two or more DISTINCT setups fire the same direction on the same symbol in one cycle, they collapse into one stacked card â nearest member target, shortest member fuse.",h:"Deliberately measured as its OWN setup so the receipts can PROVE (or refute) that stacking beats the individual members â never assumed. A confluence card with a strong receipts chip is the highest-conviction read the rail produces."},decks:{t:"Deck Rack",w:"The six instrument decks: TAPE (aggression), TERRAIN (dealer map), AUCTION (value & day type), POSITIONING (COT / OI / overnight inventory), CURVE (term structure & basis), CONTEXT (siblings, internals, events).",h:"One click opens that deckâs full section below the board â the same layouts as the design presentation."},compass:{t:"The Compass · Trend Stack",w:"Three horizons, one law. SWING = the big picture from daily bars (above/below the 20-day average, 5-day slope, higher-highs vs lower-lows). DAY = todayâs auction verdict (price vs VWAP, vs settle, vs VPOC). NOW = your execution window (flow alignment + 15-minute momentum â three 5-minute bars, one bar SLOWER than the Knife Guardâs 10-minute unlock, so permits open before the meter flips).",h:"The verdict is the rule you trade by: FULL SAIL = every horizon agrees â trade that direction only. PULLBACK = swing+day agree and NOW is counter â that counter-move IS your entry, not a reversal. TUG OF WAR = day fights the swing: scalps only, half size. RANGE / NO MAP = stand down. The Knife Guard enforces this â fighting swing+day together is FORBIDDEN even when the last 10 minutes look friendly."},console:{t:"The Console · Signal Mixdown",w:"The market as a vintage receiver. Each meter pairs a NEEDLE (its trend/level) with a money-flow LED ladder, and the ladders CASCADE across the row â session â 1h â
1 15m â 5m â 2m â mix â so the whole desk reads from the big money picture down to the raw pulse. SWING wears the sessionâs net δ (the longest window the tape holds), DAY the last hour, NOW the last 15 minutes (matching its own dial), FLOW pairs a fast 2-minute needle with a 5-minute strip (the classic peak-meter + average-meter pairing), and VOL is UNSIGNED participation whose needle borrows its color from the 2-minute pulse shown on its strip. VPIN is the TOXICITY of that flow (its session percentile, 0 to MAX): how informed and one-sided the volume is, the quality read VOL cannot give.",h:"Read a column top-to-bottom: does the money (LEDs) agree with the trend (needle)? The two disagreements are the earliest tells: a LONG needle over RED LEDs = trend without money â distribution, suspect it. A SHORT needle over GREEN LEDs = price under value while money flows in â accumulation; if the flow holds, the needle flips next (this is why the Knife Guard can say BUY ALLOWED while the day still reads short â the guard trades the money). Trade the MASTER: deep to one side + IN TREND lamp = clean signal; fluttering center = static. CLIP = velocity past 2.5 ATR (knife zone) â never chase. VOL: the dial says HOW MUCH engine, its color says WHOSE â volume itself is not flow. VPIN pairs with VOL as the QUALITY gauge: high toxicity is urgent, informed flow, so trust breakouts over fades and size down; low toxicity is calmer and mean-reversion friendly. The gold-ringed meter is the MASTER."},confluence:{t:"Confluence · Six-Dimension Read",w:"One vote per INDEPENDENT dimension so nothing double-counts. The gamma REGIME is the master switch (read it first): γ TREND (negative gamma) = trust breakouts; γ FADE (positive gamma) = mean-revert the edges. Then five dimensions each vote â TREND, LOC (price vs value), FLOW (delta), INTL (equity breadth, ES/NQ only) and INTMKT (VIX + dollar). A green dot leans LONG, red leans SHORT, dim is neutral or not-applicable. The tally = how many of the available dimensions agree.",h:"Read the regime first, then the count. A high agreement count in one direction that MATCHES the regime is a clean read; a split tally, or a lone diverging dimension (e.g. FLOW long against a SHORT trend), is a warning to stand aside, not a trade. This stacks weak, INDEPENDENT confirmations to improve odds and avoid bad entries â it is NOT a validated same-session edge (our own replays: dir_hit ~32%). Never trade one dimension alone."},part2:{t:"Decider Layer (§14â§18)",w:"The judgment instruments: Playbook Governor (what is legal today), Thesis Ledger (your open tradeâs conditions ticking green/red), Forced-Flow Forecast (who MUST trade next), Geometry QA and the Event Lens.",h:"The decks above inform; these decide and audit. The ledger arms automatically when a trade is on."}};function Ee({k:n,size:l=13}){const{t:s}=W(),i=Bc[n];if(!i)return null;const o=n.charAt(0).toUpperCase()+n.slice(1),r=s(`markets.futures.info${o}Title`,i.t),a=s(`markets.futures.info${o}What`,i.w),p=s(`markets.futures.info${o}How`,i.h);return e.jsx(ie,{title:r,what:a,how:p,size:l,extra:Uc(s)[n]||null})}const Ce={fontSize:10,color:t.muted,lineHeight:1.5,padding:"5px 7px",borderTop:`1px solid ${t.border2}`},cn={...Ce,color:t.dim,fontSize:8.5,letterSpacing:"0.08em",fontFamily:k,borderTop:"none"},Uc=n=>({compass:e.jsxs("div",{style:{marginTop:9},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,color:t.text,marginBottom:2},children:n("markets.futures.compassByStyle")}),e.jsx("div",{style:{fontSize:10.5,color:t.muted,lineHeight:1.5,marginBottom:6},children:e.jsx(qt,{i18nKey:"markets.futures.compassLaw",components:{b:e.jsx("b",{style:{color:t.text}})}})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"86px 1fr 1.2fr 1.1fr",border:`1px solid ${t.border2}`,borderRadius:6,overflow:"hidden"},children:[e.jsx("div",{style:cn,children:n("markets.futures.compassColStyle")}),e.jsx("div",{style:cn,children:n("markets.futures.compassColDirection")}),e.jsx("div",{style:cn,children:n("markets.futures.compassColEntry")}),e.jsx("div",{style:cn,children:n("markets.futures.compassColExit")}),e.jsxs("div",{style:{...Ce,color:t.text,fontWeight:700},children:["SCALP",e.jsx("br",{}),"1â5 min"]}),e.jsxs("div",{style:Ce,children:[e.jsx("b",{style:{color:t.gold},children:"NOW"})," ",n("markets.futures.compassScalpDir")]}),e.jsx("div",{style:Ce,children:n("markets.futures.compassScalpEntry")}),e.jsx("div",{style:Ce,children:n("markets.futures.compassScalpExit")}),e.jsxs("div",{style:{...Ce,color:t.text,fontWeight:700},children:["DAY TRADE",e.jsx("br",{}),"20mâhrs",e.jsx("br",{}),e.jsx("span",{style:{color:t.dim,fontWeight:400},children:n("markets.futures.compassDayFlat")})]}),e.jsxs("div",{style:Ce,children:[e.jsx("b",{style:{color:t.gold},children:"DAY"})," ",n("markets.futures.compassDayDir")]}),e.jsx("div",{style:Ce,children:e.jsx(qt,{i18nKey:"markets.futures.compassDayEntry",components:{b:e.jsx("b",{style:{color:t.text}})}})}),e.jsx("div",{style:Ce,children:e.jsx(qt,{i18nKey:"markets.futures.compassDayExit",components:{b:e.jsx("b",{style:{color:t.text}})}})}),e.jsxs("div",{style:{...Ce,color:t.text,fontWeight:700},children:["SWING",e.jsx("br",{}),"daysâweeks",e.jsx("br",{}),e.jsx("span",{style:{color:t.dim,fontWeight:400},children:n("markets.futures.compassSwingHolds")})]}),e.jsxs("div",{style:Ce,children:[e.jsx("b",{style:{color:t.gold},children:"SWING"})," ",n("markets.futures.compassSwingDir")]}),e.jsx("div",{style:Ce,children:n("markets.futures.compassSwingEntry")}),e.jsx("div",{style:Ce,children:n("markets.futures.compassSwingExit")})]}),e.jsx("div",{style:{fontSize:10.5,color:t.muted,lineHeight:1.55,marginTop:7},children:e.jsx(qt,{i18nKey:"markets.futures.compassWorkedExample",components:{b:e.jsx("b",{style:{color:t.green}})}})}
1),e.jsx("div",{style:{fontSize:10,color:t.dim,lineHeight:1.5,marginTop:5},children:n("markets.futures.compassFootnote")})]})}),Gc=n=>n?.available&&Array.isArray(n.d)&&n.d.length?n.d.map((l,s)=>({t:n.anchor_ts+60*s,delta:l})):null;function Yc({dailyBars:n,bars:l,cvd:s,last:i,settle:o,vpoc:r}){const a=Number(i);if(!isFinite(a))return null;const p=(n||[]).filter(S=>isFinite(Number(S.c))),d=S=>S.reduce((C,I)=>C+I,0)/Math.max(1,S.length);let c=null,u="needs ~12 daily bars",h=0;if(p.length>=12){const S=p.map(D=>Number(D.c)),C=d(S.slice(-Math.min(20,S.length))),I=d(S.slice(-5)),F=d(S.slice(-10,-5)),A=Math.max(...p.slice(-5).map(D=>Number(D.h??D.c))),P=Math.max(...p.slice(-10,-5).map(D=>Number(D.h??D.c))),V=Math.min(...p.slice(-5).map(D=>Number(D.l??D.c))),J=Math.min(...p.slice(-10,-5).map(D=>Number(D.l??D.c))),Q=A>P&&V>=J?1:V<J&&A<=P?-1:0,U=(a>C?1:-1)+(I>F?1:-1)+Q;c=U>=2?"up":U<=-2?"down":"range",h=U,u=`${a>C?"above":"below"} 20d · 5d slope ${I>F?"â":"â"} · ${Q>0?"higher highs":Q<0?"lower lows":"inside"}`}const m=(l||[]).filter(S=>isFinite(Number(S.c)));let y=null,b="waiting on bars",f=0;if(m.length>=6){let S=0,C=0;m.forEach(A=>{const P=(Number(A.h??A.c)+Number(A.l??A.c)+Number(A.c))/3,V=Number(A.v)>0?Number(A.v):1;S+=P*V,C+=V});const I=[[S/C,"VWAP"],[Number(o),"settle"],[Number(r),"VPOC"]].filter(([A])=>isFinite(A)),F=I.reduce((A,[P])=>A+(a>P?1:-1),0);y=F>=2?"up":F<=-2?"down":"balanced",f=F,b=I.map(([A,P])=>`${a>A?">":"<"} ${P}`).join(" · ")}const w=Il(Wn(s||[])),v=m.length?Number((m.filter(S=>Number(S.t)<=Number(m[m.length-1].t)-900).slice(-1)[0]||m[0]).c):null,g=v?a>v?"up":a<v?"down":"flat":null,x=w==="up"&&g==="up"?"up":w==="down"&&g==="down"?"down":"mixed",j=`flow ${w||"â"} · 15m ${g||"â"}`,_=S=>S==="up"?"LONG":"SHORT";let E;c&&c!=="range"&&c===y&&x===c?E={mode:"FULL SAIL",c:c==="up"?t.green:t.red,rule:`${_(c)} ONLY â every horizon agrees. Trade with it, don't fade it.`}:c&&c!=="range"&&c===y?E={mode:`PULLBACK · ${_(c)}`,c:c==="up"?t.green:t.red,rule:`swing + day agree ${c.toUpperCase()} â the counter-move you see NOW is the entry, not a reversal. ${_(c)} at levels only.`}:c&&c!=="range"&&y&&y!=="balanced"&&y!==c?E={mode:"TUG OF WAR",c:t.amber,rule:"day fights the swing â scalps only, half size, no adds, fast exits."}:c&&c!=="range"&&(y==="balanced"||y==null)&&x===c?E={mode:`LEAN · ${_(c)}`,c:c==="up"?t.green:t.red,rule:`swing ${c.toUpperCase()} and NOW agrees while the day repairs â ${_(c)} at levels, prove-it size; full sail needs the day to flip.`}:c&&c!=="range"&&(y==="balanced"||y==null)?E={mode:`SWING BIAS · ${_(c)}`,c:t.amber,rule:`only the swing speaks ${c.toUpperCase()} â patience at levels on that side; the day must confirm before size.`}:c==="range"?E={mode:"RANGE",c:t.dim,rule:"no swing trend â fade the edges, take profits quickly, never chase the middle."}:E={mode:"NO MAP",c:t.dim,rule:"horizons disagree or data is thin â stand down; flat is a position."};const T={swing:Math.max(-1,Math.min(1,h/3)),day:Math.max(-1,Math.min(1,f/3)),now:(w==="up"?.5:w==="down"?-.5:0)+(g==="up"?.5:g==="down"?-.5:0)};return{swing:c,swingWhy:u,day:y,dayWhy:b,now:x,nowWhy:j,verdict:E,ch:T}}function Xc({c:n}){const{t:l}=W();if(!n)return null;const s=(i,o,r)=>{const a=o==="up"?"â²":o==="down"?"â¼":o?"â":"â",p=o==="up"?t.green:o==="down"?t.red:t.dim;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"36px 14px 1fr",gap:5,alignItems:"baseline",marginTop:3},children:[e.jsx("span",{style:{...L(8.5,t.dim),textAlign:"right"},children:i}),e.jsx("span",{style:{...L(11,p),fontWeight:900},children:a}),e.jsx("span",{style:{...L(7.5,t.dim),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:r,children:r})]})};return e.jsxs("div",{style:{borderTop:`1px solid ${t.border2}`,paddingTop:6,marginTop:6},children:[e.jsxs("div",{style:{...L(8,t.dim),letterSpacing:"0.12em",display:"flex",alignItems:"center",gap:5},children:[l("markets.futures.compassHeader"),e.jsx(Ee,{k:"compass",size:12})]}),s("SWING",n.swing,n.swingWhy),s("DAY",n.day==="balanced"?"range":n.day,n.dayWhy),s("NOW",n.now==="mixed"?null:n.now,n.nowWhy),e.jsxs("div",{style:{marginTop:5,padding:"5px 7px",borderRadius:6,background:`${n.verdict.c}12`,border:`1px solid ${n.verdict.c}55`},children:[e.jsx("div",{style:{...L(9.5,n.verdict.c),fontWeight:900,letterSpacing:"0.06em"},children:n.verdict.mode}),e.jsx("div",{style:{...L(8,t.muted),marginTop:2,lineHeight:1.55},children:n.verdict.rule})]})]})}const xn=({frac:n,h:l=11,zones:s=[[0,.6,"rgba(55,209,131,0.14)"],[.6,.85,"rgba(242,169,59,0.15)"],[.85,1,"rgba(240,82,79,0.17)"]]})=>e.jsxs("div",{style:{position:"relative",height:l,background:t.elev,borderRadius:4,overflow:"hidden",marginTop:4},children:[s.map(([i,o,r],a)=>e.jsx("span",{style:{position:"absolute",top:0,bottom:0,left:`${i*100}%`,width:`${(o-i)*100}%`,background:r}},a)),isFinite(n)&&e.jsx("span",{style:{position:"absolute",top:-1,bottom:-1,left:`${Math.max(0,Math.min(100,n
1*100))}%`,width:2,background:t.gold,boxShadow:`0 0 6px ${t.gold}`}})]}),Ae=({frac:n,color:l=t.gold,mid:s=!1,h:i=10})=>e.jsxs("div",{style:{position:"relative",height:i,background:t.elev,borderRadius:4,overflow:"hidden",marginTop:4},children:[s&&e.jsx("span",{style:{position:"absolute",left:"50%",top:0,bottom:0,width:1,background:t.border2}}),isFinite(n)&&e.jsx("span",{style:{position:"absolute",top:-1,bottom:-1,left:`${Math.max(0,Math.min(100,n*100))}%`,width:2,background:l,boxShadow:`0 0 6px ${l}`}})]});function Kc({sum:n,curve:l,ctx:s,clock:i}){const{t:o}=W(),a=(i.h*60+i.m-1080+1440)%1440/1440*100,p=f=>{if(!isFinite(f))return null;const w=new Intl.DateTimeFormat("en-US",{timeZone:"America/New_York",hour12:!1,hour:"2-digit",minute:"2-digit"}).formatToParts(new Date(f*1e3)),v=Number((w.find(x=>x.type==="hour")||{}).value)%24,g=Number((w.find(x=>x.type==="minute")||{}).value);return(v*60+g-1080+1440)%1440/1440*100},d=[["ONH",s?.on_high,p(s?.on_high_t)],["ONL",s?.on_low,p(s?.on_low_t)]].filter(([,f,w])=>f!=null&&w!=null),c=(f,w,v)=>{const g=(f-1080+1440)%1440/1440*100,x=(w-f+1440)%1440/1440*100;return e.jsx("span",{style:{position:"absolute",top:0,bottom:0,left:`${g}%`,width:`${x}%`,...v}})},u=n.session_open===!1?o("markets.futures.sessionClosed"):i.h>=9&&i.h<16&&!(i.h===9&&i.m<30)?"RTH":"GLOBEX",h=(1020-(i.h*60+i.m)+1440)%1440,m=l?.roll,y=s?.next_event||{},b=y.name||y.title||y.event||null;return e.jsxs("div",{style:{...$e,padding:"8px 12px 7px"},children:[e.jsxs("div",{style:{position:"relative",height:24,background:t.elev,borderRadius:5,overflow:"hidden"},children:[c(1080,570,{background:"rgba(100,116,139,0.12)"}),c(570,960,{background:"rgba(210,162,76,0.10)",borderLeft:"1px solid rgba(210,162,76,0.55)",borderRight:"1px solid rgba(210,162,76,0.55)"}),c(1020,1080,{background:"repeating-linear-gradient(45deg, rgba(240,82,79,0.20) 0 4px, transparent 4px 8px)"}),d.map(([f,w,v])=>e.jsxs("span",{style:{position:"absolute",top:2,left:`${v}%`,transform:"translateX(-50%)",...L(7.5,t.dim),letterSpacing:"0.06em",whiteSpace:"nowrap",zIndex:1},children:[f," ",O(w,2)]},f)),e.jsx("span",{style:{position:"absolute",top:-2,bottom:-2,left:`${a}%`,width:2,background:t.gold,boxShadow:`0 0 8px ${t.gold}`,zIndex:2}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",...L(8,t.dim),letterSpacing:"0.08em",marginTop:3},children:[e.jsx("span",{children:"18:00 GLOBEX"}),e.jsx("span",{children:"00:00"}),e.jsx("span",{children:"06:00"}),e.jsx("span",{children:"09:30 RTH"}),e.jsx("span",{children:"16:00"}),e.jsx("span",{children:"17:00 MAINT"})]}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginTop:6},children:[e.jsxs("span",{style:he(t.green),children:["â ",u," · ",i.label," ET"]}),e.jsxs("span",{style:he(t.dim),children:["ONH ",e.jsx("b",{style:{color:t.text},children:O(n.on_high??s?.on_high,2)})," ","ONL ",e.jsx("b",{style:{color:t.text},children:O(n.on_low??s?.on_low,2)})]}),s?.minutes_to_event!=null?e.jsxs("span",{style:he(t.gold),children:[b||"EVENT"," · Tâ",En(s.minutes_to_event)]}):e.jsx("span",{style:he(t.dim),children:o("markets.futures.fuseNoEvent")}),e.jsxs("span",{style:he(t.dim),children:["MAINT · Tâ",Math.floor(h/60),":",String(h%60).padStart(2,"0")]}),m&&e.jsxs("span",{style:he(t.dim),children:["ROLL ",m.front,"â",m.next," · Tâ",m.days_to_roll,"D"]}),e.jsx("span",{style:{marginLeft:"auto"},children:n?.tod&&n.tod.cont_prior!=null?e.jsxs("span",{style:he(n.tod.cont_prior>=.55?t.green:n.tod.cont_prior<=.45?t.red:t.dim),title:o("markets.futures.todEdgeTitle",{defaultValue:"historical base rates for this 30-minute bucket (n={{n}} sessions): continuation prior + median bucket range",n:n.tod.n}),children:[o("markets.futures.todEdgeChip",{defaultValue:"EDGE {{bucket}} ET · cont {{cont}}% · ~{{med}}pt",bucket:n.tod.bucket,cont:Math.round(n.tod.cont_prior*100),med:O(n.tod.med_range,1)}),n.tod.thin?` · ${o("markets.futures.todThin",{defaultValue:"THIN"})}`:""]}):e.jsx("span",{style:he(t.dim),children:o("markets.futures.edgeHeatPending")})})]})]})}function qc({hover:n,allTapes:l}){const s=Re[n.s]||{},i=Wn(l?.[n.s]?.cvd),o=Il(i);return Et.createPortal(e.jsxs("div",{style:{position:"fixed",left:Math.min(n.x,(typeof window<"u"?window.innerWidth:1200)-214),top:n.y,zIndex:6e3,width:202,background:"#0E1219",border:`1px solid ${t.border2}`,borderRadius:8,boxShadow:"0 10px 30px rgba(0,0,0,0.55)",padding:"9px 11px",pointerEvents:"none"},children:[e.jsxs("div",{style:{...L(11,t.gold),fontWeight:800,letterSpacing:"0.03em"},children:[n.s," · ",s.name||n.s]}),e.jsxs("div",{style:{...L(8.5,t.muted),marginTop:3},children:[s.cat||"â"," · ",s.exch||"â",s.micro?` · micro ${s.micro}`:""]}),s.pv?.[0]!=null&&e.jsxs("div",{style:{...L(8.5,t.dim),marginTop:2},children:["$",O(s.pv[0],0),"/pt",s.pv[1]!=null?` · micro $${O(s.pv[1],0)}/pt`:""]}),e.jsxs("div",{style:{borderTop:`1px solid ${t.border2}`,marginTop:6,paddingTop:5,display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{...L(8,t.dim),letterSpacing:"0.1em"},children:"FLOW 2mâ1h"}),e.jsx("span",{style:{display:"flex",gap:3},children:i.map(([r,a])=>e.jsx("span",{style:{width:7,height:7,borderRadius:99,background:a==null?t.elev:a>0?t.green:a<0?t.red:t.slate}},r))}),e.jsx("span",{style:{...L(10,o==="up"?t.green:o==="down"?t.red:t.dim),fontWeight:900,marginLeft:"auto"},children:o==="up"?"â":o==="down"?"â":o==="mixed"?"·":"â"})]})]}),document.body)}function Qc({allTapes:n,sym:l,setSym:s}){const{t:i}=W(),[o,r]=$.useState(null);return e.jsxs("div",{style:{borderTop:`1px solid ${t.border2}`,paddingTop:6,marginTop:6},children:[e.jsxs("div",{style:{...L(8,t.dim),letterSpacing:"0.12em",display:"flex",alignItems:"center",gap:5},children:[i("markets.futures.crossMarketHeader"),e.jsx(Ee,{k:"crossflow",size:12})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1px 8px",marginTop:3},children:Ic.map(a=>{const p=Wn(n?.[a]?.cvd),d=Il(p),c=d==="up"?"â":d==="down"?"â":d==="mixed"?"·":"â",u=d==="up"?t.green:d==="down"?t.red:t.dim;return e.jsxs("button",{onClick:()=>s(a),onMouseEnter:h=>{const m=h.currentTarget.getBoundingClientRect();r({s:a,x:m.right+6,y:m.top})},onMouseLeave:()=>r(h=>h?.s===a?null:h),style:{display:"grid",gridTemplateColumns:"18px minmax(0, 1fr) 10px",gap:3,alignItems:"center",width:"100%",minWidth:0,padding:"2px 2px",borderRadius:4,cursor:"pointer",border:"none",background:a===l?"rgba(210,162,76,0.10)":"transparent"},children:[e.jsx("span",{style:{...L(8.5,a===l?t.gold:t.dim),fontWeight:800,textAlign:"left"},children:a}),e.jsx("span",{style:{display:"flex",gap:2,minWidth:0,overflow:"hidden"},children:p.map(([h,m])=>e.jsx("span",{style:{width:5.5,height:5.5,borderRadius:99,background:m==null?t.elev:m>0?t.green:m<0?t.red:t.slate,boxShadow:m?`0 0 4px ${m>0?t.green:t.red}`:"none"}},h))}),e.jsx("span",{style:{...L(10,u),fontWeight:900},children:c})]},a)})}),o?e.jsx(qc,{hover:o,allTapes:n}):null]})}const Zc=["1m","5m","15m","1h","4h","1d","1w"];
1function Jc({sym:n,data:l,loading:s=!1,error:i=null}){const{t:o}=W(),[r,a]=$.useState(!1),p=!l||!l.horizons?.length||l.coverage==="none",d={};for(const c of l?.horizons||[])for(const u of c.triad||[])!(u in d)&&c.tf_scores?.[u]!=null&&(d[u]={score:c.tf_scores[u],stale:c.stale_tfs?.includes(u)});return e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{...L(8,t.dim),letterSpacing:"0.12em",display:"flex",alignItems:"center",gap:5,flexShrink:0},children:[o("markets.futures.stackDialLabel",{defaultValue:"THE STACK · ALIGNMENT"}),l?.last_session?e.jsx("span",{style:{...he(t.gold),fontSize:7,marginLeft:"auto"},children:"LAST SESSION"}):null]}),s?e.jsx("div",{"data-testid":"futures-stack-dial-state","data-state":"loading",style:{...L(8.5,t.gold),lineHeight:1.5},children:o("markets.futures.stackDialLoading",{defaultValue:"loading {{sym}} alignment...",sym:n})}):i?e.jsx("div",{"data-testid":"futures-stack-dial-state","data-state":"error",style:{...L(8.5,t.amber),lineHeight:1.5},children:o("markets.futures.stackDialRetrying",{defaultValue:"stack feed retrying for {{sym}}",sym:n})}):p?e.jsx("div",{style:{...L(8.5,t.dim),lineHeight:1.5},children:o("markets.futures.stackDialEmpty",{defaultValue:"stack coverage: none for {{sym}}",sym:n})}):e.jsxs("div",{"data-testid":"futures-stack-dial-state","data-state":"ready","data-symbol":n,style:{display:"contents"},children:[e.jsx("div",{onClick:()=>a(!0),title:"open THE STACK",style:{width:"100%",aspectRatio:"1 / 1",cursor:"pointer"},children:e.jsx(Sl,{data:l,fill:!0,bare:!0,linkedCursor:!0})}),e.jsx("div",{style:{display:"flex",flexWrap:"nowrap",gap:3,marginTop:7,marginLeft:-2,marginRight:-18,flexShrink:0},children:Zc.map(c=>{const u=d[c]?.score,h=d[c]?.stale,m=u==null?"rgba(120,129,143,0.10)":u>0?`rgba(55,209,131,${.18+.5*Math.min(1,u)})`:u<0?`rgba(240,82,79,${.18+.5*Math.min(1,-u)})`:"rgba(120,129,143,0.20)";return e.jsx("span",{title:`${c}: ${u==null?"n/a":(u>=0?"+":"")+u}${h?" · last measured":""}`,style:{flex:1,textAlign:"center",fontFamily:k,fontSize:9.5,fontWeight:700,padding:"4px 2px",borderRadius:3,whiteSpace:"nowrap",border:h?`1px dashed ${t.border2}`:"none",color:u==null?t.dim:u>0?t.green:u<0?t.red:t.muted,background:m},children:c},c)})})]}),r?e.jsx(zl,{data:l,symbol:n,onClose:()=>a(!1)}):null]})}function ep({sym:n,setSym:l,sum:s,curve:i,allTapes:o,compass:r}){const{t:a}=W(),p=Wl(n),d=Re[p]||Re.ES,c=i?.roll?.front||n,u=c.length>=4?Lc[c[2]]:null,h=s.last!=null&&s.settle?s.last-s.settle:null,m=h!=null&&s.settle?h/s.settle*100:null,y=(h||0)>=0,b=(f,w,v=null,g=null)=>e.jsxs("div",{style:{borderTop:`1px solid ${t.border2}`,paddingTop:6,marginTop:6},children:[e.jsxs("div",{style:{...L(8,t.dim),letterSpacing:"0.12em",display:"flex",alignItems:"center",gap:5},children:[f,g&&e.jsx(Ee,{k:g,size:12})]}),e.jsx("div",{style:{...L(12,t.text),fontWeight:700,marginTop:2},children:w}),v]});return e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:[Nc.map(f=>e.jsx("button",{onClick:()=>l(f),style:{...he(f===n?t.gold:t.dim),fontSize:9,background:f===n?"rgba(210,162,76,0.14)":"transparent",cursor:"pointer"},children:f},f)),e.jsx("span",{style:{...he(t.dim),opacity:.7},title:"micros MES/MNQ/MCL/MGC route automatically in the engine",children:"µ"})]}),e.jsxs("div",{style:{marginTop:10,containerType:"inline-size"},children:[e.jsx("div",{style:{fontSize:20,fontWeight:900,letterSpacing:"0.02em",color:t.text},children:c}),e.jsxs("div",{style:{...L(8.5,t.dim),lineHeight:1.5},children:[n!==p?`MICRO ${d.name}`:d.name,u?` · ${u} 2${c[3]}`:""," · ",d.exch]}),e.jsx("div",{style:{...L(22,t.text),fontWeight:800,marginTop:4,whiteSpace:"nowrap",fontSize:"clamp(13px, 17cqw, 22px)"},children:O(s.last,2)}),h!=null&&e.jsxs("div",{style:{...L(11.5,y?t.green:t.red),fontWeight:700},children:[y?"+":"",O(h,2)," · ",y?"+":"",O(m,2),"%"]})]}),b(a("markets.futures.settleLabel"),O(s.settle,2),null,"settle"),b(a("markets.futures.vpinLabel"),e.jsxs("span",{style:{color:s.vpin!=null?t.gold:t.dim},children:[O(s.vpin,3),s.vpin_pctile!=null?` · p${Math.round(s.vpin_pctile*100)}`:""]}),e.jsx(xn,{frac:Number(s.vpin_pctile),h:9}),"vpin"),b(a("markets.futures.lambdaLabel"),s.lambda_pctile!=null?`p${Math.round(s.lambda_pctile*100)}${s.lambda_pctile>.85?" · THIN":""}`:"â",e.jsx(Ae,{frac:Number(s.lambda_pctile),color:t.blue,h:9}),"lambda"),b(a("markets.futures.atrLabel"),O(s.atr_pct,3),null,"atr"),s.range_budget&&s.range_budget.used_pct!=null&&(()=>{const f=Number(s.range_budget.used_pct),w=f>=110?t.red:f>=75?t.amber:t.green;return b(a("markets.futures.rangeBudgetLabel",{defaultValue:"RANGE BUDGET"}),e.jsx("span",{style:{color:w,fontWeight:800},children:a("markets.futures.rangeBudgetValue",{defaultValue:"{{used}}% of 20d range",used:O(f,0)})}),e.jsx(Ae,{frac:Math.min(1,f/150),color:w,h:9}),"rangeBudget")})(),b(a("markets.futures.regimeLabel"),e.jsx("span",{style:{color:s.regime?t.blue:t.dim},children:s.regime?s.regime.toUpperCase():"â"}),null,"regime"),b(a("markets.futures.gammaRegimeLabel"),e.jsx("span",{style:{color:s.gamma_regime==="negative"?t.red:s.gamma_regime==="positive"?t.green:t.dim},children:s.gamma_regime?`γ${s.gamma_regime==="negative"?"â":"+"} · ${s.gamma_regime.toUpperCase()}`:"â"}),!s.gamma_regime&&e.jsx("div",{style:{...L(7.5,t.dim),marginTop:3,lineHeight:1.5},children:["CL","GC"].includes(p)?a("markets.futures.noIndexSurface"):a("markets.futures.indexSurfaceOffline")}),"gamma"),e.jsx(Xc,{c:r}),e.jsx(Qc,{allTapes:o,sym:n,setSym:l})]})}function tp({v:n,windowTxt:l}){const s=Math.max(-1,Math.min(1,Number(n)||0)),i=[];for(let o=-4;o<=4;o++){if(o===0){i.push(e.jsx("span",{style:{width:2,height:9,background:t.muted,opacity:.7}},o));continue}const r=o>0?s>(o-.5)/4.5:s<(o+.5)/4.5,a=o>0?t.green:t.red;i.push(e.jsx("span",{style:{flex:"0 1 7px",minWidth:3,width:7,height:9,borderRadius:1.5,background:r?a:"#1a212b",opacity:r?.95:1,boxShadow:r?`0 0 5px ${a}`:"inset 0 1px 2px rgba(0,0,0,0.6)"}},o))}return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",alignItems:"center",marginBottom:3,height:12,overflow:"hidden"},children:[e.jsx("span",{style:{...L(6.5,t.dim),letterSpacing:"0.14em",justifySelf:"start"},children:"FLOW"}),e.jsx("span",{style:{display:"flex",alignItems:"center",gap:2.5,minWidth:0,justifyContent:"center"},children:i}),e.jsx("span",{style:{...L(6.5,t.dim),letterSpacing:"0.06em",justifySelf:"end"},children:l})]})}function dt({name:n,sub:l,v:s,level:i=!1,accent:o=!1,lampOn:r=!1,lampColor:a=t.red,flowV:p,flowLabel:d,needleColor:c=t.gold}){const{t:u}=W(),h=130,m=82,y=h/2,b=m-10,f=54,w=Math.max(i?0:-1,Math.min(1,Number(s)||0)),v=48,g=i?-v+w*2*v:w*v,x=T=>(T-90)*Math.PI/180,j=(T,S)=>[y+S*Math.cos(x(T)),b+S*Math.sin(x(T))],_=[];for(let T=-6;T<=6;T++){const S=T/6*v,C=T%3===0,[I,F]=j(S,f),[A,P]=j(S,f-(C?8:4.5));_.push(e.jsx("line",{x1:I,y1:F,x2:A,y2:P,stroke:C?t.muted:t.dim,strokeWidth:T===0?1.4:C?1:.7,opacity:C?.9:.6},T))}const E=(T,S,C,I=3.2)=>{const[F,A]=j(T,f+2),[P,V]=j(S,f+2);return e.jsx("path",{d:`M ${F} ${A} A ${f+2} ${f+2} 0 0 1 ${P} ${V}`,fill:"none",stroke:C,strokeWidth:I,opacity:"0.8",strokeLinecap:"round"})};return e.jsxs("div",{style:{background:"linear-gradient(180deg, #161d26 0%, #0d1218 70%, #0a0e13 100%)",border:`1px solid ${o?t.gold:t.border2}`,borderRadius:8,padding:"6px 6px 5px",boxShadow:o?"inset 0 2px 12px rgba(0,0,0,0.55), 0 0 0 1px rgba(210,162,76,0.4), 0 0 14px rgba(210,162,76,0.22)":"inset 0 2px 12px rgba(0,0,0,0.55), inset 0 -1px 0 rgba(210,162,76,0.06)"},children:[p!==void 0&&e.jsx(tp,{v:p,windowTxt:d}),e.jsxs("svg",{viewBox:`0 0 ${h} ${m}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",width:"100%",maxWidth:h,height:"auto",margin:"0 auto"},children:[i?E(v*.5,v,t.red):e.jsxs(e.Fragment,{children:[E(-v,-v*.58,t.red),E(v*.58,v,t.green)]}
1),_,e.jsx("text",{x:j(-v,f+12)[0],y:j(-v,f+10)[1],fill:i?t.dim:t.red,fontSize:"7.5",fontFamily:"monospace",textAnchor:"middle",opacity:"0.9",children:i?"0":u("markets.futures.vuShort")}),e.jsx("text",{x:j(0,f+13)[0],y:j(0,f+11)[1],fill:t.dim,fontSize:"7",fontFamily:"monospace",textAnchor:"middle",children:"0"}),e.jsx("text",{x:j(v,f+12)[0],y:j(v,f+10)[1],fill:i?t.red:t.green,fontSize:"7.5",fontFamily:"monospace",textAnchor:"middle",opacity:"0.9",children:i?"MAX":u("markets.futures.vuLong")}),e.jsx("text",{x:y,y:b-f*.34,fill:o?t.gold:t.text,fontSize:10.5,fontWeight:"800",fontFamily:"monospace",textAnchor:"middle",letterSpacing:"2",opacity:"0.95",children:n}),l&&e.jsx("text",{x:y,y:b-f*.34+10,fill:t.dim,fontSize:7,fontFamily:"monospace",textAnchor:"middle",letterSpacing:"1",children:l}),e.jsxs("g",{style:{transform:`rotate(${g}deg)`,transformOrigin:`${y}px ${b}px`,transition:"transform 0.9s cubic-bezier(0.22, 1, 0.36, 1)"},children:[e.jsx("line",{x1:y,y1:b+3,x2:y,y2:b-(f-3),stroke:c,strokeWidth:1.5}),e.jsx("line",{x1:y,y1:b+3,x2:y,y2:b-(f-3),stroke:c,strokeWidth:3.2,opacity:"0.22"})]}),e.jsx("circle",{cx:y,cy:b,r:2.8,fill:"#2a2015",stroke:c,strokeWidth:"1"}),e.jsx("circle",{cx:h-9,cy:9,r:"3.4",fill:r?a:"#20262f",style:r?{filter:`drop-shadow(0 0 4px ${a})`}:void 0})]})]})}function np({compass:n,cvd:l,bars:s,atrPct:i,last:o,vpinPctile:r}){if(!n?.ch)return null;const a=Wn(l||[]),p=F=>F==null?0:Math.sign(F)*Math.min(1,Math.log10(1+Math.abs(F))/4),d=a[0]?a[0][1]:null,c=a[1]?a[1][1]:null,u=a[2]?a[2][1]:null,h=a[3]?a[3][1]:null,m=(l||[]).reduce((F,A)=>F+(A.delta||0),0),y=p(h),b=(s||[]).filter(F=>isFinite(Number(F.c)));let f=null;if(b.length>12){const F=b.map(V=>Number(V.v)||0),A=F.reduce((V,J)=>V+J,0)/F.length,P=F.slice(-5).reduce((V,J)=>V+J,0)/5;f=A>0?Math.min(1,P/A/2.5):null}const w=Number(o),v=b.length?Number(b[b.length-1].t):null,g=v?b.filter(F=>Number(F.t)<=v-900).slice(-1)[0]||b[0]:null,x=g&&i?(w/Number(g.c)-1)*100/i:null,j=x!=null&&Math.abs(x)>2.5,_=[n.ch.swing,n.ch.day,n.ch.now,y],E=.35*n.ch.swing+.3*n.ch.day+.2*n.ch.now+.15*y,T=Math.sign(E),S=_.filter(F=>Math.sign(F)===T&&Math.abs(F)>.1).length,C=Math.abs(E)>.3&&S>=3,I=r==null?null:Math.max(0,Math.min(1,Number(r)>1.5?Number(r)/100:Number(r)));return{flowV:y,rpm:f,clip:j,master:E,inTrend:C,agree:S,move15atr:x,vpin:I,tapePulse:p(d),flowNow:p(c),flowDay:p(h),flowSwing:p(m),flow15:p(u)}}function lp({compass:n,con:l}){const{t:s}=W();return!n?.ch||!l?e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:{...ge,display:"flex",alignItems:"center",gap:5},children:[s("markets.futures.consoleHeader"),e.jsx(Ee,{k:"console",size:12})]}),e.jsx(q,{note:"console waiting on live tape and horizon bars"})]}):e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:{...ge,display:"flex",alignItems:"center",gap:5},children:[s("markets.futures.consoleHeader"),e.jsx(Ee,{k:"console",size:12}),e.jsx("span",{style:{marginLeft:"auto",...L(8.5,l.inTrend?t.green:t.dim),fontWeight:800},children:l.inTrend?s("markets.futures.consoleInTrend",{dir:l.master>0?"LONG":"SHORT",agree:l.agree}):s("markets.futures.consoleStatic")}),e.jsx("span",{style:{...L(8.5,l.clip?t.red:t.dim),fontWeight:800},children:l.clip?s("markets.futures.consoleClip"):s("markets.futures.consoleNoClip")})]}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",gap:7,alignItems:"end",minWidth:830},children:[e.jsx(dt,{name:"SWING",sub:s("markets.futures.consoleDailySub"),v:n.ch.swing,flowV:l.flowSwing,flowLabel:"δ sess"}),e.jsx(dt,{name:"DAY",sub:s("markets.futures.consoleAuctionSub"),v:n.ch.day,flowV:l.flowDay,flowLabel:"δ 1h"}),e.jsx(dt,{name:"NOW",sub:"15m",v:n.ch.now,flowV:l.flow15,flowLabel:"δ 15m"}),e.jsx(dt,{name:"FLOW",sub:s("markets.futures.consoleTapeSub"),v:l.tapePulse,flowV:l.flowNow,flowLabel:"δ 5m",lampOn:Math.abs(l.tapePulse)>.62,lampColor:l.tapePulse>0?t.green:t.red}),e.jsx(dt,{name:"VOL",sub:s("markets.futures.consoleParticipationSub"),v:l.rpm==null?0:l.rpm,level:!0,flowV:l.tapePulse,flowLabel:"clr·2m",needleColor:l.tapePulse>.05?t.green:l.tapePulse<-.05?t.red:t.gold,lampOn:l.rpm!=null&&l.rpm>.85,lampColor:l.tapePulse>.05?t.green:t.red}),e.jsx(dt,{name:"VPIN",sub:"toxicity",v:l.vpin==null?0:l.vpin,level:!0,flowV:l.tapePulse,flowLabel:"tox·2m",needleColor:l.vpin!=null&&l.vpin>.66?t.red:l.vpin!=null&&l.vpin>.4?t.gold:t.dim,lampOn:l.vpin!=null&&l.vpin>.8,lampColor:t.red}),e.jsx(dt,{name:"MASTER",sub:l.clip?s("markets.futures.consoleClipLabel"):l.inTrend?s("markets.futures.consoleMixdownLocked"):s("markets.futures.consoleMixdownSearching"),v:l.master,accent:!0,flowV:l.master,flowLabel:"mix",lampOn:l.clip||l.inTrend,lampColor:l.clip?t.red:t.green})]})}),e.jsx("div",{style:{...L(7.5,t.dim),marginTop:4},children:s("markets.futures.consoleNote")})]})}function sp({tape:n,limit:l=18}){const{t:s}=W(),i=n?.prints||[];let o=0;const r=i.map(d=>(d.side==="buy"?o+=d.size:d.side==="sell"&&(o-=d.size),{...d,cum:o})).slice(-l).reverse(),a=n?.mode==="inferred_tick_rule",p=d=>Math.abs(d)>=1e3?`${(d/1e3).toFixed(1)}k`:String(Math.round(d));return e.jsxs("div",{children:[e.jsxs("div",{style:{...ge,marginTop:6},children:[s("markets.futures.deltaTapeHeader"),a?"":s("markets.futures.deltaLotClass"),e.jsx(Ee,{k:"tape",size:12}),a&&e.jsx("span",{style:{...he(t.blue),marginLeft:8,fontSize:7.5},children:s("markets.futures.deltaInferred")})]}
1),r.length?r.map((d,c)=>e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",padding:"2.5px 3px",borderBottom:`1px solid ${t.border2}`,borderRadius:3,background:d.lot==="inst"?"rgba(210,162,76,0.08)":"transparent"},children:[e.jsx("span",{style:{...L(9.5,t.dim),width:58},children:cp(d.ts)}),e.jsx("span",{style:{...L(10,d.inferred?t.dim:d.lot==="inst"?t.gold:t.text),width:42,textAlign:"right",fontWeight:800},children:d.inferred?"â":xt(d.size)}),e.jsx("span",{style:{...L(10,t.muted),width:68,textAlign:"right"},children:O(d.price,2)}),d.side&&e.jsx("span",{style:he(d.side==="buy"?t.green:t.red),children:d.side==="buy"?"AT ASK":"AT BID"}),d.lot==="inst"&&e.jsx("span",{style:he(t.gold,!0),children:"INST"}),d.lot==="mid"&&e.jsx("span",{style:he(t.dim),children:"MID"}),e.jsxs("span",{style:{...L(9.5,Math.abs(d.cum)>=1e3?t.muted:t.dim),marginLeft:"auto"},children:[a?"δn":"δ"," ",d.cum>=0?"+":"",p(d.cum)]})]},c)):e.jsx(q,{note:s("markets.futures.tapeWaiting")})]})}function ip({cvd:n,sessionCvd:l,inferred:s,bars:i,emUp:o,emDn:r}){const{t:a}=W(),p=n||[],d=l&&l.available&&Array.isArray(l.d)&&l.d.length?l:null,c=p.length?p[p.length-1].t:null,h=[["2m",2],["5m",5],["15m",15],["1h",60]].map(([j,_])=>{if(d)return[j,d.d.slice(-_).reduce((T,S)=>T+S,0)];if(c==null)return[j,null];const E=p.filter(T=>T.t>c-_*60).reduce((T,S)=>T+(S.delta||0),0);return[j,E]}),m=Math.max(...h.map(([,j])=>Math.abs(j||0)),1),y=h.filter(([,j])=>j!=null&&j>0).length,b=h.filter(([,j])=>j!=null&&j<0).length,f=d==null&&c==null?null:y===4?{txt:a("markets.futures.flowAlignedIn"),c:t.green}:b===4?{txt:a("markets.futures.flowAlignedOut"),c:t.red}:{txt:a("markets.futures.flowMixed",{n:Math.max(y,b)}),c:t.dim};let w=null;const v=(i||[]).map(j=>({t:Number(j.t??j.ts),h:Number(j.h??j.high??j.c??j.close),l:Number(j.l??j.low??j.c??j.close),c:Number(j.c??j.close)})).filter(j=>isFinite(j.c)&&isFinite(j.t));if(c!=null&&v.length>=4){const j=h[2]?h[2][1]:null,_=v[v.length-1].t,E=v.filter(I=>I.t<=_-900).slice(-1)[0],T=E?v[v.length-1].c-E.c:null,S=p.reduce((I,F)=>I+Math.abs(F.delta||0),0),C=p.length?S/p.length*15:0;if(j!=null&&T!=null&&C>0){const I=Math.abs(j)>=C*.6,F=Math.abs(T)>=v[v.length-1].c*6e-4;w=!I&&!F?{txt:a("markets.futuresCmd.effortNone"),c:t.dim}:!I&&F?{txt:T>0?a("markets.futuresCmd.effortAirUp"):a("markets.futuresCmd.effortAirDn"),c:t.amber}:j>0&&F&&T>0?{txt:a("markets.futuresCmd.effortDriveUp"),c:t.green}:j<0&&F&&T<0?{txt:a("markets.futuresCmd.effortDriveDn"),c:t.red}:j>0?{txt:a("markets.futuresCmd.effortAbsorbUp"),c:t.amber}:{txt:a("markets.futuresCmd.effortAbsorbDn"),c:t.amber}}}let g=null;if(o!=null&&r!=null&&v.length>=3){const j=Math.abs(Number(o)-Number(r)),_=new Date(v[v.length-1].t*1e3).toLocaleDateString("en-CA",{timeZone:"America/New_York"});let E=null,T=null;for(const S of v)new Date(S.t*1e3).toLocaleDateString("en-CA",{timeZone:"America/New_York"})===_&&(E=E==null?S.h:Math.max(E,S.h),T=T==null?S.l:Math.min(T,S.l));j>0&&E!=null&&T!=null&&(g=Math.min(250,(E-T)/j*100))}const x=j=>Math.abs(j)>=1e3?`${(j/1e3).toFixed(1)}k`:String(Math.round(j));return e.jsxs("div",{children:[e.jsxs("div",{style:{...ge,display:"flex",alignItems:"center",gap:5},children:[a("markets.futures.flowStackHeader"),s?a("markets.futures.flowTickRule"):"",e.jsx("span",{style:{...L(7.5,d?d.last_session_fallback?t.gold:t.green:t.dim),fontWeight:800,border:`1px solid ${d?d.last_session_fallback?t.gold:t.green:t.dim}44`,borderRadius:3,padding:"1px 4px",letterSpacing:"0.05em"},children:d?d.last_session_fallback?a("markets.futures.flowLastSession"):a("markets.futures.flowVenueChip"):a("markets.futures.flowSampleChip")}),e.jsx(Ee,{k:"flowstack",size:12})]}),f&&e.jsx("div",{style:{...L(9.5,f.c),fontWeight:800,letterSpacing:"0.06em",marginBottom:5},children:f.txt}),(w||g!=null)&&e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",margin:"0 0 6px"},children:[w&&e.jsx("span",{style:{...L(8.5,w.c),fontWeight:800,border:`1px solid ${w.c}55`,borderRadius:4,padding:"2px 7px"},children:w.txt}),g!=null&&e.jsx("span",{title:a("markets.futuresCmd.budgetTitle"),style:{...L(8.5,g<60?t.green:g<=110?t.amber:t.red),fontWeight:800,border:`1px solid ${t.border2}`,borderRadius:4,padding:"2px 7px"},children:a("markets.futuresCmd.budgetChip",{pct:Math.round(g)})})]}),h.map(([j,_])=>{const E=(_||0)>=0,T=_==null?0:Math.abs(_)/m*48;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"26px 10px 1fr 56px",gap:6,alignItems:"center",padding:"2.5px 0"},children:[e.jsx("span",{style:{...L(9,t.dim),textAlign:"right"},children:j}),e.jsx("span",{style:{width:7,height:7,borderRadius:99,justifySelf:"center",background:_==null?t.elev:E?t.green:t.red,boxShadow:_==null?"none":`0 0 6px ${E?t.green:t.red}`}}),e.jsxs("span",{style:{position:"relative",height:9,background:t.elev,borderRadius:3,overflow:"hidden"},children:[e.jsx("span",{style:{position:"absolute",left:"50%",top:0,bottom:0,width:1,background:t.border2}}),e.jsx("span",{style:{position:"absolute",top:1,bottom:1,borderRadius:2,left:E?"50%":`${50-T}%`,width:`${T}%`,background:E?"linear-gradient(90deg, rgba(55,209,131,0.8), rgba(55,209,131,0.25))":"linear-gradient(270deg, rgba(240,82,79,0.8), rgba(240,82,79,0.25))"}})]}),e.jsx("span",{style:{...L(10,_==null?t.dim:E?t.green:t.red),textAlign:"right",fontWeight:700},children:_==null?"â":`${E?"+":""}${x(_)}`})]},j)}),d&&(()=>{let j=0;const _=d.d.map(T=>(j+=T,{cum:j})),E=d.total>=0;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"26px 10px 1fr 56px",gap:6,alignItems:"center",padding:"3.5px 0 1px",borderTop:`1px solid ${t.border2}`,marginTop:3},children:[e.jsx("span",{style:{...L(7.5,t.dim),textAlign:"right",letterSpacing:"0.03em"},children:a("markets.futures.flowSessionRow")}),e.jsx("span",{style:{width:7,height:7,borderRadius:99,justifySelf:"center",background:E?t.green:t.red,boxShadow:`0 0 6px ${E?t.green:t.red}`}}),e.jsx("span",{style:{minWidth:0},children:e.jsx(Dl,{cvd:_,h:22})}),e.jsx("span",{style:{...L(10,E?t.green:t.red),textAlign:"right",fontWeight:700},children:`${E?"+":""}${x(d.total)}`})]})})()]})}function rp({terrain:n,auction:l,last:s}){const i=n||{},o=l||{},r=o.levels||{},a=[["EM+ RAIL",i.em_up,t.blue],["ON HIGH",r.on_high,t.muted],["IB HIGH",r.ib_high,t.muted],["VAH",o.vah,t.muted],["CALL WALL",i.call_wall,t.red],["PIN",i.pin,t.magenta],["γ FLIP",i.flip,t.gold],["SPOT â",s,t.gold],["VPOC",o.vpoc,t.gold],["IB LOW",r.ib_low,t.muted],["VAL",o.val,t.muted],["ON LOW",r.on_low,t.muted],["EMâ RAIL",i.em_dn,t.blue],["PUT WALL",i.put_wall,t.green]].filter(([,p])=>p!=null&&isFinite(Number(p)));
1return(o.naked_pocs||[]).forEach(p=>{p.price!=null&&isFinite(Number(p.price))&&a.push([`nPOC ${p.date||""}`,p.price,t.magenta])}),a.sort((p,d)=>Number(d[1])-Number(p[1])),a.length?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:a.map(([p,d,c],u)=>{const h=p==="SPOT â",m=p.includes("WALL"),y=p==="γ FLIP";return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"86px 70px 1fr",gap:7,alignItems:"center",padding:"1px 3px",borderRadius:4,background:h?"rgba(210,162,76,0.10)":"transparent",outline:h?"1px solid rgba(210,162,76,0.45)":"none"},children:[e.jsx("span",{style:{...L(8.5,h?t.gold:t.dim),textAlign:"right",letterSpacing:"0.05em"},children:p}),e.jsx("span",{style:{...L(9.5,h?t.gold:c),textAlign:"right",fontWeight:700},children:O(d,2)}),e.jsx("span",{style:{height:7,borderRadius:3,background:t.elev,position:"relative",overflow:"hidden"},children:e.jsx("span",{style:{position:"absolute",inset:0,width:m?"85%":h?"55%":y?"100%":"28%",background:y?`repeating-linear-gradient(90deg, ${t.gold} 0 6px, transparent 6px 12px)`:c,opacity:m?.55:h?.5:y?.45:.25,borderRadius:3}})})]},`${p}-${u}`)})}):e.jsx(q,{note:i.note||"terrain waiting on the daemon"})}function op({auction:n,last:l}){const{t:s}=W(),i=(n?.stop_pools||[]).filter(d=>isFinite(Number(d.price)));if(!i.length||!isFinite(Number(l)))return e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:{...ge,display:"flex",alignItems:"center",gap:5},children:[s("markets.futures.stopMapHeader",{defaultValue:"STOP MAP · WHERE THE MARKET HUNTS"}),e.jsx(Ee,{k:"stopmap",size:12}),e.jsx("span",{style:{...he(t.dim),marginLeft:"auto",fontSize:7},children:s("markets.futures.stopMapEst",{defaultValue:"ESTIMATED"})})]}),e.jsx(q,{note:"stop pools waiting on the current auction map"})]});const o=i.filter(d=>d.side==="buy_stops").sort((d,c)=>c.price-d.price).slice(0,4),r=i.filter(d=>d.side==="sell_stops").sort((d,c)=>c.price-d.price).slice(0,4),a=Math.max(...i.map(d=>d.weight||.5),.5),p=(d,c,u)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1.5px 0"},children:[e.jsx("span",{style:{...L(8,t.dim),width:44,letterSpacing:"0.06em"},children:String(d.basis||"").toUpperCase().replace("PRIOR_","PD").replace("_HIGH","H").replace("_LOW","L").replace("ON","ON").replace("IB","IB")}),e.jsx("span",{style:{...L(9.5,t.text),fontWeight:700,width:62},children:O(d.price,2)}),e.jsx("div",{style:{flex:1,height:7,background:t.elev,borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${(d.weight||.5)/a*100}%`,height:7,background:u?"rgba(55,209,131,0.5)":"rgba(240,82,79,0.5)"}})}),e.jsx("span",{style:{...L(7.5,t.dim),width:56,textAlign:"right"},children:u?s("markets.futures.stopFuelUp",{defaultValue:"fuel â"}):s("markets.futures.stopFuelDown",{defaultValue:"fuel â"})})]},`${d.basis}${c}`);return e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:{...ge,display:"flex",alignItems:"center",gap:5},children:[s("markets.futures.stopMapHeader",{defaultValue:"STOP MAP · WHERE THE MARKET HUNTS"}),e.jsx(Ee,{k:"stopmap",size:12}),e.jsx("span",{style:{...he(t.dim),marginLeft:"auto",fontSize:7},children:s("markets.futures.stopMapEst",{defaultValue:"ESTIMATED"})})]}),e.jsxs("div",{style:{marginTop:4},children:[o.map((d,c)=>p(d,c,!0)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"2px 0"},children:[e.jsx("span",{style:{...L(8,t.gold),width:44},children:"SPOT"}),e.jsx("span",{style:{...L(9.5,t.gold),fontWeight:800,width:62},children:O(l,2)}),e.jsx("div",{style:{flex:1,height:1,background:"rgba(210,162,76,0.5)"}})]}),r.map((d,c)=>p(d,c,!1))]})]})}if(typeof document<"u"&&!document.getElementById("sa-exec-strip-css")){const n=document.createElement("style");n.id="sa-exec-strip-css",n.textContent=` 2 .sa-exec-strip-toggle:hover, 3 [role="button"]:hover > .sa-exec-strip-toggle { 4 color: #E0C27A !important; 5 border-color: rgba(210,162,76,.55) !important; 6 } 7 `,document.head.appendChild(n)}
7const ap=new Intl.DateTimeFormat("en-US",{timeZone:"America/New_York",hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),dp=new Intl.DateTimeFormat("en-US",{timeZone:"America/New_York",hour12:!1,hour:"2-digit",minute:"2-digit"}),cp=n=>isFinite(n)?ap.format(new Date(n*1e3)):"",pp=n=>{const l=Date.parse(n);return isFinite(l)?dp.format(new Date(l)):""},Is=[["TAPE",["CVD vs Price","Speed · Lot · Toxicity"]],["TERRAIN",["Gamma Bridge","EM Rails","Hedge Nowcast"]],["AUCTION",["Profile","Day Type","Stop Map","Trap Gauge"]],["POSITIONING",["COT Bands","OI Quadrant","Inventory"]],["CURVE",["Term Strip","Roll Radar","Basis & Programs"]],["CONTEXT",["Confluence","Lead-Lag","Internals","Intermarket","Crypto Bridge","Event Fuse"]]];function Dl({cvd:n,h:l=70}){const{t:s}=W(),i=(n||[]).map(c=>Number(c.cum)).filter(c=>isFinite(c));if(i.length<2)return e.jsx(q,{note:s("markets.futures.cvdWaiting")});const o=Math.min(...i),a=Math.max(...i)-o||1,p=i.map((c,u)=>`${u/(i.length-1)*300},${l-6-(c-o)/a*(l-12)}`).join(" "),d=i[i.length-1]>=i[0];return e.jsx("svg",{viewBox:`0 0 300 ${l}`,width:"100%",height:l,children:e.jsx("polyline",{points:p,fill:"none",stroke:d?t.green:t.red,strokeWidth:"1.6"})})}function up({deck:n,board:l}){const{t:s}=W(),i=l?.tape||{},o=l?.terrain||{},r=l?.auction||{},a=l?.positioning||{},p=l?.curve||{},d=l?.context||{},c=l?.summary||{},u=(h,m,y=t.text)=>e.jsxs("div",{style:{...L(9.5),marginTop:4},children:[h," ",e.jsx("b",{style:{color:y},children:m})]});if(n==="TAPE"){const h=l?.session_cvd;let m=null;if(h?.available&&Array.isArray(h.d)&&h.d.length){let y=0;m=h.d.map(b=>(y+=b,{cum:y}))}return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(230px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"CVD · SESSION"}),e.jsx(Dl,{cvd:m||i.cvd}),u("δ session",xt(m?h.total:i.delta?.delta),((m?h.total:i.delta?.delta)||0)>=0?t.green:t.red)]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:s("markets.futures.speedOfTape")}),u("rate now",`${O(i.speed?.rate_now,2)}/s`),u("median",`${O(i.speed?.rate_median,2)}/s`),u("burst z",O(i.speed?.burst_z,1),(i.speed?.burst_z||0)>2?t.gold:t.text)]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"ABSORPTION · VPIN"}),u("VPIN",c.vpin!=null?`${O(c.vpin,3)} · p${Math.round((c.vpin_pctile||0)*100)}`:"â"),e.jsx(q,{note:i.degraded_no_size?"absorption + VPIN need trade prints â pending collector TimeAndSale":"watching the zone at the nearest wall"})]})]})}if(n==="TERRAIN"){if(o.available===!1)return e.jsx(q,{note:o.note});const h=o.grades||{};return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(230px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsxs("div",{style:ge,children:["GAMMA BRIDGE · VIA ",o.index||"â"]}),u("index spot",O(o.index_spot,2)),u("basis ratio",O(o.basis_ratio,5)),u("net GEX",o.net_gex!=null?`${(o.net_gex/1e9).toFixed(2)}B`:"â",o.regime==="positive"?t.green:t.red)]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"EM RAILS · PIN · MAGNET"}),u("EM",o.em_pct!=null?`±${O(o.em_pct,2)}%`:"â",t.blue),u("rails",`${O(o.em_dn,2)} â ${O(o.em_up,2)}`),u("pin / magnet",`${O(o.pin,2)} / ${O(o.magnet,2)}`,t.magenta),u("max pain",O(o.max_pain,2),t.magenta)]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"HONEST GRADES (§05)"}),e.jsxs("div",{style:{display:"flex",gap:4,flexWrap:"wrap",marginTop:4},children:[e.jsxs("span",{style:he(t.green),children:["γ-REGIMEâVOL ",h.regime_vol||"PROVEN"]}),e.jsxs("span",{style:he(t.blue),children:["WALLS ",h.walls||"PLAUSIBLE"]}),e.jsxs("span",{style:he(t.magenta),children:["PIN ",h.pin||"FOLKLORE"]})]}),e.jsx(q,{note:s("markets.futures.terrainLocates")})]})]})}if(n==="AUCTION"){const h=r.day_probs||{},m=(r.profile||[]).slice(-14),y=Math.max(...m.map(b=>b.vol),1);return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(230px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsxs("div",{style:ge,children:["PROFILE",r.weighted_by==="tick_count"?" · TICK-COUNT WT":""]}),m.map(b=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"64px 1fr",gap:6,alignItems:"center"},children:[e.jsx("span",{style:{...L(8.5,b.price===r.vpoc?t.gold:t.dim),textAlign:"right"},children:O(b.price,2)}),e.jsx("span",{style:{height:7,background:b.price===r.vpoc?t.gold:"rgba(167,175,188,0.25)",width:`${b.vol/y*100}%`,borderRadius:2}})]},b.price)),u("VPOC · VA",`${O(r.vpoc,2)} · ${O(r.val,2)}â${O(r.vah,2)}`,t.gold)]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"DAY TYPE · OPEN"}),["balance","trend_up","trend_down","double_dist"].map(b=>e.jsxs("div",{style:{marginTop:4},children:[e.jsxs("span",{style:L(8.5,t.dim),children:[b.toUpperCase()," ",Math.round((h[b]||0)*100),"%"]}),e.jsx("div",{style:{height:5,background:t.elev,borderRadius:3},children:e.jsx("div",{style:{height:5,width:`${(h[b]||0)*100}%`,background:b==="balance"?t.muted:b==="double_dist"?t.magenta:b==="trend_up"?t.green:t.red,borderRadius:3,opacity:.6}})})]},b)),u("open type",r.open_type||"â")]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"STOP MAP · TRAP GAUGE"}),(r.stop_pools||[]).slice(0,5).map((b,f)=>e.jsxs("div",{style:L(9,t.dim),children:[b.side==="buy_stops"?"â²":"â¼"," ",O(b.price,2)," ",e.jsxs("span",{style:{color:t.slate},children:["(",b.basis,")"]})]},f)),u("trap · buys underwater",r.trap?.pct_buys_underwater!=null?`${Math.round(r.trap.pct_buys_underwater*100)}%`:"â",t.gold),(r.naked_pocs||[]).map(b=>e.jsxs("div",{style:L(9,t.magenta),children:["nPOC ",O(b.price,2)," · ",b.date]},b.price))]})]})}if(n==="POSITIONING"){const h=a.oi_quadrant||{},m=[["new_longs","Pâ OIâ new longs"],["short_covering","Pâ OIâ covering"],["new_shorts","Pâ OIâ new shorts"],["long_liquidation","Pâ OIâ liquidation"]],y=Object.keys(a.cot||{}).filter(b=>b.endsWith("_net"));return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(230px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:ge,children:s("markets.futures.overnightInventory")}),u("ON net delta",a.on_inventory!=null?`${Math.round(a.on_inventory*100)}%`:"â",(a.on_inventory||0)<0?t.red:t.green),e.jsx(Ae,{frac:a.on_inventory!=null?(Number(a.on_inventory)+1)/2:NaN,color:(a.on_inventory||0)<0?t.red:t.green,mid:!0}),e.jsx(q,{note:s("markets.futures.lopsidedBookNote")})]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"OI QUADRANT"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,marginTop:4},children:m.map(([b,f])=>e.jsx("div",{style:{border:h.label===b?`1px solid ${t.gold}`:`1px dashed ${t.border2}`,borderRadius:6,padding:"5px 7px",...L(8,h.label===b?t.gold:t.dim),background:h.label===b?"rgba(210,162,76,0.08)":"transparent"},children:f},b))}),h.label==="pending_oi_feed"&&e.jsx(q,{note:s("markets.futures.oiWriterPending")})]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"COT · 3Y PERCENTILE BANDS"}),y.length?y.map(b=>{const f=b.replace("_net",""),w=Number(a.cot[`${f}_pct`]);return e.jsxs("div",{style:{marginTop:4},children:[e.jsxs("span",{style:L(8.5,t.dim),children:[f.toUpperCase()," ",xt(a.cot[b]),isFinite(w)?` · p${Math.round(w*100)}`:""]}),e.jsx(Ae,{frac:isFinite(w)?w:NaN,h:8})]},b)}):e.jsx(q,{note:s("markets.futures.cotAccruesNote")})]})]})}if(n==="CURVE"){const h=p.basis||{};return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(230px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:ge,children:s("markets.futures.rollRadarLabel")}),p.roll?e.jsxs(e.Fragment,{children:[u("front â next",`${p.roll.front} â ${p.roll.next}`),u("roll date",`${p.roll.roll_date} · Tâ${p.roll.days_to_roll}D`),u("expiry",p.roll.expiry)]}):e.jsx(q,{note:s("markets.futures.rollRadarPending")}),e.jsx(q,{note:s("markets.futures.levelsAutoTranslate")})]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"BASIS & PROGRAMS"}),h.available?e.jsxs(e.Fragment,{children:[u("basis",O(h.basis,2)),u("fair (carry)",O(h.fair,2)),u("residual · z",`${O(h.residual,2)} · ${h.z!=null?O(h.z,1):"â (needs 30 samples)"}`,t.gold)]}):e.jsx(q,{note:h.note||s("markets.futures.basisNeedsIndex")})]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"TERM STRIP · SWING DESK (§19)"}),p.term?.available?u("term",`${String(p.term.next||"").replace("/","")} ${O(p.term.next_px,2)} · ${O(p.term.spread,2)} ${String(p.term.state||"").toUpperCase()}`,p.term.state==="backwardation"?t.gold:t.text):e.jsx(q,{note:p.term?.note||s("markets.futures.backMonthsPending")}),e.jsx(q,{note:s("markets.futures.swingLanesNote")})]})]})}return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(230px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"LEAD-LAG · SIBLING"}),u(`${d.sibling?.symbol||"â"} confirms`,d.sibling?.confirms==null?"â":d.sibling.confirms?"CONFIRMS":"REFUSES",d.sibling?.confirms===!1?t.red:d.sibling?.confirms?t.green:t.dim),e.jsx(q,{note:s("markets.futures.msLeadPending")})]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"EVENT FUSE (§18)"}),u("next event",d.minutes_to_event!=null?`Tâ${En(d.minutes_to_event)}`:"none scheduled",t.gold),e.jsx(q,{note:s("markets.futures.eventLensPendingWarehouse")})]}),e.jsxs("div",{children:[e.jsx("div",{style:ge,children:"INTERNALS · INTERMARKET"}),d.internals?.available?u("breadth",d.internals.lean>0?"UP":d.internals.lean<0?"DOWN":"MIXED",d.internals.lean>0?t.green:d.internals.lean<0?t.red:t.dim):e.jsx(q,{note:d.internals?.note||s("markets.futures.synthTickPending")}),d.intermarket?.available?u(`VIX ${O(d.intermarket.vix,1)}`,(d.intermarket.read||"â").toUpperCase(),d.intermarket.lean>0?t.green:d.intermarket.lean<0?t.red:t.dim):e.jsx(q,{note:"â"})]})]})}function Ni({compass:n,con:l,board:s}){const i=s?.context||{},o=s?.auction||{},r=s?.terrain||{},a=s?.summary||{},p=Number(a.last),d=(T,S)=>T==null||!isFinite(Number(T))?0:Number(T)>S?1:Number(T)<-S?-1:0,c=(r.regime||"").toString().toLowerCase(),u=/neg/.test(c)?"trend":/pos|pin|balan/.test(c)?"fade":"mixed",h=Number(o.vpoc),m=Number(o.vah),y=Number(o.val),b=!isFinite(p)||!p?null:isFinite(m)&&isFinite(y)&&m>y?p>m?1:p<y?-1:0:isFinite(h)?d((p-h)/p*100,.05):null,f={trend:d(l?.master??n?.ch?.day,.15),location:b,flow:d(l?.tapePulse,.1),internals:i.internals?.available?Number(i.internals.lean)||0:null,intermarket:i.intermarket?.available?Number(i.intermarket.lean)||0:null},w=o.open_type,v=w==="open_drive_up"?1:w==="open_drive_down"?-1:0,g=Object.values(f).filter(T=>T!=null),x=g.filter(T=>T>0).length,j=g.filter(T=>T<0).length,_=g.length,E=x>j?1:j>x?-1:0;return{V:f,regime:u,drive:v,dir:E,agree:Math.max(x,j),total:_,up:x,down:j}}function mp({compass:n,con:l,board:s}){const i=Ni({compass:n,con:l,board:s}),o=s?.context||{},r=o.internals||{},a=o.intermarket||{},p=s?.tape?.divergence||{},d=(v,g,x=t.text)=>e.jsxs("div",{style:{...L(9.5),marginTop:3},children:[v," ",e.jsx("b",{style:{color:x},children:g})]}),c=v=>v==null?t.dim:v>0?t.green:v<0?t.red:t.muted,u=v=>v==null?"n/a":v>0?"LONG":v<0?"SHORT":"flat",h=[["TREND",i.V.trend],["LOCATION",i.V.location],["FLOW",i.V.flow],["INTERNALS",i.V.internals],["INTERMARKET",i.V.intermarket]],m=i.dir>0?t.green:i.dir<0?t.red:t.dim,y=i.dir>0?"LONG":i.dir<0?"SHORT":"NO LEAN",b=i.regime==="trend"?t.blue:i.regime==="fade"?t.gold:t.dim,f=i.regime==="trend"?"NEGATIVE γ · TREND (trust breakouts)":i.regime==="fade"?"POSITIVE γ · FADE (mean-revert)":"MIXED / no surface",w=(v,g=2)=>v==null?"â":`${v>0?"+":""}${O(v,g)}%`;return e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:{...ge,display:"flex",alignItems:"center",gap:6},children:["CONTEXT · CONFLUENCE ",e.jsx(Ee,{k:"confluence",size:12}),e.jsxs("span",{style:{marginLeft:"auto",...L(12,m),fontWeight:800},children:[i.agree,"/",i.total," ",y]})]}),e.jsxs("div",{style:{...L(8.5,b),fontWeight:700,marginBottom:7,display:"flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{...he(b),fontSize:8,fontWeight:800,background:`${b}22`},children:"γ"}),f]}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:[h.map(([v,g])=>e.jsxs("span",{style:{...he(c(g)),fontSize:8.5,fontWeight:700,background:g?g>0?"rgba(55,209,131,0.12)":"rgba(240,82,79,0.12)":"transparent"},children:[v," · ",u(g)]},v)),i.drive!==0&&e.jsxs("span",{style:{...he(i.drive>0?t.green:t.red),fontSize:8,fontWeight:800},children:["OPEN-DRIVE ",i.drive>0?"UP":"DN"]}),p.diverging&&e.jsx("span",{style:{...he(t.gold),fontSize:8,fontWeight:800,background:"rgba(210,162,76,0.14)"},children:"â CVD DIVERGENCE"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsxs("div",{children:[e.jsx("div",{style:{...L(8,t.dim),letterSpacing:"0.12em",marginBottom:2},children:"INTERNALS · BREADTH"}),r.available?e.jsxs(e.Fragment,{children:[d("adv / dec",`${r.adv!=null?Math.round(r.adv):"â"} / ${r.dec!=null?Math.round(r.dec):"â"} · net ${O(r.breadth,2)}`,c(r.lean)),d("up/down vol",`${O(r.up_down_vol,2)}Ã`,r.up_down_vol>1.05?t.green:r.up_down_vol<.95?t.red:t.dim)]}):e.jsx(q,{note:r.note||"N/A"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{...L(8,t.dim),letterSpacing:"0.12em",marginBottom:2},children:"INTERMARKET"}),a.available?e.jsxs(e.Fragment,{children:[d("VIX",`${O(a.vix,2)} ${(a.vix_state||"").toUpperCase()} ${w(a.vix_chg,1)}${a.vix_term_state?" · "+a.vix_term_state:""}`,a.vix_state==="stress"?t.red:a.vix_state==="elevated"?t.gold:t.dim),d("dollar",`${O(a.dxy,2)} ${w(a.dxy_chg)}
7 · ${(a.read||"").toUpperCase()}`,c(a.lean))]}):e.jsx(q,{note:"cold"})]})]}),e.jsx("div",{style:{...L(7.5,t.dim),marginTop:6},children:"read the γ REGIME first · stacking INDEPENDENT confirmations improves odds · NOT a validated same-session edge (dir_hit ~32%)"})]})}function hp({deck:n,view:l,board:s,sym:i,compass:o,con:r}){const{t:a}=W(),p=s?.tape||{},d=s?.terrain||{},c=s?.auction||{},u=s?.positioning||{},h=s?.curve||{},m=s?.context||{},y=s?.summary||{},b=(v,g,x=t.text)=>e.jsxs("div",{style:{...L(9.5),marginTop:4},children:[v," ",e.jsx("b",{style:{color:x},children:g})]}),f=({t:v,children:g,wide:x=!1})=>e.jsxs("div",{style:{flex:x?2:1,minWidth:230},children:[e.jsx("div",{style:ge,children:v}),g]}),w=({children:v})=>e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap"},children:v});if(n==="TAPE"){const v=p.speed||{},g=p.prints||[],x=g.reduce((C,I)=>C+(I.size||0),0)||1,j=C=>Math.round(g.filter(I=>I.lot===C).reduce((I,F)=>I+(F.size||0),0)/x*100),_=s?.session_cvd;let E=null;if(_?.available&&Array.isArray(_.d)&&_.d.length){let C=0;E=_.d.map(I=>(C+=I,{cum:C}))}const T=E||p.cvd||[],S=T.length>=2?T[T.length-1].cum-T[Math.max(0,T.length-30)].cum:null;return e.jsxs(w,{children:[e.jsxs(f,{t:"CVD vs PRICE · DIVERGENCE AT THE WALL",wide:!0,children:[e.jsx(Dl,{cvd:E||p.cvd,h:90}),b("CVD (last 30 buckets)",S!=null?`${S>=0?"+":""}${xt(Math.round(S))}`:"â",(S||0)>=0?t.green:t.red),b("δ session",xt(E?_.total:p.delta?.delta),((E?_.total:p.delta?.delta)||0)>=0?t.green:t.red),e.jsx(q,{note:a("markets.futures.ofiRefusalTell")})]}),e.jsxs(f,{t:"SPEED · LOT CLASS · TOXICITY",wide:!0,children:[b("SPEED â median",`${O(v.rate_median,2)}/s · now ${O(v.rate_now,2)}/s · burst z ${O(v.burst_z,1)}`,(v.burst_z||0)>2?t.gold:t.text),e.jsx(Ae,{frac:Math.min(1,Math.max(0,(v.burst_z||0)/4))}),b("LOT CLASS",g.length?`INST ${j("inst")}% · MID ${j("mid")}% · RETAIL ${j("retail")}%`:"â"),e.jsxs("div",{style:{display:"flex",height:8,borderRadius:3,overflow:"hidden",marginTop:4,background:t.elev},children:[e.jsx("span",{style:{width:`${j("inst")}%`,background:"rgba(210,162,76,0.55)"}}),e.jsx("span",{style:{width:`${j("mid")}%`,background:"rgba(167,175,188,0.35)"}}),e.jsx("span",{style:{width:`${j("retail")}%`,background:"rgba(100,116,139,0.3)"}})]}),b("VPIN",y.vpin!=null?`${O(y.vpin,3)} · p${Math.round((y.vpin_pctile||0)*100)}`:"â",t.gold),e.jsx(xn,{frac:Number(y.vpin_pctile),h:9}),b("Kyle's λ",y.lambda_pctile!=null?`p${Math.round(y.lambda_pctile*100)}${y.lambda_pctile>.85?" â book thin, moves cheap to push":""}`:"â")]})]})}if(n==="TERRAIN"&&d.available!==!1){if(l==="Gamma Bridge"){const v=d.regime==="negative",g=d.nowcast,x=g?Number(g.contracts):null;return e.jsxs(w,{children:[e.jsxs(f,{t:"THE HONEST FRAME â OUR OWN RESEARCH",wide:!0,children:[e.jsxs("div",{style:{...L(9.5,t.muted),lineHeight:1.65},children:["GEX predicts ",e.jsx("b",{style:{color:t.text},children:"volatility, not direction"})," (our study; the âGEXâVIXâ trap). Terrain is a ",e.jsx("b",{style:{color:t.text},children:"locator + regime dial"}),": γ+ dampens (fade edges), γâ amplifies (breaks run) â",e.jsx("i",{style:{color:t.gold,fontStyle:"normal"},children:" terrain locates, tape decides."})]}),e.jsxs("div",{style:{...L(9.5),marginTop:8},children:["γ REGIME â ",e.jsx("b",{style:{color:v?t.red:t.green},children:v?"BELOW FLIP · AMPLIFYING":"ABOVE FLIP · DAMPENING"}),e.jsxs("span",{style:{color:t.dim},children:[" · flip ",O(d.flip,2)," · ",v?"reclaim flips the playbook from breakout to fade":"loss of the flip arms the expansion family"]})]}),e.jsx(Ae,{frac:v?.27:.73,color:v?t.red:t.green,mid:!0}),b("via",`${d.index} · spot ${O(d.index_spot,2)} · ratio ${O(d.basis_ratio,5)}`),b("net GEX",d.net_gex!=null?`${(d.net_gex/1e9).toFixed(2)}B`:"â",v?t.red:t.green)]}),e.jsx(f,{t:`HEDGE-FLOW NOWCAST â OUR DEX, IN ${i} CONTRACTS`,wide:!0,children:g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...L(9.5),marginTop:4},children:["DAY NET DEALER HEDGE â ",e.jsxs("b",{style:{color:x>=0?t.green:t.red},children:[x>=0?"+":"",O(x,0)," ",i]}),e.jsxs("span",{style:{color:t.dim},children:[" (",x>=0?"to buy":"to sell",")"]})]}),e.jsx(Ae,{frac:.5+Math.max(-.48,Math.min(.48,x/1e4)),color:x>=0?t.green:t.red,mid:!0}),e.jsxs("div",{style:{...L(9.5),marginTop:8},children:["IF PIN ",e.jsx("b",{style:{color:t.magenta},children:O(d.pin??d.magnet,2)})," HOLDS INTO CLOSE â charm ",d.charm_regime||"â"," pressure"]}),e.jsxs("div",{style:{...L(9.5),marginTop:4},children:["IF ",e.jsx("b",{style:{color:t.blue},children:O(d.em_dn,2)})," EMâ BREAKS â γâ hedge selling accelerant"]})]}):e.jsx(q,{note:a("markets.futures.deltaCache05")})})]})}if(l==="EM Rails")return e.jsxs(w,{children:[e.jsxs(f,{t:"EM RAILS · PIN · MAGNET",children:[b("EM",d.em_pct!=null?`±${O(d.em_pct,2)}%`:"â",t.blue),b("rails",`${O(d.em_dn,2)} â ${O(d.em_up,2)}`),b("pin / magnet",`${O(d.pin,2)} / ${O(d.magnet,2)}`,t.magenta),b("max pain",O(d.max_pain,2),t.magenta)]}),e.jsxs(f,{t:"HONEST GRADES (§05)",children:[e.jsxs("div",{style:{display:"flex",gap:4,flexWrap:"wrap",marginTop:4},children:[e.jsx("span",{style:he(t.blue),children:"EM = ATM STRADDLE"}),e.jsx("span",{style:he(t.magenta),children:"PIN / MAX-PAIN FOLKLORE"})]}),e.jsx(q,{note:a("markets.futures.emRailsLocate")})]})]});if(l==="Hedge Nowcast"){const v=d.nowcast,g=v?Number(v.contracts):null,x=g!=null?.5+Math.max(-.48,Math.min(.48,g/1e4)):NaN;return e.jsx(w,{children:e.jsx(f,{t:`HEDGE-FLOW NOWCAST â OUR DEX, IN ${i} CONTRACTS`,wide:!0,children:v?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...L(11),marginTop:6},children:["DAY NET DEALER HEDGE â ",e.jsxs("b",{style:{color:g>=0?t.green:t.red,fontSize:14},children:[g>=0?"+":"",O(g,0)," ",i]}),e.jsxs("span",{style:{color:t.dim},children:[" · ",xt(v.cum_delta_units)," Î-units · ",v.source]})]}),e.jsx(Ae,{frac:x,color:g>=0?t.green:t.red,mid:!0}),e.jsxs("div",{style:{...L(9.5),marginTop:8},children:["charm regime ",e.jsx("b",{style:{color:d.charm_regime==="positive"?t.green:d.charm_regime==="negative"?t.red:t.dim},children:d.charm_regime||"â"}),e.jsxs("span",{style:{color:t.dim},children:[" · pin ",O(d.pin??d.magnet,2)," · EMâ ",O(d.em_dn,2)]})]}),e.jsx(q,{note:a("markets.futures.contractsDexNote")})]}):e.jsx(q,{note:a("markets.futures.deltaCache05Nowcast")})})})}}if(n==="AUCTION"){const v=c.day_probs||{};if(l==="Day Type")return e.jsx(w,{children:e.jsxs(f,{t:"DAY-TYPE STATE MACHINE · LIVE ODDS",wide:!0,children:[b("OPEN TYPE â",String(c.open_type||"unknown").toUpperCase().replace(/_/g,"-")),["balance","trend_up","trend_down","double_dist"].map(g=>e.jsxs("div",{style:{marginTop:4},children:[e.jsxs("span",{style:L(8.5,t.dim),children:[g.toUpperCase()," ",Math.round((v[g]||0)*100),"%"]}),e.jsx("div",{style:{height:5,background:t.elev,borderRadius:3},children:e.jsx("div",{style:{height:5,width:`${(v[g]||0)*100}%`,background:g==="balance"?t.muted:g==="double_dist"?t.magenta:g==="trend_up"?t.green:t.red,borderRadius:3,opacity:.6}})})]},g)),e.jsx(q,{note:a("markets.futures.balanceEdgeFade")})]})});if(l==="Stop Map")return e.jsxs(w,{children:[e.jsxs(f,{t:"EST. STOP POOLS",children:[(c.stop_pools||[]).slice(0,6).map((g,x)=>e.jsxs("div",{style:{...L(9.5),marginTop:3},children:[e.jsxs("b",{style:{color:g.side==="buy_stops"?t.red:t.green},children:[O(g.price,2),g.side==="buy_stops"?"+":"â"]}),e.jsxs("span",{style:{color:t.dim},children:[" (",g.basis," · ",g.side==="buy_stops"?"shorts trapped above":"longs trapped below",")"]})]},x)),e.jsx(q,{note:a("markets.futures.stopEstimatesNote")})]}),e.jsxs(f,{t:"NAKED POCs",children:[(c.naked_pocs||[]).length?(c.naked_pocs||[]).map(g=>e.jsxs("div",{style:{...L(9.5,t.magenta),marginTop:3},children:["nPOC ",O(g.price,2)," · ",g.date]},g.price)):e.jsx(q,{note:a("markets.futures.noNakedPocs")}),e.jsx(q,{note:a("markets.futures.nakedPocFolklore")})]})]});if(l==="Trap Gauge")return e.jsx(w,{children:e.jsxs(f,{t:"TRAP GAUGE â RECENT AGGRESSORS UNDERWATER",wide:!0,children:[b("buys underwater",c.trap?.pct_buys_underwater!=null?`${Math.round(c.trap.pct_buys_underwater*100)}% (buy VWAP ${O(c.trap.buy_vwap,2)})`:"â",t.gold),e.jsx(Ae,{frac:c.trap?.pct_buys_underwater,color:t.red}),b("sells underwater",c.trap?.pct_sells_underwater!=null?`${Math.round(c.trap.pct_sells_underwater*100)}% (sell VWAP ${O(c.trap.sell_vwap,2)})`:"â",t.gold),e.jsx(Ae,{frac:c.trap?.pct_sells_underwater,color:t.green}),e.jsx(q,{note:p.degraded_no_size?"needs trade prints â crypto's realized-price concept ported intraday (§06)":"their pain shelf = fuel INTO the magnet â targets align"})]})})}if(n==="POSITIONING"){if(l==="COT Bands"){const v=u.oi_quadrant||{},g=y.last&&y.settle?(y.last/y.settle-1)*100:null,x=[["new_longs","Pâ OIâ new longs"],["short_covering","Pâ OIâ covering"],["new_shorts","Pâ OIâ new shorts"],["long_liquidation","Pâ OIâ liquidation"]],j=Object.keys(u.cot||{}).filter(_=>_.endsWith("_net"));return e.jsxs(w,{children:[e.jsx(f,{t:`COT BANDS · 3Y PERCENTILE${u.cot?.report_date?` · ${u.cot.report_date}`:""}`,children:j.length?j.map(_=>{const E=_.replace("_net",""),T=Number(u.cot[`${E}_pct`]);return e.jsxs("div",{style:{marginTop:5},children:[e.jsxs("span",{style:L(8.5,t.dim),children:[E.toUpperCase()," ",e.jsx("b",{style:{color:t.text},children:xt(u.cot[_])}),isFinite(T)?` · p${Math.round(T*100)}`:""]}),e.jsx(xn,{frac:isFinite(T)?T:NaN,zones:[[0,.15,"rgba(210,162,76,0.18)"],[.85,1,"rgba(210,162,76,0.18)"]]})]},_)}):e.jsx(q,{note:a("markets.futures.cotAccruesBands")})}),e.jsxs(f,{t:"OI QUADRANT · PRIOR SESSION",children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,marginTop:4},children:x.map(([_,E])=>e.jsx("div",{style:{border:v.label===_?`1px solid ${t.gold}`:`1px dashed ${t.border2}`,borderRadius:6,padding:"5px 7px",...L(8,v.label===_?t.gold:t.dim),background:v.label===_?"rgba(210,162,76,0.08)":"transparent"},children:E},_))}),e.jsx(q,{note:v.label==="pending_oi_feed"||v.oi==null?"OI accrues from the Summary stream":`price ${g!=null?`${g>=0?"+":""}${O(g,2)}%`:"â"} · OI ${v.oi_chg_pct>=0?"+":""}${O(v.oi_chg_pct,2)}% â ${v.desc||""}`})]}),e.jsxs(f,{t:"OVERNIGHT INVENTORY · GLOBEX",children:[b("ON NET DELTA â",u.on_inventory!=null?`${Math.abs(Math.round(u.on_inventory*100))}% ${u.on_inventory<0?"SHORT":"LONG"}`:"â",(u.on_inventory||0)<0?t.red:t.green),e.jsx(Ae,{frac:u.on_inventory!=null?(Number(u.on_inventory)+1)/2:NaN,color:(u.on_inventory||0)<0?t.red:t.green,mid:!0}),e.jsx(q,{note:a("markets.futures.lopsidedInventoryNote")})]})]})}if(l==="Inventory")return e.jsx(w,{children:e.jsxs(f,{t:"OVERNIGHT INVENTORY · GLOBEX",wide:!0,children:[b("ON SESSION NET DELTA â",u.on_inventory!=null?`${Math.abs(Math.round(u.on_inventory*100))}% ${u.on_inventory<0?"SHORT":"LONG"}`:"â",(u.on_inventory||0)<0?t.red:t.green),e.jsx(Ae,{frac:u.on_inventory!=null?(Number(u.on_inventory)+1)/2:NaN,color:(u.on_inventory||0)<0?t.red:t.green,mid:!0}),e.jsx(q,{note:a("markets.futures.inventoryPlaybook")})]})})}if(n==="CURVE"){const v=h.basis||{};if(l==="Term Strip"){const g=h.term||{},x=g.state==="backwardation";return e.jsxs(w,{children:[e.jsxs(f,{t:"TERM STRIP",children:[e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:4},children:[e.jsxs("div",{style:{border:"1px solid rgba(210,162,76,0.55)",borderRadius:8,padding:"8px 12px"},children:[e.jsx("div",{style:L(9,t.gold),children:g.front||h.roll?.front||i}),e.jsx("div",{style:{...L(14,t.text),fontWeight:800},children:O(y.last,2)}),e.jsx("div",{style:L(8.5,t.dim),children:"front · live"})]}),g.available?e.jsxs("div",{style:{border:`1px solid ${t.border2}`,borderRadius:8,padding:"8px 12px"},children:[e.jsx("div",{style:L(9,t.muted),children:String(g.next||"").replace("/","")}),e.jsx("div",{style:{...L(14,t.text),fontWeight:800},children:O(g.next_px,2)}),e.jsxs("div",{style:{...L(8.5,x?t.gold:t.dim)},children:[g.spread>=0?"+":"",O(g.spread,2)," · ",x?"BACK":"CONTANGO"]})]}):e.jsx(q,{note:a("markets.futures.nextMonthPending")})]}),g.available&&e.jsxs("div",{style:{...L(9.5),marginTop:6},children:["roll yield â ",e.jsxs("b",{style:{color:(g.roll_yield_est||0)>0?t.green:t.red},children:[O((g.roll_yield_est||0)*100,1),"%/yr"]}),e.jsxs("span",{style:{color:t.dim},children:[" · ",x?"the long is PAID to wait":"the long PAYS carry"]})]}),e.jsx(q,{note:a("markets.futures.curveFlipBias")})]}),e.jsxs(f,{t:"ROLL RADAR",children:[h.roll?e.jsxs(e.Fragment,{children:[b(`${h.roll.front} â ${h.roll.next}`,`Tâ${h.roll.days_to_roll}D (${h.roll.roll_date})`),e.jsx(Ae,{frac:Math.max(.02,1-h.roll.days_to_roll/90),h:8})]}):e.jsx(q,{note:a("markets.futures.rollRadarPendingSymbol")}),e.jsx(q,{note:a("markets.futures.rollMigrationNote")}),e.jsx(q,{note:a("markets.futures.clRollsMonthly")})]}),e.jsx(f,{t:"BASIS & PROGRAMS",children:v.available?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...L(9.5),marginTop:4},children:["BASIS vs FAIR â ",e.jsxs("b",{style:{color:t.text},children:[O(v.residual,2),"pt · z ",v.z!=null?O(v.z,1):"â"]})," ",e.jsx("span",{style:he(v.z!=null&&Math.abs(v.z)>=3?t.red:t.green),children:v.z!=null&&Math.abs(v.z)>=3?"PROGRAM BURST":"PROGRAMS QUIET"})]}),e.jsx(xn,{frac:v.z!=null?Math.max(0,Math.min(1,.5+v.z/8)):NaN,h:9,zones:[[0,.12,"rgba(240,82,79,0.18)"],[.88,1,"rgba(240,82,79,0.18)"]]}),(v.bursts||[]).length?(v.bursts||[]).map((j,_)=>e.jsxs("div",{style:{...L(9,t.red),marginTop:3},children:["burst ",pp(j.ts)," · z ",O(j.z,1)," · resid ",O(j.residual,2),"pt"]},_)):e.jsx(q,{note:a("markets.futures.burstLogAccrues")}),e.jsx(q,{note:a("markets.futures.fairValueFormula")})]}):e.jsx(q,{note:v.note||a("markets.futures.basisNeedsIndexDvp")})})]})}if(l==="__legacy_term__"){const g=h.term||{},x=g.state==="backwardation";return e.jsx(w,{children:e.jsxs(f,{t:"TERM STRIP",wide:!0,children:[e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:4,alignItems:"stretch"},children:[e.jsxs("div",{style:{border:"1px solid rgba(210,162,76,0.55)",borderRadius:8,padding:"8px 12px"},children:[e.jsx("div",{style:L(9,t.gold),children:g.front||h.roll?.front||i}),e.jsx("div",{style:{...L(14,t.text),fontWeight:800},children:O(y.last,2)}),e.jsx("div",{style:L(8.5,t.dim),children:"front · live"})]}),g.available?e.jsxs("div",{style:{border:`1px solid ${t.border2}`,borderRadius:8,padding:"8px 12px"},children:[e.jsx("div",{style:L(9,t.muted),children:String(g.next||"").replace("/","")}),e.jsx("div",{style:{...L(14,t.text),fontWeight:800},children:O(g.next_px,2)}),e.jsxs("div",{style:{...L(8.5,x?t.gold:t.dim)},children:[g.spread>=0?"+":"",O(g.spread,2)," · ",x?"BACKWARDATION":"CONTANGO"]})]}):e.jsxs("div",{style:{border:`1px dashed ${t.border2}`,borderRadius:8,padding:"8px 12px"},children:[e.jsx("div",{style:L(9,t.dim),children:h.roll?.next||"â"}),e.jsx("div",{style:{...L(14,t.dim),fontWeight:800},children:"â"}),e.jsx("div",{style:L(8.5,t.dim),children:"waiting on the next-month quote"})]})]}),g.available&&e.jsxs("div",{style:{...L(9.5),marginTop:8},children:["roll yield â ",e.jsxs("b",{style:{color:(g.roll_yield_est||0)>0?t.green:t.red},children:[O((g.roll_yield_est||0)*100,1),"%/yr"]}),e.jsxs("span",{style:{color:t.dim},children:[" (est. on ~",g.gap_days_est,"d gap) · ",x?"the long is PAID to wait":"the long PAYS carry"]})]}),e.jsx(q,{note:a("markets.futures.promptSpreadNote")})]})})}if(l==="Basis & Programs")return e.jsx(w,{children:e.jsx(f,{t:"BASIS & PROGRAMS",wide:!0,children:v.available?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...L(9.5),marginTop:4},children:["BASIS vs FAIR â ",e.jsxs("b",{style:{color:t.text},children:[O(v.residual,2),"pt · z ",v.z!=null?O(v.z,1):"â"]})," ",e.jsx("span",{style:he(v.z!=null&&Math.abs(v.z)>=3?t.red:t.green),children:v.z!=null&&Math.abs(v.z)>=3?"PROGRAM BURST":"PROGRAMS QUIET"})]}),b("basis / fair",`${O(v.basis,2)} / ${O(v.fair,2)}`),(v.bursts||[]).length?(v.bursts||[]).map((g,x)=>e.jsxs("div",{style:{...L(9,t.red),marginTop:3},children:["burst ",new Date(g.ts).toLocaleTimeString("en-US",{hour12:!1,timeZone:"America/Ne
7w_York"})," · z ",O(g.z,1)," · resid ",O(g.residual,2),"pt"]},x)):e.jsx(q,{note:a("markets.futures.burstLogFair08")})]}):e.jsx(q,{note:v.note||a("markets.futures.basisNeedsIndex08")})})})}if(n==="CONTEXT"){if(l==="Confluence"){const v=Ni({compass:o,con:r,board:s}),g=T=>T==null?t.dim:T>0?t.green:T<0?t.red:t.muted,x=T=>T==null?"n/a":T>0?"LONG":T<0?"SHORT":"flat",j=[["TREND",v.V.trend],["LOCATION",v.V.location],["FLOW",v.V.flow],["INTERNALS",v.V.internals],["INTERMARKET",v.V.intermarket]],_=v.dir>0?t.green:v.dir<0?t.red:t.dim,E=v.dir>0?"LONG":v.dir<0?"SHORT":"NO LEAN";return e.jsx(w,{children:e.jsxs(f,{t:"CONFLUENCE · SIX-DIMENSION BUY / SELL READ",wide:!0,children:[b("regime (gamma) â read FIRST",v.regime==="trend"?"NEGATIVE γ · TREND â trust breakouts, do not fade":v.regime==="fade"?"POSITIVE γ · FADE â mean-revert, fade extremes":"MIXED / no surface",v.regime==="trend"?t.blue:v.regime==="fade"?t.gold:t.dim),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,margin:"8px 0"},children:j.map(([T,S])=>e.jsxs("span",{style:{...he(g(S)),fontSize:8.5,fontWeight:700,background:S?S>0?"rgba(55,209,131,0.12)":"rgba(240,82,79,0.12)":"transparent"},children:[T," · ",x(S)]},T))}),v.drive!==0&&b("open type",v.drive>0?"OPEN-DRIVE UP · high-conviction long":"OPEN-DRIVE DOWN · high-conviction short",v.drive>0?t.green:t.red),b("confluence",`${v.agree} of ${v.total} dimensions lean ${E}`,_),e.jsx(q,{note:"stacking INDEPENDENT confirmations improves odds and avoids bad entries â it is NOT a validated same-session edge (our own replays: dir_hit ~32%). Read the regime FIRST: it says whether to trust the lean (trend) or fade it (range)."})]})})}if(l==="Lead-Lag")return e.jsxs(w,{children:[e.jsxs(f,{t:"LEAD-LAG · ROLLING 5M",children:[b(`${m.sibling?.symbol||"â"} â ${i}`,m.sibling?.confirms==null?"â":m.sibling.confirms?"SIBLING CONFIRMS":"SIBLING REFUSES",m.sibling?.confirms===!1?t.red:m.sibling?.confirms?t.green:t.dim),e.jsx(q,{note:a("markets.futures.signAgreementLive")}),e.jsx(q,{note:a("markets.futures.zbEsFeed")}),e.jsx(q,{note:a("markets.futures.synthDxyFold")})]}),e.jsxs(f,{t:"INTERNALS · INTERMARKET",children:[m.internals?.available?b("breadth",`${m.internals.lean>0?"UP":m.internals.lean<0?"DOWN":"MIXED"} · net ${O(m.internals.breadth,2)}`,m.internals.lean>0?t.green:m.internals.lean<0?t.red:t.dim):e.jsx(q,{note:m.internals?.note||a("markets.futures.synthTickBreadth")}),m.intermarket?.available&&b(`VIX ${O(m.intermarket.vix,1)}`,(m.intermarket.read||"â").toUpperCase(),m.intermarket.lean>0?t.green:m.intermarket.lean<0?t.red:t.dim)]}),e.jsxs(f,{t:"EVENT FUSE · WAREHOUSE PRIORS",children:[b("next event",m.minutes_to_event!=null?`Tâ${En(m.minutes_to_event)}`:"none scheduled",t.gold),e.jsx(q,{note:a("markets.futures.eventPriors")}),e.jsx(q,{note:a("markets.futures.fuseBreakCard")})]})]});if(l==="Internals"){const v=m.internals||{};if(!v.available)return e.jsx(w,{children:e.jsx(f,{t:"MARKET INTERNALS · BREADTH",wide:!0,children:e.jsx(q,{note:v.note||"internals N/A"})})});const g=v.lean>0?t.green:v.lean<0?t.red:t.dim,x=v.lean>0?"BREADTH UP · participation confirms longs":v.lean<0?"BREADTH DOWN · participation confirms shorts":"MIXED · no breadth edge";return e.jsx(w,{children:e.jsxs(f,{t:"MARKET INTERNALS · SYNTHETIC NYSE ($ADD/$VOLD/$TICK)",wide:!0,children:[b("advancers / decliners",`${v.adv!=null?Math.round(v.adv):"â"} / ${v.dec!=null?Math.round(v.dec):"â"} · net ${O(v.breadth,2)}`,g),b("up / down volume",`${O(v.up_down_vol,2)}Ã`,v.up_down_vol>1.05?t.green:v.up_down_vol<.95?t.red:t.dim),b("TICK proxy",O(v.tick_proxy,0),v.tick_proxy>0?t.green:v.tick_proxy<0?t.red:t.dim),b("read",x,g),e.jsx(q,{note:"equity breadth confirms ES / NQ only · coincident, not leading · display heuristic"})]})})}if(l==="Intermarket"){const v=m.intermarket||{};if(!v.available)return e.jsx(w,{children:e.jsx(f,{t:"INTERMARKET · CROSS-ASSET",wide:!0,children:e.jsx(q,{note:"intermarket cold"})})});const g=v.lean>0?t.green:v.lean<0?t.red:t.dim,x=v.vix_state==="stress"?t.red:v.vix_state==="elevated"?t.gold:t.dim,j=(_,E=2)=>_==null?"":`${_>0?"+":""}${O(_,E)}%`;return e.jsx(w,{children:e.jsxs(f,{t:"INTERMARKET · CROSS-ASSET VETO",wide:!0,children:[b("VIX (fear)",`${O(v.vix,2)} ${(v.vix_state||"").toUpperCase()} ${j(v.vix_chg,1)}`,x),b("US dollar (DXY)",`${O(v.dxy,2)} ${j(v.dxy_chg)}
7`,v.dxy_chg>.15?t.red:v.dxy_chg<-.15?t.green:t.text),b("read",(v.read||"â").toUpperCase(),g),e.jsx(q,{note:Re[Wl(i)]?.cat==="Index"?"risk-on (VIXâ + $â) favors index longs · conviction-shading, never a trigger":"dollar INVERSE leads commodities / rates / FX · conviction-shading, never a trigger"})]})})}if(l==="Crypto Bridge")return e.jsx(w,{children:e.jsx(f,{t:"WEEKEND CRYPTO BRIDGE",wide:!0,children:e.jsx(q,{note:a("markets.futures.btcWeekendDrift")})})});if(l==="Event Fuse")return e.jsx(w,{children:e.jsxs(f,{t:"EVENT FUSE · WAREHOUSE PRIORS",wide:!0,children:[b("next event",m.minutes_to_event!=null?`Tâ${En(m.minutes_to_event)}`:"none scheduled",t.gold),e.jsx(q,{note:a("markets.futures.eventPriorsShort")})]})})}return e.jsx(up,{deck:n,board:s})}function gp({gov:n,ctx:l,sym:s}){const{t:i}=W(),r=ht(()=>qr().catch(()=>null),3e5,[])?.priors?.symbols?.[s],a={...$e,background:t.panel,flex:1,minWidth:200},p=(d,c)=>i("markets.futures.eventPriorLine",{defaultValue:"{{bucket}} shocks (n={{n}}): day runs {{mult}}x normal · first move holds into the close {{persist}}%{{fade}}",bucket:d,n:c.n,mult:c.range_mult,persist:c.persist_pct,fade:c.fade_pct!=null?i("markets.futures.eventPriorFade",{defaultValue:" · fully fades by 10:30 {{pct}}%",pct:c.fade_pct}):""});return e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:[e.jsxs("div",{style:a,children:[e.jsxs("div",{style:ge,children:[i("markets.futures.partTwoGovernor")," ",e.jsx(Ee,{k:"part2",size:11})," ",e.jsx(Ee,{k:"governor",size:11})]}),e.jsx("div",{style:{...L(13,Oc[n.state]||t.dim),fontWeight:900,letterSpacing:"0.12em"},children:n.state||"â"}),e.jsx(q,{note:(n.why||[]).join(" · ")||i("markets.futures.governorNote")}),e.jsx(q,{note:`legal: ${(n.legal||[]).join(", ")||"â"} · size Ã${n.size_mult??"â"}`})]}),e.jsxs("div",{style:a,children:[e.jsx("div",{style:ge,children:i("markets.futures.partTwoThesis")}),e.jsx(q,{note:i("markets.futures.thesisDesc")})]}),e.jsxs("div",{style:a,children:[e.jsxs("div",{style:ge,children:[i("markets.futures.partTwoForcedFlow"),r?e.jsx("span",{style:{...he(t.gold),marginLeft:6,fontSize:7},children:i("markets.futures.eventPriorsLive",{defaultValue:"EMPIRICAL · OUR CANDLES"})}):null]}),r?e.jsxs(e.Fragment,{children:[r["0830"]&&e.jsx(q,{note:p("08:30",r["0830"])}),r[1400]&&e.jsx(q,{note:p("14:00",r[1400])}),e.jsx(q,{note:i("markets.futures.eventPriorHonesty",{defaultValue:"shock days = top-decile 08:30/14:00 bars in our own candle store; base rates, not forecasts"})})]}):e.jsx(q,{note:i("markets.futures.forcedFlowDesc")})]}),e.jsxs("div",{style:a,children:[e.jsx("div",{style:ge,children:i("markets.futures.partTwoGeometry")}),e.jsx(q,{note:i("markets.futures.geometryDesc")}),e.jsx(q,{note:l?.minutes_to_event!=null?i("markets.futures.eventLensArms",{mins:Math.round(l.minutes_to_event)}):i("markets.futures.eventLensPending")})]})]})}function Ms(){const{t:n}=W(),l=Kt(),[s,i]=yt("sa-futures-sym","ES"),o=Wl(s);$.useEffect(()=>{ni(o)},[o]);const[r,a]=$.useState("TERRAIN"),[p,d]=$.useState("Gamma Bridge"),c=Vc(),u=ht(()=>Xr(s),5e3,[s]),h=Hc(s),m=Pc(()=>s?Al(s):Promise.resolve(null),15e3,[s]),y=m.data?.symbol===s?m.data:null,b=!y&&!m.error,[f,w]=yt("sa-futures-tf","5m"),v=ht(()=>Rt(s,f,al[f]||14,Fs[f]||400),12e4,[s,f]),g=ht(()=>Rt(s,f,Math.min(al[f]||14,3),80),6e3,[s,f]),x=$.useMemo(()=>{const B=v?.symbol===s?v.candles||[]:[],te=g?.symbol===s?g.candles||[]:[];if(!B.length)return g?.symbol===s?g:v;if(!te.length)return v;const xe=te[0].t;return{...v,candles:[...B.filter(me=>me.t<xe),...te]}},[v,g,s]),j=ht(()=>Rt(s,"1m",4),1e4,[s]),_=ht(()=>Rt(s,"1d",960),12e4,[s]),E=j?.candles?.length?j.candles:x?.candles,T=ht(()=>Kr().then(B=>B?.tapes||{}),12e3,[]),S=yn("sa-futures",Fc),C=u?.summary||{},F=h&&Math.abs(Date.now()-Number(h.timestamp_ms))<=5e3&&Number.isFinite(Number(h.price))?{...C,last:Number(h.price)}:C,A=Gc(u?.session_cvd)||u?.tape?.cvd,P=Yc({dailyBars:_?.candles,bars:f==="5m"?x?.candles:E,cvd:A,last:F.last,settle:F.settle,vpoc:u?.auction?.vpoc}),V=np({compass:P,cvd:A,bars:E,atrPct:F.atr_pct,last:F.last,vpinPctile:F.vpin_pctile}),J=P?.verdict?`${o} Compass ${P.verdict.mode}: ${P.verdict.rule}`.replace(/\s+â\s+/g,": "):null;$.useEffect(()=>(lt(J),()=>lt(null)),[J]);const Q=F.governor||{},U=u?.auction?.levels||{},D={...u?.context||{},on_high:U.on_high,on_low:U.on_low,on_high_t:U.on_high_t,on_low_t:U.on_low_t};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,minWidth:0,marginTop:8,paddingBottom:56},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:10,flexWrap:"wrap"},children:[!l&&e.jsx(pl,{}),e.jsx(bn,{vis:S,panelDefs:Rc}),e.jsx(ei,{})]}),e.jsx(X,{id:"spine",vis:S,children:e.jsx(Kc,{sum:F,curve:u?.curve,ctx:D,clock:c})}),e.jsx(Gs,{id:"sa-futures-workspace-h-v1",defaultHeight:1100,minHeight:720,maxHeight:2200,disabled:l,handleLabel:"Resize the primary Futures workspace",style:{marginBottom:-10},children:e.jsx(Oe,{id:"sa-futures-cols-v3",stackBelow:l?99999:768,style:{flex:"none",height:l?void 0:"100%"},layoutEpoch:S.layoutEpoch,columns:[{defaultSize:"15%",minSize:"11%",hidden:S.isHidden("rail")&&S.isHidden("stackdial"),node:e.jsx(tt,{id:"sa-futures-left-rows-v1",stackBelow:l?99999:768,layoutEpoch:S.layoutEpoch,rows:[{id:"rail",defaultSize:"68%",minSize:"42%",hidden:S.isHidden("rail"),node:e.jsx(X,{id:"rail",vis:S,style:{height:"100%",minHeight:0,overflow:"hidden"}
7,children:e.jsx(ep,{sym:s,setSym:i,sum:F,curve:u?.curve,allTapes:T,compass:P})})},{id:"stackdial",defaultSize:"32%",minSize:"24%",hidden:S.isHidden("stackdial"),node:e.jsx(X,{id:"stackdial",vis:S,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsx(Jc,{sym:s,data:y,loading:b,error:m.error})})}]})},{defaultSize:"44%",minSize:"24%",hidden:S.isHidden("chart")&&S.isHidden("context")&&S.isHidden("console"),node:e.jsx(tt,{id:"sa-futures-center-rows-v1",stackBelow:l?99999:768,layoutEpoch:S.layoutEpoch,rows:[{id:"chart",defaultSize:"62%",minSize:"38%",hidden:S.isHidden("chart"),node:e.jsx(X,{id:"chart",vis:S,style:{height:l?"clamp(340px, 62vh, 560px)":"100%",minHeight:0,overflow:"hidden"},children:e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsx(Nl,{symbol:s,tf:f,onSymbol:i,onTf:w,tfs:Mc,searchable:!0,searchApi:!1,universe:zc,placeholder:"Search futuresâ¦",right:e.jsxs(e.Fragment,{children:[e.jsx(Ee,{k:"chart"}),u?.terrain?.em_pct!=null?e.jsx("span",{style:{color:t.blue,fontFamily:k,fontSize:10.5,whiteSpace:"nowrap"},children:n("markets.equitiesScan.expectedMoveChip",{pct:O(u.terrain.em_pct,2)})}):null,e.jsx(vn,{symbol:s,assetClass:"futures"})]})}),(()=>{const B=u?.terrain,te=u?.auction,xe=te?.levels||{},me=[["EM+",B?.em_up,t.blue],["ONH",xe.on_high,t.slate],["IBH",xe.ib_high,t.dim],["VAH",te?.vah,t.muted],["CALL WALL",B?.call_wall,t.red],["γ FLIP",B?.flip,t.gold],["VPOC",te?.vpoc,t.gold],["VAL",te?.val,t.muted],["IBL",xe.ib_low,t.dim],["ONL",xe.on_low,t.slate],["PUT WALL",B?.put_wall,t.green],["EMâ",B?.em_dn,t.blue]].filter(([,Y])=>Y!=null&&isFinite(Number(Y))).map(([Y,fe,ke])=>({value:Number(fe),title:Y,color:ke})),be=x?.symbol===s&&x.candles||Ns;return e.jsx("div",{style:{flex:1,minHeight:0,position:"relative"},onMouseLeave:_l,children:e.jsx(Bt,{data:be,liveTick:h,tf:f,symbol:o,levels:me,prefScope:"futures",onReady:Tl,onLoadMore:async Y=>{const fe=await Rt(s,f,al[f]||14,Fs[f]||400,Math.floor(Y/1e3)).catch(()=>null);return fe&&Array.isArray(fe.candles)?fe.candles:[]},contract:x?.contract,height:"100%"})})})()]})})},{id:"context",defaultSize:"18%",minSize:"15%",hidden:S.isHidden("context"),node:e.jsx(X,{id:"context",vis:S,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsx(mp,{compass:P,con:V,board:u})})},{id:"console",defaultSize:"20%",minSize:"17%",hidden:S.isHidden("console"),node:e.jsx(X,{id:"console",vis:S,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsx(lp,{compass:P,con:V})})}]})},{defaultSize:"20%",minSize:"12%",hidden:S.isHidden("terrain")&&S.isHidden("stopmap")&&S.isHidden("flowstack"),node:e.jsx(tt,{id:"sa-futures-terrain-rows-v1",stackBelow:l?99999:768,layoutEpoch:S.layoutEpoch,rows:[{id:"terrain",defaultSize:"28%",minSize:"20%",hidden:S.isHidden("terrain"),node:e.jsx(X,{id:"terrain",vis:S,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:ge,children:["TERRAIN · ",u?.terrain?.available?`${u.terrain.index}â${s} BASIS-MAPPED`:"SESSION MAP",e.jsx(Ee,{k:"terrain",size:12}),u?.terrain?.stale&&e.jsxs("span",{style:{...he(t.gold),marginLeft:6,fontSize:7.5},children:["LAST MEASURED · ",Math.round((u.terrain.stale_s||0)/60),"m"]})]}),e.jsx(rp,{terrain:u?.terrain,auction:u?.auction,last:F.last}),e.jsx("div",{style:{...L(9,t.dim),marginTop:8,lineHeight:1.6},children:u?.terrain?.nowcast?e.jsxs(e.Fragment,{children:["HEDGE NOWCAST ",e.jsxs("b",{style:{color:u.terrain.nowcast.contracts>=0?t.green:t.red},children:[u.terrain.nowcast.contracts>=0?"+":"",O(u.terrain.nowcast.contracts,0)," ",s]})," dealer hedge (day DEX",u.terrain.charm_regime?` · charm ${u.terrain.charm_regime}`:"",")"]}):e.jsxs(e.Fragment,{children:["HEDGE NOWCAST â ",e.jsx("span",{style:{color:t.gold},children:"waiting on the delta cache (§05)"})]})})]})})},{id:"stopmap",defaultSize:"20%",minSize:"15%",hidden:S.isHidden("stopmap"),node:e.jsx(X,{id:"stopmap",vis:S,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsx(op,{auction:u?.auction,last:F.last})})},{id:"flowstack",defaultSize:"52%",minSize:"30%",hidden:S.isHidden("flowstack"),node:e.jsx(X,{id:"flowstack",vis:S,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsxs("div",{style:{...$e,height:"100%",minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{flex:"0 0 auto"}
7,children:e.jsx(ip,{cvd:u?.tape?.cvd,sessionCvd:u?.session_cvd,inferred:u?.tape?.mode==="inferred_tick_rule",bars:E,emUp:u?.terrain?.em_up,emDn:u?.terrain?.em_dn})}),e.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",borderTop:`1px solid ${t.border2}`,marginTop:6},children:e.jsx(sp,{tape:u?.tape,limit:200})})]})})}]})},{defaultSize:"21%",minSize:"12%",hidden:S.isHidden("signals"),node:e.jsx(X,{id:"signals",vis:S,style:{height:"100%",minHeight:0,overflowY:"auto"},children:e.jsx(Vt,{assetClass:"futures"})})}]})}),e.jsxs(X,{id:"deck",vis:S,style:{gap:10},children:[e.jsxs("div",{style:{...$e,display:"flex",alignItems:"center",gap:5,flexWrap:"wrap",padding:"8px 10px"},children:[e.jsx(Ee,{k:"decks"}),Is.map(([B,te])=>e.jsx("button",{onClick:()=>{a(B),d(te[0])},style:{...he(r===B?t.gold:t.dim),fontSize:9.5,fontWeight:700,borderRadius:6,background:r===B?"rgba(210,162,76,0.14)":"transparent",cursor:"pointer"},children:B},B)),e.jsx("span",{style:{width:1,alignSelf:"stretch",background:t.border2,margin:"2px 6px"}}),(Is.find(([B])=>B===r)?.[1]||[]).map(B=>e.jsx("button",{onClick:()=>d(B),style:{...L(10,p===B?t.text:t.dim),padding:"4px 10px",borderRadius:6,border:"none",cursor:"pointer",background:p===B?t.panel:"transparent",boxShadow:p===B?`inset 0 -2px 0 ${t.gold}`:"none"},children:B},B))]}),e.jsx("div",{style:$e,children:e.jsx(hp,{deck:r,view:p,board:u,sym:s,compass:P,con:V})})]}),e.jsx(X,{id:"parttwo",vis:S,children:e.jsx(gp,{gov:Q,ctx:D,sym:s})})]})}const xp=[{id:"spine",label:"Spine"},{id:"readbar",label:"Read Bar"},{id:"chart",label:"Chart"},{id:"stack",label:"Multi-Timeframe Stack"},{id:"signals",label:"Signal Rail · The Record"},{id:"whale",label:"Whale Tape",group:"Split"},{id:"liq",label:"Liquidation Landscape",group:"Split"},{id:"stats",label:"Who is Buying · Squeeze · Clock"},{id:"derivs",label:"Derivatives Command"},{id:"structure",label:"Structure"}],fp=["rrp:sa-crypto-cols","h:sa-crypto-primary-h-v1"],Ii=["BTCUSDT","ETHUSDT","SOLUSDT","XRPUSDT","BNBUSDT","DOGEUSDT","ADAUSDT","AVAXUSDT","LINKUSDT","LTCUSDT"],Ln=n=>(n||"").replace("USDT",""),yp={whale:{label:"WHALE",color:"#C9A96A",bg:"rgba(210,162,76,0.10)"},orca:{label:"ORCA",color:"#E0C27A",bg:"rgba(210,162,76,0.18)"},leviathan:{label:"LEVIATHAN",color:"#F2D9A0",bg:"rgba(210,162,76,0.30)"}},bp=n=>{const l=Math.max(0,(Date.now()-n)/1e3);return l<60?`${Math.floor(l)}s`:l<3600?`${Math.floor(l/60)}m`:`${Math.floor(l/3600)}h`},nt=n=>n==null||!isFinite(n)?"â":n>=1e3?n.toLocaleString("en-US",{maximumFractionDigits:0}):n>=1?n.toFixed(2):n.toFixed(4);function Pe({title:n,info:l,right:s,children:i,style:o}){return e.jsxs("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,background:t.panel,display:"flex",flexDirection:"column",minHeight:0,...o},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,padding:"7px 12px",background:t.panel2,borderBottom:`1px solid ${t.border2}`},children:[e.jsx("span",{style:{fontFamily:k,fontSize:10.5,fontWeight:800,letterSpacing:"0.13em",color:t.gold},children:n}),l,e.jsx("div",{style:{marginLeft:"auto",display:"flex",gap:8,alignItems:"center"},children:s})]}),e.jsx("div",{style:{padding:12,minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:i})]})}function bt({children:n}){return e.jsx("div",{style:{padding:"22px 8px",textAlign:"center",color:t.dim,fontSize:11.5},children:n})}function vp({ingest:n,movers:l}){const{t:s}=W(),{data:i}=H(()=>Fn(),3e4,[]),o=i?.reads?.[0]?.cascade,r=n&&(n.msgs_total>0||n.prints_total>0),p={active:{color:"#F0524F",border:"#F0524F",label:s("markets.crypto.cascadeActive",{defaultValue:"CASCADE ACTIVE"}),glow:!0},elevated:{color:"#E8B84B",border:"rgba(232,184,75,0.6)",label:s("markets.crypto.cascadeElevated",{defaultValue:"LIQ ELEVATED"})},calm:{color:t.dim,border:t.border2,label:s("markets.crypto.cascadeCalm",{defaultValue:"LIQ CALM"})}}[o]||null;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",padding:"10px 14px",border:`1px solid ${t.border}`,borderRadius:8,background:t.panel},children:[e.jsx("span",{style:{fontFamily:k,fontSize:13,fontWeight:800,letterSpacing:"0.16em",color:t.gold},children:s("markets.crypto.title",{defaultValue:"CRYPTO COMMAND"})}),e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.dim,letterSpacing:"0.08em"},children:s("markets.crypto.subtitle",{defaultValue:"whale tape · liquidation terrain · cross-venue derivatives"})}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontFamily:k,fontSize:9,color:r?t.green:t.dim},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:3,background:r?t.green:t.slate,boxShadow:r?`0 0 6px ${t.green}`:"none"}}),"BINANCE SPOT · OKX LIQ · HYPERLIQUID"]}),p&&e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.1em",color:p.color,border:`1px solid ${p.border}`,borderRadius:5,padding:"2px 8px",boxShadow:p.glow?"0 0 10px rgba(240,82,79,0.5)":"none"},children:p.label}),e.jsx("div",{style:{marginLeft:"auto",display:"flex",gap:6,overflowX:"auto",maxWidth:"52%"},children:(l||[]).slice(0,10).map(d=>e.jsxs("span",{style:{fontFamily:k,fontSize:9.5,whiteSpace:"nowrap",padding:"2px 7px",borderRadius:5,border:`1px solid ${t.border2}`,color:d.chg_pct>=0?t.green:t.red},children:[Ln(d.sym)," ",d.chg_pct>=0?"+":"",R(d.chg_pct,1),"%"]},d.sym))})]})}function jp({pressure:n}){const l=$.useMemo(()=>Ii.map(i=>({sym:i,...n?.[i]||{}})).filter(i=>(i.buy_usd_5m||0)+(i.sell_usd_5m||0)>0).sort((i,o)=>o.buy_usd_5m+o.sell_usd_5m-(i.buy_usd_5m+i.sell_usd_5m)).slice(0,3),[n]);if(!l.length)return null;const s=Math.max(...l.map(i=>Math.max(i.buy_usd_5m||0,i.sell_usd_5m||0)),1);return e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5,marginBottom:10},children:l.map(i=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontFamily:k,fontSize:10,fontWeight:800,width:38,color:t.text},children:Ln(i.sym)}),e.jsxs("div",{style:{flex:1,display:"flex",height:10,gap:1},children:[e.jsx("div",{style:{flex:1,display:"flex",justifyContent:"flex-end"},children:e.jsx("div",{style:{width:`${i.sell_usd_5m/s*100}%`,background:"rgba(240,82,79,0.55)",borderRadius:"3px 0 0 3px"}})}),e.jsx("div",{style:{width:1,background:t.border2}}),e.jsx("div",{style:{flex:1},children:e.jsx("div",{style:{width:`${i.buy_usd_5m/s*100}%`,background:"rgba(55,209,131,0.55)",borderRadius:"0 3px 3px 0"}})})]}),e.jsxs("span",{style:{fontFamily:k,fontSize:9,color:t.dim,width:118,textAlign:"right"},children:[ee(i.sell_usd_5m)," · ",ee(i.buy_usd_5m)]})]},i.sym))})}function kp(){const{t:n}=W(),{data:l}=H(()=>ti(140),5e3,[]),{data:s}=H(()=>Rl(),1e4,[]),i=$.useMemo(()=>l?.tape||[],[l]),o=$.useMemo(()=>Math.max(...i.map(r=>r.usd||0),1),[i]);return e.jsxs(Pe,{title:n("markets.crypto.tapeTitle",{defaultValue:"WHALE TAPE"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.tapeInfoTitle",{defaultValue:"The Whale Tape"}),what:n("markets.crypto.tapeInfoWhat",{defaultValue:"Every Binance spot trade in the majors clearing $250K, live: WHALE $250K+, ORCA $1M+, LEVIATHAN $5M+. Side is the aggressor: BUY lifted the ask, SELL hit the bid. Large OKX liquidations ride the same tape wearing a LIQ chip."}),how:n("markets.crypto.tapeInfoHow",{defaultValue:"Watch for cluster
7s: repeated same-side whales in one name inside minutes is conviction flow; a lone print is just size. The pressure beams above the tape total five minutes of whale dollars by side."})}),right:e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim},children:n("markets.crypto.tapeRight",{defaultValue:"BINANCE SPOT · $250K+ · 5s"})}),style:{flex:1.4,minWidth:340},children:[e.jsx(jp,{pressure:s?.pressure}),e.jsxs("div",{style:{overflowY:"auto",minHeight:220,flex:1},children:[i.length===0&&e.jsx(bt,{children:n("markets.crypto.tapeEmpty",{defaultValue:"The tape arms as whales print. Every Binance spot trade over $250K in the majors lands here the second it happens; quiet hours are honest hours."})}),i.map((r,a)=>{const p=r.kind==="liq",d=p?r.liq_side==="long"?t.red:t.green:r.side==="buy"?t.green:t.red,c=yp[r.tier]||null;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 6px",borderBottom:"1px solid rgba(255,255,255,0.03)",position:"relative"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:2,bottom:2,borderRadius:3,width:`${Math.max(2,r.usd/o*100)}%`,background:p?"rgba(167,139,250,0.07)":r.side==="buy"?"rgba(55,209,131,0.06)":"rgba(240,82,79,0.06)"}}),e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.dim,width:26,zIndex:1},children:bp(r.ts)}),e.jsx("span",{style:{fontFamily:k,fontSize:11,fontWeight:800,width:44,color:t.text,zIndex:1},children:Ln(r.sym)}),e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,width:p?74:36,color:d,zIndex:1},children:p?`LIQ ${(r.liq_side||"").toUpperCase()}`:(r.side||"").toUpperCase()}),e.jsx("span",{style:{fontFamily:k,fontSize:11.5,fontWeight:800,color:t.text,zIndex:1,minWidth:70},children:ee(r.usd)}),e.jsxs("span",{style:{fontFamily:k,fontSize:9.5,color:t.muted,zIndex:1},children:["@",nt(r.px)]}),e.jsxs("span",{style:{marginLeft:"auto",zIndex:1,display:"flex",gap:4},children:[p&&e.jsx("span",{style:{fontFamily:k,fontSize:8,color:"#A78BFA",border:"1px solid rgba(167,139,250,0.4)",borderRadius:4,padding:"1px 5px"},children:"OKX"}),c&&e.jsx("span",{style:{fontFamily:k,fontSize:8,fontWeight:800,color:c.color,background:c.bg,border:`1px solid ${c.color}44`,borderRadius:4,padding:"1px 5px"},children:c.label})]})]},`${r.ts}${a}`)})]})]})}function wp(){const{t:n}=W(),[l,s]=$.useState("BTCUSDT"),{data:i}=H(()=>Jr(l),3e4,[l]),{data:o}=H(()=>Rl(),15e3,[]),r=i?.liqmap,a=$.useMemo(()=>{if(!r?.buckets?.length||!r.mark)return null;const u=560,h=430,m=64,y=r.lo,b=r.hi,f=x=>h-(x-y)/(b-y)*h,w=Math.max(...r.buckets.map(x=>Math.max(x.long_usd,x.short_usd)),1),v=r.buckets.map(x=>({y:f(x.px),px:x.px,longW:x.long_usd/w*(u/2-m),shortW:x.short_usd/w*(u/2-m),long_usd:x.long_usd,short_usd:x.short_usd})),g=(r.rings||[]).flatMap(x=>[{y:f(x.long_liq_px),label:`${x.lev}x`,side:"long",px:x.long_liq_px},{y:f(x.short_liq_px),label:`${x.lev}x`,side:"short",px:x.short_liq_px}]).filter(x=>x.y>8&&x.y<h-8);return{W:u,H:h,padX:m,Y:f,rows:v,rings:g,markY:f(r.mark),mx:w}},[r]),p=o?.liq,d=a&&a.rows.some(u=>u.long_usd+u.short_usd>0),c=r&&r.sufficient===!1&&(r.n_events||0)>0;return e.jsxs(Pe,{title:n("markets.crypto.terrainTitle",{defaultValue:"LIQUIDATION TERRAIN"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.terrainInfoTitle",{defaultValue:"Liquidation Terrain"}),what:n("markets.crypto.terrainInfoWhat",{defaultValue:"Where forced flow lives. Bars are observed OKX liquidations bucketed by price around the current mark: long liquidations print below (forced sellers), short liquidations above (forced buyers). Dashed rings mark where fresh 10x/25x/50x/100x entries at the mark would liquidate."}),how:n("markets.crypto.terrainInfoHow",{defaultValue:"Dense clusters just beyond a ring are fuel: price reaching them triggers forced orders in that direction, which can chain. An empty terrain means no liquidations printed in range, which is a calm tape. A thin sample says so explicitly instead: too few prints to call a cluster is a different statement from calm, and the panel will not dress one up as the other."})}),right:e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:"#E0C27A",border:"1px solid rgba(210,162,76,0.35)",background:"rgba(210,162,76,0.10)",borderRadius:5,padding:"1px 7px"},children:n("markets.crypto.estimated",{defaultValue:"ESTIMATED"})}),style:{flex:1,minWidth:320},children:[e.jsxs("div",{style:{display:"flex",gap:5,flexWrap:"wrap",marginBottom:8},children:[Ii.slice(0,6).map(u=>e.jsx("button",{onClick:()=>s(u),style:{fontFamily:k,fontSize:9.5,fontWeight:800,padding:"3px 9px",borderRadius:5,cursor:"pointer",border:`1px solid ${u===l?t.gold:t.border2}`,background:u===l?"rgba(210,162,76,0.12)":"transparent",color:u===l?t.gold:t.muted},children:Ln(u)},u)),p&&e.jsxs("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:9,color:t.dim},children:[n("markets.crypto.liq24h",{defaultValue:"24h"}),": ",e.jsxs("span",{style:{color:t.red},children:[ee(p.h24?.long_usd||0),"L"]})," · ",e.jsxs("span",{style:{color:t.green},children:[ee(p.h24?.short_usd||0),"S"]})]})]}),!a&&e.jsx(bt,{children:n("markets.crypto.terrainWaiting",{defaultValue:"Terrain builds from live liquidations; the ladder appears once the mark price is known."})}),a&&e.jsxs("svg",{viewBox:`0 0 ${a.W} ${a.H}`,width:"100%",role:"img","aria-label":`liquidation terrain ${l}`,children:[e.jsx("line",{x1:a.W/2,y1:"0",x2:a.W/2,y2:a.H,stroke:t.border2,strokeWidth:"1"}),a.rings.map((u,h)=>e.jsxs("g",{children:[e.jsx("line",{x1:a.padX-12,y1:u.y,x2:a.W-a.padX+12,y2:u.y,stroke:u.side==="long"?"rgba(240,82,79,0.35)":"rgba(55,209,131,0.35)",strokeWidth:"0.8",strokeDasharray:"5 4"}),e.jsx("text",{x:a.W-a.padX+16,y:u.y+3,fill:t.dim,fontSize:"8.5",fontFamily:"monospace",children:u.label})]},h)),a.rows.map((u,h)=>e.jsxs("g",{children:[u.longW>.5&&e.jsx("rect",{x:a.W/2-u.longW,y:u.y-5,width:u.longW,height:"10",fill:"rgba(240,82,79,0.55)",rx:"2"}),u.shortW>.5&&e.jsx("rect",{x:a.W/2+1,y:u.y-5,width:u.shortW,height:"10",fill:"rgba(55,209,131,0.55)",rx:"2"})]},h)),e.jsx("line",{x1:"0",y1:a.markY,x2:a.W,y2:a.markY,stroke:t.gold,strokeWidth:"1.4"}),e.jsx("rect",{x:"2",y:a.markY-9,width:"60",height:"15",rx:"3",fill:t.gold}),e.jsx("text",{x:"32",y:a.markY+3,fill:"#0B0C0E",fontSize:"9",fontWeight:"700",fontFamily:"monospace",textAnchor:"middle",children:nt(r.mark)}),!d&&e.jsx("text",{x:a.W/2,y:a.H/2-18,fill:t.dim,fontSize:"11",fontFamily:"monospace",textAnchor:"middle",children:n("markets.crypto.terrainQuiet",{defaultValue:"no liquidations in range yet: calm tape"})}),c&&e.jsx("text",{x:a.W/2,y:a.H/2+2,fill:"#E0C27A",fontSize:"10.5",fontFamily:"monospace",textAnchor:"middle",children:n("markets.crypto.terrainThin",{defaultValue:"thin sample: {{n}} prints, too few to call a cluster",n:r.n_events})})]}),e.jsx("div",{style:{fontSize:9,color:t.dim,marginTop:6,lineHeight:1.45},children:n("markets.crypto.terrainHonesty",{defaultValue:"Observed OKX swap liquidations, rolling window, plus leverage-geometry rings from the current mark. An estimate of where forced flow sits, not an order-book x-ray."})})]})}function zs({value:n,neutral:l=1,spanPct:s=40,goodAbove:i=!0}){if(n==null||!isFinite(n))return e.jsx("span",{style:{color:t.dim,fontFamily:k,fontSize:9},children:"â"});const o=Math.max(-1,Math.min(1,(n/l-1)/(s/100))),r=o>=0,a=r===i?"rgba(55,209,131,0.6)":"rgba(240,82,79,0.6)";return e.jsxs("div",{style:{flex:1,display:"flex",height:8,alignItems:"center"},children:[e.jsx("div",{style:{flex:1,display:"flex",justifyContent:"flex-end"},children:!r&&e.jsx("div",{style:{width:`${Math.abs(o)*100}%`,height:8,background:a,borderRadius:"3px 0 0 3px"}})}),e.jsx("div",{style:{width:1,height:12,background:t.slate}}
7),e.jsx("div",{style:{flex:1},children:r&&e.jsx("div",{style:{width:`${Math.abs(o)*100}%`,height:8,background:a,borderRadius:"0 3px 3px 0"}})})]})}function Sp(){const{t:n}=W(),{data:l}=H(()=>to(),3e4,[]),s=l?.derivs||[];if(!s.length)return e.jsx(Pe,{title:n("markets.crypto.derivsTitle",{defaultValue:"DERIVATIVES COMMAND"}),children:e.jsx(bt,{children:n("markets.crypto.derivsWaiting",{defaultValue:"Derivatives arm within a minute of the enricherâs first pass."})})});const i=o=>o==null?t.dim:o>0?t.green:o<0?t.red:t.muted;return e.jsx(Pe,{title:n("markets.crypto.derivsTitle",{defaultValue:"DERIVATIVES COMMAND"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.derivsInfoTitle",{defaultValue:"Derivatives Command"}),what:n("markets.crypto.derivsInfoWhat",{defaultValue:"The leverage complex per major: funding on Binance vs Hyperliquid normalized to 8h (GAP = Binance minus Hyperliquid, in bps), open interest with its 1h change, the top-trader long/short ratio, taker buy/sell aggression, and the perp-vs-spot basis."}),how:n("markets.crypto.derivsInfoHow",{defaultValue:"Rich positive funding plus rising OI marks a crowded long; a wide cross-venue gap shows where the crowding lives and tends to compress. Taker ratio under 1 with price flat means sellers are being absorbed."})}),right:e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim},children:"BINANCE · HYPERLIQUID · 30s"}),children:e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:k},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{fontSize:8.5,color:t.dim,textAlign:"right",letterSpacing:"0.08em"},children:[e.jsx("th",{style:{textAlign:"left",padding:"2px 6px"},children:"SYM"}),e.jsx("th",{style:{padding:"2px 6px"},children:"MARK"}),e.jsx("th",{style:{padding:"2px 6px"},children:"FUND BN 8H"}),e.jsx("th",{style:{padding:"2px 6px"},children:"FUND HL 8H"}),e.jsx("th",{style:{padding:"2px 6px"},children:"GAP bps"}),e.jsx("th",{style:{padding:"2px 6px"},children:"OI $"}),e.jsx("th",{style:{padding:"2px 6px"},children:"ÎOI 1H"}),e.jsx("th",{style:{padding:"2px 6px",minWidth:90},children:"TOP L/S"}),e.jsx("th",{style:{padding:"2px 6px",minWidth:90},children:"TAKER B/S"}),e.jsx("th",{style:{padding:"2px 6px"},children:"BASIS bps"})]})}),e.jsx("tbody",{children:s.map(o=>e.jsxs("tr",{style:{fontSize:10.5,textAlign:"right",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[e.jsx("td",{style:{textAlign:"left",padding:"4px 6px",fontWeight:800,color:t.text},children:o.coin}),e.jsx("td",{style:{padding:"4px 6px",color:t.muted},children:nt(o.mark)}),e.jsx("td",{style:{padding:"4px 6px",color:i(o.funding_bn_8h)},children:o.funding_bn_8h!=null?`${(o.funding_bn_8h*100).toFixed(4)}%`:"â"}),e.jsx("td",{style:{padding:"4px 6px",color:i(o.funding_hl_8h)},children:o.funding_hl_8h!=null?`${(o.funding_hl_8h*100).toFixed(4)}%`:"â"}),e.jsx("td",{style:{padding:"4px 6px",fontWeight:800,color:i(o.funding_gap_bps)},children:o.funding_gap_bps!=null?o.funding_gap_bps.toFixed(2):"â"}),e.jsx("td",{style:{padding:"4px 6px",color:t.muted},children:ee(o.oi_usd)}),e.jsx("td",{style:{padding:"4px 6px",color:i(o.oi_chg_1h_pct)},children:o.oi_chg_1h_pct!=null?`${o.oi_chg_1h_pct>0?"+":""}${o.oi_chg_1h_pct}%`:"â"}),e.jsx("td",{style:{padding:"4px 6px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5},children:[e.jsx(zs,{value:o.lsr_top_traders,neutral:1,spanPct:60}),e.jsx("span",{style:{fontSize:9.5,color:t.muted,width:30},children:o.lsr_top_traders!=null?R(o.lsr_top_traders,2):"â"})]})}),e.jsx("td",{style:{padding:"4px 6px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5},children:[e.jsx(zs,{value:o.taker_buy_sell,neutral:1,spanPct:40}),e.jsx("span",{style:{fontSize:9.5,color:t.muted,width:30},children:o.taker_buy_sell!=null?R(o.taker_buy_sell,2):"â"})]})}),e.jsx("td",{style:{padding:"4px 6px",color:i(o.basis_bps)},children:o.basis_bps!=null?o.basis_bps.toFixed(1):"â"})]},o.sym))})]})})})}function _p({coin:n}){const{t:l}=W(),{data:s}=H(()=>no(n),6e4,[n]),i=s?.walls;return e.jsxs("div",{style:{flex:1,minWidth:210,border:`1px solid ${t.border2}`,borderRadius:8,background:t.panel2,padding:"9px 12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginBottom:6},children:[e.jsx("span",{style:{fontFamily:k,fontSize:11.5,fontWeight:800,color:t.text},children:n}),e.jsx("span",{style:{fontFamily:k,fontSize:9,color:t.dim},children:i?`@${nt(i.mark)}`:""}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:8,color:t.dim},children:"HL BOOK"})]}),!i&&e.jsx("div",{style:{color:t.dim,fontSize:10,padding:"8px 0"},children:l("markets.crypto.wallsWaiting",{defaultValue:"book snapshot pending"})}),i&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[[...i.ask_walls||[]].reverse().map((o,r)=>
7e.jsxs("div",{style:{display:"flex",gap:7,fontFamily:k,fontSize:9.5},children:[e.jsx("span",{style:{color:t.red,width:60},children:nt(o.px)}),e.jsx("span",{style:{color:t.muted,flex:1},children:ee(o.usd)}),e.jsxs("span",{style:{color:t.dim},children:[o.dist_pct>0?"+":"",R(o.dist_pct,2),"%"]})]},`a${r}`)),e.jsx("div",{style:{height:1,background:"rgba(210,162,76,0.35)",margin:"3px 0"}}),(i.bid_walls||[]).map((o,r)=>e.jsxs("div",{style:{display:"flex",gap:7,fontFamily:k,fontSize:9.5},children:[e.jsx("span",{style:{color:t.green,width:60},children:nt(o.px)}),e.jsx("span",{style:{color:t.muted,flex:1},children:ee(o.usd)}),e.jsxs("span",{style:{color:t.dim},children:[R(o.dist_pct,2),"%"]})]},`b${r}`))]})]})}const Tp=["5m","15m","1h","4h","1d"];function Ep({movers:n}){const{t:l}=W(),[s,i]=yt("crypto.chart.symbol","BTC_USDT"),[o,r]=yt("crypto.chart.tf","1h"),{data:a}=H(()=>Zr(s,o,400),2e4,[s,o]),p=$.useMemo(()=>(a?.candles||[]).map(c=>({timestamp:Number(c.ts)*1e3,open:Number(c.open),high:Number(c.high),low:Number(c.low),close:Number(c.close),volume:Number(c.volume)||0})).filter(c=>Number.isFinite(c.timestamp)&&Number.isFinite(c.close)),[a]),d=$.useMemo(()=>{const c=new Set(["BTC_USDT","ETH_USDT","SOL_USDT"]);for(const u of(n||[]).slice(0,18))u.symbol&&c.add(u.symbol);return[...c]},[n]);return e.jsx(Pe,{title:l("markets.crypto.chartTitle",{defaultValue:"CHART"}),info:e.jsx(ie,{size:13,title:l("markets.crypto.chartInfoTitle",{defaultValue:"The Crypto Chart"}),what:l("markets.crypto.chartInfoWhat",{defaultValue:"MEXC perpetual candles for any tradable contract, from the same warehouse the signal rail and the backtest harness read. History comes from stored bars; the most recent bars are fetched live on each poll."}),how:l("markets.crypto.chartInfoHow",{defaultValue:"Use it to see what a signal is fading. The rail fires on extremes, and an extreme looks very different on the 5-minute chart than on the daily. Studies and chart type persist per board, so a change here does not follow you to Futures or Options."})}),right:e.jsxs(e.Fragment,{children:[e.jsx("select",{value:s,onChange:c=>i(c.target.value),style:{fontFamily:k,fontSize:9,background:t.panel2,color:t.text,border:`1px solid ${t.border2}`,borderRadius:4,padding:"2px 5px"},children:d.map(c=>e.jsx("option",{value:c,children:c.replace("_USDT","")},c))}),Tp.map(c=>e.jsx("button",{type:"button",onClick:()=>r(c),style:{fontFamily:k,fontSize:8.5,cursor:"pointer",padding:"2px 6px",borderRadius:4,background:o===c?t.panel:"transparent",border:`1px solid ${o===c?t.gold:t.border2}`,color:o===c?t.gold:t.dim},children:c},c))]}),style:{minHeight:320},children:p.length===0?e.jsx(bt,{children:l("markets.crypto.chartEmpty",{defaultValue:"No bars for this contract and timeframe yet."})}):e.jsx("div",{style:{flex:1,minHeight:280},children:e.jsx(Bt,{data:p,tf:o,symbol:s.replace("_USDT",""),prefScope:"crypto",height:"100%"})})})}function $p(){const[n]=yt("crypto.chart.symbol","BTC_USDT");return e.jsx(sc,{symbol:n})}function Cp(){const{t:n}=W();return e.jsx(Pe,{title:n("markets.crypto.structureTitle",{defaultValue:"STRUCTURE · RESTING LIQUIDITY"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.wallsInfoTitle",{defaultValue:"Book Walls"}),what:n("markets.crypto.wallsInfoWhat",{defaultValue:"The largest resting orders on the Hyperliquid book each side of the mark: defended prices where passive size waits. Ask walls cap rallies until eaten; bid walls cushion dips until pulled."}),how:n("markets.crypto.wallsInfoHow",{defaultValue:"A wall that survives repeated touches is real interest; one that vanishes when price approaches was spoof or fear. Read walls together with the tape: whales lifting into an ask wall is intent."})}),right:e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim},children:"60s"}),children:e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:["BTC","ETH","SOL"].map(l=>e.jsx(_p,{coin:l},l))})})}function Ap(){const{t:n}=W(),l={full_send:n("markets.crypto.whoFullSend",{defaultValue:"real money and leverage bidding together"}),real_bid:n("markets.crypto.whoRealBid",{defaultValue:"spot accumulating while leverage unwinds"}),leverage_fight:n("markets.crypto.whoLeverageFight",{defaultValue:"leverage building against spot selling"}),exodus:n("markets.crypto.whoExodus",{defaultValue:"spot and leverage both leaving"}),quiet:n("markets.crypto.whoQuiet",{defaultValue:"no significant flow this hour"})},s={long_crowded:n("markets.crypto.crowdLong",{defaultValue:"longs crowded"}),short_crowded:n("markets.crypto.crowdShort",{defaultValue:"shorts crowded"}),balanced:n("markets.crypto.crowdBalanced",{defaultValue:"positioning balanced"}),unknown:n("markets.crypto.crowdUnknown",{defaultValue:"positioning unknown"})};return{WHO:l,CROWD:s}}const jl={full_send:"#E0C27A",real_bid:"#37D183",leverage_fight:"#F0524F",exodus:"#A78BFA",quiet:"#64748B"};function Rp(){const{t:n}=W(),{WHO:l,CROWD:s}=Ap(),{data:i}=H(()=>Fn(),2e4,[]),o=i?.reads||[];if(!o.length)return null;const r=o.filter(a=>["BTCUSDT","ETHUSDT","SOLUSDT"].includes(a.sym));return e.jsx(Pe,{title:n("markets.crypto.readTitle",{defaultValue:"THE READ"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.readInfoTitle",{defaultValue:"The Read"}),what:n("markets.crypto.readInfoWhat",{defaultValue:"A rule-composed verdict per major, built only from numbers on this board: who is buying (spot whale flow vs open-interest change), whose side is crowded (funding vs its own month, top-trader positioning, basis), where the liquidation fuel sits, and whether a cascade is running. No model, no opinion: arithmetic."}),how:n("markets.crypto.readInfoHow",{defaultValue:"Trade the mechanism, not the verdict: a crowded side with fuel just beyond a leverage ring is a squeeze waiting for a spark. Every claim here is traceable to a panel below;
7 every verdict is logged the moment it prints, so the record is ours to grade."})}),right:e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim},children:n("markets.crypto.readRight",{defaultValue:"RULE-COMPOSED · LOGGED FOR GRADING · 20s"})}),children:e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:r.map(a=>{const p=a.crowd==="long_crowded"?t.red:a.crowd==="short_crowded"?t.green:t.muted;return e.jsxs("div",{style:{flex:1,minWidth:250,border:`1px solid ${t.border2}`,borderRadius:8,background:t.panel2,padding:"9px 12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{fontFamily:k,fontSize:13,fontWeight:800,color:t.text},children:a.coin}),e.jsxs("span",{style:{fontFamily:k,fontSize:10,color:t.muted},children:["@",nt(a.mark)]}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:8.5,fontWeight:800,color:jl[a.who]||t.dim,border:`1px solid ${jl[a.who]||t.dim}55`,borderRadius:4,padding:"1px 6px"},children:(a.who||"").replace("_"," ").toUpperCase()})]}),e.jsxs("div",{style:{fontSize:11,color:t.text,marginTop:6,lineHeight:1.45},children:[l[a.who]||"",". ",e.jsx("span",{style:{color:p},children:s[a.crowd]||""}),a.crowd_score!=null&&e.jsxs("span",{style:{color:t.dim},children:[" (",a.crowd_score>0?"+":"",a.crowd_score,")"]}),a.funding_pctile_30d!=null&&e.jsxs("span",{style:{color:t.dim},children:[" · ",n("markets.crypto.fundingPctile",{defaultValue:"funding p{{p}} of its month",p:Math.round(a.funding_pctile_30d)})]}),a.fuel_side&&e.jsxs("span",{style:{color:t.amber},children:[" · ",n("markets.crypto.fuelAt",{defaultValue:"fuel {{side}} at {{px}}",side:a.fuel_side,px:nt(a.fuel_px)})]})]})]},a.sym)})})})}function Fp(){const{t:n}=W(),{data:l}=H(()=>Fn(),3e4,[]),s=(l?.reads||[]).filter(o=>o.spot_net_1h!=null&&o.oi_chg_1h_pct!=null),i=$.useMemo(()=>{if(!s.length)return null;const o=460,r=300,a=34,p=Math.max(...s.map(h=>Math.abs(h.spot_net_1h)),5e5),d=Math.max(...s.map(h=>Math.abs(h.oi_chg_1h_pct)),.6),c=h=>o/2+Math.sign(h)*Math.sqrt(Math.abs(h)/p)*(o/2-a),u=h=>r/2-Math.sign(h)*Math.sqrt(Math.abs(h)/d)*(r/2-a);return{W:o,H:r,pad:a,dots:s.map(h=>({x:c(h.spot_net_1h),y:u(h.oi_chg_1h_pct),r:h}))}},[s]);return e.jsxs(Pe,{title:n("markets.crypto.whoTitle",{defaultValue:"WHO'S BUYING"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.whoInfoTitle",{defaultValue:"Who's Buying"}),what:n("markets.crypto.whoInfoWhat",{defaultValue:"Each coin plotted by the two forces that move it: horizontal = net spot whale dollars over the last hour (our own tape, real coins changing hands); vertical = the change in futures open interest (leverage entering or leaving). The four corners are four different markets."}),how:n("markets.crypto.whoInfoHow",{defaultValue:"Top-right (spot buys + OI up) is the strongest and most fragile bid. Bottom-right (spot buys + OI down) is the healthiest: real accumulation while leverage unwinds. Top-left is leverage fighting spot sellers, the unstable corner. Bottom-left is exodus."})}),style:{flex:1,minWidth:300},children:[!i&&e.jsx(bt,{children:n("markets.crypto.whoWaiting",{defaultValue:"The map arms once whale flow and open-interest deltas are both live."})}),i&&e.jsxs("svg",{viewBox:`0 0 ${i.W} ${i.H}`,width:"100%",role:"img","aria-label":"who is buying quadrant",children:[e.jsx("line",{x1:i.W/2,y1:"8",x2:i.W/2,y2:i.H-8,stroke:t.border2,strokeWidth:"1"}),e.jsx("line",{x1:"8",y1:i.H/2,x2:i.W-8,y2:i.H/2,stroke:t.border2,strokeWidth:"1"}),e.jsx("text",{x:i.W-12,y:"16",fill:t.dim,fontSize:"8",fontFamily:"monospace",textAnchor:"end",children:n("markets.crypto.quadFullSend",{defaultValue:"FULL SEND"})}),e.jsx("text",{x:i.W-12,y:i.H-10,fill:t.dim,fontSize:"8",fontFamily:"monospace",textAnchor:"end",children:n("markets.crypto.quadRealBid",{defaultValue:"REAL BID"})}),e.jsx("text",{x:"12",y:"16",fill:t.dim,fontSize:"8",fontFamily:"monospace",children:n("markets.crypto.quadLeverageFight",{defaultValue:"LEVERAGE FIGHT"})}),e.jsx("text",{x:"12",y:i.H-10,fill:t.dim,fontSize:"8",fontFamily:"monospace",children:n("markets.crypto.quadExodus",{defaultValue:"EXODUS"})}
7),e.jsx("text",{x:i.W/2+4,y:"16",fill:t.slate,fontSize:"7.5",fontFamily:"monospace",children:n("markets.crypto.quadYAxis",{defaultValue:"ÎOI 1h â"})}),e.jsx("text",{x:i.W-12,y:i.H/2-5,fill:t.slate,fontSize:"7.5",fontFamily:"monospace",textAnchor:"end",children:n("markets.crypto.quadXAxis",{defaultValue:"spot whale net $ â"})}),i.dots.map(({x:o,y:r,r:a})=>e.jsxs("g",{children:[e.jsx("circle",{cx:o,cy:r,r:"4.5",fill:jl[a.who]||t.slate,opacity:"0.85"}),e.jsx("text",{x:o+7,y:r+3,fill:t.text,fontSize:"9",fontFamily:"monospace",fontWeight:"700",children:a.coin})]},a.sym))]})]})}function Np(){const{t:n}=W(),{data:l}=H(()=>Fn(),3e4,[]),s=(l?.reads||[]).filter(i=>i.crowd_score!=null).sort((i,o)=>Math.abs(o.crowd_score)-Math.abs(i.crowd_score));return e.jsxs(Pe,{title:n("markets.crypto.squeezeTitle",{defaultValue:"SQUEEZE METER"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.squeezeInfoTitle",{defaultValue:"Squeeze Meter"}),what:n("markets.crypto.squeezeInfoWhat",{defaultValue:"Crowding per coin, scored -100 to +100 from funding vs its own 30-day history, top-trader long/short positioning, open-interest percentile, and the perp-spot basis. Right of center: longs pay to stay, the crowd is long. Left: shorts pay, the crowd is short."}),how:n("markets.crypto.squeezeInfoHow",{defaultValue:"The crowded side is the fragile side: its stops and liquidations sit behind it. Pair the beam with the terrain: a long-crowded coin with a fat liquidation cluster below is loaded spring, and the squeeze fires against the crowd."})}),style:{flex:1,minWidth:280},children:[!s.length&&e.jsx(bt,{children:n("markets.crypto.squeezeWaiting",{defaultValue:"Beams arm as funding history accrues (first pass within the hour)."})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:7},children:s.slice(0,8).map(i=>{const o=i.crowd_score,r=o>=0;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontFamily:k,fontSize:10,fontWeight:800,width:40,color:t.text},children:i.coin}),e.jsxs("div",{style:{flex:1,display:"flex",height:9,alignItems:"center"},children:[e.jsx("div",{style:{flex:1,display:"flex",justifyContent:"flex-end"},children:!r&&e.jsx("div",{style:{width:`${Math.abs(o)}%`,height:9,background:"rgba(55,209,131,0.55)",borderRadius:"3px 0 0 3px"}})}),e.jsx("div",{style:{width:1.5,height:13,background:t.slate}}),e.jsx("div",{style:{flex:1},children:r&&e.jsx("div",{style:{width:`${Math.abs(o)}%`,height:9,background:"rgba(240,82,79,0.55)",borderRadius:"0 3px 3px 0"}})})]}),e.jsxs("span",{style:{fontFamily:k,fontSize:9.5,fontWeight:700,width:34,textAlign:"right",color:Math.abs(o)>=25?r?t.red:t.green:t.dim},children:[o>0?"+":"",o]})]},i.sym)})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontFamily:k,fontSize:8,color:t.dim},children:[e.jsxs("span",{children:["â ",n("markets.crypto.squeezeShort",{defaultValue:"SHORTS CROWDED"})]}),e.jsxs("span",{children:[n("markets.crypto.squeezeLong",{defaultValue:"LONGS CROWDED"})," â"]})]})]})}function Ip(){const{t:n}=W(),{data:l}=H(()=>eo(),6e4,[]),s=l?.hours||[],i=l?.now_hour_utc,o=Math.max(...s.map(p=>p.whale_usd),1),r=Math.max(...s.map(p=>p.liq_usd),1),a=s.some(p=>p.whale_usd>0||p.liq_usd>0);return e.jsxs(Pe,{title:n("markets.crypto.sessionTitle",{defaultValue:"SESSION CLOCK"}),info:e.jsx(ie,{size:13,title:n("markets.crypto.sessionInfoTitle",{defaultValue:"Session Clock"}),what:n("markets.crypto.sessionInfoWhat",{defaultValue:"Crypto never closes, but it has sessions: whale dollars (gold, above the line) and liquidation dollars (violet, below) by UTC hour over the trailing 24 hours. Asia, Europe and the US each leave a different fingerprint."}),how:n("markets.crypto.sessionInfoHow",{defaultValue:"Size positions for the hour you trade in: a whale-quiet hour moves on less; liquidation-heavy hours are where cascades chain. The gold marker is the current hour."})}),right:e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim},children:n("markets.crypto.sessionRight",{defaultValue:"ROLLING 24H · UTC"})}),style:{flex:1,minWidth:300},children:[!a&&e.jsx(bt,{children:n("markets.crypto.sessionWaiting",{defaultValue:"The clock accrues from live capture; a full day paints within 24 hours of launch."})}),a&&e.jsxs("svg",{viewBox:"0 0 480 150",width:"100%",role:"img","aria-label":"session clock",children:[e.jsx("line",{x1:"0",y1:"90",x2:"480",y2:"90",stroke:t.border2,strokeWidth:"1"}),s.map((p,d)=>{const c=6+d*19.7,u=p.whale_usd/o*62,h=p.liq_usd/r*44;return e.jsxs("g",{children:[p.whale_usd>0&&e.jsx("rect",{x:c,y:90-u,width:"13",height:u,fill:"rgba(210,162,76,0.62)",rx:"2"}),p.liq_usd>0&&e.jsx("rect",{x:c,y:"91",width:"13",height:h,fill:"rgba(167,139,250,0.55)",rx:"2"}),d===i&&e.jsx("circle",{cx:c+6.5,cy:"145",r:"2.5",fill:t.gold}),d%4===0&&e.jsx("text",{x:c+6.5,y:"140",fill:t.dim,fontSize:"7.5",fontFamily:"monospace",textAnchor:"middle",children:String(d).padStart(2,"0")})]},d)})]})]})}function Ws(){const{t:n}=W(),l=Kt(),{data:s}=H(()=>Rl(),12e3,[]),{data:i}=H(()=>ti(1),2e4,[]),{data:o}=H(()=>Qr(),6e4,[]),r=yn("sa-crypto",fp);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 14px 90px",maxWidth:1720,margin:"0 auto"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(bn,{vis:r,panelDefs:xp})}),e.jsx(X,{id:"spine",vis:r,children:e.jsx(vp,{ingest:i?.ingest,movers:s?.movers})}),e.jsx(X,{id:"readbar",vis:r,children:e.jsx(Rp,{})}),e.jsx(X,{id:"chart",vis:r,children:e.jsx(Ep,{movers:o?.movers})}),e.jsx(X,{id:"stack",vis:r,children:e.jsx($p,{})}),e.jsx(X,{id:"signals",vis:r,children:e.jsx(Vt,{assetClass:"crypto"})}),e.jsx(Gs,{id:"sa-crypto-primary-h-v1",defaultHeight:620,minHeight:420,maxHeight:1200,disabled:l,handleLabel:"Resize the primary Crypto workspace",style:{marginBottom:l?0:-10},children:e.jsx(Oe,{id:"sa-crypto-cols",stackBelow:760,gap:12,style:{flex:"none",height:"100%"},layoutEpoch:r.layoutEpoch,columns:[{id:"whale",defaultSize:"58%",minSize:"30%",hidden:r.isHidden("whale"),node:e.jsx(X,{id:"whale",vis:r,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsx(kp,{})})},{id:"liquidations",defaultSize:"42%",minSize:"30%",hidden:r.isHidden("liq"),node:e.jsx(X,{id:"liq",vis:r,style:{height:"100%",minHeight:0,overflow:"hidden"},children:e.jsx(wp,{})})}]})}),e.jsx(X,{id:"stats",vis:r,children:e.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap",alignItems:"stretch"},children:[e.jsx(Fp,{}),e.jsx(Np,{}),e.jsx(Ip,{})]})}),e.jsx(X,{id:"derivs",vis:r,children:e.jsx(Sp,{})}),e.jsx(X,{id:"structure",vis:r,children:e.jsx(Cp,{})}),e.jsx("div",{style:{fontSize:9.5,color:t.dim,lineHeight:1.5},children:n("markets.crypto.honesty",{defaultValue:"Our own capture, end to end: Binance spot prints, OKX swap liquidations, Binance and Hyperliquid derivatives state, Hyperliquid book depth. Display heuristics for reading the market, not signals or advice; when a venue is quiet the board says so instead of inventing motion."})})]})}const Mi={">=10%":"#E0C27A","5-10%":"#C9A227","2-5%":"#8C7A3F","<2%":t.dim},Mp={LONG:"#5FB878",SHORT:"#D9534F"};function zp({r:n}){if(!n.direction)return e.jsx("span",{title:n.tier==="muted"?"No side: this nameâs card was muted by calibration (learned expectancy below zero).":"No side: no calibrated directional claim for this name.",style:{fontFamily:k,fontSize:9,color:t.dim,width:92,textAlign:"right"},children:"â"});const l=Mp[n.direction]||t.text;return e.jsxs("span",{title:`Card claim, ${n.tier}. p(win) ${n.p_win??"?"}, exp ${n.exp_r??"?"}R â calibrated as not-a-loser, NOT a proven edge.`,style:{width:92,textAlign:"right",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9.5,fontWeight:700,color:l},children:n.direction}),n.p_win!=null?e.jsxs("span",{style:{fontFamily:k,fontSize:8.5,color:t.muted,marginLeft:4},children:[(n.p_win*100).toFixed(0),"%"]}):null]})}function Ds({r:n,maxChg:l,grouped:s}){const i=Math.abs(Number(n.change_pct)||0),o=l>0?Math.max(3,Math.min(100,i/l*100)):0,r=Mi[n.band]||t.dim;return e.jsxs("div",{className:"flex items-center gap-2",style:{padding:"2px 0"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:10.5,color:t.text,width:58},children:n.symbol}),e.jsx("span",{style:{fontFamily:k,fontSize:9.5,color:r,width:46,textAlign:"right"},children:i?`${i.toFixed(1)}%`:"-"}),e.jsx("div",{style:{flex:1,height:7,background:"rgba(255,255,255,0.06)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${o}%`,height:"100%",background:r,borderRadius:3}})}),s?null:e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontFamily:k,fontSize:10,
7color:r,width:34,textAlign:"right"},children:n.pctile!=null?n.pctile.toFixed(0):"-"}),e.jsx("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim,width:46,textAlign:"right"},children:n.band})]}),e.jsx(zp,{r:n}),e.jsxs("span",{style:{fontFamily:k,fontSize:8.5,color:t.dim,width:52,textAlign:"right"},children:["n=",n.n_days??"-","d"]})]})}function Wp(){const n=(l,s)=>e.jsx("span",{style:{fontFamily:k,fontSize:8,color:t.dim,width:l,textAlign:"right"},children:s});return e.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 0 2px"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:8,color:t.dim,width:58},children:"SYMBOL"}),n(46,"TODAY"),e.jsx("span",{style:{flex:1,fontFamily:k,fontSize:8,color:t.dim},children:"MOVE SIZE (measured)"}),n(92,"SIDE · p(win)"),n(52,"SAMPLE")]})}function Dp({b:n}){const l=Mi[n.band]||t.dim,s=(n.rows||[]).length;return e.jsxs("div",{className:"flex items-baseline gap-2",style:{marginTop:9,marginBottom:3,paddingBottom:2,borderBottom:`1px solid ${t.line}`},children:[e.jsx("span",{style:{fontFamily:k,fontSize:10,fontWeight:800,color:l},children:n.band}),e.jsxs("span",{style:{fontFamily:k,fontSize:9,color:t.muted},children:["pctile ",n.pctile!=null?n.pctile.toFixed(0):"-"]}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:8.5,color:t.dim},children:s<n.n_total?`${s} of ${n.n_total}`:`${n.n_total}`})]})}function Lp({data:n}){const{t:l}=W(),s=n?.bands||[],i=n?.rows||[],o=n?.basis||{},a=(s.length?s.flatMap(p=>p.rows||[]):i).reduce((p,d)=>Math.max(p,Math.abs(Number(d.change_pct)||0)),0);return e.jsxs("div",{style:{margin:"0 2px 10px",padding:"10px 12px",background:t.panel,border:`1px solid ${t.line}`,borderRadius:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:6},children:[e.jsx("span",{style:{fontFamily:k,fontSize:9,fontWeight:800,letterSpacing:"0.12em",color:t.muted},children:l("markets.movement.title",{defaultValue:"MOVEMENT EXPECTED"})}),e.jsx(ie,{topic:"movement expected",size:14}),e.jsx("span",{style:{marginLeft:"auto",fontFamily:k,fontSize:8.5,color:t.dim},children:l("markets.movement.right",{defaultValue:"{{n}} measured · 60min horizon",n:n?.total_symbols??i.length})})]}),e.jsx("div",{style:{fontSize:9,color:t.dim,lineHeight:1.5,marginBottom:7},children:l("markets.movement.caveat2",{defaultValue:'The MOVE SIZE is measured; the SIDE is not. Ten years show no directional edge in these setups, so the bar and percentile never imply a direction. A side appears only where that nameâs own card cleared calibration (non-negative learned expectancy) â it means "not a learned loser", not a proven edge, and a dash means our calibration does not support a side. The move is also already priced (realised runs 0.84 to 0.86 of what options charge), so this is not a volatility trade in either direction.'})}),s.length||i.length?e.jsxs("div",{children:[s.length?s.map(p=>e.jsxs("div",{children:[e.jsx(Dp,{b:p}),e.jsx(Wp,{}),(p.rows||[]).map(d=>e.jsx(Ds,{r:d,maxChg:a,grouped:!0},`${d.symbol}-${d.band}`))]},p.band)):i.map(p=>e.jsx(Ds,{r:p,maxChg:a},`${p.symbol}-${p.band}`)),e.jsx("div",{style:{fontSize:8.5,color:t.dim,marginTop:7,lineHeight:1.45},children:l("markets.movement.basis",{defaultValue:"Bar and % are todayâs move, on one scale across all bands. Each band header carries its MEASURED percentile: 50 = the setup marks nothing. Percentile of realised move against the same symbol at the same minute of the session. SIDE is the cardâs own calibrated claim, shown only when it clears the tier gate; a dash means no supported side. Measured {{on}} over {{src}}.",on:o.measured_on||"-",src:o.source||"-"})})]}):e.jsx("div",{style:{fontSize:10,color:t.dim,padding:"10px 0"},children:l("markets.movement.empty",{defaultValue:"No name measured a proven movement expectation today. Unproven bands report nothing rather than a hedged number."})})]})}const Op=120,Pp=14,Hp=12e4;function Vp({vis:n}){const{t:l}=W(),{data:s,error:i}=H(()=>lo(Op,Pp).catch(()=>null),Hp,[]);return e.jsx(X,{id:"movementview",vis:n,children:e.jsxs("div",{style:{padding:"4px 2px 12px"},children:[e.jsx(Lp,{data:s}),i||s&&!(s.bands||[]).length&&!(s.rows||[]).length?e.jsx("div",{style:{fontFamily:k,fontSize:9.5,color:t.dim,padding:"2px 12px"},children:l("markets.movement.viewNote",{defaultValue:"Unproven bands report nothing rather than a hedged number, so an empty list is a measurement result, not a data outage."})}):null]})})}const dl={id:"levels",label:"Key Levels Band"},Me=[{id:"stackdial",label:"The Stack · Alignment (dial)",group:"Chart rail"},{id:"sigfeed",label:"Command Rail",group:"Signals rail"}],Bp=[{id:"pulse",label:"Flow Pulse",group:"Flow deck"},{id:"marketctx",label:"Market Context (VRP · breadth · intermarket)",group:"Flow deck"},{id:"forecast",label:"Move Forecast (implied band + receipts)",group:"Flow deck"},{id:"openclose",label:"Open / Close Premium",group:"Flow deck"},{id:"flowsignals",label:"Flow Signals Strip",group:"Flow deck"},{id:"intel",label:"Tape Intel",group:"Flow deck"},{id:"pressure",label:"Pressure Strip",group:"Flow deck"},{id:"tape",label:"The Tape (table)",group:"Flow deck"}
7],Up=[{id:"clock",label:"0DTE Clock"},{id:"map",label:"Key Levels + Scenarios",group:"0DTE deck"},{id:"advisor",label:"Strike Advisor (your view, our math)",group:"0DTE deck"},{id:"earnedcalls",label:"Earned Calls (public record gate)",group:"0DTE deck"},{id:"regime",label:"Dealer Gamma Regime",group:"0DTE deck"},{id:"tactical",label:"Stability / Bias",group:"0DTE deck"},{id:"hiro",label:"Dealer Hedging Flow",group:"0DTE deck"},{id:"dials",label:"Context Dials (Theta/EM/Gamma/Premium)",group:"0DTE deck"},{id:"ladder",label:"Net GEX by Strike",group:"0DTE deck"},{id:"charmvanna",label:"Charm / Vanna",group:"0DTE deck"},{id:"heatmap",label:"Gamma Heatmap",group:"0DTE deck"},{id:"emdetail",label:"Expected Move Detail",group:"0DTE deck"},{id:"pressure0dte",label:"Pressure Strip",group:"0DTE deck"},{id:"gexsurface",label:"GEX Term Structure",group:"0DTE deck"},{id:"tape0dte",label:"0DTE Tape",group:"0DTE deck"}],Gp=[{id:"hiroview",label:"Dealer Hedging Flow",group:"Hedging Flow"}],Yp=[{id:"statsview",label:"Options Stats",group:"Stats"}],Xp=[{id:"movementview",label:"Movement Expected (measured, direction-free)"}],Kp=[{id:"volview",label:"Volatility",group:"Volatility"}],qp=[{id:"heatmapview",label:"Strike Heatmap",group:"Heatmap"}],Qp=[{id:"oivolview",label:"OI / Volume",group:"OI/Vol"}],Zp=[{id:"histview",label:"Historical Flow",group:"Historical"}],Jp=[{id:"dpkpis",label:"Dark Pool KPIs"},{id:"dptape",label:"Dark Pool Tape",group:"Dark Pool"},{id:"dpprofile",label:"Volume Profile",group:"Dark Pool"},{id:"dpleaders",label:"Top Names",group:"Dark Pool"}],eu=[{id:"ddoi",label:"DDOI Dealer Book (flow-signed)",group:"GEX deck"},{id:"wallreceipts",label:"Wall Receipts (does the wall hold?)",group:"GEX deck"},{id:"gexregime",label:"Dealer Gamma Regime",group:"GEX"},{id:"gexstats",label:"GEX Stats",group:"GEX"},{id:"gexreplay",label:"GEX Replay (vs price)",group:"GEX"},{id:"gexsurface2",label:"GEX Surface",group:"GEX"},{id:"gexladder",label:"Net GEX by Strike",group:"GEX"}],tu=["rrp:sa-flow-shell-cols-v1","rrp:sa-flow-cols","rrp:sa-flow-rows-flow-v3","rrp:sa-flow-rows-0dte-v3","rrp:sa-flow-vitals-cols-v2","rrp:sa-flow-signal-rows-v1","rrp:sa-0dte-regime-cols-v1","rrp:sa-0dte-evidence-cols-v1","rrp:sa-darkpool-cols-v1","rrp:sa-darkpool-right-rows-v1"],nu=[["flow","Tape"],["0dte","0DTE / Weekly"],["darkpool","Dark Pool"],["alpha","What's Moving"],["gex","Gamma / GEX"],["hiro","Hedging Flow"],["stats","Options Stats"],["earnings","Earnings Hub"],["volatility","Volatility"],["alerts","Alert Stream"],["myalerts","My Alerts"],["journal","My Journal"],["news","News"],["heatmap","Heat Map"],["dollarflow","Dollar Flow"],["oi","OI / Volume"],["historical","Historical"],["watchlist","Watch List"],["movement","Movement Expected"],["futures","Futures Command"],["crypto","Crypto Command"]],Ls={earnings:"PRO",crypto:"PRO",futures:"ELITE"},kl=Object.fromEntries(nu.map(([n,l])=>[n,l])),Os=["1m","2m","4m","5m","8m","10m","15m","30m","1h","4h","1d","1w"],lu=["SPY","QQQ","IWM","AAPL","NVDA","TSLA","AMZN","META"],Ll=[["tape","TAPE",["flow","alerts","alpha","heatmap"]],["structure","STRUCTURE",["gex","hiro","0dte","oi","dollarflow","volatility"]],["dark","DARK POOL",["darkpool"]],["research","RESEARCH",["historical","stats","movement","earnings","news"]],["mine","MINE",["watchlist","myalerts","journal"]]];Object.fromEntries(Ll.flatMap(([n,,l])=>l.map(s=>[s,n])));
7const Ps={SPXW:"SPY",SPX:"SPY",XSP:"SPY",NDXP:"QQQ",NDX:"QQQ",RUTW:"IWM",RUT:"IWM"},su={flow:"flow",alpha:"flow",dollarflow:"flow",movement:"flow",gex:"gex","0dte":"gex",oi:"gex",volatility:"gex"};function Hs({view:n,setView:l,viewAllowed:s,onAlerts:i,split:o,setSplit:r,splitEligible:a}){const{t:p}=W(),d={tape:p("markets.terminal.deckTape"),structure:p("markets.terminal.deckStructure"),dark:p("markets.terminal.deckDarkPool"),research:p("markets.terminal.deckResearch"),mine:p("markets.terminal.deckMine")},c={flow:p("markets.terminal.viewTape"),alerts:p("markets.terminal.viewAlerts"),alpha:p("markets.terminal.viewMovers"),heatmap:p("markets.terminal.viewHeatmap"),gex:p("markets.terminal.viewGex"),"0dte":p("markets.terminal.viewZeroDte"),oi:p("markets.terminal.viewOIVolume"),dollarflow:p("markets.terminal.viewDollarFlow"),volatility:p("markets.terminal.viewVolatility"),darkpool:p("markets.terminal.viewDarkPool"),historical:p("markets.terminal.viewHistorical"),stats:p("markets.terminal.viewStats"),movement:p("markets.terminal.viewMovement"),news:p("markets.terminal.viewNews"),watchlist:p("markets.terminal.viewWatchlist"),myalerts:p("markets.terminal.viewMyAlerts"),journal:p("markets.terminal.viewJournal",{defaultValue:"My Journal"})};return e.jsxs("div",{style:{display:"flex",alignItems:"stretch",marginBottom:8,overflowX:"auto",WebkitOverflowScrolling:"touch",scrollbarWidth:"none",paddingBottom:2},children:[Ll.map(([u,,h],m)=>{const y=d[u]||u,b=h.includes(n);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,padding:m?"0 10px":"0 10px 0 0",borderLeft:m?`1px solid ${t.border2}`:"none",flex:"0 0 auto"},children:[e.jsx("span",{style:{fontFamily:k,fontSize:8,letterSpacing:"0.16em",fontWeight:700,color:b?"#D2A24C":t.dim,whiteSpace:"nowrap"},children:y}),e.jsx("div",{style:{display:"flex",gap:3},children:h.map(f=>e.jsxs("button",{onClick:()=>l(f),style:{flex:"0 0 auto",fontSize:11,padding:"3px 9px",borderRadius:5,cursor:"pointer",fontWeight:600,whiteSpace:"nowrap",border:`1px solid ${n===f?"#D2A24C":"transparent"}`,background:n===f?"rgba(210,162,76,0.14)":t.panel2,color:n===f?"#D2A24C":t.muted,WebkitTapHighlightColor:"transparent"},children:[c[f]||kl[f],s(f)?null:e.jsx("span",{style:{marginLeft:4,opacity:.7},children:"ð"})]},f))})]},u)}),a&&r&&e.jsxs("select",{value:o||"",onChange:u=>r(u.target.value||null),title:p("markets.terminal.splitTooltip",{defaultValue:"Open a second view beside this one â both follow the workspace symbol"}),style:{flex:"0 0 auto",alignSelf:"flex-end",marginLeft:8,fontSize:10,padding:"3px 6px",borderRadius:5,cursor:"pointer",border:`1px solid ${o?"#D2A24C":t.border2}`,background:o?"rgba(210,162,76,0.14)":t.panel2,color:o?"#D2A24C":t.muted,fontFamily:k,maxWidth:130},children:[e.jsx("option",{value:"",children:p("markets.terminal.splitOff",{defaultValue:"â«¿ SPLIT"})}),a.map(u=>e.jsx("option",{value:u,children:c[u]||kl[u]||u},u))]}),i&&e.jsx("button",{onClick:()=>i(su[n]||null),title:p("markets.alerts.bellTooltip"),style:{flex:"0 0 auto",alignSelf:"flex-end",marginLeft:8,fontSize:12,padding:"3px 9px",borderRadius:5,cursor:"pointer",border:`1px solid ${t.border2}`,background:t.panel2,color:t.muted,WebkitTapHighlightColor:"transparent"},children:"ð"})]})}function iu(){const{t:n}=W(),{data:l}=H(()=>io(25),8e3,[]),s=l&&l.bigprints||[];return e.jsxs("div",{style:{flex:1,minHeight:0,border:`1px solid ${t.border}`,borderRadius:8,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{padding:"6px 10px",background:t.panel2,fontSize:11,fontWeight:700,color:t.amber,borderBottom:`1px solid ${t.border2}`},children:n("markets.terminal.bigPrintsHeader")}),e.jsxs("div",{tabIndex:0,"aria-label":n("markets.terminal.terminalContent"),style:{flex:1,overflow:"auto"},children:[s.length===0&&e.jsx("div",{style:{padding:14,textAlign:"center",color:t.dim,fontSize:12},children:"â"}),s.map((i,o)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"5px 10px",fontSize:12,fontFamily:k,borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[e.jsx("span",{style:{width:48,fontWeight:800,color:String(i.cp).toUpperCase().startsWith("
7C")?t.green:t.red},children:i.underlying}),e.jsxs("span",{style:{color:t.muted},children:[i.strike,String(i.cp).toUpperCase()[0]]}),e.jsx("span",{style:{marginLeft:"auto",fontWeight:700,color:t.text},children:ee(i.total_premium||i.premium)})]},o))]})]})}function _u({initialMode:n="flow",initialView:l="flow"}={}){const{t:s}=W(),i=Fl(),o=i<1536,[r,a]=$.useState("SPY"),[p,d]=$.useState("SPY"),[c,u]=$.useState(l),[h,m]=$.useState({module:null,symbol:""}),y=Y=>{m({module:Y,symbol:r}),u("myalerts")},[b,f]=$.useState("0dte"),[w,v]=yt("tf.flow","15m"),g=yn("sa-flow",tu),x=yn("sa-equities",fc),[j,_]=$.useState(n);$.useEffect(()=>{_(n),u(l)},[n,l]),$.useEffect(()=>{j!=="equities"&&(c==="futures"||c==="crypto")||ni(r)},[r,j,c]);const E=Kt(),[T,S]=ro(560,16,[j]),C=Y=>{Y.preventDefault();const fe=p.trim().toUpperCase();fe&&a(fe)},I=fn("PRO"),F=fn("ELITE"),A=Y=>{const fe=Ls[Y];return fe?fe==="PRO"?I:F:!0},P=c==="0dte"?null:e.jsx(X,{id:"levels",vis:g,children:e.jsx(Mo,{symbol:r})}),V=e.jsx(Nl,{symbol:r,tf:w,onSymbol:Y=>{a(Y),d(Y)},onTf:v,presets:lu,tfs:Os,searchable:!0,right:e.jsx(vn,{symbol:r})}),J=Y=>{if(!A(Y))return e.jsx(so,{requiredTier:Ls[Y],feature:kl[Y]||"This view"});switch(Y){case"flow":return e.jsx(da,{symbol:r,vis:g});case"0dte":return e.jsx(rd,{symbol:r,setSymbol:a,setInput:d,hostedRail:!E,vis:g,dteMode:b,setDteMode:f});case"darkpool":return e.jsx(wc,{symbol:r,onGoTape:()=>u("flow"),vis:g});case"hiro":return e.jsx(vd,{symbol:r,vis:g});case"earnings":return e.jsx(jd,{});case"alpha":return e.jsx(jc,{});case"gex":return e.jsx(ud,{symbol:r,vis:g});case"stats":return e.jsx(Tc,{vis:g});case"movement":return e.jsx(Vp,{vis:g});case"volatility":return e.jsx(Ec,{symbol:r,vis:g});case"alerts":return e.jsx(gd,{});
7case"myalerts":return e.jsx(Md,{module:h.module,presetSymbol:h.symbol},`${h.module}|${h.symbol}`);case"journal":return e.jsx(Qd,{kind:"user",inline:!0,onClose:()=>{}});case"news":return e.jsx(Ac,{symbol:r});case"heatmap":return e.jsx(_d,{underlying:r,vis:g});case"dollarflow":return e.jsx(Ed,{underlying:r});case"oi":return e.jsx($d,{symbol:r,vis:g});case"historical":return e.jsx(Rd,{symbol:r,vis:g});case"watchlist":return e.jsx(Nd,{});case"futures":return e.jsx(Ms,{});case"crypto":return e.jsx(Ws,{});default:return null}},Q=J(c),U=["0dte","futures","crypto"],[D,B]=yt("terminal.splitView",null),te=!E&&i>=1400?Ll.flatMap(([,,Y])=>Y).filter(Y=>Y!==c&&!U.includes(Y)):null,me=!!D&&D!==c&&!U.includes(D)&&!E&&i>=1400?e.jsx(Oe,{id:"sa-terminal-split",stackBelow:1400,gap:10,style:{flex:1,minHeight:0},columns:[{defaultSize:"55%",minSize:"30%",node:e.jsx("div",{style:{height:"100%",minHeight:0,overflowY:"auto"},children:Q})},{defaultSize:"45%",minSize:"25%",node:e.jsxs("div",{style:{height:"100%",minHeight:0,overflowY:"auto",position:"relative"},children:[e.jsx("button",{onClick:()=>B(null),title:s("markets.terminal.splitClose",{defaultValue:"Close split"}),style:{position:"absolute",top:4,right:6,zIndex:5,fontSize:12,lineHeight:1,border:`1px solid ${t.border2}`,borderRadius:5,background:t.panel2,color:t.muted,cursor:"pointer",padding:"2px 7px"},children:"Ã"}),J(D)]})}]}):Q,be=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[E&&e.jsxs(e.Fragment,{children:[e.jsxs("form",{onSubmit:C,style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("input",{value:p,onChange:Y=>d(Y.target.value),"aria-label":s("markets.terminal.symbolAria"),placeholder:s("markets.terminal.symbolPlaceholder"),style:{width:90,background:t.panel2,border:`1px solid ${t.border2}`,borderRadius:6,color:t.text,padding:"5px 9px",fontWeight:700,fontFamily:k,textTransform:"uppercase"}}),e.jsx("button",{type:"submit",style:{background:"rgba(210,162,76,0.14)",border:"1px solid #D2A24C",color:"#D2A24C",borderRadius:6,padding:"5px 10px",fontSize:12,fontWeight:700,cursor:"pointer"},children:s("markets.terminal.goButton")})]}),e.jsx("div",{style:{display:"flex",gap:3},children:Os.map(Y=>e.jsx("button",{onClick:()=>v(Y),style:{fontSize:11,padding:"4px 8px",borderRadius:5,cursor:"pointer",border:`1px solid ${w===Y?t.blue:"transparent"}`,background:w===Y?"rgba(57,141,255,0.14)":t.panel2,color:w===Y?t.blue:t.muted},children:Y},Y))})]}),j!=="equities"&&c==="0dte"&&!E&&e.jsx(_i,{plain:!0,symbol:r,onSym:Y=>{a(Y),d(Y)}}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:10},children:[!E&&e.jsx(pl,{}),j==="equities"&&!E&&e.jsx(bn,{vis:x,panelDefs:xc}),j!=="equities"&&!E&&e.jsx(bn,{vis:g,accent:t.blue,panelDefs:c==="flow"?[...Me,dl,...Bp]:c==="0dte"?[...Me,...Up]:c==="darkpool"?[...Me,dl,...Jp]:c==="gex"?[...Me,dl,...eu]:c==="hiro"?[...Me,...Gp]:c==="stats"?[...Me,...Yp]:c==="movement"?[...Me,...Xp]:c==="volatility"?[...Me,...Kp]:c==="heatmap"?[...Me,...qp]:c==="oi"?[...Me,...Qp]:c==="historical"?[...Me,...Zp]:Me}),e.jsx(ei,{})]})]});return j!=="equities"&&c==="futures"?e.jsx("div",{style:{color:t.text},children:e.jsx(Ms,{})}):j!=="equities"&&c==="crypto"?e.jsx("div",{style:{color:t.text},children:e.jsx(Ws,{})}):E?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"auto",color:t.text},children:[be,j!=="equities"&&e.jsx(Hs,{view:c,setView:u,viewAllowed:A,onAlerts:y,split:D,setSplit:B,splitEligible:te,compact:!0}),j!=="equities"&&e.jsxs("details",{open:!0,style:{marginTop:4,marginBottom:8},children:[e.jsx("summary",{style:{fontSize:12,fontWeight:700,color:t.muted,cursor:"pointer",padding:"7px 10px",background:t.panel2,borderRadius:6,border:`1px solid ${t.border2}`,listStyle:"none",userSelect:"none",WebkitTapHighlightColor:"transparent"},children:e.jsx("span",{children:s("markets.terminal.mobileChartVitals",{symbol:r,tf:w})})}),e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{border:`1px solid ${t.border}`,borderRadius:8,overflow:"hidden",background:t.panel,display:"flex",flexDirection:"column",marginBottom:8},children:[e.jsxs("div",{style:{padding:"6px 10px",fontSize:12,fontWeight:800,color:t.text,borderBottom:`1px solid ${t.border}`,flexShrink:0},children:[r," · ",w,e.jsx(vn,{symbol:r})]}),e.jsx("div",{style:{height:240},children:e.jsx(Bt,{symbol:r,tf:w,height:"100%",prefScope:"flow"})})]}),e.jsx("div",{style:{minHeight:200,display:"flex",flexDirection:"column"},children:e.jsx(xs,{symbol:r})}),e.jsx("div",{style:{marginTop:8,minHeight:160},children:e.jsx(iu,{})})]})]}),e.jsx("div",{className:"sa-mob-flow",style:{width:"100%",minHeight:"62vh"},children:j==="equities"?e.jsx(Ts,{symbol:Ps[r]||r,tf:w,onSetSymbol
7:Y=>{a(Y),d(Y)},onSetTf:v,vis:x}):Q}),e.jsxs("details",{style:{marginTop:12,marginBottom:16},children:[e.jsx("summary",{style:{fontSize:12,fontWeight:700,color:t.muted,cursor:"pointer",padding:"7px 10px",background:t.panel2,borderRadius:6,border:`1px solid ${t.border2}`,listStyle:"none",userSelect:"none",WebkitTapHighlightColor:"transparent"},children:e.jsx("span",{children:"Signal engine / Retired"})}),e.jsx("div",{style:{marginTop:6},children:e.jsx(Vt,{assetClass:j==="equities"?"stocks":"options"})})]}),e.jsx("div",{style:{marginBottom:12},children:e.jsx(pl,{})})]}):e.jsxs("div",{ref:T,style:{display:"flex",flexDirection:"column",height:S?`${S}px`:"calc(100vh - 200px)",minHeight:560,color:t.text},children:[be,e.jsx(Oe,{id:j==="equities"?"sa-equities-shell-cols-v1":"sa-flow-shell-cols-v1",layoutEpoch:(j==="equities"?x:g).layoutEpoch,style:{flex:1,minHeight:0},columns:[{id:"workspace",defaultSize:o?"80%":"85%",minSize:"58%",node:e.jsx("div",{style:{height:"100%",minWidth:0,minHeight:0},children:j==="equities"?e.jsx(Ts,{symbol:Ps[r]||r,tf:w,onSetSymbol:Y=>{a(Y),d(Y)},onSetTf:v,vis:x}):e.jsx(Oe,{id:"sa-flow-cols",layoutEpoch:g.layoutEpoch,style:{height:"100%"},columns:[{id:"chart-rail",defaultSize:o?"36%":"28%",minSize:"15%",node:e.jsx(tt,{id:c==="0dte"?"sa-flow-rows-0dte-v3":"sa-flow-rows-flow-v3",layoutEpoch:g.layoutEpoch,rows:[{id:"chart",defaultSize:c==="0dte"?"42%":"52%",minSize:"15%",node:e.jsxs("div",{style:{height:"100%",border:`1px solid ${t.border}`,borderRadius:8,overflow:"hidden",background:t.panel,display:"flex",flexDirection:"column"},children:[V,e.jsx("div",{style:{flex:1,minHeight:0},onMouseLeave:_l,children:e.jsx(Bt,{symbol:r,tf:w,height:"100%",prefScope:"flow",onReady:Tl})})]})},{id:"vitals",defaultSize:c==="0dte"?"58%":"48%",minSize:"15%",node:e.jsx(Oe,{id:"sa-flow-vitals-cols-v2",layoutEpoch:g.layoutEpoch,style:{height:"100%"},columns:[{id:"stackdial",defaultSize:"45%",minSize:"18%",hidden:g.isHidden("stackdial"),node:e.jsx(X,{id:"stackdial",vis:g,style:{height:"100%",minHeight:0},children:e.jsx(vl,{symbol:r})})},{id:"vit",defaultSize:"55%",minSize:"28%",node:e.jsx("div",{style:{height:"100%",minHeight:0,display:"flex",flexDirection:"column"},children:c==="0dte"?e.jsx(La,{symbol:r}):e.jsx(xs,{symbol:r})})}]})}]})},{id:"deck",defaultSize:o?"64%":"72%",minSize:"30%",node:e.jsxs("div",{style:{height:"100%",minHeight:0,display:"flex",flexDirection:"column"},children:[e.jsx(Hs,{view:c,setView:u,viewAllowed:A,onAlerts:y,split:D,setSplit:B,splitEligible:te}),P,e.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:me})]})}]})})},{id:"signals",hidden:(j==="equities"?x:g).isHidden("sigfeed"),defaultSize:o?"20%":"15%",minSize:"12%",node:e.jsx(Vt,{assetClass:j==="equities"?"stocks":"options"})}]})]})}export{_u 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.