1import{j as e,n as C,r as j}from"./vendor-ahVw9cdH.js";import{a5 as g,a6 as v,ab as S,az as m,aE as T,aK as y,aL as _,bj as w,dz as E,fs as O,aW as R,bd as G,bp as P}from"./index-DXi0I5ak.js";import{u as F}from"./useGolfMetrics-C4p8Ga1h.js";import{A}from"./AppBreadcrumb-DQQeh5xA.js";import{G as I,c as L,f as B}from"./golf-stat-definitions-CwADRUbe.js";import{T as D,b as M}from"./golf-stat-tiers-B_t78XU2.js";import{T as K}from"./TierLegend-eS4dvAPO.js";import{F as H}from"./FilterEmptyState-DFgd4Gz6.js";import{T as z}from"./TimeframeControls-CwLitKXI.js";import{B as Y}from"./BaselineComparison-xTuO38DM.js";import{a as V}from"./baseline-utils-BHKuQoMF.js";import{C as U}from"./CourseFilter-RxRpRIXU.js";import"./radix--pSzM2y8.js";import"./supabase-DYrB2Yg5.js";import"./charts-CSweoJhv.js";import"./query-CeIq2NOR.js";import"./forms-Cc1FL3tT.js";import"./usePlayerProfiles-BIUWklRV.js";import"./subYears-CWGZTOgB.js";import"./setYear-lX1ccTYE.js";import"./endOfWeek-CvZ6jUGu.js";import"./breadcrumb-C59QT_kB.js";import"./calendar-VJ0tAwC5.js";import"./isSameDay-CFziqlbR.js";import"./goal-profile-to-dashboard-C5sJoTpD.js";const W=[{label:"Fairways Hit",value:"64%",sub:"9/14"},{label:"GIR",value:"52%",sub:"9/18"},{label:"Putts / Hole",value:"1.78",sub:"32 total"},{label:"Sand Saves",value:"50%",sub:"2/4"},{label:"Up & Down",value:"40%",sub:"4/10"},{label:"Penalty Rate",value:"0.11",sub:"2 strokes"}];function $(){return e.jsx("div",{className:"grid grid-cols-2 gap-2",children:W.map(r=>e.jsx(g,{children:e.jsxs(v,{className:"p-2.5 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(S,{className:"h-3 w-3 text-emerald-500"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:r.label})]}),e.jsx("p",{className:"text-base font-bold tabular-nums",children:r.value}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:r.sub})]})},r.label))})}function q({label:r,description:i,formattedValue:f,valueColor:u,valueHexColor:n,baseline:l,currentValue:c,statKey:o,type:p="golf",onClick:a,icon:x,showChevron:s=!0,compact:t=!1,className:d}){const h=a?"button":"div",b=l!=null&&c!==void 0&&c!==null;return e.jsxs(h,{onClick:a,className:m("w-full text-left flex items-center gap-3 p-3 rounded-lg border border-border/50 bg-card/30 transition-colors",a&&"hover:bg-card/50 cursor-pointer",t&&"p-2",d),children:[x&&e.jsx("div",{className:"flex-shrink-0",children:x}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:m("font-medium truncate",t?"text-xs":"text-sm"),children:r}),i&&e.jsx("p",{className:m("text-muted-foreground truncate",t?"text-[10px]":"text-xs"),children:i})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:m("font-bold",t?"text-sm":"text-base",!n&&u),style:n?{color:n}:void 0,children:f}),b&&o&&e.jsx(Y,{current:c,baseline:l,type:p,statKey:o,size:"xs"})]}),s&&a&&e.jsx(T,{className:m("text-muted-foreground",t?"h-3 w-3":"h-4 w-4")})]})]})}const J={up_down:"up_and_down"};function Ne(){const r=C(),[i,f]=j.useState("year"),[u,n]=j.useState(0),[l,c]=j.useState(null),{golfStatistics:o,isLoading:p}=F(i,u,l),{data:a=[]}=y(),{data:x}=_();return p?e.jsx(w,{}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(A,{items:[{label:"Home",href:"/dashboard"},{label:"Course Metrics"}]}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(E,{className:"h-6 w-6"}),"Course Metrics"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track your course performance statistics"})]}),a.length===0&&e.jsx(O,{page:"golf-metrics",roundsRecorded:0,children:e.jsx($,{})}),a.length>0&&e.jsx(z,{timeframe:i,periodOffset:u,onTimeframeChange:f,onPeriodOffsetChange:n,compact:!0,centered:!1}),a.length>0&&e.jsx(U,{value:l,onChange:(s,t)=>c(t)}),a.length>0&&e.jsxs(g,{children:[e.jsx(R,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(G,{className:"text-base",children:"Course Stats"}),e.jsx(P,{children:"Your course performance metrics for this period"})]}),!Object.values(o).every(s=>s===0)&&(()=>{const s=o.gir_pct||0,t=s>=65?"Excellent":s>=50?"Good":s>=30?"Average":s>
1=15?"Poor":"Very Poor";return e.jsx("span",{className:"text-xs font-semibold px-2 py-1 rounded-full",style:{backgroundColor:D[t],color:t==="Excellent"?"#fff":t==="Good"?"#000":"#fff"},children:t})})()]})}),e.jsxs(v,{className:"space-y-3",children:[Object.values(o).every(s=>s===0)?e.jsx(H,{roundFilter:"this_year",context:"course data"}):I.map(s=>{const t=L[s],d=o[t.statKey],h=V(x,s),b=J[s]||s,N=M(b,d);return e.jsx(q,{label:t.label,description:t.shortDescription,formattedValue:B(s,d),valueHexColor:N,baseline:h,currentValue:d,statKey:s,type:"golf",onClick:()=>r(`/golf/stat/${s}`)},s)}),e.jsx("div",{className:"pt-4 mt-4 border-t border-border/50",children:e.jsx(K,{variant:"golf",showRanges:!1})})]})]}),a.length>0&&!Object.values(o).every(s=>s===0)]})}export{Ne 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.