PageSourceSearch

https://hudumacna.com/static/js/5486.0898639f.chunk.js

js hudumacna.com collected 2026-10-09 22:40:12 UTC 101,034 bytes, 2 lines download raw bytes

1/*! For license information please see 5486.0898639f.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkstudent_management_app=self.webpackChunkstudent_management_app||[]).push([[5486],{606:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},10449:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},12496:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},13061:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},17026:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},22177:(e,t,s)=>{s.d(t,{A:()=>i});var a=s(9950),l=s(91523),n=s(44414);function i(e){let{value:t="",documentName:s,onSave:i}=e;const[d,r]=(0,a.useState)(!1),[o,c]=(0,a.useState)(t),[m,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)(""),p=async()=>{x(!0),h("");try{await i((0,l.vk)(o)),r(!1)}catch(e){h(e.message||"Unable to save tag. Please try again.")}finally{x(!1)}};return d?(0,n.jsxs)("div",{className:"mt-2",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("label",{className:"block text-xs font-medium text-slate-700",children:["Tag for ",s,(0,n.jsx)("input",{autoFocus:!0,value:o,maxLength:l.zq,disabled:m,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),m||p()),"Escape"!==e.key||m||r(!1)},placeholder:"e.g. Verified or Needs signature",className:"mt-1 block w-full max-w-sm rounded border border-slate-300 bg-white px-2 py-1.5 text-sm"})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Leave empty to remove the tag."}),(0,n.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:m,onClick:p,className:"rounded bg-blue-700 px-3 py-1.5 text-xs font-semibold text-white disabled:opacity-50",children:m?"Saving\u2026":"Save tag"}),(0,n.jsx)("button",{type:"button",disabled:m,onClick:()=>r(!1),className:"rounded border border-slate-300 px-3 py-1.5 text-xs font-semibold text-slate-700",children:"Cancel"})]}),u&&(0,n.jsx)("p",{role:"alert",className:"mt-1 text-xs text-red-700",children:u})]}):t||i?(0,n.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 text-xs",children:[t&&(0,n.jsx)("span",{className:"max-w-full break-words rounded-full bg-blue-100 px-2.5 py-1 font-medium text-blue-800",children:t}),i&&(0,n.jsx)("button",{type:"button","aria-label":`${t?"Edit":"Add"} tag for ${s}`,onClick:()=>{c(t),h(""),r(!0)},className:"rounded px-1 py-1 font-semibold text-blue-700 underline hover:text-blue-900",children:t?"Edit tag":"Add tag"})]}):null}},24980:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},35193:(e,t,s)=>{s.d(t,{A:()=>d});s(9950);var a=s(73814),l=s(45532),n=s(51412),i=s(44414);function d(){const{permissionsLoaded:e,isDisabled:t,hasAccess:s}=(0,l.As)();if(!e||t)return null;const d=n.bP.filter(e=>s(e.key));return d.length?(0,i.jsxs)("nav",{"aria-label":"Granted sections",className:"mb-6 rounded-xl border border-slate-200 bg-white p-4 sm:p-5",children:[(0,i.jsx)("h2",{className:"text-sm font-semibold text-slate-950",children:"Section access"}),(0,i.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Open the sections enabled for your account."}),(0,i.jsx)("div",{className:"mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:d.map(e=>(0,i.jsxs)(a.N_,{to:n.Zz[e.key],className:"flex min-h-11 items-center justify-between gap-3 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-semibold text-[#123b69] hover:border-blue-300 hover:bg-blue-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600",children:[e.label,(0,i.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},e.key))})]}):null}},36493:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},37488:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]])},37841:(e,t,s)=>{s.d(t,{A:()=>a});
2const a=(0,s(7101).A)("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]])},38284:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},38686:(e,t,s)=>{s.r(t),s.d(t,{default:()=>z,printAttendanceRecord:()=>L});var a=s(9950),l=s(73814),n=s(37488),i=s(606),d=s(37841),r=s(40859),o=s(12434),c=s(3045),m=s(47288),x=s(56790),u=s(8261),h=s(76087),p=s(17026),b=s(43654),g=s(36493),f=s(7101);const v=(0,f.A)("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]),j=(0,f.A)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);var y=s(42861),N=s(13061),w=s(38284),k=s(56600),A=s(45532),C=s(89665),I=s(35193),S=s(44414);const $=[{id:"schedule",label:"My Schedule",icon:n.A},{id:"students",label:"My Students",icon:i.A},{id:"attendance",label:"Attendance",icon:d.A},{id:"exams",label:"Class Exams",icon:r.A},{id:"content",label:"Teaching Content",icon:o.A},{id:"documents",label:"Class Documents",icon:c.A,permission:"academicDocuments"}],D={agencyName:"Washington State Board of Nursing",trainingName:"Nursing Assistant Training",contactEmail:"[email protected]",documentTitle:"Student Attendance Record",additionalPagesNote:"Note: Use additional pages as needed.",revisionText:"Updated: Dec 2024",datesPerPage:5,studentsPerPage:15},T=e=>new Date(e).toLocaleDateString("en-US",{weekday:"long",month:"short",day:"numeric",year:"numeric"}),M=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;const t=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(e)),s=e=>{var s;return(null===(s=t.find(t=>t.type===e))||void 0===s?void 0:s.value)||""};return`${s("year")}-${s("month")}-${s("day")}`},P=e=>new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}),R=(e,t)=>((null===e||void 0===e?void 0:e.students)||[]).filter(e=>"inactive"!==String(e.status||"").trim().toLowerCase()&&(e.scheduleSeriesId===t.seriesId||e.scheduleId===t.id)),E=e=>{if(!e)return"\u2014";const t=new Date(`${String(e).slice(0,10)}T12:00:00`);if(Number.isNaN(t.getTime()))return"\u2014";const s=new Date;let a=s.getFullYear()-t.getFullYear();return(s.getMonth()<t.getMonth()||s.getMonth()===t.getMonth()&&s.getDate()<t.getDate())&&
2(a-=1),a>=0?a:"\u2014"},U=e=>String(null!==e&&void 0!==e?e:"").replace(/[&<>'"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"}[e])),_=(e,t,s)=>{const a=document.createElement("iframe");a.style.cssText="position:fixed;width:0;height:0;border:0;right:0;bottom:0",document.body.appendChild(a);const l=t.map((e,t)=>`<tr><td>${t+1}</td><td><strong>${U(e.name)}</strong></td><td>${U((e=>{const t=String(e||"").trim();return t?t.charAt(0).toUpperCase():"\u2014"})(e.gender))}</td><td></td></tr>`).join("");a.contentDocument.open(),a.contentDocument.write(`<!doctype html><html><head><title>Class Roster</title><style>@page{margin:.5in}*{box-sizing:border-box}body{font-family:Arial,sans-serif;color:#162033;margin:0}.letterhead{display:flex;align-items:center;gap:16px;border-bottom:3px solid #123b69;padding-bottom:14px;margin-bottom:7px}.logo{width:64px;height:64px;object-fit:contain}.brand{flex:1}.brand h1{font-size:19px;line-height:1.2;margin:0;color:#123b69}.brand p{margin:4px 0 0;font-size:10px;color:#52606d}.docline{display:flex;justify-content:space-between;align-items:end;margin:18px 0}.docline h2{font-size:17px;margin:0}.docline span{font-size:9px;text-transform:uppercase;letter-spacing:.1em;color:#667085}.meta{display:grid;grid-template-columns:1fr 1fr;gap:9px 28px;margin-bottom:22px;padding:14px;background:#f4f6f8;border-left:3px solid #123b69}.meta div{font-size:12px}.meta b{display:block;color:#52606d;font-size:9px;text-transform:uppercase;letter-spacing:.08em;margin-bottom:3px}table{width:100%;border-collapse:collapse;font-size:11px}th{background:#123b69;color:white;text-align:left;padding:9px 8px}td{border:1px solid #ccd4dc;padding:9px 8px;height:42px}th:first-child,td:first-child{width:34px;text-align:center}th:nth-child(3),td:nth-child(3){width:72px;text-align:center}th:last-child,td:last-child{width:210px}footer{display:flex;justify-content:space-between;border-top:1px solid #ccd4dc;margin-top:20px;padding-top:9px;font-size:9px;color:#667085}</style></head><body><header class="letterhead"><img class="logo" src="${window.location.origin}/official-logo.png" alt=""><div class="brand"><h1>Caregiver Training &amp; Huduma Center LLC</h1><p>30821 Pacific Hwy S, STE A, Federal Way, WA 98003</p><p>(206) 460-9022 &nbsp;\xb7&nbsp; [email protected] &nbsp;\xb7&nbsp; hudumacna.com</p></div></header><div class="docline"><h2>Instructor Class Roster</h2><span>Official training record</span></div><div class="meta"><div><b>Program / Cohort</b>${U(e.title)}</div><div><b>Class day</b>Day ${U(e.seriesPosition)}</div><div><b>Date and time</b>${U(T(e.startAt))}, ${U(P(e.startAt))}\u2013${U(P(e.endAt))}</div><div><b>Instructor</b>${U(s||"\u2014")}</div><div><b>Location</b>${U(e.location||"\u2014")}</div><div><b>Total students</b>${t.length}</div></div><table><thead><tr><th>#</th><th>Student full name</th><th>Gender</th><th>Attendance / Notes</th></tr></thead><tbody>${l||'<tr><td colspan="4">No enrolled students</td></tr>'}</tbody></table><footer><span>Caregiver Training &amp; Huduma Center LLC</span><span>Printed ${U((new Date).toLocaleString())}</span></footer></body></html>`),a.contentDocument.close(),a.onload=()=>{a.contentWindow.focus(),a.contentWindow.print(),setTimeout(()=>a.remove(),1e3)}},L=e=>{let{session:t,schedules:s,students:a,attendanceRows:l,template:n}=e;if(!t)return;s=Array.isArray(s)?s:[],a=Array.isArray(a)?a:[],l=Array.isArray(l)?l:[];const i={...D,...n||{}},d=Math.max(1,Math.min(5,Number(i.datesPerPage)||5)),r=Math.max(1,Math.min(15,Number(i.studentsPerPage)||15)),o=t.seriesId||t.id,c=s.filter(e=>(e.seriesId||e.id)===o).sort((e,t)=>new Date(e.startAt)-new Date(t.startAt)),m=Array.from({length:Math.max(1,Math.ceil(c.length/d))},(e,t)=>c.slice(t*d,t*d+d)),x=Array.from({length:Math.max(1,Math.ceil(a.length/r))},(e,t)=>a.slice(t*r,t*r+r)),u=new Map(l.map(e=>[`${e.sessionId}_${e.studentId}`,e])),h=m.flatMap(e=>x.map(t=>{const s=Array.from({length:d},(t,s)=>{const a=e[s];return`<th>${a?`${U(new Date(a.startAt).toLocaleDateString("en-US",{month:"numeric",day:"numeric",year:"2-digit"}))}<span class="instructor-name">${U((e=>
2{const t=String(e||"").trim().split(/\s+/).filter(Boolean);return t.length?1===t.length?t[0]:`${t[0]} ${t[t.length-1].charAt(0).toUpperCase()}.`:"\u2014"})(a.instructor))}</span>`:"Date"}</th>`}).join(""),a=Array.from({length:r},(s,a)=>{const l=t[a],n=Array.from({length:d},(t,s)=>{var a,n;if(!l||!e[s])return"<td></td>";const i=u.get(`${e[s].id}_${l.id}`);return null!==i&&void 0!==i&&null!==(a=i.studentSignature)&&void 0!==a&&a.image?`<td><img src="${i.studentSignature.image}" alt="Student signature"></td>`:null!==i&&void 0!==i&&null!==(n=i.studentSignature)&&void 0!==n&&n.initials?`<td class="initials">${U(i.studentSignature.initials)}</td>`:"<td></td>"}).join("");return`<tr><td>${a+1}</td><td class="student-name">${l?U(l.name):""}</td>${n}</tr>`}).join("");return`<section class="page"><header><img class="wabon-logo" src="${window.location.origin}/wabon-logo.png" alt="${U(i.agencyName)}"><div class="agency"><strong>${U(i.agencyName)}</strong><br>${U(i.trainingName)}<br><a href="mailto:${U(i.contactEmail)}">${U(i.contactEmail)}</a></div></header><table><thead><tr><th class="record-title" colspan="${d+2}">${U(i.documentTitle)}</th></tr><tr><th class="number">#</th><th class="student-name">Students' Names</th>${s}</tr></thead><tbody>${a}</tbody></table><div class="note">${U(i.additionalPagesNote)}</div><div class="updated">${U(i.revisionText)}</div></section>`})).join(""),p=document.createElement("iframe");p.style.cssText="position:fixed;width:0;height:0;border:0;right:0;bottom:0",document.body.appendChild(p),p.contentDocument.open(),p.contentDocument.write(`<!doctype html><html><head><title>Student Attendance Record</title><style>@page{size:letter portrait;margin:.55in .6in}*{box-sizing:border-box}body{font-family:Arial,sans-serif;color:#111;margin:0}.page{min-height:9.85in;page-break-after:always;position:relative;padding-bottom:48px}.page:last-child{page-break-after:auto}header{display:flex;align-items:center;justify-content:space-between;margin:0 8px 16px}.wabon-logo{width:105px;height:61px;object-fit:contain}.agency{font-size:10px;line-height:1.35;text-align:left;min-width:245px}.agency strong{font-size:11px}.agency a{color:#2368a2;text-decoration:underline}table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:9px}th,td{border:1px solid #777;text-align:center;height:35px;padding:3px}th{font-weight:700;background:#f2f2f2}.instructor-name{display:block;margin-top:2px;text-align:right;font-size:7px;font-weight:600;color:#444}.record-title{height:31px;background:#d9d9d9;color:#1f5f9d;text-align:left;padding-left:10px;font-size:17px;font-style:italic}.number{width:27px}.student-name{width:190px;text-align:left;padding-left:7px}td img{display:block;width:100%;max-width:100%;height:29px;object-fit:contain;margin:auto}.initials{font-family:cursive;font-size:15px;font-style:italic;font-weight:700}.unsigned{color:#999;font-size:9px}.note{margin:7px 0 0 14px;font-size:9px}.updated{position:absolute;bottom:0;left:14px;font-size:9px}</style></head><body>${h}</body></html>`),p.contentDocument.close(),p.onload=()=>{p.contentWindow.focus(),p.contentWindow.print(),setTimeout(()=>p.remove(),1e3)}};function z(){var e,t,s,n,i;const d=(0,l.Zp)(),{sessionId:r,studentId:o,unitId:c}=(0,l.g)(),{user:b,profile:g,permissionsLoaded:f,hasAccess:v,logout:j}=(0,A.As)(),[y,N]=(0,a.useState)(null),[w,D]=(0,a.useState)(""),[M,P]=(0,a.useState)("schedule"),[E,U]=(0,a.useState)(!1),[_,L]=(0,a.useState)(""),[z,B]=(0,a.useState)(""),[H,Y]=(0,a.useState)(""),[Q,J]=(0,a.useState)({}),X=$.filter(e=>!e.permission||v(e.permission));(0,a.useEffect)(()=>{"documents"!==M||v("academicDocuments")||P("schedule")},[M,v]);const ee=async()=>{try{D(""),N(await(0,k.Ij)("getTutorDashboard"))}catch(e){D(e.message||"Unable to load the instructor portal.")}};(0,a.useEffect)(()=>{b&&"tutor"===(null===g||void 0===g?void 0:g.role)&&ee()},[b,g]),(0,a.useEffect)(()=>{if(!b||"tutor"!==(null===g||void 0===g?void 0:g.role)||"exams"!==M)return;const e=window.setInterval(()=>{(0,k.Ij)("getTutorDashboard").then(N).catch(()=>{})},15e3);return()=>window.clearInterval(e)},[b,g,M]);const te=(0,a.useMemo)(()=>[...(null===y||void 0===y?void 0:y.schedules)||[]].sort((e,t)=>
2new Date(e.startAt)-new Date(t.startAt)),[y]),se=(0,a.useMemo)(()=>{const e=new Map;return te.forEach(t=>{const s=t.seriesId||t.id;e.has(s)||e.set(s,{id:s,title:t.title,sessions:[]}),e.get(s).sessions.push(t)}),[...e.values()]},[te]),ae=te.find(e=>e.id===H)||te[0],le=ae?R(y,ae):[];if((0,a.useEffect)(()=>{ae&&!H&&Y(ae.id)},[ae,H]),(0,a.useEffect)(()=>{if(!ae)return;const e=Object.fromEntries(((null===y||void 0===y?void 0:y.attendance)||[]).filter(e=>e.sessionId===ae.id).map(e=>[e.studentId,{status:e.status,notes:e.notes||""}]));J(e)},[ae,y]),!b)return(0,S.jsx)(l.C5,{to:"/login",replace:!0});if(f&&"tutor"!==(null===g||void 0===g?void 0:g.role))return(0,S.jsx)(l.C5,{to:"/dashboard",replace:!0});if(w||!y)return(0,S.jsxs)("main",{className:"mx-auto min-h-screen max-w-6xl bg-gray-50 px-4 py-7 sm:px-6 lg:px-8",children:[(0,S.jsx)(I.A,{}),w?(0,S.jsxs)("div",{className:"py-10 text-center",children:[(0,S.jsx)("p",{role:"alert",className:"text-red-700",children:w}),(0,S.jsx)("button",{onClick:ee,className:"mt-3 text-[#123b69] underline",children:"Try again"})]}):(0,S.jsxs)("div",{role:"status",className:"flex items-center justify-center py-10 text-sm text-gray-600",children:[(0,S.jsx)(m.A,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading instructor portal\u2026"]})]});const ne=e=>{(r||o)&&d("/tutor"),P(e),U(!1),L("")},ie=r?te.find(e=>e.id===r):null,de=o?y.students.find(e=>e.id===o):null;return(0,S.jsxs)("div",{className:"min-h-screen bg-[#f7f8fa] lg:flex",children:[(0,S.jsx)("aside",{className:"fixed inset-y-0 left-0 z-40 w-64 border-r border-slate-200 bg-white transition-transform duration-200 lg:sticky lg:top-0 lg:h-screen lg:translate-x-0 "+(E?"translate-x-0":"-translate-x-full"),children:(0,S.jsxs)("div",{className:"flex h-full flex-col",children:[(0,S.jsxs)("div",{className:"flex h-24 items-center gap-3 px-5",children:[(0,S.jsx)("img",{src:"/official-logo.png",alt:"Caregiver Training & Huduma Center",className:"h-12 w-12 object-contain"}),(0,S.jsxs)("div",{className:"min-w-0",children:[(0,S.jsx)("p",{className:"truncate text-sm font-semibold text-slate-950",children:"Instructor Portal"}),(0,S.jsx)("p",{className:"mt-0.5 truncate text-[11px] text-slate-500",children:"Caregiver Training & Huduma"})]}),(0,S.jsx)("button",{onClick:()=>U(!1),className:"ml-auto rounded-md p-1 text-slate-500 hover:bg-slate-100 lg:hidden",children:(0,S.jsx)(x.A,{className:"h-5 w-5"})})]}),(0,S.jsx)("div",{className:"mx-5 border-t border-slate-100"}),(0,S.jsx)("nav",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto px-3 py-5",children:X.map(e=>{let{id:t,label:s,icon:a}=e;return(0,S.jsxs)("button",{onClick:()=>ne(t),className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-sm font-medium transition-colors "+(M===t?"bg-[#edf4fa] text-[#123b69]":"text-slate-600 hover:bg-slate-50 hover:text-slate-950"),children:[(0,S.jsx)(a,{className:"h-[18px] w-[18px]"}),s]},t)})}),(0,S.jsxs)("div",{className:"m-3 rounded-lg bg-slate-50 p-3",children:[(0,S.jsx)("p",{className:"truncate text-sm font-medium text-slate-900",children:(null===(e=y.profile)||void 0===e?void 0:e.displayName)||"Instructor"}),(0,S.jsx)("p",{className:"mt-0.5 truncate text-xs text-slate-500",children:(null===(t=y.profile)||void 0===t?void 0:t.email)||b.email||""}),(0,S.jsxs)("button",{onClick:j,className:"mt-3 flex items-center gap-2 text-xs font-medium text-slate-500 hover:text-slate-950",children:[(0,S.jsx)(u.A,{className:"h-4 w-4"}),"Sign out"]})]})]})}),E&&(0,S.jsx)("button",{"aria-label":"Close menu",onClick:()=>U(!1),className:"fixed inset-0 z-30 bg-black/30 lg:hidden"}),(0,S.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,S.jsxs)("header",{className:"sticky top-0 z-20 border-b border-slate-200/80 bg-white/95 backdrop-blur",children:[(0,S.jsxs)("div",{className:"flex h-16 items-center px-4 lg:px-8",children:[(0,S.jsx)("button",{onClick:()=>U(!0),"aria-label":"Open instructor menu",className:"mr-3 rounded-md p-1.5 text-slate-600 hover:bg-slate-100 lg:hidden",children:(0,S.jsx)(h.A,{className:"h-5 w-5"})}),(0,S.jsxs)("div",{className:"mx-auto flex w-full max-w-6xl items-center justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h1",{className:"text-sm font-semibold text-slate-950",children:o?"Student academic profile":r?"Cohort details":null===(s=X.find(e=>e.id===M))||void 0===s?void 0:s.label}),(0,S.jsx)("p",{className:"text-xs text-slate-500",children:"Instructor workspace"})]}),(0,S.jsx)("p",{className:"hidden text-xs text-slate-500 sm:block",children:(null===(n=y.profile)||void 0===n?void 0:n.displayName)||"Instructor"})]})]}),(0,S.jsx)("nav",{"aria-label":"Instructor features",className:"overflow-x-auto border-t border-slate-100 px-3 lg:px-8",children:(0,S.jsx)("div",{className:"mx-auto flex w-max min-w-full max-w-6xl gap-1 py-2",children:X.map(e=>{let{id:t,label:s,icon:a}=e;return(0,S.jsxs)("button",{type:"button",onClick:()=>ne(t),"aria-current":r||o||M!==t?void 0:"page",className:"flex shrink-0 items-center gap-2 rounded-md px-3 py-2 text-xs font-semibold transition-colors "+(r||o||M!==t?"text-slate-600 hover:bg-slate-100 hover:text-slate-950":"bg-[#123b69] text-white"),children:[(0,S.jsx)(a,{className:"h-4 w-4"}),s]},`quick-${t}`)})})})]}),(0,S.jsxs)("main",{className:"mx-auto w-full max-w-6xl px-4 py-7 sm:px-6 lg:px-8 lg:py-10",children:[(0,S.jsx)(I.A,{}),_&&(0,S.jsxs)("div",{className:"mb-6 flex items-start gap-2 border-l-2 border-[#123b69] bg-white px-4 py-3 text-sm text-slate-700 shadow-sm",children:[(0,S.jsx)(p.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-[#123b69]"}),_]}),c?(0,S.jsx)(K,{students:y.students||[]}):o?de?(0,S.jsx)(V,{student:de,data:y,back:()=>d("/tutor"),onSaved:ee}):(0,S.jsx)(q,{children:"This student is not part of a cohort assigned to you."}):r?ie?(0,S.jsx)(O,{session:ie,students:R(y,ie),instructor:null===(i=y.profile)||void 0===i?void 0:i.displayName,back:()=>d("/tutor"),openStudent:e=>d(`/tutor/student/${e}`)}):(0,S.jsx)(q,{children:"This assigned class day was not found or is no longer assigned to you."}):(0,S.jsxs)(S.Fragment,{children:["schedule"===M&&(0,S.jsx)(F,{cohorts:se,data:y,openSession:e=>d(`/tutor/class/${e}`)}),"students"===M&&(0,S.jsx)(Z,{cohorts:se,data:y,openStudent:e=>d(`/tutor/student/${e}`)}),"attendance"===M&&(0,S.jsx)(W,{schedules:te,session:ae,setSession:Y,roster:le,attendance:Q,setAttendance:J,markAll:e=>J(Object.fromEntries(le.map(t=>[t.id,{...Q[t.id]||{},status:e}]))),save:async()=>
2{if(!ae||!le.length)return;const e=le.filter(e=>{var t;return!(null!==(t=Q[e.id])&&void 0!==t&&t.status)});if(e.length)L(`Choose an attendance status for all students. ${e.length} still unmarked.`);else{B("attendance"),L("");try{const e=le.map(e=>({studentId:e.id,status:Q[e.id].status,notes:Q[e.id].notes||""}));await(0,k.Ij)("recordTutorAttendance",{sessionId:ae.id,records:e}),L(`Attendance saved for ${e.length} students.`),await ee()}catch(t){L(t.message||"Unable to save attendance.")}finally{B("")}}},busy:"attendance"===z,attendanceRows:y.attendance||[],sendSignatureLink:async e=>{if(ae&&e){B(`signature_${e.id}`),L("");try{await(0,k.Ij)("sendStudentAttendanceSignatureRequest",{sessionId:ae.id,studentId:e.id}),L(`A secure attendance signing link was emailed to ${e.email}. No login is required.`),await ee()}catch(t){L(t.message||"Unable to email the signing link.")}finally{B("")}}},sendAllSignatureLinks:async e=>{if(ae&&e.length){B("signature_all"),L("");try{const t=await(0,k.Ij)("sendStudentAttendanceSignatureRequests",{sessionId:ae.id,studentIds:e.map(e=>e.id)});L(`${t.emailsSent} of ${t.students} attendance signing links were emailed for ${T(ae.startAt)}.`),await ee()}catch(t){L(t.message||"Unable to email the signing links.")}finally{B("")}}},signatureBusy:z,signatureRequests:y.signatureRequests||[],learningPlans:y.learningPlans||[]}),"exams"===M&&(0,S.jsx)(G,{schedules:te,data:y,activate:async function(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";B(e.id),L("");try{const l=await(0,k.Ij)("activateCohortExam",{examId:t.id,cohortId:e.seriesId,sessionId:e.id,accessMinutes:t.durationMinutes||60,resend:s,studentId:a||null});L(`${t.title} was activated and started for ${l.students} ${1===l.students?"student":"students"}. Available in ${l.portalAvailable||l.students} student ${1===l.students?"portal":"portals"}; ${l.emailsSent} backup email ${1===l.emailsSent?"link":"links"} delivered.`),await ee()}catch(l){L(l.message||"Unable to activate this exam.")}finally{B("")}},resume:async(e,t)=>{B(`resume_${e.id}`),L("");try{const s=await(0,k.Ij)("resumeCohortExam",{sessionId:e.id,examId:t.id});L(`${t.title} resumed for ${s.students} unfinished ${1===s.students?"student":"students"}. Their saved answers and existing links were preserved; access remains open until the end of today.`),await ee()}catch(s){L(s.message||"Unable to resume this exam.")}finally{B("")}},activateRetake:async(e,t,s)=>{if(e&&t&&s){B(`retake_${e.id}_${t.id}`),L("");try{const a=await(0,k.Ij)("resendFailedStudentExam",{studentId:e.id,examId:t.id,retakeExamId:s});L(`Retake activated for ${e.name||e.email}. It is available in the student portal until ${new Date(a.closesAt).toLocaleString()}.`),await ee()}catch(a){L(a.message||"Unable to activate this student's retake.")}finally{B("")}}},busy:z}),"content"===M&&(0,S.jsx)(K,{students:y.students||[]}),"documents"===M&&v("academicDocuments")&&(0,S.jsx)(C.default,{})]})]})]})]})}function q(e){let{children:t}=e;return(0,S.jsx)("div",{className:"border border-dashed border-slate-300 bg-white px-6 py-14 text-center text-sm text-slate-500",children:t})}function B(e){let{title:t,copy:s}=e;return(0,S.jsxs)("div",{className:"mb-7",children:[(0,S.jsx)("h2",{className:"text-2xl font-semibold tracking-tight text-slate-950",children:t}),(0,S.jsx)("p",{className:"mt-1.5 max-w-2xl text-sm leading-6 text-slate-500",children:s})]})}function F(e){let{cohorts:t,data:s,openSession:a}=e;return(0,S.jsxs)("div",{children:[(0,S.jsx)(B,{title:"Assigned class days",copy:"Your schedule is based on individual teaching dates assigned by the administrator."}),(0,S.jsxs)("div",{className:"space-y-5",children:[t.map(e=>(0,S.jsxs)("section",{className:"overflow-hidden border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"flex items-end justify-between gap-4 border-b border-slate-100 px-5 py-4 sm:px-6",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:e.title}),(0,S.jsxs)("p",{className:"mt-1 text-xs text-slate-500",children:[R(s,e.sessions[0]).length," enrolled students"]})]}),(0,S.jsxs)("p",{className:"text-xs font-medium text-slate-500",children:[e.sessions.length," assigned"," ",1===e.sessions.length?"day":"days"]})]}),(0,S.jsx)("div",{className:"divide-y divide-slate-100",children:e.sessions.map(e=>(0,S.jsxs)("button",{onClick:()=>a(e.id),className:"grid w-full gap-2 px-5 py-4 text-left transition-colors hover:bg-slate-50 sm:grid-cols-[1fr_auto] sm:items-center sm:px-6",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("p",{className:"text-sm font-medium text-slate-900",children:[(0,S.jsxs)("span",{className:"mr-2 text-[#123b69]",children:["Day ",e.seriesPosition]}),T(e.startAt)]}),(0,S.jsxs)("p",{className:"mt-1.5 text-xs text-slate-500",children:[P(e.startAt),"\u2013",P(e.endAt)," \xb7"," ",e.location||"Location not set"]})]}),(0,S.jsxs)("span",{className:"flex items-center gap-3 text-xs font-medium capitalize text-slate-500",children:[e.status,(0,S.jsx)(b.A,{className:"h-4 w-4"})]})]},e.id))})]},e.id)),!t.length&&(0,S.jsx)(q,{children:"No class dates are assigned to you yet."})]})]})}function O(e){let{session:t,students:s,instructor:a,back:l,openStudent:n}=e;return(0,S.jsxs)("div",{children:[(0,S.jsxs)("button",{onClick:l,className:"mb-6 inline-flex items-center gap-2 text-sm font-medium text-slate-600 hover:text-[#123b69]",children:[(0,S.jsx)(g.A,{className:"h-4 w-4"}),"Back to my schedule"]}),(0,S.jsxs)("div",{className:"flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-[#123b69]",children:"Assigned cohort"}),(0,S.jsx)("h2",{className:"mt-2 text-2xl font-semibold tracking-tight text-slate-950",children:t.title}),(0,S.jsxs)("p",{className:"mt-1.5 text-sm text-slate-500",children:["Day ",t.seriesPosition," \xb7 ",T(t.startAt)," \xb7"," ",P(t.startAt),"\u2013",P(t.endAt)]})]}),(0,S.jsxs)("button",{onClick:()=>_(t,s,a),className:"inline-flex items-center justify-center gap-2 rounded-md bg-[#123b69] px-4 py-2.5 text-sm font-medium text-white hover:bg-[#0e3158]",children:[(0,S.jsx)(v,{className:"h-4 w-4"}),"Print student list"]})]}),(0,S.jsxs)("div",{className:"mt-7 grid grid-cols-1 gap-px border border-slate-200 bg-slate-200 sm:grid-cols-3",children:[(0,S.jsx)(H,{label:"Instructor",value:a||"Not set"}),(0,S.jsx)(H,{label:"Location",value:t.location||"Not set"}),(0,S.jsx)(H,{label:"Students",value:`${s.length} enrolled`})]}),(0,S.jsxs)("section",{className:"mt-6 overflow-hidden border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"border-b border-slate-100 px-5 py-4 sm:px-6",children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Student list"}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Select a student to review academic progress and support needs."})]}),(0,S.jsx)("div",{className:"overflow-x-auto",children:(0,S.jsxs)("table",{className:"w-full min-w-[520px] text-left text-sm",children:[(0,S.jsx)("thead",{className:"bg-slate-50 text-xs uppercase tracking-wide text-slate-500",children:(0,S.jsxs)("tr",{children:[(0,S.jsx)("th",{className:"w-14 px-5 py-3 font-semibold",children:"#"}),(0,S.jsx)("th",{className:"px-3 py-3 font-semibold",children:"First and last name"}),(0,S.jsx)("th",{className:"w-28 px-3 py-3 font-semibold",children:"Age"}),(0,S.jsx)("th",{className:"w-36 px-3 py-3 font-semibold",children:"Gender"}),(0,S.jsx)("th",{className:"w-24 px-3 py-3",children:(0,S.jsx)("span",{className:"sr-only",children:"Open"})})]})}),(0,S.jsxs)("tbody",{className:"divide-y divide-slate-100",children:[s.map((e,t)=>(0,S.jsxs)("tr",{className:"hover:bg-slate-50",children:[(0,S.jsx)("td",{className:"px-5 py-4 text-slate-400",children:t+1}),(0,S.jsx)("td",{className:"px-3 py-4 font-medium text-slate-900",children:e.name}),(0,S.jsx)("td",{className:"px-3 py-4 text-slate-700",children:E(e.dateOfBirth)}),(0,S.jsx)("td",{className:"px-3 py-4 capitalize text-slate-700",children:e.gender||"\u2014"}),(0,S.jsx)("td",{className:"px-3 py-4",children:(0,S.jsxs)("button",{onClick:()=>n(e.id),className:"inline-flex items-center gap-1 text-xs font-semibold text-[#123b69]",children:["View",(0,S.jsx)(b.A,{className:"h-4 w-4"})]})})]},e.id)),!s.length&&(0,S.jsx)("tr",{children:(0,S.jsx)("td",{colSpan:"5",className:"px-5 py-12 text-center text-slate-500",children:"No students are enrolled in this cohort."})})]})]})})]})]})}function H(e){let{label:t,value:s}=e;return(0,S.jsxs)("div",{className:"bg-white px-5 py-3 sm:px-6",children:[(0,S.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-400",children:t}),(0,S.jsx)("p",{className:"mt-1 truncate text-sm font-medium text-slate-800",children:s})]})}
2function Z(e){let{cohorts:t,data:s,openStudent:a}=e;return(0,S.jsxs)("div",{children:[(0,S.jsx)(B,{title:"Assigned students",copy:"Open an academic profile to review performance, weaknesses, attendance, and support plans."}),(0,S.jsxs)("div",{className:"space-y-5",children:[t.map(e=>{const t=R(s,e.sessions[0]);return(0,S.jsxs)("section",{className:"overflow-hidden border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"flex items-end justify-between border-b border-slate-100 px-5 py-4 sm:px-6",children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:e.title}),(0,S.jsxs)("p",{className:"text-xs text-slate-500",children:[t.length," students"]})]}),(0,S.jsxs)("div",{className:"divide-y divide-slate-100",children:[t.map(e=>(0,S.jsxs)("button",{onClick:()=>a(e.id),className:"flex w-full items-center justify-between gap-3 px-5 py-3.5 text-left hover:bg-slate-50 sm:px-6",children:[(0,S.jsxs)("div",{className:"min-w-0",children:[(0,S.jsx)("p",{className:"truncate text-sm font-medium text-slate-900",children:e.name}),(0,S.jsx)("p",{className:"mt-0.5 truncate text-xs text-slate-500",children:e.email||"No email on file"})]}),(0,S.jsxs)("span",{className:"flex items-center gap-2 text-xs capitalize text-slate-500",children:[e.status||"active",(0,S.jsx)(b.A,{className:"h-4 w-4"})]})]},e.id)),!t.length&&(0,S.jsx)("p",{className:"p-6 text-sm text-slate-500",children:"No students are enrolled in this cohort."})]})]},e.id)}),!t.length&&(0,S.jsx)(q,{children:"No assigned cohorts are available."})]})]})}function V(e){let{student:t,data:s,back:l,onSaved:n}=e;const i=(0,a.useMemo)(()=>(s.attempts||[]).filter(e=>e.studentId===t.id).sort((e,t)=>new Date(t.submittedAt||0)-new Date(e.submittedAt||0)),[s.attempts,t.id]),d=(0,a.useMemo)(()=>(s.attendance||[]).filter(e=>e.studentId===t.id),[s.attendance,t.id]),r=(0,a.useMemo)(()=>(s.support||[]).filter(e=>e.studentId===t.id).sort((e,t)=>new Date(t.updatedAt||t.createdAt||0)-new Date(e.updatedAt||e.createdAt||0)),[s.support,t.id]),o=(0,a.useMemo)(()=>{const e=new Map;return i.forEach(t=>(t.weaknessAreas||[]).forEach(t=>{const s=e.get(t.label)||{...t,occurrences:0,missed:0,total:0};s.occurrences+=1,s.missed+=Number(t.missed||0),s.total+=Number(t.total||0),s.guidance=t.guidance,e.set(t.label,s)})),[...e.values()].sort((e,t)=>t.occurrences-e.occurrences||t.missed-e.missed)},[i]),c=(0,a.useMemo)(()=>{const e=new Map;return i.forEach(t=>{e.has(t.examId)||e.set(t.examId,t)}),[...e.values()]},[i]),x=c.length?Math.round(c.reduce((e,t)=>e+Number(t.scorePercent||0),0)/c.length):null,u=c.filter(e=>e.passed).length,h=d.filter(e=>"present"===e.status||"late"===e.status).length,p=d.length?Math.round(h/d.length*100):null,[b,f]=(0,a.useState)({supportId:"",category:"academic_coaching",status:"open",summary:"",actionPlan:"",followUpDate:""}),[v,w]=(0,a.useState)(!1),[A,C]=(0,a.useState)(""),[I,$]=(0,a.useState)({}),[D,T]=(0,a.useState)(""),M=e=>{var t;return(null===(t=s.exams.find(t=>t.id===e))||void 0===t?void 0:t.title)||"Program exam"};return(0,S.jsxs)("div",{children:[(0,S.jsxs)("button",{onClick:l,className:"mb-6 inline-flex items-center gap-2 text-sm font-medium text-slate-600 hover:text-[#123b69]",children:[(0,S.jsx)(g.A,{className:"h-4 w-4"}),"Back to assigned students"]}),(0,S.jsxs)("div",{className:"border-b border-slate-200 pb-6",children:[(0,S.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-[#123b69]",children:"Academic performance"}),(0,S.jsx)("h2",{className:"mt-2 text-2xl font-semibold tracking-tight text-slate-950",children:t.name}),(0,S.jsxs)("p",{className:"mt-1.5 text-sm text-slate-500",children:[t.email||"No email on file"," \xb7"," ",t.status||"Active student"]})]}),D&&(0,S.jsx)("p",{className:"mt-5 border-l-2 border-[#123b69] bg-white px-4 py-3 text-sm text-slate-700",children:D}),(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-px border border-slate-200 bg-slate-200 sm:grid-cols-4",children:[(0,S.jsx)(H,{label:"Current average",value:null==x?"No exams":`${x}%`}),(0,S.jsx)(H,{label:"Exams passed",value:`${u} of ${c.length}`}),(0,S.jsx)(H,{label:"Attendance",value:null==p?"Not recorded":`${p}%`}),(0,S.jsx)(H,{label:"Open support",value:String(r.filter(e=>"completed"!==e.status).length)})]}),(0,S.jsxs)("div",{className:"mt-7 grid gap-6 xl:grid-cols-[minmax(0,1.25fr)_minmax(320px,.75fr)]",children:[(0,S.jsxs)("div",{className:"space-y-6",children:[(0,S.jsxs)("section",{className:"border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"border-b border-slate-100 px-5 py-4",children:[(0,S.jsxs)("h3",{className:"flex items-center gap-2 font-semibold text-slate-950",children:[(0,S.jsx)(j,{className:"h-4 w-4 text-[#123b69]"}),"Exam performance"]}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Scores and attempts only. Questions and answer keys remain protected."})]}),(0,S.jsxs)("div",{className:"divide-y divide-slate-100",children:[i.map(e=>{const a=s.exams.find(t=>
2t.id===e.examId),l=c.some(t=>t.id===e.id)&&!e.passed&&"retake"!==(null===a||void 0===a?void 0:a.examType),d=s.exams.filter(t=>"retake"===t.examType&&t.retakeForExamId===e.examId&&"published"===t.status&&!i.some(e=>e.examId===t.id));return(0,S.jsxs)("div",{className:"flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center",children:[(0,S.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,S.jsx)("p",{className:"text-sm font-medium text-slate-900",children:M(e.examId)}),(0,S.jsxs)("p",{className:"mt-1 text-xs text-slate-500",children:[e.submittedAt?new Date(e.submittedAt).toLocaleString():"Date unavailable"," ","\xb7 Attempt ",e.attemptNumber,null!==a&&void 0!==a&&a.maxAttempts?` of ${a.maxAttempts}`:""]})]}),(0,S.jsxs)("span",{className:"text-sm font-semibold "+(e.passed?"text-emerald-700":"text-red-700"),children:[e.scorePercent,"%"]}),(0,S.jsx)("span",{className:"w-fit px-2 py-1 text-[10px] font-bold uppercase "+(e.passed?"bg-emerald-50 text-emerald-700":"bg-red-50 text-red-700"),children:e.passed?"Passed":"Needs review"}),l&&(0,S.jsxs)("div",{className:"flex shrink-0 flex-col gap-2 sm:flex-row",children:[(0,S.jsxs)("select",{value:I[e.examId]||"",onChange:t=>$(s=>({...s,[e.examId]:t.target.value})),className:"h-9 rounded-md border border-slate-300 bg-white px-2 text-xs","aria-label":`Choose retake version for ${M(e.examId)}`,children:[(0,S.jsx)("option",{value:"",children:"Choose retake exam"}),(0,S.jsxs)("option",{value:e.examId,children:["Same exam \u2014 ",M(e.examId)]}),d.map(e=>(0,S.jsx)("option",{value:e.id,children:e.title},e.id))]}),(0,S.jsxs)("button",{disabled:A===e.examId,onClick:()=>(async e=>{const s=I[e.examId];if(s){C(e.examId),T("");try{const a=await(0,k.Ij)("resendFailedStudentExam",{studentId:t.id,examId:e.examId,retakeExamId:s});T(`Retake activated for ${a.email}. It is now available in the student portal until ${new Date(a.closesAt).toLocaleString()}.${a.emailDelivered?" The access email was sent.":" Portal access is active, but the backup email could not be delivered."}`),await n()}catch(a){T(a.message||"Unable to activate this retake.")}finally{C("")}}else T("Choose the same exam or a published retake version first.")})(e),className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-md border border-[#123b69] px-3 py-2 text-xs font-semibold text-[#123b69] hover:bg-[#edf4fa] disabled:opacity-50",children:[A===e.examId&&(0,S.jsx)(m.A,{className:"h-3.5 w-3.5 animate-spin"}),"Activate retake"]})]})]},e.id)}),!i.length&&(0,S.jsx)("p",{className:"px-5 py-10 text-center text-sm text-slate-500",children:"No exam attempts recorded yet."})]})]}),(0,S.jsxs)("section",{className:"border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"border-b border-slate-100 px-5 py-4",children:[(0,S.jsxs)("h3",{className:"flex items-center gap-2 font-semibold text-slate-950",children:[(0,S.jsx)(y.A,{className:"h-4 w-4 text-[#123b69]"}),"Learning needs"]}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Recurring weakness areas calculated from marked attempts."})]}),(0,S.jsxs)("div",{className:"divide-y divide-slate-100",children:[o.map(e=>(0,S.jsxs)("div",{className:"px-5 py-4",children:[(0,S.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,S.jsx)("p",{className:"text-sm font-semibold text-slate-900",children:e.label}),(0,S.jsxs)("span",{className:"shrink-0 text-xs text-slate-500",children:["Seen in ",e.occurrences," ",1===e.occurrences?"attempt":"attempts"]})]}),(0,S.jsx)("p",{className:"mt-2 text-sm leading-6 text-slate-600",children:e.guidance}),(0,S.jsx)("p",{className:"mt-2 text-xs font-medium text-[#123b69]",children:"Instructor action: review this topic, demonstrate the skill, check understanding, then document the follow-up plan."})]},e.label)),!o.length&&(0,S.jsx)("p",{className:"px-5 py-10 text-center text-sm text-slate-500",children:"No weakness areas have been identified."})]})]}),(0,S.jsxs)("section",{className:"border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"border-b border-slate-100 px-5 py-4",children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Support history"}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Academic interventions and follow-up recorded by assigned instructors."})]}),(0,S.jsxs)("div",{className:"divide-y divide-slate-100",children:[r.map(e=>(0,S.jsxs)("button",{onClick:()=>(e=>
2f({supportId:e.id,category:e.category,status:e.status,summary:e.summary,actionPlan:e.actionPlan,followUpDate:e.followUpDate||""}))(e),className:"block w-full px-5 py-4 text-left hover:bg-slate-50",children:[(0,S.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,S.jsx)("p",{className:"text-sm font-semibold capitalize text-slate-900",children:e.category.replaceAll("_"," ")}),(0,S.jsx)("span",{className:"text-xs capitalize text-slate-500",children:e.status.replaceAll("_"," ")})]}),(0,S.jsx)("p",{className:"mt-2 text-sm text-slate-700",children:e.summary}),(0,S.jsxs)("p",{className:"mt-2 text-xs text-slate-500",children:["Plan: ",e.actionPlan,e.followUpDate?` \xb7 Follow up ${e.followUpDate}`:""," ","\xb7 ",e.createdByName]})]},e.id)),!r.length&&(0,S.jsx)("p",{className:"px-5 py-10 text-center text-sm text-slate-500",children:"No academic support has been recorded."})]})]})]}),(0,S.jsxs)("aside",{className:"h-fit border border-slate-200 bg-white xl:sticky xl:top-24",children:[(0,S.jsxs)("div",{className:"border-b border-slate-100 px-5 py-4",children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:b.supportId?"Update support plan":"Add student support"}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Record what was observed, how you will assist, and when progress will be reviewed."})]}),(0,S.jsxs)("div",{className:"space-y-4 p-5",children:[(0,S.jsxs)("label",{className:"block text-xs font-semibold text-slate-600",children:["Support type",(0,S.jsxs)("select",{value:b.category,onChange:e=>f({...b,category:e.target.value}),className:"mt-1.5 w-full rounded-md border border-slate-300 px-3 py-2.5 text-sm font-normal text-slate-900",children:[(0,S.jsx)("option",{value:"academic_coaching",children:"Academic coaching"}),(0,S.jsx)("option",{value:"remediation",children:"Skill remediation"}),(0,S.jsx)("option",{value:"exam_preparation",children:"Exam preparation"}),(0,S.jsx)("option",{value:"attendance_support",children:"Attendance support"})]})]}),(0,S.jsxs)("label",{className:"block text-xs font-semibold text-slate-600",children:["Status",(0,S.jsxs)("select",{value:b.status,onChange:e=>f({...b,status:e.target.value}),className:"mt-1.5 w-full rounded-md border border-slate-300 px-3 py-2.5 text-sm font-normal text-slate-900",children:[(0,S.jsx)("option",{value:"open",children:"Open"}),(0,S.jsx)("option",{value:"in_progress",children:"In progress"}),(0,S.jsx)("option",{value:"completed",children:"Completed"})]})]}),(0,S.jsxs)("label",{className:"block text-xs font-semibold text-slate-600",children:["Observation",(0,S.jsx)("textarea",{rows:"3",value:b.summary,onChange:e=>f({...b,summary:e.target.value}),placeholder:"Describe the performance concern or improvement observed.",className:"mt-1.5 w-full rounded-md border border-slate-300 px-3 py-2.5 text-sm font-normal text-slate-900"})]}),(0,S.jsxs)("label",{className:"block text-xs font-semibold text-slate-600",children:["Assistance plan",(0,S.jsx)("textarea",{rows:"4",value:b.actionPlan,onChange:e=>f({...b,actionPlan:e.target.value}),placeholder:"Example: review transfer safety, demonstrate the skill, then complete a verbal knowledge check.",className:"mt-1.5 w-full rounded-md border border-slate-300 px-3 py-2.5 text-sm font-normal text-slate-900"})]}),(0,S.jsxs)("label",{className:"block text-xs font-semibold text-slate-600",children:["Follow-up date",(0,S.jsx)("input",{type:"date",value:b.followUpDate,onChange:e=>f({...b,followUpDate:e.target.value}),className:"mt-1.5 w-full rounded-md border border-slate-300 px-3 py-2.5 text-sm font-normal text-slate-900"})]}),(0,S.jsxs)("div",{className:"flex gap-2",children:[(0,S.jsxs)("button",{disabled:v||!b.summary.trim()||!b.actionPlan.trim(),onClick:async()=>{w(!0),T("");try{await(0,k.Ij)("saveTutorStudentSupport",{studentId:t.id,...b}),T("Student support plan saved."),f({supportId:"",category:"academic_coaching",status:"open",summary:"",actionPlan:"",followUpDate:""}),await n()}catch(e){T(e.message||"Unable to save this support plan.")}finally{w(!1)}},className:"inline-flex flex-1 items-center justify-center gap-2 rounded-md bg-[#123b69] px-4 py-2.5 text-sm font-medium text-white disabled:opacity-40",children:[v?(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}):(0,S.jsx)(N.A,{className:"h-4 w-4"}),"Save support plan"]}),b.supportId&&(0,S.jsx)("button",{onClick:()=>f({supportId:"",category:"academic_coaching",status:"open",summary:"",actionPlan:"",followUpDate:""}),className:"rounded-md border border-slate-300 px-3 text-sm text-slate-600",children:"Cancel"})]})]})]})]})]})}function W(e){var t,s;let{schedules:l,session:n,setSession:i,roster:d,attendanceRows:r,sendSignatureLink:o,sendAllSignatureLinks:c,signatureBu
2sy:x,signatureRequests:u,learningPlans:h}=e;const[p,b]=(0,a.useState)(!1),[g,f]=(0,a.useState)(""),[j,y]=(0,a.useState)(!1),[N,w]=(0,a.useState)(""),A=h.find(e=>e.sessionId===(null===n||void 0===n?void 0:n.id));(0,a.useEffect)(()=>{var e;f((null===A||void 0===A||null===(e=A.reflection)||void 0===e?void 0:e.reflection)||""),w("")},[null===n||void 0===n?void 0:n.id,null===A||void 0===A||null===(t=A.reflection)||void 0===t?void 0:t.reflection]);const C=e=>{var t;return r.some(t=>t.sessionId===(null===n||void 0===n?void 0:n.id)&&t.studentId===e&&t.studentSignature)?"signed":(null===(t=u.find(t=>t.sessionId===(null===n||void 0===n?void 0:n.id)&&t.studentId===e))||void 0===t?void 0:t.status)||"not_sent"},I=d.filter(e=>"signed"!==C(e.id)),$=d.filter(e=>"signed"===C(e.id)),D=d.length-I.length,R=null!==n&&void 0!==n&&n.startAt?M(n.startAt):"",E=M(),U=(null===n||void 0===n?void 0:n.cohortEndAt)&&new Date(n.cohortEndAt).getTime()>=Date.now(),_=Boolean(R&&R<=E&&U),z=R===E;return(0,S.jsxs)("div",{children:[(0,S.jsx)(B,{title:"Record attendance",copy:"Attendance is recorded against the exact class date assigned to you."}),l.length?(0,S.jsxs)("section",{className:"overflow-hidden border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"border-b border-slate-100 p-5 sm:p-6",children:[(0,S.jsxs)("div",{className:"mb-5 flex flex-col gap-3 border-b border-slate-100 pb-5 sm:flex-row sm:items-center sm:justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-sm font-semibold text-slate-900",children:"Student Attendance Record"}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Tutor-managed cohort record with five class dates and a student signature for each date."})]}),(0,S.jsxs)("button",{type:"button",onClick:async()=>{if(n&&d.length){b(!0);try{const e=await(0,k.Ij)("getTutorAttendancePrintRecord",{seriesId:n.seriesId||null,sessionId:n.id});L({session:n,schedules:e.schedules||l,students:d,attendanceRows:e.attendance||[],template:e.template})}finally{b(!1)}}},disabled:!n||!d.length||p,className:"inline-flex items-center justify-center gap-2 rounded-md border border-slate-300 bg-white px-3.5 py-2 text-xs font-semibold text-slate-700 hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:[p?(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}):(0,S.jsx)(v,{className:"h-4 w-4"}),p?"Preparing record\u2026":"Print attendance record"]})]}),(0,S.jsxs)("label",{className:"block text-xs font-semibold uppercase tracking-wide text-slate-500",children:["Class date",(0,S.jsx)("select",{value:(null===n||void 0===n?void 0:n.id)||"",onChange:e=>i(e.target.value),className:"mt-2 block w-full rounded-md border border-slate-300 bg-white px-3 py-2.5 text-sm font-normal normal-case tracking-normal text-slate-900 outline-none focus:border-[#123b69] focus:ring-1 focus:ring-[#123b69] sm:max-w-xl",children:l.map(e=>(0,S.jsxs)("option",{value:e.id,children:[e.title," \u2014 Day ",e.seriesPosition," \u2014"," ",T(e.startAt)]},e.id))})]}),(0,S.jsxs)("section",{className:"mt-5 border border-slate-200 bg-slate-50 p-4",children:[(0,S.jsxs)("p",{className:"text-sm font-semibold text-slate-900",children:["Day ",(null===n||void 0===n?void 0:n.seriesPosition)||1," learning reflection"]}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-600",children:"Planned units are mapped automatically from the published curriculum for this program day."}),(0,S.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[((null===A||void 0===A?void 0:A.units)||[]).map(e=>(0,S.jsx)("span",{className:"border border-blue-200 bg-white px-2.5 py-1 text-xs font-medium text-blue-800",children:e.title},e.id)),!(null!==A&&void 0!==A&&null!==(s=A.units)&&void 0!==s&&s.length)&&(0,S.jsx)("span",{className:"text-xs text-amber-700",children:"No published curriculum units are mapped to this day yet."})]}),(0,S.jsxs)("label",{className:"mt-4 block text-xs font-semibold text-slate-700",children:["What was covered today?",(0,S.jsx)("textarea",{value:g,onChange:e=>f(e.target.value),rows:4,maxLength:3e3,placeholder:"Summarize topics covered, demonstrations, practice, and anything students should review.",className:"mt-2 w-full border border-slate-300 bg-white p-3 text-sm font-normal"})]}),(0,S.jsxs)("div",{className:"mt-3 flex items-center gap-3",children:[(0,S.jsxs)("button",{type:"button",onClick:async()=>
2{if(n){y(!0),w("");try{await(0,k.Ij)("saveTutorClassReflection",{sessionId:n.id,reflection:g}),w("Daily reflection saved for students in this cohort.")}catch(e){w(e.message||"Unable to save reflection.")}finally{y(!1)}}},disabled:j,className:"inline-flex items-center gap-2 bg-[#123b69] px-4 py-2 text-sm font-semibold text-white disabled:opacity-50",children:[j&&(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),"Save reflection"]}),N&&(0,S.jsx)("span",{className:"text-xs text-slate-600",children:N})]})]}),(0,S.jsxs)("div",{className:"mt-5 flex flex-col gap-3 border-t border-slate-100 pt-5 sm:flex-row sm:items-center sm:justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-sm font-semibold text-slate-900",children:"Request attendance signatures"}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-600",children:z?`Requests send automatically at ${null!==n&&void 0!==n&&n.endAt?P(new Date(new Date(n.endAt).getTime()-72e5)):"two hours before class ends"}. You can still send or resend them manually.`:_?"This is a previous class day in an active cohort. You can send or resend requests only to students who have not signed.":R>E?"Signature requests become available on this assigned class date.":"This cohort has completed, so missed-day signature requests are closed."}),(0,S.jsxs)("p",{className:"mt-2 text-xs font-semibold text-slate-700",children:[D," of ",d.length," students signed"]}),$.length>0&&(0,S.jsxs)("p",{className:"mt-1 max-w-2xl text-xs leading-5 text-emerald-700",children:["Signed:"," ",$.map(e=>e.name).join(", ")]})]}),(0,S.jsxs)("button",{type:"button",onClick:()=>c(I),disabled:!_||!I.length||"signature_all"===x,className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-md bg-[#123b69] px-4 py-2.5 text-sm font-semibold text-white hover:bg-[#0e3158] disabled:opacity-50",children:["signature_all"===x&&(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),"signature_all"===x?"Sending requests\u2026":"Send request to all"]})]})]}),(0,S.jsxs)("div",{className:"divide-y divide-gray-100",children:[d.map(e=>(0,S.jsxs)("div",{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[(0,S.jsxs)("div",{className:"min-w-0",children:[(0,S.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,S.jsx)("p",{className:"truncate text-sm font-medium text-gray-900",children:e.name}),"inactive"===String(e.status||"").toLowerCase()&&(0,S.jsx)("span",{className:"rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-slate-600",children:"Inactive"}),(0,S.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide "+("signed"===C(e.id)?"bg-emerald-100 text-emerald-800":"pending"===C(e.id)?"bg-amber-100 text-amber-800":"bg-slate-100 text-slate-600"),children:"signed"===C(e.id)?"Signed":"pending"===C(e.id)?"Request sent":"Not sent"})]}),(0,S.jsx)("p",{className:"truncate text-xs text-gray-500",children:e.email})]}),(0,S.jsxs)("button",{type:"button",onClick:()=>o(e),disabled:!_||"signed"===C(e.id)||x===`signature_${e.id}`,className:"inline-flex w-fit items-center justify-center whitespace-nowrap rounded-md border border-[#123b69] px-3 py-2 text-xs font-semibold text-[#123b69] hover:bg-blue-50 disabled:opacity-50",children:[x===`signature_${e.id}`&&(0,S.jsx)(m.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"signed"===C(e.id)?"Signed":"pending"===C(e.id)?"Resend request":"Send request"]})]},e.id)),!d.length&&(0,S.jsx)("p",{className:"p-8 text-center text-sm text-gray-500",children:"No students are enrolled for this class date."})]})]}):(0,S.jsx)(q,{children:"No assigned class dates are available."})]})}function G(e){let{schedules:t,data:s,activate:l,resume:n,activateRetake:i,busy:d}=e;const[r,o]=(0,a.useState)({}),[c,x]=(0,a.useState)({}),[u,h]=(0,a.useState)(""),b=t.filter(e=>M(e.startAt)===M()),g=e=>String(e||"").toLowerCase().replace(/[^a-z0-9]/g,"").replace("hcacnabridgeprogram","hcacnabridge");return(0,S.jsxs)("div",{children:[(0,S.jsx)(B,{title:"Today\u2019s quizzes and exams",copy:"Review the questions and verified answers for your assigned class days, monitor cohort performance, and activate student access."}),(0,S.jsxs)("div",{className:"mb-5 border-l-2 border-emerald-600 bg-emerald-50 px-4 py-3 text-sm text-emerald-900",children:[(0,S.jsx)("strong",{children:"Today\u2019s cohort only."})," Only a cohort assigned to you and meeting today can be activated. Access is issued only to that cohort\u2019s eligible student roster."]}),(0,S.jsxs)("div",{className:"divide-y divide-slate-100 border border-slate-200 bg-white",children:[b.map(e=>{var t;const a=(e=>{const t=s.exams.filter(t=>"retake"!==t.examType&&"published"===t.status&&Number(t.dayNumber)===Number(e.seriesPosition)).sort((e,t)=>
2e.isCurrent!==t.isCurrent?e.isCurrent?-1:1:String(t.updatedAt||"").localeCompare(String(e.updatedAt||""))),a=t.find(t=>g(t.programId)===g(e.moduleId));if(a)return a;const l=new Set(R(s,e).map(e=>g(e.programId)).filter(Boolean));return t.find(e=>l.has(g(e.programId)))||(1===t.length?t[0]:void 0)})(e),b=R(s,e).filter(e=>!a||!e.programId||e.programId===a.programId),f="published"===(null===a||void 0===a?void 0:a.status),v=a&&(s.activations||[]).some(t=>t.sessionId===e.id&&t.examId===a.id),j=a&&(s.activations||[]).some(t=>t.sessionId===e.id&&t.examId===a.id&&"active"===t.status&&new Date(t.closesAt||0).getTime()>Date.now()),y=a?((e,t,a)=>{const l=new Set(a.map(e=>e.id)),n=new Map;(s.attempts||[]).filter(t=>(t.examId===e.id||t.originalExamId===e.id)&&l.has(t.studentId)).sort((e,t)=>Number(t.attemptNumber||0)-Number(e.attemptNumber||0)).forEach(e=>{n.has(e.studentId)||n.set(e.studentId,e)});const i=[...n.values()],d=i.length?Math.round(i.reduce((e,t)=>e+Number(t.scorePercent||0),0)/i.length):null,r=i.filter(e=>e.passed).length;return{results:i,average:d,passed:r,total:a.length,session:t}})(a,e,b):null,N=(null===y||void 0===y?void 0:y.results.filter(e=>!e.passed))||[];return(0,S.jsxs)("section",{className:"p-5 sm:p-6",children:[(0,S.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("p",{className:"font-semibold text-slate-950",children:[e.title," ",(0,S.jsxs)("span",{className:"font-medium text-[#123b69]",children:["\xb7 Day ",e.seriesPosition]})]}),(0,S.jsxs)("p",{className:"mt-1 text-sm text-slate-500",children:[T(e.startAt)," \xb7 ",P(e.startAt),"\u2013",P(e.endAt)]}),a?(0,S.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm text-slate-700",children:[(0,S.jsxs)("span",{children:[a.title," \xb7 ",a.questionCount," questions \xb7"," ",a.durationMinutes," minutes"]}),(0,S.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide "+(f?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"),children:f?"Published":"Awaiting publication"}),v&&(0,S.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide "+(j?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"),children:j?"Exam active":"Previously activated"})]}):(0,S.jsx)("p",{className:"mt-2 text-sm text-amber-700",children:"No exam has been configured for this program day."})]}),a&&(0,S.jsxs)("div",{className:"w-full shrink-0 space-y-2 sm:w-80",children:[(0,S.jsxs)("button",{disabled:!f||d===e.id||d===`resume_${e.id}`,onClick:()=>v?n(e,a):l(e,a,!1),className:"inline-flex w-full items-center justify-center gap-2 rounded-md bg-[#123b69] px-4 py-2.5 text-sm font-medium text-white hover:bg-[#0e3158] disabled:cursor-not-allowed disabled:bg-slate-200 disabled:text-slate-500",children:[(d===e.id||d===`resume_${e.id}`)&&(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),f?v?"Resume exam with saved answers":"Activate & start exam":"Awaiting publication"]}),v&&(0,S.jsx)("button",{disabled:!f||d===e.id||d===`resume_${e.id}`,onClick:()=>l(e,a,!0),className:"inline-flex w-full items-center justify-center rounded-md border border-slate-300 bg-white px-4 py-2 text-xs font-semibold text-slate-700 disabled:opacity-50",children:"Resend unused student links"}),(0,S.jsxs)("div",{className:"flex gap-2",children:[(0,S.jsxs)("select",{"aria-label":`Select an individual student for ${a.title}`,value:r[e.id]||"",onChange:t=>o(s=>({...s,[e.id]:t.target.value})),disabled:!f||d===e.id,className:"min-w-0 flex-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-xs disabled:bg-slate-100",children:[(0,S.jsx)("option",{value:"",children:"Select one student\u2026"}),b.map(e=>(0,S.jsx)("option",{value:e.id,children:e.name||e.email},e.id))]}),(0,S.jsx)("button",{disabled:!f||d===e.id||!r[e.id],onClick:()=>l(e,a,!1,r[e.id]),className:"rounded-md border border-[#123b69] px-3 py-2 text-xs font-semibold text-[#123b69] disabled:border-slate-200 disabled:text-slate-400",children:"Activate for student"})]}),!b.length&&(0,S.jsx)("p",{className:"text-xs text-amber-700",children:"No eligible students are enrolled in this class."})]})]}),a&&(0,S.jsxs)("div",{className:"mt-5 border-t border-slate-200 pt-5",children:[(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,S.jsxs)("div",{className:"bg-slate-50 p-3",children:[(0,S.jsx)("p",{className:"text-xs text-slate-500",children:"Completed"}),(0,S.jsxs)("p",{className:"mt-1 text-lg font-semibold text-slate-950",children:[y.results.length,"/",y.total]})]}),(0,S.jsxs)("div",{className:"bg-slate-50 p-3",children:[(0,S.jsx)("p",{className:"text-xs text-slate-500",children:"Average score"}),(0,S.jsx)("p",{className:"mt-1 text-lg font-semibold text-slate-950",children:null==y.average?"\u2014":`${y.average}%`})]}),(0,S.jsxs)("div",{className:"bg-slate-50 p-3",children:[(0,S.jsx)("p",{className:"text-xs text-slate-500",children:"Passed"}),(0,S.jsx)("p",{className:"mt-1 text-lg font-semibold text-emerald-700",children:y.passed})]}),(0,S.jsxs)("div",{className:"bg-slate-50 p-3",children:[(0,S.jsx)("p",{className:"text-xs text-slate-500",children:"Pass mark"}),(0,S.jsxs)("p",{className:"mt-1 text-lg font-semibold text-slate-950",children:[a.passPercent||80,"%"]})]})]}),(0,S.jsxs)("section",{className:"mt-4 border border-red-200 bg-red-50/40",children:[(0,S.jsxs)("div",{className:"border-b border-red-200 px-4 py-3",children:[(0,S.jsx)("h4",{className:"text-sm font-semibold text-red-900",children:"Students who failed this day\u2019s exam"}),(0,S.jsx)("p",{className:"mt-1 text-xs text-red-700",children:"Choose the same exam or an alternate retake version, then activate access for that student only."})]}),(0,S.jsxs)("div",{className:"divide-y divide-red-100",children:[N.map(t=>{const l=b.find(e=>e.id===t.studentId),n=`${e.id}_${a.id}_${t.studentId}`,r=s.exams.filter(e=>"retake"===e.examType&&e.retakeForExamId===a.id&&"published"===e.status&&!(s.attempts||[]).some(s=>s.studentId===t.studentId&&s.examId===e.id)),o=d===`retake_${t.studentId}_${a.id}`,u=(s.activations||[]).some(e=>e.studentId===t.studentId&&e.originalExamId===a.id&&e.isRetake&&"active"===e.status&&new Date(e.closesAt||0).getTime()>Date.now());return(0,S.jsxs)("div",{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center",children:[(0,S.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,S.jsx)("p",{className:"text-sm font-semibold text-slate-900",children:(null===l||void 0===l?void 0:l.name)||(null===l||void 0===l?void 0:l.email)||"Student"}),(0,S.jsxs)("p",{className:"mt-0.5 text-xs text-red-700",children:["Failed with ",t.scorePercent,"% \xb7 Attempt"," ",t.attemptNumber]})]}),u?(0,S.jsxs)("span",{className:"inline-flex h-10 items-center justify-center gap-2 bg-emerald-100 px-4 text-xs font-bold text-emerald-800",children:[(0,S.jsx)(p.A,{className:"h-4 w-4"}),"Retake active"]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("select",{value:c[n]||"",onChange:e=>x(t=>({...t,[n]:e.target.value})),className:"h-10 min-w-0 border border-slate-300 bg-white px-2 text-xs sm:w-64",children:[(0,S.jsx)("option",{value:"",children:"Choose retake exam\u2026"}),(0,S.jsxs)("option",{value:a.id,children:["Same exam \u2014 ",a.title]}),r.map(e=>(0,S.jsx)("option",{value:e.id,children:e.title},e.id))]}),(0,S.jsxs)("button",{type:"button",disabled:o||!l||!c[n],onClick:()=>i(l,a,c[n]),className:"inline-flex h-10 items-center justify-center gap-2 bg-[#123b69] px-4 text-xs font-semibold text-white hover:bg-[#0e3158] disabled:opacity-40",children:[o&&(0,S.jsx)(m.A,{className:"h-3.5 w-3.5 animate-spin"}),"Activate retake"]})]})]},t.id)}),!N.length&&(0,S.jsx)("p",{className:"p-4 text-sm text-slate-500",children:"No students currently need a retake for this exam."})]})]}),(0,S.jsx)("button",{type:"button",onClick:()=>h(t=>t===`${e.id}_${a.id}`?"":`${e.id}_${a.id}`),className:"mt-4 inline-flex h-10 items-center justify-center border border-[#123b69] px-4 text-sm font-semibold text-[#123b69] hover:bg-blue-50",children:u===`${e.id}_${a.id}`?"Hide quiz review":"View questions, answers & results"}),u===`${e.id}_${a.id}`&&(0,S.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-[minmax(0,1.4fr)_minmax(260px,.6fr)]",children:[(0,S.jsxs)("div",{className:"divide-y divide-slate-200 border border-slate-200 bg-white",children:[(a.questions||[]).map((e,t)=>(0,S.jsxs)("article",{className:"p-4",children:[(0,S.jsxs)("p",{className:"font-semibold text-slate-950",children:[e.number||t+1,"."," ",e.prompt]}),(0,S.jsx)("div",{className:"mt-3 grid gap-2",children:(e.options||[]).map(t=>{const s=t.id===e.correctOptionId;return(0,S.jsxs)("div",{className:"flex gap-2 px-3 py-2 text-sm "+(s?"border border-emerald-300 bg-emerald-50 text-emerald-900":"bg-slate-50 text-slate-700"),
2children:[(0,S.jsxs)("strong",{children:[t.id,"."]}),(0,S.jsx)("span",{children:t.text}),s&&(0,S.jsx)("span",{className:"ml-auto shrink-0 text-xs font-bold uppercase",children:"Correct answer"})]},t.id)})})]},e.id)),!(null!==(t=a.questions)&&void 0!==t&&t.length)&&(0,S.jsx)("p",{className:"p-5 text-sm text-slate-500",children:"Questions are available only for class days assigned to your tutor account."})]}),(0,S.jsxs)("div",{className:"h-fit border border-slate-200 bg-white",children:[(0,S.jsxs)("div",{className:"border-b border-slate-200 p-4",children:[(0,S.jsx)("h4",{className:"font-semibold text-slate-950",children:"Latest student results"}),(0,S.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"The latest completed attempt for each student."})]}),(0,S.jsxs)("div",{className:"divide-y divide-slate-100",children:[y.results.map(e=>{const t=b.find(t=>t.id===e.studentId);return(0,S.jsxs)("div",{className:"flex items-center justify-between gap-3 p-4 text-sm",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"font-medium text-slate-900",children:(null===t||void 0===t?void 0:t.name)||(null===t||void 0===t?void 0:t.email)||"Student"}),(0,S.jsxs)("p",{className:"mt-0.5 text-xs text-slate-500",children:["Attempt ",e.attemptNumber]})]}),(0,S.jsxs)("span",{className:"font-semibold "+(e.passed?"text-emerald-700":"text-red-700"),children:[e.scorePercent,"%"]})]},e.id)}),!y.results.length&&(0,S.jsx)("p",{className:"p-4 text-sm text-slate-500",children:"No students have completed this quiz yet."})]})]})]})]})]},e.id)}),!b.length&&(0,S.jsx)(q,{children:"No cohort assigned to you is meeting today."})]})]})}function K(e){var t,s,n,i,d;let{students:r}=e;const c=(0,l.Zp)(),{unitId:x}=(0,l.g)(),[u,h]=(0,a.useState)(null),[p,f]=(0,a.useState)(null),[v,j]=(0,a.useState)(""),[y,N]=(0,a.useState)(""),[A,C]=(0,a.useState)(null),[I,$]=(0,a.useState)(!1);(0,a.useEffect)(()=>{(0,k.Ij)("getTutorContentBank").then(e=>h(e.units||[])).catch(e=>N(e.message||"Unable to load curriculum content."))},[]),(0,a.useEffect)(()=>{x&&(f({id:x,loading:!0}),(0,k.Ij)("getTutorContentUnit",{unitId:x}).then(e=>f(e.unit)).catch(e=>N(e.message||"Unable to open this curriculum unit.")))},[x]);const D=(u||[]).filter(e=>`${e.title} ${e.summary} ${(e.keywords||[]).join(" ")}`.toLowerCase().includes(v.toLowerCase()));return y?(0,S.jsx)(q,{children:y}):u?(0,S.jsxs)("div",{children:[!x&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(B,{title:"Curriculum Bank",copy:"Approved, source-grounded teaching guides synchronized from the CNA book."}),(0,S.jsxs)("label",{className:"relative mb-5 block sm:max-w-md",children:[(0,S.jsx)(w.A,{className:"absolute left-3 top-3 h-4 w-4 text-slate-400"}),(0,S.jsx)("input",{value:v,onChange:e=>j(e.target.value),placeholder:"Search chapters, topics, or keywords",className:"h-10 w-full border border-slate-300 bg-white pl-9 pr-3 text-sm"})]}),(0,S.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[D.map(e=>(0,S.jsxs)("button",{onClick:()=>(e=>c(`/tutor/content/${e.id}`))(e),className:"border border-slate-200 bg-white p-5 text-left hover:border-slate-400",children:[(0,S.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,S.jsx)("span",{className:"flex h-10 w-10 items-center justify-center border border-slate-200 bg-slate-50",children:(0,S.jsx)(o.A,{className:"h-4 w-4"})}),(0,S.jsx)("span",{className:"text-xs font-semibold text-[#123b69]",children:e.dayNumber?`Day ${e.dayNumber}`:e.chapterNumber?`Chapter ${e.chapterNumber}`:"Shared curriculum"})]}),(0,S.jsx)("h3",{className:"mt-4 font-semibold text-slate-950",children:e.title}),(0,S.jsx)("p",{className:"mt-2 line-clamp-3 text-sm leading-6 text-slate-600",children:e.summary}),(0,S.jsxs)("p",{className:"mt-4 flex items-center gap-1 text-xs font-semibold text-[#123b69]",children:["Open teaching guide",(0,S.jsx)(b.A,{className:"h-4 w-4"})]})]},e.id)),!D.length&&(0,S.jsx)("div",{className:"md:col-span-2",children:(0,S.jsx)(q,{children:"No published curriculum content matches this search."})})]})]}),p&&(0,S.jsxs)("div",{children:[(0,S.jsxs)("button",{onClick:()=>c("/tutor"),className:"mb-5 inline-flex items-center gap-2 text-sm font-semibold text-[#123b69]",children:[(0,S.jsx)(g.A,{className:"h-4 w-4"}),"Back to Curriculum Bank"]}),(0,S.jsxs)("article",{className:"border border-slate-200 bg-white",children:[(0,S.jsxs)("header",{className:"sticky top-0 z-10 flex items-center justify-between border-b bg-white p-5",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("p",{className:"text-xs font-semibold uppercase text-[#123b69]",children:["Approved curriculum",p.dayNumber?` \xb7 Day ${p.dayNumber}`:p.chapterNumber?` \xb7 Chapter ${p.chapterNumber}`:""]}),(0,S.jsx)("h2",{className:"mt-1 text-xl font-bold text-slate-950",children:p.title})]}),(0,S.jsx)("button",{onClick:()=>c("/tutor"),className:"text-sm text-slate-600",children:"Back"})]}),p.loading?(0,S.jsx)("div",{className:"flex justify-center p-20",children:(0,S.jsx)(m.A,{className:"h-6 w-6 animate-spin"})}):(0,S.jsxs)("div",{className:"space-y-7 p-5 sm:p-7",children:[(0,S.jsxs)("section",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Overview"}),(0,S.jsx)("p",{className:"mt-2 text-sm leading-7 text-slate-700",children:p.summary})]}),(0,S.jsx)(Y,{title:"Learning objectives",values:p.objectives}),(0,S.jsx)(Y,{title:"Chapter topics",values:p.topics}
2),(0,S.jsx)(Y,{title:"Student study guidance",values:p.studyGuide}),(0,S.jsx)(Y,{title:"Teaching and student-support ideas",values:p.teachingIdeas}),(0,S.jsx)(Y,{title:"Targeted remediation",values:p.remediationGuidance}),!(null===(t=p.teachingKnowledge)||void 0===t||!t.length)&&(0,S.jsxs)("section",{children:[(0,S.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Tutor intelligence library"}),(0,S.jsx)("p",{className:"mt-1 text-sm text-slate-600",children:"Pre-generated, source-grounded coaching insights available without a live AI connection."})]}),(0,S.jsxs)("span",{className:"bg-emerald-50 px-2 py-1 text-xs font-semibold text-emerald-700",children:["Offline ready \xb7 ",p.teachingKnowledge.length," ","insights"]})]}),(0,S.jsx)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:p.teachingKnowledge.map(e=>{var t;return(0,S.jsxs)("details",{className:"border border-slate-200 bg-slate-50 p-4",children:[(0,S.jsxs)("summary",{className:"cursor-pointer list-none",children:[(0,S.jsxs)("p",{className:"text-xs font-semibold uppercase text-[#123b69]",children:[e.nnaapDomain||"Source-grounded insight"," \xb7"," ",e.difficulty]}),(0,S.jsx)("h4",{className:"mt-1 text-sm font-semibold text-slate-950",children:e.title}),(0,S.jsx)("p",{className:"mt-2 line-clamp-3 text-sm leading-6 text-slate-600",children:e.teachingExplanation})]}),(0,S.jsxs)("div",{className:"mt-4 space-y-5 border-t border-slate-200 pt-4",children:[(0,S.jsx)("p",{className:"text-sm leading-7 text-slate-700",children:e.teachingExplanation}),(0,S.jsx)(Y,{title:"Clinical application",values:e.clinicalApplications}),(0,S.jsx)(Y,{title:"Warning signs",values:e.warningSigns}),(0,S.jsx)(Y,{title:"CNA scope guidance",values:e.scopeGuidance}),(0,S.jsx)(Y,{title:"Memory cues",values:e.memoryCues}),(0,S.jsx)(Y,{title:"Adaptive coaching prompts",values:e.adaptivePrompts}),!(null===(t=e.misconceptions)||void 0===t||!t.length)&&(0,S.jsxs)("section",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Misconceptions to correct"}),(0,S.jsx)("div",{className:"mt-3 space-y-3",children:e.misconceptions.map((e,t)=>(0,S.jsxs)("div",{className:"border-l-2 border-amber-400 pl-3 text-sm leading-6",children:[(0,S.jsx)("p",{className:"font-medium text-slate-900",children:e.claim}),(0,S.jsx)("p",{className:"text-slate-600",children:e.correction})]},t))})]})]})]},e.id)})})]}),!(null===(s=p.enrichedResources)||void 0===s||!s.length)&&(0,S.jsxs)("section",{children:[(0,S.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Teaching resources"}),(0,S.jsx)("p",{className:"mt-1 text-sm text-slate-600",children:"Source-grounded explanations, scenarios, misconceptions, and coaching notes from the enriched Content Bank."})]}),(0,S.jsxs)("p",{className:"text-xs font-semibold text-slate-500",children:[(null===(n=p.enrichedResourceStats)||void 0===n?void 0:n.conceptCount)||0," ","concepts \xb7"," ",(null===(i=p.enrichedResourceStats)||void 0===i?void 0:i.questionConnections)||0," ","question links"]})]}),(0,S.jsx)("div",{className:"mt-4 divide-y border border-slate-200",children:p.enrichedResources.map(e=>(0,S.jsxs)("details",{className:"group p-4",children:[(0,S.jsx)("summary",{className:"cursor-pointer list-none",children:(0,S.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs font-semibold uppercase text-[#123b69]",children:e.section}),(0,S.jsx)("h4",{className:"mt-1 text-sm font-semibold text-slate-950",children:e.title})]}),(0,S.jsxs)("span",{className:"shrink-0 bg-slate-100 px-2 py-1 text-xs font-medium text-slate-600",children:[e.questionCount," questions"]})]})}),(0,S.jsxs)("div",{className:"mt-4 grid gap-5 border-t pt-4 lg:grid-cols-2",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-sm leading-7 text-slate-700",children:e.explanation}),(0,S.jsx)(Y,{title:"Use in class",values:e.applicationPrompts})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)(Y,{title:"Teaching notes",values:e.teachingRationales}),(0,S.jsx)(Y,{title:"Misconceptions to correct",values:e.misconceptionDistractors})]})]})]},e.id))})]}),(0,S.jsx)(Q,{unit:p,students:r,builder:A,setBuilder:C,begin:e=>C({type:"study_guide",title:`${e.title} study guide`,instructions:"Review the assigned source guide. Be prepared to explain each objective and apply it to a safe resident-care scenario.",dueDate:"",studentIds:[]}),assign:async()=>{$(!0);try{const e=await(0,k.Ij)("createTutorCurriculumAssignment",{unitId:p.id,...A});C(null),N(`Assigned to ${e.studentCount} student${1===e.studentCount?"":"s"}.`)}catch(e){N(e.message||"Unable to assign this resource.")}finally{$(!1)}},busy:I}),!(null===(d=p.keyConcepts)||void 0===d||!d.length)&&(0,S.jsxs)("section",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Live encyclopedia"}),(0,S.jsx)("div",{className:"mt-3 divide-y border border-slate-200",children:p.keyConcepts.map((e,t)=>(0,S.jsxs)("details",{className:"p-4",children:[(0,S.jsx)("summary",{className:"cursor-pointer text-sm font-semibold text-slate-900",children:e.term}),(0,S.jsx)("p",{className:"mt-2 text-sm leading-7 text-slate-700",children:e.explanation})]},t))})]}),(0,S.jsxs)("section",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Curriculum source text"}),(0,S.jsx)("div",{className:"mt-3 max-h-[55vh] overflow-y-auto whitespace-pre-wrap border border-slate-200 bg-slate-50 p-5 text-sm leading-7 text-slate-700",children:p.content})]})]})]})]})]}):(0,S.jsxs)("div",{className:"flex items-center justify-center py-20 text-sm text-slate-500",children:[(0,S.jsx)(m.A,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading approved curriculum\u2026"]})}function Y(e){let{title:t,values:s}=e;return(0,S.jsxs)("section",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:t}),null!==s&&void 0!==s&&s.length?(0,S.jsx)("ul",{className:"mt-3 space-y-2",children:s.map((e,t)=>(0,S.jsxs)("li",{className:"flex gap-3 text-sm leading-6 text-slate-700",children:[(0,S.jsx)(p.A,{className:"mt-1 h-4 w-4 shrink-0 text-[#123b69]"}),e]},t))}):(0,S.jsx)("p",{className:"mt-2 text-sm text-slate-500",children:"Not yet added by the curriculum administrator."})]})}function Q(e){let{unit:t,students:s,builder:a,setBuilder:l,begin:n,assign:i,busy:d}=e;return(0,S.jsxs)("section",{className:"border border-slate-200 bg-slate-50 p-5",children:[(0,S.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"font-semibold text-slate-950",children:"Create from this chapter"}),(0,S.jsx)("p",{className:"mt-1 text-sm text-slate-600",children:"Build a source-grounded resource without exposing exam questions."})]}),(0,S.jsx)("button",{onClick:()=>n(t),className:"shrink-0 bg-[#123b69] px-4 py-2.5 text-sm font-semibold text-white",children:"Build and assign"})]}),a&&(0,S.jsxs)("div",{className:"mt-5 space-y-4 border-t border-slate-200 pt-5",children:[(0,S.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,S.jsxs)("label",{className:"text-xs font-semibold text-slate-600",children:["Resource type",(0,S.jsxs)("select",{value:a.type,onCh
2ange:e=>l({...a,type:e.target.value}),className:"mt-1.5 w-full border border-slate-300 bg-white px-3 py-2.5 text-sm font-normal",children:[(0,S.jsx)("option",{value:"study_guide",children:"Study guide"}),(0,S.jsx)("option",{value:"discussion",children:"Guided discussion"}),(0,S.jsx)("option",{value:"quick_challenge",children:"Adaptive quick challenge"}),(0,S.jsx)("option",{value:"practice",children:"Practice activity"}),(0,S.jsx)("option",{value:"remediation",children:"Targeted remediation"})]})]}),(0,S.jsxs)("label",{className:"text-xs font-semibold text-slate-600",children:["Due date",(0,S.jsx)("input",{type:"date",value:a.dueDate,onChange:e=>l({...a,dueDate:e.target.value}),className:"mt-1.5 w-full border border-slate-300 bg-white px-3 py-2.5 text-sm font-normal"})]})]}),(0,S.jsxs)("label",{className:"block text-xs font-semibold text-slate-600",children:["Title",(0,S.jsx)("input",{value:a.title,onChange:e=>l({...a,title:e.target.value}),className:"mt-1.5 w-full border border-slate-300 bg-white px-3 py-2.5 text-sm font-normal"})]}),(0,S.jsxs)("label",{className:"block text-xs font-semibold text-slate-600",children:["Instructor directions",(0,S.jsx)("textarea",{rows:"4",value:a.instructions,onChange:e=>l({...a,instructions:e.target.value}),className:"mt-1.5 w-full border border-slate-300 bg-white px-3 py-2.5 text-sm font-normal"})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs font-semibold text-slate-600",children:"Assign students"}),(0,S.jsx)("div",{className:"mt-2 grid max-h-44 gap-2 overflow-y-auto border border-slate-200 bg-white p-3 sm:grid-cols-2",children:s.map(e=>(0,S.jsxs)("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[(0,S.jsx)("input",{type:"checkbox",checked:a.studentIds.includes(e.id),onChange:t=>l({...a,studentIds:t.target.checked?[...a.studentIds,e.id]:a.studentIds.filter(t=>t!==e.id)})}),e.name]},e.id))})]}),(0,S.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,S.jsx)("button",{onClick:()=>l(null),className:"border border-slate-300 px-4 py-2 text-sm",children:"Cancel"}),(0,S.jsxs)("button",{disabled:d||!a.title.trim()||!a.instructions.trim()||!a.studentIds.length,onClick:i,className:"inline-flex items-center gap-2 bg-[#123b69] px-4 py-2 text-sm font-semibold text-white disabled:opacity-40",children:[d&&(0,S.jsx)(m.A,{className:"h-4 w-4 animate-spin"}),"Assign resource"]})]})]})]})}},40859:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]])},42861:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]])},43654:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},47288:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},55551:(e,t,s)=>{s.d(t,{A:()=>a});const a=(0,s(7101).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},89665:(e,t,s)=>{s.r(t),s.d(t,{default:()=>k});var a=s(9950),l=s(24980),n=s(7101);const i=(0,n.A)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var d=s(10449),r=s(12496),o=s(56790),c=s(47288),m=s(13061),x=s(95936),u=s(19888);const h=(0,n.A)("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);var p=s(55551),b=s(39751),g=s(56600),f=s(38686),v=s(22177),j=s(91523),y=s(44414);const N={documents:[],folders:[],attendanceCohorts:[],attendanceRecords:[]},w=function(){const e=(arguments.length>
20&&void 0!==arguments[0]?arguments[0]:[]).filter(Boolean).sort();if(!e.length)return"Dates pending";const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"numeric",...t?{year:"numeric"}:{}}).format(new Date(`${e}T00:00:00Z`))};if(1===e.length)return t(e[0],!0);const s=e[0].slice(0,4),a=e.at(-1).slice(0,4);return`${t(e[0],s!==a)}\u2013${t(e.at(-1),!0)}`};function k(){const[e,t]=(0,a.useState)({documents:[],folders:[],attendanceCohorts:[],attendanceRecords:[]}),[s,n]=(0,a.useState)(!0),[k,A]=(0,a.useState)(!1),[C,I]=(0,a.useState)(!1),[S,$]=(0,a.useState)(""),[D,T]=(0,a.useState)(""),[M,P]=(0,a.useState)(!1),[R,E]=(0,a.useState)(""),[U,_]=(0,a.useState)(!1),[L,z]=(0,a.useState)(""),[q,B]=(0,a.useState)(null),[F,O]=(0,a.useState)(null),[H,Z]=(0,a.useState)(null),[V,W]=(0,a.useState)(""),[G,K]=(0,a.useState)(""),[Y,Q]=(0,a.useState)(""),[J,X]=(0,a.useState)({title:"",category:"other",description:"",file:null}),ee=async()=>{n(!0);try{const e=await(0,g.Ij)("getAdminCommonDocuments");t({documents:Array.isArray(null===e||void 0===e?void 0:e.documents)?e.documents:[],folders:Array.isArray(null===e||void 0===e?void 0:e.folders)?e.folders:[],attendanceCohorts:Array.isArray(null===e||void 0===e?void 0:e.attendanceCohorts)?e.attendanceCohorts:[],attendanceRecords:Array.isArray(null===e||void 0===e?void 0:e.attendanceRecords)?e.attendanceRecords:[]})}catch(e){$(e.message||"Unable to load documents.")}finally{n(!1)}};(0,a.useEffect)(()=>{ee()},[]);const te=[{id:"system:attendance",category:"attendance",name:"Attendance",description:"Attendance records and signed sheets"}],se=(Array.isArray(null===e||void 0===e?void 0:e.attendanceCohorts)?e.attendanceCohorts:[]).map(e=>({id:`attendance:${e.id}`,parentId:"system:attendance",category:"attendance",name:`${e.title} \u2014 ${w(e.dates)}`,description:"1 live attendance register containing every scheduled class date",cohort:e})),ae=[...te,...se,...e.folders||[]].find(e=>e.id===D),le=D?"system:attendance"===D?se:(e.folders||[]).filter(e=>e.parentId===D):[...te,...(e.folders||[]).filter(e=>!e.parentId)],ne=(e.documents||N.documents).filter(e=>e.folderId===D),ie=null!==ae&&void 0!==ae&&ae.cohort?(Array.isArray(null===e||void 0===e?void 0:e.attendanceRecords)?e.attendanceRecords:[]).filter(e=>e.cohortId===ae.cohort.id):[],de="system:attendance"===D||D.startsWith("attendance:"),re=(e.folders||[]).map(t=>{const s=[t.name];let a=t.parentId;const l=new Set([t.id]);for(;a&&!l.has(a);){l.add(a);const t=a,n=(e.folders||[]).find(e=>e.id===t);if(!n)break;s.unshift(n.name),a=n.parentId}return{...t,pathLabel:s.join(" / ")}}).sort((e,t)=>e.pathLabel.localeCompare(t.pathLabel)),oe=async(e,t)=>{if(e&&t&&e.folderId!==t.id){W(e.id),$("");try{await(0,g.Ij)("updateAdminCommonDocument",{documentId:e.id,title:e.title,category:t.category||e.category||"other",folderId:t.id,description:e.description||""}),Z(null),await ee(),$(`Moved \u201c${e.title}\u201d to ${t.name}.`)}catch(s){$(s.message||"Unable to move document.")}finally{W(""),K(""),Q("")}}},ce=async()=>{if(!R.trim())return $("Enter a folder name.");I(!0),$("");try{U?await(0,g.Ij)("renameAdminDocumentFolder",{folderId:D,name:R}):await(0,g.Ij)("createAdminDocumentFolder",{name:R,parentId:D||null,category:(null===ae||void 0===ae?void 0:ae.category)||"other"}),E(""),_(!1),P(!1),await ee()}catch(e){$(e.message||"Unable to create folder.")}finally{I(!1)}};return(0,y.jsxs)("div",{className:"mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8",children:[(0,y.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{className:"text-xs font-bold uppercase tracking-wider text-blue-700",children:"Academics"}),(0,y.jsx)("h1",{className:"mt-1 text-2xl font-bold text-slate-950",children:(null===ae||void 0===ae?void 0:ae.name)||"Documents"}),(0,y.jsx)("p",{className:"mt-1 text-sm text-slate-500",children:(null===ae||void 0===ae?void 0:ae.description)||"Create folders to organize and store school documents."})]}),(0,y.jsxs)("div",{className:"flex flex-wrap gap-2",children:[D&&(0,y.jsxs)("button",{onClick:()=>T((null===ae||void 0===ae?void 0:ae.parentId)||""),className:"inline-flex items-center gap-2 border border-slate-300 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700",children:[(0,y.jsx)(l.A,{className:"h-4 w-4"})," Back"]}),!de&&(0,y.jsxs)("button",{onClick:()=>{_(!1),E(""),P(e=>!e)},className:"inline-flex items-center gap-2 border border-slate-300 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700",children:[(0,y.jsx)(i,{className:"h-4 w-4"})," ",D?"Add subfolder":"Add folder"]}),D&&!de&&(0,y.jsxs)("button",{onClick:()=>{_(!0),E((null===ae||void 0===ae?void 0:ae.name)||""),P(!0)},className:"inline-flex items-center gap-2 border border-slate-300 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700",children:[(0,y.jsx)(d.A,{className:"h-4 w-4"})," Rename folder"]}),D&&!de&&(0,y.jsxs)("button",{onClick:()=>{O(null),X({title:"",category:(null===ae||void 0===ae?void 0:ae.category)||"other",description:"",file:null}),A(!0)},className:"inline-flex items-center justify-center gap-2 bg-[#123b69] px-4 py-2.5 text-sm font-semibold text-white",children:[(0,y.jsx)(r.A,{className:"h-4 w-4"})," Add document"]})]})]}),S&&(0,y.jsx)("p",{className:"mt-4 rounded-lg border border-slate-200 bg-white px-4 py-3 text-sm text-slate-700",children:S}),M&&(0,y.jsxs)("section",{className:"mt-6 border border-slate-200 bg-white p-5",children:[(0,y.jsx)("h2",{className:"font-semibold text-slate-950",children:U?"Rename folder":"Create "+(D?"subfolder":"folder")}),(0,y.jsxs)("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[(0,y.jsx)("input",{autoFocus:!0,value:R,onChange:e=>E(e.target.value),onKeyDown:e=>"Enter"===e.key&&ce(),placeholder:"Folder name",className:"h-11 flex-1 border border-slate-300 px-3 text-sm"}),(0,y.jsx)("button",{onClick:ce,disabled:C,className:"h-11 bg-[#123b69] px-5 text-sm font-semibold text-white disabled:opacity-50",children:U?"Save name":"Create folder"})]})]}
2),k&&(0,y.jsxs)("section",{className:"mt-6 rounded-xl border border-slate-200 bg-white p-5",children:[(0,y.jsxs)("div",{className:"flex items-center justify-between",children:[(0,y.jsx)("h2",{className:"font-semibold text-slate-950",children:F?"Edit or replace document":"Save a common academic document"}),(0,y.jsx)("button",{onClick:()=>{A(!1),O(null)},className:"p-1 text-slate-400 hover:text-slate-700",children:(0,y.jsx)(o.A,{className:"h-5 w-5"})})]}),(0,y.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,y.jsxs)("label",{className:"text-xs font-semibold text-slate-600",children:["Document title",(0,y.jsx)("input",{value:J.title,onChange:e=>X({...J,title:e.target.value}),className:"mt-1.5 w-full rounded-lg border border-slate-300 px-3 py-2.5 text-sm font-normal"})]}),(0,y.jsxs)("label",{className:"text-xs font-semibold text-slate-600",children:["Category",(0,y.jsxs)("select",{value:J.category,onChange:e=>X({...J,category:e.target.value}),className:"mt-1.5 w-full rounded-lg border border-slate-300 bg-white px-3 py-2.5 text-sm font-normal",children:[(0,y.jsx)("option",{value:"attendance",children:"Attendance"}),(0,y.jsx)("option",{value:"curriculum",children:"Curriculum"}),(0,y.jsx)("option",{value:"compliance",children:"Compliance"}),(0,y.jsx)("option",{value:"report",children:"Report"}),(0,y.jsx)("option",{value:"other",children:"Other"})]})]}),(0,y.jsxs)("label",{className:"text-xs font-semibold text-slate-600 sm:col-span-2",children:["Description",(0,y.jsx)("input",{value:J.description,onChange:e=>X({...J,description:e.target.value}),className:"mt-1.5 w-full rounded-lg border border-slate-300 px-3 py-2.5 text-sm font-normal"})]}),(0,y.jsxs)("label",{className:"text-xs font-semibold text-slate-600 sm:col-span-2",children:[F?"Replacement file (optional)":"File",(0,y.jsx)("input",{type:"file",onChange:e=>{var t;return X({...J,file:(null===(t=e.target.files)||void 0===t?void 0:t[0])||null})},className:"mt-1.5 block w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm font-normal"}),F&&(0,y.jsxs)("span",{className:"mt-1 block font-normal text-slate-400",children:["Leave empty to keep ",F.fileName,"."]})]})]}),(0,y.jsxs)("button",{onClick:async()=>{if(!J.title.trim()||!F&&!J.file)return $(F?"Enter a document title.":"Enter a document title and choose a file.");I(!0),$("");try{let e={};if(J.file){const t=J.file.name.replace(/[^a-zA-Z0-9._-]+/g,"_"),s=`admin/${(D||`system:${J.category}`).replace(/[^a-zA-Z0-9_-]+/g,"_")}/common-document_${Date.now()}_${t}`,a=(0,b.KR)(g.IG,s);await(0,b.D)(a,J.file,{contentType:J.file.type||"application/octet-stream"}),e={fileName:J.file.name,contentType:J.file.type,storagePath:s,downloadUrl:await(0,b.qk)(a)}}const t={title:J.title,category:J.category,folderId:D||`system:${J.category}`,description:J.description,...e};F?await(0,g.Ij)("updateAdminCommonDocument",{documentId:F.id,...t}):await(0,g.Ij)("saveAdminCommonDocument",t),X({title:"",category:"other",description:"",file:null}),O(null),A(!1),await ee(),$(F?"Document updated.":"Document saved to the academic archive.")}catch(e){$(e.message||"Unable to save document.")}finally{I(!1)}},disabled:C,className:"mt-4 inline-flex items-center gap-2 rounded-lg bg-blue-700 px-4 py-2.5 text-sm font-semibold text-white disabled:opacity-50",children:[C?(0,y.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,y.jsx)(m.A,{className:"h-4 w-4"})," ",F?"Save changes":"Save document"]})]}),s?(0,y.jsx)("div",{className:"flex justify-center py-20",children:(0,y.jsx)(c.A,{className:"h-7 w-7 animate-spin text-blue-700"})}):(0,y.jsxs)("section",{className:"mt-7",children:[(0,y.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:le.map(t=>{const s=(t=>(e.documents||[]).filter(e=>e.folderId===t.id).length+(e.folders||[]).filter(e=>e.parentId===t.id).length+("system:attendance"===t.id?se.length:t.cohort?(e.attendanceRecords||[]).filter(e=>e.cohortId===t.cohort.id).length:0))(t);return(0,y.jsxs)("button",{onClick:()=>T(t.id),onDragOver:e=>{G&&!t.cohort&&(e.preventDefault(),e.dataTransfer.dropEffect="move",Q(t.id))},onDragLeave:()=>Q(e=>e===t.id?"":e),onDrop:s=>{s.preventDefault(),s.stopPropagation();const a=s.dataTransfer.getData("text/plain")||G,l=(e.documents||[]).find(e=>e.id===a);l&&!t.cohort&&oe(l,t)},className:"group flex min-h-36 flex-col items-start border bg-white p-5 text-left transition hover:border-blue-300 hover:shadow-sm "+(Y===t.id?"border-blue-500 bg-blue-50 ring-2 ring-blue-200":"border-slate-200"),children:[(0,y.jsxs)("div",{className:"flex w-full items-start justify-between",children:[(0,y.jsx)("div",{className:"flex h-11 w-11 items-center justify-center bg-blue-50 text-blue-700",children:(0,y.jsx)(i,{className:"h-6 w-6"})}),!t.cohort&&(0,y.jsxs)("span",{className:"text-xs font-semibold text-slate-400",children:[s," ",1===s?"item":"items"]})]}),(0,y.jsx)("h2",{className:"mt-4 font-semibold text-slate-950 group-hover:text-blue-800",children:t.name}),t.description&&!t.cohort&&(0,y.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-500",children:t.description})]},t.id)})}),D&&(0,y.jsx)("div",{className:"mt-5 overflow-hidden border border-slate-200 bg-white",children:(0,y.jsxs)("div",{className:"divide-y divide-slate-100",children:[ie.map(e=>{var t;return(0,y.jsxs)("article",{className:"flex flex-col gap-4 p-4 sm:flex-row sm:items-center sm:justify-between sm:p-5",children:[(0,y.jsxs)("div",{className:"flex gap-3",children:[(0,y.jsx)(x.A,{className:"mt-0.5 h-5 w-5 text-blue-700"}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("h3",{className:"text-sm font-semibold",children:[e.isCohortRegister?"Cohort attendance register":`Day ${e.dayNumber} \u2014 Attendance record`," \u2014"," ",w(e.dates)]}),(0,y.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:(e.dates||[]).join(" \xb7 ")||"Dates pending"}),(0,y.jsxs)("p",{className:"mt-2 text-xs text-slate-500",children:[e.studentCount," students \xb7 ",e.classDateCount||1," class dates \xb7 ",e.signed," of ",null!==(t=e.signatureSlots)&&void 0!==t?t:e.studentCount," signatures"]})]})]}),(0,y.jsxs)("button",{onClick:()=>(async e=>{z(e.id),$("");try{var t;const s=await(0,g.Ij)("getAdminAttendancePrintRecord",{sessionId:e.isCohortRegister?null:e.sessionId||e.id,seriesId:e.cohortId||null,date:e.isCohortRegister?null:(null===(t=e.dates)||void 0===t?void 0:t[0])||null});(0,f.printAttendanceRecord)({...s,schedules:(null===s||void 0===s?void 0:s.schedules)||[],students:(null===s||void 0===s?void 0:s.students)||[],attendanceRows:(null===s||void 0===s?void 0:s.attendance)||(null===s||void 0===s?void 0:s.attendanceRows)||[]})}catch(s){$(s.message||"Unable to open attendance document.")}finally{z("")}})(e),disabled:L===e.id,className:"inline-flex shrink-0 items-center justify-center gap-2 border border-[#123b69] px-3 py-2 text-xs font-semibold text-[#123b69] disabled:opacity-50",children:[L===e.id?(0,y.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,y.jsx)(u.A,{className:"h-4 w-4"})," ","View / download"]})]},e.id)}),ne.map(e=>(0,y.jsxs)("article",{draggable:V!==e.id,onDragStart:t=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.id),K(e.id)},onDragEnd:()=>{K(""),Q("")},className:"flex cursor-grab flex-col gap-4 p-4 hover:bg-slate-50 active:cursor-grabbing sm:flex-row sm:items-center sm:justify-between sm:p-5 "+(G===e.id?"opacity-50":""),children:[(0,y.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,y.jsx)(x.A,{className:"mt-0.5 h-5 w-5 shrink-0 text-slate-400"}),(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("h3",{className:"truncate text-sm font-semibold",children:e.title}),(0,y.jsx)("p",{className:"mt-1 truncate text-xs text-slate-500",children:e.fileName}),(0,y.jsxs)("p",{className:"mt-1 text-xs text-slate-500",children:["Uploaded: ",(0,j.Nl)(e.uploadedAt||e.createdAt)]}),(0,y.jsx)(v.A,{value:e.customTag,documentName:e.title,onSave:s=>(async(e,s)=>{await(0,g.Ij)("updateAdminCommonDocument",{documentId:e,customTag:s}),t(t=>({...t,documents:t.documents.map(t=>
2t.id===e?{...t,customTag:s}:t)}))})(e.id,s)}),e.description&&(0,y.jsx)("p",{className:"mt-1 text-xs text-slate-600",children:e.description})]})]}),(0,y.jsxs)("div",{className:"flex w-full flex-wrap gap-2 sm:w-auto sm:shrink-0",children:[(0,y.jsxs)("button",{onClick:()=>Z(e),disabled:V===e.id,className:"inline-flex items-center gap-2 border border-slate-300 px-3 py-2 text-xs font-semibold text-slate-700 disabled:opacity-50",children:[V===e.id?(0,y.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,y.jsx)(h,{className:"h-4 w-4"})," ","Move to\u2026"]}),(0,y.jsxs)("button",{onClick:()=>(e=>{O(e),X({title:e.title||"",category:e.category||"other",description:e.description||"",file:null}),A(!0),$("")})(e),className:"inline-flex items-center gap-2 border border-slate-300 px-3 py-2 text-xs font-semibold text-slate-700",children:[(0,y.jsx)(d.A,{className:"h-4 w-4"})," Edit / replace"]}),(0,y.jsxs)("button",{onClick:()=>(async e=>{z(e.id),$("");try{var t;const s=await(null===(t=g.j2.currentUser)||void 0===t?void 0:t.getIdToken());if(!s)throw new Error("Please sign in again.");const a=await fetch(`/api/admin-documents/${encodeURIComponent(e.id)}`,{headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(await a.text()||"Unable to open document.");const l=URL.createObjectURL(await a.blob());B({url:l,name:e.fileName||e.title,contentType:e.contentType||""})}catch(s){$(s.message||"Unable to open document.")}finally{z("")}})(e),disabled:L===e.id,className:"inline-flex items-center gap-2 border border-[#123b69] px-3 py-2 text-xs font-semibold text-[#123b69] disabled:opacity-50",children:[L===e.id?(0,y.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,y.jsx)(p.A,{className:"h-4 w-4"})," ","View"]})]})]},e.id)),!le.length&&!ne.length&&!ie.length&&(0,y.jsx)("p",{className:"p-10 text-center text-sm text-slate-500",children:"This folder is empty. Create a subfolder or add a document."})]})})]}),q&&(0,y.jsx)("div",{className:"fixed inset-0 z-[150] flex items-center justify-center bg-black/70 p-3 sm:p-6",role:"dialog","aria-modal":"true",children:(0,y.jsxs)("div",{className:"flex h-[92vh] w-full max-w-6xl flex-col overflow-hidden rounded-xl bg-white shadow-2xl",children:[(0,y.jsxs)("header",{className:"flex items-center justify-between gap-4 border-b border-slate-200 px-4 py-3",children:[(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Document preview"}),(0,y.jsx)("h2",{className:"truncate font-semibold text-slate-950",children:q.name})]}),(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsxs)("a",{href:q.url,download:q.name,className:"inline-flex items-center gap-2 border border-slate-300 px-3 py-2 text-xs font-semibold text-slate-700",children:[(0,y.jsx)(u.A,{className:"h-4 w-4"})," Download"]}),(0,y.jsx)("button",{onClick:()=>{null!==q&&void 0!==q&&q.url&&URL.revokeObjectURL(q.url),B(null)},className:"p-2 text-slate-500 hover:bg-slate-100","aria-label":"Close preview",children:(0,y.jsx)(o.A,{className:"h-5 w-5"})})]})]}),(0,y.jsx)("iframe",{src:q.url,title:`Preview ${q.name}`,className:"min-h-0 flex-1 border-0 bg-slate-100"})]})}),H&&(0,y.jsx)("div",{className:"fixed inset-0 z-[160] flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"move-document-title",onMouseDown:e=>e.target===e.currentTarget&&Z(null),children:(0,y.jsxs)("div",{className:"w-full max-w-lg overflow-hidden rounded-xl bg-white shadow-2xl",children:[(0,y.jsxs)("header",{className:"flex items-start justify-between gap-4 border-b border-slate-200 px-5 py-4",children:[(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("h2",{id:"move-document-title",className:"font-semibold text-slate-950",children:"Move document"}),(0,y.jsx)("p",{className:"mt-1 truncate text-sm text-slate-500",children:H.title})]}),(0,y.jsx)("button",{onClick:()=>Z(null),className:"p-1.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700","aria-label":"Close move dialog",children:(0,y.jsx)(o.A,{className:"h-5 w-5"})})]}),(0,y.jsxs)("div",{className:"max-h-[55vh] overflow-y-auto p-3",children:[(0,y.jsx)("p",{className:"px-2 pb-2 text-xs font-semibold uppercase tracking-wide text-slate-400",children:"Choose a destination"}),re.filter(e=>e.id!==H.folderId).map(e=>(0,y.jsxs)("button",{onClick:()=>oe(H,e),disabled:Boolean(V),className:"flex w-full items-center gap-3 rounded-lg px-3 py-3 text-left hover:bg-blue-50 disabled:opacity-50",children:[(0,y.jsx)(i,{className:"h-5 w-5 shrink-0 text-blue-700"}),(0,y.jsx)("span",{className:"min-w-0 truncate text-sm font-medium text-slate-800",children:e.pathLabel})]},e.id)),!re.some(e=>e.id!==H.folderId)&&(0,y.jsx)("p",{className:"px-3 py-8 text-center text-sm text-slate-500",children:"Create another folder before moving this document."})]})]})})]})}},91523:(e,t,s)=>{s.d(t,{Nl:()=>i,ru:()=>n,vk:()=>l,zq:()=>a});const a=80,l=e=>{const t=String(null!==e&&void 0!==e?e:"").trim();if(t.length>a)throw new Error(`Tags must be ${a} characters or fewer.`);return t},n=(e,t,s)=>{const a=l(s);if(!Array.isArray(e)||!e.some(e=>e.id===t))throw new Error("This document no longer exists. Refresh the document list.");return e.map(e=>e.id===t?{...e,customTag:a}:e)},i=e=>{if(void 0===e||null===e||""===e)return"Upload time unavailable";try{if("string"===typeof e&&/^\d{4}-\d{2}-\d{2}$/.test(e)){const t=new Date(`${e}T00:00:00Z`);return`${new Intl.DateTimeFormat("en-US",{timeZone:"UTC",year:"numeric",month:"short",day:"numeric"}).format(t)} (time unavailable)`}let t;if("function"===typeof(null===e||void 0===e?void 0:e.toDate))t=e.toDate();else if("number"===typeof(null===e||void 0===e?void 0:e.seconds))t=new Date(1e3*e.seconds);else if("number"===typeof(null===e||void 0===e?void 0:e._seconds))t=new Date(1e3*e._seconds);else{if(!(e instanceof Date||"string"===typeof e||"number"===typeof e))return"Upload time unavailable";t=new Date(e)}return new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0,timeZoneName:"short"}).format(t)}catch{return"Upload time unavailable"}}}}]);

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.