import{R as e,r as m}from"./index-56c1d501.js";import{c as Fe}from"./clsx-e0889333.js";import{B as X,u as k,a as R,m as u,A as C,c as Ye,b as He,d as We,e as Ve,t as Je,Q as Xe,P as ze}from"./redux-thunk-93cdf4f0.js";import{a as ie,g as Ke}from"./ststistic-3f81b54e.js";import{u as G}from"./use-sound.esm-86ef9aee.js";import{a as qe,s as Qe}from"./sadTrombone-a3e2bf79.js";import{p as Ze}from"./put-disc-c35d6269.js";import{m as et}from"./mixkit-twig-breaking-2945-bd8452d5.js";import{m as tt}from"./mixkit-tree-branch-brake-2943-8211ee5f.js";import{u as at}from"./use-animation-894d55ea.js";import{F as P,D as re,q as lt,a as ne}from"./index-63998e7b.js";import{d as ot,p as rt,a as nt,P as st}from"./index-bdb71453.js";import{_ as ct}from"./preload-helper-f61836a9.js";import"./recaptcha-v3-f0e7cd4f.js";import"./fingerprint-374ab551.js";import"./index-f11686b8.js";const be=document.getElementById("root").getAttribute("data-game-title").replaceAll("\\",""),it=document.getElementById("root").getAttribute("data-suffle").replaceAll("\\",""),dt=document.getElementById("root").getAttribute("data-deselect-all").replaceAll("\\",""),mt=document.getElementById("root").getAttribute("data-submit").replaceAll("\\",""),ut=document.getElementById("root").getAttribute("data-form-four-groups-of-four-items-each").replaceAll("\\",""),pt=document.getElementById("root").getAttribute("data-mistakes-remaining").replaceAll("\\","");document.getElementById("root").getAttribute("data-easy").replaceAll("\\","");document.getElementById("root").getAttribute("data-medium").replaceAll("\\","");document.getElementById("root").getAttribute("data-hard").replaceAll("\\","");document.getElementById("root").getAttribute("data-difficulty").replaceAll("\\","");const yt=document.getElementById("root").getAttribute("data-congratulations").replaceAll("\\",""),ft=document.getElementById("root").getAttribute("data-you-have-found-all-groups").replaceAll("\\",""),gt=document.getElementById("root").getAttribute("data-connection-results").replaceAll("\\",""),se=document.getElementById("root").getAttribute("data-share-results").replaceAll("\\",""),bt=document.getElementById("root").getAttribute("data-your-results-have-been-successfully-copied-to-the-clipboard").replaceAll("\\",""),Et=document.getElementById("root").getAttribute("data-unable-to-copy-your-results-to-the-clipboard-please-try-again").replaceAll("\\",""),xt=document.getElementById("root").getAttribute("data-game-over").replaceAll("\\",""),kt=document.getElementById("root").getAttribute("data-all-attempts-used-up").replaceAll("\\",""),Ee=document.getElementById("root").getAttribute("data-options").replaceAll("\\",""),ht=document.getElementById("root").getAttribute("data-how-to-play").replaceAll("\\",""),xe=document.getElementById("root").getAttribute("data-statistics").replaceAll("\\",""),wt=document.getElementById("root").getAttribute("data-back").replaceAll("\\",""),At=document.getElementById("root").getAttribute("data-sound").replaceAll("\\",""),St=document.getElementById("root").getAttribute("data-please-note-the-statistics-will-be-deleted-if-you-clear-your-browser-cache-or-delete-your-cookies").replaceAll("\\",""),Nt=document.getElementById("root").getAttribute("data-reset").replaceAll("\\",""),ke=document.getElementById("root").getAttribute("data-close").replaceAll("\\",""),he=document.getElementById("root").getAttribute("data-cancel").replaceAll("\\",""),vt=document.getElementById("root").getAttribute("data-one-away").replaceAll("\\",""),_t=document.getElementById("root").getAttribute("data-youve-already-guessed-those-words").replaceAll("\\",""),It=document.getElementById("root").getAttribute("data-countdown-to-next-game").replaceAll("\\",""),Tt=document.getElementById("root").getAttribute("data-total-played").replaceAll("\\",""),Ot=document.getElementById("root").getAttribute("data-total-completed").replaceAll("\\",""),Ct=document.getElementById("root").getAttribute("data-winning-rate").replaceAll("\\",""),jt=document.getElementById("root").getAttribute("data-current-streak").replaceAll("\\",""),Lt=document.getElementById("root").getAttribute("data-max-streak").replaceAll("\\",""),Mt=document.getElementById("root").getAttribute("data-loading").replaceAll("\\",""),we=document.getElementById("root").getAttribute("data-menu").replaceAll("\\",""),Rt=document.getElementById("root").getAttribute("data-how-to-play-description").replaceAll("\\",""),x=JSON.parse(document.getElementById("root").getAttribute("data-archive")),de=!!document.getElementById("root").getAttribute("data-is-archive-game"),Dt=document.getElementById("root").getAttribute("data-you-want-to-play-archive-games").replaceAll("\\",""),Ae=document.getElementById("root").getAttribute("data-archive-link-name"),Pt=document.getElementById("root").getAttribute("data-play-archive").replaceAll("\\",""),Se=document.getElementById("root").getAttribute("data-archive-url"),Bt=document.getElementById("root").getAttribute("data-are-you-sure-you-want-to-reset-stats").replaceAll("\\",""),Ut=document.getElementById("root").getAttribute("data-ok").replaceAll("\\",""),z=document.documentElement.lang,Gt=(t=!1)=>{let a=localStorage.getItem("connections-browserVisitId"+x.date);return t&&(localStorage.removeItem("persist:"+localStorage.getItem("connections-browserVisitId"+x.date)),a=Math.random().toString(36).substr(2,9),localStorage.setItem("connections-browserVisitId"+x.date,a)),a},M=t=>JSON.parse(JSON.stringify(t)),Ne=(t="en")=>{const a=new Date,o=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return t==="de"?`${r}.${l}.${o}`:`${r}-${l}-${o}`},ae=[],me=(t,a,o,l=!1)=>{if(!t||!a||!o)return;let r=le();const n=`${o}-${a}-${t}`;r=r.filter(s=>s.id!==n),r.push({id:n,isSucceed:l}),localStorage.setItem("connections-statistics",JSON.stringify(r))},le=()=>{const t=localStorage.getItem("connections-statistics");return t?JSON.parse(t):ae},$t=()=>(localStorage.setItem("connections-statistics",JSON.stringify(ae)),ae),te=t=>{let a=0,o=0,l=0,r=0;for(let n=t.length-1;n>=0;n--)t[n].isSucceed?(a++,o++,r++,r>l&&(l=r)):(o=0,r=0);return{totalPlayed:t.length,totalCompleted:a,currentStreak:o,maxStreak:l,winningRate:(a*100/Math.max(1,t.length)).toFixed()+" %"}},ve=t=>{for(let a=t.length-1;a>0;a--){const o=Math.floor(Math.random()*(a+1));[t[a],t[o]]=[t[o],t[a]]}return t},Ft=t=>ve(t.flatMap(({category:a,words:o,difficulty:l})=>o.map(r=>({text:r,category:a,difficulty:l})))),Yt=(t,a,o)=>{if(navigator.clipboard)navigator.clipboard.writeText(t).then(()=>{console.log("Text copied to clipboard"),a&&a()}).catch(l=>{console.error("Could not copy text: ",l),o&&o()});else{const l=document.createElement("textarea");l.value=t,l.style.top="0",l.style.left="0",l.style.position="fixed",document.body.appendChild(l),l.focus(),l.select();try{const r=document.execCommand("copy");console.log("Fallback: Copying text command was "+(r?"successful":"unsuccessful")),r?a&&a():o&&o()}catch(r){console.error("Fallback: Oops, unable to copy",r),o&&o()}document.body.removeChild(l)}},_e=(t,a)=>{const o=t.map((l,r)=>`${r+1} - `+l.map(n=>["🟨","🟩","🟦","🟪"][n.difficulty-1]).join(" ")).join(`
`);Yt(gt.replaceAll("<result>",o).replaceAll("<difficulty>",a).replaceAll("<date>",Ne(z)),()=>{X.success(bt,{toastId:"success-1"})},()=>{X.warn(Et,{toastId:"warn-1"})})},Ie=(t=null,a=null,o=null)=>{const l=JSON.parse(localStorage.getItem("connections-progress"+x.date)||"{}");if(!t)return l;const r=Object.fromEntries(Object.entries(l).filter(([n])=>n.startsWith(t)));return localStorage.setItem("connections-progress"+x.date,JSON.stringify(r)),r[`${t}-${a}-${o}`]||{}},D=t=>{let a=Ie();a={...a,...Object.keys(t).reduce((o,l)=>(o[l]=a[l]?{...a[l],...t[l]}:t[l],o),{})},localStorage.setItem("connections-progress"+x.date,JSON.stringify(a))},V=t=>t.split("").map(a=>e.createElement("p",{className:a===" "?"mr-1.5":"",key:a},a!=="ß"?a:e.createElement("span",{className:"normal-case"},"ß"))),Te="SET_SETTINGS",Oe="SET_GLOBAL_MODAL",Ce="CLOSE_GLOBAL_MODAL",oe="SET_LOADING",je="SELECT_WORD",Le="SELECT_GAME_STATUS",Me="RESET_SELECTIONS",Re="SUFFLE_WORDS",J="CORRECT_ATTEMPT",De="WRONG_ATTEMPT",Pe="ADD_HISTORY",Be="CHANGE_DIFFICULTY",Ht=t=>a=>{a({type:Te,payload:t})},F=(t,a)=>o=>{o({type:Oe,name:t,payload:a})},U=t=>a=>{a({type:Ce,name:t,payload:null})},Y="MODAL/COMPLETED",H="MODAL/FAILED",K="MODAL/MENU",q="MODAL/SETTING",Q="MODAL/STATISTICS",Z="MODAL/HOW_TO_PLAY",Wt=[{label:Ee,modalName:q},{label:ht,modalName:Z},{label:xe,modalName:Q},{label:Ae,to:Se},{label:wt}],Vt={EASY:"easy",MEDIUM:"medium",HARD:"hard"},T={PLAYING:1,COMPLETED:2,FAILED:3},ue=t=>(a,o)=>(a({type:oe,payload:!0}),new Promise(async(l,r)=>{try{const n=JSON.parse(x.game_of_today),s=Object.keys(n.answers)[0],i=x.date;localStorage.setItem("connections-last-option",JSON.stringify({LOCALE:z,difficulty:s}));const d=Ie(i,s,z),y={mistakes:0,selected:[],correctAnswers:[],history:[],status:T.PLAYING,difficulty:s,seed:i,...n,...d,words:Ft(n.answers[s]).filter(g=>!((d==null?void 0:d.correctAnswers)??[]).includes(g.difficulty))};a({type:Be,payload:y}),a({type:oe,payload:!1}),l()}catch(n){r(n)}})),Jt=()=>(t,a)=>{const{seed:o,difficulty:l,words:r}=a().connections,{language:n}=a().user.settings,s=ve(M(r));t({type:Re,payload:s}),D({[`${o}-${l}-${n}`]:{words:s}})},Xt=(t,a)=>(o,l)=>{const{selected:r}=l().connections;let n=M(r);const s=n.findIndex(i=>i.text===t.text&&i.difficulty===t.difficulty);if(s>-1)n.splice(s,1);else{if(n.length>=4)return a();n.push(M(t))}o({type:je,payload:n})},zt=()=>t=>{t({type:Me})},Kt=({applauseSound:t,correctAnswerSound:a,sadTromboneSound:o,wrongAnswerSound:l},r,n)=>(s,i)=>{const{selected:d,mistakes:y,correctAnswers:g,words:S,seed:_,difficulty:N,history:B}=i().connections,{language:I}=i().user.settings;d.sort((O,h)=>O.difficulty-h.difficulty);const W=M(d).map(({text:O})=>O);if(B.some(O=>O.every(h=>W.includes(h.text)))){n(),l(),X.info(_t,{toastId:"info-2"});return}return s({type:Pe,payload:M(d)}),D({[`${_}-${N}-${I}`]:{history:[...B,M(d)]}}),new Promise(async O=>{if(d.every(b=>b.category===d[0].category)){await r();const b=[...g,d[0].difficulty],v=M(S).filter(({difficulty:c})=>!b.includes(c));if(b.length===4?t():a(),b.length===4){s({type:J,payload:{words:[],correctAnswers:b,selected:[]}}),D({[`${_}-${N}-${I}`]:{words:[],correctAnswers:b,selected:[]}});let c="connections";var E=new Date;let f=E.getFullYear()+(E.getMonth()+1<10?"-0":"-")+(E.getMonth()+1)+"-"+E.getDate();x&&(f=x.date);let p={};p[c]={};let w=0;localStorage.completedArchiveGames&&(p=JSON.parse(localStorage.completedArchiveGames),w=p.hasOwnProperty(c)?Object.keys(p[c]).length:0),(!p.hasOwnProperty(c)||Object.values(p[c]).indexOf(f)===-1)&&(p.hasOwnProperty(c)||(p[c]={}),p[c][w]=f),localStorage.setItem("completedArchiveGames",JSON.stringify(p)),await new Promise(j=>setTimeout(j,1e3)),F(Y,!0)(s),pe(T.COMPLETED)(s),me(I,N,_,!0),D({[`${_}-${N}-${I}`]:{status:T.COMPLETED}}),ie("connections","success",x.date)}else s({type:J,payload:{words:v,correctAnswers:b,selected:[]}}),D({[`${_}-${N}-${I}`]:{words:v,correctAnswers:b,selected:[]}})}else if(await n(),s({type:De}),D({[`${_}-${N}-${I}`]:{mistakes:y+1}}),y>=3){o(),pe(T.FAILED)(s),ie("connections","fail",x.date),await new Promise(c=>setTimeout(c,2e3)),D({[`${_}-${N}-${I}`]:{words:[],correctAnswers:[1,2,3,4],selected:[],status:T.FAILED,mistakes:y}});const b=Array.from({length:4},(c,f)=>f+1).filter(c=>!g.includes(c)),v=M(g);for(let c=0;c<b.length;c++){v.push(b[c]);const f=M(S).filter(({difficulty:p})=>!v.includes(p));v.sort(),s({type:J,payload:{words:f,correctAnswers:v,selected:[]}}),await new Promise(p=>setTimeout(p,1500))}await new Promise(c=>setTimeout(c,500)),F(H,!0)(s),me(I,N,_,!1)}else{l();let b=!1;for(let v=1;v<=4;v++)if(d.filter(({difficulty:c})=>c===v).length===3){b=!0;break}b&&X.info(vt,{toastId:"info-1"})}})},pe=t=>a=>{a({type:Le,payload:t})},Ue=m.createContext(),Ge=()=>m.useContext(Ue),qt=({children:t})=>{const a=k(({user:i})=>i.settings.playSound),[o]=G(qe,{soundEnabled:a,html5:!0}),[l]=G(Qe,{soundEnabled:a,html5:!0}),[r]=G(Ze,{soundEnabled:a,html5:!0}),[n]=G(et,{soundEnabled:a,html5:!0}),[s]=G(tt,{soundEnabled:a,html5:!0});return e.createElement(Ue.Provider,{value:{applauseSound:o,sadTromboneSound:l,correctAnswerSound:r,typeSound:n,wrongAnswerSound:s}},t)},Qt=({data:t,isSelected:a,disabled:o},l)=>{const r=R(),n=at(),{typeSound:s}=Ge(),i=async(S=0)=>{await n.start({x:[0,-3,3,-5,5,-3,3,0],transition:{duration:.5,delay:S}})},d=async(S=0)=>{await n.start({y:[0,-7,0],transition:{duration:.5,delay:S}})},y=()=>{n.start({opacity:[1,.5,0,.5,1],rotate:[-5,5,-5,5,-3,3,0],transition:{duration:1}})};m.useImperativeHandle(l,()=>({vibrateCard:i,shakeCard:y,vibrateUpCard:d}));const g=m.useMemo(()=>t.text.trim().length<8?"text-sm md:text-xl":"text-xs md:text-base",[t]);return e.createElement(u.div,{layout:!0,layoutId:t.text+t.difficulty,key:t.text+t.difficulty,animate:n,className:`flex h-14 cursor-pointer flex-wrap  items-center justify-center rounded bg-[#e6ebf0] p-1 text-center font-medium text-black shadow dark:border dark:border-majky-400 dark:bg-transparent dark:text-majky-400 md:h-20 ${a&&"!bg-majky-600 !text-white"} ${g} ${o&&"pointer-events-none"}`,whileTap:{scale:.95},whileHover:{scale:.98},onClick:()=>{s(),r(Xt(t,i))}},V(t.text))},Zt=m.forwardRef(Qt),ea=({count:t})=>e.createElement("div",{className:"mt-4 flex w-60 items-center gap-2"},pt,e.createElement(C,null,Array.from({length:4-t},(a,o)=>e.createElement(u.div,{key:o,initial:{scale:.7,opacity:0},animate:{scale:1,opacity:1},exit:{scale:1.5,opacity:0},className:"aspect-square h-4 rounded-full bg-majky-400 dark:bg-majky-800"})))),A=({className:t="",disabled:a=!1,children:o,onClick:l=()=>{},layout:r=!0})=>{const[n,s]=m.useState([]),i=m.useRef(null);return m.useEffect(()=>{const d=g=>{const S=i.current,{left:_,top:N}=S.getBoundingClientRect(),B=g.clientX-_,I=g.clientY-N,O=Math.max(S.clientWidth,S.clientHeight)*2/2,h={x:B,y:I,radius:O,id:Date.now()};s(E=>[...E,h]),setTimeout(()=>{s(E=>E.filter(b=>b.id!==h.id))},1e3)},y=i.current;return y.addEventListener("click",d),()=>{y.removeEventListener("click",d)}},[s]),e.createElement(u.button,{ref:i,layout:r,type:"button",className:`relative overflow-hidden shadow ${t} !outline-none ${a&&"!pointer-events-none"}`,disabled:a,onClick:l,whileHover:{scale:a?1:1.05},whileTap:{scale:a?1:.95}},o,n.map(d=>e.createElement("span",{key:d.id,className:"ripple",style:{left:d.x-d.radius+"px",top:d.y-d.radius+"px",width:d.radius*2+"px",height:d.radius*2+"px"}})))},ta={initial:{opacity:0,scaleX:1,scaleY:1},animate:{scaleX:[1,1,1.05,1],scaleY:[1,1.1,1,1],opacity:[0,.5,1,1],transition:{delayChildren:.3,duration:.5,delay:.7}},exit:{opacity:0,scaleX:1,scaleY:1,transition:{duration:0}}},ye={initial:{opacity:0},animate:{opacity:1,transition:{delay:.7}},exit:{opacity:0}},aa={initial:{opacity:1},animate:{opacity:0,transition:{delay:.7}},exit:{opacity:0}},la=({data:t})=>{var a;return e.createElement("div",{className:"relative col-span-4 w-full"},e.createElement(u.div,{variants:ta,initial:"initial",animate:"animate",exit:"exit",className:`flex h-14 flex-col items-center justify-center text-wrap break-all rounded text-sm uppercase md:h-20 md:text-xl ${"!pointer-events-none !text-black "+["!bg-majky-yellow","!bg-majky-green","!bg-majky-blue","!bg-majky-purple"][t.difficulty-1]}`},e.createElement(u.div,{variants:ye,className:"flex flex-wrap font-bold"},V(t.category)),e.createElement(u.div,{variants:ye,className:"flex flex-wrap"},t.words.map((o,l)=>e.createElement("span",{className:"flex",key:l},V(o),l<t.words.length-1&&e.createElement("p",{className:"mr-1"},","))))),e.createElement("div",{className:"absolute top-0 grid w-full grid-cols-4 gap-2 md:gap-4"},(a=t.words)==null?void 0:a.map(o=>e.createElement(u.div,{layout:!0,layoutId:o+t.difficulty,key:o+t.difficulty,variants:aa,initial:"initial",animate:"animate",exit:"exit",className:`flex h-14 cursor-pointer flex-wrap  items-center justify-center rounded bg-majky-600 p-1 text-center font-medium text-white shadow dark:border dark:border-majky-400 dark:bg-transparent dark:text-majky-400 md:h-20 ${o.trim().length<8?"text-sm md:text-xl":"text-xs md:text-base"} pointer-events-none`},V(o)))))},oa=()=>{const t=m.useCallback(()=>{const r=new Date,s=new Date(r.getFullYear(),r.getMonth(),r.getDate()+1,0,0,0)-r;return{hours:Math.floor(s/36e5%24),minutes:Math.floor(s/1e3/60%60),seconds:Math.floor(s/1e3%60)}},[]),[a,o]=m.useState(t);m.useEffect(()=>{const r=setInterval(()=>{o(t)},1e3);return()=>clearInterval(r)},[t]);const l=r=>r<10?`0${r}`:r;return e.createElement("div",{className:"flex items-center gap-2"},e.createElement("div",null,It),e.createElement("div",{className:"text-lg font-medium text-majky-600 dark:text-majky-400"},l(a.hours),":",l(a.minutes),":",l(a.seconds)))},ra=()=>{const{language:t}=k(({user:c})=>c.settings),{answers:a,correctAnswers:o,words:l,mistakes:r,selected:n,difficulty:s,status:i}=k(({connections:c})=>c),[d,y]=m.useState(localStorage.completedArchiveGames?JSON.parse(localStorage.completedArchiveGames):{}),[g,S]=m.useState(!1);m.useEffect(()=>{g&&Ke("connections",x.date)},[g]),m.useEffect(()=>{n&&S(!0)},[n]);const _=()=>{let c=d;c.connections={};for(let[f,p]of Object.entries(d.connections))p!==x.date&&(c[Object.entries(c).length]=p);localStorage.setItem("completedArchiveGames",JSON.stringify(c)),y(c),localStorage.removeItem("connections-progress"+x.date),h(ue())},{typeSound:N,applauseSound:B,correctAnswerSound:I,sadTromboneSound:W,wrongAnswerSound:O}=Ge(),h=R();m.useEffect(()=>{h(ue())},[t]);const E=m.useRef(l.map(()=>m.createRef())),b=m.useCallback(()=>new Promise(c=>{const f=[];l.forEach((w,j)=>{n.findIndex(({text:L,difficulty:ee})=>L===w.text&&ee===w.difficulty)>-1&&f.push(j)}),f.sort(()=>Math.random()-.5);const p=f.map((w,j)=>{var L;return(L=E==null?void 0:E.current[w])==null?void 0:L.vibrateCard(j*.1)});Promise.all(p).then(()=>{c()})}),[l,n]),v=m.useCallback(()=>new Promise(async c=>{const f=[];l.forEach((w,j)=>{n.findIndex(({text:L,difficulty:ee})=>L===w.text&&ee===w.difficulty)>-1&&f.push(j)}),f.sort(()=>Math.random()-.5);const p=f.map((w,j)=>{var L;return(L=E==null?void 0:E.current[w])==null?void 0:L.vibrateUpCard(j*.1)});Promise.all(p).then(()=>{c()})}),[l,n]);return e.createElement(C,{mode:"wait"},e.createElement(u.div,{key:`${t}-${s}`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"relative h-full w-full flex-1 p-2 lg:p-4"},e.createElement("div",{className:"flex flex-col items-center justify-center"},e.createElement("div",{className:"m-2"},ut),e.createElement("div",{className:`mt-2 grid h-64 w-full grid-cols-4 gap-2 uppercase md:h-96 md:gap-4 ${i!==T.PLAYING&&"cursor-not-allowed"}`},o.map(c=>e.createElement(la,{key:c,data:a[s][c-1]})),l==null?void 0:l.map((c,f)=>e.createElement(Zt,{key:c.text+c.difficulty,ref:p=>E.current[f]=p,data:c,isSelected:n.findIndex(({text:p,difficulty:w})=>p===c.text&&w===c.difficulty)>-1,disabled:i!==T.PLAYING}))),i===T.PLAYING?e.createElement(m.Fragment,null,e.createElement(ea,{count:r}),e.createElement("div",{className:"mt-4 flex flex-row items-center justify-between gap-2"},e.createElement(A,{onClick:()=>{var c;N(),(c=E.current)==null||c.forEach((f,p)=>{f==null||f.shakeCard()}),h(Jt()),S(!0)},className:"w-24 rounded-full border border-majky-600 bg-white py-2 text-center text-black disabled:bg-gray-400 disabled:text-white dark:bg-slate-800 dark:text-majky-400 dark:disabled:bg-gray-400 dark:disabled:text-white md:w-32 md:py-3"},it),e.createElement(A,{onClick:()=>{h(zt()),N()},className:"w-32 rounded-full border border-majky-600 bg-white py-2 text-center text-black disabled:border-none disabled:bg-gray-400 disabled:text-white dark:bg-slate-800 dark:text-majky-400 dark:disabled:bg-gray-400 dark:disabled:text-white md:py-3",disabled:n.length===0},dt),e.createElement(A,{onClick:()=>{h(Kt({applauseSound:B,correctAnswerSound:I,sadTromboneSound:W,wrongAnswerSound:O},v,b))},className:"w-24 rounded-full bg-majky-600 py-2 text-center text-white disabled:bg-gray-400 dark:bg-majky-400 dark:text-black dark:disabled:bg-gray-400 md:w-32  md:py-3",disabled:n.length!==4},mt))):e.createElement("div",{className:"mt-4 flex flex-col justify-center gap-2"},e.createElement(A,{onClick:()=>{h(F(i===T.COMPLETED?Y:i===T.FAILED?H:null,!0))},className:"rounded-full border border-majky-600 bg-majky-50 px-3 py-2 text-center text-majky-800 dark:bg-slate-800 dark:text-majky-400 "},e.createElement(P,{icon:re,className:"mr-2"}),se),!de&&e.createElement(oa,null))),(i===T.COMPLETED||d.hasOwnProperty("connections")&&Object.values(d.connections).indexOf(x.date)>-1)&&e.createElement("div",{className:"my-12 text-center"},e.createElement("p",{className:"font-bold mb-5"},Dt.replaceAll("<name>",be)),e.createElement("a",{className:"underline",href:Se},Ae),de&&e.createElement("button",{onClick:_,className:"block mt-5 mx-auto hover:no-underline border-[1px] border-black rounded-full px-4 py-2 text-center text-sm"},Pt))))},ce=()=>{const[t,a]=m.useState(localStorage.getItem("connections-theme")||"light"),o=t==="dark"?"light":"dark";return m.useEffect(()=>{const l=window.document.documentElement;l.classList.remove(o),l.classList.add(t),localStorage.setItem("connections-theme",t)},[t,o]),[t,a]},na={settings:{playSound:!1,language:z},modals:{[q]:!1,[Z]:!1,[Q]:!1,[Y]:!1,[H]:!1,[K]:!1}},sa=(t=na,a)=>{switch(a.type){case Te:return{...t,settings:{...t.settings,...a.payload}};case Oe:return{...t,modals:{...t.modals,[a.name]:a.payload}};case Ce:return{...t,modals:{...t.modals,[a.name]:a.payload}};default:return t}};var fe,ge;const ca={difficulty:((fe=JSON.parse(localStorage.getItem("connections-last-option")))==null?void 0:fe.difficulty)??Vt.HARD,loading:!1,mistakes:((ge=JSON.parse(localStorage.getItem("connections-progress"+x.date)))==null?void 0:ge.mistakes)??0,words:[],seed:Ne(),selected:[],correctAnswers:[],history:[],status:T.PLAYING,answers:{easy:[],medium:[],hard:[]}},ia=(t=ca,a)=>{switch(a.type){case je:return{...t,selected:a.payload};case Me:return{...t,selected:[]};case oe:return{...t,loading:a.payload};case Le:return{...t,status:a.payload};case Re:return{...t,words:a.payload};case Be:return{...t,...a.payload};case J:return{...t,...a.payload};case De:return{...t,mistakes:t.mistakes+1};case Pe:return{...t,history:[...t.history,a.payload]};default:return t}},da=Ye({user:sa,connections:ia}),ma={key:Gt(!1),storage:ot},ua=rt(ma,da),pa=Ve,$e=He(ua,pa(We(Je))),ya=nt($e);const fa="/build/assets/logo-de.png",ga="/build/assets/logo-de.png",ba=()=>{const t=R(),{language:a}=k(({user:o})=>o.settings);return e.createElement("header",{className:"flex h-16 w-full items-center justify-between border-b-2 border-slate-200 px-3 dark:border-slate-400 max-xs:h-8"},e.createElement("div",{className:"ml-0 md:ml-4"},e.createElement("h1",{className:"flex flex-auto select-none items-center space-x-0 text-2xl font-bold md:space-x-4 md:text-3xl"},e.createElement("img",{className:"mr-1 aspect-square h-12 object-contain",src:new URL(Object.assign({"../../../../../image/connections/logo-de.png":fa,"../../../../../image/connections/logo-en.png":ga})[`../../../../../image/connections/logo-${a}.png`],self.location).href,alt:"logo"}),e.createElement("span",{className:"text-majky-600 dark:text-majky-400"},be))),e.createElement("div",{className:"relative"},e.createElement(A,{className:"rounded border border-majky-600 bg-majky-600 px-3 py-2 text-white shadow shadow-white dark:bg-slate-900/50 dark:text-majky-400 max-xs:px-1 max-xs:py-0.5",onClick:()=>{t(F(K,!0))}},e.createElement(P,{icon:lt}),e.createElement("div",{className:"hidden md:pl-2 lg:inline-block"},we))))},Ea=({id:t,checked:a,onChange:o})=>e.createElement("div",{className:"inline-flex items-center"},e.createElement("div",{className:"relative inline-block h-4 w-8 cursor-pointer rounded-full border dark:border-majky-400"},e.createElement("input",{id:t,type:"checkbox",className:"peer absolute left-0 top-0 h-4 w-8 cursor-pointer appearance-none rounded-full bg-majky-100 transition-colors duration-300 checked:bg-majky-500 peer-checked:border-majky-500 peer-checked:before:bg-majky-500 dark:bg-majky-800 dark:checked:bg-majky-300 dark:peer-checked:border-majky-300 dark:peer-checked:before:bg-majky-300",checked:a,onChange:o}),e.createElement("label",{htmlFor:t,className:"before:content[''] before:bg-blue-slate-500 absolute -left-1  top-2/4 h-5 w-5 -translate-y-2/4 cursor-pointer rounded-full border border-majky-100 bg-white shadow-md transition-all duration-300 before:absolute before:left-2/4 before:top-2/4 before:block before:h-10 before:w-10 before:-translate-x-2/4 before:-translate-y-2/4 before:rounded-full before:opacity-0 before:transition-opacity hover:before:opacity-10 peer-checked:translate-x-full peer-checked:border-majky-500 peer-checked:before:bg-majky-500 dark:border-majky-400"},e.createElement("div",{className:"left-2/4 top-2/4 inline-block -translate-x-2/4 -translate-y-2/4 rounded-full p-5","data-ripple-dark":"true"})))),xa=()=>{const t=k(({user:n})=>{var s;return((s=n==null?void 0:n.modals)==null?void 0:s[q])||null}),a=R(),{settings:o}=k(({user:n})=>n),l=(n,s)=>{a(Ht({[n]:s}))},r=()=>{a(U(q))};return ce(),e.createElement(C,null,t&&e.createElement(u.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:r},e.createElement("div",{className:"relative max-h-full w-full overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-900/80 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-xs",onClick:n=>{n.stopPropagation()}},e.createElement(P,{className:"absolute left-4 top-4 h-6 w-6 cursor-pointer hover:text-majky-600 active:text-majky-500",onClick:r,icon:ne}),e.createElement("h2",{className:"border-b border-majky-600 pb-1 pt-7 text-center text-2xl font-bold text-majky-800 shadow dark:text-majky-400"},Ee),e.createElement("div",{className:"my-4 p-4 text-center shadow"},e.createElement("div",{className:"flex flex-col items-center"},e.createElement("div",{className:"mt-6 flex w-60 cursor-pointer items-center text-base font-bold text-gray-600 dark:text-majky-400"},e.createElement("div",{className:"w-32"},e.createElement(Ea,{id:"options-play-sound",onChange:n=>{l("playSound",n.target.checked)},checked:o.playSound})),e.createElement("label",{className:"text-balance",htmlFor:"options-play-sound"},At)))))))},ka=()=>{const t=k(({user:l})=>{var r;return((r=l==null?void 0:l.modals)==null?void 0:r[K])||null}),a=R(),o=()=>{a(U(K))};return ce(),e.createElement(C,null,t&&e.createElement(u.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:o},e.createElement(u.div,{className:"relative flex max-h-full w-full flex-col overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-800 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-xs",onClick:l=>{l.stopPropagation()}},e.createElement(P,{className:"absolute left-4 top-4 h-6 w-6 cursor-pointer hover:text-majky-600 active:text-majky-500",onClick:o,icon:ne}),e.createElement(u.h2,{layout:!0,className:"border-b  border-majky-600 pb-1 pt-7 text-center text-2xl font-bold text-majky-800 shadow dark:text-majky-400"},we),e.createElement(u.div,{className:"my-4 grid grid-cols-1 gap-1 text-center"},Wt.map(({label:l,to:r,modalName:n,newGame:s},i)=>e.createElement(u.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{y:0,opacity:1,transition:{delay:i*.1}},closed:{y:10,opacity:0}},key:`menu-button-${i}`},e.createElement(A,{onClick:()=>{r&&(window.location=r),n?a(F(n,!0)):o()},className:"rounded border  border-transparent bg-white px-2 py-2 text-base font-bold text-gray-600 shadow-none hover:border-gray-600 hover:bg-gray-100  dark:bg-slate-800  dark:text-majky-400 dark:hover:border-majky-400 max-xs:py-1"},l)))))))},ha=()=>{const t=R(),{settings:a,modals:o}=k(({user:y})=>y),l=(o==null?void 0:o[Z])||null,r=()=>{t(U(Z))},[n,s]=m.useState(null),[i,d]=m.useState(!1);return m.useEffect(()=>{l&&(async()=>{d(!0);try{s(Rt)}catch(g){console.error(g)}finally{d(!1)}})()},[l,n,a.language]),e.createElement(C,null,l&&e.createElement(u.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:r},e.createElement(u.div,{className:"relative max-h-full w-full overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-900/80 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-screen-md",onClick:r},i?e.createElement("p",{className:"my-4 text-center"},Mt):e.createElement("div",{className:"px-4 text-gray-600 dark:text-gray-300",dangerouslySetInnerHTML:{__html:n}}))))},wa=()=>e.createElement(u.div,{initial:{backdropFilter:"blur(0px)",opacity:0},animate:{backdropFilter:"blur(4px)",opacity:1},exit:{backdropFilter:"blur(0px)",opacity:0},transition:{duration:.6},className:"fixed left-0 top-0 z-[10000] h-screen w-screen bg-black/30"},e.createElement(u.img,{initial:{y:-300},animate:{y:0},exit:{y:-300},transition:{delay:.3,type:"spring"},className:"absolute left-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l1-b15bb7e9.png",self.location).href,alt:"celebration_l1.png"}),e.createElement(u.img,{initial:{y:-400},animate:{y:0},exit:{y:-300},transition:{delay:.4,type:"spring"},className:"absolute left-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l2-25c12ae6.png",self.location).href,alt:"celebration_l2.png"}),e.createElement(u.img,{initial:{y:-500},animate:{y:0},exit:{y:-300},transition:{delay:.1,type:"spring"},className:"absolute left-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l3-24b64409.png",self.location).href,alt:"celebration_l3.png"}),e.createElement(u.img,{initial:{y:-400,scaleX:-1},animate:{y:0,scaleX:-1},exit:{y:-300,scaleX:-1},transition:{delay:.4,type:"spring"},className:"absolute right-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l1-b15bb7e9.png",self.location).href,alt:"celebration_r1.png"}),e.createElement(u.img,{initial:{y:-500,scaleX:-1},animate:{y:0,scaleX:-1},exit:{y:-300,scaleX:-1},transition:{delay:.1,type:"spring"},className:"absolute right-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l2-25c12ae6.png",self.location).href,alt:"celebration_r2.png"}),e.createElement(u.img,{initial:{y:-300,scaleX:-1},animate:{y:0,scaleX:-1},exit:{y:-300,scaleX:-1},transition:{delay:.3,type:"spring"},className:"absolute right-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l3-24b64409.png",self.location).href,alt:"celebration_l3.png"}),e.createElement("div",{className:"absolute left-1/2 top-0 -ml-[25%] w-1/2"},e.createElement(u.img,{initial:{y:-100},animate:{y:0},exit:{y:-100},transition:{delay:.1,type:"spring"},className:"absolute -top-2 ml-[12.5%] w-3/4 origin-top",src:new URL("/build/assets/celebration_c1-27ee5f77.png",self.location).href,alt:"celebration_c1.png"}),e.createElement(u.img,{initial:{y:-300},animate:{y:0},exit:{y:-300},transition:{delay:.5,type:"spring"},className:"absolute top-0 w-full",src:new URL("/build/assets/celebration_c2-33815d62.png",self.location).href,alt:"celebration_c2.png"}))),Aa=()=>{const t=R(),a=k(({user:r})=>{var n;return((n=r==null?void 0:r.modals)==null?void 0:n[Y])||null}),{difficulty:o,history:l}=k(({connections:r})=>r);return e.createElement(m.Fragment,null,a&&e.createElement(wa,null),e.createElement(C,null,a&&e.createElement(u.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:r=>{r.stopPropagation()}},e.createElement(u.div,{className:" max-h-full overflow-y-auto rounded border bg-white p-2 pb-4 shadow-md dark:border-majky-400 dark:bg-slate-900/80 max-sm:w-full md:max-w-screen-md md:p-4"},e.createElement("div",{className:"flex w-full flex-1 flex-col items-center justify-center"},e.createElement("h2",{className:"mt-4 w-full text-center text-3xl font-medium text-majky-800 dark:text-majky-400"},yt),e.createElement("div",{className:"my-2 text-xl  font-medium"},ft),e.createElement("div",{className:"grid grid-cols-4 gap-1"},l.flatMap((r,n)=>r.map((s,i)=>e.createElement("div",{key:`${n}-${i}`,className:`aspect-square h-4 rounded ${["!bg-yellow-300","!bg-green-400","!bg-blue-400","!bg-purple-400"][s.difficulty-1]}`})))),e.createElement("div",{className:"mt-4"},e.createElement(A,{onClick:()=>_e(l,o),className:"rounded-full border border-majky-600 bg-majky-50 px-3 py-2 text-center text-majky-800 dark:bg-slate-800 dark:text-majky-400 "},e.createElement(P,{icon:re,className:"mr-2"}),se)),e.createElement("div",{className:"mt-4"},e.createElement(A,{onClick:()=>{t(U(Y))},className:"min-w-32 rounded border border-majky-600 px-2 py-2 text-base font-bold  text-majky-600  dark:border-majky-400"},ke)))))))},Sa=({isOpen:t,setIsOpen:a,onOK:o=()=>{}})=>(m.useEffect(()=>{const l=()=>{a(!1)};return t&&document.addEventListener("click",l),()=>{t&&document.removeEventListener("click",l)}},[t,a]),e.createElement(C,null,t&&e.createElement(u.div,{className:"absolute left-0 right-0 z-50 w-60 rounded border  border-majky-400 bg-white   px-3 py-4 shadow-md dark:bg-slate-900 max-sm:w-60 lg:mt-2 mx-auto",initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1,y:0},closed:{opacity:0,y:-30,transition:{delay:.2,duration:.1}}},onClick:l=>{l.stopPropagation()}},e.createElement("h2",{className:"relative px-2 text-center font-medium text-majky-800 dark:text-majky-400"},Bt,e.createElement(P,{className:"absolute right-0 top-0 cursor-pointer hover:text-majky-600 active:text-majky-500",onClick:()=>{a(!1)},icon:ne})),e.createElement(u.div,{className:"mt-4 grid grid-cols-2 gap-2  font-medium"},e.createElement(A,{className:"rounded border-majky-200 bg-majky-50 py-1 text-center text-majky-800  dark:bg-slate-800 dark:text-majky-400",onClick:()=>{a(!1)}},he),e.createElement(A,{className:" rounded border-majky-200  bg-majky-400 py-1 text-center text-white dark:bg-majky-600 dark:text-slate-800",onClick:()=>{o(),a(!1)}},Ut))))),$=({label:t,value:a})=>e.createElement("div",{className:"mt-2 w-full md:max-w-96"},e.createElement("span",{className:"inline-block w-40 text-right "},t),e.createElement("span",{className:"pl-4"},":"),e.createElement("span",{className:" inline-block w-32 md:w-40"},a)),Na=()=>{const t=k(({user:y})=>{var g;return((g=y==null?void 0:y.modals)==null?void 0:g[Q])||null}),a=R(),[o,l]=m.useState(!1),[r,n]=m.useState(!1),s=()=>{a(U(Q))},[i,d]=m.useState(te(le()));return m.useEffect(()=>{t&&d(te(le()))},[t]),e.createElement(C,null,t&&e.createElement(u.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:s},e.createElement("div",{className:"relative flex max-h-full w-full flex-col items-center justify-between overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-900/80 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-screen-md",onClick:y=>{y.stopPropagation()}},e.createElement("h2",{className:"w-full border-b border-majky-600 pb-1 pt-7 text-center text-2xl font-bold text-majky-800 shadow dark:text-majky-400"},xe),e.createElement("div",{className:"mt-4 flex w-full flex-col items-center text-center"},e.createElement($,{label:Tt,value:i.totalPlayed}),e.createElement($,{label:Ot,value:i.totalCompleted}),e.createElement($,{label:Ct,value:i.winningRate}),e.createElement($,{label:jt,value:i.currentStreak}),e.createElement($,{label:Lt,value:i.maxStreak})),e.createElement("div",{className:"mt-4 text-balance text-center text-sm text-majky-600"},St),e.createElement("div",{className:"mt-4 grid w-full max-w-80 grid-cols-2 gap-2  font-medium"},e.createElement(A,{className:"rounded border-majky-200  bg-majky-50 py-1 text-center text-majky-800  dark:bg-slate-800 dark:text-majky-400",onClick:y=>{l(!0),n(g=>!g)}},Nt),e.createElement(A,{className:" rounded border-majky-200  bg-majky-400 py-1 text-center text-white dark:bg-majky-600 dark:text-slate-800",onClick:s},he))),e.createElement(Sa,{isOpen:r,setIsOpen:n,onOK:()=>{d(te($t()))}})))},va=()=>{const t=R(),a=k(({user:r})=>{var n;return((n=r==null?void 0:r.modals)==null?void 0:n[H])||null}),{history:o,difficulty:l}=k(({connections:r})=>r);return e.createElement(C,null,a&&e.createElement(u.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:r=>{r.stopPropagation()}},e.createElement(u.div,{className:" max-h-full overflow-y-auto rounded border bg-white p-2 pb-4 shadow-md dark:border-majky-400 dark:bg-slate-900/80 max-sm:w-full md:max-w-screen-md md:p-4"},e.createElement("div",{className:"flex w-full flex-1 flex-col items-center justify-center"},e.createElement("h2",{className:"mt-4 w-full text-center text-3xl font-medium text-rose-800 dark:text-rose-400"},xt),e.createElement("div",{className:"my-2 text-xl font-medium"},kt),e.createElement("div",{className:"grid grid-cols-4 gap-1"},o.flatMap((r,n)=>r.map((s,i)=>e.createElement("div",{key:`${n}-${i}`,className:`aspect-square h-4 rounded ${["!bg-yellow-300","!bg-green-400","!bg-blue-400","!bg-purple-400"][s.difficulty-1]}`})))),e.createElement("div",{className:"mt-4"},e.createElement(A,{onClick:()=>_e(o,l),className:"rounded-full border border-majky-600 bg-majky-50 px-3 py-2 text-center text-majky-800 dark:bg-slate-800 dark:text-majky-400 "},e.createElement(P,{icon:re,className:"mr-2"}),se)),e.createElement("div",{className:"mt-4"},e.createElement(A,{onClick:()=>{t(U(H))},className:"min-w-32 rounded border border-majky-600 px-2 py-2 text-base font-bold  text-majky-600  dark:border-majky-400"},ke))))))},_a=({trigger:t})=>e.createElement(C,null,t&&e.createElement(u.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed left-0 top-0 z-[999] flex h-full w-full items-center justify-center bg-slate-800/90 dark:bg-slate-600/90"},e.createElement("div",{className:"h-36 w-36 animate-spin rounded-full border-8 border-t-majky-600"}))),Ia=({children:t})=>{k(({user:o})=>o);const{loading:a}=k(({connections:o})=>o);return e.createElement(qt,null,e.createElement(Xe,{position:"top-center",newestOnTop:!0,closeOnClick:!0,toastClassName:"bg-white dark:text-slate-100 dark:bg-slate-900"}),e.createElement("div",{className:"relative flex h-full w-full flex-auto !select-none flex-col items-center justify-start overflow-hidden bg-white bg-cover bg-center transition-all dark:bg-slate-900 dark:text-slate-100"},e.createElement("div",{className:"relative flex w-full max-w-screen-sm flex-col items-start justify-start"},e.createElement(ba,null),t),e.createElement(ka,null),e.createElement(xa,null),e.createElement(ha,null),e.createElement(Na,null),e.createElement(Aa,null),e.createElement(va,null),e.createElement(_a,{trigger:a})))};function Ta(){return ce(),e.createElement(ze,{store:$e},e.createElement(st,{loading:null,persistor:ya},e.createElement(m.Suspense,null,e.createElement(Ia,null,e.createElement(ra,null)))))}const Oa=t=>{t&&t instanceof Function&&ct(()=>import("./web-vitals-23d6d37b.js"),[]).then(({getCLS:a,getFID:o,getFCP:l,getLCP:r,getTTFB:n})=>{a(t),o(t),l(t),r(t),n(t)})},Ca=Fe.createRoot(document.getElementById("root"));Ca.render(e.createElement(e.StrictMode,null,e.createElement(Ta,null)));Oa();