1import{D as H,s as K,Q as X,h as Y,y as Z,z as c,o as a,c as l,j as s,a as o,k as u,F as ee,e as v,l as d,t as w,d as b,B as C,b as p,i as te,w as oe}from"./index-D8GvWgwI.js";import{u as se}from"./courseStore-Dm8bHeVn.js";import{u as ne}from"./eventStore-B0ynicFl.js";import{a as A,g as ae}from"./courseEvents-DxXcoJyv.js";import"./useSafeMarked-CFTK_15D.js";import"./marked.esm-C4n1i0vC.js";const le={class:"tw-min-h-screen tw-bg-bg tw-flex tw-justify-center tw-px-4 tw-py-10 md:tw-py-16"},re={class:"tw-w-full tw-max-w-xl"},ie={class:"tw-flex tw-flex-col tw-gap-1"},ce={key:0,class:"tw-mt-0 tw-text-content-secondary"},ue={key:0},de={key:1,class:"tw-flex tw-items-center tw-gap-3 tw-py-6"},we={key:2,class:"tw-flex tw-flex-col tw-gap-4"},ve={key:0,class:"tw-flex tw-flex-col tw-gap-3"},pe=["href"],fe={key:0,class:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-3 tw-rounded-md tw-border tw-border-solid tw-border-border-soft"},me={class:"tw-flex tw-flex-col"},ge={class:"tw-text-lg"},ye={key:1,class:"tw-m-0 tw-text-sm tw-text-content-secondary tw-whitespace-pre-line"},he={class:"tw-flex tw-flex-wrap tw-gap-2"},xe=["href"],_e={key:3,class:"tw-flex tw-flex-col tw-gap-3"},ke={key:0,class:"tw-m-0 tw-text-sm tw-text-red-500"},be={key:4,class:"tw-flex tw-flex-col tw-gap-3"},Ce={key:5,class:"tw-flex tw-flex-col tw-gap-3"},Ee={class:"tw-flex tw-gap-2"},Ve={__name:"CourseEventAccessView",setup(je){const m=H(),L=K(),N=X(),B=se(),D=ne(),g=m.params.courseId,E=m.params.eventId,z=typeof m.query.token=="string"?m.query.token:"",j=v(()=>z?"token":"auth"),y=v(()=>{var t;return!!((t=L.User)!=null&&t.id)}),n=d(null),h=d(null),f=d(""),r=d(""),S=d(!1),x=d(!1),_=d(!1),V=v(()=>{var t,e;return((t=n.value)==null?void 0:t.eventTitle)||((e=h.value)==null?void 0:e.title)||""}),k=v(()=>{var t,e;return((t=n.value)==null?void 0:t.start)||((e=h.value)==null?void 0:e.start)||""}),T=v(()=>{var t,e;return((t=n.value)==null?void 0:t.end)||((e=h.value)==null?void 0:e.end)||""}),U=v(()=>k.value?ae({id:E,title:V.value,start:k.value,end:T.value},g):""),G=async()=>{try{h.value=await D.getEvent(E,"")}catch(t){console.error("Error loading event info:",t)}},I=async()=>{if(y.value){S.value=!0,r.value="";try{n.value=await B.getCourseEventJoinInfo(g,E)}catch(t){console.error("Error loading join details:",t),r.value=t.message||"Couldn't verify your access."}finally{S.value=!1}}},J=async()=>{if(f.value.trim()){x.value=!0,r.value="";try{n.value=await B.getCourseEventJoinInfoByToken(z,f.value.trim())}catch(t){console.error("Error unlocking join details:",t),r.value=t.message||"Couldn't unlock the join details."}finally{x.value=!1}}},q=async()=>{var t;try{await navigator.clipboard.writeText(((t=n.value)==null?void 0:t.joinPassword)||""),_.value=!0,setTimeout(()=>{_.value=!1},2e3)}catch(e){console.error("Clipboard write failed:",e)}},F=()=>N.login_oauth("google",!1);return Y(async()=>{await G(),y.value&&(await I(),j.value==="token"&&!n.value&&(r.value=""))}),Z(y,async t=>{t&&j.value==="auth"&&!n.value&&await I()}),(t,e)=>{const $=c("Toast"),O=c("ProgressSpinner"),P=c("Message"),i=c("Button"),M=c("router-link"),Q=c("InputText"),R=c("Card");return a(),l(ee,null,[s($,{position:"top-right"}),o("div",le,[o("div",re,[s(R,null,{title:u(()=>[o("div",ie,[e[1]||(e[1]=o("span",{class:"tw-text-sm tw-font-normal tw-text-content-secondary"},"Course event access",-1)),o("span",null,w(V.value||"Event join details"),1)])]),content:u(()=>[k.value?(a(),l("p",ce,[e[2]||(e[2]=o("i",{class:"pi pi-calendar tw-mr-2"},null,-1)),b(w(C(A)(k.value))+" ",1),T.value?(a(),l("span",ue," â "+w(C(A)(T.value)),1)):p("",!0)])):p("",!0),S.value?(a(),l("div",de,[s(O,{style:{width:"28px",height:"28px"}}),e[3]||(e[3]=o("span",{class:"tw-text-content-secondary"},"Checking your accessâ¦",-1))])):n.value?(a(),l("div",we,[s(P,{severity:"success",closable:!1},{default:u(()=>[...e[4]||(e[4]=[b(" Access verified â these details are exclusive to course members. Please don't share them. ",-1)])]),_:1}),n.value.joinLink?(a(),l("div",ve,[o("a",{href:n.value.joinLink,target:"_blank",rel:"noopener noreferrer"},[s(i,{label:"Join the event now",icon:"pi pi-video",class:"tw-w-full"})],8,pe),n.value.joinPassword?(a(),l("div",fe,[o("div",me,[e[5]||
1(e[5]=o("span",{class:"tw-text-xs tw-text-content-secondary tw-uppercase"},"Meeting password",-1)),o("code",ge,w(n.value.joinPassword),1)]),s(i,{label:_.value?"Copied!":"Copy",icon:_.value?"pi pi-check":"pi pi-copy",size:"small",outlined:"",onClick:q},null,8,["label","icon"])])):p("",!0),n.value.notes?(a(),l("p",ye,w(n.value.notes),1)):p("",!0)])):(a(),te(P,{key:1,severity:"info",closable:!1},{default:u(()=>[...e[6]||(e[6]=[b(" The organizer hasn't added the meeting link yet â check back closer to the event. ",-1)])]),_:1})),o("div",he,[U.value?(a(),l("a",{key:0,href:U.value,target:"_blank",rel:"noopener noreferrer"},[s(i,{label:"Add to Google Calendar",icon:"pi pi-calendar-plus",size:"small",outlined:""})],8,xe)):p("",!0),s(M,{to:`/course/${C(g)}`},{default:u(()=>[s(i,{label:"Back to the course",icon:"pi pi-arrow-left",size:"small",text:""})]),_:1},8,["to"])])])):j.value==="token"?(a(),l("div",_e,[e[7]||(e[7]=o("p",{class:"tw-m-0 tw-text-content-secondary"}," Enter the personal event password from your reminder email to reveal the join details. ",-1)),o("form",{class:"tw-flex tw-flex-col tw-gap-3",onSubmit:oe(J,["prevent"])},[s(Q,{modelValue:f.value,"onUpdate:modelValue":e[0]||(e[0]=W=>f.value=W),placeholder:"Personal event password",autocomplete:"off",class:"tw-w-full"},null,8,["modelValue"]),s(i,{type:"submit",label:x.value?"Unlockingâ¦":"Unlock join details",icon:"pi pi-lock-open",loading:x.value,disabled:!f.value.trim()},null,8,["label","loading","disabled"])],32),r.value?(a(),l("p",ke,w(r.value),1)):p("",!0),e[8]||(e[8]=o("p",{class:"tw-m-0 tw-text-xs tw-text-content-secondary"}," Lost the email? Sign in and open this page from the course instead. ",-1))])):y.value?(a(),l("div",Ce,[s(P,{severity:"warn",closable:!1},{default:u(()=>[b(w(r.value||"Only course members can view these join details."),1)]),_:1}),o("div",Ee,[s(M,{to:`/course/${C(g)}`},{default:u(()=>[s(i,{label:"Go to the course",icon:"pi pi-arrow-right",size:"small"})]),_:1},8,["to"]),s(i,{label:"Try again",icon:"pi pi-refresh",size:"small",outlined:"",onClick:I})])])):(a(),l("div",be,[e[9]||(e[9]=o("p",{class:"tw-m-0 tw-text-content-secondary"}," Sign in with the account that owns this course to reveal the join details. ",-1)),s(i,{label:"Sign in with Google",icon:"pi pi-google",onClick:F})]))]),_:1})])])],64)}}};export{Ve as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.