PageSourceSearch

https://io.google/2026/puzzle/assets/App-Bws3rbHt.js

js io.google collected 2026-09-24 08:29:43 UTC 17,723 bytes, 56 lines download raw bytes

1import{j as s,r as x,a as D}from"./vendor-core-BfsIZGLM.js";import{a as O,u as B,g as C,b as T,c as A,t as G}from"./main-Cznl0eY3.js";import{B as R}from"./BuildComplete-B6MQsk9a.js";import"./vendor-animation-C5u8yPkK.js";import"./vendor-three-DWQGnPeS.js";async function W(e,i=[]){try{const f=await fetch(O("/api/build/10"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generate_puzzle",level:e,previousWords:i})});if(!f.ok)throw new Error(`Server error: ${f.status}`);const b=await f.json();if(b.result)return b.result;throw new Error("Invalid response format")}catch(f){console.warn("Generating fallback puzzle",f);const b=[{letters:"CLOUDS",words:[{word:"CLOUD",x:0,y:0,direction:"v"},{word:"COLD",x:0,y:0,direction:"h"},{word:"LOUD",x:-1,y:2,direction:"h"}]},{letters:"EODCNE",words:[{word:"ENCODE",x:0,y:3,direction:"h"},{word:"NODE",x:1,y:3,direction:"v"},{word:"CODE",x:3,y:2,direction:"v"},{word:"DONE",x:5,y:0,direction:"v"}]},{letters:"FNGIOC",words:[{word:"CONFIG",x:0,y:2,direction:"h"},{word:"ICON",x:0,y:1,direction:"v"},{word:"INFO",x:4,y:2,direction:"v"},{word:"FOG",x:5,y:0,direction:"v"}]},{letters:"SCRIPT",words:[{word:"SCRIPT",x:1,y:0,direction:"v"},{word:"TRIP",x:0,y:2,direction:"h"},{word:"TIPS",x:1,y:5,direction:"h"}]},{letters:"WIDGET",words:[{word:"WIDGET",x:0,y:0,direction:"h"},{word:"EDIT",x:4,y:0,direction:"v"},{word:"TIDE",x:2,y:0,direction:"v"}]}];return{...b[e%b.length],difficulty:e}}}const U=({levelId:e,totalLevels:i,score:f,button:b,buttonDisabled:h})=>{const y={background:"conic-gradient(from 270deg at 50% 50.12%, #4285F4 142.87deg, #BB55A1 175.78deg, #EA4335 194.23deg, #FBBC04 246.99deg, #B9D84C 268.68deg, #38A852 305.11deg, #38A852 330.36deg, #4285F4 353.77deg)"};return s.jsx("div",{className:"flex items-center",children:s.jsx("div",{className:"p-[1.5px] rounded-full overflow-hidden shadow-lg",style:y,children:s.jsxs("div",{className:"bg-[#000000] rounded-full flex h-[48px] px-4 items-center gap-[12px]",children:[s.jsx("div",{className:"min-w-[160px] md:min-w-[210px] flex justify-start",children:s.jsxs("span",{className:"text-white font-['Google_Sans'] text-[16px] md:text-[18px] font-medium leading-[1.2] md:leading-[1.6] md:tracking-[-0.36px] whitespace-nowrap",children:["Level ",e,"/",i," - ",f," points"]})}),s.jsx("button",{onClick:a=>{a.stopPropagation(),b()},disabled:h,className:"flex h-[35px] px-[18px] items-center justify-center bg-[#202020] hover:bg-white text-white hover:text-black rounded-full transition-colors duration-200",children:s.jsx("span",{className:"font-['Google_Sans'] text-[16px] md:text-[18px] font-medium leading-[1.2] md:leading-[1.6] md:tracking-[-0.36px] whitespace-nowrap",children:"Hint (-30pts)"})})]})})})},X=({letters:e,onWordSubmit:i,onCurrentWordChange:f,onInteraction:b})=>{const h=x.useRef(null),[y,p]=x.useState([]),[a,I]=x.useState(!1),[k,F]=x.useState({x:50,y:50}),m=35,{playForeground:E}=B(),P=x.useMemo(()=>e.split(""),[e]),[N,S]=x.useState(()=>Array.from({length:e.length},(n,o)=>o).sort(()=>Math.random()-.5)),L=()=>{S(n=>[...n].sort(()=>Math.random()-.5)),E(C("/media/audio/sfx/wordwheel/letterselect.mp3"))},v=x.useCallback(n=>{const o=n/P.length*2*Math.PI-Math.PI/2;return{x:50+m*Math.cos(o),y:50+m*Math.sin(o)}},[P.length,m]),j=(n,o)=>{if(!h.current)return-1;const w=h.current.getBoundingClientRect(),c=(n-w.left)/w.width*100,t=(o-w.top)/w.height*100,r=14;for(let d=0;d<N.length;d++){const l=v(d);if(Math.sqrt(Math.pow(l.x-c,2)+Math.pow(l.y-t,2))<r)return N[d]}return-1},z=n=>{const o="touches"in n?n.touches[0].clientX:n.clientX,w="touches"in n?n.touches[0].clientY:n.clientY,c=j(o,w);if(c!==-1){b?.(),I(!0),p([c]),E(C("/media/audio/sfx/wordwheel/letterselect.mp3"));const t=h.current?.getBoundingClientRect();t&&F({x:(o-t.left)/t.width*100,y:(w-t.top)/t.height*100}),f(P[c])}},g=x.useCallback(n=>{if(!a||!h.current)return;const o="touches"in n?n.touches[0].clientX:n.clientX,w="touches"in n?n.touches[0].clientY:n.clientY,c=h.current.getBoundingClientRect(),t=(o-c.left)/c.width*100,r=(w-c.top)/c.height*100;F({x:t,y:r});const d=j(o,w);if(d!==-1&&!y.includes(d)){const l=[...y,d];E(C("/media/audio/sfx/wordwheel/letterselect.mp3")),f(l.map(M=>P[M]).join("")),p(l)}},[a,y,N,P,f]),u=x.useCallback(()=>
1{if(a){const n=y.map(o=>P[o]).join("");n.length>1&&i(n),I(!1),p([]),f("")}},[a,y,P,i,f]);return x.useEffect(()=>(window.addEventListener("mousemove",g),window.addEventListener("mouseup",u),window.addEventListener("touchmove",g),window.addEventListener("touchend",u),()=>{window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",u),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",u)}),[g,u]),s.jsxs("div",{className:"relative w-full max-w-[175px] sm:max-w-[200px] md:max-w-[250px] short:lg:max-w-[424px] lg:max-w-[472px] mx-auto select-none touch-none animate-wheel",children:[s.jsx("style",{children:`
2          @keyframes wheelPop {
3            0% { 
4              opacity: 0; 
5              transform: scale(0.9); 
6            }
7            100% { 
8              opacity: 1; 
9              transform: scale(1); 
10            }
11          }
12
13          .animate-wheel {
14            animation: wheelPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
15          }
16        `}),s.jsxs("div",{ref:h,onMouseDown:z,onTouchStart:z,className:"relative w-full aspect-square rounded-full bg-[#37383B] flex items-center justify-center overflow-visible transition-all",children:[s.jsx("svg",{viewBox:"0 0 100 100",className:"absolute inset-0 w-full h-full pointer-events-none overflow-visible z-0",children:y.length>0&&y.map((n,o)=>{const w=N.indexOf(n),c=v(w);if(o===y.length-1)return s.jsx("line",{x1:c.x,y1:c.y,x2:k.x,y2:k.y,stroke:"#FFFFFF",strokeWidth:"2.5",strokeLinecap:"round",opacity:"1"},"last");const t=N.indexOf(y[o+1]),r=v(t);return s.jsx("line",{x1:c.x,y1:c.y,x2:r.x,y2:r.y,stroke:"#FFFFFF",strokeWidth:"2.5",strokeLinecap:"round",opacity:"1"},o)})}),N.map((n,o)=>{const w=o/P.length*2*Math.PI-Math.PI/2,c=y.includes(n);return s.jsx("div",{className:`absolute flex items-center justify-center rounded-full transition-opacity duration-150 transform-gpu z-10 w-10 h-10 lg:w-18.5 lg:h-18.5 text-[24px] lg:text-[54px] font-medium
17                ${c?"bg-[#FFFFFF] text-black":"bg-transparent text-white hover:text-black hover:bg-[#FFFFFF]"}
18              `,style:{left:`calc(50% + ${Math.cos(w)*m}%)`,top:`calc(50% + ${Math.sin(w)*m}%)`,transform:"translate(-50%, -50%)"},children:P[n]},n)}),s.jsx("button",{onClick:n=>{n.stopPropagation(),L()},className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 p-3 lg:p-6 aspect-square rounded-full bg-white hover:bg-white/75 transition-all active:scale-90 z-20",children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 22 16",fill:"none",className:"w-3 h-3 lg:w-6 lg:h-6 text-black",children:s.jsx("path",{d:"M11.05 16C8.81667 16 6.91667 15.225 5.35 13.675C3.78333 12.125 3 10.2333 3 8V7.825L1.4 9.425L0 8.025L4 4.025L8 8.025L6.6 9.425L5 7.825V8C5 9.66667 5.5875 11.0833 6.7625 12.25C7.9375 13.4167 9.36667 14 11.05 14C11.4833 14 11.9083 13.95 12.325 13.85C12.7417 13.75 13.15 13.6 13.55 13.4L15.05 14.9C14.4167 15.2667 13.7667 15.5417 13.1 15.725C12.4333 15.9083 11.75 16 11.05 16ZM18 11.975L14 7.975L15.4 6.575L17 8.175V8C17 6.33333 16.4125 4.91667 15.2375 3.75C14.0625 2.58333 12.6333 2 10.95 2C10.5167 2 10.0917 2.05 9.675 2.15C9.25833 2.25 8.85 2.4 8.45 2.6L6.95 1.1C7.58333 0.733333 8.23333 0.458333 8.9 0.275C9.56667 0.0916667 10.25 0 10.95 0C13.1833 0 15.0833 0.775 16.65 2.325C18.2167 3.875 19 5.76667 19 8V8.175L20.6 6.575L22 7.975L18 11.975Z",fill:"currentColor"})})})]})]},e)},Y=({puzzle:e,foundWords:i})=>{const[f,b]=x.useState(e),[h,y]=x.useState(!1);e!==f&&!h&&y(!0),x.useEffect(()=>{if(h){const L=setTimeout(()=>{b(e),y(!1)},300);return()=>clearTimeout(L)}},[e,f]);const p=f;if(!p.words||p.words.length===0)return null;let a=1/0,I=-1/0,k=1/0,F=-1/0;p.words.forEach(L=>{const{word:v,x:j,y:z,direction:g}=L;for(let u=0;u<v.length;u++){const n=g==="h"?j+u:j,o=g==="v"?z+u:z;a=Math.min(a,n),I=Math.max(I,n),k=Math.min(k,o),F=Math.max(F,o)}});const m=I-a+1,E=F-k+1,P=Array.from({length:E},()=>Array(m).fill(null)),N=Array.from({length:E},()=>Array(m).fill(!1));p.words.forEach(L=>{const{word:v,x:j,y:z,direction:g}=L;for(let u=0;u<v.length;u++){const n=(g==="h"?j+u:j)-a,o=(g==="v"?z+u:z)-k;n>=0&&n<m&&o>=0&&o<E&&(P[o][n]=v[u],N[o][n]=!0)}});const S=(L,v)=>{const j=L+a,z=v+k;return p.words.some(g=>{if(!i.includes(g.word))return!1;const{word:u,x:n,y:o,direction:w}=g;for(let c=0;c<u.length;c++){const t=w==="h"?n+c:n,r=w==="v"?o+c:o;if(t===j&&r===z)return!0}return!1})};return s.jsxs("div",{className:"flex justify-center items-center max-w-full max-h-full min-w-0 min-h-0 short:lg:mt-0 lg:mt-[78px]",children:[s.jsx("style",{children:`
19        @keyframes cellFadeIn {
20          from { 
21            opacity: 0; 
22            transform: scale(0.8); 
23          }
24          to { 
25            opacity: 1; 
26            transform: scale(1); 
27          }
28        }
29        .animate-cell-in {
30          opacity: 0;
31          animation: cellFadeIn 0.4s ease-out forwards;
32        }
33      `}),s.jsx("div",{className:`grid gap-1 lg:gap-2 p-[8px] max-w-full max-h-full justify-center items-center [--cell-size:32px] md:[--cell-size:48px] short:lg:[--cell-size:48px] lg:[--cell-size:64px] ${h?"opacity-0 scale-95":"opacity-100 scale-100"}`,style:{gridTemplateColumns:`repeat(${m}, var(--cell-size))`,gridTemplateRows:`repeat(${E}, var(--cell-size))`,width:"fit-content"},children:P.map((L,v)=>L.map((j,z)=>{const g=S(z,v),u=N[v][z],n=m>1?z/(m-1)*99:0,o=E>1?v/(E-1)*99:0;return s.jsx("div",{className:`w-8 h-8 md:w-12 md:h-12 short:lg:w-12 short:lg:h-12 lg:w-16 lg:h-16 bg-[#37383B] rounded flex items-center justify-center
34                  ${u?"animate-cell-in":"invisible pointer-events-none"}
35                  ${g?"ring-2 ring-blue-500/10":""}
36                `,style:{animationDelay:`${(z+v)*50}ms`,...g?{backgroundImage:`url('${C("/media/images/builds/nonogram-gradient.png")}')`,backgroundRepeat:"no-repeat",backgroundSize:`${m*100}% ${E*100}%`,backgroundPosition:`${n+.5}% ${o+.5}%`}:{}},children:u&&s.jsx("span",{className:`text-[20px] short:lg:text-[32px] lg:text-[48px] font-medium leading-none select-none text-white
37                      ${g?"opacity-100 transition-opacity duration-500":"opacity-0 transition-none"}
38                    `,children:j})},`${z}-${v}`)}))},JSON.stringify(`${p.letters}-${p.difficulty}`))]},`${p.letters}-${p.difficulty}`)};console.log("Using puzzle generator:","Production");const $={difficulty:1,letters:"BUDGET",words:[{word:"BUDGET",x:0,y:2,direction:"h"},{word:"DEBUG",x:0,y:0,direction:"v"},{word:"DUE",x:0,y:0,direction:"h"},{word:"GET",x:3,y:2,direction:"v"}]},J=()=>{const[e,i]=x.useState({level:1,score:30,foundWords:[],currentPuzzle:null,nextPuzzle:null,loading:!0,message:"Preparing your brain...",gameWon:!1,showLevelModal:!1}
38),[f,b]=x.useState(""),[h,y]=x.useState({text:"",type:"info"}),p=x.useRef([]),a=x.useRef(null),I=T(t=>t.setLastCompletedBuildIdx),k=T(t=>t.setLastCompletedRemixIdx),{navigateTo:F}=A(),{playForeground:m}=B(),E=T(t=>t.completedBuilds),P=T(t=>t.completeBuildIdx);x.useEffect(()=>{e.gameWon&&(P(3),I(3),k(null))},[e.gameWon,P]);const N=document.getElementById("footer-portal-target"),S=`
39    footer {
40      position: static;
41      padding-block: 8px;
42
43      @media (min-width: 1280px) {
44        position: fixed;
45        padding-bottom: 0;
46      }
47    }
48  `,L=x.useCallback(async t=>{const r=t+1;if(r>6||a.current?.level===r)return;i(l=>({...l,isPrefetching:!0}));const d=W(r,p.current.slice(-30));a.current={level:r,promise:d};try{const l=await d;console.log("Generated Next Level Puzzle:",l),i(M=>l.difficulty<=M.level?{...M,isPrefetching:!1}:{...M,nextPuzzle:l,isPrefetching:!1})}catch(l){console.warn("Prefetch failed",l),i(M=>({...M,isPrefetching:!1}))}finally{a.current?.level===r&&(a.current=null)}},[]),v=x.useCallback(()=>{e.nextPuzzle||a.current||L(e.level)},[e.level,e.nextPuzzle,L]),j=x.useCallback(async t=>{if(t===1){i(r=>({...r,currentPuzzle:$,foundWords:[],loading:!1,level:1,nextPuzzle:null}));return}if(e.nextPuzzle&&e.nextPuzzle.difficulty===t){i(r=>({...r,currentPuzzle:r.nextPuzzle,nextPuzzle:null,foundWords:[],loading:!1,level:t}));return}i(r=>({...r,loading:!0,message:`Building Level ${t}...`}));try{let r;if(a.current?.level===t)r=await a.current.promise;else{const d=W(t,p.current.slice(-30));a.current={level:t,promise:d};try{r=await d}finally{a.current?.level===t&&(a.current=null)}}console.log("Generated Current Level Puzzle:",r),i(d=>({...d,currentPuzzle:r,nextPuzzle:null,foundWords:[],loading:!1,isPrefetching:!1,level:t}))}catch(r){console.error(r)}},[e.nextPuzzle,L]);x.useEffect(()=>{j(e.level)},[]);const z=t=>{if(!e.currentPuzzle)return;if(e.currentPuzzle.words.find(d=>d.word===t))if(e.foundWords.includes(t))o("ALREADY FOUND","info"),m(C("/media/audio/sfx/wordwheel/incorrectword.mp3"));else{const d=[...e.foundWords,t];p.current.push(t),i(l=>({...l,foundWords:d,score:l.score+t.length*20})),o("EXCELLENT","success"),m(C("/media/audio/sfx/wordwheel/correctword.mp3")),d.length===e.currentPuzzle.words.length&&(o("LEVEL COMPLETE","success"),G("level_complete",{currentBuild:"Word wheel",buildsCompleted:E.length,currentLevel:e.level}),m(C("/media/audio/sfx/global/win.mp3")),e.level>=6?setTimeout(()=>i(l=>({...l,gameWon:!0})),1200):setTimeout(()=>i(l=>({...l,showLevelModal:!0})),1200))}else o("NOT IN PUZZLE","error"),m(C("/media/audio/sfx/wordwheel/incorrectword.mp3"));b("")},g=async()=>{m(C("/media/audio/sfx/global/buttonclick.mp3")),p.current=[],a.current=null,i({level:1,score:0,foundWords:[],currentPuzzle:$,nextPuzzle:null,loading:!1,message:"Starting fresh...",gameWon:!1,showLevelModal:!1,isPrefetching:!1}),b("")},u=()=>{if(!e.currentPuzzle||e.score<30)return;const t=e.currentPuzzle.words.filter(r=>!e.foundWords.includes(r.word));if(t.length>0){const r=t[Math.floor(Math.random()*t.length)].word,d=[...e.foundWords,r];p.current.push(r),i(l=>({...l,foundWords:d,score:l.score-30})),o("HINT APPLIED","info"),m(C("/media/audio/sfx/global/buttonclick.mp3")),d.length===e.currentPuzzle.words.length&&setTimeout(()=>{o("LEVEL COMPLETE","success"),m(C("/media/audio/sfx/global/win.mp3")),e.level>=6?setTimeout(()=>i(l=>({...l,gameWon:!0})),1200):setTimeout(()=>i(l=>({...l,showLevelModal:!0})),600)},500)}},n=t=>t&&t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),o=(t,r)=>{y({text:t,type:r}),setTimeout(()=>y({text:"",type:"info"}),1e3)},w=s.jsx(R,{byLine:`${e.score} points`,frontTexture:C("/media/images/builds/03_thumbnail_completed.png"),backTexture:C("/media/images/builds/03_thumbnail.png"),onNextBuild:()=>{F("play")},onPlayAgain:g}),c=s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/1 backdrop-blur-2xl animate-in fade-in duration-300 animate-[fadeIn_0.3s_ease-out]",children:s.jsxs("div",{className:"bg-black px-[55px] lg:px-[40px] py-[50px] gap-[40px] rounded-3xl shadow-2xl flex flex-col items-center mx-[55px] rainbow-border w-full max-w-[430px] text-center",children:[s.jsxs("h2",{className:"text-[48px] font-medium text-white tracking-[-1.2px] leading-[1.1]",children:["Level ",e.level," complete"]}),s.jsxs("div",{className:"flex flex-col gap-[22px]",children:[s.jsx("button",{onClick:()=>{i(t=>({...t,currentPuzzle:null,showLevelModal:!1})),setTimeout(()=>{j(e.level+1)},10)},className:"bg-white py-[12px] text-[18px] leading-[1.6] tracking-[-0.36px] text-black rounded-full font-medium white-button h-[64px] px-[55px] md:px-[89px]",children:"Next level"}),s.jsx("button",{onClick:()=>window.location.reload(),className:"bg-[#202020] px-[20px] py-[12px] text-white rounded-full font-medium self-center px-[28px]",children:"Play again"})]})]})});return s.jsxs("div",{className:"w-full h-[calc(100%-130px)] short:lg:h-[calc(100%-66px)] lg:h-[c
48alc(100%-75px)] flex flex-col mx-auto rounded-2xl justify-center",children:[e.gameWon&&w,e.showLevelModal&&c,s.jsx("style",{children:`
49        @keyframes sparkleAnim {
50          to { transform: translate(var(--tx), var(--ty)); opacity: 0; }
51        }
52      `}),s.jsxs("div",{className:"flex flex-col short:md:flex-row short:md:flex-1 lg:flex-1 lg:flex-row overflow-hidden gap-2 sm:gap-6 md:gap-10 md:gap-10 lg:gap-4",children:[s.jsx("div",{className:"flex short:md:flex-1 lg:flex-1 items-start md:items-center justify-center lg:max-w-1/2",children:e.currentPuzzle&&s.jsx(Y,{puzzle:e.currentPuzzle,foundWords:e.foundWords},`$[state.currentPuzzle.difficulty]-${e.currentPuzzle.letters}`)}),s.jsxs("div",{className:"flex short:md:flex-1 short:md:justify-center lg:flex-1 flex-col items-center justify-start lg:justify-center relative",children:[s.jsx("div",{className:`mb-[8px] sm:mb-[16px] short:md:mb-[16px] md:mb-[32px] mt-[8px] flex flex-col items-center whitespace-nowrap justify-center bg-white text-base text-black rounded-full font-medium px-7 py-2.5 leading-none ${!f&&!h.text?"invisible":""}`,children:f?s.jsx("div",{className:"animate-in fade-in zoom-in duration-200",children:s.jsx("span",{className:"",children:n(f)})}):h.text?s.jsx("div",{className:`transition-all
53                ${h.type==="success"?"text-black":""}
54                ${h.type==="error"?"text-[#514e4e]":""}
55                ${h.type==="info"?"text-black":""}
56              `,children:n(h.text)}):s.jsx("div",{className:"",children:"..."})}),e.currentPuzzle&&s.jsx(X,{letters:e.currentPuzzle.letters,onWordSubmit:z,onCurrentWordChange:b,onInteraction:v},e.currentPuzzle.letters)]})]}),s.jsx("style",{children:S}),N&&D.createPortal(s.jsx(U,{levelId:e.level,totalLevels:6,score:e.score,button:u,buttonDisabled:e.score<30}),N)]})};export{J as default};

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