PageSourceSearch

https://club.touchtight.com/assets/SessionDetailV2-Bizl1Plg.js

js touchtight.com collected 2026-10-02 00:02:09 UTC 83,820 bytes, 1 lines download raw bytes

1import{j as e,a as n}from"./react-vendor-DJtAp8P_.js";import{s as na}from"./sessionSaveCopy-2cD21jMD.js";import{S as ia}from"./index-CV4d4vNT.js";import{s as la,S as ca}from"./index-DYb8OJI5.js";import{P as kt,C as Et,D as da}from"./hello-pangea-dnd-1bhs5THC.js";import{ab as ua,c6 as pa,F as Ue,u as Ce,c as Ve,m as mt,o as xt,J as ma,x as Pt,bY as xa,D as ha,c7 as fa,c8 as ht}from"./app-DT7WuczB.js";import{a as fe}from"./api-Ay-9DW4b.js";import{bI as ge,bK as ve,bi as Dt,bt as ba,bC as ga,bq as va,br as ya,cr as ja,bs as Na,bu as ft,c_ as Ca,bw as bt,bm as Lt,aT as Sa,bX as wa,dc as _a}from"./index-CyS3LFy6.js";import{a9 as ka,ao as we,aq as ze,aw as Ze,ar as ke,as as Ee,at as qe,au as We,av as Ye,b as oe,ap as Ea,aA as Ke,q as Pa,ax as Da,F as La,f as Oa,Z as Aa,g as Ra,j as Ta,a0 as gt,a6 as Ma,a5 as Ia,aD as Fa,aE as $a}from"./swiper-react-DcF17yCe.js";import{y as Ot,at as Ga,ar as Ba}from"./mutation--iSLlBrt.js";import{D as Qe,a as Je,b as Xe,c as je,d as Ha}from"./dropdown-menu-Cf_HXWjm.js";import{P as Ua}from"./pencil-D2T7VuLA.js";import{B as Va}from"./bookmark-D81rgROb.js";import{G as za}from"./globe-wjwtVzP3.js";import{T as At}from"./trash-2-B3r-aJQU.js";import{E as Rt}from"./editable-input-BbmoAFqJ.js";import{S as Za}from"./index-CvVUxn0l.js";import{d as qa,k as Wa,P as Ya,N as Ka,a as Ne}from"./practiceTypeDisplay-ixPkQdXG.js";import{C as et}from"./chevron-down-D9vZfud1.js";import{s as tt}from"./imageOptimization-zUL1CBPb.js";import{C as Qa}from"./chevron-up-Cdk80VBZ.js";import{a as Ja}from"./index-Dmrtjh9z.js";import{P as Xa,b as vt,c as er,a as yt}from"./permissions-Yy0NM63Q.js";import{a as tr,b as ar,c as rr}from"./popover-DQmY_bgT.js";import{I as jt}from"./IconTooltipC-CIRgTaC1.js";import{L as sr}from"./layout-grid-71yoZBL3.js";import{I as or}from"./image-CwUTZjHK.js";import{P as nr}from"./plus-jTnJ9Ylg.js";import{ag as Te,ah as Me,$ as Ie,ai as Fe,z as M,an as ir,T as Nt}from"./mui-DvP2hOwX.js";import{c as lr,d as Se,u as cr}from"./index.esm-CWqXbt53.js";import{T as $e}from"./Search-BEYvHCFs.js";import"./query-CcmDMjHA.js";import{M as dr}from"./Modal-BzPnYVEi.js";import"./dayjs-CFxoC4n5.js";import"./moment-Bj79pgB5.js";import"./SessionPlannerMobile-85wkJ1ZS.js";import{u as Tt}from"./s3FileHandler-Bp64keCt.js";import{n as _e}from"./apollo-DL0KWP0Y.js";import{M as ur}from"./index-DCNIU6Vb.js";import{C as pr}from"./index-BHFF4lkW.js";import{F as mr}from"./FileSaver.min-CVXvx7px.js";import{S as xr}from"./switch-DVTTALDv.js";import{g as hr}from"./groupBy-BsGpKOH5.js";import{m as fr}
1from"./mapKeys-BOig4Tgf.js";import"./seededSessionFill-BljGszd4.js";import"./babel-helpers-D2wBBc1I.js";import"./mui-styles-C9F12l22.js";import"./Button-C4goEOKP.js";import"./lodash-icp7yO-G.js";import"./merge-TfBrBrIh.js";import"./_baseAssignValue-CjtYt4eh.js";import"./_baseClone-DByvJCmO.js";import"./isArrayLikeObject-CcVCHQro.js";import"./map-BI8CQ8np.js";import"./browser-B3fhYDhb.js";import"./_arrayIncludes-DFQcso6E.js";import"./_baseIndexOf-DqPIyCu4.js";import"./some-YFJAbcVi.js";import"./values-DeBIqcD0.js";import"./index-B79atc36.js";import"./_baseDifference-BHjDay7E.js";import"./omit-BaIHraq0.js";import"./index-bEsv4Yks.js";import"./mui-x-DMY3qA32.js";import"./compact-DZdspzxW.js";import"./index-DbR5jsy0.js";import"./index-C53T7JDS.js";import"./floating-ui.dom-CpqR1Q5s.js";import"./check-njpSxvzl.js";import"./chevron-right-Bx281FLM.js";import"./PracticeNotesStyle-BI2Oy8Xh.js";import"./file-text-BNcik8vm.js";import"./notebook-pen-CylHQ532.js";import"./useIsMobileShell-BG-PNUUI.js";import"./star-DNcD-a5x.js";import"./heart-SY2Qtxi5.js";import"./tooltip-BAn5bXOX.js";import"./index-CMsqgI2o.js";import"./cloneDeep-mVQ3twB2.js";import"./select-BkBd-IXy.js";import"./triangle-alert-BdPscC9S.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="a6323227-e40d-471e-bd1e-e8f53d18214f",t._sentryDebugIdIdentifier="sentry-dbid-a6323227-e40d-471e-bd1e-e8f53d18214f")}catch{}function br({session:t,rating:u,likes:i,isLikedByUser:o,isLikeLoading:N,isOwnSession:d,canManage:x,hasUnsavedChanges:_,totalMinutes:O,onToggleLike:g,onRateChange:y,onExportPdf:I,onSave:l,saving:E=!1,saveDisabled:c=!1,onEditDetails:j,onSaveForLater:S,onAddToGlobalLibrary:h,canAddToGlobalLibrary:C,onDelete:a,canDelete:T}){const D=t.sessionName||t.session_name||"Untitled session",F=t.durationMins??t.duration,R=!!(F&&O>F);return e.jsxs("header",{className:"px-6 pt-[22px] pb-4 bg-[color:var(--bg)] border-b border-[color:var(--hairline)]",children:[e.jsx("div",{className:"font-mono text-[9px] font-semibold tracking-wide14 uppercase text-[color:var(--subtle)] mb-2",children:"Session Planner · Session Detail"}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"font-head font-bold text-[24px] md:text-[30px] text-[color:var(--fg)] tracking-wide2 uppercase",children:D}),_&&e.jsx("span",{className:"font-mono text-[9.5px] font-semibold text-[color:var(--warn)] tracking-wide14 uppercase",children:"UNSAVED"}),e.jsxs("span",{className:"font-mono text-[10px] font-semibold tracking-wide14 uppercase px-2 py-[3px] rounded-sm bg-[color:var(--card)] border border-solid border-[color:var(--hairline)]",style:{color:R?"var(--warn)":"var(--accent-2)"},children:[O," MIN",F?` / ${F}`:""]}),e.jsxs("div",{className:"ml-auto flex flex-nowrap items-center gap-2 max-w-full",children:[!x&&!d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map($=>e.jsx("button",{type:"button",disabled:d,onClick:()=>y($),className:`w-6 h-6 flex items-center justify-center ${d?"cursor-not-allowed opacity-60":"hover:scale-110"} transition-transform`,"aria-label":`Rate ${$}`,title:d?"Can't rate own session":`Rate ${$}`,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:$<=u.userRating?"var(--accent-2)":"none",stroke:"var(--accent-2)",strokeWidth:"1.2",children:e.jsx("path",{d:"M8 1 L10 6 L15 6 L11 9.5 L12.5 14.5 L8 11.5 L3.5 14.5 L5 9.5 L1 6 L6 6 Z"})})},$)),u.avgRating>0&&e.jsx("span",{className:"font-body text-[10px] text-[color:var(--subtle)] tracking-wide2 ml-1",children:u.avgRating.toFixed(1)})]}),e.jsxs("button",{type:"button",disabled:N,onClick:g,className:"flex items-center gap-1 px-3 py-1.5 bg-[color:var(--card)] border border-[color:var(--hairline)] rounded-sm hover:border-[color:var(--accent-2)] transition-colors",children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:o?"var(--accent)":"none",stroke:"var(--accent)",strokeWidth:"1.2","aria-hidden":!0,
1children:e.jsx("path",{d:"M7 12 C3 9 1 6 1 4 A3 3 0 0 1 7 4 A3 3 0 0 1 13 4 C13 6 11 9 7 12 Z"})}),e.jsx("span",{className:"font-body text-[11px] font-semibold text-[color:var(--fg)] tracking-wide2",children:i})]})]}),e.jsx("button",{type:"button",onClick:I,className:"font-head font-bold text-[11px] tracking-wide14 uppercase px-3 py-2 bg-[color:var(--card)] border border-[color:var(--hairline)] text-[color:var(--fg)] rounded-sm hover:border-[color:var(--accent-2)]",children:"Export PDF"}),x&&e.jsx("button",{type:"button",onClick:l,disabled:c,"aria-busy":E,className:"hidden tab:inline-flex font-head font-bold text-[11px] tracking-wide14 uppercase px-4 py-2 bg-[color:var(--accent-2)] text-[#06080c] rounded-sm hover:opacity-90",children:E?"Saving…":"Save"}),x&&e.jsxs(Qe,{children:[e.jsx(Je,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-9 h-9 flex items-center justify-center bg-[color:var(--card)] border border-[color:var(--hairline)] rounded-sm hover:border-[color:var(--accent-2)] text-[color:var(--fg)] outline-none focus-visible:ring-[3px] focus-visible:ring-[color:var(--focus-ring)]","aria-label":"Session menu",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"3",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"7",cy:"7",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"7",cy:"11",r:"1.4",fill:"currentColor"})]})})}),e.jsxs(Xe,{align:"end",sideOffset:4,children:[e.jsxs(je,{onClick:j,children:[e.jsx(Ua,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Edit details"})]}),e.jsxs(je,{onClick:S,children:[e.jsx(Va,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Save for later"})]}),C&&e.jsxs(je,{onClick:h,children:[e.jsx(za,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Add to Global Library"})]}),T&&e.jsxs(e.Fragment,{children:[e.jsx(Ha,{}),e.jsxs(je,{destructive:!0,onClick:a,children:[e.jsx(At,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Delete session"})]})]})]})]})]})]})]})}const gr=[{key:"practice_type_id",label:"Practice Type",kind:"select",options:ka},{key:"difficultyAgeGroup",label:"Difficulty",kind:"select",options:we},{key:"language",label:"Language",kind:"select",options:ze},{key:"unitRelationShip",label:"Unit Relationship",kind:"select",options:Ze}],vr=[{key:"sets",label:"Sets",kind:"number"},{key:"activeMins",label:"Active",kind:"number",suffix:"MIN"},{key:"restMins",label:"Rest",kind:"number",suffix:"MIN"},{key:"areaWidth",label:"Width",kind:"number",suffix:"M"},{key:"areaLength",label:"Length",kind:"number",suffix:"M"}],yr=[{key:"technical",label:"Technical",kind:"select",options:ke},{key:"tactical",label:"Tactical",kind:"select",options:Ee},{key:"physical",label:"Physical",kind:"select",options:qe},{key:"social",label:"Social",kind:"select",options:We},{key:"psychologicalSocialFocus",label:"Psych + Social",kind:"select",options:Ye}],jr=[{key:"keyCoachingPoints",label:"Key Coaching Points",kind:"textarea",placeholder:"Add key coaching points…"},{key:"progressions",label:"Progressions",kind:"textarea",placeholder:"Add progressions…"},{key:"additionalComments",label:"Additional Comments",kind:"textarea",placeholder:"Add additional comments…"}];function Nr({drill:t,canEdit:u,onFieldChange:i}){const[o,N]=n.useState(()=>({})),d=c=>c in o?o[c]:t[c]??"",x=(c,j)=>{N(S=>({...S,[c]:j}))},_=c=>{if(!(c in o))return;const j=o[c],S=t[c];j!==S&&i({[c]:j})},O="practice-settings-control",g="font-body text-[12px] font-medium text-muted",y="font-body text-[13.5px] text-[color:var(--fg)] w-full bg-transparent placeholder:text-[color:var(--subtle)] focus:outline-none",I="font-body text-[13px] tracking-wide2 text-[color:var(--fg)] w-full bg-transparent focus:outline-none",l=c=>{var h;const j=d(c.key),S=!u;return c.kind==="select"?e.jsxs("label",{className:"flex flex-col gap-[5px]",children:[e.jsx("span",{className:g,children:c.label}),e.jsx("div",{className:O,children:e.jsx(Za,{disabled:S,value:j??"",onChange:C=>{x(c.key,C),i({[c.key]:C})},options:[{value:"",label:"—"},...((h=c.options)==null?void 0:h.map(C=>({value:String(C.id),label:C.name})))??[]],ariaLabel:c.label,className:`px-0 ${S?"opacity-60":""}`,align:"start"})})]},c.key):c.kind==="textarea"?e.jsxs("label",{className:"flex flex-col gap-[5px]",children:[e.jsx("span",{className:g,children:c.label}),e.jsx("textarea",{disabled:S,placeholder:c.placeholder,value:j??"",onChange:C=>x(c.key,C.target.value),onBlur:()=>_(c.key),className:`${O} ${y} min-h-[88px] leading-snug resize-y ${S?"opacity-60 cursor-not-allowed":""}`})]},c.key):c.kind==="number"?e.jsxs("label",{className:"flex flex-col gap-[5px]",children:[e.jsx("span",{className:g,children:c.label}),e.jsxs("div",{className:`${O} flex items-center gap-[6px]`,children:[e.jsx(Rt,{type:"number",disabled:S,value:j??"",onChange:C=>x(c.key,C.target.value===""?"":Number(C.target.value)),onBlur:()=>_(c.key),className:`${I}
1 ${S?"opacity-60 cursor-not-allowed":""}`}),c.suffix&&e.jsx("span",{className:"font-mono text-[9px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase shrink-0",children:c.suffix})]})]},c.key):e.jsxs("label",{className:"flex flex-col gap-[5px]",children:[e.jsx("span",{className:g,children:c.label}),e.jsx("input",{type:"text",disabled:S,value:j??"",onChange:C=>x(c.key,C.target.value),onBlur:()=>_(c.key),className:`${O} ${y} ${S?"opacity-60 cursor-not-allowed":""}`})]},c.key)},E=c=>e.jsx("span",{className:"font-mono text-[9.5px] font-semibold text-[color:var(--subtle)] tracking-wide16 uppercase block mb-[10px]",children:c});return e.jsxs("div",{className:"practice-settings-panel",role:"region","aria-label":"Practice settings",children:[e.jsxs("div",{children:[E("Classification"),e.jsx("div",{className:"practice-settings-grid",children:gr.map(l)})]}),e.jsxs("div",{children:[E("Timing + Area"),e.jsx("div",{className:"practice-settings-grid",children:vr.map(l)})]}),e.jsxs("div",{children:[E("Focus Areas"),e.jsx("div",{className:"practice-settings-grid",children:yr.map(l)})]}),e.jsxs("div",{children:[E("Coaching Detail"),e.jsx("div",{className:"practice-settings-grid",children:jr.map(l)})]})]})}const Cr=[5,10,15,20,25,30,35,40,45,50,55,60],Sr=Array.from({length:120},(t,u)=>u+1),wr=[...Cr.map(t=>({value:t,popular:!0})),...Sr.map(t=>({value:t,popular:!1}))];function _r({value:t,disabled:u,onChange:i}){return e.jsxs("div",{className:"flex items-center gap-1 pl-2.5 pr-1 py-1 bg-[color:var(--bg-raised)] border border-[color:var(--hairline)] rounded-sm shrink-0 box-border transition-colors focus-within:border-[color:var(--accent-2)]",onClick:o=>o.stopPropagation(),children:[e.jsx(Rt,{type:"number",min:1,max:120,disabled:u,value:t??"",placeholder:"0",onChange:o=>i(o.target.value===""?"":Number(o.target.value)),className:"font-body font-semibold text-[13px] text-[color:var(--fg)] w-7 text-right bg-transparent focus:outline-none box-border placeholder:text-[color:var(--subtle)] [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":"Duration in minutes"}),e.jsx("span",{className:"font-mono text-[9px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase",children:"MIN"}),!u&&e.jsxs(Qe,{children:[e.jsx(Je,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Pick a duration",className:"w-5 h-6 flex items-center justify-center text-[color:var(--subtle)] hover:text-[color:var(--fg)] rounded-sm",children:e.jsx(et,{className:"w-3.5 h-3.5"})})}),e.jsx(Xe,{align:"end",sideOffset:4,className:"max-h-[280px] overflow-y-auto min-w-[96px]",children:wr.map((o,N)=>e.jsxs(je,{onClick:()=>i(o.value),className:`justify-between ${Number(t)===o.value?"text-[color:var(--accent-2)]":""}`,children:[e.jsx("span",{className:"font-body text-[13px]",children:o.value}),e.jsx("span",{className:"font-mono text-[9px] text-[color:var(--subtle)] uppercase tracking-wide14",children:"min"})]},`${o.value}-${N}`))})]})]})}const kr=`${ge.CLOUDFRONT_DOMAIN}/${ve.IMAGES.SESSION_PLANNER.THUMBNAILS}`;function Er({drill:t,index:u,bucket:i,expanded:o,canEdit:N,manageClubNotesPermission:d,isOwnDrill:x,onToggleExpand:_,onFieldChange:O,onRemove:g,onMoveUp:y,onMoveDown:I,canMoveUp:l=!1,canMoveDown:E=!1,onSavedToast:c}){const j=t.practice_type_id||i,S=qa(j).toUpperCase(),h=Wa(j),C=h==="--muted"?"--on-media-muted":h==="--accent-2"?"--on-media-accent-2":h,a=t.thumbnail?tt(kr,t.thumbnail):void 0;return e.jsx(kt,{draggableId:`drill-${t.id}-${u}`,index:u,isDragDisabled:!N,children:T=>e.jsxs("div",{ref:T.innerRef,...T.draggableProps,"data-practice-row":t.id,children:[e.jsxs("div",{className:`group bg-[color:var(--card)] border transition-[border-color,box-shadow] duration-200 ${o?"border-[color:var(--accent-2)] rounded-t-[3px] border-b-0":"border-[color:var(--hairline)] rounded-[3px] hover:border-[color:var(--accent-2)] hover:shadow-[0_12px_28px_-16px_rgba(34,211,238,0.45)]"} overflow-hidden`,children:[e.jsxs("div",{className:"planner-practice-header flex flex-wrap items-center gap-2 px-3 py-3 border-b border-[color:var(--hairline)]",children:[e.jsx("div",{...T.dragHandleProps,className:"flex items-center justify-center cursor-grab text-[color:var(--subtle)] hover:text-[color:var(--fg)] shrink-0","aria-label":"Drag practice",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,
1children:[e.jsx("circle",{cx:"4",cy:"3",r:"1.25",fill:"currentColor"}),e.jsx("circle",{cx:"4",cy:"7",r:"1.25",fill:"currentColor"}),e.jsx("circle",{cx:"4",cy:"11",r:"1.25",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"3",r:"1.25",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"7",r:"1.25",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"11",r:"1.25",fill:"currentColor"})]})}),e.jsxs("span",{className:"font-mono text-[9.5px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase shrink-0",children:[Ya[i]," · ",String(u+1).padStart(2,"0")]}),e.jsx("h4",{className:"planner-practice-title m-0 font-head font-bold text-[15px] md:text-[17px] text-[color:var(--fg)] tracking-wide2 uppercase min-w-0 flex-1 transition-colors group-hover:text-[color:var(--accent-2)]",children:t.work_title||"Untitled practice"}),e.jsx(_r,{value:t.durationMins,disabled:!N,onChange:D=>O({durationMins:D})}),N&&(y||I)&&e.jsxs("div",{className:"flex items-center shrink-0 border border-[color:var(--hairline)] rounded-sm overflow-hidden",children:[e.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),y==null||y()},disabled:!l,"aria-label":"Move practice up",className:"w-7 h-7 flex items-center justify-center text-[color:var(--subtle)] hover:text-[color:var(--fg)] hover:bg-[color:var(--card-hi)] disabled:opacity-25 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:e.jsx(Qa,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"w-px h-4 bg-[color:var(--hairline)]","aria-hidden":!0}),e.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),I==null||I()},disabled:!E,"aria-label":"Move practice down",className:"w-7 h-7 flex items-center justify-center text-[color:var(--subtle)] hover:text-[color:var(--fg)] hover:bg-[color:var(--card-hi)] disabled:opacity-25 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:e.jsx(et,{className:"w-3.5 h-3.5"})})]}),N&&e.jsxs(Qe,{children:[e.jsx(Je,{asChild:!0,children:e.jsx("button",{type:"button",onClick:D=>D.stopPropagation(),className:"w-7 h-7 flex items-center justify-center rounded-sm text-[color:var(--subtle)] hover:text-[color:var(--fg)] hover:bg-[color:var(--card-hi)] shrink-0 outline-none focus-visible:ring-[3px] focus-visible:ring-[color:var(--focus-ring)]","aria-label":"Row menu",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"3",r:"1.2",fill:"currentColor"}),e.jsx("circle",{cx:"7",cy:"7",r:"1.2",fill:"currentColor"}),e.jsx("circle",{cx:"7",cy:"11",r:"1.2",fill:"currentColor"})]})})}),e.jsx(Xe,{align:"end",sideOffset:4,children:e.jsxs(je,{destructive:!0,onClick:D=>{D.stopPropagation(),g()},children:[e.jsx(At,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Remove practice"})]})})]})]}),e.jsxs("div",{className:"planner-practice-body flex flex-col md:flex-row gap-4 p-4",children:[e.jsxs("div",{className:"planner-practice-thumbnail relative box-border self-start w-full md:w-[300px] shrink-0 aspect-video rounded-[4px] overflow-hidden bg-[color:var(--card-hi)] bg-cover bg-center",style:a?{backgroundImage:`url(${a})`}:void 0,children:[e.jsx("span",{className:"absolute inset-0 pointer-events-none bg-white opacity-0 group-hover:opacity-[0.06] transition-opacity"}),e.jsx("span",{className:"absolute inset-x-0 bottom-0 h-px pointer-events-none bg-[color:var(--accent-2)] opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-wide16 uppercase px-[6px] py-[3px] bg-[rgba(6,8,12,0.75)] backdrop-blur-sm rounded-sm",style:{color:`var(${C})`},children:S})}),t.media_type==="video"&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-[rgba(6,8,12,0.65)] backdrop-blur-sm flex items-center justify-center",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":!0,children:e.jsx("path",{d:"M2 0 L10 6 L2 12 Z",fill:"white"})})})}),e.jsxs("div",{className:"absolute bottom-2 left-2 flex gap-[6px] font-mono text-[9px] text-white tracking-wide14 uppercase",children:[t.sets&&e.jsxs("span",{className:"px-[6px] py-[3px] bg-[rgba(6,8,12,0.75)] backdrop-blur-sm rounded-sm",children:[t.sets," SETS"]}),t.areaWidth&&t.areaLength&&e.jsxs("span",{className:"px-[6px] py-[3px] bg-[rgba(6,8,12,0.75)] backdrop-blur-sm rounded-sm",children:[t.areaWidth,"×",t.areaLength,"M"]})]})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(Ka,{drill:t,manageClubNotesPermission:d,isOwnDrill:x,onDrillFieldUpdate:O,onSavedToast:c})})]}),e.jsx("div",{className:"px-2 py-1.5 border-t border-[color:var(--hairline)] flex items-center",children:e.jsxs("button",{type:"button",onClick:_,"aria-expanded":o,className:"font-body text-[12px] font-medium text-muted hover:text-fg rounded-sm px-2 min-h-11 w-full transition-colors flex items-center justify-between gap-2 cursor-pointer",children:[e.jsx("span",{children:"Practice settings"}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 14 14",className:`transition-transform ${o?"rotate-180":""}
1`,"aria-hidden":!0,children:e.jsx("path",{d:"M3 5 L7 9 L11 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})})]})})]}),o&&e.jsx(Nr,{drill:t,canEdit:N,onFieldChange:O})]})})}const ee=["warm_ups","main_activities","final_activities","additional_activities"];function Pr({bucket:t,drills:u,expandedDrillId:i,canEdit:o,manageClubNotesPermission:N,loggedInUserId:d,onToggleExpand:x,onFieldChange:_,onRemove:O,onAddDrillCta:g,onMovePractice:y,onSavedToast:I,pickerOpen:l=!1,minimalHeader:E=!1,isActiveTarget:c=!1,onSelectTarget:j}){const S=Ne[t],[h,C]=n.useState(!1);n.useEffect(()=>{l&&c&&C(!1)},[l,c,u.length]);const a=u.reduce((R,q)=>R+(Number(q.durationMins)||0),0),T=ee.indexOf(t),D=T===0,F=T===ee.length-1;return e.jsxs("div",{className:`mb-4 box-border border border-solid rounded-xl overflow-hidden transition-colors ${l&&c?"border-[color:var(--accent-2)] shadow-[0_0_0_1px_var(--accent-2)]":"border-[color:var(--border)]"}`,children:[E?e.jsx("h3",{className:"m-0 border-b border-[color:var(--hairline)] bg-[color:var(--bg-raised)] font-body text-[14px] font-semibold text-fg",children:e.jsx("button",{type:"button",disabled:!o,"aria-pressed":c,onClick:()=>j==null?void 0:j(t),className:"min-h-11 w-full px-3 py-3 text-left font-body text-[14px] font-semibold hover:text-accent-2 disabled:cursor-default",children:S.label})}):e.jsxs("div",{className:`group flex flex-wrap items-center justify-between gap-2 px-3 py-3 bg-[color:var(--bg-raised)] border-b border-[color:var(--hairline)] ${l&&o?"cursor-pointer":""}`,onClick:l&&o?()=>{C(!1),j==null||j(t)}:void 0,children:[e.jsxs("div",{className:"min-w-0 flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{className:"font-mono text-[9.5px] font-semibold text-[color:var(--subtle)] tracking-wide16 uppercase",children:S.kicker}),e.jsx("h3",{className:"m-0 font-body font-semibold text-[14px] text-[color:var(--fg)]",children:S.label}),e.jsxs("span",{className:"font-mono text-[10px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase",children:["(",u.length,")"]}),e.jsxs("span",{className:"font-mono text-[10px] font-semibold text-[color:var(--accent-2)] tracking-wide14 uppercase",children:[a," MIN"]})]}),e.jsxs("div",{className:"flex items-center gap-2 self-center",children:[l&&o&&c&&e.jsx("span",{className:"font-mono text-[9px] font-bold text-[color:var(--bg)] bg-[color:var(--accent-2)] px-2 py-[3px] rounded-sm tracking-wide14 uppercase",children:"Adding Here"}),l&&o&&!c&&e.jsx("span",{className:"hidden group-hover:inline font-mono text-[9px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase",children:"Tap to add here"}),o&&e.jsxs("button",{type:"button",onClick:R=>{R.stopPropagation(),C(!1),g(t)},className:"min-h-11 font-body text-[12px] font-semibold text-[color:var(--accent-2)] hover:text-[color:var(--fg)] flex items-center gap-1",children:[e.jsx("span",{className:"text-[14px] leading-none",children:"+"}),e.jsx("span",{children:"Add Practice"})]}),e.jsx("button",{type:"button","aria-label":`${h?"Expand":"Collapse"} ${S.label}`,"aria-expanded":!h,onClick:R=>{R.stopPropagation(),C(q=>!q)},className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-card-hi hover:text-fg",children:e.jsx(et,{size:16,className:h?"-rotate-90":""})})]})]}),(E||!h)&&e.jsx(Et,{droppableId:`droppable-${t}`,isDropDisabled:!o,children:(R,q)=>e.jsxs("div",{ref:R.innerRef,...R.droppableProps,className:`flex flex-col gap-2.5 p-3 min-h-[72px] ${q.isDraggingOver?"bg-accent-2/[0.14]":""} transition-colors`,children:[u.length===0?o?e.jsxs("button",{type:"button",onClick:()=>g(t),className:`group/empty box-border min-h-[120px] w-full flex flex-col gap-2 items-center justify-center border border-dashed rounded-md bg-transparent p-4 transition-colors cursor-pointer ${q.isDraggingOver?"border-[color:var(--accent-2)] bg-[color:var(--card-hi)]":"border-[color:var(--hairline)] hover:border-[color:var(--accent-2)] hover:bg-[color:var(--card-hi)] hover:shadow-[0_0_0_1px_var(--accent-2),0_8px_24px_-10px_rgba(34,211,238,0.55)]"}`,children:[e.jsx("span",{className:"font-mono text-[10px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase transition-colors group-hover/empty:text-[color:var(--accent-2)]",children:q.isDraggingOver?"Drop practice here":"Drag practices here"}),e.jsx("span",{className:"font-body text-xs text-muted",children:"Or tap to browse practices"})]}):e.jsx("div",{className:"h-[60px] w-full flex items-center justify-center border border-dashed border-[color:var(--hairline)] rounded-sm",children:e.jsx("span",{className:"font-mono text-[10px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase",children:"No practices yet"})}):u.map(($,Z)=>e.jsx(Er,{drill:$,index:Z,bucket:t,expanded:i===$.id,canEdit:o,manageClubNotesPermission:N,isOwnDrill:$.user_id===d,onToggleExpand:()=>x($.id),onFieldChange:ae=>_(t,$.id,ae),onRemove:()=>O($.id),onMoveUp:y?()=>y(t,Z,"up"):void 0,onMoveDown:y?()=>y(t,Z,"down"):void 0,canMoveUp:!(D&&Z===0),canMoveDown:!(F&&Z===u.length-1),onSavedToast:I},`${$.id}-${Z}`)),R.placeholder]})})]})}
1const Dr=12,Lr=`${ge.CLOUDFRONT_DOMAIN}/${ve.IMAGES.SESSION_PLANNER.THUMBNAILS}`,Ct="(max-width: 639px)";function Or(){const[t,u]=n.useState(()=>typeof window>"u"?!1:window.matchMedia(Ct).matches);return n.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(Ct),o=N=>u(N.matches);return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]),t}const Ar=[{id:"format_warm_up",name:"Warm Up"},{id:"format_cool_down",name:"Cool Down"},{id:"format_rondo",name:"Rondo"},{id:"format_opposed_skill",name:"Opposed Skill"},{id:"format_small_sided_game",name:"SSG"},{id:"format_medium_sided_game",name:"MSG"},{id:"format_11v11",name:"11v11"},{id:"format_pattern_of_play",name:"Pattern"},{id:"format_phase_of_play",name:"Phase"},{id:"format_function",name:"Function"},{id:"format_wave_of_play",name:"Wave"},{id:"format_individual",name:"Individual"},{id:"format_fitness_conditioning",name:"Fitness"},{id:"format_lead_practice",name:"Lead"}];function Ge({label:t,options:u,selected:i,onChange:o,isOpen:N,onOpenChange:d}){const x=g=>{o(i.includes(g)?i.filter(y=>y!==g):[...i,g])},_=i.length,O=_>0;return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>d(!N),className:`inline-flex items-center gap-[6px] px-3 py-[6px] rounded-full font-head text-[10px] uppercase tracking-wide14 cursor-pointer transition-colors box-border border border-solid ${O?"bg-[color:var(--accent-2)] text-[#06080c] border-[color:var(--accent-2)]":"bg-[color:var(--card)] text-[color:var(--muted)] border-[color:var(--hairline)] hover:text-[color:var(--fg)] hover:border-[color:var(--accent-2)]"}`,children:[e.jsx("span",{children:t}),_>0&&e.jsx("span",{className:"font-mono text-[9px] font-semibold tracking-wide14",children:_})]}),N&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 z-10 bg-[color:var(--card)] border border-[color:var(--hairline)] rounded-sm p-2 min-w-[200px] shadow-lg max-h-[280px] overflow-y-auto scrollbar-thin-c",children:[u.map(g=>{const y=i.includes(g.id);return e.jsxs("button",{type:"button",onClick:()=>x(g.id),className:`w-full text-left px-2 py-1.5 rounded-sm font-body text-[12px] flex items-center justify-between ${y?"bg-[color:var(--card-hi)] text-[color:var(--accent-2)]":"text-[color:var(--fg)] hover:bg-[color:var(--card-hi)]"}`,children:[e.jsx("span",{children:g.name}),y&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":!0,children:e.jsx("path",{d:"M1 5 L4 8 L9 2",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})})]},g.id)}),_>0&&e.jsx("button",{type:"button",onClick:()=>o([]),className:"w-full mt-1 pt-1 border-t border-[color:var(--hairline)] font-mono text-[9px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase hover:text-[color:var(--fg)]",children:"Clear"})]})]})}function Rr({embedded:t=!1,open:u,onClose:i,loggedInUserId:o,loggedInClubId:N,onAddDrill:d}){const x=Dt(),[_,O]=n.useState(null),[g,y]=n.useState(null),I=Or(),l=!t&&I,[E,c]=n.useState("all"),[j,S]=n.useState(""),[h,C]=n.useState({practice_type_id:[],age_group_id:[],language:[]}),[a,T]=n.useState(null),D=n.useRef(null);n.useEffect(()=>{if(!a)return;const f=B=>{D.current&&!D.current.contains(B.target)&&T(null)},w=B=>{B.key==="Escape"&&T(null)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",w)}},[a]);const[F,R]=n.useState([]),[q,$]=n.useState(0),[Z,ae]=n.useState(0),[ie,re]=n.useState(!1),b=n.useCallback(async f=>{var he;re(!0);const w=f.filtersValue??h,B=f.searchValue??j,W=f.offsetOverride??(f.reset?0:q),z=Object.entries(w).reduce((te,[de,J])=>(J.length>0&&(te[de]=J),te),{}),pe=new URLSearchParams({limit:String(Dr),offset:String(W),filters:JSON.stringify(z)});B&&pe.set("searchQuery",B);try{const te=await fe({url:`/work-list?${pe.toString()}`,method:"GET"}),de=(he=te==null?void 0:te.data)==null?void 0:he.data;if(de){const J=de.rows||[];ae(de.count??J.length),R(Pe=>f.reset?J:[...Pe,...J]),$(W+J.length)}}catch{}finally{re(!1)}},[h,j,q]),P=n.useMemo(()=>ua(f=>{b({reset:!0,offsetOverride:0,searchValue:f})},500),[b]),[m,U]=n.useState(!1);n.useEffect(()=>{u&&!m&&(b({reset:!0,offsetOverride:0}),U(!0))},[u,m,b]),n.useEffect(()=>{m&&b({reset:!0,offsetOverride:0,filtersValue:h})},[h]);const G=n.useMemo(()=>
1{const f=F.filter(B=>o!=null&&B.user_id===o).length,w=F.filter(B=>N!=null&&B.club_id===N&&B.user_id!==o).length;return{all:F.length,my:f,club:w}},[F,o,N]),L=n.useMemo(()=>E==="my"&&o!=null?F.filter(f=>f.user_id===o):E==="club"&&N!=null?F.filter(f=>f.club_id===N&&f.user_id!==o):F,[F,E,o,N]),H=Math.max(Z-F.length,0),Q=[{key:"all",label:"All",count:G.all},{key:"my",label:"My Practices",count:G.my},{key:"club",label:"Club Practices",count:G.club}];return e.jsxs("aside",{className:t?"flex min-h-0 flex-1 flex-col bg-bg":"fixed top-0 h-full w-full md:w-[max(420px,30vw)] md:max-w-[520px] bg-[color:var(--bg)] border-l border-[color:var(--hairline)] flex flex-col z-40 transition-[right] duration-200 ease-out",style:t?void 0:{right:u?0:"-100vw"},"aria-hidden":!u,inert:!u,children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-[color:var(--hairline)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-mono text-[9.5px] font-semibold text-[color:var(--accent-2)] tracking-wide16 uppercase",children:"Practice Library"}),e.jsx(jt,{label:"Close",children:e.jsx("button",{type:"button",onClick:i,className:"w-7 h-7 flex items-center justify-center text-[color:var(--subtle)] hover:text-[color:var(--fg)]","aria-label":"Close practice picker",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,children:e.jsx("path",{d:"M3 3 L11 11 M11 3 L3 11",stroke:"currentColor",strokeWidth:"1.5"})})})})]}),e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("h2",{className:"font-head font-bold text-[20px] text-[color:var(--fg)] tracking-wide2 uppercase",children:"Practice Picker"}),e.jsxs("span",{className:"font-mono text-[10px] font-semibold text-[color:var(--subtle)] tracking-wide14 uppercase",children:[Z," PRACTICES"]})]}),e.jsx("p",{className:"mt-1 font-body text-[12px] text-[color:var(--subtle)] leading-snug",children:"Tap a thumbnail to preview. Quick Add uses the selected section; Add lets you choose. You can also drag practices into a section."})]}),e.jsxs("div",{className:"px-5 pt-2 flex items-center justify-between gap-3 border-b border-[color:var(--hairline)]",children:[e.jsx("div",{role:"tablist",className:"flex items-center gap-5 -mb-px",children:Q.map(f=>{const w=f.key===E;return e.jsxs("button",{role:"tab","aria-selected":w,type:"button",onClick:()=>c(f.key),className:`border-b-2 border-solid pb-2 flex items-center gap-1.5 font-head font-bold text-[11px] tracking-wide14 uppercase transition-colors ${w?"border-[color:var(--accent-2)] text-[color:var(--fg)]":"border-transparent text-[color:var(--muted)] hover:text-[color:var(--fg)]"}`,children:[e.jsx("span",{children:f.label}),e.jsx("span",{className:`font-mono text-[9px] font-semibold tracking-wide14 ${w?"text-[color:var(--accent-2)]":"text-[color:var(--subtle)]"}`,children:f.count})]},f.key)})}),e.jsxs("button",{type:"button",onClick:()=>x("/session-planner/my-library"),className:"font-mono text-[9.5px] font-semibold tracking-wide14 uppercase text-[color:var(--accent-2)] hover:text-[color:var(--fg)] inline-flex items-center gap-1 pb-2",children:[e.jsx("span",{className:"text-[13px] leading-none",children:"+"}),e.jsx("span",{children:"Open Library"})]})]}),e.jsxs("div",{className:"px-5 pt-3 pb-3 flex flex-col gap-3 border-b border-[color:var(--hairline)]",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 bg-[color:var(--card)] border border-[color:var(--hairline)] rounded-sm box-border",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"text-[color:var(--subtle)] shrink-0",children:[e.jsx("circle",{cx:"6",cy:"6",r:"4",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("path",{d:"M9 9 L13 13",stroke:"currentColor",strokeWidth:"1.2"})]}),e.jsx("input",{type:"search",placeholder:"Search practices…",value:j,onChange:f=>{S(f.target.value),P(f.target.value)},className:"flex-1 bg-transparent font-body text-[13px] text-[color:var(--fg)] placeholder:text-[color:var(--subtle)] focus:outline-none"}),j&&e.jsx(jt,{label:"Clear",children:e.jsx("button",{type:"button",onClick:()=>{S(""),b({reset:!0,offsetOverride:0,searchValue:""})},className:"text-[color:var(--subtle)] hover:text-[color:var(--fg)]","aria-label":"Clear search",children:"×"})})]}),e.jsxs("div",{ref:D,className:"flex flex-wrap gap-2",children:[e.jsx(Ge,{label:"Type",options:Ar,selected:h.practice_type_id,onChange:f=>C(w=>({...w,practice_type_id:f})),isOpen:a==="practice_type_id",onOpenChange:f=>T(f?"practice_type_id":null)}),e.jsx(Ge,{label:"Age",options:we,selected:h.age_group_id,onChange:f=>C(w=>({...w,age_group_id:f})),isOpen:a==="age_group_id",onOpenChange:f=>T(f?"age_group_id":null)}),e.jsx(Ge,{label:"Language",options:ze,selected:h.language,onChange:f=>C(w=>({...w,language:f})),isOpen:a==="language",onOpenChange:f=>T(f?"language":null)})]})]}),e.jsx(Et,{droppableId:"drill-picker-source",isDropDisabled:!0,children:f=>e.jsx("div",{ref:f.innerRef,...f.droppableProps,className:l?"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-2":"builder-mobile-flow min-h-0 flex-1 overflow-y-auto px-4 py-4",children:e.jsxs("div",{className:l?"flex flex-col gap-3":"responsive-practice-grid",children:[L.length===0&&!ie&&e.jsx("div",{className:l?void 0:"col-span-full",children:e.jsx(Ja,{compact:!0,icon:sr,title:E==="my"?"No practices you own yet":E==="club"?"No club practices loaded":"No practices match"})}),L.map((w,B)=>{var he;const W=w.thumbnail?tt(Lr,w.thumbnail):void 0,z=w.media_type==="video",pe=((he=w.practice_type_id)==null?void 0:he.replace(/^format_/,"").replace(/_/g," ").replace(/\b[a-z]/g,te=>te.toUpperCase()))||"Practice";return e.jsx(kt,{draggableId:`picker-drill-${w.id}`,index:B,children:(te,de)=>e.jsxs("div",{ref:te.innerRef,...te.draggableProps,...te.dragHandleProps,className:`box-border min-w-0 rounded-lg border border-hairline bg-card p-2 ${de.isDragging?"shadow-xl":""}`,children:[e.jsx("button",{type:"button","aria-label":`Preview ${w.work_title||"practice"}`,onClick:()=>O(w.id),className:"relative block aspect-video w-full overflow-hidden rounded-md border-0 bg-card-hi bg-cover bg-center",style:W?{backgroundImage:`url(${W})`}:void 0,children:e.jsx("span",{className:"absolute bottom-2 right-2 flex h-6 w-6 items-center justify-center rounded-md bg-black/65 text-white",children:z?e.jsx(pa,{size:14}):e.jsx(or,{size:14})})}),e.jsxs("div",{className:"px-2 py-3",children:[e.jsxs("div",{className:"text-xs text-fg",children:[pe,w.durationMins?` · ${w.durationMins} min`:""]}),e.jsxs("div",{className:"mt-2 flex min-w-0 items-center justify-end gap-1",children:[e.jsx("button",{type:"button",className:"inline-flex min-h-9 items-center whitespace-nowrap rounded-sm border-0 bg-transparent px-2 font-head text-[10px] font-bold text-accent-2 transition-colors hover:bg-accent-2/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-2",onClick:()=>
1d(w.id),children:"Quick Add"}),e.jsxs(tr,{open:g===w.id,onOpenChange:J=>y(J?w.id:null),children:[e.jsx(ar,{asChild:!0,children:e.jsxs("button",{type:"button",className:"inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-accent-2/70 bg-card px-2 text-accent-2 transition-colors hover:bg-accent-2 hover:text-bg",children:[e.jsx(nr,{size:14}),e.jsx("span",{className:"font-head text-[10px] font-bold uppercase tracking-wide10",children:"Add"})]})}),e.jsxs(rr,{className:"builder-practice-picker w-56 p-2",align:"end",children:[e.jsx("p",{className:"text-xs",children:"Add to section"}),ee.map(J=>e.jsx("button",{type:"button",className:"block w-full rounded-md border-0 bg-transparent px-3 py-2 text-left text-sm text-fg hover:bg-card-hi",onClick:()=>{d(w.id,J),y(null)},children:Ne[J].label},J))]})]})]}),e.jsx("div",{className:"mt-2 break-words font-body text-sm font-semibold text-fg",children:w.work_title||"Untitled"})]})]})},`picker-${w.id}`)}),f.placeholder]})})}),e.jsxs("div",{className:"box-border h-16 shrink-0 px-4 border-t border-[color:var(--hairline)] flex items-center justify-between [overflow-anchor:none]",children:[e.jsxs("span",{className:"font-mono text-[10px] text-[color:var(--subtle)] tracking-wide14 uppercase",children:[H," REMAINING"]}),e.jsx("button",{type:"button",disabled:ie||H===0,onClick:()=>b({reset:!1}),className:"font-head font-bold text-[11px] tracking-wide14 uppercase px-3 py-1.5 border border-solid border-[color:var(--hairline)] rounded-sm text-[color:var(--fg)] hover:border-[color:var(--accent-2)] disabled:opacity-40 disabled:cursor-not-allowed bg-[color:var(--card)]",children:ie?e.jsxs("span",{role:"status",className:"inline-flex items-center gap-2",children:[e.jsx(ba,{"aria-hidden":"true",className:"h-4 w-4 animate-spin motion-reduce:animate-none text-accent-2"}),"Loading…"]}):"Load More"})]}),e.jsx(Xa,{practiceId:_,library:"club-library",onClose:()=>O(null),onAdd:f=>{d(f),O(null)}})]})}const Tr=t=>n.createElement("svg",{width:268,height:200,viewBox:"0 0 268 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},n.createElement("path",{opacity:.16,fillRule:"evenodd",clipRule:"evenodd",d:"M0.666992 110.434C0.666992 133.465 8.96998 154.453 22.6331 170.315C38.3078 188.517 61.0377 199.962 86.374 200C97.447 200.016 108.035 197.841 117.76 193.869C122.789 191.814 128.417 192.05 133.287 194.484C139 197.335 145.397 198.934 152.152 198.934C154.943 198.934 157.675 198.659 160.319 198.138C167.864 196.654 174.73 193.144 180.368 188.171C183.912 185.045 188.451 183.474 193.089 183.479H193.168C208.495 183.479 222.732 178.628 234.553 170.315C245.12 162.892 253.749 152.706 259.499 140.745C264.512 130.323 267.334 118.549 267.334 106.088C267.334 63.3484 234.126 28.6963 193.168 28.6963C188.992 28.6963 184.902 29.0643 180.911 29.751C170.343 11.9 151.42 0 129.833 0C120.719 0 112.078 2.12094 104.344 5.9229C96.9887 9.52685 90.449 14.6479 85.0994 20.8889C66.9344 21.1911 50.1381 27.3833 36.3909 37.7175C14.7511 53.9751 0.666992 80.4902 0.666992 110.434Z",fill:"url(#paint0_linear_6022_18667)"}),n.createElement("g",{opacity:.2},n.createElement("path",{d:"M151.739 42.0209C150.339 42.0209 148.939 41.4891 147.873 40.4251C145.742 38.297 145.742 34.8346 147.873 32.7069C150.004 30.5795 153.473 30.5788 155.604 32.7069C157.736 34.835 157.736 38.2973 155.604 40.4251C154.539 41.4891 153.139 42.0209 151.739 42.0209ZM151.739 34.873C151.305 34.873 150.87 35.0378 150.539 35.3683C149.878 36.0285 149.878 37.1031 150.539 37.7636C151.201 38.4238 152.276 38.4242 152.938 37.7636C153.599 37.1034 153.599 36.0289 152.938 35.3683C152.608 35.0382 152.173 34.873 151.739 34.873Z",fill:"#2F80ED"}),n.createElement("path",{d:"M108.764 169.444C107.364 169.444 105.964 168.912 104.899 167.849C102.767 165.72 102.767 162.258 104.899 160.13C107.029 158.003 110.499 158.003 112.629 160.13C114.761 162.258 114.761 165.721 112.629 167.849C111.564 168.913 110.164 169.444 108.764 169.444ZM108.764 162.296C108.33 162.296 107.895 162.461 107.564 162.792C106.903 163.452 106.903 164.527 107.564 165.187C108.226 165.848 109.302 165.848 109.964 165.187C110.625 164.527 110.625 163.452 109.964 162.792C109.633 162.462 109.198 162.296 108.764 162.296Z",fill:"#2F80ED"})),n.createElement("g",{opacity:.2},n.createElement("path",{d:"M204.338 143.74C203.856 143.74 203.373 143.556 203.005 143.189L200.756 140.944L198.508 143.189C197.772 143.923 196.578 143.923 195.842 143.189C195.106 142.454 195.106 141.262 195.842 140.527L199.424 136.952C200.159 136.217 201.354 136.217 202.089 136.952L205.671 140.527C206.407 141.262 206.407 142.454 205.671 143.189C205.303 143.556 204.82 143.74 204.338 143.74Z",fill:"#2F80ED"}),n.createElement("path",{d:"M71.382 136.57C70.8999 136.57 70.4169 136.386 70.0493 136.019L67.8005 133.774L65.5516 136.019C64.8161 136.753 63.6217 136.753 62.8862 136.019C62.1499 135.283 62.1499 134.092 62.8862 133.357L66.4678 129.781C67.2033 129.047 68.3977 129.047 69.1332 129.781L72.7148 133.357C73.4511 134.092 73.4511 135.284 72.7148 136.019C72.3468 
1136.386 71.8642 136.57 71.382 136.57Z",fill:"#2F80ED"})),n.createElement("path",{opacity:.16,fillRule:"evenodd",clipRule:"evenodd",d:"M96.2319 96.3767H109.05C110.821 96.3767 112.255 94.9457 112.255 93.1774C112.255 91.409 110.821 89.9781 109.05 89.9781H96.2319C94.4606 89.9781 93.0273 91.409 93.0273 93.1774C93.0273 94.9457 94.4606 96.3767 96.2319 96.3767ZM173.141 89.9781H141.096C139.324 89.9781 137.891 91.409 137.891 93.1774V131.569C137.891 133.337 139.324 134.768 141.096 134.768H173.141C174.913 134.768 176.346 133.337 176.346 131.569V93.1774C176.346 91.409 174.913 89.9781 173.141 89.9781ZM93.0273 105.975C93.0273 104.206 94.4606 102.775 96.2319 102.775H128.277C130.049 102.775 131.482 104.206 131.482 105.975C131.482 107.743 130.049 109.174 128.277 109.174H96.2319C94.4606 109.174 93.0273 107.743 93.0273 105.975ZM96.2319 115.572C94.4606 115.572 93.0273 117.003 93.0273 118.772C93.0273 120.54 94.4606 121.971 96.2319 121.971H128.277C130.049 121.971 131.482 120.54 131.482 118.772C131.482 117.003 130.049 115.572 128.277 115.572H96.2319ZM93.0273 131.569C93.0273 129.8 94.4606 128.37 96.2319 128.37H128.277C130.049 128.37 131.482 129.8 131.482 131.569C131.482 133.337 130.049 134.768 128.277 134.768H96.2319C94.4606 134.768 93.0273 133.337 93.0273 131.569Z",fill:"#2F80ED"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M79.5684 81.02V137.325C79.5684 141.567 83.007 145.006 87.2489 145.006H182.125C186.366 145.006 189.805 141.567 189.805 137.325V81.02H79.5684ZM109.05 96.3766H96.2318C94.4606 96.3766 93.0273 94.9457 93.0273 93.1774C93.0273 91.409 94.4606 89.9781 96.2318 89.9781H109.05C110.821 89.9781 112.255 91.409 112.255 93.1774C112.255 94.9457 110.821 96.3766 109.05 96.3766ZM141.096 89.9781H173.141C174.912 89.9781 176.346 91.409 176.346 93.1774V131.569C176.346 133.337 174.912 134.768 173.141 134.768H141.096C139.324 134.768 137.891 133.337 137.891 131.569V93.1774C137.891 91.409 139.324 89.9781 141.096 89.9781ZM96.2318 102.775C94.4606 102.775 93.0273 104.206 93.0273 105.975C93.0273 107.743 94.4606 109.174 96.2318 109.174H128.277C130.049 109.174 131.482 107.743 131.482 105.975C131.482 104.206 130.049 102.775 128.277 102.775H96.2318ZM93.0273 118.772C93.0273 117.003 94.4606 115.572 96.2318 115.572H128.277C130.049 115.572 131.482 117.003 131.482 118.772C131.482 120.54 130.049 121.971 128.277 121.971H96.2318C94.4606 121.971 93.0273 120.54 93.0273 118.772ZM96.2318 128.37C94.4606 128.37 93.0273 129.8 93.0273 131.569C93.0273 133.337 94.4606 134.768 96.2318 134.768H128.277C130.049 134.768 131.482 133.337 131.482 131.569C131.482 129.8 130.049 128.37 128.277 128.37H96.2318Z",fill:"#2F80ED",fillOpacity:.48}),n.createElement("path",{opacity:.16,fillRule:"evenodd",clipRule:"evenodd",d:"M189.805 63.1062C189.805 58.8644 186.366 55.4257 182.125 55.4257H87.2489C83.007 55.4257 79.5684 58.8644 79.5684 63.1062V81.02H189.805V63.1062ZM96.232 65.0236C94.4373 65.0236 93.0275 66.4311 93.0275 68.2229C93.0275 70.0143 94.4373 71.4222 96.232 71.4222C98.0268 71.4222 99.4366 70.0143 99.4366 68.2229C99.4366 66.4311 98.0268 65.0236 96.232 65.0236ZM109.05 65.0236C107.256 65.0236 105.846 66.4311 105.846 68.2229C105.846 70.0143 107.256 71.4222 109.05 71.4222C110.845 71.4222 112.255 70.0143 112.255 68.2229C112.255 66.4311 110.845 65.0236 109.05 65.0236ZM121.868 65.0236C120.074 65.0236 118.664 66.4311 118.664 68.2229C118.664 70.0143 120.074 71.4222 121.868 71.4222C123.663 71.4222 125.073 70.0143 125.073 68.2229C125.073 66.4311 123.663 65.0236 121.868 65.0236Z",fill:"#2F80ED"}),n.createElement("path",{opacity:.8,fillRule:"evenodd",clipRule:"evenodd",d:"M96.2319 65.0236C94.4371 65.0236 93.0273 66.431 93.0273 68.2228C93.0273 70.0142 94.4371 71.4221 96.2319 71.4221C98.0267 71.4221 99.4365 70.0142 99.4365 68.2228C99.4365 66.431 98.0267 65.0236 96.2319 65.0236ZM109.05 65.0236C107.255 65.0236 105.846 66.431 105.846 68.2228C105.846 70.0142 107.255 71.4221 109.05 71.4221C110.845 71.4221 112.255 70.0142 112.255 68.2228C112.255 66.431 110.845 65.0236 109.05 65.0236ZM121.868 65.0236C120.074 65.0236 118.664 66.431 118.664 68.2228C118.664 70.0142 120.074 71.4221 121.868 71.4221C123.663 71.4221 125.073 70.0142 125.073 68.2228C125.073 66.431 123.663 65.0236 121.868 65.0236Z",fill:"#2F80ED"}),n.createElement("defs",null,n.createElement("linearGradient",{id:"paint0_linear_6022_18667",x1:183.339,y1:235.573,x2:281.441,y2:14.4711,gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#2F80ED"}),n.createElement("stop",{offset:1,stopColor:"#919EAB",stopOpacity:.01}),n.createElement("stop",{offset:1,stopColor:"#2F80ED",stopOpacity:.01})))),ne={accordion:{"&.MuiAccordion-root":{boxShadow:"none"},"&.MuiAccordion-root.Mui-expanded":{margin:"0"}},accordionSummary:{"&.MuiAccordionSummary-root":{padding:"12px 24px"},"& .MuiAccordionSummary-content":{fontWeight:600,lineHeight:"24px"},"& .MuiAccordionSummary-content.Mui-expanded":{margin:"12px 0px"},"&.MuiAccordionSummary-root.Mui-expanded":{borderTop:t=>`1px solid ${t.palette.divider}`,borderBottom:t=>`1px solid ${t.palette.divider}`}}
1,accordionDetail:{"&.MuiAccordionDetails-root":{padding:"16px"}},heading:{fontWeight:700,lineHeight:"36px",fontSize:"24px"}},Mr={sessionName:"",visibility:"",sessionType:"",difficultyAgeGroup:"",noOfPlayers:"",language:"",sessionObjective:"",technical:"",tactical:"",physical:"",social:"",psychologicalSocialFocus:"",unitRelationShip:"",psychological:"",durationMins:"",coachNotes:""},Ir=`${ge.CLOUDFRONT_DOMAIN}/${ve.DOCUMENTS.SESSION_PLANNER.SESSION}`,Fr=({open:t,handleClose:u,selectedSession:i,isDuplicate:o,getSession:N})=>{var Z,ae,ie,re;const[d]=Ue(),[x,_]=n.useState(!1),[O]=_e(Ot),g=Ce(b=>b.club),{selectedFiles:y,setSelectedFiles:I,startUploadOnS3:l,handleRemoveFiles:E}=Tt(),c=Ce(b=>{var P;return(P=b==null?void 0:b.user)==null?void 0:P.userPermission}),j=c.planId===1?c.permission.documents-g.documentsCount:5,S=Ve(),h=`${ge.CLOUDFRONT_DOMAIN}/${ve.IMAGES.SESSION_PLANNER.THUMBNAILS}`,C=lr({sessionName:Se().required("Session Name is required"),visibility:Se().required("Visibility is required"),sessionType:Se().required("Session Type is required"),difficultyAgeGroup:Se().required("Difficulty Age Groups required"),language:Se().required("Key Coaching Points is required")}),a=cr({initialValues:mt(i)?Mr:i,enableReinitialize:!0,validationSchema:C,onSubmit:async b=>{_(!0),await l(ve.DOCUMENTS.SESSION_PLANNER.SESSION,ge.S3_MEDIA_BUCKET)?await F(b):d({msg:"Unable to update documents at the moment.",variant:"error"}),_(!1)}}),T=()=>{u(),a.resetForm(),I([])},D=async b=>{if(y!=null&&y.length)for(const P of y)await O({variables:{uploadDocument:{name:P.name,size:P==null?void 0:P.size,url:P.url,docType:Ra(P==null?void 0:P.name),parentId:1,clubId:(S==null?void 0:S.club_id)??0,session_planner_session_id:b}}})},F=async b=>{var m,U;const P={...mt(i)||o?{}:{id:i.id},session_name:b.sessionName,type:b.visibility,session_type_id:b.sessionType,age_group_id:b.difficultyAgeGroup,no_of_players:b.noOfPlayers,language:b.language,session_objective:b.sessionObjective,technical_id:b.technical,tactical_id:b.tactical,physical:b.physical,social:b.social,psychological:b.psychological,unit_relationship:b.unitRelationShip,duration:b.durationMins,coach_notes:b.coachNotes,practices:b.practices};try{let G=!1,L={};if(o){const{data:{success:H,data:Q}}=await xt({url:"/create-session",method:"POST",data:P});G=H,L=Q}else{const{data:{success:H}}=await xt({url:"/update-session",method:"POST",data:P});G=H}G&&(d({msg:`Practice ${o?"duplicated":"updated"} successfully`,variant:"success"}),D(o?L.id:i.id),!o&&N()),T()}catch(G){const L=(U=(m=G==null?void 0:G.response)==null?void 0:m.data)==null?void 0:U.errorCode;d(L==="SESSION_LIMIT_REACHED"?{msg:"You've reached your session plan limit. Upgrade your plan to create more.",variant:"error"}:{msg:"Something went wrong. Please try again.",variant:"error"})}},R=b=>{const P=[...a.values.practices];a.setFieldValue("practices",P.filter(m=>m.id!==b))},q=(b,P,m)=>{m==="clear"&&E(y)},$=(b,P,m)=>{if(m==="removeOption"){const U=y.map((L,H)=>({id:H,name:L.name})),G=Ta(U,P,"id");E(G)}};return e.jsxs(dr,{open:t,padding:"0px",loading:x,title:"Manage Session",disabledHandleKeyPress:!0,handleClose:T,actionHandler:a.handleSubmit,actionBtnTitle:o?"Duplicate Session":"Save Session",children:[e.jsxs(Te,{sx:ne.accordion,children:[e.jsx(Me,{sx:ne.accordionSummary,expandIcon:e.jsx(Ie,{}),children:"Practice Settings"}),e.jsx(Fe,{sx:ne.accordionDetail,children:e.jsxs(M,{container:!0,gap:3,p:1,children:[e.jsxs(M,{container:!0,spacing:3,size:12,children:[e.jsx(M,{size:6,children:e.jsx($e,{label:"Session Name",name:"sessionName",value:a.values.sessionName,onChange:a.handleChange,error:a.touched.sessionName&&!!a.errors.sessionName,helperText:a.touched.sessionName&&a.errors.sessionName})}),e.jsx(M,{size:6,children:e.jsx(oe,{label:"Visibility",name:"visibility",value:a.values.visibility,onChange:a.handleChange,options:Ea,error:a.touched.visibility&&!!a.errors.visibility,helperText:a.touched.visibility&&a.errors.visibility})})]}),e.jsxs(M,{container:!0,spacing:3,size:12,children:[e.jsx(M,{size:6,children:e.jsx(oe,{label:"Session Type",name:"sessionType",value:a.values.sessionType,onCh
1ange:a.handleChange,options:Ke,error:a.touched.sessionType&&!!a.errors.sessionType,helperText:a.touched.sessionType&&a.errors.sessionType})}),e.jsx(M,{size:6,children:e.jsx(oe,{label:"Difficulty / Age Group",name:"difficultyAgeGroup",value:a.values.difficultyAgeGroup,onChange:a.handleChange,options:we,error:a.touched.difficultyAgeGroup&&!!a.errors.difficultyAgeGroup,helperText:a.touched.difficultyAgeGroup&&a.errors.difficultyAgeGroup})}),e.jsx(M,{size:6,children:e.jsx(oe,{label:"Language",name:"language",value:a.values.language,onChange:a.handleChange,options:ze,error:a.touched.language&&!!a.errors.language,helperText:a.touched.language&&a.errors.language})})]})]})})]}),e.jsxs(Te,{sx:ne.accordion,children:[e.jsx(Me,{sx:ne.accordionSummary,expandIcon:e.jsx(Ie,{}),children:"Additional Session Settings"}),e.jsx(Fe,{sx:ne.accordionDetail,children:e.jsxs(M,{container:!0,gap:3,p:1,children:[e.jsx($e,{label:"Session Objective",multiline:!0,maxRows:6,minRows:6,name:"sessionObjective",value:a.values.sessionObjective,onChange:a.handleChange,error:a.touched.sessionObjective&&!!a.errors.sessionObjective,helperText:a.touched.sessionObjective&&a.errors.sessionObjective}),e.jsxs(M,{container:!0,spacing:3,size:12,children:[e.jsx(M,{size:6,children:e.jsx(oe,{label:"No of Players",name:"noOfPlayers",value:a.values.noOfPlayers,onChange:a.handleChange,options:Pa(50),error:a.touched.noOfPlayers&&!!a.errors.noOfPlayers,helperText:a.touched.noOfPlayers&&a.errors.noOfPlayers})}),e.jsx(M,{size:6,children:e.jsx(oe,{label:"Duration (Mins)",name:"durationMins",value:a.values.durationMins,onChange:a.handleChange,options:Da,error:a.touched.durationMins&&!!a.errors.durationMins,helperText:a.touched.durationMins&&a.errors.durationMins})})]}),e.jsxs(M,{container:!0,spacing:3,size:12,children:[e.jsx(M,{size:6,children:e.jsx(oe,{label:"Technical",name:"technical",value:a.values.technical,onChange:a.handleChange,options:ke,error:a.touched.technical&&!!a.errors.technical,helperText:a.touched.technical&&a.errors.technical})}),e.jsx(M,{size:6,children:e.jsx(oe,{label:"Tactical",name:"tactical",value:a.values.tactical,onChange:a.handleChange,options:Ee,error:a.touched.tactical&&!!a.errors.tactical,helperText:a.touched.tactical&&a.errors.tactical})})]}),e.jsxs(M,{container:!0,spacing:3,size:12,children:[e.jsx(M,{size:6,children:e.jsx(oe,{label:"Physical",name:"physical",value:a.values.physical,onChange:a.handleChange,options:qe,error:a.touched.physical&&!!a.errors.physical,helperText:a.touched.physical&&a.errors.physical})}),e.jsx(M,{size:6,children:e.jsx(oe,{label:"Psychological",name:"psychological",value:a.values.psychological,onChange:a.handleChange,options:Ye,error:a.touched.psych
1ological&&!!a.errors.psychological,helperText:a.touched.psychological&&a.errors.psychological})})]}),e.jsxs(M,{container:!0,spacing:3,size:12,children:[e.jsx(M,{size:6,children:e.jsx(oe,{label:"Social",name:"social",value:a.values.social,onChange:a.handleChange,options:We,error:a.touched.social&&!!a.errors.social,helperText:a.touched.social&&a.errors.social})}),e.jsx(M,{size:6,children:e.jsx(oe,{label:"Unit Relationship",name:"unitRelationShip",value:a.values.unitRelationShip,onChange:a.handleChange,options:Ze,error:a.touched.unitRelationShip&&!!a.errors.unitRelationShip,helperText:a.touched.unitRelationShip&&a.errors.unitRelationShip})})]}),e.jsx($e,{label:"Coach Notes",multiline:!0,maxRows:6,minRows:6,name:"coachNotes",value:a.values.coachNotes,onChange:a.handleChange,error:a.touched.coachNotes&&!!a.errors.coachNotes,helperText:a.touched.coachNotes&&a.errors.coachNotes}),e.jsxs(M,{container:!0,py:2,size:12,children:[e.jsx(La,{fileUrl:Ir,limit:j,selectedFiles:y,setSelectedFiles:I}),e.jsx(M,{pt:2,size:12,children:e.jsx(Oa,{name:"selectedFiles",label:"Selected Files",value:y.map((b,P)=>({id:P,name:b.name})),options:y.map((b,P)=>({id:P,name:b.name})),onInputChange:q,onChange:$})})]})]})})]}),e.jsxs(Te,{sx:ne.accordion,defaultExpanded:!0,children:[e.jsx(Me,{sx:ne.accordionSummary,expandIcon:e.jsx(Ie,{}),children:"Practice"}),e.jsx(Fe,{sx:ne.accordionDetail,children:e.jsx(M,{container:!0,spacing:3,p:1,children:((ae=(Z=a.values)==null?void 0:Z.practices)==null?void 0:ae.length)>0?(re=(ie=a.values)==null?void 0:ie.practices)==null?void 0:re.map((b,P)=>e.jsx(M,{size:6,children:e.jsx(Aa,{isModifiable:!0,id:b.id,imageUrl:b.thumbnail_signed_url||tt(h,b.thumbnail),title:b.work_title,checkBox:!1,handleClickDelete:R})},P)):e.jsxs(ir,{container:!0,p:3,gap:7,alignItems:"center",direction:"column",sx:ne.box,children:[e.jsx(M,{children:e.jsx(Tr,{})}),e.jsx(M,{children:e.jsxs(M,{container:!0,gap:2,justifyContent:"center",children:[e.jsx(Nt,{sx:ne.heading,children:"No Practices"}),e.jsx(Nt,{sx:ne.boxText,children:"Search and select practices here."})]})})]})})})]})]})};function $r(t){return ma("session-planner-editors-v2")?e.jsx(ur,{...t}):e.jsx(Fr,{...t})}const Gr={"Full Description Vertical":$a,"Full Description Horizontal":Fa,"Grid 2x2 Vertical":Ia,"Grid 2x2 Horizontal":Ma},Mt=[{value:"Full Description Vertical",title:"Full Description",sub:"Every drill, full detail"},{value:"Grid 2x2 Vertical",title:"Image Grid",sub:"4-up, images only"}],It=[{value:"Full Description Horizontal",title:"Full Description",sub:"Every drill, full detail"},{value:"Grid 2x2 Horizontal",title:"Image Grid",sub:"4-up, images only"}],St=new Set([...Mt,...It].map(t=>t.value)),Be=t=>t==="portrait"?"Full Description Vertical":"Full Description Horizontal",Br=`${ge.CLOUDFRONT_DOMAIN}/${ve.DOCUMENTS.SESSION_PLANNER.SESSION}`;function Hr({open:t,handleCloseModal:u,session:i}){const o=Ce(m=>m.club),N=Ce(m=>m.user),d=N==null?void 0:N.userDetail,[x]=Ue(),_=Pt(),{uploadFile:O}=Tt(),[g]=_e(Ot),[y,I]=n.useState(()=>localStorage.getItem("pdfOrientation")||"portrait"),[l,E]=n.useState(""),[c,j]=n.useState(!0),[S,h]=n.useState(null),[C,a]=n.useState(!1),[T,D]=n.useState(null),[F,R]=n.useState(!1),q=y==="portrait"?Mt:It,$=(i==null?void 0:i.sessionName)||(i==null?void 0:i.session_name)||"Untitled session";n.useEffect(()=>{t&&(o!=null&&o.club_logo)&&xa(`${ga}/${o.club_logo}`,72,!0).then(h)},[t,o==null?void 0:o.club_logo]);const Z=n.useMemo(()=>{const m=(i==null?void 0:i.practices)||{},U=ee.flatMap(L=>m[L]||[]),G=Object.keys(m).filter(L=>!ee.includes(L)).flatMap(L=>m[L]||[]);return[...U,...G].map(L=>{const H=L;return{...H,title:H.work_title,description:H.work_description}})},[i==null?void 0:i.practices]),ae=({selectedDesign:m})=>{const U=(i==null?void 0:i.durationMins)??(i==null?void 0:i.duration),G=i==null?void 0:i.noOfPlayers,L=Ee.find(z=>String(z.id)===String(i==null?void 0:i.tactical)),H=ke.find(z=>String(z.id)===String(i==null?void 0:i.technical)),Q=Ke.find(z=>String(z.id)===String(i==null?void 0:i.sessionType)),f=we.find(z=>String(z.id)===String(i==null?void 0:i.difficultyAgeGroup)),w=`${(d==null?void 0:d.username)||""} ${(d==null?void 0:d.lastname)||""}`.trim(),B={sessionName:$,practices:Z,duration:U,ageGroup:f==null?void 0:f.name,clubName:o==null?void 0:o.club_name,noOfPlayers:G,sessionType:Q==null?void 0:Q.name,coachesName:w,clubLogo:S},W=Gr[m];return W?m==="Full Description Vertical"?e.jsx(W,{...B,tactical:L==null?void 0:L.name,technical:H==null?void 0:H.name}):m==="Full Description Horizontal"?e.jsx(W,{...B,session:i,tactical:L==null?void 0:L.name,technical:H==null?void 0:H.name}):e.jsx(W,{...B}):null},ie=async()=>{var m,U,G,L,H;a(!0);try{const Q=await gt(e.jsx(ae,{selectedDesign:l})).toBlob(),f=`${$.replace(/\s+/g,"_")}_${l.replace(/\s+/g,"_")}.pdf`;if(Q.name=f,c&&await O(Q,ve.DOCUMENTS.SESSION_PLANNER.SESSION,ge.S3_MEDIA_BUCKET)){const B={name:f,size:Q.size,url:`${Br}/${f}`,docType:"pdf",parentId:1,clubId:o==null?void 0:o.id,session_planner_session_id:i==null?void 0:i.id},W=await g({variables:{uploadDocument:B}});(U=(m=W==null?void 0:W.data)==null?void 0:m.uploadDocument)!=null&&U.success||x({msg:"Unable to save PDF in documents at the moment",variant:"error"}),(H=_==null?void 0:_.capture)==null||H.call(_,ha.SESSION_PLANNER_SESSION_PDF_CREATED,{customData:{userId:d==null?void 0:d.id,email:d==null?void 0:d.email,clubId:d==null?void 0:d.club_id,roles:(L=(G=d==null?void 0:d.userRolesPermissions)==null?void 0:G.roles)==null?void 0:L.map(z=>z.name)}})}mr.saveAs(Q,f)}catch{x({msg:"Could not generate the PDF. Please try again.",variant:"error"})}finally{re(),a(!1)}},re=()=>{E(""),R(!1),D(null),u()};n.useEffect(()=>{if(t){const m=localStorage.getItem("pdfDesign");E(m&&St.has(m)?m:Be(y)),setTimeout(()=>R(!0),100)}else R(!1),D(null)},[t]),n.useEffect(()=>{let m=null;return l&&F&&i&&Z.length>0&&(D(null),gt(e.jsx(ae,{selectedDesign:l})).toBlob().then(U=>{m=URL.createObjectURL(U),D(m)}).catch(U=>console.error("Error generating preview:",U))),()=>{m&&URL.revokeObjectURL(m)}},[l,F,Z.length,S,y]);const b=m=>{I(m),localStorage.setItem("pdfOrientation",m);const U=l?l.replace(/(Vertical|Horizontal)$/,m==="portrait"?"Vertical":"Horizontal"):Be(m),G=St.has(U)?U:Be(m);E(G),localStorage.setItem("pdfDesign",G)},P=m=>{E(m),localStorage.setItem("pdfDesign",m)};return e.jsx(va,{open:t,onOpenChange:m=>m?void 0:re(),children:e.jsxs(ya,{className:"bg-card-hi border border-tt-border max-w-2xl font-body max-h-[90vh] overflow-y-auto",children:[e.jsxs(ja,{className:"space-y-1",children:[e.jsx("div",{className:"font-mono text-[9.5px] uppercase tracking-wide14 text-subtle",children:"Session Planner · Export PDF"}),e.jsx(Na,{className:"font-head text-[15px] font-bold uppercase tracking-wide10 text-fg",children:"Export Session Plan"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wide14 text-muted mb-2",children:"Orientation"}),e.jsx("div",{className:"flex gap-2",children:["portrait","landscape"].map(m=>e.jsx("button",{type:"button",onClick:()=>b(m),className:ft("box-border font-head text-[12px] uppercase tracking-wide10 px-4 py-2 rounded border",y===m?"bg-accent text-bg border-accent":"bg-card text-muted border-tt-border"),children:m},m))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wide14 text-muted mb-2",children:"Template"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:q.map(m=>e.jsxs("button",{type:"button",onClick:()=>P(m.value),className:ft("box-border text-left px-3 py-3 rounded border",l===m.value?"bg-accent/10 border-accent":"bg-card border-tt-border"),children:[e.jsx("div",{className:"font-head text-[13px] font-bold uppercase tracking-wide10 text-fg",children:m.title}),e.jsx("div",{className:"font-body text-[11px] text-muted mt-0.5",children:m.sub})]},m.value))})]}),e.jsx("div",{className:"flex flex-col gap-3",children:e.jsxs("label",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-body text-[13px] text-fg",children:"Save PDF to Documents"}),e.jsx(xr,{checked:c,onCheckedChange:j})]})}),F&&e.jsx("div",{className:"w-full h-[460px] border border-tt-border rounded overflow-hidden bg-card",children:T?e.jsx("object",{data:T,type:"application/pdf",width:"100%",height:"100%","aria-label":"PDF Preview",children:e.jsx("iframe",{src:T,width:"100%",height:"100%",style:{border:"none"},title:"PDF Preview"})}):e.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[11px] uppercase tracking-wide14 text-muted",children:"Generating preview…"})}),e.jsxs(Ca,{children:[e.jsx(bt,{variant:"ghost",onClick:re,disabled:C,className:"font-head uppercase tracking-wide10",children:"Cancel"}),e.jsx(bt,{onClick:ie,disabled:!l||C,className:"font-head uppercase tracking-wide10",children:C?"Exporting…":"Export"})]})]})})}const Ft=[["duration","durationMins"],["active_mins","activeMins"],["rest_mins","restMins"],["area_width","areaWidth"],["area_length","areaLength"],["key_coaching_points","keyCoachingPoints"],["additional_comments","additionalComments"],["technical_id","technical"],["tactical_id","tactical"],["psychological_social_focus","psychologicalSocialFocus"],["unit_relationship","unitRelationShip"],["age_group_id","difficultyAgeGroup"]],wt=t=>{const u={...t};return Ft.forEach(([i,o])=>{u[o]===void 0&&(u[o]=t[i])}),u},Ur=t=>
1{const u=t,i={...u};return Ft.forEach(([o,N])=>{u[N]!==void 0&&(i[o]=u[N])}),i};function He({routeId:t,loadedId:u,canManage:i,saving:o,hasDraft:N}){const d=Number(t);return Number.isSafeInteger(d)&&d>0&&u===d&&i&&!o&&N}const _t=()=>ee.reduce((t,u)=>(t[u]=[],t),{}),No=()=>{const{id:t}=Lt(),u=Ve();return e.jsx(Vr,{},`${u==null?void 0:u.id}:${u==null?void 0:u.club_id}:${t}`)},Vr=()=>{var ct,dt,ut;const{id:t}=Lt(),u=Sa(),i=Dt(),[o,N]=wa(),[d]=Ue(),x=Pt(),_=u.state,O=(_==null?void 0:_.currentLibrary)||"club-library",g=Ve(),y=Ce(s=>{var r;return(r=s==null?void 0:s.user)==null?void 0:r.userPermission}),I=(g==null?void 0:g.id)!=null?Number(g.id):void 0,[l,E]=n.useState({id:0,practices:_t()}),c=n.useRef(l);c.current=l;const j=fa(),S={userId:String((g==null?void 0:g.id)??""),clubId:String((g==null?void 0:g.club_id)??"")},h=n.useRef(!0),C=n.useRef(!1),[a,T]=n.useState(!1),D=Ce(s=>s.plannerPracticeDrafts),F=ht(D.owner,S),R=F&&!!D.pending[String(t)],q=F?D.entries[String(t)]:void 0;n.useEffect(()=>(h.current=!0,()=>{h.current=!1}),[]);const $=()=>{const s=j.getState().plannerPracticeDrafts;return ht(s.owner,S)?s.entries[String(t)]:void 0},[Z,ae]=n.useState({avgRating:0,userRating:0,totalRatings:0}),[ie,re]=n.useState(0),[b,P]=n.useState(null),[m,U]=n.useState(!1),[G,L]=n.useState(null),[H,Q]=n.useState("warm_ups"),[f,w]=n.useState(0),[B,W]=n.useState(!!(_!=null&&_.openDrillPicker)),[z,pe]=n.useState(!1);n.useEffect(()=>{pe(!!q)},[q]);const[he,te]=n.useState("activities"),[de,J]=n.useState(!1),[Pe,De]=n.useState(!1),[at,rt]=n.useState(!1),[$t,st]=n.useState(!1),[Gt]=_e(Ga),[Bt]=_e(Ba),Ht=vt(g,O,y),ot=I===(l==null?void 0:l.user_id),le=yt(Ht,ot),Le=(ut=(dt=(ct=g==null?void 0:g.userRolesPermissions)==null?void 0:ct.permissions)==null?void 0:dt.sessionPlanner)==null?void 0:ut.general,Ut=Le==null?void 0:Le.manageClubNotes,Vt=er(y),nt=n.useMemo(()=>ee.reduce((s,r)=>{var v;const p=((v=l.practices)==null?void 0:v[r])||[];return s+p.reduce((k,A)=>k+(Number(A.durationMins)||0),0)},0),[l.practices]),Oe=n.useCallback(async()=>{var K;const s=await fe({url:`/single-session/${Number(t)}`,method:"GET"});if(!((K=s==null?void 0:s.data)!=null&&K.success)||!s.data.data||!h.current)return;const r=s.data.data,p=hr(r.session_planner_works??[],"session_planner_session_work.practice_type"),v=fr(p,(X,Y)=>_a[Y]||Y),k=Object.fromEntries(Object.entries(v).map(([X,Y])=>[X,Y.map(wt)])),A=yt(vt(g,O,y),I===r.user_id)?$():void 0;E({...r,sessionName:r.session_name,visibility:r.type,sessionType:r.session_type_id,difficultyAgeGroup:r.age_group_id,noOfPlayers:r.no_of_players,language:r.language,sessionObjective:r.session_objective,durationMins:r.duration,technical:r.technical_id,tactical:r.tactical_id,physical:r.physical,social:r.social,psychological:r.psychological,unitRelationShip:r.unit_relationship,coachNotes:r.coach_notes,practices:(A==null?void 0:A.practices)??{..._t(),...k}}),P((r==null?void 0:r.isLikedByUser)===1),re((r==null?void 0:r.likes)||0),ae({avgRating:r.average_rating||0,totalRatings:r.totalRatings||0,userRating:r.userRating||0}),pe(!!A)},[t]),ce=n.useCallback(async(s,r=!1)=>{var v,k,A,K;if(!r||!He({routeId:t,loadedId:c.current.id,canManage:le,saving:C.current||R,hasDraft:!!$()}))return;const p=(v=$())==null?void 0:v.revision;C.current=!0,T(!0),j.dispatch({type:"START_PLANNER_PRACTICE_SAVE",payload:{owner:S,key:String(t),revision:p}});try{const X=Object.fromEntries(Object.entries(s).map(([ue,ye])=>[ue,ye.map(Ur)])),Y=c.current,V=na(Y.sessionName,Y.sessionObjective,ee.map(ue=>({label:Ne[ue].label,titles:s[ue].map(ye=>ye.work_title||"Practice")}))),se={...(k=Y.sessionName)!=null&&k.trim()?{}:{session_name:V.name},...(A=Y.sessionObjective)!=null&&A.trim()?{}:{session_objective:V.description}},be={id:Number(t),practices:X,...se},xe=await fe({url:"/update-session",method:"POST",data:be});if(!((K=xe==null?void 0:xe.data)!=null&&K.success))throw new Error("Save rejected");if(h.current&&E(ue=>{var ye,pt;return{...ue,...se.session_name&&!((ye=ue.sessionName)!=null&&ye.trim())?{sessionName:V.name,session_name:V.name}:{},...se.session_objective&&!((pt=ue.sessionObjective)!=null&&pt.trim())?{sessionObjective:V.description}:{}}}),la){if(j.dispatch({type:"CLEAR_PLANNER_PRACTICE_DRAFT",payload:{owner:S,key:String(t),revision:p}}),!h.current)return;pe(!!$()),d({msg:$()?"Saved. Your newer practice changes still need saving.":"Practice changes saved.",variant:"success"})}}catch{h.current&&d({msg:"Could not save practice changes. Your draft is still here — please retry.",variant:"error"})}finally{j.dispatch({type:"FINISH_PLANNER_PRACTICE_SAVE",payload:{owner:S,key:String(t),revision:p}}),C.current=!1,h.current&&T(!1)}},[t,le,R]),me=s=>{!h.current||!le||!c.current.id||(j.dispatch({type:"PUT_PLANNER_PRACTICE_DRAFT",payload:{owner:S,key:String(t),draft:{practices:s,revision:crypto.randomUUID()}}}),c.current={...c.current,practices:s},E(c.current),pe(!0))}
1,zt=(s,r,p)=>{const v=c.current.practices,k={...v,[s]:(v[s]||[]).map(A=>A.id===r?{...A,...p}:A)};me(k),ce(k)};n.useEffect(()=>{if(!z)return;const s=r=>{r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[z]);const it=()=>{if(z||R){d({msg:"Save your practice changes before editing session details.",variant:"info"});return}J(!0)};n.useEffect(()=>{const s=o.get("expandDrill");if(s){const r=Number(s);Number.isNaN(r)||L(r)}},[o]),n.useEffect(()=>{Oe()},[Oe]),n.useEffect(()=>{var s;l.user_id&&(I&&I!==l.user_id&&fe({url:"/view-session-planner-session",method:"POST",data:{id:Number(t)}}).catch(()=>{}),(s=x==null?void 0:x.capture)==null||s.call(x,"session_editor_opened",{session_id:t,isOwnSession:I===l.user_id}))},[l.user_id]),n.useEffect(()=>{if(b===null)return;(async()=>{var p,v;U(!0);const r=await fe({url:"/like-session-planner-session",method:"POST",data:{id:Number(t),status:b}});re(((v=(p=r.data)==null?void 0:p.data)==null?void 0:v.likesCount)??ie),U(!1)})()},[b]);const Zt=async s=>{var k,A;const r=s===Z.userRating,p=await fe({url:r?"/clear-session-planner-session-rating":"/rate-session-planner-session",method:"POST",data:r?{id:Number(t)}:{id:Number(t),rating:s}}),v=(k=p==null?void 0:p.data)==null?void 0:k.data;(A=p==null?void 0:p.data)!=null&&A.success&&v&&ae(K=>({...K,avgRating:v.averageRating,totalRatings:v.totalRatingsCount,userRating:r?0:s}))},Ae=(s,r,p)=>{const v=[...l.practices[s]||[]],[k]=v.splice(r,1);return v.splice(p,0,k),{...l.practices,[s]:v}},lt=async(s,r,p)=>{var v,k;try{const A=await fe({url:`/single-work/${r}?session=true`,method:"GET"}),K=(v=A==null?void 0:A.data)==null?void 0:v.data;if(!K)return d({msg:"Could not add that practice. Please try again.",variant:"error"}),null;const X=wt(K);if(Number(X.durationMins)>0||(X.durationMins=20),!h.current||!le)return null;const Y=c.current.practices,V=[...Y[s]||[]];V.splice(p??V.length,0,X);const se={...Y,[s]:V};return me(se),ce(se),(k=x==null?void 0:x.capture)==null||k.call(x,"session_drill_added_from_picker",{session_id:t,drill_id:r,bucket:s}),X}catch{return d({msg:"Could not add that practice — please try again.",variant:"error"}),null}},qt=(s,r)=>{var v;const p={...l.practices,[s]:(l.practices[s]||[]).filter(k=>k.id!==r)};me(p),ce(p),G===r&&L(null),d({msg:"Practice removed from session.",variant:"success"}),(v=x==null?void 0:x.capture)==null||v.call(x,"session_drill_removed",{session_id:t,drill_id:r,bucket:s})},Wt=async s=>{var se,be;const{destination:r,source:p,draggableId:v}=s;if(!r)return;if(p.droppableId==="drill-picker-source"){const xe=Number(v.replace("picker-drill-",""));if(Number.isNaN(xe))return;const ue=r.droppableId.split("-").slice(1).join("-");await lt(ue,xe,r.index);return}const k=p.droppableId.split("-").slice(1).join("-"),A=r.droppableId.split("-").slice(1).join("-");if(k===A){if(p.index===r.index)return;const xe=Ae(k,p.index,r.index);me(xe),ce(xe),(se=x==null?void 0:x.capture)==null||se.call(x,"session_drill_reordered",{session_id:t,bucket:k,from_index:p.index,to_index:r.index});return}const K=[...l.practices[k]||[]],[X]=K.splice(p.index,1);if(!X)return;const Y=[...l.practices[A]||[]];Y.splice(r.index,0,X);const V={...l.practices,[k]:K,[A]:Y};me(V),ce(V),(be=x==null?void 0:x.capture)==null||be.call(x,"session_drill_moved_phase",{session_id:t,from_bucket:k,to_bucket:A,to_index:r.index})},[Re,Yt]=n.useState(null);n.useEffect(()=>{if(!Re)return;const s=requestAnimationFrame(()=>{var r;
1(r=document.querySelector(`[data-practice-row="${Re.id}"]`))==null||r.scrollIntoView({behavior:"smooth",block:"nearest"})});return()=>cancelAnimationFrame(s)},[Re]);const Kt=(s,r,p)=>{var Y;const v=ee.indexOf(s),k=[...l.practices[s]||[]],A=k[r];if(!A)return;if((Y=x==null?void 0:x.capture)==null||Y.call(x,"session_practice_moved",{session_id:t,bucket:s,direction:p}),Yt(V=>({id:A.id,n:((V==null?void 0:V.n)??0)+1})),p==="up"){if(r>0){const be=Ae(s,r,r-1);me(be),ce(be);return}const V=ee[v-1];if(!V)return;k.splice(r,1);const se={...l.practices,[s]:k,[V]:[...l.practices[V]||[],A]};me(se),ce(se);return}if(r<k.length-1){const V=Ae(s,r,r+1);me(V),ce(V);return}const K=ee[v+1];if(!K)return;k.splice(r,1);const X={...l.practices,[s]:k,[K]:[A,...l.practices[K]||[]]};me(X),ce(X)},Qt=async()=>{var s;try{const r=await Bt({variables:{createSaveForLaterItemInput:{type:"SESSION_PLANNER_SESSION",item_id:Number(t)}}}),p=(s=r==null?void 0:r.data)==null?void 0:s.createSaveForLaterEntry,v=(p==null?void 0:p.success)||(p==null?void 0:p.status)===409;d({msg:v?(p==null?void 0:p.message)||"Saved for later.":(p==null?void 0:p.message)||"Could not save for later.",variant:v?"success":"error"})}catch{d({msg:"Could not save for later.",variant:"error"})}},Jt=async()=>{var r;if(ee.reduce((p,v)=>{var k;return p+(((k=l.practices[v])==null?void 0:k.length)||0)},0)>6){d({msg:"You can only add sessions that contain up to 6 practices.",variant:"error"});return}try{const p=await Gt({variables:{createGlobalLibraryItemInput:{type:"SESSION_PLANNER_SESSION",item_ids:[Number(t)]}}}),v=(r=p==null?void 0:p.data)==null?void 0:r.createGlobalLibraryEntry;d({msg:v!=null&&v.success?"Added to Global Library.":(v==null?void 0:v.message)||"Could not add to Global Library.",variant:v!=null&&v.success?"success":"error"})}catch{d({msg:"Could not add to Global Library.",variant:"error"})}},Xt=async()=>{var s;st(!0);try{const r=await fe({url:"/delete-session",method:"DELETE",data:{ids:[Number(t)]}});(s=r==null?void 0:r.data)!=null&&s.success?(j.dispatch({type:"CLEAR_PLANNER_PRACTICE_DRAFT",payload:{owner:S,key:String(t)}}),d({msg:"Session deleted.",variant:"success"}),i(`/session-planner/${O}`)):d({msg:"Could not delete the session.",variant:"error"})}catch{d({msg:"Could not delete the session.",variant:"error"})}finally{st(!1),De(!1)}},ea=()=>{rt(!0)},ta=s=>{var r;if(L(p=>p===s?null:s),(r=x==null?void 0:x.capture)==null||r.call(x,"session_drill_settings_expanded",{session_id:t,drill_id:s}),o.has("expandDrill")){const p=new URLSearchParams(o);p.delete("expandDrill"),N(p,{replace:!0})}},aa=s=>d({msg:s,variant:"success"}),ra=ee.every(s=>{var r;return(((r=l.practices)==null?void 0:r[s])||[]).length===0}),sa=e.jsxs("div",{className:`min-w-0 flex-none tab:min-h-0 tab:flex-1 flex flex-col overflow-visible tab:overflow-hidden transition-[padding] duration-200 ease-out ${B?"planner-builder-session":""} `,children:[e.jsx(br,{session:l,rating:Z,likes:ie,isLikedByUser:b,isLikeLoading:m,isOwnSession:ot,canManage:le,hasUnsavedChanges:z,totalMinutes:nt,onToggleLike:()=>P(s=>!s),onRateChange:Zt,onExportPdf:ea,saving:R,saveDisabled:!He({routeId:t,loadedId:l.id,canManage:le,saving:R,hasDraft:z}),onSave:()=>void ce(c.current.practices,!0),onEditDetails:it,onSaveForLater:Qt,onAddToGlobalLibrary:Jt,canAddToGlobalLibrary:Vt,onDelete:()=>De(!0),canDelete:le}),z&&e.jsx("p",{role:"status",className:"px-6 py-2 text-sm text-[color:var(--subtle)]",children:"Practice changes are a draft. Save to update this session. You can return to this draft while browsing in this tab; reloading clears it."}),e.jsx(Zr,{activeTab:he,onChange:te}),e.jsx("div",{className:"builder-mobile-flow min-h-0 flex-none overflow-visible px-4 py-4 tab:flex-1 tab:overflow-y-auto",children:he==="details"?e.jsx(qr,{session:l,totalMinutes:nt,canManage:le,onEdit:it}):e.jsxs(e.Fragment,{children:[ra&&e.jsx(zr,{onDrawerOpen:()=>{Q("warm_ups"),W(!0),w(s=>s+1)}}),ee.map(s=>e.jsx(Pr,{bucket:s,drills:l.practices[s]||[],expandedDrillId:G,canEdit:le,manageClubNotesPermission:Ut,loggedInUserId:I,onToggleExpand:ta,onFieldChange:zt,pickerOpen:B,minimalHeader:B,isActiveTarget:H===s,onSelectTarget:Q,onMovePractice:Kt,onRemove:r=>qt(s,r),onAddDrillCta:r=>{Q(r),W(!0),w(p=>p+1),d({msg:`Click or drag a practice to add it to ${Ne[r].label}.`,variant:"info"})},onSavedToast:aa}
1,s))]})}),le&&e.jsx("div",{className:"tab:hidden",children:e.jsx(ia,{show:z,saving:R,label:"Save session",disabled:!He({routeId:t,loadedId:l.id,canManage:le,saving:R,hasDraft:z}),onSave:()=>void ce(c.current.practices,!0)})})]}),oa=e.jsx(Rr,{open:B,embedded:B,onClose:()=>W(!1),loggedInUserId:I,loggedInClubId:g==null?void 0:g.club_id,onAddDrill:async(s,r=H)=>{await lt(r,s)&&d({msg:`Practice added to ${Ne[r].label}.`,variant:"success"})}});return e.jsxs(da,{onDragEnd:Wt,children:[e.jsx("div",{"data-v2-surface":!0,className:"flex h-auto min-h-0 tab:h-full w-full bg-[color:var(--bg)] text-[color:var(--fg)]",children:e.jsx(ca,{active:B,libraryRequest:f,library:oa,session:sa,count:Object.values(l.practices).reduce((s,r)=>s+r.length,0)})}),de&&e.jsx($r,{open:de,handleClose:()=>J(!1),selectedSession:l,isDuplicate:!1,getSession:Oe}),e.jsx(pr,{open:Pe,handleClose:()=>De(!1),handleDelete:Xt,loading:$t,title:"Delete session?",actionBtnTitle:"Delete session",subjectName:l.sessionName||l.session_name,warning:"This permanently deletes the session and its practice arrangement. This can't be undone."}),at&&e.jsx(Hr,{open:at,handleCloseModal:()=>rt(!1),session:l})]})};function zr({onDrawerOpen:t}){return e.jsxs("div",{className:"mb-6 flex flex-col gap-3 rounded-sm border border-dashed border-[color:var(--hairline)] bg-[color:var(--card-hi)] px-5 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-mono text-[9.5px] font-semibold text-[color:var(--accent-2)] tracking-wide16 uppercase",children:"Empty Session"}),e.jsx("p",{className:"font-body text-[13px] text-[color:var(--subtle)] leading-snug",children:"Drag drills from the picker into a phase below, or open the picker to get started."})]}),e.jsx("button",{type:"button",onClick:t,className:"shrink-0 font-head font-bold text-[11px] tracking-wide14 uppercase px-4 py-2 bg-[color:var(--accent-2)] text-[#06080c] rounded-sm hover:opacity-90",children:"Open Drill Picker"})]})}function Zr({activeTab:t,onChange:u}){const i=[{key:"activities",label:"Activities"},{key:"details",label:"Details"}];return e.jsx("div",{className:"px-6 border-b border-[color:var(--hairline)] bg-[color:var(--bg)]",children:e.jsx("div",{role:"tablist",className:"flex items-center gap-6",children:i.map(o=>{const N=o.key===t;return e.jsx("button",{role:"tab","aria-selected":N,type:"button",onClick:()=>u(o.key),className:`-mb-px border-b-2 border-solid py-3 font-head font-bold text-[12px] tracking-wide14 uppercase transition-colors ${N?"border-[color:var(--accent-2)] text-[color:var(--fg)]":"border-transparent text-[color:var(--muted)] hover:text-[color:var(--fg)]"}`,children:o.label},o.key)})})})}function qr({session:t,totalMinutes:u,canManage:i,onEdit:o}){const N=t.sessionType??t.session_type_id,d=Ke.find(h=>h&&h.id===N),x=t.difficultyAgeGroup??t.age_group_id,_=we.find(h=>h&&h.id===x),O=t.noOfPlayers??t.no_of_players,g=t.sessionObjective||t.session_objective,y=t.durationMins??t.duration,I=!!(y&&u>y),l=(h,C)=>{var a;return(a=h.find(T=>T.id===C))==null?void 0:a.name},E=[{label:"Technical",value:l(ke,t.technical)||"—"},{label:"Tactical",value:l(Ee,t.tactical)||"—"},{label:"Physical",value:l(qe,t.physical)||"—"},{label:"Psychological",value:l(Ye,t.psychological)||"—"},{label:"Social",value:l(We,t.social)||"—"},{label:"Unit Relationship",value:l(Ze,t.unitRelationShip)||"—"}],c=t.coachNotes,j="font-mono text-[9px] font-semibold tracking-wide14 uppercase",S=[{label:"Total Time",value:`${u} MIN`,color:I?"var(--warn)":"var(--accent-2)"},{label:"Planned",value:y?`${y} MIN`:"—"},{label:"Type",value:(d==null?void 0:d.name)||"—"},{label:"Difficulty",value:(_==null?void 0:_.name)||"—"},{label:"Players",value:O?String(O):"—"}];return e.jsxs("div",{className:"flex flex-col gap-4",children:[i&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:`${j} text-[color:var(--subtle)]`,children:"Session Information"}),e.jsx("button",{type:"button",onClick:o,className:"font-head font-bold text-[11px] tracking-wide14 uppercase px-3 py-2 border border-solid border-[color:var(--hairline)] rounded-sm text-[color:var(--fg)] hover:border-[color:var(--accent-2)] bg-[
1color:var(--card)]",children:"Edit Session Details"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 bg-[color:var(--card)] border border-solid border-[color:var(--hairline)] rounded-[3px]",children:S.map((h,C)=>e.jsxs("div",{className:`p-[14px_18px] ${C>0?"border-l border-[color:var(--hairline)]":""}`,children:[e.jsx("div",{className:`${j} text-[color:var(--subtle)] mb-1.5`,children:h.label}),e.jsx("div",{className:"font-head font-bold text-[20px] tracking-wide2 uppercase truncate",style:{color:h.color||"var(--fg)"},children:h.value})]},h.label))}),e.jsxs("div",{className:"px-[16px] py-[14px] bg-[color:var(--card-hi)] border border-solid border-[color:var(--hairline)] rounded-sm border-l-2 border-l-[color:var(--accent-2)]",children:[e.jsx("div",{className:`${j} text-[color:var(--subtle)] mb-2`,children:"Session Objective"}),g?e.jsx("div",{className:"font-body text-[14px] text-[color:var(--fg)] leading-snug whitespace-pre-wrap",children:g}):e.jsx("div",{className:"font-body text-[14px] text-[color:var(--subtle)] italic",children:"No session objective added"})]}),e.jsxs("div",{className:"px-[16px] py-[14px] bg-[color:var(--card)] border border-solid border-[color:var(--hairline)] rounded-sm",children:[e.jsx("div",{className:`${j} text-[color:var(--subtle)] mb-3`,children:"Additional Session Details"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:E.map(h=>e.jsxs("div",{className:"flex flex-col gap-[3px]",children:[e.jsx("span",{className:`${j} text-[color:var(--subtle)]`,children:h.label}),e.jsx("span",{className:"font-body text-[14px] text-[color:var(--fg)] leading-snug",children:h.value})]},h.label))}),e.jsxs("div",{className:"mt-4 pt-3 border-t border-[color:var(--hairline)]",children:[e.jsx("div",{className:`${j} text-[color:var(--subtle)] mb-1.5`,children:"Coach Notes"}),c?e.jsx("div",{className:"font-body text-[14px] text-[color:var(--fg)] leading-snug whitespace-pre-wrap",children:c}):e.jsx("div",{className:"font-body text-[14px] text-[color:var(--subtle)] italic",children:"No coach notes added"})]})]}),e.jsxs("div",{className:"px-[16px] py-[14px] bg-[color:var(--card)] border border-solid border-[color:var(--hairline)] rounded-sm",children:[e.jsx("div",{className:`${j} text-[color:var(--subtle)] mb-2`,children:"Activity Breakdown"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:ee.map(h=>{var D;const C=((D=t.practices)==null?void 0:D[h])||[],a=C.reduce((F,R)=>F+(Number(R.durationMins)||0),0),T=Ne[h].label;return e.jsxs("div",{className:"flex flex-col gap-[3px]",children:[e.jsx("span",{className:`${j} text-[color:var(--subtle)]`,children:T}),e.jsxs("span",{className:"font-head font-bold text-[16px] text-[color:var(--fg)] tracking-wide2 uppercase",children:[C.length," DRILL",C.length===1?"":"S"]}),e.jsxs("span",{className:"font-mono text-[10px] font-semibold text-[color:var(--accent-2)] tracking-wide14 uppercase",children:[a," MIN"]})]},h)})})]})]})}export{No 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.