PageSourceSearch

https://mindgolf.ai/assets/ContributorDetail-Blc3lcO4.js

js mindgolf.ai collected 2026-10-05 14:53:19 UTC 15,515 bytes, 1 lines download raw bytes

1import{q as ve,r as v,j as e}from"./vendor-ahVw9cdH.js";import{aF as je,aH as ke,bi as Ne,aQ as K,aK as Ce,aJ as Se,d9 as Ie,aS as we,aT as Te,aL as Me,aM as Be,aO as le,aP as re,aN as oe,bj as Le,V as ce,bB as Pe,a5 as V,aW as ie,bd as Fe,bp as Ae,aR as Y,aY as $e,aZ as _e,e6 as Ge,a6 as Q,a_ as Z,ay as Ee,a7 as Ke,aa as Ve,a$ as Ue,b0 as He,b1 as ze,b2 as qe,b3 as Re,b4 as We,af as ue,ds as Je,b6 as Oe,b7 as Ye,e7 as Qe,b8 as Ze}from"./index-DXi0I5ak.js";import{B as Xe}from"./BaselineComparison-xTuO38DM.js";import{A as De}from"./AppBreadcrumb-DQQeh5xA.js";import{A as et}from"./AIAssistantTrigger-C4Hxq-OR.js";import{u as tt,c as st}from"./useTrendDefinitions-BxLQgFuE.js";import{E as nt}from"./EmptyStateJourneyCard-Cjvz8giF.js";import{M as at}from"./MentalSGFilterSlot-DJ6NmKHk.js";import{F as lt}from"./FilterEmptyState-DFgd4Gz6.js";import{g as rt}from"./baseline-utils-BHKuQoMF.js";import{u as ot,L as ct}from"./usePerFactorMentalSGReference-j3l6noIk.js";import{u as it}from"./useMentalKPIBenchmark-CyBjbaoP.js";import{M as ut}from"./MentalFactorSelector-B7ncjALh.js";import{M as dt}from"./MentalScoreJourneyChart-BOGFcl0p.js";import{u as mt,C as pt}from"./useBottomUpContributorImpacts-vEGVIu_k.js";import{D as ht}from"./DetailTrendChartSlot-De_OAeJV.js";import{u as gt}from"./useBottomUpKpiCategoryImpacts-DwUJ4siq.js";import"./radix--pSzM2y8.js";import"./supabase-DYrB2Yg5.js";import"./charts-CSweoJhv.js";import"./query-CeIq2NOR.js";import"./forms-Cc1FL3tT.js";import"./breadcrumb-C59QT_kB.js";import"./golf-stat-tiers-B_t78XU2.js";import"./goal-profile-to-dashboard-C5sJoTpD.js";import"./InfoTooltip-CpjFUwGS.js";import"./useMentalPerfBenchmark-BHEDYq5Q.js";import"./usePlayerBaselineSummary-DsQboNTY.js";import"./canonicalBenchmarkOverlay-CcgraKzh.js";import"./score-utils-CbzbcqzZ.js";import"./useContextualInsight-C8UKmzgH.js";import"./useWhoopSourceFlag-CUglCXLw.js";import"./subject-copy-B85nrqvU.js";import"./useWhoopFactorSeries-BqVpMafz.js";import"./useReconciledReadinessFactorSGImpact-J0VqM6MF.js";import"./useBottomUpReadinessMatrix-Bw0kRfNF.js";import"./minus-D7WxUA4j.js";import"./TierLegend-eS4dvAPO.js";function ns(){var ae;const{metricKey:d,contributorKey:n}=ve(),X=je(),{roundFilter:h,customDateRange:j,customN:N,setRoundFilter:D,setCustomDateRange:de,setCustomN:me}=ke(),[ee,pe]=v.useState(!1),[C,he]=v.useState("personal_best"),{userId:ge}=Ne(),S=ge??void 0,te=ot(S?[S]:[]),{data:B,isHistorical:E}=it({benchmarkType:C,roundFilter:h,customDateRange:j});n&&K(n);const[xt,ft]=v.useState(!1);v.useEffect(()=>{window.scrollTo(0,0)},[n]);const w=K(n||""),L=(w==null?void 0:w.isInverse)??!1,g=Y[n||""]||n,{data:F,isLoading:xe}=Ce(),{data:_}=Se(S),{data:bt}=Ie(),U=gt({userId:S,roundFilter:h,customDateRange:j,customN:N}),fe=v.useMemo(()=>{const t=U.kpiCategoryImpacts;return t?{commitment:t.commitment.total??null,emotions:t.emotions.total??null,focus:t.focus.total??null}:null},[U.kpiCategoryImpacts]),H=mt({userId:S,roundFilter:h,customDateRange:j,customN:N}),z=we(S,{kpiRowBudgets:fe,bottomUpContributorImpacts:H.byKey}),q=Te(S),s=v.useMemo(()=>z.contributors.find(t=>t.contributorKey===n)??null,[z,n]),A=v.useMemo(()=>!(_!=null&&_.rankedFactors)||!n?null:_.rankedFactors.find(t=>t.key===n),[_,n]),{data:se}=tt(),{data:R}=Me(),x=d?Be[d]:null,P=x?[...x.relationship.positive.map(t=>({key:t,type:"positive"})),...x.relationship.negative.map(t=>({key:t,type:"negative"})),...(x.relationship.modifiers||[]).map(t=>({key:t,type:"modifier"}))]:[],ne=v.useMemo(()=>{if(!F||P.length===0)return{};const t={},a=F.filter(o=>o.processingStatus==="approved"||!0),p=le(a,h,"roundDate",{customDateRange:j,customN:N});return P.forEach(({key:o})=>{const l=[];p.forEach(u=>{const y=oe(o),i=u.shots.map(r=>{var m;return(m=r.mental_metrics)==null?void 0:m[y]}).filter(r=>r!=null);i.length>0&&l.push(i.reduce((r,m)=>r+m,0)/i.length)}),t[o]=l.length>0?l.reduce((u,y)=>u+y,0)/l.length:null}),t},[F,P,h,j,N,re()]),f=v.useMemo(()=>!F||!n?[]:F.map(t=>{const a=t.shots.map(o=>{const l=o.mental_metrics;return l==null?void 0:l[oe(n)]}).filter(o=>o!=null);if(a.length===0)return null;const p=a.reduce((o,l)=>o+l,0)/a.length;return{round_id:t.roundId,course_name:t.courseName,date:t.roundDate,score:p}}).filter(t=>t!==null),[F,n]),$=v.useMemo(()=>
1{if(!n)return null;if(f.length>=2){const t=f.map(a=>a.score);return t.reduce((a,p)=>a+p,0)/t.length}return R?rt(R,n):null},[R,n,f]);f.length>=2;const c=v.useMemo(()=>le(f,h,"date",{customDateRange:j,customN:N}),[f,h,j,N,re()]),W=[],k=c.length>0?c.reduce((t,a)=>t+a.score,0)/c.length:0;W.length>0&&W.reduce((t,a)=>t+a.score,0)/W.length;const be=c.slice(-5).length>0?c.slice(-5).reduce((t,a)=>t+a.score,0)/c.slice(-5).length:k,ye=c.slice(0,-5).length>0?c.slice(0,-5).reduce((t,a)=>t+a.score,0)/c.slice(0,-5).length:k,G=Qe(be,ye);c.length*60;const T=se&&c.length>0?st(c.map(t=>({date:t.date,score:t.score})),"year",se):null;return v.useMemo(()=>f.length===0?0:f.reduce((t,a)=>t+a.score,0)/f.length,[f]),(ae=P.find(t=>t.key===n))!=null&&ae.type,xe?e.jsx("div",{className:"container mx-auto p-6",children:e.jsx(Le,{})}):w?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(De,{items:[{label:"Home",href:"/dashboard"},{label:"Analytics",href:"/performance"},{label:(x==null?void 0:x.label)||"Metric",href:`/assistant/${d}`},{label:g}]}),e.jsx(ct,{section:"contributor",keyName:n||""})]}),e.jsx(ut,{currentValue:n?`contrib:${n}`:void 0}),f.length>0&&e.jsx(at,{roundFilter:h,onRoundFilterChange:D,customDateRange:j,onCustomDateRangeChange:de,customN:N,onCustomNChange:me,benchmarkSlot:e.jsx($e,{value:C,onChange:he}),benchmarkType:C}),(()=>{const t=(d==null?void 0:d.replace(/_kpi$/,""))??"",{cells:a,total:p}=_e(U.kpiCategoryImpacts,t),o=(s==null?void 0:s.sgImpact)??null,l=H.byKey&&n?H.byKey[n]??null:null;let u;if(l)u={offTee:l.offTee,approach:l.approach,shortGame:l.shortGame,putting:l.putting};else{const b=(z.byCategory[t]??[]).filter(I=>I.contributorKey!==`${t}_kpi`).map(I=>({key:I.contributorKey,headline:I.sgImpact??null})),M=Ge(a,p,b);u=n&&M[n]?M[n]:{offTee:null,approach:null,shortGame:null,putting:null}}const y=[{category:"offTee",sgImpact:u.offTee??0},{category:"approach",sgImpact:u.approach??0},{category:"shortGame",sgImpact:u.shortGame??0},{category:"putting",sgImpact:u.putting??0}],i=(s==null?void 0:s.beta)??null,r=(s==null?void 0:s.historicalAvg)??null,m=i!=null&&r!=null&&n?((q==null?void 0:q.matchedRounds)??[]).map(b=>{var I;const M=(I=b.contributorScores)==null?void 0:I[n];return typeof M!="number"||!Number.isFinite(M)?null:{factorSG:i*(M-r)}}).filter(b=>b!==null):null;return e.jsx(pt,{contributorLabel:String(g),sgImpact:o,categoryBreakdown:y,matchedRoundCount:te,sampleSize:(s==null?void 0:s.sampleSize)??null,rSquared:(s==null?void 0:s.rSquared)??null,confidenceLabel:(s==null?void 0:s.confidenceLabel)??null,parentKpiLabel:d?Y[d]??null:null,headlineSource:(s==null?void 0:s.source)??null,clamped:(s==null?void 0:s.clamped)??!1,directTier:(s==null?void 0:s.directTier)??null,directShotsScored:(s==null?void 0:s.directShotsScored)??null,shotsToNextTier:(s==null?void 0:s.shotsToNextTier)??null,parentKpiKey:d==null?void 0:d.replace(/_kpi$/,""),analyticsBasePath:"/performance",contributorKey:n,benchmarkType:C,lifetimePerRoundFactorSeries:m})})(),e.jsx(V,{children:e.jsx(Q,{className:"py-4 px-4",children:c.length===0?e.jsx("div",{className:"py-2",children:e.jsx(lt,{roun
1dFilter:h,context:`${g.toLowerCase()} data`})}):isNaN(k)?e.jsx("div",{className:"py-2",children:e.jsx(nt,{description:`No data available for ${g.toLowerCase()}.`,variant:"compact"})}):(()=>{const t=Math.round((L?10-k:k)*10),a=d==null?void 0:d.replace(/_kpi$/,""),p=!E&&B&&a?B[a]:null,o=p!==null?p:$!==null?(L?10-$:$)*10:null,l=!E&&p!==null?Z(C):"historical avg",u=Ze(t);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:g}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length," round",c.length!==1?"s":""," recorded"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"text-2xl font-bold",style:{color:u},children:[t,"%"]}),o!==null&&e.jsxs("div",{className:"text-[11px] font-medium",style:{color:"hsl(270, 50%, 60%)"},children:[Math.round(o),"% ",l]})]})]}),e.jsx(Ee,{value:t,className:"h-2",indicatorStyle:{backgroundColor:u},benchmarkValue:o!==null?Math.round(o):null,benchmarkColor:"hsl(270, 50%, 60%)"}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[T&&e.jsxs(Ke,{variant:"outline",className:"text-xs gap-1",children:[T.trend.key==="improving"&&e.jsx(Ve,{className:"h-3 w-3 text-emerald-500"}),T.trend.key==="declining"&&e.jsx(Ue,{className:"h-3 w-3 text-red-500"}),(!T.trend.key||T.trend.key==="stable")&&e.jsx("span",{className:"h-3 w-3 text-muted-foreground",children:"—"}),T.trend.key?T.trend.key.charAt(0).toUpperCase()+T.trend.key.slice(1):"Stable"]}),o!==null&&e.jsx(Xe,{current:t,baseline:Math.round(o),type:"mental",size:"xs",baselineLabel:l})]})]})})()})}),(()=>{const t=d==null?void 0:d.replace(/_kpi$/,""),a=!E&&B&&t?B[t]:null,p=a!==null?a:$!==null?(L?10-$:$)*10:null,o=!E&&a!==null?Z(C):"Historical Avg",l=`${g} Trend`,u=`Your ${g} score across rounds in the selected timeframe.`;return e.jsx(ht,{title:l,description:u,chartRoundCount:c.length,children:e.jsx(dt,{rounds:c.map(y=>({roundDate:y.date,courseName:y.course_name,metrics:{commitment_kpi:null,emotions_kpi:null,focus_kpi:null},mentalScore:Math.round((L?10-y.score:y.score)*10)})),baselineScore:p,benchmarkScore:p,benchmarkLabel:p!==null?o:void 0,title:l,description:u,mode:"mental"})})})(),e.jsx(He,{open:ee,onOpenChange:pe,children:e.jsxs(V,{className:"border-muted",children:[e.jsx(ze,{asChild:!0,children:e.jsx(ie,{className:"cursor-pointer hover:bg-accent/50 transition-colors py-3 px-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["What is ",g,"?"]}),ee?e.jsx(qe,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Re,{className:"h-4 w-4 text-muted-foreground"})]})})}),e.jsx(We,{children:e.jsxs(Q,{className:"space-y-3 pt-0 px-4 pb-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-1",children:"Description"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.description})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-1",children:"Why It Matters"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:w.improvementTips&&w.improvementTips.length>0?w.improvementTips[0]:`This factor influences your ${(x==null?void 0:x.label)||"mental"} score through its impact on shot-by-shot decision making.`})]})]})})]})}),d&&c.length===0&&f.length>0&&e.jsx(V,{className:"border-dashed border-2 border-violet-500/20",children:e.jsx(Q,{className:"pt-6",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-violet-500/10 flex items-center justify-center mx-auto",children:e.jsx(ue,{className:"h-6 w-6 text-violet-500"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:"Unlock Assistant Insights"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",g.toLowerCase()," data was detected in your round notes. Mention how you felt about your ",g.toLowerCase()," during recording to get personalized coaching."]})]}),e.jsxs("div",{className:"flex items-start gap-2 text-left bg-muted/30 rounded-lg p-3",children:[e.jsx(ue,{className:"h-4 w-4 text-violet-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:"What you'll unlock"}),e.jsxs("ul",{className:"space-y-1",children:[e.jsx("li",{children:"• Personalized coaching advice"}),e.jsx("li",{children:"• Pattern recognition insights"}),e.jsx("li",{children:"• Improvement strategies"})]})]})]}),e.jsxs(ce,{onClick:()=>
1X("/talk?mode=round"),className:"bg-emerald-600 hover:bg-emerald-700 gap-2",children:[e.jsx(Je,{className:"h-4 w-4"}),"Record New Round"]})]})})}),d&&c.length>0&&!isNaN(k)&&(()=>{const t=Math.round((L?10-k:k)*10),a=L?10-k:k,p=(x==null?void 0:x.label)??d,o=P.length>0?(()=>{const i=P.map(r=>{const m=ne[r.key];if(m==null||!Number.isFinite(m))return null;const b=K(r.key);return b!=null&&b.isInverse?10-m:m}).filter(r=>r!=null&&Number.isFinite(r));return i.length?Math.round(i.reduce((r,m)=>r+m,0)/i.length*10):null})():null,l=P.filter(i=>i.key!==n).map(i=>{const r=ne[i.key];if(r==null||!Number.isFinite(r))return null;const m=K(i.key),b=m!=null&&m.isInverse?10-r:r;return{key:i.key,label:Y[i.key]??i.key,valuePct:Math.round(b*10)}}).filter(i=>i!==null).slice(0,6),u=(A==null?void 0:A.categoryBreakdown)??null,y={surface:"contributor",viewer:{mode:"b2c_self"},timeframe:{filter:String(h??"all"),customRange:j??null,label:String(h??"all"),roundCount:c.length},focus:{label:String(g??n??""),valuePct:t,rawValue:a,isInverse:L,trendLabel:G??void 0,...B&&Number.isFinite(B.value)?{benchmark:{type:C,label:Z(C),valuePct:Math.round(B.value*10)}}:{}},related:{...o!=null?{parentKpi:{key:String(d),label:p,valuePct:o}}:{},...l.length?{siblingFactors:l}:{},...(s==null?void 0:s.sgImpact)!=null?{sg:{mentalSGTotal:Math.round(s.sgImpact*100)/100,...u?{categoryBreakdown:u}:{}}}:u?{sg:{categoryBreakdown:u}}:{}}};return e.jsx(et,{contextType:"contributor",contextKey:`contributor_${n||"unknown"}`,pageTitle:`${g}`,viewerRole:"player",description:`Explore your ${g} patterns with the Assistant.`,focus:{type:"contributor",key:String(n??"")},snapshot:y,cacheScope:Ye({roundFilter:h,customDateRange:j,customN:N,benchmarkType:C,directTier:(s==null?void 0:s.directTier)??null}),dataSufficiency:Oe({factorLabel:String(g??n??"this factor"),hasValue:c.length>0&&!isNaN(k),recordedRoundsInWindow:c.length,totalRecordedRounds:f.length,requiredRounds:3,window:h}),keyInsightsScope:S?{scope:"aggregate",userId:S,roundFilter:h,customDateRange:j,customN:N,onRoundFilterChange:D}:void 0,contextData:(()=>{const i=[...l].sort((J,O)=>O.valuePct-J.valuePct)[0],r=[...l].sort((J,O)=>J.valuePct-O.valuePct)[0],m=t>=70?"green":t>=40?"yellow":"red",b=G&&G!=="stable"?` and ${G}`:"",M=h?`over ${String(h).replace(/_/g," ")}`:`across ${c.length} rounds`,I=`Your ${g} is ${m} at ${t}% ${M}${b}.`;return{metricLabel:g,contributorKey:n,currentScore:t,recentAvg:s==null?void 0:s.recentAvg,historicalAvg:s==null?void 0:s.historicalAvg,trend:G,topContributor:i==null?void 0:i.label,weakContributor:r==null?void 0:r.label,seedInsight:I,totalSGImpact:s==null?void 0:s.sgImpact,categoryBreakdown:A==null?void 0:A.categoryBreakdown,rSquared:s==null?void 0:s.rSquared,roundCount:c.length,matchedRoundCount:te??void 0,...(s==null?void 0:s.sgImpact)!=null?{mentalImpactSG:s.sgImpact,shotCount:s.sampleSize,scenarioType:s.sgImpact<-.05?"costing":s.sgImpact>.05?"contributing":"neutral",...u?{mentalImpactByCategory:u}:{}}:{}}})()})})()]}):e.jsxs("div",{className:"container mx-auto p-4 md:p-6",children:[e.jsxs(ce,{variant:"ghost",size:"sm",onClick:()=>X(`/assistant/${d}`),className:"mb-4",children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"}),"Back to ",(x==null?void 0:x.label)||"Metric"]}),e.jsx(V,{children:e.jsxs(ie,{children:[e.jsx(Fe,{children:"Contributor Not Found"}),e.jsxs(Ae,{children:['The contributor factor "',n,'" could not be found.']})]})})]})}export{ns 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.