PageSourceSearch

https://www.funnudge.com/_next/static/chunks/2100.dfa6f9b1c42964fd.js

js funnudge.com collected 2026-10-02 01:30:52 UTC 41,732 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2100],{2100:(e,t,n)=>{n.r(t),n.d(t,{default:()=>R});var l=n(5155),r=n(2115),s=n(6440),a=n(9341),o=n(8753);let i={0:39,1:26,2:13,3:0},c=new Set([0,8,13,21,26,34,39,47]),u={2:[0,2],3:[0,1,2],4:[0,1,2,3]},d=(e,t)=>(i[e]+t)%52;function x(e,t){let n=[],l=e.tokens[e.turn];for(let e=0;e<4;e++){let r=l[e];-1===r?6===t&&n.push(e):r<56&&r+t<=56&&n.push(e)}return n}let f=e=>{let t=e.seats.indexOf(e.turn);return e.seats[(t+1)%e.seats.length]};function m(e,t){var n;let l=null!=(n=e.dice)?n:0,r=e.turn,s=e.tokens.map(e=>e.slice()),a=s[r][t],o=-1===a?0:a+l;s[r][t]=o;let i=[];if(o>=0&&o<=50){let t=d(r,o);if(!c.has(t)){for(let n of e.seats)if(n!==r)for(let e=0;e<4;e++){let l=s[n][e];l>=0&&l<=50&&d(n,l)===t&&(s[n][e]=-1,i.push({color:n,token:e}))}}}let u=56===o,x=s[r].every(e=>56===e),m=!x&&(6===l||i.length>0||u);return{state:{...e,tokens:s,dice:null,sixStreak:6===l?e.sixStreak:0,turn:x?e.turn:m?r:f(e),winner:x?r:e.winner},captured:i,finished:u,extraTurn:m}}let h=(e,t)=>e.tokens[t].filter(e=>56===e).length;var p=n(1175),g=n(4107);let b=[[8,1],[8,2],[8,3],[8,4],[8,5],[9,6],[10,6],[11,6],[12,6],[13,6],[14,6],[14,7],[14,8],[13,8],[12,8],[11,8],[10,8],[9,8],[8,9],[8,10],[8,11],[8,12],[8,13],[8,14],[7,14],[6,14],[6,13],[6,12],[6,11],[6,10],[6,9],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8],[0,7],[0,6],[1,6],[2,6],[3,6],[4,6],[5,6],[6,5],[6,4],[6,3],[6,2],[6,1],[6,0],[7,0],[8,0]],y={0:[[1,7],[2,7],[3,7],[4,7],[5,7]],1:[[7,13],[7,12],[7,11],[7,10],[7,9]],2:[[13,7],[12,7],[11,7],[10,7],[9,7]],3:[[7,1],[7,2],[7,3],[7,4],[7,5]]},j={0:[0,0],1:[0,9],2:[9,9],3:[9,0]},v=[[2,2],[4,2],[2,4],[4,4]],k={0:[-.75,0],1:[0,.75],2:[.75,0],3:[0,-.75]};function w(e,t,n){if(-1===t){let[t,l]=j[e],[r,s]=v[n];return[t+r,l+s]}if(56===t){let[t,n]=k[e];return[7.5+t,7.5+n]}if(t>=51){let[n,l]=y[e][t-51];return[n+.5,l+.5]}let[l,r]=b[d(e,t)];return[l+.5,r+.5]}let N={0:{fill:"#e5453c",lite:"#f2665c",token:"#ef4444",dark:"#8f1d16"},1:{fill:"#5cb946",lite:"#77cd5f",token:"#4caf3c",dark:"#2d6e20"},2:{fill:"#f2b02e",lite:"#f7c458",token:"#f5a623",dark:"#96650c"},3:{fill:"#4a8de0",lite:"#6aa4ea",token:"#3f8cf2",dark:"#1d4c8f"}},D={0:"text-red-400",1:"text-green-400",2:"text-yellow-400",3:"text-blue-400"},C={0:"bg-red-500",1:"bg-green-500",2:"bg-yellow-400",3:"bg-blue-500"},z={0:"ring-red-500",1:"ring-green-500",2:"ring-yellow-400",3:"ring-blue-500"},S=["Red","Green","Yellow","Blue"],T={0:b[39],1:b[26],2:b[13],3:b[0]},E=[b[8],b[21],b[34],b[47]],M=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.34,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.145;return Array.from({length:10},(r,s)=>{let a=-Math.PI/2+s*Math.PI/5,o=s%2?l:n;return"".concat((e+Math.cos(a)*o).toFixed(3),",").concat((t+Math.sin(a)*o).toFixed(3))}).join(" ")},F={1:[[0,0]],2:[[-.28,-.28],[.28,.28]],3:[[-.28,-.28],[0,0],[.28,.28]],4:[[-.28,-.28],[.28,-.28],[-.28,.28],[.28,.28]],5:[[-.28,-.28],[.28,-.28],[0,0],[-.28,.28],[.28,.28]],6:[[-.28,-.3],[.28,-.3],[-.28,0],[.28,0],[-.28,.3],[.28,.3]]};function B(e){var t;let{ludo:n,myColor:s,movable:a,onPick:o,diceValue:i,diceOwner:c,landStamp:u,offline:x,rolling:f,canRoll:m,onRoll:h}=e,[p,g]=(0,r.useState)({}),[k,D]=(0,r.useState)({}),[C,z]=(0,r.useState)({}),[S,B]=(0,r.useState)([]),R=(0,r.useRef)(0),I=(0,r.useRef)(null),O=(0,r.useRef)({}),W=(e,t,n,l)=>{var r,s;let a=++R.current;B(r=>[...r.slice(-11),{id:a,kind:e,x:t,y:n,c:l}]),(null!=(s=(r=O.current)._fx)?s:r._fx=[]).push(setTimeout(()=>B(e=>e.filter(e=>e.id!==a)),950))};(0,r.useEffect)(()=>{let e=I.current,t={},l={};for(let s of n.seats)for(let a=0;a<4;a++){var r;let o="".concat(s,"-").concat(a),i=n.tokens[s][a];t[o]=i;let c=null==e?void 0:e[o];if(c===i)continue;if((null!=(r=O.current[o])?r:[]).forEach(clearTimeout),O.current[o]=[],null==e||null==c){l[o]=w(s,i,a);continue}if(-1===i&&c>=0){let[e,t]=w(s,c,a);W("boom",e,t,s),z(e=>({...e,[o]:!0})),O.current[o].push(setTimeout(()=>z(e=>({...e,[o]:!1})),760))}if(56===i&&56!==c){let[e,t]=w(s,56,a);W("star",e,t,s)}let u=[];if(-1!==i&&-1!==c&&i>c&&i-c<=6)for(let e=c+1;e<=i;e++)u.push(w(s,e,a));else u.push(w(s,i,a));u.length>1?D(e=>({...e,[o]:!0})):D(e=>e[o]?{...e,[o]:!1}:e),u.forEach((e,t)=>{O.current[o].push(setTimeout(()=>{g(t=>({...t,[o]:e})),u.length>1&&t<u.length-1&&W("trail",e[0],e[1],s)},175*t))}),O.current[o].push(setTimeout(()=>D(e=>({...e,[o]:!1})),175*u.length))}I.current=t,Object.keys(l).length&&g(e=>({...e,...l}))},[n]),(0,r.useEffect)(()=>{let e=O.current;return()=>
1Object.values(e).forEach(e=>e.forEach(clearTimeout))},[]);let _={},L={},P={},A=new Map;for(let e of n.seats)for(let t=0;t<4;t++){let l="".concat(e,"-").concat(t),r=w(e,n.tokens[e][t],t);_[l]=r;let s="".concat(r[0].toFixed(1),",").concat(r[1].toFixed(1));A.has(s)||A.set(s,[]),A.get(s).push(l)}for(let e of A.values())e.forEach((t,l)=>{let[r,s]=t.split("-").map(Number),a=n.tokens[r][s];if(1===e.length)L[t]=[0,0],P[t]=56===a?.72:1;else{let n=l/e.length*Math.PI*2-Math.PI/2;L[t]=[.19*Math.cos(n),.19*Math.sin(n)],P[t]=.72}});let H=new Set(a),K=null!=c?c:n.turn,q=N[K],[G,Y]=j[K],V=null==n.winner,Z=m&&!f&&null==c,J=(e,t,n,r)=>(0,l.jsx)("rect",{x:e,y:t,width:1,height:1,fill:n,stroke:"#c3bdb0",strokeWidth:.04},r);return(0,l.jsxs)("svg",{viewBox:"0 0 15 15",className:"h-full w-full",role:"img","aria-label":"Ludo board",children:[(0,l.jsxs)("defs",{children:[[0,1,2,3].map(e=>(0,l.jsxs)("radialGradient",{id:"ludo-tok-".concat(e),cx:"0.35",cy:"0.28",r:"0.95",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.95"}),(0,l.jsx)("stop",{offset:"30%",stopColor:N[e].lite}),(0,l.jsx)("stop",{offset:"72%",stopColor:N[e].token}),(0,l.jsx)("stop",{offset:"100%",stopColor:N[e].dark})]},"t".concat(e))),[0,1,2,3].map(e=>(0,l.jsxs)("linearGradient",{id:"ludo-q-".concat(e),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:N[e].lite}),(0,l.jsx)("stop",{offset:"100%",stopColor:N[e].fill})]},"q".concat(e)))]}),(0,l.jsx)("rect",{x:0,y:0,width:15,height:15,rx:.35,fill:"#f6f3ec"}),(0,l.jsx)("rect",{x:.06,y:.06,width:14.88,height:14.88,rx:.3,fill:"none",stroke:"#d8d1c0",strokeWidth:.1}),[0,1,2,3].map(e=>{let[t,n]=j[e];return(0,l.jsxs)("g",{children:[(0,l.jsx)("rect",{x:t,y:n,width:6,height:6,fill:"url(#ludo-q-".concat(e,")")}),(0,l.jsx)("rect",{x:t+1,y:n+1.08,width:4,height:4,rx:.55,fill:"rgba(0,0,0,0.18)"}),(0,l.jsx)("rect",{x:t+1,y:n+1,width:4,height:4,rx:.55,fill:"#ffffff"}),v.map((r,s)=>{let[a,o]=r;return(0,l.jsxs)("g",{children:[(0,l.jsx)("circle",{cx:t+a,cy:n+o,r:.56,fill:N[e].fill,opacity:.22}),(0,l.jsx)("circle",{cx:t+a,cy:n+o,r:.56,fill:"none",stroke:N[e].fill,strokeWidth:.06,opacity:.55})]},s)})]},"q".concat(e))}),b.map((e,t)=>{let[n,l]=e,r=[0,13,26,39].indexOf(t),s=[3,2,1,0][r],a=E.some(e=>{let[t,r]=e;return t===n&&r===l});return J(n,l,r>=0&&void 0!==s?N[s].fill:a?"#eee9db":"#ffffff","t".concat(t))}),[0,1,2,3].map(e=>y[e].map((t,n)=>{let[l,r]=t;return J(l,r,N[e].fill,"h".concat(e,"-").concat(n))})),[0,1,2,3].map(e=>{let[t,n]=b[d(e,50)],r=[0,270,180,90][e];return(0,l.jsx)("g",{transform:"translate(".concat(t+.5,", ").concat(n+.5,") rotate(").concat(r,")"),children:(0,l.jsx)("path",{d:"M -0.3 -0.14 L 0.02 -0.14 L 0.02 -0.28 L 0.32 0 L 0.02 0.28 L 0.02 0.14 L -0.3 0.14 Z",fill:N[e].fill,stroke:"rgba(0,0,0,0.25)",strokeWidth:.03,strokeLinejoin:"round"})},"entry".concat(e))}),(0,l.jsxs)("g",{stroke:"#f6f3ec",strokeWidth:.06,strokeLinejoin:"round",children:[(0,l.jsx)("polygon",{points:"6,6 9,6 7.5,7.5",fill:N[3].fill}),(0,l.jsx)("polygon",{points:"9,6 9,9 7.5,7.5",fill:N[2].fill}),(0,l.jsx)("polygon",{points:"9,9 6,9 7.5,7.5",fill:N[1].fill}),(0,l.jsx)("polygon",{points:"6,9 6,6 7.5,7.5",fill:N[0].fill})]}),(0,l.jsx)("circle",{cx:7.5,cy:7.5,r:.22,fill:"#fff",stroke:"#c3bdb0",strokeWidth:.05}),E.map((e,t)=>{let[n,r]=e;return(0,l.jsx)("polygon",{points:M(n+.5,r+.5),fill:"#dcd6c6",stroke:"#8f897a",strokeWidth:.06,strokeLinejoin:"round"},"s".concat(t))}),[0,1,2,3].map(e=>{let[t,n]=T[e];return(0,l.jsx)("polygon",{points:M(t+.5,n+.5,.3,.13),fill:"rgba(255,255,255,0.85)",stroke:"none"},"ss".concat(e))}),null==n.winner&&(0,l.jsx)("rect",{x:j[K][0]+.12,y:j[K][1]+.12,width:5.76,height:5.76,rx:.3,fill:"none",stroke:"#ffffff",strokeWidth:.16,className:"animate-pulse"}),V&&(0,l.jsx)("g",{style:{transform:"translate(".concat(G+3,"px, ").concat(Y+3,"px)"),transition:"transform 0.45s ease"},onPointerDown:Z?h:void 0,className:Z?"cursor-pointer":void 0,children:(0,l.jsx)("g",{transform:"scale(1.28)",children:(0,l.jsxs)("g",{className:f?"ludo-dice-rolling":u>0?"ludo-dice-land":void 0,children:[(0,l.jsx)("ellipse",{cy:.74,rx:.52,ry:.13,fill:"rgba(0,0,0,0.22)"}),(0,l.jsx)("rect",{x:-.62,y:-.62,width:1.24,height:1.24,rx:.24,fill:"#fffdf6",stroke:Z?q.fill:"#c9c2b2",strokeWidth:.08}),(null!=(t=F[null!=i?i:6])?t:[]).map((e,t)=>
1{let[n,r]=e;return(0,l.jsx)("circle",{cx:n,cy:r,r:.115,fill:"#26221c"},t)}),Z&&(0,l.jsx)("rect",{x:-.74,y:-.74,width:1.48,height:1.48,rx:.3,fill:"none",stroke:q.fill,strokeWidth:.09,className:"animate-pulse"})]},f?"rolling":"land-".concat(u))})}),null!=s&&n.turn===s&&null!=n.dice&&a.map(e=>{var t;let r=n.tokens[s][e],[a,o]=w(s,-1===r?0:r+(null!=(t=n.dice)?t:0),e);return(0,l.jsxs)("g",{className:"pointer-events-none",children:[(0,l.jsx)("circle",{cx:a,cy:o,r:.34,fill:N[s].fill,opacity:.16}),(0,l.jsx)("circle",{cx:a,cy:o,r:.38,fill:"none",stroke:N[s].fill,strokeWidth:.07,strokeDasharray:"0.17 0.11",opacity:.85,className:"ludo-ring"})]},"dest-".concat(e))}),S.filter(e=>"trail"===e.kind).map(e=>(0,l.jsx)("circle",{cx:e.x,cy:e.y,r:.3,fill:N[e.c].fill,className:"ludo-trail pointer-events-none"},e.id)),n.seats.flatMap(e=>[0,1,2,3].map(t=>{var r,a,i;let c="".concat(e,"-").concat(t),u=null!=(r=p[c])?r:_[c],[d,f]=null!=(a=L[c])?a:[0,0],m=!!k[c],h=s===e&&n.turn===e&&H.has(t),g=null!=(i=P[c])?i:1;return(0,l.jsx)("g",{opacity:x.has(e)?.4:1,style:{transform:"translate(".concat(u[0],"px, ").concat(u[1],"px)"),transition:m?"transform ".concat(160,"ms ease-in-out"):C[c]?"transform 0.72s cubic-bezier(0.4, 0.05, 0.3, 1)":"transform 0.45s cubic-bezier(0.25, 0.8, 0.35, 1)"},onPointerDown:h?()=>o(t):void 0,className:h?"cursor-pointer":void 0,children:(0,l.jsxs)("g",{style:{transform:"translate(".concat(d,"px, ").concat(f,"px)"),transition:"transform 0.3s ease"},children:[(0,l.jsx)("circle",{r:.6,fill:"transparent"}),h&&(0,l.jsx)("circle",{r:.5,fill:"rgba(255,255,255,0.22)",stroke:"#ffffff",strokeWidth:.08,className:"ludo-ring"}),(0,l.jsx)("g",{className:m?"ludo-walk":C[c]?"ludo-fly":void 0,children:(0,l.jsxs)("g",{style:{transform:"scale(".concat(g,")")},children:[(0,l.jsx)("ellipse",{cy:.3,rx:.3,ry:.1,fill:"rgba(0,0,0,0.3)"}),(0,l.jsx)("ellipse",{cy:.16,rx:.3,ry:.2,fill:"url(#ludo-tok-".concat(e,")")}),(0,l.jsx)("ellipse",{cy:.16,rx:.3,ry:.2,fill:"none",stroke:N[e].dark,strokeWidth:.03,opacity:.6}),(0,l.jsx)("path",{d:"M 0 0.24 C -0.2 0.02 -0.24 -0.02 -0.24 -0.12 A 0.24 0.24 0 1 1 0.24 -0.12 C 0.24 -0.02 0.2 0.02 0 0.24 Z",fill:"#f6f4ec",stroke:"rgba(0,0,0,0.22)",strokeWidth:.025}),(0,l.jsx)("circle",{cy:-.12,r:.13,fill:"url(#ludo-tok-".concat(e,")")}),(0,l.jsx)("circle",{cy:-.12,r:.13,fill:"none",stroke:N[e].dark,strokeWidth:.02,opacity:.5}),(0,l.jsx)("ellipse",{cx:-.08,cy:-.2,rx:.1,ry:.06,fill:"#ffffff",opacity:.8})]})})]})},c)})),S.filter(e=>"trail"!==e.kind).map(e=>"boom"===e.kind?(0,l.jsxs)("g",{className:"pointer-events-none",children:[(0,l.jsx)("circle",{cx:e.x,cy:e.y,r:.85,fill:"none",stroke:N[e.c].fill,strokeWidth:.14,className:"ludo-boom"}),(0,l.jsx)("circle",{cx:e.x,cy:e.y,r:.5,fill:N[e.c].fill,opacity:.5,className:"ludo-boom"}),[0,60,120,180,240,300].map(t=>(0,l.jsx)("g",{transform:"rotate(".concat(t," ").concat(e.x," ").concat(e.y,")"),children:(0,l.jsx)("rect",{x:e.x-.045,y:e.y-1.05,width:.09,height:.34,rx:.045,fill:N[e.c].fill,className:"ludo-boom"})},t))]},e.id):(0,l.jsxs)("g",{className:"pointer-events-none",children:[(0,l.jsx)("polygon",{points:M(e.x,e.y,.75,.32),fill:"#f7c948",stroke:"#b8860b",strokeWidth:.05,className:"ludo-star-pop"}),(0,l.jsx)("circle",{cx:e.x,cy:e.y,r:.95,fill:"none",stroke:"#f7c948",strokeWidth:.09,className:"ludo-boom"})]},e.id)),Z&&(0,l.jsx)("rect",{x:G,y:Y,width:6,height:6,fill:"transparent",className:"cursor-pointer",onPointerDown:h})]})}function R(){var e,t,n;let[i,c]=(0,r.useState)([]),[d,b]=(0,r.useState)(null),[y,j]=(0,r.useState)(!1),[v,k]=(0,r.useState)(null),[w,N]=(0,r.useState)(null),[T,E]=(0,r.useState)(0),[M,F]=(0,r.useState)([]),[R,I]=(0,r.useState)(!1),O=(0,r.useRef)(null),[W,_]=(0,r.useState)(""),[L,P]=(0,r.useState)(""),[A,H]=(0,r.useState)(!1),[K,q]=(0,r.useState)(0),G=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!K)return;let e=setTimeout(()=>q(0),2200);return()=>clearTimeout(e)},[K]);let Y=(0,r.useRef)([]),V=(0,r.useRef)(null),Z=(0,r.useRef)(!1),J=(0,r.useRef)(null),Q=(0,r.useRef)(null),U=(0,r.useRef)(null),X=(0,r.useRef)(null);Y.current=i,V.current=d,Z.current=y;let $=()=>{X.current&&clearTimeout(X.current),X.current=null,N(null)},ee=(0,r.useRef)(new Map),et=(0,r.useRef)(new Map),en=e=>{var t,n;let l=null!=(t=ee.current.get(e))?t:[];if(0===l.length){l=[1,2,3,4,5,6,1,2,3,4,5,6];for(let e=l.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[l[e],l[t]]=[l[t],l[e]]}ee.current.set(e,l)}let r=null!=(n=et.current.get(e))?n:0;if(r>=9&&6!==l[0]){let e=l.indexOf(6);e>0&&l.splice(e,1),l.unshift(6)}let s=l.shift();return et.current.set(e,6===s?0:r+1),s};(0,r.useEffect)(()=>()=>{Q.current&&clearInterval(Q.current),J.current&&clearTimeout(J.current),U.current&&clearTimeout(U.current),X.current&&clearTimeout(X.current),O.current&&clearTimeout(O.current)},[]);let el=e=>{_(e),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>_(""),2200)},er=()=>Y.current.find(e=>e.key===eh.myKey),es=e=>Y.current.find(t=>t.color===e),ea=e=>{var t,n;return null!=(n=null==(t=es(e))?void 0:t.name)?n:S[e]},eo=(0,r.useRef)(Date.now()),ei=e=>{if(eo.current=Date.now(),V.current=e,b({...e}),null!=e.winner){var t;P(ea(e.winner));let n=(null==(t=er())?void 0:t.color)===e.winner;(0,p._O)(n?"win":"lose"),(0,g.q7)("ludo-online",+!!n),eh.vsBots||(0,a.np)("ludo",n?"w":"l"),eh.endMatch()}},ec=(e,t)=>{let n=V.current;if(!n||null!==n.dice||null!=n.winner)return;let l=n.turn,{state:r,movable:s,forfeit:a}=function(e,t){let n=6===t?e.sixStreak+1:0;if(6===t&&n>=3)return{state:{...e,dice:null,sixStreak:0,turn:f(e)},movable:[],forfeit:!0};let l={...e,dice:t,sixStreak:n},r=x(l,t);return 0===r.length?{state:{...l,dice:null,turn:f(e),sixStreak:0},movable:[],forfeit:!1}:{state:l,movable:r,forfeit:!1}}(n,e),o=r.turn!==l;
1Z.current=!0,j(!0),X.current&&clearTimeout(X.current),N(l),(0,p._O)("flap"),Q.current&&clearInterval(Q.current),Q.current=setInterval(()=>{k(1+Math.floor(6*Math.random()))},110),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{Q.current&&(clearInterval(Q.current),Q.current=null),k(e),U.current=setTimeout(()=>{U.current=null,Z.current=!1,j(!1),E(e=>e+1),F(t=>[...t.slice(-11),{c:l,v:e}]),(0,p._O)("tap"),a?el("\uD83D\uDE35 Three sixes — turn forfeited!"):0===s.length&&el("\uD83C\uDFB2 Rolled ".concat(e," — no possible move")),o?X.current=setTimeout(()=>{X.current=null,N(null)},900):N(null)},240)},460),ei(r),eh.isHost&&eh.hostSync();let i=er();if(i&&r.turn===i.color&&null!=r.dice){let e=x(r,r.dice);1!==e.length||t||setTimeout(()=>{var t;(null==(t=V.current)?void 0:t.dice)!=null&&V.current.turn===i.color&&ef(e[0])},850)}},eu=(e,t)=>{let n=V.current;if(!n||null==n.dice||null!=n.winner||!x(n,n.dice).includes(e))return;let l=m(n,e);if($(),l.captured.length>0){var r,s,a,o;(0,p._O)("slice");let e=l.captured[0].color,t=(null==(r=er())?void 0:r.color)===n.turn,i=(null==(s=er())?void 0:s.color)===e;el(t?"\uD83D\uDCA5 Gotcha! You sent them home!":i?"\uD83D\uDE31 ".concat(ea(n.turn)," captured you!"):"\uD83D\uDCA5 ".concat(ea(n.turn)," captured a token!")),eh.localFloaty("\uD83D\uDCA5"),eh.localFloaty(t?"\uD83D\uDE0E":i?"\uD83D\uDE2D":"\uD83D\uDD25"),I(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>I(!1),450);try{null==(a=(o=navigator).vibrate)||a.call(o,60)}catch(e){}}else l.finished?((0,p._O)("combo"),eh.localFloaty("\uD83C\uDFE0"),el("\uD83C\uDFE0 ".concat(ea(n.turn)," got a token home!"))):l.extraTurn?((0,p._O)("tap"),el("\uD83C\uDFB2 ".concat(ea(n.turn)," rolled a 6 — extra turn!"))):(0,p._O)("tap");ei(l.state),eh.isHost&&eh.hostSync()},ed=(e,t)=>{let n=V.current;n&&null==n.winner&&(null==e||n.turn===e)&&($(),ei({...n,dice:null,sixStreak:0,turn:f(n)}),eh.isHost&&eh.hostSync())},ex=()=>{let e=V.current,t=er();if(!e||!t||e.turn!==t.color||null!==e.dice||Z.current)return;let n=en(t.color);eh.send("roll",{v:n}),ec(n,!1)},ef=e=>{let t=V.current,n=er();t&&n&&t.turn===n.color&&null!=t.dice&&x(t,t.dice).includes(e)&&(eh.send("pick",{t:e}),eu(e,!1))},em=(0,r.useCallback)(()=>{let e=V.current;e&&null==e.winner&&(eh.send("pass",{c:e.turn}),ed(e.turn,!1))},[]),eh=(0,o.VB)({prefix:"ludo",events:["roll","pick","pass"],onEvent:(e,t,n
1)=>{let l=V.current;if(!l)return;let r=Y.current.find(e=>e.key===n);if("pass"===e){var s;r&&ed(null!=(s=t.c)?s:null,!0);return}r&&r.color===l.turn&&("roll"===e&&ec(t.v,!0),"pick"===e&&eu(t.t,!0))},onStart:(e,t,n)=>{let l=u[Math.min(4,Math.max(2,e.length))],r=e.slice(0,l.length).map((e,n)=>({key:e,name:t[n],color:l[n]}));c(r),Y.current=r,P(""),k(null),Q.current&&clearInterval(Q.current),Q.current=null,U.current&&clearTimeout(U.current),U.current=null,$(),Z.current=!1,j(!1),ee.current=new Map,et.current=new Map,F([]),ei({seats:l,tokens:[0,1,2,3].map(()=>[-1,-1,-1,-1]),turn:l[0],dice:null,sixStreak:0,winner:null})},getState:()=>({ludo:V.current,seats:Y.current}),setState:e=>{(null==e?void 0:e.ludo)&&(eo.current=Date.now(),c(e.seats),Y.current=e.seats,b({...e.ludo}),V.current=e.ludo,null!=e.ludo.dice&&k(e.ludo.dice))},onPlayerLeft:(e,t)=>{let n=Y.current.find(t=>t.key===e);if(!n||(el("\uD83D\uDEAA ".concat(n.name," left — forfeited")),!eh.isHost))return;let l=V.current;if(!l||null!=l.winner)return;let r=Y.current.filter(e=>!t.has(e.key));if(r.length<=1){r[0]&&(ei({...l,winner:r[0].color}),eh.hostSync());return}l.turn===n.color&&em()},onTurnTimeout:()=>{let e=V.current,t=er();e&&null==e.winner&&t&&e.turn===t.color&&(el("⏰ Time's up — turn passed"),em())},botAction:()=>{let e=V.current;if(!e||null!=e.winner||Z.current)return null;let t=Y.current.find(t=>t.color===e.turn);if(!t||!t.key.startsWith("bot-"))return null;if(null==e.dice)return{event:"roll",payload:{v:en(e.turn)},fromKey:t.key};let n=x(e,e.dice);if(0===n.length)return null;let l=n[0],r=-1/0;for(let t of n){let n=m(e,t),s=e.tokens[e.turn][t],a=50*n.captured.length+30*!!n.finished+8*!!n.extraTurn+12*(-1===s)+.2*s+2*Math.random();a>r&&(r=a,l=t)}return{event:"pick",payload:{t:l},fromKey:t.key}}});(0,r.useEffect)(()=>{if(!eh.isHost||"playing"!==eh.stage)return;let e=new Set(eh.players.map(e=>e.key)),t=!1,n=Y.current.map(n=>{if(e.has(n.key))return n;let l=eh.players.find(e=>e.name===n.name&&!Y.current.some(t=>t.key===e.key));return l?(t=!0,{...n,key:l.key}):n});t&&(c(n),Y.current=n,eh.hostSync());let l=V.current;if(l&&null==l.winner){let t=n.find(e=>e.color===l.turn);if(t&&!e.has(t.key)){let e=setTimeout(()=>{let e=V.current,n=!eh.players.some(e=>e.key===t.key);e&&e.turn===t.color&&n&&(eh.send("pass",{c:t.color}),ed(t.color,!1))},6e3);return()=>clearTimeout(e)}}},[eh.players,eh.stage,eh.isHost]);let ep=(0,r.useRef)(new Set);(0,r.useEffect)(()=>{if("playing"!==eh.stage&&"over"!==eh.stage){ep.current=new Set;return}let e=new Set(eh.players.map(e=>e.key)),t=new Set(i.filter(t=>!e.has(t.key)).map(e=>e.color)),n=ep.current;for(let e of i){if(e.key===eh.myKey)continue;let l=n.has(e.color),r=t.has(e.color);r&&!l?(el("\uD83D\uDCF4 ".concat(e.name," lost connection…")),(0,p._O)("chirp")):!r&&l&&(el("✅ ".concat(e.name," is back!")),(0,p._O)("combo"))}ep.current=t},[eh.players,i,eh.stage]);let eg=(0,r.useRef)(null);if((0,r.useEffect)(()=>{if("playing"!==eh.stage){eg.current=null;return}let e=setInterval(()=>{let e=V.current;if(!e||null!=e.winner)return;let t=new Set(eh.players.map(e=>e.key)),n=Y.current.some(e=>e.key===eh.myKey),l=Y.current.some(e=>e.key!==eh.myKey&&t.has(e.key));if(!n||l){eg.current=null;return}if(null==eg.current){eg.current=Date.now(),el("\uD83D\uDCF4 Everyone disconnected — you win if nobody returns");return}if(Date.now()-eg.current>3e4){eg.current=null;let t=er();t&&(ei({...e,winner:t.color}),eh.isHost&&eh.hostSync())}},1500);return()=>clearInterval(e)},[eh.players,eh.stage]),(0,r.useEffect)(()=>{if("playing"!==eh.stage||!d||null!=d.winner)return;let e=er(),t=!!e&&d.turn===e.color;if(eh.beginTurn(t),t&&null==d.dice&&!document.hidden){(0,p._O)("chirp");try{var n,l;null==(n=(l=navigator).vibrate)||n.call(l,30)}catch(e){}}},[null==d?void 0:d.turn,(null==d?void 0:d.dice)===null,eh.stage]),(0,r.useEffect)(()=>{if("playing"!==eh.stage)return;let e=setInterval(()=>{eh.isHost&&(Date.now()-eo.current<3500||eh.hostSync())},2e3);return()=>clearInterval(e)},[eh.stage,eh.isHost]),(0,r.useEffect)(()=>{if("playing"!==eh.stage)return;let e=setInterval(()=>{let e=V.current;if(!e||null!=e.winner)return;let t=(Math.max(eh.moveTotal,10)+6)*1e3;if(Date.now()-eo.current<t)return;let n=Y.current.find(t=>t.color===e.turn),l=new Set(eh.players.map(e=>e.key)),r=Y.current.find(e=>l.has(e.key)&&e.key!==(null==n?void 0:n.key));if(r&&r.key===eh.myKey){var s;eo.current=Date.now(),el("⏰ ".concat(null!=(s=null==n?void 0:n.name)?s:"Player","'s turn skipped")),eh.send("pass",{c:e.turn}),ed(e.turn,!1)}},1500);return()=>clearInterval(e)},[eh.stage,eh.players,eh.moveTotal]),(0,r.useEffect)(()=>{window.__ludoPick=e=>ef(e),window.__ludoRoll=()=>ex()}),!eh.enabled)return(0,l.jsx)("div",{className:"flex min-h-[20rem] items-center justify-center text-zinc-400",children:"Online play isn't configured on this deployment yet."});if(eh.matching)return(0,l.jsx)("div",{className:"select-none",children:(0,l.jsxs)("div",{className:"mx-auto flex max-w-md flex-col items-center gap-5 rounded-2xl border border-white/10 bg-gradient-to-b from-slate-900/60 to-zinc-900/60 p-8 text-center",children:[(0,l.jsx)("p",{className:"animate-bounce text-5xl","aria-hidden":!0,
1children:"\uD83C\uDFB2"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-xl font-extrabold text-white",children:"Looking for an opponent…"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-zinc-400",children:eh.seekers>1?"Players found — waiting a moment for more (up to 4)…":"Games start with 2–4 players — you'll join the next group"})]}),(0,l.jsxs)("div",{className:"flex items-center justify-center gap-6","aria-hidden":!0,children:[(0,l.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,l.jsx)("span",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-gradient-to-br from-amber-500/40 to-orange-600/40 text-2xl ring-2 ring-amber-400/60",children:"\uD83D\uDE42"}),(0,l.jsx)("span",{className:"max-w-[5.5rem] truncate text-xs font-bold text-zinc-300",children:eh.name||"You"})]}),(0,l.jsxs)("div",{className:"relative h-16 w-16",children:[[0,1,2].map(e=>(0,l.jsx)("span",{className:"mm-ring absolute inset-0 rounded-full border-2 border-amber-400/70",style:{animationDelay:"".concat(.5*e,"s")}},e)),(0,l.jsx)("span",{className:"absolute inset-0 flex items-center justify-center text-xl",children:"\uD83C\uDFB2"})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,l.jsx)("div",{className:"grid grid-cols-2 gap-1",children:[0,1,2,3].map(e=>(0,l.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full text-xs ".concat(e<eh.seekers?"bg-emerald-500/40 ring-1 ring-emerald-400/70":"mm-shimmer bg-white/10 ring-1 ring-white/15"),children:e<eh.seekers?"\uD83D\uDE00":"?"},e))}),(0,l.jsxs)("span",{className:"text-xs font-bold text-zinc-500",children:[eh.seekers,"/4 joined"]})]})]}),(0,l.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[eh.hasBots&&(0,l.jsx)("button",{onClick:()=>eh.playBots(3),className:"rounded-xl bg-gradient-to-r from-indigo-500 to-violet-600 px-6 py-2.5 font-bold text-white transition hover:scale-[1.02]",children:"\uD83E\uDD16 Play the AI now"}),(0,l.jsx)("button",{onClick:eh.cancelMatch,className:"rounded-xl bg-white/10 px-6 py-2.5 font-bold text-zinc-300 transition hover:bg-white/20",children:"✕ Cancel"})]}),(0,l.jsx)("p",{className:"text-xs text-zinc-500",children:"Tip: it's faster to invite friends — create a room and share the link"})]})});if("menu"===eh.stage){let e=e=>()=>{if(!eh.name.trim()){var t;q(e=>e+1),null==(t=G.current)||t.focus();return}e()};return(0,l.jsxs)("div",{className:"relative select-none",children:[(0,l.jsx)(s.Xp,{nudge:K}),(0,l.jsxs)("div",{className:"pointer-events-none absolute inset-0 -z-10","aria-hidden":!0,children:[(0,l.jsx)("div",{className:"absolute left-1/2 top-8 h-72 w-72 -translate-x-1/2 rounded-full bg-gradient-to-br from-amber-500 to-orange-600 opacity-20 blur-3xl"}),(0,l.jsx)("span",{className:"absolute -top-8 right-[6%] rotate-12 text-[7rem] opacity-[0.06]",children:"\uD83C\uDFB2"}),(0,l.jsx)("span",{className:"absolute bottom-0 left-[4%] -rotate-12 text-[5.5rem] opacity-[0.05]",children:"\uD83C\uDFB2"})]}),(0,l.jsxs)("div",{className:"mx-auto flex max-w-md flex-col gap-5 rounded-2xl border border-white/10 bg-gradient-to-b from-slate-900/60 to-zinc-900/60 p-6",children:[(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("p",{className:"text-4xl","aria-hidden":!0,children:"\uD83C\uDFB2"}),(0,l.jsx)("h2",{className:"mt-2 text-xl font-extrabold text-white",children:eh.invited?"You're invited to Ludo!":"Play Ludo with friends"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-zinc-400",children:"2–4 players \xb7 the classic board, live"})]}),eh.matchEmpty&&(0,l.jsxs)("div",{className:"rounded-xl border border-amber-400/30 bg-amber-500/10 p-3 text-center text-sm",children:[(0,l.jsx)("p",{className:"font-bold text-amber-300",children:"\uD83D\uDE15 No players online right now"}),(0,l.jsx)("p",{className:"mt-0.5 text-xs text-zinc-400",children:eh.hasBots?"Play our AI instead, or create a room and invite friends.":"Try again in a bit — or create a room and invite friends, it only takes one link."}),eh.hasBots&&(0,l.jsx)("button",{onClick:()=>eh.playBots(3),className:"mt-2 rounded-xl bg-gradient-to-r from-indigo-500 to-violet-600 px-5 py-2 font-bold text-white transition hover:scale-[1.02]",children:"\uD83E\uDD16 Play the AI"})]}),(0,l.jsxs)("label",{className:"text-sm font-semibold text-zinc-300",children:["Your name",(0,l.jsxs)("div",{className:"mt-1 flex gap-2",children:[(0,l.jsx)("input",{ref:G,value:eh.name,onChange:e=>eh.saveName(e.target.value),placeholder:"e.g. Sanket",className:"w-full flex-1 rounded-xl border bg-black/30 px-4 py-2.5 font-bold text-white outline-none placeholder:text-zinc-600 focus:border-amber-400/60 ".concat(K?"shake-nudge border-rose-400/80":"border-white/10")}),(0,l.jsx)("button",{onClick:()=>{var e;eh.saveName((0,s.Zm)(),{auto:!0}),null==(e=G.current)||e.focus()},title:"Give me a random name","aria-label":"Random name",className:"rounded-xl bg-white/10 px-3 text-xl transition hover:rotate-12 hover:bg-white/20",children:"\uD83C\uDFB2"})]})]}),eh.invited?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("button",{onClick:e(eh.joinExisting),
1className:"rounded-xl bg-gradient-to-r from-amber-500 to-orange-600 px-6 py-3 font-bold text-white transition hover:scale-[1.02]",children:["▶ Join the game (",eh.codeInput,")"]}),(0,l.jsx)("button",{onClick:e(eh.createRoom),className:"rounded-xl bg-white/10 px-6 py-2.5 font-bold text-zinc-300 transition hover:bg-white/20",children:"or create your own room"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:e(eh.createRoom),className:"rounded-xl bg-gradient-to-r from-amber-500 to-orange-600 px-6 py-3 text-lg font-bold text-white shadow-lg transition hover:scale-[1.02]",children:"➕ Create a room"}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,l.jsx)("button",{onClick:e(eh.quickMatch),className:"rounded-xl border border-fuchsia-400/40 bg-fuchsia-500/15 px-4 py-2.5 font-bold text-fuchsia-200 transition hover:scale-[1.02] hover:bg-fuchsia-500/25 ".concat(eh.hasBots?"":"col-span-2"),children:"⚡ Quick match"}),eh.hasBots&&(0,l.jsx)("button",{onClick:e(()=>eh.playBots(3)),className:"rounded-xl border border-indigo-400/40 bg-indigo-500/15 px-4 py-2.5 font-bold text-indigo-200 transition hover:scale-[1.02] hover:bg-indigo-500/25",children:"\uD83E\uDD16 Play the AI"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-3 text-xs text-zinc-500",children:[(0,l.jsx)("span",{className:"h-px flex-1 bg-white/10"})," or join friends",(0,l.jsx)("span",{className:"h-px flex-1 bg-white/10"})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("input",{value:eh.codeInput,onChange:e=>eh.setCodeInput(e.target.value.toUpperCase().slice(0,6)),placeholder:"ROOM CODE",className:"w-full flex-1 rounded-xl border border-white/10 bg-black/30 px-4 py-2.5 text-center font-mono text-lg font-extrabold tracking-[0.3em] text-white outline-none placeholder:text-sm placeholder:tracking-normal placeholder:text-zinc-600 focus:border-amber-400/60"}),(0,l.jsx)("button",{onClick:e(eh.joinExisting),className:"rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 px-5 py-2.5 font-bold text-white transition hover:scale-[1.02]",children:"Join"})]})]}),eh.error&&(0,l.jsx)("p",{className:"text-center text-sm font-semibold text-rose-400",children:eh.error}),(0,l.jsx)(s.tF,{game:"ludo"}),(0,l.jsx)(s.my,{game:"ludo"})]}),(0,l.jsx)("p",{className:"mt-4 text-center text-sm text-zinc-500",children:"Free \xb7 no accounts \xb7 share one link and everyone plays"})]})}let eb=i.find(e=>e.key===eh.myKey),ey=d?i.find(e=>e.color===d.turn):void 0,ej=!!eb&&!!d&&d.turn===eb.color&&!d.winner,ev=ej&&(null==d?void 0:d.dice)!=null?x(d,d.dice):[],ek=new Set(i.filter(e=>!eh.players.some(t=>t.key===e.key)).map(e=>e.color)),ew=(0,l.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[(0,l.jsx)("div",{className:"flex items-center gap-2 text-sm",children:eh.vsBots?(0,l.jsx)("span",{className:"rounded-full bg-indigo-500/20 px-3 py-1.5 text-xs font-bold text-indigo-200",children:"\uD83E\uDD16 vs AI"}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"rounded-full bg-white/10 px-3 py-1.5 font-mono text-lg font-extrabold tracking-[0.25em] text-white",children:eh.roomCode}),(0,l.jsx)("button",{onClick:eh.copyInvite,className:"rounded-full bg-white/10 px-3 py-1.5 font-semibold text-zinc-300 transition hover:bg-white/20",children:eh.copied?"✅ Copied!":"\uD83D\uDD17 Copy invite"}),(0,l.jsx)("span",{className:"hidden rounded-full px-3 py-1.5 text-xs font-bold sm:block ".concat("open"===eh.status?"bg-emerald-500/20 text-emerald-300":"bg-amber-500/20 text-amber-300"),children:"open"===eh.status?"● live":"● connecting…"})]})}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[!eh.vsBots&&(0,l.jsx)("button",{onClick:eh.toggleNotify,title:"Notify me when it's my turn",className:"rounded-xl px-3 py-2 text-lg transition hover:bg-white/20 ".concat(eh.notifyOn?"bg-amber-500/25":"bg-white/10"),children:eh.notifyOn?"\uD83D\uDD14":"\uD83D\uDD15"}),(0,l.jsx)(s.A7,{needConfirm:"playing"===eh.stage,onLeave:eh.leaveRoom})]})]});if("lobby"===eh.stage){let e=u[Math.min(4,Math.max(2,eh.players.length))];return(0,l.jsxs)("div",{className:"select-none",children:[ew,(0,l.jsxs)("div",{className:"mx-auto max-w-md rounded-2xl border border-white/10 bg-gradient-to-b from-slate-900/60 to-zinc-900/60 p-6",children:[(0,l.jsx)("h3",{className:"text-center text-lg font-extrabold text-white",children:"\uD83C\uDFB2 Game lobby"}),(0,l.jsx)("p",{className:"mt-1 text-center text-sm text-zinc-400",children:eh.players.length<2?"Waiting for friends — share the invite link!":"".concat(eh.players.length," player").concat(eh.players.length>
11?"s":""," in — up to 4 can play")}),(0,l.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[eh.players.slice(0,4).map((t,n)=>(0,l.jsxs)("div",{className:"flex items-center gap-3 rounded-xl bg-white/5 px-4 py-2.5",children:[(0,l.jsx)("span",{className:"h-4 w-4 rounded-full ".concat(C[e[Math.min(n,e.length-1)]])}),(0,l.jsxs)("span",{className:"flex-1 font-bold text-white",children:[t.name,t.you&&(0,l.jsx)("span",{className:"ml-1 text-zinc-400",children:"(you)"})]}),t.isHost&&(0,l.jsx)("span",{className:"rounded-full bg-amber-500/20 px-2.5 py-0.5 text-xs font-bold text-amber-300",children:"\uD83D\uDC51 host"}),(0,l.jsx)("span",{className:"animate-pulse text-emerald-400",children:"●"})]},t.key)),eh.players.length<4&&Array.from({length:Math.min(4,Math.max(2,eh.players.length+1))-eh.players.length}).map((e,t)=>(0,l.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border border-dashed border-white/10 px-4 py-2.5 text-sm text-zinc-500",children:[(0,l.jsx)("span",{className:"h-4 w-4 rounded-full bg-white/10"}),"waiting for a player…"]},"empty".concat(t)))]}),eh.quick?(0,l.jsxs)("div",{className:"mt-5 flex flex-col items-center gap-2 text-center",children:[(0,l.jsx)("p",{className:"text-sm font-bold text-emerald-300",children:eh.players.length>=2?"⚡ Match found — starting…":"⏳ Gathering your group…"}),(0,l.jsx)("span",{className:"flex gap-1.5","aria-hidden":!0,children:[0,1,2].map(e=>(0,l.jsx)("span",{className:"h-2.5 w-2.5 animate-bounce rounded-full bg-white/60",style:{animationDelay:"".concat(.15*e,"s")}},e))})]}):eh.isHost?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"mt-5 flex justify-center gap-2",children:o.Ev.map(e=>(0,l.jsxs)("button",{onClick:()=>eh.chooseTime(e.secs),className:"rounded-xl px-3 py-2 text-center text-xs font-bold transition ".concat(eh.timeSecs===e.secs?"bg-amber-500/30 text-amber-200 ring-1 ring-amber-400/60":"bg-white/5 text-zinc-400 hover:bg-white/10"),children:[(0,l.jsx)("div",{children:e.label}),(0,l.jsx)("div",{className:"mt-0.5 font-medium opacity-75",children:e.sub})]},e.secs))}),(0,l.jsx)("button",{onClick:eh.startGame,disabled:eh.players.length<2,className:"mt-4 w-full rounded-xl bg-gradient-to-r from-amber-500 to-orange-600 px-6 py-3 font-bold text-white transition hover:scale-[1.01] disabled:cursor-not-allowed disabled:opacity-40",children:eh.players.length<2?"Need at least 2 players…":"▶ Start with ".concat(Math.min(4,eh.players.length)," players")})]}):(0,l.jsx)("p",{className:"mt-5 text-center text-sm font-semibold text-zinc-300",children:"⏳ Waiting for the host to start the game…"}),(0,l.jsx)(s.cQ,{api:eh})]}),(0,l.jsx)("p",{className:"mt-3 text-center text-xs text-zinc-500",children:"2 players sit opposite \xb7 turn timer set by the host \xb7 \uD83C\uDFB2 roll a 6 to bring a token out"})]})}return(0,l.jsxs)("div",{className:"select-none",children:[ew,(0,l.jsx)("div",{className:"mb-3 flex flex-wrap items-center justify-center gap-2 text-sm font-semibold",children:i.map(e=>{let t=!!d&&!d.winner&&d.turn===e.color,n=d?h(d,e.color):0,r=!eh.players.some(t=>t.key===e.key);return(0,l.jsxs)("span",{className:"flex items-center gap-1.5 rounded-full px-3 py-1.5 transition-opacity ".concat(t?"bg-white/15 text-white ring-1 ring-amber-400/70":"bg-white/5 text-zinc-300"," ").concat(r?"opacity-50":""),children:[(0,l.jsx)("span",{className:"h-3 w-3 rounded-full ".concat(C[e.color])}),e.name,e.key===eh.myKey&&(0,l.jsx)("span",{className:"text-zinc-400",children:"(you)"}),n>0&&(0,l.jsxs)("span",{className:"text-xs text-emerald-300",children:["\uD83C\uDFE0",n]}),r&&(0,l.jsx)("span",{className:"rounded-full bg-rose-500/20 px-1.5 text-[10px] font-bold text-rose-300",children:"\uD83D\uDCF4 offline"}),t&&eh.moveWhose&&(0,l.jsx)("span",{className:"ml-0.5 rounded-full bg-black/40 px-1.5 text-xs font-bold text-amber-300",children:eh.moveLeft})]},e.color)})}),(0,l.jsx)("p",{className:"mb-2 text-center text-sm font-bold text-zinc-200",children:(null==d?void 0:d.winner)!=null?(0,l.jsxs)("span",{className:D[d.winner],children:["\uD83C\uDFC6 ",L," wins the game!"]}
1):y&&null!=w?(0,l.jsxs)("span",{className:D[w],children:["\uD83C\uDFB2"," ",(null==(e=es(w))?void 0:e.key)===eh.myKey?"You're rolling…":"".concat(ea(w)," is rolling…")]}):ej?(null==d?void 0:d.dice)==null?(0,l.jsx)("span",{className:"text-emerald-300",children:"\uD83C\uDFB2 Your turn — tap the dice in your house!"}):(0,l.jsxs)("span",{className:"text-emerald-300",children:["You rolled ",d.dice," — pick a glowing token"]}):(0,l.jsxs)("span",{children:["⏳ ",null!=(t=null==ey?void 0:ey.name)?t:"…",(null==d?void 0:d.dice)!=null?" rolled ".concat(d.dice,"…"):"'s turn"]})}),M.length>0&&(null==d?void 0:d.winner)==null&&(0,l.jsxs)("div",{className:"mb-2 flex items-center justify-center gap-1.5","aria-label":"Recent dice rolls",children:[(0,l.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-wider text-zinc-500",children:"rolls"}),M.map((e,t)=>(0,l.jsx)("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-zinc-100 text-[11px] font-extrabold text-zinc-900 ring-2 ".concat(z[e.c]," ").concat(t===M.length-1?"animate-bounce-in":""),style:{opacity:.45+.55*(t+1)/M.length},children:e.v},t))]}),(0,l.jsxs)("div",{"data-board":!0,className:"relative mx-auto aspect-square w-full max-w-lg overflow-hidden rounded-2xl border border-white/10 bg-[#11131f] p-2 sm:p-3 ".concat(R?"ludo-shake":""),children:[d&&(0,l.jsx)(B,{ludo:d,myColor:null==eb?void 0:eb.color,movable:ev,onPick:ef,diceValue:v,diceOwner:w,landStamp:T,offline:ek,rolling:y,canRoll:ej&&null==d.dice,onRoll:ex}),(0,l.jsx)(s.ls,{api:eh,youActive:ej,turnLabel:(null==d?void 0:d.winner)!=null?"\uD83C\uDFC6 ".concat(L," wins!"):ej?"Your turn":"".concat(null!=(n=null==ey?void 0:ey.name)?n:"…","'s turn"),accentDot:ey?C[ey.c
1olor]:"bg-zinc-500",quickChat:o.yV}),eh.floaties.map(e=>(0,l.jsx)("span",{className:"animate-floaty pointer-events-none absolute bottom-6 z-20 text-4xl drop-shadow-lg",style:{left:"".concat(e.left,"%")},children:e.emoji},e.id)),(0,l.jsx)("div",{className:"online-chat pointer-events-none absolute inset-x-0 top-2 z-20 flex flex-col items-stretch gap-1.5 px-3",children:eh.chats.map(e=>(0,l.jsx)("div",{className:"flex ".concat(e.mine?"justify-end":"justify-start"),children:(0,l.jsxs)("span",{className:"animate-bounce-in max-w-[70%] rounded-2xl px-3 py-1.5 text-sm font-semibold shadow-xl ring-1 ring-black/30 ".concat(e.mine?"rounded-tr-sm bg-sky-500/95 text-white":"rounded-tl-sm bg-zinc-700/95 text-zinc-100"),children:[(0,l.jsxs)("span",{className:"mr-1 text-xs opacity-70",children:[e.from,":"]}),e.text]})},e.id))}),W&&(0,l.jsx)("div",{className:"pointer-events-none absolute left-1/2 top-1/2 z-30 -translate-x-1/2 -translate-y-1/2 rounded-2xl bg-black/80 px-5 py-3 text-center text-lg font-extrabold text-amber-300 shadow-2xl ring-1 ring-amber-400/40",children:W}),"open"!==eh.status&&(0,l.jsx)("div",{className:"absolute inset-0 z-30 flex items-center justify-center bg-black/30 backdrop-blur-[3px]",children:(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-full bg-zinc-900/90 px-5 py-2.5 font-bold text-white shadow-xl",children:[(0,l.jsx)("span",{className:"inline-block h-2.5 w-2.5 animate-ping rounded-full bg-amber-400"}),"Reconnecting…"]})}),"over"===eh.stage&&(0,l.jsxs)("div",{className:"absolute inset-0 z-30 flex flex-col items-center justify-center gap-4 bg-black/65 backdrop-blur-sm",children:[Array.from({length:32}).map((e,t)=>(0,l.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute top-0 rounded-sm",style:{left:"".concat(89*t%100,"%"),width:6+t%3*2,height:10+t%4*2,background:["#ef4444","#22c55e","#eab308","#3b82f6","#f472b6"][t%5],animation:"confetti-fall ".concat(1.5+t%5*.3,"s ease-in ").concat(t%7*.13,"s forwards")}},t)),(0,l.jsxs)("p",{className:"px-4 text-center text-3xl font-extrabold text-white",children:["\uD83C\uDFC6 ",L," wins!"]}),d&&(0,l.jsx)("div",{className:"flex flex-col items-center gap-1 text-sm text-zinc-200",children:[...i].sort((e,t)=>(t.color===d.winner?99:h(d,t.color))-(e.color===d.winner?99:h(d,e.color))).map((e,t)=>(0,l.jsxs)("p",{className:0===t?"font-bold":"",children:[["\uD83E\uDD47","\uD83E\uDD48","\uD83E\uDD49","4️⃣"][t]," ",(0,l.jsx)("span",{className:D[e.color],children:e.name})," —"," ",h(d,e.color),"/4 home"]},e.color))}),eh.isHost?(0,l.jsx)("button",{onClick:eh.backToLobby,className:"rounded-xl bg-gradient-to-r from-amber-500 to-orange-600 px-6 py-3 font-bold text-white transition hover:scale-105",children:eh.vsBots?"\uD83D\uDD01 Play again":"\uD83C\uDFB2 Back to lobby (play again)"}):(0,l.jsx)("p",{className:"text-sm text-zinc-300",children:"Waiting for the host to restart…"})]})]}),(0,l.jsxs)("div",{className:"relative mt-3 flex flex-wrap items-center justify-center gap-2",children:[["\uD83D\uDC4D","\uD83D\uDE02","\uD83D\uDE2E","\uD83D\uDE31","\uD83C\uDF89"].map(e=>(0,l.jsx)("button",{onClick:()=>eh.react(e),className:"rounded-full bg-white/10 px-2.5 py-1 text-lg transition hover:scale-110 hover:bg-white/20",children:e},e)),(0,l.jsx)("button",{onClick:()=>H(e=>!e),className:"rounded-full px-2.5 py-1 text-lg transition hover:scale-110 ".concat(A?"bg-sky-500/40":"bg-white/10 hover:bg-white/20"),children:"\uD83D\uDCAC"}),A&&(0,l.jsx)("div",{className:"absolute bottom-full left-1/2 z-40 mb-2 flex w-56 -translate-x-1/2 flex-col gap-1 rounded-2xl border border-white/10 bg-zinc-900/95 p-2 shadow-2xl",children:o.yV.map(e=>(0,l.jsx)("button",{onClick:()=>{eh.sendChat(e),H(!1)},className:"rounded-lg px-3 py-1.5 text-left text-sm font-semibold text-zinc-200 transition hover:bg-white/10",children:e},e))})]}),(0,l.jsx)("p",{className:"mt-3 text-center text-xs text-zinc-500",children:"\uD83C\uDFB2 6 brings a token out & rolls again \xb7 land on an enemy to capture \xb7 ⭐ star cells are safe \xb7 tap the dice in your house to roll"})]})}}}]);

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.