@mblinkov/whats-missing 20.0.34 → 20.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("react"),he=window.origin+"/cloud/speakid/games/whatsmissing/",Y=(a,m)=>a.map(([r,i])=>({src:`${he}${m}/${i.replace(/\s/g,"%20")}.png`,name:i})),fe=[["apple","apple"],["banana","banana"],["bread","bread"],["burger","burger"],["cake","cake"],["carrot","carrot"],["cheese","cheese"],["chicken","chicken"],["chocolate","chocolate"],["corn","corn"],["donut","donut"],["fish","fish"],["fries","fries"],["grapes","grapes"],["ice_cream","ice cream"],["milk","milk"],["orange","orange"],["pear","pear"],["pizza","pizza"],["rice","rice"],["sandwich","sandwich"],["soup","soup"],["strawberry","strawberry"],["tomato","tomato"],["watermelon","watermelon"]],pe=[["bear","bear"],["cat","cat"],["crocodile","crocodile"],["dolphin","dolphin"],["elephant","elephant"],["fox","fox"],["giraffe","giraffe"],["horse","horse"],["kangaroo","kangaroo"],["lion","lion"],["monkey","monkey"],["owl","owl"],["panda","panda"],["penguin","penguin"],["squirrel","squirrel"],["tiger","tiger"],["tortoise","tortoise"],["wolf","wolf"],["zebra","zebra"]],ye=[["ball","ball"],["balloon","balloon"],["blocks","blocks"],["car","car"],["doll","doll"],["drum","drum"],["guitar","guitar"],["jump_rope","jump rope"],["kite","kite"],["paints","paints"],["plane","plane"],["puzzle","puzzle"],["rocket","rocket"],["scooter","scooter"],["skateboard","skateboard"],["slide","slide"],["teddy_bear","teddy bear"],["yo-yo","yo-yo"],["crayons","crayons"]],P={food:Y(fe,"food"),animals:Y(pe,"animals"),toys:Y(ye,"toys")},xe=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("react"),he=window.origin+"/cloud/speakid/games/whatsmissing/",Y=(l,m)=>l.map(([r,i])=>({src:`${he}${m}/${i.replace(/\s/g,"%20")}.png`,name:i})),fe=[["apple","apple"],["banana","banana"],["bread","bread"],["burger","burger"],["cake","cake"],["carrot","carrot"],["cheese","cheese"],["chicken","chicken"],["chocolate","chocolate"],["corn","corn"],["donut","donut"],["fish","fish"],["fries","fries"],["grapes","grapes"],["ice_cream","ice cream"],["milk","milk"],["orange","orange"],["pear","pear"],["pizza","pizza"],["rice","rice"],["sandwich","sandwich"],["soup","soup"],["strawberry","strawberry"],["tomato","tomato"],["watermelon","watermelon"]],pe=[["bear","bear"],["cat","cat"],["crocodile","crocodile"],["dolphin","dolphin"],["elephant","elephant"],["fox","fox"],["giraffe","giraffe"],["horse","horse"],["kangaroo","kangaroo"],["lion","lion"],["monkey","monkey"],["owl","owl"],["panda","panda"],["penguin","penguin"],["squirrel","squirrel"],["tiger","tiger"],["tortoise","tortoise"],["wolf","wolf"],["zebra","zebra"]],ye=[["ball","ball"],["balloon","balloon"],["blocks","blocks"],["car","car"],["doll","doll"],["drum","drum"],["guitar","guitar"],["jump_rope","jump rope"],["kite","kite"],["paints","paints"],["plane","plane"],["puzzle","puzzle"],["rocket","rocket"],["scooter","scooter"],["skateboard","skateboard"],["slide","slide"],["teddy_bear","teddy bear"],["yo-yo","yo-yo"],["crayons","crayons"]],P={food:Y(fe,"food"),animals:Y(pe,"animals"),toys:Y(ye,"toys")},xe=`
2
2
  @keyframes spin {
3
3
  from { transform: rotate(0deg); }
4
4
  to { transform: rotate(360deg); }
5
5
  }
6
- `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const a=document.createElement("style");a.id="spin-keyframes",a.innerHTML=xe,document.head.appendChild(a)}const we={animation:"spin 1.4s linear infinite"},n={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"#1f2937",padding:"24px 16px",boxSizing:"border-box",transform:"translateY(20px)"},gmHeadline1:{fontWeight:700,fontSize:"clamp(28px, 4vw, 40px)",lineHeight:"110%"},gmHeadline3:{fontWeight:600,fontSize:"18px",lineHeight:"130%"},gmBodyM:{fontWeight:400,fontSize:"16px",lineHeight:"140%"},gmBodyS:{fontWeight:400,fontSize:"14px",lineHeight:"140%",color:"#6b7280"},gmButton:{fontFamily:'"Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans"',fontWeight:600,fontSize:"16px",padding:"10px 16px",borderRadius:"12px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"0 6px 18px rgba(236, 76, 68, .18)",transition:"transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease"},gmButtonActive:{background:"#333",color:"#fff"},gmGameLayout:{position:"relative",width:"100%",maxWidth:"none",minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"none",margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(3, 210px)",gridAutoRows:"210px",gap:"20px",justifyContent:"center"},gmCard:{border:"1px solid #e5e7eb",borderRadius:"16px",background:"#f9f9f9",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease"},gmCorrect:{border:"2px solid #10b981",boxShadow:"0 0 18px rgba(16,185,129,.45)",background:"#ecfdf5"},gmWrong:{border:"2px solid #ec4c44",boxShadow:"0 0 18px rgba(236,76,68,.35)",background:"#fef2f2"},gmInput:{padding:"6px 10px",borderRadius:"6px",border:"1px solid #ccc",fontSize:"16px",fontFamily:'"Geist", system-ui',width:"160px"},gmTable:{marginTop:"20px",marginBottom:"32px",borderCollapse:"collapse",width:"100%",maxWidth:"520px",tableLayout:"fixed",textAlign:"center"},gmTableCell:{padding:"8px 12px",borderBottom:"1px solid #e5e7eb",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},gmLogoFixed:{position:"absolute",top:"16px",left:"24px",width:"120px",zIndex:10,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased"},gmHourglass:{fontSize:"42px",...we}},be=()=>{const a=document.createElement("style");a.textContent=`
6
+ `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const l=document.createElement("style");l.id="spin-keyframes",l.innerHTML=xe,document.head.appendChild(l)}const be={animation:"spin 1.4s linear infinite"},o={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"#1f2937",padding:"24px 16px",boxSizing:"border-box",transform:"translateY(20px)"},gmHeadline1:{fontWeight:700,fontSize:"clamp(28px, 4vw, 40px)",lineHeight:"110%"},gmHeadline3:{fontWeight:600,fontSize:"18px",lineHeight:"130%"},gmBodyM:{fontWeight:400,fontSize:"16px",lineHeight:"140%"},gmBodyS:{fontWeight:400,fontSize:"14px",lineHeight:"140%",color:"#6b7280"},gmButton:{fontFamily:'"Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans"',fontWeight:600,fontSize:"16px",padding:"10px 16px",borderRadius:"12px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"0 6px 18px rgba(236, 76, 68, .18)",transition:"transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease"},gmButtonActive:{background:"#333",color:"#fff"},gmGameLayout:{position:"relative",width:"100%",maxWidth:"none",minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"none",margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(3, 210px)",gridAutoRows:"210px",gap:"20px",justifyContent:"center"},gmCard:{border:"1px solid #e5e7eb",borderRadius:"16px",background:"#f9f9f9",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease"},gmCorrect:{border:"2px solid #10b981",boxShadow:"0 0 18px rgba(16,185,129,.45)",background:"#ecfdf5"},gmWrong:{border:"2px solid #ec4c44",boxShadow:"0 0 18px rgba(236,76,68,.35)",background:"#fef2f2"},gmInput:{padding:"6px 10px",borderRadius:"6px",border:"1px solid #ccc",fontSize:"16px",fontFamily:'"Geist", system-ui',width:"160px"},gmTable:{marginTop:"20px",marginBottom:"32px",borderCollapse:"collapse",width:"100%",maxWidth:"520px",tableLayout:"fixed",textAlign:"center"},gmTableCell:{padding:"8px 12px",borderBottom:"1px solid #e5e7eb",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},gmLogoFixed:{position:"absolute",top:"16px",left:"24px",width:"120px",zIndex:10,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased"},gmHourglass:{fontSize:"42px",...be}},we=()=>{const l=document.createElement("style");l.textContent=`
7
7
  #whats-missing-root, #whats-missing-root * { box-sizing: border-box; }
8
8
  #whats-missing-root img { max-width:100%; height:auto; display:block; user-select:none; }
9
- `,document.head.appendChild(a)},je=(a,m)=>{const r=Array.from({length:a.length+1},()=>Array(m.length+1).fill(0));for(let i=0;i<=a.length;i++)r[i][0]=i;for(let i=0;i<=m.length;i++)r[0][i]=i;for(let i=1;i<=a.length;i++)for(let u=1;u<=m.length;u++)r[i][u]=a[i-1]===m[u-1]?r[i-1][u-1]:Math.min(r[i-1][u-1],r[i][u-1],r[i-1][u])+1;return r[a.length][m.length]};function Se(a,m={minDesktopWidth:1200,forceResize:!1}){const r=s.useRef(null),i=m.minDesktopWidth??1200,u=!!m.forceResize;s.useLayoutEffect(()=>{if(typeof window>"u"||!a||!a.current)return;const d=a.current,R=()=>{try{const l=document.body,j=getComputedStyle(l),w=parseFloat(l.style&&l.style.zoom||"");if(w&&!isNaN(w)&&w>0)return w;const S=parseFloat(j.zoom||"");if(S&&!isNaN(S)&&S>0)return S;const g=document.createElement("div");g.style.position="absolute",g.style.left="0",g.style.top="0",g.style.width="100px",g.style.height="1px",g.style.visibility="hidden",document.documentElement.appendChild(g);const k=g.getBoundingClientRect();if(document.documentElement.removeChild(g),k&&k.width>0){const p=k.width/100;if(!isNaN(p)&&p>0)return p}}catch{}return 1},I=()=>{if(i&&window.innerWidth<i){y();return}const l=R();if(!l||l===1){y();return}r.current||(r.current={transform:d.style.transform||null,transformOrigin:d.style.transformOrigin||null,width:d.style.width||null,height:d.style.height||null,willChange:d.style.willChange||null});const j=1/l;u&&(d.style.width=`${l*100}%`,d.style.height=`${l*100}%`),d.style.transformOrigin="50% 50%",d.style.transform=`scale(${j})`,d.style.willChange="transform"},y=()=>{if(!r.current)return;const l=r.current;d.style.transform=l.transform??"",d.style.transformOrigin=l.transformOrigin??"",d.style.width=l.width??"",d.style.height=l.height??"",d.style.willChange=l.willChange??"",r.current=null};let C=0;const x=()=>{cancelAnimationFrame(C),C=requestAnimationFrame(I)},T=new MutationObserver(l=>{for(const j of l)if(j.type==="attributes"&&(j.attributeName==="style"||j.attributeName==="class")){x();break}});return T.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",x),x(),()=>{cancelAnimationFrame(C),T.disconnect(),window.removeEventListener("resize",x),y()}},[a,i,u])}function ve({gameCubeSize:a,screenHeight:m,screenWidth:r}){const i=s.useRef(null),u=s.useRef(null),[d,R]=s.useState(null);Se(i,{minDesktopWidth:1024,forceResize:!1});const I=s.useMemo(()=>{const e=a??Math.min(r??1e3,m??1e3),o=r??(typeof window<"u"?window.innerWidth:1e3);return e<600&&o>768?600:o<=768?Math.min(e,o-20):e},[a,r,m]);s.useEffect(()=>(be(),()=>{document.body.style.overflow=""}),[]);const[y,C]=s.useState(null),[x,T]=s.useState([]),[l,j]=s.useState(4),[w,S]=s.useState(!1),[g,k]=s.useState(1),[p,ie]=s.useState(null),[b,H]=s.useState("ready"),[U,V]=s.useState(3),[E,A]=s.useState(10),[W,Z]=s.useState(20),[re,F]=s.useState(0),[B,G]=s.useState(!1),[L,_]=s.useState(""),[z,$]=s.useState(!1),[N,K]=s.useState(!1),[J,M]=s.useState(null),[ae,O]=s.useState([]),[le,Q]=s.useState([]),[h,de]=s.useState(!1);s.useEffect(()=>{if(typeof window>"u")return;const e=()=>{const o=r??window.innerWidth,c=window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;de(o<=768||c)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[r]),s.useLayoutEffect(()=>{const e=u.current;if(!e||typeof window>"u")return;let o=null;try{o=new ResizeObserver(c=>{for(const f of c){const v=f.contentRect;R(Math.round(Math.min(v.width,v.height)))}}),o.observe(e),R(Math.round(Math.min(e.clientWidth,e.clientHeight)))}catch{R(Math.round(Math.min(e.clientWidth,e.clientHeight)))}return()=>o?.disconnect()},[h]);const X=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),ee=()=>{if(!y)return;const e=X(P[y]);T(e),S(!0),G(!1),k(1),F(0),O([]),Q([]),te(e,[],!0)},te=(e=x,o=le,c=!1)=>{const f=X(e.length?e:P[y]);let v=Math.floor(Math.random()*f.length),q=f[v].name,se=0;for(;o.includes(q)&&se<20;)v=Math.floor(Math.random()*f.length),q=f[v].name,se++;T(f),ie(v),Q([...o,q]),$(!1),_(""),Z(20),M(null),c?(H("ready"),V(3),A(10)):(H("memorize"),A(10))};s.useEffect(()=>{if(!(!w||B||z)){if(b==="ready")if(U<=0)H("memorize");else{const e=setTimeout(()=>V(o=>o-1),1e3);return()=>clearTimeout(e)}if(b==="memorize")if(E<=0)H("guess");else{const e=setTimeout(()=>A(o=>o-1),1e3);return()=>clearTimeout(e)}if(b==="guess"){if(W<=0){$(!0),M("wrong");const o=x[p].name;O(c=>[...c,{round:g,answer:L,correct:o,result:"wrong"}]);return}const e=setTimeout(()=>Z(o=>o-1),1e3);return()=>clearTimeout(e)}}},[b,U,E,W,w,B,z,x,p,g,L]);const ce=()=>{if(p===null||N)return;const e=x[p].name,o=L.toLowerCase().trim();let c="wrong";o===e?(F(f=>f+1),M("correct"),c="correct"):je(o,e)===1?(F(f=>f+.5),M("almost"),c="almost"):(M("wrong"),c="wrong"),O(f=>[...f,{round:g,answer:o,correct:e,result:c}]),K(!0),setTimeout(()=>{K(!1),$(!0)},600)},me=()=>g<l?(k(e=>e+1),te()):G(!0),ue=()=>{S(!1),G(!1),C(null)},ge=s.useMemo(()=>t.jsx("div",{style:{...n.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),t.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:n.gmLogoImg,loading:"lazy"})]})}),[]),ne=1200,oe=700,D=s.useMemo(()=>{const e=r??(typeof window<"u"?window.innerWidth:ne),o=m??(typeof window<"u"?window.innerHeight:oe),c=Math.min(e/ne,o/oe);return Math.min(1.35,Math.max(1,c))},[r,m,h]);return t.jsx("div",{ref:i,style:{position:"fixed",inset:0,display:"flex",justifyContent:"center",alignItems:"center",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",overflow:"hidden",zIndex:1,width:"100vw",height:"100vh",transform:"none",zoom:1,scale:"1 !important"},children:t.jsx("div",{ref:u,style:{width:h?"100%":`${I}px`,height:h?"100%":`${I}px`,borderRadius:h?0:"20px",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",position:"relative",overflow:"hidden",boxShadow:h?"none":"0 0 40px rgba(0,0,0,0.08)",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxs("div",{id:"whats-missing-root",style:{transform:`scale(${D})`,transformOrigin:"center center",transition:"transform 0.2s ease-out",width:`${100/D}%`,height:`${100/D}%`,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[!h&&ge,!y&&!w&&t.jsxs("div",{style:n.gmCenterScreen,children:[t.jsx("h1",{style:n.gmHeadline1,children:"WHAT'S MISSING?"}),t.jsx("p",{style:n.gmBodyM,children:"Select a theme:"}),t.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(e=>t.jsx("button",{style:n.gmButton,onClick:()=>C(e),children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),t.jsxs("div",{style:{marginTop:24},children:[t.jsx("p",{style:n.gmBodyS,children:"Choose number of rounds:"}),t.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(e=>t.jsx("button",{style:{...n.gmButton,...l===e?n.gmButtonActive:{}},onClick:()=>j(e),children:e},e))})]})]}),y&&!w&&t.jsxs("div",{style:n.gmCenterScreen,children:[t.jsxs("h1",{style:n.gmHeadline1,children:["Theme selected: ",y]}),t.jsxs("p",{style:n.gmBodyM,children:["Rounds: ",l]}),t.jsx("button",{style:n.gmButton,onClick:ee,children:"▶ Start game"})]}),B&&t.jsxs("div",{style:n.gmCenterScreen,children:[t.jsx("h1",{style:n.gmHeadline1,children:"Results"}),t.jsxs("h2",{style:n.gmHeadline3,children:["Your score: ",re," / ",l]}),t.jsx("p",{style:{...n.gmBodyM,color:"#10b981",marginTop:12},children:"Yahoo! You did it! 🍬✨"}),t.jsxs("table",{style:n.gmTable,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Round"}),t.jsx("th",{children:"Your Answer"}),t.jsx("th",{children:"Correct"}),t.jsx("th",{children:"Result"})]})}),t.jsx("tbody",{children:ae.map((e,o)=>t.jsxs("tr",{children:[t.jsx("td",{style:n.gmTableCell,children:e.round}),t.jsx("td",{style:n.gmTableCell,children:e.answer||"—"}),t.jsx("td",{style:n.gmTableCell,children:e.correct}),t.jsx("td",{style:n.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},o))})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[t.jsx("button",{style:n.gmButton,onClick:ee,children:"🔁 Play again"}),t.jsx("button",{style:n.gmButton,onClick:ue,children:"⬅️ Choose theme"})]})]}),w&&!B&&t.jsxs("div",{style:n.gmGameLayout,children:[t.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[b==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx("h1",{style:{...n.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),t.jsx("div",{style:n.gmHourglass,children:"⏳"})]}),b==="memorize"&&t.jsxs("p",{style:{...n.gmBodyM,color:"#10b981"},children:["MEMORIZE (",E,")"]}),b==="guess"&&!z&&t.jsxs("p",{style:n.gmBodyM,children:["⏳ Time left: ",W,"s"]})]}),b!=="ready"&&t.jsx("div",{style:{...n.gmGrid,display:"grid",gridTemplateColumns:`repeat(${h?2:3}, 1fr)`,gridTemplateRows:`repeat(${h?3:2}, 1fr)`,gap:h?12:20,justifyContent:"center",alignContent:"center",padding:h?8:16,width:"100%",height:"100%",maxWidth:h?"100%":600,maxHeight:h?"100%":400,boxSizing:"border-box"},children:x.map((e,o)=>{const c=p===o&&b==="guess"&&!z;return t.jsx("div",{style:{...n.gmCard,width:"100%",height:"100%",...J==="correct"&&p===o?n.gmCorrect:{},...J==="wrong"&&p===o?n.gmWrong:{}},children:!c&&t.jsx("img",{src:e.src,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},o)})}),t.jsxs("div",{style:{marginTop:16,height:80},children:[b==="guess"&&!z&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"Type the missing word",value:L,onChange:e=>_(e.target.value),style:n.gmInput}),t.jsx("button",{style:{...n.gmButton,marginLeft:8},onClick:ce,disabled:N,children:N?"...":"Check"})]}),z&&t.jsx("button",{type:"button",style:n.gmButton,onClick:me,children:"Next round"})]})]})]})})})}exports.Game=ve;exports.themes=P;
9
+ `,document.head.appendChild(l)},je=(l,m)=>{const r=Array.from({length:l.length+1},()=>Array(m.length+1).fill(0));for(let i=0;i<=l.length;i++)r[i][0]=i;for(let i=0;i<=m.length;i++)r[0][i]=i;for(let i=1;i<=l.length;i++)for(let g=1;g<=m.length;g++)r[i][g]=l[i-1]===m[g-1]?r[i-1][g-1]:Math.min(r[i-1][g-1],r[i][g-1],r[i-1][g])+1;return r[l.length][m.length]};function Se(l,m={minDesktopWidth:1200,forceResize:!1}){const r=s.useRef(null),i=m.minDesktopWidth??1200,g=!!m.forceResize;s.useLayoutEffect(()=>{if(typeof window>"u"||!l||!l.current)return;const c=l.current,T=()=>{try{const a=document.body,j=getComputedStyle(a),b=parseFloat(a.style&&a.style.zoom||"");if(b&&!isNaN(b)&&b>0)return b;const v=parseFloat(j.zoom||"");if(v&&!isNaN(v)&&v>0)return v;const h=document.createElement("div");h.style.position="absolute",h.style.left="0",h.style.top="0",h.style.width="100px",h.style.height="1px",h.style.visibility="hidden",document.documentElement.appendChild(h);const C=h.getBoundingClientRect();if(document.documentElement.removeChild(h),C&&C.width>0){const p=C.width/100;if(!isNaN(p)&&p>0)return p}}catch{}return 1},H=()=>{if(i&&window.innerWidth<i){y();return}const a=T();if(!a||a===1){y();return}r.current||(r.current={transform:c.style.transform||null,transformOrigin:c.style.transformOrigin||null,width:c.style.width||null,height:c.style.height||null,willChange:c.style.willChange||null});const j=1/a;g&&(c.style.width=`${a*100}%`,c.style.height=`${a*100}%`),c.style.transformOrigin="50% 50%",c.style.transform=`scale(${j})`,c.style.willChange="transform"},y=()=>{if(!r.current)return;const a=r.current;c.style.transform=a.transform??"",c.style.transformOrigin=a.transformOrigin??"",c.style.width=a.width??"",c.style.height=a.height??"",c.style.willChange=a.willChange??"",r.current=null};let z=0;const x=()=>{cancelAnimationFrame(z),z=requestAnimationFrame(H)},R=new MutationObserver(a=>{for(const j of a)if(j.type==="attributes"&&(j.attributeName==="style"||j.attributeName==="class")){x();break}});return R.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",x),x(),()=>{cancelAnimationFrame(z),R.disconnect(),window.removeEventListener("resize",x),y()}},[l,i,g])}function ve({gameCubeSize:l,screenHeight:m,screenWidth:r}){const i=s.useRef(null),g=s.useRef(null),[c,T]=s.useState(null);Se(i,{minDesktopWidth:1024,forceResize:!1}),s.useEffect(()=>{const e=document.body,n=document.documentElement,d=e.style.zoom,u=e.style.transform,S=n.style.zoom,I=n.style.transform;return e.style.zoom="1",e.style.transform="none",n.style.zoom="1",n.style.transform="none",()=>{e.style.zoom=d,e.style.transform=u,n.style.zoom=S,n.style.transform=I}},[]);const H=s.useMemo(()=>{const e=l??Math.min(r??1e3,m??1e3),n=r??(typeof window<"u"?window.innerWidth:1e3);return e<600&&n>768?600:n<=768?Math.min(e,n-20):e},[l,r,m]);s.useEffect(()=>(we(),()=>{document.body.style.overflow=""}),[]);const[y,z]=s.useState(null),[x,R]=s.useState([]),[a,j]=s.useState(4),[b,v]=s.useState(!1),[h,C]=s.useState(1),[p,ie]=s.useState(null),[w,B]=s.useState("ready"),[Z,U]=s.useState(3),[A,W]=s.useState(10),[F,V]=s.useState(20),[re,G]=s.useState(0),[E,$]=s.useState(!1),[L,_]=s.useState(""),[k,N]=s.useState(!1),[O,K]=s.useState(!1),[J,M]=s.useState(null),[le,D]=s.useState([]),[ae,Q]=s.useState([]),[f,de]=s.useState(!1);s.useEffect(()=>{if(typeof window>"u")return;const e=()=>{const n=r??window.innerWidth,d=window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;de(n<=768||d)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[r]),s.useLayoutEffect(()=>{const e=g.current;if(!e||typeof window>"u")return;let n=null;try{n=new ResizeObserver(d=>{for(const u of d){const S=u.contentRect;T(Math.round(Math.min(S.width,S.height)))}}),n.observe(e),T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}catch{T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}return()=>n?.disconnect()},[f]);const X=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),ee=()=>{if(!y)return;const e=X(P[y]);R(e),v(!0),$(!1),C(1),G(0),D([]),Q([]),te(e,[],!0)},te=(e=x,n=ae,d=!1)=>{const u=X(e.length?e:P[y]);let S=Math.floor(Math.random()*u.length),I=u[S].name,se=0;for(;n.includes(I)&&se<20;)S=Math.floor(Math.random()*u.length),I=u[S].name,se++;R(u),ie(S),Q([...n,I]),N(!1),_(""),V(20),M(null),d?(B("ready"),U(3),W(10)):(B("memorize"),W(10))};s.useEffect(()=>{if(!(!b||E||k)){if(w==="ready")if(Z<=0)B("memorize");else{const e=setTimeout(()=>U(n=>n-1),1e3);return()=>clearTimeout(e)}if(w==="memorize")if(A<=0)B("guess");else{const e=setTimeout(()=>W(n=>n-1),1e3);return()=>clearTimeout(e)}if(w==="guess"){if(F<=0){N(!0),M("wrong");const n=x[p].name;D(d=>[...d,{round:h,answer:L,correct:n,result:"wrong"}]);return}const e=setTimeout(()=>V(n=>n-1),1e3);return()=>clearTimeout(e)}}},[w,Z,A,F,b,E,k,x,p,h,L]);const ce=()=>{if(p===null||O)return;const e=x[p].name,n=L.toLowerCase().trim();let d="wrong";n===e?(G(u=>u+1),M("correct"),d="correct"):je(n,e)===1?(G(u=>u+.5),M("almost"),d="almost"):(M("wrong"),d="wrong"),D(u=>[...u,{round:h,answer:n,correct:e,result:d}]),K(!0),setTimeout(()=>{K(!1),N(!0)},600)},me=()=>h<a?(C(e=>e+1),te()):$(!0),ue=()=>{v(!1),$(!1),z(null)},ge=s.useMemo(()=>t.jsx("div",{style:{...o.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),t.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:o.gmLogoImg,loading:"lazy"})]})}),[]),ne=1200,oe=700,q=s.useMemo(()=>{const e=r??(typeof window<"u"?window.innerWidth:ne),n=m??(typeof window<"u"?window.innerHeight:oe),d=Math.min(e/ne,n/oe);return Math.min(1.35,Math.max(1,d))},[r,m,f]);return t.jsx("div",{ref:i,style:{position:"fixed",inset:0,display:"flex",justifyContent:"center",alignItems:"center",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",overflow:"hidden",zIndex:1,width:"100vw",height:"100vh",transform:"none",zoom:1,scale:"1 !important"},children:t.jsx("div",{ref:g,style:{width:f?"100%":`${H}px`,height:f?"100%":`${H}px`,borderRadius:f?0:"20px",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",position:"relative",overflow:"hidden",boxShadow:f?"none":"0 0 40px rgba(0,0,0,0.08)",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxs("div",{id:"whats-missing-root",style:{transform:`scale(${q})`,transformOrigin:"center center",transition:"transform 0.2s ease-out",width:`${100/q}%`,height:`${100/q}%`,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[!f&&ge,!y&&!b&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),t.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),t.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(e=>t.jsx("button",{style:o.gmButton,onClick:()=>z(e),children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),t.jsxs("div",{style:{marginTop:24},children:[t.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),t.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(e=>t.jsx("button",{style:{...o.gmButton,...a===e?o.gmButtonActive:{}},onClick:()=>j(e),children:e},e))})]})]}),y&&!b&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",y]}),t.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",a]}),t.jsx("button",{style:o.gmButton,onClick:ee,children:"▶ Start game"})]}),E&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"Results"}),t.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",re," / ",a]}),t.jsx("p",{style:{...o.gmBodyM,color:"#10b981",marginTop:12},children:"Yahoo! You did it! 🍬✨"}),t.jsxs("table",{style:o.gmTable,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Round"}),t.jsx("th",{children:"Your Answer"}),t.jsx("th",{children:"Correct"}),t.jsx("th",{children:"Result"})]})}),t.jsx("tbody",{children:le.map((e,n)=>t.jsxs("tr",{children:[t.jsx("td",{style:o.gmTableCell,children:e.round}),t.jsx("td",{style:o.gmTableCell,children:e.answer||"—"}),t.jsx("td",{style:o.gmTableCell,children:e.correct}),t.jsx("td",{style:o.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},n))})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[t.jsx("button",{style:o.gmButton,onClick:ee,children:"🔁 Play again"}),t.jsx("button",{style:o.gmButton,onClick:ue,children:"⬅️ Choose theme"})]})]}),b&&!E&&t.jsxs("div",{style:o.gmGameLayout,children:[t.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[w==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),t.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),w==="memorize"&&t.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",A,")"]}),w==="guess"&&!k&&t.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",F,"s"]})]}),w!=="ready"&&t.jsx("div",{style:{...o.gmGrid,display:"grid",gridTemplateColumns:`repeat(${f?2:3}, 1fr)`,gridTemplateRows:`repeat(${f?3:2}, 1fr)`,gap:f?12:20,justifyContent:"center",alignContent:"center",padding:f?8:16,width:"100%",height:"100%",maxWidth:f?"100%":600,maxHeight:f?"100%":400,boxSizing:"border-box"},children:x.map((e,n)=>{const d=p===n&&w==="guess"&&!k;return t.jsx("div",{style:{...o.gmCard,width:"100%",height:"100%",...J==="correct"&&p===n?o.gmCorrect:{},...J==="wrong"&&p===n?o.gmWrong:{}},children:!d&&t.jsx("img",{src:e.src,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},n)})}),t.jsxs("div",{style:{marginTop:16,height:80},children:[w==="guess"&&!k&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"Type the missing word",value:L,onChange:e=>_(e.target.value),style:o.gmInput}),t.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:ce,disabled:O,children:O?"...":"Check"})]}),k&&t.jsx("button",{type:"button",style:o.gmButton,onClick:me,children:"Next round"})]})]})]})})})}exports.Game=ve;exports.themes=P;
@@ -1,6 +1,6 @@
1
- import { jsx as n, jsxs as a, Fragment as be } from "react/jsx-runtime";
2
- import { useRef as Z, useState as d, useMemo as P, useEffect as U, useLayoutEffect as de } from "react";
3
- const xe = window.origin + "/cloud/speakid/games/whatsmissing/", V = (s, u) => s.map(([r, i]) => ({
1
+ import { jsx as o, jsxs as a, Fragment as be } from "react/jsx-runtime";
2
+ import { useRef as V, useState as d, useEffect as j, useMemo as P, useLayoutEffect as de } from "react";
3
+ const xe = window.origin + "/cloud/speakid/games/whatsmissing/", U = (s, u) => s.map(([r, i]) => ({
4
4
  src: `${xe}${u}/${i.replace(/\s/g, "%20")}.png`,
5
5
  name: i
6
6
  })), ve = [
@@ -29,7 +29,7 @@ const xe = window.origin + "/cloud/speakid/games/whatsmissing/", V = (s, u) => s
29
29
  ["strawberry", "strawberry"],
30
30
  ["tomato", "tomato"],
31
31
  ["watermelon", "watermelon"]
32
- ], Ce = [
32
+ ], ze = [
33
33
  ["bear", "bear"],
34
34
  ["cat", "cat"],
35
35
  ["crocodile", "crocodile"],
@@ -49,7 +49,7 @@ const xe = window.origin + "/cloud/speakid/games/whatsmissing/", V = (s, u) => s
49
49
  ["tortoise", "tortoise"],
50
50
  ["wolf", "wolf"],
51
51
  ["zebra", "zebra"]
52
- ], ke = [
52
+ ], Ce = [
53
53
  ["ball", "ball"],
54
54
  ["balloon", "balloon"],
55
55
  ["blocks", "blocks"],
@@ -70,10 +70,10 @@ const xe = window.origin + "/cloud/speakid/games/whatsmissing/", V = (s, u) => s
70
70
  ["yo-yo", "yo-yo"],
71
71
  ["crayons", "crayons"]
72
72
  ], ae = {
73
- food: V(ve, "food"),
74
- animals: V(Ce, "animals"),
75
- toys: V(ke, "toys")
76
- }, ze = `
73
+ food: U(ve, "food"),
74
+ animals: U(ze, "animals"),
75
+ toys: U(Ce, "toys")
76
+ }, ke = `
77
77
  @keyframes spin {
78
78
  from { transform: rotate(0deg); }
79
79
  to { transform: rotate(360deg); }
@@ -81,11 +81,11 @@ const xe = window.origin + "/cloud/speakid/games/whatsmissing/", V = (s, u) => s
81
81
  `;
82
82
  if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
83
83
  const s = document.createElement("style");
84
- s.id = "spin-keyframes", s.innerHTML = ze, document.head.appendChild(s);
84
+ s.id = "spin-keyframes", s.innerHTML = ke, document.head.appendChild(s);
85
85
  }
86
86
  const Se = {
87
87
  animation: "spin 1.4s linear infinite"
88
- }, t = {
88
+ }, n = {
89
89
  gmCenterScreen: {
90
90
  position: "relative",
91
91
  zIndex: 1,
@@ -252,31 +252,31 @@ const Se = {
252
252
  for (let i = 0; i <= s.length; i++) r[i][0] = i;
253
253
  for (let i = 0; i <= u.length; i++) r[0][i] = i;
254
254
  for (let i = 1; i <= s.length; i++)
255
- for (let g = 1; g <= u.length; g++)
256
- r[i][g] = s[i - 1] === u[g - 1] ? r[i - 1][g - 1] : Math.min(r[i - 1][g - 1], r[i][g - 1], r[i - 1][g]) + 1;
255
+ for (let h = 1; h <= u.length; h++)
256
+ r[i][h] = s[i - 1] === u[h - 1] ? r[i - 1][h - 1] : Math.min(r[i - 1][h - 1], r[i][h - 1], r[i - 1][h]) + 1;
257
257
  return r[s.length][u.length];
258
258
  };
259
259
  function Me(s, u = { minDesktopWidth: 1200, forceResize: !1 }) {
260
- const r = Z(null), i = u.minDesktopWidth ?? 1200, g = !!u.forceResize;
260
+ const r = V(null), i = u.minDesktopWidth ?? 1200, h = !!u.forceResize;
261
261
  de(() => {
262
262
  if (typeof window > "u" || !s || !s.current) return;
263
- const c = s.current, M = () => {
263
+ const m = s.current, M = () => {
264
264
  try {
265
- const l = document.body, C = getComputedStyle(l), x = parseFloat(l.style && l.style.zoom || "");
265
+ const l = document.body, z = getComputedStyle(l), x = parseFloat(l.style && l.style.zoom || "");
266
266
  if (x && !isNaN(x) && x > 0) return x;
267
- const k = parseFloat(C.zoom || "");
267
+ const k = parseFloat(z.zoom || "");
268
268
  if (k && !isNaN(k) && k > 0) return k;
269
- const h = document.createElement("div");
270
- h.style.position = "absolute", h.style.left = "0", h.style.top = "0", h.style.width = "100px", h.style.height = "1px", h.style.visibility = "hidden", document.documentElement.appendChild(h);
271
- const T = h.getBoundingClientRect();
272
- if (document.documentElement.removeChild(h), T && T.width > 0) {
269
+ const f = document.createElement("div");
270
+ f.style.position = "absolute", f.style.left = "0", f.style.top = "0", f.style.width = "100px", f.style.height = "1px", f.style.visibility = "hidden", document.documentElement.appendChild(f);
271
+ const T = f.getBoundingClientRect();
272
+ if (document.documentElement.removeChild(f), T && T.width > 0) {
273
273
  const y = T.width / 100;
274
274
  if (!isNaN(y) && y > 0) return y;
275
275
  }
276
276
  } catch {
277
277
  }
278
278
  return 1;
279
- }, B = () => {
279
+ }, L = () => {
280
280
  if (i && window.innerWidth < i) {
281
281
  w();
282
282
  return;
@@ -287,25 +287,25 @@ function Me(s, u = { minDesktopWidth: 1200, forceResize: !1 }) {
287
287
  return;
288
288
  }
289
289
  r.current || (r.current = {
290
- transform: c.style.transform || null,
291
- transformOrigin: c.style.transformOrigin || null,
292
- width: c.style.width || null,
293
- height: c.style.height || null,
294
- willChange: c.style.willChange || null
290
+ transform: m.style.transform || null,
291
+ transformOrigin: m.style.transformOrigin || null,
292
+ width: m.style.width || null,
293
+ height: m.style.height || null,
294
+ willChange: m.style.willChange || null
295
295
  });
296
- const C = 1 / l;
297
- g && (c.style.width = `${l * 100}%`, c.style.height = `${l * 100}%`), c.style.transformOrigin = "50% 50%", c.style.transform = `scale(${C})`, c.style.willChange = "transform";
296
+ const z = 1 / l;
297
+ h && (m.style.width = `${l * 100}%`, m.style.height = `${l * 100}%`), m.style.transformOrigin = "50% 50%", m.style.transform = `scale(${z})`, m.style.willChange = "transform";
298
298
  }, w = () => {
299
299
  if (!r.current) return;
300
300
  const l = r.current;
301
- c.style.transform = l.transform ?? "", c.style.transformOrigin = l.transformOrigin ?? "", c.style.width = l.width ?? "", c.style.height = l.height ?? "", c.style.willChange = l.willChange ?? "", r.current = null;
301
+ m.style.transform = l.transform ?? "", m.style.transformOrigin = l.transformOrigin ?? "", m.style.width = l.width ?? "", m.style.height = l.height ?? "", m.style.willChange = l.willChange ?? "", r.current = null;
302
302
  };
303
303
  let S = 0;
304
304
  const b = () => {
305
- cancelAnimationFrame(S), S = requestAnimationFrame(B);
305
+ cancelAnimationFrame(S), S = requestAnimationFrame(L);
306
306
  }, I = new MutationObserver((l) => {
307
- for (const C of l)
308
- if (C.type === "attributes" && (C.attributeName === "style" || C.attributeName === "class")) {
307
+ for (const z of l)
308
+ if (z.type === "attributes" && (z.attributeName === "style" || z.attributeName === "class")) {
309
309
  b();
310
310
  break;
311
311
  }
@@ -313,122 +313,127 @@ function Me(s, u = { minDesktopWidth: 1200, forceResize: !1 }) {
313
313
  return I.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), window.addEventListener("resize", b), b(), () => {
314
314
  cancelAnimationFrame(S), I.disconnect(), window.removeEventListener("resize", b), w();
315
315
  };
316
- }, [s, i, g]);
316
+ }, [s, i, h]);
317
317
  }
318
318
  function Be({
319
319
  gameCubeSize: s,
320
320
  screenHeight: u,
321
321
  screenWidth: r
322
322
  }) {
323
- const i = Z(null), g = Z(null), [c, M] = d(null);
324
- Me(i, { minDesktopWidth: 1024, forceResize: !1 });
325
- const B = P(() => {
326
- const e = s ?? Math.min(r ?? 1e3, u ?? 1e3), o = r ?? (typeof window < "u" ? window.innerWidth : 1e3);
327
- return e < 600 && o > 768 ? 600 : o <= 768 ? Math.min(e, o - 20) : e;
323
+ const i = V(null), h = V(null), [m, M] = d(null);
324
+ Me(i, { minDesktopWidth: 1024, forceResize: !1 }), j(() => {
325
+ const e = document.body, t = document.documentElement, c = e.style.zoom, g = e.style.transform, C = t.style.zoom, B = t.style.transform;
326
+ return e.style.zoom = "1", e.style.transform = "none", t.style.zoom = "1", t.style.transform = "none", () => {
327
+ e.style.zoom = c, e.style.transform = g, t.style.zoom = C, t.style.transform = B;
328
+ };
329
+ }, []);
330
+ const L = P(() => {
331
+ const e = s ?? Math.min(r ?? 1e3, u ?? 1e3), t = r ?? (typeof window < "u" ? window.innerWidth : 1e3);
332
+ return e < 600 && t > 768 ? 600 : t <= 768 ? Math.min(e, t - 20) : e;
328
333
  }, [s, r, u]);
329
- U(() => (Te(), () => {
334
+ j(() => (Te(), () => {
330
335
  document.body.style.overflow = "";
331
336
  }), []);
332
- const [w, S] = d(null), [b, I] = d([]), [l, C] = d(4), [x, k] = d(!1), [h, T] = d(1), [y, ce] = d(null), [v, L] = d("ready"), [_, K] = d(3), [E, j] = d(10), [F, J] = d(20), [me, $] = d(0), [A, G] = d(!1), [W, Q] = d(""), [R, N] = d(!1), [D, X] = d(!1), [ee, H] = d(null), [ue, O] = d([]), [ge, te] = d([]), [f, he] = d(!1);
333
- U(() => {
337
+ const [w, S] = d(null), [b, I] = d([]), [l, z] = d(4), [x, k] = d(!1), [f, T] = d(1), [y, ce] = d(null), [v, A] = d("ready"), [_, K] = d(3), [F, $] = d(10), [G, J] = d(20), [me, N] = d(0), [E, D] = d(!1), [W, Q] = d(""), [R, O] = d(!1), [q, X] = d(!1), [ee, H] = d(null), [ue, Y] = d([]), [ge, te] = d([]), [p, he] = d(!1);
338
+ j(() => {
334
339
  if (typeof window > "u") return;
335
340
  const e = () => {
336
- const o = r ?? window.innerWidth, m = window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
337
- he(o <= 768 || m);
341
+ const t = r ?? window.innerWidth, c = window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
342
+ he(t <= 768 || c);
338
343
  };
339
344
  return e(), window.addEventListener("resize", e), window.addEventListener("orientationchange", e), () => {
340
345
  window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e);
341
346
  };
342
347
  }, [r]), de(() => {
343
- const e = g.current;
348
+ const e = h.current;
344
349
  if (!e || typeof window > "u") return;
345
- let o = null;
350
+ let t = null;
346
351
  try {
347
- o = new ResizeObserver((m) => {
348
- for (const p of m) {
349
- const z = p.contentRect;
350
- M(Math.round(Math.min(z.width, z.height)));
352
+ t = new ResizeObserver((c) => {
353
+ for (const g of c) {
354
+ const C = g.contentRect;
355
+ M(Math.round(Math.min(C.width, C.height)));
351
356
  }
352
- }), o.observe(e), M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
357
+ }), t.observe(e), M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
353
358
  } catch {
354
359
  M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
355
360
  }
356
- return () => o?.disconnect();
357
- }, [f]);
361
+ return () => t?.disconnect();
362
+ }, [p]);
358
363
  const ne = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), oe = () => {
359
364
  if (!w) return;
360
365
  const e = ne(ae[w]);
361
- I(e), k(!0), G(!1), T(1), $(0), O([]), te([]), ie(e, [], !0);
362
- }, ie = (e = b, o = ge, m = !1) => {
363
- const p = ne(e.length ? e : ae[w]);
364
- let z = Math.floor(Math.random() * p.length), Y = p[z].name, le = 0;
365
- for (; o.includes(Y) && le < 20; )
366
- z = Math.floor(Math.random() * p.length), Y = p[z].name, le++;
367
- I(p), ce(z), te([...o, Y]), N(!1), Q(""), J(20), H(null), m ? (L("ready"), K(3), j(10)) : (L("memorize"), j(10));
366
+ I(e), k(!0), D(!1), T(1), N(0), Y([]), te([]), ie(e, [], !0);
367
+ }, ie = (e = b, t = ge, c = !1) => {
368
+ const g = ne(e.length ? e : ae[w]);
369
+ let C = Math.floor(Math.random() * g.length), B = g[C].name, le = 0;
370
+ for (; t.includes(B) && le < 20; )
371
+ C = Math.floor(Math.random() * g.length), B = g[C].name, le++;
372
+ I(g), ce(C), te([...t, B]), O(!1), Q(""), J(20), H(null), c ? (A("ready"), K(3), $(10)) : (A("memorize"), $(10));
368
373
  };
369
- U(() => {
370
- if (!(!x || A || R)) {
374
+ j(() => {
375
+ if (!(!x || E || R)) {
371
376
  if (v === "ready")
372
- if (_ <= 0) L("memorize");
377
+ if (_ <= 0) A("memorize");
373
378
  else {
374
- const e = setTimeout(() => K((o) => o - 1), 1e3);
379
+ const e = setTimeout(() => K((t) => t - 1), 1e3);
375
380
  return () => clearTimeout(e);
376
381
  }
377
382
  if (v === "memorize")
378
- if (E <= 0) L("guess");
383
+ if (F <= 0) A("guess");
379
384
  else {
380
- const e = setTimeout(() => j((o) => o - 1), 1e3);
385
+ const e = setTimeout(() => $((t) => t - 1), 1e3);
381
386
  return () => clearTimeout(e);
382
387
  }
383
388
  if (v === "guess") {
384
- if (F <= 0) {
385
- N(!0), H("wrong");
386
- const o = b[y].name;
387
- O((m) => [
388
- ...m,
389
- { round: h, answer: W, correct: o, result: "wrong" }
389
+ if (G <= 0) {
390
+ O(!0), H("wrong");
391
+ const t = b[y].name;
392
+ Y((c) => [
393
+ ...c,
394
+ { round: f, answer: W, correct: t, result: "wrong" }
390
395
  ]);
391
396
  return;
392
397
  }
393
- const e = setTimeout(() => J((o) => o - 1), 1e3);
398
+ const e = setTimeout(() => J((t) => t - 1), 1e3);
394
399
  return () => clearTimeout(e);
395
400
  }
396
401
  }
397
- }, [v, _, E, F, x, A, R, b, y, h, W]);
402
+ }, [v, _, F, G, x, E, R, b, y, f, W]);
398
403
  const fe = () => {
399
- if (y === null || D) return;
400
- const e = b[y].name, o = W.toLowerCase().trim();
401
- let m = "wrong";
402
- o === e ? ($((p) => p + 1), H("correct"), m = "correct") : Re(o, e) === 1 ? ($((p) => p + 0.5), H("almost"), m = "almost") : (H("wrong"), m = "wrong"), O((p) => [...p, { round: h, answer: o, correct: e, result: m }]), X(!0), setTimeout(() => {
403
- X(!1), N(!0);
404
+ if (y === null || q) return;
405
+ const e = b[y].name, t = W.toLowerCase().trim();
406
+ let c = "wrong";
407
+ t === e ? (N((g) => g + 1), H("correct"), c = "correct") : Re(t, e) === 1 ? (N((g) => g + 0.5), H("almost"), c = "almost") : (H("wrong"), c = "wrong"), Y((g) => [...g, { round: f, answer: t, correct: e, result: c }]), X(!0), setTimeout(() => {
408
+ X(!1), O(!0);
404
409
  }, 600);
405
- }, pe = () => h < l ? (T((e) => e + 1), ie()) : G(!0), ye = () => {
406
- k(!1), G(!1), S(null);
410
+ }, pe = () => f < l ? (T((e) => e + 1), ie()) : D(!0), ye = () => {
411
+ k(!1), D(!1), S(null);
407
412
  }, we = P(
408
- () => /* @__PURE__ */ n("div", { style: { ...t.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ a("picture", { children: [
409
- /* @__PURE__ */ n(
413
+ () => /* @__PURE__ */ o("div", { style: { ...n.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ a("picture", { children: [
414
+ /* @__PURE__ */ o(
410
415
  "source",
411
416
  {
412
417
  srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg",
413
418
  type: "image/svg+xml"
414
419
  }
415
420
  ),
416
- /* @__PURE__ */ n(
421
+ /* @__PURE__ */ o(
417
422
  "img",
418
423
  {
419
424
  src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png",
420
425
  alt: "SPEAKID Logo",
421
- style: t.gmLogoImg,
426
+ style: n.gmLogoImg,
422
427
  loading: "lazy"
423
428
  }
424
429
  )
425
430
  ] }) }),
426
431
  []
427
- ), re = 1200, se = 700, q = P(() => {
428
- const e = r ?? (typeof window < "u" ? window.innerWidth : re), o = u ?? (typeof window < "u" ? window.innerHeight : se), m = Math.min(e / re, o / se);
429
- return Math.min(1.35, Math.max(1, m));
430
- }, [r, u, f]);
431
- return /* @__PURE__ */ n(
432
+ ), re = 1200, se = 700, Z = P(() => {
433
+ const e = r ?? (typeof window < "u" ? window.innerWidth : re), t = u ?? (typeof window < "u" ? window.innerHeight : se), c = Math.min(e / re, t / se);
434
+ return Math.min(1.35, Math.max(1, c));
435
+ }, [r, u, p]);
436
+ return /* @__PURE__ */ o(
432
437
  "div",
433
438
  {
434
439
  ref: i,
@@ -449,18 +454,18 @@ function Be({
449
454
  scale: "1 !important"
450
455
  // ✅ на случай если transform тянется сверху
451
456
  },
452
- children: /* @__PURE__ */ n(
457
+ children: /* @__PURE__ */ o(
453
458
  "div",
454
459
  {
455
- ref: g,
460
+ ref: h,
456
461
  style: {
457
- width: f ? "100%" : `${B}px`,
458
- height: f ? "100%" : `${B}px`,
459
- borderRadius: f ? 0 : "20px",
462
+ width: p ? "100%" : `${L}px`,
463
+ height: p ? "100%" : `${L}px`,
464
+ borderRadius: p ? 0 : "20px",
460
465
  background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
461
466
  position: "relative",
462
467
  overflow: "hidden",
463
- boxShadow: f ? "none" : "0 0 40px rgba(0,0,0,0.08)",
468
+ boxShadow: p ? "none" : "0 0 40px rgba(0,0,0,0.08)",
464
469
  display: "flex",
465
470
  justifyContent: "center",
466
471
  alignItems: "center"
@@ -470,78 +475,78 @@ function Be({
470
475
  {
471
476
  id: "whats-missing-root",
472
477
  style: {
473
- transform: `scale(${q})`,
478
+ transform: `scale(${Z})`,
474
479
  transformOrigin: "center center",
475
480
  transition: "transform 0.2s ease-out",
476
- width: `${100 / q}%`,
477
- height: `${100 / q}%`,
481
+ width: `${100 / Z}%`,
482
+ height: `${100 / Z}%`,
478
483
  display: "flex",
479
484
  flexDirection: "column",
480
485
  justifyContent: "center",
481
486
  alignItems: "center"
482
487
  },
483
488
  children: [
484
- !f && we,
485
- !w && !x && /* @__PURE__ */ a("div", { style: t.gmCenterScreen, children: [
486
- /* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
487
- /* @__PURE__ */ n("p", { style: t.gmBodyM, children: "Select a theme:" }),
488
- /* @__PURE__ */ n("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ n("button", { style: t.gmButton, onClick: () => S(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
489
+ !p && we,
490
+ !w && !x && /* @__PURE__ */ a("div", { style: n.gmCenterScreen, children: [
491
+ /* @__PURE__ */ o("h1", { style: n.gmHeadline1, children: "WHAT'S MISSING?" }),
492
+ /* @__PURE__ */ o("p", { style: n.gmBodyM, children: "Select a theme:" }),
493
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ o("button", { style: n.gmButton, onClick: () => S(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
489
494
  /* @__PURE__ */ a("div", { style: { marginTop: 24 }, children: [
490
- /* @__PURE__ */ n("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
491
- /* @__PURE__ */ n("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ n(
495
+ /* @__PURE__ */ o("p", { style: n.gmBodyS, children: "Choose number of rounds:" }),
496
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ o(
492
497
  "button",
493
498
  {
494
499
  style: {
495
- ...t.gmButton,
496
- ...l === e ? t.gmButtonActive : {}
500
+ ...n.gmButton,
501
+ ...l === e ? n.gmButtonActive : {}
497
502
  },
498
- onClick: () => C(e),
503
+ onClick: () => z(e),
499
504
  children: e
500
505
  },
501
506
  e
502
507
  )) })
503
508
  ] })
504
509
  ] }),
505
- w && !x && /* @__PURE__ */ a("div", { style: t.gmCenterScreen, children: [
506
- /* @__PURE__ */ a("h1", { style: t.gmHeadline1, children: [
510
+ w && !x && /* @__PURE__ */ a("div", { style: n.gmCenterScreen, children: [
511
+ /* @__PURE__ */ a("h1", { style: n.gmHeadline1, children: [
507
512
  "Theme selected: ",
508
513
  w
509
514
  ] }),
510
- /* @__PURE__ */ a("p", { style: t.gmBodyM, children: [
515
+ /* @__PURE__ */ a("p", { style: n.gmBodyM, children: [
511
516
  "Rounds: ",
512
517
  l
513
518
  ] }),
514
- /* @__PURE__ */ n("button", { style: t.gmButton, onClick: oe, children: "▶ Start game" })
519
+ /* @__PURE__ */ o("button", { style: n.gmButton, onClick: oe, children: "▶ Start game" })
515
520
  ] }),
516
- A && /* @__PURE__ */ a("div", { style: t.gmCenterScreen, children: [
517
- /* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "Results" }),
518
- /* @__PURE__ */ a("h2", { style: t.gmHeadline3, children: [
521
+ E && /* @__PURE__ */ a("div", { style: n.gmCenterScreen, children: [
522
+ /* @__PURE__ */ o("h1", { style: n.gmHeadline1, children: "Results" }),
523
+ /* @__PURE__ */ a("h2", { style: n.gmHeadline3, children: [
519
524
  "Your score: ",
520
525
  me,
521
526
  " / ",
522
527
  l
523
528
  ] }),
524
- /* @__PURE__ */ n("p", { style: { ...t.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
525
- /* @__PURE__ */ a("table", { style: t.gmTable, children: [
526
- /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ a("tr", { children: [
527
- /* @__PURE__ */ n("th", { children: "Round" }),
528
- /* @__PURE__ */ n("th", { children: "Your Answer" }),
529
- /* @__PURE__ */ n("th", { children: "Correct" }),
530
- /* @__PURE__ */ n("th", { children: "Result" })
529
+ /* @__PURE__ */ o("p", { style: { ...n.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
530
+ /* @__PURE__ */ a("table", { style: n.gmTable, children: [
531
+ /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ a("tr", { children: [
532
+ /* @__PURE__ */ o("th", { children: "Round" }),
533
+ /* @__PURE__ */ o("th", { children: "Your Answer" }),
534
+ /* @__PURE__ */ o("th", { children: "Correct" }),
535
+ /* @__PURE__ */ o("th", { children: "Result" })
531
536
  ] }) }),
532
- /* @__PURE__ */ n("tbody", { children: ue.map((e, o) => /* @__PURE__ */ a("tr", { children: [
533
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.round }),
534
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.answer || "—" }),
535
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.correct }),
536
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
537
- ] }, o)) })
537
+ /* @__PURE__ */ o("tbody", { children: ue.map((e, t) => /* @__PURE__ */ a("tr", { children: [
538
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.round }),
539
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.answer || "—" }),
540
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.correct }),
541
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
542
+ ] }, t)) })
538
543
  ] }),
539
544
  /* @__PURE__ */ a("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
540
- /* @__PURE__ */ n("button", { style: t.gmButton, onClick: oe, children: "🔁 Play again" }),
541
- /* @__PURE__ */ n("button", { style: t.gmButton, onClick: ye, children: "⬅️ Choose theme" })
545
+ /* @__PURE__ */ o("button", { style: n.gmButton, onClick: oe, children: "🔁 Play again" }),
546
+ /* @__PURE__ */ o("button", { style: n.gmButton, onClick: ye, children: "⬅️ Choose theme" })
542
547
  ] })
543
548
  ] }),
544
- x && !A && /* @__PURE__ */ a("div", { style: t.gmGameLayout, children: [
549
+ x && !E && /* @__PURE__ */ a("div", { style: n.gmGameLayout, children: [
545
550
  /* @__PURE__ */ a(
546
551
  "div",
547
552
  {
@@ -554,53 +559,53 @@ function Be({
554
559
  },
555
560
  children: [
556
561
  v === "ready" && /* @__PURE__ */ a(be, { children: [
557
- /* @__PURE__ */ n("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
558
- /* @__PURE__ */ n("div", { style: t.gmHourglass, children: "⏳" })
562
+ /* @__PURE__ */ o("h1", { style: { ...n.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
563
+ /* @__PURE__ */ o("div", { style: n.gmHourglass, children: "⏳" })
559
564
  ] }),
560
- v === "memorize" && /* @__PURE__ */ a("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
565
+ v === "memorize" && /* @__PURE__ */ a("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
561
566
  "MEMORIZE (",
562
- E,
567
+ F,
563
568
  ")"
564
569
  ] }),
565
- v === "guess" && !R && /* @__PURE__ */ a("p", { style: t.gmBodyM, children: [
570
+ v === "guess" && !R && /* @__PURE__ */ a("p", { style: n.gmBodyM, children: [
566
571
  "⏳ Time left: ",
567
- F,
572
+ G,
568
573
  "s"
569
574
  ] })
570
575
  ]
571
576
  }
572
577
  ),
573
- v !== "ready" && /* @__PURE__ */ n(
578
+ v !== "ready" && /* @__PURE__ */ o(
574
579
  "div",
575
580
  {
576
581
  style: {
577
- ...t.gmGrid,
582
+ ...n.gmGrid,
578
583
  display: "grid",
579
- gridTemplateColumns: `repeat(${f ? 2 : 3}, 1fr)`,
580
- gridTemplateRows: `repeat(${f ? 3 : 2}, 1fr)`,
581
- gap: f ? 12 : 20,
584
+ gridTemplateColumns: `repeat(${p ? 2 : 3}, 1fr)`,
585
+ gridTemplateRows: `repeat(${p ? 3 : 2}, 1fr)`,
586
+ gap: p ? 12 : 20,
582
587
  justifyContent: "center",
583
588
  alignContent: "center",
584
- padding: f ? 8 : 16,
589
+ padding: p ? 8 : 16,
585
590
  width: "100%",
586
591
  height: "100%",
587
- maxWidth: f ? "100%" : 600,
588
- maxHeight: f ? "100%" : 400,
592
+ maxWidth: p ? "100%" : 600,
593
+ maxHeight: p ? "100%" : 400,
589
594
  boxSizing: "border-box"
590
595
  },
591
- children: b.map((e, o) => {
592
- const m = y === o && v === "guess" && !R;
593
- return /* @__PURE__ */ n(
596
+ children: b.map((e, t) => {
597
+ const c = y === t && v === "guess" && !R;
598
+ return /* @__PURE__ */ o(
594
599
  "div",
595
600
  {
596
601
  style: {
597
- ...t.gmCard,
602
+ ...n.gmCard,
598
603
  width: "100%",
599
604
  height: "100%",
600
- ...ee === "correct" && y === o ? t.gmCorrect : {},
601
- ...ee === "wrong" && y === o ? t.gmWrong : {}
605
+ ...ee === "correct" && y === t ? n.gmCorrect : {},
606
+ ...ee === "wrong" && y === t ? n.gmWrong : {}
602
607
  },
603
- children: !m && /* @__PURE__ */ n(
608
+ children: !c && /* @__PURE__ */ o(
604
609
  "img",
605
610
  {
606
611
  src: e.src,
@@ -614,34 +619,34 @@ function Be({
614
619
  }
615
620
  )
616
621
  },
617
- o
622
+ t
618
623
  );
619
624
  })
620
625
  }
621
626
  ),
622
627
  /* @__PURE__ */ a("div", { style: { marginTop: 16, height: 80 }, children: [
623
628
  v === "guess" && !R && /* @__PURE__ */ a("div", { children: [
624
- /* @__PURE__ */ n(
629
+ /* @__PURE__ */ o(
625
630
  "input",
626
631
  {
627
632
  type: "text",
628
633
  placeholder: "Type the missing word",
629
634
  value: W,
630
635
  onChange: (e) => Q(e.target.value),
631
- style: t.gmInput
636
+ style: n.gmInput
632
637
  }
633
638
  ),
634
- /* @__PURE__ */ n(
639
+ /* @__PURE__ */ o(
635
640
  "button",
636
641
  {
637
- style: { ...t.gmButton, marginLeft: 8 },
642
+ style: { ...n.gmButton, marginLeft: 8 },
638
643
  onClick: fe,
639
- disabled: D,
640
- children: D ? "..." : "Check"
644
+ disabled: q,
645
+ children: q ? "..." : "Check"
641
646
  }
642
647
  )
643
648
  ] }),
644
- R && /* @__PURE__ */ n("button", { type: "button", style: t.gmButton, onClick: pe, children: "Next round" })
649
+ R && /* @__PURE__ */ o("button", { type: "button", style: n.gmButton, onClick: pe, children: "Next round" })
645
650
  ] })
646
651
  ] })
647
652
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mblinkov/whats-missing",
3
- "version": "20.0.34",
3
+ "version": "20.0.36",
4
4
  "main": "dist/whats-missing.umd.js",
5
5
  "module": "dist/whats-missing.es.js",
6
6
  "types": "dist/index.d.ts",
package/src/Game.tsx CHANGED
@@ -3,6 +3,7 @@ import { themes } from "./themes";
3
3
  import { styles } from "./Game.styles";
4
4
  import type { Theme } from "./themes";
5
5
 
6
+
6
7
  type ImageItem = { src: string; name: string };
7
8
  type RoundResult = {
8
9
  round: number;
@@ -159,6 +160,28 @@ export default function Game({
159
160
  const [squareSize, setSquareSize] = useState<number | null>(null);
160
161
  useNeutralizeBodyZoom(containerRef, { minDesktopWidth: 1024, forceResize: false });
161
162
 
163
+ useEffect(() => {
164
+ const b = document.body;
165
+ const h = document.documentElement;
166
+
167
+ const oldBodyZoom = b.style.zoom;
168
+ const oldBodyTransform = b.style.transform;
169
+ const oldHtmlZoom = h.style.zoom;
170
+ const oldHtmlTransform = h.style.transform;
171
+
172
+ b.style.zoom = "1";
173
+ b.style.transform = "none";
174
+ h.style.zoom = "1";
175
+ h.style.transform = "none";
176
+
177
+ return () => {
178
+ b.style.zoom = oldBodyZoom;
179
+ b.style.transform = oldBodyTransform;
180
+ h.style.zoom = oldHtmlZoom;
181
+ h.style.transform = oldHtmlTransform;
182
+ };
183
+ }, []);
184
+
162
185
  // ✅ защита от слишком маленьких размеров игры
163
186
  const effectiveGameCubeSize = useMemo(() => {
164
187
  const baseSize = gameCubeSize ?? Math.min(screenWidth ?? 1000, screenHeight ?? 1000);