(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7348,39255],{3401:(e,t,s)=>{Promise.resolve().then(s.bind(s,39255))},29156:(e,t,s)=>{"use strict";function n(e){if(!e)return!1;let t=e.split("?")[0]||e;return"/dashboard"===t||t.startsWith("/dashboard/")}function a(e){if(!e)return!1;let t=e.split("?")[0]||e;return"/admin"===t||t.startsWith("/admin/")}s.d(t,{M:()=>n,P:()=>a})},39255:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var n=s(95155),a=s(12115),r=s(30571),i=s(30313),l=s(75560),o=s(2581);let c={GENERAL:"Notice",EVENT:"Event",HOLIDAY:"Holiday"},u={GENERAL:"bg-slate-100 text-slate-700",EVENT:"bg-sky-50 text-sky-800",HOLIDAY:"bg-violet-50 text-violet-800"};function d(){let[e,t]=(0,a.useState)([]),[s,d]=(0,a.useState)(!0),[m,h]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let e=!1;return(0,l.BZ)().then(s=>{e||t(s)}).catch(t=>{e||(0,o.Qg)(t instanceof Error?t.message:"Failed to load notices")}).finally(()=>{e||d(!1)}),()=>{e=!0}},[]),(0,n.jsx)(r.o,{title:"Notices",description:"School announcements, events, and holidays for you.",children:s?(0,n.jsx)("div",{className:"space-y-3 animate-pulse",children:Array.from({length:3}).map((e,t)=>(0,n.jsx)("div",{className:"h-24 rounded-lg bg-slate-100"},t))}):0===e.length?(0,n.jsx)(i.i0,{title:"No notices yet",description:"When your school publishes announcements for you, they will show up here."}):(0,n.jsx)("ul",{className:"space-y-3",children:e.map(e=>{let t=m===e.id;return(0,n.jsx)("li",{children:(0,n.jsxs)("div",{className:"overflow-hidden rounded-lg border border-slate-100 bg-white shadow-sm",children:[(0,n.jsxs)("button",{type:"button",className:"w-full p-4 text-left touch-manipulation sm:p-5",onClick:()=>h(t?null:e.id),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"mb-1.5 flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${u[e.noticeType]||u.GENERAL}`,children:c[e.noticeType]||"Notice"}),e.isPinned?(0,n.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-amber-700",children:"Pinned"}):null]}),(0,n.jsx)("p",{className:"font-semibold text-slate-900",children:e.title}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-slate-500",children:[e.eventDate?`${e.eventDate} \xb7 `:"",e.publishAt?new Date(e.publishAt).toLocaleDateString():""]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs font-medium text-primary-700",children:t?"Hide":"Read"})]}),t?null:(0,n.jsx)("p",{className:"mt-2 line-clamp-2 text-sm text-slate-500",children:e.body})]}),t?(0,n.jsx)("div",{className:"border-t border-slate-100 px-4 py-3 text-sm whitespace-pre-wrap text-slate-800 sm:px-5",children:e.body}):null]})},e.id)})})})}},73321:(e,t,s)=>{"use strict";var n=s(74645);s.o(n,"useParams")&&s.d(t,{useParams:function(){return n.useParams}}),s.o(n,"usePathname")&&s.d(t,{usePathname:function(){return n.usePathname}}),s.o(n,"useRouter")&&s.d(t,{useRouter:function(){return n.useRouter}}),s.o(n,"useSearchParams")&&s.d(t,{useSearchParams:function(){return n.useSearchParams}})},99462:(e,t,s)=>{"use strict";s.d(t,{Fb:()=>h,b:()=>i,sK:()=>p});var n=s(73321),a=s(12115);let r="academy-route-change";function i(){window.dispatchEvent(new Event(r))}let l=new Set,o=!1;function c(){o||(o=!0,setTimeout(()=>{o=!1,l.forEach(e=>{try{e()}catch{}})},0))}function u(e){l.add(e);let t=()=>c();return window.addEventListener("popstate",t),window.addEventListener(r,t),()=>{l.delete(e),window.removeEventListener("popstate",t),window.removeEventListener(r,t)}}function d(){return window.location.pathname||"/"}function m(){return window.location.search||""}function h(){return(0,a.useSyncExternalStore)(u,m,()=>"")}function p(){let e=(0,n.usePathname)()||"/",t=(0,a.useSyncExternalStore)(u,d,()=>e);return((0,a.useEffect)(()=>{c()},[]),t&&t!==e)?t:e}}},e=>{e.O(0,[35760,92619,59185,98500,62007,76541,30313,16645,28441,93794,77358],()=>e(e.s=3401)),_N_E=e.O()}]);