PageSourceSearch

https://club.touchtight.com/assets/index-BWQ867dj.js

js touchtight.com collected 2026-10-02 00:02:32 UTC 44,332 bytes, 6 lines download raw bytes

1import{a as r,j as t}from"./react-vendor-DJtAp8P_.js";import{s as Ft}from"./filters-D4RYviTZ.js";import{s as et}from"./search-DNkl80Xk.js";import{S as rt,g as ya,c as ka,u as Me,d as Sa,F as va,l as Pt,J as wa,v as Ca,bm as Na,bn as Ea,cd as Bt,m as Mt,bk as Ta}from"./app-DT7WuczB.js";import{A as Ia}from"./AddPracticeToSessionModalGate-BB6n61YO.js";import{u as ja}from"./useCollectionsPracticeTypeMap-Diyla1H4.js";import{P as La}from"./index-C1t7uqC1.js";import{C as Dt,a as Ra,b as Aa,Q as Oa,L as _a}from"./CategorySortDropdown-CR9YM-yu.js";import{bg as Fa,bu as Ue,aT as Pa,bD as Ba,bh as Qt,bm as Ma,bi as Da,aW as Ua,at as Ga,aX as Se,cj as Ut}from"./index-CyS3LFy6.js";import{u as Va}from"./useIsTabletOrBelow-XMMGxyyS.js";import{U as qa}from"./index-Dg9Ob-9g.js";import{G as $a,ar as za,aW as Qa,aQ as Ja,aq as Ya,aU as Ha}from"./query-CcmDMjHA.js";import{ar as Ka,bt as Wa,by as Xa}from"./mutation--iSLlBrt.js";import{a as Za}from"./useSuggestedAgeBand-5rJfp5g2.js";import{p as er,j as tr,q as ar}from"./onboardingStorage-VOmd6pEl.js";import{T as rr}from"./TrailerModal-CVX4TgKw.js";import{M as sr}from"./MultiSelectBarV2-YoOpbYEX.js";import{M as or,u as nr}from"./MediaCardV2-CVjrjZCx.js";import{A as ir}from"./AddPlaylistModalV2-CK13cVBA.js";import{PlanBuilder as lr}from"./index-C29Qg2hZ.js";import cr from"./PlanBuilderV2-bNZKSOzf.js";import{L as dr}from"./LibraryLoadingStatus-C7OfBfBE.js";import{s as ur,S as pr,a as Gt}from"./SearchRecovery-CYdbUSRL.js";import{u as mr}from"./useIsMobileShell-BG-PNUUI.js";import{R as Jt}from"./index-CeeFDfJ-.js";import{E as gr}from"./EngineRoomBreadcrumbV2-DyOCPLFM.js";import{T as fr}from"./tokens-BIS2AW1b.js";import{F as Vt}from"./funnel-CHKnj2yC.js";import{A as hr}from"./arrow-up-Bnsw1-8C.js";import{D as br}from"./DesktopBulkBar-CKYIlLDP.js";import{B as xr}from"./bookmark-D81rgROb.js";import{c as yr}from"./compact-DZdspzxW.js";import{v as kr}from"./values-DeBIqcD0.js";import{m as tt}from"./map-BI8CQ8np.js";import{i as Sr}from"./isNil-R7kYXCYw.js";import{u as vr,e as De,n as at}from"./apollo-DL0KWP0Y.js";import"./mui-styles-C9F12l22.js";import"./babel-helpers-D2wBBc1I.js";import"./dayjs-CFxoC4n5.js";import"./swiper-react-DcF17yCe.js";import"./SessionPlannerMobile-85wkJ1ZS.js";import"./mui-DvP2hOwX.js";import"./moment-Bj79pgB5.js";import"./Modal-BzPnYVEi.js";import"./Button-C4goEOKP.js";import"./imageOptimization-zUL1CBPb.js";import"./index.esm-CWqXbt53.js";import"./_baseClone-DByvJCmO.js";import"./_baseAssignValue-CjtYt4eh.js";import"./cloneDeep-mVQ3twB2.js";import"./Search-BEYvHCFs.js";import"./lodash-icp7yO-G.js";import"./merge-TfBrBrIh.js";import"./isArrayLikeObject-CcVCHQro.js";import"./browser-B3fhYDhb.js";import"./_arrayIncludes-DFQcso6E.js";import"./_baseIndexOf-DqPIyCu4.js";import"./hello-pangea-dnd-1bhs5THC.js";import"./some-YFJAbcVi.js";import"./index-B79atc36.js";import"./_baseDifference-BHjDay7E.js";import"./omit-BaIHraq0.js";import"./index-bEsv4Yks.js";import"./mui-x-DMY3qA32.js";import"./s3FileHandler-Bp64keCt.js";import"./seededSessionFill-BljGszd4.js";import"./popover-DQmY_bgT.js";import"./index-C53T7JDS.js";import"./floating-ui.dom-CpqR1Q5s.js";import"./index-CrwW5ro-.js";import"./subMonths-CpZP7vPB.js";import"./chevron-left-hHkvU2-n.js";import"./chevron-right-Bx281FLM.js";import"./sessionSections-a-lprBoU.js";import"./index-CvVUxn0l.js";import"./check-njpSxvzl.js";import"./index-Cor9x_UP.js";import"./checkbox-BCFY1QRf.js";import"./input-CuTRSUQZ.js";import"./editable-input-BbmoAFqJ.js";import"./chevron-down-D9vZfud1.js";import"./label-DlgL8a7V.js";import"./plus-jTnJ9Ylg.js";import"./arrow-right-CPcr9UUY.js";import"./footballize-CKQT9bi3.js";import"./rotate-cw-C3CCEtsC.js";import"./plainText-DBpeJa6y.js";import"./index-DFAqAA9H.js";import"./star-DNcD-a5x.js";import"./heart-SY2Qtxi5.js";import"./calendar-range-BRkGfDrQ.js";import"./list-plus-jbEUR6Jd.js";import"./arrow-down-oYUkFNnA.js";import"./arrow-up-right-BHTble7A.js";import"./ellipsis-BPffiR7H.js";import"./trash-2-B3r-aJQU.js";import"./folder-plus-BuJChPs4.js";import"./share-2-BcYbamX-.js";import"./useHoverTrailerV2-C_vNBnFz.js";import"./play-CBxhfLg4.js";import"./imageUrl-gCnBcCAn.js";import"./VideoPlayerModal-BgJm66DJ.js";import"./CreateEditSeasonModal-CSydoVwi.js";import"./AlertModal-CGXcj45Q.js";import"./DatePicker-BFwkswR8.js";import"./SortMenu-CjsJdGGV.js";import"./DeleteModal-BX6BaNP3.js";import"./Tabs-lVcpmzV2.js";import"./SearchHeader-BOq_PWig.js";import"./Filter-vdZeYdaV.js";import"./SearchBlue-Cq--C03-.js";import"./omitBy-CVfI2Mdq.js";import"./_basePickBy-jHhPNsuZ.js";import"./index-ngBBROCs.js";import"./select-BkBd-IXy.js";import"./index-DbR5jsy0.js";import"./index-CMsqgI2o.js";import"./chevron-up-Cdk80VBZ.js";import"./index-Dmrtjh9z.js";import"./index-DI7EGspv.js";import"./index-BV4DY1_C.js";import"./dropdown-menu-Cf_HXWjm.js";import"./triangle-alert-BdPscC9S.js";import"./calendar-clock-DLaUufr_.js";import"./sparkles-DgxfdHqs.js";import"./index-CUzDeUYg.js";import"./index-CB0mj_O3.js";import"./rotate-ccw-i0PdhBGb.js";import"./grip-vertical-B3X-bmLk.js";import"./lightbulb-CluGZi-m.js";import"./buildSessionPdfDocument-Cr4fNpTl.js";import"./switch-DVTTALDv.js";import"./mapKeys-BOig4Tgf.js";try{let s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new s.Error().stack;
1n&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[n]="add9894a-88d5-4a00-9030-ea6c3cf13ab5",s._sentryDebugIdIdentifier="sentry-dbid-add9894a-88d5-4a00-9030-ea6c3cf13ab5")}catch{}/**
2 * @license lucide-react v1.31.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const wr=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Cr=Fa("mouse-pointer-click",wr);function qt({active:s,onClick:n,children:u}){return t.jsxs("button",{type:"button","aria-pressed":s,onClick:n,className:Ue("v3-filter-chip flex-shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-sm border font-head font-semibold text-xs tab:text-[13px] uppercase tracking-wide6 whitespace-nowrap cursor-pointer transition-colors",s?"border-accent bg-[rgba(255,128,208,0.15)] text-fg":"border-tt-border bg-transparent text-white hover:text-fg"),children:[s&&t.jsx("span",{"aria-hidden":!0,className:"text-accent text-[8px] leading-none",children:"●"}),u]})}function Nr({filterGroups:s,selectedTags:n,onToggleTag:u,onClearGroup:v,className:i,collapsed:S=!1}){const[h,m]=r.useState(null),l=r.useMemo(()=>!s||s.length===0?null:s.find(y=>y.name===h)??s[0],[s,h]);if(!l)return null;const P=n[l.name]??[];return t.jsxs("div",{role:"group","aria-label":"Filters",className:Ue("bg-bg border-b border-hairline",i),children:[!S&&t.jsx("div",{className:"flex items-center gap-3 overflow-x-auto overflow-y-hidden overscroll-x-contain border-b border-hairline py-1.5",children:s.map(y=>{var D;const M=y.name===l.name,w=(((D=n[y.name])==null?void 0:D.length)??0)>0;return t.jsxs("button",{type:"button","aria-pressed":M,onClick:()=>m(y.name),className:Ue("v3-filter-tab flex-shrink-0 inline-flex items-center gap-1.5 border-b-2 border-solid px-1 py-1 font-head font-bold uppercase text-xs tab:text-[13px] tracking-wide6 whitespace-nowrap cursor-pointer transition-colors",M?"border-accent text-fg":"border-transparent text-white hover:text-fg"),children:[y.displayName,w&&t.jsx("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full bg-accent align-middle"})]},y.name)})}),t.jsxs("div",{className:"flex items-center gap-2 overflow-x-auto overflow-y-hidden overscroll-x-contain py-1.5",children:[t.jsx(qt,{active:P.length===0,onClick:()=>v(l.name),children:"All"}),l.tags.map(y=>t.jsx(qt,{active:P.includes(y.id),onClick:()=>u(l.name,y.id),children:y.name},y.id))]})]})}const Er=[{label:"Library",to:"/engine-room/home"},{label:"Sessions",to:"/dugout/sessions"},{label:"Animations",to:"/animation"},{label:"The Gaffer",to:"/the-gaffer"},{label:"Dugout",to:"/dugout/dashboard"},{label:"Stats",to:"/dugout/players"}];function Tr({activeTeamName:s,searchValue:n="",onSearchChange:u,moduleLabel:v="Engine Room",hideWordmark:i=!1,hideModuleLabel:S=!1,hideTeamChip:h=!1,hideTabs:m=!1,hideSearch:l=!1}){const P=Pa(),y=s?s.toUpperCase():"NO TEAM SET",M=!i||!S||!h;return t.jsx("header",{className:"sticky top-0 z-30 bg-gradient-to-b from-[#0a0d12] to-[#06080c] border-b border-hairline",children:t.jsxs("div",{className:"max-w-[1440px] mx-auto px-7 py-3 flex items-center justify-between gap-6",children:[M&&t.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[!i&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-head font-bold text-[15px] text-fg tracking-wide2",children:"Touchtight"}),t.jsx("span",{className:"w-px h-5 bg-hairline"})]}),!S&&t.jsx("span",{className:"font-head font-bold text-[17px] uppercase tracking-wide4 text-accent-2",children:v}),!h&&t.jsxs("span",{className:"hidden lg:inline font-mono text-[9.5px] uppercase tracking-wide10 text-subtle ml-2 truncate",children:["· ",y]})]}),!m&&t.jsx("nav",{className:"hidden md:flex items-center gap-1 flex-1 justify-center",children:Er.map(w=>{const D=P.pathname.startsWith(w.to.split("?")[0]);return t.jsx(Ba,{to:w.to,className:Ue("font-head text-[13.5px] uppercase tracking-wide10 px-4 py-2.5","border-b-2 border-transparent transition-colors",D?"font-bold text-fg border-accent":"font-medium text-muted hover:text-fg"),children:w.label},w.to)})}),t.jsx("div",{className:"flex items-center gap-3 min-w-0",children:!l&&t.jsxs("div",{className:"hidden lg:flex items-center gap-2 bg-card border border-tt-border rounded-[3px] px-3 py-2 w-[280px]",children:[t.jsx(rt,{className:"w-3.5 h-3.5 text-subtle flex-shrink-0"}),t.jsx("input",{type:"search",placeholder:"Search drills, sessions, themes…",value:n,onChange:w=>u==null?void 0:u(w.target.value),className:"bg-transparent border-0 outline-none text-[13px] text-fg placeholder:text-subtle flex-1 min-w-0"})]})})]})})}function Ir(s,n,u){const v=[];n&&v.push({key:"search",label:`"${n}"`,kind:"search"});for(const i of u){const S=s[i.name];if(S!=null&&S.length)for(const h of S){const m=i.tags.find(l=>l.id===h);m&&v.push({key:`${i.name}:${h}`,label:m.name,kind:"tag",groupName:i.name,tagId:h})}}return v}function jr({isFilterApplied:s,selectedTags:n,searchTerm:u,filterGroups:v,onRemoveTag:i,onRemoveSearch:S,onClearAll:h}
6){if(!s)return null;const m=Ir(n,u,v);return m.length===0?null:t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 border-b border-hairline pb-2",children:[t.jsx("span",{className:"font-head text-[11px] uppercase tracking-wide10 text-accent-2",children:"Applied"}),m.map(l=>t.jsxs("button",{type:"button",onClick:()=>l.kind==="search"?S():i(l.groupName,l.tagId),className:"group inline-flex flex-shrink-0 items-center gap-1.5 rounded-sm border border-accent bg-accent/15 px-2.5 py-1.5 font-head font-semibold text-[11px] uppercase tracking-wide6 text-fg hover:bg-accent/25","aria-label":`Remove filter ${l.label}`,children:[t.jsx("span",{children:l.label}),t.jsx(Qt,{size:11,"aria-hidden":!0,className:"opacity-70 group-hover:opacity-100"})]},l.key)),t.jsx("button",{type:"button",onClick:h,className:"ml-2 font-head text-[11px] uppercase tracking-wide10 text-muted underline-offset-4 hover:text-accent hover:underline",children:"Clear all"})]})}function Lr(s){if(!s)return[];try{const n=JSON.parse(s);return Array.isArray(n)?n.map(u=>typeof u=="string"?u:(u==null?void 0:u.name)??(u==null?void 0:u.label)??"").filter(u=>typeof u=="string"&&u.length>0):[]}catch{return[]}}function Rr({rows:s,savedIds:n,selectedIds:u,selectMode:v,isReadOnlyMode:i,isLoading:S,showPracticeTypeTags:h,onCardClick:m,detailFirst:l,onToggleLike:P,onToggleSave:y,onPlayTrailer:M,onPlayClick:w,onAddToSession:D,onAddToPlaylist:j,onToggleSelect:se,isSeasonPlan:C}){return S&&s.length===0?t.jsx("section",{className:"mt-1.5",children:t.jsx("div",{className:"grid grid-cols-1 gap-2.5 [@media(min-width:560px)_and_(max-width:1023px)]:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4",children:Array.from({length:12}).map((k,q)=>t.jsx("div",{className:"aspect-[4/5] animate-pulse rounded-md border border-hairline bg-bg-raised"},q))})}):t.jsxs("section",{className:"mt-1.5",children:[t.jsx("div",{className:"grid grid-cols-1 gap-2.5 [@media(min-width:560px)_and_(max-width:1023px)]:grid-cols-2 sm:gap-3 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4",children:s.map((k,q)=>t.jsx(or,{index:q,item:k,isSaved:n.has(Number(k.id)),isLiked:k.isLikedByUser??!1,onToggleLike:P?()=>P(k):void 0,selectMode:v,isSelected:u.has(Number(k.id)),tags:h?Lr(k.practiceTypeTags):void 0,fillCell:!0,onOpen:()=>m(k),onPlayTrailer:()=>M(k),onPlayClick:w?()=>w(k):void 0,detailFirst:l,onToggleSave:i?void 0:()=>y(k),onAddToSession:i?void 0:()=>D(k),onAddToPlaylist:i?void 0:()=>j(k),onToggleSelect:i?void 0:()=>se(k),isSeasonPlan:C},k.id))}),t.jsx(dr,{loading:S&&s.length>0})]})}const Ar={"practices / drills":"Focused drills sharpening technique, decisions and game intelligence.","full sessions":"Ready-to-run sessions: warm-up, main theme, finishing games.","session plans":"Structured multi-week plans for coaching across the season.","season plans":"Long-term blueprints linking themes, blocks and player development.","2024-25 season plans":"Long-term blueprints linking themes, blocks and player development.","position specific":"Content developing each position's role and movement.","position specific - player game understanding":"Content developing each position's role and movement.","position specific coaching themes":"Content developing each position's role and movement.","pre-season":"Building fitness, sharpness and team cohesion before kickoff.","pre season":"Building fitness, sharpness and team cohesion before kickoff.",finishing:"Goalscoring practices improving composure and finishing under pressure.",defending:"Defensive drills for pressing, shape, tackling and recovery.",possession:"Possession practices to retain the ball and control tempo.",attacking:"Attacking practices creating chances, breaking lines, exploiting space.",rondos:"Rondo drills sharpening passing, movement and quick decisions.","warm ups":"Dynamic warm-ups preparing players for training.","set pieces":"Routines for corners, free-kicks and throw-ins.",goalkeeping:"Goalkeeper drills for handling, footwork, distribution and shot-stopping.","ball mastery":"Exercises developing close control, coordination and confidence.","phases of play":"Practices rehearsing real game attacking scenarios.","counter attacking":"Transition practices attacking quickly after winning possession.","switching play":"Practices switching play to exploit width and space.","formations & tactics":"Content explaining formations, roles and how systems work.","coaching themes":"Themed content grouped around key principles of play.",games:"Small-sided games making training competitive, fun and realistic.","passing (technical drills)":"Technical passing drills improving accuracy, timing and touch.","shape / patterns":"Patterns rehearsing team shape, movement and combinations.","functional practices":"Practices coaching units within realistic game situations.","wave practice":"Continuous practices repeating attacking and defending actions.",individual:"Individual practices to develop core technical skills.","fun games and races":"Fun games and races keeping young players engaged.","11 v 11":"Eleven-a-side practices rehearsing shape, transitions and management.",futsal:"Futsal drills developing close control and quick combinations.","featured soccer coaching content":"Hand-picked highlights from the Touchtight coaching library.","latest releases (all content)":"The newest drills, sessions and plans added recently.","trending now":"Popular content coaches are watching and using now.","most popular":"The most-watched, highly-rated content across the library.","all time favourites":"Coach favourites that consistently deliver great sessions.","new soccer drills":"Freshly added drills keeping your training varied and current.","new soccer sessions":"Freshly added sessions ready to run with your squad.","pre-season soccer drills":"Pre-season drills building fitness and sharpness before kickoff.","pre season soccer sessions":"Pre-season sessions preparing your team for the campaign.","free practices / drills":"A free selection sampling the coaching library.","under 8's - mini baller practices":"Mini-baller practices making first football fun for under-eights."};function Or(s){const n=(s??"").trim();if(!n)return"";const u=Ar[n.toLowerCase()];return u||`Explore ${n} in the Touchtight coaching library.`}function _r({title:s,count:n,isLoading:u}){const v=s||"—",i=Or(s);return t.jsxs("header",{className:"flex flex-col gap-0.5 border-b border-hairline pb-1",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[t.jsx("h1",{className:"v3-category-title truncate whitespace-nowrap font-head uppercase text-[24px] leading-[0.95] tracking-tight sm:text-[28px] md:text-[34px] lg:text-[40px]",children:v}),n>0?t.jsx(Jt,{size:"md",count:n,label:n===1?"item":"items",className:"shrink-0"}):null]}),t.jsx("div",{className:"hidden tab:block",children:t.jsx(gr,{trail:[{label:"Engine Room",href:"/engine-room/home"},{label:u?"…":s||"—"}]})}),i?t.jsx("p",{className:"font-body text-[12.5px] leading-snug text-muted tab:hidden",children:i}):null]})}const Fr=140,Pr=56;function Br({title:s,count:n,categoryId:u,isLoading:v,sortBy:i,sortOrder:S,onSortChange:h,hasAgeGroupFilter:m,hasNumberOfPlayersFilter:l,hasPitchSizeFilter:P,isPracticeAndDrills:y,useDropdownSort:M,searchValue:w,onSearchChange:D,activeFilterCount:j,onOpenFilters:se,selectMode:C,selectedCount:k,onToggleSelectMode:q,topSlot:$}){const[Q,ae]=r.useState(!1),W=mr(),[O,L]=r.useState(!1),U=O||w.length>0,_=W&&Q;r.useEffect(()=>{const T=W?window:document.querySelector("main")??window;let z=0;const G=()=>{z=0;const g=T===window?window.scrollY:T.scrollTop;ae(B=>!B&&g>Fr?!0:B&&g<Pr?!1:B)},ve=()=>{z===0&&(z=window.requestAnimationFrame(G))};return G(),T.addEventListener("scroll",ve,{passive:!0}),()=>{z!==0&&window.cancelAnimationFrame(z),T.removeEventListener("scroll",ve)}},[W]);const Ge=(s||"").toUpperCase(),J=fr[s]??null,R=J?`${J[0]} ${J[1]}`.trim():Ge||"—",de=()=>{const z=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",G=W?window:document.querySelector("main")??window;G===window?window.scrollTo({top:0,behavior:z}):G.scrollTo({top:0,behavior:z})},ue=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("button",{type:"button",onClick:de,"aria-label":"Scroll to top",className:"grid h-8 w-8 shrink-0 place-items-center rounded-md text-accent-2 hover:bg-accent-2/10",children:t.jsx(hr,{size:16,"aria-hidden":!0})}),t.jsx("span",{className:"truncate font-head text-[15px] uppercase leading-tight tracking-tight text-fg",children:R}),n>0&&t.jsx(Jt,{size:"sm",count:n,label:"items",className:"shrink-0"})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsxs("button",{type:"button",onClick:se,"aria-label":`Filters${j>0?` (${j} active)`:""}`,className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border px-2.5 py-1.5 font-head text-xs uppercase tracking-wide10 "+(j>0?"border-accent bg-accent/15 text-fg":"border-tt-border text-fg hover:border-accent-2 hover:text-accent-2"),children:[t.jsx(Vt,{size:14,"aria-hidden":!0}),j>0&&t.jsx("span",{children:j})]}),t.jsx(Dt,{includeCategoryOrder:u!==100,compact:!0,sortBy:i,sortOrder:S,onChange:h,hasAgeGroupFilter:m,hasNumberOfPlayersFilter:l,hasPitchSizeFilter:P,isPracticeAndDrills:y})]})]});return t.jsxs(t.Fragment,{children:[W&&t.jsx("div",{className:"fixed inset-x-0 z-[13] border-b border-tt-border bg-bg-raised/95 px-4 backdrop-blur-[10px] motion-reduce:transition-none transition-[opacity,transform] duration-150",style:{to
6p:"var(--shell-top, 0px)",opacity:Q?1:0,transform:Q?"translateY(0)":"translateY(-8px)",pointerEvents:Q?"auto":"none"},"aria-hidden":!Q,children:t.jsx("div",{className:"mx-auto flex max-w-[1600px] items-center justify-between gap-2 py-2",children:ue})}),t.jsxs("div",{className:(W?"sticky top-0 z-[12] transform-gpu bg-bg-raised/92 backdrop-blur-[10px] [backface-visibility:hidden]":"relative bg-bg-raised")+" -mx-4 border-b border-tt-border px-4 motion-reduce:transition-none sm:-mx-5 sm:px-5 md:-mx-6 md:px-6 xl:-mx-7 xl:px-7","data-collapsed":_?"true":"false",children:[$==null?void 0:$(Q),t.jsxs("div",{className:"motion-reduce:transition-none transition-[max-height,opacity,padding] duration-200 ease-out overflow-hidden",style:{maxHeight:_?0:480,opacity:_?0:1,paddingTop:_?0:6,paddingBottom:_?0:4,pointerEvents:_?"none":"auto"},"aria-hidden":_,children:[t.jsx(_r,{title:s,count:n,isLoading:v,id:u}),t.jsxs("div",{className:"mt-1.5 flex flex-nowrap items-center gap-2 md:flex-wrap md:justify-between",children:[M?t.jsx(Dt,{includeCategoryOrder:u!==100,compact:!0,sortBy:i,sortOrder:S,onChange:h,hasAgeGroupFilter:m,hasNumberOfPlayersFilter:l,hasPitchSizeFilter:P,isPracticeAndDrills:y}):t.jsx(Ra,{includeCategoryOrder:u!==100,sortBy:i,sortOrder:S,onChange:h,hasAgeGroupFilter:m,hasNumberOfPlayersFilter:l,hasPitchSizeFilter:P,isPracticeAndDrills:y}),t.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2 md:w-auto md:flex-none",children:[U?t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 rounded-md border border-tt-border bg-card px-3 py-1.5 md:w-[200px] md:flex-none",children:[t.jsx(rt,{size:14,className:"flex-shrink-0 text-subtle","aria-hidden":!0}),t.jsx("input",{type:"search",autoFocus:!0,placeholder:"Search drills, sessions, themes…",value:w,onChange:T=>D(T.target.value),onBlur:()=>{w||L(!1)},className:"w-full min-w-0 border-0 bg-transparent font-body text-[13px] text-fg outline-none placeholder:text-subtle"}),w.length>0&&t.jsx("button",{type:"button",onClick:()=>{D(""),L(!1)},"aria-label":"Clear search",className:"text-subtle hover:text-fg",children:t.jsx(Qt,{size:14,"aria-hidden":!0})})]}):t.jsx("button",{type:"button",onClick:()=>L(!0),"aria-label":"Search",className:"inline-flex items-center justify-center rounded-md border border-tt-border px-2.5 py-1.5 text-fg hover:border-accent-2 hover:text-accent-2",children:t.jsx(rt,{size:14,"aria-hidden":!0})}),t.jsxs("button",{type:"button",onClick:se,"aria-label":`Filters${j>0?` (${j} active)`:""}`,className:"inline-flex shrink-0 items-center gap-1.5 rounded-md border px-2.5 py-1.5 font-head text-xs uppercase tracking-wide10 "+(j>0?"border-accent bg-accent/15 text-fg":"border-tt-border text-fg hover:border-accent-2 hover:text-accent-2"),children:[t.jsx(Vt,{size:14,"aria-hidden":!0}),t.jsx("span",{className:"hidden min-[400px]:inline",children:"Filters"}),j>0&&t.jsx("span",{children:j})]}),t.jsxs("button",{type:"button",onClick:q,"aria-label":C?`Select (${k} selected)`:"Select",className:"inline-flex shrink-0 items-center gap-1.5 rounded-md border px-2.5 py-1.5 font-head text-xs uppercase tracking-wide10 "+(C?"border-accent-2 bg-accent-2/15 text-fg":"border-tt-border text-fg hover:border-accent-2 hover:text-accent-2"),children:[t.jsx(Cr,{size:14,"aria-hidden":!0}),t.jsx("span",{className:"hidden min-[460px]:inline",children:"Select"}),C&&t.jsx("span",{children:k})]})]})]})]})]})]})}function Mr({on:s,onToggle:n,savedCount:u,visibleSavedCount:v}){return u===0?null:t.jsx("div",{className:"border-b border-hairline px-6 py-4",children:t.jsxs("button",{type:"button",role:"switch","aria-checked":s,onClick:()=>n(!s),className:"flex w-full items-center justify-between gap-3 text-left",children:[t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(xr,{size:14,"aria-hidden":!0,className:s?"text-accent":"text-muted"}),t.jsx("span",{className:"font-head text-sm uppercase tracking-wide10 text-fg",children:"My bookmarks"})]}),t.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wide10 text-subtle",children:[v," saved in view"]})]}),t.jsx("span",{className:"relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors "+(s?"bg-accent border-accent":"bg-card-hi border-tt-border"),children:t.jsx("span",{className:"inline-block h-5 w-5 transform rounded-full bg-fg transition-transform "+(s?"translate-x-5":"translate-x-0.5")})})]})})}function $t(s){return`${s.categoryId}:${s.generation}:${s.page}`}function Dr(s,n,u){return s.categoryId===n&&s.generation===u}function Ur(s,n){var i;const u=String(s??"").trim().match(/^(\d-?\d-?\d(?:-?\d)?)\s+content$/i);if(!u)return null;const v=u[1].replace(/-/g,"");if([...v].reduce((S,h)=>S+Number(h),0)!==10)return null;for(const S of Object.values(n??{}))for(const h of S??[]){const m=(i=h.tags)==null?void 0:i.find(l=>String(l.name).replace(/-/g,"").trim()===v);if(m&&Number.isFinite(Number(m.id)))return Number(m.id)}return null}const zt=12,ce=100;function hn(){var Tt,It,jt,Lt,Rt,At,Ot;const s=ya(),n=ka(),u=Me(e=>e.club),v=(n==null?void 0:n.id)!=null?Number(n.id):void 0,i=Me(e=>e.user.userPermission),{isReadOnlyMode:S}=Sa(),[h]=va(),{id:m=""}=Ma(),l=Number(m),P=ur(n==null?void 0:n.id,(u==null?void 0:u.id)??(n==null?void 0:n.club_id),m),y=Da(),M=vr(),w=nr(),D=Va(),j=Me(e=>{var a,o;return((o=(a=e.filters.engineRoom)==null?void 0:a.category)==null?void 0:o[m])||{}}),se=Pt(j),C=Me(e=>{var a;return((a=e.search.engineRoom)==null?void 0:a.category)||""}),[k,q]=r.useState(!0),[$,Q]=r.useState(!1),[ae,W]=r.useState({}),[O,L]=r.useState([]),[U,_]=r.useState(0),[Ge,J]=r.useState(!1),[R,de]=r.useState({}),ue=Pt(R),[T,z]=r.useState([]),[G,ve]=r.useState({}),[g,B]=r.useState(null),[A,X]=r.useState([]),[st,Yt]=r.useState(!1),[re,Ht]=r.useState([]),[pe,we]=r.useState(!1),[Kt,me]=r.useState(!1),[Wt,oe]=r.useState(!1),[Xt,Ce]=r.useState(!1),[ot,Ne]=r.useState(!1),[nt,Ee]=r.useState(!1),Zt=wa("v2-plan-builder"),[ea,it]=r.useState(!1),[ne,ge]=r.useState(!1),[ta,fe]=r.useState([]),[aa,lt]=r.useState([]),ra=ja(aa,ot),[ct,sa]=r.useState(0),[dt,Y]=r.useState(-1),[N,V]=r.useState({page:0,value:l===ce?"created_at":"manual",order:l===ce?"DESC":"ASC",searchQuery:C}),he=r.useRef(null),Te=r.useRef(null),Ie=r.useRef(null),ut=r.useRef(l),je=r.useRef(0),be=r.useRef(null);r.useLayoutEffect(()=>{ut.current=l,je.current+=1,be.current=null},[l,C,ue,N.value,N.order]);const Z=Se.FULL_SESSIONS===l,H=[Se.WEEK_PLANS_46,Se.SEASON_PLANS].includes(l),Le=Se.PRACTICE_AND_DRILLS===l,ie=n==null?void 0:n.userRolesPermissions,oa=((jt=(It=(Tt=ie==null?void 0:ie.permissions)==null?void 0:Tt.dugout)==null?void 0:It.sessions)==null?void 0:jt.manage)===Ua.YES,na=((At=(Rt=(Lt=ie==null?void 0:ie.permissions)==null?void 0:Lt.engineRoom)==null?void 0:Rt.weeklySeasonPlans)==null?void 0:At.add)??!1,{data:Re,loading:pt,error:Ve,refetch:ia}=De($a,{variables:{validSearchFiltersInput:{}},skip:!!(T!=null&&T.length),fetchPolicy:"cache-first"}),xe=!pt&&(!!Ve||!!Re&&((Ot=Re.getValidSearchFilters)==null?void 0:Ot.data)==null),qe=r.useRef(!1);r.useEffect(()=>{xe&&!qe.current&&(qe.current=!0,Ga(Ve??new Error("getValidSearchFilters returned null data"),{tags:{feature:"er-filters",surface:"category-v2"},extra:{categoryId:m,input:"bulk"}})),xe||(qe.current=!1)},[xe,Ve,m]);const{data:mt,loading:ee}
6=De(za,{variables:{singleRowInput:{id:l,userId:v}},fetchPolicy:"cache-first",skip:!(n!=null&&n.id)||!l}),{data:Ae}=De(Qa,{skip:!(n!=null&&n.id),variables:{listCategoriesInput:{userId:v,pagination:!0,limit:100,offset:0,sortBy:"position",sortOrder:"ASC",filter:{collectionTitle:"",tagIds:[]}}},fetchPolicy:"cache-first"}),la=r.useMemo(()=>{var a,o;const e=((o=(a=Ae==null?void 0:Ae.categoriesList)==null?void 0:a.data)==null?void 0:o.rows)??[];return Aa(e,{requireNonEmpty:!0})},[Ae]),ca=r.useCallback(e=>{y(`/categories/${e}`)},[y]),{data:gt,refetch:le}=De(Ja,{variables:{saveForLaterLiteInput:{type:"ENGINE_ROOM_COLLECTION"}},fetchPolicy:"no-cache",skip:!(n!=null&&n.id)}),[$e]=at(Ka),[ft]=at(Wa),[Oe]=at(Xa),[da,ze]=r.useState([]),[Qe,Je]=r.useState(null);r.useEffect(()=>{var o,d;const e=gt,a=((d=(o=e==null?void 0:e.saveForLaterEntriesLite)==null?void 0:o.data)==null?void 0:d.savedForLaterEntries)??[];Ht(a)},[gt]),r.useEffect(()=>{var a;const e=Re;(a=e==null?void 0:e.getValidSearchFilters)!=null&&a.data&&ve(e.getValidSearchFilters.data)},[Re]),r.useEffect(()=>{var a;const e=mt;if((a=e==null?void 0:e.categoryDetails)!=null&&a.data){W(e.categoryDetails.data);const o=G[m??"Homepage"];o&&z(o)}},[mt,G,m]);const _e=r.useMemo(()=>{const e=ae;return Number(e.id)!==l?null:Ur(e.title,G)},[ae,G,l]),ht=r.useRef(_e);ht.current=_e,r.useEffect(()=>{_e!=null&&(L([]),Y(-1),V(e=>({...e,page:0})))},[_e]);const Fe=r.useCallback(async(e,a)=>{var b;const o={categoryId:l,page:N.page,generation:je.current},d=$t(o),f=()=>Dr(o,ut.current,je.current);q(!0),Q(!1);try{const E=yr(kr(a??R)),p=ht.current,c=await M.query({query:Ya,variables:{listCategoryCollectionsInput:{userId:v,limit:zt,offset:N.page*zt,sortBy:N.value,sortOrder:N.order,filter:p?{tagIds:[[p],...E],title:e??C,categoryIds:[]}:{tagIds:E,title:e??C,categoryIds:[l]}}},fetchPolicy:"network-only"});if(!f())return;const x=(b=c.data.getCategoryCollections)==null?void 0:b.data;if(!x||!Array.isArray(x.rows)||!Number.isFinite(x.count)||Number(x.count)<0)throw new Error("Category results unavailable");const F=(x==null?void 0:x.rows)??[],I=Z?F.filter(Ze=>{var _t;return(((_t=Ze.videos)==null?void 0:_t.length)??0)>1}):F,K=F.length-I.length,xa=Z?Math.max(((x==null?void 0:x.count)??0)-K,0):(x==null?void 0:x.count)??0;L(Ze=>o.page===0?I:[...Ze,...I]),_(xa),Y(o.page)}catch{f()&&Q(!0)}finally{f()&&q(!1),be.current===d&&(be.current=null)}},[M,v,N.page,N.value,N.order,C,ue,l,Z]),Pe=r.useCallback(e=>{var o,d;const a=e.content_type==="collection"?e.id:((d=(o=e.videos)==null?void 0:o[0])==null?void 0:d.id)??e.id;return Ca(e.title??"",a,e.id,e.content_type)},[]),ye=r.useCallback(e=>{localStorage.removeItem("scrollPositionRelatedVideos"),localStorage.removeItem("isLikedByUser"),localStorage.removeItem("ratingsData"),localStorage.removeItem("isUserViewed");const a={category:{collections:[...O],collectionCount:U,filters:N,scrollPosition:ct,lastSelectedCollectionId:e.id,lastSelectedCategoryId:m}};window.localStorage.setItem("categoryState",JSON.stringify(a)),y(`/collections?${Pe(e)}`)},[O,U,N,ct,m,y,Pe]),bt=r.useCallback(e=>{if(w){y(`/collections?${Pe(e)}`);return}B(e),we(!0)},[w,y,Pe]),ua=r.useCallback(e=>{Le||Z?bt(e):ye(e)},[Le,Z,bt,ye]);r.useEffect(()=>{var f,b,E;if(!pe||!(g!=null&&g.id)){ze([]),Je(null);return}let e=!1;const o=ae.title||((E=(b=(f=Object.entries(Se).find(([,p])=>p===l))==null?void 0:f[0])==null?void 0:b.replace(/_/g," "))==null?void 0:E.replace(/\b\w/g,p=>p.toUpperCase()))||"Category",d=[{id:l,title:o}];return ze(d),M.query({query:Ha,variables:{collectionLinkedDataInput:{collectionId:g.id}},fetchPolicy:"no-cache"}).then(p=>{var F,I;if(e)return;const c=((I=(F=p.data)==null?void 0:F.getCollectionCategories)==null?void 0:I.categories)??[];if(c.length===0)return;const x=c.some(K=>Number(K.id)===l);ze(x?c:[...d,...c])}).catch(()=>{}),Je(g.likes??null),()=>{e=!0}},[pe,g,M,ae,l]);const xt=r.useCallback(async()=>{var b,E;if(!(g!=null&&g.id))return;const e=Number(g.id),a=!(g.isLikedByUser??!1),o=l===ce&&!a,d=O.findIndex(p=>Number(p.id)===e),f=d>=0?O[d]:g;o&&(L(p=>p.filter(c=>Number(c.id)!==e)),_(p=>Math.max(0,p-1))),B(p=>p&&{...p,isLikedByUser:a});try{const c=(E=(b=(await Oe({variables:{likeCollectionInput:{id:e,status:a}},fetchPolicy:"no-cache"})).data)==null?void 0:b.likeCollection)==null?void 0:E.data;if(!c)throw new Error("Like mutation returned no data");Je(c.likesCount??Qe),B(x=>x&&{...x,isLikedByUser:c.likedByUser,likes:c.likesCount}),window.localStorage.setItem("isLikedByUser",JSON.stringify(c.likedByUser)),c.likedByUser||h({msg:"Removed from My Liked Content",variant:"success"})}catch(p){console.error("[EngineRoomCategoryV2] drawer like failed",p),B(c=>c&&{...c,isLikedByUser:!a}),o&&(L(c=>{if(c.some(F=>Number(F.id)===e))return c;const x=[...c];return x.splice(Math.max(0,d),0,f),x}),_(c=>c+1)),h({msg:"Could not update like. Try again.",variant:"error"})}},[g,l,O,Oe,Qe,h]),pa=r.useCallback(async e=>{var f,b;const a=Number(e.id),o=!(e.isLikedByUser??!1),d=l===ce&&!o;L(E=>d?E.filter(p=>Number(p.id)!==a):E.map(p=>Number(p.id)===a?{...p,isLikedByUser:o,likes:(p.likes??0)+(o?1:-1)}:p)),d&&_(E=>Math.max(0,E-1));try{const p=(b=(f=(await Oe({variables:{likeCollectionInput:{id:a,status:o}},fetchPolicy:"no-cache"})).data)==null?void 0:f.likeCollection)==null?void 0:b.data;if(!p)throw new Error("Like mutation returned no data");d&&p.likedByUser?(L(c=>[e,...c]),_(c=>c+1)):L(c=>
6d?c:c.map(x=>Number(x.id)===a?{...x,isLikedByUser:p.likedByUser,likes:p.likesCount}:x)),p.likedByUser||h({msg:"Removed from My Liked Content",variant:"success"})}catch(E){console.error("[EngineRoomCategoryV2] like failed",E),L(p=>d?[e,...p]:p.map(c=>Number(c.id)===a?{...c,isLikedByUser:!o,likes:(c.likes??0)-(o?1:-1)}:c)),d&&_(p=>p+1),h({msg:"Could not update like. Try again.",variant:"error"})}},[l,Oe,h]),ma=r.useCallback(e=>{we(!1),Ce(!1),Ne(!1),me(!1),y(`/categories/${e}`)},[y]),ga=r.useCallback(()=>{we(!1),s(Na(!1)),s(Ea(null));const e=JSON.parse(localStorage.getItem("isLikedByUser")??"null"),a=JSON.parse(localStorage.getItem("ratingsData")??"null"),o=JSON.parse(localStorage.getItem("isUserViewed")??"null");g&&(e!=null||a!=null||o!=null)&&L(d=>d.map(f=>{if(f.id!==g.id)return f;const b={...f};return e!=null&&(b.isLikedByUser=e),(a==null?void 0:a.totalRatings)!=null&&(b.totalRatings=a.totalRatings),(a==null?void 0:a.avgRating)!=null&&(b.average_rating=a.avgRating),o!=null&&(b.visits=(f.visits??0)+1),b})),localStorage.removeItem("isLikedByUser"),localStorage.removeItem("ratingsData"),localStorage.removeItem("isUserViewed"),B(null),le()},[s,g,le]),ke=r.useCallback(async e=>{var f,b,E,p,c,x;const a=Number(e.id);if(!a||Number.isNaN(a)){h({msg:"Invalid or missing ID.",variant:"error"});return}const o=re.find(F=>F.collectionId===a),d=!!o;if(((i==null?void 0:i.planId)??0)<3){if(d){h({msg:"Content already has been bookmarked",variant:"info"});return}const I=(b=(f=(await $e({variables:{createSaveForLaterItemInput:{type:Ut.ENGINE_ROOM_COLLECTION,item_id:a}}})).data)==null?void 0:f.createSaveForLaterEntry)==null?void 0:b.success;h({msg:I?"Content has been bookmarked":"Failed to bookmark content",variant:I?"success":"error"}),I&&le();return}if(d){const I=(p=(E=(await ft({variables:{deleteSaveForLaterItemInput:{ids:[o.id]}}})).data)==null?void 0:E.deleteSaveForLaterEntry)==null?void 0:p.success;h({msg:I?"Content has been removed from bookmarked":"Failed to remove content from bookmarked",variant:I?"success":"error"}),I&&le()}else{const I=(x=(c=(await $e({variables:{createSaveForLaterItemInput:{type:Ut.ENGINE_ROOM_COLLECTION,item_id:a}}})).data)==null?void 0:c.createSaveForLaterEntry)==null?void 0:x.success;h({msg:I?"Content has been bookmarked":"Failed to bookmark content",variant:I?"success":"error"}),I&&le()}},[re,i==null?void 0:i.planId,$e,ft,le,h]),Ye=r.useCallback(e=>{if(B(e),fe([...tt(e.videos??[],"id")]),lt(e.id!=null?[e.id]:[]),((i==null?void 0:i.planId)??0)<3){oe(!0);return}H?Ee(!0):Ne(!0)},[i==null?void 0:i.planId,H]),yt=r.useCallback(()=>{if(((i==null?void 0:i.planId)??0)<3){oe(!0);return}const e=[];A.forEach(a=>e.push(...tt(a.videos??[],"id"))),fe(e.reverse()),lt(A.map(a=>a.id).filter(a=>a!=null)),Ne(!0)},[A,i==null?void 0:i.planId]),kt=r.useCallback(()=>{if(!(!H||A.length!==1)){if(((i==null?void 0:i.planId)??0)<3){oe(!0);return}B(A[0]),Ee(!0)}},[H,A,i==null?void 0:i.planId]),St=r.useCallback(()=>{A.forEach(e=>{ke(e)})},[A,ke]),He=r.useCallback(e=>{if(B(e),fe([...tt(e.videos??[],"id")]),((i==null?void 0:i.planId)??0)<3){oe(!0);return}Ce(!0)},[i==null?void 0:i.planId]),te=r.useCallback(e=>{const o=Object.values(e).flat().filter(Boolean).length===0&&C==="";J(!o),de(e),L([]),V(d=>({...d,page:0})),Y(-1),s(Ft({key:"category",value:{[m]:e}}))},[s,m,C]);r.useEffect(()=>{var o;if(!T.length||er()||!Bt(j))return;const e=Za(tr().ageBand);if(!e)return;const a=(o=T.find(d=>d.name==="Age Group"))==null?void 0:o.tags.find(d=>d.name===e);a&&(ar(),te({"Age Group":[a.id]}))},[T,j,te]);const Ke=r.useCallback((e,a)=>{const o=R[e]??[],d={...R,[e]:o.filter(f=>f!==a)};te(d)},[R,te]),We=r.useCallback(()=>{s(et({key:"category",value:""}))},[s]),vt=r.useCallback(e=>{s(et({key:"category",value:e}))},[s]),wt=r.useCallback((e,a)=>{const o=R[e]??[],d=o.includes(a)?o.filter(f=>f!==a):[...o,a];te({...R,[e]:d})},[R,te]),Be=r.useCallback(()=>{L([]),V(e=>({...e,page:0,searchQuery:""})),s(et({key:"category",value:""})),de({}),s(Ft({key:"category",value:{[m]:{}}})),J(!1),Y(-1)},[s,m]),fa=r.useCallback((e,a)=>{(N.value!==e||N.order!==a)&&L([]),V(o=>({...o,page:0,value:e,order:a})),Y(-1)},[N.value,N.order]),Ct=r.useCallback(e=>{e[0].isIntersecting&&!k&&!$&&U>O.length&&!ee&&V(o=>({...o,page:o.page+1}))},[k,$,U,O.length,ee]);r.useEffect(()=>{let e=null;if(!he.current)return;const o=(f=>{let b=(f==null?void 0:f.parentElement)??null;for(;b;){const E=getComputedStyle(b).overflowY;if((E==="auto"||E==="scroll")&&b.scrollHeight>b.clientHeight)return b;b=b.parentElement}return null})(he.current),d=new IntersectionObserver(Ct,{root:o,threshold:0,rootMargin:"0px 0px 600px 0px"});return d.observe(he.current),e=he.current,()=>{e&&d.unobserve(e)}},[Ct]),r.useEffect(()=>{if(w||k||$||ee||U<=O.length)return;const e=document.querySelector("main");e&&e.scrollHeight<=e.clientHeight+600&&V(a=>({...a,page:a.page+1}))},[w,k,$,ee,U,O.length]),r.useEffect(()=>{var d;X([]),we(!1),B(null);const e=localStorage.getItem("categoryState"),a=e?JSON.parse(e):null;if(!(((d=a==null?void 0:a.category)==null?void 0:d.lastSelectedCategoryId)===m)){const f=document.querySelector("main");f?f.scrollTop=0:window.scrollTo({top:0})}},[m]),r.useEffect(()=>{if(!Sr(j)){L([]),_(0),V(a=>({...a,page:0})),Y(-1);const e=Bt(j);J(!e||!!C),de(e?{}:j)}q(!0)},[m,se]),r.useEffect(()=>{if(ee){V(o=>({...o,page:0})),Y(-1),L([]),X([]);return}const e=localStorage.getItem("categoryState"),a=e?JSON.parse(e):null;
6if(a!=null&&a.category&&!Mt(a.category)&&a.category.lastSelectedCategoryId===m){const{collections:o,collectionCount:d,filters:f,scrollPosition:b,lastSelectedCollectionId:E}=a.category,p=JSON.parse(localStorage.getItem("isLikedByUser")??"null"),c=JSON.parse(localStorage.getItem("ratingsData")??"null"),x=JSON.parse(localStorage.getItem("isUserViewed")??"null"),F=(o??[]).map(I=>{if(I.id!==E)return I;const K={...I};return p!=null&&(K.isLikedByUser=p),(c==null?void 0:c.totalRatings)!=null&&(K.totalRatings=c.totalRatings),(c==null?void 0:c.avgRating)!=null&&(K.average_rating=c.avgRating),x!=null&&(K.visits=(I.visits??0)+1),K});L(F),_(d??0),f&&V(f),Y((f==null?void 0:f.page)??-1),q(!1),window.setTimeout(()=>{Te.current&&b!=null&&(Te.current.scrollTop=b)},50);return}if(Ie.current===m){const o=$t({categoryId:l,page:N.page,generation:je.current});N.page>dt&&be.current!==o&&(be.current=o,Fe())}else V({page:0,value:l===ce?"created_at":"manual",order:l===ce?"DESC":"ASC",searchQuery:C})},[m,N.page,N.value,N.order,dt,ee,ue,pe,Ie.current,C,Fe]),r.useEffect(()=>{O.length&&U!==0&&N.value&&window.localStorage.removeItem("categoryState")},[O.length,U,N.value]),r.useEffect(()=>{const e=document.querySelector("main");Te.current=e},[]),r.useEffect(()=>{const e=o=>{sa(o.target.scrollTop)},a=Te.current;return a==null||a.addEventListener("scroll",e),()=>{a==null||a.removeEventListener("scroll",e)}},[]),r.useEffect(()=>{Ie.current!==m&&(Ie.current=m)},[m]),r.useEffect(()=>{L([]),Y(-1),V(e=>({...e,page:0,searchQuery:C})),C||!Mt(j)?J(!0):J(!1)},[C]);const ha=(ae??{}).title??"",Nt=new Set(re.map(e=>e.collectionId)),Xe=ne?O.filter(e=>Nt.has(Number(e.id))):O,Et=ne?Xe.length:U,ba=!!g&&Ta(l,g.content_type??"",na)&&oa;return t.jsxs("div",{className:"er-v2 min-h-screen bg-bg text-fg font-body",children:[!w&&t.jsx(Tr,{hideWordmark:!0,hideModuleLabel:!0,hideTeamChip:!0,hideTabs:!0,hideSearch:!0}),t.jsxs("div",{className:"mx-auto max-w-[1600px] px-4 pb-20 sm:px-5 md:px-6 xl:px-7",children:[t.jsx(Br,{title:ha,count:Et,categoryId:l,isLoading:ee,sortBy:N.value,sortOrder:N.order,onSortChange:fa,hasAgeGroupFilter:T.some(e=>e.name==="Age Group"),hasNumberOfPlayersFilter:T.some(e=>e.name==="Number of Players"),hasPitchSizeFilter:T.some(e=>e.name==="Pitch Area Needed"),isPracticeAndDrills:Le,useDropdownSort:D,searchValue:C,onSearchChange:vt,topSlot:e=>t.jsxs(t.Fragment,{children:[D&&t.jsx(Nr,{filterGroups:T,selectedTags:R,onToggleTag:wt,onClearGroup:a=>te({...R,[a]:[]}),collapsed:e}),!e&&t.jsx(jr,{isFilterApplied:Ge,selectedTags:R,searchTerm:C,filterGroups:T,onRemoveTag:Ke,onRemoveSearch:We,onClearAll:Be}),!e&&t.jsx(La,{links:la,onJump:ca})]}),activeFilterCount:Object.values(R).filter(e=>e==null?void 0:e.length).length+(ne?1:0),onOpenFilters:()=>it(!0),selectMode:st,selectedCount:A.length,onToggleSelectMode:()=>{Yt(e=>(e&&X([]),!e))}}),t.jsx(pr,{scopeKey:P,search:C,tags:R,groups:T,filtersReady:!pt&&!xe&&Array.isArray(G[m]),saveDisabledReason:ne?"Turn off My bookmarks before saving a search.":void 0,onApply:e=>{ge(!1),X([]),vt(e.search),te(e.tags)}},P??`unknown:${m}`),$&&!k&&t.jsx(Gt,{error:!0,search:C,tags:R,groups:T,onRemoveTag:Ke,onRemoveSearch:We,onClear:Be,onRetry:()=>{Fe()}}),!$&&!k&&!ee&&Xe.length===0?t.jsx(Gt,{search:C,tags:R,groups:T,onRemoveTag:Ke,onRemoveSearch:We,bookmarks:ne,onRemoveBookmarks:()=>ge(!1),onClear:()=>{Be(),ge(!1)}}):t.jsx(Rr,{rows:Xe,savedIds:new Set(re.map(e=>e.collectionId)),selectedIds:new Set(A.map(e=>Number(e.id))),selectMode:st,isReadOnlyMode:S,isSeasonPlan:H,isLoading:k,showPracticeTypeTags:Z,onCardClick:ua,onToggleLike:pa,onToggleSave:ke,onPlayTrailer:e=>{B(e),me(!0)},onPlayClick:ye,detailFirst:Le||Z,onAddToSession:Ye,onAddToPlaylist:He,onToggleSelect:e=>{X(a=>a.some(d=>d.id===e.id)?a.filter(d=>d.id!==e.id):a.length>=10?(h({msg:"Only 10 videos can be selected at a time.",variant:"warning"}),a):[e,...a])}}),t.jsx("div",{ref:he,className:"h-px [overflow-anchor:none]"})]}),t.jsx(Oa,{open:pe,item:g,onClose:ga,onOpenDetail:e=>ye(e),isLiked:(g==null?void 0:g.isLikedByUser)??!1,isSaved:!!g&&re.some(e=>e.collectionId===Number(g.id)),onToggleLike:xt,onToggleSave:e=>ke(e),onAddToSession:e=>Ye(e),onAddToPlaylist:e=>He(e),categories:da,onCategoryClick:ma,likesCount:Qe,isSeasonPlan:H}),t.jsx(rr,{open:Kt,item:g,onClose:()=>me(!1),onOpenDetail:e=>{me(!1),ye(e)},isLiked:(g==null?void 0:g.isLikedByUser)??!1,isSaved:!!g&&re.some(e=>e.collectionId===Number(g.id)),onToggleLike:()=>xt(),onToggleSave:e=>ke(e),onAddToSession:e=>Ye(e),onCreateSession:e=>{me(!1),y("/engine-room/build-session",{state:{seedPractice:e}})},onAddToPlaylist:e=>He(e),isSeasonPlan:H}),t.jsx(qa,{open:Wt,onClose:()=>oe(!1),triggerReason:"feature-locked",featureName:"Engine Room",currentPlanLabel:"Starter"}),t.jsx(Ia,{open:ot,handleClose:()=>Ne(!1),setSelectedCollectionIds:X,videoIds:ta,refetchData:Fe,workflow:"ENGINE_ROOM",practiceTypeByVideoId:ra}),t.jsx(ir,{open:Xt,onClose:()=>
6Ce(!1),collectionIds:g?[Number(g.id)]:[],anchorOffsetPx:pe&&!w?420:0}),Zt?t.jsx(cr,{open:nt,selectedCollectionId:g==null?void 0:g.id,onClose:()=>{Ee(!1),fe([])}}):t.jsx(lr,{open:nt,selectedCollectionId:g==null?void 0:g.id,handleClose:()=>{Ee(!1),fe([])}}),t.jsx(_a,{open:ea,onClose:()=>it(!1),filterGroups:T,selectedTags:R,onToggleTag:wt,onClearAll:()=>{Be(),ge(!1)},resultCount:Et,resultLoading:k,loadError:xe,onRetry:()=>ia(),prependSlot:t.jsx(Mr,{on:ne,onToggle:ge,savedCount:re.length,visibleSavedCount:O.filter(e=>Nt.has(Number(e.id))).length})}),w?!S&&A.length>0?t.jsx(sr,{selected:A,onClear:()=>X([]),onBulkSave:()=>St(),onBulkAddToPlaylist:()=>{if(((i==null?void 0:i.planId)??0)<3){oe(!0);return}Ce(!0)},onBulkAddToSession:()=>yt(),canPopulateSessions:H&&A.length===1,onPopulateSessions:()=>kt()}):null:t.jsx(br,{selected:A,isReadOnlyMode:S,canShowAddToSession:A.length>0&&(!A.every(e=>e.content_type==="collection")||Z),canShowPopulateSessions:H&&A.length===1,onClear:()=>X([]),onSave:St,onAddToSession:yt,onPopulateSessions:kt}),null]})}export{hn 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.