1import{v as ze,u as Z,r as l,z as Ie,j as e,G as Kt,B as D,h as ie,l as vt,C as Xt,c as ee,d as oe,M as Jt,S as jt,E as wt,J as Ke,a as Be,ag as Nt,a0 as Ze,o as We,ah as St,F as V,L as Ce,b as Te,Z as Me,g as Zt,a4 as it,t as Qt}from"./index-_aijvlUq.js";import{p as ne}from"./performances-duTJPchz.js";import{b as Qe,g as et,f as kt,u as Ct,c as Tt,P as It,m as At,d as en,a as tn,e as nn,H as sn,O as Lt,h as rn,r as an}from"./RehearsalsTabPanel-QAqBXhwA.js";import{v as ln}from"./venues-DxAiztOL.js";import{o as Rt}from"./orgEvents-BRXhXibs.js";import{u as on,c as lt,a as dn}from"./useQuickActions-DMVMPpKD.js";import{P as cn}from"./PageHeader-DCofr6qo.js";import{p as mn}from"./payments-BcDSbBQ_.js";import{a as un}from"./CancelEventDialog-iYnlU3wL.js";import{h as $t}from"./helpRequests-Bol7uyz2.js";import{a as Xe,h as ot}from"./helpWanted-C0itiuLN.js";import{I as hn}from"./Input-ysTyZFq5.js";import{d as Ve}from"./TripForm-CydVdSPh.js";import{n as xn,a as pn,t as fn,D as bn}from"./tripRates-CtgxAan6.js";import{f as gn}from"./equipmentValueReport-BI2xc4oS.js";import{S as le}from"./SectionHeading-CJLky1om.js";import{W as yn}from"./WhoList-DOo2DXJ4.js";import{A as vn,f as jn,l as wn,h as Nn,i as Sn,j as dt,S as Se,L as ct,g as mt,M as W,o as kn}from"./MobilePerformanceDetailSheet-6xhmAXlq.js";import{m as tt}from"./members-I3UAoZ9P.js";import{i as Dt}from"./instruments-CRxWHJ-h.js";import{e as Cn}from"./ensembles-WGlB365j.js";import{b as Ee}from"./badges-sJrwZCWE.js";import{O as Tn}from"./orgRoles-D1oGgqrm.js";import{A as In}from"./Avatar-BMcjKrGk.js";import{B as Mt}from"./BottomSheet-BiQNSujt.js";import{p as An}from"./paletteHash-DBBw93pZ.js";import{M as Ln}from"./MobileListSkeleton-BxuyWDCs.js";import{u as Rn}from"./useResumeRefetch-Dmzejf9t.js";import{m as $n}from"./musicLibrary-DdhMEkq5.js";import{o as Dn}from"./onboarding-yVikBuxN.js";import"./RestoreEventDialog-B5yJWYUU.js";import"./ConfirmDialog-CODvETNM.js";import"./ActiveFiltersBar-DPDav4h_.js";import"./MusicLibraryFilterBar-C3yZnsfl.js";import"./sectionLeader-CxeZyjmi.js";import"./useDragReorder-BPTlhWx5.js";import"./EmptyState-CPGKooqj.js";import"./notifications-B26coFA7.js";import"./Menu-CATQC14B.js";import"./MemberMultiPicker-DdjcDFao.js";import"./MobileMusicDetailSheet-EusJN61d.js";import"./InstrumentsFromPhotoModal--KDh5F6z.js";import"./CameraCaptureButton-B4WpiVvJ.js";import"./Table-Yng-lqpt.js";import"./ChipToggle-hmCaOMqs.js";import"./ensembleTag-kZVL-M-W.js";import"./Badge-DJIi163x.js";import"./useConcertRehearsalsQuestion-CvhgYAiE.js";import"./downscaleImage-qyGK-a3D.js";const Et={getStats(){return ze.get("/dashboard")},getNextSteps(){return ze.get("/dashboard/next-steps")}};function Pt(){const t=Z(),[s,n]=l.useState(null);return l.useEffect(()=>{let r=!0;return mn.getMyPayments({skipUpgradeModal:!0}).then(m=>{if(!r)return;const u=(m?.charges||[]).filter(i=>i.status==="owed"&&i.productType!=="donation");u.length&&n({totalCents:u.reduce((i,d)=>i+d.amountCents,0),count:u.length,label:u.length===1?`${u[0].productName}${u[0].periodKey?` (${u[0].periodKey})`:""}`:`${u.length} items`,promised:u.every(i=>i.promisedMethod)})}).catch(Ie("dues banner: no plan or no member record means nothing to show")),()=>{r=!1}},[]),s?e.jsxs("div",{"data-testid":"dues-due-banner",className:`rounded-xl border p-4 flex flex-wrap items-center justify-between gap-3 mx-4 md:mx-0 ${s.promised?"bg-gray-50 border-gray-200":"bg-amber-50 border-amber-200"}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:`text-sm font-semibold ${s.promised?"text-gray-700":"text-amber-800"}`,children:s.promised?"Payment on its way":"Your dues are ready when you are"}),e.jsxs("p",{className:`text-sm ${s.promised?"text-gray-500":"text-amber-700"}`,children:[Kt(s.totalCents)," · ",s.label,s.promised&&" â you said youâd bring cash or a check"]})]}),e.jsx(D,{variant:s.promised?"secondary":"primary",size:"sm",onClick:()=>t("/account/payments"),children:s.promised?"View":"Pay now"})]}):null}const Ye=3,Mn=30;function Ot(){const t=ie(a=>a.currentOrg?.volunteerSettings?.enabled!==!1),[s,n]=l.useState(null);if(l.useEffect(()=>{if(!t)return;let a=!0;return $t.forMe().then(o=>{a&&n(Array.isArray(o)?o:[])}).catch(Ie("help wanted on Home: an ambient card")),()=>{a=!1}},[t]),!t||!s)return null;const r=vt(),m=new Date;m.setDate(m.getDate()+Mn);const u=Xt(m),i=s.filter(a=>a.status==="open"||a.youAreOn).filter(a=>!a.neededOn||a.neededOn>=r&&a.neededOn<=u).filter(a=>a.youAreOn||a.open>0).sort((a,o)=>(o.youAreOn?1:0)-(a.youAreOn?1:0)||String(a.neededOn||"9999").localeCompare(String(o.neededOn||"9999")));if(!i.length)return null;const d=i.slice(0,Ye);return e.jsxs("section",{className:"rounded-xl border border-gray-200 bg-white px-4 py-3 mx-4 md:mx-0","data-testid":"help-wanted-home",children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900",children:"Help wanted"}),e.jsx(un,{list:d,showFor:!0,compact:!0,linkTo:a=>a.performanceId?Xe(a.performanceId):null,onChange:a=>n(o=>(o||[]).map(g=>a.find(c=>c.id===g.id)||g))}),i.length>Ye&&e.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[i.length-Ye," more on your concerts and work days."]})]})}function Je({className:t=""}){const s=ie(w=>
1w.currentOrg?.tripSettings),n=l.useMemo(()=>xn(s),[s]),r=ee(w=>w.showSuccess),m=ee(w=>w.showError),[u,i]=l.useState(null),[d,a]=l.useState(null),[o,g]=l.useState(""),[c,N]=l.useState("both"),[v,k]=l.useState(!1),[b,f]=l.useState(!1);if(l.useEffect(()=>{if(!n.enabled)return;let w=!0;return Ve.toRecord().then(A=>{w&&i(Array.isArray(A)?A:[])}).catch(Ie("trips to record on Home: an ambient card")),()=>{w=!1}},[n.enabled]),!n.enabled||!u?.length)return null;function L(w){g(""),N("both"),k(!1),a(w)}const T=o&&Number(o)>0?pn(o,n,c):null,j=Number(o)>0,h=c!=="both"&&n.oneWayPays!=="full";async function I(w){if(w.preventDefault(),!(!j||!d)){f(!0);try{d.mine?(await Ve.recordMine({helpRequestId:d.helpRequestId,oneWayMiles:Number(o),direction:c}),r("Trip recorded. Your treasurer has been asked to authorize it.")):(await Ve.create({driverMemberId:d.driverMemberId,helpRequestId:d.helpRequestId,tripDate:d.neededOn,activity:d.title,oneWayMiles:Number(o),direction:c}),r(`Trip recorded for ${d.driverName}. It is waiting to be authorized.`)),i(A=>(A||[]).filter(E=>!(E.helpRequestId===d.helpRequestId&&E.driverMemberId===d.driverMemberId))),a(null)}catch(A){m(A?.message||wt)}finally{f(!1)}}}return e.jsxs("section",{className:`rounded-xl border border-gray-200 bg-white px-4 py-3 mx-4 md:mx-0 ${t}`,"data-testid":"trips-to-record",children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900",children:"Trips to record"}),e.jsx("ul",{className:"divide-y divide-gray-100",children:u.map(w=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 py-2",children:[e.jsxs("div",{className:"flex-1 min-w-[12rem]",children:[e.jsx("p",{className:"text-base text-gray-900",children:w.mine?w.title:`${w.driverName}: ${w.title}`}),e.jsxs("p",{className:"text-sm text-gray-600",children:[w.forTitle?`${w.forTitle} · `:"",e.jsx("span",{className:"whitespace-nowrap",children:oe(w.neededOn)})]})]}),e.jsx(D,{type:"button",variant:"secondary",size:"md",onClick:()=>L(w),"aria-label":w.mine?`Record my trip for ${w.title}`:`Record a trip for ${w.driverName}`,children:w.mine?"Record my tripâ¦":"Record tripâ¦"})]},`${w.helpRequestId}-${w.driverMemberId}`))}),e.jsx(Jt,{isOpen:!!d,onClose:()=>a(null),title:d?d.mine?"Record your trip":`Record a trip for ${d.driverName}`:"",footer:e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(D,{type:"button",variant:"ghost",onClick:()=>a(null),disabled:b,children:"Cancel"}),e.jsx(D,{type:"submit",form:"trip-to-record-form",variant:"primary",isLoading:b,disabled:!j,children:"Record trip"})]}),children:d&&e.jsxs("form",{id:"trip-to-record-form",onSubmit:I,children:[e.jsx("p",{className:"text-base text-gray-900",children:d.title}),e.jsxs("p",{className:"text-sm text-gray-600 mb-4",children:[d.forTitle?`${d.forTitle} · `:"",oe(d.neededOn)]}),e.jsxs("div",{className:"max-w-xs",children:[e.jsx(hn,{label:"Miles one way",autoFocus:!0,t
1ype:"number",inputMode:"decimal",min:"0.1",step:"any",value:o,onChange:w=>g(w.target.value),required:!0,"aria-describedby":"trip-to-record-miles-hint"}),e.jsx("p",{id:"trip-to-record-miles-hint",className:"text-xs text-gray-500 mt-1",children:n.milesNote||"One way, from where the driver starts to where the trip ends."})]}),T&&!d.mine&&e.jsx("p",{className:"text-base text-gray-900 mt-4","aria-live":"polite",children:T.basis==="band"?e.jsxs(e.Fragment,{children:[h?"Half your rate":"Your rate"," (",fn(c,o),"): ",e.jsx("strong",{children:gn(T.amountCents)})]}):"The treasurer sets the amount for this trip."}),v?e.jsxs("div",{className:"max-w-xs mt-4",children:[e.jsx(jt,{label:"Which way?",value:c,onChange:w=>N(w.target.value),options:bn,"aria-describedby":"trip-to-record-way-hint"}),e.jsx("p",{id:"trip-to-record-way-hint",className:"text-xs text-gray-500 mt-1",children:"Choose one way only when someone else drives the other way."})]}):e.jsx(D,{type:"button",variant:"ghost",size:"md",className:"!px-0 mt-2",onClick:()=>k(!0),children:"More options"}),e.jsx("p",{className:"text-sm text-gray-600 mt-4",children:d.mine?"Your treasurer is then asked to authorize it.":"It then waits to be authorized."})]})})]})}function zt({className:t=""}){const s=ie(a=>{const o=a.currentOrg?.volunteerSettings||{};return o.enabled!==!1&&o.membersSeeTheirHours!==!1}),[n,r]=l.useState(null),[m,u]=l.useState(!1);if(l.useEffect(()=>{if(!s)return;let a=!0;return Promise.resolve().then(()=>$t.myHours()).then(o=>{a&&r(o||null)}).catch(Ie("my volunteer hours on Home: an ambient line")),()=>{a=!1}},[s]),!s||!n||!n.jobsThisYear)return null;const i=`${n.jobsThisYear} job${n.jobsThisYear===1?"":"s"}`,d=n.hoursThisYear>0?`Youâve given ${ot(n.hoursThisYear)} helping in ${n.year}`:`Youâve helped with ${i} in ${n.year}`;return e.jsxs("section",{className:`rounded-xl border border-gray-200 bg-white px-4 py-2 mx-4 md:mx-0 ${t}`,"data-testid":"my-volunteer-hours",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[e.jsxs("p",{className:"text-base text-gray-900 flex-1 min-w-[12rem]",children:[d,". Thank you!"]}),e.jsx(D,{type:"button",variant:"ghost",size:"md","aria-expanded":m,onClick:()=>u(a=>!a),children:m?"Hide what you helped with":"See what you helped with"})]}),m&&e.jsx("ul",{className:"divide-y divide-gray-100 border-t border-gray-100 mt-1",children:n.entries.map(a=>e.jsxs("li",{className:"py-2 flex flex-wrap items-baseline gap-x-3",children:[e.jsxs("span",{className:"text-base text-gray-900 flex-1 min-w-[10rem]",children:[a.title,a.forTitle&&e.jsxs("span",{className:"text-sm text-gray-600",children:[", ",a.forTitle]})]}),e.jsx("span",{className:"text-sm text-gray-600 whitespace-nowrap",children:[Ke(a.date),a.hours!=null?ot(a.hours):null].filter(Boolean).join(" · ")})]},a.id))})]})}const Wt={get(t){return ze.get(`/rehearsals/${t}/attendance-view`)}};function En(t){return(t?.sections||[]).flatMap(s=>(s.absentees||[]).map(n=>({id:n.memberId,name:`${n.firstName||""} ${n.lastName||""}`.trim(),detail:[s.name,n.reason].filter(Boolean).join(" · ")})))}function Pn({entry:t,today:s}){const{canFully:n}=Be(),r=ie(y=>y.currentOrg),m=ee(y=>y.showError),u=Z(),i=t?.event,d=t?.mode==="show",a=d?i?.id:i?.performanceId,o=!!i?.date&&i.date===s,g=Nt({isShow:d,cancelled:!!i?.cancelledAt,hasPerformance:!!a,canFully:n,org:r}),[c,N]=l.useState(null),[v,k]=l.useState(!1),[b,f]=l.useState(!1),[L,T]=l.useState(null),[j,h]=l.useState(null),[I,w]=l.useState(null),[A,E]=l.useState(!1),M=o&&g.whoIsOut&&!!i?.id;if(l.useEffect(()=>{if(N(null),k(!1),f(!1),!M)return;let y=!1;return Wt.get(i.id).then(F=>{y||N(F)}).catch(Ie("who is out on the Today row (404 = nothing to show)")),()=>{y=!0}},[M,i?.id]),!o||!g.any)return null;async function S(){T("attendance");try{const y=d?"performance":"rehearsal",F=await We.generateToken({eventId:i.id,eventType:y});h({token:F.token,title:i.title,date:i.date,eventType:y})}catch(y){m(y?.message||"Could not open attendance.")}finally{T(null)}}async function C(){T("audience");try{const y=await We.generateToken({eventId:i.id,eventType:"performance",purpose:"audience"});w({url:`${window.location.origin}/app/audience/${y.token}`,title:i.title})}catch(y){m(y?.message||"Could not open the audience counter.")}finally{T(null)}}const P=c?.scope==="director"?En(c):null,z=c?.scope==="band_manager"?c.totals:null,H=c?.scope==="director"?c.totals:null,Y=d?"today":"tonight";return e.jsxs("div",{className:"rounded-lg border border-band-200 bg-band-50 p-4 space-y-3","data-testid":"today-actions",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Today"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.takeAttendance&&e.jsx(D,{isLoading:L==="attendance",onClick:S,children:d?"Check in members":"Take attendance"}),g.recordAbsence&&e.jsx(D,{variant:"secondary",onClick:()=>E(!0),children:"Record absence"}),g.audienceCounter&&e.jsx(D,{variant:"secondary",isLoading:L==="audience",onClick:C,children:"Audience counter"}),g.stageLayout&&e.jsx(D,{variant:"ghost",onClick:()=>u(`/performances?highlight=${a}&openGroup=stage`),children:"Stage layout"})]}),(P||z||H)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-gray-700",children:[P&&e.jsx(D,{variant:"ghost",size:"sm","aria-expanded":v,onClick:()=>{k(y=>!y),f(!1)},"data-testid":"today-who-out",children:P.length===0?`Nobody out ${Y}`:`${P.length} out ${Y}`}),z&&e.jsxs("span",{children:["Chairs to set out: ",e.jsx("span",{className:"font-semibold text-gray-900",children:z.chairsSetup})," of ",z.normalRoster]}),H&&e.jsxs("span",{children:["Expected tonight: ",e.jsx("span",{className:"font-semibold text-gray-900",children:H.chairsSetup})," of ",H.normalRoster]}),c?.scope==="band_manager"&&c.rows?.length>0&&e.jsx(D,{variant:"ghost",size:"sm","aria-expanded":b,onClick:()=>{f(y=>!y),k(!1)},children:"By row"})]}),v&&P&&e.jsx(yn,{title:`Out ${Y}`,people:P,linkable:n("members:read"),onClose:()=>k(!1),testId:"today-who-list"}),b&&c?.scope==="band_manager"&&e.jsxs("ul",{className:"text-sm text-gray-700 space-y-0.5","data-testid":"today-rows",children:[c.rows.map(y=>e.jsxs("li",{children:[y.label,": ",e.jsx("span",{className:"font-medium",children:y.chairsSetup})," chairs"]},y.label)),c.percussion&&e.jsxs("li",{children:["Percussion: ",e.jsx("span",{className:"font-medium",children:c.percussion.chairsSetup})," stations"]})]}),e.jsx(Ze,{isOpen:!!j,onClose:()=>h(null),token:j?.token,eventTitle:j?.title,eventDate:j?.date,eventType:j?.eventType}),e.jsx(vn,{data:I,onClose:()=>w(null)}),d?e.jsx(Qe,{performanceId:A?i.id:null,isOpen:A,onClose:()=>E(!1)}):e.jsx(et,{rehearsalId:i.id,isOpen:A,onClose:()=>E(!1)})]})}function Fe(t){return`${t.getFullYear()}
1-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function On(t){if(!t)return"";const n=Fe(new Date);if(t===n)return"Today";const r=new Date(n+"T00:00:00");return r.setDate(r.getDate()+1),t===Fe(r)?"Tomorrow":new Date(t+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",month:"short",day:"numeric"})}function zn(t){const s=t.date===Fe(new Date)?"Today":t.date?new Date(t.date+"T00:00:00").toLocaleDateString("en-US",{weekday:"short"}):"",n=t.ensembleName||t.title;return s?`${s} · ${n}`:n}function Wn(t,s){return t?s?`${V(t)} â ${V(s)}`:V(t):null}function Ft({venue:t}){return t?.name?t.mapUrl?e.jsx("a",{href:t.mapUrl,target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary font-medium hover:underline",children:t.name}):e.jsx("span",{className:"font-medium text-gray-700",children:t.name}):null}function Fn({pieces:t,heading:s}){return!t||t.length===0?null:e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-2",children:s}),e.jsx("ol",{className:"space-y-1",children:t.map((n,r)=>e.jsxs("li",{className:"flex items-baseline gap-2 text-sm",children:[e.jsxs("span",{className:"text-gray-400 tabular-nums w-5 text-right shrink-0",children:[r+1,"."]}),n.recordingUrl?e.jsx("a",{href:n.recordingUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-brand-primary hover:underline",children:n.title}):e.jsx("span",{className:"font-medium text-gray-900",children:n.title}),n.folderNumber&&e.jsxs("span",{className:"text-gray-500",children:["#",n.folderNumber]}),n.composer&&e.jsxs("span",{className:"text-gray-400 truncate",children:["â ",n.composer]})]},n.id||r))})]})}function Bn({next:t}){if(!t?.event)return null;const s=[["Date",oe(t.date)],["Call time",t.event.callTime?V(t.event.callTime):null],["Performance",t.event.startTime?V(t.event.startTime):null],["Dress",t.event.dressAttire||null]].filter(([,n])=>n);return e.jsxs("div",{className:"border-t border-gray-200 pt-4",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-2",children:["Performance Details â ",t.event.title]}),e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm",children:[s.map(([n,r])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-gray-500",children:n}),e.jsx("dd",{className:"font-medium text-gray-900",children:r})]},n)),t.event.venue?.name&&e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-gray-500",children:"Venue"}),e.jsx("dd",{children:e.jsx(Ft,{venue:t.event.venue})})]})]})]})}function Hn(){const[t,s]=l.useState(null),[n,r]=l.useState(!1),[m,u]=l.useState(null);if(l.useEffect(()=>{let b=!1;return St.getWeek().then(f=>{b||s(f)}).catch(()=>{b||r(!0)}),()=>{b=!0}},[]),n)return null;if(t==null)return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 animate-pulse",children:[e.jsx("div",{className:"h-4 w-24 bg-gray-200 rounded mb-3"}),e.jsx("div",{className:"h-5 w-64 bg-gray-200 rounded mb-2"}),e.jsx("div",{className:"h-4 w-48 bg-gray-100 rounded"})]});if(!t.mode||!t.event)return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 px-6 py-4 text-sm text-gray-500",children:["Nothing scheduled this week.",t.nextPerformance?.event&&e.jsxs("span",{className:"ml-1",children:["Next up: ",e.jsx("span",{className:"font-medium text-gray-700",children:t.nextPerformance.event.title})," on ",oe(t.nextPerformance.date),"."]})]});const i=t.events||[{...t}],d=m??(t.defaultIndex||0),a=i[d]||i[0],o=a.event,g=a.mode==="show",c=!!o.cancelledAt,N=g?a.setList:a.rehearsalAgenda,v=a.nextPerformance!==void 0?a.nextPerformance:t.nextPerformance,k=v&&(!g||o.id!==v.event?.id);return e.jsxs("section",{"data-testid":"this-week-card",children:[e.jsx(le,{children:"This Week"}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("span",{className:`inline-flex items-center rounded-lg px-2.5 py-1 text-xs font-semibold ${g?"bg-brand-primary text-white":"bg-gray-100 text-gray-700"}`,children:g?"Performance":"Rehearsal"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:On(o.date||t.eventDate)}),c&&e.jsx("span",{className:"inline-flex items-center rounded-lg bg-red-100 text-red-700 px-2.5 py-1 text-xs font-semibold",children:"CANCELLED"}),i.length>1&&e.jsx("div",{className:"ml-auto flex gap-1",children:i.map((b,f)=>e.jsx("button",{type:"button",onClick:()=>u(f),className:`px-2.5 py-1 rounded-lg text-xs font-medium transition-colors ${f===d?"bg-brand-primary text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:zn(b.event)}
1,b.event.id||f))})]}),e.jsxs("div",{children:[e.jsxs("p",{className:`text-lg font-semibold ${c?"text-gray-400 line-through":"text-gray-900"}`,children:[o.title,o.ensembleName&&e.jsxs("span",{className:"text-gray-400 font-normal",children:[" · ",o.ensembleName]})]}),e.jsxs("p",{className:"text-sm text-gray-600 mt-0.5",children:[Wn(o.startTime,o.endTime),o.callTime&&e.jsxs("span",{children:[" · Call ",V(o.callTime)]}),o.venue?.name&&e.jsxs("span",{children:[" · ",e.jsx(Ft,{venue:o.venue})]})]}),o.dressAttire&&e.jsxs("p",{className:"text-sm text-gray-600 mt-0.5",children:["Dress: ",e.jsx("span",{className:"font-medium text-gray-800",children:o.dressAttire})]}),c&&o.cancellationReason&&e.jsx("p",{className:"text-sm text-red-700 mt-1",children:o.cancellationReason})]}),e.jsx(Pn,{entry:a,today:t.today||Fe(new Date)}),!c&&e.jsx(Fn,{pieces:N,heading:g?"Program":"Rehearsal Order"}),o.directorNotes&&e.jsx("p",{className:"text-sm text-gray-600 bg-gray-50 border border-gray-200 rounded-lg px-4 py-3",children:o.directorNotes}),k&&e.jsx(Bn,{next:v}),(g?o.id:o.performanceId)&&e.jsx("div",{className:"text-right",children:e.jsx(Ce,{to:`/performances?highlight=${g?o.id:o.performanceId}${g?"":`&openRehearsalId=${o.id}`}`,className:"text-sm text-brand-primary font-medium hover:underline",children:"View details â"})})]})]})}const _n={schedule({from:t,to:s}={}){const n={};return t&&(n.from=t),s&&(n.to=s),ze.get("/me/schedule",{params:n})}},Bt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Un({members:t}){const s=Z(),n=Bt[new Date().getMonth()];return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"text-base","aria-hidden":!0,children:"ð"}),e.jsxs("h3",{className:"text-sm font-semibold text-gray-700",children:[n," Birthdays"]}),t.length>0&&e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-pink-100 text-pink-700",children:t.length})]}),t.length===0?e.jsx("p",{className:"text-sm text-gray-600",children:"No birthdays this month."}):e.jsx("ul",{className:"space-y-1.5",children:t.map(r=>e.jsx("li",{children:e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>s(`/members/${r.id}`),className:"!px-0 !py-0 text-sm text-brand-primary hover:underline text-left",children:[r.firstName," ",r.lastName]})},r.id))})]})}function Vn(t){const s=new Date,[,n,r]=t.split("-");return parseInt(n,10)===s.getMonth()+1&&parseInt(r,10)===s.getDate()}function ut(t){return t===1?"1 year":`${t} years`}function Yn({members:t}){const s=Z(),n=Bt[new Date().getMonth()];return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"text-base","aria-hidden":!0,children:"ð
"}),e.jsxs("h3",{className:"text-sm font-semibold text-gray-700",children:[n," Anniversaries"]}),t.length>0&&e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-700",children:t.length})]}),t.length===0?e.jsx("p",{className:"text-sm text-gray-600",children:"No milestone anniversaries this month."}):e.jsx("ul",{className:"space-y-1.5",children:t.map(r=>{const m=Vn(r.onboardingDate);return e.jsxs("li",{className:"flex items-center justify-between gap-2",children:[e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>s(`/members/${r.id}`),className:"!px-0 !py-0 text-sm text-brand-primary hover:underline text-left",children:[r.firstName," ",r.lastName]}),e.jsx("span",{className:`text-xs shrink-0 ${m?"font-semibold text-purple-600":"text-gray-400"}`,children:m?`ð ${ut(r.years)}!`:ut(r.years)})]},r.id)})})]})}const ht=5,Gn=l.forwardRef(function({members:s,icon:n},r){const{showSuccess:m,showError:u}=ee(),[i,d]=l.useState(s),[a,o]=l.useState(!1),[g,c]=l.useState(null),[N,v]=l.useState(null),[k,b]=l.useState(""),[f,L]=l.useState(!1),T=l.useRef(null);l.useEffect(()=>{g&&!N&&Dt.list("member").then(v).catch(()=>u("Failed to load instruments"))},[g]),l.useEffect(()=>{g&&T.current&&T.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[g]);function j(S){g===S?(c(null),b("")):(c(S),b(""))}async function h(S){if(k){L(!0);try{await tt.update(S,{instruments:[{instrumentId:k}]}),d(C=>C.filter(P=>P.id!==S)),c(null),b(""),m("Instrument assigned")}catch(C){u(C.message||"Failed to assign instrument")}finally{L(!1)}}}const I="Missing Instrument",w="All members have an instrument";if(i.length===0)return e.jsxs("div",{ref:r,className:"bg-white rounded-xl border border-gray-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:I})]}),e.jsxs("p",{className:"text-sm text-emerald-600 flex items-center gap-1.5",children:[e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),w]})]});const A=a?i:i.slice(0,ht),E=i.length-ht,M=N?Object.entries(N.reduce((S,C)=>{const P=C.family||"Other";return S[P]||(S[P]=[]),S[P].push(C),S},{})).sort(([S],[C])=>S.localeCompare(C)):[];return e.jsxs("div",{ref:r,className:"bg-white rounded-xl border border-amber-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:I}),e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700",children:i.length})]}),e.jsx("ul",{className:"space-y-1",children:A.map(S=>e.jsxs("li",{children:[e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>j(S.id),className:"!px-0 !py-0 text-sm text-brand-primary hover:underline text-left",children:[S.firstName," ",S.lastName]}),g===S.id&&e.jsxs("div",{ref:T,className:"mt-2 mb-3 flex items-center gap-2 pl-0 animate-[fadeSlideIn_0.2s_ease-out]",children:[e.jsxs("select",{value:k,onChange:C=>b(C.target.value),className:"flex-1 min-w-0 rounded-md border border-gray-300 px-2 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary focus:border-brand-primary",children:[e.jsx("option",{value:"",children:"Select instrumentâ¦"}),M.map(([C,P])=>e.jsx("optgroup",{label:C.charAt(0).toUpperCase()+C.slice(1),children:P.map(z=>e.jsx("option",{value:z.id,children:z.name},z.id))},C))]}),e.jsx(D,{size:"sm",type:"button",disabled:!k||f,onClick:()=>h(S.id),isLoading:f,children:"Save"}),e.jsx(D,{variant:"secondary",size:"sm",type:"button",onClick:()=>{c(null),b("")},children:"Cancel"})]})]},S.id))}),!a&&E>0&&e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>o(!0),className:"!px-0 mt-2 text-xs text-gray-400 hover:text-gray-600",children:["+ ",E," more"]})]})}),xt=5,qn=l.forwardRef(function({members:s,icon:n},r){const{showSuccess:m,showError:u}=ee(),[i,d]=l.useState(s),[a,o]=l.useState(!1),[g,c]=l.useState(null),[N,v]=l.useState(null),[k,b]=l.useState(""),[f,L]=l.useState(!1),T=l.useRef(null);l.useEffect(()=>{g&&!N&&Cn.list().then(v).catch(()=>u("Failed to load ensembles"))},[g]),l.useEffect(()=>{g&&T.current&&T.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[g]);function j(M){g===M?(c(null),b("")):(c(M),b(""))}async function h(M){if(k){L(!0);try{await tt.update(M,{ensembleIds:[k]}),d(S=>S.filter(C=>C.id!==M)),c(null),b(""),m("Ensemble assigned")}catch(S){u(S.message||"Failed to assign ensemble")}finally{L(!1)}}}const I="Missing Ensemble",w="All members are in an ensemble";if(i.length===0)return e.jsxs("div",{ref:r,className:"bg-white rounded-xl border border-gray-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:I})]}),e.jsxs("p",{className:"text-sm text-emerald-600 flex items-center gap-1.5",children:[e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),w]})]});const A=a?i:i.slice(0,xt),E=i.length-xt;return e.jsxs("div",{ref:r,className:"bg-white rounded-xl border border-amber-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:I}),e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700",children:i.length})]}),e.jsx("ul",{className:"space-y-1",children:A.map(M=>e.jsxs("li",{children:[e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>j(M.id),className:"!px-0 !py-0 text-sm text-brand-primary hover:underline text-left",children:[M.firstName," ",M.lastName]}),g===M.id&&e.jsxs("div",{ref:T,className:"mt-2 mb-3 flex items-center gap-2 pl-0 animate-[fadeSlideIn_0.2s_ease-out]",children:[e.jsxs("select",{value:k,onChange:S=>b(S.target.value),className:"flex-1 min-w-0 rounded-md border border-gray-300 px-2 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary focus:border-brand-primary",children:[e.jsx("option",{value:"",children:"Select ensembleâ¦"}),(N||[]).map(S=>e.jsx("option",{value:S.id,children:S.name},S.id))]}),e.jsx(D,{size:"sm",type:"button",disabled:!k||f,onClick:()=>h(M.id),isLoading:f,children:"Save"}),e.jsx(D,{variant:"secondary",size:"sm",type:"button",onClick:()=>{c(null),b("")},children:"Cancel"})]})]},M.id))}),!a&&E>0&&e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>o(!0),className:"!px-0 mt-2 text-xs text-gray-400 hover:text-gray-600",children:["+ ",E," more"]})]})}),pt=5,Kn=l.forwardRef(function({members:s,icon:n},r){const{showSuccess:m,showError:u}=ee(),[i,d]=l.useState(s),[a,o]=l.useState(!1),[g,c]=l.useState(null),[N,v]=l.useState(null),[k,b]=l.useState(""),[f,L]=l.useState(!1),T=l.useRef(null);l.useEffect(()=>{g&&!N&&Dt.list("member").then(v).catch(()=>u("Failed to load instruments"))},[g]),l.useEffect(()=>{g&&T.current&&T.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[g]);function j(S){g===S?(c(null),b("")):(c(S),b(""))}async function h(S){if(k){L(!0);try{const C=S.ensembles.map(P=>P);await tt.update(S.id,{instruments:[{instrumentId:k}]}),d(P=>P.filter(z=>z.id!==S.id)),c(null),b(""),m("Instrument assigned")}catch(C){u(C.message||"Failed to assign instrument")}finally{L(!1)}}}const I="Missing Ensemble Instrument",w="All ensemble members have instruments";if(i.length===0)return e.jsxs("div",{ref:r,className:"bg-white rounded-xl border border-gray-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:I})]}),e.jsxs("p",{className:"text-sm text-emerald-600 flex items-center gap-1.5",children:[e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),w]})]});const A=a?i:i.slice(0,pt),E=i.length-pt,M=N?Object.entries(N.reduce((S,C)=>{const P=C.family||"Other";return S[P]||(S[P]=[]),S[P].push(C),S},{})).sort(([S],[C])=>S.localeCompare(C)):[];return e.jsxs("div",{ref:r,className:"bg-white rounded-xl border border-amber-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:I}),e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700",children:i.length})]}),e.jsx("ul",{className:"space-y-1",children:A.map(S=>e.jsxs("li",{children:[e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>j(S.id),className:"!px-0 !py-0 text-sm text-brand-primary hover:underline text-left",children:[S.firstName," ",S.lastName]}),e.jsxs("span",{className:"text-xs text-gray-400 ml-1.5",children:["(",S.ensembles.join(", "),")"]}),g===S.id&&e.jsxs("div",{ref:T,className:"mt-2 mb-3 flex items-center gap-2 pl-0 animate-[fadeSlideIn_0.2s_ease-out]",children:[e.jsxs("select",{value:k,onChange:C=>b(C.target.value),className:"flex-1 min-w-0 rounded-md border border-gray-300 px-2 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary focus:border-brand-primary",children:[e.jsx("option",{value:"",children:"Select instrumentâ¦"}),M.map(([C,P])=>e.jsx("optgroup",{label:C.charAt(0).toUpperCase()+C.slice(1),children:P.map(z=>e.jsx("option",{value:z.id,children:z.name},z.id))},C))]}),e.jsx(D,{size:"sm",type:"button",disabled:!k||f,onClick:()=>h(S),isLoading:f,children:"Save"}),e.jsx(D,{variant:"secondary",size:"sm",type:"button",onClick:()=>{c(null),b("")},children:"Cancel"})]})]},S.id))}),!a&&E>0&&e.jsxs(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>o(!0),className:"!px-0 mt-2 text-xs text-gray-400 hover:text-gray-600",children:["+ ",E," more"]})]})});function Xn({rows:t=[],icon:s}){const n=Z();return t.length?e.jsxs("div",{className:"bg-white rounded-xl border border-amber-200 px-6 py-5","data-testid":"low-stock-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Stock to reorder"}),e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700",children:t.length})]}),e.jsx("ul",{className:"space-y-1",children:t.map(r=>e.jsxs("li",{className:"text-sm text-gray-700 flex items-baseline gap-2 flex-wrap",children:[e.jsx(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>n("/equipment"),className:"!px-0 !py-0 text-sm text-brand-primary hover:underline text-left",children:r.variantLabel?`${r.name} · ${r.variantLabel}`:r.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:[r.inStock," left",r.minStock!=null?` · reorder at ${r.minStock}`:""]}),r.reorderUrl&&e.jsxs("a",{href:r.reorderUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-brand-primary hover:underline",children:["order from ",r.reorderSource||"the supplier"]})]},r.id))})]}):null}function Jn({rows:t=[],icon:s}){const n=Z();return t.length?e.jsxs("div",{className:"bg-white rounded-xl border border-amber-200 px-6 py-5","data-testid":"former-member-stock-card",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s,e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Stock out with former members"}),e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700",children:t.length})]}),e.jsx("ul",{className:"space-y-1",children:t.map(r=>e.jsxs("li",{className:"text-sm text-gray-700 flex items-baseline gap-2 flex-wrap",children:[e.jsx(D,{variant:"ghost",size:"sm",type:"button",onClick:()=>n("/equipment?tab=loans"),className:"!px-0 !py-0 text-sm text-brand-primary hover:underline text-left",children:r.variantLabel?`${r.name} · ${r.variantLabel}`:r.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:[r.memberName," (",r.statusLabel,")"]})]},r.loanId))}),e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:"Mark returned, or Sold to member⦠if they are keeping it."})]}):null}const ft=6;function Zn({data:t}){if(!t?.members?.length)return null;const{sinceDate:s,members:n}=t,r=new Date(`${s}T00:00:00`).toLocaleDateString("en-US",{month:"short",day:"numeric"}),m=n.slice(0,ft),u=n.length-ft,i=n.map(d=>d.id);return e.jsxs("div",{className:"bg-white rounded-xl border border-band-200 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("svg",{className:"h-4 w-4 text-band-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"})}),e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"New Since Last Rehearsal"}),e.jsx("span",{className:"ml-auto inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-band-100 text-band-700",children:n.length})]}),e.jsxs(
1"p",{className:"text-xs text-gray-400 mb-3",children:["Joined after the ",r," rehearsal â prep name badges and stand tents."]}),e.jsxs("ul",{className:"space-y-1 mb-3",children:[m.map(d=>e.jsx("li",{children:e.jsxs(Ce,{to:`/members/${d.id}`,className:"text-sm text-brand-primary hover:underline",children:[d.firstName," ",d.lastName]})},d.id)),u>0&&e.jsxs("li",{className:"text-xs text-gray-400",children:["+ ",u," more"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(D,{size:"sm",type:"button",onClick:()=>Ee.openPdf(Ee.urlForMembers(i)),children:"Print badges"}),e.jsx(D,{variant:"secondary",size:"sm",type:"button",onClick:()=>Ee.openPdf(Ee.tentUrlForMembers(i)),children:"Print tents"}),e.jsx(Ce,{to:`/members?joinedAfter=${s}`,className:"ml-auto text-xs text-brand-primary hover:underline self-center",children:"View in Members"})]})]})}function Qn({orgRoster:t}){if(!t?.length)return null;const s=Tn.flatMap(n=>t.filter(r=>r.role===n.value).map(r=>({...r,roleLabel:n.label})));return e.jsxs("section",{children:[e.jsx(le,{children:"Leadership Contacts"}),e.jsx("div",{className:"hidden sm:block bg-white rounded-xl border border-gray-200 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50",children:[e.jsx("th",{className:"px-4 py-2.5 text-left text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Role"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Name"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Email"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Phone"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:s.map(n=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-2.5",children:e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-semibold bg-teal-100 text-teal-700",children:n.roleLabel})}),e.jsxs("td",{className:"px-4 py-2.5 font-medium text-gray-900",children:[n.firstName," ",n.lastName]}),e.jsx("td",{className:"px-4 py-2.5 text-gray-500",children:(()=>{const r=n.aliasEmail||n.emailAddress;return r?e.jsx("a",{href:`mailto:${r}`,className:"hover:underline text-brand-primary",title:n.aliasEmail?"Role email":"Personal email",children:r}):"â"})()}),e.jsx("td",{className:"px-4 py-2.5 text-gray-500",children:n.phone?e.jsx("a",{href:`tel:${n.phone}`,className:"hover:underline text-brand-primary",children:n.phone}):"â"})]},`${n.role}-${n.memberId}`))})]})}),e.jsx("div",{className:"sm:hidden space-y-2",children:s.map(n=>e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-semibold bg-teal-100 text-teal-700",children:n.roleLabel}),e.jsxs("span",{className:"font-medium text-sm text-gray-900",children:[n.firstName," ",n.lastName]})]}),e.jsxs("div",{className:"flex flex-col gap-0.5 text-sm",children:[(n.aliasEmail||n.emailAddress)&&e.jsx("a",{href:`mailto:${n.aliasEmail||n.emailAddress}`,className:"text-brand-primary hover:underline truncate",title:n.aliasEmail?"Role email":"Personal email",children:n.aliasEmail||n.emailAddress}),n.phone&&e.jsx("a",{href:`tel:${n.phone}`,className:"text-brand-primary hover:underline",children:n.phone})]})]},`${n.role}-${n.memberId}`))})]})}function es({memberSections:t}){return t?.length?e.jsxs("section",{children:[e.jsx(le,{children:t.length===1?"Your Section":"Your Sections"}),e.jsx("div",{className:t.length>1?"grid gap-3 sm:grid-cols-2":"",children:t.map(s=>e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[s.leader&&e.jsx(In,{src:s.leader.photoUrl,firstName:s.leader.firstName,lastName:s.leader.lastName,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900",children:s.name}),s.ensembleName&&e.jsx("p",{className:"text-xs text-gray-400",children:s.ensembleName}),s.leader?e.jsxs("div",{className:"mt-2 space-y-0.5",children:[e.jsxs("p",{className:"text-sm text-gray-700",children:[s.leader.firstName," ",s.leader.lastName]}),e.jsx("p",{className:"text-xs text-gray-400",children:"Section Leader"}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 mt-1",children:[s.leader.phone&&e.jsx("a",{href:`tel:${s.leader.phone}`,className:"text-xs text-brand-primary hover:underline",children:s.leader.phone}),s.leader.email&&e.jsx("a",{href:`mailto:${s.leader.email}`,className:"text-xs text-brand-primary hover:underline truncate",children:s.leader.email})]})]}):e.jsx("p",{className:"text-xs text-gray-400 mt-2",children:"No section leader assigned"})]})]})},s.id))})]}):null}function ts(){const t=ee(c=>c.showSuccess),s=ee(c=>c.showError),[n,r]=l.useState(null),[m,u]=l.useState({}),[i,d]=l.useState(null),a=l.useCallback(async()=>{try{const c=await ne.getCoverageGaps();r(c?.performances||[])}catch{r([])}},[]);l.useEffect(()=>{a()},[a]);async function o(c,N){const v=`${c.performanceId}:${N.instrumentId}`,k=m[v]||N.substitutes[0]?.id;if(!k)return;const b=N.substitutes.find(f=>f.id===k);d(v);try{await ne.fillGap(c.performanceId,k,N.instrumentId),t(`${b?`${b.firstName} ${b.lastName}`:"Player"} added to ${N.instrumentName} for ${c.performanceTitle}.`),await a()}catch(f){s(f?.message||`Couldn't fill ${N.instrumentName}.`)}finally{d(null)}}if(n==null||n.length===0)return null;const g=n.reduce((c,N)=>c+N.gaps.length,0);return e.jsxs("section",{children:[e.jsxs("h2",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wide mb-3",children:["Coverage Gaps",e.jsx("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700 normal-case tracking-normal",children:g})]}),e.jsx("div",{className:"space-y-3",children:n.map(c=>e.jsxs("div",{className:"bg-white rounded-xl border border-amber-200 p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2 mb-3",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",children:c.performanceTitle}),e.jsxs("p",{className:"text-xs text-gray-400 shrink-0",children:[c.ensembleName,c.performanceDate?` · ${oe(c.performanceDate)}`:""]})]}),e.jsx("ul",{className:"space-y-3",children:c.gaps.map(N=>{const v=`${c.performanceId}:${N.instrumentId}`,k=i===v,b=N.substitutes.length>0;return e.jsxs("li",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-amber-900",children:N.instrumentName}),N.musicTitles.length>0&&e.jsxs("p",{className:"text-xs text-gray-500 truncate",children:["Needed for ",N.musicTitles.join(", ")
1]})]}),b?e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(jt,{"aria-label":`Choose a player for ${N.instrumentName}`,value:m[v]||N.substitutes[0].id,onChange:f=>u(L=>({...L,[v]:f.target.value})),options:N.substitutes.map(f=>({value:f.id,label:`${f.firstName} ${f.lastName}`})),className:"!py-1 min-w-[10rem]"}),e.jsx(D,{variant:"primary",size:"sm",isLoading:k,disabled:i!==null,onClick:()=>o(c,N),children:k?"Adding":"Fill"})]}):e.jsx("span",{className:"text-xs text-gray-400 italic shrink-0",children:"No players available"})]},N.instrumentId)})})]},c.performanceId))})]})}const ns=1,ss=300,rs=30;function as({children:t,maxScale:s=4,doubleTapScale:n=2.2,style:r}){const m=l.useRef(null),u=l.useRef(null),[i,d]=l.useState({s:1,x:0,y:0}),a=l.useRef(i);a.current=i;const o=l.useRef(new Map),g=l.useRef(null),c=l.useRef(!1),N=l.useRef({time:0,x:0,y:0});function v(j,h){const I=m.current?.getBoundingClientRect();return I?{x:j-I.left,y:h-I.top}:{x:j,y:h}}function k(j){const h=m.current?.getBoundingClientRect(),I=u.current;if(!h||!I)return j;const w=I.offsetWidth*j.s,A=I.offsetHeight*j.s,E=(M,S,C)=>C>=S?Math.max(S-C,Math.min(0,M)):(S-C)/2;return{s:j.s,x:E(j.x,h.width,w),y:E(j.y,h.height,A)}}function b(){const j=[...o.current.values()];if(j.length>=2){const h=v((j[0].x+j[1].x)/2,(j[0].y+j[1].y)/2);g.current={mode:"pinch",dist:Math.max(1,Math.hypot(j[0].x-j[1].x,j[0].y-j[1].y)),mid:h,start:a.current}}else j.length===1?g.current={mode:"pan",pt:{...j[0]},start:a.current}:g.current=null}function f(j){try{m.current?.setPointerCapture?.(j.pointerId)}catch{}o.current.set(j.pointerId,{x:j.clientX,y:j.clientY}),o.current.size===1&&(c.current=!1),b()}function L(j){if(!o.current.has(j.pointerId))return;o.current.set(j.pointerId,{x:j.clientX,y:j.clientY});const h=g.current;if(!h)return;const I=[...o.current.values()];if(h.mode==="pinch"&&I.length>=2){const w=Math.max(1,Math.hypot(I[0].x-I[1].x,I[0].y-I[1].y));Math.abs(w-h.dist)>2&&(c.current=!0);const A=Math.max(ns,Math.min(s,h.start.s*(w/h.dist))),E=A/h.start.s;
1d(k({s:A,x:h.mid.x-(h.mid.x-h.start.x)*E,y:h.mid.y-(h.mid.y-h.start.y)*E}))}else if(h.mode==="pan"&&I.length===1){const w=I[0].x-h.pt.x,A=I[0].y-h.pt.y;Math.hypot(w,A)>4&&(c.current=!0),d(k({s:h.start.s,x:h.start.x+w,y:h.start.y+A}))}}function T(j){if(o.current.delete(j.pointerId)){if(o.current.size===0&&g.current?.mode==="pan"&&!c.current){const I=Date.now(),w=v(j.clientX,j.clientY),A=N.current;if(I-A.time<ss&&Math.hypot(w.x-A.x,w.y-A.y)<rs){if(a.current.s>1.001)d({s:1,x:0,y:0});else{const M=Math.min(s,n);d(k({s:M,x:w.x*(1-M),y:w.y*(1-M)}))}N.current={time:0,x:0,y:0}}else N.current={time:I,x:w.x,y:w.y}}b()}}return e.jsx("div",{ref:m,onPointerDown:f,onPointerMove:L,onPointerUp:T,onPointerCancel:T,style:{overflow:"hidden",touchAction:"none",...r},children:e.jsx("div",{ref:u,style:{transformOrigin:"0 0",transform:`translate(${i.x}px, ${i.y}px) scale(${i.s})`,willChange:"transform"},children:t})})}function is({data:t,fill:s=!1}){const n=t?.stage,r=l.useMemo(()=>n?jn(n):null,[n]),[m,u]=l.useState(()=>new Set),i=l.useMemo(()=>!r||!n||!t?.partBlocks?[]:t.partBlocks.map(c=>{const{seats:N,isPercussion:v,holding:k}=wn(c,r,n);return{block:c,seats:N,isPercussion:v,holding:!!k}}),[t,r,n]);if(!t||!n||!r)return null;const d=Nn(n,r),a={x:r.stageLeftX,y:r.stageTopY,w:r.stageRightX-r.stageLeftX,h:r.stageHeightPx},o={x:a.x,y:a.y,w:a.w,h:r.seatedTopY-a.y},g=i.some(c=>c.holding);return e.jsxs("svg",{viewBox:`0 0 ${Sn} ${g?Math.max(dt,Math.ceil(Se+5*r.pxPerFt)):dt}`,width:"100%",height:s?"100%":void 0,preserveAspectRatio:"xMidYMid meet",style:s?{display:"block"}:void 0,xmlns:"http://www.w3.org/2000/svg",role:"img",children:[e.jsx("title",{children:"Stage map"}),e.jsx("rect",{x:a.x,y:a.y,width:a.w,height:a.h,fill:"#fafafa",stroke:"#cbd5e1",strokeWidth:"1.5",rx:"2"}),n.percussionDepthFt>0&&e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:"#f1f5f9",stroke:"none"}),e.jsx("line",{x1:a.x,y1:r.seatedTopY,x2:a.x+a.w,y2:r.seatedTopY,stroke:"#cbd5e1",strokeWidth:"1",strokeDasharray:"6 4"}),e.jsx("text",{x:a.x+8,y:o.y+14,fill:"#94a3b8",fontSize:"10",fontWeight:"600",letterSpacing:"1",children:"PERCUSSION"})]}),n.rhythmZoneFt>0&&e.jsxs("g",{children:[e.jsx("rect",{x:a.x,y:a.y,width:n.rhythmZoneFt*r.pxPerFt,height:a.h,fill:"rgba(99, 102, 241, 0.04)",stroke:"#c7d2fe",strokeWidth:"1",strokeDasharray:"6 4"}),e.jsx("text",{x:a.x+8,y:a.y+14,fill:"#818cf8",fontSize:"10",fontWeight:"600",letterSpacing:"1",children:"RHYTHM"})]}),e.jsx("text",{x:a.x+a.w-8,y:a.y+14,textAnchor:"end",fill:"#94a3b8",fontSize:"10",fontWeight:"500",children:`${n.widthFt}â² Ã ${n.depthFt}â² stage`}),d.map(c=>e.jsx("g",{children:e.jsx("path",{d:c.d,fill:"none",stroke:"#e2e8f0",strokeWidth:"1",strokeDasharray:"3 3"})},c.key)),e.jsx("polygon",{points:`${r.cx},${Se-16} ${r.cx-12},${Se+4} ${r.cx+12},${Se+4}`,fill:"#1a1a1a"}),e.jsx("text",{x:r.cx,y:Se+18,textAnchor:"middle",fill:"#6b7280",fontSize:"9",fontWeight:"600",letterSpacing:"1",children:"CONDUCTOR"}),i.map(({block:c,isPercussion:N,holding:v,seats:k})=>{let b,f,L=0;if(N||v||n.isStraight)b=c.xFt,f=c.yFt+ct;else{const E=Math.sqrt(c.xFt*c.xFt+c.yFt*c.yFt)||.001,M=(E+ct)/E;b=c.xFt*M,f=c.yFt*M,L=Math.atan2(c.xFt,c.yFt)*180/Math.PI}const{x:T,y:j}=r.ftToSvg(b,f),[h,I]=(c.label||"").split(" · "),w=k?.length||0,A=w?`${h} (${w})`:h;return e.jsx("text",{x:T,y:j,textAnchor:"middle",dominantBaseline:"middle",fill:c.color,fontSize:"10",fontWeight:"600",letterSpacing:"0.3",stroke:"white",strokeWidth:"3",strokeLinejoin:"round",paintOrder:"stroke",transform:L?`rotate(${L} ${T} ${j})`:void 0,children:I?e.jsxs(e.Fragment,{children:[e.jsx("tspan",{x:T,dy:"-0.35em",children:A}),e.jsx("tspan",{x:T,dy:"1.05em",children:`· ${I}`})]}):A},`lbl-${mt(c)}`)}),e.jsx("defs",{children:e.jsx("clipPath",{id:"bb-map-photo-clip",clipPathUnits:"objectBoundingBox",children:e.jsx("rect",{x:"0",y:"0",width:"1",height:"1",rx:"0.17"})})}),i.map(({block:c,seats:N})=>e.jsx("g",{children:N.map(v=>{const k=v.photoUrl&&!m.has(v.memberId),b=!!v.absent,f=!!v.rehearsalOnly,L=b?.3:1;return e.jsxs("g",{children:[e.jsx("title",{children:`${v.memberName} â ${c.label} · seat ${v.seatPosition||"?"}${b?` â OUT${v.absentReason?`: ${v.absentReason}`:""}`:""}${f?" â rehearsal only (not in concert)":""}`}),e.jsx("rect",{x:v.x-W/2,y:v.y-W/2,width:W,height:W,rx:"5",fill:v.color,stroke:b?"#dc2626":f?"#7c3aed":v.isPrincipal?"white":v.color,strokeWidth:b?1.5:f||v.isPrincipal?2:.5,strokeDasharray:b?"3 2":f?"4 3":void 0,opacity:L}),k?e.jsxs(e.Fragment,{children:[e.jsx("image",{href:v.photoUrl,x:v.x-W/2,y:v.y-W/2,width:W,height:W,preserveAspectRatio:"xMidYMid slice",clipPath:"url(#bb-map-photo-clip)",opacity:L,onError:()=>u(T=>new Set(T).add(v.memberId))}),e.jsx("rect",{x:v.x-W/2,y:v.y-W/2,width:W,height:W,rx:"5",fill:"none",stroke:b?"#dc2626":f?"#7c3aed":v.isPrincipal?"white":v.color,strokeWidth:v.isPrincipal?2:1.5,strokeDasharray:b?"3 2":f?"4 3":void 0})]}):e.jsx("text",{x:v.x,y:v.y+3,textAnchor:"middle",fill:"white",fontSize:"10",fontWeight:"700",opacity:b?.5:1,children:v.initials}),b&&e.jsxs("g",{children:[e.jsx("line",{x1:v.x-W/2+5,y1:v.y-W/2+5,x2:v.x+W/2-5,y2:v.y+W/2-5,stroke:"#dc2626",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:v.x+W/2-5,y1:v.y-W/2+5,x2:v.x-W/2+5,y2:v.y+W/2-5,stroke:"#dc2626",strokeWidth:"2.5",strokeLinecap:"round"})]})]},v.memberId)})},mt(c)))]})}function ls(){const t=typeof document<"u"?document.documentElement:null;return!!(t&&(t.requestFullscreen||t.webkitRequestFullscreen))}function os(){const[t,s]=l.useState(()=>typeof document<"u"&&!!(document.fullscreenElement||document.webkitFullscreenElement));return l.useEffect(()=>{const m=()=>s(!!(document.fullscreenElement||document.webkitFullscreenElement));return document.addEventListener("fullscreenchange",m),document.addEventListener("webkitfullscreenchange",m),()=>{document.removeEventListener("fullscreenchange",m),document.removeEventListener("webkitfullscreenchange",m)}},[]),{isFs:t,enter:()=>
1{const m=document.documentElement,u=m.requestFullscreen||m.webkitRequestFullscreen;try{u?.call(m)?.catch?.(()=>{})}catch{}},exit:()=>{const m=document.exitFullscreen||document.webkitExitFullscreen;try{m?.call(document)?.catch?.(()=>{})}catch{}}}}function ds(){const[t,s]=l.useState(()=>typeof window<"u"&&!!window.matchMedia?.("(orientation: landscape)").matches);return l.useEffect(()=>{const n=window.matchMedia?.("(orientation: landscape)");if(!n)return;const r=m=>s(m.matches);return n.addEventListener?.("change",r),()=>n.removeEventListener?.("change",r)},[]),t}function cs({isOpen:t,onClose:s,performanceId:n,rehearsalId:r}){const[m,u]=l.useState({status:"loading",data:null}),i=ds(),{isFs:d,enter:a,exit:o}=os();l.useEffect(()=>{!t&&d&&o()},[t]);function g(){d&&o(),s?.()}l.useEffect(()=>{if(!t||!n)return;let b=!1;return u({status:"loading",data:null}),ne.getStageLayout(n,{rehearsalId:r}).then(f=>{b||u({status:"ok",data:f})}).catch(()=>{b||u({status:"error",data:null})}),()=>{b=!0}},[t,n,r]);const c=m.data,N=(c?.partBlocks||[]).flatMap(b=>b.holding?[]:b.seats||[]),v=N.filter(b=>b.absent).length,k=N.length-v;return e.jsxs(Mt,{isOpen:t,onClose:g,title:"Tonight's stage map",fullHeight:i,children:[m.status==="loading"&&e.jsx("p",{style:{margin:"var(--bb-space-4)",fontSize:14,color:"var(--bb-fg-muted)"},children:"Loading the stage mapâ¦"}),m.status==="error"&&e.jsx("p",{style:{margin:"var(--bb-space-4)",fontSize:14,color:"var(--bb-fg-muted)"},children:"Couldnât load the stage map. Close and try again."}),m.status==="ok"&&c&&e.jsxs("div",{style:{padding:"0 var(--bb-space-4)",display:i?"flex":"block",flexDirection:"column",height:i?"100%":void 0,boxSizing:"border-box"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:i?"4px 0":"8px 0",flexShrink:0},children:[e.jsx("div",{style:{fontSize:i?12:13,color:v>0?"#b91c1c":"var(--bb-fg-muted)",fontWeight:600},children:c.rehearsal&&c.rehearsal.rsvpEnabled===!1?"RSVP tracking is off â no absences shown":v>0?`${v} marked out (â) · set up ${k} chairs`:`Full seating · ${k} chairs`}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[!i&&e.jsx("span",{style:{fontSize:11,color:"var(--bb-fg-subtle, var(--bb-fg-muted))",whiteSpace:"nowrap"},children:"Pinch to zoom"}),ls()&&e.jsxs("button",{type:"button",onClick:d?o:a,style:{display:"flex",alignItems:"center",gap:5,padding:"5px 10px",borderRadius:"var(--bb-radius-pill)",border:"1px solid var(--bb-border-soft)",background:"var(--bb-surface-sunken)",color:"var(--bb-fg)",fontSize:12,fontWeight:600,cursor:"pointer",font:"inherit",whiteSpace:"nowrap"},children:[e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d?e.jsxs(e.Fragment,{children:[e.jsx("polyline",{points:"8 3 8 8 3 8"}),e.jsx("polyline",{points:"16 3 16 8 21 8"}),e.jsx("polyline",{points:"8 21 8 16 3 16"}),e.jsx("polyline",{points:"16 21 16 16 21 16"})]}):e.jsxs(e.Fragment,{children:[e.jsx("polyline",{points:"3 8 3 3 8 3"}),e.jsx("polyline",{points:"21 8 21 3 16 3"}),e.jsx("polyline",{points:"3 16 3 21 8 21"}),e.jsx("polyline",{points:"21 16 21 21 16 21"})]})}),d?"Exit":"Full screen"]})]})]}),c.stage?.usingFallbackVenue&&e.jsx("p",{style:{margin:"0 0 8px",fontSize:12,color:"#b45309",flexShrink:0},children:"This room has no stage dimensions set, so the concert stage is shown."}),e.jsx(as,{style:{border:"1px solid var(--bb-border-soft)",borderRadius:"var(--bb-radius-lg)",background:"white",flex:i?1:void 0,minHeight:i?0:void 0,marginBottom:i?8:0},children:e.jsx(is,{data:c})}),!i&&(c?.rehearsal?.rehearsalOnly?.length>0||c?.rehearsal?.rehearsalOnlySeated?.length>0)&&e.jsxs("div",{style:{margin:"8px 0 0",padding:"8px 10px",fontSize:12,borderRadius:8,border:"1px solid var(--bb-border-soft)",background:"var(--bb-surface-sunken)",color:"var(--bb-fg)"},children:[e.jsxs("strong",{children:["Rehearsal only â not in concert"," ","(",(c.rehearsal.rehearsalOnlySeated?.length||0)+(c.rehearsal.rehearsalOnly?.length||0),"):"]})," ",(c.rehearsal.rehearsalOnlySeated||[]).map(b=>`${b.firstName} ${b.lastName} (seated)`).join(" · "),c.rehearsal.rehearsalOnlySeated?.length>0&&c.rehearsal.rehearsalOnly?.length>0?" · ":"",(c.rehearsal.rehearsalOnly||[]).map(b=>`${b.firstName} ${b.lastName} (no chair)`).join(" · ")]}),!i&&e.jsx("p",{style:{margin:"8px 0 0",fontSize:12,color:"var(--bb-fg-muted)"},children:"Rotate your phone for a full-screen view. Seats update as members respond â reopen for the latest. Only declared âcanât make itâ responses show as out."})]})]})}const ms=6e4;function us({rehearsalId:t}){const[s,n]=l.useState({status:"loading",data:null}),[r,m]=l.useState(!1),[u,i]=l.useState(!1);if(l.useEffect(()=>{if(!t){n({status:"idle",data:null});return}let b=!1,f=null;async function L(){try{const T=await Wt.get(t);b||n({status:"ok",data:T})}catch(T){if(b)return;if(T?.status===404||T?.response?.status===404){n({status:"hidden",data:null});return}n({status:"error",data:null})}}return L(),f=setInterval(L,ms),()=>{b=!0,f&&clearInterval(f)}},[t]),s.status==="loading"||s.status==="idle"||s.status==="hidden"||s.status==="error"||!s.data)return null;const{scope:d,rehearsal:a}=s.data,o=(d==="director"||d==="band_manager"||d==="section_leader")&&!!a?.performanceId,g=o?()=>m(!0):null,c=(d==="director"||d==="band_manager"||d==="section_leader")&&!!a?.id,N=d==="section_leader"?"section":"manager",v=c?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>i(!0),style:{display:"block",width:"100%",marginTop:8,padding:"10px 12px",borderRadius:"var(--bb-radius-md, 10px)",border:"1px solid var(--bb-border-soft)",background:"var(--bb-surface)",color:"var(--bb-link, #2e6b8a)",fontWeight:600,fontSize:14,textAlign:"center",cursor:"pointer",font:"inherit"},children:"Record absence"}),e.jsx(et,{variant:N,rehearsalId:a.id,isOpen:u,onClose:()=>i(!1)})]}):null,k=o?e.jsx(cs,{isOpen:r,onClose:()=>m(!1),performanceId:a.performanceId,rehearsalId:a.id}):null;return d==="director"?e.jsxs(e.Fragment,{children:[e.jsx(hs,{...s.data,onViewMap:g}),v,k]}):d==="band_manager"?e.jsxs(e.Fragment,{children:[e.jsx(ps,{...s.data,onViewMap:g}),v,k]}):d==="section_leader"?e.jsxs(e.Fragment,{children:[e.jsx(xs,{...s.data,onViewMap:g}),k]}):d==="member"?e.jsx(fs,{...s.data}):null}function he({onClick:t}){return t?e.jsx("button",{type:"button",onClick:t,style:{display:"block",width:"100%",marginTop:10,padding:"10px 12px",borderRadius:"var(--bb-radius-md, 10px)",border:"1px solid var(--bb-border-soft)",background:"var(--bb-surface-sunken)",color:"var(--bb-link, #2e6b8a)",fontWeight:600,fontSize:14,textAlign:"center",cursor:"pointer",font:"inherit"},children:"View stage map â"}):null}function de({eyebrow:t,title:s,expanded:n,onToggle:r,children:m}){const u=e.jsxs(e.Fragment,{children:[t&&e.jsx("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-muted)",marginBottom:2},children:t}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[e.jsx("h2",{style:{margin:0,fontSize:17,fontWeight:600,color:"var(--bb-fg)"},children:s}),r&&e.jsx("span",{"aria-hidden":"true",style:{flexShrink:0,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",background:"var(--bb-bg)",transition:"transform 0.15s ease",transform:n?"rotate(90deg)":"none"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--bb-fg-muted)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 6 15 12 9 18"})})})]})]});return e.jsxs("section",{"data-testid":"attendance-hero-card",style:{margin:"var(--bb-space-4)",background:"var(--bb-surface)",border:"1px solid var(--bb-border-soft)",borderRadius:"var(--bb-radius-lg)",boxShadow:"var(--bb-shadow-sm)",overflow:"hidden"},children:[r?e.jsx("button",{type:"button",onClick:r,"aria-expanded":n,style:{display:"block",width:"100%",padding:"12px 14px",background:"transparent",border:"none",textAlign:"left",cursor:"pointer",font:"inherit"},children:u}):e.jsx("div",{style:{padding:"12px 14px"},children:u}),(n||!r)&&m&&e.jsx("div",{style:{padding:"0 14px 12px"},children:m})]})}function Ht(t){return`${t.firstName||""} ${t.lastName||""}`.trim()}function hs({sections:t,totals:s,updatedAt:n,onViewMap:r}){const[m,u]=l.useState(!1),i=t.filter(a=>a.normalRoster>0),d=s?.absent??0;return d===0?e.jsx(de,{eyebrow:"Tonight's attendance",title:`All ${s.normalRoster} expected`,children:r?e.jsx(he,{onClick:r}):null}):e.jsxs(de,{eyebrow:"Tonight's attendance",title:`${s.chairsSetup} of ${s.normalRoster} expected (${d}
1 out)`,expanded:m,onToggle:()=>u(a=>!a),children:[e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:e.jsx("tbody",{children:i.map(a=>e.jsxs("tr",{style:{borderBottom:"1px solid var(--bb-border-soft)"},children:[e.jsx("td",{style:{padding:"8px 0",fontWeight:600,color:"var(--bb-fg)",whiteSpace:"nowrap",verticalAlign:"top"},children:a.name}),e.jsxs("td",{style:{padding:"8px 8px",color:"var(--bb-fg-muted)",whiteSpace:"nowrap",verticalAlign:"top"},children:[a.chairsSetup,"/",a.normalRoster]}),e.jsx("td",{style:{padding:"8px 0",color:"var(--bb-fg)",verticalAlign:"top"},children:a.absentees.length===0?e.jsx("span",{style:{color:"var(--bb-fg-muted)"},children:"â"}):a.absentees.map((o,g)=>e.jsxs("span",{children:[g>0&&", ",e.jsx("span",{children:Ht(o)}),o.reason&&e.jsxs("span",{style:{color:"var(--bb-fg-muted)"},children:[" (",o.reason,")"]})]},o.memberId))})]},a.id||a.name))})}),e.jsx(he,{onClick:r})]})}function xs({sections:t,updatedAt:s,onViewMap:n}){const[r,m]=l.useState(!1),u=t.reduce((a,o)=>a+o.normalRoster,0),i=t.reduce((a,o)=>a+o.chairsSetup,0),d=t.reduce((a,o)=>a+(o.absentees?.length||0),0);return d===0?e.jsx(de,{eyebrow:"Your section · tonight",title:`All ${u} expected`,children:n?e.jsx(he,{onClick:n}):null}):e.jsxs(de,{eyebrow:"Your section · tonight",title:`${i} of ${u} expected (${d}
1 out)`,expanded:r,onToggle:()=>m(a=>!a),children:[e.jsx("div",{children:t.map(a=>e.jsxs("div",{style:{marginBottom:"var(--bb-space-3)"},children:[t.length>1&&e.jsxs("div",{style:{fontSize:14,fontWeight:600,color:"var(--bb-fg)",marginBottom:4},children:[a.name," (",a.chairsSetup,"/",a.normalRoster,")"]}),a.absentees.length===0?e.jsx("div",{style:{fontSize:13,color:"var(--bb-fg-muted)"},children:"All present."}):e.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:a.absentees.map(o=>e.jsxs("li",{style:{padding:"4px 0",fontSize:14,color:"var(--bb-fg)"},children:[e.jsx("span",{style:{fontWeight:600},children:Ht(o)}),o.reason&&e.jsxs("span",{style:{color:"var(--bb-fg-muted)"},children:[" â ",o.reason]})]},o.memberId))})]},a.id||a.name))}),n?e.jsx(he,{onClick:n}):null]})}function ps({rows:t,percussion:s,totals:n,updatedAt:r,onViewMap:m}){const[u,i]=l.useState(!1),d=(t||[]).filter(o=>o.normalChairs>0);return n.normalRoster-n.chairsSetup===0?e.jsx(de,{eyebrow:"Chair setup · tonight",title:`All ${n.normalRoster} chairs`,children:m?e.jsx(he,{onClick:m}):null}):e.jsxs(de,{eyebrow:"Chair setup · tonight",title:`${n.chairsSetup} chairs (normal ${n.normalRoster})`,expanded:u,onToggle:()=>i(o=>!o),children:[e.jsx("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:e.jsxs("tbody",{children:[d.map(o=>e.jsxs("tr",{style:{borderBottom:"1px solid var(--bb-border-soft)"},children:[e.jsx("td",{style:{padding:"8px 0",color:"var(--bb-fg)",verticalAlign:"top"},children:o.label}),e.jsxs("td",{style:{padding:"8px 8px",fontWeight:600,color:"var(--bb-fg)",textAlign:"right",whiteSpace:"nowrap",verticalAlign:"top"},children:[o.chairsSetup," chair",o.chairsSetup===1?"":"s"]}),e.jsx("td",{style:{padding:"8px 0",color:o.delta<0?"#b91c1c":"var(--bb-fg-muted)",textAlign:"right",whiteSpace:"nowrap",verticalAlign:"top"},children:o.delta===0?"":`(${o.delta})`})]},o.index)),s&&s.normalChairs>0&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"8px 0",color:"#6d28d9",verticalAlign:"top",fontWeight:600},children:"Percussion"}),e.jsxs("td",{style:{padding:"8px 8px",fontWeight:600,color:"#6d28d9",textAlign:"right",whiteSpace:"nowrap",verticalAlign:"top"},children:[s.chairsSetup," station",s.chairsSetup===1?"":"s"]}),e.jsx("td",{style:{padding:"8px 0",color:s.delta<0?"#b91c1c":"var(--bb-fg-muted)",textAlign:"right",whiteSpace:"nowrap",verticalAlign:"top"},children:s.delta===0?"":`(${s.delta})`})]})]})}),e.jsx(he,{onClick:m})]})}function fs({rehearsal:t,own:s}){const[n,r]=l.useState(s),m=l.useRef(0);l.useEffect(()=>{Date.now()-m.current<7e4||r(s)},[s]);const[u,i]=l.useState(!1),d=n?.response==="not_attending",a=t?.performanceId?`/performances?highlight=${t.performanceId}`:null;return e.jsxs(de,{eyebrow:"Your plans · tonight",title:d?"You're marked as not attending":"You're confirmed for tonight",children:[d&&n.reason&&e.jsxs("p",{style:{margin:0,color:"var(--bb-fg-muted)",fontSize:14},children:["Note: ",n.reason]}),e.jsxs("div",{style:{display:"flex",gap:16,marginTop:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",onClick:()=>i(!0),style:{minHeight:44,display:"inline-flex",alignItems:"center",padding:0,border:"none",background:"none",cursor:"pointer",color:"var(--bb-link, #2e6b8a)",fontSize:14,fontWeight:600,fontFamily:"inherit"},children:"Change my plans"}),a&&e.jsx(Ce,{to:a,style:{minHeight:44,display:"inline-flex",alignItems:"center",color:"var(--bb-link, #2e6b8a)",fontSize:14,fontWeight:600,textDecoration:"none"},children:"View rehearsal â"})]}),e.jsx(kt,{rehearsal:t,current:n,isOpen:u,onClose:()=>i(!1),onSaved:o=>{m.current=Date.now(),r(o)}})]})}const Ge={width:44,height:44,borderRadius:"var(--bb-radius-pill)",background:"var(--bb-primary-soft)",color:"var(--bb-primary)",display:"flex",alignItems:"center",justifyContent:"center",textDecoration:"none",flexShrink:0};function _t({phone:t,email:s,name:n}){return!t&&!s?null:e.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[t&&e.jsx("a",{href:`tel:${t}`,"aria-label":`Call ${n}`,style:Ge,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,"aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 5a2 2 0 012-2h2.28a1 1 0 01.95.68l1.5 4.5a1 1 0 01-.27 1.05L8.09 10.91a11 11 0 005 5l1.68-1.37a1 1 0 011.05-.27l4.5 1.5a1 1 0 01.68.95V19a2 2 0 01-2 2A16 16 0 013 5z"})})}),t&&e.jsx("a",{href:`sms:${t}`,"aria-label":`Text ${n}`,style:Ge,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,"aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.86 9.86 0 01-4.25
15-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),s&&e.jsx("a",{href:`mailto:${s}`,"aria-label":`Email ${n}`,style:Ge,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,"aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})})]})}function Ut({section:t}){const s=Z(),n=t.leader,r=An(t.id,6),m=n?((n.firstName?.[0]||"")+(n.lastName?.[0]||"")).toUpperCase()||"?":(t.name?.[0]||"?").toUpperCase(),u=()=>s(`/members?sectionId=${t.id}`),i={width:48,height:48,borderRadius:"50%",flexShrink:0,border:"none",padding:0,cursor:"pointer",overflow:"hidden",background:"transparent"};return e.jsxs("li",{style:{margin:"0 var(--bb-space-4) var(--bb-space-3)",padding:"var(--bb-space-4)",background:"var(--bb-surface)",border:"1px solid var(--bb-border)",borderRadius:"var(--bb-radius-lg)",boxShadow:"var(--bb-shadow-xs)",display:"flex",alignItems:"center",gap:"var(--bb-space-3)"},children:[e.jsx("button",{type:"button",onClick:u,"aria-label":`Show ${t.name} members`,style:i,children:n?.photoUrl?e.jsx("img",{src:n.photoUrl,alt:"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):e.jsx("div",{"aria-hidden":"true",style:{width:"100%",height:"100%",background:`var(--bb-avatar-${r})`,color:`var(--bb-avatar-${r}-ink)`,fontSize:15,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center"},children:m})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:"var(--bb-fg)"},children:t.name}),t.ensembleName&&e.jsx("div",{style:{marginTop:1,fontSize:12,color:"var(--bb-fg-muted)"},children:t.ensembleName}),n?e.jsxs("div",{style:{marginTop:4,fontSize:13,color:"var(--bb-fg-body)"},children:[n.firstName," ",n.lastName,e.jsx("span",{style:{color:"var(--bb-fg-muted)"},children:" · Section Leader"})]}):e.jsx("div",{style:{marginTop:4,fontSize:12,color:"var(--bb-fg-muted)",fontStyle:"italic"},children:"No section leader assigned"})]}),n&&e.jsx(_t,{phone:n.phone,email:n.email,name:n.firstName})]})}function Pe(t){return!t||!Number.isFinite(Number(t))?null:`${t} min`}function qe({label:t,value:s,onClick:n,ariaLabel:r}){const m={flex:1,padding:"var(--bb-space-3)",background:"var(--bb-surface)",border:"1px solid var(--bb-border-soft)",borderRadius:"var(--bb-radius-lg)",textAlign:"left",fontFamily:"inherit"},u=e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontSize:28,fontWeight:700,color:"var(--bb-fg)",lineHeight:1},children:s}),e.jsx("div",{style:{marginTop:6,fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-muted)"},children:t})]});return n?e.jsx("button",{type:"button",onClick:n,"aria-label":r||t,style:{...m,cursor:"pointer",transition:"border-color 120ms ease, transform 120ms ease"},children:u}):e.jsx("div",{style:m,children:u})}function Oe({children:t}){return e.jsxs("div",{style:{borderTop:"1px solid var(--bb-border-soft)",margin:"0 var(--bb-space-4)",padding:"var(--bb-space-4) 0 var(--bb-space-2)",display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{"aria-hidden":"true",style:{width:3,height:12,borderRadius:2,background:"var(--bb-primary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-body)"},children:t})]})}function bs({data:t,memberSections:s}){const n=Array.isArray(t?.events)&&t.events.length>0?t.events:t?.mode&&t?.event?[t]:[],[r,m]=l.useState(()=>{const i=Number.isInteger(t?.defaultIndex)?t.defaultIndex:0;return Math.min(Math.max(i,0),Math.max(n.length-1,0))});if(n.length===0)return null;const u=n[Math.min(r,n.length-1)];return e.jsxs("div",{children:[n.length>1&&e.jsx("div",{"data-testid":"tonight-switcher",role:"tablist","aria-label":"Tonight's events",style:{display:"flex",gap:6,margin:"var(--bb-space-4) var(--bb-space-4) 0",padding:4,background:"var(--bb-surface)",border:"1px solid var(--bb-border-soft)",borderRadius:"var(--bb-radius-lg)"},children:n.map((i,d)=>{const a=d===Math.min(r,n.length-1),o=i.event?.ensembleName||i.event?.title||(i.mode==="show"?"Show":"Rehearsal"),g=V(i.event?.startTime);return e.jsxs("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>m(d),style:{flex:1,minHeight:44,padding:"6px 10px",border:"none",borderRadius:"var(--bb-radius-md)",background:a?"var(--bb-primary)":"transparent",color:a?"#fff":"var(--bb-fg-body)",fontFamily:"inherit",fontSize:13,fontWeight:600,cursor:"pointer"},children:[e.jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),g&&e.jsx("span",{style:{display:"block",marginTop:1,fontSize:11,fontWeight:500,color:a?"rgba(255,255,255,0.85)":"var(--bb-fg-muted)"},children:g})]},i.event?.id||d)})}),e.jsx(gs,{data:u,memberSections:s},u.event?.id||r)]})}function gs({data:t,memberSections:s}){const{canFully:n}=Be(),{showError:r}=ee(),{currentOrg:m}=ie(),u=Z(),[i,d]=l.useState(null),[a,o]=l.useState(!1),{myPlans:g,updatePlan:c}=Ct(),N=n("attendance:take"),v=Te(y=>!!y.user?.sectionId),k=N?"manager":"section",[b,f]=l.useState(null),[L,T]=l.useState(null);if(!t||!t.mode||!t.event)return null;const j=t.mode==="show",h=t.event,I=j&&h?.id&&g?.[h.id]||null,w=h.venue,A=j?h.id:h.performanceId||h.id,E=()=>{A&&u(`/performances?highlight=${A}`)},M=Nt({isShow:j,canFully:n,org:m}).takeAttendance,S=h.title||(j?"Tonight":"Rehearsal"),C=!!h.cancelledAt,P=h.setupTime?`Setup ${V(h.setupTime)}
1`:null,z=h.callTime?`Call ${V(h.callTime)}`:null,H=h.startTime?`${j?"Perform":"Start"} ${V(h.startTime)}`:null;h.venue?.name;async function Y(){if(!a){o(!0);try{const y=h.id,F=j?"performance":"rehearsal",K=await We.generateToken({eventId:y,eventType:F});d({token:K.token,title:h.title||(j?"Tonight":"Rehearsal"),date:h.performanceDate||h.rehearsalDate||"",eventType:F})}catch(y){r(y?.message||"Could not open attendance.")}finally{o(!1)}}}return e.jsxs("div",{"data-testid":"tonight-view",style:{padding:"var(--bb-space-4) 0 120px"},children:[e.jsxs("div",{"data-testid":"tonight-hero",style:{margin:"0 var(--bb-space-4)",padding:"var(--bb-space-5)",minHeight:160,display:"flex",flexDirection:"column",justifyContent:"flex-end",borderRadius:"var(--bb-radius-lg)",background:C?"linear-gradient(135deg, #b91c1c, #7f1d1d)":"linear-gradient(135deg, var(--bb-banner-from), var(--bb-banner-to))",color:"var(--bb-fg-on-dark)",boxShadow:"var(--bb-shadow-md)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-on-dark-muted)"},children:[e.jsxs("span",{children:[j?"Tonight":"Rehearsal",h.ensembleName?` · ${h.ensembleName}`:""]}),C&&e.jsx("span",{style:{background:"#ffffff",color:"#7f1d1d",padding:"2px 8px",borderRadius:"var(--bb-radius-pill)",fontWeight:800,letterSpacing:"0.08em"},children:"CANCELLED"})]}),e.jsx("div",{style:{marginTop:6,fontSize:24,fontWeight:700,lineHeight:1.2,textDecoration:C?"line-through":"none"},children:S}),!C&&(j||h.performanceId)&&e.jsxs("button",{type:"button","data-testid":"tonight-details-link",onClick:E,style:{marginTop:6,padding:0,background:"none",border:"none",fontSize:14,fontFamily:"inherit",color:"var(--bb-fg-on-dark)",textDecoration:"underline",textUnderlineOffset:3,display:"inline-flex",alignItems:"center",gap:4,minHeight:44,cursor:"pointer"},children:[j?"View performance details":"View performance & rehearsal details"," â"]}),C&&h.cancellationReason&&e.jsxs("div",{style:{marginTop:8,fontSize:14,color:"#fecaca",fontStyle:"italic"},children:["Reason: ",h.cancellationReason]}),w?.name&&(w.mapUrl?e.jsxs("a",{href:w.mapUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"tonight-venue-link",style:{marginTop:6,fontSize:14,color:"var(--bb-fg-on-dark)",textDecoration:"underline",textUnderlineOffset:3,display:"inline-flex",alignItems:"center",gap:4,minHeight:44},children:[w.name,e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",style:{marginLeft:2},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 3h7v7M10 14L21 3M19 14v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6a1 1 0 011-1h6"})})]}):e.jsx("div",{style:{marginTop:6,fontSize:14,color:"var(--bb-fg-on-dark-muted)"},children:w.name})),(H||z||P)&&e.jsx("div",{style:{marginTop:4,fontSize:13,color:"var(--bb-fg-on-dark-muted)"},children:[P,z,H].filter(Boolean).join(" · ")})]}),h.mySeat&&(h.mySeat.row||h.mySeat.isPercussion)&&e.jsxs("div",{"data-testid":"tonight-my-seat",style:{margin:"var(--bb-space-3) var(--bb-space-4) 0",padding:"12px 14px",borderRadius:"var(--bb-radius-lg)",background:"var(--bb-primary-soft)",color:"var(--bb-primary-ink)",border:"1px solid var(--bb-primary)",display:"flex",alignItems:"center",gap:10},children:[e.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,"aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 9h18M3 9v10a1 1 0 001 1h2a1 1 0 001-1v-3h10v3a1 1 0 001 1h2a1 1 0 001-1V9M5 9V5a2 2 0 012-2h10a2 2 0 012 2v4"})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-primary)"},children:"Your stage seat"}),e.jsx("div",{style:{marginTop:2,fontSize:15,fontWeight:600},children:h.mySeat.isPercussion?`Percussion · ${h.mySeat.part||""}`.trim():`Row ${h.mySeat.row}${h.mySeat.part?` · ${h.mySeat.part}`:""}`})]})]}),j&&A&&e.jsxs("div",{style:{padding:"var(--bb-space-3) var(--bb-space-4) 0"},children:[e.jsxs("a",{href:ne.calendarUrl(A),"data-testid":"tonight-add-to-calendar",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,minHeight:44,padding:"10px 16px",border:"1px solid var(--bb-border)",borderRadius:"var(--bb-radius-md)",background:"var(--bb-surface)",color:"var(--bb-fg-body)",fontFamily:"inherit",fontSize:15,fontWeight:600,textDecoration:"none"},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),e.jsx("line",{x1:"12",y1:"14",x2:"12",y2:"18"}),e.jsx("line",{x1:"10",y1:"16",x2:"14",y2:"16"})]}),"Add to Calendar"]}),e.jsx(Ce,{to:"/account/calendar","data-testid":"tonight-subscribe-feed",style:{display:"block",marginTop:6,fontSize:12,color:"var(--bb-fg-muted)",textAlign:"center",textDecoration:"underline"},children:"Or subscribe to your full schedule"})]}),M&&(()=>{const y=t.attendance?.expected??0,F=t.attendance?.checkedIn??0,K=Math.max(0,y-F);return e.jsxs("div",{"data-testid":"tonight-stats",style:{display:"flex",gap:"var(--bb-space-3)",padding:"var(--bb-space-4)"},children:[e.jsx(qe,{label:"Expected",value:y,onClick:Y,ariaLabel:"Expected attendees â open attendance"}),e.jsx(qe,{label:"Checked in",value:F,onClick:Y,ariaLabel:"Checked-in count â open attendance"}),e.jsx(qe,{label:"Missing",value:K,onClick:Y,ariaLabel:"Missing attendees â open attendance to see who"})]})})(),!j&&h?.id&&e.jsx(us,{rehearsalId:h.id}),j&&I&&e.jsx("div",{style:{padding:"0 var(--bb-space-4) var(--bb-space-3)",display:"flex"},children:e.jsx(Tt,{state:I,onOpen:()=>T(I.row)})}),e.jsx(It,{performance:L,current:L?g?.[L.id]:null,isOpen:!!L,onClose:()=>T(null),onSaved:y=>c(L.id,y),onBulkSaved:At({updatePerformancePlan:c}),onRecordOther:(N||v)&&L?()=>{const y=L;T(null),f(y)}:null}),e.jsx(Qe,{variant:k,performanceId:b?.id||null,isOpen:!!b,onClose:()=>f(null)}),j&&Array.isArray(t.setList)&&t.setList.length>0&&e.jsxs("section",{children:[e.jsx(Oe,{children:"Tonight's set"}),e.jsx("ul",{"data-testid":"tonight-setlist",style:{listStyle:"none",margin:0,padding:0,background:"var(--bb-surface)"},children:t.setList.map((y,F)=>e.jsxs("li",{style:{padding:"8px var(--bb-space-4)",borderTop:"1px solid var(--bb-border-soft)",display:"flex",alignItems:"center",gap:"var(--bb-space-3)",fontSize:15,fontWeight:600,color:"var(--bb-fg)"},children:[e.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.recordingUrl?e.jsx("a",{href:y.recordingUrl,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--bb-primary)",textDecoration:"none"},children:Me(y)}):Me(y)}),Pe(y.duration)&&e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--bb-fg-muted)",flexShrink:0},children:Pe(y.duration)})]},y.id||F))})]}),!j&&Array.isArray(t.rehearsalAgenda)&&t.rehearsalAgenda.length>0&&e.jsxs("section",{children:[e.jsx(Oe,{children:"Agenda"}),e.jsx("ol",{"data-testid":"tonight-agenda",style:{listStyle:"none",margin:0,padding:0,background:"var(--bb-surface)"},children:t.rehearsalAgenda.map(y=>e.jsxs("li",{style:{padding:"12px var(--bb-space-4)",borderTop:"1px solid var(--bb-border-soft)",display:"flex",gap:"var(--bb-space-3)"},children:[e.jsx("div",{style:{width:28,height:28,borderRadius:"var(--bb-radius-pill)",background:"var(--bb-primary-soft)",color:"var(--bb-primary)",fontSize:13,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:y.order}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:"var(--bb-fg)"},children:y.title&&y.recordingUrl?e.jsx("a",{href:y.recordingUrl,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--bb-primary)",textDecoration:"none"},children:Me(y)}):y.title?Me(y):"Agenda item"}),y.notes&&e.jsx("div",{style:{marginTop:2,fontSize:13,color:"var(--bb-fg-muted)"},children:y.notes})]}),Pe(y.duration)&&e.jsx("div",{style:{fontSize:13,color:"var(--bb-fg-muted)"},children:Pe(y.duration)})]},y.order))})]}),Array.isArray(t.keyContacts)&&t.keyContacts.length>0&&e.jsxs("section",{style:{marginTop:"var(--bb-space-5)"},children:[e.jsx(Oe,{children:"Key contacts"}),e.jsx("ul",{"data-testid":"tonight-contacts",style:{listStyle:"none",margin:0,padding:0,background:"var(--bb-surface)"},children:t.keyContacts.map((y,F)=>e.jsxs("li",{style:{display:"flex",alignItems:"center",gap:"var(--bb-space-3)",padding:"12px var(--bb-space-4)",borderTop:"1px solid var(--bb-border-soft)"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:"var(--bb-fg)"},children:y.name}),y.role&&e.jsx("div",{style:{marginTop:2,fontSize:12,color:"var(--bb-fg-muted)"},children:y.role})]}),e.jsx(_t,{phone:y.phone,email:y.email,name:y.name})]},(y.name||"")+F))})]}),Array.isArray(s)&&s.length>0&&e.jsxs("section",{style:{marginTop:"var(--bb-space-5)"},children:[e.jsx(Oe,{children:s.length===1?"Your section":"Your sections"}),e.jsx("ul",{"data-testid":"tonight-your-section",style:{listStyle:"none",margin:0,padding:0},children:s.map(y=>e.jsx(Ut,{section:y},y.id))})]}),M&&!C&&e.jsx("div",{"data-testid":"tonight-primary-action",style:{position:"fixed",left:0,right:0,bottom:"calc(var(--bb-tabbar-height) + env(safe-area-inset-bottom, 0px))",padding:"var(--bb-space-3) var(--bb-space-4)",background:"linear-gradient(to top, var(--bb-bg), rgba(245, 247, 248, 0))",pointerEvents:"none"},children:e.jsx("button",{type:"button",disabled:a,onClick:Y,style:{pointerEvents:"auto",width:"100%",minHeight:48,padding:"12px 16px",border:"none",borderRadius:"var(--bb-radius-md)",background:"var(--bb-primary)",color:"#fff",fontFamily:"inherit",fontSize:16,fontWeight:600,cursor:a?"wait":"pointer",boxShadow:"var(--bb-shadow-md)"},children:a?"Openingâ¦":j?"Check in members â":"Take attendance â"})}),e.jsx(Ze,{isOpen:!!i,onClose:()=>d(null),token:i?.token,eventTitle:i?.title,eventDate:i?.date,eventType:i?.eventType})]})}function ys(){const t=new Date().getHours();return t<12?"Good morning":t<17?"Good afternoon":"Good evening"}function vs(t){return(t||"").split(" ")[0]||""}function He(t){if(!t)return"";const s=t.length===10?`${t}T00:00:00`:t,n=new Date(s);return Number.isNaN(n.getTime())?t:n.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function nt(t){if(!t)return null;const s=new Date;s.setHours(0,0,0,0);const n=new Date(`${t.length===10?t:t.slice(0,10)}T00:00:00`);if(Number.isNaN(n.getTime()))return null;const r=n.getTime()-s.getTime();return Math.round(r/864e5)}function st(t){if(!t?.venueName)return null;const s=[t.venueName,t.venueAddress,t.venueCity,t.venueState].filter(
1Boolean);return`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(s.join(", "))}`}function js(){const t=Z(),s=Te(x=>x.user),{currentOrg:n}=ie(),[r,m]=l.useState(null),[u,i]=l.useState(null),[d,a]=l.useState(null),[o,g]=l.useState(null),[c,N]=l.useState([]),[v,k]=l.useState(null),[b,f]=l.useState(!0),[L,T]=l.useState(null),[j,h]=l.useState(null),[I,w]=l.useState(null),{myPlans:A,updatePlan:E}=en(),{canFully:M}=Be(),S=M("attendance:take"),C=tn({enabled:!M("performance:update")}),[P,z]=l.useState(!1),H=Te(x=>!!x.user?.sectionId),Y=S?"manager":"section",[y,F]=l.useState(null),[K,ce]=l.useState(null),[G,q]=l.useState(0),xe=nn(S?"org":H?"section":null,G),[Q,se]=l.useState(null),{myPlans:re,updatePlan:pe}=Ct(),fe=At({updateRehearsalPlan:E,updatePerformancePlan:pe}),[X,J]=l.useState(null);l.useEffect(()=>{if(!n?.id)return;let x=!0;return be(()=>x),()=>{x=!1}},[n?.id]);function be(x=()=>!0){Promise.all([St.get().catch(()=>null),Et.getStats().catch(()=>null),ne.list(n.id,{}).catch(()=>null),$n.stats(n.id).catch(()=>null),ne.rehearsals(n.id).catch(()=>[]),Rt.list({filter:"upcoming",includeCancelled:!1}).catch(()=>[])]).then(([O,U,me,Re,we,Ne])=>{x()&&(m(O),i(U),a(Array.isArray(me)?me:me?.items||[]),k(Re),g(Array.isArray(we)?we:[]),N(Array.isArray(Ne)?Ne:[]),f(!1))})}if(Rn(()=>{n?.id&&be()}),b)return e.jsxs("div",{style:{padding:"var(--bb-space-4) 0"},children:[e.jsx("div",{"aria-hidden":"true",style:{margin:"0 var(--bb-space-4)",height:128,borderRadius:"var(--bb-radius-lg)",background:"var(--bb-surface-sunken)"}}),e.jsx("div",{style:{marginTop:"var(--bb-space-5)"},children:e.jsx(Ln,{variant:"performance",count:3})})]});if(r?.mode)return e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"mt-4"}),e.jsx(bs,{data:r,memberSections:u?.memberSections})]});const Ae=vt(),Le=new Set((u?.memberSections||[]).map(x=>x.ensembleId).filter(Boolean)),ge=x=>Le.size===0||Le.has(x.ensembleId),R=(d||[]).filter(x=>x.performanceDate&&x.performanceDate>=Ae&&ge(x)).sort((x,O)=>(x.performanceDate||"").localeCompare(O.performanceDate||"")),_e=(o||[]).filter(x=>x.rehearsalDate&&x.rehearsalDate>=Ae&&ge(x)).sort((x,O)=>{const U=(x.rehearsalDate||"").localeCompare(O.rehearsalDate||"");return U!==0?U:(x.startTime||"").localeCompare(O.startTime||"")}),ye=new Map;for(const x of R)ye.has(x.ensembleId)||ye.set(x.ensembleId,x);const ve=new Map;for(const x of _e)ve.has(x.ensembleId)||ve.set(x.ensembleId,x);const ae=Array.from(ye.values()),je=Array.from(ve.values());return e.jsxs("div",{"data-testid":"mobile-default-home",style:{padding:"var(--bb-space-4) 0"},children:[e.jsx("div",{style:{margin:"0 0 var(--bb-space-3)"},children:e.jsx(Pt,{})}),e.jsxs("div",{"data-testid":"mobile-default-home-banner",style:{margin:"0 var(--bb-space-4)",padding:"var(--bb-space-5)",minHeight:128,display:"flex",flexDirection:"column",justifyContent:"center",borderRadius:"var(--bb-radius-lg)",background:"linear-gradient(135deg, var(--bb-banner-from), var(--bb-banner-to))",color:"var(--bb-fg-on-dark)",boxShadow:"var(--bb-shadow-md)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-on-dark-muted)"},children:n?.name||"Backstage Baton"}),e.jsxs("div",{style:{marginTop:6,fontSize:24,fontWeight:700,lineHeight:1.2},children:[ys(),", ",vs(s?.displayName)]})]}),e.jsx("div",{style:{marginTop:"var(--bb-space-4)"},children:e.jsx(Je,{})}),e.jsx("div",{style:{marginTop:"var(--bb-space-4)"},children:e.jsx(Ot,{})}),e.jsx(zt,{className:"mt-4"}),e.jsxs("section",{style:{marginTop:"var(--bb-space-5)",padding:"0 var(--bb-space-4)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:"var(--bb-space-2)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-muted)"},children:ae.length>1?"Next performances":"Next performance"}),R.length>ae.length&&e.jsxs("button",{type:"button",onClick:()=>t("/performances"),style:{background:"transparent",border:"none",padding:0,fontSize:12,fontWeight:600,color:"var(--bb-primary)",cursor:"pointer",fontFamily:"inherit"},children:["View all (",R.length,") â"]})]}),ae.length===0?e.jsx("div",{style:{padding:"var(--bb-space-5)",background:"var(--bb-surface)",border:"1px solid var(--bb-border-soft)",borderRadius:"var(--bb-radius-lg)",color:"var(--bb-fg-muted)",fontSize:14,textAlign:"center"},children:"Nothing on the schedule yet."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--bb-space-3)"},children:ae.map(x=>e.jsx(ws,{perf:x,onTap:()=>T(x),planState:re?.[x.id]||null,onPlanTap:re?.[x.id]?()=>J(re[x.id].row):null,helpState:C[x.id]||null,onHelpTap:()=>{z(!0),T(x)},outCount:x.cancelledAt?null:xe?.performances?.[x.id]},x.id))})]}),je.length>0&&e.jsxs("section",{style:{marginTop:"var(--bb-space-4)",padding:"0 var(--bb-space-4)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-muted)",marginBottom:"var(--bb-space-2)"},children:je.length>1?"Next rehearsals":"Next rehearsal"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--bb-space-2)"},children:je.map(x=>{const O=(d||[]).find(U=>U.id===x.performanceId);return e.jsx(Ns,{rehearsal:x,parentPerf:O,onTap:O?()=>{h(x.id),T(O)}
1:null,planState:x.cancelledAt?null:A?.[x.id],onPlanTap:()=>se(A?.[x.id]?.row||null),outCount:x.cancelledAt?null:xe?.rehearsals?.[x.id]},x.id)})})]}),c.length>0&&e.jsxs("section",{style:{marginTop:"var(--bb-space-4)",padding:"0 var(--bb-space-4)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-muted)",marginBottom:"var(--bb-space-2)"},children:c.length>1?"Upcoming events":"Upcoming event"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--bb-space-2)"},children:c.slice(0,3).map(x=>e.jsx(Ss,{event:x,onTap:()=>w(x)},x.id))})]}),Array.isArray(u?.memberSections)&&u.memberSections.length>0&&e.jsxs("section",{style:{marginTop:"var(--bb-space-5)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--bb-fg-muted)",padding:"0 var(--bb-space-4) var(--bb-space-2)"},children:u.memberSections.length===1?"Your section":"Your sections"}),e.jsx("ul",{"data-testid":"mobile-default-home-your-section",style:{listStyle:"none",margin:0,padding:0},children:u.memberSections.map(x=>e.jsx(Ut,{section:x},x.id))})]}),e.jsx(ks,{event:I,isOpen:!!I,onClose:()=>w(null)}),e.jsx(kt,{rehearsal:Q,current:Q?A?.[Q.id]:null,isOpen:!!Q,onClose:()=>se(null),onSaved:x=>{E(Q.id,x),q(O=>O+1)},onBulkSaved:x=>{fe(x),q(O=>O+1)},onRecordOther:(S||H)&&Q?()=>{const x=Q;se(null),F(x)}:null}),e.jsx(et,{variant:Y,rehearsalId:y?.id||null,isOpen:!!y,onClose:()=>{F(null),q(x=>x+1)}}),e.jsx(It,{performance:X,current:X?re?.[X.id]:null,isOpen:!!X,onClose:()=>J(null),onSaved:x=>{pe(X.id,x),q(O=>O+1)},onBulkSaved:x=>{fe(x),q(O=>O+1)},onRecordOther:(S||H)&&X?()=>{const x=X;J(null),ce(x)}:null}),e.jsx(Qe,{variant:Y,performanceId:K?.id||null,isOpen:!!K,onClose:()=>{ce(null),q(x=>x+1)}}),e.jsx(kn,{perf:L,isOpen:!!L,autoOpenRehearsalId:j,autoOpenHelp:P,onClose:()=>{T(null),h(null),z(!1)},onPerfChanged:x=>{a(O=>(O||[]).map(U=>U.id===x.id?{...U,...x}:U)),T(O=>O&&O.id===x.id?{...O,...x}:O)},onPerfDeleted:x=>{a(O=>(O||[]).filter(U=>U.id!==x.id))}})]})}function ws({perf:t,onTap:s,planState:n=null,onPlanTap:r=null,outCount:m=null,helpState:u=null,onHelpTap:i=null}){const d=!!t.cancelledAt,a=d?"#dc2626":t.ensembleColor||"var(--bb-primary)",o=nt(t.performanceDate),g=o===null?null:o===0?"Today":o===1?"Tomorrow":`In ${o} days`;return e.jsxs("button",{type:"button",onClick:s,"data-testid":"mobile-default-home-next-perf","data-ensemble-id":t.ensembleId||"",style:{width:"100%",textAlign:"left",padding:"var(--bb-space-4)",background:d?"#fef2f2":"var(--bb-surface)",border:d?"1px solid #fecaca":"1px solid var(--bb-border-soft)",borderLeft:`4px solid ${a}`,borderRadius:"var(--bb-radius-lg)",cursor:"pointer",fontFamily:"inherit"},children:[e.jsx(Vt,{color:a,name:t.ensembleName,pill:d?"CANCELLED":g,pillTone:d?"danger":"strong"}),e.jsx("div",{style:{marginTop:4,fontSize:18,fontWeight:700,color:d?"#7f1d1d":"var(--bb-fg)",textDecoration:d?"line-through":"none"},children:t.title||"Untitled"}),e.jsxs("div",{style:{marginTop:4,fontSize:14,lineHeight:1.5,color:d?"#991b1b":"var(--bb-fg-muted)",textDecoration:d?"line-through":"none"},children:[He(t.performanceDate),t.performanceTime&&` · ${V(t.performanceTime)}`]}),t.venueName&&e.jsx("div",{style:{marginTop:2,fontSize:13,color:d?"#991b1b":"var(--bb-fg-muted)",textDecoration:d?"line-through":"none"},children:t.venueName}),d&&t.cancellationReason&&e.jsxs("div",{style:{marginTop:6,fontSize:12,color:"#b91c1c",fontStyle:"italic"},children:["Reason: ",t.cancellationReason]}),(n&&r||m||u&&i)&&!d&&e.jsxs("div",{style:{marginTop:8,display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[n&&r&&e.jsx(Tt,{state:n,onOpen:r}),u&&i&&e.jsx(sn,{state:u,onOpen:i}),m?e.jsx(Lt,{count:m}):null]})]})}function Ns({rehearsal:t,parentPerf:s,onTap:n,planState:r=null,onPlanTap:m=null,outCount:u=null}){const i=!!t.cancelledAt||!!s?.cancelledAt,d=i?"#dc2626":t.ensembleColor||"var(--bb-primary)",a=nt(t.rehearsalDate),o=a===null||a>7?null:a===0?"Today":a===1?"Tomorrow":`In ${a} days`,g=st(t),c=n?{role:"button",tabIndex:0,onClick:n,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),n())},"data-testid":"mobile-default-home-next-rehearsal"}:{};return e.jsxs("div",{...c,"data-ensemble-id":t.ensembleId||"",style:{padding:"var(--bb-space-3) var(--bb-space-4)",background:i?"#fef2f2":"var(--bb-surface)",border:i?"1px solid #fecaca":"1px solid var(--bb-border-soft)",borderLeft:`4px solid ${d}`,borderRadius:"var(--bb-radius-lg)",cursor:n?"pointer":"default"}
1,children:[e.jsx(Vt,{color:d,name:t.ensembleName,pill:i?"CANCELLED":o,pillTone:i?"danger":"muted"}),e.jsxs("div",{style:{marginTop:4,fontSize:15,fontWeight:600,color:i?"#7f1d1d":"var(--bb-fg)",textDecoration:i?"line-through":"none"},children:[He(t.rehearsalDate),t.startTime&&` · ${V(t.startTime)}`]}),t.venueName&&e.jsxs("a",{href:g,target:"_blank",rel:"noopener noreferrer",onClick:N=>N.stopPropagation(),style:{marginTop:4,display:"inline-flex",alignItems:"center",gap:4,fontSize:13,color:"var(--bb-primary)",textDecoration:"none"},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.657 16.657L13.414 20.9a2 2 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),t.venueName]}),s?.title&&e.jsxs("div",{style:{marginTop:4,fontSize:12,color:"var(--bb-fg-subtle)"},children:["Preparing for ",s.title]}),(r&&m||u)&&!i&&e.jsxs("div",{style:{marginTop:8,display:"flex",gap:6,alignItems:"center"},children:[r&&m&&e.jsx(rn,{state:r,onOpen:m}),u?e.jsx(Lt,{count:u}):null]})]})}function Ss({event:t,onTap:s}){const n="#7c3aed",r=st(t),m=nt(t.eventDate),u=m===null||m>14?null:m===0?"Today":m===1?"Tomorrow":`In ${m} days`,i=s?{role:"button",tabIndex:0,onClick:s,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),s())}}:{};return e.jsxs("div",{...i,style:{padding:"var(--bb-space-3) var(--bb-space-4)",background:"var(--bb-surface)",border:"1px solid var(--bb-border-soft)",borderLeft:`4px solid ${n}`,borderRadius:"var(--bb-radius-lg)",cursor:s?"pointer":"default"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:n},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:n,display:"inline-block"}}),"Event"]}),u&&e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--bb-fg-muted)",background:"var(--bb-surface-sunken)",padding:"2px 8px",borderRadius:"var(--bb-radius-sm)"},children:u})]}),e.jsx("div",{style:{marginTop:4,fontSize:15,fontWeight:600,color:"var(--bb-fg)"},children:t.title}),e.jsxs("div",{style:{marginTop:2,fontSize:13,color:"var(--bb-fg-muted)"},children:[He(t.eventDate),t.startTime&&` · ${V(t.startTime)}`]}),t.venueName&&e.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",onClick:d=>d.stopPropagation(),style:{marginTop:4,display:"inline-flex",alignItems:"center",gap:4,fontSize:13,color:"var(--bb-primary)",textDecoration:"none"},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.657 16.657L13.414 20.9a2 2 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),t.venueName]})]})}function ks({event:t,isOpen:s,onClose:n}){if(!t)return null;const r="#7c3aed",m=st(t),u=[t.venueName,t.venueAddress,t.venueCity,t.venueState].filter(Boolean).join(", ");return e.jsx(Mt,{isOpen:s,onClose:n,title:t.title,titleColor:r,children:e.jsxs("div",{style:{padding:"var(--bb-space-4)",display:"flex",flexDirection:"column",gap:"var(--bb-space-3)"},children:[e.jsxs("div",{style:{display:"inline-flex",alignSelf:"flex-start",alignItems:"center",gap:6,padding:"2px 8px",borderRadius:"var(--bb-radius-sm)",background:"#ede9fe",color:"#5b21b6",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:r,display:"inline-block"}}),"Event"]}),e.jsxs("div",{style:{fontSize:14,color:"var(--bb-fg-body)"},children:[e.jsx("strong",{children:He(t.eventDate)}),t.startTime&&e.jsxs(e.Fragment,{children:[" · ",V(t.startTime),t.endTime?`â${V(t.endTime)}`:""]})]}),t.venueName&&e.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:14,color:"var(--bb-primary)",textDecoration:"none"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.657 16.657L13.414 20.9a2 2 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),u||t.venueName]}),t.description&&e.jsx("p",{style:{margin:0,fontSize:14,color:"var(--bb-fg-body)",lineHeight:1.5,whiteSpace:"pre-wrap"},children:t.description})]})})}function Vt({color:t,name:s,pill:n,pillTone:r="strong"}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--bb-fg-muted)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:t,flexShrink:0}}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:s||"Ensemble"})]}),n&&e.jsx("span",{style:{flexShrink:0,fontSize:11,fontWeight:r==="danger"?800:r==="strong"?700:600,color:r==="danger"?"#ffffff"
1:r==="strong"?"var(--bb-primary)":"var(--bb-fg-muted)",background:r==="danger"?"#dc2626":r==="strong"?"var(--bb-primary-soft)":"var(--bb-surface-sunken)",padding:r==="danger"||r==="strong"?"4px 10px":"3px 8px",borderRadius:"var(--bb-radius-pill)",letterSpacing:r==="danger"?"0.08em":"0"},children:n})]})}const Cs=({className:t="h-5 w-5"})=>e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z"})}),Ts={hasDirector:{cta:"Assign a director",blurb:"Assign a member a leadership role under Roles & Access.",to:()=>"/settings/roles"},hasEnsemble:{cta:"Create an ensemble",blurb:"Add your first ensemble (e.g. Concert Band).",to:()=>"/ensembles"},hasMember:{cta:"Add members",blurb:"Add members by hand or with Smart Import.",to:()=>"/members"},hasOrgName:{cta:"Name your org",blurb:"Give your organization a name.",to:t=>`/settings/organizations/${t}`}},bt=["hasOrgName","hasEnsemble","hasMember","hasDirector"];function Is({orgId:t,orgName:s,onResolve:n}){const r=Z(),[m,u]=l.useState(null);if(l.useEffect(()=>{let a=!1;return Dn.getStatus().then(o=>{a||(u(o),n?.(o?.status==="onboarding"))}).catch(()=>{a||(u(null),n?.(!1))}),()=>{a=!0}},[t]),!m||m.status!=="onboarding")return null;const i=s?`the ${s}`:"your organization";if(m.canGoLive)return e.jsxs("div",{className:"relative overflow-hidden rounded-xl px-6 py-5 text-white shadow-md bg-gradient-to-r from-emerald-500 via-teal-500 to-cyan-500",children:[e.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute -top-6 -right-4 text-6xl opacity-20 select-none",children:"ð"}),e.jsxs("div",{className:"relative flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-lg font-bold flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":!0,children:"ð"})," You're ready to go live!"]}),e.jsxs("p",{className:"text-sm text-white/90 mt-1",children:["Everything's set up for ",i,". Going live opens the doors for your organization and sends each member a personalized welcome invitation â with everything they need to get started on the new system."]})]}),e.jsx(D,{variant:"primary",size:"md",onClick:()=>r(`/settings/organizations/${t}`),className:"shrink-0 !bg-white !text-emerald-700 hover:!bg-emerald-50 font-semibold shadow animate-pulse",children:"ð Go Live â"})]})]});const d=Object.entries(m.checklist||{}).filter(([,a])=>!a.pass).sort(([a],[o])=>bt.indexOf(a)-bt.indexOf(o));return e.jsx("div",{className:"relative overflow-hidden rounded-xl border border-violet-200 bg-gradient-to-r from-violet-50 to-indigo-50 px-5 py-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"mt-0.5 shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-full bg-gradient-to-r from-violet-500 to-indigo-500 text-white",children:e.jsx(Cs,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm font-semibold text-violet-900",children:["Let's finish setting up ",i]}),e.jsx("p",{className:"text-xs text-violet-700 mt-0.5",children:d.length===1?"One step left before you can go live:":`${d.length} steps left before you can go live:`}),e.jsx("ul",{className:"mt-3 space-y-2",children:d.map(([a,o])=>{const g=Ts[a];return e.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-lg border border-violet-100 bg-white/70 px-3 py-2",children:[e.jsx("span",{className:"text-sm text-violet-900 min-w-0",children:g?.blurb||o.label}),g&&e.jsx(D,{variant:"ai",size:"sm",className:"shrink-0",onClick:()=>r(g.to(t)),children:g.cta})]},a)})})]})]})})}function As(){const t=new Date().getHours();return t<12?"Good morning":t<17?"Good afternoon":"Good evening"}function gt(t){if(!t)return!1;const s=new Date,[,n]=t.split("-");return parseInt(n,10)===s.getMonth()+1}function yt(t){if(!t)return!1;const s=new Date,[,n,r]=t.split("-");return parseInt(n,10)===s.getMonth()+1&&parseInt(r,10)===s.getDate()}function Ls(t){return t?new Date().getFullYear()-parseInt(t.slice(0,4),10):0}const ke=e.jsx("svg",{className:"h-4 w-4 text-amber-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"})});function Cr(){const t=Z(),{role:s,canFully:n,authority:r}=Be(),{showSuccess:m,showError:u}=ee(),i=ie(p=>p.currentOrg),d=ie(p=>p.orgs),a=Te(p=>p.switchOrg),o=Te(p=>p.user),g=Zt(),c=s===it.PRESIDENT||s===it.SUPERADMIN||r==="owner"||r==="admin",N=n("performance:update"),v=n("attendance:take"),k=N||v,b=s==="librarian"||c,[f,L]=l.useState(null),[T,j]=l.useState(!0),[h,I]=l.useState(null),[w,A]=l.useState([]),[E,M]=l.useState([]),[S,C]=l.useState([]),[P,z]=l.useState([]),[H,Y]=l.useState(null),[y,F]=l.useState(null),[K,ce]=l.useState(null),[G,q]=l.useState({performanceId:"",venueId:"",startTime:"",endTime:""}),[xe,Q]=l.useState(!1),se=(d||[]).length>1,[re,pe]=l.useState(!1),[fe,X]=l.useState(null),[J,be]=l.useState([]),Ae=l.useRef(null),Le=l.useRef(null),ge=l.useRef(null),R=on({perfs:h,setPerfs:I,rehearsalList:w,setRehearsalList:A,orgEventsList:S,venuesList:E,isAdmin:c,showSuccess:m,showError:u,onRefresh:me,blackoutDates:P});l.useEffect(()=>{if(!R.actionDayStr)return;const p=setTimeout(()=>ge.current?.scrollIntoView({behavior:"smooth",block:"center"}),60);return()=>clearTimeout(p)},[R.actionDayStr]);async function _e(p,$){try{const B=$==="perf"?"performance":"rehearsal",_=p.id,ue=await We.generateToken({eventId:_,eventType:B});Y({token:ue.token,title:B==="performance"?p.title:p.performanceTitle||p.title||"Rehearsal",date:B==="performance"?p.performanceDate:p.rehearsalDate,eventType:B})}catch(B){u(B.message||"Failed to generate attendance link")}}function ye(){F(null),ce(null),t(`/performances?new=true&date=${y}`)}function ve(){ce("rehearsal")}function ae(){F(null),ce(null),be([])}function je(p){const $=w.filter(te=>te.performanceId===p);if($.length===0)return{};const B={};for(const te of $)te.venueId&&(B[te.venueId]=(B[te.venueId]||0)+1);const _=Object.entries(B).sort((te,qt)=>qt[1]-te[1])[0]?.[0]||"",ue=$.filter(te=>te.startTime),De=ue[ue.length-1];return{venueId:_,startTime:De?.startTime||"",endTime:De?.endTime||""}}function x(){if(!h||!y)return[];const p=new Set(J.map($=>$.performanceId));return h.filter($=>$.performanceDate&&$.performanceDate>=y&&!p.has($.id))}async function O(p){if(p.preventDefault(),!G.performanceId){u("Please select a performance");return}Q(!0);try{const $=h.find(_=>_.id===G.performanceId),B=await an.create({orgId:i.id,performanceId:G.performanceId,rehearsalDate:y,venueId:G.venueId||null,startTime:G.
1startTime||null,endTime:G.endTime||null});A(_=>[..._,B].sort((ue,De)=>ue.rehearsalDate.localeCompare(De.rehearsalDate))),be(_=>[..._,{performanceId:G.performanceId,ensembleName:$?.ensembleName||"",title:$?.title||""}]),q(_=>({..._,performanceId:""}))}catch($){u($.message||wt)}finally{Q(!1)}}function U(){const p=J.length;m(`${p} rehearsal${p!==1?"s":""} added`);const $=Le.current;ae(),$!=null&&requestAnimationFrame(()=>window.scrollTo({top:$,behavior:"smooth"}))}l.useEffect(()=>{Re()},[]),l.useEffect(()=>{i&&me()},[i?.id]),l.useEffect(()=>{if(!i||!k)return;let p=null;try{p=sessionStorage.getItem("bsb.openDayAction"),p&&sessionStorage.removeItem("bsb.openDayAction")}catch{}if(p&&R.handleDayAction){const $=setTimeout(()=>R.handleDayAction(p),200);return()=>clearTimeout($)}},[i?.id,k]),l.useEffect(()=>{if(!se){X(null);return}let p=!1;return _n.schedule().then($=>{p||X($)}).catch(()=>{p||X({rows:[],orgs:[]})}),()=>{p=!0}},[se,h,w,S]);async function me(){try{const[p,$,B]=await Promise.all([ne.list(i.id,{}),ne.rehearsals(i.id),ne.venues(i.id)]);I(p),A($),M(B),ln.listAllBlackoutDates().then(z).catch(()=>z([])),Rt.list({filter:"upcoming",includeCancelled:!0}).then(C).catch(()=>C([]))}catch{}}async function Re(){try{const p=await Et.getStats();L(p)}catch{u(Qt("dashboard"))}finally{j(!1)}}const we=o?.displayName?.split(" ")[0]||"",Ne=f?.currentMember?.birthday,Ue=f?.currentMember?.onboardingDate,rt=gt(Ne),Yt=yt(Ne),at=gt(Ue),Gt=yt(Ue),$e=Ls(Ue);return g?e.jsx(js,{}):e.jsxs("div",{className:"space-y-8",children:[e.jsx(cn,{title:"Dashboard"}),T?e.jsx("div",{className:"flex justify-center py-16",children:e.jsxs("svg",{className:"animate-spin motion-reduce:!animate-spin h-7 w-7 text-brand-primary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}):f?e.jsxs(e.Fragment,{children:[e.jsx(Pt,{}),e.jsx(Je,{}),e.jsx(Ot,{}),e.jsxs("div",{className:"bg-gradient-to-r from-brand-chrome to-brand-primary rounded-xl px-6 py-5 text-white",children:[e.jsxs("p",{className:"text-lg font-semibold",children:[As(),we?`, ${we}`:"","!"]}),e.jsxs("p",{className:"text-sm text-white/70 mt-0.5",children:[i?.name,f.totalMembers!=null?` · ${f.totalMembers} members`:""]}),(rt||at&&$e>0)&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[rt&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-white/15 backdrop-blur-sm rounded-lg px-3 py-1 text-sm",children:[e.jsx("span",{"aria-hidden":!0,children:"ð"}),Yt?"Happy Birthday!":"Happy Birthday this month!"]}),at&&$e>0&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-white/15 backdrop-blur-sm rounded-lg px-3 py-1 text-sm",children:[e.jsx("span",{"aria-hidden":!0,children:"ð"}),Gt?`Happy ${$e}-year anniversary with ${i?.shortName||i?.name}!`:`${$e}-year anniversary this month!`]})]})]}),e.jsx(zt,{}),e.jsx(Hn,{}),h!=null&&e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3 flex-wrap gap-2",children:[e.jsx(le,{className:"!mb-0",children:"Your Schedule"}),e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[se&&e.jsxs("div",{className:"inline-flex rounded-md border border-gray-300 overflow-hidden",children:[e.jsx("button",{type:"button",onClick:()=>pe(!1),className:`px-3 py-1 ${re?"bg-white text-gray-700 hover:bg-gray-50":"bg-brand-primary text-white"}`,children:i?.shortName||i?.name||"Current org"}),e.jsx("button",{type:"button",onClick:()=>pe(!0),className:`px-3 py-1 border-l border-gray-300 ${re?"bg-brand-primary text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,children:"All my orgs"})]}),e.jsx("button",{type:"button",onClick:()=>t("/schedule"),className:"text-brand-primary hover:underline",children:"Open full schedule â"})]})]}),re&&se?fe===null?e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-8 text-center",children:e.jsx("p",{className:"text-sm text-gray-400",children:"Loading your scheduleâ¦"})}):e.jsx(lt,{onOpenHelp:p=>t(Xe(p)),rows:(fe.rows||[]).map(p=>({...p,key:`${p.kind}-${p.id}`,cancelled:!!p.cancelledAt})),showOrgContext:!0,selectedDate:R.actionDayStr,onSelectRow:async p=>{if(p.orgId!==i?.id){try{sessionStorage.setItem("bsb.openDayAction",p.date)}catch{}await a(p.orgId)&&window.location.reload();return}k&&R.handleDayAction(p.date)}}):e.jsx(lt,{onOpenHelp:p=>t(Xe(p)),perfs:h,rehearsals:w,orgEvents:S,onSelectDay:k?R.handleDayAction:void 0,selectedDate:R.actionDayStr}),e.jsxs("div",{className:"space-y-3 mt-4",ref:ge,children:[R.actionDayStr&&k&&(R.actionPerfs.length>0||R.actionRehearsals.length>0||R.actionEvents.length>0)&&e.jsx(dn,{dayStr:R.actionDayStr,performances:R.actionPerfs,rehearsals:R.actionRehearsals,events:R.actionEvents,openAction:R.openAction,formData:R.actionFormData,setFormData:R.setActionFormData,venues:E,isAdmin:c,isDrafting:R.isDrafting,isSaving:R.isSavingAction,copied:R.copied,draftHint:R.draftHint,onOpenAction:R.handleOpenAction,onSaveDate:R.saveDateChange,onSaveLocation:R.saveLocationChange,onSaveTime:R.saveTimeChange,onCancelEvent:R.cancelEvent,onUncancelEvent:R.uncancelEvent,onCopyMessage:R.copyMessage,onSendMessage:R.sendMessage,onClose:R.closeActionPanel,onCloseAction:R.closeAction,onDraftNotification:R.handleDraftNotification,onDraftMessage:R.handleDraftMessage,onTakeAttendance:v?_e:void 0,attendanceOnly:!N,blackoutSiblings:R.blackoutSiblings,onRehearsalChanged:Re}),y&&N&&e.jsxs("div",{ref:Ae,className:"bg-brand-primary/10 rounded-xl border-2 border-brand-primary/30 p-5 shadow-sm animate-[fadeSlideIn_0.25s_ease-out]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full bg-brand-primary text-white text-xs font-bold",children:"+"}),e.jsx("h3",{className:"text-sm font-semibold text-brand-chrome",children:K==="rehearsal"?`Schedule Rehearsal â ${Ke(y)}`:`Add to ${Ke(y)}`})]}),e.jsx(D,{variant:"ghost",size:"sm",onClick:ae,"aria-label":"Close",className:"!p-1 text-gray-400 hover:text-gray-600",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),K===null&&e.jsx("p",{className:"text-xs text-brand-primary mb-4 ml-9",children:"What would you like to schedule?"}),K===null&&e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{type:"button",onClick:ye,className:"flex-1 flex flex-col items-center gap-2 p-4 rounded-lg bg-white border-2 border-brand-primary/20 hover:border-brand-primary hover:shadow-md transition-all cursor-pointer group",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-brand-primary/10 group-hover:bg-brand-primary/20 transition-colors",children:e.jsx("svg",{className:"h-5 w-5 text-brand-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.75,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 19V6l12-3v13M9 19a2 2 0 11-4 0 2 2
10 014 0zm12 0a2 2 0 11-4 0 2 2 0 014 0z"})})}),e.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"New Performance"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Opens the full wizard"})]}),e.jsxs("button",{type:"button",onClick:ve,className:"flex-1 flex flex-col items-center gap-2 p-4 rounded-lg bg-white border-2 border-gray-200 hover:border-gray-400 hover:shadow-md transition-all cursor-pointer group",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-gray-100 group-hover:bg-gray-200 transition-colors",children:e.jsx("svg",{className:"h-5 w-5 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.75,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"New Rehearsal"}),e.jsx("span",{className:"text-xs text-gray-400",children:"Quick add to a performance"})]})]}),K==="rehearsal"&&e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4 space-y-3",children:[J.length>0&&e.jsx("div",{className:"space-y-1.5",children:J.map((p,$)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-700",children:[e.jsx("svg",{className:"h-4 w-4 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),e.jsxs("span",{children:[p.ensembleName?`${p.ensembleName} â `:"",p.title]})]},$))}),x().length>0?e.jsxs("form",{onSubmit:O,className:"space-y-3",children:[J.length>0&&e.jsx("p",{className:"text-xs font-medium text-gray-500",children:"Add another ensemble for this date:"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Which performance is this rehearsal for?"}),e.jsxs("select",{value:G.performanceId,onChange:p=>{const $=p.target.value,B=$?je($):{};q(_=>({..._,performanceId:$,venueId:B.venueId||_.venueId||"",startTime:B.startTime||_.startTime||"",endTime:B.endTime||_.endTime||""}))},required:!0,className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary focus:border-brand-primary",children:[e.jsx("option",{value:"",children:"Select a performanceâ¦"}),x().map(p=>e.jsxs("option",{value:p.id,children:[p.ensembleName?`${p.ensembleName} â `:"",p.title," (",oe(p.performanceDate),")"]},p.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Rehearsal Location"}),e.jsxs("select",{value:G.venueId,onChange:p=>q($=>({...$,venueId:p.target.value})),className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary focus:border-brand-primary",children:[e.jsx("option",{value:"",children:"No venue"}),E.map(p=>e.jsx("option",{value:p.id,children:p.name},p.id))]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Start Time"}),e.jsx("input",{type:"time",value:G.startTime,onChange:p=>q($=>({...$,startTime:p.target.value})),className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary focus:border-brand-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"End Time"}),e.jsx("input",{type:"time",value:G.endTime,onChange:p=>q($=>({...$,endTime:p.target.value})),className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-primary focus:border-brand-primary"})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(D,{type:"submit",size:"sm",disabled:xe,isLoading:xe,children:"Create"}),J.length>0?e.jsx(D,{type:"button",variant:"secondary",size:"sm",onClick:U,children:"Done"}):e.jsx(D,{type:"button",variant:"secondary",size:"sm",onClick:ae,children:"Cancel"})]})]}):J.length>0?e.jsx("div",{className:"flex gap-2 pt-1",children:e.jsx(D,{type:"button",size:"sm",onClick:U,children:"Done"})}):null]})]})]})]}),e.jsx(es,{memberSections:f.memberSections}),e.jsx(Qn,{orgRoster:f.orgRoster}),((f.birthdays?.length??0)>0||(f.anniversaries?.length??0)>0)&&e.jsxs("section",{children:[e.jsx(le,{children:"Birthdays & Anniversaries"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(f.birthdays?.length??0)>0&&e.jsx(Un,{members:f.birthdays}),(f.anniversaries?.length??0)>0&&e.jsx(Yn,{members:f.anniversaries})]})]}),(c||N||b)&&e.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide pt-4 border-t border-gray-200",children:"For Directors & Staff"}),c&&e.jsx(Is,{orgId:i?.id,orgName:i?.name}),c&&e.jsxs("section",{children:[e.jsx(le,{children:"To-Do"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsx(Zn,{data:f.todos.newSinceLastRehearsal}),e.jsx(qn,{members:f.todos.noEnsemble,icon:ke}),e.jsx(Gn,{members:f.todos.noInstrument,icon:ke}),f.todos.noEnsembleInstrument?.length>0&&e.jsx(Kn,{members:f.todos.noEnsembleInstrument,icon:ke}),e.jsx(Xn,{rows:f.todos.lowStock||[],icon:ke}),e.jsx(Jn,{rows:f.todos.formerMemberStock||[],icon:ke})]})]}),N&&e.jsx(ts,{}),b&&f.librarianTasks!=null&&e.jsxs("section",{children:[e.jsxs(le,{children:["Librarian Tasks",f.librarianTasks.length>0&&e.jsx("span",{className:"ml-1 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700 normal-case tracking-normal",children:f.librarianTasks.length})]}),f.librarianTasks.length===0?e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 px-6 py-5",children:e.jsxs("p",{className:"text-sm text-emerald-600 flex items-center gap-1.5",children:[e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"No pieces currently requested for performance"]})}):e.jsx("button",{type:"button",onClick:()=>t("/music?inSetlist=true"),className:"w-full text-left bg-white rounded-xl border border-amber-200 px-6 py-5 hover:bg-amber-50 transition-colors",children:e.jsx("ul",{className:"space-y-3",children:f.librarianTasks.map(p=>e.jsxs("li",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800 truncate",children:p.musicTitle}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[p.performanceTitle,p.performanceDate&&` · ${oe(p.performanceDate)}`]})]}),e.jsx("span",{className:`shrink-0 inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${p.musicStatus==="checked_out"?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-600"}`,children:p.musicStatus==="checked_out"?"Checked Out":"Checked In"})]},`${p.performanceId}-${p.musicId}`))})})]})]}):null,e.jsx(Ze,{isOpen:!!H,onClose:()=>Y(null),token:H?.token,eventTitle:H?.title,eventDate:H?.date,eventType:H?.eventType})]})}
1export{Cr as HomePage};
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.