1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sgp-values-DwITIVPk.js","assets/types-B5LGYWf1.js","assets/index-CM8r5Wjg.js","assets/vendor-mantine-1B1KABau.js","assets/vendor-react-DEH02D30.js","assets/vendor-supabase-BvWrAn-t.js","assets/index-CFjW3YXv.css","assets/season-progress-ChoEAlgz.js","assets/espn-auth-DpTSE1fh.js","assets/datastore-snapshot-C9T-pdod.js"])))=>i.map(i=>d[i]); 2import{u as xs,v as ws,_ as Ss}from"./index-CM8r5Wjg.js";import{j as t,b as ue,k as g,G as Z,i as Ie,v as wi,P as ht,U as ct,B as Xe,h as ee,S as js,w as Ve,T as p,g as Si,z as Ps,n as ge,Q as ut,d as Bt,$ as Oe,a0 as ys,E as sn,V as vs,f as ai,A as ri,M as ks,N as Ms}from"./vendor-mantine-1B1KABau.js";import{L as Ue,r as u,e as Cs,h as Ts,u as As}from"./vendor-react-DEH02D30.js";import{P as Os}from"./PageHeader-CSn_jkXW.js";import{P as Is,a as Bs}from"./InlineProjectionUpload-BN9RB1xS.js";import{R as Ns}from"./RosOnlyStandingsBanner-BsJApezx.js";import{u as Rs,b as li,F as oi}from"./blended-team-standings-DeYTyD-Q.js";import{N as Vs}from"./NoLeagueSelected-CwRmR42h.js";import{u as zs,c as Fs}from"./DataStoreContext-DxUEGAyI.js";import{h as Ds}from"./feature-access-qXK6r0UN.js";import{g as Ls}from"./dynasty-price-map-BFHvJLv_.js";import{P as ji}from"./PlayerLink-DB24m1r-.js";import{L as Pi}from"./LevelBadge-B6daa5Me.js";import{getDisplayPositions as Es,getResolvedPositions as pt,SLOT_ELIGIBLE_POSITIONS as $s,buildPitcherClassifications as an,loadPositionData as Hs,loadEligibilityOverrides as Gs}from"./eligibility-CpfdXEES.js";import{bG as Ws,c as yi,b as vi,aD as Ys,bF as Ks,m as D,aF as hn,a as Ze,a3 as pn,a4 as qs,f as ki,R as Mi,br as gn,bs as Js,bt as ci,ay as Us,a5 as Qs,aA as Zs,by as Xs,bD as ea,bE as ta,w as na,o as ia,p as sa,bu as aa}from"./types-B5LGYWf1.js";import{g as ra,i as la}from"./player-level-BPq8CoL_.js";import{M as oa,a as ca}from"./my-team-highlight-MYutStmS.js";import{a as ui,d as Nt,h as ua,l as di}from"./projections-_rVtYl9o.js";import{n as da}from"./projection-source-notice-D9XilZpY.js";import{Y as Qe,m as Je,n as rn,j as ln,q as dt,l as ha,k as pa,A as ga,v as fa,a as ma,s as ba}from"./sgp-calculator-BskEUsb1.js";import{b as _a,t as xa,c as wa,d as Sa,e as Rt,f as ja,m as hi,g as Pa}from"./suggester-categories-DzqcgrVz.js";import{s as ya}from"./hitting-split-projections-B89UePdA.js";import{m as va,u as ka}from"./lineup-optimizer-yNtcBhFb.js";import{a as Ma}from"./projected-standings-CN0YNLem.js";import{u as Ca}from"./usePickupSuggesterData-oZS6y61B.js";import{u as Ta,A as Aa,C as Oa}from"./ColumnHeaderFilter-CU25Lar5.js";import{u as Ia}from"./useLeagueRefreshNonce-DwHcRiW6.js";import{loadYahooOwnership as Ba}from"./yahoo-ownership-CE61u01j.js";import{loadEspnOwnership as Na}from"./espn-ownership-ITjeyAis.js";import{o as Ra,b as Va,l as za,a as Fa}from"./statcast-Amen2aoe.js";import{l as Da,m as La,I as Ea}from"./il-status-B7xdX4bs.js";import{b as $a,l as Ha,p as Ga,g as Wa}from"./adp-CdobQBT1.js";import{l as Ya,h as Ka,a as qa}from"./league-ownership-Dg8VsdgA.js";import"./vendor-supabase-BvWrAn-t.js";import"./Icons-VJoYYvpd.js";import"./feed-freshness-CdTL7u9r.js";import"./season-progress-ChoEAlgz.js";import"./ProjectionUploadBody-DIQ0Za6m.js";import"./extension-detect-BcqzZu3H.js";import"./PlatformTiles-DqNQwdeh.js";import"./espn-auth-DpTSE1fh.js";import"./cbs-auth-CtlBgA3m.js";import"./RotoHoundConnectorLink-kSCZ1Sfx.js";import"./admin-BIk9Jh8z.js";import"./dynasty-DWBC8quZ.js";import"./dynasty-lens-CmHlV4gu.js";import"./dynamic-values-Yv6QAwWf.js";import"./position-eligibility-format-DpaDxnPa.js";import"./datastore-snapshot-C9T-pdod.js";import"./slot-accepts-DNC3aEHq.js";import"./active-roster-cap-CVpXnTQY.js";import"./standings-CLRfoRkB.js";import"./historical-standings-DONaN1dV.js";import"./roster-capacity-BJZNAg_e.js";import"./yahoo-api-042kDbHJ.js";import"./h2h-standings-kJKWQgKm.js";import"./notify-D2LRllKP.js";import"./onroto-api-CPYx33mG.js";import"./ottoneu-import-lEr7EZ_w.js";import"./proxy-interstitial-C6hI_QYf.js";import"./lineup-frequency-DB5yaVDD.js";import"./faab-CMC7PGNG.js";function Ci(e,l){const a=l.dynastyYearMap?.get(D(e.id));return typeof a=="number"&&Number.isFinite(a)?a:null}const f=1e9;function Ti(e){if(!e)return null;const l=Date.now()-new Date(e).getTime();return Math.floor(l/315576e5)}function Ai(e){if(!e||!e.PA)return null;const l=e.BB;return l==null?null:l/e.PA*100}function Oi(e){if(!e||!e.PA)return null;const l=e.SO??e.K;return l==null?null:l/e.PA*100}function Ii(e){if(!e)return null;const l=e.H,a=e.HR,n=e.AB,i=e.SO??e.K??0;if(l==null||a==null||n==null)return null;const P=n-i-a+(e.SF||0);return P>0?(l-a)/P:null}function Bi(e){return!e||e.SLG==null||e.AVG==null?null:e.SLG-e.AVG}function Ni(e){return!e||e.OBP==null||e.SLG==null?null:e.OBP+e.SLG}const Ja={G:"h_g",PA:"h_pa",AB:"h_ab",H:"h_h","2B":"h_2b","3B":"h_3b",HR:"h_hr",R:"h_r",RBI:"h_rbi",SB:"h_sb",CS:"h_cs",BB:"h_bb",HBP:"h_hbp",K:"h_so",SO:"h_so",AVG:"h_avg",OBP:"h_obp",SLG:"h_slg",wOBA:"h_woba","wRC+":"h_wrc",WAR:"h_war"},Ua={G:"p_g",GS:"p_gs",IP:"p_ip",W:"p_w",L:"p_l",SV:"p_sv",HLD:"p_hld",QS:"p_qs",K:"p_k",SO:"p_k",H:"p_h",ER:"p_er",HR:"p_hr",BB:"p_bb",HBP:"p_hbp",ERA:"p_era",WHIP:"p_whip","K/9":"p_k9","BB/9":"p_bb9","HR/9":"p_hr9",FIP:"p_fip",WAR:"p_war"};function Vt(e,l){const a=l.trim();return(e==="hitting"?Ja:Ua)[a]||`${e==="hitting"?"h_stat:":"p_stat:"}${a}`}function pi(e,l,a){return Ks(a)[e].labels?.[l]||l}function Qa(e,l,a){if(!l)return{hitting:vi(e),pitching:yi(e)};const n=Ys(e),i=a?.batting||n?.hitting||{},P=a?.pitching||n?.pitching||{};return{hitting:Object.entries(i).filter(([,A])=>Number(A)!==0).map(([A])=>A),pitching:Object.entries(P).filter(([,A])=>Number(A)!==0).map(([A])=>A)}}function gi(e,l,a,n,i="-"){const P=hn(e||null,l,a);return P==null||Number.isNaN(P)?i:ki(P,n,l)}function Za(e){const l=new Map;for(const a of e){if(!a.data)continue;const n=new Map;for(const i of a.data)i.playerId&&n.set(i.playerId,i.rank);l.set(a.name,n)}return l}function Xa(e){const l=new Map;for(const a of e){if(!a.data)continue;const n=new Map;for(const i of a.data)i.playerId&&n.set(i.playerId,i.dollars);l.set(a.name,n)}return l}function er(e){if(e==null)return null;const l=String(e).replace(/[$,%\s]/g,"");if(l==="")return null;const a=Number(l);return Number.isFinite(a)?a:null}function tr(e,l){if(e!=="pitchers"&&e!=="hitters")return!0;const a=["P","SP","RP","TWP"].includes(l),n=l==="TWP"||!["P","SP","RP"].includes(l);return e==="pitchers"?a:n}function nr(e,l){const a=new Map,n=[],i=new Set;for(const P of e)for(const A of P.columns||[]){const m=`cdata:${P.n
2ame}::${A.key}`;n.push({id:m,label:A.label||A.key,source:P.name}),A.numeric&&A.sortAsc&&i.add(m);const R=new Map;for(const L of P.data||[]){const S=l.get(L.playerId);if(!S||!tr(A.applies||"both",S.primaryPosition))continue;const h=L.values?.[A.key];if(!(h==null||h===""))if(A.numeric){const U=er(h);U!==null&&R.set(L.playerId,U)}else R.set(L.playerId,String(h))}a.set(m,R)}return{maps:a,columns:n,ascIds:i}}function ir(){const e=new Map;try{const l=Ws()||{};for(const[a,n]of Object.entries(l))e.set(parseInt(a),n)}catch{}return e}function sr(e){const l=[],a=Qa(e.scoringFormat,e.isFGPts,e.leaguePointValues),n=new Set(["age","value","pos","owner","h_pa","p_ip","h_g","p_g","h_bbpct","h_kpct","h_babip","p_k9","p_bb9","p_hr9","p_fip"]);a.hitting.forEach(S=>n.add(Vt("hitting",S))),a.pitching.forEach(S=>n.add(Vt("pitching",S))),e.isFGPts&&(n.add("h_ppg"),n.add("h_pts"),n.add("p_pip"),n.add("p_pts"));const i=S=>{const h=l.find(U=>U.id===S.id);if(h){h.defaultVisible=h.defaultVisible||S.defaultVisible,!h.tooltip&&S.tooltip&&(h.tooltip=S.tooltip),!h.label&&S.label&&(h.label=S.label);return}l.push(S)};if(i({id:"age",label:"Age",group:"info",defaultVisible:n.has("age")}),i({id:"pos",label:"Pos",group:"info",defaultVisible:n.has("pos")}),i({id:"value",label:"Val",group:"info",defaultVisible:n.has("value")}),e.dynastyYearLabel&&i({id:"dyn_next",label:e.dynastyYearLabel,tooltip:"Dynasty value: projected value over the coming seasons, discounted to today and priced on this league's scale; sort by this when rebuilding / playing for the long run",group:"info",defaultVisible:!0}),e.isSnake&&e.hasDraftPositionData?i({id:"draft",label:"Draft",tooltip:"Overall draft pick",group:"info",defaultVisible:!0}):e.isSnake||i({id:"salary",label:"Sal",group:"info",defaultVisible:!0}),e.hasOttoneuOwnership&&(i({id:"ott_avg_salary",label:"O$",tooltip:"Ottoneu average salary (this league's scoring format)",group:"info",defaultVisible:!0}),i({id:"ott_own",label:"Ottoneu%",tooltip:"Ottoneu % rostered (this league's scoring format)",group:"info",defaultVisible:!0}),i({id:"ott_own_delta",label:"Ottoneu%Î",tooltip:"Ottoneu % rostered, 7-day change",group:"info",defaultVisible:!0}),i({id:"ott_last10",label:"O$ L10",tooltip:"Ottoneu average salary across the last 10 transactions",group:"info",defaultVisible:!1})),e.adpSourceNames.length===1?i({id:`adp:${e.adpSourceNames[0]}`,label:"ADP",tooltip:e.adpSourceNames[0],group:"info",defaultVisible:!0}):e.adpSourceNames.forEach((S,h)=>{i({id:`adp:${S}`,label:`ADP ${h+1}`,tooltip:S,group:"info",defaultVisible:S===e.adpDefaultName})}),e.hasYahooDraft&&i({id:"yahoo_draft",label:"Draft",group:"info",defaultVisible:!0}),e.rankingSourceNames.length===1){const S=e.rankingSourceNames[0];i({id:`ranking:${S}`,label:e.rankingShortNames[S]||S,tooltip:S,group:"info",defaultVisible:!0})}else e.rankingSourceNames.forEach(S=>{i({id:`ranking:${S}`,label:e.rankingShortNames[S]||S,tooltip:S,group:"info",defaultVisible:!0})});e.customDataColumns.forEach(S=>{i({id:S.id,label:S.label,tooltip:`${S.source}: ${S.label}`,group:"info",defaultVisible:!0})}),i({id:"owner",label:"Owner",group:"info",defaultVisible:n.has("owner")});const P=!e.hasOttoneuOwnership;if(e.hasYahooOwnership&&(i({id:"yahoo_own",label:"Y%",tooltip:"Yahoo % owned across all leagues",group:"info",defaultVisible:P}),i({id:"yahoo_own_delta",label:"Y%Î",tooltip:"Yahoo % owned, week-over-week change",group:"info",defaultVisible:P})),e.hasEspnOwnership&&(i({id:"espn_own",label:"E%",tooltip:"ESPN % owned across all leagues",group:"info",defaultVisible:P}),i({id:"espn_own_delta",label:"E%Î",tooltip:"ESPN % owned, 7-day change",group:"info",defaultVisible:P})),e.hasCbsOwnership){const S=e.platform==="NFBC"?"% of teams in this NFBC contest rostering the player":e.platform==="Fantrax"?"Fantrax rostered percentage from the latest league import":"CBS % rostered in this league";i({id:"cbs_own",label:e.platform==="Fantrax"?"Fantrax%":"Owned %",tooltip:S,group:"info",defaultVisible:!0}),e.hasStartPct&&i({id:"cbs_start",label:"Start %",tooltip:"% of teams in this NFBC contest starting the player",group:"info",defaultVisible:!0})}e.hasOttoneuOwnership&&(i({id:"ott_own",label:"Ottoneu%",tooltip:"Ottoneu % rostered (this league's scoring format)",group:"info",defaultVisible:!0}),i({id:"ott_own_delta",label:"Ottoneu%Î",tooltip:"Ottoneu % rostered, 7-day change",group:"info",defaultVisible:!0}),i({id:"ott_avg_salary",label:"O$",tooltip:"Ottoneu average salary (this league's scoring format)",group:"info",defaultVisible:!0}),i({id:"ott_last10",label:"O$ L10",tooltip:"Ottoneu average salary across the last 10 transactions",group:"info",defaultVisible:!1})),i({id:"h_pa",label:"PA",group:"hitting",defaultVisible:n.has("h_pa")}),i({id:"h_g",label:"G",group:"hitting",defaultVisible:n.has("h_g")}),e.isFGPts&&(i({id:"h_ppg",label:"P/G",group:"hitting",defaultVisible:n.has("h_ppg")}),i({id:"h_pts",label:"H PTS",group:"hitting",defaultVisible:n.has("h_pts")}
2)),a.hitting.forEach(S=>{const h=Vt("hitting",S);i({id:h,label:pi("hitting",S,e.scoringFormat),group:"hitting",defaultVisible:n.has(h)})}),i({id:"h_bbpct",label:"BB%",tooltip:"Walk rate (BB / PA)",group:"hitting",defaultVisible:n.has("h_bbpct")}),i({id:"h_kpct",label:"K%",tooltip:"Strikeout rate (SO / PA)",group:"hitting",defaultVisible:n.has("h_kpct")}),i({id:"h_babip",label:"BABIP",tooltip:"Batting average on balls in play",group:"hitting",defaultVisible:n.has("h_babip")}),i({id:"h_iso",label:"ISO",tooltip:"Isolated power (SLG â AVG)",group:"hitting",defaultVisible:n.has("h_iso")}),i({id:"h_ops",label:"OPS",tooltip:"On-base plus slugging (OBP + SLG)",group:"hitting",defaultVisible:n.has("h_ops")});const A=[{id:"h_pa",label:"PA"},{id:"h_ab",label:"AB"},{id:"h_h",label:"H"},{id:"h_2b",label:"2B"},{id:"h_3b",label:"3B"},{id:"h_r",label:"R"},{id:"h_hr",label:"HR"},{id:"h_rbi",label:"RBI"},{id:"h_sb",label:"SB"},{id:"h_cs",label:"CS"},{id:"h_bb",label:"BB"},{id:"h_hbp",label:"HBP"},{id:"h_so",label:"K"},{id:"h_avg",label:"AVG"},{id:"h_obp",label:"OBP"},{id:"h_slg",label:"SLG"},{id:"h_woba",label:"wOBA"},{id:"h_wrc",label:"wRC+"},{id:"h_war",label:"WAR"}];for(const S of A)i({...S,group:"hitting",defaultVisible:!1});i({id:"p_ip",label:"IP",group:"pitching",defaultVisible:n.has("p_ip")}),i({id:"p_g",label:"G",group:"pitching",defaultVisible:n.has("p_g")}),e.isFGPts&&(i({id:"p_pip",label:"P/IP",group:"pitching",defaultVisible:n.has("p_pip")}),i({id:"p_pts",label:"P PTS",group:"pitching",defaultVisible:n.has("p_pts")})),a.pitching.forEach(S=>{const h=Vt("pitching",S);i({id:h,label:pi("pitching",S,e.scoringFormat),group:"pitching",defaultVisible:n.has(h)})}),i({id:"p_k9",label:"K/9",tooltip:"Strikeouts per 9 innings",group:"pitching",defaultVisible:n.has("p_k9")}),i({id:"p_bb9",label:"BB/9",tooltip:"Walks per 9 innings",group:"pitching",defaultVisible:n.has("p_bb9")}),i({id:"p_hr9",label:"HR/9",tooltip:"Home runs per 9 innings",group:"pitching",defaultVisible:n.has("p_hr9")}),i({id:"p_fip",label:"FIP",tooltip:"Fielding Independent Pitching",group:"pitching",defaultVisible:n.has("p_fip")});const m=[{id:"p_g",label:"G"},{id:"p_gs",label:"GS"},{id:"p_ip",label:"IP"},{id:"p_w",label:"W"},{id:"p_l",label:"L"},{id:"p_sv",label:"SV"},{id:"p_hld",label:"HLD"},{id:"p_qs",label:"QS"},{id:"p_k",label:"K"},{id:"p_h",label:"H"},{id:"p_er",label:"ER"},{id:"p_hr",label:"HR"},{id:"p_bb",label:"BB"},{id:"p_hbp",label:"HBP"},{id:"p_era",label:"ERA"},{id:"p_whip",label:"WHIP"},{id:"p_k9",label:"K/9"},{id:"p_bb9",label:"BB/9"},{id:"p_hr9",label:"HR/9"},{id:"p_fip",label:"FIP"},{id:"p_war",label:"WAR"}];for(const S of m)i({...S,group:"pitching",defaultVisible:!1});const R=[{id:"sc_h_bbe",label:"BBE",tooltip:"Statcast: batted-ball events (sample size for contact-quality rates)"},{id:"sc_h_ev",label:"EV",tooltip:"Statcast: average exit velocity (mph)"},{id:"sc_h_maxev",label:"MaxEV",tooltip:"Statcast: hardest-hit ball of the season (mph)"},{id:"sc_h_la",label:"LA",tooltip:"Statcast: average launch angle (degrees)"},{id:"sc_h_sweet",label:"SwSp%",tooltip:"Statcast: sweet-spot %: batted balls in the 8°â32° launch-angle window"},{id:"sc_h_brl",label:"Barrel%",tooltip:"Statcast: barrels per batted-ball event"},{id:"sc_h_hh",label:"HardHit%",tooltip:"Statcast: % of batted balls 95+ mph"},{id:"sc_h_squp",label:"SqUp%",tooltip:"Statcast: squared-up %: share of swings with optimal contact quality"},{id:"sc_h_xba",label:"xBA",tooltip:"Statcast: expected batting average"},{id:"sc_h_xslg",label:"xSLG",tooltip:"Statcast: expected slugging"},{id:"sc_h_xwoba",label:"xwOBA",tooltip:"Statcast: expected wOBA"},{id:"sc_h_xiso",label:"xISO",tooltip:"Statcast: expected isolated power"},{id:"sc_h_xobp",label:"xOBP",tooltip:"Statcast: expected on-base percentage"},{id:"sc_h_whiff",label:"Whiff%",tooltip:"Statcast: swing-and-miss rate"},{id:"sc_h_swstr",label:"SwStr%",tooltip:"Statcast: swinging strikes per pitch (whiff rate à swing rate)"},{id:"sc_h_chase",label:"Chase%",tooltip:"Statcast: out-of-zone swing rate"},{id:"sc_h_zcon",label:"Z-Con%",tooltip:"Statcast: in-zone contact rate"},{id:"sc_h_ocon",label:"O-Con%",tooltip:"Statcast: out-of-zone contact rate"},{id:"sc_h_zone",label:"Zone%",tooltip:"Statcast: % of pitches seen in the strike zone"},{id:"sc_h_fstr",label:"F-Str%",tooltip:"Statcast: first-pitch strike rate"},{id:"sc_h_gb",label:"GB%",tooltip:"Statcast: ground-ball %"},{id:"sc_h_fb",label:"FB%",tooltip:"Statcast: fly-ball %"},{id:"sc_h_ld",label:"LD%",tooltip:"Statcast: line-drive %"},{id:"sc_h_pu",label:"PU%",tooltip:"Statcast: pop-up %"}
2,{id:"sc_h_hrfb",label:"HR/FB",tooltip:"Statcast: home runs per fly ball"},{id:"sc_h_pull",label:"Pull%",tooltip:"Statcast: pull rate (all batted balls)"},{id:"sc_h_sprint",label:"Sprint",tooltip:"Statcast: sprint speed (ft/sec)"},{id:"sc_h_batspd",label:"BatSpd",tooltip:"Statcast: average bat speed (mph)"}];for(const S of R)i({...S,group:"statcast_hit",defaultVisible:!1});const L=[{id:"sc_p_pitches",label:"Pitches",tooltip:"Statcast: total pitches thrown (sample size for per-pitch rates)"},{id:"sc_p_xera",label:"xERA",tooltip:"Statcast: expected ERA"},{id:"sc_p_xba",label:"xBA",tooltip:"Statcast: expected BA against"},{id:"sc_p_xslg",label:"xSLG",tooltip:"Statcast: expected SLG against"},{id:"sc_p_xwoba",label:"xwOBA",tooltip:"Statcast: expected wOBA against"},{id:"sc_p_whiff",label:"Whiff%",tooltip:"Statcast: swing-and-miss rate"},{id:"sc_p_swstr",label:"SwStr%",tooltip:"Statcast: swinging strikes per pitch induced (whiff rate à swing rate)"},{id:"sc_p_chase",label:"Chase%",tooltip:"Statcast: out-of-zone swing rate"},{id:"sc_p_kpct",label:"K%",tooltip:"Statcast: strikeout rate"},{id:"sc_p_bbpct",label:"BB%",tooltip:"Statcast: walk rate"},{id:"sc_p_kbb",label:"K-BB%",tooltip:"Statcast: strikeout rate minus walk rate"},{id:"sc_p_zcon",label:"Z-Con%",tooltip:"Statcast: in-zone contact allowed"},{id:"sc_p_ocon",label:"O-Con%",tooltip:"Statcast: out-of-zone contact allowed"},{id:"sc_p_zone",label:"Zone%",tooltip:"Statcast: % of pitches in the strike zone"},{id:"sc_p_fstr",label:"F-Str%",tooltip:"Statcast: first-pitch strike rate"},{id:"sc_p_fbvelo",label:"FB",tooltip:"Statcast: average fastball velocity"},{id:"sc_p_gb",label:"GB%",tooltip:"Statcast: ground-ball % allowed"},{id:"sc_p_fb",label:"FB%",tooltip:"Statcast: fly-ball % allowed"},{id:"sc_p_ld",label:"LD%",tooltip:"Statcast: line-drive % allowed"},{id:"sc_p_pu",label:"PU%",tooltip:"Statcast: pop-up % allowed"},{id:"sc_p_hrfb",label:"HR/FB",tooltip:"Statcast: home runs per fly ball allowed"},{id:"sc_p_brl",label:"Brl%a",tooltip:"Statcast: barrels per batted ball allowed"},{id:"sc_p_hh",label:"HH%a",tooltip:"Statcast: hard-hit % allowed"},{id:"sc_p_ev",label:"EVa",tooltip:"Statcast: exit velocity allowed"}];for(const S of L)i({...S,group:"statcast_pit",defaultVisible:!1});return l}function fi(e,l,a){const n=ar(e,l,a);return n==null||typeof n=="number"&&!Number.isFinite(n)?f:n}function ar(e,l,a){if(l.startsWith("sc_h_")){const n=a.statcastHittersMap.get(D(e.id));return n?{sc_h_pa:n.pa,sc_h_bbe:n.bbe,sc_h_ev:n.exit_velocity_avg,sc_h_maxev:n.max_exit_velocity,sc_h_la:n.launch_angle_avg,sc_h_sweet:n.sweet_spot_pct,sc_h_brl:n.barrel_pct,sc_h_hh:n.hard_hit_pct,sc_h_squp:n.squared_up_pct,sc_h_xba:n.xba,sc_h_xslg:n.xslg,sc_h_xwoba:n.xwoba,sc_h_xiso:n.xiso,sc_h_xobp:n.xobp,sc_h_whiff:n.whiff_pct,sc_h_swstr:n.swstr_pct,sc_h_chase:n.chase_pct,sc_h_zcon:n.z_contact_pct,sc_h_ocon:n.o_contact_pct,sc_h_zone:n.zone_pct,sc_h_fstr:n.f_strike_pct,sc_h_gb:n.gb_pct,sc_h_fb:n.fb_pct,sc_h_ld:n.ld_pct,sc_h_pu:n.pu_pct,sc_h_hrfb:n.hr_per_fb,sc_h_pull:n.pull_pct,sc_h_sprint:n.sprint_speed,sc_h_batspd:n.bat_speed}[l]??f:f}if(l.startsWith("sc_p_")){const n=a.statcastPitchersMap.get(D(e.id));return n?{sc_p_pa:n.pa,sc_p_pitches:n.total_pitches,sc_p_xera:n.xera,sc_p_xba:n.xba_against,sc_p_xslg:n.xslg_against,sc_p_xwoba:n.xwoba_against,sc_p_whiff:n.whiff_pct,sc_p_swstr:n.swstr_pct,sc_p_chase:n.chase_pct,sc_p_fbvelo:n.fb_velo,sc_p_kpct:n.k_pct,sc_p_bbpct:n.bb_pct,sc_p_kbb:n.k_minus_bb_pct??(n.k_pct!=null&&n.bb_pct!=null?n.k_pct-n.bb_pct:null),sc_p_zcon:n.z_contact_pct,sc_p_ocon:n.o_contact_pct,sc_p_zone:n.zone_pct,sc_p_fstr:n.f_strike_pct,sc_p_gb:n.gb_pct_allowed,sc_p_fb:n.fb_pct_allowed,sc_p_ld:n.ld_pct_allowed,sc_p_pu:n.pu_pct_allowed,sc_p_hrfb:n.hr_per_fb_allowed,sc_p_brl:n.barrel_pct_allowed,sc_p_hh:n.hard_hit_pct_allowed,sc_p_ev:n.exit_velocity_against}[l]??f:f}if(l.startsWith("adp:"))return a.adpMaps.get(l.substring(4))?.get(e.id)??f;if(l.startsWith("ranking:"))return a.rankingMaps.get(l.substring(8))?.get(e.id)??f;if(l.startsWith("cdata:")){const n=a.customDataMaps.get(l)?.get(e.id);return n===void 0?f:n}if(l.startsWith("auction:"))return a.auctionMaps.get(l.substring(8))?.get(e.id)??f;switch(l){case"value":return a.filterContext==="pitching"?e.pitchingValue??f:a.filterContext==="hitting"?e.hittingValue??f:e.rawDollarValue??e.dollarValue??f;case"dyn_next":return Ci(e,a)??f;case"name":return e.name;case"pos":return e.primaryPosition;case"age":return Ti(e.birthDate)??f;
2case"owner":return e.owner==="Free Agent"?f:e.owner;case"salary":return e.salary??f;case"draft":return e.draftOverall??f;case"yahoo_draft":{const n=a.yahooDraftMap.get(e.id);return n?n.round*1e3+n.pick:f}case"yahoo_own":{const n=a.yahooOwnershipMap.get(D(e.id));return n?n.percentOwned:f}case"yahoo_own_delta":{const n=a.yahooOwnershipMap.get(D(e.id));return n?n.delta:f}case"ott_own":{const n=a.ottoneuOwnershipMap.get(D(e.id));return n?n.rosterPct:f}case"ott_own_delta":{const n=a.ottoneuOwnershipMap.get(D(e.id));return n&&n.delta7d!==null?n.delta7d:f}case"ott_avg_salary":return a.ottoneuOwnershipMap.get(D(e.id))?.avgSalary??f;case"ott_last10":return a.ottoneuOwnershipMap.get(D(e.id))?.last10??f;case"espn_own":{const n=a.espnOwnershipMap.get(D(e.id));return n?n.percentOwned:f}case"espn_own_delta":{const n=a.espnOwnershipMap.get(D(e.id));return n&&n.delta7d!==null?n.delta7d:f}case"cbs_own":{const n=a.cbsOwnershipMap.get(D(e.id));return n?n.percentOwned:f}case"cbs_start":{const n=a.cbsOwnershipMap.get(D(e.id));return n&&n.percentStarted!=null?n.percentStarted:f}case"h_g":return e.batting?.G??f;case"h_bbpct":return Ai(e.batting)??f;case"h_kpct":return Oi(e.batting)??f;case"h_babip":return Ii(e.batting)??f;case"h_iso":return Bi(e.batting)??f;case"h_ops":return Ni(e.batting)??f;case"h_r":return e.batting?.R??f;case"h_hr":return e.batting?.HR??f;case"h_rbi":return e.batting?.RBI??f;case"h_sb":return e.batting?.SB??f;case"h_avg":return e.batting?.AVG??f;case"h_pa":return e.batting?.PA??f;case"h_ab":return e.batting?.AB??f;case"h_h":return e.batting?.H??f;case"h_2b":return e.batting?.["2B"]??f;case"h_3b":return e.batting?.["3B"]??f;case"h_bb":return e.batting?.BB??f;case"h_hbp":return e.batting?.HBP??f;case"h_so":return e.batting?.SO??f;case"h_cs":return e.batting?.CS??f;case"h_obp":return e.batting?.OBP??f;case"h_slg":return e.batting?.SLG??f;case"h_woba":return e.batting?.wOBA??f;case"h_wrc":return e.batting?.["wRC+"]??f;case"h_war":return e.batting?.WAR??f;case"h_ppg":{if(!Ze(a.scoringFormat)||!e.batting?.G)return f;const n=pn(e.batting,a.scoringFormat,a.leaguePointValues?.batting);return e.batting.G>0?n/e.batting.G:f}case"h_pts":return!Ze(a.scoringFormat)||!e.batting?.AB?f:pn(e.batting,a.scoringFormat,a.leaguePointValues?.batting);case"p_ip":return e.pitching?.IP??f;case"p_w":return e.pitching?.W??f;case"p_l":return e.pitching?.L??f;case"p_sv":return e.pitching?.SV??f;case"p_k":return e.pitching?.SO??f;case"p_era":return e.pitching?.ERA??f;case"p_whip":return e.pitching?.WHIP??f;case"p_hld":return e.pitching?.HLD??f;case"p_h":return e.pitching?.H??f;case"p_er":return e.pitching?.ER??f;case"p_hr":return e.pitching?.HR??f;case"p_bb":return e.pitching?.BB??f;case"p_hbp":return e.pitching?.HBP??f;case"p_g":return e.pitching?.G??f;case"p_gs":return e.pitching?.GS??f;case"p_qs":return e.pitching?.QS??f;case"p_k9":return e.pitching?.["K/9"]??f;case"p_bb9":return e.pitching?.["BB/9"]??f;case"p_hr9":return e.pitching?.["HR/9"]??f;case"p_fip":return e.pitching?.FIP??f;case"p_war":return e.pitching?.WAR??f;case"p_pip":{if(!Ze(a.scoringFormat)||!e.pitching?.IP)return f;const n=fn(e.pitching,a.scoringFormat,a.leaguePointValues);return e.pitching.IP>0?n/e.pitching.IP:f}case"p_pts":return!Ze(a.scoringFormat)||!e.pitching?.IP?f:fn(e.pitching,a.scoringFormat,a.leaguePointValues);default:{if(l.startsWith("h_stat:")){const n=hn(e.batting,l.substring(7),"hitting");return n==null||Number.isNaN(n)?f:n}if(l.startsWith("p_stat:")){const n=hn(e.pitching,l.substring(7),"pitching");return n==null||Number.isNaN(n)?f:n}return 0}}}function fn(e,l,a){return qs({IP:e.IP,K:e.SO,H:e.H,BB:e.BB,HBP:e.HBP,HR:e.HR,SV:e.SV,HLD:e.HLD,W:e.W,L:e.L,ER:e.ER,QS:e.QS},l,a?.pitching)}function d(e,l,a){return t.jsx("td",{className:"rh-plain-cell",style:{textAlign:"center",fontSize:11,...a?{borderLeft:"2px solid light-dark(#C5CDD5, #4A5261)"}:{}},children:l},e)}const E=e=>e?Math.round(e):"-",ce=(e,l)=>e!=null?e.toFixed(l):"-";function rr(e,l,a){const n=l.id;if(n==="value"){let i;a.filterContext==="pitching"?i=e.pitchingValue:a.filterContext==="hitting"?i=e.hittingValue:i=e.dollarValue;const P=i!==null?`$${Math.round(i)}`:"-",A=i!==null&&i<0?"red":void 0,m=a.filterContext==="all"||a.filterContext==="both"?e.rawDollarValue:null,R=typeof m=="number"&&Number.isFinite(m)&&m<-.05;return t.jsx("td",{className:"rh-plain-cell",style:{textAlign:"right",fontWeight:600,color:A,fontSize:11},children:R?t.jsx(ue,{label:`$${Math.abs(m).toFixed(1)} below replacement level. Players shown at $0 sort by this margin.`,openDelay:400,withArrow:!0,multiline:!0,maw:240,children:t.jsx("span",{style:{cursor:"help"},children:P})}):P},n)}if(n==="dyn_next"){const i=Ci(e,a),P=i!==null?`$${Math.round(i)}`:"-";return t.jsx("td",{className:"rh-plain-cell",style:{textAlign:"right",fontWeight:600,fontSize:11,color:"var(--mantine-color-blue-filled)"},children:P},n)}if(n==="draft")return d(n,e.draftOverall!==null?e.draftOverall:"");if(n==="salary")return d(n,e.salary!==null?`$${Math.round(e.salary)}`:"-");if(n==="pos"){const i=Es(e.id,e.primaryPosition).join("/");return t.jsx("td",{className:"rh-plain-cell",style:{fontSize:10,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:48,maxWidth:80},children:t.jsx(ue,{label:i,openDelay:400,disabled:i.length<10,withArrow:!0,children:t.jsx(g,{size:"xs",truncate:!0,children:i})})},n)}if(n==="age")return d(n,Ti(e.birthDate)??"-");if(n==="owner")return t.jsx("td",{className:"rh-plain-cell",style:{fontSize:11,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.ownerIndex!==null?t.jsx(ue,{label:e.owner,openDelay:400,disabled:(e.owner?.length||0)<18,children:t.jsx(Ue,{to:`/roster-manager?team=${e.ownerIndex}${a.leagueId?`&league=${a.leagueId}`:""}`,style:{textDecoration:"none",display:"block"},onClick:i=>i.stopPropagation(),children:t.jsx(g,{size:"xs",c:"blue",fw:500,truncate:!0,children:e.owner})})}):t.jsx(g,{size:"xs",c:"dimmed",fw:600,children:"Free Agent"})},n);if(n==="yahoo_draft"){const i=a.yahooDraftMap.get(e.id);let P="-";return i&&(i.cost?P=`$${i.cost}`:P=`${i.display||`${i.round}.${i.pickInRound}`} (${i.pick})`),d(n,P)}if(n==="yahoo_own"){const i=a.yahooOwnershipMap.get(D(e.id));return d(n,i?`${i.percentOwned}%`:"-")}
2if(n==="yahoo_own_delta")return on(n,a.yahooOwnershipMap.get(D(e.id))?.delta,!0);if(n==="ott_own"){const i=a.ottoneuOwnershipMap.get(D(e.id));return d(n,i?`${Math.round(i.rosterPct)}%`:"-")}if(n==="ott_own_delta"){const i=a.ottoneuOwnershipMap.get(D(e.id));return on(n,i&&i.delta7d!==null?i.delta7d:void 0,!1)}if(n==="ott_avg_salary"){const i=a.ottoneuOwnershipMap.get(D(e.id));return d(n,i?.avgSalary!=null?`$${Math.round(i.avgSalary)}`:"-")}if(n==="ott_last10"){const i=a.ottoneuOwnershipMap.get(D(e.id));return d(n,i?.last10!=null?`$${Math.round(i.last10)}`:"-")}if(n==="espn_own"){const i=a.espnOwnershipMap.get(D(e.id));return d(n,i?`${i.percentOwned.toFixed(0)}%`:"-")}if(n==="espn_own_delta"){const i=a.espnOwnershipMap.get(D(e.id));return on(n,i&&i.delta7d!==null?i.delta7d:void 0,!1)}if(n==="cbs_own"){const i=a.cbsOwnershipMap.get(D(e.id));return d(n,i?`${Math.round(i.percentOwned)}%`:"â")}if(n==="cbs_start"){const i=a.cbsOwnershipMap.get(D(e.id));return d(n,i&&i.percentStarted!=null?`${Math.round(i.percentStarted)}%`:"â")}if(n.startsWith("adp:")){const i=a.adpMaps.get(n.substring(4))?.get(e.id);return d(n,i!==void 0?i.toFixed(1):"-")}if(n.startsWith("ranking:")){const i=a.rankingMaps.get(n.substring(8))?.get(e.id);return d(n,i!==void 0?i:"-")}if(n.startsWith("cdata:")){const i=a.customDataMaps.get(n)?.get(e.id);return d(n,i!==void 0&&i!==""?String(i):"-")}if(n.startsWith("auction:")){const i=a.auctionMaps.get(n.substring(8))?.get(e.id);return d(n,i!==void 0?`$${Math.round(i)}`:"-")}return d(n,"-")}function on(e,l,a){if(l==null)return d(e,"-");const n=Math.round(l);if(n===0)return d(e,"0%");const i=n>0?"+":"",P=n>0?"green":"red";return t.jsxs("td",{className:"rh-plain-cell",style:{textAlign:"center",fontSize:11,color:`var(--mantine-color-${P}-6)`,fontWeight:600},children:[i,n,"%"]},e)}function lr(e,l,a,n){const i=l.id,P=a.isFGPts;let A=null,m=null;switch(P&&e.batting?.AB&&(A=pn(e.batting,a.scoringFormat,a.leaguePointValues?.batting)),P&&e.pitching?.IP&&(m=fn(e.pitching,a.scoringFormat,a.leaguePointValues)),i){case"h_g":return d(i,E(e.batting?.G),n);case"h_pa":return d(i,E(e.batting?.PA),n);case"h_ab":return d(i,E(e.batting?.AB),n);case"h_h":return d(i,E(e.batting?.H),n);case"h_2b":return d(i,E(e.batting?.["2B"]),n);case"h_3b":return d(i,E(e.batting?.["3B"]),n);case"h_hr":return d(i,E(e.batting?.HR),n);case"h_r":return d(i,E(e.batting?.R),n);case"h_rbi":return d(i,E(e.batting?.RBI),n);case"h_sb":return d(i,E(e.batting?.SB),n);case"h_cs":return d(i,E(e.batting?.CS),n);case"h_bb":return d(i,E(e.batting?.BB),n);case"h_hbp":return d(i,E(e.batting?.HBP),n);case"h_so":return d(i,E(e.batting?.SO),n);case"h_avg":return d(i,ce(e.batting?.AVG,3).replace(/^0\./,"."),n);case"h_obp":return d(i,ce(e.batting?.OBP,3),n);case"h_slg":return d(i,ce(e.batting?.SLG,3),n);case"h_woba":return d(i,ce(e.batting?.wOBA,3),n);case"h_wrc":return d(i,E(e.batting?.["wRC+"]),n);case"h_war":return d(i,ce(e.batting?.WAR,1),n);case"h_bbpct":{const R=Ai(e.batting);return d(i,R!==null?`${R.toFixed(1)}%`:"-",n)}case"h_kpct":{const R=Oi(e.batting);return d(i,R!==null?`${R.toFixed(1)}%`:"-",n)}case"h_babip":{const R=Ii(e.batting);return d(i,R!==null?R.toFixed(3).replace(/^0\./,"."):"-",n)}case"h_iso":{const R=Bi(e.batting);return d(i,R!==null?R.toFixed(3).replace(/^0\./,"."):"-",n)}case"h_ops":{const R=Ni(e.batting);return d(i,R!==null?R.toFixed(3).replace(/^0\./,"."):"-",n)}case"h_ppg":return d(i,A!==null&&e.batting?.G>0?(A/e.batting.G).toFixed(2):"-",n);case"h_pts":return d(i,A!==null?A.toFixed(1):"-",n);case"p_ip":return d(i,ce(e.pitching?.IP,1),n);case"p_g":return d(i,E(e.pitching?.G),n);case"p_gs":return d(i,E(e.pitching?.GS),n);case"p_w":return d(i,E(e.pitching?.W),n);case"p_l":return d(i,E(e.pitching?.L),n);case"p_sv":return d(i,E(e.pitching?.SV),n);case"p_hld":return d(i,E(e.pitching?.HLD),n);case"p_qs":return d(i,E(e.pitching?.QS),n);case"p_k":return d(i,E(e.pitching?.SO),n);case"p_h":return d(i,E(e.pitching?.H),n);case"p_er":return d(i,E(e.pitching?.ER),n);case"p_hr":return d(i,E(e.pitching?.HR),n);case"p_bb":return d(i,E(e.pitching?.BB),n);case"p_hbp":return d(i,E(e.pitching?.HBP),n);case"p_era":return d(i,ce(e.pitching?.ERA,2),n);case"p_whip":return d(i,ce(e.pitching?.WHIP,2),n);case"p_k9":return d(i,ce(e.pitching?.["K/9"],2),n);case"p_bb9":return d(i,ce(e.pitching?.["BB/9"],2),n);case"p_hr9":return d(i,ce(e.pitching?.["HR/9"],2),n);case"p_fip":return d(i,ce(e.pitching?.FIP,2),n);case"p_war":return d(i,ce(e.pitching?.WAR,1),n);case"p_pip":return d(i,m!==null&&e.pitching?.IP>0?(m/e.pitching.IP).toFixed(2):"-",n);case"p_pts":return d(i,m!==null?m.toFixed(1):"-",n);default:return i.startsWith("h_stat:")?d(i,gi(e.batting,i.substring(7),"hitting",a.scoringFormat),n):i.startsWith("p_stat:")?d(i,gi(e.pitching,i.substring(7),"pitching",a.scoringFormat),n):d(i,"-",n)}}function or(e,l,a,n){const i=l.id,P=D(e.id),A=h=>h==null?"-":h.toFixed(1),m=h=>h==null?"-":`${h.toFixed(1)}%`,R=h=>h==null?"-":`${h.toFixed(1)}°`,L=h=>h==null?"-":h.toFixed(3).replace(/^0\./,"."),S=h=>
2h==null?"-":h.toLocaleString();if(i.startsWith("sc_h_")){const h=a.statcastHittersMap.get(P);switch(i){case"sc_h_bbe":return d(i,S(h?.bbe),n);case"sc_h_ev":return d(i,A(h?.exit_velocity_avg),n);case"sc_h_maxev":return d(i,A(h?.max_exit_velocity),n);case"sc_h_la":return d(i,R(h?.launch_angle_avg),n);case"sc_h_sweet":return d(i,m(h?.sweet_spot_pct),n);case"sc_h_brl":return d(i,m(h?.barrel_pct),n);case"sc_h_hh":return d(i,m(h?.hard_hit_pct),n);case"sc_h_squp":return d(i,m(h?.squared_up_pct!=null?h.squared_up_pct*100:null),n);case"sc_h_xba":return d(i,L(h?.xba),n);case"sc_h_xslg":return d(i,L(h?.xslg),n);case"sc_h_xwoba":return d(i,L(h?.xwoba),n);case"sc_h_xiso":return d(i,L(h?.xiso),n);case"sc_h_xobp":return d(i,L(h?.xobp),n);case"sc_h_whiff":return d(i,m(h?.whiff_pct),n);case"sc_h_chase":return d(i,m(h?.chase_pct),n);case"sc_h_zcon":return d(i,m(h?.z_contact_pct),n);case"sc_h_ocon":return d(i,m(h?.o_contact_pct),n);case"sc_h_zone":return d(i,m(h?.zone_pct),n);case"sc_h_fstr":return d(i,m(h?.f_strike_pct),n);case"sc_h_gb":return d(i,m(h?.gb_pct),n);case"sc_h_fb":return d(i,m(h?.fb_pct),n);case"sc_h_ld":return d(i,m(h?.ld_pct),n);case"sc_h_pu":return d(i,m(h?.pu_pct),n);case"sc_h_hrfb":return d(i,m(h?.hr_per_fb),n);case"sc_h_pull":return d(i,m(h?.pull_pct),n);case"sc_h_sprint":return d(i,A(h?.sprint_speed),n);case"sc_h_batspd":return d(i,A(h?.bat_speed),n)}}if(i.startsWith("sc_p_")){const h=a.statcastPitchersMap.get(P);switch(i){case"sc_p_pitches":return d(i,S(h?.total_pitches),n);case"sc_p_kpct":return d(i,m(h?.k_pct),n);case"sc_p_bbpct":return d(i,m(h?.bb_pct),n);case"sc_p_kbb":return d(i,m(h?.k_minus_bb_pct??(h?.k_pct!=null&&h?.bb_pct!=null?h.k_pct-h.bb_pct:null)),n);case"sc_p_xera":return d(i,h?.xera!=null?h.xera.toFixed(2):"-",n);case"sc_p_xba":return d(i,L(h?.xba_against),n);case"sc_p_xslg":return d(i,L(h?.xslg_against),n);case"sc_p_xwoba":return d(i,L(h?.xwoba_against),n);case"sc_p_whiff":return d(i,m(h?.whiff_pct),n);case"sc_p_chase":return d(i,m(h?.chase_pct),n);case"sc_p_zcon":return d(i,m(h?.z_contact_pct),n);case"sc_p_ocon":return d(i,m(h?.o_contact_pct),n);case"sc_p_zone":return d(i,m(h?.zone_pct),n);case"sc_p_fstr":return d(i,m(h?.f_strike_pct),n);case"sc_p_fbvelo":return d(i,A(h?.fb_velo),n);case"sc_p_gb":return d(i,m(h?.gb_pct_allowed),n);case"sc_p_fb":return d(i,m(h?.fb_pct_allowed),n);case"sc_p_ld":return d(i,m(h?.ld_pct_allowed),n);case"sc_p_pu":return d(i,m(h?.pu_pct_allowed),n);case"sc_p_hrfb":return d(i,m(h?.hr_per_fb_allowed),n);case"sc_p_brl":return d(i,m(h?.barrel_pct_allowed),n);case"sc_p_hh":return d(i,m(h?.hard_hit_pct_allowed),n);case"sc_p_ev":return d(i,A(h?.exit_velocity_against),n)}}return d(i,"-",n)}function cr(e,l,a,n){return l.group==="info"?rr(e,l,a):l.group==="statcast_hit"||l.group==="statcast_pit"?or(e,l,a,n):lr(e,l,a,n)}function ur({player:e,isSelected:l,isMine:a,rank:n,impact:i,impactColVisible:P,isPoints:A,playerStatuses:m,toColumnPlayer:R,columnCtx:L,orderedVisibleCols:S,separatorIds:h,onSelect:U,onStage:Be}){const te=D(e.id),ne=pt(e.id,e.primaryPosition),fe=m[String(te)]||Mi(te,e.level),_e=ra(gn(e.currentTeam),e.level,fe),W=R(e),et=l?"light-dark(rgba(255, 235, 120, 0.2), rgba(255, 235, 120, 0.08))":a?oa:void 0,N=l?"light-dark(rgba(255, 235, 120, 0.95), rgba(40, 35, 12, 0.98))":a?ca:"var(--mantine-color-body)";let Pe=null;if(P)if(!i)Pe=t.jsx("td",{className:"rh-plain-cell",style:{textAlign:"right",whiteSpace:"nowrap",width:1},title:a?void 0:"No evaluated move for this player (outside the candidate pool).",children:t.jsx(g,{size:"xs",c:"dimmed",children:"â"})});else{const I=i,ze=(Math.round(I.totalGain*10)/10).toFixed(1),$=I.rankAfter!==I.rankBefore;Pe=t.jsxs("td",{className:"rh-plain-cell",style:{textAlign:"right",whiteSpace:"nowrap",width:1,cursor:"pointer"},title:`Best move: add ${I.player.name}${I.drop?`, drop ${I.drop.name}`:" (open roster spot, no drop)"}${I.placedSlot?` (fills ${I.placedSlot})`:""}. Gains ${ze} ${A?"PTS":"standings points"}${$?`, rank ${I.rankBefore} to ${I.rankAfter}`:""}. Click to stage this move.`,onClick:me=>{me.stopPropagation(),Be(I)},children:[t.jsxs(g,{size:"xs",fw:700,c:"green",children:["+",ze]}),$&&t.jsxs(g,{size:"10px",c:I.rankAfter<I.rankBefore?"green":"red",children:[I.rankBefore,"â",I.rankAfter]})]})}return t.jsxs("tr",{className:"rh-plain-row",onClick:()=>{a||U(e.id)},style:{cursor:a?"default":"pointer",backgroundColor:et},children:[t.jsx("td",{className:"rh-plain-cell",style:{position:"sticky",left:0,zIndex:1,background:N,whiteSpace:"nowrap"},children:t.jsx(Z,{gap:4,wrap:"nowrap",children:t.jsxs(Ie,{style:{minWidth:0},children:[t.jsx(Z,{gap:4,wrap:"nowrap",children:t.jsx(ji,{playerId:e.id,name:e.name})}),t.jsxs(Z,{gap:4,children:[t.jsx(g,{size:"10px",c:"dimmed",children:_e}
2),t.jsx(g,{size:"10px",fw:600,c:"blue",children:ne.join("/")}),t.jsx(Pi,{level:e.level,status:fe})]})]})})}),t.jsx("td",{className:"rh-plain-cell",style:{textAlign:"right",whiteSpace:"nowrap",width:1},children:t.jsx(g,{size:"xs",c:"dimmed",children:n||"â"})}),Pe,S.map(I=>cr(W,I,L,h.has(I.id)))]})}const dr=u.memo(ur);function mi(e){const l=Math.round(e*10)/10;return l%1===0?l.toFixed(0):l.toFixed(1)}const hr={lineup:null,bench:"BN",il:"IL",minors:"MiLB"};function cn(e,l){return e.categoryGains.find(a=>a.category===l)?.gain??0}const pr=3;function gr(e){return e.drop?String(e.drop.playerId):""}function fr(e){return e.drop?.name?`dropping ${e.drop.name}`:"with no drop"}function bi(e){return e.repairs.find(l=>l.kind==="benched")?.name??null}const Ri=()=>t.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[t.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),t.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]});function _i({name:e,onClick:l}){return t.jsx(ue,{label:`Hide ${e} from suggestions (use if their projection looks off-market)`,withArrow:!0,multiline:!0,maw:260,children:t.jsx(Si,{size:"xs",variant:"light",color:"gray","aria-label":`Hide ${e} from suggestions`,style:{flexShrink:0,marginLeft:2},onClick:a=>{a.stopPropagation(),l()},children:t.jsx(Ri,{})})})}function mr({result:e,hittingCategories:l,pitchingCategories:a,collapsed:n=!1,onToggleCollapsed:i,onStage:P,stagedPlayerId:A,excludedPlayers:m,onExclude:R,onUnexclude:L}
2){const{suggestions:S,isPointsLeague:h,myCategoryPoints:U,numTeams:Be}=e,te=h?"PTS":"pts",ne=u.useMemo(()=>[...new Set([...l,...a])],[l,a]),fe=u.useMemo(()=>_a(ne,U,Be),[ne,U,Be]),_e=u.useMemo(()=>Object.values(fe).some(_=>_.flagged),[fe]),W=wi("(max-width: 48em)")??!1,[et,N]=u.useState(!1),Pe=!W||et,[I,ze]=u.useState("all"),[$,me]=u.useState("all"),[ye,Ge]=u.useTransition(),We=$==="hit"?l:$==="pitch"?a:ne,[de,xe]=u.useState("gain"),[ve,Ne]=u.useState(!1),tt=_=>{if(_===de){Ne(w=>!w);return}xe(_),Ne(!1)},gt=_=>{ze(_),Ge(()=>{de!=="gain"&&!(_==="hit"?l:_==="pitch"?a:ne).includes(de)&&(xe("gain"),Ne(!1)),me(_)})},he=u.useMemo(()=>S.filter(_=>$==="all"?!0:$==="pitch"?_.isPitcher:!_.isPitcher),[S,$]),V=u.useMemo(()=>{const _=[{id:"add",label:"Add",type:"category",accessor:w=>w.player.name},{id:"gain",label:`+${te}`,type:"number",accessor:w=>Math.round(w.totalGain*10)/10},{id:"rank",label:"Rank after",type:"number",accessor:w=>w.rankAfter}];if(!h)for(const w of ne)_.push({id:w,label:w,type:"number",accessor:X=>Math.round(cn(X,w)*10)/10});return _.push({id:"slot",label:"Slot",type:"category",accessor:w=>w.placedSlot??"Bench"}),_.push({id:"drop",label:"Drop",type:"category",accessor:w=>w.drop?.name??"None (open spot)"}),_.push({id:"bench",label:"Bench",type:"category",accessor:w=>bi(w)??"â"}),_},[h,ne,te]),nt=u.useMemo(()=>new Map(V.map(_=>[_.id,_])),[V]),Re=Ta(he,V),Fe=u.useMemo(()=>{const _=w=>de==="gain"?w.totalGain:cn(w,de);return[...Re.rows].sort((w,X)=>{const le=_(X)-_(w);return(ve?-le:le)||X.totalGain-w.totalGain||X.faDollarValue-w.faDollarValue})},[Re.rows,de,ve]),ie=_=>de===_?ve?" â´":" â¾":"",ft=Rs(Fe,e,{keyOf:gr,labelOf:fr,preview:pr,placement:"positional"}),ke=ft.items,it=u.useMemo(()=>ke.filter(_=>_.kind==="row").length,[ke]),pe=(_,w)=>{const X=nt.get(_);if(!X)return null;const le=Re.getColumnApi(_);return t.jsx(Oa,{colDef:X,value:le.value,isFiltered:le.isFiltered,setValue:le.setValue,minMax:X.type==="number"?Re.getMinMax(_):void 0,options:X.type==="category"?Re.categoryOptions[_]:void 0,revealOnHover:!0,sort:w?{active:de===w?ve?"asc":"desc":null,onSort:Me=>{xe(w),Ne(Me==="asc")},onClear:()=>{xe("gain"),Ne(!1)}}:void 0})},Lt=_=>{const w=fe[_],X=w?xa(w.tier):void 0;return t.jsxs(p.Th,{className:"rh-th-filterable",onClick:()=>tt(_),style:{cursor:"pointer",textAlign:"right",whiteSpace:"nowrap",userSelect:"none"},children:[t.jsx(ue,{label:wa(w,_,Be),withArrow:!0,multiline:!0,maw:260,children:t.jsxs(g,{span:!0,inherit:!0,fw:w?.flagged?700:void 0,c:X,children:[_,ie(_)]})}),pe(_,_)]},_)};return t.jsxs(ht,{p:"sm",children:[t.jsxs(Z,{gap:"xs",align:"baseline",wrap:"wrap",children:[t.jsx(g,{fw:700,children:"Pickup ideas"}),t.jsxs(g,{size:"xs",c:"dimmed",children:["Every add/drop ranked by projected ",h?"fantasy points":"standings points"," gained."]}),i&&t.jsx(ct,{onClick:i,style:{marginLeft:"auto"},children:t.jsx(g,{size:"xs",c:"blue.4",children:n?"(show)":"(hide)"})})]}),!n&&!Pe&&t.jsxs(g,{size:"xs",c:"dimmed",mt:4,children:["Click a row to preview the move below."," ",t.jsx(ct,{onClick:()=>N(!0),style:{display:"inline"},"aria-label":"Show the full explanation",children:t.jsx(g,{span:!0,size:"xs",c:"blue.4",children:"(more)"})})]}),!n&&Pe&&t.jsxs(g,{size:"xs",c:"dimmed",mt:4,children:["Click a column to sort, or its filter icon to narrow it (e.g. only pickups that add ",t.jsx(g,{span:!0,inherit:!0,fw:600,children:"SB"}),", or only ones dropping a certain player). Click a row (or its ",t.jsx(g,{span:!0,inherit:!0,fw:600,children:"Stage"})," button) to preview the move below. A player's name opens their profile; the ",t.jsx(g,{span:!0,inherit:!0,style:{verticalAlign:"middle"},children:t.jsx(Ri,{})})," hides all moves involving a player you don't want to add/drop.",W&&t.jsxs(t.Fragment,{children:[" ",t.jsx(ct,{onClick:()=>N(!1),style:{display:"inline"},"aria-label":"Collapse the explanation",children:t.jsx(g,{span:!0,size:"xs",c:"blue.4",children:"(less)"})})]})]}),!n&&!h&&_e&&Pe&&t.jsxs(g,{size:"xs",c:"dimmed",mt:4,children:[t.jsx(g,{span:!0,inherit:!0,c:"orange.5",fw:700,children:"Orange"})," categories are where you have the most room to gain; click one to sort pickups by how much they help there."]}),!n&&m.length>0&&t.jsxs(Z,{gap:6,mt:"xs",wrap:"wrap",children:[t.jsx(g,{size:"xs",c:"dimmed",children:"Hidden:"}),m.map(_=>t.jsx(Xe,{size:"sm",variant:"light",color:"gray",styles:{root:{textTransform:"none"}},rightSection:t.jsx(ct,{onClick:()=>L(_.id),"aria-label":`Show ${_.name} again`,children:t.jsx(g,{size:"xs",c:"dimmed",children:"â"})}),children:_.name},_.id)),m.length>1&&t.jsx(ee,{size:"compact-xs",variant:"subtle",color:"gray",onClick:()=>m.forEach(_=>L(_.id)),children:"Show all"})]}),!n&&S.length===0&&t.jsxs(g,{size:"sm",c:"dimmed",mt:"xs",children:["No pickup projects to gain ",h?"fantasy points":"standings points"," right now",m.length>0?" (with the current hidden players)":"; your lineup already beats everything on the wire","."]}),!n&&S.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs(Z,{gap:"xs",mt:"xs",align:"center",children:[t.jsx(js,{size:"xs",value:I,onChange:_=>gt(_),data:[{label:"All",value:"all"},{label:"Hit",value:"hit"},{label:"Pitch",value:"pitch"}]}),!h&&t.jsx(g,{size:"xs",c:"dimmed",children:I==="hit"?"Hitter pickups and hitting categories only":I==="pitch"?"Pitcher pickups and pitching categories only":"Showing both sides"})]}),t.jsx(Ie,{style:{overflowX:"auto"},mt:6,children:t.jsx(Aa,{filter:Re,compact:W})}),Fe.length===0?t.jsx(g,{size:"sm",c:"dimmed",mt:"xs",children:Re.rows.length<he.length?"No pickups match your filters;
2 clear or widen them above.":`No ${$==="pitch"?"pitcher":"hitter"} pickups right now; switch the filter above.`}):t.jsxs(t.Fragment,{children:[t.jsx(Ve.Autosize,{mah:520,type:"auto",mt:"xs",offsetScrollbars:"x",style:{opacity:ye?.55:1,transition:"opacity 100ms ease"},children:t.jsxs(p,{highlightOnHover:!0,verticalSpacing:3,fz:"xs",style:{minWidth:700+(h?0:We.length*46)},children:[t.jsx(p.Thead,{style:{position:"sticky",top:0,zIndex:2,background:"var(--mantine-color-body)"},children:t.jsxs(p.Tr,{children:[t.jsxs(p.Th,{className:"rh-th-filterable",style:{whiteSpace:"nowrap"},children:["Add",pe("add")]}),t.jsxs(p.Th,{className:"rh-th-filterable",onClick:()=>tt("gain"),style:{cursor:"pointer",textAlign:"right",whiteSpace:"nowrap",userSelect:"none"},children:["+",te,ie("gain"),pe("gain","gain")]}),t.jsxs(p.Th,{className:"rh-th-filterable",style:{textAlign:"right",whiteSpace:"nowrap"},children:[t.jsx(ue,{label:"Your overall standings rank before â after this move",withArrow:!0,children:t.jsx(g,{span:!0,inherit:!0,children:"Rank"})}),pe("rank")]}),!h&&We.map(_=>Lt(_)),t.jsxs(p.Th,{className:"rh-th-filterable",style:{whiteSpace:"nowrap"},children:["Slot",pe("slot")]}),t.jsxs(p.Th,{className:"rh-th-filterable",style:{whiteSpace:"nowrap"},children:["Drop",pe("drop")]}),t.jsxs(p.Th,{className:"rh-th-filterable",style:{whiteSpace:"nowrap"},children:[t.jsx(ue,{label:"The starter this move sends to the bench (the added player takes their lineup slot).",withArrow:!0,multiline:!0,maw:260,children:t.jsx(g,{span:!0,inherit:!0,children:"Bench"})}),pe("bench")]}),t.jsx(p.Th,{style:{width:60}})]})}),t.jsx(p.Tbody,{children:ke.map(_=>{if(_.kind!=="row"){const we=7+(h?0:We.length),Se=_.kind==="expand",Le=_.kind==="expand"?_.hidden:0;return t.jsx(p.Tr,{children:t.jsx(p.Td,{colSpan:we,style:{padding:"2px 8px"},children:t.jsx(ct,{onClick:()=>ft.toggle(_.groupKey,Se),"aria-label":Se?`Show ${Le} more pickups ${_.label}`:`Show fewer pickups ${_.label}`,children:t.jsx(g,{size:"xs",c:"blue.4",children:Se?`⸠${Le} more ${_.label}`:`â´ Show fewer ${_.label}`})})})},`${_.kind}-${_.groupKey}`)}const w=_.row,X=A!==null&&String(A)===String(w.player.id),le=w.drop?hr[w.drop.from]:null,Me=bi(w),De=w.rankAfter<w.rankBefore,mt=w.rankAfter>w.rankBefore;return t.jsxs(p.Tr,{onClick:()=>P(w),style:{cursor:"pointer"},bg:X?"light-dark(var(--mantine-color-blue-0), var(--rh-dk-staged-row-tint))":void 0,children:[t.jsx(p.Td,{style:{whiteSpace:"nowrap"},children:t.jsxs(Z,{gap:4,wrap:"nowrap",style:{width:"max-content"},children:[t.jsx(ji,{playerId:w.player.id,name:w.player.name}),t.jsx(Xe,{size:"xs",variant:"light",style:{flexShrink:0},children:(w.player.positions?.length?w.player.positions:[w.player.primaryPosition]).join("/")}),w.player.level&&w.player.level!=="MLB"&&t.jsx(Pi,{level:w.player.level}),t.jsx(_i,{name:w.player.name,onClick:()=>R(String(w.player.id),w.player.name)})]})}),t.jsx(p.Td,{style:{textAlign:"right",whiteSpace:"nowrap"},children:t.jsxs(g,{size:"xs",fw:700,c:"green",children:["+",mi(w.totalGain)]})}),t.jsx(p.Td,{style:{textAlign:"right",whiteSpace:"nowrap"},children:De||mt?t.jsxs(g,{span:!0,size:"xs",fw:600,c:De?"green":"red",children:[De?"â²":"â¼"," ",w.rankBefore,"â",w.rankAfter]}):t.jsx(g,{span:!0,size:"xs",c:"dimmed",children:"â"})}),!h&&We.map(we=>{const Se=cn(w,we);return Math.abs(Se)<1e-4?t.jsx(p.Td,{style:{textAlign:"right"},c:"dimmed",children:"â"},we):t.jsx(p.Td,{style:{textAlign:"right",whiteSpace:"nowrap"},children:t.jsxs(g,{size:"xs",fw:600,c:Se>0?"green":"red",children:[Se>0?"+":"",mi(Se)]})},we)}),t.jsx(p.Td,{style:{whiteSpace:"nowrap"},children:w.placedSlot||"Bench"}),t.jsx(p.Td,{style:{whiteSpace:"nowrap"},children:w.drop?t.jsxs(Z,{gap:4,wrap:"nowrap",style:{width:"max-content"},children:[t.jsx(g,{size:"xs",children:w.drop.name}),le&&t.jsx(Xe,{size:"xs",variant:"light",color:"gray",style:{flexShrink:0},children:le}),t.jsx(_i,{name:w.drop.name,onClick:()=>R(String(w.drop.playerId),w.drop.name)})]}):t.jsx(ue,{label:"You have an open roster spot, so nothing needs to be dropped.",withArrow:!0,multiline:!0,maw:240,children:t.jsx(g,{size:"xs",c:"dimmed",style:{cursor:"help"},children:"None (open spot)"})})}),t.jsx(p.Td,{style:{whiteSpace:"nowrap"},children:Me?t.jsx(ue,{label:`${w.player.name} takes ${Me}'s lineup slot; ${Me} moves to the bench (still on your roster).`,withArrow:!0,multiline:!0,maw:260,children:t.jsx(g,{size:"xs",style:{cursor:"help"},children:Me})}):t.jsx(g,{size:"xs",c:"dimmed",children:"â"})}),t.jsx(p.Td,{children:t.jsx(ee,{size:"compact-xs",variant:X?"filled":"default",onClick:we=>{we.stopPropagation(),P(w)},children:X?"Staged â":"Stage"})})]},String(w.player.id))})})]})}),t.jsxs(g,{size:"xs",c:"dimmed",mt:4,children:["Showing ",it,it<he.length?` of ${he.length}`:""," idea",it===1?"":"s",". Click any row to preview its full impact below."]})]})]})]})}function br(e){return!e||typeof e!="object"||e.sourceType&&e.sourceType!=="sgp"?!1:e.statsYear===ba()&&typeof e.sourceName=="string"&&e.sourceName.length>0}function _r(e){return e===Qe||e.startsWith("trailing:")}function Dt(e){if(typeof e=="number")return Number.isFinite(e)?e:0;const l=Number(e?.dollarValue??0);return Number.isFinite(l)?l:0}function un(e){return e==="P"||e==="SP"||e==="RP"}function Vi(e){if(!e||typeof e!="object")return!1;let l=0,a=0;for(const i of Object.values(e)){const P=Dt(i);Number.isFinite(P)&&(l++,Math.abs(P)>=.5&&a++)}if(l===0)return!1;const n=l>=100?10:l>=20?3:1;return a>=n}
2function xr(e,l,a){if(!Vi(e))return!1;let n=0,i=0;const P=(m,R)=>{if(!Number.isFinite(R)||R<=0)return;const L=m?.xMLBAMID;if(!L)return;n++;const S=Dt(e?.[String(L)]);Math.abs(S)>=.5&&i++};if(l.forEach(m=>P(m,Number(m.PA??m.AB??0))),a.forEach(m=>P(m,Number(m.IP??0))),n===0)return!0;const A=n>=100?10:n>=20?3:1;return i>=A}function wr(e){if(Ze(e))return{hitting:[],pitching:[],all:[],inverted:[],isPoints:!0};const l=vi(e),a=yi(e),n=Qs(e);return{hitting:l,pitching:a,all:[...l,...a],inverted:n,isPoints:!1}}function xi(e,l){return ki(e,"5x5",l)}function zt(e,l,a,n=[]){const i=e-l;if(Math.abs(i)<1e-4)return"0";const P=i>0?"+":"";return a?["AVG","OBP","SLG","OPS","BAA","OBPA"].includes(a)?`${P}${i.toFixed(3)}`:["ERA","WHIP","HR/9","K/9","BB/9","H/9","K/BB"].includes(a)?`${P}${i.toFixed(3)}`:a==="IP"?`${P}${i.toFixed(1)}`:n.includes(a)?`${P}${i.toFixed(2)}`:`${P}${Math.round(i).toLocaleString()}`:`${P}${i.toFixed(1)}`}function Ft(e,l,a,n=[]){const i=e-l,P=a?n.includes(a):!1;return Math.abs(i)<.001?"":P?i<0?"green":"red":i>0?"green":"red"}function dn(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}const Sr=[{value:"all-hitters",label:"All Hitters"},{value:"all-pitchers",label:"All Pitchers"},{value:"C",label:"C"},{value:"1B",label:"1B"},{value:"2B",label:"2B"},{value:"SS",label:"SS"},{value:"MI",label:"MI"},{value:"3B",label:"3B"},{value:"CI",label:"CI"},{value:"OF",label:"OF"},{value:"SP",label:"SP"},{value:"RP",label:"RP"}],jr=new Set(["player","rank","impact"]);function Il(){const{store:e,leagueId:l,loading:a}=zs(),{user:n}=xs(),i=Ds();Fs(["sgp","rankings","customData","auctionValues","yahooDraftPositions","currentStandings","adp"]);const[P,A]=Cs(),m=wi("(max-width: 48em)"),R=P.get("view")==="ideas"?"ideas":"evaluate",L=u.useCallback(s=>{A(r=>{const c=new URLSearchParams(r);return s==="ideas"?c.set("view","ideas"):c.delete("view"),c},{replace:!0})},[A]),[S,h]=u.useState(!0),[U,Be]=u.useState({}),[te,ne]=u.useState({}),[fe,_e]=u.useState({}),[W,et]=u.useState([]),[N,Pe]=u.useState(null),[I,ze]=u.useState(null),[$,me]=u.useState(null),[ye,Ge]=u.useState(null),[We,de]=u.useState(!1),[xe,ve]=u.useState(null),[Ne,tt]=u.useState({}),[gt,he]=u.useState([]),[V,nt]=u.useState(null),[Re,Fe]=u.useState(null),[ie,ft]=u.useState("all-hitters"),[ke,it]=u.useState("mlb"),[pe,Lt]=u.useState("all"),[_,w]=u.useState(""),X=u.useRef(null);u.useEffect(()=>{X.current?.scrollTo({top:0})},[ie,ke,pe,_]);const[le,Me]=u.useState(!1),[De,mt]=u.useState({}),[we,Se]=u.useState(new Map),[Le,zi]=u.useState(new Map),[bt,Fi]=u.useState(new Map),[_t,Di]=u.useState(new Map),[mn,Li]=u.useState(new Map),[bn,Ei]=u.useState(new Map),[_n,$i]=u.useState(new Map),[xn,Hi]=u.useState(new Map),[wn,Gi]=u.useState(new Map),[Sn,Wi]=u.useState(new Map),[jn,Yi]=u.useState([]),[Pn,Ki]=u.useState(new Map),[xt,qi]=u.useState(new Map),[yn,Ji]=u.useState([]),[vn,Ui]=u.useState(null),[kn,Qi]=u.useState([]),[Mn,Zi]=u.useState({}),[Xi,es]=u.useState([]),[ts,wt]=u.useState(null),[ns,Cn]=u.useState(!1),[se,st]=u.useState("yahoo_own_delta"),[Ye,St]=u.useState(!1),[Et,Tn]=u.useState(null),[An,On]=u.useState([]),[Q,at]=u.useState(Qe),[Pr,jt]=u.useState(!1),[In,Bn]=u.useState(new Map),[Nn,Rn]=u.useState(new Map),[Ce,$t]=u.useState(null),[Vn,Ht]=u.useState(null),is=u.useRef(null),zn=u.useRef(null),[ss,Pt]=u.useState(!1),[ae,Fn]=u.useState(null),[Ee,Dn]=u.useState(null),[Gt,Ln]=u.useState(1),[Wt,En]=u.useState(""),C=e.getCurrentLeague(),be=C?.scoringFormat||"5x5",yt=C?.rosterSlots||Js,$e=Ze(be),je=u.useMemo(()=>wr(be),[be]),$n=C?.keeperLeague===!0,[vt,Hn]=u.useState(null);u.useEffect(()=>{if(!$n||!C){Hn(null);return}let s=!1;return Ls(C).then(r=>{if(s||!r)return;const c=new Map;r.forEach((o,v)=>{c.set(Number(v),o)}),Hn(c)}),()=>{s=!0}},[i,$n,l]);const Yt=Ia(l),re=u.useMemo(()=>(e.getTeams()||[]).filter(s=>s.name),[e,Yt]),Ke=C?.draftType==="Snake",as=u.useMemo(()=>ci("hitting",yt),[yt]),rs=u.useMemo(()=>ci("pitching",yt),[yt]),Gn=u.useRef(null);u.useEffect(()=>{if(!(Gn.current!==(l??null))&&(V||Ce))return;Gn.current=l??null;async function r(){try{const[c,o]=await Promise.all([di(),Zs()]),v={};c.batting.forEach(x=>{v[x.xMLBAMID]={batting:x}}),c.pitching.forEach(x=>{v[x.xMLBAMID]||(v[x.xMLBAMID]={}),v[x.xMLBAMID].pitching=x}),Be(v),Tn(c.sourceName||null),On(Qt());const M=o.map(x=>{const b=x.name.split(" ");return{...x,lastName:b.length>1?b.slice(1).join(" "):x.name}});et(M);const k={};ne(k),_e({}),await Hs(),l&&Gs(l),an(c.pitching);const O={},q=(x,b)=>{if(!b?.playerId)return;const y=String(b.playerId);O[y]=x;const z=String(D(b.playerId));O[z]=x};re.forEach(x=>{const b=e.getRoster(x.index);
2b&&(b.lineup&&Object.values(b.lineup).forEach(y=>{q(x.name,y)}),b.bench&&["hitting","pitching","il","minors"].forEach(y=>{b.bench[y]&&b.bench[y].forEach(z=>{q(x.name,z)})}))}),tt(O);const j=Xs(M,C).filter(x=>!O[String(x.id)]);j.forEach(x=>{x.dollarValue=k[String(x.id)]||0,x.rawDollarValue=x.dollarValue}),j.sort((x,b)=>(b.rawDollarValue||0)-(x.rawDollarValue||0)),he(j);const T=e.getMyTeamIndex();if(T!==null){Pe(T);let x=e.getRoster(T);if(!x&&typeof e.reloadRosters=="function")try{await e.reloadRosters(),x=e.getRoster(T)}catch(b){console.warn("Could not reload rosters while initializing pickup analyzer:",b)}x&&(ze(x),me(JSON.parse(JSON.stringify(x))))}h(!1)}catch(c){console.error("Error loading pickup analyzer data:",c),h(!1)}}r()},[re,l]),u.useEffect(()=>{let s=!1;Ba().then(c=>{s||zi(c)}).catch(()=>{}),Na().then(c=>{s||Fi(c)}).catch(()=>{});const r=Ra(C)??2;return Va(r).then(c=>{s||Di(c)}).catch(()=>{}),()=>{s=!0}},[C?.platform,C?.scoringFormat,C?.leagueType]),u.useEffect(()=>{let s=!1;return Us().then(r=>{s||mt(r)}).catch(()=>{s||mt({})}),Da().then(r=>{s||Se(r)}).catch(()=>{}),()=>{s=!0}},[]),u.useEffect(()=>{const s=C?.platform;st(s==="ESPN"?"espn_own_delta":s==="Ottoneu"?"ott_own_delta":"yahoo_own_delta"),St(!1)},[C?.platform]),u.useEffect(()=>{Li(Ya(C))},[C?.platform,C?.cbsOwnership,C?.leagueOwnership]),u.useEffect(()=>{let s=!1;const r=Q===Je?rn():ln();return za(r).then(c=>{s||Ei(c)}).catch(()=>{}),Fa(r).then(c=>{s||$i(c)}).catch(()=>{}),()=>{s=!0}},[Q]),u.useEffect(()=>{if(W.length===0)return;let s=!1;return(async()=>{const r=Wa()||[],c=$a(W),o=new Set(W.map(G=>G.id));let v=null;const M=new Map,k=[];let O=null;for(const G of r)if(G.content){k.push(G.name),G.isDefault&&(O=G.name);try{v||(v=await Ha());const nn=Ga(G.content,c,v,o);M.set(G.name,nn.adpMap)}catch{}}const q=C?.defaultADPSource;q&&k.includes(q)&&(O=q);const j=ea()||[],T=new Set(C?.hiddenRankingSources||[]),x=j.filter(G=>!T.has(G.name)),b=Za(x),y={};for(const G of x)G.shortName&&(y[G.name]=G.shortName);const z=ta()||[],J=new Set(C?.hiddenCustomDataSources||[]),B=z.filter(G=>!J.has(G.name)),F=new Map(W.map(G=>[G.id,G])),{maps:Y,columns:oe}=nr(B,F),lt=na()||[],ot=Xa(lt);s||(Hi(M),Ji(k),Ui(O),Gi(b),Qi(x.map(G=>G.name)),Zi(y),Wi(Y),Yi(oe),Ki(ot),es(lt.map(G=>G.name)),qi(ir()))})(),()=>{s=!0}},[W,l]),u.useEffect(()=>{let s=!1;async function r(){jt(!0);try{let c=[],o=[];if(ne({}),_e({}),he(j=>j.map(T=>({...T,dollarValue:0,rawDollarValue:0}))),Q==="projections"||Q==="projections-600pa"){const j=Q==="projections-600pa",T=new Map,x=new Map;
2if(Object.entries(U).forEach(([b,y])=>{const z=Number(b);y.batting&&T.set(z,j?ya(y.batting,600):y.batting),y.pitching&&x.set(z,y.pitching)}),s||(Bn(T),Rn(x)),!j){const b=e.getSGPPlayerValues();if(!s&&br(b)&&Vi(b?.valueMap)){const y={},z={};Object.entries(b.valueMap).forEach(([J,B])=>{y[String(J)]=Dt(B),z[String(J)]=dt(B)}),ne(y),_e(z),he(J=>{const B=J.map(F=>({...F,dollarValue:y[String(F.id)]||0,rawDollarValue:z[String(F.id)]||0}));return B.sort((F,Y)=>(Y.rawDollarValue||0)-(F.rawDollarValue||0)),B}),jt(!1);return}}c=Array.from(T.values()),o=Array.from(x.values())}if(Q===Qe||Q===Je){const j=Q===Je?rn():ln(),T=await ha(j);c=T.batting,o=T.pitching}else if(Q.startsWith("trailing:")){const j=parseInt(Q.split(":")[1],10),T=await pa(j);c=T.batting,o=T.pitching}if(s)return;const v=new Map;c.forEach(j=>{const T=Number(j.xMLBAMID);T&&v.set(T,j)});const M=new Map;o.forEach(j=>{const T=Number(j.xMLBAMID);T&&M.set(T,j)}),Bn(v),Rn(M);const k=e.getSGPPlayerValues(),O=/^trailing:(\d+)$/.exec(Q);if((!k||!k.valueMap?!1:Q===Qe?k.statsYear===ga()&&!k.sourceName:Q===Je?k.statsYear===fa()&&!k.sourceName:O?k.statsYear===`trailing_${O[1]}`:!1)&&xr(k.valueMap,c,o)){const j={},T={};Object.entries(k.valueMap).forEach(([x,b])=>{j[String(x)]=Dt(b),T[String(x)]=dt(b)}),ne(j),_e(T),he(x=>{const b=x.map(y=>({...y,dollarValue:j[String(y.id)]||0,rawDollarValue:T[String(y.id)]||0}));return b.sort((y,z)=>(z.rawDollarValue||0)-(y.rawDollarValue||0)),b}),jt(!1);return}try{an(o);const j={...ma()};_r(Q)&&(j.minPA=0,j.minIP=0);try{const B=await di();B?.batting?.length&&(j.referenceHitterProjections=B.batting),B?.pitching?.length&&(j.referencePitcherProjections=B.pitching)}catch{}const T=await ws(()=>Ss(()=>import("./sgp-values-DwITIVPk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),x=await ia({batting:c,pitching:o,league:C,protectedPlayerIds:sa({additionalIds:Object.keys(Ne||{})})}),b={};x.batting.forEach(B=>{const F=String(B.xMLBAMID),Y=B.minpos||B.Pos||B.position||B.primaryPosition||"Util",oe=pt(Number(F),Y);oe.length>0?b[F]=oe:b[F]=["Util"]}),x.pitching.forEach(B=>{const F=String(B.xMLBAMID);if(!b[F]){const Y=Number(B.GS)||0;b[F]=[Y>=5?"SP":"RP"]}});const y=$e&&T.calculatePointsValues?.(x.batting,x.pitching,j,b)||T.calculateSGPValues(x.batting,x.pitching,j,b);if(s)return;const z={},J={};y.hitters?.players?.forEach(B=>{z[String(B.id)]=B.dollarValue||0,J[String(B.id)]=dt(B)}),y.pitchers?.players?.forEach(B=>{const F=String(B.id);z[F]||(z[F]=B.dollarValue||0,J[F]=dt(B))}),ne(z),_e(J),he(B=>{const F=B.map(Y=>({...Y,dollarValue:z[String(Y.id)]||0,rawDollarValue:J[String(Y.id)]||0}));return F.sort((Y,oe)=>(oe.rawDollarValue||0)-(Y.rawDollarValue||0)),F})}catch(j){console.warn("[PickupAnalyzer] SGP recalc for source failed:",j),s||(ne({}),_e({}),he(T=>T.map(x=>({...x,dollarValue:0,rawDollarValue:0}))))}}catch(c){console.warn("[PickupAnalyzer] Stats source load failed:",c)}finally{s||jt(!1)}}return!S&&Object.keys(U).length>0&&r(),()=>{s=!0}},[Q,S,U,C,Ne,e]);const Te=u.useMemo(()=>{const s=new Set;if(!I)return s;const r=o=>{const v=Number(o?.playerId);if(Number.isFinite(v)&&v>0){s.add(v);const M=Number(D(v));Number.isFinite(M)&&M>0&&s.add(M)}};Object.values(I.lineup||{}).forEach(r);const c=I.bench||{};return["hitting","pitching","il","minors"].forEach(o=>{(c[o]||[]).forEach(r)}),s},[I]),kt=u.useMemo(()=>{const s={},r=[];for(const c of W){const o=String(c.id),v=Number(fe[o]??te[o]??0);r.push({id:o,v})}return r.sort((c,o)=>o.v-c.v),r.forEach((c,o)=>{s[c.id]=o+1}),s},[W,te,fe]),Kt=u.useMemo(()=>{const s=dn(_.toLowerCase()),r=[...gt];if(le&&Te.size>0){const c=new Set(r.map(o=>Number(o.id)));for(const o of W){const v=Number(D(o.id));if(!Te.has(Number(o.id))&&!Te.has(v)||c.has(Number(o.id)))continue;const M={...o,dollarValue:Number(te[String(o.id)]??0),rawDollarValue:Number(fe[String(o.id)]??te[String(o.id)]??0)};r.push(M),c.add(Number(o.id))}}return r.filter(c=>{{const k=pt(c.id,c.primaryPosition),O=un(c.primaryPosition),q=k.some(b=>un(b)),j=k.some(b=>!un(b)),T=O||q,x=j&&!O;if(ie==="all-hitters"){if(!x)return!1}else if(ie==="all-pitchers"){if(!T)return!1}else if(ie==="SP"||ie==="RP"){if(!k.includes(ie))return!1}else{const b=$s[ie]||[];if(!k.some(y=>b.includes(y)))return!1}}if(s&&s.length>=2){const k=dn(c.name.toLowerCase()),O=dn((c.lastName||"").toLowerCase());if(!k.includes(s)&&!O.includes(s))return!1}const o=D(c.id),v=De[String(o)]||Mi(o,c.level),M=la(c.level,v);return!(ke==="mlb"&&M||ke==="milb"&&!M||!La(we,o,pe))})},[gt,ie,_,ke,pe,we,le,Te,W,te,fe,De]),qt=ie==="SP"||ie==="RP"||ie==="all-pitchers",Wn=!qt,Yn=u.useMemo(()=>re.find(s=>
2s.index===N)?.name||"",[re,N]),K=u.useMemo(()=>sr({scoringFormat:be,isFGPts:$e,isSnake:Ke,hasDraftPositionData:!1,hasYahooDraft:xt.size>0,hasOttoneuOwnership:C?.platform==="Ottoneu"&&_t.size>0,hasYahooOwnership:Le.size>0,hasEspnOwnership:bt.size>0,hasCbsOwnership:qa(C),hasStartPct:Ka(C),platform:C?.platform,adpSourceNames:yn,rankingSourceNames:kn,rankingShortNames:Mn,customDataColumns:jn,adpDefaultName:vn,leaguePointValues:C?.pointValues,dynastyYearLabel:vt?"Dyn $":null}),[be,$e,Ke,xt,C,_t,bt,Le,yn,kn,Mn,Xi,jn,vn,vt]),Ae=l?`pickupAnalyzerColumns_${l}`:null;u.useEffect(()=>{if(K.length===0)return;let s=null;try{const r=Ae?localStorage.getItem(Ae):null;s=r?JSON.parse(r):null}catch{s=null}if(s&&Array.isArray(s)){const r=new Set(K.map(c=>c.id));wt(new Set(s.filter(c=>r.has(c))))}else wt(new Set(K.filter(r=>r.defaultVisible).map(r=>r.id)))},[Ae,K.length]);const Jt=ts||new Set(K.filter(s=>s.defaultVisible).map(s=>s.id)),Kn=u.useCallback(s=>{if(!Jt.has(s))return!1;const r=K.find(c=>c.id===s);return!(!r||(r.group==="hitting"||r.group==="statcast_hit")&&!Wn||(r.group==="pitching"||r.group==="statcast_pit")&&!qt)},[Jt,K,Wn,qt]),ls=u.useCallback(s=>{wt(r=>{const c=new Set(r||K.filter(o=>o.defaultVisible).map(o=>o.id));c.has(s)?c.delete(s):c.add(s);try{Ae&&localStorage.setItem(Ae,JSON.stringify(Array.from(c)))}catch{}return c})},[K,Ae]),os=u.useCallback(()=>{const s=new Set(K.filter(r=>r.defaultVisible).map(r=>r.id));wt(s);try{Ae&&localStorage.removeItem(Ae)}catch{}},[K,Ae]),Mt=u.useMemo(()=>{const s=["info","hitting","pitching","statcast_hit","statcast_pit"],r=[];for(const c of s)r.push(...K.filter(o=>o.group===c&&Kn(o.id)));return r},[K,Kn]),qn=u.useMemo(()=>{const s=new Set;return["hitting","pitching","statcast_hit","statcast_pit"].forEach(r=>{const c=Mt.find(o=>o.group===r);c&&s.add(c.id)}),s},[Mt]),Ct=u.useMemo(()=>({filterContext:"all",scoringFormat:be,isFGPts:$e,leaguePointValues:C?.pointValues,leagueId:l,adpMaps:xn,rankingMaps:wn,customDataMaps:Sn,auctionMaps:Pn,yahooDraftMap:xt,yahooOwnershipMap:Le,ottoneuOwnershipMap:_t,espnOwnershipMap:bt,cbsOwnershipMap:mn,statcastHittersMap:bn,statcastPitchersMap:_n,dynastyYearMap:vt}),[be,$e,C,l,xn,wn,Sn,Pn,xt,Le,_t,bt,mn,bn,_n,vt]),Ut=u.useCallback(s=>{const r=Number(s.id),c=Te.has(r)||Te.has(Number(D(r))),o=s.dollarValue??null;return{id:r,name:s.name,primaryPosition:s.primaryPosition,currentTeam:s.currentTeam,level:s.level,birthDate:s.birthDate,batting:In.get(r)||null,pitching:Nn.get(r)||null,owner:c?Yn:"Free Agent",ownerIndex:c&&N!==null?N:null,dollarValue:o,rawDollarValue:s.rawDollarValue??o,hittingValue:o,pitchingValue:o,salary:null,draftOverall:null}},[In,Nn,Te,Yn,N]),cs=u.useMemo(()=>[{label:"Info & Rankings",columns:K.filter(s=>s.group==="info")},{label:"Hitting Stats",columns:K.filter(s=>s.group==="hitting")},{label:"Pitching Stats",columns:K.filter(s=>s.group==="pitching")},{label:"Statcast (Hitters)",columns:K.filter(s=>s.group==="statcast_hit")},{label:"Statcast (Pitchers)",columns:K.filter(s=>s.group==="statcast_pit")}].filter(s=>s.columns.length>0),[K]),Qt=u.useCallback(()=>{const s=ui("batting"),r=ui("pitching"),c=new Set;s.forEach(M=>c.add(M.name)),r.forEach(M=>c.add(M.name));const o=Nt();return Array.from(c).sort((M,k)=>M===o?-1:k===o?1:M.localeCompare(k)).map(M=>({value:M,label:M===o?`${M} (Default)`:M}))},[]),Zt=u.useCallback(s=>{s&&(async()=>{const r=await ua(s);Be(Ma(r.batting,r.pitching)),Tn(s),da(s,r.backfilled),r.pitching.length>0&&an(r.pitching)})()},[]),us=u.useCallback(s=>{On(Qt());const r=s||Nt();r&&Zt(r)},[Qt,Zt]),{suggestionsResult:rt,suggesterExcludedIds:Jn,excludedPlayers:ds,excludeSuggesterPlayer:hs,unexcludeSuggesterPlayer:ps}=Ca({enabled:!0,projectionSourceName:Et,precomputedLineups:ye,precomputedLineupsPending:We}),Un=u.useMemo(()=>{const s=new Map;for(const r of rt?.suggestions??[])s.set(String(r.player.id),r);return s},[rt]),Tt=u.useCallback(s=>Un.get(String(s))??null,[Un]),Xt=!!rt,gs=u.useMemo(()=>{const s=Kt.map(r=>({p:r,cp:Ut(r)}));return s.sort((r,c)=>{const o=r.p,v=c.p;let M=0;if(se==="player")M=o.name.localeCompare(v.name);else if(se==="rank"){const k=kt[String(o.id)]??Number.MAX_SAFE_INTEGER;M=(kt[String(v.id)]??Number.MAX_SAFE_INTEGER)-k}else if(se==="impact"){const k=Tt(o.id)?.totalGain??null,O=Tt(v.id)?.totalGain??null;if(k===null&&O===null)return o.name.localeCompare(v.name);if(k===null)return 1;if(O===null)return-1;M=k-O}
2else{const k=fi(r.cp,se,Ct),O=fi(c.cp,se,Ct),q=k===f,j=O===f;if(q&&j)return o.name.localeCompare(v.name);if(q)return 1;if(j)return-1;typeof k=="number"&&typeof O=="number"?M=k-O:M=String(k).localeCompare(String(O))}return M===0&&(M=o.name.localeCompare(v.name)),Ye?M:-M}),s.slice(0,100).map(r=>r.p)},[Kt,se,Ye,Ut,Ct,kt,Tt]);u.useEffect(()=>{K.length!==0&&(jr.has(se)||K.some(s=>s.id===se)||(st("rank"),St(!1)))},[K,se]);const At=u.useCallback(s=>{if(se===s){St(r=>!r);return}st(s),St(s==="player")},[se]),Ot=u.useMemo(()=>{const s={};try{const r=e.getSGPPlayerValues();r?.valueMap&&Object.entries(r.valueMap).forEach(([c,o])=>{s[c]=dt(o)})}catch{}return s},[e,l,Yt]);u.useEffect(()=>{if(re.length<2||Object.keys(U).length===0){Ge(null),de(!1);return}const s={};re.forEach(c=>{const o=e.getRoster(c.index);o&&(s[String(c.index)]=o)});let r=!1;return Ge(null),de(!0),(async()=>{try{const{rosters:c}=await va({teams:re.map(o=>({index:o.index,name:o.name})),rosters:s,projectionMap:U,scoringFormat:be,pointValues:C?.pointValues??null,cap:C?.pitcherCap,lineupFrequency:C?.lineupFrequency,currentStandingsData:e.getCurrentStandingsForProjection()||null,customHittingCats:C?.customHittingCats??null,customPitchingCats:C?.customPitchingCats??null,valueMap:Ot,onYield:ka});r||Ge(c)}catch(c){console.error("[PickupAnalyzer] materialize failed:",c),r||Ge(null)}finally{r||de(!1)}})(),()=>{r=!0}},[re,U,be,C?.pointValues,C?.pitcherCap,C?.lineupFrequency,C?.customHittingCats,C?.customPitchingCats,Ot,e,l,Yt]);const Qn=u.useCallback(s=>{const r=W.find(c=>c.id===s);r&&(nt(r),me(I?JSON.parse(JSON.stringify(I)):null),qe.current=null,Fe(null),ve(null),$t(null))},[W,I]),qe=u.useRef(null),Zn=u.useCallback(s=>{if(!V||!$)return;const r=qe.current??$;qe.current||(qe.current=JSON.parse(JSON.stringify(r)));const c=JSON.parse(JSON.stringify(r)),o=k=>Rt(V,k),{droppedPlayerName:v,placedSlot:M}=Sa(c,s,V,o);me(c),Fe(M),Ht(v),ve({mode:"manual",dropTargetId:s})},[V,$]),[H,Xn]=u.useState(null),He=u.useCallback(()=>Xn(null),[]),ei=u.useCallback(s=>{if(!$)return;const r=JSON.parse(JSON.stringify($));s(r),me(r)},[$]);u.useEffect(()=>{if(!H)return;const s=r=>{r.key==="Escape"&&He()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[H,He]);const ti=u.useCallback(s=>{if(!$)return;if(!H){if(!s.player?.playerId)return;Xn(s);return}if(H.kind==="lineup"&&s.kind==="lineup"&&H.slot===s.slot||H.kind==="bench"&&s.kind==="bench"&&H.section===s.section&&H.index===s.index){He();return}const c={id:H.player.playerId,primaryPosition:H.player.playerPosition||H.player.primaryPosition};if(s.kind==="lineup"){if(!Rt(c,s.slot)){He();return}const o=s.player;if(o?.playerId&&H.kind==="lineup"){const v={id:o.playerId,primaryPosition:o.playerPosition||o.primaryPosition};if(!Rt(v,H.slot)){He();return}}}ei(o=>{H.kind==="lineup"&&s.kind==="lineup"?ja(o,H.slot,s.slot):H.kind==="bench"&&s.kind==="lineup"?hi(o,H.section,H.index,s.slot):H.kind==="lineup"&&s.kind==="bench"&&hi(o,s.section,s.index,H.slot)}),He()},[$,H,ei,He]),ni=u.useCallback(s=>{if(N===null||!ye)return;const r={teams:re.map(v=>({index:v.index,name:v.name})),getRoster:v=>ye[String(v)]??e.getRoster(v),projectionMap:U,scoringFormat:be,leaguePointValues:C?.pointValues??null,myTeamIndex:N,customHittingCats:C?.customHittingCats??null,customPitchingCats:C?.customPitchingCats??null,cap:C?.pitcherCap,lineupFrequency:C?.lineupFrequency,currentStandingsData:e.getCurrentStandingsForProjection()||null,optimalLineup:!1},c=li(r),o=li({...r,rosterOverrides:{[N]:s}});$t({beforeStats:c,afterStats:o,beforeStandings:c,afterStandings:o})},[N,ye,re,e,U,be,C?.pointValues,C?.customHittingCats,C?.customPitchingCats,C?.pitcherCap,C?.lineupFrequency]);u.useEffect(()=>{if(!xe||N===null||!ye)return;let s=null;if(xe.mode==="staged")s=xe.roster;else if(V){const r=ye[String(N)];r&&(s=Pa({myRoster:r,fa:{id:V.id,name:V.name,primaryPosition:V.primaryPosition,currentTeam:V.currentTeam,level:V.level},dropTargetId:xe.dropTargetId,projectionMap:U,valueMap:Ot,excludeIds:new Set(Jn)})?.roster??null)}s&&ni(s)},[xe,ye,N,V,U,Ot,Jn,ni]);const en=u.useCallback(s=>
2{if(V&&String(V.id)===String(s.player.id)){nt(null),me(I?JSON.parse(JSON.stringify(I)):null),qe.current=null,Fe(null),Ht(null),ve(null),$t(null);return}const c=W.find(v=>String(v.id)===String(s.player.id));if(!c)return;const o=JSON.parse(JSON.stringify(s.roster));nt(c),me(o),qe.current=I?JSON.parse(JSON.stringify(I)):null,Fe(s.placedSlot),Ht(s.drop?.name??null),ve({mode:"staged",roster:o}),L("evaluate"),Ps.show({title:"Staged pickup",message:s.drop?`Pickup ${s.player.name}, drop ${s.drop.name}. Impact shown below.`:`Pickup ${s.player.name} (open roster spot, no drop). Impact shown below.`,color:"blue",autoClose:2500}),setTimeout(()=>zn.current?.scrollIntoView({behavior:"smooth",block:"start"}),60)},[V,I,W,L]),It=Ts(),fs=As(),ii=u.useRef(!1);u.useEffect(()=>{const s=It.state?.stagedPickup;!s||ii.current||S||N===null||W.length===0||(ii.current=!0,en(s),fs(`${It.pathname}${It.search}`,{replace:!0,state:null}))},[It.state,S,N,W]);const si=u.useRef(!1);u.useEffect(()=>{const s=P.get("player");!s||si.current||S||N===null||W.length===0||(si.current=!0,Qn(Number(s)))},[P,S,N,W]),u.useCallback((s,r)=>{r.stopPropagation(),Fn(s),Dn(N!==null?String(N):null),Ln(1),En(""),Pt(!0)},[N]);const tn=u.useCallback(async()=>{if(!ae||Ee===null)return;const s=Number(Ee),r=e.getRoster(s);if(!r)return;const c=JSON.parse(JSON.stringify(r));c.bench||(c.bench={hitting:[],pitching:[]}),c.bench.hitting||(c.bench.hitting=[]),c.bench.pitching||(c.bench.pitching=[]);const o=pt(ae.id,ae.primaryPosition),v=o.includes("SP")||o.includes("RP")||o.includes("P"),M={name:ae.name,playerId:ae.id,playerPosition:ae.primaryPosition,playerTeam:ae.currentTeam,salary:Ke?"":`$${Gt}`,draftPosition:Ke&&Wt||null,level:ae.level||"MLB"};v?c.bench.pitching.push(M):c.bench.hitting.push(M),e.saveRoster(s,c);const k=re.find(O=>O.index===s);k&&tt(O=>({...O,[ae.id]:k.name})),he(O=>O.filter(q=>q.id!==ae.id)),s===N&&(ze(c),me(JSON.parse(JSON.stringify(c)))),Pt(!1),Fn(null)},[ae,Ee,Gt,Wt,Ke,e,re,N]),ms=()=>{if(!$?.lineup)return t.jsx(g,{c:"dimmed",ta:"center",py:"lg",children:"No roster data"});const r=re.find(b=>b.index===N)?.name||"My Team",c=b=>{const y=[],z=[];return(b||[]).forEach(J=>{if(!J?.playerId)return;(pt(J.playerId,J.playerPosition||J.primaryPosition).some(Y=>Y==="SP"||Y==="RP"||Y==="P")?z:y).push(J)}),{hitting:y,pitching:z}},o=c($.bench?.il),v=c($.bench?.minors),M={il:o.hitting,minors:v.hitting},k={il:o.pitching,minors:v.pitching},O=new Set;if(I?.lineup)for(const b of Object.keys(I.lineup)){const y=I.lineup[b];y?.playerId&&O.add(String(y.playerId))}const q=new Set;for(const b of[...$.bench?.hitting||[],...$.bench?.pitching||[]])b?.playerId&&O.has(String(b.playerId))&&q.add(String(b.playerId));const j=({isActive:b,onClick:y,tourId:z})=>t.jsx(ue,{label:"Move player, then click a destination slot",withArrow:!0,position:"right",disabled:b,children:t.jsx(Si,{size:m?"md":"sm",variant:b?"filled":"light",color:b?"red":"blue","data-tour-id":z,onClick:y,"aria-label":b?"Cancel move":"Move player",children:t.jsx(g,{size:"xs",fw:700,children:b?"â":"â"})})}),T=b=>{const y=$.lineup[b],z=!!(V&&y?.playerId),J=aa(b),B=V&&y?.playerId==V.id,F=V?Rt(V,b):!1,Y=H?.kind==="lineup"&&H.slot===b;return t.jsxs(Ie,{onClick:z?()=>Zn(y.playerId):void 0,style:{display:"flex",alignItems:"center",gap:6,padding:"2px 8px",borderBottom:"1px solid var(--mantine-color-default-border)",cursor:z?"pointer":void 0,backgroundColor:B?"light-dark(rgba(255, 235, 120, 0.2), rgba(255, 235, 120, 0.08))":z?F?"light-dark(var(--mantine-color-orange-0), var(--mantine-color-dark-5))":"light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-6))":void 0},children:[t.jsx(Xe,{size:"xs",variant:"light",w:36,style:{textAlign:"center",flexShrink:0},children:J}),y?.playerId?t.jsxs(t.Fragment,{children:[t.jsxs(g,{size:"xs",fw:B?700:void 0,style:{flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[y.name," ",t.jsx(g,{span:!0,size:"xs",c:"dimmed",children:gn(y.playerTeam||"")}),B?t.jsx(g,{span:!0,size:"xs",fw:700,c:"yellow.6",children:" NEW"}):null]}),t.jsx(g,{size:"xs",c:"dimmed",children:te[y.playerId]!==void 0?`$${Math.round(te[y.playerId])}`:""})]}):t.jsx(g,{size:"xs",c:"dimmed",style:{flex:1},children:"Empty"}),t.jsx(j,{isActive:Y,onClick:oe=>{oe.stopPropagation(),ti({kind:"lineup",slot:b,player:y||null})}})]},b)},x=(b,y)=>{const z=y==="il"||y==="minors";if(!b?.length)return z?null:t.jsx(g,{size:"xs",c:"dimmed",px:"sm",py:2,fs:"italic",children:"No bench players"});const J=y==="il"?"IL":y==="minors"?"MIN":"BN",B=y==="il"?"red":y==="minors"?"grape":void 0;return b.map((F,Y)=>{if(!F?.playerId)return null;const oe=V&&F.playerId==V.id,lt=!z&&!oe&&q.has(String(F.playerId)),ot=!!V,G=!z&&H?.kind==="bench"&&H.section===y&&H.index===Y;return t.jsxs(Ie,{onClick:ot?()=>Zn(F.playerId):void 0,style:{display:"flex",alignItems:"center",gap:6,padding:"2px 8px",borderBottom:"1px solid var(--mantine-color-default-border)",cursor:ot?"pointer":void 0,backgroundColor:oe?"light-dark(rgba(255, 235, 120, 0.2), rgba(255, 235, 120, 0.08))":lt?"light-dark(rgba(151, 117, 250, 0.16), rgba(151, 117, 250, 0.14))":ot?"light-dark(var(--mantine-color-orange-0), var(--mantine-color-dark-5))":void 0},children:[t.jsx(Xe,{size:"xs",variant:"light",color:B,w:36,style:{flexShrink:0},children:J}),t.jsxs(g,{size:"xs",fw:oe?700:void 0,style:{flex:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[F.name," ",t.jsx(g,{span:!0,size:"xs",c:"dimmed",children:gn(F.playerTeam||"")}),oe?t.jsx(g,{span:!0,size:"xs",fw:700,c:"green",children:" NEW"}):null,lt?t.jsx(ue,{label:"Moved out of your starting lineup to make room for the pickup",withArrow:!0,children:t.jsx(g,{span:!0,size:"xs",fw:700,c:"violet",children:" BUMPED"})}):null]}),t.jsx(g,{size:"xs",c:"dimmed",children:te[F.playerId]!==void 0?`$${Math.round(te[F.playerId])}`:""}),z?t.jsx(Ie,{w:m?34:28}):t.jsx(j,{isActive:G,onClick:nn=>{nn.stopPropagation(),ti({kind:"bench",section:y,index:Y,player:F})}})]},`${y}-${Y}`)})};return t.jsxs(ht,{children:[t.jsxs(Z,{p:"xs",justify:"space-between",wrap:"wrap",style:{borderBottom:"2px s
2olid var(--mantine-color-default-border)"},children:[t.jsxs(Z,{gap:"xs",wrap:"wrap",children:[t.jsx(g,{fw:700,size:"sm",children:r}),V&&t.jsxs(Xe,{color:"green",size:"sm",children:["+ ",V.name]}),V&&!Ce&&t.jsx(g,{size:"xs",fw:600,c:"orange",children:"Click any player to drop"})]}),t.jsx(ri,{component:Ue,to:`/roster-manager${l?`?league=${l}`:""}`,size:"xs",children:"Edit on Roster Manager"})]}),t.jsx(g,{fw:600,size:"xs",p:"xs",style:{background:"light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-6))"},children:"Hitting"}),as.map(b=>T(b)),t.jsx(g,{fw:600,size:"xs",p:"xs",style:{borderTop:"1px solid var(--mantine-color-default-border)",background:"light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-6))"},children:"Bench"}),x($.bench?.hitting,"hitting"),x(M.il,"il"),x(M.minors,"minors"),t.jsx(g,{fw:600,size:"xs",p:"xs",style:{borderTop:"1px solid var(--mantine-color-default-border)",background:"light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-6))"},children:"Pitching"}),rs.map(b=>T(b)),t.jsx(g,{fw:600,size:"xs",p:"xs",style:{borderTop:"1px solid var(--mantine-color-default-border)",background:"light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-6))"},children:"Bench"}),x($.bench?.pitching,"pitching"),x(k.il,"il"),x(k.minors,"minors")]})},bs=()=>{if(!Ce||!N)return null;const s=Ce.beforeStats.find(o=>o.teamIndex===N),r=Ce.afterStats.find(o=>o.teamIndex===N);if(!s||!r)return null;if($e){const o=v=>v.toFixed(1);return t.jsx(Ve,{type:"auto",children:t.jsxs(p,{className:"clean-table",children:[t.jsx(p.Thead,{children:t.jsxs(p.Tr,{children:[t.jsx(p.Th,{}),t.jsx(p.Th,{ta:"right",children:"Hitting PTS"}),t.jsx(p.Th,{ta:"right",children:"Pitching PTS"}),t.jsx(p.Th,{ta:"right",children:"Total PTS"})]})}),t.jsxs(p.Tbody,{children:[t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"Before"}),t.jsx(p.Td,{ta:"right",children:o(s.hittingPTS)}),t.jsx(p.Td,{ta:"right",children:o(s.pitchingPTS)}),t.jsx(p.Td,{ta:"right",fw:600,children:o(s.totalPTS)})]}),t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"After"}),t.jsx(p.Td,{ta:"right",children:o(r.hittingPTS)}),t.jsx(p.Td,{ta:"right",children:o(r.pitchingPTS)}),t.jsx(p.Td,{ta:"right",fw:600,children:o(r.totalPTS)})]}),t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"Change"}),t.jsx(p.Td,{ta:"right",c:Ft(r.hittingPTS,s.hittingPTS),children:zt(r.hittingPTS,s.hittingPTS)}),t.jsx(p.Td,{ta:"right",c:Ft(r.pitchingPTS,s.pitchingPTS),children:zt(r.pitchingPTS,s.pitchingPTS)}),t.jsx(p.Td,{ta:"right",fw:600,c:Ft(r.totalPTS,s.totalPTS),children:zt(r.totalPTS,s.totalPTS)})]})]})]})})}const c=[...je.hitting,...je.pitching];return t.jsx(Ve,{type:"auto",children:t.jsxs(p,{className:"clean-table",children:[t.jsx(p.Thead,{children:t.jsxs(p.Tr,{children:[t.jsx(p.Th,{}),c.map(o=>t.jsx(p.Th,{ta:"right",children:o},o))]})}),t.jsxs(p.Tbody,{children:[t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"Before"}),c.map(o=>t.jsx(p.Td,{ta:"right",children:xi(s[o]||0,o)},o))]}),t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"After"}),c.map(o=>t.jsx(p.Td,{ta:"right",children:xi(r[o]||0,o)},o))]}),t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"Change"}),c.map(o=>t.jsx(p.Td,{ta:"right",c:Ft(r[o]||0,s[o]||0,o,je.inverted),children:zt(r[o]||0,s[o]||0,o,je.inverted)},o))]})]})]})})},_s=()=>
2{if(!Ce||!N)return null;const{beforeStandings:s,afterStandings:r}=Ce,c=s.find(j=>j.teamIndex===N),o=r.find(j=>j.teamIndex===N);if(!c||!o)return null;const v=s.findIndex(j=>j.teamIndex===N)+1,M=r.findIndex(j=>j.teamIndex===N)+1,k=v-M;if($e){const j=x=>x===1?"1st":x===2?"2nd":x===3?"3rd":`${x}th`,T=o.totalPTS-c.totalPTS;return t.jsxs(ge,{gap:"sm",children:[t.jsx(Ve,{type:"auto",children:t.jsxs(p,{className:"clean-table",children:[t.jsx(p.Thead,{children:t.jsxs(p.Tr,{children:[t.jsx(p.Th,{}),t.jsx(p.Th,{ta:"right",children:"Total PTS"}),t.jsx(p.Th,{ta:"right",children:"Rank"})]})}),t.jsxs(p.Tbody,{children:[t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"Before"}),t.jsx(p.Td,{ta:"right",children:(c.totalPTS||0).toFixed(1)}),t.jsx(p.Td,{ta:"right",children:j(v)})]}),t.jsxs(p.Tr,{style:{backgroundColor:"light-dark(#EEF2F7, var(--mantine-color-dark-5))"},children:[t.jsx(p.Td,{fw:600,children:"After"}),t.jsxs(p.Td,{ta:"right",children:[(o.totalPTS||0).toFixed(1),Math.abs(T)>=.1&&t.jsxs(g,{span:!0,size:"xs",c:T>0?"green":"red",ml:4,children:[T>0?"+":"",T.toFixed(1)]})]}),t.jsxs(p.Td,{ta:"right",children:[j(M),k!==0&&t.jsxs(g,{span:!0,size:"xs",c:k>0?"green":"red",ml:4,children:[k>0?"+":"",k]})]})]})]})]})}),t.jsx(oi,{beforeStandings:s,afterStandings:r,isPoints:!0,highlightTeamIndexes:[N],label:"Full Standings After Pickup:"}),t.jsxs(g,{size:"xs",c:"dimmed",children:["Rankings based on projected total points vs other teams. ",t.jsx(g,{span:!0,inherit:!0,c:"green",children:"â²"}),"/",t.jsx(g,{span:!0,inherit:!0,c:"red",children:"â¼"})," mark rank changes from the pickup."]})]})}const O=je.all,q=(o.totalPoints||0)-(c.totalPoints||0);return t.jsxs(ge,{gap:"sm",children:[t.jsx(Ve,{type:"auto",children:t.jsxs(p,{className:"clean-table",children:[t.jsx(p.Thead,{children:t.jsxs(p.Tr,{children:[t.jsx(p.Th,{}),O.map(j=>t.jsx(p.Th,{ta:"right",children:j},j)),t.jsx(p.Th,{ta:"right",children:"Total"}),t.jsx(p.Th,{ta:"right",children:"Rank"})]})}),t.jsxs(p.Tbody,{children:[t.jsxs(p.Tr,{children:[t.jsx(p.Td,{children:"Before"}),O.map(j=>t.jsx(p.Td,{ta:"right",children:(c.points?.[j]||0).toFixed(1)},j)),t.jsx(p.Td,{ta:"right",fw:600,children:(c.totalPoints||0).toFixed(1)}),t.jsx(p.Td,{ta:"right",children:v})]}),t.jsxs(p.Tr,{style:{backgroundColor:"light-dark(#EEF2F7, var(--mantine-color-dark-5))"},children:[t.jsx(p.Td,{fw:600,children:"After"}),O.map(j=>{const T=(o.points?.[j]||0)-(c.points?.[j]||0);return t.jsxs(p.Td,{ta:"right",children:[(o.points?.[j]||0).toFixed(1),Math.abs(T)>=.01&&t.jsxs(g,{span:!0,size:"xs",c:T>0?"green":"red",ml:2,children:[T>0?"+":"",T.toFixed(1)]})]},j)}),t.jsxs(p.Td,{ta:"right",fw:600,children:[(o.totalPoints||0).toFixed(1),Math.abs(q)>=.01&&t.jsxs(g,{span:!0,size:"xs",c:q>0?"green":"red",ml:2,children:[q>0?"+":"",q.toFixed(1)]})]}),t.jsxs(p.Td,{ta:"right",children:[M,k!==0&&t.jsxs(g,{span:!0,size:"xs",c:k>0?"green":"red",ml:4,children:[k>0?"+":"",k]})]})]})]})]})}),t.jsx(oi,{beforeStandings:s,afterStandings:r,isPoints:!1,allCats:O,highlightTeamIndexes:[N],label:"Full Standings After Pickup:"}),t.jsxs(g,{size:"xs",c:"dimmed",children:[t.jsx(g,{span:!0,inherit:!0,c:"green",children:"â²"}),"/",t.jsx(g,{span:!0,inherit:!0,c:"red",children:"â¼"})," mark rank changes and ",t.jsx(g,{span:!0,inherit:!0,c:"green",children:"+"}),"/",t.jsx(g,{span:!0,inherit:!0,c:"red",children:"â"})," the category-point shifts caused by your pickup."]})]})};return!l&&!a?t.jsx(Vs,{pageTitle:"Pickup Analyzer",showImportTiles:!0}):S?t.jsxs(ge,{gap:"sm",children:[t.jsx(ut,{height:40}),t.jsx(ut,{height:200}),t.jsx(ut,{height:200})]}):N===null?t.jsxs(ge,{align:"center",py:"xl",children:[t.jsx(g,{c:"dimmed",children:'Set "My Team" in your league setup to use the Pickup Analyzer.'}),t.jsx(ee,{component:Ue,to:`/league-setup?league=${l}`,variant:"outline",children:"Go to League Setup"})]}):I?t.jsxs(ge,{gap:"md",children:[t.jsx(Os,{title:"Pickup Analyzer",context:An.length>0?t.jsxs(Z,{gap:"xs",align:"flex-end",wrap:"wrap",children:[t.jsx(Bt,{label:"Projections",size:"xs",w:200,data:An,value:Et,onChange:Zt}),t.jsx(Is,{sourceName:Et}),t.jsx(Bs,{leagueId:l,onChanged:us})]}):void 0}),t.jsx(Ns,{}),t.jsxs(Oe,{value:R,onChange:L,styles:{tab:{paddingLeft:0,paddingRight:0,marginRight:16}},children:[m?t.jsx(Ve,{type:"auto",mb:"sm",children:t.jsxs(Oe.List,{style:{flexWrap:"nowrap"},children:[t.jsx(Oe.Tab,{value:"evaluate",children:"Pickup"}),t.jsx(Oe.Tab,{value:"ideas",children:"Ideas"})]})}):t.jsxs(Oe.List,{mb:"sm",children:[t.jsx(Oe.Tab,{value:"evaluate",children:"Evaluate Pickup"}),t.jsx(Oe.Tab,{value:"ideas",children:"Pickup Ideas"})]}),t.jsx(Oe.Panel,{value:"ideas",pt:"sm",keepMounted:!0,children:rt?t.jsx(mr,{result:rt,hittingCategories:je.isPoints?[]:je.hitting,pitchingCategories:je.isPoints?[]:je.pitching,onStage:en,stagedPlayerId:V?.id??null,excludedPlayers:ds,onExclude:hs,onUnexclude:ps}):t.jsxs(ge,{children:[t.jsx(ut,{height:28,radius:"sm"}),t.jsx(ut,{height:200,radius:"sm"})]})}),t.jsx(Oe.Panel,{value:"evaluate",pt:"sm",keepMounted:!0,children:t.jsxs(ge,{gap:"md",children:[t.jsx(g,{size:"sm",children:"Click a free agent from the table on the left, then click any player on your roster (lineup or bench) to drop. The free agent takes that lineup slot if eligible, otherwise lands on the bench; use the â buttons on each row to rearrange your lineup before locking in the impact."}),t.jsxs(Ie,{style:{display:"flex",gap:"var(--mantine-spacing-md)",minHeight:500,flexWrap:"wrap"},children:[t.jsxs(ht,{p:"sm",style:{flex:"1 1 560px",minWidth:m?0:320,width:m?"100%":void 0,maxHeight:700,overflow:"hidden",display:"flex",flexDirection:"column"},children:[t.jsxs(Z,{gap:"md",align:"center",mb:"xs",wrap:"nowrap",children:[t.jsx(g,{fw:700,children:"Free Agents"}),t.jsx(ys,{size:"xs",label:"Show my team",checked:le,onChange:s=>Me(s.currentTarget.checked)}),t.jsx(Ie,{style:{marginLeft:"auto"},children:t.jsxs(sn,{opened:ns,onChange:Cn,position:"bottom-end",width:280,withinPortal:!0,shadow:"md",children:[t.jsx(sn.Target,{children:t.jsx(ee,{size:"compact-xs",variant:"default",onClick:()=>Cn(s=>!s),children:"Edit Columns"})}),t.jsx(sn.Dropdown,{children:t.jsx(Ve.Autosize,{mah:360,type:"auto",children:t.jsxs(ge,{gap:"xs",children:[cs.map(s=>t.jsxs(Ie,{children:[t.jsx(g,{size:"xs",fw:700,c:"dimmed",tt:"uppercase",mb:4,children:s.label}),t.jsx(ge,{gap:2,children:s.columns.map(r=>
2t.jsx(vs,{size:"xs",checked:Jt.has(r.id),onChange:()=>ls(r.id),label:r.tooltip?t.jsx(ue,{label:r.tooltip,openDelay:300,multiline:!0,w:220,withArrow:!0,children:t.jsx(g,{size:"xs",span:!0,children:r.label})}):r.label},r.id))})]},s.label)),t.jsx(ee,{size:"compact-xs",variant:"subtle",onClick:os,children:"Reset to Defaults"})]})})})]})})]}),t.jsxs(Z,{gap:"lg",mb:"xs",wrap:"wrap",align:"center",children:[t.jsxs(ee,{size:"compact-xs",color:"gray",variant:Q===Qe?"filled":"light",onClick:()=>at(Qe),children:[ln()," YTD"]}),t.jsxs(Z,{gap:6,align:"center",wrap:"nowrap",children:[t.jsx(g,{size:"xs",c:"dimmed",children:"Trailing"}),t.jsx(ee.Group,{children:[7,14,30,60].map(s=>t.jsx(ee,{size:"compact-xs",color:"gray",variant:Q===`trailing:${s}`?"filled":"default",onClick:()=>at(`trailing:${s}`),children:s},s))}),t.jsx(g,{size:"xs",c:"dimmed",children:"days"})]}),t.jsxs(Z,{gap:6,align:"center",wrap:"nowrap",children:[t.jsx(g,{size:"xs",c:"dimmed",children:"Projections"}),t.jsxs(ee.Group,{children:[t.jsx(ee,{size:"compact-xs",color:"gray",variant:Q==="projections"?"filled":"default",onClick:()=>at("projections"),children:Nt()||"RotoHound RoS"}),t.jsx(ee,{size:"compact-xs",color:"gray",variant:Q==="projections-600pa"?"filled":"default",onClick:()=>at("projections-600pa"),children:"600 PA"})]})]}),t.jsxs(ee,{size:"compact-xs",color:"gray",variant:Q===Je?"filled":"light",onClick:()=>at(Je),children:[rn()," Season"]})]}),t.jsxs(Z,{gap:"xs",mb:"xs",align:"end",children:[t.jsx(ai,{placeholder:"Search players...",size:"xs",value:_,onChange:s=>w(s.currentTarget.value),style:{flex:"1 1 220px"}}),t.jsx(Bt,{label:"Level",size:"xs",w:120,value:ke,onChange:s=>s&&it(s),data:[{value:"all",label:"All Levels"},{value:"mlb",label:"MLB Only"},{value:"milb",label:"MiLB Only"}]}),t.jsx(Bt,{label:"IL Status",size:"xs",w:120,value:pe,onChange:s=>s&&Lt(s),data:Ea})]}),t.jsx(Z,{gap:4,mb:"xs",wrap:"wrap",children:Sr.map(s=>t.jsx(ee,{size:"compact-xs",variant:ie===s.value?"filled":"light",onClick:()=>ft(s.value),children:s.label},s.value))}),t.jsx(Ve,{style:{flex:1},type:"auto",viewportRef:X,children:Kt.length===0?t.jsx(g,{c:"dimmed",ta:"center",py:"md",children:"No free agents found"}):t.jsxs(p,{highlightOnHover:!0,style:{fontSize:11},children:[t.jsx(p.Thead,{style:{position:"sticky",top:0,zIndex:3,background:"var(--mantine-color-body)"},children:t.jsxs(p.Tr,{children:[t.jsxs(p.Th,{onClick:()=>At("player"),style:{cursor:"pointer",position:"sticky",left:0,zIndex:4,background:"var(--mantine-color-body)",minWidth:140},children:["Player ",se==="player"?Ye?"â":"â":""]}),t.jsxs(p.Th,{onClick:()=>At("rank"),title:"Player's $ value rank across all MLB players for the current stats source",style:{cursor:"pointer",textAlign:"right",whiteSpace:"nowrap",width:1},children:["Rk ",se==="rank"?Ye?"â":"â":""]}),Xt&&t.jsxs(p.Th,{onClick:()=>At("impact"),title:"This player's best add/drop move from Pickup Ideas: projected standings points gained and your rank move. Click a value to stage the move.",style:{cursor:"pointer",textAlign:"right",whiteSpace:"nowrap",width:1},children:["+Pts ",se==="impact"?Ye?"â":"â":""]}),Mt.map(s=>t.jsxs(p.Th,{onClick:()=>At(s.id),title:s.tooltip||s.label,style:{cursor:"pointer",textAlign:"center",whiteSpace:"nowrap",paddingLeft:4,paddingRight:4,...qn.has(s.id)?{borderLeft:"2px solid light-dark(#C5CDD5, #4A5261)"}:{}},children:[s.label," ",se===s.id?Ye?"â":"â":""]},s.id))]})}),t.jsx(p.Tbody,{children:gs.map(s=>{const r=Te.has(Number(s.id))||Te.has(Number(D(s.id)));return t.jsx(dr,{player:s,isSelected:V?.id===s.id,isMine:r,rank:kt[String(s.id)],impact:Xt&&!r?Tt(s.id):null,impactColVisible:Xt,isPoints:je.isPoints,playerStatuses:De,toColumnPlayer:Ut,columnCtx:Ct,orderedVisibleCols:Mt,separatorIds:qn,onSelect:Qn,onStage:en},s.id)})})]})})]}),t.jsxs(Ie,{ref:zn,style:{flex:"1 1 320px",minWidth:m?0:280,width:m?"100%":void 0,maxHeight:700,overflowY:"auto"},children:[ms(),Ce&&t.jsx(g,{size:"xs",c:"dimmed",mt:"xs",ta:"center",children:"Scroll down to see projected standings impact when you've completed all desired moves."})]})]}),Ce&&t.jsxs(ge,{gap:"md",ref:is,children:[V&&t.jsxs(g,{fw:600,size:"sm",children:["Pickup ",t.jsx(g,{span:!0,fw:700,c:"green",children:V.name}),Vn?t.jsxs(t.Fragment,{children:[", Drop ",t.jsx(g,{span:!0,fw:700,c:"red",children:Vn})]}):null]}),t.jsxs(ht,{p:"sm",children:[t.jsxs(Z,{justify:"space-between",mb:"sm",wrap:"wrap",children:[t.jsx(ue,{label:"Before and after assume each team fields its best lineup; gains you could get for free by rearranging your current lineup don't count.",withArrow:!0,multiline:!0,maw:300,children:t.jsx(g,{fw:700,style:{cursor:"help"},children:"Projected Statistics Impact"})}),t.jsxs(g,{size:"xs",c:"dimmed",children:["Projection System: ",Nt()||"RotoHound RoS"," · ",t.jsx(ri,{component:Ue,to:`/projections-adp${l?`?league=${l}`:""}`,size:"xs",onClick:()=>window.scrollTo(0,0),children:"Change"})]})]}),bs()]}),t.jsxs(ht,{p:"sm",children:[t.jsx(g,{fw:700,mb:"sm",children:"Projected Standings Impact"}),_s()]})]})]})})]}),t.jsx(ks,{opened:ss,onClose:()=>Pt(!1),title:"Add to Roster",centered:!0,fullScreen:m,children:ae&&t.jsxs(ge,{gap:"md",children:[t.jsx(g,{fw:600,children:ae.name}),t.jsxs(g,{size:"sm",c:"dimmed",children:[ae.primaryPosition," - ",ae.currentTeam]}),t.jsx(Bt,{label:"Team",placeholder:"Select team",data:re.map(s=>({value:String(s.index),label:s.name})),value:Ee,onChange:Dn}),Ke?t.jsx(ai,{label:"Draft Position",placeholder:"e.g. 3.4",value:Wt,onCh
2ange:s=>En(s.currentTarget.value),onKeyDown:s=>{s.key==="Enter"&&Ee!==null&&tn()}}):t.jsx(Ms,{label:"Salary",prefix:"$",min:0,value:Gt,onChange:Ln,onKeyDown:s=>{s.key==="Enter"&&Ee!==null&&tn()}}),t.jsxs(Z,{justify:"flex-end",children:[t.jsx(ee,{variant:"default",onClick:()=>Pt(!1),children:"Cancel"}),t.jsx(ee,{color:"green",onClick:tn,disabled:Ee===null,children:"Confirm"})]})]})})]}):t.jsxs(ge,{align:"center",py:"xl",children:[t.jsx(g,{c:"dimmed",children:"We couldn't load the roster for your selected team. Try refreshing the league data, or reselect your team in league setup if the import changed team order."}),t.jsxs(Z,{children:[t.jsx(ee,{component:Ue,to:`/league-home?league=${l}`,variant:"outline",children:"Back to League Home"}),t.jsx(ee,{component:Ue,to:`/league-setup?league=${l}`,variant:"outline",children:"Go to League Setup"})]})]})}export{Il as PickupAnalyzerPage};
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.