PageSourceSearch

https://www.hobbymonitor.com/assets/_slug_-mxnsmOug.js

js hobbymonitor.com collected 2026-09-24 13:59:28 UTC 19,192 bytes, 1 lines download raw bytes

1import{a as e,u as t,j as r}from"./query-vendor-DZMRrbMU.js";import{P as s,u as a,a as d,L as n,H as i,k as o,I as l,c}from"./index-Ww_mg2y_.js";import{h as m,ac as x,V as u,_ as h,u as g,x as f,w as p,ai as b,aB as j}from"./icon-vendor-BVA9AJ-N.js";import{R as N,C as v,a as y,X as w,Y as k,T as S,c as F,A as C,L as $,b as I}from"./chart-vendor-C9AHoz67.js";import"./ui-vendor-BNlO3lKu.js";import"./firebase-vendor-CX_xv3XA.js";import"./form-vendor-BbpM4sBQ.js";import"./date-vendor-CXQvy03X.js";import"./image-vendor-CbOcgYXP.js";function P(e){if(!e)return"-";const t=parseFloat(e);return isNaN(t)?"-":`$${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function M(e){return e>=1e3?`$${(e/1e3).toFixed(1)}k`:`$${e.toFixed(0)}`}function L(e){if(!e)return"-";const t=parseFloat(e);return isNaN(t)?"-":t.toFixed(1)}function A(e){if(!e)return"Never";const t=new Date(e),r=(new Date).getTime()-t.getTime(),s=Math.floor(r/36e5);if(s<1)return"Just now";if(s<24)return`${s}h ago`;const a=Math.floor(s/24);return 1===a?"Yesterday":`${a}d ago`}function V({confidence:e}){if(null===e)return r.jsx("span",{className:"text-muted-foreground",children:"-"});const t=e>=80?"bg-green-500/15 text-green-700 dark:text-green-400":e>=40?"bg-amber-500/15 text-amber-700 dark:text-amber-400":"bg-muted text-muted-foreground";return r.jsxs("span",{className:o("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t),children:[e,"%"]})}function T({user:e,children:t}){return r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"blur-[6px] pointer-events-none select-none","aria-hidden":"true",children:t}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/40",children:r.jsxs("div",{className:"text-center px-4 py-5 rounded-xl bg-card/90 border border-border shadow-lg max-w-xs",children:[r.jsx(j,{className:"h-5 w-5 text-muted-foreground mx-auto mb-2"}),r.jsx("h3",{className:"font-semibold text-sm mb-1",children:"Premium Feature"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Unlock price history, individual member data, and trend analysis."}),r.jsx(n,{href:"/about#pricing",children:r.jsx(c,{size:"sm",children:e?"Upgrade to Premium":"Sign in to access"})})]})})]})}function D(){const e=Array.from({length:18},(e,t)=>({date:`${["Jan","Feb","Mar"][Math.floor(t/6)]} ${t%28+1}`,totalValue:2800+400*Math.sin(.5*t)+30*t,avgPrice:90+15*Math.sin(.7*t)+1.5*t}));return r.jsxs("div",{className:"bg-card rounded-lg border border-border p-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(b,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Index History"})]}),r.jsx("div",{className:"h-[220px]",children:r.jsx(N,{width:"100%",height:"100%",children:r.jsxs(I,{data:e,margin:{top:5,right:10,bottom:5,left:0},children:[r.jsx(y,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.5}),r.jsx(w,{dataKey:"date",tick:{fontSize:11},tickLine:!1,axisLine:!1}),r.jsx(k,{tick:{fontSize:11},tickFormatter:M,tickLine:!1,axisLine:!1,width:50}),r.jsx(C,{type:"monotone",dataKey:"totalValue",stroke:"hsl(var(--primary))",fill:"hsl(var(--primary)/0.1)",strokeWidth:2,dot:!1})]})})})]})}function G({memberCount:e}){const t=["A. Johnson","B. Williams","C. Davis","D. Martinez","E. Anderson","F. Thomas","G. Wilson","H. Moore"],s=Math.min(e,8);return r.jsx("div",{className:"bg-card rounded-lg border border-border overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[r.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-muted-foreground w-10",children:"#"}),r.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-muted-foreground",children:"Player"}),r.jsx("th",{className:"text-right py-2.5 px-3 font-medium text-muted-foreground",children:"Raw Price"}),r.jsx("th",{className:"text-right py-2.5 px-3 font-medium text-muted-foreground",children:"Sales"}),r.jsx("th",{className:"text-center py-2.5 px-3 font-medium text-muted-foreground",children:"Confidence"})]})}),r.jsx("tbody",{children:Array.from({length:s},(e,s)=>r.jsxs("tr",{className:"border-b border-border last:border-0",children:[r.jsx("td",{className:"py-2.5 px-3 text-muted-foreground",children:s+1}),r.jsx("td",{className:"py-2.5 px-3 font-medium text-foreground",children:t[s]}),r.jsxs("td",{className:"py-2.5 px-3 text-right font-mono text-foreground",children:["$",(200-20*s+10*Math.random()).toFixed(2)]}),r.jsx("td",{className:"py-2.5 px-3 text-right text-foreground",children:80-5*s}),r.jsx("td",{className:"py-2.5 px-3 text-center",children:r.jsxs("span",{className:"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-green-500/15 text-green-700 dark:text-green-400",children:[95-3*s,"%"]})})]},s))})]})})})}function z({slug:s,user:a}){const[d,n]=e.useState(90),[i,l]=e.useState(()=>"undefined"==typeof window?7:"30"===localStorage.getItem("index-market-ma")?30:7);e.useEffect(()=>localStorage.setItem("index-market-ma",String(i)),[i]);const{data:c,isLoading:m}=t({queryKey:["index-history",s,d,null==a?void 0:a.uid],queryFn:async()=>{const e={};a&&(e.Authorization=`Bearer ${await a.getIdToken()}`);const t=await fetch(`/api/market-indices/${s}/history?days=${d}`,{headers:e});if(!t.ok)throw new Error("Failed to fetch history");return t.json()},staleTime:6e5}),x=e.useMemo(()=>
1{if(!(null==c?void 0:c.data))return[];const e=c.data.map(e=>{return{date:(t=e.recordedDate,new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})),indexValue:e.indexValue?parseFloat(e.indexValue):null};var t});return e.map((t,r)=>{const s=Math.max(0,r-i+1),a=e.slice(s,r+1).map(e=>e.indexValue).filter(e=>null!=e);return{...t,trend:a.length?Math.round(a.reduce((e,t)=>e+t,0)/a.length*10)/10:null}})},[c,i]);return m?r.jsx("div",{className:"bg-card rounded-lg border border-border p-4 mb-6",children:r.jsxs("div",{className:"animate-pulse",children:[r.jsx("div",{className:"h-4 w-40 bg-muted rounded mb-3"}),r.jsx("div",{className:"h-[200px] bg-muted/50 rounded"})]})}):x.length?r.jsxs("div",{className:"bg-card rounded-lg border border-border p-4 mb-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(b,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Index History"})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap justify-end",children:[r.jsx("div",{className:"flex gap-1",children:[30,90,180].map(e=>r.jsxs("button",{onClick:()=>n(e),className:o("px-2 py-0.5 rounded text-xs font-medium transition-colors",d===e?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:[e,"d"]},e))}),r.jsx("div",{className:"flex gap-1 bg-muted/50 rounded p-0.5",role:"tablist","aria-label":"Trend smoothing",children:[7,30].map(e=>r.jsxs("button",{role:"tab","aria-selected":i===e,onClick:()=>l(e),className:o("px-2 py-0.5 rounded text-xs font-medium transition-colors",i===e?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[e,"d avg"]},e))})]})]}),r.jsx("div",{className:"h-[220px]",children:r.jsx(N,{width:"100%",height:"100%",children:r.jsxs(v,{data:x,margin:{top:5,right:10,bottom:5,left:0},children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:"totalValueGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"5%",stopColor:"hsl(var(--primary))",stopOpacity:.2}),r.jsx("stop",{offset:"95%",stopColor:"hsl(var(--primary))",stopOpacity:0})]})}),r.jsx(y,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.5}),r.jsx(w,{dataKey:"date",tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"},interval:"preserveStartEnd",tickLine:!1,axisLine:!1}),r.jsx(k,{yAxisId:"idx",domain:["auto","auto"],tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"},tickFormatter:e=>e.toFixed(0),tickLine:!1,axisLine:!1,width:40}),r.jsx(S,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"},formatter:(e,t)=>[e.toFixed(1),"trend"===t?`${i}d avg`:"Index"]}),r.jsx(F,{yAxisId:"idx",y:100,stroke:"hsl(var(--muted-foreground))",strokeDasharray:"4 3",strokeOpacity:.5}),r.jsx(C,{yAxisId:"idx",type:"monotone",dataKey:"indexValue",name:"index",stroke:"hsl(var(--primary))",strokeOpacity:.35,fill:"url(#totalValueGrad)",strokeWidth:1,dot:!1,connectNulls:!0}),r.jsx($,{yAxisId:"idx",type:"monotone",dataKey:"trend",name:"trend",stroke:"#f59e0b",strokeWidth:2.5,dot:!1,connectNulls:!0})]})})}),r.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("div",{className:"w-3 h-0.5 bg-primary/40 rounded"}),"Index (base 100)"]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("div",{className:"w-3 h-[2px] bg-amber-500 rounded"}),i,"d avg"]})]})]}):r.jsxs("div",{className:"bg-card rounded-lg border border-border p-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(b,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Index History"})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"History data will appear after a few days of tracking."})]})}function K({slug:s,memberId:a,user:d}){const{data:n}=t({queryKey:["member-history",s,a,null==d?void 0:d.uid],queryFn:async()=>{const e={};d&&(e.Authorization=`Bearer ${await d.getIdToken()}`);const t=await fetch(`/api/market-indices/${s}/members/${a}/history?days=30`,{headers:e});if(!t.ok)throw new Error("Failed to fetch member history");return t.json()},staleTime:6e5}),i=e.useMemo(()=>{var e;return(null==(e=null==n?void 0:n.data)?void 0:e.length)?n.data.map(e=>e.rawPrice?parseFloat(e.rawPrice):null).filter(e=>null!==e):null},[n]);if(!i||i.length<2)return r.jsx("span",{className:"text-muted-foreground text-xs",children:"--"});const o=Math.min(...i),l=Math.max(...i)-o||1,c=i.map((e,t)=>`${1+t/(i.length-1)*58},${19-(e-o)/l*18}`),m=i[i.length-1]>=i[0]?"#22c55e":"#ef4444";return r.jsx("svg",{width:60,height:20,className:"inline-block",children:r.jsx("polyline",{points:c.join(" "),fill:"none",stroke:m,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function U(){const c=s().slug,{user:b,loading:j}=a(),N=b&&("premium"===(null==b?void 0:b.tier)||"pro"===(null==b?void 0:b.tier)||(null==b?void 0:b.isAdmin)),[v,y]=e.useState(""),[w,k]=e.useState("price"),[,S]=d(),{data:F,isLoading:C,error:$}=t({queryKey:["market-index",c,null==b?void 0:b.uid],queryFn:async()=>{const e={};b&&(e.Authorization=`Bearer ${await b.getIdToken()}`);const t=await fetch(`/api/market-indices/${c}`,{headers:e});if(!t.ok)throw new Error("Failed to fetch index");return t.json()},staleTime:3e5,enabled:!!c&&!j}),I=null==F?void 0:F.data,M=e.useMemo(()=>
1{if(!(null==I?void 0:I.members))return[];let e=[...I.members];if(v){const t=v.toLowerCase();e=e.filter(e=>e.displayName.toLowerCase().includes(t))}return e.sort((e,t)=>{switch(w){case"price":{const r=e.latestGradedPrice?parseFloat(e.latestGradedPrice):-1;return(t.latestGradedPrice?parseFloat(t.latestGradedPrice):-1)-r}case"name":return e.displayName.localeCompare(t.displayName);case"sales":{const r=e.latestSaleCount??-1;return(t.latestSaleCount??-1)-r}case"confidence":{const r=e.latestConfidence??-1;return(t.latestConfidence??-1)-r}default:return 0}}),e},[null==I?void 0:I.members,v,w]);return C||j?r.jsx("div",{className:"min-h-dvh bg-background",children:r.jsx("div",{className:"max-w-4xl mx-auto px-4 py-6",children:r.jsxs("div",{className:"animate-pulse space-y-4",children:[r.jsx("div",{className:"h-4 w-32 bg-muted rounded"}),r.jsx("div",{className:"h-7 w-2/3 bg-muted rounded"}),r.jsx("div",{className:"h-4 w-full bg-muted rounded"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(e=>r.jsx("div",{className:"h-16 bg-muted rounded-lg"},e))})]})})}):$||!I?r.jsx("div",{className:"min-h-dvh bg-background",children:r.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-6",children:[r.jsxs(n,{href:"/indices",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-4",children:[r.jsx(m,{className:"h-4 w-4"}),"Market Indices"]}),r.jsxs("div",{className:"bg-card rounded-lg border border-destructive/50 p-5",children:[r.jsxs("div",{className:"flex items-center gap-2 text-destructive mb-2",children:[r.jsx(x,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:"Index not found"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"This index may not exist or is no longer active."})]})]})}):r.jsxs("div",{className:"min-h-dvh bg-background",children:[r.jsxs(i,{children:[r.jsxs("title",{children:[I.name," - Market Index | HobbyMonitor"]}),r.jsx("meta",{name:"description",content:`${I.name} market index tracking ${I.memberCount} members with real-time pricing.`})]}),r.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4",children:[r.jsxs(n,{href:"/indices",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-3",children:[r.jsx(m,{className:"h-4 w-4"}),"Market Indices"]}),r.jsx("h1",{className:"text-xl md:text-2xl font-bold text-foreground mb-1",children:I.name}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:I.description}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[r.jsxs("div",{className:"bg-card rounded-lg border border-border p-3",children:[r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[r.jsx(u,{className:"h-3 w-3"}),"Index Value"]}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsx("div",{className:"text-lg font-bold text-foreground",children:L(I.indexValue)}),I.indexValue&&r.jsxs("span",{className:o("text-xs font-medium",parseFloat(I.indexValue)>=100?"text-emerald-500":"text-red-500"),children:[parseFloat(I.indexValue)>=100?"+":"",(parseFloat(I.indexValue)-100).toFixed(1),"%"]})]})]}),r.jsxs("div",{className:"bg-card rounded-lg border border-border p-3",children:[r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[r.jsx(h,{className:"h-3 w-3"}),"Avg Graded (PSA 10)"]}),r.jsx("div",{className:"text-lg font-bold text-foreground",children:P(I.avgGradedPrice)})]}),r.jsxs("div",{className:"bg-card rounded-lg border border-border p-3",children:[r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[r.jsx(g,{className:"h-3 w-3"}),"Members Priced"]}),r.jsxs("div",{className:"text-lg font-bold text-foreground",children:[I.pricedCount,"/",I.memberCount]})]}),r.jsxs("div",{className:"bg-card rounded-lg border border-border p-3",children:[r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[r.jsx(f,{className:"h-3 w-3"}),"Last Updated"]}),r.jsx("div",{className:"text-lg font-bold text-foreground",children:A(I.lastUpdated)})]})]}),c&&(N?r.jsx(z,{slug:c,user:b}):r.jsx(T,{user:b,children:r.jsx(D,{})})),N?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(p,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}
1),r.jsx(l,{placeholder:"Search members...",value:v,onChange:e=>y(e.target.value),className:"pl-9 h-9"})]}),r.jsxs("select",{value:w,onChange:e=>k(e.target.value),className:"h-9 rounded-md border border-input bg-background px-3 text-sm",children:[r.jsx("option",{value:"price",children:"Sort by Price"}),r.jsx("option",{value:"name",children:"Sort by Name"}),r.jsx("option",{value:"sales",children:"Sort by Sales"}),r.jsx("option",{value:"confidence",children:"Sort by Confidence"})]})]}),r.jsx("div",{className:"bg-card rounded-lg border border-border overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[r.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-muted-foreground w-10",children:"#"}),r.jsx("th",{className:"text-left py-2.5 px-3 font-medium text-muted-foreground",children:"Player"}),r.jsx("th",{className:"text-right py-2.5 px-3 font-medium text-muted-foreground",children:"Graded (PSA 10)"}),r.jsx("th",{className:"text-center py-2.5 px-3 font-medium text-muted-foreground hidden md:table-cell",children:"30d Trend"}),r.jsx("th",{className:"text-right py-2.5 px-3 font-medium text-muted-foreground hidden md:table-cell",children:"Raw"}),r.jsx("th",{className:"text-right py-2.5 px-3 font-medium text-muted-foreground",children:"Sales"}),r.jsx("th",{className:"text-center py-2.5 px-3 font-medium text-muted-foreground hidden md:table-cell",children:"Confidence"}),r.jsx("th",{className:"text-right py-2.5 px-3 font-medium text-muted-foreground hidden sm:table-cell",children:"Updated"})]})}),r.jsx("tbody",{children:0===M.length?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"text-center py-8 text-muted-foreground text-sm",children:v?"No members match your search.":"No members in this index."})}):M.map((e,t)=>r.jsxs("tr",{onClick:()=>S(`/indices/${c}/members/${e.id}`),className:"border-b border-border last:border-0 hover:bg-muted/30 cursor-pointer",children:[r.jsx("td",{className:"py-2.5 px-3 text-muted-foreground",children:t+1}),r.jsx("td",{className:"py-2.5 px-3 font-medium text-foreground",children:r.jsxs("div",{className:"flex items-center gap-2",children:[e.coverImagePath&&"skip"!==e.coverImagePath?r.jsx("img",{src:`/api/images/300/85${e.coverImagePath}`,alt:e.displayName,className:"w-12 h-16 object-cover rounded shrink-0",loading:"lazy"}):null,r.jsx("span",{children:e.displayName})]})}),r.jsx("td",{className:"py-2.5 px-3 text-right font-mono text-foreground",children:P(e.latestGradedPrice)}),r.jsx("td",{className:"py-2.5 px-3 text-center hidden md:table-cell",children:c&&r.jsx(K,{slug:c,memberId:e.id,user:b})}),r.jsx("td",{className:"py-2.5 px-3 text-right font-mono text-muted-foreground hidden md:table-cell",children:P(e.latestRawPrice)}),r.jsx("td",{className:"py-2.5 px-3 text-right text-foreground",children:e.latestSaleCount??"-"}),r.jsx("td",{className:"py-2.5 px-3 text-center hidden md:table-cell",children:r.jsx(V,{confidence:e.latestConfidence})}),r.jsx("td",{className:"py-2.5 px-3 text-right text-muted-foreground text-xs hidden sm:table-cell",children:A(e.lastPriceUpdate)})]},e.id))})]})})}),M.length>0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Showing ",M.length," of ",I.members.length," members"]})]}):r.jsx(T,{user:b,children:r.jsx(G,{memberCount:I.memberCount})})]})]})}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.