PageSourceSearch

https://fit4tennis.com/_next/static/chunks/app/library/page-90a16a…?dpl=dpl_3KfSvMWHWa5eX8LRGDV343U39q2Y

js fit4tennis.com collected 2026-10-02 00:49:48 UTC 47,491 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2072,7382],{412:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={default:function(){return d},getImageProps:function(){return c}};for(var l in a)Object.defineProperty(t,l,{enumerable:!0,get:a[l]});let s=r(93764),n=r(78080),i=r(91468),o=s._(r(61012));function c(e){let{props:t}=(0,n.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let d=i.Image},7837:(e,t,r)=>{"use strict";function a(e,t={}){if(!e)return null;let r=`/api/mux/thumb?id=${encodeURIComponent(e)}`;return t.context?`${r}&context=${encodeURIComponent(t.context)}`:r}function l(e,t,r){if(r)return r;if(e&&!/uscreen/i.test(e))return e;let l=a(t);return l||(e??null)}function s(e,t,r={}){let l="string"==typeof e&&""!==e.trim()?e:null,n=a(t,{context:r.context}),i=["string"==typeof r.posterUrl&&""!==r.posterUrl.trim()?r.posterUrl:null,...(null===l||/uscreen/i.test(l))&&"stored"!==r.order?[n,l]:[l,n]],o=new Set;return i.filter(e=>!(null===e||o.has(e))&&(o.add(e),!0))}r.d(t,{HM:()=>s,bg:()=>a,tQ:()=>l})},8164:(e,t,r)=>{"use strict";r.d(t,{nT:()=>i});var a=r(40264),l=r(15911),s=r(36932);let n=[{hostname:"image.mux.com"},{hostname:"sxcqwfpemyffpwpzofve.supabase.co",pathnamePrefix:"/storage/v1/object/public/posters/",requireEmptySearch:!0},{hostname:"res.cloudinary.com",pathnamePrefix:"/dv033eo0x/image/upload/"},{hostname:"alpha.uscreencdn.com"},{hostname:"**.uscreencdn.com"}];function i({src:e,fallbackSrc:t,alt:r,className:l,sizes:n,priority:c}){let[d,u]=(0,s.useState)(null),h=null!==d&&d===e&&t&&t!==e?t:e,m=h===e?()=>u(e):void 0;return(0,a.jsx)(o,{src:h,alt:r,className:l,sizes:n,priority:c,onError:m})}function o({src:e,alt:t,className:r,sizes:s,priority:i,onError:c}){return!function(e){let t;if(!e||!/^https:\/\//i.test(e))return!1;try{t=new URL(e)}catch{return!1}return"https:"===t.protocol&&n.some(e=>!!function(e,t){if(!t.includes("*"))return e===t;let r=t.replace(/^\*+/,"");return e.endsWith(r)&&e.length>r.length}(t.hostname,e.hostname)&&(!e.pathnamePrefix||!!t.pathname.startsWith(e.pathnamePrefix))&&(!e.requireEmptySearch||""===t.search))}(e)?(0,a.jsx)("img",{src:e,alt:t,className:r,loading:"lazy",decoding:"async",onError:c}):(0,a.jsx)(l.default,{src:e,alt:t,width:640,height:360,sizes:s,className:r,priority:i,onError:c})}},9473:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45922).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},15911:(e,t,r)=>{"use strict";r.d(t,{default:()=>l.a});var a=r(412),l=r.n(a)},27605:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45922).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},41122:(e,t,r)=>{"use strict";r.d(t,{AssumptionOfRiskGate:()=>c});var a=r(40264),l=r(36932),s=r(71563),n=r.n(s),i=r(69271);function o({message:e}){return(0,a.jsx)("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive",children:e})}function c({children:e,overlay:t=!1,onAccepted:r}){let s,[d,u]=(0,l.useState)({phase:"loading"}),[h,m]=(0,l.useState)(!1),[x,p]=(0,l.useState)(!1),[b,f]=(0,l.useState)(null),g=(0,l.useRef)(!0);async function w(){if(!h||x||"required"!==d.phase)return;let{version:e,userId:t}=d.status;p(!0),f(null);try{let a=await fetch("/api/legal/assumption-of-risk",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({surface:"web",version:e,userId:t})});if(!g.current)return;if(!a.ok){let e=await a.json().catch(()=>({}));f(e.error??"Could not save acceptance. Please try again.");return}let l=await fetch("/api/legal/assumption-of-risk",{method:"GET",headers:{Accept:"application/json"},cache:"no-store"});if(!g.current)return;let s=l.ok?await l.json():null;if(!s?.accepted||s.userId!==t||s.version!==e)return void f("The account or acknowledgment changed. Refresh and review before continuing.");u({phase:"accepted"}),(0,i.pT)(),r?.()}catch{g.current&&f("Network error. Please try again.")}finally{g.current&&p(!1)}}if((0,l.useEffect)(()=>(g.current=!0,(async()=>{try{let e=await fetch("/api/legal/assumption-of-risk",{method:"GET",headers:{Accept:"application/json"}});if(!g.current)return;if(401===e.status)return void u({phase:"accepted"});if(!e.ok)return void u({phase:"error",message:"Could not load legal acknowledgment. Please refresh."});let t=await e.json();if(!g.current)return;!1===t.authenticated||t.accepted?u({phase:"accepted"}):"string"==typeof t.userId&&t.userId?u({phase:"required",status:t}):u({phase:"error",message:"Could not verify the acknowledgment account. Please refresh."})}catch{g.current&&u({phase:"error",message:"Could not reach the server. Please check your connection."})}})(),()=>{g.current=!1}),[]),"loading"===d.phase&&!t)return(0,a.jsx)("div",{className:"flex min-h-[200px] items-center justify-center text-sm text-muted-foreground",children:"Loading…"});if("error"===d.phase&&!t)return(0,a.jsx)(o,{message:d.message});if("accepted"===d.phase&&!t)return(0,a.jsx)(a.Fragment,{children:e});let v={className:(s="required"===d.phase)?"pointer-events-none select-none opacity-40 blur-sm":"contents",ariaHidden:!!s||void 0,inert:!!s||void 0},y="error"===d.phase?(0,a.jsx)(o,{message:d.message}):null,k=null;if("required"===d.phase){let{status:e}=d;k=(0,a.jsx)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"aor-modal-title",className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/70 p-4",children:(0,a.jsxs)("div",{className:"relative mx-auto w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900",children:[(0,a.jsx)("h2",{id:"aor-modal-title",className:"mb-1 text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Before you play"}),(0,a.jsx)("p",{className:"mb-3 text-sm text-zinc-600 dark:text-zinc-400",children:"One confirmation — then your videos start. You only do this once."}),(0,a.jsx)("div",{className:"mb-4 max-h-60 overflow-y-auto rounded-lg border border-zinc-200 bg-zinc-50 p-4 text-xs leading-relaxed text-zinc-700 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",tabIndex:0,"aria-label":"Assumption of Risk text",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap font-sans",children:e.text})}),(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 text-sm text-zinc-800 dark:text-zinc-200",children:[(0,a.jsx)("input",{type:"checkbox",checked:h,onChange:e=>m(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 accent-yellow-400","aria-required":"true"}),(0,a.jsxs)("span",{children:[e.checkboxLabel,(0,a.jsxs)("span",{className:"mt-1 block text-xs text-zinc-500 dark:text-zinc-400",children:["Read:"," ",(0,a.jsx)(n(),{href:"/legal/assumption-of-risk",target:"_blank",rel:"noopener noreferrer",className:"underline",onClick:e=>e.stopPropagation(),children:"Assumption of Risk"})," ","\xb7"," ",(0,a.jsx)(n(),{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"underline",onClick:e=>e.stopPropagation(),children:"Terms of Service"})]})]})]}),b&&(0,a.jsx)("p",{role:"alert",className:"mt-3 text-xs text-red-600",children:b}),(0,a.jsx)("button",{type:"button",disabled:!h||x,onClick:()=>void w(),className:"mt-4 w-full rounded-lg bg-yellow-400 py-3 text-sm font-semibold text-zinc-900 transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:x?"Saving…":"Accept and continue"})]})})}let j=(0,a.jsx)("div",{"aria-hidden":v.ariaHidden,inert:v.inert,className:v.className,children:e});return t?(0,a.jsxs)(a.Fragment,{children:[y,j,k]}):(0,a.jsxs)(a.Fragment,{children:[j,k]})}},45922:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var a=r(36932);let l=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let n=(0,a.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:o,iconNode:c,...d},u)=>(0,a.createElement)("svg",{ref:u,...s,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:l("lucide",i),...d},[...c.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(o)?o:[o]])),i=(e,t)=>{let r=(0,a.forwardRef)(({className:r,...s},i)=>(0,a.createElement)(n,{ref:i,iconNode:t,className:l(`lucide-${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,r),...s}));return r.displayName=`${e}`,r}},56806:(e,t,r)=>{"use strict";r.d(t,{FooterNewsletter:()=>s});var a=r(40264),l=r(36932);function s(){let[e,t]=(0,l.useState)(""),[r,s]=(0,l.useState)("idle"),[n,i]=(0,l.useState)("");async function o(a){if(a.preventDefault(),"submitting"!==r){s("submitting"),i("");try{let r=await fetch("/api/email/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({form_type:"newsletter",email:e,source:"footer",consent:!0})}),a=await r.json();r.ok&&a.ok&&!0===a.verification_required?(s("ok"),i(a.message??"Check your inbox and confirm — that's the last step."),t("")):(s("error"),i(a.error||"Something went wrong. Please try again."))}catch{s("error"),i("Something went wrong. Please try again.")}}}return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[11px] font-bold uppercase tracking-[0.32em] text-yellow mb
1-5",children:"Newsletter"}),(0,a.jsx)("p",{className:"font-sans text-[14px] leading-[1.55] text-line max-w-xs mb-5",children:"Training tips and new sessions from the Fit4Tennis coaches. We'll email a confirmation first; nothing is added until you confirm."}),"ok"===r?(0,a.jsx)("p",{className:"text-[15px] leading-[1.55] text-yellow max-w-md",role:"status","aria-live":"polite",children:n}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("form",{onSubmit:o,"data-opt-in-contract":"double-confirmation",className:"flex flex-col sm:flex-row gap-3 max-w-md",children:[(0,a.jsx)("label",{htmlFor:"footer-email",className:"sr-only",children:"Email address"}),(0,a.jsx)("input",{id:"footer-email",type:"email",inputMode:"email",autoComplete:"email",required:!0,placeholder:"Enter your email",value:e,onChange:e=>t(e.target.value),className:"flex-1 min-w-0 px-4 py-3 bg-white/[0.04] border border-white/[0.14] text-paper placeholder:text-mute focus:border-yellow/50 focus:outline-none transition-colors duration-150"}),(0,a.jsx)("button",{type:"submit",disabled:"submitting"===r,className:"shrink-0 min-h-[44px] px-6 py-3 bg-yellow text-ink font-bold text-[13px] uppercase tracking-[0.12em] hover:bg-yellow/90 disabled:opacity-60 transition-colors duration-150",children:"submitting"===r?"Sending...":"Subscribe"})]}),"error"===r&&n&&(0,a.jsx)("p",{className:"mt-3 text-[13px] text-red-400",role:"alert",children:n})]})]})}},62072:(e,t,r)=>{"use strict";function a(){return"u">typeof window}r.d(t,{u4:()=>n});function l(){return(a()?window.vam:function(){return"production"}())||"production"}function s(){return"production"===l()}function n(e,t,r){var n,i;if(!a()){let e="[Vercel Web Analytics] Please import `track` from `@vercel/analytics/server` when using this function in a server environment";if(s())console.warn(e);else throw Error(e);return}if(!t){null==(n=window.va)||n.call(window,"event",{name:e,options:r});return}try{let a=function(e,t){if(!e)return;let r=e,a=[];for(let[l,s]of Object.entries(e))"object"==typeof s&&null!==s&&(t.strip?r=function(e,{[e]:t,...r}){return r}(l,r):a.push(l));if(a.length>0&&!t.strip)throw Error(`The following properties are not valid: ${a.join(", ")}. Only strings, numbers, booleans, and null are allowed.`);return r}(t,{strip:s()});null==(i=window.va)||i.call(window,"event",{name:e,data:a,options:r})}catch(e){e instanceof Error&&"development"===l()&&console.error(e)}}},63692:(e,t,r)=>{"use strict";var a=r(96700);r.o(a,"useParams")&&r.d(t,{useParams:function(){return a.useParams}}),r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}}),r.o(a,"useSearchParams")&&r.d(t,{useSearchParams:function(){return a.useSearchParams}})},81456:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45922).A)("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]])},97210:(e,t,r)=>{"use strict";r.d(t,{LibraryBrowse:()=>T});var a=r(40264),l=r(36932),s=r(71563),n=r.n(s),i=r(12635),o=r(8164),c=r(18946),d=r(7837),u=r(80439);let h=r(42936).QY.yellow,m=new Set(["alias-exact","alias-token"]);function x({result:e,onSelectVideo:t}){let r=(0,a.jsxs)("div",{className:"flex min-h-11 items-center justify-between gap-3 rounded-lg px-3 py-2 transition-colors hover:bg-white/8",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-[13px] font-bold text-white",children:e.title}),(e.subtitle||e.coach)&&(0,a.jsx)("div",{className:"truncate text-[11px] text-white/55",children:e.subt
1itle||e.coach})]}),m.has(e.matchReason)&&(0,a.jsx)("span",{className:"flex-none rounded bg-white/10 px-1.5 py-0.5 text-[9.5px] font-bold uppercase tracking-wide text-white/55",children:"Previous title"})]});return"program"===e.kind?(0,a.jsx)(n(),{href:`/training/programs/${e.id}`,className:"block","aria-label":`Open program ${e.title}`,children:r}):(0,a.jsx)("button",{type:"button",onClick:()=>t(e),className:"block w-full text-left","aria-label":`Show ${e.title} below`,children:r})}function p({title:e,results:t,onSelectVideo:r}){return 0===t.length?null:(0,a.jsxs)("div",{className:"min-w-[220px] flex-1",children:[(0,a.jsx)("div",{className:"mb-1.5 px-3 text-[10px] font-bold uppercase tracking-[0.15em] text-white/50",children:e}),(0,a.jsx)("div",{className:"space-y-0.5",children:t.map(e=>(0,a.jsx)(x,{result:e,onSelectVideo:r},`${e.kind}-${e.id}`))})]})}function b({results:e,loading:t,error:r,onSelectVideo:l}){return t?(0,a.jsx)("div",{"aria-label":"Loading quick matches",className:"mb-6 animate-pulse rounded-xl border border-white/10 bg-white/[0.03] p-4",children:(0,a.jsx)("div",{className:"h-3 w-40 rounded bg-white/8"})}):r||0===e.best.length?null:(0,a.jsxs)("section",{"aria-label":"Quick matches",className:"mb-6 rounded-xl border border-white/10 bg-white/[0.03] p-4",children:[(0,a.jsxs)("div",{className:"mb-3 text-[11px] font-bold uppercase tracking-[0.18em]",style:{color:h},children:["Quick matches for “",e.query,"”"]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,a.jsx)(p,{title:"Programs",results:e.programs,onSelectVideo:l}),(0,a.jsx)(p,{title:"Workouts",results:e.workouts,onSelectVideo:l}),(0,a.jsx)(p,{title:"Lessons",results:e.lessons,onSelectVideo:l})]})]})}var f=r(83486),g=r(69271);function w(e){return!!(e.level||e.trainer||e.search||e.workoutType||e.durationBand||e.phaseFilter)}let v=[{k:"",label:"All"},{k:"workout",label:"Workouts"},{k:"program",label:"Programs"},{k:"lesson",label:"Lessons"}],y=[{v:"",label:"All levels"},{v:"beginner",label:"Beginner"},{v:"intermediate",label:"Intermediate"},{v:"advanced",label:"Advanced"}],k=[{v:"",label:"All types"},{v:"speed-agility-footwork",label:"Footwork & speed"},{v:"strength",label:"Strength"},{v:"power-explosive",label:"Power"},{v:"rotational-core",label:"Core & rotation"},{v:"conditioning",label:"Conditioning"},{v:"mobility",label:"Mobility"},{v:"prehab",label:"Prehab"},{v:"recovery",label:"Recovery"}],j=[{v:"",label:"Any length"},{v:"under15",label:"Under 15 min"},{v:"15to30",label:"15–30 min"},{v:"30to45",label:"30–45 min"},{v:"over45",label:"45+ min"}],N={beginner:{label:"Beginner",c:"#3DDC97"},intermediate:{label:"Intermediate",c:"#46A6FF"},advanced:{label:"Advanced",c:"#FF7A7A"},all:{label:"All levels",c:"#C9CDD6"}},_=[{v:"General Prep",label:"General Prep",short:"General"},{v:"Specific Prep",label:"Specific Prep",short:"Power"},{v:"Pre-Comp/Taper",label:"Pre-Comp / Taper",short:"Pre-Comp"},{v:"In-Season Maintenance",label:"In-Season",short:"In-Season"},{v:"Active Recovery",label:"Active Recovery",short:"Recovery"}],S={"General Prep":"rgba(70,166,255,0.18)","Specific Prep":"rgba(247,230,69,0.15)","Pre-Comp/Taper":"rgba(255,122,122,0.18)","In-Season Maintenance":"rgba(61,220,151,0.15)","Active Recovery":"rgba(180,130,255,0.18)"},C={"General Prep":"#46A6FF","Specific Prep":"#F7E645","Pre-Comp/Taper":"#FF7A7A","In-Season Maintenance":"#3DDC97","Active Recovery":"#B482FF"},P="#F7E645",E=e=>{if(!e)return"";let t=Math.round(e/60);return t>=1?`${t} min`:`${e}s`};function A({onPlay:e,onSeeAll:t,trainers:r,trainerFilter:s,onTrainerChange:n,workoutTypeFilter:i,access:o}){let[c,d]=(0,l.useState)([]),[h,m]=(0,l.useState)(0),[x,p]=(0,l.useState)(!0),[b,f]=(0,l.useState)(!1),[g,w]=(0,l.useState)(0),v=(0,l.useRef)(null);return((0,l.useEffect)(()=>{let e=!1;return(async()=>{p(!0),f(!1);try{let t=new URLSearchParams({kind:"workout",limit:"16"});s&&t.set("coach",s),i&&t.set("type",i);let r=await (0,u.i)(()=>fetch(`/api/library?${t}`,{cache:"no-store"}),"items");e||(d(r.rows),m(r.total))}catch{e||(d([]),m(0),f(!0))}finally{e||p(!1)}})(),()=>{e=!0}},[s,i,g]),x)?(0,a.jsxs)("div",{className:"mb-10 min-h-[370px] sm:min-h-0",children:[(0,a.jsxs)("div",{className:"mb-4 space-y-2 animate-pulse",children:[(0,a.jsx)("div",{className:"h-3 w-24 rounded bg-white/8"}),(0,a.jsx)("div",{className:"h-7 w-40 rounded bg-white/8"}),(0,a.jsx)("div",{className:"h-4 w-64 max-w-full rounded bg-white/8"})]}),(0,a.jsx)("div",{className:"flex gap-4 overflow-hidden",children:Array.from({length:4}).map((e,t)=>(0,a.jsx)("div",{className:"h-[190px] flex-none w-[220px] rounded-xl bg-white/6 animate-pulse"},t))})]}):b?(0,a.jsxs)("section",{"aria-label":"Full workouts could not load",className:"mb-10 min-h-[370px] rounded-xl border border-white/10 bg-white/[0.03] p-6 sm:min-h-0",children:[(0,a.jsx)("h2",{className:"text-lg font-black text-white",children:"Full workouts couldn't load"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-white/50",children:"Try again to see the full workouts."}),(0,a.jsx)("button",{onClick:()=>w(e=>e+1),className:"mt-4 inline-flex min-h-11 items-center rounded-lg px-4 py-2 text-sm font-bold text-[#111]",style:{background:P},children:"Retry full workouts"})]}):x||0!==c.length||s||i?(0,a.jsxs)("section",{"aria-label":"Full workouts",className:"mb-10 min-h-[370px] sm:min-h-0",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-[0.18em]",style:{color:P},children:"paid"===o?"Ready to play":"Explore the workouts"}),(0,a.jsx)("h2",{className:"text-2xl font-black text-white mt-0.5",children:"Full workouts"}),!s&&!i&&(0,a.jsx)("p",{className:"text-white/65 text-sm mt-0.5",children:"paid"===o?`${h} complete workouts — press play and follow along.`:`${h.toLocaleStr
1ing()} complete workouts to explore. Membership is needed to watch.`}),(s||i)&&(0,a.jsxs)("p",{className:"text-white/65 text-sm mt-0.5",children:[h," ",s?`with ${s}`:"",s&&i?" \xb7 ":"",i?k.find(e=>e.v===i)?.label??i:""]})]}),(0,a.jsxs)("button",{onClick:t,className:"inline-flex min-h-11 flex-none items-center text-sm font-bold text-white/70 hover:text-white transition-colors whitespace-nowrap","aria-label":`See all ${h} full workouts`,children:["See all ",h.toLocaleString()," →"]})]}),r.length>0&&(0,a.jsxs)("div",{className:"mb-4 hidden sm:block",children:[(0,a.jsx)("div",{className:"text-[10px] font-bold uppercase tracking-[0.15em] text-white/65 mb-2",children:"Browse by trainer"}),(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,a.jsx)("button",{onClick:()=>n(""),className:"inline-flex min-h-11 items-center px-3 py-1.5 rounded-full text-[12px] font-bold transition-colors",style:s?{background:"rgba(255,255,255,0.07)",color:"rgba(255,255,255,0.6)"}:{background:P,color:"#111"},"aria-pressed":!s,children:"All trainers"}),r.map(e=>(0,a.jsx)("button",{onClick:()=>n(s===e?"":e),className:"inline-flex min-h-11 items-center px-3 py-1.5 rounded-full text-[12px] font-bold transition-colors",style:s===e?{background:P,color:"#111"}:{background:"rgba(255,255,255,0.07)",color:"rgba(255,255,255,0.6)"},"aria-pressed":s===e,children:e},e))]})]}),c.length>0?(0,a.jsxs)("div",{ref:v,className:"flex gap-4 overflow-x-auto pb-2 -mx-1 px-1",style:{scrollbarWidth:"none"},children:[c.map(t=>(0,a.jsx)("div",{className:"flex-none w-[220px]",children:(0,a.jsx)(R,{it:t,onPlay:()=>e(t)})},t.id)),h>c.length&&(0,a.jsxs)("button",{onClick:t,className:"flex-none w-[140px] rounded-xl border border-white/10 bg-white/[0.03] hover:bg-white/8 transition-colors flex flex-col items-center justify-center gap-2 text-white/50 hover:text-white/80 text-sm font-bold min-h-[124px]","aria-label":`View all ${h} workouts`,children:[(0,a.jsxs)("span",{className:"text-2xl font-black",style:{color:P},children:["+",(h-c.length).toLocaleString()]}),"more workouts"]})]}):(0,a.jsx)("div",{className:"text-white/65 text-sm py-6",children:"No workouts match these filters."}),(0,a.jsx)("div",{className:"mt-8 border-t border-white/8"})]}):null}function R({it:e,onPlay:t}){let r=N[e.level]||N.all,l=e.playable&&!!e.playback_id;return(0,a.jsxs)("div",{role:l?"button":void 0,tabIndex:l?0:void 0,onClick:l?t:void 0,onKeyDown:l?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())}:void 0,"aria-label":l?`Play ${e.title}`:e.title,className:`group rounded-xl overflow-hidden bg-white/[0.03] border border-white/8 hover:border-white/20 transition-colors ${l?"cursor-pointer focus:outline-none focus:ring-2 focus:ring-[#F7E645]/70":""}`,children:[(0,a.jsxs)("div",{className:"relative aspect-video bg-[#0a0d12] overflow-hidden",children:[(0,d.tQ)(e.thumbnail_url,e.playback_id,e.poster_url)?(0,a.jsx)(o.nT,{src:(0,d.tQ)(e.thumbnail_url,e.playback_id,e.poster_url),alt:e.title??"",sizes:"220px",className:"w-full h-full object-cover group-hover:scale-[1.03] transition-transform duration-300"}):(0,a.jsx)("div",{className:"w-full h-full flex items-center justify-center text-white/20 text-[10px]",children:"no preview"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent"}),e.duration_seconds?(0,a.jsx)("span",{className:"absolute bottom-2 right-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-black/65 text-white",children:E(e.duration_seconds)}):null,l&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:(0,a.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{background:P},children:(0,a.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"#111",children:(0,a.jsx)("path",{d:"M4 2.5v11l9-5.5z"})})})})]}),(0,a.jsxs)("div",{className:"p-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 mb-1",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full flex-none",style:{background:r.c}}),(0,a.jsx)("span",{className:"text-[10px] font-semibold truncate",style:{color:r.c},children:r.label})]}),(0,a.jsx)("div",{className:"text-[13px] font-bold text-white leading-tight line-clamp-2",children:e.title}),e.coach_authority&&(0,a.jsx)("div",{className:"text-[11px] text-white/65 mt-1 truncate",children:e.coach_authority})]})]})}function T(){let[e,t]=(0,l.useState)([]),[r,s]=(0,l.useState)(0),[i,o]=(0,l.useState)(0),[d,h]=(0,l.useState)(!0),[m,x]=(0,l.useState)(null),[p,g]=(0,l.useState)(""),[N,E]=(0,l.useState)(""),[R,T]=(0,l.useState)(""),[$,L]=(0,l.useState)(""),[I,O]=(0,l.useState)(""),[M,q]=(0,l.useState)(""),[B,D]=(0,l.useState)(""),[W,U]=(0,l.useState)(null),[G,V]=(0,l.useState)(!1),[Q,Y]=(0,l.useState)(null),[J,H]=(0,l.useState)([]),[K,X]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(null),[et,er]=(0,l.useState)(null),[ea,el]=(0,l.useState)(null),[es,en]=(0,l.useState)(!1),[ei,eo]=(0,l.useState)(!1),ec=(0,l.useRef)(!1),ed=(0,l.useCallback)(()=>Y(null),[]),eu=(0,l.useRef)(null),eh=(0,l.useRef)(0);(0,l.useEffect)(()=>{fetch("/api/library/trainers",{cache:"no-store"}).then(async e=>{let t=await e.json();if(!e.ok||!Array.isArray(t.trainers))throw Error("Trainer filters unavailable");H(t.trainers.filter(e=>"string"==typeof e)),X(!1)}).catch(()=>{H([]),X(!0)})},[]);let em=(0,l.useCallback)(e=>{e!==p&&(eh.current+=1,g(e),(0,c.trackEvent)("library_filter_used",{filter_type:"kind",value:e||"all"}))},[p]),ex=(0,l.useCallback)(e=>{e!==N&&(eh.current+=1,E(e),(0,c.trackEvent)("library_filter_used",{filter_type:"level",value:e||"all"}))},[N]),ep=(0,l.useCallback)(e=>{e!==$&&(eh.current+=1,L(e),(0,c.trackEvent)("library_filter_used",{filter_type:"trainer",value:e||"all"}))},[$]),eb=(0,l.useCallback)(e=>
1{e!==I&&(eh.current+=1,O(e),(0,c.trackEvent)("library_filter_used",{filter_type:"workout_type",value:e||"all"}))},[I]),ef=(0,l.useCallback)(e=>{e!==R&&(eh.current+=1,T(e))},[R]),eg=(0,l.useCallback)(e=>{eh.current+=1,q(e),(0,c.trackEvent)("library_filter_used",{filter_type:"duration_band",value:e||"all"})},[]),ew=(0,l.useCallback)(e=>{eh.current+=1,D(e),(0,c.trackEvent)("library_filter_used",{filter_type:"periodization_phase",value:e||"all"})},[]),ev=(0,l.useCallback)(e=>{Y(e),(0,c.trackEvent)("video_play",{video_id:String(e.id),video_title:e.title,video_kind:e.kind,video_level:e.level,video_coach:e.coach_authority??"unknown"})},[]),ey=(0,l.useCallback)(()=>{em("workout"),(0,c.trackEvent)("library_filter_used",{filter_type:"kind",value:"workout",source:"workouts_shelf"})},[em]);(0,l.useEffect)(()=>{if(!w({level:N,trainer:$,search:R,workoutType:I,durationBand:M,phaseFilter:B}))return;let e=!1;return(async()=>{try{let t=await Promise.all(v.filter(e=>"program"!==e.k).map(async e=>{let t=new URLSearchParams({limit:"1"});e.k&&t.set("kind",e.k),N&&t.set("level",N),$&&t.set("coach",$),R&&t.set("search",R),I&&t.set("type",I),M&&t.set("duration",M),B&&t.set("phase",B);let r=await (0,u.i)(()=>fetch(`/api/library?${t}`,{cache:"no-store"}),"items");return[e.k||"all",r.total]}));if(e)return;U(Object.fromEntries(t)),V(!1)}catch{if(e)return;U(null),V(!0)}})(),()=>{e=!0}},[N,$,R,I,M,B]);let ek=(0,l.useCallback)(async e=>{let r=++eh.current;h(!0),e&&x(null);let a=e?0:i,l=new URLSearchParams({limit:String(48),offset:String(a)});p&&l.set("kind",p),N&&l.set("level",N),R&&l.set("search",R),$&&l.set("coach",$),I&&l.set("type",I),M&&l.set("duration",M),B&&l.set("phase",B);try{let n=await (0,u.i)(()=>fetch(`/api/library?${l}`,{cache:"no-store"}),"items");if(r!==eh.current)return;if(x(null),s(n.total),t(t=>e?n.rows:[...t,...n.rows]),o(a+n.rows.length),e&&(ee(n.access),n.catalogTotals&&er(n.catalogTotals),!w({level:N,trainer:$,search:R,workoutType:I,durationBand:M,phaseFilter:B}))){let e,t=(e=n.catalogTotals)?{all:e.workout+e.lesson,workout:e.workout,lesson:e.lesson}:null;U(t),V(null===t)}}catch{if(r!==eh.current)return;x("We couldn't load the library right now. Give it another try."),e&&(t([]),s(0),w({level:N,trainer:$,search:R,workoutType:I,durationBand:M,phaseFilter:B})||(U(null),V(!0)))}finally{r===eh.current&&h(!1)}},[i,p,N,R,$,I,M,B]);(0,l.useEffect)(()=>(eu.current&&clearTimeout(eu.current),eu.current=setTimeout(()=>{o(0),ek(!0)},280*!!R),()=>{eu.current&&clearTimeout(eu.current),eh.current+=1}),[p,N,R,$,I,M,B]),(0,l.useEffect)(()=>{R.trim()&&!ec.current&&(ec.current=!0,en(!0),(async()=>{try{let e=await (0,u.i)(()=>fetch("/api/library/search-index",{cache:"no-store"}),"entries");el((0,f.cD)(e.rows)),eo(!1)}catch{el(null),eo(!0),ec.current=!1}finally{en(!1)}})())},[R]);let ej=(0,l.useMemo)(()=>ea&&R.trim()?ea.search(R):null,[ea,R]),eN=(0,l.useCallback)(e=>{ef(e.title),(0,c.trackEvent)("library_filter_used",{filter_type:"search_quick_match",value:e.matchReason})},[ef]),e_=""===p&&""===R&&!(N||M||B),eS=!!($||I||M||N||B),eC=(0,l.useCallback)(()=>{($||I||N||M||B)&&(eh.current+=1),L(""),O(""),q(""),E(""),D(""),(0,c.trackEvent)("library_filter_used",{filter_type:"clear_all",value:"all"})},[$,I,N,M,B]);return(0,a.jsxs)("div",{className:"mx-auto max-w-[1240px] px-5 py-10",children:[(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("div",{className:"text-[13px] font-bold uppercase tracking-[0.2em]",style:{color:P},children:"The Library"}),(0,a.jsx)("h1",{className:"text-4xl md:text-5xl font-black text-white mt-2 leading-[1.05]",children:"paid"===Z?(0,a.jsxs)(a.Fragment,{children:["Your full workout library,",(0,a.jsx)("br",{}),"ready to play."]}):(0,a.jsxs)(a.Fragment,{children:["Explore the workout library.",(0,a.jsx)("br",{}),"Find your next session."]})}),(0,a.jsx)("p",{className:"text-white/55 mt-3 max-w-xl",children:et?`${et.workout.toLocaleString()} workouts and ${et.lesson.toLocaleString()} lessons.`:G?"Complete workouts and lessons, ready when you are.":"Loading your library…"})]}),(0,a.jsxs)("div",{className:"mb-8 min-h-[149px] sm:min-h-[88px]",children:[null===Z&&!m&&(0,a.jsx)("div",{"aria-label":"Checking library access",className:"flex min-h-[149px] items-center rounded-xl border border-white/10 bg-white/[0.03] px-5 py-4 sm:min-h-[88px]",children:(0,a.jsxs)("div",{className:"w-full space-y-2 animate-pulse","aria-hidden":"true",children:[(0,a.jsx)("div",{className:"h-3 w-24 rounded bg-white/8"}),(0,a.jsx)("div",{className:"h-4 w-full max-w-md rounded bg-white/8"}),(0,a.jsx)("div",{className:"h-4 w-2/3 max-w-xs rounded bg-white/8"})]})}),"taste"===Z&&(0,a.jsxs)("div",{className:"flex min-h-[149px] flex-col items-start gap-4 roun
1ded-xl border border-white/10 bg-white/[0.03] px-5 py-4 sm:min-h-[88px] sm:flex-row sm:items-center",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"text-[11px] font-bold uppercase tracking-[0.18em] text-white/65 mb-1",children:"Explore the full library"}),(0,a.jsxs)("p",{className:"text-white font-semibold text-sm leading-snug",children:["Browse every published workout and lesson."," ",(0,a.jsx)("span",{className:"text-white/60 font-normal",children:"A paid membership is needed to watch workouts and lessons."})]})]}),(0,a.jsx)(n(),{href:"/pricing",className:"inline-flex min-h-11 flex-none items-center px-5 py-2.5 rounded-lg text-sm font-bold text-[#111] whitespace-nowrap hover:opacity-90 transition-opacity",style:{background:P},children:"Compare plans"})]}),"paid"===Z&&(0,a.jsxs)("div",{className:"flex min-h-[149px] flex-col items-start gap-4 rounded-xl border border-white/10 bg-white/[0.03] px-5 py-4 sm:min-h-[88px] sm:flex-row sm:items-center",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"text-[11px] font-bold uppercase tracking-[0.18em] text-white/65 mb-1",children:"You're all set"}),(0,a.jsx)("p",{className:"text-white font-semibold text-sm leading-snug",children:"Your full workout and lesson library is ready."})]}),(0,a.jsx)(n(),{href:"/dashboard/videos",className:"inline-flex min-h-11 flex-none items-center px-5 py-2.5 rounded-lg text-sm font-bold text-[#111] whitespace-nowrap hover:opacity-90 transition-opacity",style:{background:P},children:"Open my library"})]}),null===Z&&m&&(0,a.jsx)("div",{className:"flex min-h-[149px] items-center rounded-xl border border-amber-300/20 bg-amber-300/[0.04] px-5 py-4 text-sm text-amber-100/80 sm:min-h-[88px]",children:"We couldn't check your access just now. Retry below."})]}),e_&&!m&&(0,a.jsx)(A,{onPlay:ev,onSeeAll:ey,trainers:J,trainerFilter:$,onTrainerChange:ep,workoutTypeFilter:I,access:Z}),e_&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-black text-white",children:"Browse everything"}),(0,a.jsx)("p",{className:"text-white/65 text-sm",children:"Use the filters to dig into workouts and lessons."})]}),(0,a.jsx)("div",{className:"flex gap-2 flex-wrap mb-4",children:v.map(e=>{let t=p===e.k,r=W?.[e.k||"all"],l=(0,a.jsxs)(a.Fragment,{children:[e.label,null!=r&&(0,a.jsxs)("span",{className:"hidden sm:inline",children:[" \xb7 ",r]})]});return"program"===e.k?(0,a.jsx)(n(),{href:"/training/programs",className:"inline-flex min-h-11 items-center px-4 py-2 rounded-full text-sm font-bold transition-colors",style:{background:"rgba(255,255,255,0.06)",color:"rgba(255,255,255,0.7)"},children:l},e.k):(0,a.jsx)("button",{onClick:()=>em(e.k),className:"inline-flex min-h-11 items-center px-4 py-2 rounded-full text-sm font-bold transition-colors",style:t?{background:P,color:"#111"}:{background:"rgba(255,255,255,0.06)",color:"rgba(255,255,255,0.7)"},children:l},e.k||"all")})}),(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap items-center mb-7",children:[(0,a.jsx)("input",{value:R,onChange:e=>ef(e.target.value),placeholder:"Search the library…","aria-label":"Search the library",className:"min-h-11 px-4 rounded-lg bg-white/8 border border-white/10 text-white text-sm w-64 outline-none focus:border-white/30 placeholder:text-white/65"}),(0,a.jsx)("select",{value:N,onChange:e=>ex(e.target.value),"aria-label":"Filter by level",className:"min-h-11 px-3 rounded-lg bg-white/8 border border-white/10 text-white text-sm outline-none appearance-none pr-8",style:{backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23fff' stroke-opacity='.4' stroke-width='1.5' fill='none'/%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},children:y.map(e=>(0,a.jsx)("option",{value:e.v,className:"text-black",children:e.label},e.v))}),(0,a.jsxs)("select",{value:$,onChange:e=>ep(e.target.value),"aria-label":"Filter by trainer",disabled:0===J.length,className:"min-h-11 px-3 rounded-lg bg-white/8 border border-white/10 text-white text-sm outline-none appearance-none pr-8 disabled:text-white/55",style:{backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23fff' stroke-opacity='.4' stroke-width='1.5' fill='none'/%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},children:[(0,a.jsx)("option",{value:"",className:"text-black",children:J.length>0?"All trainers":"Trainers"}),J.map(e=>(0,a.jsx)("option",{value:e,className:"text-black",children:e},e))]}),K&&(0,a.jsx)("span",{className:"text-sm text-amber-300/80",children:"Trainer filters aren't loading right now. Refresh to try again."}),(0,a.jsx)("select",{value:I,onChange:e=>eb(e.target.value),"aria-label":"Filter by workout type",className:"min-h-11 px-3 rounded-lg bg-white/8 border border-white/10 text-white text-sm outline-none appearance-none pr-8",style:{backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23fff' stroke-opacity='.4' stroke-width='1.5' fill='none'/%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},children:k.map(e=>(0,a.jsx)("option",{value:e.v,className:"text-black",children:e.label},e.v))}),(0,a.jsx)("select",{value:M,onChange:e=>eg(e.target.value),"aria-label":"Filter by duration",className:"min-h-11 px-3 rounded-lg bg-white/8 border border-white/10 text-white text-sm outline-none appearance-none pr-8",style:{backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23fff' stroke-opacity='.4' stroke-width='1.5' fill='none'/%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},children:j.map(e=>(0,a.jsx)("option",{value:e.v,className:"text-black",children:e.label},e.v))}),eS&&(0,a.jsx)("button",{onClick:eC,className:"min-h-11 px-3 rounded-lg text-sm font-bold text-white/70 hover:text-white border border-white/10 hover:border-white/25 transition-colors",children:"Clear filters"}),(0,a.jsx)("div",{className:"text-white/65 text-sm ml-auto",children:m?"Results couldn't load":`${r.toLocaleStr
1ing()} results`})]}),(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap mb-6",children:[(0,a.jsx)("button",{onClick:()=>ew(""),className:"inline-flex min-h-11 items-center px-3 py-1.5 rounded-full text-[12px] font-bold transition-colors",style:B?{background:"rgba(255,255,255,0.05)",color:"rgba(255,255,255,0.72)"}:{background:"rgba(255,255,255,0.12)",color:"#fff"},"aria-pressed":!B,"aria-label":"All phases",children:"All phases"}),_.map(e=>(0,a.jsx)("button",{onClick:()=>ew(B===e.v?"":e.v),className:"inline-flex min-h-11 items-center px-3 py-1.5 rounded-full text-[12px] font-bold transition-colors",style:B===e.v?{background:S[e.v]??"rgba(255,255,255,0.12)",color:C[e.v]??"#fff",outline:`1px solid ${C[e.v]??"#fff"}40`}:{background:"rgba(255,255,255,0.05)",color:"rgba(255,255,255,0.72)"},"aria-pressed":B===e.v,"aria-label":`Filter by phase: ${e.label}`,children:e.short},e.v))]}),""!==R.trim()&&(0,a.jsx)(b,{results:ej??{query:R,best:[],programs:[],workouts:[],lessons:[]},loading:es,error:ei,onSelectVideo:eN}),!d&&m&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 gap-4 text-center",children:[(0,a.jsx)("p",{className:"text-white/60 text-sm max-w-sm",children:m}),(0,a.jsx)("button",{onClick:()=>ek(!0),className:"inline-flex min-h-11 items-center px-5 py-2.5 rounded-lg text-sm font-bold text-[#111]",style:{background:P},children:"Retry"})]}),!m&&(0,a.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:e.map(e=>(0,a.jsx)(z,{it:e,onPlay:()=>ev(e)},e.id))}),Q&&(0,a.jsx)(F,{item:Q,onClose:ed}),!m&&e.length<r&&(0,a.jsx)("div",{className:"text-center mt-8",children:(0,a.jsx)("button",{onClick:()=>ek(!1),disabled:d,className:"inline-flex min-h-11 items-center px-6 py-3 rounded-lg font-bold text-sm disabled:opacity-50",style:{background:P,color:"#111"},children:d?"Loading more videos…":`Show more (${r-e.length})`})}),!d&&!m&&0===e.length&&(0,a.jsxs)("div",{className:"text-center text-white/65 py-20",children:["No videos match these filters.",eS&&(0,a.jsx)("button",{onClick:eC,className:"ml-2 inline-flex min-h-11 items-center underline hover:text-white/70 transition-colors",children:"Clear filters"})]})]})}function z({it:e,onPlay:t}){let r=N[e.level]||N.all,l=Array.isArray(e.tags?.goal)?e.tags.goal:[],s="string"==typeof e.tags?.movement_category?e.tags.movement_category:null,n=e.playable&&!!e.playback_id,i=e.periodization_phase?S[e.periodization_phase]:void 0,c=e.periodization_phase?C[e.periodization_phase]:void 0;return(0,a.jsxs)("div",{role:n?"button":void 0,tabIndex:n?0:void 0,onClick:n?t:void 0,onKeyDown:n?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())}:void 0,"aria-label":n?`Play ${e.title}`:void 0,className:`group rounded-xl overflow-hidden bg-white/[0.03] border border-white/8 hover:border-white/20 transition-colors relative ${n?"cursor-pointer focus:outline-none focus:ring-2 focus:ring-[#F7E645]/70":""}`,children:[(0,a.jsxs)("div",{className:"relative aspect-video bg-[#0a0d12] overflow-hidden",children:[(0,d.tQ)(e.thumbnail_url,e.playback_id,e.poster_url)?(0,a.jsx)(o.nT,{src:(0,d.tQ)(e.thumbnail_url,e.playback_id,e.poster_url),alt:e.title??"",sizes:"(max-width: 768px) 50vw, (max-width: 1024px) 33vw, 25vw",className:"w-full h-full object-cover group-hover:scale-[1.03] transition-transform duration-300"}):(0,a.jsx)("div",{className:"w-full h-full flex items-center justify-center text-white/20 text-xs",children:"no preview"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent"}),(0,a.jsx)("div",{className:"absolute top-2.5 left-2.5 flex gap-1.5",children:(0,a.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full bg-black/55 backdrop-blur text-white/90",children:e.kind})}),e.duration_seconds?(0,a.jsx)("span",{className:"absolute bottom-2.5 right-2.5 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-black/65 text-white",children:E(e.duration_seconds)}):null,!e.locked&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:(0,a.jsx)("div",{className:"w-12 h-12 rounded-full flex items-center justify-center",style:{background:P},children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"#111",children:(0,a.jsx)("path",{d:"M4 2.5v11l9-5.5z"})})})}),e.locked&&(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/60 backdrop-blur-sm gap-2 px-3 text-center",children:[(0,a.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.7)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,a.jsx)("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),(0,a.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),(0,a.jsx)("a",{href:"/pricing",onClick:e=>e.stopPropagation(),className:"text-[11px] font-bold px-3 py-1.5 rounded-lg text-[#111] whitespace-nowrap hover:opacity-90 transition-opacity min-h-[44px] flex items-center",style:{background:P},"aria-label":"Compare memberships to watch workouts and lessons",children:"Compare plans to watch"})]})]}),(0,a.jsxs)("div",{className:"p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:r.c}}),(0,a.jsx)("span",{className:"text-[11px] font-semibold",style:{color:r.c},children:r.label}),e.collection&&(0,a.jsxs)("span",{className:"text-[11px] text-white/65 truncate",children:["\xb7 ",e.collection]})]}),(0,a.jsx)("div",{className:"text-[14px] font-bold text-white leading-tight line-clamp-2",children:e.title}),e.coach_authority&&(0,a.jsx)("div",{className:"text-[11px] text-white/65 mt-0.5 truncate",children:e.coach_authority}),(0,a.jsx)("div",{className:"text-[12px] text-white/65 mt-1 line-clamp-2",children:e.description}),(e.periodization_phase||e.tennis_quality||l.length>0||s)&&(0,a.jsxs)("div",{className:"flex gap-1 flex-wrap mt-2",children:[e.periodization_phase&&(0,a.jsx)("span",{className:"text-[9.5px] px-1.5 py-0.5 rounded font-bold",style:{background:i??"rgba(255,255,255,0.08)",color:c??"rgba(255,255,255,0.55)"},children:e.periodization_phase}),e.tennis_quality&&(0,a.jsx)("span",{className:"text-[9.5px] px-1.5 py-0.5 rounded bg-white/8 text-white/50 font-semibold",children:e.tennis_quality}),s&&(0,a.jsx)("span",{className:"text-[9.5px] px-1.5 py-0.5 rounded bg-white/8 text-white/55 font-semibold",children:s.replace(/-/g," ")}),l.slice(0,1).map((e,t)=>(0,a.jsx)("span",{className:"text-[9.5px] px-1.5 py-0.5 rounded bg-white/6 text-white/65",children:e},t))]})]})]})}function F({item:e,onClose:t}){let[r,s]=(0,l.useState)(null),[n,o]=(0,l.useState)("loading"),[c,d]=(0,l.useState)(0),[u,h]=(0,l.useState)("idle"),m=(0,l.useRef)(null),x=(0,l.useRef)(!1),p=(0,l.useRef)(null),b=(0,l.useCallback)(t=>{if(x.current||!e.catalog_id)return;let r=Math.round(t??e.duration_seconds??0);p.current=r,x.current=!0,h("saving"),fetch("/api/video/progress",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({video_id:e.catalog_id,completed:!0,progress_seconds:r})}).then(async e=>{let t=await e.json().catch(()=>({}
1)),r="string"==typeof t.id&&t.id.trim().length>0;if(!e.ok||!0!==t.ok||!1===t.recorded||!r)throw Error("progress_not_recorded");h("saved")}).catch(()=>{h("error")})},[e.catalog_id,e.duration_seconds]),f=(0,l.useCallback)(()=>{x.current=!1,b(p.current??e.duration_seconds??0)},[e.duration_seconds,b]);return(0,l.useEffect)(()=>{let e=document.activeElement;m.current?.focus();let r=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r),e?.focus?.()}},[t]),(0,l.useEffect)(()=>(0,g.yl)(()=>d(e=>e+1)),[]),(0,l.useEffect)(()=>{let t=!1;return(async()=>{if(!e.playback_id)return o("error");o("loading");try{let r=await fetch("/api/mux/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({playbackId:e.playback_id})});if(t)return;if(401===r.status)return void o("auth");let a=await r.json().catch(()=>({}));if((0,g.Np)(r.status,a.error))return void o("aor");if(!r.ok)return void o("error");s(a),o("ready")}catch{t||o("error")}})(),()=>{t=!0}},[e.playback_id,c]),(0,a.jsx)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"player-dialog-title",onClick:t,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",children:(0,a.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"w-full max-w-4xl",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{id:"player-dialog-title",className:"text-lg font-bold text-white line-clamp-1",children:e.title}),e.coach_authority&&(0,a.jsx)("div",{className:"text-sm text-white/65 mt-0.5",children:e.coach_authority})]}),(0,a.jsx)("button",{ref:m,onClick:t,"aria-label":"Close player",className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/20",children:"✕"})]}),(0,a.jsxs)("div",{className:"overflow-hidden rounded-lg bg-black",style:{aspectRatio:"16 / 9"},children:["loading"===n&&(0,a.jsx)("div",{className:"flex h-full items-center justify-center text-white/50",children:"Opening video…"}),"ready"===n&&e.playback_id&&(0,a.jsx)(i.F4TVideoPlayer,{playbackId:e.playback_id,title:e.title,tokens:r??void 0,onEnded:()=>b(e.duration_seconds??void 0),onTimeUpdate:(e,t)=>{t>0&&e/t>=.9&&b(e)}}),"auth"===n&&(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[(0,a.jsx)("p",{className:"text-white/70",children:"Sign in to watch the full library."}),(0,a.jsx)("a",{href:"/login?next=/library",className:"inline-flex min-h-11 items-center rounded-lg px-5 py-2.5 text-sm font-bold text-[#111]",style:{background:P},children:"Sign in"})]}),"aor"===n&&(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-6 text-center",children:[(0,a.jsx)("p",{className:"text-white font-medium",children:"One confirmation first"}),(0,a.jsx)("p",{className:"text-white/60 text-sm",children:"Check the box on the notice — then this video starts."})]}),"error"===n&&(0,a.jsx)("div",{className:"flex h-full items-center justify-center px-6 text-center text-white/60",children:"This video couldn't be loaded right now. Please try again."})]}),"idle"!==u&&(0,a.jsxs)("div",{className:"mt-3 min-h-11 text-sm","aria-live":"polite",children:["saving"===u&&(0,a.jsx)("p",{className:"text-white/60",children:"Saving to your history…"}),"saved"===u&&(0,a.jsx)("p",{className:"text-[#c5d86d]",children:"Saved to your history"}),"error"===u&&(0,a.jsxs)("p",{className:"text-amber-300",children:["Watch complete, but progress wasn't saved."," ",(0,a.jsx)("button",{type:"button",className:"min-h-11 px-2 font-semibold underline underline-offset-4",onClick:f,children:"Try again"})]})]})]})})}},97992:(e,t,r)=>{Promise.resolve().then(r.bind(r,56806)),Promise.resolve().then(r.bind(r,94672)),Promise.resolve().then(r.bind(r,41122)),Promise.resolve().then(r.bind(r,59655)),Promise.resolve().then(r.bind(r,97210)),Promise.resolve().then(r.t.bind(r,71563,23)),Promise.resolve().then(r.t.bind(r,91468,23))}},e=>{e.O(0,[8655,1563,9087,7333,4672,8946,5299,7422,3137,7358],()=>e(e.s=97992)),_N_E=e.O()}]);

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.