1import{b as e,r as s,j as a,L as t,R as l}from"./react-vendor-mJE67xr1.js";import{S as r}from"./SEO-5SzjKk1y.js";import{a as n,ez as i,eA as d,eB as o,b as m,eC as c,eD as x,a8 as p,eu as h,ev as g,ew as b,ex as k,R as u,eE as f,a0 as j,cG as w,G as y,cH as N,eF as v,cJ as M,bR as T,eG as z,bh as L,eH as C,cK as G}from"../assets/index-C0PUTU2T.js";import{u as S,M as I}from"./useLocaleStockIndex-DGLNLX65.js";import{M as A}from"./MarketDataProgressBar-D50t9of_.js";import{F as D}from"./FooterSection--tcRGHXC.js";import{c as P,s as U,g as R,C as q}from"./CommoditiesQuoteDetailTooltip-Cl4o_Nek.js";import{M as E}from"./quickLinkButtonClassName-Bl4j5ffm.js";import{u as B}from"./i18n-vendor-peNJPOqg.js";import{a as F,aj as H,n as $,_ as Q}from"./ui-vendor-D2aVcy5s.js";import"./helmet-vendor-BxvPnmey.js";import"./firebase-auth-CnGPAdc3.js";import"./firebase-functions-BIkcAD2c.js";import"./firebase-core-ES3oYmR9.js";import"./firebase-firestore-BXNJosLe.js";import"./dndkit-vendor-BC6j4eOO.js";import"./flags-vendor-C6ccH1Xz.js";import"./marked-vendor-DnXKqpPN.js";import"./chart-vendor-CdNLo97a.js";import"./RiskDisclaimerContent-CksJNBix.js";import"./commodityDisplayName-6MlCZca6.js";const K=z,O=f.map(e=>e.symbol),Y=()=>{const{t:l,i18n:z}=B(),L=e(),{setSelectedSymbolForCategory:C,addToHistory:G,state:Y}=n(),{selectedIndex:J,handleIndexChange:V}=S({validSymbols:O,fallbackSymbol:K,feature:"gainersLosers"}),W=z.language||void 0,X=i(J,W),Z=d(J,W),[ee,se]=s.useState(()=>X),[ae,te]=s.useState(()=>!X),[le,re]=s.useState(null),[ne,ie]=s.useState("gainers"),[de,oe]=s.useState(null),[me,ce]=s.useState(null),[xe,pe]=s.useState(null),[he,ge]=s.useState(null),[be,ke]=s.useState(()=>Z?o(Z.cells):new Map),{isAuthenticated:ue}=m(),fe=s.useCallback(async(e,s=!1)=>{const a=z.language||void 0,t=s?null:i(e,a);if(t){se(t),te(!1),re(null);const s=d(e,a);return void(s?ke(o(s.cells)):c(e,a).then(e=>ke(o(e.cells))).catch(()=>ke(new Map)))}s||te(!0),re(null);try{const[t,l]=await Promise.all([x(e,a,{skipCache:s}),c(e,a,{skipCache:s}).catch(()=>null)]);se(t),ke(o(l?.cells))}catch(r){re(p(r,l("marketMapGainersLosers.loadError"))),se(null),ke(new Map)}finally{te(!1)}},[l,z.language]);s.useEffect(()=>{fe(J)},[J,fe]),h(()=>fe(J,!0),Boolean(ee));const je=s.useMemo(()=>[...ee?.gainers??[],...ee?.losers??[]].map(e=>e.symbol),[ee?.gainers,ee?.losers]),{quotes:we,lastTickAt:ye}=g(je,"equity",Boolean(ee)),Ne=s.useMemo(()=>ee?{...ee,gainers:ee.gainers.map(e=>b(e,k(we,e.symbol))),losers:ee.losers.map(e=>b(e,k(we,e.symbol))),lastUpdated:Math.max(ee.lastUpdated??0,ye)}:null,[ee,we,ye])??ee,ve=s.useCallback(e=>{C(e,"indices"),G(e,"indices"),L(u.INDICES)},[C,G,L]),Me=s.useCallback((e,s)=>{pe(s),ge(P(e))},[]),Te=s.useCallback(()=>{pe(null),ge(null)},[]),ze=s.useMemo(()=>{if(!xe)return null;const e=xe.symbol.trim().toUpperCase(),s=be.get(e);return s?U(s):R(xe)},[xe,be]),Le=s.useMemo(()=>f.find(e=>e.symbol===J),[J]),Ce=Le?.shortName??J;return a.jsxs(j,{currentTerminal:"indices",onSymbolChange:ve,className:"bg-app-canvas dark:bg-[#080a0f] text-slate-800 dark:text-zinc-200",children:[a.jsx(r,{title:l("marketMapGainersLosers.seoTitle"),description:l("marketMapGainersLosers.seoDescription"),keywords:l("marketMapGainersLosers.seoKeywords"),url:"https://1uptick.ai/market-map/gainers-losers",isSoftware:!0}),a.jsxs("main",{className:"flex-1 min-h-0 min-w-0 flex flex-col overflow-hidden",children:[a.jsx("div",{className:"shrink-0 w-full border-b border-slate-200 dark:border-zinc-800 bg-slate-50 dark:bg-[#0d1017]/90",children:a.jsxs("div",{className:"max-w-[1800px] w-full mx-auto px-4 py-2.5 flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[a.jsxs("h1",{className:"text-base font-bold text-slate-900 dark:text-white flex items-center gap-2 shrink-0",children:[a.jsx(F,{className:"w-4.5 h-4.5 text-brand"}),a.jsx("span",{className:"md:hidden",children:l("marketMapGainersLosers.title")}),a.jsx("span",{className:"hidden md:inline",children:l("marketMapGainersLosers.title")})]}),a.jsx(I,{selectedIndex:J,onIndexChange:V,loading:ae})]}),a.jsxs("div",{className:"hidden md:flex items-center gap-3 shrink-0",children:[Ne?.lastUpdated>0&&a.jsxs("span",{className:"text-sm text-slate-700 dark:text-white flex items-center gap-1",children:[a.jsx(H,{className:"w-4 h-4 text-slate-700 dark:text-white"}),l("marketMapGainersLosers.updated",{time:w(Ne.lastUpdated)})]}),a.jsxs(t,{to:`${u.STOCK_HEATMAP}?index=${encodeURIComponent(J)}
1`,className:E,children:[a.jsx($,{className:"w-3 h-3 shrink-0 dark:w-4 dark:h-4","aria-hidden":!0}),l("marketMapGainersLosers.heatmap","Heatmap")]})]})]})}),a.jsxs("div",{className:"max-w-[1800px] w-full mx-auto min-h-0 flex-1 flex flex-col overflow-hidden min-w-0",children:[le&&a.jsxs("div",{className:"shrink-0 mx-4 mt-3 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-300 text-sm border border-red-200 dark:border-red-800/50",children:[a.jsx("p",{className:"font-medium mb-1",children:l("marketMapGainersLosers.loadErrorForIndex",{label:Ce})}),a.jsx("p",{className:"text-xs mb-2 text-rose-600 dark:text-rose-400",children:le}),a.jsx("button",{type:"button",onClick:()=>fe(J,!0),className:"px-3 py-1 rounded bg-red-100 dark:bg-red-900/40 hover:bg-red-200 dark:hover:bg-red-900/60 text-red-800 dark:text-red-200 font-medium text-xs",children:l("marketMapGainersLosers.retry")})]}),ae&&!ee&&a.jsx(A,{message:l("marketMapGainersLosers.loadingIndexData",{label:Ce}),terminal:"indices",compact:!0}),ee&&!le&&a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:[ae&&a.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center bg-slate-50/80 dark:bg-[#0d1017]/85 backdrop-blur-[2px] rounded-b-lg","aria-live":"polite","aria-busy":"true",children:[a.jsx(y,{size:"lg",className:"mb-3"}),a.jsx("p",{className:"text-sm font-medium text-slate-700 dark:text-zinc-300",children:l("marketMapGainersLosers.loadingIndexData",{label:Ce})})]}),a.jsx("div",{className:"lg:hidden shrink-0 w-full border-b border-slate-200 dark:border-zinc-800 bg-slate-50 dark:bg-[#0d1017]/50",children:a.jsxs("div",{className:"max-w-[1800px] w-full mx-auto px-4 py-2 flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-sm font-semibold text-slate-900 dark:text-white",children:Ce}),Ne?.lastUpdated>0&&a.jsxs("span",{className:"text-sm text-slate-700 dark:text-white flex items-center gap-1 shrink-0",children:[a.jsx(H,{className:"w-4 h-4 text-slate-700 dark:text-white"}),l("marketMapGainersLosers.updated",{time:new Date(Ne.lastUpdated).toLocaleTimeString()})]})]})}),a.jsx("div",{className:"lg:hidden shrink-0 w-full border-b border-slate-200 dark:border-zinc-800 bg-slate-50 dark:bg-[#0d1017]/50",children:a.jsxs("div",{className:"max-w-[1800px] w-full mx-auto flex items-stretch",children:[a.jsxs("div",{className:"flex flex-1 min-w-0",children:[a.jsxs("button",{type:"button",onClick:()=>ie("gainers"),className:"flex-1 flex items-center justify-center gap-2 py-3 text-sm font-semibold transition-colors "+("gainers"===ne?"text-emerald-600 dark:text-emerald-400 border-b-2 border-emerald-600 dark:border-emerald-400 bg-white dark:bg-[#0d1017]":"text-slate-500 dark:text-zinc-400 hover:text-slate-700 dark:hover:text-zinc-300"),children:[a.jsx(F,{className:"w-4 h-4"}),l("marketMapGainersLosers.gainers")]}),a.jsxs("button",{type:"button",onClick:()=>ie("losers"),className:"flex-1 flex items-center justify-center gap-2 py-3 text-sm font-semibold transition-colors "+("losers"===ne?"text-rose-600 dar
1k:text-rose-400 border-b-2 border-red-600 dark:border-red-400 bg-white dark:bg-[#0d1017]":"text-slate-500 dark:text-zinc-400 hover:text-slate-700 dark:hover:text-zinc-300"),children:[a.jsx(Q,{className:"w-4 h-4"}),l("marketMapGainersLosers.losers")]})]}),a.jsxs(t,{to:`${u.STOCK_HEATMAP}?index=${encodeURIComponent(J)}`,className:`hidden sm:inline-flex pl-3 pr-2 ${E}`,children:[a.jsx($,{className:"w-3 h-3 shrink-0 sm:w-4 sm:h-4 dark:w-4 dark:h-4","aria-hidden":!0}),a.jsx("span",{className:"hidden sm:inline",children:l("marketMapGainersLosers.heatmap","Heatmap")})]})]})}),a.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden max-lg:px-0 px-2 pt-4 md:px-4",children:a.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-1 lg:grid-cols-2 gap-6 min-h-0",children:[a.jsxs("section",{className:"flex flex-col min-h-0 min-w-0 "+("gainers"!==ne?"hidden lg:flex":""),children:[a.jsxs("h2",{className:"hidden lg:flex text-sm font-bold text-emerald-600 dark:text-emerald-400 mb-3 items-center gap-2 shrink-0",children:[a.jsx(F,{className:"w-4 h-4"}),l("marketMapGainersLosers.topGainers")]}),a.jsx("div",{className:"flex flex-col flex-1 min-h-0 min-w-0 max-lg:rounded-none max-lg:border-x-0 rounded-lg border border-slate-200 dark:border-zinc-800 bg-white dark:bg-[#0d1017] shadow-sm max-lg:shadow-none overflow-hidden",children:a.jsx("div",{className:N({reservePageFooter:!0}),children:a.jsxs("table",{className:"w-full max-w-full text-left text-sm table-fixed lg:table-auto lg:min-w-[280px]",children:[a.jsx("thead",{className:"sticky top-0 z-[1] bg-white dark:bg-[#0d1017]",children:a.jsxs("tr",{className:"border-b border-slate-200 dark:border-zinc-800 text-slate-500 dark:text-zinc-400",children:[a.jsx("th",{className:"px-1.5 py-2 lg:px-2 lg:py-2.5 font-medium w-8 lg:w-10 shrink-0",children:"#"}),a.jsx("th",{className:"px-1.5 py-2 font-medium lg:hidden min-w-0",children:l("marketTable.stock")}),a.jsx("th",{className:"px-3 py-2 lg:px-4 lg:py-2.5 font-medium hidden lg:table-cell lg:min-w-[4.5rem]",children:l("marketTable.symbol")}),a.jsx("th",{className:"px-3 py-2 lg:px-4 lg:py-2.5 font-medium hidden lg:table-cell",children:l("marketTable.name")}),a.jsx("th",{className:"px-1 py-2 lg:px-4 lg:py-2.5 font-medium text-right hidden lg:table-cell lg:min-w-[5.5rem]",children:l("marketTable.price")}),a.jsx("th",{className:"px-1 py-2 lg:px-3 lg:py-2.5 font-medium text-right hidden lg:table-cell lg:min-w-[4.5rem] whitespace-nowrap",children:l("marketTable.volume")}),a.jsx("th",{className:"max-lg:px-3 py-2 pl-1 pr-2.5 lg:pl-3 lg:pr-4 lg:py-2.5 font-medium text-right w-20 min-w-0 shrink-0 lg:min-w-[8rem] whitespace-nowrap",children:l("marketTable.changePct")})]})}),a.jsxs("tbody",{children:[0===(Ne??ee).gainers.length&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-3 py-4 text-slate-500 dark:text-zinc-500 text-center",children:l("marketMapGainersLosers.noGainersYet")})}),(Ne??ee).gainers.map((e,s)=>a.jsx(_,{rank:s+1,row:e,isGain:!0,onQuickAnalysisClick:e=>{oe(e.symbol),ce(e.name??null)},onTooltipMove:Me,onTooltipLeave:Te},e.symbol))]})]})})})]}),a.jsxs("section",{className:"flex flex-col min-h-0 min-w-0 "+("losers"
1!==ne?"hidden lg:flex":""),children:[a.jsxs("h2",{className:"hidden lg:flex text-sm font-bold text-rose-600 dark:text-rose-400 mb-3 items-center gap-2 shrink-0",children:[a.jsx(Q,{className:"w-4 h-4 shrink-0"}),l("marketMapGainersLosers.topLosers")]}),a.jsx("div",{className:"flex flex-col flex-1 min-h-0 min-w-0 max-lg:rounded-none max-lg:border-x-0 rounded-lg border border-slate-200 dark:border-zinc-800 bg-white dark:bg-[#0d1017] shadow-sm max-lg:shadow-none overflow-hidden",children:a.jsx("div",{className:N({reservePageFooter:!0}),children:a.jsxs("table",{className:"w-full max-w-full text-left text-sm table-fixed lg:table-auto lg:min-w-[280px]",children:[a.jsx("thead",{className:"sticky top-0 z-[1] bg-white dark:bg-[#0d1017]",children:a.jsxs("tr",{className:"border-b border-slate-200 dark:border-zinc-800 text-slate-500 dark:text-zinc-400",children:[a.jsx("th",{className:"px-1.5 py-2 lg:px-2 lg:py-2.5 font-medium w-8 lg:w-10 shrink-0",children:"#"}),a.jsx("th",{className:"px-1.5 py-2 font-medium lg:hidden min-w-0",children:l("marketTable.stock")}),a.jsx("th",{className:"px-3 py-2 lg:px-4 lg:py-2.5 font-medium hidden lg:table-cell lg:min-w-[4.5rem]",children:l("marketTable.symbol")}),a.jsx("th",{className:"px-3 py-2 lg:px-4 lg:py-2.5 font-medium hidden lg:table-cell",children:l("marketTable.name")}),a.jsx("th",{className:"px-1 py-2 lg:px-4 lg:py-2.5 font-medium text-right hidden lg:table-cell lg:min-w-[5.5rem]",children:l("marketTable.price")}),a.jsx("th",{className:"px-1 py-2 lg:px-3 lg:py-2.5 font-medium text-right hidden lg:table-cell lg:min-w-[4.5rem] whitespace-nowrap",children:l("marketTable.volume")}),a.jsx("th",{className:"max-lg:px-3 py-2 pl-1 pr-2.5 lg:pl-3 lg:pr-4 lg:py-2.5 font-medium text-right w-20 min-w-0 shrink-0 lg:min-w-[8rem] whitespace-nowrap",children:l("marketTable.changePct")})]})}),a.jsxs("tbody",{children:[0===(Ne??ee).losers.length&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-3 py-4 text-slate-500 dark:text-zinc-500 text-center",children:l("marketMapGainersLosers.noLosersYet")})}),(Ne??ee).losers.map((e,s)=>a.jsx(_,{rank:s+1,row:e,isGain:!1,onQuickAnalysisClick:e=>{oe(e.symbol),ce(e.name??null)},onTooltipMove:Me,onTooltipLeave:Te},e.symbol))]})]})})})]})]})})]})]}),ee&&!le&&a.jsx("div",{className:v,children:a.jsx(D,{terminal:"indices",showDisclaimer:!1,fixed:!1,contentAreaBg:!0,darkTextInLightTheme:!0,fullWidthBleed:!0})})]}),a.jsx(q,{model:ze,tooltipPos:he,t:l,sizeMetric:"changePercent",quoteTitleVariant:"stock",darkMode:Y.isDarkMode,showTileSizeRow:!1}),de?a.jsx(s.Suspense,{fallback:null,children:a.jsx(M,{symbol:de,displayName:me??void 0,assetType:"equity",isOpen:!0,onClose:()=>{oe(null),ce(null)},requireLoginToRun:!ue,terminal:"equity",onRunFullAnalysis:e=>{oe(null),ce(null),C(e,"equity"),G(e,"equity"),L(T(`${u.EQUITY}?symbol=${encodeURIComponent(e)}`))}})}):null]})},_=l.memo(function({rank:e,row:s,isGain:t,onQuickAnalysisClick:l,onTooltipMove:r,onTooltipLeave:n}){const{t:i}=B();return a.jsxs("tr",{className:"border-b border-slate-200 dark:border-zinc-800/50 hover:bg-slate-50 dark:hover:bg-zinc-800/30 group cursor-pointer",onClick:()=>l(s),onMouseMove:e=>r?.(e,s),onMouseLeave:n,children:[a.jsx("td",{className:"px-1.5 py-2 lg:px-2 lg:py-2.5 text-slate-500 dark:text-zinc-500 align-top",children:e}),a.jsx("td",{className:"px-1.5 py-2 lg:hidden min-w-0",children:a.jsxs("span",{className:"text-left block w-full",children:[a.jsxs("span",{className:"font-mono text-slate-900 dark:text-white block leading-tight",children:[a.jsx("span",{className:"font-semibold",children:s.symbol}),a.jsxs("span",{className:"text-slate-600 dark:text-zinc-400 font-normal",children:[" @ ",L(s.price)]})]}),a.jsx("span",{className:"text-xs text-slate-600 dark:text-zinc-400 truncate block mt-0.5",title:s.name||s.symbol,children:s.name||"â"}),a.jsxs("span",{className:"text-xs text-slate-500 dark:text-zinc-500 tabular-nums mt-0.5 block",children:[i("marketTable.volume"),": ",C(s.volume)]})]})}),a.jsx("td",{className:"px-3 py-2 lg:px-4 lg:py-2.5 hidden lg:table-cell font-mono font-semibold text-slate-900 dark:text-white",children:s.symbol}),a.jsx("td",{className:"px-3 py-2 lg:px-4 lg:py-2.5 max-w-[180px] hidden lg:table-cell",children:a.jsx("span",{className:"truncate block w-full text-slate-700 dark:text-zinc-300",title:s.name||s.symbol,children:s.name||"â"})}),a.jsx("td",{className:"px-1 py-2 lg:px-4 lg:py-2.5 text-right font-mono text-slate-600 dar
1k:text-zinc-400 align-top text-xs sm:text-sm whitespace-nowrap hidden lg:table-cell",children:L(s.price)}),a.jsx("td",{className:"px-1 py-2 lg:px-3 lg:py-2.5 text-right font-mono text-slate-600 dark:text-zinc-400 align-top text-xs sm:text-sm whitespace-nowrap hidden lg:table-cell tabular-nums",children:C(s.volume)}),a.jsx("td",{className:"max-lg:px-3 py-2 pl-1 pr-2.5 lg:pl-3 lg:pr-4 lg:py-2.5 text-right font-mono font-semibold align-top text-xs sm:text-sm whitespace-nowrap w-20 min-w-0 shrink-0 lg:min-w-[8rem] "+(t?"text-emerald-600 dark:text-emerald-400":"text-rose-600 dark:text-rose-400"),children:G(s.changesPercentage)})]})});export{Y as MarketMapGainersLosersPage,Y 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.