From aa21333ec9a39d29a39a2df46209711b42a59c78 Mon Sep 17 00:00:00 2001 From: Rustic-Citrus Date: Wed, 10 Jul 2024 08:25:09 +0000 Subject: [PATCH] deploy: f1cd62bb7c3af1b83fb9962ea6bfbcb2a3c34dd4 --- assets/{index-DsSs18On.js => index-DEg_eMiE.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-DsSs18On.js => index-DEg_eMiE.js} (89%) diff --git a/assets/index-DsSs18On.js b/assets/index-DEg_eMiE.js similarity index 89% rename from assets/index-DsSs18On.js rename to assets/index-DEg_eMiE.js index 349e38e..c6eca13 100644 --- a/assets/index-DsSs18On.js +++ b/assets/index-DEg_eMiE.js @@ -81,4 +81,4 @@ Error generating stack: `+i.message+` top: ${l}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(c)}},[t]),d.jsx(dO,{isPresent:t,childRef:r,sizeRef:s,children:p.cloneElement(e,{ref:r})})}const Ql=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const a=y0(hO),l=p.useId(),u=p.useMemo(()=>({id:l,initial:t,isPresent:n,custom:s,onExitComplete:c=>{a.set(c,!0);for(const f of a.values())if(!f)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),i?[Math.random()]:[n]);return p.useMemo(()=>{a.forEach((c,f)=>a.set(f,!1))},[n]),p.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),o==="popLayout"&&(e=d.jsx(fO,{isPresent:n,children:e})),d.jsx(za.Provider,{value:u,children:e})};function hO(){return new Map}function pO(e){return p.useEffect(()=>()=>e(),[])}const Yn=e=>e.key||"";function mO(e,t){e.forEach(n=>{const r=Yn(n);t.set(r,n)})}function gO(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const Cm=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:s,presenceAffectsLayout:i=!0,mode:o="sync"})=>{const a=p.useContext(Kd).forceRender||cO()[0],l=Sx(),u=gO(e);let c=u;const f=p.useRef(new Map).current,h=p.useRef(c),v=p.useRef(new Map).current,y=p.useRef(!0);if(Bd(()=>{y.current=!1,mO(u,v),h.current=c}),pO(()=>{y.current=!0,v.clear(),f.clear()}),y.current)return d.jsx(d.Fragment,{children:c.map(m=>d.jsx(Ql,{isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:i,mode:o,children:m},Yn(m)))});c=[...c];const w=h.current.map(Yn),S=u.map(Yn),x=w.length;for(let m=0;m{if(S.indexOf(g)!==-1)return;const C=v.get(g);if(!C)return;const T=w.indexOf(g);let E=m;if(!E){const P=()=>{f.delete(g);const j=Array.from(v.keys()).filter(M=>!S.includes(M));if(j.forEach(M=>v.delete(M)),h.current=u.filter(M=>{const b=Yn(M);return b===g||j.includes(b)}),!f.size){if(l.current===!1)return;a(),r&&r()}};E=d.jsx(Ql,{isPresent:!1,onExitComplete:P,custom:t,presenceAffectsLayout:i,mode:o,children:C},Yn(C)),f.set(g,E)}c.splice(T,0,E)}),c=c.map(m=>{const g=m.key;return f.has(g)?m:d.jsx(Ql,{isPresent:!0,presenceAffectsLayout:i,mode:o,children:m},Yn(m))}),d.jsx(d.Fragment,{children:f.size?c:c.map(m=>p.cloneElement(m))})},yO=()=>{const{user:e,signOut:t}=an(),[n,r]=p.useState(!1),s=async i=>{i.preventDefault(),r(!0);try{setTimeout(async()=>{await t()},1e3)}catch(o){console.log(o.message)}finally{setTimeout(()=>{r(!1)},2e3)}};return d.jsxs(dp,{expand:"lg",className:"bg-body-tertiary justify-content-between text-center align-items-center px-5",sticky:"top",children:[d.jsx(dp.Brand,{children:d.jsx(Et,{className:"align-items-center text-decoration-none",to:"/",children:d.jsx("h1",{className:"display-6 mb-0","aria-label":"brand",title:"Return to home page.",children:"Simplifica."})})}),e&&d.jsx(Oe.div,{initial:{opacity:0},animate:{opacity:1,transition:{delay:.2}},exit:{opacity:0},whileHover:{scale:1.05},whileTap:{scale:.8},children:d.jsx(B,{variant:"dark",onClick:s,disabled:n,className:"w-100",children:n?d.jsxs("span",{children:["Signing out..."," ",d.jsx(mr,{as:"span",animation:"border",className:"mx-3",size:"sm",role:"status","aria-hidden":"true",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})})]}):"Sign Out"})})]})},Ec=2**31-1;function Cx(e,t,n){const r=n-Date.now();e.current=r<=Ec?setTimeout(t,r):setTimeout(()=>Cx(e,t,n),Ec)}function vO(){const e=Fv(),t=p.useRef();return bd(()=>clearTimeout(t.current)),p.useMemo(()=>{const n=()=>clearTimeout(t.current);function r(s,i=0){e()&&(n(),i<=Ec?t.current=setTimeout(s,i):Cx(t,s,Date.now()+i))}return{set:r,clear:n,handleRef:t}},[])}const xO={[ht]:"showing",[es]:"showing show"},Ex=p.forwardRef((e,t)=>d.jsx(pr,{...e,ref:t,transitionClasses:xO}));Ex.displayName="ToastFade";const Tx=p.createContext({onClose(){}}),kx=p.forwardRef(({bsPrefix:e,closeLabel:t="Close",closeVariant:n,closeButton:r=!0,className:s,children:i,...o},a)=>{e=D(e,"toast-header");const l=p.useContext(Tx),u=ze(c=>{l==null||l.onClose==null||l.onClose(c)});return d.jsxs("div",{ref:a,...o,className:A(e,s),children:[i,r&&d.jsx($a,{"aria-label":t,variant:n,onClick:u,"data-dismiss":"toast"})]})});kx.displayName="ToastHeader";const jx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"toast-body"),d.jsx(n,{ref:s,className:A(e,t),...r})));jx.displayName="ToastBody";const Px=p.forwardRef(({bsPrefix:e,className:t,transition:n=Ex,show:r=!0,animation:s=!0,delay:i=5e3,autohide:o=!1,onClose:a,onEntered:l,onExit:u,onExiting:c,onEnter:f,onEntering:h,onExited:v,bg:y,...w},S)=>{e=D(e,"toast");const x=p.useRef(i),m=p.useRef(a);p.useEffect(()=>{x.current=i,m.current=a},[i,a]);const g=vO(),C=!!(o&&r),T=p.useCallback(()=>{C&&(m.current==null||m.current())},[C]);p.useEffect(()=>{g.set(T,x.current)},[g,T]);const E=p.useMemo(()=>({onClose:a}),[a]),P=!!(n&&s),j=d.jsx("div",{...w,ref:S,className:A(e,t,y&&`bg-${y}`,!P&&(r?"show":"hide")),role:"alert","aria-live":"assertive","aria-atomic":"true"});return d.jsx(Tx.Provider,{value:E,children:P&&n?d.jsx(n,{in:r,onEnter:f,onEntering:h,onEntered:l,onExit:u,onExiting:c,onExited:v,unmountOnExit:!0,children:j}):j})});Px.displayName="Toast";const Xl=Object.assign(Px,{Body:jx,Header:kx}),Rx=({title:e,message:t,type:n,toggleVisible:r})=>{const s=new Date;return d.jsxs(Xl,{onClose:r,delay:5e3,bg:n==="error"?"warning":n,autohide:!0,children:[d.jsxs(Xl.Header,{children:[d.jsx("strong",{className:"me-auto","aria-label":"feedback-title",children:e}),d.jsx("small",{"aria-label":"feedback-timestamp",children:s.toLocaleTimeString()})]}),d.jsx(Xl.Body,{className:n==="error"?"text-grey":"text-white","aria-label":"feedback-message",children:t})]})};Rx.propTypes={title:U.string.isRequired,message:U.string.isRequired,type:U.string.isRequired,toggleVisible:U.func.isRequired};const wO=()=>{const[e,t]=p.useState(!1),[n,r]=p.useState([]);return[n,e,o=>{r(o),t(!0)},()=>t(!e)]},Nx=p.createContext(),Ox=({children:e})=>{const[t,n,r,s]=wO(),i=p.useMemo(()=>({feedback:t,showFeedback:n,triggerFeedback:r,toggleFeedback:s}),[t,n,r,s]);return d.jsx(Nx.Provider,{value:i,children:e})},Qa=()=>p.useContext(Nx);Ox.propTypes={children:U.node};const SO={"top-start":"top-0 start-0","top-center":"top-0 start-50 translate-middle-x","top-end":"top-0 end-0","middle-start":"top-50 start-0 translate-middle-y","middle-center":"top-50 start-50 translate-middle","middle-end":"top-50 end-0 translate-middle-y","bottom-start":"bottom-0 start-0","bottom-center":"bottom-0 start-50 translate-middle-x","bottom-end":"bottom-0 end-0"},Lx=p.forwardRef(({bsPrefix:e,position:t,containerPosition:n,className:r,as:s="div",...i},o)=>(e=D(e,"toast-container"),d.jsx(s,{ref:o,...i,className:A(e,t&&SO[t],n&&`position-${n}`,r)})));Lx.displayName="ToastContainer";const CO=()=>{const{feedback:e,showFeedback:t,toggleFeedback:n}=Qa();return d.jsxs(d.Fragment,{children:[d.jsx(yO,{}),d.jsx(Cm,{children:d.jsx(WC,{})}),d.jsx(Cm,{children:t&&d.jsx(Lx,{style:{position:"fixed",top:0,right:0,marginRight:"1rem",marginTop:"1rem",maxWidth:"90%"},children:e.map((r,s)=>d.jsx(Oe.div,{drag:!0,dragConstraints:{top:0,left:-50,right:0,bottom:50},initial:{opacity:0},animate:{opacity:1,transition:{delay:.2}},exit:{opacity:0},whileHover:{scale:1.05},whileTap:{scale:.5},className:"my-1",children:d.jsx(Rx,{title:r.title,message:r.message,type:r.type,toggleVisible:n})},s))})})]})},qs=(e,t)=>{const n=e.target.value;t(n)},Em=e=>/^[a-zA-Z][a-zA-Z0-9_]{4,19}$/.test(e),Tm=e=>/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/.test(e),EO=[{name:"invalid_password",info:{type:"error",title:"Invalid Password",message:"Password is invalid. It should be at least 8 characters long, and should contain at least 1 uppercase letter, lowercase letter, special character and number."}},{name:"invalid_username",info:{type:"error",title:"Invalid Username",message:"Username is invalid. It should be between 4 and 19 characters long, and should only contain numbers, letters and underscores."}},{name:"passwords_not_matching",info:{type:"error",title:"Non-Matching Passwords",message:"Passwords do not match. Verify that the two passwords you have typed in are the same."}}],Bn=p.forwardRef(({bsPrefix:e,fluid:t=!1,as:n="div",className:r,...s},i)=>{const o=D(e,"container"),a=typeof t=="string"?`-${t}`:"-fluid";return d.jsx(n,{ref:i,...s,className:A(r,t?`${o}${a}`:o)})});Bn.displayName="Container";function TO(e,t=Nv,n=Ov){const r=[];return Object.entries(e).forEach(([s,i])=>{i!=null&&(typeof i=="object"?t.forEach(o=>{const a=i[o];if(a!=null){const l=o!==n?`-${o}`:"";r.push(`${s}${l}-${a}`)}}):r.push(`${s}-${i}`))}),r}const rs=p.forwardRef(({as:e="div",bsPrefix:t,className:n,direction:r,gap:s,...i},o)=>{t=D(t,r==="horizontal"?"hstack":"vstack");const a=Nd(),l=Od();return d.jsx(e,{...i,ref:o,className:A(n,t,...TO({gap:s},a,l))})});rs.displayName="Stack";const sn=p.createContext({}),gf=p.forwardRef(({controlId:e,as:t="div",...n},r)=>{const s=p.useMemo(()=>({controlId:e}),[e]);return d.jsx(sn.Provider,{value:s,children:d.jsx(t,{...n,ref:r})})});gf.displayName="FormGroup";const rr=p.forwardRef(({bsPrefix:e,className:t,children:n,controlId:r,label:s,...i},o)=>(e=D(e,"form-floating"),d.jsxs(gf,{ref:o,className:A(t,e),controlId:r,...i,children:[n,d.jsx("label",{htmlFor:r,children:s})]})));rr.displayName="FloatingLabel";const kO={type:U.string,tooltip:U.bool,as:U.elementType},Xa=p.forwardRef(({as:e="div",className:t,type:n="valid",tooltip:r=!1,...s},i)=>d.jsx(e,{...s,ref:i,className:A(t,`${n}-${r?"tooltip":"feedback"}`)}));Xa.displayName="Feedback";Xa.propTypes=kO;const Mi=p.forwardRef(({id:e,bsPrefix:t,className:n,type:r="checkbox",isValid:s=!1,isInvalid:i=!1,as:o="input",...a},l)=>{const{controlId:u}=p.useContext(sn);return t=D(t,"form-check-input"),d.jsx(o,{...a,ref:l,type:r,id:e||u,className:A(n,t,s&&"is-valid",i&&"is-invalid")})});Mi.displayName="FormCheckInput";const ca=p.forwardRef(({bsPrefix:e,className:t,htmlFor:n,...r},s)=>{const{controlId:i}=p.useContext(sn);return e=D(e,"form-check-label"),d.jsx("label",{...r,ref:s,htmlFor:n||i,className:A(t,e)})});ca.displayName="FormCheckLabel";function jO(e,t){return p.Children.toArray(e).some(n=>p.isValidElement(n)&&n.type===t)}const Ax=p.forwardRef(({id:e,bsPrefix:t,bsSwitchPrefix:n,inline:r=!1,reverse:s=!1,disabled:i=!1,isValid:o=!1,isInvalid:a=!1,feedbackTooltip:l=!1,feedback:u,feedbackType:c,className:f,style:h,title:v="",type:y="checkbox",label:w,children:S,as:x="input",...m},g)=>{t=D(t,"form-check"),n=D(n,"form-switch");const{controlId:C}=p.useContext(sn),T=p.useMemo(()=>({controlId:e||C}),[C,e]),E=!S&&w!=null&&w!==!1||jO(S,ca),P=d.jsx(Mi,{...m,type:y==="switch"?"checkbox":y,ref:g,isValid:o,isInvalid:a,disabled:i,as:x});return d.jsx(sn.Provider,{value:T,children:d.jsx("div",{style:h,className:A(f,E&&t,r&&`${t}-inline`,s&&`${t}-reverse`,y==="switch"&&n),children:S||d.jsxs(d.Fragment,{children:[P,E&&d.jsx(ca,{title:v,children:w}),u&&d.jsx(Xa,{type:c,tooltip:l,children:u})]})})})});Ax.displayName="FormCheck";const da=Object.assign(Ax,{Input:Mi,Label:ca}),bx=p.forwardRef(({bsPrefix:e,type:t,size:n,htmlSize:r,id:s,className:i,isValid:o=!1,isInvalid:a=!1,plaintext:l,readOnly:u,as:c="input",...f},h)=>{const{controlId:v}=p.useContext(sn);return e=D(e,"form-control"),d.jsx(c,{...f,type:t,size:r,ref:h,readOnly:u,id:s||v,className:A(i,l?`${e}-plaintext`:e,n&&`${e}-${n}`,t==="color"&&`${e}-color`,o&&"is-valid",a&&"is-invalid")})});bx.displayName="FormControl";const PO=Object.assign(bx,{Feedback:Xa}),Dx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"form-floating"),d.jsx(n,{ref:s,className:A(e,t),...r})));Dx.displayName="FormFloating";function RO({as:e,bsPrefix:t,className:n,...r}){t=D(t,"col");const s=Nd(),i=Od(),o=[],a=[];return s.forEach(l=>{const u=r[l];delete r[l];let c,f,h;typeof u=="object"&&u!=null?{span:c,offset:f,order:h}=u:c=u;const v=l!==i?`-${l}`:"";c&&o.push(c===!0?`${t}${v}`:`${t}${v}-${c}`),h!=null&&a.push(`order${v}-${h}`),f!=null&&a.push(`offset${v}-${f}`)}),[{...r,className:A(n,...o,...a)},{as:e,bsPrefix:t,spans:o}]}const Pt=p.forwardRef((e,t)=>{const[{className:n,...r},{as:s="div",bsPrefix:i,spans:o}]=RO(e);return d.jsx(s,{...r,ref:t,className:A(n,!o.length&&i)})});Pt.displayName="Col";const Mx=p.forwardRef(({as:e="label",bsPrefix:t,column:n=!1,visuallyHidden:r=!1,className:s,htmlFor:i,...o},a)=>{const{controlId:l}=p.useContext(sn);t=D(t,"form-label");let u="col-form-label";typeof n=="string"&&(u=`${u} ${u}-${n}`);const c=A(s,t,r&&"visually-hidden",n&&u);return i=i||l,n?d.jsx(Pt,{ref:a,as:"label",className:c,htmlFor:i,...o}):d.jsx(e,{ref:a,className:c,htmlFor:i,...o})});Mx.displayName="FormLabel";const Ix=p.forwardRef(({bsPrefix:e,className:t,id:n,...r},s)=>{const{controlId:i}=p.useContext(sn);return e=D(e,"form-range"),d.jsx("input",{...r,type:"range",ref:s,className:A(t,e),id:n||i})});Ix.displayName="FormRange";const _x=p.forwardRef(({bsPrefix:e,size:t,htmlSize:n,className:r,isValid:s=!1,isInvalid:i=!1,id:o,...a},l)=>{const{controlId:u}=p.useContext(sn);return e=D(e,"form-select"),d.jsx("select",{...a,size:n,ref:l,className:A(r,e,t&&`${e}-${t}`,s&&"is-valid",i&&"is-invalid"),id:o||u})});_x.displayName="FormSelect";const Fx=p.forwardRef(({bsPrefix:e,className:t,as:n="small",muted:r,...s},i)=>(e=D(e,"form-text"),d.jsx(n,{...s,ref:i,className:A(t,e,r&&"text-muted")})));Fx.displayName="FormText";const Vx=p.forwardRef((e,t)=>d.jsx(da,{...e,ref:t,type:"switch"}));Vx.displayName="Switch";const NO=Object.assign(Vx,{Input:da.Input,Label:da.Label}),OO={_ref:U.any,validated:U.bool,as:U.elementType},yf=p.forwardRef(({className:e,validated:t,as:n="form",...r},s)=>d.jsx(n,{...r,ref:s,className:A(e,t&&"was-validated")}));yf.displayName="Form";yf.propTypes=OO;const O=Object.assign(yf,{Group:gf,Control:PO,Floating:Dx,Check:da,Switch:NO,Label:Mx,Text:Fx,Range:Ix,Select:_x,FloatingLabel:rr});U.string,U.bool,U.bool,U.bool,U.bool;const Q=p.forwardRef(({bsPrefix:e,className:t,fluid:n=!1,rounded:r=!1,roundedCircle:s=!1,thumbnail:i=!1,...o},a)=>(e=D(e,"img"),d.jsx("img",{ref:a,...o,className:A(t,n&&`${e}-fluid`,r&&"rounded",s&&"rounded-circle",i&&`${e}-thumbnail`)})));Q.displayName="Image";const $x=p.createContext(null);$x.displayName="InputGroupContext";const qa=p.forwardRef(({className:e,bsPrefix:t,as:n="span",...r},s)=>(t=D(t,"input-group-text"),d.jsx(n,{ref:s,className:A(e,t),...r})));qa.displayName="InputGroupText";const LO=e=>d.jsx(qa,{children:d.jsx(Mi,{type:"checkbox",...e})}),AO=e=>d.jsx(qa,{children:d.jsx(Mi,{type:"radio",...e})}),Bx=p.forwardRef(({bsPrefix:e,size:t,hasValidation:n,className:r,as:s="div",...i},o)=>{e=D(e,"input-group");const a=p.useMemo(()=>({}),[]);return d.jsx($x.Provider,{value:a,children:d.jsx(s,{ref:o,...i,className:A(r,e,t&&`${e}-${t}`,n&&"has-validation")})})});Bx.displayName="InputGroup";const xe=Object.assign(Bx,{Text:qa,Radio:AO,Checkbox:LO}),bO=()=>{const{triggerFeedback:e}=Qa(),[t,n]=p.useState(!0),[r,s]=p.useState(!0),[i,o]=p.useState(!1),[a,l]=p.useState(""),[u,c]=p.useState(""),[f,h]=p.useState(!1),[v,y]=p.useState(""),{register:w}=an();p.useEffect(()=>{Tm(u)&&Em(a)&&u===v?o(!0):o(!1)},[a,u,v]);const S=C=>qs(C,l),x=C=>qs(C,c),m=C=>qs(C,y),g=async C=>{h(!0);const T=[];if(C.preventDefault(),i)try{const E=await w({username:a,password:u});E.status===201?T.push({title:"Registration Successful",message:E.data.msg,type:"success"}):T.push({title:"Registration Failed",message:E.data.msg,type:"error"})}catch(E){console.log(E.message)}else{C.stopPropagation();const E=[];u!==v&&E.push("passwords_not_matching"),Tm(u)||E.push("invalid_password"),Em(a)||E.push("invalid_username");for(const P of E)for(const j of EO)j.name===P&&T.push(j.info)}setTimeout(()=>{h(!1)},1e3),e(T)};return d.jsx(Bn,{className:"col-12 col-md-6 pt-3 px-2 pt-md-5 px-md-4 ms-md-4 pb-4 align-middle",children:d.jsxs(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:[d.jsxs(rs,{gap:1,children:[d.jsx("h1",{className:"display-3 mt-5 pt-5","aria-label":"title",children:"Create an account"}),d.jsx("p",{"aria-label":"subtitle",children:"Enter a username and password"})]}),d.jsxs(O,{noValidate:!0,validated:i,onSubmit:g,children:[d.jsxs(O.Group,{controlId:"form",children:[d.jsx(rr,{controlId:"username-label",label:"Your username",children:d.jsx(O.Control,{type:"text",placeholder:"Your username",className:"mb-2",title:"Type your username here.","aria-label":"username-input",onChange:S})}),d.jsxs(xe,{hasValidation:!0,className:"mb-2",children:[d.jsx(rr,{controlId:"password-label",label:"Your password",children:d.jsx(O.Control,{type:t?"password":"text",placeholder:"Your password",title:"Type your password here.","aria-label":"password-input",onChange:x})}),d.jsx(B,{variant:"outline-secondary",onClick:()=>n(!t),title:"Click here to reveal your password.","aria-label":"hide-password-button",children:d.jsx(Q,{src:t?"/simplifica/eye.svg":"/simplifica/eye-slash.svg",alt:"Icon of an eye."})})]}),d.jsxs(xe,{hasValidation:!0,className:"mb-2",children:[d.jsx(rr,{controlId:"confirm-password-label",label:"Confirm your password",children:d.jsx(O.Control,{type:r?"password":"text",placeholder:"Confirm your password","aria-label":"confirm-password-input",title:"Type your password again here.",onChange:m})}),d.jsx(B,{variant:"outline-secondary",onClick:()=>s(!r),title:"Click here to reveal your password.","aria-label":"hide-confirm-password-button",children:d.jsx(Q,{src:r?"/simplifica/eye.svg":"/simplifica/eye-slash.svg",alt:"Icon of an eye."})})]})]}),d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{type:"submit",variant:"dark",className:"w-100","aria-label":"get-started-button",title:"Click here to register your account.",disabled:f,children:f?d.jsxs("span",{children:["Creating your account..."," ",d.jsx(mr,{as:"span",animation:"border",className:"mx-3",size:"sm",role:"status","aria-hidden":"true"})]}):"Get Started"})})]})]})})},DO=()=>{const{triggerFeedback:e}=Qa(),[t,n]=p.useState(""),[r,s]=p.useState(""),[i,o]=p.useState(!0),[a,l]=p.useState(!1),{signIn:u}=an(),c=v=>qs(v,n),f=v=>qs(v,s),h=async v=>{v.preventDefault(),l(!0);const y=[],w={username:t,password:r};try{const S=await u(w);S.status===200?y.push({type:"success",title:"Success",message:S.data.msg}):y.push({type:"error",title:"Error",message:S.data.msg})}catch(S){y.push({type:"error",title:"Error",message:S.message})}finally{setTimeout(()=>{l(!1)},1e3)}e(y)};return d.jsx(Bn,{className:"col-12 col-md-6 pt-3 px-2 pt-md-5 px-md-4 ms-md-4 align-middle",children:d.jsxs(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:[d.jsx(rs,{gap:1,className:"mb-3",children:d.jsx("h1",{className:"display-3 mt-5 pt-5","aria-label":"title",children:"Welcome back"})}),d.jsxs(O,{noValidate:!0,onSubmit:h,children:[d.jsxs(O.Group,{controlId:"form",children:[d.jsx(rr,{controlId:"username-label",label:"Your username",children:d.jsx(O.Control,{type:"text",placeholder:"Your username",className:"mb-2",title:"Type your username here.","aria-label":"username-input",onChange:c})}),d.jsxs(xe,{className:"mb-2",children:[d.jsx(rr,{controlId:"password-label",label:"Your password",children:d.jsx(O.Control,{type:i?"password":"text",placeholder:"Your password",title:"Type your password here.","aria-label":"password-input",onChange:f})}),d.jsx(B,{variant:"outline-secondary",onClick:()=>o(!i),title:"Click here to reveal your password.","aria-label":"hide-password-button",children:d.jsx(Q,{src:i?"/simplifica/eye.svg":"/simplifica/eye-slash.svg",alt:"Icon of an eye."})})]})]}),d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{type:"submit",variant:"dark",className:"w-100","aria-label":"sign-in-button",title:"Click here to sign into your account.",disabled:a,children:a?d.jsxs("span",{children:["Signing in..."," ",d.jsx(mr,{as:"span",animation:"border",className:"mx-3",size:"sm",role:"status","aria-hidden":"true"})]}):"Sign In"})})]})]})})};var At,bt;class Ja{constructor(t,n){Vi(this,At);Vi(this,bt);$i(this,At,pe.create({baseURL:t})),$i(this,bt,n)}getInstance(){return Se(this,At)}getUserId(){return Se(this,bt)}async getLessonPlans(){try{return await Se(this,At).get(`/${Se(this,bt)}/lesson-plans`)}catch(t){return t.message}}async getOneLessonPlan(t){try{return await Se(this,At).get(`/${Se(this,bt)}/lesson-plans/${t}`)}catch(n){return n.message}}async createLessonPlan(t){try{return await Se(this,At).post(`/${Se(this,bt)}/lesson-plans`,{lessonPlan:t})}catch(n){return n.message}}async updateLessonPlan(t,n){try{return await Se(this,At).put(`/${Se(this,bt)}/lesson-plans/${t}`,{newLessonPlan:n})}catch(r){return r.message}}async deleteLessonPlan(t){try{return await Se(this,At).delete(`/${Se(this,bt)}/lesson-plans/${t}`)}catch(n){return n.message}}}At=new WeakMap,bt=new WeakMap;const MO=async(e,t)=>{try{const n=await e.current.getLessonPlans();t(n.data.lessonPlans)}catch(n){console.log(n.message)}},Ux=async(e,t,n)=>{try{const r=await e.current.getOneLessonPlan(t);n(r.data.lessonPlan)}catch(r){console.log(r.message)}},nt=({message:e=""})=>d.jsx(Bn,{className:"pt-5 mt-5 px-4 h-100 align-middle",children:d.jsxs(rs,{gap:1,className:"col-12 col-sm-10 col-md-8 col-lg-6 col-xl-5",children:[d.jsx("h1",{className:"display-1 mt-5 pt-5 text-danger","aria-label":"title",children:"Uh-oh..."}),d.jsx("p",{"aria-label":"message",children:e.trim()!==""?e:"An unexpected error occurred. Click below to return to the homepage or see the console for more information."}),d.jsx(Et,{to:"/",children:d.jsx(B,{variant:"dark",className:"w-100",title:"Return to home page.","aria-label":"back-button",children:"Back"})})]})});nt.propTypes={message:U.string};const Ii=p.forwardRef(({bsPrefix:e,className:t,as:n="div",...r},s)=>{const i=D(e,"row"),o=Nd(),a=Od(),l=`${i}-cols`,u=[];return o.forEach(c=>{const f=r[c];delete r[c];let h;f!=null&&typeof f=="object"?{cols:h}=f:h=f;const v=c!==a?`-${c}`:"";h!=null&&u.push(`${l}${v}-${h}`)}),d.jsx(n,{ref:s,...r,className:A(t,i,...u)})});Ii.displayName="Row";const IO=p.forwardRef(({bsPrefix:e,className:t,striped:n,bordered:r,borderless:s,hover:i,size:o,variant:a,responsive:l,...u},c)=>{const f=D(e,"table"),h=A(t,f,a&&`${f}-${a}`,o&&`${f}-${o}`,n&&`${f}-${typeof n=="string"?`striped-${n}`:"striped"}`,r&&`${f}-bordered`,s&&`${f}-borderless`,i&&`${f}-hover`),v=d.jsx("table",{...u,className:h,ref:c});if(l){let y=`${f}-responsive`;return typeof l=="string"&&(y=`${y}-${l}`),d.jsx("div",{className:y,children:v})}return v}),_O=()=>{const[e,t]=p.useState([]),[n,r]=p.useState(!1),s=p.useRef(),{user:i}=an(),{userId:o}=La();return p.useEffect(()=>{i&&(i._id===o?r(!0):r(!1)),n&&!s.current&&(s.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",o),MO(s,t)),console.log(`Authorised? ${n}`)},[n,i,o]),d.jsx(Bn,{className:"pt-3 px-2 pt-md-5 px-md-4 ms-md-4 align-middle",children:n?d.jsxs(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:[d.jsxs(Ii,{className:"mt-lg-3 mx-lg-5 align-items-center",children:[d.jsx(Pt,{xs:8,md:10,children:d.jsx("h1",{className:"display-3","aria-label":"title",children:"My Lesson Plans"})}),d.jsx(Pt,{xs:{span:2,offset:1},md:1,children:d.jsx(Et,{to:`/${o}/create`,children:d.jsx(B,{variant:"outline-success",children:d.jsx(Q,{src:"/simplifica/plus.svg"})})})})]}),d.jsxs(IO,{striped:!0,className:"mx-1 mx-lg-5",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"#"}),d.jsx("th",{children:"Topic"}),d.jsx("th",{children:"Date"})]})}),d.jsx("tbody",{children:e!==void 0&&e.map((a,l)=>d.jsxs("tr",{children:[d.jsx("td",{children:d.jsx(Et,{to:`/${o}/view/${a._id}`,children:l+1})}),d.jsx("td",{children:d.jsx(Et,{to:`/${o}/view/${a._id}`,children:a.topic})}),d.jsx("td",{children:d.jsx(Et,{to:`/${o}/view/${a._id}`,children:new Date(a.date).toLocaleDateString("en-GB")})})]},l))})]})]}):d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to access someone else's profile. To access their profile, you must be signed in with their account."})})})},FO=()=>d.jsxs(Oe.div,{className:"pt-3 px-2 pt-md-5 px-md-4 ms-md-4 align-middle",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,ease:[0,.71,.2,1.01]},children:[d.jsxs(rs,{gap:1,children:[d.jsx("h1",{className:"display-1 mt-5 pt-5","aria-label":"title",children:"Simplifica."}),d.jsx("p",{"aria-label":"subtitle",children:"Who said planning lessons couldn't be quick?"})]}),d.jsxs(rs,{gap:2,className:"col-auto col-sm-8 col-lg-6 col-xl-5",children:[d.jsx(Et,{to:"/register",children:d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{variant:"dark","aria-label":"sign-up-button",className:"w-100",title:"Register for an account.",children:"Sign Up (it's free!)"})})}),d.jsx(Et,{to:"/login",children:d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{variant:"outline-secondary","aria-label":"sign-in-button",className:"w-100",title:"Sign in to an account.",style:{borderColor:"darkgrey",color:"black"},children:"Sign In"})})})]})]}),VO="",$O="",BO={objective:"",materials:[],connection:""},UO={real_life_application:"",feedback_method:"",activities:[]},zO={learner_interaction:"",success_criteria:[],activities:[]},vf={topic:VO,date:$O,presentation:BO,practice:UO,production:zO};var lo;function km(e){if((!lo&&lo!==0||e)&&fs){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),lo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return lo}function HO(){return p.useState(null)}const zx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"modal-body"),d.jsx(n,{ref:s,className:A(e,t),...r})));zx.displayName="ModalBody";const xf=p.forwardRef(({bsPrefix:e,className:t,contentClassName:n,centered:r,size:s,fullscreen:i,children:o,scrollable:a,...l},u)=>{e=D(e,"modal");const c=`${e}-dialog`,f=typeof i=="string"?`${e}-fullscreen-${i}`:`${e}-fullscreen`;return d.jsx("div",{...l,ref:u,className:A(c,t,s&&`${e}-${s}`,r&&`${c}-centered`,a&&`${c}-scrollable`,i&&f),children:d.jsx("div",{className:A(`${e}-content`,n),children:o})})});xf.displayName="ModalDialog";const Hx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"modal-footer"),d.jsx(n,{ref:s,className:A(e,t),...r})));Hx.displayName="ModalFooter";const Wx=p.forwardRef(({bsPrefix:e,className:t,closeLabel:n="Close",closeButton:r=!1,...s},i)=>(e=D(e,"modal-header"),d.jsx(Hv,{ref:i,...s,className:A(t,e),closeLabel:n,closeButton:r})));Wx.displayName="ModalHeader";const WO=Ba("h4"),Kx=p.forwardRef(({className:e,bsPrefix:t,as:n=WO,...r},s)=>(t=D(t,"modal-title"),d.jsx(n,{ref:s,className:A(e,t),...r})));Kx.displayName="ModalTitle";function KO(e){return d.jsx(pr,{...e,timeout:null})}function GO(e){return d.jsx(pr,{...e,timeout:null})}const Gx=p.forwardRef(({bsPrefix:e,className:t,style:n,dialogClassName:r,contentClassName:s,children:i,dialogAs:o=xf,"data-bs-theme":a,"aria-labelledby":l,"aria-describedby":u,"aria-label":c,show:f=!1,animation:h=!0,backdrop:v=!0,keyboard:y=!0,onEscapeKeyDown:w,onShow:S,onHide:x,container:m,autoFocus:g=!0,enforceFocus:C=!0,restoreFocus:T=!0,restoreFocusOptions:E,onEntered:P,onExit:j,onExiting:M,onEnter:b,onEntering:X,onExited:$e,backdropClassName:Ae,manager:et,...te},ne)=>{const[ke,N]=p.useState({}),[_,F]=p.useState(!1),H=p.useRef(!1),q=p.useRef(!1),je=p.useRef(null),[ye,me]=HO(),Be=hs(ne,me),Vt=ze(x),Za=WT();e=D(e,"modal");const gs=p.useMemo(()=>({onHide:Vt}),[Vt]);function yr(){return et||Yv({isRTL:Za})}function _i(W){if(!fs)return;const wr=yr().getScrollbarWidth()>0,Tf=W.scrollHeight>Fa(W).documentElement.clientHeight;N({paddingRight:wr&&!Tf?km():void 0,paddingLeft:!wr&&Tf?km():void 0})}const vr=ze(()=>{ye&&_i(ye.dialog)});bd(()=>{ic(window,"resize",vr),je.current==null||je.current()});const ys=()=>{H.current=!0},xr=W=>{H.current&&ye&&W.target===ye.dialog&&(q.current=!0),H.current=!1},re=()=>{F(!0),je.current=Dv(ye.dialog,()=>{F(!1)})},Fi=W=>{W.target===W.currentTarget&&re()},vs=W=>{if(v==="static"){Fi(W);return}if(q.current||W.target!==W.currentTarget){q.current=!1;return}x==null||x()},Ew=W=>{y?w==null||w(W):(W.preventDefault(),v==="static"&&re())},Tw=(W,wr)=>{W&&_i(W),b==null||b(W,wr)},kw=W=>{je.current==null||je.current(),j==null||j(W)},jw=(W,wr)=>{X==null||X(W,wr),bv(window,"resize",vr)},Pw=W=>{W&&(W.style.display=""),$e==null||$e(W),ic(window,"resize",vr)},Rw=p.useCallback(W=>d.jsx("div",{...W,className:A(`${e}-backdrop`,Ae,!h&&"show")}),[h,Ae,e]),Ef={...n,...ke};Ef.display="block";const Nw=W=>d.jsx("div",{role:"dialog",...W,style:Ef,className:A(t,e,_&&`${e}-static`,!h&&"show"),onClick:v?vs:void 0,onMouseUp:xr,"data-bs-theme":a,"aria-label":c,"aria-labelledby":l,"aria-describedby":u,children:d.jsx(o,{...te,onMouseDown:ys,className:r,contentClassName:s,children:i})});return d.jsx(_d.Provider,{value:gs,children:d.jsx(Bv,{show:f,ref:Be,backdrop:v,container:m,keyboard:!0,autoFocus:g,enforceFocus:C,restoreFocus:T,restoreFocusOptions:E,onEscapeKeyDown:Ew,onShow:S,onHide:x,onEnter:Tw,onEntering:jw,onEntered:P,onExit:kw,onExiting:M,onExited:Pw,manager:yr(),transition:h?KO:void 0,backdropTransition:h?GO:void 0,renderBackdrop:Rw,renderDialog:Nw})})});Gx.displayName="Modal";const Os=Object.assign(Gx,{Body:zx,Header:Wx,Title:Kx,Footer:Hx,Dialog:xf,TRANSITION_DURATION:300,BACKDROP_TRANSITION_DURATION:150}),Yx=({show:e,toggleShow:t,handleDeleteConfirmed:n})=>{const r=()=>{t(),n()};return d.jsxs(Os,{variant:"warning",show:e,onHide:t,children:[d.jsx(Os.Header,{closeButton:!0,children:d.jsx(Os.Title,{children:"Warning"})}),d.jsx(Os.Body,{children:"You are about to delete this lesson plan. Are you sure you want to continue?"}),d.jsxs(Os.Footer,{children:[d.jsx(B,{variant:"secondary",onClick:t,children:"Cancel"}),d.jsx(B,{variant:"danger",onClick:r,children:"Delete"})]})]})};Yx.propTypes={show:U.bool,toggleShow:U.func,handleDeleteConfirmed:U.func};var jm={exports:{}},Tc={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;function n(r){function s(o,a,l,u,c,f){var h=u||"<>",v=f||l;if(a[l]==null)return o?new Error("Required "+c+" `"+v+"` was not specified "+("in `"+h+"`.")):null;for(var y=arguments.length,w=Array(y>6?y-6:0),S=6;S!t,!1);return e}const wf=p.createContext(null);wf.displayName="NavContext";const ms=p.createContext(null),XO=["as","active","eventKey"];function qO(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function Qx({key:e,onClick:t,active:n,id:r,role:s,disabled:i}){const o=p.useContext(cr),a=p.useContext(wf),l=p.useContext(ms);let u=n;const c={role:s};if(a){!s&&a.role==="tablist"&&(c.role="tab");const f=a.getControllerId(e??null),h=a.getControlledId(e??null);c[Va("event-key")]=e,c.id=f||r,u=n==null&&e!=null?a.activeKey===e:n,(u||!(l!=null&&l.unmountOnExit)&&!(l!=null&&l.mountOnEnter))&&(c["aria-controls"]=h)}return c.role==="tab"&&(c["aria-selected"]=u,u||(c.tabIndex=-1),i&&(c.tabIndex=-1,c["aria-disabled"]=!0)),c.onClick=ze(f=>{i||(t==null||t(f),e!=null&&o&&!f.isPropagationStopped()&&o(e,f))}),[c,{isActive:u}]}const Xx=p.forwardRef((e,t)=>{let{as:n=Zv,active:r,eventKey:s}=e,i=qO(e,XO);const[o,a]=Qx(Object.assign({key:vi(s,i.href),active:r},i));return o[Va("active")]=a.isActive,d.jsx(n,Object.assign({},i,o,{ref:t}))});Xx.displayName="NavItem";const JO=Xx,ZO=["as","onSelect","activeKey","role","onKeyDown"];function eL(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}const Pm=()=>{},Rm=Va("event-key"),qx=p.forwardRef((e,t)=>{let{as:n="div",onSelect:r,activeKey:s,role:i,onKeyDown:o}=e,a=eL(e,ZO);const l=QO(),u=p.useRef(!1),c=p.useContext(cr),f=p.useContext(ms);let h,v;f&&(i=i||"tablist",s=f.activeKey,h=f.getControlledId,v=f.getControllerId);const y=p.useRef(null),w=g=>{const C=y.current;if(!C)return null;const T=Wn(C,`[${Rm}]:not([aria-disabled=true])`),E=C.querySelector("[aria-selected=true]");if(!E||E!==document.activeElement)return null;const P=T.indexOf(E);if(P===-1)return null;let j=P+g;return j>=T.length&&(j=0),j<0&&(j=T.length-1),T[j]},S=(g,C)=>{g!=null&&(r==null||r(g,C),c==null||c(g,C))},x=g=>{if(o==null||o(g),!f)return;let C;switch(g.key){case"ArrowLeft":case"ArrowUp":C=w(-1);break;case"ArrowRight":case"ArrowDown":C=w(1);break;default:return}C&&(g.preventDefault(),S(C.dataset[xk("EventKey")]||null,g),u.current=!0,l())};p.useEffect(()=>{if(y.current&&u.current){const g=y.current.querySelector(`[${Rm}][aria-selected=true]`);g==null||g.focus()}u.current=!1});const m=hs(t,y);return d.jsx(cr.Provider,{value:S,children:d.jsx(wf.Provider,{value:{role:i,activeKey:vi(s),getControlledId:h||Pm,getControllerId:v||Pm},children:d.jsx(n,Object.assign({},a,{onKeyDown:x,ref:m,role:i}))})})});qx.displayName="Nav";const tL=Object.assign(qx,{Item:JO}),Sf=p.createContext(null);Sf.displayName="CardHeaderContext";const Jx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"nav-item"),d.jsx(n,{ref:s,className:A(e,t),...r})));Jx.displayName="NavItem";const nL=["onKeyDown"];function rL(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function sL(e){return!e||e.trim()==="#"}const Zx=p.forwardRef((e,t)=>{let{onKeyDown:n}=e,r=rL(e,nL);const[s]=Fd(Object.assign({tagName:"a"},r)),i=ze(o=>{s.onKeyDown(o),n==null||n(o)});return sL(r.href)||r.role==="button"?d.jsx("a",Object.assign({ref:t},r,s,{onKeyDown:i})):d.jsx("a",Object.assign({ref:t},r,{onKeyDown:n}))});Zx.displayName="Anchor";const ew=p.forwardRef(({bsPrefix:e,className:t,as:n=Zx,active:r,eventKey:s,disabled:i=!1,...o},a)=>{e=D(e,"nav-link");const[l,u]=Qx({key:vi(s,o.href),active:r,disabled:i,...o});return d.jsx(n,{...o,...l,ref:a,disabled:i,className:A(t,e,i&&"disabled",u.isActive&&"active")})});ew.displayName="NavLink";const tw=p.forwardRef((e,t)=>{const{as:n="div",bsPrefix:r,variant:s,fill:i=!1,justify:o=!1,navbar:a,navbarScroll:l,className:u,activeKey:c,...f}=Rv(e,{activeKey:"onSelect"}),h=D(r,"nav");let v,y,w=!1;const S=p.useContext(hr),x=p.useContext(Sf);return S?(v=S.bsPrefix,w=a??!0):x&&({cardHeaderBsPrefix:y}=x),d.jsx(tL,{as:n,ref:t,activeKey:c,className:A(u,{[h]:!w,[`${v}-nav`]:w,[`${v}-nav-scroll`]:w&&l,[`${y}-${s}`]:!!y,[`${h}-${s}`]:!!s,[`${h}-fill`]:i,[`${h}-justified`]:o}),...f})});tw.displayName="Nav";const de=Object.assign(tw,{Item:Jx,Link:ew});function iL(e,t,n){const r=p.useRef(e!==void 0),[s,i]=p.useState(t),o=e!==void 0,a=r.current;return r.current=o,!o&&a&&s!==t&&i(t),[o?e:s,p.useCallback((...l)=>{const[u,...c]=l;let f=n==null?void 0:n(u,...c);return i(u),f},[n])]}const fa={prefix:String(Math.round(Math.random()*1e10)),current:0},nw=Ee.createContext(fa),oL=Ee.createContext(!1);let aL=!!(typeof window<"u"&&window.document&&window.document.createElement),ql=new WeakMap;function lL(e=!1){let t=p.useContext(nw),n=p.useRef(null);if(n.current===null&&!e){var r,s;let i=(s=Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||s===void 0||(r=s.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(i){let o=ql.get(i);o==null?ql.set(i,{id:t.current,state:i.memoizedState}):i.memoizedState!==o.state&&(t.current=o.id,ql.delete(i))}n.current=++t.current}return n.current}function uL(e){let t=p.useContext(nw);t===fa&&!aL&&console.warn("When server rendering, you must wrap your application in an to ensure consistent ids are generated between the client and server.");let n=lL(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function cL(e){let t=Ee.useId(),[n]=p.useState(mL()),r=n?"react-aria":`react-aria${fa.prefix}`;return e||`${r}-${t}`}const dL=typeof Ee.useId=="function"?cL:uL;function fL(){return!1}function hL(){return!0}function pL(e){return()=>{}}function mL(){return typeof Ee.useSyncExternalStore=="function"?Ee.useSyncExternalStore(pL,fL,hL):p.useContext(oL)}const gL=["active","eventKey","mountOnEnter","transition","unmountOnExit","role","onEnter","onEntering","onEntered","onExit","onExiting","onExited"],yL=["activeKey","getControlledId","getControllerId"],vL=["as"];function kc(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function rw(e){let{active:t,eventKey:n,mountOnEnter:r,transition:s,unmountOnExit:i,role:o="tabpanel",onEnter:a,onEntering:l,onEntered:u,onExit:c,onExiting:f,onExited:h}=e,v=kc(e,gL);const y=p.useContext(ms);if(!y)return[Object.assign({},v,{role:o}),{eventKey:n,isActive:t,mountOnEnter:r,transition:s,unmountOnExit:i,onEnter:a,onEntering:l,onEntered:u,onExit:c,onExiting:f,onExited:h}];const{activeKey:w,getControlledId:S,getControllerId:x}=y,m=kc(y,yL),g=vi(n);return[Object.assign({},v,{role:o,id:S(n),"aria-labelledby":x(n)}),{eventKey:n,isActive:t==null&&g!=null?vi(w)===g:t,transition:s||m.transition,mountOnEnter:r??m.mountOnEnter,unmountOnExit:i??m.unmountOnExit,onEnter:a,onEntering:l,onEntered:u,onExit:c,onExiting:f,onExited:h}]}const sw=p.forwardRef((e,t)=>{let{as:n="div"}=e,r=kc(e,vL);const[s,{isActive:i,onEnter:o,onEntering:a,onEntered:l,onExit:u,onExiting:c,onExited:f,mountOnEnter:h,unmountOnExit:v,transition:y=Id}]=rw(r);return d.jsx(ms.Provider,{value:null,children:d.jsx(cr.Provider,{value:null,children:d.jsx(y,{in:i,onEnter:o,onEntering:a,onEntered:l,onExit:u,onExiting:c,onExited:f,mountOnEnter:h,unmountOnExit:v,children:d.jsx(n,Object.assign({},s,{ref:t,hidden:!i,"aria-hidden":!i}))})})})});sw.displayName="TabPanel";const iw=e=>{const{id:t,generateChildId:n,onSelect:r,activeKey:s,defaultActiveKey:i,transition:o,mountOnEnter:a,unmountOnExit:l,children:u}=e,[c,f]=iL(s,i,r),h=dL(t),v=p.useMemo(()=>n||((w,S)=>h?`${h}-${S}-${w}`:null),[h,n]),y=p.useMemo(()=>({onSelect:f,activeKey:c,transition:o,mountOnEnter:a||!1,unmountOnExit:l||!1,getControlledId:w=>v(w,"tabpane"),getControllerId:w=>v(w,"tab")}),[f,c,o,a,l,v]);return d.jsx(ms.Provider,{value:y,children:d.jsx(cr.Provider,{value:f||null,children:u})})};iw.Panel=sw;function ow(e){return typeof e=="boolean"?e?pr:Id:e}const aw=({transition:e,...t})=>d.jsx(iw,{...t,transition:ow(e)});aw.displayName="TabContainer";const lw=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"tab-content"),d.jsx(n,{ref:s,className:A(e,t),...r})));lw.displayName="TabContent";const uw=p.forwardRef(({bsPrefix:e,transition:t,...n},r)=>{const[{className:s,as:i="div",...o},{isActive:a,onEnter:l,onEntering:u,onEntered:c,onExit:f,onExiting:h,onExited:v,mountOnEnter:y,unmountOnExit:w,transition:S=pr}]=rw({...n,transition:ow(t)}),x=D(e,"tab-pane");return d.jsx(ms.Provider,{value:null,children:d.jsx(cr.Provider,{value:null,children:d.jsx(S,{in:a,onEnter:l,onEntering:u,onEntered:c,onExit:f,onExiting:h,onExited:v,mountOnEnter:y,unmountOnExit:w,children:d.jsx(i,{...o,ref:r,className:A(s,x,a&&"active")})})})})});uw.displayName="TabPane";const xL={eventKey:U.oneOfType([U.string,U.number]),title:U.node.isRequired,disabled:U.bool,tabClassName:U.string,tabAttrs:U.object},cw=()=>{throw new Error("ReactBootstrap: The `Tab` component is not meant to be rendered! It's an abstract component that is only valid as a direct Child of the `Tabs` Component. For custom tabs components use TabPane and TabsContainer directly")};cw.propTypes=xL;const He=Object.assign(cw,{Container:aw,Content:lw,Pane:uw}),Cf=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"card-body"),d.jsx(n,{ref:s,className:A(e,t),...r})));Cf.displayName="CardBody";const dw=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"card-footer"),d.jsx(n,{ref:s,className:A(e,t),...r})));dw.displayName="CardFooter";const fw=p.forwardRef(({bsPrefix:e,className:t,as:n="div",...r},s)=>{const i=D(e,"card-header"),o=p.useMemo(()=>({cardHeaderBsPrefix:i}),[i]);return d.jsx(Sf.Provider,{value:o,children:d.jsx(n,{ref:s,...r,className:A(t,i)})})});fw.displayName="CardHeader";const hw=p.forwardRef(({bsPrefix:e,className:t,variant:n,as:r="img",...s},i)=>{const o=D(e,"card-img");return d.jsx(r,{ref:i,className:A(n?`${o}-${n}`:o,t),...s})});hw.displayName="CardImg";const pw=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"card-img-overlay"),d.jsx(n,{ref:s,className:A(e,t),...r})));pw.displayName="CardImgOverlay";const mw=p.forwardRef(({className:e,bsPrefix:t,as:n="a",...r},s)=>(t=D(t,"card-link"),d.jsx(n,{ref:s,className:A(e,t),...r})));mw.displayName="CardLink";const wL=Ba("h6"),gw=p.forwardRef(({className:e,bsPrefix:t,as:n=wL,...r},s)=>(t=D(t,"card-subtitle"),d.jsx(n,{ref:s,className:A(e,t),...r})));gw.displayName="CardSubtitle";const yw=p.forwardRef(({className:e,bsPrefix:t,as:n="p",...r},s)=>(t=D(t,"card-text"),d.jsx(n,{ref:s,className:A(e,t),...r})));yw.displayName="CardText";const SL=Ba("h5"),vw=p.forwardRef(({className:e,bsPrefix:t,as:n=SL,...r},s)=>(t=D(t,"card-title"),d.jsx(n,{ref:s,className:A(e,t),...r})));vw.displayName="CardTitle";const xw=p.forwardRef(({bsPrefix:e,className:t,bg:n,text:r,border:s,body:i=!1,children:o,as:a="div",...l},u)=>{const c=D(e,"card");return d.jsx(a,{ref:u,...l,className:A(t,c,n&&`bg-${n}`,r&&`text-${r}`,s&&`border-${s}`),children:i?d.jsx(Cf,{children:o}):o})});xw.displayName="Card";const G=Object.assign(xw,{Img:hw,Title:vw,Subtitle:gw,Body:Cf,Link:mw,Text:yw,Header:fw,Footer:dw,ImgOverlay:pw}),ww=()=>{const[e,t]=p.useState(vf),[n,r]=p.useState(!1),[s,i]=p.useState(!1),[o,a]=p.useState(!0),[l,u]=p.useState(!1),{userId:c,lessonId:f}=La(),h=p.useRef(null),{user:v}=an(),y=us();p.useEffect(()=>{v&&v._id===c?r(!0):r(!1),n&&!h.current&&(h.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",c),Ux(h,f,t),a(!1))},[v,c,h,f,n]);const w=async()=>{y(`/${c}/edit/${f}`)},S=async()=>{try{i(!0),(await h.current.deleteLessonPlan(f)).status<300&&setTimeout(()=>{y(`/${c}`),i(!1)},2e3)}catch(m){console.log(m.message)}},x=async m=>{m.preventDefault(),u(!0)};return d.jsxs(Bn,{fluid:!0,children:[d.jsx(Yx,{show:l,toggleShow:()=>u(!1),handleDeleteConfirmed:S}),n&&!o&&d.jsxs(d.Fragment,{children:[d.jsx(Et,{to:`/${c}`,className:"m-3",children:d.jsx(B,{variant:"outline-secondary",className:"my-2",title:"Go back to profile.","aria-label":"back-button",children:d.jsx(Q,{src:"/simplifica/arrow-left.svg"})})}),d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},className:"mx-3 my-2",children:d.jsxs(G,{className:"mx-3 mx-lg-5 mb-2",children:[d.jsx(G.Header,{"aria-label":"success-title",children:"Lesson Plan"}),d.jsxs(G.Body,{children:[d.jsx(G.Title,{children:d.jsxs(Ii,{className:"align-items-center",children:[d.jsx(Pt,{xs:8,sm:8,md:10,children:d.jsx("h1",{className:"display-6","aria-label":"topic",children:e.topic})}),d.jsx(Pt,{xs:2,sm:2,md:1,children:d.jsx(B,{variant:"outline-secondary",onClick:w,"aria-label":"edit-button",children:d.jsx(Q,{src:"/simplifica/pencil.svg"})})}),d.jsx(Pt,{xs:2,sm:2,md:1,className:"d-flex justify-content center align-items-center",children:s?d.jsx(mr,{animation:"border",role:"status",size:"sm",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})}):d.jsx(B,{variant:"outline-danger",onClick:x,"aria-label":"delete-button",children:d.jsx(Q,{src:"/simplifica/trash.svg"})})})]})}),d.jsx(G.Subtitle,{className:"mb-4 text-muted","aria-label":"lesson-date",children:new Date(e.date).toLocaleDateString("en-GB")}),d.jsxs(He.Container,{id:"phase-tabs",defaultActiveKey:"presentation",children:[d.jsxs(He.Content,{children:[d.jsxs(He.Pane,{eventKey:"presentation",children:[d.jsx(G.Text,{className:"h6","aria-label":"lesson-objective-question",children:"What is the main language point (grammar, vocabulary, function) you want to teach?"}),d.jsx(G.Text,{"aria-label":"lesson-objective-answer",children:e.presentation.objective}),d.jsx(G.Text,{className:"h6",children:"What materials (textbook, audio, video, visual aids) will you need?"}),d.jsx("ul",{children:e.presentation.materials.map((m,g)=>d.jsx("li",{children:m},g))}),d.jsx(G.Text,{className:"h6",children:"How will you introduce the topic to make it relevant and engaging for students?"}),d.jsx(G.Text,{children:e.presentation.connection})]}),d.jsxs(He.Pane,{eventKey:"practice",children:[d.jsx(G.Text,{className:"h6",children:"How is the target language applicable to the students' everyday lives?"}),d.jsx(G.Text,{children:e.practice.real_life_application}),d.jsx(G.Text,{className:"h6",children:"What type of feedback will you provide to correct errors and reinforce learning?"}),d.jsx(G.Text,{children:e.practice.feedback_method}),d.jsx(G.Text,{className:"h6",children:"What activities will you use to help students practice the new language in a controlled way?"}),d.jsx("ul",{children:e.practice.activities.map((m,g)=>d.jsx("li",{children:m},g))})]}),d.jsxs(He.Pane,{eventKey:"production",children:[d.jsx(G.Text,{className:"h6",children:"How will you facilitate student interaction and collaboration during the production phase?"}),d.jsx(G.Text,{children:e.production.learner_interaction}),d.jsx(G.Text,{className:"h6",children:"What criteria will you use to evaluate their performance?"}),d.jsx("ul",{className:"list-group-flush",children:e.production.success_criteria.map((m,g)=>d.jsx("li",{children:m},g))}),d.jsx(G.Text,{className:"h6",children:"What activities will allow students to use the new language more freely and creatively?"}),d.jsx("ul",{className:"list-group-flush",children:e.production.activities.map((m,g)=>d.jsx("li",{children:m},g))})]})]}),d.jsxs(de,{variant:"pills",className:"flex-row mt-3",children:[d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"presentation",title:"See the presentation phase.",children:"Presentation"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"practice",title:"See the practice phase.",variant:"outline-dark",children:"Practice"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"production",title:"See the production phase.",children:"Production"})})]})]})]})]})})]}),!n&&d.jsx(Oe.div,{initial:{opacity:0,x:-100},animate:{opacity:1,x:0},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to view someone else's lesson. In order to view their lessons, you must sign in to their account."})})]})};ww.propTypes={triggerFeedback:U.func};const Sw=e=>{const[t,n]=p.useState(e);return[t,(s,i=null,o=null)=>{n(i===null&&o===null?s:a=>({...a,[i]:o!==null?{...a[i],[o]:s}:s}))}]},Cw=()=>{const{triggerFeedback:e}=Qa(),{user:t}=an(),{userId:n}=La(),r=us(),s=p.useRef(null),[i,o]=p.useState(!1),[a,l]=p.useState(!1),[u,c]=Sw(vf),[f,h]=p.useState(!1),[v,y]=p.useState(!1);p.useEffect(()=>{t&&(t._id===n?o(!0):o(!1)),i&&!s.current&&(s.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",n))},[t,n,i,u]);const w=async T=>{if(T.preventDefault(),!v||!f)return e([{type:"error",title:"Error",message:"Lesson needs at least a topic and a date."}]);try{l(!0),await s.current.createLessonPlan(u),setTimeout(()=>{r(`/${n}`),l(!1)},2e3)}catch(E){console.log(E.message)}},S=T=>T.trim()!=="",x=(T,E)=>{switch(T){case"date":h(E);break;case"topic":y(E);break}},m=T=>{const{name:E,value:P}=T.target,j=E.split("."),M=S(P);j.length===1&&(x(j[0],M),c(P,j[0],null)),j.length===1?c(P,j[0],null):c(P,j[0],j[1])},g=(T,E,P,j)=>{T.preventDefault();const M=document.getElementById(j).value;M.trim()!==""&&(c([...u[E][P],M],E,P),document.getElementById(j).value="")},C=(T,E,P,j)=>{T.preventDefault();const M=u[E][P].filter((b,X)=>X!==j);c(M,E,P)};return d.jsx(Bn,{fluid:!0,children:i?d.jsxs(d.Fragment,{children:[d.jsx(Et,{to:`/${n}`,className:"m-3",children:d.jsx(B,{variant:"outline-secondary",className:"my-2",title:"Go back to profile.","aria-label":"back-button",children:d.jsx(Q,{src:"/simplifica/arrow-left.svg"})})}),d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},className:"mx-3 my-2",children:d.jsxs(G,{className:"mx-3 mx-lg-5",children:[d.jsx(G.Header,{children:"New Lesson Plan"}),d.jsx(G.Body,{children:d.jsxs(O,{children:[d.jsx(G.Title,{className:"mb-3",children:d.jsxs(Ii,{className:"align-items-center",children:[d.jsx(Pt,{xs:9,sm:10,md:10,children:d.jsx(O.Group,{children:d.jsx(O.Control,{type:"text",placeholder:"Lesson Topic","aria-label":"topic-input",name:"topic",onChange:m})})}),d.jsx(Pt,{xs:1,sm:2,md:{span:1,offset:1},children:a?d.jsx(mr,{animation:"border",role:"status",size:"sm",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})}):d.jsx(B,{variant:"outline-success","aria-label":"save-button",onClick:w,children:d.jsx(Q,{src:"/simplifica/floppy.svg"})})})]})}),d.jsx(G.Subtitle,{className:"mb-4 text-muted",children:d.jsx(O.Control,{type:"date",placeholder:"Date",name:"date",onChange:m})}),d.jsxs(He.Container,{id:"phase-tabs",defaultActiveKey:"presentation",children:[d.jsxs(He.Content,{children:[d.jsxs(He.Pane,{eventKey:"presentation",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"lessonObjective",children:[d.jsx(O.Label,{className:"h5",children:"What is the main language point you want to teach?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.objective",placeholder:"Grammar, vocabulary, functions, etc.",onChange:m,"aria-label":"objective-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What materials will you need?"}),u.presentation.materials.length>0&&u.presentation.materials.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`material-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeMaterialButton","aria-label":"remove-material-button",onClick:P=>C(P,"presentation","materials",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Textbooks, audio, video, visual aids, etc.",name:"presentation.materials",id:"materialInput","aria-label":"material-input"}),d.jsx(B,{variant:"outline-success",id:"addMaterialButton","aria-label":"add-material-button",onClick:T=>g(T,"presentation","materials","materialInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"connection",children:[d.jsx(O.Label,{className:"h5",children:"How will you introduce the topic to make it relevant and engaging for students?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.connection",onChange:m,"aria-label":"connection-textarea",placeholder:"I will..."})]})]}),d.jsxs(He.Pane,{eventKey:"practice",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"realLifeApplication",children:[d.jsx(O.Label,{className:"h5",children:"How is the target language applicable to the students' everyday lives?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:m,name:"practice.real_life_application","aria-label":"real-life-application-textarea"})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"feedbackMethod",children:[d.jsx(O.Label,{className:"h5",children:"What type of feedback will you provide to correct errors and reinforce learning?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:m,name:"practice.feedback_method","aria-label":"feedback-method-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What activities will you use to help students practice the target language?"}),u.practice.activities.length>0&&u.practice.activities.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`practice-activity-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removePracticeActivityButton","aria-label":"remove-practice-activity-button",onClick:P=>C(P,"practice","activities",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"practice.activities",id:"practiceActivityInput","aria-label":"practice-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addPracticeActivityButton","aria-label":"add-practice-activity-button",onClick:T=>g(T,"practice","activities","practiceActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]}),d.jsxs(He.Pane,{eventKey:"production",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"learnerInteraction",children:[d.jsx(O.Label,{className:"h5",children:"How will you facilitate student interaction and collaboration during the production phase?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:m,name:"production.learner_interaction"})]}),d.jsx(O.Label,{className:"h5",children:"What criteria will you use to evaluate their performance?"}),u.production.success_criteria.length>0&&u.production.success_criteria.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`criterion-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeSuccessCriterionButton","aria-label":"remove-success-criterion-button",onClick:P=>C(P,"production","success_criteria",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Ability to use target language without help, etc.",name:"production.success_criteria",id:"successCriteriaInput","aria-label":"success-criteria-input"}),d.jsx(B,{variant:"outline-success",id:"addSuccessCriterionButton","aria-label":"add-success-criterion-button",onClick:T=>g(T,"production","success_criteria","successCriteriaInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsx(O.Label,{className:"h5",children:"What activities will allow students to use the new language more freely and creatively?"}),u.production.activities.length>0&&u.production.activities.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`production-activity-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeProductionActivityButton","aria-label":"remove-production-activity-button",onClick:P=>C(P,"production","activities",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"production.activities",id:"productionActivityInput","aria-label":"production-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addProductionActivityButton","aria-label":"add-production-activity-button",onClick:T=>g(T,"production","activities","productionActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]})]}),d.jsxs(de,{variant:"pills",className:"flex-row mt-3",children:[d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"presentation",title:"See the presentation phase.",children:"Presentation"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"practice",title:"See the practice phase.",variant:"outline-dark",children:"Practice"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"production",title:"See the production phase.",children:"Production"})})]})]})]})})]})})]}):d.jsx(Oe.div,{initial:{opacity:0,x:-100,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to create a lesson for an account which you are not signed in to. To create a lesson for that account, you must sign in with their details."})})})};Cw.propTypes={triggerFeedback:U.func};const _s=({children:e})=>{const{user:t,authenticate:n}=an();return p.useEffect(()=>{n()},[n,t]),t?e:d.jsx(qy,{to:"/login"})};_s.propTypes={children:U.element};const Po=({children:e})=>{const{user:t}=an();return t?d.jsx(qy,{to:`/${t._id}`}):e};Po.propTypes={children:U.element};const CL=()=>{const{user:e}=an(),{userId:t,lessonId:n}=La(),r=us(),s=p.useRef(null),[i,o]=p.useState(!1),[a,l]=p.useState(!1),[u,c]=Sw(vf);p.useEffect(()=>{e&&(e._id===t?o(!0):o(!1)),i&&!s.current&&(s.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",t),Ux(s,n,c))},[e,t,i,u,n,c]);const f=async w=>{w.preventDefault();try{l(!0),await s.current.updateLessonPlan(n,u),setTimeout(()=>{r(`/${t}`),l(!1)},2e3)}catch(S){console.log(S.message)}},h=w=>{const{name:S,value:x}=w.target,m=S.split(".");m.length===1?c(x,m[0],null):c(x,m[0],m[1])},v=(w,S,x,m)=>{w.preventDefault();const g=document.getElementById(m).value;g.trim()!==""&&(c([...u[S][x],g],S,x),document.getElementById(m).value="")},y=(w,S,x,m)=>{w.preventDefault();const g=u[S][x].filter((C,T)=>T!==m);c(g,S,x)};return d.jsx(d.Fragment,{children:i?d.jsxs(d.Fragment,{children:[d.jsx(Bn,{fluid:!0,children:d.jsx(Et,{to:`/${t}`,children:d.jsx(B,{variant:"outline-secondary",className:"my-2",title:"Go back to profile.","aria-label":"back-button",children:d.jsx(Q,{src:"/simplifica/arrow-left.svg"})})})}),d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:d.jsxs(G,{className:"mx-3 mx-lg-5",children:[d.jsx(G.Header,{children:"New Lesson Plan"}),d.jsx(G.Body,{children:d.jsxs(O,{children:[d.jsx(G.Title,{className:"mb-3",children:d.jsxs(Ii,{className:"align-items-center",children:[d.jsx(Pt,{xs:9,sm:10,md:10,children:d.jsx(O.Group,{children:d.jsx(O.Control,{type:"text",placeholder:"Lesson Topic","aria-label":"topic-input",name:"topic",value:u.topic,onChange:h})})}),d.jsx(Pt,{xs:1,sm:2,md:{span:1,offset:1},children:a?d.jsx(mr,{animation:"border",role:"status",size:"sm",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})}):d.jsx(B,{variant:"outline-success","aria-label":"save-button",onClick:f,children:d.jsx(Q,{src:"/simplifica/floppy.svg"})})})]})}),d.jsx(G.Subtitle,{className:"mb-4 text-muted",children:d.jsx(O.Control,{type:"date",placeholder:"Date",name:"date",value:u.date!==""?new Date(u.date).toISOString().split("T")[0]:"",onChange:h})}),d.jsxs(He.Container,{id:"phase-tabs",defaultActiveKey:"presentation",children:[d.jsxs(He.Content,{children:[d.jsxs(He.Pane,{eventKey:"presentation",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"lessonObjective",children:[d.jsx(O.Label,{className:"h5",children:"What is the main language point you want to teach?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.objective",placeholder:"Grammar, vocabulary, functions, etc.",defaultValue:u.presentation.objective,onChange:h,"aria-label":"objective-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What materials will you need?"}),u.presentation.materials.length>0&&u.presentation.materials.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`material-${S}`,defaultValue:u.presentation.materials[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeMaterialButton","aria-label":"remove-material-button",onClick:x=>y(x,"presentation","materials",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Textbooks, audio, video, visual aids, etc.",name:"presentation.materials",id:"materialInput","aria-label":"material-input"}),d.jsx(B,{variant:"outline-success",id:"addMaterialButton","aria-label":"add-material-button",onClick:w=>v(w,"presentation","materials","materialInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"connection",children:[d.jsx(O.Label,{className:"h5",children:"How will you introduce the topic to make it relevant and engaging for students?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.connection",defaultValue:u.presentation.connection,onChange:h,"aria-label":"connection-textarea",placeholder:"I will..."})]})]}),d.jsxs(He.Pane,{eventKey:"practice",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"realLifeApplication",children:[d.jsx(O.Label,{className:"h5",children:"How is the target language applicable to the students' everyday lives?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:h,defaultValue:u.practice.real_life_application,name:"practice.real_life_application","aria-label":"real-life-application-textarea"})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"feedbackMethod",children:[d.jsx(O.Label,{className:"h5",children:"What type of feedback will you provide to correct errors and reinforce learning?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:h,defaultValue:u.practice.feedback_method,name:"practice.feedback_method","aria-label":"feedback-method-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What activities will you use to help students practice the target language?"}),u.practice.activities.length>0&&u.practice.activities.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`practice-activity-${S}`,defaultValue:u.practice.activities[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removePracticeActivityButton","aria-label":"remove-practice-activity-button",onClick:x=>y(x,"practice","activities",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"practice.activities",id:"practiceActivityInput","aria-label":"practice-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addPracticeActivityButton","aria-label":"add-practice-activity-button",onClick:w=>v(w,"practice","activities","practiceActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]}),d.jsxs(He.Pane,{eventKey:"production",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"learnerInteraction",children:[d.jsx(O.Label,{className:"h5",children:"How will you facilitate student interaction and collaboration during the production phase?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:h,defaultValue:u.production.learner_interaction,name:"production.learner_interaction"})]}),d.jsx(O.Label,{className:"h5",children:"What criteria will you use to evaluate their performance?"}),u.production.success_criteria.length>0&&u.production.success_criteria.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`criterion-${S}`,defaultValue:u.production.success_criteria[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeSuccessCriterionButton","aria-label":"remove-success-criterion-button",onClick:x=>y(x,"production","success_criteria",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Ability to use target language without help, etc.",name:"production.success_criteria",id:"successCriteriaInput","aria-label":"success-criteria-input"}),d.jsx(B,{variant:"outline-success",id:"addSuccessCriterionButton","aria-label":"add-success-criterion-button",onClick:w=>v(w,"production","success_criteria","successCriteriaInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsx(O.Label,{className:"h5",children:"What activities will allow students to use the new language more freely and creatively?"}),u.production.activities.length>0&&u.production.activities.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`production-activity-${S}`,defaultValue:u.production.activities[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeProductionActivityButton","aria-label":"remove-production-activity-button",onClick:x=>y(x,"production","activities",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"production.activities",id:"productionActivityInput","aria-label":"production-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addProductionActivityButton","aria-label":"add-production-activity-button",onClick:w=>v(w,"production","activities","productionActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]})]}),d.jsxs(de,{variant:"pills",className:"flex-row mt-3",children:[d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"presentation",title:"See the presentation phase.",children:"Presentation"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"practice",title:"See the practice phase.",variant:"outline-dark",children:"Practice"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"production",title:"See the production phase.",children:"Production"})})]})]})]})})]})})]}):d.jsx(Oe.div,{initial:{opacity:0,x:-100,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to edit a lesson for an account which you are not signed in to. To edit a lesson for that account, you must sign in with their details."})})})},EL=()=>d.jsx(Ox,{children:d.jsx(kv,{children:d.jsx(GC,{children:d.jsxs($t,{path:"/",element:d.jsx(CO,{}),errorElement:d.jsx(nt,{}),children:[d.jsx($t,{path:"/",element:d.jsx(Po,{children:d.jsx(FO,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/register",element:d.jsx(Po,{children:d.jsx(bO,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/login",element:d.jsx(Po,{children:d.jsx(DO,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId",element:d.jsx(_s,{children:d.jsx(_O,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId/view/:lessonId",element:d.jsx(_s,{children:d.jsx(ww,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId/edit/:lessonId",element:d.jsx(_s,{children:d.jsx(CL,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId/create",element:d.jsx(_s,{children:d.jsx(Cw,{})}),errorElement:d.jsx(nt,{})})]})})})});Jl.createRoot(document.getElementById("root")).render(d.jsx(Ee.StrictMode,{children:d.jsx(eE,{basename:"/simplifica",children:d.jsx(EL,{})})})); + `),()=>{document.head.removeChild(c)}},[t]),d.jsx(dO,{isPresent:t,childRef:r,sizeRef:s,children:p.cloneElement(e,{ref:r})})}const Ql=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const a=y0(hO),l=p.useId(),u=p.useMemo(()=>({id:l,initial:t,isPresent:n,custom:s,onExitComplete:c=>{a.set(c,!0);for(const f of a.values())if(!f)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),i?[Math.random()]:[n]);return p.useMemo(()=>{a.forEach((c,f)=>a.set(f,!1))},[n]),p.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),o==="popLayout"&&(e=d.jsx(fO,{isPresent:n,children:e})),d.jsx(za.Provider,{value:u,children:e})};function hO(){return new Map}function pO(e){return p.useEffect(()=>()=>e(),[])}const Yn=e=>e.key||"";function mO(e,t){e.forEach(n=>{const r=Yn(n);t.set(r,n)})}function gO(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const Cm=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:s,presenceAffectsLayout:i=!0,mode:o="sync"})=>{const a=p.useContext(Kd).forceRender||cO()[0],l=Sx(),u=gO(e);let c=u;const f=p.useRef(new Map).current,h=p.useRef(c),v=p.useRef(new Map).current,y=p.useRef(!0);if(Bd(()=>{y.current=!1,mO(u,v),h.current=c}),pO(()=>{y.current=!0,v.clear(),f.clear()}),y.current)return d.jsx(d.Fragment,{children:c.map(m=>d.jsx(Ql,{isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:i,mode:o,children:m},Yn(m)))});c=[...c];const w=h.current.map(Yn),S=u.map(Yn),x=w.length;for(let m=0;m{if(S.indexOf(g)!==-1)return;const C=v.get(g);if(!C)return;const T=w.indexOf(g);let E=m;if(!E){const P=()=>{f.delete(g);const j=Array.from(v.keys()).filter(M=>!S.includes(M));if(j.forEach(M=>v.delete(M)),h.current=u.filter(M=>{const b=Yn(M);return b===g||j.includes(b)}),!f.size){if(l.current===!1)return;a(),r&&r()}};E=d.jsx(Ql,{isPresent:!1,onExitComplete:P,custom:t,presenceAffectsLayout:i,mode:o,children:C},Yn(C)),f.set(g,E)}c.splice(T,0,E)}),c=c.map(m=>{const g=m.key;return f.has(g)?m:d.jsx(Ql,{isPresent:!0,presenceAffectsLayout:i,mode:o,children:m},Yn(m))}),d.jsx(d.Fragment,{children:f.size?c:c.map(m=>p.cloneElement(m))})},yO=()=>{const{user:e,signOut:t}=an(),[n,r]=p.useState(!1),s=async i=>{i.preventDefault(),r(!0);try{setTimeout(async()=>{await t()},1e3)}catch(o){console.log(o.message)}finally{setTimeout(()=>{r(!1)},2e3)}};return d.jsxs(dp,{expand:"lg",className:"bg-body-tertiary justify-content-between text-center align-items-center px-5",sticky:"top",children:[d.jsx(dp.Brand,{children:d.jsx(Et,{className:"align-items-center text-decoration-none",to:"/",children:d.jsx("h1",{className:"display-6 mb-0","aria-label":"brand",title:"Return to home page.",children:"Simplifica."})})}),e&&d.jsx(Oe.div,{initial:{opacity:0},animate:{opacity:1,transition:{delay:.2}},exit:{opacity:0},whileHover:{scale:1.05},whileTap:{scale:.8},children:d.jsx(B,{variant:"dark",onClick:s,disabled:n,className:"w-100",children:n?d.jsxs("span",{children:["Signing out..."," ",d.jsx(mr,{as:"span",animation:"border",className:"mx-3",size:"sm",role:"status","aria-hidden":"true",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})})]}):"Sign Out"})})]})},Ec=2**31-1;function Cx(e,t,n){const r=n-Date.now();e.current=r<=Ec?setTimeout(t,r):setTimeout(()=>Cx(e,t,n),Ec)}function vO(){const e=Fv(),t=p.useRef();return bd(()=>clearTimeout(t.current)),p.useMemo(()=>{const n=()=>clearTimeout(t.current);function r(s,i=0){e()&&(n(),i<=Ec?t.current=setTimeout(s,i):Cx(t,s,Date.now()+i))}return{set:r,clear:n,handleRef:t}},[])}const xO={[ht]:"showing",[es]:"showing show"},Ex=p.forwardRef((e,t)=>d.jsx(pr,{...e,ref:t,transitionClasses:xO}));Ex.displayName="ToastFade";const Tx=p.createContext({onClose(){}}),kx=p.forwardRef(({bsPrefix:e,closeLabel:t="Close",closeVariant:n,closeButton:r=!0,className:s,children:i,...o},a)=>{e=D(e,"toast-header");const l=p.useContext(Tx),u=ze(c=>{l==null||l.onClose==null||l.onClose(c)});return d.jsxs("div",{ref:a,...o,className:A(e,s),children:[i,r&&d.jsx($a,{"aria-label":t,variant:n,onClick:u,"data-dismiss":"toast"})]})});kx.displayName="ToastHeader";const jx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"toast-body"),d.jsx(n,{ref:s,className:A(e,t),...r})));jx.displayName="ToastBody";const Px=p.forwardRef(({bsPrefix:e,className:t,transition:n=Ex,show:r=!0,animation:s=!0,delay:i=5e3,autohide:o=!1,onClose:a,onEntered:l,onExit:u,onExiting:c,onEnter:f,onEntering:h,onExited:v,bg:y,...w},S)=>{e=D(e,"toast");const x=p.useRef(i),m=p.useRef(a);p.useEffect(()=>{x.current=i,m.current=a},[i,a]);const g=vO(),C=!!(o&&r),T=p.useCallback(()=>{C&&(m.current==null||m.current())},[C]);p.useEffect(()=>{g.set(T,x.current)},[g,T]);const E=p.useMemo(()=>({onClose:a}),[a]),P=!!(n&&s),j=d.jsx("div",{...w,ref:S,className:A(e,t,y&&`bg-${y}`,!P&&(r?"show":"hide")),role:"alert","aria-live":"assertive","aria-atomic":"true"});return d.jsx(Tx.Provider,{value:E,children:P&&n?d.jsx(n,{in:r,onEnter:f,onEntering:h,onEntered:l,onExit:u,onExiting:c,onExited:v,unmountOnExit:!0,children:j}):j})});Px.displayName="Toast";const Xl=Object.assign(Px,{Body:jx,Header:kx}),Rx=({title:e,message:t,type:n,toggleVisible:r})=>{const s=new Date;return d.jsxs(Xl,{onClose:r,delay:5e3,bg:n==="error"?"warning":n,autohide:!0,children:[d.jsxs(Xl.Header,{children:[d.jsx("strong",{className:"me-auto","aria-label":"feedback-title",children:e}),d.jsx("small",{"aria-label":"feedback-timestamp",children:s.toLocaleTimeString()})]}),d.jsx(Xl.Body,{className:n==="error"?"text-grey":"text-white","aria-label":"feedback-message",children:t})]})};Rx.propTypes={title:U.string.isRequired,message:U.string.isRequired,type:U.string.isRequired,toggleVisible:U.func.isRequired};const wO=()=>{const[e,t]=p.useState(!1),[n,r]=p.useState([]);return[n,e,o=>{r(o),t(!0)},()=>t(!e)]},Nx=p.createContext(),Ox=({children:e})=>{const[t,n,r,s]=wO(),i=p.useMemo(()=>({feedback:t,showFeedback:n,triggerFeedback:r,toggleFeedback:s}),[t,n,r,s]);return d.jsx(Nx.Provider,{value:i,children:e})},Qa=()=>p.useContext(Nx);Ox.propTypes={children:U.node};const SO={"top-start":"top-0 start-0","top-center":"top-0 start-50 translate-middle-x","top-end":"top-0 end-0","middle-start":"top-50 start-0 translate-middle-y","middle-center":"top-50 start-50 translate-middle","middle-end":"top-50 end-0 translate-middle-y","bottom-start":"bottom-0 start-0","bottom-center":"bottom-0 start-50 translate-middle-x","bottom-end":"bottom-0 end-0"},Lx=p.forwardRef(({bsPrefix:e,position:t,containerPosition:n,className:r,as:s="div",...i},o)=>(e=D(e,"toast-container"),d.jsx(s,{ref:o,...i,className:A(e,t&&SO[t],n&&`position-${n}`,r)})));Lx.displayName="ToastContainer";const CO=()=>{const{feedback:e,showFeedback:t,toggleFeedback:n}=Qa();return d.jsxs(d.Fragment,{children:[d.jsx(yO,{}),d.jsx(Cm,{children:d.jsx(WC,{})}),d.jsx(Cm,{children:t&&d.jsx(Lx,{style:{position:"fixed",top:0,right:0,marginRight:"1rem",marginTop:"1rem",maxWidth:"90%"},children:e.map((r,s)=>d.jsx(Oe.div,{drag:!0,dragConstraints:{top:0,left:-50,right:0,bottom:50},initial:{opacity:0},animate:{opacity:1,transition:{delay:.2}},exit:{opacity:0},whileHover:{scale:1.05},whileTap:{scale:.5},className:"my-1",children:d.jsx(Rx,{title:r.title,message:r.message,type:r.type,toggleVisible:n})},s))})})]})},qs=(e,t)=>{const n=e.target.value;t(n)},Em=e=>/^[a-zA-Z][a-zA-Z0-9_]{4,19}$/.test(e),Tm=e=>/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/.test(e),EO=[{name:"invalid_password",info:{type:"error",title:"Invalid Password",message:"Password is invalid. It should be at least 8 characters long, and should contain at least 1 uppercase letter, lowercase letter, special character and number."}},{name:"invalid_username",info:{type:"error",title:"Invalid Username",message:"Username is invalid. It should be between 4 and 19 characters long, and should only contain numbers, letters and underscores."}},{name:"passwords_not_matching",info:{type:"error",title:"Non-Matching Passwords",message:"Passwords do not match. Verify that the two passwords you have typed in are the same."}}],Bn=p.forwardRef(({bsPrefix:e,fluid:t=!1,as:n="div",className:r,...s},i)=>{const o=D(e,"container"),a=typeof t=="string"?`-${t}`:"-fluid";return d.jsx(n,{ref:i,...s,className:A(r,t?`${o}${a}`:o)})});Bn.displayName="Container";function TO(e,t=Nv,n=Ov){const r=[];return Object.entries(e).forEach(([s,i])=>{i!=null&&(typeof i=="object"?t.forEach(o=>{const a=i[o];if(a!=null){const l=o!==n?`-${o}`:"";r.push(`${s}${l}-${a}`)}}):r.push(`${s}-${i}`))}),r}const rs=p.forwardRef(({as:e="div",bsPrefix:t,className:n,direction:r,gap:s,...i},o)=>{t=D(t,r==="horizontal"?"hstack":"vstack");const a=Nd(),l=Od();return d.jsx(e,{...i,ref:o,className:A(n,t,...TO({gap:s},a,l))})});rs.displayName="Stack";const sn=p.createContext({}),gf=p.forwardRef(({controlId:e,as:t="div",...n},r)=>{const s=p.useMemo(()=>({controlId:e}),[e]);return d.jsx(sn.Provider,{value:s,children:d.jsx(t,{...n,ref:r})})});gf.displayName="FormGroup";const rr=p.forwardRef(({bsPrefix:e,className:t,children:n,controlId:r,label:s,...i},o)=>(e=D(e,"form-floating"),d.jsxs(gf,{ref:o,className:A(t,e),controlId:r,...i,children:[n,d.jsx("label",{htmlFor:r,children:s})]})));rr.displayName="FloatingLabel";const kO={type:U.string,tooltip:U.bool,as:U.elementType},Xa=p.forwardRef(({as:e="div",className:t,type:n="valid",tooltip:r=!1,...s},i)=>d.jsx(e,{...s,ref:i,className:A(t,`${n}-${r?"tooltip":"feedback"}`)}));Xa.displayName="Feedback";Xa.propTypes=kO;const Mi=p.forwardRef(({id:e,bsPrefix:t,className:n,type:r="checkbox",isValid:s=!1,isInvalid:i=!1,as:o="input",...a},l)=>{const{controlId:u}=p.useContext(sn);return t=D(t,"form-check-input"),d.jsx(o,{...a,ref:l,type:r,id:e||u,className:A(n,t,s&&"is-valid",i&&"is-invalid")})});Mi.displayName="FormCheckInput";const ca=p.forwardRef(({bsPrefix:e,className:t,htmlFor:n,...r},s)=>{const{controlId:i}=p.useContext(sn);return e=D(e,"form-check-label"),d.jsx("label",{...r,ref:s,htmlFor:n||i,className:A(t,e)})});ca.displayName="FormCheckLabel";function jO(e,t){return p.Children.toArray(e).some(n=>p.isValidElement(n)&&n.type===t)}const Ax=p.forwardRef(({id:e,bsPrefix:t,bsSwitchPrefix:n,inline:r=!1,reverse:s=!1,disabled:i=!1,isValid:o=!1,isInvalid:a=!1,feedbackTooltip:l=!1,feedback:u,feedbackType:c,className:f,style:h,title:v="",type:y="checkbox",label:w,children:S,as:x="input",...m},g)=>{t=D(t,"form-check"),n=D(n,"form-switch");const{controlId:C}=p.useContext(sn),T=p.useMemo(()=>({controlId:e||C}),[C,e]),E=!S&&w!=null&&w!==!1||jO(S,ca),P=d.jsx(Mi,{...m,type:y==="switch"?"checkbox":y,ref:g,isValid:o,isInvalid:a,disabled:i,as:x});return d.jsx(sn.Provider,{value:T,children:d.jsx("div",{style:h,className:A(f,E&&t,r&&`${t}-inline`,s&&`${t}-reverse`,y==="switch"&&n),children:S||d.jsxs(d.Fragment,{children:[P,E&&d.jsx(ca,{title:v,children:w}),u&&d.jsx(Xa,{type:c,tooltip:l,children:u})]})})})});Ax.displayName="FormCheck";const da=Object.assign(Ax,{Input:Mi,Label:ca}),bx=p.forwardRef(({bsPrefix:e,type:t,size:n,htmlSize:r,id:s,className:i,isValid:o=!1,isInvalid:a=!1,plaintext:l,readOnly:u,as:c="input",...f},h)=>{const{controlId:v}=p.useContext(sn);return e=D(e,"form-control"),d.jsx(c,{...f,type:t,size:r,ref:h,readOnly:u,id:s||v,className:A(i,l?`${e}-plaintext`:e,n&&`${e}-${n}`,t==="color"&&`${e}-color`,o&&"is-valid",a&&"is-invalid")})});bx.displayName="FormControl";const PO=Object.assign(bx,{Feedback:Xa}),Dx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"form-floating"),d.jsx(n,{ref:s,className:A(e,t),...r})));Dx.displayName="FormFloating";function RO({as:e,bsPrefix:t,className:n,...r}){t=D(t,"col");const s=Nd(),i=Od(),o=[],a=[];return s.forEach(l=>{const u=r[l];delete r[l];let c,f,h;typeof u=="object"&&u!=null?{span:c,offset:f,order:h}=u:c=u;const v=l!==i?`-${l}`:"";c&&o.push(c===!0?`${t}${v}`:`${t}${v}-${c}`),h!=null&&a.push(`order${v}-${h}`),f!=null&&a.push(`offset${v}-${f}`)}),[{...r,className:A(n,...o,...a)},{as:e,bsPrefix:t,spans:o}]}const Pt=p.forwardRef((e,t)=>{const[{className:n,...r},{as:s="div",bsPrefix:i,spans:o}]=RO(e);return d.jsx(s,{...r,ref:t,className:A(n,!o.length&&i)})});Pt.displayName="Col";const Mx=p.forwardRef(({as:e="label",bsPrefix:t,column:n=!1,visuallyHidden:r=!1,className:s,htmlFor:i,...o},a)=>{const{controlId:l}=p.useContext(sn);t=D(t,"form-label");let u="col-form-label";typeof n=="string"&&(u=`${u} ${u}-${n}`);const c=A(s,t,r&&"visually-hidden",n&&u);return i=i||l,n?d.jsx(Pt,{ref:a,as:"label",className:c,htmlFor:i,...o}):d.jsx(e,{ref:a,className:c,htmlFor:i,...o})});Mx.displayName="FormLabel";const Ix=p.forwardRef(({bsPrefix:e,className:t,id:n,...r},s)=>{const{controlId:i}=p.useContext(sn);return e=D(e,"form-range"),d.jsx("input",{...r,type:"range",ref:s,className:A(t,e),id:n||i})});Ix.displayName="FormRange";const _x=p.forwardRef(({bsPrefix:e,size:t,htmlSize:n,className:r,isValid:s=!1,isInvalid:i=!1,id:o,...a},l)=>{const{controlId:u}=p.useContext(sn);return e=D(e,"form-select"),d.jsx("select",{...a,size:n,ref:l,className:A(r,e,t&&`${e}-${t}`,s&&"is-valid",i&&"is-invalid"),id:o||u})});_x.displayName="FormSelect";const Fx=p.forwardRef(({bsPrefix:e,className:t,as:n="small",muted:r,...s},i)=>(e=D(e,"form-text"),d.jsx(n,{...s,ref:i,className:A(t,e,r&&"text-muted")})));Fx.displayName="FormText";const Vx=p.forwardRef((e,t)=>d.jsx(da,{...e,ref:t,type:"switch"}));Vx.displayName="Switch";const NO=Object.assign(Vx,{Input:da.Input,Label:da.Label}),OO={_ref:U.any,validated:U.bool,as:U.elementType},yf=p.forwardRef(({className:e,validated:t,as:n="form",...r},s)=>d.jsx(n,{...r,ref:s,className:A(e,t&&"was-validated")}));yf.displayName="Form";yf.propTypes=OO;const O=Object.assign(yf,{Group:gf,Control:PO,Floating:Dx,Check:da,Switch:NO,Label:Mx,Text:Fx,Range:Ix,Select:_x,FloatingLabel:rr});U.string,U.bool,U.bool,U.bool,U.bool;const Q=p.forwardRef(({bsPrefix:e,className:t,fluid:n=!1,rounded:r=!1,roundedCircle:s=!1,thumbnail:i=!1,...o},a)=>(e=D(e,"img"),d.jsx("img",{ref:a,...o,className:A(t,n&&`${e}-fluid`,r&&"rounded",s&&"rounded-circle",i&&`${e}-thumbnail`)})));Q.displayName="Image";const $x=p.createContext(null);$x.displayName="InputGroupContext";const qa=p.forwardRef(({className:e,bsPrefix:t,as:n="span",...r},s)=>(t=D(t,"input-group-text"),d.jsx(n,{ref:s,className:A(e,t),...r})));qa.displayName="InputGroupText";const LO=e=>d.jsx(qa,{children:d.jsx(Mi,{type:"checkbox",...e})}),AO=e=>d.jsx(qa,{children:d.jsx(Mi,{type:"radio",...e})}),Bx=p.forwardRef(({bsPrefix:e,size:t,hasValidation:n,className:r,as:s="div",...i},o)=>{e=D(e,"input-group");const a=p.useMemo(()=>({}),[]);return d.jsx($x.Provider,{value:a,children:d.jsx(s,{ref:o,...i,className:A(r,e,t&&`${e}-${t}`,n&&"has-validation")})})});Bx.displayName="InputGroup";const xe=Object.assign(Bx,{Text:qa,Radio:AO,Checkbox:LO}),bO=()=>{const{triggerFeedback:e}=Qa(),[t,n]=p.useState(!0),[r,s]=p.useState(!0),[i,o]=p.useState(!1),[a,l]=p.useState(""),[u,c]=p.useState(""),[f,h]=p.useState(!1),[v,y]=p.useState(""),{register:w}=an();p.useEffect(()=>{Tm(u)&&Em(a)&&u===v?o(!0):o(!1)},[a,u,v]);const S=C=>qs(C,l),x=C=>qs(C,c),m=C=>qs(C,y),g=async C=>{h(!0);const T=[];if(C.preventDefault(),i)try{const E=await w({username:a,password:u});E.status===201?T.push({title:"Registration Successful",message:E.data.msg,type:"success"}):T.push({title:"Registration Failed",message:E.data.msg,type:"error"})}catch(E){console.log(E.message)}else{C.stopPropagation();const E=[];u!==v&&E.push("passwords_not_matching"),Tm(u)||E.push("invalid_password"),Em(a)||E.push("invalid_username");for(const P of E)for(const j of EO)j.name===P&&T.push(j.info)}setTimeout(()=>{h(!1)},1e3),e(T)};return d.jsx(Bn,{className:"col-12 col-md-6 pt-3 px-2 pt-md-5 px-md-4 ms-md-4 pb-4 align-middle",children:d.jsxs(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:[d.jsxs(rs,{gap:1,children:[d.jsx("h1",{className:"display-3 mt-5 pt-5","aria-label":"title",children:"Create an account"}),d.jsx("p",{"aria-label":"subtitle",children:"Enter a username and password"})]}),d.jsxs(O,{noValidate:!0,validated:i,onSubmit:g,children:[d.jsxs(O.Group,{controlId:"form",children:[d.jsx(rr,{controlId:"username-label",label:"Your username",children:d.jsx(O.Control,{type:"text",placeholder:"Your username",className:"mb-2",title:"Type your username here.","aria-label":"username-input",onChange:S})}),d.jsxs(xe,{hasValidation:!0,className:"mb-2",children:[d.jsx(rr,{controlId:"password-label",label:"Your password",children:d.jsx(O.Control,{type:t?"password":"text",placeholder:"Your password",title:"Type your password here.","aria-label":"password-input",onChange:x})}),d.jsx(B,{variant:"outline-secondary",onClick:()=>n(!t),title:"Click here to reveal your password.","aria-label":"hide-password-button",children:d.jsx(Q,{src:t?"/simplifica/eye.svg":"/simplifica/eye-slash.svg",alt:"Icon of an eye."})})]}),d.jsxs(xe,{hasValidation:!0,className:"mb-2",children:[d.jsx(rr,{controlId:"confirm-password-label",label:"Confirm your password",children:d.jsx(O.Control,{type:r?"password":"text",placeholder:"Confirm your password","aria-label":"confirm-password-input",title:"Type your password again here.",onChange:m})}),d.jsx(B,{variant:"outline-secondary",onClick:()=>s(!r),title:"Click here to reveal your password.","aria-label":"hide-confirm-password-button",children:d.jsx(Q,{src:r?"/simplifica/eye.svg":"/simplifica/eye-slash.svg",alt:"Icon of an eye."})})]})]}),d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{type:"submit",variant:"dark",className:"w-100","aria-label":"get-started-button",title:"Click here to register your account.",disabled:f,children:f?d.jsxs("span",{children:["Creating your account..."," ",d.jsx(mr,{as:"span",animation:"border",className:"mx-3",size:"sm",role:"status","aria-hidden":"true"})]}):"Get Started"})})]})]})})},DO=()=>{const{triggerFeedback:e}=Qa(),[t,n]=p.useState(""),[r,s]=p.useState(""),[i,o]=p.useState(!0),[a,l]=p.useState(!1),{signIn:u}=an(),c=v=>qs(v,n),f=v=>qs(v,s),h=async v=>{v.preventDefault(),l(!0);const y=[],w={username:t,password:r};try{const S=await u(w);S.status===200?y.push({type:"success",title:"Success",message:S.data.msg}):y.push({type:"error",title:"Error",message:S.data.msg})}catch(S){y.push({type:"error",title:"Error",message:S.message})}finally{setTimeout(()=>{l(!1)},1e3)}e(y)};return d.jsx(Bn,{className:"col-12 col-md-6 pt-3 px-2 pt-md-5 px-md-4 ms-md-4 align-middle",children:d.jsxs(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:[d.jsx(rs,{gap:1,className:"mb-3",children:d.jsx("h1",{className:"display-3 mt-5 pt-5","aria-label":"title",children:"Welcome back"})}),d.jsxs(O,{noValidate:!0,onSubmit:h,children:[d.jsxs(O.Group,{controlId:"form",children:[d.jsx(rr,{controlId:"username-label",label:"Your username",children:d.jsx(O.Control,{type:"text",placeholder:"Your username",className:"mb-2",title:"Type your username here.","aria-label":"username-input",onChange:c})}),d.jsxs(xe,{className:"mb-2",children:[d.jsx(rr,{controlId:"password-label",label:"Your password",children:d.jsx(O.Control,{type:i?"password":"text",placeholder:"Your password",title:"Type your password here.","aria-label":"password-input",onChange:f})}),d.jsx(B,{variant:"outline-secondary",onClick:()=>o(!i),title:"Click here to reveal your password.","aria-label":"hide-password-button",children:d.jsx(Q,{src:i?"/simplifica/eye.svg":"/simplifica/eye-slash.svg",alt:"Icon of an eye."})})]})]}),d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{type:"submit",variant:"dark",className:"w-100","aria-label":"sign-in-button",title:"Click here to sign into your account.",disabled:a,children:a?d.jsxs("span",{children:["Signing in..."," ",d.jsx(mr,{as:"span",animation:"border",className:"mx-3",size:"sm",role:"status","aria-hidden":"true"})]}):"Sign In"})})]})]})})};var At,bt;class Ja{constructor(t,n){Vi(this,At);Vi(this,bt);$i(this,At,pe.create({baseURL:t})),$i(this,bt,n)}getInstance(){return Se(this,At)}getUserId(){return Se(this,bt)}async getLessonPlans(){try{return await Se(this,At).get(`/${Se(this,bt)}/lesson-plans`)}catch(t){return t.message}}async getOneLessonPlan(t){try{return await Se(this,At).get(`/${Se(this,bt)}/lesson-plans/${t}`)}catch(n){return n.message}}async createLessonPlan(t){try{return await Se(this,At).post(`/${Se(this,bt)}/lesson-plans`,{lessonPlan:t})}catch(n){return n.message}}async updateLessonPlan(t,n){try{return await Se(this,At).put(`/${Se(this,bt)}/lesson-plans/${t}`,{newLessonPlan:n})}catch(r){return r.message}}async deleteLessonPlan(t){try{return await Se(this,At).delete(`/${Se(this,bt)}/lesson-plans/${t}`)}catch(n){return n.message}}}At=new WeakMap,bt=new WeakMap;const MO=async(e,t)=>{try{const n=await e.current.getLessonPlans();t(n.data.lessonPlans)}catch(n){console.log(n.message)}},Ux=async(e,t,n)=>{try{const r=await e.current.getOneLessonPlan(t);n(r.data.lessonPlan)}catch(r){console.log(r.message)}},nt=({message:e=""})=>d.jsx(Bn,{className:"pt-5 mt-5 px-4 h-100 align-middle",children:d.jsxs(rs,{gap:1,className:"col-12 col-sm-10 col-md-8 col-lg-6 col-xl-5",children:[d.jsx("h1",{className:"display-1 mt-5 pt-5 text-danger","aria-label":"title",children:"Uh-oh..."}),d.jsx("p",{"aria-label":"message",children:e.trim()!==""?e:"An unexpected error occurred. Click below to return to the homepage or see the console for more information."}),d.jsx(Et,{to:"/",children:d.jsx(B,{variant:"dark",className:"w-100",title:"Return to home page.","aria-label":"back-button",children:"Back"})})]})});nt.propTypes={message:U.string};const Ii=p.forwardRef(({bsPrefix:e,className:t,as:n="div",...r},s)=>{const i=D(e,"row"),o=Nd(),a=Od(),l=`${i}-cols`,u=[];return o.forEach(c=>{const f=r[c];delete r[c];let h;f!=null&&typeof f=="object"?{cols:h}=f:h=f;const v=c!==a?`-${c}`:"";h!=null&&u.push(`${l}${v}-${h}`)}),d.jsx(n,{ref:s,...r,className:A(t,i,...u)})});Ii.displayName="Row";const IO=p.forwardRef(({bsPrefix:e,className:t,striped:n,bordered:r,borderless:s,hover:i,size:o,variant:a,responsive:l,...u},c)=>{const f=D(e,"table"),h=A(t,f,a&&`${f}-${a}`,o&&`${f}-${o}`,n&&`${f}-${typeof n=="string"?`striped-${n}`:"striped"}`,r&&`${f}-bordered`,s&&`${f}-borderless`,i&&`${f}-hover`),v=d.jsx("table",{...u,className:h,ref:c});if(l){let y=`${f}-responsive`;return typeof l=="string"&&(y=`${y}-${l}`),d.jsx("div",{className:y,children:v})}return v}),_O=()=>{const[e,t]=p.useState([]),[n,r]=p.useState(!1),s=p.useRef(),{user:i}=an(),{userId:o}=La();return p.useEffect(()=>{i&&(i._id===o?r(!0):r(!1)),n&&!s.current&&(s.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",o),MO(s,t))},[n,i,o]),d.jsx(Bn,{className:"pt-3 px-2 pt-md-5 px-md-4 ms-md-4 align-middle",children:n?d.jsxs(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:[d.jsxs(Ii,{className:"mt-lg-3 mx-lg-5 align-items-center",children:[d.jsx(Pt,{xs:8,md:10,children:d.jsx("h1",{className:"display-3","aria-label":"title",children:"My Lesson Plans"})}),d.jsx(Pt,{xs:{span:2,offset:1},md:1,children:d.jsx(Et,{to:`/${o}/create`,children:d.jsx(B,{variant:"outline-success",children:d.jsx(Q,{src:"/simplifica/plus.svg"})})})})]}),d.jsxs(IO,{striped:!0,className:"mx-1 mx-lg-5",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"#"}),d.jsx("th",{children:"Topic"}),d.jsx("th",{children:"Date"})]})}),d.jsx("tbody",{children:e!==void 0&&e.map((a,l)=>d.jsxs("tr",{children:[d.jsx("td",{children:d.jsx(Et,{to:`/${o}/view/${a._id}`,children:l+1})}),d.jsx("td",{children:d.jsx(Et,{to:`/${o}/view/${a._id}`,children:a.topic})}),d.jsx("td",{children:d.jsx(Et,{to:`/${o}/view/${a._id}`,children:new Date(a.date).toLocaleDateString("en-GB")})})]},l))})]})]}):d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to access someone else's profile. To access their profile, you must be signed in with their account."})})})},FO=()=>d.jsxs(Oe.div,{className:"pt-3 px-2 pt-md-5 px-md-4 ms-md-4 align-middle",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,ease:[0,.71,.2,1.01]},children:[d.jsxs(rs,{gap:1,children:[d.jsx("h1",{className:"display-1 mt-5 pt-5","aria-label":"title",children:"Simplifica."}),d.jsx("p",{"aria-label":"subtitle",children:"Who said planning lessons couldn't be quick?"})]}),d.jsxs(rs,{gap:2,className:"col-auto col-sm-8 col-lg-6 col-xl-5",children:[d.jsx(Et,{to:"/register",children:d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{variant:"dark","aria-label":"sign-up-button",className:"w-100",title:"Register for an account.",children:"Sign Up (it's free!)"})})}),d.jsx(Et,{to:"/login",children:d.jsx(Oe.div,{whileHover:{scale:1.02},whileTap:{scale:.9},children:d.jsx(B,{variant:"outline-secondary","aria-label":"sign-in-button",className:"w-100",title:"Sign in to an account.",style:{borderColor:"darkgrey",color:"black"},children:"Sign In"})})})]})]}),VO="",$O="",BO={objective:"",materials:[],connection:""},UO={real_life_application:"",feedback_method:"",activities:[]},zO={learner_interaction:"",success_criteria:[],activities:[]},vf={topic:VO,date:$O,presentation:BO,practice:UO,production:zO};var lo;function km(e){if((!lo&&lo!==0||e)&&fs){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),lo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return lo}function HO(){return p.useState(null)}const zx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"modal-body"),d.jsx(n,{ref:s,className:A(e,t),...r})));zx.displayName="ModalBody";const xf=p.forwardRef(({bsPrefix:e,className:t,contentClassName:n,centered:r,size:s,fullscreen:i,children:o,scrollable:a,...l},u)=>{e=D(e,"modal");const c=`${e}-dialog`,f=typeof i=="string"?`${e}-fullscreen-${i}`:`${e}-fullscreen`;return d.jsx("div",{...l,ref:u,className:A(c,t,s&&`${e}-${s}`,r&&`${c}-centered`,a&&`${c}-scrollable`,i&&f),children:d.jsx("div",{className:A(`${e}-content`,n),children:o})})});xf.displayName="ModalDialog";const Hx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"modal-footer"),d.jsx(n,{ref:s,className:A(e,t),...r})));Hx.displayName="ModalFooter";const Wx=p.forwardRef(({bsPrefix:e,className:t,closeLabel:n="Close",closeButton:r=!1,...s},i)=>(e=D(e,"modal-header"),d.jsx(Hv,{ref:i,...s,className:A(t,e),closeLabel:n,closeButton:r})));Wx.displayName="ModalHeader";const WO=Ba("h4"),Kx=p.forwardRef(({className:e,bsPrefix:t,as:n=WO,...r},s)=>(t=D(t,"modal-title"),d.jsx(n,{ref:s,className:A(e,t),...r})));Kx.displayName="ModalTitle";function KO(e){return d.jsx(pr,{...e,timeout:null})}function GO(e){return d.jsx(pr,{...e,timeout:null})}const Gx=p.forwardRef(({bsPrefix:e,className:t,style:n,dialogClassName:r,contentClassName:s,children:i,dialogAs:o=xf,"data-bs-theme":a,"aria-labelledby":l,"aria-describedby":u,"aria-label":c,show:f=!1,animation:h=!0,backdrop:v=!0,keyboard:y=!0,onEscapeKeyDown:w,onShow:S,onHide:x,container:m,autoFocus:g=!0,enforceFocus:C=!0,restoreFocus:T=!0,restoreFocusOptions:E,onEntered:P,onExit:j,onExiting:M,onEnter:b,onEntering:X,onExited:$e,backdropClassName:Ae,manager:et,...te},ne)=>{const[ke,N]=p.useState({}),[_,F]=p.useState(!1),H=p.useRef(!1),q=p.useRef(!1),je=p.useRef(null),[ye,me]=HO(),Be=hs(ne,me),Vt=ze(x),Za=WT();e=D(e,"modal");const gs=p.useMemo(()=>({onHide:Vt}),[Vt]);function yr(){return et||Yv({isRTL:Za})}function _i(W){if(!fs)return;const wr=yr().getScrollbarWidth()>0,Tf=W.scrollHeight>Fa(W).documentElement.clientHeight;N({paddingRight:wr&&!Tf?km():void 0,paddingLeft:!wr&&Tf?km():void 0})}const vr=ze(()=>{ye&&_i(ye.dialog)});bd(()=>{ic(window,"resize",vr),je.current==null||je.current()});const ys=()=>{H.current=!0},xr=W=>{H.current&&ye&&W.target===ye.dialog&&(q.current=!0),H.current=!1},re=()=>{F(!0),je.current=Dv(ye.dialog,()=>{F(!1)})},Fi=W=>{W.target===W.currentTarget&&re()},vs=W=>{if(v==="static"){Fi(W);return}if(q.current||W.target!==W.currentTarget){q.current=!1;return}x==null||x()},Ew=W=>{y?w==null||w(W):(W.preventDefault(),v==="static"&&re())},Tw=(W,wr)=>{W&&_i(W),b==null||b(W,wr)},kw=W=>{je.current==null||je.current(),j==null||j(W)},jw=(W,wr)=>{X==null||X(W,wr),bv(window,"resize",vr)},Pw=W=>{W&&(W.style.display=""),$e==null||$e(W),ic(window,"resize",vr)},Rw=p.useCallback(W=>d.jsx("div",{...W,className:A(`${e}-backdrop`,Ae,!h&&"show")}),[h,Ae,e]),Ef={...n,...ke};Ef.display="block";const Nw=W=>d.jsx("div",{role:"dialog",...W,style:Ef,className:A(t,e,_&&`${e}-static`,!h&&"show"),onClick:v?vs:void 0,onMouseUp:xr,"data-bs-theme":a,"aria-label":c,"aria-labelledby":l,"aria-describedby":u,children:d.jsx(o,{...te,onMouseDown:ys,className:r,contentClassName:s,children:i})});return d.jsx(_d.Provider,{value:gs,children:d.jsx(Bv,{show:f,ref:Be,backdrop:v,container:m,keyboard:!0,autoFocus:g,enforceFocus:C,restoreFocus:T,restoreFocusOptions:E,onEscapeKeyDown:Ew,onShow:S,onHide:x,onEnter:Tw,onEntering:jw,onEntered:P,onExit:kw,onExiting:M,onExited:Pw,manager:yr(),transition:h?KO:void 0,backdropTransition:h?GO:void 0,renderBackdrop:Rw,renderDialog:Nw})})});Gx.displayName="Modal";const Os=Object.assign(Gx,{Body:zx,Header:Wx,Title:Kx,Footer:Hx,Dialog:xf,TRANSITION_DURATION:300,BACKDROP_TRANSITION_DURATION:150}),Yx=({show:e,toggleShow:t,handleDeleteConfirmed:n})=>{const r=()=>{t(),n()};return d.jsxs(Os,{variant:"warning",show:e,onHide:t,children:[d.jsx(Os.Header,{closeButton:!0,children:d.jsx(Os.Title,{children:"Warning"})}),d.jsx(Os.Body,{children:"You are about to delete this lesson plan. Are you sure you want to continue?"}),d.jsxs(Os.Footer,{children:[d.jsx(B,{variant:"secondary",onClick:t,children:"Cancel"}),d.jsx(B,{variant:"danger",onClick:r,children:"Delete"})]})]})};Yx.propTypes={show:U.bool,toggleShow:U.func,handleDeleteConfirmed:U.func};var jm={exports:{}},Tc={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;function n(r){function s(o,a,l,u,c,f){var h=u||"<>",v=f||l;if(a[l]==null)return o?new Error("Required "+c+" `"+v+"` was not specified "+("in `"+h+"`.")):null;for(var y=arguments.length,w=Array(y>6?y-6:0),S=6;S!t,!1);return e}const wf=p.createContext(null);wf.displayName="NavContext";const ms=p.createContext(null),XO=["as","active","eventKey"];function qO(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function Qx({key:e,onClick:t,active:n,id:r,role:s,disabled:i}){const o=p.useContext(cr),a=p.useContext(wf),l=p.useContext(ms);let u=n;const c={role:s};if(a){!s&&a.role==="tablist"&&(c.role="tab");const f=a.getControllerId(e??null),h=a.getControlledId(e??null);c[Va("event-key")]=e,c.id=f||r,u=n==null&&e!=null?a.activeKey===e:n,(u||!(l!=null&&l.unmountOnExit)&&!(l!=null&&l.mountOnEnter))&&(c["aria-controls"]=h)}return c.role==="tab"&&(c["aria-selected"]=u,u||(c.tabIndex=-1),i&&(c.tabIndex=-1,c["aria-disabled"]=!0)),c.onClick=ze(f=>{i||(t==null||t(f),e!=null&&o&&!f.isPropagationStopped()&&o(e,f))}),[c,{isActive:u}]}const Xx=p.forwardRef((e,t)=>{let{as:n=Zv,active:r,eventKey:s}=e,i=qO(e,XO);const[o,a]=Qx(Object.assign({key:vi(s,i.href),active:r},i));return o[Va("active")]=a.isActive,d.jsx(n,Object.assign({},i,o,{ref:t}))});Xx.displayName="NavItem";const JO=Xx,ZO=["as","onSelect","activeKey","role","onKeyDown"];function eL(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}const Pm=()=>{},Rm=Va("event-key"),qx=p.forwardRef((e,t)=>{let{as:n="div",onSelect:r,activeKey:s,role:i,onKeyDown:o}=e,a=eL(e,ZO);const l=QO(),u=p.useRef(!1),c=p.useContext(cr),f=p.useContext(ms);let h,v;f&&(i=i||"tablist",s=f.activeKey,h=f.getControlledId,v=f.getControllerId);const y=p.useRef(null),w=g=>{const C=y.current;if(!C)return null;const T=Wn(C,`[${Rm}]:not([aria-disabled=true])`),E=C.querySelector("[aria-selected=true]");if(!E||E!==document.activeElement)return null;const P=T.indexOf(E);if(P===-1)return null;let j=P+g;return j>=T.length&&(j=0),j<0&&(j=T.length-1),T[j]},S=(g,C)=>{g!=null&&(r==null||r(g,C),c==null||c(g,C))},x=g=>{if(o==null||o(g),!f)return;let C;switch(g.key){case"ArrowLeft":case"ArrowUp":C=w(-1);break;case"ArrowRight":case"ArrowDown":C=w(1);break;default:return}C&&(g.preventDefault(),S(C.dataset[xk("EventKey")]||null,g),u.current=!0,l())};p.useEffect(()=>{if(y.current&&u.current){const g=y.current.querySelector(`[${Rm}][aria-selected=true]`);g==null||g.focus()}u.current=!1});const m=hs(t,y);return d.jsx(cr.Provider,{value:S,children:d.jsx(wf.Provider,{value:{role:i,activeKey:vi(s),getControlledId:h||Pm,getControllerId:v||Pm},children:d.jsx(n,Object.assign({},a,{onKeyDown:x,ref:m,role:i}))})})});qx.displayName="Nav";const tL=Object.assign(qx,{Item:JO}),Sf=p.createContext(null);Sf.displayName="CardHeaderContext";const Jx=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"nav-item"),d.jsx(n,{ref:s,className:A(e,t),...r})));Jx.displayName="NavItem";const nL=["onKeyDown"];function rL(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function sL(e){return!e||e.trim()==="#"}const Zx=p.forwardRef((e,t)=>{let{onKeyDown:n}=e,r=rL(e,nL);const[s]=Fd(Object.assign({tagName:"a"},r)),i=ze(o=>{s.onKeyDown(o),n==null||n(o)});return sL(r.href)||r.role==="button"?d.jsx("a",Object.assign({ref:t},r,s,{onKeyDown:i})):d.jsx("a",Object.assign({ref:t},r,{onKeyDown:n}))});Zx.displayName="Anchor";const ew=p.forwardRef(({bsPrefix:e,className:t,as:n=Zx,active:r,eventKey:s,disabled:i=!1,...o},a)=>{e=D(e,"nav-link");const[l,u]=Qx({key:vi(s,o.href),active:r,disabled:i,...o});return d.jsx(n,{...o,...l,ref:a,disabled:i,className:A(t,e,i&&"disabled",u.isActive&&"active")})});ew.displayName="NavLink";const tw=p.forwardRef((e,t)=>{const{as:n="div",bsPrefix:r,variant:s,fill:i=!1,justify:o=!1,navbar:a,navbarScroll:l,className:u,activeKey:c,...f}=Rv(e,{activeKey:"onSelect"}),h=D(r,"nav");let v,y,w=!1;const S=p.useContext(hr),x=p.useContext(Sf);return S?(v=S.bsPrefix,w=a??!0):x&&({cardHeaderBsPrefix:y}=x),d.jsx(tL,{as:n,ref:t,activeKey:c,className:A(u,{[h]:!w,[`${v}-nav`]:w,[`${v}-nav-scroll`]:w&&l,[`${y}-${s}`]:!!y,[`${h}-${s}`]:!!s,[`${h}-fill`]:i,[`${h}-justified`]:o}),...f})});tw.displayName="Nav";const de=Object.assign(tw,{Item:Jx,Link:ew});function iL(e,t,n){const r=p.useRef(e!==void 0),[s,i]=p.useState(t),o=e!==void 0,a=r.current;return r.current=o,!o&&a&&s!==t&&i(t),[o?e:s,p.useCallback((...l)=>{const[u,...c]=l;let f=n==null?void 0:n(u,...c);return i(u),f},[n])]}const fa={prefix:String(Math.round(Math.random()*1e10)),current:0},nw=Ee.createContext(fa),oL=Ee.createContext(!1);let aL=!!(typeof window<"u"&&window.document&&window.document.createElement),ql=new WeakMap;function lL(e=!1){let t=p.useContext(nw),n=p.useRef(null);if(n.current===null&&!e){var r,s;let i=(s=Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||s===void 0||(r=s.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(i){let o=ql.get(i);o==null?ql.set(i,{id:t.current,state:i.memoizedState}):i.memoizedState!==o.state&&(t.current=o.id,ql.delete(i))}n.current=++t.current}return n.current}function uL(e){let t=p.useContext(nw);t===fa&&!aL&&console.warn("When server rendering, you must wrap your application in an to ensure consistent ids are generated between the client and server.");let n=lL(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function cL(e){let t=Ee.useId(),[n]=p.useState(mL()),r=n?"react-aria":`react-aria${fa.prefix}`;return e||`${r}-${t}`}const dL=typeof Ee.useId=="function"?cL:uL;function fL(){return!1}function hL(){return!0}function pL(e){return()=>{}}function mL(){return typeof Ee.useSyncExternalStore=="function"?Ee.useSyncExternalStore(pL,fL,hL):p.useContext(oL)}const gL=["active","eventKey","mountOnEnter","transition","unmountOnExit","role","onEnter","onEntering","onEntered","onExit","onExiting","onExited"],yL=["activeKey","getControlledId","getControllerId"],vL=["as"];function kc(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function rw(e){let{active:t,eventKey:n,mountOnEnter:r,transition:s,unmountOnExit:i,role:o="tabpanel",onEnter:a,onEntering:l,onEntered:u,onExit:c,onExiting:f,onExited:h}=e,v=kc(e,gL);const y=p.useContext(ms);if(!y)return[Object.assign({},v,{role:o}),{eventKey:n,isActive:t,mountOnEnter:r,transition:s,unmountOnExit:i,onEnter:a,onEntering:l,onEntered:u,onExit:c,onExiting:f,onExited:h}];const{activeKey:w,getControlledId:S,getControllerId:x}=y,m=kc(y,yL),g=vi(n);return[Object.assign({},v,{role:o,id:S(n),"aria-labelledby":x(n)}),{eventKey:n,isActive:t==null&&g!=null?vi(w)===g:t,transition:s||m.transition,mountOnEnter:r??m.mountOnEnter,unmountOnExit:i??m.unmountOnExit,onEnter:a,onEntering:l,onEntered:u,onExit:c,onExiting:f,onExited:h}]}const sw=p.forwardRef((e,t)=>{let{as:n="div"}=e,r=kc(e,vL);const[s,{isActive:i,onEnter:o,onEntering:a,onEntered:l,onExit:u,onExiting:c,onExited:f,mountOnEnter:h,unmountOnExit:v,transition:y=Id}]=rw(r);return d.jsx(ms.Provider,{value:null,children:d.jsx(cr.Provider,{value:null,children:d.jsx(y,{in:i,onEnter:o,onEntering:a,onEntered:l,onExit:u,onExiting:c,onExited:f,mountOnEnter:h,unmountOnExit:v,children:d.jsx(n,Object.assign({},s,{ref:t,hidden:!i,"aria-hidden":!i}))})})})});sw.displayName="TabPanel";const iw=e=>{const{id:t,generateChildId:n,onSelect:r,activeKey:s,defaultActiveKey:i,transition:o,mountOnEnter:a,unmountOnExit:l,children:u}=e,[c,f]=iL(s,i,r),h=dL(t),v=p.useMemo(()=>n||((w,S)=>h?`${h}-${S}-${w}`:null),[h,n]),y=p.useMemo(()=>({onSelect:f,activeKey:c,transition:o,mountOnEnter:a||!1,unmountOnExit:l||!1,getControlledId:w=>v(w,"tabpane"),getControllerId:w=>v(w,"tab")}),[f,c,o,a,l,v]);return d.jsx(ms.Provider,{value:y,children:d.jsx(cr.Provider,{value:f||null,children:u})})};iw.Panel=sw;function ow(e){return typeof e=="boolean"?e?pr:Id:e}const aw=({transition:e,...t})=>d.jsx(iw,{...t,transition:ow(e)});aw.displayName="TabContainer";const lw=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"tab-content"),d.jsx(n,{ref:s,className:A(e,t),...r})));lw.displayName="TabContent";const uw=p.forwardRef(({bsPrefix:e,transition:t,...n},r)=>{const[{className:s,as:i="div",...o},{isActive:a,onEnter:l,onEntering:u,onEntered:c,onExit:f,onExiting:h,onExited:v,mountOnEnter:y,unmountOnExit:w,transition:S=pr}]=rw({...n,transition:ow(t)}),x=D(e,"tab-pane");return d.jsx(ms.Provider,{value:null,children:d.jsx(cr.Provider,{value:null,children:d.jsx(S,{in:a,onEnter:l,onEntering:u,onEntered:c,onExit:f,onExiting:h,onExited:v,mountOnEnter:y,unmountOnExit:w,children:d.jsx(i,{...o,ref:r,className:A(s,x,a&&"active")})})})})});uw.displayName="TabPane";const xL={eventKey:U.oneOfType([U.string,U.number]),title:U.node.isRequired,disabled:U.bool,tabClassName:U.string,tabAttrs:U.object},cw=()=>{throw new Error("ReactBootstrap: The `Tab` component is not meant to be rendered! It's an abstract component that is only valid as a direct Child of the `Tabs` Component. For custom tabs components use TabPane and TabsContainer directly")};cw.propTypes=xL;const He=Object.assign(cw,{Container:aw,Content:lw,Pane:uw}),Cf=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"card-body"),d.jsx(n,{ref:s,className:A(e,t),...r})));Cf.displayName="CardBody";const dw=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"card-footer"),d.jsx(n,{ref:s,className:A(e,t),...r})));dw.displayName="CardFooter";const fw=p.forwardRef(({bsPrefix:e,className:t,as:n="div",...r},s)=>{const i=D(e,"card-header"),o=p.useMemo(()=>({cardHeaderBsPrefix:i}),[i]);return d.jsx(Sf.Provider,{value:o,children:d.jsx(n,{ref:s,...r,className:A(t,i)})})});fw.displayName="CardHeader";const hw=p.forwardRef(({bsPrefix:e,className:t,variant:n,as:r="img",...s},i)=>{const o=D(e,"card-img");return d.jsx(r,{ref:i,className:A(n?`${o}-${n}`:o,t),...s})});hw.displayName="CardImg";const pw=p.forwardRef(({className:e,bsPrefix:t,as:n="div",...r},s)=>(t=D(t,"card-img-overlay"),d.jsx(n,{ref:s,className:A(e,t),...r})));pw.displayName="CardImgOverlay";const mw=p.forwardRef(({className:e,bsPrefix:t,as:n="a",...r},s)=>(t=D(t,"card-link"),d.jsx(n,{ref:s,className:A(e,t),...r})));mw.displayName="CardLink";const wL=Ba("h6"),gw=p.forwardRef(({className:e,bsPrefix:t,as:n=wL,...r},s)=>(t=D(t,"card-subtitle"),d.jsx(n,{ref:s,className:A(e,t),...r})));gw.displayName="CardSubtitle";const yw=p.forwardRef(({className:e,bsPrefix:t,as:n="p",...r},s)=>(t=D(t,"card-text"),d.jsx(n,{ref:s,className:A(e,t),...r})));yw.displayName="CardText";const SL=Ba("h5"),vw=p.forwardRef(({className:e,bsPrefix:t,as:n=SL,...r},s)=>(t=D(t,"card-title"),d.jsx(n,{ref:s,className:A(e,t),...r})));vw.displayName="CardTitle";const xw=p.forwardRef(({bsPrefix:e,className:t,bg:n,text:r,border:s,body:i=!1,children:o,as:a="div",...l},u)=>{const c=D(e,"card");return d.jsx(a,{ref:u,...l,className:A(t,c,n&&`bg-${n}`,r&&`text-${r}`,s&&`border-${s}`),children:i?d.jsx(Cf,{children:o}):o})});xw.displayName="Card";const G=Object.assign(xw,{Img:hw,Title:vw,Subtitle:gw,Body:Cf,Link:mw,Text:yw,Header:fw,Footer:dw,ImgOverlay:pw}),ww=()=>{const[e,t]=p.useState(vf),[n,r]=p.useState(!1),[s,i]=p.useState(!1),[o,a]=p.useState(!0),[l,u]=p.useState(!1),{userId:c,lessonId:f}=La(),h=p.useRef(null),{user:v}=an(),y=us();p.useEffect(()=>{v&&v._id===c?r(!0):r(!1),n&&!h.current&&(h.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",c),Ux(h,f,t),a(!1))},[v,c,h,f,n]);const w=async()=>{y(`/${c}/edit/${f}`)},S=async()=>{try{i(!0),(await h.current.deleteLessonPlan(f)).status<300&&setTimeout(()=>{y(`/${c}`),i(!1)},2e3)}catch(m){console.log(m.message)}},x=async m=>{m.preventDefault(),u(!0)};return d.jsxs(Bn,{fluid:!0,children:[d.jsx(Yx,{show:l,toggleShow:()=>u(!1),handleDeleteConfirmed:S}),n&&!o&&d.jsxs(d.Fragment,{children:[d.jsx(Et,{to:`/${c}`,className:"m-3",children:d.jsx(B,{variant:"outline-secondary",className:"my-2",title:"Go back to profile.","aria-label":"back-button",children:d.jsx(Q,{src:"/simplifica/arrow-left.svg"})})}),d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},className:"mx-3 my-2",children:d.jsxs(G,{className:"mx-3 mx-lg-5 mb-2",children:[d.jsx(G.Header,{"aria-label":"success-title",children:"Lesson Plan"}),d.jsxs(G.Body,{children:[d.jsx(G.Title,{children:d.jsxs(Ii,{className:"align-items-center",children:[d.jsx(Pt,{xs:8,sm:8,md:10,children:d.jsx("h1",{className:"display-6","aria-label":"topic",children:e.topic})}),d.jsx(Pt,{xs:2,sm:2,md:1,children:d.jsx(B,{variant:"outline-secondary",onClick:w,"aria-label":"edit-button",children:d.jsx(Q,{src:"/simplifica/pencil.svg"})})}),d.jsx(Pt,{xs:2,sm:2,md:1,className:"d-flex justify-content center align-items-center",children:s?d.jsx(mr,{animation:"border",role:"status",size:"sm",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})}):d.jsx(B,{variant:"outline-danger",onClick:x,"aria-label":"delete-button",children:d.jsx(Q,{src:"/simplifica/trash.svg"})})})]})}),d.jsx(G.Subtitle,{className:"mb-4 text-muted","aria-label":"lesson-date",children:new Date(e.date).toLocaleDateString("en-GB")}),d.jsxs(He.Container,{id:"phase-tabs",defaultActiveKey:"presentation",children:[d.jsxs(He.Content,{children:[d.jsxs(He.Pane,{eventKey:"presentation",children:[d.jsx(G.Text,{className:"h6","aria-label":"lesson-objective-question",children:"What is the main language point (grammar, vocabulary, function) you want to teach?"}),d.jsx(G.Text,{"aria-label":"lesson-objective-answer",children:e.presentation.objective}),d.jsx(G.Text,{className:"h6",children:"What materials (textbook, audio, video, visual aids) will you need?"}),d.jsx("ul",{children:e.presentation.materials.map((m,g)=>d.jsx("li",{children:m},g))}),d.jsx(G.Text,{className:"h6",children:"How will you introduce the topic to make it relevant and engaging for students?"}),d.jsx(G.Text,{children:e.presentation.connection})]}),d.jsxs(He.Pane,{eventKey:"practice",children:[d.jsx(G.Text,{className:"h6",children:"How is the target language applicable to the students' everyday lives?"}),d.jsx(G.Text,{children:e.practice.real_life_application}),d.jsx(G.Text,{className:"h6",children:"What type of feedback will you provide to correct errors and reinforce learning?"}),d.jsx(G.Text,{children:e.practice.feedback_method}),d.jsx(G.Text,{className:"h6",children:"What activities will you use to help students practice the new language in a controlled way?"}),d.jsx("ul",{children:e.practice.activities.map((m,g)=>d.jsx("li",{children:m},g))})]}),d.jsxs(He.Pane,{eventKey:"production",children:[d.jsx(G.Text,{className:"h6",children:"How will you facilitate student interaction and collaboration during the production phase?"}),d.jsx(G.Text,{children:e.production.learner_interaction}),d.jsx(G.Text,{className:"h6",children:"What criteria will you use to evaluate their performance?"}),d.jsx("ul",{className:"list-group-flush",children:e.production.success_criteria.map((m,g)=>d.jsx("li",{children:m},g))}),d.jsx(G.Text,{className:"h6",children:"What activities will allow students to use the new language more freely and creatively?"}),d.jsx("ul",{className:"list-group-flush",children:e.production.activities.map((m,g)=>d.jsx("li",{children:m},g))})]})]}),d.jsxs(de,{variant:"pills",className:"flex-row mt-3",children:[d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"presentation",title:"See the presentation phase.",children:"Presentation"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"practice",title:"See the practice phase.",variant:"outline-dark",children:"Practice"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"production",title:"See the production phase.",children:"Production"})})]})]})]})]})})]}),!n&&d.jsx(Oe.div,{initial:{opacity:0,x:-100},animate:{opacity:1,x:0},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to view someone else's lesson. In order to view their lessons, you must sign in to their account."})})]})};ww.propTypes={triggerFeedback:U.func};const Sw=e=>{const[t,n]=p.useState(e);return[t,(s,i=null,o=null)=>{n(i===null&&o===null?s:a=>({...a,[i]:o!==null?{...a[i],[o]:s}:s}))}]},Cw=()=>{const{triggerFeedback:e}=Qa(),{user:t}=an(),{userId:n}=La(),r=us(),s=p.useRef(null),[i,o]=p.useState(!1),[a,l]=p.useState(!1),[u,c]=Sw(vf),[f,h]=p.useState(!1),[v,y]=p.useState(!1);p.useEffect(()=>{t&&(t._id===n?o(!0):o(!1)),i&&!s.current&&(s.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",n))},[t,n,i,u]);const w=async T=>{if(T.preventDefault(),!v||!f)return e([{type:"error",title:"Error",message:"Lesson needs at least a topic and a date."}]);try{l(!0),await s.current.createLessonPlan(u),setTimeout(()=>{r(`/${n}`),l(!1)},2e3)}catch(E){console.log(E.message)}},S=T=>T.trim()!=="",x=(T,E)=>{switch(T){case"date":h(E);break;case"topic":y(E);break}},m=T=>{const{name:E,value:P}=T.target,j=E.split("."),M=S(P);j.length===1&&(x(j[0],M),c(P,j[0],null)),j.length===1?c(P,j[0],null):c(P,j[0],j[1])},g=(T,E,P,j)=>{T.preventDefault();const M=document.getElementById(j).value;M.trim()!==""&&(c([...u[E][P],M],E,P),document.getElementById(j).value="")},C=(T,E,P,j)=>{T.preventDefault();const M=u[E][P].filter((b,X)=>X!==j);c(M,E,P)};return d.jsx(Bn,{fluid:!0,children:i?d.jsxs(d.Fragment,{children:[d.jsx(Et,{to:`/${n}`,className:"m-3",children:d.jsx(B,{variant:"outline-secondary",className:"my-2",title:"Go back to profile.","aria-label":"back-button",children:d.jsx(Q,{src:"/simplifica/arrow-left.svg"})})}),d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},className:"mx-3 my-2",children:d.jsxs(G,{className:"mx-3 mx-lg-5",children:[d.jsx(G.Header,{children:"New Lesson Plan"}),d.jsx(G.Body,{children:d.jsxs(O,{children:[d.jsx(G.Title,{className:"mb-3",children:d.jsxs(Ii,{className:"align-items-center",children:[d.jsx(Pt,{xs:9,sm:10,md:10,children:d.jsx(O.Group,{children:d.jsx(O.Control,{type:"text",placeholder:"Lesson Topic","aria-label":"topic-input",name:"topic",onChange:m})})}),d.jsx(Pt,{xs:1,sm:2,md:{span:1,offset:1},children:a?d.jsx(mr,{animation:"border",role:"status",size:"sm",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})}):d.jsx(B,{variant:"outline-success","aria-label":"save-button",onClick:w,children:d.jsx(Q,{src:"/simplifica/floppy.svg"})})})]})}),d.jsx(G.Subtitle,{className:"mb-4 text-muted",children:d.jsx(O.Control,{type:"date",placeholder:"Date",name:"date",onChange:m})}),d.jsxs(He.Container,{id:"phase-tabs",defaultActiveKey:"presentation",children:[d.jsxs(He.Content,{children:[d.jsxs(He.Pane,{eventKey:"presentation",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"lessonObjective",children:[d.jsx(O.Label,{className:"h5",children:"What is the main language point you want to teach?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.objective",placeholder:"Grammar, vocabulary, functions, etc.",onChange:m,"aria-label":"objective-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What materials will you need?"}),u.presentation.materials.length>0&&u.presentation.materials.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`material-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeMaterialButton","aria-label":"remove-material-button",onClick:P=>C(P,"presentation","materials",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Textbooks, audio, video, visual aids, etc.",name:"presentation.materials",id:"materialInput","aria-label":"material-input"}),d.jsx(B,{variant:"outline-success",id:"addMaterialButton","aria-label":"add-material-button",onClick:T=>g(T,"presentation","materials","materialInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"connection",children:[d.jsx(O.Label,{className:"h5",children:"How will you introduce the topic to make it relevant and engaging for students?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.connection",onChange:m,"aria-label":"connection-textarea",placeholder:"I will..."})]})]}),d.jsxs(He.Pane,{eventKey:"practice",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"realLifeApplication",children:[d.jsx(O.Label,{className:"h5",children:"How is the target language applicable to the students' everyday lives?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:m,name:"practice.real_life_application","aria-label":"real-life-application-textarea"})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"feedbackMethod",children:[d.jsx(O.Label,{className:"h5",children:"What type of feedback will you provide to correct errors and reinforce learning?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:m,name:"practice.feedback_method","aria-label":"feedback-method-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What activities will you use to help students practice the target language?"}),u.practice.activities.length>0&&u.practice.activities.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`practice-activity-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removePracticeActivityButton","aria-label":"remove-practice-activity-button",onClick:P=>C(P,"practice","activities",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"practice.activities",id:"practiceActivityInput","aria-label":"practice-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addPracticeActivityButton","aria-label":"add-practice-activity-button",onClick:T=>g(T,"practice","activities","practiceActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]}),d.jsxs(He.Pane,{eventKey:"production",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"learnerInteraction",children:[d.jsx(O.Label,{className:"h5",children:"How will you facilitate student interaction and collaboration during the production phase?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:m,name:"production.learner_interaction"})]}),d.jsx(O.Label,{className:"h5",children:"What criteria will you use to evaluate their performance?"}),u.production.success_criteria.length>0&&u.production.success_criteria.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`criterion-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeSuccessCriterionButton","aria-label":"remove-success-criterion-button",onClick:P=>C(P,"production","success_criteria",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Ability to use target language without help, etc.",name:"production.success_criteria",id:"successCriteriaInput","aria-label":"success-criteria-input"}),d.jsx(B,{variant:"outline-success",id:"addSuccessCriterionButton","aria-label":"add-success-criterion-button",onClick:T=>g(T,"production","success_criteria","successCriteriaInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsx(O.Label,{className:"h5",children:"What activities will allow students to use the new language more freely and creatively?"}),u.production.activities.length>0&&u.production.activities.map((T,E)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:T,"aria-label":`production-activity-${E}`,disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeProductionActivityButton","aria-label":"remove-production-activity-button",onClick:P=>C(P,"production","activities",E),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},E)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"production.activities",id:"productionActivityInput","aria-label":"production-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addProductionActivityButton","aria-label":"add-production-activity-button",onClick:T=>g(T,"production","activities","productionActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]})]}),d.jsxs(de,{variant:"pills",className:"flex-row mt-3",children:[d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"presentation",title:"See the presentation phase.",children:"Presentation"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"practice",title:"See the practice phase.",variant:"outline-dark",children:"Practice"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"production",title:"See the production phase.",children:"Production"})})]})]})]})})]})})]}):d.jsx(Oe.div,{initial:{opacity:0,x:-100,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to create a lesson for an account which you are not signed in to. To create a lesson for that account, you must sign in with their details."})})})};Cw.propTypes={triggerFeedback:U.func};const _s=({children:e})=>{const{user:t,authenticate:n}=an();return p.useEffect(()=>{(async()=>{setTimeout(()=>{if(!t)return d.jsx(qy,{to:"/login"});n()},500)})()},[t,n]),e};_s.propTypes={children:U.element};const Po=({children:e})=>{const{user:t}=an();return t?d.jsx(qy,{to:`/${t._id}`}):e};Po.propTypes={children:U.element};const CL=()=>{const{user:e}=an(),{userId:t,lessonId:n}=La(),r=us(),s=p.useRef(null),[i,o]=p.useState(!1),[a,l]=p.useState(!1),[u,c]=Sw(vf);p.useEffect(()=>{e&&(e._id===t?o(!0):o(!1)),i&&!s.current&&(s.current=new Ja("https://simplifica-backend-spring-smoke-3356.fly.dev/",t),Ux(s,n,c))},[e,t,i,u,n,c]);const f=async w=>{w.preventDefault();try{l(!0),await s.current.updateLessonPlan(n,u),setTimeout(()=>{r(`/${t}`),l(!1)},2e3)}catch(S){console.log(S.message)}},h=w=>{const{name:S,value:x}=w.target,m=S.split(".");m.length===1?c(x,m[0],null):c(x,m[0],m[1])},v=(w,S,x,m)=>{w.preventDefault();const g=document.getElementById(m).value;g.trim()!==""&&(c([...u[S][x],g],S,x),document.getElementById(m).value="")},y=(w,S,x,m)=>{w.preventDefault();const g=u[S][x].filter((C,T)=>T!==m);c(g,S,x)};return d.jsx(d.Fragment,{children:i?d.jsxs(d.Fragment,{children:[d.jsx(Bn,{fluid:!0,children:d.jsx(Et,{to:`/${t}`,children:d.jsx(B,{variant:"outline-secondary",className:"my-2",title:"Go back to profile.","aria-label":"back-button",children:d.jsx(Q,{src:"/simplifica/arrow-left.svg"})})})}),d.jsx(Oe.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5,delay:.2,ease:[0,.71,.2,1.01]},children:d.jsxs(G,{className:"mx-3 mx-lg-5",children:[d.jsx(G.Header,{children:"New Lesson Plan"}),d.jsx(G.Body,{children:d.jsxs(O,{children:[d.jsx(G.Title,{className:"mb-3",children:d.jsxs(Ii,{className:"align-items-center",children:[d.jsx(Pt,{xs:9,sm:10,md:10,children:d.jsx(O.Group,{children:d.jsx(O.Control,{type:"text",placeholder:"Lesson Topic","aria-label":"topic-input",name:"topic",value:u.topic,onChange:h})})}),d.jsx(Pt,{xs:1,sm:2,md:{span:1,offset:1},children:a?d.jsx(mr,{animation:"border",role:"status",size:"sm",children:d.jsx("span",{className:"visually-hidden",children:"Loading..."})}):d.jsx(B,{variant:"outline-success","aria-label":"save-button",onClick:f,children:d.jsx(Q,{src:"/simplifica/floppy.svg"})})})]})}),d.jsx(G.Subtitle,{className:"mb-4 text-muted",children:d.jsx(O.Control,{type:"date",placeholder:"Date",name:"date",value:u.date!==""?new Date(u.date).toISOString().split("T")[0]:"",onChange:h})}),d.jsxs(He.Container,{id:"phase-tabs",defaultActiveKey:"presentation",children:[d.jsxs(He.Content,{children:[d.jsxs(He.Pane,{eventKey:"presentation",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"lessonObjective",children:[d.jsx(O.Label,{className:"h5",children:"What is the main language point you want to teach?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.objective",placeholder:"Grammar, vocabulary, functions, etc.",defaultValue:u.presentation.objective,onChange:h,"aria-label":"objective-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What materials will you need?"}),u.presentation.materials.length>0&&u.presentation.materials.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`material-${S}`,defaultValue:u.presentation.materials[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeMaterialButton","aria-label":"remove-material-button",onClick:x=>y(x,"presentation","materials",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Textbooks, audio, video, visual aids, etc.",name:"presentation.materials",id:"materialInput","aria-label":"material-input"}),d.jsx(B,{variant:"outline-success",id:"addMaterialButton","aria-label":"add-material-button",onClick:w=>v(w,"presentation","materials","materialInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"connection",children:[d.jsx(O.Label,{className:"h5",children:"How will you introduce the topic to make it relevant and engaging for students?"}),d.jsx(O.Control,{as:"textarea",rows:3,name:"presentation.connection",defaultValue:u.presentation.connection,onChange:h,"aria-label":"connection-textarea",placeholder:"I will..."})]})]}),d.jsxs(He.Pane,{eventKey:"practice",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"realLifeApplication",children:[d.jsx(O.Label,{className:"h5",children:"How is the target language applicable to the students' everyday lives?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:h,defaultValue:u.practice.real_life_application,name:"practice.real_life_application","aria-label":"real-life-application-textarea"})]}),d.jsxs(O.Group,{className:"mb-3",controlId:"feedbackMethod",children:[d.jsx(O.Label,{className:"h5",children:"What type of feedback will you provide to correct errors and reinforce learning?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:h,defaultValue:u.practice.feedback_method,name:"practice.feedback_method","aria-label":"feedback-method-textarea"})]}),d.jsx(O.Label,{className:"h5",children:"What activities will you use to help students practice the target language?"}),u.practice.activities.length>0&&u.practice.activities.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`practice-activity-${S}`,defaultValue:u.practice.activities[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removePracticeActivityButton","aria-label":"remove-practice-activity-button",onClick:x=>y(x,"practice","activities",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"practice.activities",id:"practiceActivityInput","aria-label":"practice-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addPracticeActivityButton","aria-label":"add-practice-activity-button",onClick:w=>v(w,"practice","activities","practiceActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]}),d.jsxs(He.Pane,{eventKey:"production",children:[d.jsxs(O.Group,{className:"mb-3",controlId:"learnerInteraction",children:[d.jsx(O.Label,{className:"h5",children:"How will you facilitate student interaction and collaboration during the production phase?"}),d.jsx(O.Control,{as:"textarea",rows:3,onChange:h,defaultValue:u.production.learner_interaction,name:"production.learner_interaction"})]}),d.jsx(O.Label,{className:"h5",children:"What criteria will you use to evaluate their performance?"}),u.production.success_criteria.length>0&&u.production.success_criteria.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`criterion-${S}`,defaultValue:u.production.success_criteria[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeSuccessCriterionButton","aria-label":"remove-success-criterion-button",onClick:x=>y(x,"production","success_criteria",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Ability to use target language without help, etc.",name:"production.success_criteria",id:"successCriteriaInput","aria-label":"success-criteria-input"}),d.jsx(B,{variant:"outline-success",id:"addSuccessCriterionButton","aria-label":"add-success-criterion-button",onClick:w=>v(w,"production","success_criteria","successCriteriaInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]}),d.jsx(O.Label,{className:"h5",children:"What activities will allow students to use the new language more freely and creatively?"}),u.production.activities.length>0&&u.production.activities.map((w,S)=>d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{type:"text",placeholder:w,"aria-label":`production-activity-${S}`,defaultValue:u.production.activities[S],disabled:!0,readOnly:!0}),d.jsx(B,{variant:"outline-danger",id:"removeProductionActivityButton","aria-label":"remove-production-activity-button",onClick:x=>y(x,"production","activities",S),children:d.jsx(Q,{src:"/simplifica/dash-lg.svg"})})]},S)),d.jsxs(xe,{className:"mb-3",children:[d.jsx(O.Control,{placeholder:"Musical chairs, hot potato, word association, etc.",name:"production.activities",id:"productionActivityInput","aria-label":"production-activity-input"}),d.jsx(B,{variant:"outline-success",id:"addProductionActivityButton","aria-label":"add-production-activity-button",onClick:w=>v(w,"production","activities","productionActivityInput"),children:d.jsx(Q,{src:"/simplifica/plus.svg"})})]})]})]}),d.jsxs(de,{variant:"pills",className:"flex-row mt-3",children:[d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"presentation",title:"See the presentation phase.",children:"Presentation"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"practice",title:"See the practice phase.",variant:"outline-dark",children:"Practice"})}),d.jsx(de.Item,{children:d.jsx(de.Link,{eventKey:"production",title:"See the production phase.",children:"Production"})})]})]})]})})]})})]}):d.jsx(Oe.div,{initial:{opacity:0,x:-100,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,delay:.5,ease:[0,.71,.2,1.01]},children:d.jsx(nt,{message:"You are trying to edit a lesson for an account which you are not signed in to. To edit a lesson for that account, you must sign in with their details."})})})},EL=()=>d.jsx(Ox,{children:d.jsx(kv,{children:d.jsx(GC,{children:d.jsxs($t,{path:"/",element:d.jsx(CO,{}),errorElement:d.jsx(nt,{}),children:[d.jsx($t,{path:"/",element:d.jsx(Po,{children:d.jsx(FO,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/register",element:d.jsx(Po,{children:d.jsx(bO,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/login",element:d.jsx(Po,{children:d.jsx(DO,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId",element:d.jsx(_s,{children:d.jsx(_O,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId/view/:lessonId",element:d.jsx(_s,{children:d.jsx(ww,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId/edit/:lessonId",element:d.jsx(_s,{children:d.jsx(CL,{})}),errorElement:d.jsx(nt,{})}),d.jsx($t,{path:"/:userId/create",element:d.jsx(_s,{children:d.jsx(Cw,{})}),errorElement:d.jsx(nt,{})})]})})})});Jl.createRoot(document.getElementById("root")).render(d.jsx(Ee.StrictMode,{children:d.jsx(eE,{basename:"/simplifica",children:d.jsx(EL,{})})})); diff --git a/index.html b/index.html index 6e25638..8db9bba 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Simplifica - +