PageSourceSearch

https://mycurriculummate.com.au/static/js/9262.e406b0c6.chunk.js

js mycurriculummate.com.au collected 2026-09-24 14:09:24 UTC 13,405 bytes, 3 lines download raw bytes

1/*! For license information please see 9262.e406b0c6.chunk.js.LICENSE.txt */
2"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[9262],{6277(e,s,t){t.d(s,{A:()=>o});var r=t(5043),a=t(579);const o=e=>{let{gridData:s=[],placements:t=[],readOnly:o=!1,showAnswers:n=!1,onComplete:l,onGuessesChange:i,teacherMode:c=!1}=e;const d=s.length,u=d>0?s[0].length:0,[m,x]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),[f,w]=(0,r.useState)("across"),[v,j]=(0,r.useState)(!1),[g,y]=(0,r.useState)({}),[b,N]=(0,r.useState)({}),k=(0,r.useRef)(null),A=(0,r.useRef)(null),C=(e,s)=>`${e}_${s}`,$=(e,t)=>e>=0&&e<d&&t>=0&&t<u&&""!==s[e][t],S={},_={};for(const r of t){const e=C(r.row,r.col);S[e]||(S[e]=r.number),_[`${r.number}_${r.direction}`]=r}const R=new Set,D=new Set;for(const r of t){const e="down"===r.direction?1:0,s="across"===r.direction?1:0,t=(r.word||"").length||(()=>{let t=0;for(;$(r.row+e*t,r.col+s*t);)t++;return t})();for(let a=0;a<t;a++){const t=C(r.row+e*a,r.col+s*a);"across"===r.direction?R.add(t):D.add(t)}}const M=(e,s,t)=>{const r=C(e,s);return"across"===t?R.has(r):D.has(r)},E=(0,r.useCallback)((e,s,t)=>{const r="down"===t?1:0,a="across"===t?1:0;let o=e,n=s;for(;$(o-r,n-a);)o-=r,n-=a;const l=[];for(;$(o,n);)l.push([o,n]),o+=r,n+=a;return l},[d,u]),T=(e,s)=>{if(!$(e,s)||o)return;const t="across"===f?"down":"across";let r=f;M(e,s,f)?v&&e===m&&s===h&&M(e,s,t)&&(r=t):r=t,x(e),p(s),w(r),j(!0),k.current&&k.current.focus()},z=(0,r.useCallback)((e,s,t)=>{const r=e+("down"===t?1:0),a=s+("across"===t?1:0);$(r,a)&&(x(r),p(a))},[]),P=(0,r.useCallback)((e,s,t)=>{const r=e-("down"===t?1:0),a=s-("across"===t?1:0);$(r,a)&&(x(r),p(a))},[]),I=(0,r.useCallback)(e=>{if(null===m||o)return;const s=m,t=h;if("Backspace"===e.key||"Delete"===e.key){e.preventDefault();const r=C(s,t);return void(g[r]?y(e=>{const s={...e};return delete s[r],s}):P(s,t,f))}if("Tab"===e.key)return void e.preventDefault();const r={ArrowRight:[0,1],ArrowLeft:[0,-1],ArrowDown:[1,0],ArrowUp:[-1,0]};if(r[e.key]){e.preventDefault();const[a,o]=r[e.key],n=0!==a?"down":"across",l=s+a,i=t+o;return void($(l,i)&&(x(l),p(i),w(n)))}if(/^[a-zA-Z]$/.test(e.key)){e.preventDefault();const r=e.key.toUpperCase();y(e=>({...e,[C(s,t)]:r})),N(e=>{const r={...e};return delete r[C(s,t)],r}),z(s,t,f)}},[m,h,f,g,o,z,P]);(0,r.useEffect)(()=>{i&&i(g)},[g]),(0,r.useEffect)(()=>{if(!l)return;const e=Object.keys(Object.fromEntries([...R,...D].map(e=>[e,!0]))).length,s=Object.keys(g).filter(e=>{const[s,t]=e.split("_").map(Number);return $(s,t)}).length;l(e>0?Math.round(s/e*100):0)},[g]);const O=new Set;null!==m&&E(m,h,f).forEach(e=>{let[s,t]=e;return O.add(C(s,t))});const U=Math.max(28,Math.min(40,Math.floor(320/Math.max(u,d,1)))),Z=(e,t)=>{const r=C(e,t);if(n&&c){const r=s[e][t];return r?(0,a.jsx)("span",{className:"text-primary font-bold text-sm select-none",children:r}):null}if(g[r]){const e=b[r];return(0,a.jsx)("span",{className:"font-bold text-sm select-none "+("correct"===e?"text-primary":"incorrect"===e?"text-destructive":"text-foreground"),children:g[r]})}return null};return(0,a.jsxs)("div",{className:"overflow-auto",children:[(0,a.jsx)("input",{ref:k,onKeyDown:I,onBlur:()=>j(!1),onFocus:()=>j(!0),readOnly:!0,"aria-hidden":"true",tabIndex:-1,style:{position:"absolute",top:-9999,left:-9999,width:1,height:1,opacity:0,fontSize:16,pointerEvents:"none"},autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),(0,a.jsx)("div",{ref:A,style:{display:"grid",gridTemplateColumns:`repeat(${u}, ${U}px)`,gridTemplateRows:`repeat(${d}, ${U}px)`,width:u*U},role:"grid","aria-label":"Crossword grid",children:Array.from({length:d},(e,s)=>Array.from({length:u},(e,t)=>{const r=C(s,t),n=$(s,t),l=s===m&&t===h,i=O.has(r),c=S[r];return n?(0,a.jsxs)("div",{role:"gridcell",tabIndex:0,onClick:()=>T(s,t),onKeyDown:e=>"Enter"===e.key&&T(s,t),style:{width:U,height:U,position:"relative",border:"1px solid hsl(var(--border))",cursor:o?"default":"pointer",backgroundColor:l?"hsl(var(--secondary) / 0.5)":i?"hsl(var(--primary) / 0.12)":"white",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},"aria-selected":l,children:[c&&(0,a.jsx)("span",{style:{position:"absolute",top:1,left:2,fontSize:Math.max(8,.22*U),lineHeight:1,color:"#263238",fontFamily:"Helvetica, Arial, sans-serif",pointerEvents:"none"},children:c}),Z(s,t)]},r):(0,a.jsx)("div",{style:{width:U,height:U,backgroundColor:"#263238"}},r)}))})]})}},2357(e,s,t){t.d(s,{g:()=>n,h:()=>o});const r="feedback_prompted_session",a=e=>`feedback_prompted_${e}`,o=e=>{if(!e)return!1;try{if(localStorage.getItem(a(e)))return!1;if(sessionStorage.getItem(r))return!1}catch{return!1}return!0},n=e=>{if(e)try{localStorage.setItem(a(e),"1"),sessionStorage.setItem(r,"1")}catch{}}},9262(e,s,t){t.r(s),t.d(s,{default:()=>S});var r=t(5043),a=t(5621),o=t(3974),n=t(4980),l=t(6328),i=t(3390),c=t(1140),d=t(5949),u=t(5732),m=t(4204),x=t(6277),h=t(7167),p=t(1351),f=t(5440),w=t(2357),v=t
2(2054),j=t(4105),g=t(2024),y=t(5469),b=t(2313),N=t(7104),k=t(5040),A=t(9855),C=t(7118),$=t(579);const S=()=>{var e;const{crosswordId:s}=(0,a.g)(),t=(0,a.Zp)(),{user:S}=(0,o.As)(),[_,R]=(null===S||void 0===S||S.subscription_tier,(0,r.useState)(null)),[D,M]=(0,r.useState)([]),[E,T]=(0,r.useState)(!0),[z,P]=(0,r.useState)(!1),[I,O]=(0,r.useState)(null),[U,Z]=(0,r.useState)(!1),[F,L]=(0,r.useState)(!1),[B,W]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{try{const[e,t]=await Promise.all([n.A.get(`${n.n}/crosswords/${s}`),n.A.get(`${n.n}/crosswords/${s}/attempts`)]);R(e.data),O(e.data.share_token),M(t.data.attempts||[])}catch{l.oR.error("Could not load crossword."),t("/activity-studio/crossword")}finally{T(!1)}})()},[s,t]);if(E)return(0,$.jsx)(m.A,{children:(0,$.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,$.jsx)(g.A,{className:"w-8 h-8 animate-spin text-primary"})})});const K=(null===_||void 0===_?void 0:_.content)||{},q=(K.placements||[]).filter(e=>"across"===e.direction).sort((e,s)=>e.number-s.number),H=(K.placements||[]).filter(e=>"down"===e.direction).sort((e,s)=>e.number-s.number),X=I?`${window.location.origin}/activity-studio/play/${I}`:null;return(0,$.jsxs)(m.A,{children:[(0,$.jsx)(f.A,{}),(0,$.jsxs)("div",{className:"p-6 max-w-5xl mx-auto",children:[(0,$.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,$.jsx)(i.$,{variant:"ghost",size:"sm",onClick:()=>t("/activity-studio/crossword"),children:(0,$.jsx)(y.A,{className:"w-4 h-4"})}),(0,$.jsx)("div",{className:"p-2 rounded-lg bg-primary/10",children:(0,$.jsx)(j.A,{className:"w-5 h-5 text-primary"})}),(0,$.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,$.jsx)("h1",{className:"text-xl font-bold text-foreground truncate",children:null===_||void 0===_?void 0:_.title}),(0,$.jsxs)("p",{className:"text-sm text-muted-foreground",children:[null===_||void 0===_?void 0:_.subject," \xb7 Year ",null===_||void 0===_||null===(e=_.year_levels)||void 0===e?void 0:e.join(", ")," \xb7 ",null===_||void 0===_?void 0:_.num_items," words"]})]})]}),(0,$.jsxs)("div",{className:"flex flex-wrap gap-2 mb-6",children:[(0,$.jsxs)(i.$,{onClick:async()=>{try{const e=(await n.A.post(`${n.n}/crosswords/${s}/share`)).data.share_token;O(e);const t=`${window.location.origin}/activity-studio/play/${e}`;await navigator.clipboard.writeText(t),Z(!0),setTimeout(()=>Z(!1),2500),l.oR.success("Student link copied to clipboard!"),(0,w.h)(s)&&((0,w.g)(s),W(!0))}catch(a){var e,t,r;if(403===(null===(e=a.response)||void 0===e?void 0:e.status))L(!0),"no_credits"===(null===(t=a.response)||void 0===t||null===(r=t.data)||void 0===r?void 0:r.detail)&&l.oR.info("You've run out of credits. Top up to share more crosswords.");else l.oR.error("Could not generate share link.")}},variant:"outline",size:"sm",children:[U?(0,$.jsx)(v.A,{className:"w-4 h-4 mr-2 text-primary"}):(0,$.jsx)(k.A,{className:"w-4 h-4 mr-2"}),U?"Copied!":"Copy student link"]}),(0,$.jsxs)(i.$,{onClick:async()=>{P(!0);try{const e=await n.A.get(`${n.n}/crosswords/${s}/export`,{responseType:"blob",validateStatus:e=>e<500});if(402===e.status&&(L(!0),l.oR.info("Upgrade to Pro to download a clean PDF without watermark.")),200!==e.status&&402!==e.status)return void l.oR.error("PDF export failed. Please try again.");const t=new Blob([e.data],{type:"application/pdf"}),r=URL.createObjectURL(t),a=document.createElement("a");a.href=r,a.download=`${(null===_||void 0===_?void 0:_.title)||"crossword"}_crossword.pdf`,a.click(),URL.revokeObjectURL(r),402!==e.status&&(0,w.h)(s)&&((0,w.g)(s),W(!0))}catch{l.oR.error("PDF export failed. Please try again.")}finally{P(!1)}},disabled:z,size:"sm",children:[z?(0,$.jsx)(g.A,{className:"w-4 h-4 mr-2 animate-spin"}):(0,$.jsx)(N.A,{className:"w-4 h-4 mr-2"}),"Download PDF"]}),(0,$.jsxs)(i.$,{onClick:async()=>{if(window.confirm("Delete this crossword and all student attempts? This cannot be undone."))try{await n.A.delete(`${n.n}/crosswords/${s}`),l.oR.success("Crossword deleted."),t("/activity-studio/crossword")}catch{l.oR.error("Delete failed.")}},variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive ml-auto",children:[(0,$.jsx)(A.A,{className:"w-4 h-4 mr-2"})," Delete"]})]}),X&&(0,$.jsxs)("div",{className:"mb-6 p-3 rounded-lg bg-muted border border-border flex items-center gap-2 text-sm",children:[(0,$.jsx)(k.A,{className:"w-4 h-4 text-muted-foreground shrink-0"}),(0,$.jsx)("span",{className:"text-muted-foreground flex-1 truncate",children:X}),(0,$.jsx)(i.$,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:async()=>{await navigator.clipboard.writeText(X),l.oR.success("Copied!")},children:(0,$.jsx)(b.A,{className:"w-3.5 h-3.5"})})]}),(0,$.jsxs)(u.tU,{defaultValue:"preview",children:[(0,$.jsxs)(u.j7,{className:"mb-6",children:[(0,$.jsx)(u.Xi,{value:"preview",children:"Preview"}),(0,$.jsxs)(u.Xi,{value:"analytics",children:[(0,$.jsx)(C.A,{className:"w-3.5 h-3.5 mr-1.5"})," Attempts (",D.length,")"]})]}),(0,$.jsx)(u.av,{value:"preview",children:(0,$.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,$.jsxs)(c.Zp,{children:[(0,$.jsx)(c.aR,{className:"pb-2",children:(0,$.jsx)(c.ZB,{className:"text-sm font-medium",children:"Answer Key Preview"})}),(0,$.jsx)(c.Wu,{className:"overflow-auto",children:(0,$.jsx)(x.A,{gridData:K.grid||[],placements:K.placements||[],readOnly:!0,showAnswers:!0,teacherMode:!0})})]}),(0,$.jsxs)(c.Zp,{children:[(0,$.jsx)(c.aR,{className:"pb-2",children:(0,$.jsx)(c.ZB,{className:"text-sm font-medium",children:"Clue List"})}),(0,$.jsx)(c.Wu,{children:(0,$.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide mb-2",children:"Across"}),(0,$.jsx)("ol",{className:"space-y-1.5",children:q.map(e=>(0,$.jsxs)("li",{className:"text-xs",children:[(0,$.jsxs)("span",{className:"font-semibold mr-1",children:[e.number,"."]}),e.clue,(0,$.jsx)(d.E,{variant:"outline",className:"ml-1.5 text-[10px] py-0",children:e.word})]},e.number))})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide mb-2",children:"Down"}),(0,$.jsx)("ol",{className:"space-y-1.5",children:H.map(e=>(0,$.jsxs)("li",{className:"text-xs",children:[(0,$.jsxs)("span",{className:"font-semibold mr-1",children:[e.number,"."]}),e.clue,(0,$.jsx)(d.E,{variant:"outline",className:"ml-1.5 text-[10px] py-0",children:e.word})]},e.number))})]})]})})]})]})}),(0,$.jsx)(u.av,{value:"analytics",children:0===D.length?(0,$.jsx)(c.Zp,{children:(0,$.jsxs)(c.Wu,{className:"py-12 text-center",children:[(0,$.jsx)(C.A,{className:"w-10 h-10 text-muted-foreground
2/40 mx-auto mb-3"}),(0,$.jsx)("p",{className:"text-muted-foreground",children:"No student attempts yet."}),(0,$.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Share the student link to get started."})]})}):(0,$.jsx)("div",{className:"space-y-2",children:D.map(e=>{const s=e.cells_total>0?Math.round(e.cells_correct/e.cells_total*100):0;return(0,$.jsx)(c.Zp,{children:(0,$.jsxs)(c.Wu,{className:"flex items-center gap-4 py-3",children:[(0,$.jsxs)("div",{className:"flex-1",children:[(0,$.jsx)("p",{className:"font-medium text-sm",children:e.student_name||"Anonymous"}),(0,$.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.cells_correct,"/",e.cells_total," cells \xb7 ",s,"%"," ",e.completed&&(0,$.jsx)("span",{className:"text-primary",children:"\xb7 Completed"})]})]}),e.time_taken_seconds&&(0,$.jsxs)("span",{className:"text-xs text-muted-foreground",children:[Math.floor(e.time_taken_seconds/60),"m ",e.time_taken_seconds%60,"s"]}),(0,$.jsx)("div",{className:"w-16 h-1.5 rounded-full bg-muted overflow-hidden",title:`${s}%`,children:(0,$.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${s}%`}})})]})},e.attempt_id)})})})]})]}),B&&(0,$.jsx)("div",{className:"max-w-2xl mx-auto px-4 pb-6",children:(0,$.jsx)(h.A,{feature:"crossword",resourceId:null===_||void 0===_?void 0:_.activity_id,onClose:()=>W(!1)})}),F&&(0,$.jsx)(p.A,{isOpen:!0,onClose:()=>L(!1)})]})}},5040(e,s,t){t.d(s,{A:()=>r});const r=(0,t(7784).A)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]])}}]);
3//# sourceMappingURL=9262.e406b0c6.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.