1"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[4729],{4158(e,s,a){a.d(s,{Fc:()=>c,TN:()=>d});var l=a(65043),t=a(10917),r=a(99766),i=a(70579);const n=(0,t.F)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),c=l.forwardRef((e,s)=>{let{className:a,variant:l,...t}=e;return(0,i.jsx)("div",{ref:s,role:"alert",className:(0,r.cn)(n({variant:l}),a),...t})});c.displayName="Alert";l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,i.jsx)("h5",{ref:s,className:(0,r.cn)("mb-1 font-medium leading-none tracking-tight",a),...l})}).displayName="AlertTitle";const d=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,i.jsx)("div",{ref:s,className:(0,r.cn)("text-sm [&_p]:leading-relaxed",a),...l})});d.displayName="AlertDescription"},91140(e,s,a){a.d(s,{BT:()=>d,Wu:()=>o,ZB:()=>c,Zp:()=>i,aR:()=>n,wL:()=>m});var l=a(65043),t=a(99766),r=a(70579);const i=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,t.cn)("rounded-xl border bg-card text-card-foreground shadow",a),...l})});i.displayName="Card";const n=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,t.cn)("flex flex-col space-y-1.5 p-6",a),...l})});n.displayName="CardHeader";const c=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,t.cn)("font-semibold leading-none tracking-tight",a),...l})});c.displayName="CardTitle";const d=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,t.cn)("text-sm text-muted-foreground",a),...l})});d.displayName="CardDescription";const o=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,t.cn)("p-6 pt-0",a),...l})});o.displayName="CardContent";const m=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,t.cn)("flex items-center p-6 pt-0",a),...l})});m.displayName="CardFooter"},92264(e,s,a){a.d(s,{p:()=>i});var l=a(65043),t=a(99766),r=a(70579);const i=l.forwardRef((e,s)=>{let{className:a,type:l,...i}=e;return(0,r.jsx)("input",{type:l,className:(0,t.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:s,...i})});i.displayName="Input"},59938(e,s,a){a.d(s,{J:()=>d});var l=a(65043),t=a(65131),r=a(10917),i=a(99766),n=a(70579);const c=(0,r.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,n.jsx)(t.b,{ref:s,className:(0,i.cn)(c(),a),...l})});d.displayName=t.b.displayName},84370(e,s,a){a.d(s,{bq:()=>u,eb:()=>j,gC:()=>p,l6:()=>o,yv:()=>m});var l=a(65043),t=a(22095),r=a(36210),i=a(92382),n=a(15711),c=a(99766),d=a(70579);const o=t.bL,m=(t.YJ,t.WT),u=l.forwardRef((e,s)=>{let{className:a,children:l,...r}=e;return(0,d.jsxs)(t.l9,{ref:s,className:(0,c.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,(0,d.jsx)(t.In,{asChild:!0,children:(0,d.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=t.l9.displayName;const x=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,d.jsx)(t.PP,{ref:s,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...l,children:(0,d.jsx)(n.A,{className:"h-4 w-4"})})});x.displayName=t.PP.displayName;const h=l.forwardRef((e,s)=>{let{className:a,...l}=e;
1return(0,d.jsx)(t.wn,{ref:s,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...l,children:(0,d.jsx)(i.A,{className:"h-4 w-4"})})});h.displayName=t.wn.displayName;const p=l.forwardRef((e,s)=>{let{className:a,children:l,position:r="popper",...i}=e;return(0,d.jsx)(t.ZL,{children:(0,d.jsxs)(t.UC,{ref:s,className:(0,c.cn)("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...i,children:[(0,d.jsx)(x,{}),(0,d.jsx)(t.LM,{className:(0,c.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),(0,d.jsx)(h,{})]})})});p.displayName=t.UC.displayName;l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,d.jsx)(t.JU,{ref:s,className:(0,c.cn)("px-2 py-1.5 text-sm font-semibold",a),...l})}).displayName=t.JU.displayName;const j=l.forwardRef((e,s)=>{let{className:a,children:l,...i}=e;return(0,d.jsxs)(t.q7,{ref:s,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...i,children:[(0,d.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,d.jsx)(t.VF,{children:(0,d.jsx)(r.A,{className:"h-4 w-4"})})}),(0,d.jsx)(t.p4,{children:l})]})});j.displayName=t.q7.displayName;l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,d.jsx)(t.wv,{ref:s,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...l})}).displayName=t.wv.displayName},19690(e,s,a){a.d(s,{Xi:()=>d,av:()=>o,j7:()=>c,tU:()=>n});var l=a(65043),t=a(47127),r=a(99766),i=a(70579);const n=t.bL,c=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,i.jsx)(t.B8,{ref:s,className:(0,r.cn)("inline-flex h-9 max-w-full items-center justify-start overflow-x-auto scrollbar-hide rounded-lg bg-muted p-1 text-muted-foreground",a),...l})});c.displayName=t.B8.displayName;const d=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,i.jsx)(t.l9,{ref:s,className:(0,r.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",a),...l})});d.displayName=t.l9.displayName;const o=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,i.jsx)(t.UC,{ref:s,className:(0,r.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...l})});o.displayName=t.UC.displayName},13416(e,s,a){a.d(s,{T:()=>i});var l=a(65043),t=a(99766),r=a(70579);const i=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,r.jsx)("textarea",{className:(0,t.cn)("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:s,...l})});i.displayName="Textarea"},74729(e,s,a){a.r(s),a.d(s,{default:()=>F});var l=a(65043),t=a(45621),r=a(73824),i=a(4980),n=a(56328),c=a(13390),d=a(91140),o=a(5949),m=a(92264),u=a(59938),x=a(84370),h=a(19690),p=a(65598),j=a(4158),f=(a(13416),a(76833)),g=a(76245),v=a(23658),N=a(22024),b=a(37719),y=a(65469),w=a(22626),_=a(75088),C=a(1457),A=a(87978),S=a(94805),R=a(39292),T=a(40007),k=a(50797),L=a(70579);const F=()=>{var e,s,a,F,U,$,D,B,W,Z,E,V,I,J,X,M,P,z,q;const{user:O}=(0,r.As)(),[Y,G]=(0,l.useState)([]),[H,Q]=(0,l.useState)(null),[K,ee]=(0,l.useState)(null),[se,ae]=(0,l.useState)([]),[le,te]=(0,l.useState)(!0),[re,ie]=(0,l.useState)(!1),[ne,ce]=(0,l.useState)(!1),[de,oe]=(0,l.useState)(null),[me,ue]=(0,l.useState)(""),[xe,he]=(0,l.useState)(""),[pe,je]=(0,l.useState)(!0),[fe,ge]=(0,l.useState)(null),[ve,Ne]=(0,l.useState)(""),[be,ye]=(0,l.useState)(""),[we,_e]=(0,l.useState)(null),[Ce,Ae]=(0,l.useState)(!1),[Se,Re]=(0,l.useState)(null),[Te,ke]=(0,l.useState)(!1),[Le,Fe]=(0,l.useState)(""),[Ue,$e]=(0,l.useState)([]),[De,Be]=(0,l.useState)(!1),We=(0,l.useCallback)(async()=>{try{var e;const s=await i.A.get(`${r.nC}/admin/curriculum/states`);G(s.data.states||[]),(null===(e=s.data.states)||void 0===e?void 0:e.length)>0&&!H&&Q(s.data.states[0].code)}catch(s){n.oR.error("Failed to load curriculum states")}finally{te(!1)}},[H]),Ze=(0,l.useCallback)(async e=>{try{const s=await i.A.get(`${r.nC}/admin/curriculum/state/${e}`);ee(s.data)}catch(a){var s;404!==(null===(s=a.response)||void 0===s?void 0:s.status)&&console.error("Error fetching state details:",a),ee(null)}},[]),Ee=(0,l.useCallback)(async e=>{try{const s=await i.A.get(`${r.nC}/admin/curriculum/state/${e}/versions`);ae(s.data.versions||[])}catch(s){console.error("Error fetching versions:",s),ae([])}},[]);(0,l.useEffect)(()=>{We()},[We]),(0,l.useEffect)(()=>{H&&(Ze(H),Ee(H))},[H,Ze,Ee]);const Ve=async()=>
1{if(H&&Le.trim()){Be(!0);try{const e=await i.A.get(`${r.nC}/admin/curriculum/search?state=${H}&query=${encodeURIComponent(Le)}`);$e(e.data.results||[])}catch(e){n.oR.error("Search failed")}finally{Be(!1)}}},Ie=e=>e?new Date(e).toLocaleString():"N/A";return le?(0,L.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,L.jsx)(N.A,{className:"h-8 w-8 animate-spin text-emerald-600"})}):(0,L.jsxs)("div",{className:"container mx-auto py-6 space-y-6",children:[(0,L.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,L.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,L.jsx)(t.N_,{to:"/dashboard",children:(0,L.jsxs)(c.$,{variant:"outline",size:"sm",className:"gap-2",children:[(0,L.jsx)(v.A,{className:"h-4 w-4"}),"Dashboard"]})}),(0,L.jsx)(t.N_,{to:"/admin",children:(0,L.jsxs)(c.$,{variant:"outline",size:"sm",className:"gap-2",children:[(0,L.jsx)(y.A,{className:"h-4 w-4"}),"Admin CRM"]})}),(0,L.jsxs)("div",{className:"min-w-0",children:[(0,L.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Curriculum Management"}),(0,L.jsx)("p",{className:"text-gray-600",children:"Upload, manage, and verify curriculum data for AI generation"})]})]}),(0,L.jsx)(o.E,{variant:"outline",className:"text-emerald-700 border-emerald-300",children:"Admin Access"})]}),(0,L.jsxs)(h.tU,{defaultValue:"overview",className:"space-y-4",children:[(0,L.jsxs)(h.j7,{className:"grid w-full grid-cols-4 lg:w-[600px]",children:[(0,L.jsx)(h.Xi,{value:"overview",children:"Overview"}),(0,L.jsx)(h.Xi,{value:"upload",children:"Upload"}),(0,L.jsx)(h.Xi,{value:"versions",children:"Versions"}),(0,L.jsx)(h.Xi,{value:"test",children:"Test LLM"})]}),(0,L.jsxs)(h.av,{value:"overview",className:"space-y-4",children:[(0,L.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[Y.map(e=>{var s;return(0,L.jsxs)(d.Zp,{className:"cursor-pointer transition-all hover:shadow-md "+(H===e.code?"ring-2 ring-emerald-500":""),onClick:()=>Q(e.code),children:[(0,L.jsxs)(d.aR,{className:"pb-2",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsx)(d.ZB,{className:"text-lg",children:e.code}),e.current_version?(0,L.jsx)(o.E,{className:"bg-emerald-100 text-emerald-800",children:"Active"}):(0,L.jsx)(o.E,{variant:"outline",className:"text-gray-500",children:"No Data"})]}),(0,L.jsx)(d.BT,{children:e.name})]}),(0,L.jsx)(d.Wu,{children:(0,L.jsxs)("div",{className:"text-sm text-gray-600 space-y-1",children:[(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"Items:"})," ",(null===(s=e.item_count)||void 0===s?void 0:s.toLocaleString())||0]}),e.last_updated&&(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"Updated:"})," ",new Date(e.last_updated).toLocaleDateString()]})]})})]},e.code)}),(0,L.jsx)(d.Zp,{className:"border-dashed border-2 border-gray-300 hover:border-emerald-400 cursor-pointer transition-all",children:(0,L.jsxs)(d.Wu,{className:"flex flex-col items-center justify-center h-full min-h-[150px] text-gray-500",children:[(0,L.jsx)(C.A,{className:"h-8 w-8 mb-2"}),(0,L.jsx)("p",{className:"text-sm",children:"Upload new state curriculum"})]})})]}),H&&K&&(0,L.jsxs)(d.Zp,{children:[(0,L.jsx)(d.aR,{children:(0,L.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[(0,L.jsx)(w.A,{className:"h-5 w-5"}),H," Curriculum Details"]})}),(0,L.jsxs)(d.Wu,{children:[(0,L.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,L.jsxs)("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[(0,L.jsx)("p",{className:"text-2xl font-bold text-emerald-600",children:(null===(e=K.statistics)||void 0===e||null===(s=e.total_items)||void 0===s?void 0:s.toLocaleString())||0}),(0,L.jsx)("p",{className:"text-sm text-gray-600",children:"Total Items"})]}),(0,L.jsxs)("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[(0,L.jsx)("p",{className:"text-2xl font-bold text-blue-600",children:(null===(a=K.statistics)||void 0===a||null===(F=a.subjects)||void 0===F?void 0:F.length)||0}),(0,L.jsx)("p",{className:"text-sm text-gray-600",children:"Subjects"})]}),(0,L.jsxs)("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[(0,L.jsx)("p",{className:"text-2xl font-bold text-purple-600",children:(null===(U=K.statistics)||void 0===U||null===($=U.year_levels)||void 0===$?void 0:$.length)||0}),(0,L.jsx)("p",{className:"text-sm text-gray-600",children:"Year Levels"})]}),(0,L.jsxs)("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[(0,L.jsx)("p",{className:"text-2xl font-bold text-orange-600",children:(null===(D=K.statistics)||void 0===D||null===(B=D.strands)||void 0===B?void 0:B.length)||0}),(0,L.jsx)("p",{className:"text-sm text-gray-600",children:"Strands"})]})]}),(null===(W=K.statistics)||void 0===W||null===(Z=W.subjects)||void 0===Z?void 0:Z.length)>0&&(0,L.jsxs)("div",{className:"mt-4",children:[(0,L.jsx)("h4",{className:"font-medium mb-2",children:"Subjects"}),(0,L.jsxs)("div",{className:"flex flex-wrap gap-2",children:[K.statistics.subjects.slice(0,15).map(e=>(0,L.jsx)(o.E,{variant:"secondary",children:e},e)),K.statistics.subjects.length>15&&(0,L.jsxs)(o.E,{variant:"outline",children:["+",K.statistics.subjects.length-15," more"]})]})]}),(0,L.jsxs)("div",{className:"mt-6 pt-4 border-t",children:[(0,L.jsx)("h4",{className:"font-medium mb-2",children:"Search Curriculum"}),(0,L.jsxs)("div",{className:"flex gap-2",children:[(0,L.jsx)(m.p,{placeholder:"Search by code, description, or strand...",value:Le,onChange:e=>Fe(e.target.value),onKeyDown:e=>"Enter"===e.key&&Ve()}),(0,L.jsx)(c.$,{onClick:Ve,disabled:De,children:De?(0,L.jsx)(N.A,{className:"h-4 w-4 animate-spin"}):(0,L.jsx)(R.A,{className:"h-4 w-4"})})]}),Ue.length>0&&(0,L.jsx)("div",{className:"mt-4 max-h-[300px] overflow-y-auto border rounded-lg",children:(0,L.jsxs)("table",{className:"w-full text-sm",children:[(0,L.jsx)("thead",{className:"bg-gray-50 sticky top-0",children:(0,L.jsxs)("tr",{children:[(0,L.jsx)("th",{className:"text-left p-2",children:"Code"}),(0,L.jsx)("th",{className:"text-left p-2",children:"Subject"}),(0,L.jsx)("th",{className:"text-left p-2",children:"Year"}),(0,L.jsx)("th",{className:"text-left p-2",children:"Description"})]})}),(0,L.jsx)("tbody",{children:Ue.map((e,s)=>(0,L.jsxs)("tr",{className:"border-t hover:bg-gray-50",children:[(0,L.jsx)("td",{className:"p-2 font-mono text-xs",children:e.code}),(0,L.jsx)("td",{className:"p-2",children:e.subject}),(0,L.jsx)("td",{className:"p-2",children:e.year_level}),(0,L.jsx)("td",{className:"p-2 text-gray-600 truncate max-w-[300px]",children:e.description})]},e.code||`sr-${s}`))})]})})]})]})]})]}),(0,L.jsxs)(h.av,{value:"upload",className:"space-y-4",children:[(0,L.jsxs)(d.Zp,{children:[(0,L.jsxs)(d.aR,{children:[(0,L.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[(0,L.jsx)(k.A,{className:"h-5 w-5"}),"Upload Curriculum Data"]}),(0,L.jsx)(d.BT,{children:"Upload curriculum data in XLS or XLSX format. The system will auto-detect column mappings."})]}),(0,L.jsxs)(d.Wu,{className:"space-y-4",children:[(0,L.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,L.jsxs)("div",{className:"space-y-2",children:[(0,L.jsx)(u.J,{htmlFor:"state-select",children:"State/Curriculum"}),(0,L.jsxs)(x.l6,{value:me,onValueChange:ue,children:[(0,L.jsx)(x.bq,{children:(0,L.jsx)(x.yv,{placeholder:"Select state..."})}),(0,L.jsxs)(x.gC,{children:[(0,L.jsx)(x.eb,{value:"NAT",children:"National (Australian Curriculum)"}),(0,L.jsx)(x.eb,{value:"NSW",children:"New South Wales"}),(0,L.jsx)(x.eb,{value:"VIC",children:"Victoria"}),(0,L.jsx)(x.eb,{value:"QLD",children:"Queensland (New)"}),(0,L.jsx)(x.eb,{value:"SA",children:"South Australia (New)"}),(0,L.jsx)(x.eb,{value:"WA",children:"Western Australia (New)"}),(0,L.jsx)(x.eb,{value:"TAS",children:"Tasmania (New)"}),(0,L.jsx)(x.eb,{value:"ACT",children:"ACT (New)"}),(0,L.jsx)(x.eb,{value:"NT",children:"Northern Territory (New)"})]})]})]}
1),!["NAT","NSW","VIC"].includes(me)&&me&&(0,L.jsxs)("div",{className:"space-y-2",children:[(0,L.jsx)(u.J,{htmlFor:"state-name",children:"State Full Name"}),(0,L.jsx)(m.p,{id:"state-name",placeholder:"e.g., Queensland",value:xe,onChange:e=>he(e.target.value)})]})]}),(0,L.jsxs)("div",{className:"space-y-2",children:[(0,L.jsx)(u.J,{htmlFor:"curriculum-file-input",children:"Curriculum File (.xls or .xlsx)"}),(0,L.jsx)(m.p,{id:"curriculum-file-input",type:"file",accept:".xls,.xlsx",onChange:e=>{var s;const a=null===(s=e.target.files)||void 0===s?void 0:s[0];if(a){if(!a.name.endsWith(".xls")&&!a.name.endsWith(".xlsx"))return void n.oR.error("Please select an XLS or XLSX file");oe(a)}},className:"cursor-pointer"}),de&&(0,L.jsxs)("p",{className:"text-sm text-gray-600",children:["Selected: ",de.name," (",(de.size/1024).toFixed(1)," KB)"]})]}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("input",{type:"checkbox",id:"replace-existing",checked:pe,onChange:e=>je(e.target.checked),className:"rounded"}),(0,L.jsx)(u.J,{htmlFor:"replace-existing",className:"text-sm cursor-pointer",children:"Replace existing curriculum (archive previous version)"})]}),(0,L.jsxs)(j.Fc,{children:[(0,L.jsx)(C.A,{className:"h-4 w-4"}),(0,L.jsxs)(j.TN,{children:[(0,L.jsx)("strong",{children:"Expected columns:"})," Code, Description, Year Level, Subject, Strand (auto-detected). The system will try to match common column name variations."]})]})]}),(0,L.jsx)(d.wL,{children:(0,L.jsx)(c.$,{onClick:async()=>{if(de)if(me){ie(!0),ge(null);try{const e=new FormData;e.append("file",de),e.append("state",me),e.append("replace_existing",pe),xe&&e.append("state_name",xe);const s=await i.A.post(`${r.nC}/admin/curriculum/upload`,e,{headers:{"Content-Type":"multipart/form-data"}});ge(s.data),n.oR.success(`Successfully uploaded ${s.data.item_count} curriculum items`),We(),me===H&&(Ze(H),Ee(H)),oe(null),he(""),document.getElementById("curriculum-file-input").value=""}catch(a){var e,s;n.oR.error((null===(e=a.response)||void 0===e||null===(s=e.data)||void 0===s?void 0:s.detail)||"Upload failed")}finally{ie(!1)}}else n.oR.error("Please select or enter a state");else n.oR.error("Please select a file")},disabled:re||!de||!me,className:"bg-emerald-600 hover:bg-emerald-700",children:re?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(N.A,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k.A,{className:"h-4 w-4 mr-2"}),"Upload Curriculum"]})})})]}),fe&&(0,L.jsxs)(d.Zp,{className:"border-emerald-200 bg-emerald-50",children:[(0,L.jsx)(d.aR,{children:(0,L.jsxs)(d.ZB,{className:"flex items-center gap-2 text-emerald-800",children:[(0,L.jsx)(f.A,{className:"h-5 w-5"}),"Upload Successful"]})}),(0,L.jsxs)(d.Wu,{className:"space-y-4",children:[(0,L.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("p",{className:"text-sm text-gray-600",children:"Items Uploaded"}),(0,L.jsx)("p",{className:"text-2xl font-bold text-emerald-700",children:fe.item_count})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("p",{className:"text-sm text-gray-600",children:"Version ID"}),(0,L.jsx)("p",{className:"font-mono text-sm",children:fe.version_id})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("p",{className:"text-sm text-gray-600",children:"State"}),(0,L.jsx)("p",{className:"font-medium",children:fe.state})]})]}),(null===(E=fe.warnings)||void 0===E?void 0:E.length)>0&&(0,L.jsxs)(j.Fc,{variant:"warning",children:[(0,L.jsx)(b.A,{className:"h-4 w-4"}),(0,L.jsxs)(j.TN,{children:[(0,L.jsx)("strong",{children:"Warnings:"}),(0,L.jsx)("ul",{className:"list-disc list-inside mt-1",children:fe.warnings.map((e,s)=>(0,L.jsx)("li",{children:e},`warn-${s}`))})]})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("p",{className:"text-sm font-medium mb-2",children:"Column Mappings Detected:"}),(0,L.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(fe.column_mapping||{}).map(e=>{let[s,a]=e;return(0,L.jsxs)(o.E,{variant:"outline",children:[s," \u2192 ",a]},s)})})]})]})]})]}),(0,L.jsx)(h.av,{value:"versions",className:"space-y-4",children:(0,L.jsxs)(d.Zp,{children:[(0,L.jsxs)(d.aR,{children:[(0,L.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[(0,L.jsx)(A.A,{className:"h-5 w-5"}),"Version History - ",H]}),(0,L.jsx)(d.BT,{children:"View and rollback to previous curriculum versions"})]}),(0,L.jsx)(d.Wu,{children:0===se.length?(0,L.jsxs)("p",{className:"text-gray-500 text-center py-8",children:["No versions foun
1d for ",H]}):(0,L.jsx)("div",{className:"space-y-3",children:se.map((e,s)=>(0,L.jsx)("div",{className:"p-4 border rounded-lg "+(e.is_current?"border-emerald-300 bg-emerald-50":"border-gray-200"),children:(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[e.is_current?(0,L.jsx)(f.A,{className:"h-5 w-5 text-emerald-600"}):(0,L.jsx)(_.A,{className:"h-5 w-5 text-gray-400"}),(0,L.jsxs)("div",{children:[(0,L.jsxs)("p",{className:"font-medium",children:[e.filename,e.is_current&&(0,L.jsx)(o.E,{className:"ml-2 bg-emerald-600",children:"Current"})]}),(0,L.jsxs)("p",{className:"text-sm text-gray-600",children:[e.item_count," items \u2022 Uploaded ",Ie(e.uploaded_at)]}),(0,L.jsxs)("p",{className:"text-xs text-gray-500",children:["By: ",e.uploaded_by_email," \u2022 ID: ",e.version_id]})]})]}),!e.is_current&&(0,L.jsxs)(c.$,{variant:"outline",size:"sm",onClick:()=>{Re(e),Ae(!0)},children:[(0,L.jsx)(S.A,{className:"h-4 w-4 mr-1"}),"Rollback"]})]})},e.version_id))})})]})}),(0,L.jsxs)(h.av,{value:"test",className:"space-y-4",children:[(0,L.jsxs)(d.Zp,{children:[(0,L.jsxs)(d.aR,{children:[(0,L.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[(0,L.jsx)(T.A,{className:"h-5 w-5"}),"Test LLM Curriculum Usage"]}),(0,L.jsx)(d.BT,{children:"Verify that the AI is using the uploaded curriculum data when generating content"})]}),(0,L.jsx)(d.Wu,{className:"space-y-4",children:(0,L.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,L.jsxs)("div",{className:"space-y-2",children:[(0,L.jsx)(u.J,{children:"State"}),(0,L.jsxs)(x.l6,{value:H,onValueChange:Q,children:[(0,L.jsx)(x.bq,{children:(0,L.jsx)(x.yv,{placeholder:"Select state..."})}),(0,L.jsx)(x.gC,{children:Y.map(e=>(0,L.jsxs)(x.eb,{value:e.code,children:[e.code," - ",e.name]},e.code))})]})]}),(0,L.jsxs)("div",{className:"space-y-2",children:[(0,L.jsx)(u.J,{children:"Subject"}),(0,L.jsx)(m.p,{placeholder:"e.g., History, Mathematics",value:ve,onChange:e=>Ne(e.target.value)})]}),(0,L.jsxs)("div",{className:"space-y-2",children:[(0,L.jsx)(u.J,{children:"Year Level"}),(0,L.jsx)(m.p,{placeholder:"e.g., 9, Stage 5",value:be,onChange:e=>ye(e.target.value)})]})]})}),(0,L.jsx)(d.wL,{children:(0,L.jsx)(c.$,{onClick:async()=>{if(H)if(ve&&be){ce(!0),_e(null);try{var e,s,a;const l=new FormData;l.append("state",H),l.append("subject",ve),l.append("year_level",be);const t=await i.A.post(`${r.nC}/admin/curriculum/test-generation`,l,{headers:{"Content-Type":"multipart/form-data"}});_e(t.data),null!==(e=t.data.verification)&&void 0!==e&&e.all_codes_verified?n.oR.success("LLM is correctly using uploaded curriculum!"):(null===(s=t.data.verification)||void 0===s||null===(a=s.codes_not_in_uploaded_curriculum)||void 0===a?void 0:a.length)>0&&n.oR.warning("Some codes were not from the uploaded curriculum")}catch(l){n.oR.error("Test generation failed")}finally{ce(!1)}}else n.oR.error("Please enter subject and year level");else n.oR.error("Please select a state first")},disabled:ne||!H||!ve||!be,className:"bg-blue-600 hover:bg-blue-700",children:ne?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(N.A,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"Run Test Generation"]})})})]}),we&&(0,L.jsxs)(d.Zp,{className:we.success?"border-blue-200":"border-red-200",children:[(0,L.jsx)(d.aR,{children:(0,L.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[null!==(V=we.verification)&&void 0!==V&&V.all_codes_verified?(0,L.jsx)(f.A,{className:"h-5 w-5 text-emerald-600"}):(0,L.jsx)(b.A,{className:"h-5 w-5 text-amber-600"}),"Test Results"]})}),(0,L.jsxs)(d.Wu,{className:"space-y-4",children:[(0,L.jsxs)("div",{className:"p-3 bg-gray-50 rounded-lg",children:[(0,L.jsx)("p",{className:"text-sm font-medium",children:"Curriculum Version Used:"}),(0,L.jsxs)("p",{className:"text-xs text-gray-600",children:["Version: ",(null===(I=we.curriculum_version)||void 0===I?void 0:I.version_id)||"N/A"," \u2022 Uploaded: ",Ie(null===(J=we.curriculum_version)||void 0===J?void 0:J.uploaded_at)," \u2022 File: ",(null===(X=we.curriculum_version)||void 0===X?void 0:X.filename)||"N/A"]}),(0,L.jsxs)("p",{className:"text-sm mt-1",children:["Matching curriculum items found: ",(0,L.jsx)("strong",{children:we.curriculum_items_found})]})]}),(0,L.jsxs)("div",{className:"p-3 border rounded-lg",children:[(0,L.jsx)("p",{className:"font-medium mb-2",children:"Code Verification:"}),(null===(M=we.verification)||void 0===M||null===(P=M.codes_from_uploaded_curriculum)||void 0===P?void 0:P.length)>0&&(0,L.jsxs)("div",{className:"mb-2",children:[(0,L.jsxs)("p",{className:"text-sm text-emerald-700 flex items-center gap-1",children:[(0,L.jsx)(f.A,{className:"h-4 w-4"}),"Codes from uploaded curriculum:"]}),(0,L.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:we.verification.codes_from_uploaded_curriculum.map(e=>(0,L.jsx)(o.E,{className:"bg-emerald-100 text-emerald-800",children:e},e))})]}),(null===(z=we.verification)||void 0===z||null===(q=z.codes_not_in_uploaded_curriculum)||void 0===q?void 0:q.length)>0&&(0,L.jsxs)("div",{children:[(0,L.jsxs)("p",{className:"text-sm text-amber-700 flex items-center gap-1",children:[(0,L.jsx)(g.A,{className:"h-4 w-4"}),"Codes NOT in uploaded curriculum (potential hallucination):"]}),(0,L.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:we.verification.codes_not_in_uploaded_curriculum.map(e=>(0,L.jsx)(o.E,{variant:"destructive",children:e},e))})]})]}),we.test_generation&&(0,L.jsxs)("div",{className:"p-3 bg-blue-50 rounded-lg",children:[(0,L.jsx)("p",{className:"font-medium mb-2",children:"Generated Lesson Outline:"}),we.test_generation.lesson_topic&&(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"Topic:"})," ",we.test_generation.lesson_topic]}),we.test_generation.learning_intention&&(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"Learning Intention:"})," ",we.test_generation.learning_intention]}),we.test_generation.raw_response&&(0,L.jsx)("pre",{className:"text-xs mt-2 p-2 bg-white rounded overflow-auto max-h-[200px]",children:we.test_generation.raw_response})]})]})]})]})]}),(0,L.jsx)(p.lG,{open:Ce,onOpenChange:Ae,children:(0,L.jsxs)(p.Cf,{children:[(0,L.jsxs)(p.c7,{children:[(0,L.jsx)(p.L3,{children:"Confirm Rollback"}),(0,L.jsx)(p.rr,{children:"Are you sure you want to rollback to this version? The current curriculum will be archived."})]}),Se&&(0,L.jsxs)("div",{className:"py-4",children:[(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"File:"}
1)," ",Se.filename]}),(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"Items:"})," ",Se.item_count]}),(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"Uploaded:"})," ",Ie(Se.uploaded_at)]}),(0,L.jsxs)("p",{children:[(0,L.jsx)("strong",{children:"By:"})," ",Se.uploaded_by_email]})]}),(0,L.jsxs)(p.Es,{children:[(0,L.jsx)(c.$,{variant:"outline",onClick:()=>Ae(!1),children:"Cancel"}),(0,L.jsx)(c.$,{onClick:async()=>{if(Se){ke(!0);try{await i.A.post(`${r.nC}/admin/curriculum/state/${H}/rollback/${Se.version_id}`,{}),n.oR.success(`Rolled back to version from ${new Date(Se.uploaded_at).toLocaleDateString()}`),Ae(!1),Ze(H),Ee(H)}catch(e){n.oR.error("Rollback failed")}finally{ke(!1)}}},disabled:Te,className:"bg-amber-600 hover:bg-amber-700",children:Te?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(N.A,{className:"h-4 w-4 mr-2 animate-spin"}),"Rolling back..."]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(S.A,{className:"h-4 w-4 mr-2"}),"Confirm Rollback"]})})]})]})})]})}}}]); 2//# sourceMappingURL=4729.21236164.chunk.js.map
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.