PageSourceSearch

https://advisorsclub.com/assets/app.calendar-A84prWzr.js

js advisorsclub.com collected 2026-10-04 06:37:07 UTC 68,568 bytes, 1 lines download raw bytes

1import{c as da,d8 as ha,d9 as ua,da as ma,db as pa,j as e,dc as xa,dd as ja,de as ga,df as va,dg as us,aG as ba,R as qs,V as Ys,r as o,dh as L,di as fa,dj as ya,dk as Na,aZ as wa,dl as Ca,cR as ka,U as Sa,E as za,v as Ea,b6 as Ra,bI as Aa,Q as Te,dm as Da,dn as Ta,w as k,dp as La,L as W,dq as ms,ai as ve,dr as Gs,al as $a,ds as Ma,at as is,aY as Za,s as Ms,dt as Ia,t as Ua,bb as Pa,ac as Oa,a0 as Ks,u as Zs,du as Fa,dv as Ha,dw as _a,dx as Va,dy as Ba,d0 as Wa,dz as as,ag as Is,dA as ge,_ as cs,dB as Us,F as qa,p as Js,dC as Ya,K as Ga,dD as Ps,cY as Be,n as ps,o as xs,dE as Ka,dF as Ja,dG as Qa,dH as Xa,dI as et,dJ as st,dK as at,dL as tt,dM as nt,aV as lt,dN as it,dO as Ve,dP as De,dQ as ct,dR as os,dS as ot,dT as rt,dU as dt}from"./index-B3LkCOOS.js";import{u as ht}from"./use-events-C3as-9Xv.js";import{C as ut}from"./CommunityRail-BjDdC1H7.js";import{C as rs,a as mt,b as pt,c as xt,i as jt,d as gt,r as vt,v as bt,e as ft,f as yt,w as Nt}from"./location-CLI-pllA.js";import{C as wt,E as js,r as Os,e as Ct,c as gs,M as ts,d as kt,a as St,b as zt,i as Et,f as Rt,u as At,o as Fs,A as Dt}from"./AttendeesModal-wXtDWUdB.js";import{e as G,a as Le,b as Qs,t as Tt}from"./detail-BqpsBD05.js";import{R as Xs}from"./repeat-Bo7lddvf.js";import{l as Lt,a as $t,r as Mt,d as Zt,c as It,b as Ut}from"./zoom-store-u5M9DHNB.js";import"./rail-config-Co7m5sa2.js";import"./use-leaderboard-R3vaH82q.js";import"./RailEventsCard-BrTcz7pC.js";import"./upcoming-BuVxJTqO.js";import"./ProgressLeaderboardCard-D7Z-ty-n.js";const Pt=[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]],Ot=da("calendar-range",Pt);async function Ft(s,a){const l=`draft-${crypto.randomUUID()}`,{path:c,width:r,height:u}=await ua(s,"event",l,a);return{path:c,width:r,height:u,previewUrl:URL.createObjectURL(a)}}async function Ht(s,a,l){await ma({clubId:s,entityType:"event",entityId:a},{image:{kind:"storage",path:l.path,width:l.width,height:l.height,source:"upload",previewUrl:l.previewUrl},copy:pa(null),brief:null},null)}async function ns(s){s&&(URL.revokeObjectURL(s.previewUrl),await ha(s.path))}const _t={zoom:"M5.033 14.649H.743a.74.74 0 0 1-.686-.458.74.74 0 0 1 .16-.808L3.19 10.41H1.06A1.06 1.06 0 0 1 0 9.35h3.957c.301 0 .57.18.686.458a.74.74 0 0 1-.161.808L1.51 13.59h2.464c.585 0 1.06.475 1.06 1.06zM24 11.338c0-1.14-.927-2.066-2.066-2.066-.61 0-1.158.265-1.537.686a2.061 2.061 0 0 0-1.536-.686c-1.14 0-2.066.926-2.066 2.066v3.311a1.06 1.06 0 0 0 1.06-1.06v-2.251a1.004 1.004 0 0 1 2.013 0v2.251c0 .586.474 1.06 1.06 1.06v-3.311a1.004 1.004 0 0 1 2.012 0v2.251c0 .586.475 1.06 1.06 1.06zM16.265 12a2.728 2.728 0 1 1-5.457 0 2.728 2.728 0 0 1 5.457 0zm-1.06 0a1.669 1.669 0 1 0-3.338 0 1.669 1.669 0 0 0 3.338 0zm-4.82 0a2.728 2.728 0 1 1-5.458 0 2.728 2.728 0 0 1 5.457 0zm-1.06 0a1.669 1.669 0 1 0-3.338 0 1.669 1.669 0 0 0 3.338 0z",google_meet:"M5.53 2.13 0 7.75h5.53zm.398 0v5.62h7.608v3.65l5.47-4.45c-.014-1.22.031-2.25-.025-3.46-.148-1.09-1.287-1.47-2.236-1.36zM23.1 4.32c-.802.295-1.358.995-2.047 1.49-2.506 2.05-4.982 4.12-7.468 6.19 3.025 2.59 6.04 5.18 9.065 7.76 1.218.671 1.428-.814 1.328-1.64v-13a.828.828 0 0 0-.877-.825zM.038 8.15v7.7h5.53v-7.7zm13.577 8.1H6.008v5.62c3.864-.006 7.737.011 11.58-.009 1.02-.07 1.618-1.12 1.468-2.07v-2.51l-5.47-4.68v3.65zm-13.577 0c.02 1.44-.041 2.88.033 4.31.162.948 1.158 1.43 2.047 1.31h3.464v-5.62z"};function Vt({id:s,size:a=16,...l}){return e.jsx("svg",{viewBox:"0 0 24 24",width:a,height:a,fill:"currentColor","aria-hidden":!0,focusable:"false",...l,children:e.jsx("path",{d:_t[s]})})}const Bt={native_call:Ys,native_webinar:qs,link:ba,address:us};function Hs({kind:s}){const a=gt(s);if(a)return e.jsx(Vt,{id:a,size:15,className:"cal-loc-mark"});const l=Bt[s];return l?e.jsx(l,{size:15,className:"cal-loc-mark","aria-hidden":!0}):null}function Wt({value:s,onChange:a,labelledBy:l}){const c=s==="text"?"address":s;return e.jsxs(xa,{value:c,onValueChange:r=>a(r),children:[e.jsx(ja,{className:"cal-loc-trigger","aria-labelledby":l,children:e.jsxs("span",{className:"cal-loc-value",children:[e.jsx(Hs,{kind:c}),rs[c]]})}),e.jsx(ga,{className:"z-[120] cal-loc-menu",children:mt.map(r=>{const u=jt(r);return e.jsx(va,{value:r,disabled:!u,className:"cal-loc-item",children:e.jsxs("span",{className:"cal-loc-row",children:[e.jsx(Hs,{kind:r}),e.jsxs("span",{className:"cal-loc-text",children:[e.jsxs("span",{className:"cal-loc-name",children:[rs[r],!u&&e.jsx("em",{className:"cal-loc-soon",children:pt})]}),e.jsx("span",{className:"cal-loc-desc",children:xt[r]})]})]})},r)})})]})}const _s=new Map;function qt(s){let a=_s.get(s);
1return a||(a={id:null,subs:new Set},_s.set(s,a)),a}function Yt(s,a){const l=qt(s);return l.subs.add(a),l.id===null&&(l.id=window.setInterval(()=>{const c=Date.now();l.subs.forEach(r=>r(c))},s)),()=>{l.subs.delete(a),l.subs.size===0&&l.id!==null&&(window.clearInterval(l.id),l.id=null)}}function vs(s=1e3){const[a,l]=o.useState(()=>Date.now());return o.useEffect(()=>Yt(s,l),[s]),a}function ea({event:s,canManage:a,actions:l,className:c=""}){const[r,u]=o.useState(null),x=r!==null,h=s.status==="published",n=L(s),d=fa(s);if(!a)return null;const p=()=>u(null),m=b=>()=>{p(),b()};return e.jsxs("div",{className:`cal-actions ${c}`.trim(),onClick:b=>b.stopPropagation(),children:[e.jsx("button",{type:"button",className:"cal-actions-btn","aria-label":"Event options",title:"Event options","aria-haspopup":"menu","aria-expanded":x,onClick:b=>u(x?null:b.currentTarget),children:e.jsx(ya,{size:16})}),e.jsx(Na,{open:x,anchor:r,className:"nv-menu cal-menu",children:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:m(l.onEdit),children:[e.jsx(wa,{size:14})," Edit Event"]}),e.jsxs("button",{type:"button",onClick:m(l.onDuplicate),children:[e.jsx(Ca,{size:14})," Duplicate Event"]}),e.jsxs("button",{type:"button",onClick:m(l.onCopyLink),children:[e.jsx(ka,{size:14})," Copy Link"]}),e.jsxs("button",{type:"button",onClick:m(l.onManageAttendees),children:[e.jsx(Sa,{size:14})," Manage Attendees"]}),e.jsxs("button",{type:"button",onClick:m(()=>l.onPublishChange(h?"draft":"published")),children:[h?e.jsx(za,{size:14}):e.jsx(Ea,{size:14}),h?"Unpublish Event":"Publish Event"]}),d&&e.jsxs("button",{type:"button",onClick:m(()=>l.onCancelChange(!n)),children:[n?e.jsx(Ra,{size:14}):e.jsx(wt,{size:14}),n?"Reinstate Event":"Cancel Event"]}),e.jsx("div",{className:"nv-menu-sep"}),e.jsxs("button",{type:"button",className:"danger",onClick:m(l.onDelete),children:[e.jsx(Aa,{size:14})," Delete Event"]})]})})]})}function bs({eventId:s,registered:a,onRegisteredChange:l,disabled:c,size:r="md",className:u=""}){const[x,h]=o.useState(!1),[n,d]=o.useState(null);o.useEffect(()=>{d(null)},[a,s]);const p=n??a;async function m(){if(!x){h(!0);try{const b=p?await Da(s):await Ta(s),j=b.registration?.registrationStatus==="registered";if(!p&&!j)throw new Error(b.zoom.error??"Zoom registration could not be completed.");d(j),l?.(j),k.success(j?"You're registered":"Registration cancelled");const A=La(b.zoom);A&&b.zoom.status!=="synced"&&k.message(A)}catch(b){k.error(b instanceof Error&&b.message?b.message:"That couldn't be saved right now.")}finally{h(!1)}}}return e.jsx("div",{className:`rsvp-split rsvp-split--single${p?" is-answered":""} rsvp-split--${r} ${u}`,onClick:b=>b.stopPropagation(),children:e.jsxs("button",{type:"button",className:"rsvp-split-main",disabled:c||x,"aria-label":p?"Cancel registration":"Register for this event",onClick:()=>{m()},children:[p?e.jsx(Te,{size:14,"aria-hidden":"true"}):null,p?"Registered":"Register"]})})}function Gt({event:s,rsvp:a,onRsvp:l,covers:c,canManage:r,actions:u,countdown:x,past:h=!1}){const n=L(s),d=G(s.id);return e.jsxs("article",{className:`cal-ec${n?" is-cancelled":""}`,children:[e.jsx(W,{className:"cal-ec-link",to:d,"aria-label":`${s.title} — event details`,children:e.jsx("span",{className:"sr-only",children:s.title})}),e.jsxs("div",{className:"cal-ec-thumb",children:[e.jsx(js,{className:"cal-ec-thumb-img",eventId:s.id,title:s.title,description:s.description,cover:c.covers[s.id]??null,fallbackUrl:s.thumb,clubId:c.clubId,canEdit:c.canEdit,style:c.style,onChanged:()=>{c.refresh()}}),x?e.jsx("div",{className:"cal-ec-cd",children:x}):null,r&&s.status!=="published"&&e.jsx("span",{className:"cal-ec-draft",children:s.status==="draft"?"Draft":"Archived"}),n&&e.jsx("span",{className:"cal-ec-cancelled",children:"Cancelled"}),h&&!n&&e.jsx("span",{className:"cal-ec-past",children:"Past Event"}),e.jsxs("div",{className:"cal-ec-tools",children:[e.jsx(ms,{type:"event",id:s.id,className:"sv-toggle-float"}),e.jsx(ea,{event:s,canManage:r,actions:u})]})]}),e.jsxs("div",{className:"cal-ec-body",children:[e.jsxs("div",{className:"cal-ec-date",children:[e.jsx(ve,{size:12,"aria-hidden":"true"}),Le(s)," · ",Qs(s),Gs(s)&&e.jsxs("span",{className:"cal-ec-repeat",title:Os(s)??"Repeats",children:[e.jsx(Xs,{size:11,"aria-hidden":"true"}
1),Os(s)??"Repeats"]})]}),e.jsx("h3",{className:"cal-ec-title",children:s.title}),e.jsx("p",{className:"cal-ec-desc",children:s.description}),e.jsxs("div",{className:"cal-ec-meta",children:[e.jsx(us,{size:12,"aria-hidden":"true"}),e.jsxs("span",{className:"cal-ec-meta-t",children:[s.location||"No Location",s.host?` · Hosted By ${s.host}`:""]})]}),r&&s.location.toLowerCase().includes("zoom")&&s.host&&e.jsxs("div",{className:"cal-ec-zoom-owner",children:["Zoom host account: ",s.host]}),e.jsx("div",{className:"cal-ec-foot",children:n?e.jsx("p",{className:"cal-ec-cancelled-note",children:"This class has been cancelled. Your registration has been kept."}):h?e.jsx(W,{className:"cal-ec-more cal-ec-past-link",to:d,onClick:p=>p.stopPropagation(),children:"View Event"}):e.jsxs(e.Fragment,{children:[e.jsx(bs,{eventId:s.id,registered:a==="going",onRegisteredChange:p=>l(p?"going":null),size:"sm"}),e.jsx(W,{className:"cal-ec-more",to:d,onClick:p=>p.stopPropagation(),children:"Learn More"})]})})]})]})}const ls=5,Kt=[{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"biweekly",label:"Biweekly (every 2 weeks)"},{value:"monthly",label:"Monthly"}];function Jt(s,a){const l=s==="daily"?"day":s==="weekly"?"week":"month";return a===1?l:`${l}s`}function sa({startDate:s,value:a,onChange:l}){const c=a?Ct(s,a):[],r=a?gs(s,a):null;function u(h){if(h==="none")return l(null);const n=h;l({frequency:n==="biweekly"?"weekly":n,interval:n==="biweekly"?2:1,count:a?.count??8})}const x=a?.frequency==="weekly"&&a.interval===2?"biweekly":a?.interval===1?a.frequency:"custom";return e.jsxs("div",{className:"cal-repeat",children:[e.jsxs("div",{className:"cal-field",children:[e.jsx("span",{id:"cal-repeat-label",children:"Repeat pattern"}),e.jsxs("div",{className:"cal-repeat-select-shell",children:[e.jsxs("select",{className:"cal-repeat-freq","aria-labelledby":"cal-repeat-label",value:x,onChange:h=>u(h.target.value),children:[x==="custom"&&e.jsx("option",{value:"custom",children:"Custom repeat"}),Kt.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))]}),e.jsx($a,{"aria-hidden":"true",size:20})]}),e.jsx("em",{className:"cal-field-hint",children:"No Fixed Time creates a reusable Zoom room, so it is not available for a dated calendar event."})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cal-field-row",children:[e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Every"}),e.jsxs("div",{className:"cal-repeat-every",children:[e.jsx("input",{type:"number",min:1,max:52,value:a.interval,onChange:h=>l({...a,interval:Math.max(1,Number(h.target.value)||1)})}),e.jsx("em",{children:Jt(a.frequency,a.interval)})]})]}),e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Number of dates"}),e.jsx("input",{type:"number",min:2,max:ts,value:a.count??2,onChange:h=>l({frequency:a.frequency,interval:a.interval,count:Math.min(ts,Math.max(2,Number(h.target.value)||2))})})]})]}),r?e.jsx("p",{className:"cal-field-err",role:"alert",children:r==="too_many"?`One series can hold at most ${ts} dates. Create the next one when this finishes.`:"That repeat rule cannot be saved. Check the interval and the number of dates."}):e.jsxs("div",{className:"cal-repeat-preview",children:[e.jsxs("p",{className:"cal-repeat-summary",children:[kt(s,a)," · ",c.length," ",c.length===1?"date":"dates"]}),e.jsxs("ul",{className:"cal-repeat-dates",children:[c.slice(0,ls).map(h=>e.jsx("li",{children:Le({date:h})},h)),c.length>ls&&e.jsxs("li",{className:"cal-repeat-more",children:["+",c.length-ls," more, through"," ",Le({date:c[c.length-1]})]})]})]})]})]})}const Qt=["one","following","all"],Xt={one:"This Event only",following:"This and all later dates",all:"Every date in the series"},en={one:"Changes this one date. Nothing else in the series moves.",following:"Changes this date and every date after it. Earlier dates stay as they are.",all:"Changes every date, including ones that have already happened."};function sn({value:s,onChange:a,count:l}){return e.jsxs("fieldset",{className:"cal-scope",children:[e.jsx("legend",{children:"Apply To"}),Qt.map(c=>e.jsxs("label",{className:"cal-scope-row",children:[e.jsx("input",{type:"radio",name:"cal-series-scope",value:c,checked:s===c,onChange:()=>a(c)}),e.jsxs("span",{className:"cal-scope-label",children:[Xt[c],c==="all"?` (${l})`:""]}),e.jsx("em",{className:"cal-scope-hint",children:en[c]})]},c))]})}
1function an(s,a,l,c=Date.now()){const r=new Set(a),u={kept:[],matchedCancelled:[],cancelling:[],removing:[],adding:[],past:0,answersAffected:0},x=new Set;for(const h of s){if(Date.parse(h.startsAt)<=c){u.past+=1,x.add(h.startsAt);continue}x.add(h.startsAt);const n={id:h.id,startsAt:h.startsAt,rsvps:l(h.id)?.total??0},d=r.has(h.startsAt);if(L(h)){d&&u.matchedCancelled.push(n);continue}d?u.kept.push(n):n.rsvps>0?(u.cancelling.push(n),u.answersAffected+=n.rsvps):u.removing.push(n)}return u.adding=a.filter(h=>!x.has(h)),u}function tn(s){return s.adding.length===0&&s.cancelling.length===0&&s.removing.length===0}function ne(s){return`${s} ${s===1?"date":"dates"}`}function nn({event:s,occurrences:a,seriesId:l,onConfirm:c,onClose:r}){const[u,x]=o.useState(s.recurrence??{frequency:"weekly",interval:1,count:8}),[h,n]=o.useState(null),[d,p]=o.useState(!1),[m,b]=o.useState(!1);o.useEffect(()=>{let z=!0;return Ma(l).then(H=>{z&&(n(H),p(!0))}).catch(()=>z&&p(!0)),()=>{z=!1}},[l]);const j=s.timezone||"UTC",A=gs(s.date,u),I=o.useMemo(()=>A?[]:St(s.date,u,{start:s.start,end:s.end&&s.end!==s.start?s.end:null,timezone:j}).map(z=>z.startsAt),[A,s.date,s.start,s.end,u,j]),g=o.useMemo(()=>an(a,I,z=>h?.[z]??null),[a,I,h]),f=d&&h===null,y=!A&&tn(g);async function D(){if(A||y||m)return;b(!0);const z=await c(u);b(!1),z&&r()}return e.jsx("div",{className:"cal-modal-bd",onClick:r,children:e.jsxs("div",{className:"cal-modal",onClick:z=>z.stopPropagation(),children:[e.jsxs("div",{className:"cal-modal-head",children:[e.jsx("h3",{children:"Change The Schedule"}),e.jsx("button",{className:"cal-modal-x",onClick:r,"aria-label":"Close",children:e.jsx(is,{size:16})})]}),e.jsxs("div",{className:"cal-modal-body",children:[e.jsxs("p",{className:"cal-field-note",children:[s.title," · the new schedule starts on ",Le(s),". Dates before that are history and are left exactly as they are."]}),e.jsx(sa,{startDate:s.date,value:u,onChange:z=>z&&x(z)}),!A&&e.jsxs("div",{className:g.cancelling.length?"cal-cost is-serious":"cal-cost",children:[e.jsxs("h4",{className:"cal-cost-h",children:[g.cancelling.length>0&&e.jsx(Za,{size:14,"aria-hidden":"true",className:"cal-cost-icon"}),"What This Changes"]}),y?e.jsx("p",{className:"cal-cost-line",children:"Nothing. This is the schedule the series already has."}):e.jsxs("ul",{className:"cal-cost-list",children:[g.adding.length>0&&e.jsxs("li",{children:[e.jsxs("strong",{children:[ne(g.adding.length)," added."]})," Nobody has answered these yet."]}),g.kept.length>0&&e.jsxs("li",{children:[e.jsxs("strong",{children:[ne(g.kept.length)," unchanged."]})," Every registration on them is kept."]}),g.cancelling.length>0&&e.jsxs("li",{className:"cal-cost-serious",children:[e.jsxs("strong",{children:[ne(g.cancelling.length)," cancelled."]})," ",f?e.jsx(e.Fragment,{children:"Members have answered these dates and will be told. We could not read how many."}):e.jsxs(e.Fragment,{children:[g.answersAffected," ",g.answersAffected===1?"member has":"members have"," answered these dates and will be told. Their registrations are kept."]})]}),g.removing.length>0&&e.jsxs("li",{children:[e.jsxs("strong",{children:[ne(g.removing.length)," removed."]})," Nobody had answered them."]}),g.matchedCancelled.length>0&&e.jsxs("li",{children:[ne(g.matchedCancelled.length)," you already cancelled stay cancelled. Rescheduling does not put them back."]}),g.past>0&&e.jsxs("li",{children:[ne(g.past)," already happened and are not touched."]})]}),f&&e.jsx("p",{className:"cal-field-err",role:"alert",children:"The registration counts for this series could not be read, so the numbers above are incomplete."})]})]}),e.jsxs("div",{className:"cal-modal-foot",children:[e.jsx("button",{className:"cal-btn-ghost",onClick:r,disabled:m,children:"Cancel"}),e.jsx("button",{className:"cal-btn-pri",onClick:()=>{D()},disabled:!!A||y||m,children:m?"Saving…":g.cancelling.length>0?`Change Schedule & Cancel ${ne(g.cancelling.length)}`:"Change Schedule"})]})]})})}function ln(s){const a=s.trim();if(!a)return{url:null,type:null};const l=a.match(/<iframe\b[^>]*\bsrc=["']([^"']+)["']/i)?.[1],c=l??a;
1try{const r=new URL(c);return r.protocol!=="https:"?{url:null,type:null}:{url:r.toString(),type:l?"embed":"url"}}catch{return{url:null,type:null}}}const cn=new Set(["video/mp4","video/webm","video/quicktime"]);async function on(s,a,l){if(!cn.has(l.type))throw new Error("Upload an MP4, WebM, or MOV video.");if(l.size>2*1024*1024*1024)throw new Error("The video must be 2 GB or smaller.");const c=l.name.split(".").pop()?.toLowerCase().replace(/[^a-z0-9]/g,"")||"mp4",r=`${s}/${a}/${crypto.randomUUID()}.${c}`,{error:u}=await Ms.storage.from("event-replays").upload(r,l,{contentType:l.type,upsert:!1});if(u)throw new Error("The replay video could not be uploaded.");return Ms.storage.from("event-replays").getPublicUrl(r).data.publicUrl}function rn(s,a){if(a!=="going")return;const l=typeof window>"u"?"":`${window.location.origin}${G(s.id)}`,c=zt(s,{url:l});k.success(`You're registered for ${s.title}`,{id:`rsvp:${s.id}`,description:`${Le(s)} · ${Qs(s)} · ${Tt(s.timezone)}`,action:{label:"Add To Calendar",onClick:()=>{const r=document.createElement("a");r.href=Et(c),r.download=Rt(s),document.body.appendChild(r),r.click(),r.remove()}}})}function dn(s,a){const l=[],c=[];for(const r of s){const u=new Date(r.endsAt??r.startsAt).getTime();Number.isFinite(u)&&u<=a?c.push(r):l.push(r)}return{upcoming:l,past:c}}const ds=["January","February","March","April","May","June","July","August","September","October","November","December"],fs=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],We=s=>{const[a,l]=s.split(":").map(Number),c=a>=12?"PM":"AM";return`${(a+11)%12+1}:${String(l).padStart(2,"0")} ${c}`},ys=(s,a)=>`${We(s)} – ${We(a)}`,hs=s=>`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`,aa=s=>{const[a,l,c]=s.split("-").map(Number);return new Date(a,l-1,c)},le=s=>Array.from(new Set(s.split(",").map(a=>a.trim()).filter(Boolean))).slice(0,30),V=s=>ct(s);function hn(s){const a=vs(1e3),l=s.getTime()-a;if(l<=0)return-l<=2*36e5?{live:!0,label:"Live Now",ended:!1}:{live:!1,label:"",ended:!0};const c=Math.floor(l/864e5),r=Math.floor(l%864e5/36e5),u=Math.floor(l%36e5/6e4),x=Math.floor(l%6e4/1e3);return c>0?{live:!1,label:`${c}d ${r}h ${u}m`,ended:!1}:r>0?{live:!1,label:`${r}h ${u}m ${x}s`,ended:!1}:{live:!1,label:`${u}m ${x}s`,ended:!1}}function Dn(){const{events:s,isRegistered:a,refreshRegistration:l,create:c,update:r,setStatus:u,setCancelled:x,remove:h,remote:n}=ht(),d=o.useCallback((i,v)=>{l(i);const N=s.find(_=>_.id===i);N&&rn(N,v)},[s,l]),p=Ia.useSearch(),m=Ua(),{viewAs:b,isAdmin:j}=Pa(),A=Oa(),{clubId:I}=Ks(),g=Zs(Fa),f=Zs(Ha),[y,D]=o.useState("events"),[z,H]=o.useState([]),ie=o.useCallback(async()=>{if(!I)return H([]);const i=await g({data:{clubId:I}});i.ok&&H(i.recordings)},[I,g]);o.useEffect(()=>{y==="replays"&&ie()},[y,ie]),_a("events");const ce=A.canManageClub()&&!b&&n,B=ce,[R,K]=o.useState(null),[O,oe]=o.useState(null),[$,be]=o.useState(null),w=o.useCallback(async(i,v,N)=>{try{return await Va(i,v,N),k.success("The series was updated."),!0}catch(_){return k.error(_ instanceof Error&&_.message?_.message:"Could not update that series."),!1}},[]),qe=o.useCallback(async(i,v)=>{try{return await Ba({seriesId:i.seriesId,fromDate:i.date,startTime:i.start,endTime:i.end&&i.end!==i.start?i.end:null,timezone:i.timezone,rule:v}),k.success("The schedule was changed."),!0}catch(N){return k.error(N instanceof Error&&N.message?N.message:"Could not change that schedule."),!1}},[]),[M,fe]=o.useState(null),[re,$e]=o.useState(!0),[J,ye]=o.useState(null),[de,Me]=o.useState(!0),ee=i=>!!i?.location.toLowerCase().includes("zoom");async function Ne(i,v){if(!v||!ee(i))return!0;try{const N=await Zt(i.id);return N.ok?!0:(k.error(N.error??"Zoom could not delete that session."),!1)}catch(N){return k.error(N instanceof Error?N.message:"Zoom could not delete that session."),!1}}const he=i=>({onEdit:()=>K(i),onDuplicate:()=>{Ye(i)},onCopyLink:()=>{Ze(i)},onManageAttendees:()=>oe(i),onPublishChange:v=>{u(i.id,v)},onCancelChange:v=>{if(!v)return void x(i.id,!1);Me(!0),ye(i)},onDelete:()=>{$e(!0),fe(i)}});async function Ye(i){const v=await c({title:`${i.title} (Copy)`,description:i.description,date:i.date,start:i.start,end:i.end,host:i.host,location:i.location,timezone:i.timezone||os(),kind:i.kind,joinUrl:i.joinUrl??null,status:"draft",visibility:i.visibility});v&&(k.success("Event duplicated as a draft."),K(v))}async function Ze(i){const v=`${window.location.origin}${G(i.id)}`;try{await navigator.clipboard.writeText(v),k.success("Event link copied")}catch{k.error(`Couldn't copy. The link is ${v}`)}}
1const[T,F]=o.useState("grid"),[we,se]=o.useState(()=>{const i=new Date;return new Date(i.getFullYear(),i.getMonth(),i.getDate())}),[Ge,Ce]=o.useState(()=>{const i=new Date;return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}),[Ke,ue]=o.useState(!1),[Ie,Ue]=o.useState(null),Pe=vs(6e4),Oe=o.useMemo(()=>s.map(i=>i.id),[s]),ke=At(Oe),{upcoming:E,past:Se}=o.useMemo(()=>dn(s,Pe),[s,Pe]),Q=y==="past"?Se:E,q=o.useMemo(()=>{const i={};for(const v of Q)(i[v.date]||=[]).push(v);return i},[Q]);o.useEffect(()=>{if(p.event){const i=s.find(v=>v.id===p.event);if(i){const v=new Date(i.endsAt??i.startsAt).getTime();D(Number.isFinite(v)&&v<=Date.now()?"past":"events"),se(aa(i.date)),Ce(i.date),Ue(i.id),F("grid");const N=setTimeout(()=>{document.getElementById(`cal-evt-${i.id}`)?.scrollIntoView({behavior:"smooth",block:"center"})},80);return()=>clearTimeout(N)}}},[p.event,s]),o.useEffect(()=>{p.create&&ue(!0)},[p.create]),o.useEffect(()=>{if(!p.edit)return;const i=B?s.find(v=>v.id===p.edit):null;B&&!i||(i&&K(i),m({to:"/app/calendar",search:{event:p.event,create:p.create,edit:void 0},replace:!0}))},[p.edit,p.event,p.create,s,B,m]);function Fe(){ue(!1),p.create&&m({to:"/app/calendar",search:{event:p.event,create:void 0,edit:p.edit}})}return e.jsxs("div",{className:"cal-wrap",children:[e.jsx(Wa,{title:"Calendar",coverEntity:{type:"event",id:"calendar",description:"Everything the club has scheduled: calls, workshops and sessions."},menuItems:B?e.jsx(Ya,{asChild:!0,children:e.jsxs(W,{to:"/app/manage/events",children:[e.jsx(Ga,{size:14,"aria-hidden":"true"})," Event Analytics"]})}):void 0,actions:e.jsxs("div",{className:"cal-toolbar",children:[e.jsxs("nav",{className:"cal-section-tabs","aria-label":"Calendar sections",children:[e.jsxs(as,{type:"button",variant:"outline",className:"cal-section-tab","aria-pressed":y==="events",onClick:()=>D("events"),children:[e.jsx(Is,{"aria-hidden":"true"})," Upcoming"]}),e.jsxs(as,{type:"button",variant:"outline",className:"cal-section-tab","aria-pressed":y==="past",onClick:()=>{D("past"),F("grid")},children:[e.jsx(ve,{"aria-hidden":"true"})," Past"]}),e.jsxs(as,{type:"button",variant:"outline",className:"cal-section-tab","aria-pressed":y==="replays",onClick:()=>D("replays"),children:[e.jsx(ge,{"aria-hidden":"true"})," Replays"]})]}),y==="replays"?e.jsxs("div",{className:"cal-views",children:[e.jsxs("button",{className:`cal-vbtn ${T==="list"?"":"on"}`,onClick:()=>F("grid"),children:[e.jsx(cs,{size:14})," Grid"]}),e.jsxs("button",{className:`cal-vbtn ${T==="list"?"on":""}`,onClick:()=>F("list"),children:[e.jsx(Us,{size:14})," List"]})]}):e.jsxs("div",{className:"cal-views",children:[e.jsxs("button",{className:`cal-vbtn ${T==="grid"?"on":""}`,onClick:()=>F("grid"),children:[e.jsx(cs,{size:14})," Grid"]}),e.jsxs("button",{className:`cal-vbtn ${T==="list"?"on":""}`,onClick:()=>F("list"),children:[e.jsx(Us,{size:14})," List"]}),e.jsxs("button",{className:`cal-vbtn ${T==="month"?"on":""}`,onClick:()=>F("month"),children:[e.jsx(Is,{size:14})," Month"]}),e.jsxs("button",{className:`cal-vbtn ${T==="week"?"on":""}`,onClick:()=>F("week"),children:[e.jsx(Ot,{size:14})," Week"]}),e.jsxs("button",{className:`cal-vbtn ${T==="day"?"on":""}`,onClick:()=>F("day"),children:[e.jsx(qa,{size:14})," Day"]})]}),ce&&e.jsxs("button",{type:"button",className:"cal-new",onClick:()=>ue(!0),children:[e.jsx(Js,{size:14})," New Event"]})]})}),y==="replays"?e.jsx(un,{events:s,liveRecordings:z,covers:ke,canManage:B,onPublishLiveRecording:async(i,v)=>{const N=await f({data:{sessionId:i,published:v}});if(!N.ok){k.error(N.error);return}k.success(v?"Replay published.":"Replay moved back to review."),await ie()},layout:T==="list"?"list":"grid"}):T==="month"?e.jsx(mn,{cursor:we,setCursor:se,selected:Ge,setSelected:Ce,eventsByDate:q,rsvpOf:i=>a(i)?"going":null,onRsvp:d}):null,y!=="replays"&&T==="week"&&e.jsx(pn,{cursor:we,setCursor:se,eventsByDate:q}),y!=="replays"&&T==="day"&&e.jsx(xn,{cursor:we,setCursor:se,eventsByDate:q}),y!=="replays"&&T==="grid"&&e.jsx(jn,{events:Q,past:y==="past",rsvpOf:i=>a(i)?"going":null,onRsvp:d,focusId:Ie,covers:ke,canManage:B,actionsFor:he}),y!=="replays"&&T==="list"&&e.jsxs("div",{className:"cm-layout",children:[e.jsx("div",{children:e.jsx(gn,{events:Q,past:y==="past",rsvpOf:i=>a(i)?"going":null,onRsvp:d,focusId:Ie,covers:ke,canManage:B,actionsFor:he})}),e.jsx(ut,{isAdmin:j})]}),Ke&&e.jsx(Bs,{onClose:Fe,onCreate:c,onRemove:h}),R&&e.jsx(Bs,{event:R,onClose:()=>K(null),onCreate:c,onUpdate:r,seriesOccurrences:Fs(s,R),onUpdateSeries:w,onReschedule:i=>{K(null),be(i)}}),$&&e.jsx(nn,{event:$,occurrences:Fs(s,$),seriesId:$.seriesId,onConfirm:i=>qe($,i),onClose:()=>be(null)}),O&&e.jsx(Dt,{event:O,onClose:()=>oe(null)}),e.jsx(Ps,{open:J!==null,onOpenChange:i=>!i&&ye(null),title:"Cancel This Event?",description:ee(J)?"The event stays on the calendar, marked cancelled, and keeps its registrations and attendance record. If you delete its Zoom session, reinstating the event later will not recreate that session automatically.":"The event stays on the calendar, marked cancelled, and keeps its registrations and attendance record. You can reinstate it from the same menu.",confirmLabel:"Cancel Event",onConfirm:()=>{const i=J;ye(null),i&&Ne(i,de).then(v=>{v&&x(i.id,!0)})},children:ee(J)&&e.jsxs("label",{className:"cal-confirm-option",children:[e.jsx("input",{type:"checkbox",checked:de,onCh
1ange:i=>Me(i.target.checked)}),e.jsx("span",{children:"Also delete the meeting or webinar from Zoom"})]})}),e.jsx(Ps,{open:M!==null,onOpenChange:i=>!i&&fe(null),title:"Delete Event?",description:"This permanently deletes this class. This action cannot be undone. Its registrations are deleted with it.",confirmLabel:"Delete Event",destructive:!0,onConfirm:()=>{const i=M;fe(null),i&&Ne(i,re).then(v=>{v&&h(i.id)})},children:ee(M)&&e.jsxs("label",{className:"cal-confirm-option",children:[e.jsx("input",{type:"checkbox",checked:re,onChange:i=>$e(i.target.checked)}),e.jsx("span",{children:"Also delete the meeting or webinar from Zoom"})]})})]})}function un({events:s,liveRecordings:a,covers:l,canManage:c,onPublishLiveRecording:r,layout:u="grid"}){const x=vs(6e4),h=o.useMemo(()=>s.filter(n=>new Date(n.endsAt??n.startsAt).getTime()<=x).sort((n,d)=>d.startsAt.localeCompare(n.startsAt)),[s,x]);return!h.length&&!a.length?e.jsxs("div",{className:"cal-replay-empty",children:[e.jsx("span",{children:e.jsx(ge,{size:24})}),e.jsx("h2",{children:"Your replay library will appear here"}),e.jsx("p",{children:"After an event ends, its recording will be kept with the same audience access."})]}):e.jsxs("section",{className:"cal-replay-section","aria-labelledby":"cal-replay-title",children:[e.jsxs("div",{className:"cal-replay-intro",children:[e.jsxs("div",{children:[e.jsx("span",{className:"cal-replay-kicker",children:"On demand"}),e.jsx("h2",{id:"cal-replay-title",children:"Event replays"}),e.jsx("p",{children:"Catch up on past calls, workshops, and member sessions."})]}),e.jsxs("span",{className:"cal-replay-count",children:[h.filter(n=>n.replayUrl).length+a.filter(n=>n.recording_published_at).length," ","available"]})]}),e.jsxs("div",{className:`cal-replay-grid${u==="list"?" is-list":""}`,children:[a.map(n=>{const d=n.recording_status==="ready"&&!!n.recording_playback_url,p=!!n.recording_published_at;return e.jsxs("article",{className:"cal-replay-card",children:[e.jsxs("div",{className:"cal-replay-media cal-live-replay-media",children:[e.jsxs("div",{children:[e.jsx(qs,{size:30}),e.jsx("span",{children:"Live recording"})]}),p&&d&&e.jsx("span",{className:"cal-replay-play",children:e.jsx(ge,{size:28})})]}),e.jsxs("div",{className:"cal-replay-body",children:[e.jsx("span",{className:"cal-replay-date",children:n.started_at?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(n.started_at)):"Scheduled live"}),e.jsx("h3",{children:n.title}),e.jsx("p",{children:n.description||"Watch the full live replay."}),e.jsxs("div",{className:"cal-replay-actions",children:[p&&d?e.jsxs("a",{className:"cal-replay-watch",href:n.recording_playback_url,target:"_blank",rel:"noreferrer",children:[e.jsx(ge,{size:16})," Watch replay"]}):e.jsx("span",{className:"cal-replay-processing",children:n.recording_status==="failed"?"Recording failed":d?"Ready for review":"Replay processing"}),c&&d&&e.jsx("button",{type:"button",className:"cal-replay-publish",onClick:()=>{r(n.id,!p)},children:p?"Move to review":"Publish replay"})]})]})]},`live-${n.id}`)}),h.map(n=>{const d=[...n.access.tags??[],...n.access.plans??[]];return e.jsxs("article",{className:"cal-replay-card",children:[e.jsxs("div",{className:"cal-replay-media",children:[e.jsx(js,{eventId:n.id,title:n.title,description:n.description,cover:l.covers[n.id]??null,fallbackUrl:n.thumb,clubId:l.clubId,canEdit:l.canEdit,style:l.style,onChanged:()=>{l.refresh()}}),n.replayUrl&&e.jsx("span",{className:"cal-replay-play",children:e.jsx(ge,{size:28})})]}),e.jsxs("div",{className:"cal-replay-body",children:[e.jsx("span",{className:"cal-replay-date",children:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(new Date(n.startsAt))}),e.jsx("h3",{children:n.title}),e.jsx("p",{children:n.description||"Watch the full event replay."}),d.length>0&&e.jsxs("div",{className:"cal-replay-access",children:[e.jsx(Be,{size:14})," Available to ",d.join(" or ")]}),e.jsxs("div",{className:"cal-replay-actions",children:[n.replayUrl?e.jsxs("a",{className:"cal-replay-watch",href:n.replayUrl,target:"_blank",rel:"noreferrer",children:[e.jsx(ge,{size:16})," Watch replay"]}):e.jsx("span",{className:"cal-replay-processing",children:c?"Add a replay in Edit Event":"Replay processing"}),e.jsx(W,{to:G(n.id),children:"View details"})]})]})]},n.id)})]})]})}function mn({cursor:s,setCursor:a,selected:l,setSelected:c,eventsByDate:r,rsvpOf:u,onRsvp:x}){const h=s.getFullYear(),n=s.getMonth(),d=new Date(h,n,1).getDay(),p=new Date(h,n+1,0).getDate(),m=[...Array(d).fill(null),...Array.from({length:p},(g,f)=>f+1)];for(;m.length%7;)m.push(null);const b=g=>`${h}-${String(n+1).padStart(2,"0")}-${String(g).padStart(2,"0")}`,j=r[l]||[],A=`${h}-${String(n+1).padStart(2,"0")}-`,I=Object.keys(r).filter(g=>g.startsWith(A)&&g!==l&&(r[g]?.length??0)>0).sort();return e.jsxs("div",{className:"cal-month",children:[e.jsxs("div",{className:"cal-card",children:[e.jsxs("div",{className:"cal-card-head",children:[e.jsxs("h2",{children:[ds[n]," ",h]}),e.jsxs("div",{className:"cal-nav",children:[e.jsx("button",{onClick:()=>a(new Date(h,n-1,1)),className:"cal-navbtn",children:e.jsx(ps,{size:16})}),e.jsx("button",{onClick:()=>a(new Date),className:"cal-navbtn cal-today",children:"Today"}),e.jsx("button",{onClick:()=>a(new Date(h,n+1,1)),className:"cal-navbtn",children:e.jsx(xs,{size:16})})]})]}
1),e.jsxs("div",{className:"cal-grid",children:[fs.map(g=>e.jsx("div",{className:"cal-dow",children:g},g)),m.map((g,f)=>{if(g===null)return e.jsx("div",{},f);const y=b(g),D=!!r[y],z=l===y;return e.jsxs("button",{onClick:()=>c(y),className:`cal-cell ${z?"sel":""} ${D?"has":""}`,children:[g,D&&!z&&e.jsx("span",{className:"cal-dot"})]},f)})]})]}),e.jsxs("div",{className:"cal-card",children:[e.jsx("h3",{className:"cal-side-title",children:new Date(l).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})}),j.length===0?e.jsx("p",{className:"cal-empty",children:"No classes scheduled."}):e.jsx("ul",{className:"cal-side-list",children:j.map(g=>e.jsx(Vs,{e:g,rsvpOf:u,onRsvp:x},g.id))}),I.length>0&&e.jsxs("div",{className:"cal-side-rest",children:[e.jsxs("h4",{className:"cal-side-subtitle",children:["Rest Of ",ds[n]]}),I.map(g=>e.jsxs("div",{className:"cal-side-daygroup",children:[e.jsx("button",{type:"button",className:"cal-side-dayhead",onClick:()=>c(g),children:new Date(g).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),e.jsx("ul",{className:"cal-side-list",children:(r[g]??[]).map(f=>e.jsx(Vs,{e:f,rsvpOf:u,onRsvp:x},f.id))})]},g))]})]})]})}function Vs({e:s,rsvpOf:a,onRsvp:l}){return e.jsxs("li",{className:`cal-side-evt${L(s)?" is-cancelled":""}`,children:[e.jsxs(W,{to:G(s.id),className:"cal-side-evt-title",children:[s.title,L(s)&&e.jsx("span",{className:"cal-cancelled-inline",children:"Cancelled"})]}),e.jsxs("div",{className:"cal-side-evt-meta",children:[e.jsx(ve,{size:12})," ",ys(s.start,s.end)]}),e.jsxs("div",{className:"cal-side-evt-meta",children:["Hosted By ",s.host]}),!L(s)&&e.jsx(Ns,{target:V(s)}),e.jsx(ms,{type:"event",id:s.id,size:14}),e.jsxs("div",{className:"cal-side-evt-foot",children:[!L(s)&&e.jsx(bs,{eventId:s.id,registered:a(s.id)==="going",onRegisteredChange:c=>l(s.id,c?"going":null),size:"sm"}),e.jsx(W,{className:"cal-ec-more",to:G(s.id),children:"Learn More"})]})]})}function pn({cursor:s,setCursor:a,eventsByDate:l}){const c=new Date(s);c.setDate(s.getDate()-s.getDay()),c.setHours(0,0,0,0);const r=Array.from({length:7},(u,x)=>{const h=new Date(c);return h.setDate(c.getDate()+x),h});return e.jsxs("div",{className:"cal-card",children:[e.jsxs("div",{className:"cal-card-head",children:[e.jsxs("h2",{children:["Week of ",c.toLocaleDateString("en-US",{month:"long",day:"numeric"})]}),e.jsxs("div",{className:"cal-nav",children:[e.jsx("button",{onClick:()=>{const u=new Date(s);u.setDate(s.getDate()-7),a(u)},className:"cal-navbtn",children:e.jsx(ps,{size:16})}),e.jsx("button",{onClick:()=>a(new Date),className:"cal-navbtn cal-today",children:"This Week"}),e.jsx("button",{onClick:()=>{const u=new Date(s);u.setDate(s.getDate()+7),a(u)},className:"cal-navbtn",children:e.jsx(xs,{size:16})})]})]}),e.jsx("div",{className:"cal-week",children:r.map((u,x)=>{const h=hs(u),n=l[h]||[],d=hs(new Date)===h;return e.jsxs("div",{className:"cal-week-col",children:[e.jsxs("div",{className:`cal-week-head ${d?"today":""}`,children:[e.jsx("div",{className:"cal-week-dow",children:fs[u.getDay()]}),e.jsx("div",{className:"cal-week-num",children:u.getDate()})]}),e.jsx("div",{className:"cal-week-body",children:n.length===0?e.jsx("div",{className:"cal-week-empty",children:"—"}):n.map(p=>e.jsxs(W,{to:G(p.id),className:`cal-week-evt${L(p)?" is-cancelled":""}`,children:[e.jsx("div",{className:"cal-week-evt-time",children:We(p.start)}),e.jsxs("div",{className:"cal-week-evt-title",children:[p.title,L(p)&&e.jsx("span",{className:"cal-cancelled-inline",children:"Cancelled"})]})]},p.id))})]},x)})})]})}function xn({cursor:s,setCursor:a,eventsByDate:l}){const c=hs(s),r=(l[c]||[]).slice().sort((x,h)=>x.start.localeCompare(h.start)),u=Array.from({length:14},(x,h)=>h+7);return e.jsxs("div",{className:"cal-card",children:[e.jsxs("div",{className:"cal-card-head",children:[e.jsx("h2",{children:s.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),e.jsxs("div",{className:"cal-nav",children:[e.jsx("button",{onClick:()=>{const x=new Date(s);x.setDate(s.getDate()-1),a(x)},className:"cal-navbtn",children:e.jsx(ps,{size:16})}),e.jsx("button",{onClick:()=>a(new Date),className:"cal-navbtn cal-today",children:"Today"}),e.jsx("button",{onClick:()=>{const x=new Date(s);x.setDate(s.getDate()+1),a(x)},className:"cal-navbtn",children:e.jsx(xs,{size:16})})]})]}),e.jsxs("div",{className:"cal-day",children:[u.map(x=>{const h=r.filter(n=>parseInt(n.start.split(":")[0])===x);return e.jsxs("div",{className:"cal-day-row",children:[e.jsx("div",{className:"cal-day-hr",children:We(`${x}:00`)}),e.jsx("div",{className:"cal-day-slot",children:h.map(n=>e.jsxs(W,{to:G(n.id),className:`cal-day-evt${L(n)?" is-cancelled":""}`,children:[e.jsxs("div",{className:"cal-day-evt-title",children:[n.title,L(n)&&e.jsx("span",{className:"cal-cancelled-inline",children:"Cancelled"})]}),e.jsxs("div",{className:"cal-day-evt-meta",children:[ys(n.start,n.end)," · ",n.host]})]},n.id))})]},x)}),r.length===0&&e.jsx("p",{className:"cal-empty",style:{padding:"12px 4px"},children:"No classes scheduled for this day."})]})]})}function jn({events:s,past:a,rsvpOf:l,onRsvp:c,focusId:r,covers:u,canManage:x,actionsFor:h}){const n=o.useMemo(()=>s.slice().sort((d,p)=>a?V(p).getTime()-V(d).getTime():V(d).getTime()-V(p).getTime()),[s,a]);return n.length===0?e.jsx("p",{className:"cal-empty cal-events-empty",children:a?"No past events yet.":"No upcoming events scheduled."}
1):e.jsx("div",{className:"cal-grid-view",children:n.map(d=>e.jsx("div",{id:`cal-evt-${d.id}`,className:r===d.id?"cal-ec-focus":void 0,children:e.jsx(Gt,{event:d,rsvp:l(d.id),onRsvp:p=>c(d.id,p),covers:u,canManage:x,actions:h(d),countdown:a?void 0:e.jsx(Ns,{target:V(d)}),past:a})},d.id))})}function gn({events:s,past:a,rsvpOf:l,onRsvp:c,focusId:r,covers:u,canManage:x,actionsFor:h}){const n=o.useMemo(()=>s.slice().sort((d,p)=>a?V(p).getTime()-V(d).getTime():V(d).getTime()-V(p).getTime()),[s,a]);return n.length===0?e.jsx("p",{className:"cal-empty",style:{padding:"16px 4px"},children:a?"No past events yet.":"No upcoming events scheduled."}):e.jsx("div",{className:"cal-list-view",children:n.map(d=>{const p=aa(d.date);return e.jsxs("article",{id:`cal-evt-${d.id}`,className:`cal-lrow${r===d.id?" cal-ec-focus":""}${L(d)?" is-cancelled":""}`,children:[e.jsxs("div",{className:"cal-lrow-date",children:[e.jsx("span",{className:"cal-lrow-dow",children:fs[p.getDay()]}),e.jsx("span",{className:"cal-lrow-day",children:p.getDate()}),e.jsx("span",{className:"cal-lrow-mon",children:ds[p.getMonth()].slice(0,3)})]}),e.jsx(js,{className:"cal-lrow-thumb",eventId:d.id,title:d.title,description:d.description,cover:u.covers[d.id]??null,fallbackUrl:d.thumb,clubId:u.clubId,canEdit:u.canEdit,style:u.style,onChanged:()=>{u.refresh()}}),e.jsxs("div",{className:"cal-lrow-main",children:[e.jsxs("div",{className:"cal-lrow-top",children:[e.jsxs("h3",{className:"cal-lrow-title",children:[d.title,L(d)&&e.jsx("span",{className:"cal-cancelled-inline",children:"Cancelled"})]}),!L(d)&&!a&&e.jsx(Ns,{target:V(d)})]}),e.jsxs("div",{className:"cal-lrow-meta",children:[e.jsx(ve,{size:12})," ",ys(d.start,d.end)]}),e.jsxs("div",{className:"cal-lrow-meta",children:[e.jsx(us,{size:12})," ",d.location," · Hosted By ",d.host]}),x&&d.location.toLowerCase().includes("zoom")&&d.host&&e.jsxs("div",{className:"cal-lrow-meta cal-lrow-zoom-owner",children:["Zoom host account: ",d.host]}),e.jsxs("div",{className:"cal-lrow-foot",children:[L(d)?e.jsx("span",{className:"cal-lrow-cancelled-note",children:"This event has been cancelled."}):a?e.jsx("span",{className:"cal-lrow-past-note",children:"Past event"}):e.jsx(bs,{eventId:d.id,registered:l(d.id)==="going",onRegisteredChange:m=>c(d.id,m?"going":null),size:"sm"}),e.jsx(W,{className:"cal-ec-more",to:G(d.id),children:"Learn More"})]})]}),e.jsxs("div",{className:"cal-lrow-actions",children:[e.jsx(ms,{type:"event",id:d.id,className:"sv-toggle-round"}),e.jsx(ea,{event:d,canManage:x,actions:h(d)})]})]},d.id)})})}function Bs({event:s,onClose:a,onCreate:l,onRemove:c,onUpdate:r,seriesOccurrences:u,onUpdateSeries:x,onReschedule:h}){const n=!!s,d=!!(s&&Gs(s)),{clubId:p}=Ks(),[m,b]=o.useState({title:s?.title??"",description:s?.description??"",date:s?.date??new Date().toISOString().slice(0,10),start:s?.start??"17:30",end:s?.end??"18:30",host:s?.host??""}),[j,A]=o.useState(()=>s?vt(s.location,s.joinUrl):{kind:"zoom",url:null,text:null}),[I,g]=o.useState(!1),[f,y]=o.useState(n?"details":"experience"),[D,z]=o.useState(""),[H,ie]=o.useState([]),[ce,B]=o.useState(!1),[R,K]=o.useState(null),[O,oe]=o.useState([]),[$,be]=o.useState(null),[w,qe]=o.useState("create"),[M,fe]=o.useState("meeting"),[re,$e]=o.useState(!0),[J,ye]=o.useState(""),[de,Me]=o.useState(!1),[ee,Ne]=o.useState("cloud"),[he,Ye]=o.useState("manual"),[Ze,T]=o.useState(!0),[F,we]=o.useState(!1),[se,Ge]=o.useState(!0),[Ce,Ke]=o.useState(!1),[ue,Ie]=o.useState(!0),[Ue,Pe]=o.useState(!0),[Oe,ke]=o.useState(!0),[E,Se]=o.useState(null),[Q,q]=o.useState(null),[Fe,i]=o.useState(!1),v=Ka(O,R,M),N=O.find(t=>t.id===$)??null,_=w==="create"&&$?Ja(N,M):null,me=w==="link"?Qa(H,R,D):null,ze=w==="link"?null:$?Xa(O,R,$,$):"Select the Zoom Host Account before continuing.",pe=j.kind==="zoom"&&w==="create"&&!de&&!J.trim()?"Choose at least one security option: waiting room or passcode.":null;o.useEffect(()=>{if(j.kind!=="zoom")return;let t=!0;return B(!0),Lt().then(S=>{t&&(ie(S),K(C=>et(S,C)))}).catch(()=>{t&&ie([])}).finally(()=>{t&&B(!1)}),()=>{t=!1}},[j.kind]),o.useEffect(()=>{if(j.kind!=="zoom"||!R){oe([]);return}let t=!0;return $t(R).then(S=>{if(!t)return;const C=st(S,R);oe(C),be(te=>te&&C.some(X=>X.id===te)?te:null)}
1).catch(()=>{t&&oe([])}),()=>{t=!1}},[j.kind,R]);const[ae,ws]=o.useState(null),[Je,ta]=o.useState("one"),[Y,Cs]=o.useState(null),[He,ks]=o.useState(!1),Ee=o.useRef(null),[Re,Ss]=o.useState((s?.access.tags??[]).join(", ")),[Ae,zs]=o.useState((s?.access.plans??[]).join(", ")),[Qe,Es]=o.useState(s?.replayUrl??""),[Xe,Rs]=o.useState(!s?.replayUrl),[As,Ds]=o.useState(!1),[_e,na]=o.useState({tags:[],plans:[]});o.useEffect(()=>{let t=!0;return at().then(S=>{t&&na(S)}).catch(()=>{}),()=>{t=!1}},[]);const U=j.kind==="zoom"&&w==="create"?null:bt(j),xe=m.start&&m.end&&m.end<=m.start?"End time must be after the start.":null,Ts=ae?gs(m.date,ae):null,es=!!(m.title.trim()&&m.date&&m.start&&m.end)&&!U&&!me&&!ze&&!_&&!pe&&!(j.kind==="zoom"&&w==="link"&&D.trim()&&!E)&&!xe&&!Ts&&!I,la=!!(m.title.trim()&&m.date&&m.start&&m.end)&&!xe&&!Ts,ia=!U&&!me&&!ze&&!_&&!pe&&!(j.kind==="zoom"&&w==="link"&&D.trim()&&!E);async function ca(t){if(!(!t||!p)){ks(!0);try{const S=await Ft(p,t);ns(Y),Cs(S)}catch(S){k.error(S instanceof Error&&S.message?S.message:"Could not use that image.")}finally{ks(!1),Ee.current&&(Ee.current.value="")}}}async function oa(){const t=Y;Cs(null),await ns(t)}function je(){ns(Y),a()}async function Ls(){if(!es)return;g(!0);const t=Nt(j.kind==="zoom"&&w==="create"?{...j,url:null}:j),S=j.kind==="zoom"?w==="create"?N?Ve(N):null:E?.hostName??null:null,C={...m,title:m.title.trim(),host:S||m.host.trim()||"You",location:t.location??"",joinUrl:t.joinUrl};if(n&&d&&Je!=="one"&&x){const Z=await x(s.seriesId,{title:C.title,description:C.description,location:C.location,...C.joinUrl?{joinUrl:C.joinUrl}:{},host:C.host},Je==="following"?s.id:null);g(!1),Z&&a();return}const te=le(Re),X=le(Ae),ss=te.length>0||X.length>0,P=n?await r?.(s.id,C):await l({...C,timezone:os(),status:ss?"draft":"published",visibility:"members"},ae);if(P)try{const Z=ln(Qe);if(n&&Qe.trim()&&!Z.url)throw new Error("Enter a secure video URL or valid embed code.");await ot(P.id,{autoPublish:j.kind==="zoom"&&w==="create"&&he==="automatic",status:n?!Xe&&Z.url?"ready":"coming_soon":he==="none"?"hidden":"coming_soon",sourceType:Z.type,sourceUrl:Z.url}),(n||ss)&&await rt(P.id,{tags:te,plans:X,publish:!n&&ss})}catch(Z){!n&&c&&await c(P.id),k.error(Z instanceof Error?Z.message:"The event could not be created with that access."),g(!1);return}if(P&&j.kind==="zoom"&&R)try{if(w==="create"&&$){const Z=dt(m.date,m.start),ra=Math.max(1,Math.round((new Date(`${m.date}T${m.end}:00`).getTime()-new Date(`${m.date}T${m.start}:00`).getTime())/6e4)),$s=await It({eventId:P.id,connectionId:R,hostId:$,sessionType:M,topic:m.title.trim(),agenda:m.description.trim(),startTime:Z,durationMinutes:ra,timezone:os(),registrationRequired:re,approvalType:re?0:2,passcode:J.trim(),waitingRoom:de,autoRecording:ee,hostVideo:Ze,participantVideo:F,muteUponEntry:se,joinBeforeHost:Ce,practiceSession:ue,panelistsVideo:Ue,questionAndAnswer:Oe,recurrence:null});if(!$s.ok){!n&&c&&await c(P.id),k.error($s.error??"Zoom could not create that session."),g(!1);return}}else if(w==="link"&&D.trim()&&E){const Z=await Ut({eventId:P.id,connectionId:R,sessionId:D.trim(),sessionType:E.sessionType});if(!Z.ok){!n&&c&&await c(P.id),k.error(Z.error??"That Zoom session could not be connected."),g(!1);return}}}catch{!n&&c&&await c(P.id),k.error("Zoom could not create or connect the session, so the event was not saved."),g(!1);return}if(P&&Y){try{await Ht(p,P.id,Y)}catch{k.error("The Event was created, but its cover could not be attached.")}URL.revokeObjectURL(Y.previewUrl)}g(!1),P&&a()}return!n&&f==="experience"?e.jsx("div",{className:"cal-modal-bd",onClick:je,children:e.jsxs("div",{className:"cal-modal cal-event-builder",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"cal-modal-head",children:[e.jsxs("div",{children:[e.jsx("h3",{children:"Create Event"}),e.jsx("p",{children:"First, choose the experience you want members to have."})]}),e.jsx("button",{className:"cal-modal-x",onClick:je,"aria-label":"Close",children:e.jsx(is,{size:16})})]}),e.jsxs("div",{className:"cal-modal-body",children:[e.jsxs("nav",{className:"cal-builder
1-steps","aria-label":"Event setup progress",children:[e.jsxs("span",{className:"is-current",children:[e.jsx("b",{children:"1"})," Experience"]}),e.jsxs("span",{children:[e.jsx("b",{children:"2"})," Details"]}),e.jsxs("span",{children:[e.jsx("b",{children:"3"})," Platform"]}),e.jsxs("span",{children:[e.jsx("b",{children:"4"})," Registration"]}),e.jsxs("span",{children:[e.jsx("b",{children:"5"})," Review"]})]}),e.jsxs("section",{className:"cal-builder-section","aria-labelledby":"cal-event-type-title",children:[e.jsx("div",{className:"cal-builder-section-head",children:e.jsxs("div",{children:[e.jsx("h4",{id:"cal-event-type-title",children:"Choose your event experience"}),e.jsx("p",{children:"Select how this event will be delivered. You will add its details next."})]})}),e.jsxs("div",{className:"cal-event-type-grid",children:[e.jsxs("button",{type:"button",className:"cal-event-type is-selected","aria-pressed":"true",children:[e.jsx("span",{className:"cal-event-type-icon",children:e.jsx(Ys,{size:18})}),e.jsx("strong",{children:"Live Event"}),e.jsx("em",{children:"Host a real-time meeting or webinar."}),e.jsxs("span",{className:"cal-event-type-check",children:[e.jsx(Te,{size:13})," Selected"]})]}),e.jsxs("button",{type:"button",className:"cal-event-type",disabled:!0,children:[e.jsx("span",{className:"cal-event-type-icon",children:e.jsx(ve,{size:18})}),e.jsx("strong",{children:"Evergreen"}),e.jsx("em",{children:"Run a pre-recorded experience on a schedule."}),e.jsx("span",{className:"cal-event-type-soon",children:"Coming soon"})]}),e.jsxs("button",{type:"button",className:"cal-event-type",disabled:!0,children:[e.jsx("span",{className:"cal-event-type-icon",children:e.jsx(cs,{size:18})}),e.jsx("strong",{children:"Hybrid"}),e.jsx("em",{children:"Combine live and pre-recorded segments."}),e.jsx("span",{className:"cal-event-type-soon",children:"Coming soon"})]})]})]})]}),e.jsxs("div",{className:"cal-modal-foot",children:[e.jsx("button",{className:"cal-btn-ghost",onClick:je,children:"Cancel"}),e.jsx("button",{className:"cal-btn-pri",onClick:()=>y("details"),children:"Continue to details"})]})]})}):e.jsx("div",{className:"cal-modal-bd",onClick:je,children:e.jsxs("div",{className:`cal-modal cal-event-builder${!n&&f==="platform"?" is-platform-step":""}`,onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"cal-modal-head",children:[e.jsxs("div",{children:[e.jsx("h3",{children:n?"Edit Event":"Create Event"}),!n&&e.jsx("p",{children:"Build the member experience, schedule, and delivery in one place."})]}),e.jsx("button",{className:"cal-modal-x",onClick:je,"aria-label":"Close",children:e.jsx(is,{size:16})})]}),e.jsxs("div",{className:"cal-modal-body",children:[!n&&e.jsx(e.Fragment,{children:e.jsx("nav",{className:"cal-builder-steps","aria-label":"Event setup progress",children:[["experience","Experience"],["details","Details"],["platform","Platform"],["registration","Registration"],["review","Review"]].map(([t,S],C)=>{const X=["experience","details","platform","registration","review"].indexOf(f);return e.jsxs("span",{className:C===X?"is-current":C<X?"is-complete":"",children:[e.jsx("b",{children:C<X?e.jsx(Te,{size:11}):C+1})," ",S]},t)})})}),(n||f==="details")&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Title"}),e.jsx("input",{value:m.title,onChange:t=>b({...m,title:t.target.value}),placeholder:"e.g. Office Hours",autoFocus:!0})]}),e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Description"}),e.jsx("textarea",{rows:3,value:m.description,onChange:t=>b({...m,description:t.target.value}),placeholder:"What's this event about?"})]}),e.jsxs("div",{className:"cal-field-row",children:[e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Date"}),e.jsx("input",{type:"date",value:m.date,onChange:t=>b({...m,date:t.target.value})})]}),e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Start"}),e.jsx("input",{type:"time",value:m.start,onChange:t=>b({...m,start:t.target.value})})]}),e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"End"}),e.jsx("input",{type:"time",value:m.end,onChange:t=>b({...m,end:t.target.value}),"aria-invalid":xe?!0:void 0,"aria-describedby":xe?"cal-time-err":void 0}),xe&&e.jsx("em",{className:"cal-field-err",id:"cal-time-err",children:xe})]})]}),!n&&e.jsxs("label",{className:"cal-check cal-repeat-toggle",children:[e.jsx("input",{type:"checkbox",checked:ae!==null,onChange:t=>ws(t.target.checked?{frequency:"daily",interval:1,count:8}:null)}),e.jsx("span",{children:"Recurring event"})]}),!n&&ae&&e.jsx(sa,{startDate:m.date,value:ae,onChange:ws}),!n&&e.jsxs("div",{className:"cal-field",children:[e.jsx("span",{children:"Cover Image"}),e.jsx("input",{ref:Ee,type:"file",accept:tt.join(","),hidden:!0,onChange:t=>{ca(t.target.files?.[0])}}),Y?e.jsxs("div",{className:"cal-cover",children:[e.jsx("img",{src:Y.previewUrl,alt:"",className:"cal-cover-img"}),e.jsxs("div",{className:"cal-cover-acts",children:[e.jsx("button",{type:"button",className:"cal-btn-ghost",disabled:He,onClick:()=>Ee.current?.click(),children:"Change"}),e.jsx("button",{type:"button",className:"cal-btn-ghost",disabled:He,onClick:()=>{oa()},children:"Remove"})]})]}):e.jsxs("button",{type:"button",className:"cal-cover-add",disabled:He||!p,onClick:()=>Ee.current?.click(),children:[e.jsx(nt,{size:16,"aria-hidden":!0})," ",He?"Uploading…":"Add Cover"]}),e.jsx("em",{className:"cal-field-hint",children:"Optional. A Class without one shows its own placeholder."})]})]}),n&&d&&e.jsxs(e.Fragment,{children:[e.jsx(sn,{value:Je,onChange:ta,count:u?.length??0}),h&&e.jsxs("button",{type:"button",className:"cal-reschedule-open",onClick:()=>h(s),children:[e.jsx(Xs,{size:13,"aria-hidden":"true"})," Change The Schedule…"]})]}),(n||f==="registration")&&e.jsxs("section",{className:"cal-audience","aria-labelledby":"
1cal-audience-title",children:[e.jsxs("div",{className:"cal-audience-head",children:[e.jsx("span",{className:"cal-audience-icon",children:e.jsx(Be,{size:17})}),e.jsxs("div",{children:[e.jsx("h4",{id:"cal-audience-title",children:"Who can access this event?"}),e.jsx("p",{children:"Leave both fields blank for every active member. Otherwise, matching any tag or access level unlocks the event and its replay."})]})]}),e.jsxs("div",{className:"cal-field-row",children:[e.jsxs("label",{className:"cal-field",children:[e.jsxs("span",{children:[e.jsx(lt,{size:13})," Member tags"]}),_e.tags.length>0&&e.jsx(Ws,{options:_e.tags,value:Re,onChange:Ss}),e.jsx("input",{value:Re,onChange:t=>Ss(t.target.value),placeholder:"VIP, Coaching Client"}),e.jsx("em",{className:"cal-field-hint",children:"Separate multiple tags with commas."})]}),e.jsxs("label",{className:"cal-field",children:[e.jsxs("span",{children:[e.jsx(Be,{size:13})," Access levels"]}),_e.plans.length>0&&e.jsx(Ws,{options:_e.plans,value:Ae,onChange:zs}),e.jsx("input",{value:Ae,onChange:t=>zs(t.target.value),placeholder:"Free, Pro, VIP"}),e.jsx("em",{className:"cal-field-hint",children:"Uses the member's current plan level."})]})]}),e.jsxs("div",{className:"cal-audience-status",role:"status",children:[e.jsx(Be,{size:14,"aria-hidden":"true"}),le(Re).length||le(Ae).length?"Restricted — members need at least one matching tag or access level.":"Everyone — all active members can access this event and its replay."]})]}),n&&e.jsxs("div",{className:"cal-field",children:[e.jsx("span",{children:"Replay publishing"}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:Xe,onChange:t=>Rs(t.target.checked)}),e.jsx("span",{children:"Show the event artwork with “Coming Soon”"})]}),e.jsx("textarea",{value:Qe,onChange:t=>Es(t.target.value),placeholder:"Paste a YouTube, Vimeo, or other HTTPS video URL — or its iframe embed code",disabled:Xe}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"file",accept:"video/mp4,video/webm,video/quicktime",disabled:As||!p||!s,onChange:t=>{const S=t.target.files?.[0];!S||!p||!s||(Ds(!0),on(p,s.id,S).then(C=>{Es(C),Rs(!1),k.success("Video uploaded. Save changes to publish it.")}).catch(C=>k.error(C instanceof Error?C.message:"Upload failed.")).finally(()=>Ds(!1)))}}),e.jsx("span",{children:As?"Uploading video…":"Upload an MP4, WebM, or MOV file"})]}),e.jsx("em",{className:"cal-field-hint",children:"The replay uses this event's artwork, tags, and access levels."})]}),(n||f==="platform")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cal-field-row",children:[j.kind!=="zoom"&&e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Host"}),e.jsx("input",{value:m.host,onChange:t=>b({...m,host:t.target.value}),placeholder:"You"})]}),e.jsxs("div",{className:"cal-field",children:[e.jsx("span",{id:"cal-loc-label",children:"Location (where members will attend)"}),e.jsx(Wt,{labelledBy:"cal-loc-label",value:j.kind,onChange:t=>A({kind:t,url:null,text:j.text})})]})]}),ft(j.kind)?e.jsx("p",{className:"cal-field-note",children:U}):j.kind!=="zoom"?e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:j.kind==="address"||j.kind==="text"?"Address":"Link"}),j.kind==="address"||j.kind==="text"?e.jsx("input",{value:j.text??"",onChange:t=>A({...j,text:t.target.value}),placeholder:"e.g. 400 N Ashley Dr, Tampa FL","aria-invalid":U?!0:void 0,"aria-describedby":U?"cal-loc-err":void 0}):e.jsx("input",{type:"url",inputMode:"url",value:j.url??"",onChange:t=>A({...j,url:t.target.value}),placeholder:"https://…","aria-invalid":U?!0:void 0,"aria-describedby":U?"cal-loc-err":void 0}),e.jsx("em",{className:"cal-field-hint",children:yt[j.kind==="text"?"address":j.kind]}),U&&e.jsx("em",{className:"cal-field-err",id:"cal-loc-err",children:U})]}):null,j.kind==="zoom"&&e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"How do you want to use Zoom?"}),e.jsx("div",{className:"cal-zoom-accounts",role:"radiogroup","aria-label":"Zoom setup",children:["create","link"].map(t=>e.jsxs("button",{type:"button",role:"radio","aria-checked":w===t,className:`cal-zoom-account${w===t?" is-on":""}`,onClick:()=>{qe(t),Se(null),q(null)},children:[e.jsx("strong",{children:t==="create"?"Create a New Zoom Session":"Use an Existing Zoom Session"}),e.jsx("em",{children:t==="create"?"Create and configure the meeting or webinar from this event."
1:"Connect a meeting or webinar that already exists in Zoom."})]},t))})]}),j.kind==="zoom"&&(w==="link"||H.length>1)&&e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Zoom Connection"}),e.jsxs("select",{value:R??"",onChange:t=>K(t.target.value||null),disabled:ce||H.length===0,children:[e.jsx("option",{value:"",children:ce?"Loading Zoom accounts…":H.length?"Select a Zoom connection":"No Zoom accounts connected"}),H.map(t=>e.jsxs("option",{value:t.id,children:[t.label," · ",it(t)]},t.id))]}),e.jsx("em",{className:"cal-field-hint",children:ce?"Checking the Zoom accounts available to this Club.":H.length?"Choose the connected Zoom workspace that owns this session.":"No Zoom account is connected yet. Add one in Settings, Integrations, Zoom Accounts."})]}),j.kind==="zoom"&&w==="create"&&e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Zoom Host Account"}),e.jsxs("select",{value:$??"",onChange:t=>be(t.target.value||null),disabled:!R||O.length===0,"aria-describedby":ze||_?"cal-zoom-host-err":void 0,children:[e.jsx("option",{value:"",children:R?O.length?"Select the account that will host this session":"No eligible host accounts available":"Loading connected Zoom accounts…"}),O.map(t=>e.jsxs("option",{value:t.id,children:[Ve(t),Ve(t).toLowerCase()===t.email.toLowerCase()?"":` · ${t.email}`,M==="webinar"&&!t.canHostWebinar?" · Meeting only":""]},t.id))]}),e.jsx("em",{className:"cal-field-hint",children:O.length?`${O.length} connected account${O.length===1?"":"s"}. The selected account will own the Zoom meeting or webinar.`:"Sync approved host accounts in Settings, Integrations, Zoom Accounts."}),(ze||_)&&e.jsx("em",{className:"cal-field-err",id:"cal-zoom-host-err",children:ze??_})]}),j.kind==="zoom"&&w==="create"&&e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Zoom Format"}),e.jsx("div",{className:"cal-zoom-accounts",role:"radiogroup","aria-label":"Zoom format",children:["meeting","webinar"].map(t=>e.jsxs("button",{type:"button",role:"radio","aria-checked":M===t,className:`cal-zoom-account${M===t?" is-on":""}`,onClick:()=>fe(t),children:[e.jsx("strong",{children:De(t)}),e.jsx("em",{children:t==="meeting"?"Everyone can speak and be seen.":"Attendees watch; only panellists present."})]},t))}),e.jsx("em",{className:"cal-field-hint",children:v.length?`${v.length} host${v.length===1?"":"s"} can run a ${De(M).toLowerCase()}.`:`No synced Zoom host is licensed for a ${De(M).toLowerCase()}.`})]}),j.kind==="zoom"&&w==="create"&&e.jsxs("div",{className:"cal-field",children:[e.jsx("span",{children:"Zoom Settings"}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:re,onChange:t=>$e(t.target.checked)}),e.jsx("span",{children:"Require Zoom registration, so each member gets their own join link"})]}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:de,onChange:t=>Me(t.target.checked)}),e.jsx("span",{children:"Hold arrivals in a waiting room"})]}),e.jsx("input",{value:J,onChange:t=>ye(t.target.value),placeholder:"Passcode (optional when waiting room is on)","aria-label":"Zoom passcode","aria-invalid":pe?!0:void 0,"aria-describedby":pe?"cal-zoom-security-err":void 0,maxLength:10}),pe&&e.jsx("em",{className:"cal-field-err",id:"cal-zoom-security-err",children:pe}),e.jsx("em",{className:"cal-field-hint",children:"The title, description, date, time and length above are sent to Zoom as this session's own details."}),e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Replay publishing"}),e.jsxs("select",{value:he,onChange:t=>{const S=t.target.value;Ye(S),S==="automatic"&&Ne("cloud")},children:[e.jsx("option",{value:"none",children:"Do not post a replay"}),e.jsx("option",{value:"manual",children:"Coming Soon — I’ll upload or link it later"}),e.jsx("option",{value:"automatic",children:"Automatically post the Zoom cloud recording"})]}),e.jsx("em",{className:"cal-field-hint",children:"This is separate from recording the meeting. You can record automatically without publishing a replay."})]}),e.jsxs("details",{className:"cal-zoom-advanced",children:[e.jsx("summary",{children:"Advanced Zoom options"}),e.jsxs("div",{className:"cal-zoom-advanced-grid",children:[e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Automatic recording"}),e.jsxs("select",{value:ee,onChange:t=>Ne(t.target.value),children:[e.jsx("option",{value:"cloud",children:"Record automatically to the cloud"}),e.jsx("option",{value:"local",children:"Record automatically on the host computer"}),e.jsx("option",{value:"none",children:"Do not record automatically"})]})]}),e.jsxs("div",{className:"cal-zoom-option-list",children:[e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:Ze,onChange:t=>T(t.target.checked)}),e.jsx("span",{children:"Start with host video on"})]}),M==="meeting"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:F,onChange:t=>we(t.target.checked)}),e.jsx("span",{children:"Start with participant video on"})]}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:se,onChange:t=>Ge(t.target.checked)}),e.jsx("span",{children:"Mute participants when they enter"})]}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:Ce,onChange:t=>Ke(t.target.checked)}),e.jsx("span",{children:"Allow participants to join before the host"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:ue,onChange:t=>Ie(t.target.checked)}),e.jsx("span",{children:"Enable a practice session before attendees enter"})]}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:Ue,onChange:t=>Pe(t.target.checked)}),e.jsx("span",{children:"Start with panelist video on"})]}),e.jsxs("label",{className:"cal-check",children:[e.jsx("input",{type:"checkbox",checked:Oe,onChange:t=>ke(t.target.checked)}),e.jsx("span",{children:"Enable attendee Q&A, comments and upvotes"})]})]})]})]})]})]}),j.kind==="zoom"&&w==="link"&&e.jsxs("div",{className:"cal-field",children:[e.jsxs("div",{className:"cal-field-row",children:[e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Zoom URL"}),e.jsx("input",{type:"url",inputMode:"url",value:j.url??"",onChange:t=>A({...j,url:t.target.value}),placeholder:"https://zoom.us/j/…","aria-invalid":U?!0:void 0,"aria-describedby":U?"cal-existing-zoom-url-err":void 0}),U&&e.jsx("em",{className:"cal-field-err",id:"cal-existing-zoom-url-err",children:U})]}),e.jsxs("label",{className:"cal-field",children:[e.jsx("span",{children:"Meeting or Webinar ID"}),e.jsx("input",{inputMode:"numeric",value:D,onChange:t=>{z(t.target.value),Se(null),q(null)},placeholder:"123 4567 8901","aria-invalid":me?!0:void 0,"aria-describedby":me?"cal-zoom-err":void 0})]})]}),e.jsx("button",{type:"button",className:"cal-ghost-btn",disabled:!D.trim()||!R||Fe,onClick:()=>{R&&(i(!0),q(null),Mt({connectionId:R,sessionId:D.trim()}).then(t=>{Se(t.session),q(t.ok?null:t.error)}).catch(()=>q("Zoom could not be reached.")).finally(()=>i(!1)))},children:Fe?"Looking up…":"Look Up on Zoom"}),E&&e.jsxs("div",{className:"cal-zoom-preview",children:[e.jsxs("strong",{children:[De(E.sessionType),": ",E.topic]}),e.jsxs("em",{children:["Host ",E.hostName??"unknown"," ·"," ",E.startTime?new Date(E.startTime).toLocaleStr
1ing():"no scheduled time"," ","· ",E.timezone??"no time zone",E.durationMinutes?` · ${E.durationMinutes} min`:""]}),e.jsxs("em",{children:[E.registrationRequired?"Zoom registration is on: members get their own join link.":"Zoom registration is off: members use the session link.",E.capacity?` · Capacity ${E.capacity}`:""]}),e.jsx("em",{children:"Zoom keeps the schedule, recurrence, registration, host and capacity. Advisors Club keeps the title, description, cover and who can see it. Saving connects this session; it does not overwrite the Event."})]}),(me||Q)&&e.jsx("em",{className:"cal-field-err",id:"cal-zoom-err",children:me??Q}),!E&&!Q&&e.jsx("em",{className:"cal-field-hint",children:"Add both values, then look the session up. It is connected only after you have confirmed the Zoom details."})]})]}),!n&&f==="review"&&e.jsxs("section",{className:"cal-review","aria-labelledby":"cal-review-title",children:[e.jsxs("div",{className:"cal-review-head",children:[e.jsx("span",{children:e.jsx(Te,{size:18})}),e.jsxs("div",{children:[e.jsx("h4",{id:"cal-review-title",children:"Review your event"}),e.jsx("p",{children:"Confirm the member experience before creating it."})]})]}),e.jsxs("dl",{className:"cal-review-grid",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Event"}),e.jsx("dd",{children:m.title.trim()})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Schedule"}),e.jsxs("dd",{children:[m.date," · ",m.start,"–",m.end,ae?" · Recurring":" · One-time"]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Platform"}),e.jsxs("dd",{children:[rs[j.kind],j.kind==="zoom"?` · ${w==="create"?`New ${De(M)}`:"Existing Zoom session"}
1`:""]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:j.kind==="zoom"?"Zoom host account":"Host"}),e.jsx("dd",{children:j.kind==="zoom"?w==="create"?N?Ve(N):"Not selected":E?.hostName??"Not confirmed":m.host.trim()||"You"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Registration"}),e.jsx("dd",{children:le(Re).length||le(Ae).length?"Restricted access":"All active members"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Cover"}),e.jsx("dd",{children:Y?"Custom image added":"Default event artwork"})]})]}),m.description.trim()&&e.jsx("p",{className:"cal-review-description",children:m.description.trim()})]}),n&&e.jsx("p",{className:"cal-field-note",children:"The image, registrations and link for this Class are unchanged by saving here."})]}),e.jsxs("div",{className:"cal-modal-foot",children:[n?e.jsx("button",{className:"cal-btn-ghost",onClick:je,children:"Cancel"}):e.jsx("button",{className:"cal-btn-ghost",onClick:()=>y(f==="details"?"experience":f==="platform"?"details":f==="registration"?"platform":"registration"),children:"Back"}),n?e.jsx("button",{className:"cal-btn-pri",disabled:!es,onClick:()=>{Ls()},children:I?"Saving…":"Save Changes"}):f==="review"?e.jsxs("button",{className:"cal-btn-pri",disabled:!es,onClick:()=>{Ls()},children:[e.jsx(Js,{size:14})," ",I?"Creating…":"Create Event"]}):e.jsx("button",{className:"cal-btn-pri",disabled:f==="details"?!la:f==="platform"?!ia:!1,onClick:()=>y(f==="details"?"platform":f==="platform"?"registration":"review"),children:f==="details"?"Continue to platform":f==="platform"?"Continue to registration":"Review event"})]})]})})}function Ws({options:s,value:a,onChange:l}){const c=le(a);return e.jsx("div",{className:"cal-audience-choices",children:s.map(r=>{const u=c.some(x=>x.toLowerCase()===r.toLowerCase());return e.jsxs("button",{type:"button",className:u?"is-on":"","aria-pressed":u,onClick:()=>l(u?c.filter(x=>x.toLowerCase()!==r.toLowerCase()).join(", "):[...c,r].join(", ")),children:[u&&e.jsx(Te,{size:11})," ",r]},r)})})}function Ns({target:s}){const a=hn(s);return a.ended?null:a.live?e.jsxs("span",{className:"cal-live-badge",children:[e.jsx("span",{className:"cal-live-dot"})," Live"]}):e.jsxs("span",{className:"cal-cd-chip",children:[e.jsx(ve,{size:11})," ",a.label]})}export{Dn as component};

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.