"use strict";exports.id=67926,exports.ids=[67926],exports.modules={59699:(a,b,c)=>{c.d(b,{AM:()=>o,Ei:()=>u,MX:()=>h,OE:()=>i,R3:()=>j,Tf:()=>r,_u:()=>n,je:()=>k,kT:()=>t,kv:()=>p,mr:()=>v,oP:()=>l,qQ:()=>w,qw:()=>m,v0:()=>q,wg:()=>s});var d=c(23971),e=c(40433);let f=/\[\[series:[^\]]+\]\]/gi,g=/\[\[series-range:[^\]]+\]\]/gi,h=a=>{let b=String(a.description||"").match(/\[\[series:([a-f0-9-]{8,})\]\]/i);return b?.[1]||null},i=a=>String(a||"").replace(f,"").replace(g,"").trim(),j=[{value:"ZOOM",label:"Zoom"},{value:"GOOGLE_MEET",label:"Google Meet"},{value:"OTHER",label:"Other"}],k={ZOOM:"https://zoom.us/j/...",GOOGLE_MEET:"https://meet.google.com/abc-defg-hij",OTHER:"https://..."};function l(a){if(!a)return"Other";let b=j.find(b=>b.value===a);return b?.label??a.replace(/_/g," ")}function m(a){let b=String(a||"").trim();if(!b)return"";if(/^([01]\d|2[0-3]):[0-5]\d$/.test(b))return b;let c=b.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(!c)return"";let d=parseInt(c[1],10),e=parseInt(c[2],10),f=c[3].toUpperCase();return Number.isNaN(d)||Number.isNaN(e)?"":("AM"===f?12===d&&(d=0):12!==d&&(d+=12),`${String(d).padStart(2,"0")}:${String(e).padStart(2,"0")}`)}let n=async a=>{try{let b=(await d.uE.get(e.Sn.LIVE_CLASSES.LIST,{params:a})).data;if(b?.success)return{data:b.data??[],pagination:b.pagination??{page:1,limit:10,total:0,pages:0}};throw Error("Failed to fetch live classes")}catch(a){throw Error((0,d.hS)(a))}},o=async a=>{try{let{refreshKey:b,...c}=a||{},e=(await d.uE.get("/live-classes/my-available",{params:{...c,_t:b??Date.now()}})).data;if(e?.success)return{data:e.data??[],pagination:e.pagination??{page:1,limit:10,total:0,pages:0}};throw Error("Failed to fetch available live classes")}catch(a){throw Error((0,d.hS)(a))}},p=async a=>{try{let b=(await d.uE.get("/live-classes/me/manage",{params:a})).data;if(b?.success)return{data:b.data??[],pagination:b.pagination??{page:1,limit:10,total:0,pages:0}};throw Error("Failed to fetch managed live classes")}catch(a){throw Error((0,d.hS)(a))}},q=async a=>{try{let b=await d.uE.get(e.Sn.LIVE_CLASSES.BY_ID(a));return(0,d.yH)(b)}catch(a){throw Error((0,d.hS)(a))}},r=async a=>{try{let b=await d.uE.post(e.Sn.LIVE_CLASSES.LIST,a);return(0,d.yH)(b)}catch(a){throw Error((0,d.hS)(a))}},s=async(a,b)=>{try{let c=await d.uE.put(e.Sn.LIVE_CLASSES.BY_ID(a),b);return(0,d.yH)(c)}catch(a){throw Error((0,d.hS)(a))}},t=async a=>{try{await d.uE.delete(e.Sn.LIVE_CLASSES.BY_ID(a))}catch(a){throw Error((0,d.hS)(a))}},u=async a=>{try{let b=await d.uE.post(e.Sn.LIVE_CLASSES.CANCEL_SERIES(a));return(0,d.yH)(b)}catch(a){throw Error((0,d.hS)(a))}},v=async a=>{try{let b=(await d.uE.get("/live-classes/me/enrollments",{params:a})).data;if(b?.success)return{data:b.data??[],pagination:b.pagination??{page:1,limit:10,total:0,pages:0}};throw Error("Failed to fetch enrollments")}catch(a){throw Error((0,d.hS)(a))}},w=async a=>{try{let b=await d.uE.post(`${e.Sn.LIVE_CLASSES.LIST}/${a}/enroll`);return(0,d.yH)(b)}catch(a){throw Error((0,d.hS)(a))}}},67926:(a,b,c)=>{c.r(b),c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(19099),g=c(59699),h=c(306);function i({params:a}){let b=(0,e.use)(a);(0,f.useRouter)();let{isAuthenticated:c}=(0,h.As)(),i=b.id,[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!0),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1);return((0,e.useCallback)(async()=>{if(i){o(null),m(!0);try{let a=await g.v0(i);k(a)}catch(a){o(a instanceof Error?a.message:"Failed to load live class"),k(null)}finally{m(!1)}}},[i]),(0,e.useCallback)(async()=>{if(c&&i){s(!0);try{let a=((await g.mr({limit:100})).data??[]).some(a=>a.liveClassId===i);q(a)}catch{q(!1)}finally{s(!1)}}},[c,i]),l)?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-20",children:[(0,d.jsx)("div",{className:"w-12 h-12 border-4 border-[var(--primary-600)] border-t-transparent rounded-full animate-spin"}),(0,d.jsx)("p",{className:"mt-4 text-[var(--muted-foreground)]",children:"Loading live class..."})]}):null}c(40433),c(91115)}};