speakid-hangman 1.0.3 → 1.0.4
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,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),l=require("react"),a={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",fontFamily:'"Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',background:"transparent"},gmHeadline1:{fontWeight:600,fontSize:"clamp(30px, 4vw, 32px)",lineHeight:"110%",marginBottom:"24px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmHeadline3:{fontWeight:500,fontSize:"clamp(16px, 2vw, 24px)",lineHeight:"110%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyL:{fontWeight:400,fontSize:"18px",lineHeight:"120%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyM:{fontWeight:400,fontSize:"clamp(14px, 1.5vw, 16px)",lineHeight:"120%",marginBottom:"8px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyS:{fontWeight:400,fontSize:"clamp(12px, 1.5vw, 14px)",lineHeight:"120%",color:"#6b7280",marginBottom:"8px",fontFamily:'"Onest", system-ui, sans-serif'},gmButton:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:400,fontSize:"16px",lineHeight:"100%",padding:"10px 16px",borderRadius:"8px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"none",transition:"background-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease",margin:"4px"},gmButtonSecondary:{background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",boxShadow:"none"},gmButtonGroup:{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center",marginBottom:"24px"},gmWordDisplay:{fontSize:"clamp(20px, 5vw, 28px)",fontWeight:500,letterSpacing:"6px",margin:"32px 0",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmGuessedLetters:{fontSize:"clamp(12px, 1.5vw, 16px)",color:"#6b7280",marginTop:"16px",minHeight:"24px",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmStatusWin:{color:"#10b981",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmStatusLose:{color:"#ec4c44",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmInfoBox:{background:"#f9f9f9",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",marginBottom:"24px",maxWidth:"500px",width:"100%",boxShadow:"none"},gmLogoFixed:{position:"absolute",top:"16px",left:"16px",width:"auto",zIndex:10,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"28px",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased",display:"block"}};function ke({mistakes:r,maxMistakes:P,size:O=200}){const c=O,g=O*1.25,f=Math.max(2,O/100),F=10*(c/200),y=240*(g/250),h=150*(c/200),x=80*(c/200),V=20*(g/250),X=240*(g/250),k=80*(c/200),D=20*(g/250),M=150*(c/200),L=150*(c/200),w=20*(g/250),T=50*(g/250),$=150*(c/200),B=70*(g/250),G=20*(c/200),S=150*(c/200),U=90*(g/250),I=150*(g/250),m=150*(c/200),j=110*(g/250),u=130*(c/200),z=130*(g/250),Z=150*(c/200),C=110*(g/250),se=170*(c/200),v=130*(g/250),q=150*(c/200),Q=150*(g/250),p=130*(c/200),K=190*(g/250),W=150*(c/200),J=150*(g/250),i=170*(c/200),E=190*(g/250),d=r===0||r<=P*.5?"#1f2937":r<=P*.75?"#f59e0b":"#ec4c44";return t.jsxs("svg",{width:c,height:g,style:{display:"block",margin:"0 auto"},children:[r>0&&t.jsx("line",{x1:F,y1:y,x2:h,y2:y,stroke:d,strokeWidth:f}),r>1&&t.jsx("line",{x1:x,y1:V,x2:x,y2:X,stroke:d,strokeWidth:f}),r>2&&t.jsx("line",{x1:k,y1:D,x2:M,y2:D,stroke:d,strokeWidth:f}),r>3&&t.jsx("line",{x1:L,y1:w,x2:L,y2:T,stroke:d,strokeWidth:f}),r>4&&t.jsx("circle",{cx:$,cy:B,r:G,stroke:d,fill:"none",strokeWidth:f}),r>5&&t.jsx("line",{x1:S,y1:U,x2:S,y2:I,stroke:d,strokeWidth:f}),r>6&&t.jsx("line",{x1:m,y1:j,x2:u,y2:z,stroke:d,strokeWidth:f}),r>7&&t.jsx("line",{x1:Z,y1:C,x2:se,y2:v,stroke:d,strokeWidth:f}),r>8&&t.jsx("line",{x1:q,y1:Q,x2:p,y2:K,stroke:d,strokeWidth:f}),r>9&&t.jsx("line",{x1:W,y1:J,x2:i,y2:E,stroke:d,strokeWidth:f})]})}function re({gameCubeSize:r=400,screenHeight:P=800,screenWidth:O=800,logoUrl:c,showLogo:g=!0,baseURL:f}={}){const F={Professions:["teacher","doctor","nurse","driver","police","firefighter","cook","waiter","farmer","builder","singer","actor","dentist","pilot","vet","artist","cleaner","student","baker","mechanic"],Family:["mother","father","sister","brother","grandmother","grandfather","aunt","uncle","cousin","baby","parents","children","wife","husband","son","daughter","family","twins","relatives"],"Farm animals":["cow","pig","horse","sheep","goat","duck","chicken","rooster","turkey","goose","rabbit","mouse","donkey","bee","hen","lamb","bull","pony"],Food:["apple","banana","bread","cheese","milk","egg","rice","soup","fish","meat","potato","carrot","tomato","cucumber","butter","cake","salad","pasta","pizza","juice"],Hobbies:["reading","drawing","painting","dancing","singing","cooking","swimming","fishing","running","cycling","skating","writing","camping","photography","hiking","games"],Christmas:["tree","present","gift","santa","snow","snowman","bell","star","lights","card","cookies","elf","sleigh","reindeer","candle","stocking"],Halloween:["pumpkin","costume","candy","ghost","witch","spider","bat","skeleton","mask","monster","mummy","cat","broom","zombie","trick","treat","candle","night","party"],Sport:["football","basketball","tennis","swimming","running","baseball","skiing","skating","volleyball","hockey","golf","boxing","cycling","rugby","karate","yoga","surfing","climbing","dancing","gym","chess"],"Body parts":["head","hair","eyes","ears","nose","mouth","teeth","tongue","neck","shoulder","arm","hand","finger","leg","knee","foot","toe","back","stomach","heart","legs","nails","chin","beard"],"School subjects":["math","english","history","geography","art","music","science","biology","chemistry","physics","pe","literature","drama","design","economics"],Animals:["cat","dog","rabbit","elephant","lion","tiger","monkey","bear","fox","wolf","giraffe","zebra","crocodile","dolphin","whale","shark","frog","parrot","mouse","penguin","deer","lizard","turtle","snake"],Countries:["russia","canada","china","japan","france","germany","italy","spain","brazil","india","australia","america","england","korea","mexico","egypt","turkey","vietnam","norway","finland","thailand","georgia","kazakhstan"],Clothes:["shirt","dress","skirt","trousers","jeans","coat","jacket","sweater","socks","shoes","boots","hat","scarf","gloves","shorts","cap","belt","tie","uniform","pants","underwear"],Traveling:["ticket","luggage","suitcase","airport","flight","passport","visa","map","guide","hotel","reservation","bus","train","taxi","tourist","sightseeing","backpack","journey","adventure","beach","tour","souvenir"],Environment:["tree","forest","air","water","pollution","recycle","nature","clean","waste","plastic","energy","animal","climate","earth","ocean","river","planet","save","green","environment","litter","organic"],Space:["planet","star","sun","moon","astronaut","rocket","space","galaxy","universe","telescope","comet","asteroid","orbit","gravity","alien","spaceship","mars","satellite","sky","eclipse"],Devices:["computer","laptop","phone","tablet","tv","keyboard","mouse","printer","camera","headphones","charger","screen","watch","microphone","speaker","console","router","battery","cable","remote"]},[y,h]=l.useState("lobby"),[x,V]=l.useState(""),[X]=l.useState("Normal"),[k,D]=l.useState(0),[M,L]=l.useState(1),[w,T]=l.useState(""),[$,B]=l.useState([]),[G,S]=l.useState(0),[U,I]=l.useState(0),[m,j]=l.useState(null),[u,z]=l.useState(null),[Z,C]=l.useState(1),[se,v]=l.useState([]),q=X==="Easy"?8:X==="Normal"?6:4,Q=f||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman`:"/cloud/speakid/games/hangman"),[p,K]=l.useState(!1),[W,J]=l.useState(!1),i=l.useMemo(()=>{const e=(u||r||1e3)/400;return{headline1:p?Math.max(24,Math.min(30,30*e)):Math.max(28,Math.min(32,32*e)),headline2:Math.max(20,Math.min(28,24*e)),headline3:p?Math.max(14,Math.min(18,16*e)):Math.max(20,Math.min(26,24*e)),bodyL:Math.max(14,Math.min(20,18*e)),bodyM:p?Math.max(12,Math.min(16,14*e)):Math.max(14,Math.min(18,16*e)),bodyS:p?Math.max(10,Math.min(14,12*e)):Math.max(12,Math.min(16,14*e)),wordDisplay:Math.max(18,Math.min(32,26*e)),button:Math.max(12,Math.min(18,16*e))}},[p,u,r]),E=l.useMemo(()=>{const e=(u||r||1e3)/400;return W?Math.max(8,Math.min(12,10*e)):Math.max(12,Math.min(24,16*e))},[W,u,r]),o=l.useMemo(()=>{const e=(u||r||1e3)/400;return W?Math.max(3,Math.min(6,5*e)):Math.max(4,Math.min(12,8*e))},[W,u,r]),d=l.useMemo(()=>{const e=(u||r||1e3)/400;return Math.max(6,Math.min(10,8*e))},[u,r]),de=(e,n)=>e.split("").every(s=>n.includes(s)),ge=(e,n)=>e.split("").map(s=>n.includes(s)?s:"_").join(" "),ue=e=>"abcdefghijklmnopqrstuvwxyz".split("").filter(s=>!e.includes(s)),_=(e,n=[])=>{var N;if(!e||!F[e]){const b=Object.keys(F)[0];return((N=F[b])==null?void 0:N[0])||""}const s=F[e];if(!s||s.length===0)return"";const H=s.filter(b=>!n.includes(b)),R=H.length>0?H:s;if(R.length===0)return"";let A;if(typeof crypto<"u"&&crypto.getRandomValues){const b=new Uint32Array(1);crypto.getRandomValues(b);const ce=b[0]/4294967295;A=Math.floor(ce*R.length)}else A=Math.floor(Math.random()*R.length);return R[A]},pe=()=>{if(!x)return;v([]);const e=_(x,[]);if(!e){h("category");return}T(e),v([e]),B([]),S(0),L(1),I(0),j(null),h("game")},ee=l.useCallback(e=>{if(y!=="game"||m!==null)return;const n=e.toLowerCase();/^[a-z]$/.test(n)&&(B(s=>s.includes(n)?s:[...s,n]),T(s=>(s&&!s.includes(n)&&S(H=>H+1),s)))},[y,m]),te=l.useCallback(e=>{ee(e.key)},[ee]);l.useEffect(()=>{if(y==="game")return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[y,te]);const me=w?ge(w,$):"",ie=w?de(w,$):!1,ae=G>=10,he=ue($),ne=l.useCallback(()=>{if(!x||M>=k){h("result");return}L(e=>e+1),v(e=>{const n=_(x,e);return n?(T(n),[...e,n]):e}),B([]),S(0),j(null)},[x,M,k]);l.useEffect(()=>{if(ie&&m===null){j("win"),I(n=>n+1);const e=setTimeout(()=>{ne()},2e3);return()=>clearTimeout(e)}if(ae&&m===null){j("lose");const e=setTimeout(()=>{ne()},2e3);return()=>clearTimeout(e)}},[ie,ae,m,ne]);const xe=()=>{if(!x||M>=k){h("result");return}L(e=>e+1),v(e=>{const n=_(x,e);return n?(T(n),[...e,n]):e}),B([]),S(0),j(null)};l.useEffect(()=>{const e=()=>{const n=window.innerWidth,s=window.innerHeight,H=n<768||n===926&&s===428||n===932&&s===430,R=s<700,A=n/s>1.8,N=n===1024&&s===600;if(K(H),J(N),r&&r>=320){const be=Math.max(320,Math.min(1200,r));z(be),C(1)}else if(H)z(null),C(1);else if(R)z(null),C(1);else if(A){const b=Math.min(1e3,Math.min(n,s)*.9);z(b),C(.85)}else{const b=Math.min(1e3,Math.min(n,s)*.9);z(b),C(1)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const oe=`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),l=require("react"),a={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",fontFamily:'"Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',background:"transparent"},gmHeadline1:{fontWeight:600,fontSize:"clamp(30px, 4vw, 32px)",lineHeight:"110%",marginBottom:"24px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmHeadline3:{fontWeight:500,fontSize:"clamp(16px, 2vw, 24px)",lineHeight:"110%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyL:{fontWeight:400,fontSize:"18px",lineHeight:"120%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyM:{fontWeight:400,fontSize:"clamp(14px, 1.5vw, 16px)",lineHeight:"120%",marginBottom:"8px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyS:{fontWeight:400,fontSize:"clamp(12px, 1.5vw, 14px)",lineHeight:"120%",color:"#6b7280",marginBottom:"8px",fontFamily:'"Onest", system-ui, sans-serif'},gmButton:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:400,fontSize:"16px",lineHeight:"100%",padding:"10px 16px",borderRadius:"8px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"none",transition:"background-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease",margin:"4px"},gmButtonSecondary:{background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",boxShadow:"none"},gmButtonGroup:{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center",marginBottom:"24px"},gmWordDisplay:{fontSize:"clamp(20px, 5vw, 28px)",fontWeight:500,letterSpacing:"6px",margin:"32px 0",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmGuessedLetters:{fontSize:"clamp(12px, 1.5vw, 16px)",color:"#6b7280",marginTop:"16px",minHeight:"24px",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmStatusWin:{color:"#10b981",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmStatusLose:{color:"#ec4c44",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmInfoBox:{background:"#f9f9f9",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",marginBottom:"24px",maxWidth:"500px",width:"100%",boxShadow:"none"},gmLogoFixed:{position:"absolute",top:"16px",left:"16px",width:"auto",zIndex:10,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"28px",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased",display:"block"}};function ke({mistakes:r,maxMistakes:N,size:A=200}){const c=A,g=A*1.25,f=Math.max(2,A/100),F=10*(c/200),y=240*(g/250),h=150*(c/200),x=80*(c/200),P=20*(g/250),O=240*(g/250),k=80*(c/200),X=20*(g/250),M=150*(c/200),L=150*(c/200),w=20*(g/250),T=50*(g/250),S=150*(c/200),B=70*(g/250),D=20*(c/200),$=150*(c/200),V=90*(g/250),I=150*(g/250),m=150*(c/200),j=110*(g/250),u=130*(c/200),z=130*(g/250),U=150*(c/200),C=110*(g/250),se=170*(c/200),v=130*(g/250),Z=150*(c/200),G=150*(g/250),p=130*(c/200),q=190*(g/250),W=150*(c/200),K=150*(g/250),i=170*(c/200),J=190*(g/250),d=r===0||r<=N*.5?"#1f2937":r<=N*.75?"#f59e0b":"#ec4c44";return t.jsxs("svg",{width:c,height:g,style:{display:"block",margin:"0 auto"},children:[r>0&&t.jsx("line",{x1:F,y1:y,x2:h,y2:y,stroke:d,strokeWidth:f}),r>1&&t.jsx("line",{x1:x,y1:P,x2:x,y2:O,stroke:d,strokeWidth:f}),r>2&&t.jsx("line",{x1:k,y1:X,x2:M,y2:X,stroke:d,strokeWidth:f}),r>3&&t.jsx("line",{x1:L,y1:w,x2:L,y2:T,stroke:d,strokeWidth:f}),r>4&&t.jsx("circle",{cx:S,cy:B,r:D,stroke:d,fill:"none",strokeWidth:f}),r>5&&t.jsx("line",{x1:$,y1:V,x2:$,y2:I,stroke:d,strokeWidth:f}),r>6&&t.jsx("line",{x1:m,y1:j,x2:u,y2:z,stroke:d,strokeWidth:f}),r>7&&t.jsx("line",{x1:U,y1:C,x2:se,y2:v,stroke:d,strokeWidth:f}),r>8&&t.jsx("line",{x1:Z,y1:G,x2:p,y2:q,stroke:d,strokeWidth:f}),r>9&&t.jsx("line",{x1:W,y1:K,x2:i,y2:J,stroke:d,strokeWidth:f})]})}function re({gameCubeSize:r=400,screenHeight:N=800,screenWidth:A=800,logoUrl:c,showLogo:g=!0,baseURL:f}={}){const F={Professions:["teacher","doctor","nurse","driver","police","firefighter","cook","waiter","farmer","builder","singer","actor","dentist","pilot","vet","artist","cleaner","student","baker","mechanic"],Family:["mother","father","sister","brother","grandmother","grandfather","aunt","uncle","cousin","baby","parents","children","wife","husband","son","daughter","family","twins","relatives"],"Farm animals":["cow","pig","horse","sheep","goat","duck","chicken","rooster","turkey","goose","rabbit","mouse","donkey","bee","hen","lamb","bull","pony"],Food:["apple","banana","bread","cheese","milk","egg","rice","soup","fish","meat","potato","carrot","tomato","cucumber","butter","cake","salad","pasta","pizza","juice"],Hobbies:["reading","drawing","painting","dancing","singing","cooking","swimming","fishing","running","cycling","skating","writing","camping","photography","hiking","games"],Christmas:["tree","present","gift","santa","snow","snowman","bell","star","lights","card","cookies","elf","sleigh","reindeer","candle","stocking"],Halloween:["pumpkin","costume","candy","ghost","witch","spider","bat","skeleton","mask","monster","mummy","cat","broom","zombie","trick","treat","candle","night","party"],Sport:["football","basketball","tennis","swimming","running","baseball","skiing","skating","volleyball","hockey","golf","boxing","cycling","rugby","karate","yoga","surfing","climbing","dancing","gym","chess"],"Body parts":["head","hair","eyes","ears","nose","mouth","teeth","tongue","neck","shoulder","arm","hand","finger","leg","knee","foot","toe","back","stomach","heart","legs","nails","chin","beard"],"School subjects":["math","english","history","geography","art","music","science","biology","chemistry","physics","pe","literature","drama","design","economics"],Animals:["cat","dog","rabbit","elephant","lion","tiger","monkey","bear","fox","wolf","giraffe","zebra","crocodile","dolphin","whale","shark","frog","parrot","mouse","penguin","deer","lizard","turtle","snake"],Countries:["russia","canada","china","japan","france","germany","italy","spain","brazil","india","australia","america","england","korea","mexico","egypt","turkey","vietnam","norway","finland","thailand","georgia","kazakhstan"],Clothes:["shirt","dress","skirt","trousers","jeans","coat","jacket","sweater","socks","shoes","boots","hat","scarf","gloves","shorts","cap","belt","tie","uniform","pants","underwear"],Traveling:["ticket","luggage","suitcase","airport","flight","passport","visa","map","guide","hotel","reservation","bus","train","taxi","tourist","sightseeing","backpack","journey","adventure","beach","tour","souvenir"],Environment:["tree","forest","air","water","pollution","recycle","nature","clean","waste","plastic","energy","animal","climate","earth","ocean","river","planet","save","green","environment","litter","organic"],Space:["planet","star","sun","moon","astronaut","rocket","space","galaxy","universe","telescope","comet","asteroid","orbit","gravity","alien","spaceship","mars","satellite","sky","eclipse"],Devices:["computer","laptop","phone","tablet","tv","keyboard","mouse","printer","camera","headphones","charger","screen","watch","microphone","speaker","console","router","battery","cable","remote"]},[y,h]=l.useState("lobby"),[x,P]=l.useState(""),[O]=l.useState("Normal"),[k,X]=l.useState(0),[M,L]=l.useState(1),[w,T]=l.useState(""),[S,B]=l.useState([]),[D,$]=l.useState(0),[V,I]=l.useState(0),[m,j]=l.useState(null),[u,z]=l.useState(null),[U,C]=l.useState(1),[se,v]=l.useState([]),Z=O==="Easy"?8:O==="Normal"?6:4,G=f||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman`:"/cloud/speakid/games/hangman"),[p,q]=l.useState(!1),[W,K]=l.useState(!1),i=l.useMemo(()=>{const e=(u||r||1e3)/400;return{headline1:p?Math.max(24,Math.min(30,30*e)):Math.max(28,Math.min(32,32*e)),headline2:Math.max(20,Math.min(28,24*e)),headline3:p?Math.max(14,Math.min(18,16*e)):Math.max(20,Math.min(26,24*e)),bodyL:Math.max(14,Math.min(20,18*e)),bodyM:p?Math.max(12,Math.min(16,14*e)):Math.max(14,Math.min(18,16*e)),bodyS:p?Math.max(10,Math.min(14,12*e)):Math.max(12,Math.min(16,14*e)),wordDisplay:Math.max(18,Math.min(32,26*e)),button:Math.max(12,Math.min(18,16*e))}},[p,u,r]),J=l.useMemo(()=>{const e=(u||r||1e3)/400;return W?Math.max(8,Math.min(12,10*e)):Math.max(12,Math.min(24,16*e))},[W,u,r]),o=l.useMemo(()=>{const e=(u||r||1e3)/400;return W?Math.max(3,Math.min(6,5*e)):Math.max(4,Math.min(12,8*e))},[W,u,r]),d=l.useMemo(()=>{const e=(u||r||1e3)/400;return Math.max(6,Math.min(10,8*e))},[u,r]),de=(e,n)=>e.split("").every(s=>n.includes(s)),ge=(e,n)=>e.split("").map(s=>n.includes(s)?s:"_").join(" "),ue=e=>"abcdefghijklmnopqrstuvwxyz".split("").filter(s=>!e.includes(s)),Q=(e,n=[])=>{var _;if(!e||!F[e]){const b=Object.keys(F)[0];return((_=F[b])==null?void 0:_[0])||""}const s=F[e];if(!s||s.length===0)return"";const H=s.filter(b=>!n.includes(b)),R=H.length>0?H:s;if(R.length===0)return"";let Y;if(typeof crypto<"u"&&crypto.getRandomValues){const b=new Uint32Array(1);crypto.getRandomValues(b);const ce=b[0]/4294967295;Y=Math.floor(ce*R.length)}else Y=Math.floor(Math.random()*R.length);return R[Y]},pe=()=>{if(!x)return;v([]);const e=Q(x,[]);if(!e){h("category");return}T(e),v([e]),B([]),$(0),L(1),I(0),j(null),h("game")},ee=l.useCallback(e=>{if(y!=="game"||m!==null)return;const n=e.toLowerCase();/^[a-z]$/.test(n)&&(B(s=>s.includes(n)?s:[...s,n]),T(s=>(s&&!s.includes(n)&&$(H=>H+1),s)))},[y,m]),te=l.useCallback(e=>{ee(e.key)},[ee]);l.useEffect(()=>{if(y==="game")return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[y,te]);const me=w?ge(w,S):"",ie=w?de(w,S):!1,ae=D>=10,he=ue(S),ne=l.useCallback(()=>{if(!x||M>=k){h("result");return}L(e=>e+1),v(e=>{const n=Q(x,e);return n?(T(n),[...e,n]):e}),B([]),$(0),j(null)},[x,M,k]);l.useEffect(()=>{if(ie&&m===null){j("win"),I(n=>n+1);const e=setTimeout(()=>{ne()},2e3);return()=>clearTimeout(e)}if(ae&&m===null){j("lose");const e=setTimeout(()=>{ne()},2e3);return()=>clearTimeout(e)}},[ie,ae,m,ne]);const xe=()=>{if(!x||M>=k){h("result");return}L(e=>e+1),v(e=>{const n=Q(x,e);return n?(T(n),[...e,n]):e}),B([]),$(0),j(null)};l.useEffect(()=>{const e=()=>{const n=window.innerWidth,s=window.innerHeight,H=n<768||n===926&&s===428||n===932&&s===430,R=s<700,Y=n/s>1.8,_=n===1024&&s===600;if(q(H),K(_),r&&r>=320){const be=Math.max(320,Math.min(1200,r));z(be),C(1)}else if(H)z(null),C(1);else if(R)z(null),C(1);else if(Y){const b=Math.min(1e3,Math.min(n,s)*.9);z(b),C(.85)}else{const b=Math.min(1e3,Math.min(n,s)*.9);z(b),C(1)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const oe=`
|
|
2
2
|
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" style="position: absolute; top: 0; left: 0; pointer-events: none; opacity: 0.2;">
|
|
3
3
|
<!-- Каракули мелками и фломастерами -->
|
|
4
4
|
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
<path d="M 35% 85% Q 37% 83%, 39% 85% T 43% 85% T 47% 85%"
|
|
43
43
|
fill="none" stroke="#FF4500" stroke-width="3.5" stroke-linecap="round"/>
|
|
44
44
|
</svg>
|
|
45
|
-
`,fe={...a.gmCenterScreen,width:"100%",height:"100%",padding:`${E}px`,overflow:"auto",position:"relative",boxSizing:"border-box",background:"transparent"},le=!p&&g,Y=l.useMemo(()=>{const e=window.innerWidth,n=window.innerHeight;if(p&&e>n||n<700||!le)return null;const s=c||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman/logo`:"/cloud/speakid/games/hangman/logo");return t.jsx("div",{style:{...a.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:`${s}.svg`,type:"image/svg+xml"}),t.jsx("img",{src:`${s}.png`,alt:"SPEAKID Logo",style:a.gmLogoImg,loading:"lazy"})]})})},[p,le,c]),ye=()=>y==="lobby"?t.jsxs(t.Fragment,{children:[Y,t.jsx("div",{dangerouslySetInnerHTML:{__html:oe}}),t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${i.headline1}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:"HANGMAN"}),t.jsxs("button",{onClick:()=>h("category"),style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${i.button}px`,padding:`${o*1.2}px ${o*3}px`,borderRadius:`${d*1.5}px`,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#ec4c44",color:"#ffffff",border:"none",cursor:"pointer",transition:"background 0.2s ease, transform 0.1s ease",boxShadow:"0 2px 8px rgba(236, 76, 68, 0.2)",minWidth:"120px"},onMouseEnter:e=>{e.currentTarget.style.background="#d43a32",e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(236, 76, 68, 0.3)"},onMouseLeave:e=>{e.currentTarget.style.background="#ec4c44",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 2px 8px rgba(236, 76, 68, 0.2)"},onMouseDown:e=>{e.currentTarget.style.transform="translateY(0)"},children:[t.jsx("svg",{width:`${i.button*1.3}px`,height:`${i.button*1.3}px`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",marginRight:`${o}px`},children:t.jsx("path",{d:"M8 5V19L19 12L8 5Z",fill:"#ffffff",stroke:"none"})}),t.jsx("span",{style:{fontWeight:500},children:"PLAY"})]}),t.jsxs("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",pointerEvents:"none",zIndex:0},children:[t.jsx("img",{src:`${Q}/sun.png`,alt:"Sun",style:{position:"absolute",left:p?"-10%":"5%",top:"20%",width:"auto",height:p?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((u||r||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}}),t.jsx("img",{src:`${Q}/character.png`,alt:"Hangman character",style:{position:"absolute",right:p?"5%":"10%",bottom:"10%",width:"auto",height:p?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((u||r||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}})]})]}):y==="category"?t.jsxs(t.Fragment,{children:[Y,t.jsx("div",{dangerouslySetInnerHTML:{__html:oe}}),t.jsx("button",{onClick:()=>h("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,position:"absolute",top:`${E}px`,left:"160px",zIndex:10},children:"←"}),t.jsx("div",{style:{...a.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,marginTop:`${o*4}px`,position:"relative",zIndex:1},children:Object.keys(F).map(e=>t.jsx("button",{onClick:()=>{V(e),h("rounds")},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${i.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${d*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):y==="rounds"?t.jsxs(t.Fragment,{children:[Y,t.jsx("div",{dangerouslySetInnerHTML:{__html:oe}}),t.jsx("button",{onClick:()=>h("category"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,position:"absolute",top:`${E}px`,left:"160px",zIndex:10},children:"←"}),t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${i.headline1}px`,marginBottom:`${o*2}px`,position:"relative",zIndex:1},children:"Choose rounds"}),t.jsx("div",{style:{...a.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:[1,3,5].map(e=>t.jsx("button",{onClick:()=>{D(e),pe()},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${i.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${d*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):y==="game"?t.jsxs(t.Fragment,{children:[Y,t.jsxs("div",{style:{...a.gmInfoBox,padding:`${o*.8}px`,marginBottom:`${o*.5}px`,maxWidth:`${(u||r)*.9}px`},children:[t.jsxs("h3",{style:{...a.gmHeadline3,fontSize:`${i.headline3}px`,marginBottom:`${o*.5}px`},children:["Category: ",x]}),t.jsxs("p",{style:{...a.gmBodyM,fontSize:`${i.bodyM}px`,marginBottom:"0px"},children:["Round ",M," of ",k]})]}),w&&t.jsxs("p",{style:{...a.gmBodyS,fontSize:`${i.bodyS}px`,marginTop:`${o*.5}px`,marginBottom:`${o}px`},children:["I am thinking of a word that is ",t.jsx("strong",{children:w.length})," letters long"]}),t.jsx("div",{style:{margin:`${o}px 0`,display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx(ke,{mistakes:G,maxMistakes:q,size:W?Math.max(80,Math.min(110,(u||r)*.16)):Math.max(100,Math.min(150,(u||r)*.2))})}),t.jsx("div",{style:{...a.gmWordDisplay,fontSize:`${Math.max(16,Math.min(24,i.wordDisplay*.9))}px`,margin:`${o}px 0`,letterSpacing:`${o*.8}px`,minHeight:`${Math.max(16,Math.min(24,i.wordDisplay*.9))*1.2}px`},children:me||"Loading..."}),t.jsxs("div",{style:{...a.gmInfoBox,padding:`${o}px`,marginTop:`${o}px`,marginBottom:`${o}px`,maxWidth:`${(u||r)*.95}px`},children:[t.jsx("p",{style:{...a.gmBodyS,fontSize:`${i.bodyS}px`,marginBottom:`${o}px`,fontWeight:500},children:"Available letters:"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:`${o/3}px`,justifyContent:"center",fontSize:`${Math.max(9,Math.min(12,i.bodyS*.75))}px`,fontFamily:'"Onest", system-ui, sans-serif'},children:he.map(e=>t.jsx("button",{onClick:()=>ee(e),disabled:m!==null,onMouseEnter:n=>{m===null&&(n.currentTarget.style.backgroundColor="#e5e7eb",n.currentTarget.style.cursor="pointer")},onMouseLeave:n=>{m===null&&(n.currentTarget.style.backgroundColor="#f9f9f9",n.currentTarget.style.cursor="pointer")},style:{padding:`${o/4}px ${o/3}px`,borderRadius:`${d*.5}px`,background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",minWidth:`${Math.max(o*1.5,(u||r)*.04)}px`,textAlign:"center",display:"inline-block",cursor:m===null?"pointer":"default",fontFamily:'"Onest", system-ui, sans-serif',fontSize:`${Math.max(9,Math.min(12,i.bodyS*.75))}px`,transition:"background-color 0.2s ease"},children:e},e))})]}),$.length>0&&t.jsx("div",{style:{...a.gmGuessedLetters,fontSize:`${Math.max(10,Math.min(12,i.bodyS*.85))}px`,marginTop:`${o*.5}px`,marginBottom:"2px"},children:t.jsxs("span",{style:{color:"#6b7280"},children:["Guessed letters: ",t.jsx("strong",{children:$.join(", ")})]})}),m==="win"&&t.jsx("div",{style:{...a.gmStatusWin,fontSize:`${i.bodyL}px`,margin:"2px 0"},children:"🎉 You won this round!"}),m==="lose"&&t.jsxs("div",{style:{...a.gmStatusLose,fontSize:`${i.bodyL}px`,margin:"2px 0"},children:["The hangman is complete! The word was: ",t.jsx("strong",{children:w})]}),m!==null&&M<k&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:xe,onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${Math.max(11,Math.min(14,i.button*.85))}px`,padding:`${o*.6}px ${o*1.2}px`,borderRadius:`${d}px`},children:"NEXT"})}),m!==null&&M>=k&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:()=>h("result"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`},children:"View Results →"})}),m===null&&$.length===0&&t.jsx("p",{style:{...a.gmBodyS,fontSize:`${i.bodyS}px`,marginTop:`${o}px`,marginBottom:`${o}px`},children:"Type a letter on your keyboard"})]}):y==="result"?t.jsxs(t.Fragment,{children:[Y,t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${i.headline1}px`,marginBottom:`${o*2}px`},children:"🎊 Game Finished!"}),t.jsxs("p",{style:{...a.gmBodyL,fontSize:`${i.bodyL}px`,marginBottom:`${o*2}px`},children:["You guessed ",t.jsx("strong",{children:U})," out of ",t.jsx("strong",{children:k})," words correctly."]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:`${o}px`,alignItems:"center"},children:[t.jsx("button",{onClick:()=>{if(!x||k===0){h("lobby");return}v([]);const e=_(x,[]);e&&(T(e),v([e]),B([]),S(0),L(1),I(0),j(null),h("game"))},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,minWidth:"200px"},children:"Play again"}),t.jsx("button",{onClick:()=>h("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,minWidth:"200px"},children:"Exit"})]})]}):null;return t.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"transparent",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},children:t.jsx("div",{style:{width:p?"100%":u||r||1e3,height:p?"100%":u||r||1e3,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",borderRadius:p?0:"20px",background:"#ffffff",boxShadow:p?"none":"0 0 40px rgba(0,0,0,0.1)",margin:p?"0 auto":"unset",position:"relative",transform:`scale(${Z})`},children:t.jsx("div",{style:{transform:"translateZ(0)",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx("div",{style:fe,children:ye()})})})})}exports.Game=re;exports.HangmanLobbyGame=re;exports.default=re;
|
|
45
|
+
`,fe={...a.gmCenterScreen,width:"100%",height:"100%",padding:`${J}px`,overflow:"auto",position:"relative",boxSizing:"border-box",background:"transparent"},le=!p&&g,E=l.useMemo(()=>{const e=window.innerWidth,n=window.innerHeight;if(p&&e>n||n<700||!le)return null;const s=c||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman/logo`:"/cloud/speakid/games/hangman/logo");return t.jsx("div",{style:{...a.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:`${s}.svg`,type:"image/svg+xml"}),t.jsx("img",{src:`${s}.png`,alt:"SPEAKID Logo",style:a.gmLogoImg,loading:"lazy"})]})})},[p,le,c]),ye=()=>y==="lobby"?t.jsxs(t.Fragment,{children:[E,t.jsx("div",{dangerouslySetInnerHTML:{__html:oe}}),t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${i.headline1}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:"HANGMAN"}),t.jsxs("button",{onClick:()=>h("category"),style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${i.button}px`,padding:`${o*1.2}px ${o*3}px`,borderRadius:`${d*1.5}px`,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#ec4c44",color:"#ffffff",border:"none",cursor:"pointer",transition:"background 0.2s ease, transform 0.1s ease",boxShadow:"0 2px 8px rgba(236, 76, 68, 0.2)",minWidth:"120px"},onMouseEnter:e=>{e.currentTarget.style.background="#d43a32",e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(236, 76, 68, 0.3)"},onMouseLeave:e=>{e.currentTarget.style.background="#ec4c44",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 2px 8px rgba(236, 76, 68, 0.2)"},onMouseDown:e=>{e.currentTarget.style.transform="translateY(0)"},children:[t.jsx("svg",{width:`${i.button*1.3}px`,height:`${i.button*1.3}px`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",marginRight:`${o}px`},children:t.jsx("path",{d:"M8 5V19L19 12L8 5Z",fill:"#ffffff",stroke:"none"})}),t.jsx("span",{style:{fontWeight:500},children:"PLAY"})]}),t.jsxs("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",pointerEvents:"none",zIndex:0},children:[t.jsx("img",{src:`${G}/sun.png`,alt:"Sun",style:{position:"absolute",left:p?"-10%":"5%",top:"20%",width:"auto",height:p?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((u||r||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}}),t.jsx("img",{src:`${G}/character.png`,alt:"Hangman character",style:{position:"absolute",right:p?"5%":"10%",bottom:"10%",width:"auto",height:p?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((u||r||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}})]})]}):y==="category"?t.jsxs(t.Fragment,{children:[E,t.jsx("div",{dangerouslySetInnerHTML:{__html:oe}}),t.jsx("button",{onClick:()=>h("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,position:"absolute",top:"52px",left:"16px",zIndex:10},children:"←"}),t.jsx("div",{style:{...a.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,marginTop:`${o*4}px`,position:"relative",zIndex:1},children:Object.keys(F).map(e=>t.jsx("button",{onClick:()=>{P(e),h("rounds")},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${i.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${d*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):y==="rounds"?t.jsxs(t.Fragment,{children:[E,t.jsx("div",{dangerouslySetInnerHTML:{__html:oe}}),t.jsx("button",{onClick:()=>h("category"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,position:"absolute",top:"52px",left:"16px",zIndex:10},children:"←"}),t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${i.headline1}px`,marginBottom:`${o*2}px`,position:"relative",zIndex:1},children:"Choose rounds"}),t.jsx("div",{style:{...a.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:[1,3,5].map(e=>t.jsx("button",{onClick:()=>{X(e),pe()},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${i.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${d*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):y==="game"?t.jsxs(t.Fragment,{children:[E,t.jsxs("div",{style:{...a.gmInfoBox,padding:`${o*.8}px`,marginBottom:`${o*.5}px`,maxWidth:`${(u||r)*.9}px`},children:[t.jsxs("h3",{style:{...a.gmHeadline3,fontSize:`${i.headline3}px`,marginBottom:`${o*.5}px`},children:["Category: ",x]}),t.jsxs("p",{style:{...a.gmBodyM,fontSize:`${i.bodyM}px`,marginBottom:"0px"},children:["Round ",M," of ",k]})]}),w&&t.jsxs("p",{style:{...a.gmBodyS,fontSize:`${i.bodyS}px`,marginTop:`${o*.5}px`,marginBottom:`${o}px`},children:["I am thinking of a word that is ",t.jsx("strong",{children:w.length})," letters long"]}),t.jsx("div",{style:{margin:`${o}px 0`,display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx(ke,{mistakes:D,maxMistakes:Z,size:W?Math.max(80,Math.min(110,(u||r)*.16)):Math.max(100,Math.min(150,(u||r)*.2))})}),t.jsx("div",{style:{...a.gmWordDisplay,fontSize:`${Math.max(16,Math.min(24,i.wordDisplay*.9))}px`,margin:`${o}px 0`,letterSpacing:`${o*.8}px`,minHeight:`${Math.max(16,Math.min(24,i.wordDisplay*.9))*1.2}px`},children:me||"Loading..."}),t.jsxs("div",{style:{...a.gmInfoBox,padding:`${o}px`,marginTop:`${o}px`,marginBottom:`${o}px`,maxWidth:`${(u||r)*.95}px`},children:[t.jsx("p",{style:{...a.gmBodyS,fontSize:`${i.bodyS}px`,marginBottom:`${o}px`,fontWeight:500},children:"Available letters:"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:`${o/3}px`,justifyContent:"center",fontSize:`${Math.max(9,Math.min(12,i.bodyS*.75))}px`,fontFamily:'"Onest", system-ui, sans-serif'},children:he.map(e=>t.jsx("button",{onClick:()=>ee(e),disabled:m!==null,onMouseEnter:n=>{m===null&&(n.currentTarget.style.backgroundColor="#e5e7eb",n.currentTarget.style.cursor="pointer")},onMouseLeave:n=>{m===null&&(n.currentTarget.style.backgroundColor="#f9f9f9",n.currentTarget.style.cursor="pointer")},style:{padding:`${o/4}px ${o/3}px`,borderRadius:`${d*.5}px`,background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",minWidth:`${Math.max(o*1.5,(u||r)*.04)}px`,textAlign:"center",display:"inline-block",cursor:m===null?"pointer":"default",fontFamily:'"Onest", system-ui, sans-serif',fontSize:`${Math.max(9,Math.min(12,i.bodyS*.75))}px`,transition:"background-color 0.2s ease"},children:e},e))})]}),S.length>0&&t.jsx("div",{style:{...a.gmGuessedLetters,fontSize:`${Math.max(10,Math.min(12,i.bodyS*.85))}px`,marginTop:`${o*.5}px`,marginBottom:"2px"},children:t.jsxs("span",{style:{color:"#6b7280"},children:["Guessed letters: ",t.jsx("strong",{children:S.join(", ")})]})}),m==="win"&&t.jsx("div",{style:{...a.gmStatusWin,fontSize:`${i.bodyL}px`,margin:"2px 0"},children:"🎉 You won this round!"}),m==="lose"&&t.jsxs("div",{style:{...a.gmStatusLose,fontSize:`${i.bodyL}px`,margin:"2px 0"},children:["The hangman is complete! The word was: ",t.jsx("strong",{children:w})]}),m!==null&&M<k&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:xe,onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${Math.max(11,Math.min(14,i.button*.85))}px`,padding:`${o*.6}px ${o*1.2}px`,borderRadius:`${d}px`},children:"NEXT"})}),m!==null&&M>=k&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:()=>h("result"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`},children:"View Results →"})}),m===null&&S.length===0&&t.jsx("p",{style:{...a.gmBodyS,fontSize:`${i.bodyS}px`,marginTop:`${o}px`,marginBottom:`${o}px`},children:"Type a letter on your keyboard"})]}):y==="result"?t.jsxs(t.Fragment,{children:[E,t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${i.headline1}px`,marginBottom:`${o*2}px`},children:"🎊 Game Finished!"}),t.jsxs("p",{style:{...a.gmBodyL,fontSize:`${i.bodyL}px`,marginBottom:`${o*2}px`},children:["You guessed ",t.jsx("strong",{children:V})," out of ",t.jsx("strong",{children:k})," words correctly."]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:`${o}px`,alignItems:"center"},children:[t.jsx("button",{onClick:()=>{if(!x||k===0){h("lobby");return}v([]);const e=Q(x,[]);e&&(T(e),v([e]),B([]),$(0),L(1),I(0),j(null),h("game"))},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,minWidth:"200px"},children:"Play again"}),t.jsx("button",{onClick:()=>h("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${i.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${d}px`,minWidth:"200px"},children:"Exit"})]})]}):null;return t.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"transparent",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},children:t.jsx("div",{style:{width:p?"100%":u||r||1e3,height:p?"100%":u||r||1e3,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",borderRadius:p?0:"20px",background:"#ffffff",boxShadow:p?"none":"0 0 40px rgba(0,0,0,0.1)",margin:p?"0 auto":"unset",position:"relative",transform:`scale(${U})`},children:t.jsx("div",{style:{transform:"translateZ(0)",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx("div",{style:fe,children:ye()})})})})}exports.Game=re;exports.HangmanLobbyGame=re;exports.default=re;
|
|
46
46
|
//# sourceMappingURL=speakid-hangman.cjs.js.map
|