1"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[9721],{28589(e,s,t){t.d(s,{A:()=>l});var a=t(70067),r=t(70579);const l=e=>{let{checkAdvice:s,testId:t="ai-image-text-notice"}=e;return(0,r.jsxs)("div",{className:"flex items-start gap-2.5 text-xs px-3 py-2.5 rounded-lg border border-secondary/40 bg-secondary/10 text-foreground","data-testid":t,children:[(0,r.jsx)(a.A,{className:"w-4 h-4 flex-shrink-0 mt-0.5 text-foreground/70"}),(0,r.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,r.jsx)("p",{className:"font-semibold",children:"Check the words inside your images"}),(0,r.jsxs)("p",{className:"text-muted-foreground",children:["AI image tools draw letters as shapes rather than spelling them, so any writing that ends up in a picture (a sign, a book page, a label) can be misspelt or look like gibberish. We ask for images without text and proofread all written content, but we can't fully control what the image tool draws. ",s]})]})]})}},18322(e,s,t){t.d(s,{GH:()=>f,Ih:()=>x,v3:()=>p});var a=t(65043),r=t(65598),l=t(13390),i=t(63944),o=t(40614),n=t(4980),d=t(73824),c=t(70579);const u="https://www.trustpilot.com/review/mycurriculummate.com.au",h="mcm_gen_count",m="mcm_trustpilot_gen_shown",x=e=>{let{user:s,onDismiss:t}=e;const[r,l]=(0,a.useState)(!1);(0,a.useEffect)(()=>{s&&s.login_count>=2&&!s.trustpilot_login_nudge_shown&&l(!0)},[s]);const h=(0,a.useCallback)(async()=>{l(!1);try{await n.A.post(`${d.nC}/auth/trustpilot-dismiss`)}catch{}t&&t()},[t]);return r?(0,c.jsxs)("div",{className:"relative flex items-center gap-3 rounded-lg border border-yellow-200 bg-yellow-50 px-4 py-3 text-sm text-yellow-900 mb-4",children:[(0,c.jsx)(i.A,{className:"w-4 h-4 shrink-0 text-yellow-500 fill-yellow-400"}),(0,c.jsxs)("span",{className:"flex-1",children:["Welcome back! If My Curriculum Mate has saved you time, a quick"," ",(0,c.jsx)("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"font-semibold underline underline-offset-2 hover:text-yellow-800",children:"Trustpilot review"})," ","helps other teachers find us \u2014 it takes 60 seconds."]}),(0,c.jsx)("button",{onClick:h,"aria-label":"Dismiss",className:"shrink-0 rounded p-0.5 hover:bg-yellow-100",children:(0,c.jsx)(o.A,{className:"w-4 h-4"})})]}):null},p=()=>{if(localStorage.getItem(m))return!1;const e=parseInt(localStorage.getItem(h)||"0",10)+1;return localStorage.setItem(h,String(e)),3===e},f=e=>{let{isOpen:s,onClose:t}=e;const a=()=>{localStorage.setItem(m,"1"),t()};return(0,c.jsx)(r.lG,{open:s,onOpenChange:a,children:(0,c.jsxs)(r.Cf,{className:"sm:max-w-sm text-center",children:[(0,c.jsxs)(r.c7,{children:[(0,c.jsx)("div",{className:"flex justify-center mb-2",children:(0,c.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,c.jsx)(i.A,{className:"w-6 h-6 text-yellow-400 fill-yellow-400"},e))})}),(0,c.jsx)(r.L3,{className:"text-center",children:"Loving My Curriculum Mate?"}),(0,c.jsx)(r.rr,{className:"text-center",children:"You've just created your third resource \u2014 you're on a roll! A quick review on Trustpilot helps other Australian teachers discover us."})]}),(0,c.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[(0,c.jsx)(l.$,{onClick:()=>{localStorage.setItem(m,"1"),window.open(u,"_blank","noopener,noreferrer"),t()},className:"w-full bg-[#00b67a] hover:bg-[#00a06c] text-white",children:"Leave a Review on Trustpilot"}),(0,c.jsx)(l.$,{variant:"ghost",onClick:a,className:"w-full text-muted-foreground",children:"Maybe Later"})]})]})})}},65005(e,s,t){t.d(s,{S:()=>n});var a=t(65043),r=t(76622),l=t(36210),i=t(99766),o=t(70579);const n=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,o.jsx)(r.bL,{ref:s,className:(0,i.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...a,children:(0,o.jsx)(r.C1,{className:(0,i.cn)("flex items-center justify-center text-current"),children:(0,o.jsx)(l.A,{className:"h-4 w-4"})})})});n.displayName=r.bL.displayName},92264(e,s,t){t.d(s,{p:()=>i});var a=t(65043),r=t(99766),l=t(70579);const i=a.forwardRef((e,s)=>{let{className:t,type:a,...i}=e;return(0,l.jsx)("input",{type:a,className:(0,r.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",t),ref:s,...i})});i.displayName="Input"},84370(e,s,t){t.d(s,{bq:()=>h,eb:()=>f,gC:()=>p,l6:()=>c,yv:()=>u});var a=t(65043),r=t(22095),l=t(36210),i=t(92382),o=t(15711),n=t(99766),d=t(70579);const c=r.bL,u=(r.YJ,r.WT),h=a.forwardRef((e,s)=>{let{className:t,children:a,...l}=e;return(0,d.jsxs)(r.l9,{ref:s,className:(0,n.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",t),...l,children:[a,(0,d.jsx)(r.In,{asChild:!0,children:(0,d.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=r.l9.displayName;const m=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)(r.PP,{ref:s,className:(0,n.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,d.jsx)(o.A,{className:"h-4 w-4"})})});m.displayName=r.PP.displayName;const x=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)(r.wn,{ref:s,className:(0,n.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,d.jsx)(i.A,{className:"h-4 w-4"})})});x.displayName=r.wn.displayName;const p=a.forwardRef((e,s)=>{let{className:t,children:a,position:l="popper",...i}=e;return(0,d.jsx)(r.ZL,{children:(0,d.jsxs)(r.UC,{ref:s,className:(0,n.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]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...i,children:[(0,d.jsx)(m,{}),(0,d.jsx)(r.LM,{className:(0,n.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,d.jsx)(x,{})]})})});p.displayName=r.UC.displayName;a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)(r.JU,{ref:s,className:(0,n.cn)("px-2 py-1.5 text-sm font-semibold",t),...a})}).displayName=r.JU.displayName;const f=a.forwardRef((e,s)=>{let{className:t,children:a,...i}=e;return(0,d.jsxs)(r.q7,{ref:s,className:(0,n.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",t),...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)(r.VF,{children:(0,d.jsx)(l.A,{className:"h-4 w-4"})})}),(0,d.jsx)(r.p4,{children:a})]})});f.displayName=r.q7.displayName;a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,d.jsx)(r.wv,{ref:s,className:(0,n.cn)("-mx-1 my-1 h-px bg-muted",t),...a})}).displayName=r.wv.displayName},19690(e,s,t){t.d(s,{Xi:()=>d,av:()=>c,j7:()=>n,tU:()=>o});var a=t(65043),r=t(47127),l=t(99766),i=t(70579);const o=r.bL,n=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,i.jsx)(r.B8,{ref:s,className:(0,l.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",t),...a})});n.displayName=r.B8.displayName;const d=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,i.jsx)(r.l9,{ref:s,className:(0,l.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",t),...a})});d.displayName=r.l9.displayName;const c=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,i.jsx)(r.UC,{ref:s,className:(0,l.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...a})});c.displayName=r.UC.displayName},79721(e,s,t){t.r(s),t.d(s,{default:()=>I});var a=t(65043),r=t(45621),l=t(73824),i=t(4980),o=t(56328),n=t(13390),d=t(91140),c=t(92264),u=t(59938),h=t(13416),m=t(25440),x=t(18322),p=t(84370),f=t(65005),g=t(5949),j=t(19690),v=t(46258),b=t(28589),w=t(95258),y=t(22024),N=t(56099),k=t(65469),C=t(7104),_=t(41680),A=t(71360),S=t(72308),q=t(39292),R=t(9855),$=t(40614),L=t(57040),E=t(1673),W=t(70579);const I=()=>{var e,s,t,I,T,F;const J=(0,r.Zp)(),{user:M}=(0,l.As)(),[P]=(0,r.ok)(),[B,G]=(0,a.useState)(!1),[U,V]=(0,a.useState)(!1),[z,O]=(0,a.useState)(null),[D,Y]=(0,a.useState)([]),[Z,H]=(0,a.useState)([]),[K,Q]=(0,a.useState)([]),[X,ee]=(0,a.useState)([]),[se,te]=(0,a.useState)("create"),[ae,re]=(0,a.useState)(!1),[le,ie]=(0,a.useState)(!1),[oe,ne]=(0,a.useState)(null),[de,ce]=(0,a.useState)(""),[ue,he]=(0,a.useState)("all"),[me,xe]=(0,a.useState)("all"),[pe,fe]=(0,a.useState)({title:P.get("title")||"",year_level:P.get("year_level")||"",subject:P.get("subject")||"",topic:P.get("topic")||"",difficulty:"mixed",question_types:["multiple_choice","short_answer"],num_questions:10,include_differentiation:!1,outcome_codes:P.get("outcome_codes")||""}),[ge,je]=(0,a.useState)({slideshow_id:P.get("slideshow")||"",title:"",worksheet_type:"quiz",include_differentiation:!0,num_questions:10}),ve=e=>({HASS:"HASS / HSIE"}[e]||e),be=(0,a.useCallback)(async()=>{try{const e=await i.A.get(`${l.nC}/subscription/credits`);ne(e.data)}catch{}},[]),we=(0,a.useCallback)(async()=>{try{const e=await i.A.get(`${l.nC}/curriculum/years`);Q(e.data.years)}catch(e){console.error("Error fetching years:",e)}},[]),ye=(0,a.useCallback)(async e=>{try{const s=await i.A.get(`${l.nC}/curriculum/${e}
1/subjects`);ee(s.data.subjects)}catch(s){console.error("Error fetching subjects:",s)}},[]),Ne=(0,a.useCallback)(async()=>{try{const e=await i.A.get(`${l.nC}/worksheets`);Y(e.data)}catch(e){console.error("Error fetching worksheets:",e)}},[]),ke=(0,a.useCallback)(async()=>{try{const e=await i.A.get(`${l.nC}/slideshows`);H(e.data)}catch(e){console.error("Error fetching slideshows:",e)}},[]);(0,a.useEffect)(()=>{be(),we(),Ne(),ke(),P.get("slideshow")&&te("from-slideshow");const e=()=>{Ne()};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[be,we,Ne,ke,P]),(0,a.useEffect)(()=>{pe.year_level&&ye(pe.year_level)},[pe.year_level,ye]);const Ce=(0,a.useMemo)(()=>D.filter(e=>{var s,t,a;const r=""===de||(null===(s=e.title)||void 0===s?void 0:s.toLowerCase().includes(de.toLowerCase()))||(null===(t=e.topic)||void 0===t?void 0:t.toLowerCase().includes(de.toLowerCase()))||(null===(a=e.subject)||void 0===a?void 0:a.toLowerCase().includes(de.toLowerCase())),l="all"===ue||e.year_level===ue,i="all"===me||e.subject===me;return r&&l&&i}),[D,de,ue,me]),_e=(0,a.useMemo)(()=>[...new Set(D.map(e=>e.subject).filter(Boolean))],[D]),Ae=()=>{ce(""),he("all"),xe("all")};return(0,W.jsxs)(v.A,{children:[(B||U)&&(0,W.jsx)("div",{className:"fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex items-center justify-center",children:(0,W.jsx)(L.A,{type:"worksheet",title:"Creating your worksheet..."})}),(0,W.jsxs)("div",{className:"max-w-5xl mx-auto","data-testid":"worksheet-tool-page",children:[(0,W.jsx)(m.A,{}),(0,W.jsxs)(n.$,{variant:"ghost",onClick:()=>J("/dashboard"),className:"mb-4",children:[(0,W.jsx)(k.A,{className:"w-4 h-4 mr-2"}),"Back to Dashboard"]}),(0,W.jsxs)("div",{className:"flex items-center gap-3 mb-8",children:[(0,W.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-green-500 to-emerald-600 flex items-center justify-center text-white",children:(0,W.jsx)(_.A,{className:"w-6 h-6"})}),(0,W.jsxs)("div",{className:"min-w-0",children:[(0,W.jsx)("h1",{className:"text-3xl font-bold text-foreground",children:"Worksheet Creator"}),(0,W.jsx)("p",{className:"text-muted-foreground",children:"Generate print-ready worksheets with AI"})]})]}),(0,W.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-8",children:[(0,W.jsx)("div",{className:"lg:col-span-3",children:(0,W.jsxs)(j.tU,{value:se,onValueChange:te,className:"w-full",children:[(0,W.jsxs)(j.j7,{className:"grid w-full grid-cols-2 mb-6",children:[(0,W.jsxs)(j.Xi,{value:"create","data-testid":"create-tab",children:[(0,W.jsx)(A.A,{className:"w-4 h-4 mr-2"}),"Create New"]}),(0,W.jsxs)(j.Xi,{value:"from-slideshow","data-testid":"from-slideshow-tab",children:[(0,W.jsx)(S.A,{className:"w-4 h-4 mr-2"}),"From Slideshow"]})]}),(0,W.jsx)(j.av,{value:"create",children:(0,W.jsxs)(d.Zp,{className:"border-border/50","data-testid":"generator-form",children:[(0,W.jsx)(d.aR,{children:(0,W.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[(0,W.jsx)(N.A,{className:"w-5 h-5 text-secondary"}),"Generate New Worksheet"]})}),(0,W.jsxs)(d.Wu,{className:"space-y-4",children:[(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Worksheet Title *"}),(0,W.jsx)(c.p,{placeholder:"e.g., Fractions Practice",value:pe.title,onChange:e=>fe({...pe,title:e.target.value}),"data-testid":"title-input"})]}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Year Level *"}),(0,W.jsxs)(p.l6,{value:pe.year_level,onValueChange:e=>fe({...pe,year_level:e}),children:[(0,W.jsx)(p.bq,{"data-testid":"year-select",children:(0,W.jsx)(p.yv,{placeholder:"Select year"})}),(0,W.jsx)(p.gC,{children:K.map(e=>(0,W.jsx)(p.eb,{value:e,children:"K"===e?"Kindergarten":`Year ${e}`},e))})]})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Subject *"}),(0,W.jsxs)(p.l6,{value:pe.subject,onValueChange:e=>fe({...pe,subject:e}),disabled:!pe.year_level,children:[(0,W.jsx)(p.bq,{"data-testid":"subject-select",children:(0,W.jsx)(p.yv,{placeholder:"Select subject"})}),(0,W.jsx)(p.gC,{children:X.map(e=>(0,W.jsx)(p.eb,{value:e,children:ve(e)},e))})]})]})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Topic *"}),(0,W.jsx)(c.p,{placeholder:"e.g., Adding and subtracting fractions",value:pe.topic,onChange:e=>fe({...pe,topic:e.target.value}),"data-testid":"topic-input"})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Keywords (optional)"}),(0,W.jsx)(c.p,{placeholder:"e.g., visual, word problems, real-world, scaffolded",value:pe.keywords||"",onChange:e=>fe({...pe,keywords:e.target.value}),"data-testid":"keywords-input"}),(0,W.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Add keywords to guide AI worksheet generation"})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Outcome Codes (optional)"}),(0,W.jsx)(h.T,{placeholder:"e.g. AC9M5N08, AC9M5N02",value:pe.outcome_codes||"",onChange:e=>fe({...pe,outcome_codes:e.target.value}),className:"resize-none h-16 font-mono text-sm","data-testid":"outcome-codes-input"}),(0,W.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Enter specific outcome codes (comma-separated) to align questions to those outcomes. Works with any curriculum: National, NSW, VIC, or WA. Codes guide question alignment but will not appear on the printed worksheet."})]}),(0,W.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Difficulty"}),(0,W.jsxs)(p.l6,{value:pe.difficulty,onValueChange:e=>fe({...pe,difficulty:e}),children:[(0,W.jsx)(p.bq,{children:(0,W.jsx)(p.yv,{})}),(0,W.jsxs)(p.gC,{children:[(0,W.jsx)(p.eb,{value:"easy",children:"Easy"}),(0,W.jsx)(p.eb,{value:"medium",children:"Medium"}),(0,W.jsx)(p.eb,{value:"hard",children:"Hard"}),(0,W.jsx)(p.eb,{value:"mixed",children:"Mixed"})]})]})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Number of Questions"}),(0,W.jsxs)(p.l6,{value:pe.num_questions.toString(),onValueChange:e=>fe({...pe,num_questions:parseInt(e)}),children:[(0,W.jsx)(p.bq,{children:(0,W.jsx)(p.yv,{})}),(0,W.jsxs)(p.gC,{children:[(0,W.jsx)(p.eb,{value:"5",children:"5 questions"}),(0,W.jsx)(p.eb,{value:"10",children:"10 questions"}),(0,W.jsx)(p.eb,{value:"15",children:"15 questions"}),(0,W.jsx)(p.eb,{value:"20",children:"20 questions"})]})]})]})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Question Types"}),(0,W.jsx)("div",{className:"grid grid-cols-2 gap-2 mt-2",children:[{value:"multiple_choice",label:"Multiple Choice"},{value:"short_answer",label:"Short Answer"},{value:"true_false",label:"True/False"},{value:"fill_blank",label:"Fill in the Blank"},{value:"matching",label:"Matching"}].map(e=>(0,W.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,W.jsx)(f.S,{id:e.value,checked:pe.question_types.includes(e.value),onCheckedChange:()=>{return s=e.value,void fe(e=>({...e,question_types:e.question_types.includes(s)?e.question_types.filter(e=>e!==s):[...e.question_types,s]}));var s}}),(0,W.jsx)("label",{htmlFor:e.value,className:"text-sm cursor-pointer",children:e.label})]},e.value))})]}),(0,W.jsxs)("div",{className:"flex items-start gap-3 p-4 rounded-lg border-2 cursor-pointer transition-colors "+(pe.include_differentiation?"border-emerald-300 bg-emerald-50":"border-border bg-muted/30"),onClick:()=>fe({...pe,include_differentiation:!pe.include_differentiation}),children:[(0,W.jsx)(f.S,{checked:pe.include_differentiation,onCheckedChange:e=>fe({...pe,include_differentiation:e}),className:"mt-0.5"}),(0,W.jsxs)("div",{className:"min-w-0",children:[(0,W.jsxs)("p",{className:"text-sm font-medium flex items-center gap-2",children:[(0,W.jsx)(w.A,{className:"w-4 h-4 text-emerald-600"}),"Include Differentiated Learning Levels"]}),(0,W.jsx)("p",{className:"text-xs text-muted-foreground",children:"Generate Foundation, Standard, and Extension ver
1sions"})]})]}),(0,W.jsx)(b.A,{testId:"worksheet-image-text-notice",checkAdvice:"The header image only shows on screen (it isn't included when you print or download), so please check it before showing your worksheet to the class."}),oe&&"admin"!==(null===M||void 0===M?void 0:M.role)&&(0,W.jsxs)("div",{className:"flex items-center justify-between text-sm px-3 py-2 rounded-lg border "+((null!==(e=oe.balance)&&void 0!==e?e:0)>=5?"bg-primary/5 border-primary/20 text-primary":"bg-amber-50 border-amber-200 text-amber-700"),children:[(0,W.jsxs)("span",{children:["Credit cost: ",(0,W.jsx)("strong",{children:"5"})]}),(0,W.jsxs)("span",{children:[(null!==(s=oe.balance)&&void 0!==s?s:0)>=5?"\u2713":"\u26a0"," ",null!==(t=oe.balance)&&void 0!==t?t:0," available"]})]}),(0,W.jsxs)(n.$,{onClick:async()=>{if(pe.title&&pe.year_level&&pe.subject&&pe.topic){G(!0);try{const e=pe.outcome_codes?pe.outcome_codes.split(",").map(e=>e.trim()).filter(Boolean):[],s=await i.A.post(`${l.nC}/worksheets/generate`,{...pe,outcome_codes:e},{timeout:3e5}),t=s.data;Y(e=>[t,...e]),o.oR.success("Worksheet generated successfully!"),(0,x.v3)()&&ie(!0),J(`/tools/worksheet/${s.data.worksheet_id}`)}catch(g){var e;console.error("Error generating worksheet:",g);const x=null===(e=g.response)||void 0===e?void 0:e.status;var s,t,a,r,n,d,c,u;if(x>=400&&x<500)return void(403===x&&(null!==(s=g.response)&&void 0!==s&&null!==(t=s.data)&&void 0!==t&&null!==(a=t.detail)&&void 0!==a&&a.toLowerCase().includes("insufficient credits")||null!==(r=g.response)&&void 0!==r&&null!==(n=r.data)&&void 0!==n&&null!==(d=n.detail)&&void 0!==d&&d.toLowerCase().includes("free trial has ended"))?re(!0):null!==(c=g.response)&&void 0!==c&&null!==(u=c.data)&&void 0!==u&&u.detail?o.oR.error(g.response.data.detail):o.oR.error("Failed to generate worksheet. Please try again."));try{const e=(await i.A.get(`${l.nC}/worksheets`)).data;if(Array.isArray(e)&&e.length>D.length){Y(e);const s=e[0];o.oR.success("Worksheet was created successfully!",{duration:5e3}),J(`/tools/worksheet/${s.worksheet_id}`)}else{var h,m,p,f;Array.isArray(e)&&Y(e),"ECONNABORTED"===g.code||null!==(h=g.message)&&void 0!==h&&h.includes("timeout")||null!==(m=g.message)&&void 0!==m&&m.includes("Network Error")?o.oR.warning("The request took longer than expected. Please try again.",{duration:6e3}):null!==(p=g.response)&&void 0!==p&&null!==(f=p.data)&&void 0!==f&&f.detail?o.oR.error(g.response.data.detail):o.oR.error("Failed to generate worksheet. Please try again.")}}catch(j){o.oR.error("Failed to generate worksheet. Please try again.")}}finally{G(!1)}}else o.oR.error("Please fill in all required fields")},disabled:B,className:"w-full bg-primary text-primary-foreground hover:bg-primary/90 rounded-full","data-testid":"generate-btn",children:[(0,W.jsx)(N.A,{className:"w-4 h-4 mr-2"}),"Generate Worksheet"]})]})]})}),(0,W.jsx)(j.av,{value:"from-slideshow",children:(0,W.jsxs)(d.Zp,{className:"border-border/50","data-testid":"slideshow-form",children:[(0,W.jsx)(d.aR,{children:(0,W.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[(0,W.jsx)(S.A,{className:"w-5 h-5 text-amber-500"}),"Generate from Slideshow"]})}),(0,W.jsx)(d.Wu,{className:"space-y-4",children:0===Z.length?(0,W.jsxs)("div",{className:"text-center py-8",children:[(0,W.jsx)(S.A,{className:"w-12 h-12 text-muted-foreground/50 mx-auto mb-4"}),(0,W.jsx)("p",{className:"text-muted-foreground mb-4",children:"No slideshows available"}),(0,W.jsx)(n.$,{onClick:()=>J("/tools/slideshow"),variant:"outline",children:"Create a Slideshow First"})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Select Slideshow *"}),(0,W.jsxs)(p.l6,{value:ge.slideshow_id,onValueChange:e=>je({...ge,slideshow_id:e}),children:[(0,W.jsx)(p.bq,{"data-testid":"slideshow-select",children:(0,W.jsx)(p.yv,{placeholder:"Choose a slideshow"})}),(0,W.jsx)(p.gC,{children:Z.map(e=>(0,W.jsxs)(p.eb,{value:e.slideshow_id,children:[e.title," (Year ",e.year_level,")"]},e.slideshow_id))})]})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Worksheet Title *"}),(0,W.jsx)(c.p,{placeholder:"e.g., Solar System Quiz",value:ge.title,onChange:e=>je({...ge,title:e.target.value}),"data-testid":"slideshow-title-input"})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Worksheet Type"}),(0,W.jsxs)(p.l6,{value:ge.worksheet_type,onValueChange:e=>je({...ge,worksheet_type:e}),children:[(0,W.jsx)(p.bq,{"data-testid":"worksheet-type-select",children:(0,W.jsx)(p.yv,{})}),(0,W.jsx)(p.gC,{children:[{value:"quiz",label:"Quiz (Multiple choice, T/F, short answer)"},{value:"fill_blank",label:"Fill in the Blank"},{value:"activity",label:"Activity (Hands-on tasks)"},{value:"comprehension",label:"Comprehension (Extended responses)"},{value:"mixed",label:"Mixed (All types)"}].map(e=>(0,W.jsx)(p.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,W.jsxs)("div",{className:"form-group",children:[(0,W.jsx)(u.J,{children:"Number of Questions"}),(0,W.jsxs)(p.l6,{value:ge.num_questions.toString(),onValueChange:e=>je({...ge,num_questions:parseInt(e)}),children:[(0,W.jsx)(p.bq,{children:(0,W.jsx)(p.yv,{})}),(0,W.jsxs)(p.gC,{children:[(0,W.jsx)(p.eb,{value:"5",children:"5 questions"}),(0,W.jsx)(p.eb,{value:"10",children:"10 questions"}),(0,W.jsx)(p.eb,{value:"15",children:"15 questions"}),(0,W.jsx)(p.eb,{value:"20",children:"20 questions"})]})]})]}),(0,W.jsx)("div",{className:"form-group",children:(0,W.jsxs)("div",{className:"flex items-center space-x-3 p-4 bg-emerald-50 rounded-lg border border-emerald-200",children:[(0,W.jsx)(f.S,{id:"include-diff",checked:ge.include_differentiation,onCheckedChange:e=>je({...ge,include_differentiation:e}),"data-testid":"differentiation-checkbox"}),(0,W.jsxs)("div",{className:"min-w-0",children:[(0,W.jsxs)("label",{htmlFor:"include-diff",className:"text-sm font-medium cursor-pointer flex items-center gap-2",children:[(0,W.jsx)(w.A,{className:"w-4 h-4 text-emerald-600"}),"Include Differentiated Learning Levels"]}),(0,W.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Generate Foundation, Standard, and Extension ver
1sions"})]})]})}),ge.include_differentiation&&ge.num_questions>10&&(0,W.jsxs)("p",{className:"text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded-lg p-3",children:["Generating ",ge.num_questions," questions \xd7 3 levels (",3*ge.num_questions," total). This may take up to 60 seconds."]}),(0,W.jsx)(b.A,{testId:"worksheet-from-slideshow-image-text-notice",checkAdvice:"The header image only shows on screen (it isn't included when you print or download), so please check it before showing your worksheet to the class."}),oe&&"admin"!==(null===M||void 0===M?void 0:M.role)&&(0,W.jsxs)("div",{className:"flex items-center justify-between text-sm px-3 py-2 rounded-lg border "+((null!==(I=oe.balance)&&void 0!==I?I:0)>=5?"bg-primary/5 border-primary/20 text-primary":"bg-amber-50 border-amber-200 text-amber-700"),children:[(0,W.jsxs)("span",{children:["Credit cost: ",(0,W.jsx)("strong",{children:"5"})]}),(0,W.jsxs)("span",{children:[(null!==(T=oe.balance)&&void 0!==T?T:0)>=5?"\u2713":"\u26a0"," ",null!==(F=oe.balance)&&void 0!==F?F:0," available"]})]}),(0,W.jsxs)(n.$,{onClick:async()=>{if(ge.slideshow_id&&ge.title){V(!0);try{const e=await i.A.post(`${l.nC}/worksheets/generate-from-slideshow`,ge,{timeout:3e5}),s=e.data;Y(e=>[s,...e]),o.oR.success("Worksheet generated successfully!"),(0,x.v3)()&&ie(!0),J(`/tools/worksheet/${e.data.worksheet_id}`)}catch(p){var e,s,t,a,r,n,d,c,u,h,m;"ECONNABORTED"===p.code||null!==(e=p.message)&&void 0!==e&&e.includes("timeout")?o.oR.error("Request timed out. The AI is taking longer than expected. Please try again."):403===(null===(s=p.response)||void 0===s?void 0:s.status)&&(null!==(t=p.response)&&void 0!==t&&null!==(a=t.data)&&void 0!==a&&null!==(r=a.detail)&&void 0!==r&&r.toLowerCase().includes("insufficient credits")||null!==(n=p.response)&&void 0!==n&&null!==(d=n.data)&&void 0!==d&&null!==(c=d.detail)&&void 0!==c&&c.toLowerCase().includes("free trial has ended"))?re(!0):403===(null===(u=p.response)||void 0===u?void 0:u.status)||null!==(h=p.response)&&void 0!==h&&null!==(m=h.data)&&void 0!==m&&m.detail?o.oR.error(p.response.data.detail):o.oR.error("Failed to generate worksheet. Please try again.")}finally{V(!1)}}else o.oR.error("Please select a slideshow and enter a title")},disabled:U,className:"w-full bg-amber-500 text-white hover:bg-amber-600 rounded-full","data-testid":"generate-from-slideshow-btn",children:[(0,W.jsx)(N.A,{className:"w-4 h-4 mr-2"}),"Generate Worksheet"]})]})})]})})]})}),(0,W.jsx)("div",{className:"lg:col-span-2",children:(0,W.jsxs)(d.Zp,{className:"border-border/50","data-testid":"worksheets-list",children:[(0,W.jsx)(d.aR,{children:(0,W.jsxs)(d.ZB,{className:"flex items-center justify-between",children:[(0,W.jsx)("span",{children:"Your Worksheets"}),(0,W.jsx)(g.E,{variant:"secondary",children:D.length})]})}),(0,W.jsxs)(d.Wu,{children:[(0,W.jsxs)("div",{className:"mb-4 space-y-3","data-testid":"search-section",children:[(0,W.jsxs)("div",{className:"relative",children:[(0,W.jsx)(q.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),(0,W.jsx)(c.p,{placeholder:"Search by title, topic, or subject...",value:de,onChange:e=>ce(e.target.value),className:"pl-10 pr-10","data-testid":"search-input"}),(de||"all"!==ue||"all"!==me)&&(0,W.jsx)("button",{onClick:Ae,className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:(0,W.jsx)($.A,{className:"w-4 h-4"})})]}),(0,W.jsxs)("div",{className:"flex gap-2",children:[(0,W.jsxs)(p.l6,{value:ue,onValueChange:he,children:[(0,W.jsx)(p.bq,{className:"w-[110px]","data-testid":"year-filter",children:(0,W.jsx)(p.yv,{placeholder:"Year"})}),(0,W.jsxs)(p.gC,{children:[(0,W.jsx)(p.eb,{value:"all",children:"All Years"}),K.map(e=>(0,W.jsx)(p.eb,{value:e,children:"K"===e?"Kinder":`Year ${e}`},e))]})]}),(0,W.jsxs)(p.l6,{value:me,onValueChange:xe,children:[(0,W.jsx)(p.bq,{className:"w-[120px]","data-testid":"subject-filter",children:(0,W.jsx)(p.yv,{placeholder:"Subject"})}),(0,W.jsxs)(p.gC,{children:[(0,W.jsx)(p.eb,{value:"all",children:"All Subjects"}),_e.map(e=>(0,W.jsx)(p.eb,{value:e,children:e},e))]})]})]}),(de||"all"!==ue||"all"!==me)&&(0,W.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Showing ",Ce.length," of ",D.length," worksheets"]})]}),Ce.length>0?(0,W.jsx)("div",{className:"space-y-3 max-h-[500px] overflow-y-auto",children:Ce.map(e=>(0,W.jsxs)("div",{onClick:()=>J(`/tools/worksheet/${e.worksheet_id}`),className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 hover:bg-muted transition-colors cursor-pointer border border-transparent hover:border-primary/20","data-testid":`worksheet-item-${e.worksheet_id}`,children:[(0,W.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,W.jsx)("h4",{className:"font-medium text-foreground truncate",children:e.title}),(0,W.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,W.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Year ",e.year_level," \u2022 ",e.subject]})}),(0,W.jsxs)("div",{className:"flex gap-1 mt-2",children:["slideshow"===e.source_type&&(0,W.jsxs)(g.E,{variant:"outline",className:"text-xs bg-amber-50 text-amber-700 border-amber-200",children:[(0,W.jsx)(S.A,{className:"w-3 h-3 mr-1"}),"Slideshow"]}),e.include_differentiation&&(0,W.jsxs)(g.E,{variant:"outline",className:"text-xs bg-emerald-50 text-emerald-700 border-emerald-200",children:[(0,W.jsx)(w.A,{className:"w-3 h-3 mr-1"}),"Diff"]})]})]}),(0,W.jsxs)("div",{className:"flex gap-1 ml-2",children:[(0,W.jsx)(n.$,{variant:"ghost",size:"sm",onClick:s=>(async(e,s,t)=>{t.stopPropagation(),O(e);try{const t=await i.A.get(`${l.nC}/worksheets/${e}/export?format=docx&level=standard&include_answers=false`,{responseType:"blob"}),a=window.URL.createObjectURL(new Blob([t.data],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})),r=document.createElement("a");r.href=a,r.setAttribute("download",`${s.replace(/\s+/g,"_")}.docx`),document.body.appendChild(r),r.click(),r.remove(),window.URL.revokeObjectURL(a),o.oR.success("Worksheet exported to Word!")}catch(a){o.oR.error("Failed to export worksheet")}finally{O(null)}})(e.worksheet_id,e.title,s),disabled:z===e.worksheet_id,title:"Download as Word document","data-testid":`export-word-btn-${e.worksheet_id}`,children:z===e.worksheet_id?(0,W.jsx)(y.A,{className:"w-4 h-4 animate-spin"}):(0,W.jsx)(C.A,{className:"w-4 h-4"})}),(0,W.jsx)(n.$,{variant:"ghost",size:"sm",onClick:s=>(async(e,s)=>{if(s.stopPropagation(),window.confirm("Are you sure you want to delete this worksheet?"))try{await i.A.delete(`${l.nC}/worksheets/${e}`),o.oR.success("Worksheet deleted"),Ne()}catch(t){o.oR.error("Failed to delete worksheet")}})(e.worksheet_id,s),className:"text-destructive hover:text-destructive","data-testid":`delete-btn-${e.worksheet_id}`,children:(0,W.jsx)(R.A,{className:"w-4 h-4"})})]})]},e.worksheet_id))}):D.length>0?(0,W.jsxs)("div",{className:"text-center py-8",children:[(0,W.jsx)(q.A,{className:"w-12 h-12 text-muted-foreground
1/50 mx-auto mb-4"}),(0,W.jsx)("p",{className:"text-muted-foreground",children:"No worksheets match your search"}),(0,W.jsx)(n.$,{variant:"link",onClick:Ae,className:"text-sm",children:"Clear filters"})]}):(0,W.jsxs)("div",{className:"text-center py-8",children:[(0,W.jsx)(_.A,{className:"w-12 h-12 text-muted-foreground/50 mx-auto mb-4"}),(0,W.jsx)("p",{className:"text-muted-foreground",children:"No worksheets yet"}),(0,W.jsx)("p",{className:"text-sm text-muted-foreground",children:"Generate your first worksheet above"})]})]})]})})]})]}),(0,W.jsx)(E.A,{isOpen:ae,onClose:()=>re(!1),onPurchaseComplete:()=>{re(!1),Ne()}}),(0,W.jsx)(x.GH,{isOpen:le,onClose:()=>ie(!1)})]})}}}]); 2//# sourceMappingURL=9721.efc706c3.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.