1/*! For license information please see 9751.bac6e045.chunk.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[9751],{1673(e,s,a){a.d(s,{y:()=>_,A:()=>A});var t=a(65043),r=a(73824),l=a(4980),n=a(56328),i=a(13390),o=a(91140),c=a(5949),d=a(65598),u=a(99432),m=a(22024),p=a(20073),x=a(36210),h=a(51419),g=a(11009),f=a(99766),j=a(31699),v=a(10917),y=a(70579);const b=(0,v.F)("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});t.forwardRef((e,s)=>{let{className:a,variant:t,size:r,...l}=e;return(0,y.jsx)(j.b,{ref:s,className:(0,f.cn)(b({variant:t,size:r,className:a})),...l})}).displayName=j.b.displayName;const w=t.createContext({size:"default",variant:"default"}),N=t.forwardRef((e,s)=>{let{className:a,variant:t,size:r,children:l,...n}=e;return(0,y.jsx)(g.bL,{ref:s,className:(0,f.cn)("flex items-center justify-center gap-1",a),...n,children:(0,y.jsx)(w.Provider,{value:{variant:t,size:r},children:l})})});N.displayName=g.bL.displayName;const C=t.forwardRef((e,s)=>{let{className:a,children:r,variant:l,size:n,...i}=e;const o=t.useContext(w);return(0,y.jsx)(g.q7,{ref:s,className:(0,f.cn)(b({variant:o.variant||l,size:o.size||n}),a),...i,children:r})});C.displayName=g.q7.displayName;const k=a(26712).D.find(e=>"pro"===e.id)||{price:"$120",period:"/year",monthlyPrice:"$12.99",monthlyPeriod:"/month",monthlyBilling:"Billed monthly",yearlySavings:"Save with yearly billing"},_=e=>{let{onComplete:s}=e;const[a,i]=(0,t.useState)(!1);(0,t.useEffect)(()=>{const e=new URLSearchParams(window.location.search),s=e.get("credit_purchase"),a=e.get("session_id");"success"===s&&a?c(a):"cancelled"===s&&(n.oR.info("Credit purchase was cancelled"),window.history.replaceState({},document.title,window.location.pathname))},[]);const c=async e=>{i(!0);try{const a=await l.A.get(`${r.nC}/payments/credit-purchase/status/${e}`);"success"===a.data.status?(n.oR.success(a.data.message),s&&s()):"already_applied"===a.data.status?n.oR.info(a.data.message):"pending"===a.data.status?n.oR.info("Payment is still processing. Credits will be added shortly."):n.oR.error(a.data.message||"Failed to apply credits")}catch(a){n.oR.error("Failed to verify purchase. Please contact support if credits weren't added.")}finally{i(!1),window.history.replaceState({},document.title,window.location.pathname)}};return a?(0,y.jsx)("div",{className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:(0,y.jsx)(o.Zp,{className:"w-80",children:(0,y.jsxs)(o.Wu,{className:"pt-6 text-center",children:[(0,y.jsx)(m.A,{className:"w-12 h-12 animate-spin text-primary mx-auto mb-4"}),(0,y.jsx)("h3",{className:"font-semibold",children:"Applying Credits..."}),(0,y.jsx)("p",{className:"text-sm text-muted-foreground",children:"Please wait while we add credits to your account."})]})})}):null},A=e=>{let{isOpen:s,onClose:a,onPurchaseComplete:g}=e;const[f,j]=(0,t.useState)([]),[v,b]=(0,t.useState)(!0),[w,_]=(0,t.useState)(null),[A,S]=(0,t.useState)("yearly");(0,t.useEffect)(()=>{s&&R()},[s]);const R=async()=>{b(!0);try{const e=await l.A.get(`${r.nC}/payments/credit-packs`);j(e.data.packs)}catch(e){n.oR.error("Failed to load credit packs")}finally{b(!1)}},$=async e=>{_(e);try{const s=await l.A.post(`${r.nC}/payments/purchase-credits`,{pack_id:e});s.data.checkout_url&&(window.location.href=s.data.checkout_url)}catch(t){var s,a;n.oR.error((null===(s=t.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Failed to start purchase"),_(null)}},P=e=>e>=500?"from-purple-500 to-pink-500":e>=250?"from-blue-500 to-purple-500":e>
2=100?"from-green-500 to-blue-500":"from-amber-500 to-orange-500";return(0,y.jsx)(d.lG,{open:s,onOpenChange:a,children:(0,y.jsxs)(d.Cf,{className:"sm:max-w-[600px]",children:[(0,y.jsxs)(d.c7,{children:[(0,y.jsxs)(d.L3,{className:"flex items-center gap-2",children:[(0,y.jsx)(u.A,{className:"w-5 h-5 text-amber-500"}),"Buy More Credits"]}),(0,y.jsx)(d.rr,{children:"Purchase additional credits to continue generating lesson plans, slideshows, and worksheets."})]}),v?(0,y.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,y.jsx)(m.A,{className:"w-8 h-8 animate-spin text-primary"})}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(o.Zp,{className:"border-2 border-primary bg-primary/5 dark:bg-primary/10 overflow-hidden",children:[(0,y.jsx)("div",{className:"h-2 bg-gradient-to-r from-primary to-primary/70"}),(0,y.jsxs)(o.Wu,{className:"pt-5 pb-4",children:[(0,y.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,y.jsx)(p.A,{className:"w-5 h-5 text-primary"}),(0,y.jsx)("h3",{className:"font-bold text-lg",children:"Upgrade to Pro"})]}),(0,y.jsxs)(N,{type:"single",size:"sm",value:A,onValueChange:e=>e&&S(e),className:"w-fit bg-muted/60 rounded-full p-1 mb-3",children:[(0,y.jsx)(C,{value:"monthly",className:"rounded-full px-3 text-xs",children:"Monthly"}),(0,y.jsx)(C,{value:"yearly",className:"rounded-full px-3 text-xs",children:"Yearly"})]}),(0,y.jsxs)("div",{className:"flex items-baseline justify-between gap-2 mb-3",children:[(0,y.jsxs)("span",{className:"text-2xl font-bold text-primary",children:["monthly"===A?k.monthlyPrice:k.price,(0,y.jsx)("span",{className:"text-sm font-normal text-muted-foreground",children:"monthly"===A?k.monthlyPeriod:k.period})]}),(0,y.jsx)("span",{className:"text-xs text-muted-foreground text-right min-w-0",children:"monthly"===A?k.monthlyBilling:k.yearlySavings})]}),(0,y.jsxs)("ul",{className:"space-y-1.5 mb-4 text-sm",children:[(0,y.jsxs)("li",{className:"flex items-center gap-2",children:[(0,y.jsx)(x.A,{className:"w-4 h-4 text-primary flex-shrink-0"}),"500 credits monthly \u2014 unused credits roll over (up to 1,000)"]}),(0,y.jsxs)("li",{className:"flex items-center gap-2",children:[(0,y.jsx)(x.A,{className:"w-4 h-4 text-primary flex-shrink-0"}),"All Pro features \u2014 slideshows, unit plans, image generation, AI chat"]}),"yearly"===A&&(0,y.jsxs)("li",{className:"flex items-center gap-2",children:[(0,y.jsx)(x.A,{className:"w-4 h-4 text-primary flex-shrink-0"}
2),"7-day free trial (yearly billing) \u2014 no charge today"]})]}),(0,y.jsx)(i.$,{className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground",disabled:null!==w,onClick:async()=>{_("pro_upgrade");try{const e=await l.A.post(`${r.nC}/payments/create-checkout-session`,{tier:"monthly"===A?"pro_monthly":"pro"});e.data.checkout_url?window.location.href=e.data.checkout_url:(n.oR.error("Failed to start checkout"),_(null))}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)||"Failed to start checkout"),_(null)}},children:"pro_upgrade"===w?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Redirecting to checkout..."]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(p.A,{className:"w-4 h-4 mr-2"}),"Upgrade \u2014 ","monthly"===A?"Monthly":"Yearly"]})})]})]}),(0,y.jsxs)("div",{className:"relative py-2",children:[(0,y.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,y.jsx)("span",{className:"w-full border-t"})}),(0,y.jsx)("div",{className:"relative flex justify-center text-xs uppercase",children:(0,y.jsx)("span",{className:"bg-background px-2 text-muted-foreground",children:"Or purchase a one-off credit pack"})})]}),(0,y.jsx)("div",{className:"grid grid-cols-2 gap-4",children:f.map(e=>{const s=(e=>{switch(e){case"credits_100":return"10% off";case"credits_250":return"20% off";case"credits_500":return"30% off";default:return null}})(e.pack_id);return(0,y.jsxs)(o.Zp,{className:"relative overflow-hidden border-2 transition-all hover:border-primary/50 hover:shadow-lg cursor-pointer "+(w===e.pack_id?"border-primary":"border-border"),onClick:()=>!w&&$(e.pack_id),children:[s&&(0,y.jsx)(c.E,{className:"absolute top-2 right-2 bg-green-500 text-white text-xs",children:s}),(0,y.jsx)("div",{className:`h-2 bg-gradient-to-r ${P(e.credits)}`}),(0,y.jsx)(o.Wu,{className:"pt-4",children:(0,y.jsxs)("div",{className:"text-center",children:[(0,y.jsx)("div",{className:`inline-flex items-center justify-center w-12 h-12 rounded-full bg-gradient-to-r ${P(e.credits)} text-white mb-3`,children:(0,y.jsx)(u.A,{className:"w-6 h-6"})}),(0,y.jsx)("h3",{className:"text-2xl font-bold",children:e.credits}),(0,y.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"credits"}),(0,y.jsx)("div",{className:"text-xl font-semibold text-primary",children:e.price_formatted}),(0,y.jsx)("p",{className:"text-xs text-muted-foreground",children:e.currency}),(0,y.jsx)(i.$,{className:"w-full mt-4",disabled:null!==w,onClick:s=>{s.stopPropagation(),$(e.pack_id)},children:w===e.pack_id?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Processing..."]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h.A,{className:"w-4 h-4 mr-2"}),"Buy Now"]})})]})})]},e.pack_id)})})]}),(0,y.jsx)("div",{className:"text-center text-xs text-muted-foreground pt-2 border-t",children:(0,y.jsx)("p",{children:"Secure payment powered by Stripe. Credits never expire."})})]})})}},37167(e,s,a){a.d(s,{A:()=>j});var t=a(65043),r=a(36210),l=a(89598),n=a(56095),i=a(40614),o=a(13390),c=a(13416),d=a(91140),u=a(4980),m=a(73824),p=a(56328),x=a(70579);const h=["Accurate content","Saved me time","Curriculum-aligned","Great layout","Engaging for students"],g=["Inaccurate content","Wrong difficulty level","Didn't match curriculum","Formatting issues","Took too long"],f=e=>{let{label:s,selected:a,onClick:t}=e;return(0,x.jsxs)("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium border transition-all "+(a?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:border-primary/50"),children:[a&&(0,x.jsx)(r.A,{className:"w-3 h-3"}),s]})},j=e=>{let{feature:s,resourceId:a,onClose:r,show:j=!0}=e;const[v,y]=(0,t.useState)(null),[b,w]=(0,t.useState)(""),[N,C]=(0,t.useState)(!1),[k,_]=(0,t.useState)([]),[A,S]=(0,t.useState)([]),[R,$]=(0,t.useState)(null),[P,z]=(0,t.useState)(!1),[L,I]=(0,t.useState)(!1),F=(e,s,a)=>{a(s.includes(e)?s.filter(s=>s!==e):[...s,e])},T=()=>{const e=navigator.userAgent,s=e.match(/(Chrome|Firefox|Safari|Edg)\/[\d.]+/);return{full_url:window.location.href,browser:s?s[0]:e.slice(0,120),viewport:`${window.innerWidth}x${window.innerHeight}`,platform:navigator.platform,language:navigator.language}},q=e=>{y(e),"down"===e&&C(!0)},V=async()=>{I(!0);try{await u.A.post(`${m.nC}/feedback`,{feedback_type:"rating",thumbs:v,comment:b||null,feature:s,resource_id:a,page_url:window.location.href,resource:a?{type:s,id:a}:null,context:T(),positive_aspects:"up"===v&&k.length>0?k:null,negative_reasons:"down"===v&&A.length>0?A:null,used_with_class:"up"===v?R:null}),z(!0),setTimeout(()=>null===r||void 0===r?void 0:r(),2e3)}catch{p.oR.error("Failed to submit feedback")}finally{I(!1)}};return j?P?(0,x.jsx)(d.Zp,{className:"border-primary/20 bg-primary/5 animate-in fade-in duration-300",children:(0,x.jsx)(d.Wu,{className:"py-4 text-center",children:(0,x.jsx)("p",{className:"text-sm text-primary font-medium",children:"Thanks for your feedback! \ud83c\udf89"})})}):(0,x.jsx)(d.Zp,{className:"border-border/50 animate-in slide-in-from-bottom duration-300","data-testid":"feedback-rating",children:(0,x.jsxs)(d.Wu,{className:"py-4",children:[(0,x.jsxs)("div",{className:"flex items-center justify-between",children:[(0,x.jsxs)("div",{className:"flex items-center gap-4",children:[(0,x.jsxs)("span",{className:"text-sm text-muted-foreground",children:["How was this ",{lesson_plan:"lesson plan",slideshow:"slideshow",worksheet:"worksheet",quiz:"quiz",image:"image",crossword:"crossword",findaword:"find-a-word",bingo:"bingo set",brain_break:"brain break pack",colouring_page:"colouring page",cut_and_assemble:"cut & assemble activity",tech_project:"tech project"}[s]||"content","?"]}),(0,x.jsxs)("div",{className:"flex gap-2",children:[(0,x.jsx)(o.$,{variant:"up"===v?"default":"outline",size:"sm",onClick:()=>q("up"),disabled:L,className:"up"===v?"bg-green-600 hover:bg-green-700":"","data-testid":"thumbs-up-btn",children:(0,x.jsx)(n.A,{className:"w-4 h-4"})}),(0,x.jsx)(o.$,{variant:"down"===v?"default":"outline",size:"sm",onClick:()=>q("down"),disabled:L,className:"down"===v?"bg-red-600 hover:bg-red-700":"","data-testid":"thumbs-down-btn",children:(0,x.jsx)(l.A,{className:"w-4 h-4"})})]})]}),(0,x.jsx)(o.$,{variant:"ghost",size:"sm",onClick:r,className:"text-muted-foreground",children:(0,x.jsx)(i.A,{className:"w-4 h-4"})})]}),"up"===v&&(0,x.jsxs)("div",{className:"mt-4 space-y-4 animate-in slide-in-from-top duration-200",children:[(0,x.jsxs)("div",{className:"space-y-2",children:[(0,x.jsxs)("p",{className:"text-xs text-muted-foreground font-medium",children:["What worked well? ",(0,x.jsx)("span",{className:"font-normal",children:"(optional)"})]}),(0,x.jsx)("div",{className:"flex flex-wrap gap-2",children:h.map(e=>(0,x.jsx)(f,{label:e,selected:k.includes(e),onClick:()=>F(e,k,_)},e))})]}),(0,x.jsxs)("div",{className:"space-y-2",children:[(0,x.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Did you use this with your class?"}),(0,x.jsxs)("div",{className:"flex gap-2",children:[(0,x.jsx)(o.$,{variant:!0===R?"default":"outline",size:"sm",onClick:()=>
2$(!0!==R||null),className:!0===R?"bg-green-600 hover:bg-green-700":"",children:"Yes"}),(0,x.jsx)(o.$,{variant:!1===R?"default":"outline",size:"sm",onClick:()=>$(!1===R&&null),children:"Not yet"})]})]}),N?(0,x.jsx)(c.T,{placeholder:"Anything else to share? (optional)",value:b,onChange:e=>w(e.target.value),className:"min-h-[70px] text-sm","data-testid":"feedback-comment"}):(0,x.jsx)("button",{type:"button",onClick:()=>C(!0),className:"text-xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"Add a comment"}),(0,x.jsx)(o.$,{onClick:V,disabled:L,size:"sm",className:"w-full",children:L?"Sending\u2026":"Submit \u2713"})]}),"down"===v&&N&&(0,x.jsxs)("div",{className:"mt-4 space-y-3 animate-in slide-in-from-top duration-200",children:[(0,x.jsxs)("div",{className:"space-y-2",children:[(0,x.jsxs)("p",{className:"text-xs text-muted-foreground font-medium",children:["What went wrong? ",(0,x.jsx)("span",{className:"font-normal",children:"(optional)"})]}),(0,x.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,x.jsx)(f,{label:e,selected:A.includes(e),onClick:()=>F(e,A,S)},e))})]}),(0,x.jsx)(c.T,{placeholder:"What could be better? (optional)",value:b,onChange:e=>w(e.target.value),className:"min-h-[80px] text-sm","data-testid":"feedback-comment"}),(0,x.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,x.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>V(),disabled:L,children:"Skip"}),(0,x.jsx)(o.$,{size:"sm",onClick:V,disabled:L,children:L?"Sending\u2026":"Submit"})]})]})]})}):null}},25440(e,s,a){a.d(s,{A:()=>l});var t=a(49367),r=a(70579);const l=()=>(0,r.jsx)(t.mg,{children:(0,r.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})},18322(e,s,a){a.d(s,{GH:()=>g,Ih:()=>x,v3:()=>h});var t=a(65043),r=a(65598),l=a(13390),n=a(63944),i=a(40614),o=a(4980),c=a(73824),d=a(70579);const u="https://www.trustpilot.com/review/mycurriculummate.com.au",m="mcm_gen_count",p="mcm_trustpilot_gen_shown",x=e=>{let{user:s,onDismiss:a}=e;const[r,l]=(0,t.useState)(!1);(0,t.useEffect)(()=>{s&&s.login_count>=2&&!s.trustpilot_login_nudge_shown&&l(!0)},[s]);const m=(0,t.useCallback)(async()=>{l(!1);try{await o.A.post(`${c.nC}/auth/trustpilot-dismiss`)}catch{}a&&a()},[a]);return r?(0,d.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,d.jsx)(n.A,{className:"w-4 h-4 shrink-0 text-yellow-500 fill-yellow-400"}),(0,d.jsxs)("span",{className:"flex-1",children:["Welcome back! If My Curriculum Mate has saved you time, a quick"," ",(0,d.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,d.jsx)("button",{onClick:m,"aria-label":"Dismiss",className:"shrink-0 rounded p-0.5 hover:bg-yellow-100",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]}):null},h=()=>{if(localStorage.getItem(p))return!1;const e=parseInt(localStorage.getItem(m)||"0",10)+1;return localStorage.setItem(m,String(e)),3===e},g=e=>{let{isOpen:s,onClose:a}=e;const t=()=>{localStorage.setItem(p,"1"),a()};return(0,d.jsx)(r.lG,{open:s,onOpenChange:t,children:(0,d.jsxs)(r.Cf,{className:"sm:max-w-sm text-center",children:[(0,d.jsxs)(r.c7,{children:[(0,d.jsx)("div",{className:"flex justify-center mb-2",children:(0,d.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,d.jsx)(n.A,{className:"w-6 h-6 text-yellow-400 fill-yellow-400"},e))})}),(0,d.jsx)(r.L3,{className:"text-center",children:"Loving My Curriculum Mate?"}),(0,d.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,d.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[(0,d.jsx)(l.$,{onClick:()=>{localStorage.setItem(p,"1"),window.open(u,"_blank","noopener,noreferrer"),a()},className:"w-full bg-[#00b67a] hover:bg-[#00a06c] text-white",children:"Leave a Review on Trustpilot"}),(0,d.jsx)(l.$,{variant:"ghost",onClick:t,className:"w-full text-muted-foreground",children:"Maybe Later"})]})]})})}},91140(e,s,a){a.d(s,{BT:()=>c,Wu:()=>d,ZB:()=>o,Zp:()=>n,aR:()=>i,wL:()=>u});var t=a(65043),r=a(99766),l=a(70579);const n=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)("div",{ref:s,className:(0,r.cn)("rounded-xl border bg-card text-card-foreground shadow",a),...t})});
2n.displayName="Card";const i=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)("div",{ref:s,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",a),...t})});i.displayName="CardHeader";const o=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)("div",{ref:s,className:(0,r.cn)("font-semibold leading-none tracking-tight",a),...t})});o.displayName="CardTitle";const c=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)("div",{ref:s,className:(0,r.cn)("text-sm text-muted-foreground",a),...t})});c.displayName="CardDescription";const d=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)("div",{ref:s,className:(0,r.cn)("p-6 pt-0",a),...t})});d.displayName="CardContent";const u=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,l.jsx)("div",{ref:s,className:(0,r.cn)("flex items-center p-6 pt-0",a),...t})});u.displayName="CardFooter"},92264(e,s,a){a.d(s,{p:()=>n});var t=a(65043),r=a(99766),l=a(70579);const n=t.forwardRef((e,s)=>{let{className:a,type:t,...n}=e;return(0,l.jsx)("input",{type:t,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",a),ref:s,...n})});n.displayName="Input"},84370(e,s,a){a.d(s,{bq:()=>m,eb:()=>g,gC:()=>h,l6:()=>d,yv:()=>u});var t=a(65043),r=a(22095),l=a(36210),n=a(92382),i=a(15711),o=a(99766),c=a(70579);const d=r.bL,u=(r.YJ,r.WT),m=t.forwardRef((e,s)=>{let{className:a,children:t,...l}=e;return(0,c.jsxs)(r.l9,{ref:s,className:(0,o.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),...l,children:[t,(0,c.jsx)(r.In,{asChild:!0,children:(0,c.jsx)(n.A,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.l9.displayName;const p=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,c.jsx)(r.PP,{ref:s,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",a),...t,children:(0,c.jsx)(i.A,{className:"h-4 w-4"})})});p.displayName=r.PP.displayName;const x=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,c.jsx)(r.wn,{ref:s,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",a),...t,children:(0,c.jsx)(n.A,{className:"h-4 w-4"})})});x.displayName=r.wn.displayName;const h=t.forwardRef((e,s)=>{let{className:a,children:t,position:l="popper",...n}=e;return(0,c.jsx)(r.ZL,{children:(0,c.jsxs)(r.UC,{ref:s,className:(0,o.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"===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",a),position:l,...n,children:[(0,c.jsx)(p,{}),(0,c.jsx)(r.LM,{className:(0,o.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,c.jsx)(x,{})]})})});h.displayName=r.UC.displayName;t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,c.jsx)(r.JU,{ref:s,className:(0,o.cn)("px-2 py-1.5 text-sm font-semibold",a),...t})}).displayName=r.JU.displayName;const g=t.forwardRef((e,s)=>{let{className:a,children:t,...n}=e;return(0,c.jsxs)(r.q7,{ref:s,className:(0,o.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),...n,children:[(0,c.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,c.jsx)(r.VF,{children:(0,c.jsx)(l.A,{className:"h-4 w-4"})})}),(0,c.jsx)(r.p4,{children:t})]})});g.displayName=r.q7.displayName;t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,c.jsx)(r.wv,{ref:s,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",a),...t})}).displayName=r.wv.displayName},29751(e,s,a){a.r(s),a.d(s,{default:()=>F});var t=a(65043),r=a(45621),l=a(73824),n=a(4980),i=a(56328),o=a(13390),c=a(9114
20),d=a(92264),u=a(59938),m=a(13416),p=a(65598),x=a(25440),h=a(18322),g=a(84370),f=a(46258),j=a(37167),v=a(95258),y=a(22024),b=a(56099),w=a(65469),N=a(28646),C=a(65727),k=a(28006),_=a(39292),A=a(9855),S=a(40614),R=a(1673),$=a(89231),P=a(70579);const z=[["K","1"],["1","2"],["2","3"],["3","4"],["4","5"],["5","6"],["6","7"],["7","8"],["8","9"],["9","10"]],L=(e,s)=>"K"===e?(e=>"WA"===e?"Pre-primary":"VIC"===e?"Foundation":"Kindergarten")(s):`Year ${e}`,I=(e,s)=>`${L(e[0],s)} / ${L(e[1],s)}`,F=()=>{var e,s,a,F,T,q,V,W,E,G;const M=(0,r.Zp)(),{user:Y}=(0,l.As)(),[D,J]=(0,t.useState)(!1),[B,Z]=(0,t.useState)([]),[H,O]=(0,t.useState)([]),[U,K]=(0,t.useState)([]),[Q,X]=(0,t.useState)(!1),[ee,se]=(0,t.useState)(!1),[ae,te]=(0,t.useState)(null),[re,le]=(0,t.useState)(""),[ne,ie]=(0,t.useState)("all"),[oe,ce]=(0,t.useState)("all"),[de,ue]=(0,t.useState)(!1),[me,pe]=(0,t.useState)(null),[xe,he]=(0,t.useState)(""),[ge,fe]=(0,t.useState)({title:"",year_level:"",subject:"",topic:"",duration_weeks:4,lessons_per_week:3,state:null===Y||void 0===Y||!Y.state||"NSW"!==Y.state&&"VIC"!==Y.state&&"WA"!==Y.state?"":Y.state,outcome_codes:"",is_composite:!1,year_levels:[],composite_strategy:null}),[je,ve]=(0,t.useState)(null),ye="pro"===(null===Y||void 0===Y?void 0:Y.subscription_tier)||"schools"===(null===Y||void 0===Y?void 0:Y.subscription_tier)||"admin"===(null===Y||void 0===Y?void 0:Y.role),be=e=>({HASS:"HASS / HSIE"}[e]||e);(0,t.useEffect)(()=>{(async()=>{try{const e=await n.A.get(`${l.nC}/subscription/credits`);te(e.data)}catch{}})(),we(),ke();const e=()=>{ke()};return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]),(0,t.useEffect)(()=>{var e;ge.is_composite?2===(null===(e=ge.year_levels)||void 0===e?void 0:e.length)&&Ce(ge.year_levels):ge.year_level&&Ne(ge.year_level)},[ge.year_level,ge.is_composite,null===(e=ge.year_levels)||void 0===e?void 0:e.join("/")]);const we=async()=>{try{const e=await n.A.get(`${l.nC}/curriculum/years`);O(e.data.years)}catch(e){console.error("Error fetching years:",e)}},Ne=async e=>{try{const s=await n.A.get(`${l.nC}/curriculum/${e}/subjects`);K(s.data.subjects)}catch(s){console.error("Error fetching subjects:",s)}},Ce=async e=>{let[s,a]=e;try{const[e,t]=await Promise.all([n.A.get(`${l.nC}/curriculum/${s}/subjects`),n.A.get(`${l.nC}/curriculum/${a}/subjects`)]),r=new Set(t.data.subjects);K(e.data.subjects.filter(e=>r.has(e)))}catch(t){console.error("Error fetching composite subjects:",t)}},ke=async()=>{try{const e=await n.A.get(`${l.nC}/unit-plans`);Z(e.data)}catch(e){console.error("Error fetching unit plans:",e)}},_e=(0,t.useMemo)(()=>B.filter(e=>{var s,a,t;const r=""===re||(null===(s=e.title)||void 0===s?void 0:s.toLowerCase().includes(re.toLowerCase()))||(null===(a=e.topic)||void 0===a?void 0:a.toLowerCase().includes(re.toLowerCase()))||(null===(t=e.subject)||void 0===t?void 0:t.toLowerCase().includes(re.toLowerCase())),l="all"===ne||e.year_level===ne,n="all"===oe||e.subject===oe;return r&&l&&n}),[B,re,ne,oe]),Ae=(0,t.useMemo)(()=>[...new Set(B.map(e=>e.subject).filter(Boolean))],[B]),Se=()=>{le(""),ie("all"),ce("all")};return(0,P.jsxs)(f.A,{children:[(0,P.jsxs)("div",{className:"max-w-4xl mx-auto","data-testid":"unit-planner-tool-page",children:[(0,P.jsx)(x.A,{}),de&&(0,P.jsx)("div",{className:"mb-4",children:(0,P.jsx)(j.A,{feature:"lesson_plan",resourceId:me,onClose:()=>ue(!1)})}),(0,P.jsxs)(o.$,{variant:"ghost",onClick:()=>M("/dashboard"),className:"mb-4",children:[(0,P.jsx)(w.A,{className:"w-4 h-4 mr-2"}),"Back to Dashboard"]}),(0,P.jsxs)("div",{className:"flex items-center gap-3 mb-8",children:[(0,P.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-emerald-500 to-teal-600 flex items-center justify-center text-white",children:(0,P.jsx)(v.A,{className:"w-6 h-6"})}),(0,P.jsxs)("div",{className:"min-w-0",children:[(0,P.jsx)("h1",{className:"text-3xl font-bold text-foreground",children:"Unit / Lesson Planner"}),(0,P.jsx)("p",{className:"text-muted-foreground",children:"Design complete unit and lesson plans"})]})]}),(0,P.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[(0,P.jsxs)(c.Zp,{className:"border-border/50",children:[(0,P.jsx)(c.aR,{children:(0,P.jsxs)(c.ZB,{className:"flex items-center gap-2",children:[(0,P.jsx)(b.A,{className:"w-5 h-5 text-secondary"}),"Generate New Plan"]})}),(0,P.jsxs)(c.Wu,{className:"space-y-4",children:[(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Unit / Lesson Title *"}),(0,P.jsx)(d.p,{placeholder:"e.g., Exploring Australian History",value:ge.title,onChange:e=>fe({...ge,title:e.target.value})})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Class Type"}),(0,P.jsxs)($.z,{value:ge.is_composite?"composite":"single",onValueChange:e=>{if("composite"===e&&!ye)return i.oR.error("Composite class planning requires Pro or Schools subscription"),void M("/subscription");K([]),fe({...ge,is_composite:"composite"===e,year_level:"",year_levels:[],subject:"",composite_strategy:"composite"===e?ge.composite_strategy:null})},className:"grid grid-cols-2 gap-2",children:[(0,P.jsxs)("label",{className:"flex items-center gap-2 p-3 rounded-lg border-2 cursor-pointer transition-colors "+(ge.is_composite?"border-border":"border-primary bg-primary/5"),children:[(0,P.jsx)($.C,{value:"single",id:"class-type-single"}),(0,P.jsx)("span",{className:"text-sm font-medium",children:"Single Year"})]}),(0,P.jsxs)("label",{className:`flex items-center gap-2 p-3 rounded-lg border-2 cursor-pointer transition-colors ${ge.is_composite?"border-primary bg-primary/5":"border-border"}
2 ${ye?"":"opacity-70"}`,children:[(0,P.jsx)($.C,{value:"composite",id:"class-type-composite"}),(0,P.jsxs)("span",{className:"text-sm font-medium flex items-center gap-1.5",children:["Composite Class",!ye&&(0,P.jsx)(C.A,{className:"w-3.5 h-3.5 text-muted-foreground"})]})]})]}),!ye&&(0,P.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Composite classes (e.g. Year 4/5 or Year 9/10) are a Pro and Schools feature."})]}),ge.is_composite?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Composite Pairing *"}),(0,P.jsxs)(g.l6,{value:2===(null===(s=ge.year_levels)||void 0===s?void 0:s.length)?ge.year_levels.join("/"):"",onValueChange:e=>fe({...ge,year_levels:e.split("/"),subject:""}),children:[(0,P.jsx)(g.bq,{children:(0,P.jsx)(g.yv,{placeholder:"Select pairing"})}),(0,P.jsx)(g.gC,{children:z.map(e=>(0,P.jsx)(g.eb,{value:e.join("/"),children:I(e,ge.state)},e.join("/")))})]})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Instruction Strategy *"}),(0,P.jsxs)(g.l6,{value:ge.composite_strategy||"",onValueChange:e=>fe({...ge,composite_strategy:e}),children:[(0,P.jsx)(g.bq,{children:(0,P.jsx)(g.yv,{placeholder:"Select strategy"})}),(0,P.jsxs)(g.gC,{children:[(0,P.jsx)(g.eb,{value:"blended",children:"Blended \u2014 shared theme, adjusted per year"}),(0,P.jsx)(g.eb,{value:"differentiated",children:"Differentiated \u2014 shared intro, split groups"})]})]})]})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Subject *"}),(0,P.jsxs)(g.l6,{value:ge.subject,onValueChange:e=>fe({...ge,subject:e}),disabled:2!==(null===(a=ge.year_levels)||void 0===a?void 0:a.length),children:[(0,P.jsx)(g.bq,{children:(0,P.jsx)(g.yv,{placeholder:2===(null===(F=ge.year_levels)||void 0===F?void 0:F.length)?"Select subject":"Select a pairing first"})}),(0,P.jsx)(g.gC,{children:U.map(e=>(0,P.jsx)(g.eb,{value:e,children:be(e)},e))})]}),(0,P.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Only subjects available at both year levels are shown."})]})]}):(0,P.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Year Level *"}),(0,P.jsxs)(g.l6,{value:ge.year_level,onValueChange:e=>fe({...ge,year_level:e}),children:[(0,P.jsx)(g.bq,{children:(0,P.jsx)(g.yv,{placeholder:"Select year"})}),(0,P.jsx)(g.gC,{children:H.map(e=>(0,P.jsx)(g.eb,{value:e,children:L(e,ge.state)},e))})]})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Subject *"}),(0,P.jsxs)(g.l6,{value:ge.subject,onValueChange:e=>fe({...ge,subject:e}),disabled:!ge.year_level,children:[(0,P.jsx)(g.bq,{children:(0,P.jsx)(g.yv,{placeholder:"Select subject"})}),(0,P.jsx)(g.gC,{children:U.map(e=>(0,P.jsx)(g.eb,{value:e,children:be(e)},e))})]})]})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Topic / Theme *"}),(0,P.jsx)(d.p,{placeholder:"e.g., First Fleet and Early Settlement",value:ge.topic,onChange:e=>fe({...ge,topic:e.target.value})})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Keywords (optional)"}),(0,P.jsx)(d.p,{placeholder:"e.g., hands-on, collaborative, differentiated, inquiry-based",value:ge.keywords||"",onChange:e=>fe({...ge,keywords:e.target.value}),"data-testid":"keywords-input"}),(0,P.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Add keywords to guide AI lesson generation"})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Outcome Codes (optional)"}),(0,P.jsx)(m.T,{placeholder:"e.g. AC9M5N08, AC9M5N02",value:ge.outcome_codes||"",onChange:e=>fe({...ge,outcome_codes:e.target.value}),className:"resize-none h-16 font-mono text-sm"}),(0,P.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Enter specific outcome codes (comma-separated) to have the AI build the unit around them. Works with any curriculum: National, NSW, VIC, or WA."})]}),(0,P.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Duration (weeks)"}),(0,P.jsxs)(g.l6,{value:ge.duration_weeks.toString(),onValueChange:e=>fe({...ge,duration_weeks:parseInt(e)}),children:[(0,P.jsx)(g.bq,{children:(0,P.jsx)(g.yv,{})}),(0,P.jsxs)(g.gC,{children:[(0,P.jsx)(g.eb,{value:"1",children:"1 week"}),(0,P.jsx)(g.eb,{value:"2",children:"2 weeks"}),(0,P.jsx)(g.eb,{value:"4",children:"4 weeks"}),(0,P.jsx)(g.eb,{value:"6",children:"6 weeks"}),(0,P.jsx)(g.eb,{value:"8",children:"8 weeks"}),(0,P.jsx)(g.eb,{value:"10",children:"10 weeks (full term)"})]})]})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsx)(u.J,{children:"Lessons per Week"}),(0,P.jsxs)(g.l6,{value:ge.lessons_per_week.toString(),onValueChange:e=>fe({...ge,lessons_per_week:parseInt(e)}),children:[(0,P.jsx)(g.bq,{children:(0,P.jsx)(g.yv,{})}),(0,P.jsxs)(g.gC,{children:[(0,P.jsx)(g.eb,{value:"1",children:"1 lesson"}),(0,P.jsx)(g.eb,{value:"2",children:"2 lessons"}),(0,P.jsx)(g.eb,{value:"3",children:"3 lessons"}),(0,P.jsx)(g.eb,{value:"4",children:"4 lessons"}),(0,P.jsx)(g.eb,{value:"5",children:"5 lessons"})]})]})]})]}),(0,P.jsxs)("div",{className:"form-group",children:[(0,P.jsxs)(u.J,{className:"flex items-center gap-2",children:[(0,P.jsx)(k.A,{className:"w-4 h-4"}),"State Curriculum *"]}),(0,P.jsxs)(g.l6,{value:null===ge.state?"null":ge.state,onValueChange:e=>{fe({...ge,state:"null"===e?null:e}),he("")},children:[(0,P.jsx)(g.bq,{"data-testid":"state-select",className:xe?"border-destructive":"",children:(0,P.jsx)(g.yv,{placeholder:"Select state curriculum"})}),(0,P.jsx)(g.gC,{children:[{value:"null",label:"National Curriculum (All States)"},{value:"NSW",label:"New South Wales (NSW)"},{value:"VIC",label:"Victoria (VIC)"},{value:"WA",label:"Western Australia (SCSA)"}].map(e=>(0,P.jsx)(g.eb,{value:e.value,children:e.label},e.value))})]}),xe?(0,P.jsx)("p",{className:"text-xs text-destructive mt-1",children:xe}):(0,P.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Select a state to align with specific state syllabus outcomes"})]}),ae&&"admin"!==(null===Y||void 0===Y?void 0:Y.role)&&(0,P.jsxs)("div",{className:"flex items-center justify-between text-sm px-3 py-2 rounded-lg border "+((null!==(T=ae.balance)&&void 0!==T?T:0)>=(1===ge.duration_weeks&&1===ge.lessons_per_week?10:20)?"bg-primary/5 border-primary/20 text-primary":"bg-amber-50 border-amber-200 text-amber-700"),children:[(0,P.jsxs)("span",{children:["Credit cost: ",(0,P.jsx)("strong",{children:1===ge.duration_weeks&&1===ge.lessons_per_week?10:20})]}),(0,P.jsxs)("span",{children:[(null!==(q=ae.balance)&&void 0!==q?q:0)>=(1===ge.duration_weeks&&1===ge.lessons_per_week?10:20)?"\u2713":"\u26a0"," ",null!==(V=ae.balance)&&void 0!==V?V:0," available"]})]}),(0,P.jsx)(o.$,{onClick:async()=>
2{if(!ge.title||!ge.subject||!ge.topic)return void i.oR.error("Please fill in all required fields");if(ge.is_composite){if(!ge.year_levels||2!==ge.year_levels.length)return void i.oR.error("Please select a composite class pairing");if(!ge.composite_strategy)return void i.oR.error("Please select an instruction strategy (Blended or Differentiated)")}else if(!ge.year_level)return void i.oR.error("Please fill in all required fields");if(""===ge.state)return void he("Please select your state curriculum before generating");J(!0);let e=!1;try{const e=ge.outcome_codes?ge.outcome_codes.split(",").map(e=>e.trim()).filter(Boolean):[],s=await n.A.post(`${l.nC}/unit-plans/generate`,{...ge,outcome_codes:e,force_create:!1},{timeout:3e5});if(s.data.duplicate_warning)return ve({existing:s.data.existing_plan,pendingData:{...ge,outcome_codes:e}}),void J(!1);try{await ke()}catch(x){}pe(s.data.unit_id),ue(!0),i.oR.success("Lesson plan generated successfully!"),(0,h.v3)()&&se(!0),fe({...ge,title:"",topic:"",outcome_codes:""})}catch(g){var s;console.error("Error generating lesson plan:",g);const x=null===(s=g.response)||void 0===s?void 0:s.status;if(x>=400&&x<500){var a,t;if(403===x){var r,o,c;const e=(null===(r=g.response)||void 0===r||null===(o=r.data)||void 0===o||null===(c=o.detail)||void 0===c?void 0:c.toLowerCase())||"";e.includes("insufficient credits")||e.includes("free trial has ended")?X(!0):i.oR.error(g.response.data.detail)}else null!==(a=g.response)&&void 0!==a&&null!==(t=a.data)&&void 0!==t&&t.detail?i.oR.error(g.response.data.detail):i.oR.error("Failed to generate lesson plan. Please try again.");return}try{const s=(await n.A.get(`${l.nC}/unit-plans`)).data;if(Array.isArray(s)&&s.length>B.length){Z(s);const a=new Set(B.map(e=>e.unit_id)),t=s.find(e=>!a.has(e.unit_id));return null!==t&&void 0!==t&&t.unit_id&&pe(t.unit_id),ue(!0),i.oR.success("Lesson plan was created successfully!",{duration:5e3}),fe({...ge,title:"",topic:"",outcome_codes:""}),void(e=!0)}var d,u,m,p;Array.isArray(s)&&Z(s),!g.response||"ECONNABORTED"===g.code||null!==(d=g.message)&&void 0!==d&&d.includes("timeout")||null!==(u=g.message)&&void 0!==u&&u.includes("Network Error")?i.oR.warning("Generation is taking longer than expected \u2014 check your lesson plans list in a moment.",{duration:8e3}):null!==(m=g.response)&&void 0!==m&&null!==(p=m.data)&&void 0!==p&&p.detail?i.oR.error(g.response.data.detail):i.oR.error("Failed to generate lesson plan. Please try again.")}catch(f){i.oR.error("Failed to generate lesson plan. Please try again.")}}finally{e||J(!1)}},disabled:D,className:"w-full bg-primary text-primary-foreground hover:bg-primary/90 rounded-full","data-testid":"generate-unit-btn",children:D?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(y.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(b.A,{className:"w-4 h-4 mr-2"}),"Generate Plan"]})}),(0,P.jsx)("p",{className:"text-xs text-muted-foreground text-center mt-2",children:"You can add YouTube videos and resources after generating your unit plan."})]})]}),(0,P.jsxs)(c.Zp,{className:"border-border/50",children:[(0,P.jsx)(c.aR,{children:(0,P.jsx)(c.ZB,{children:"Your Plans"})}),(0,P.jsxs)(c.Wu,{children:[(0,P.jsxs)("div",{className:"mb-4 space-y-3","data-testid":"search-section",children:[(0,P.jsxs)("div",{className:"relative",children:[(0,P.jsx)(_.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),(0,P.jsx)(d.p,{placeholder:"Search by title, topic, or subject...",value:re,onChange:e=>le(e.target.value),className:"pl-10 pr-10","data-testid":"search-input"}),(re||"all"!==ne||"all"!==oe)&&(0,P.jsx)("button",{onClick:Se,className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:(0,P.jsx)(S.A,{className:"w-4 h-4"})})]}),(0,P.jsxs)("div",{className:"flex gap-2",children:[(0,P.jsxs)(g.l6,{value:ne,onValueChange:ie,children:[(0,P.jsx)(g.bq,{className:"w-[130px]","data-testid":"year-filter",children:(0,P.jsx)(g.yv,{placeholder:"Year"})}),(0,P.jsxs)(g.gC,{children:[(0,P.jsx)(g.eb,{value:"all",children:"All Years"}),H.map(e=>(0,P.jsx)(g.eb,{value:e,children:"K"===e?"Kinder":`Year ${e}`},e))]})]}),(0,P.jsxs)(g.l6,{value:oe,onValueChange:ce,children:[(0,P.jsx)(g.bq,{className:"w-[140px]","data-testid":"subject-filter",children:(0,P.jsx)(g.yv,{placeholder:"Subject"})}),(0,P.jsxs)(g.gC,{children:[(0,P.jsx)(g.eb,{value:"all",children:"All Subjects"}),Ae.map(e=>(0,P.jsx)(g.eb,{value:e,children:e},e))]})]})]}),(re||"all"!==ne||"all"!==oe)&&(0,P.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Showing ",_e.length," of ",B.length," lesson plans"]})]}),D&&(0,P.jsxs)("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-primary/5 border border-primary/20 mb-3",children:[(0,P.jsx)(y.A,{className:"w-4 h-4 animate-spin text-primary flex-shrink-0"}),(0,P.jsxs)("div",{children:[(0,P.jsxs)("p",{className:"text-sm font-medium text-foreground",children:['Generating "',ge.title,'"']}),(0,P.jsx)("p",{className:"text-xs text-muted-foreground",children:"This usually takes 30\u201360 seconds\u2026"})]})]}),_e.length>0?(0,P.jsx)("div",{className:"space-y-3 max-h-[400px] overflow-y-auto",children:_e.map(e=>(0,P.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[(0,P.jsxs)("div",{className:"flex-1",children:[(0,P.jsx)("h4",{className:"font-medium text-foreground",children:e.title}),(0,P.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Year ",e.year_level," \u2022 ",e.subject]}),(0,P.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-xs text-muted-foreground",children:[(0,P.jsx)(N.A,{className:"w-3 h-3"}),e.duration_weeks," ",1===e.duration_weeks?"week":"weeks"]})]}),(0,P.jsxs)("div",{className:"flex gap-2",children:[(0,P.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>M(`/tools/lesson-plan/${e.unit_id}`),children:"View"}),(0,P.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>(async e=>{try{await n.A.delete(`${l.nC}/unit-plans/${e}`),i.oR.success("Lesson plan deleted"),ke()}catch(s){i.oR.error("Failed to delete lesson plan")}})(e.unit_id),className:"text-destructive",children:(0,P.jsx)(A.A,{className:"w-4 h-4"})})]})]},e.unit_id))}):B.length>0?(0,P.jsxs)("div",{className:"text-center py-8",children:[(0,P.jsx)(_.A,{className:"w-12 h-12 text-muted-foreground
2/50 mx-auto mb-4"}),(0,P.jsx)("p",{className:"text-muted-foreground",children:"No lesson plans match your search"}),(0,P.jsx)(o.$,{variant:"link",onClick:Se,className:"text-sm",children:"Clear filters"})]}):D?null:(0,P.jsxs)("div",{className:"text-center py-8",children:[(0,P.jsx)(v.A,{className:"w-12 h-12 text-muted-foreground/50 mx-auto mb-4"}),(0,P.jsx)("p",{className:"text-muted-foreground",children:"No lesson plans yet"}),(0,P.jsx)("p",{className:"text-sm text-muted-foreground",children:"Generate your first lesson plan above"})]})]})]})]})]}),(0,P.jsx)(R.A,{isOpen:Q,onClose:()=>X(!1),onPurchaseComplete:()=>{X(!1),ke()}}),(0,P.jsx)(h.GH,{isOpen:ee,onClose:()=>se(!1)}),(0,P.jsx)(p.lG,{open:!!je,onOpenChange:()=>ve(null),children:(0,P.jsxs)(p.Cf,{children:[(0,P.jsxs)(p.c7,{children:[(0,P.jsx)(p.L3,{children:"Unit Plan Already Exists"}),(0,P.jsxs)(p.rr,{children:["You already have a unit plan for ",(0,P.jsx)("strong",{children:null===je||void 0===je||null===(W=je.existing)||void 0===W?void 0:W.topic})," (Year ",null===je||void 0===je||null===(E=je.existing)||void 0===E?void 0:E.year_level," ",null===je||void 0===je||null===(G=je.existing)||void 0===G?void 0:G.subject,"). Do you want to create a new one anyway?"]})]}),(0,P.jsxs)(p.Es,{className:"flex gap-2 sm:justify-end",children:[(0,P.jsx)(o.$,{variant:"outline",onClick:()=>{M(`/tools/lesson-plan/${je.existing.unit_id}`),ve(null)},children:"View Existing"}),(0,P.jsx)(o.$,{onClick:async()=>{if(!je)return;const{pendingData:e}=je;ve(null),J(!0);try{const s=await n.A.post(`${l.nC}/unit-plans/generate`,{...e,force_create:!0},{timeout:3e5});await ke(),pe(s.data.unit_id),ue(!0),i.oR.success("Lesson plan generated successfully!"),(0,h.v3)()&&se(!0),fe({...ge,title:"",topic:"",outcome_codes:""})}catch(r){var s,a,t;if(403===(null===(s=r.response)||void 0===s?void 0:s.status))X(!0);else i.oR.error((null===(a=r.response)||void 0===a||null===(t=a.data)||void 0===t?void 0:t.detail)||"Failed to generate lesson plan.")}finally{J(!1)}},children:"Create New"})]})]})})]})}},99432(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]])},22024(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},65727(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},28006(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]])},39292(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},51419(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("shopping-cart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]])},89598(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("thumbs-down",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]])},56095(e,s,a){a.d(s,{A:()=>t});const t=(0,a(77784).A)("thumbs-up",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]])},11009(e,s,a){a.d(s,{bL:()=>_,q7:()=>A});var t=a(65043),r=a(21862),l=a(87914),n=a(96711),i=a(31699),o=a(13642),c=a(14204),d=a(70579),u="ToggleGroup",[m,p]=(0,r.A)(u,[n.RG]),x=(0,n.RG)(),h=t.forwardRef((e,s)=>{const{type:a,...t}=e;if("single"===a){const e=t;return(0,d.jsx)(j,{...e,ref:s})}if("multiple"===a){const e=t;return(0,d.jsx)(v,{...e,ref:s})}throw new Error(`Missing prop \`type\` expected on \`${u}\``)});h.displayName=u;var[g,f]=m(u),j=t.forwardRef((e,s)=>{const{value:a,defaultValue:r,onValueChange:l=()=>{},...n}=e,[i,c]=(0,o.i)({prop:a,defaultProp:r??"",onChange:l,caller:u});return(0,d.jsx)(g,{scope:e.__scopeToggleGroup,type:"single",value:t.useMemo(()=>i?[i]:[],[i]),onItemActivate:c,onItemDeactivate:t.useCallback(()=>c(""),[c]),children:(0,d.jsx)(w,{...n,ref:s})})}),v=t.forwardRef((e,s)=>{const{value:a,defaultValue:r,onValueChange:l=()=>{},...n}=e,[i,c]=(0,o.i)({prop:a,defaultProp:r??[],onChange:l,caller:u}),m=t.useCallback(e=>c(function(){return[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e]}),[c]),p=t.useCallback(e=>c(function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(s=>s!==e)}),[c]);return(0,d.jsx)(g,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:m,onItemDeactivate:p,children:(0,d.jsx)(w,{...n,ref:s})})});h.displayName=u;var[y,b]=m(u),w=t.forwardRef((e,s)=>{const{__scopeToggleGroup:a,disabled:t=!1,rovingFocus:r=!0,orientation:i,dir:o,loop:u=!0,...m}=e,p=x(a),h=(0,c.jH)(o),g={role:"group",dir:h,...m};return(0,d.jsx)(y,{scope:a,rovingFocus:r,disabled:t,children:r?(0,d.jsx)(n.bL,{asChild:!0,...p,orientation:i,dir:h,loop:u,children:(0,d.jsx)(l.sG.div,{...g,ref:s})}):(0,d.jsx)(l.sG.div,{...g,ref:s})})}),N="ToggleGroupItem",C=t.forwardRef((e,s)=>{const a=f(N,e.__scopeToggleGroup),r=b(N,e.__scopeToggleGroup),l=x(e.__scopeToggleGroup),i=a.value.includes(e.value),o=r.disabled||e.disabled,c={...e,pressed:i,disabled:o},u=t.useRef(null);return r.rovingFocus?(0,d.jsx)(n.q7,{asChild:!0,...l,focusable:!o,active:i,ref:u,children:(0,d.jsx)(k,{...c,ref:s})}):(0,d.jsx)(k,{...c,ref:s})});C.displayName=N;var k=t.forwardRef((e,s)=>{const{__scopeToggleGroup:a,value:t,...r}=e,l=f(N,a),n={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},o="single"===l.type?n:void 0;
2return(0,d.jsx)(i.l,{...o,...r,ref:s,onPressedChange:e=>{e?l.onItemActivate(t):l.onItemDeactivate(t)}})}),_=h,A=C},31699(e,s,a){a.d(s,{b:()=>d,l:()=>c});var t=a(65043),r=a(30858),l=a(13642),n=a(87914),i=a(70579),o="Toggle",c=t.forwardRef((e,s)=>{const{pressed:a,defaultPressed:t,onPressedChange:c,...d}=e,[u,m]=(0,l.i)({prop:a,onChange:c,defaultProp:t??!1,caller:o});return(0,i.jsx)(n.sG.button,{type:"button","aria-pressed":u,"data-state":u?"on":"off","data-disabled":e.disabled?"":void 0,...d,ref:s,onClick:(0,r.mK)(e.onClick,()=>{e.disabled||m(!u)})})});c.displayName=o;var d=c}}]); 3//# sourceMappingURL=9751.bac6e045.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.