diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33c85fe..97d4f06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,11 @@ jobs: node-version: '22' cache: 'npm' + # The committed package-lock.json is generated by npm 11; the npm 10.x + # bundled with Node 22 crashes on it ("Exit handler never called!"). + - name: Align npm version + run: npm install -g npm@11 + - name: Install dependencies run: npm ci @@ -30,5 +35,8 @@ jobs: - name: TypeScript run: npx tsc -b + - name: Tests + coverage (min 85%) + run: npm run test:coverage + - name: Build run: npm run build diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..214c29d --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +registry=https://registry.npmjs.org/ diff --git a/docs/404.html b/docs/404.html index 1d08e30..3f5d459 100644 --- a/docs/404.html +++ b/docs/404.html @@ -5,8 +5,8 @@ Algorithm Visualizer - - + +
diff --git a/docs/assets/AdvancedStructurePage-DOo62Byj.js b/docs/assets/AdvancedStructurePage-BcFhvyhq.js similarity index 97% rename from docs/assets/AdvancedStructurePage-DOo62Byj.js rename to docs/assets/AdvancedStructurePage-BcFhvyhq.js index dc5ca1b..746aa22 100644 --- a/docs/assets/AdvancedStructurePage-DOo62Byj.js +++ b/docs/assets/AdvancedStructurePage-BcFhvyhq.js @@ -1 +1 @@ -import{r as N,j as t}from"./index-lLadk08S.js";import{u as O}from"./useDSSound-CPhif-bj.js";import{S as P}from"./shuffle-ADbBlETg.js";import{C as E,a as D}from"./chevron-right-Cp_zyb7b.js";import{P as F}from"./play-b2ZiatJ3.js";import{V,a as W}from"./volume-x-CjLNPeax.js";import"./audioContext-NbgqvQGz.js";const Q={trie:{title:"Trie",subtitle:"Prefix tree for words",inputLabel:"Words; operation; query",defaultInput:"cat,car,cart,dog,dove;prefix;ca",helper:"Format: words; insert/delete/search/prefix; query"},"segment-tree":{title:"Segment Tree",subtitle:"Range query and point update",inputLabel:"Array; operation; args",defaultInput:"2,1,5,3,4,8;query;1,4",helper:"Operations: build, query;l,r, update;index,value"},"fenwick-tree":{title:"Fenwick Tree",subtitle:"Binary indexed tree",inputLabel:"Array; operation; args",defaultInput:"2,1,5,3,4,8;range;1,4",helper:"Operations use 1-based indexes: build, prefix;i, range;l,r, update;index,value"}};function re({structure:i}){const l=Q[i],[p,c]=N.useState(l.defaultInput),[e,d]=N.useState(()=>R(i,l.defaultInput)),[o,x]=N.useState(0),[h,f]=N.useState(650),{soundEnabled:n,toggleSound:s,playInsert:a,playDelete:r,playAccess:w,playTraverse:$,playFound:y,playNotFound:b}=O(),m=e[o]??e[0],j=(u,g)=>{u.event==="insert"?a():u.event==="delete"?r():u.event==="access"?w():u.event==="traverse"?$(g,e.length):u.event==="found"?y():b()},z=()=>{const u=R(i,p);d(u),x(0),u[0]&&j(u[0],0)},I=u=>{const g=Math.max(0,Math.min(e.length-1,u));x(g);const C=e[g];C&&j(C,g)},B=()=>{const u=J(i);c(u);const g=R(i,u);d(g),x(0)},L=()=>{for(let u=o;u{x(u);const g=e[u];g&&j(g,u)},(u-o)*h)};return t.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[t.jsxs("main",{className:"order-last flex min-h-[520px] flex-1 flex-col gap-4 xl:order-first",children:[t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm",children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-rose-300",children:"Data Structures"}),t.jsx("h2",{className:"mt-1 text-xl font-bold text-white",children:l.title}),t.jsx("p",{className:"mt-1 text-sm text-slate-400",children:l.subtitle})]}),t.jsx("section",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5",children:m?.nodes?t.jsx(U,{step:m}):t.jsx(X,{step:m,structure:i})})]}),t.jsxs("aside",{className:"w-full space-y-4 xl:w-80 xl:shrink-0",children:[t.jsxs(k,{title:"Operation",children:[t.jsx("label",{className:"text-[11px] text-slate-500",children:l.inputLabel}),t.jsx("textarea",{value:p,onChange:u=>c(u.target.value),rows:2,className:"mt-1 w-full resize-none rounded-xl bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-rose-500/50"}),t.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:l.helper}),t.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[t.jsx("button",{onClick:z,className:"rounded-xl bg-rose-500/20 px-3 py-2 text-xs font-semibold text-rose-300 ring-1 ring-rose-500/40 hover:bg-rose-500/30",children:"Run"}),t.jsxs("button",{onClick:B,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[t.jsx(P,{size:13})," Random"]})]})]}),t.jsxs(k,{title:"Step Playback",children:[t.jsx("p",{className:"min-h-12 text-xs leading-relaxed text-slate-300",children:m?.description}),m?.meta&&t.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:m.meta.map(u=>t.jsx("span",{className:"rounded-full bg-slate-800 px-2 py-0.5 text-[10px] font-mono text-slate-400",children:u},u))}),t.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs text-slate-500",children:[t.jsx("span",{children:"Step"}),t.jsxs("span",{className:"font-mono text-rose-300",children:[Math.min(o+1,e.length)," / ",e.length]})]}),t.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Animation Speed"}),t.jsxs("span",{className:"font-mono text-[10px] text-rose-300",children:[h,"ms"]})]}),t.jsx("input",{type:"range",min:120,max:1200,step:40,value:1320-h,onChange:u=>f(1320-Number(u.target.value)),className:"w-full accent-rose-400","aria-label":"Animation speed"}),t.jsxs("div",{className:"mt-1 flex justify-between text-[9px] uppercase tracking-wide text-slate-600",children:[t.jsx("span",{children:"Slow"}),t.jsx("span",{children:"Fast"})]})]}),t.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[t.jsxs("button",{onClick:()=>I(o-1),disabled:o<=0,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:[t.jsx(E,{size:13})," Back"]}),t.jsxs("button",{onClick:L,disabled:o>=e.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-emerald-500/15 px-2 py-2 text-xs font-semibold text-emerald-300 ring-1 ring-emerald-500/30 disabled:opacity-30",children:[t.jsx(F,{size:13})," Play"]}),t.jsxs("button",{onClick:()=>I(o+1),disabled:o>=e.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:["Next ",t.jsx(D,{size:13})]})]})]}),t.jsx(k,{title:"Audio",children:t.jsxs("button",{onClick:()=>s(!n),className:`inline-flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 ${n?"bg-rose-500/15 text-rose-300 ring-rose-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[n?t.jsx(V,{size:14}):t.jsx(W,{size:14}),n?"Sound On":"Sound Off"]})})]})]})}function k({title:i,children:l}){return t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:i}),l]})}function U({step:i}){const l=i.nodes??[],p=new Set(i.highlights??[]);return t.jsxs("svg",{viewBox:"0 0 720 380",className:"h-full min-h-[420px] w-full",children:[l.map(c=>{const e=l.find(d=>d.id===c.parentId);return e?t.jsx("line",{x1:e.x,y1:e.y,x2:c.x,y2:c.y,stroke:"#475569",strokeWidth:1.5},`${e.id}-${c.id}`):null}),l.map(c=>{const e=p.has(Number(c.id.replace(/\D/g,"")))||p.has(l.indexOf(c));return t.jsxs("g",{children:[t.jsx("circle",{cx:c.x,cy:c.y,r:22,fill:e?"rgba(244,63,94,0.22)":"rgba(30,41,59,0.9)",stroke:e?"#fb7185":"#64748b",strokeWidth:2}),t.jsx("text",{x:c.x,y:c.y+4,textAnchor:"middle",fontSize:"12",fontWeight:"800",fill:e?"#fecdd3":"#cbd5e1",children:c.label}),c.value!==void 0&&t.jsx("text",{x:c.x,y:c.y+35,textAnchor:"middle",fontSize:"10",fill:"#94a3b8",children:c.value})]},c.id)})]})}function X({step:i,structure:l}){const p=i?.array??[],c=new Set(i?.highlights??[]);return t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:p.map((e,d)=>t.jsxs("div",{className:`relative flex h-14 min-w-14 items-center justify-center rounded-xl px-3 font-mono text-sm font-black ring-1 ${c.has(d)?"bg-rose-500/20 text-rose-200 ring-rose-500/50":"bg-slate-800/70 text-slate-200 ring-slate-700/50"}`,children:[e,t.jsx("span",{className:"absolute -bottom-5 text-[9px] text-slate-500",children:l==="fenwick-tree"?d+1:d})]},`${e}-${d}`))}),i?.queryRange&&t.jsxs("p",{className:"text-center text-xs text-slate-400",children:["Active range: [",i.queryRange[0],", ",i.queryRange[1],"]"]})]})}function R(i,l){return i==="trie"?_(l):i==="segment-tree"?G(l):H(l)}function M(i){return i.split(",").map(l=>l.trim()).filter(Boolean).map(Number).filter(Number.isFinite)}function _(i){const[l="",p="prefix",c=""]=i.split(";"),e=l.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean),d=p.trim().toLowerCase(),o=c.trim().toLowerCase(),x=[];T=0;const h=A("*"),f=d==="insert"&&o?[...e,o]:e.filter(n=>!(d==="delete"&&n===o));if(e.forEach(n=>q(h,n)),x.push({description:`Build trie from ${e.length} word(s).`,event:"insert",nodes:v(h),meta:e}),d==="insert"&&o)q(h,o),x.push({description:`Insert "${o}" character by character.`,event:"insert",nodes:v(h),meta:f});else if(d==="delete"&&o){const n=A("*");f.forEach(s=>q(n,s)),x.push({description:`Delete "${o}" and rebuild active prefixes.`,event:"delete",nodes:v(n),meta:f})}else{let n=h;const s=[0];for(const r of o){if(n=n.children.get(r),!n)return x.push({description:`Character "${r}" is missing, so "${o}" was not found.`,event:"not-found",nodes:v(h),highlights:s,meta:e}),x;s.push(n.order),x.push({description:`Traverse character "${r}" in "${o}".`,event:"traverse",nodes:v(h),highlights:[...s],meta:e})}const a=e.filter(r=>d==="search"?r===o:r.startsWith(o));x.push({description:a.length?`Matched: ${a.join(", ")}.`:`No match for "${o}".`,event:a.length?"found":"not-found",nodes:v(h),highlights:s,meta:a})}return x}let T=0;function A(i){return{label:i,order:T++,terminal:!1,children:new Map}}function q(i,l){let p=i;for(const c of l)p.children.has(c)||p.children.set(c,A(c)),p=p.children.get(c);p.terminal=!0}function v(i){const l=[],p=new Map,c=(e,d,o)=>{const x=p.get(d)??[];x.push(e),p.set(d,x),l.push({id:`trie-${e.order}`,label:e.terminal?`${e.label}*`:e.label,x:0,y:d*72+42,parentId:o}),[...e.children.values()].forEach(h=>c(h,d+1,`trie-${e.order}`))};return c(i,0),l.forEach(e=>{const d=Math.round((e.y-42)/72),o=l.filter(h=>Math.round((h.y-42)/72)===d),x=o.indexOf(e);e.x=360+(x-(o.length-1)/2)*Math.max(46,520/Math.max(o.length,1))}),l}function G(i){const[l="",p="query",c="0,0"]=i.split(";"),e=M(l),d=p.trim(),o=M(c),x=Array(e.length*4).fill(0),h=[],f=(n,s,a)=>{if(s===a)x[n]=e[s];else{const r=Math.floor((s+a)/2);f(n*2,s,r),f(n*2+1,r+1,a),x[n]=x[n*2]+x[n*2+1]}h.push({description:`Build segment [${s}, ${a}] with sum ${x[n]}.`,event:"insert",array:[...e],highlights:S(s,a),queryRange:[s,a],meta:[`node:${n}`,`sum:${x[n]}`]})};if(e.length&&f(1,0,e.length-1),d==="query"){const[n,s]=o,a=Math.max(0,Math.min(e.length-1,n??0)),r=Math.max(a,Math.min(e.length-1,s??e.length-1)),w=(y,b,m)=>{if(h.push({description:`Visit segment [${b}, ${m}] for query [${a}, ${r}].`,event:"traverse",array:[...e],highlights:S(Math.max(b,a),Math.min(m,r)),queryRange:[a,r],meta:[`node:${y}`]}),r=0&&n{for(let r=s+1;r<=e.length;r+=r&-r)d[r]+=a,o.push({description:`Update BIT[${r}] += ${a}; next index is i + lowbit(i).`,event:"insert",array:d.slice(1),highlights:[r-1],meta:[`lowbit:${r&-r}`]})};e.forEach((s,a)=>x(a,s));const h=s=>{let a=0;for(let r=s+1;r>0;r-=r&-r)a+=d[r],o.push({description:`Read BIT[${r}] while computing prefix(${s}); next index is i - lowbit(i).`,event:"traverse",array:d.slice(1),highlights:[r-1],meta:[`partial:${a}`,`lowbit:${r&-r}`]});return a},f=p.trim(),n=M(c);if(f==="prefix"){const s=Math.max(0,Math.min(e.length-1,(n[0]??1)-1)),a=h(s);o.push({description:`Prefix sum up to position ${s+1} = ${a}.`,event:"found",array:d.slice(1),highlights:[s],meta:[`sum:${a}`]})}else if(f==="update"){const s=Math.max(0,Math.min(e.length-1,(n[0]??1)-1)),a=n[1]??e[s]??0;s>=0&&s0?h(s-1):0);o.push({description:`Range sum positions [${s+1}, ${a+1}] = ${r}.`,event:"found",array:d.slice(1),highlights:S(s,a),queryRange:[s+1,a+1],meta:[`sum:${r}`]})}return o}function S(i,l){return li+c)}function J(i){if(i==="trie")return"tree,trie,trial,algo,all,also;prefix;tr";const l=Array.from({length:6},()=>Math.floor(Math.random()*9)+1).join(",");return i==="segment-tree"?`${l};query;1,4`:`${l};range;1,4`}export{re as default}; +import{r as N,j as t}from"./index-CB1-0H6I.js";import{u as O}from"./useDSSound-BJYLYD0f.js";import{S as P}from"./shuffle-DZnyoAGL.js";import{C as E,a as D}from"./chevron-right-ChVmoNtO.js";import{P as F}from"./play-SZ6Nqtz8.js";import{V,a as W}from"./volume-x-CKT6TOtL.js";import"./audioContext-NbgqvQGz.js";const Q={trie:{title:"Trie",subtitle:"Prefix tree for words",inputLabel:"Words; operation; query",defaultInput:"cat,car,cart,dog,dove;prefix;ca",helper:"Format: words; insert/delete/search/prefix; query"},"segment-tree":{title:"Segment Tree",subtitle:"Range query and point update",inputLabel:"Array; operation; args",defaultInput:"2,1,5,3,4,8;query;1,4",helper:"Operations: build, query;l,r, update;index,value"},"fenwick-tree":{title:"Fenwick Tree",subtitle:"Binary indexed tree",inputLabel:"Array; operation; args",defaultInput:"2,1,5,3,4,8;range;1,4",helper:"Operations use 1-based indexes: build, prefix;i, range;l,r, update;index,value"}};function re({structure:i}){const l=Q[i],[p,c]=N.useState(l.defaultInput),[e,d]=N.useState(()=>R(i,l.defaultInput)),[o,x]=N.useState(0),[h,f]=N.useState(650),{soundEnabled:n,toggleSound:s,playInsert:a,playDelete:r,playAccess:w,playTraverse:$,playFound:y,playNotFound:b}=O(),m=e[o]??e[0],j=(u,g)=>{u.event==="insert"?a():u.event==="delete"?r():u.event==="access"?w():u.event==="traverse"?$(g,e.length):u.event==="found"?y():b()},z=()=>{const u=R(i,p);d(u),x(0),u[0]&&j(u[0],0)},I=u=>{const g=Math.max(0,Math.min(e.length-1,u));x(g);const C=e[g];C&&j(C,g)},B=()=>{const u=J(i);c(u);const g=R(i,u);d(g),x(0)},L=()=>{for(let u=o;u{x(u);const g=e[u];g&&j(g,u)},(u-o)*h)};return t.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[t.jsxs("main",{className:"order-last flex min-h-[520px] flex-1 flex-col gap-4 xl:order-first",children:[t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm",children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-rose-300",children:"Data Structures"}),t.jsx("h2",{className:"mt-1 text-xl font-bold text-white",children:l.title}),t.jsx("p",{className:"mt-1 text-sm text-slate-400",children:l.subtitle})]}),t.jsx("section",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5",children:m?.nodes?t.jsx(U,{step:m}):t.jsx(X,{step:m,structure:i})})]}),t.jsxs("aside",{className:"w-full space-y-4 xl:w-80 xl:shrink-0",children:[t.jsxs(k,{title:"Operation",children:[t.jsx("label",{className:"text-[11px] text-slate-500",children:l.inputLabel}),t.jsx("textarea",{value:p,onChange:u=>c(u.target.value),rows:2,className:"mt-1 w-full resize-none rounded-xl bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-rose-500/50"}),t.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:l.helper}),t.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[t.jsx("button",{onClick:z,className:"rounded-xl bg-rose-500/20 px-3 py-2 text-xs font-semibold text-rose-300 ring-1 ring-rose-500/40 hover:bg-rose-500/30",children:"Run"}),t.jsxs("button",{onClick:B,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[t.jsx(P,{size:13})," Random"]})]})]}),t.jsxs(k,{title:"Step Playback",children:[t.jsx("p",{className:"min-h-12 text-xs leading-relaxed text-slate-300",children:m?.description}),m?.meta&&t.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:m.meta.map(u=>t.jsx("span",{className:"rounded-full bg-slate-800 px-2 py-0.5 text-[10px] font-mono text-slate-400",children:u},u))}),t.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs text-slate-500",children:[t.jsx("span",{children:"Step"}),t.jsxs("span",{className:"font-mono text-rose-300",children:[Math.min(o+1,e.length)," / ",e.length]})]}),t.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Animation Speed"}),t.jsxs("span",{className:"font-mono text-[10px] text-rose-300",children:[h,"ms"]})]}),t.jsx("input",{type:"range",min:120,max:1200,step:40,value:1320-h,onChange:u=>f(1320-Number(u.target.value)),className:"w-full accent-rose-400","aria-label":"Animation speed"}),t.jsxs("div",{className:"mt-1 flex justify-between text-[9px] uppercase tracking-wide text-slate-600",children:[t.jsx("span",{children:"Slow"}),t.jsx("span",{children:"Fast"})]})]}),t.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[t.jsxs("button",{onClick:()=>I(o-1),disabled:o<=0,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:[t.jsx(E,{size:13})," Back"]}),t.jsxs("button",{onClick:L,disabled:o>=e.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-emerald-500/15 px-2 py-2 text-xs font-semibold text-emerald-300 ring-1 ring-emerald-500/30 disabled:opacity-30",children:[t.jsx(F,{size:13})," Play"]}),t.jsxs("button",{onClick:()=>I(o+1),disabled:o>=e.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:["Next ",t.jsx(D,{size:13})]})]})]}),t.jsx(k,{title:"Audio",children:t.jsxs("button",{onClick:()=>s(!n),className:`inline-flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 ${n?"bg-rose-500/15 text-rose-300 ring-rose-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[n?t.jsx(V,{size:14}):t.jsx(W,{size:14}),n?"Sound On":"Sound Off"]})})]})]})}function k({title:i,children:l}){return t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:i}),l]})}function U({step:i}){const l=i.nodes??[],p=new Set(i.highlights??[]);return t.jsxs("svg",{viewBox:"0 0 720 380",className:"h-full min-h-[420px] w-full",children:[l.map(c=>{const e=l.find(d=>d.id===c.parentId);return e?t.jsx("line",{x1:e.x,y1:e.y,x2:c.x,y2:c.y,stroke:"#475569",strokeWidth:1.5},`${e.id}-${c.id}`):null}),l.map(c=>{const e=p.has(Number(c.id.replace(/\D/g,"")))||p.has(l.indexOf(c));return t.jsxs("g",{children:[t.jsx("circle",{cx:c.x,cy:c.y,r:22,fill:e?"rgba(244,63,94,0.22)":"rgba(30,41,59,0.9)",stroke:e?"#fb7185":"#64748b",strokeWidth:2}),t.jsx("text",{x:c.x,y:c.y+4,textAnchor:"middle",fontSize:"12",fontWeight:"800",fill:e?"#fecdd3":"#cbd5e1",children:c.label}),c.value!==void 0&&t.jsx("text",{x:c.x,y:c.y+35,textAnchor:"middle",fontSize:"10",fill:"#94a3b8",children:c.value})]},c.id)})]})}function X({step:i,structure:l}){const p=i?.array??[],c=new Set(i?.highlights??[]);return t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:p.map((e,d)=>t.jsxs("div",{className:`relative flex h-14 min-w-14 items-center justify-center rounded-xl px-3 font-mono text-sm font-black ring-1 ${c.has(d)?"bg-rose-500/20 text-rose-200 ring-rose-500/50":"bg-slate-800/70 text-slate-200 ring-slate-700/50"}`,children:[e,t.jsx("span",{className:"absolute -bottom-5 text-[9px] text-slate-500",children:l==="fenwick-tree"?d+1:d})]},`${e}-${d}`))}),i?.queryRange&&t.jsxs("p",{className:"text-center text-xs text-slate-400",children:["Active range: [",i.queryRange[0],", ",i.queryRange[1],"]"]})]})}function R(i,l){return i==="trie"?_(l):i==="segment-tree"?G(l):H(l)}function M(i){return i.split(",").map(l=>l.trim()).filter(Boolean).map(Number).filter(Number.isFinite)}function _(i){const[l="",p="prefix",c=""]=i.split(";"),e=l.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean),d=p.trim().toLowerCase(),o=c.trim().toLowerCase(),x=[];T=0;const h=A("*"),f=d==="insert"&&o?[...e,o]:e.filter(n=>!(d==="delete"&&n===o));if(e.forEach(n=>q(h,n)),x.push({description:`Build trie from ${e.length} word(s).`,event:"insert",nodes:v(h),meta:e}),d==="insert"&&o)q(h,o),x.push({description:`Insert "${o}" character by character.`,event:"insert",nodes:v(h),meta:f});else if(d==="delete"&&o){const n=A("*");f.forEach(s=>q(n,s)),x.push({description:`Delete "${o}" and rebuild active prefixes.`,event:"delete",nodes:v(n),meta:f})}else{let n=h;const s=[0];for(const r of o){if(n=n.children.get(r),!n)return x.push({description:`Character "${r}" is missing, so "${o}" was not found.`,event:"not-found",nodes:v(h),highlights:s,meta:e}),x;s.push(n.order),x.push({description:`Traverse character "${r}" in "${o}".`,event:"traverse",nodes:v(h),highlights:[...s],meta:e})}const a=e.filter(r=>d==="search"?r===o:r.startsWith(o));x.push({description:a.length?`Matched: ${a.join(", ")}.`:`No match for "${o}".`,event:a.length?"found":"not-found",nodes:v(h),highlights:s,meta:a})}return x}let T=0;function A(i){return{label:i,order:T++,terminal:!1,children:new Map}}function q(i,l){let p=i;for(const c of l)p.children.has(c)||p.children.set(c,A(c)),p=p.children.get(c);p.terminal=!0}function v(i){const l=[],p=new Map,c=(e,d,o)=>{const x=p.get(d)??[];x.push(e),p.set(d,x),l.push({id:`trie-${e.order}`,label:e.terminal?`${e.label}*`:e.label,x:0,y:d*72+42,parentId:o}),[...e.children.values()].forEach(h=>c(h,d+1,`trie-${e.order}`))};return c(i,0),l.forEach(e=>{const d=Math.round((e.y-42)/72),o=l.filter(h=>Math.round((h.y-42)/72)===d),x=o.indexOf(e);e.x=360+(x-(o.length-1)/2)*Math.max(46,520/Math.max(o.length,1))}),l}function G(i){const[l="",p="query",c="0,0"]=i.split(";"),e=M(l),d=p.trim(),o=M(c),x=Array(e.length*4).fill(0),h=[],f=(n,s,a)=>{if(s===a)x[n]=e[s];else{const r=Math.floor((s+a)/2);f(n*2,s,r),f(n*2+1,r+1,a),x[n]=x[n*2]+x[n*2+1]}h.push({description:`Build segment [${s}, ${a}] with sum ${x[n]}.`,event:"insert",array:[...e],highlights:S(s,a),queryRange:[s,a],meta:[`node:${n}`,`sum:${x[n]}`]})};if(e.length&&f(1,0,e.length-1),d==="query"){const[n,s]=o,a=Math.max(0,Math.min(e.length-1,n??0)),r=Math.max(a,Math.min(e.length-1,s??e.length-1)),w=(y,b,m)=>{if(h.push({description:`Visit segment [${b}, ${m}] for query [${a}, ${r}].`,event:"traverse",array:[...e],highlights:S(Math.max(b,a),Math.min(m,r)),queryRange:[a,r],meta:[`node:${y}`]}),r=0&&n{for(let r=s+1;r<=e.length;r+=r&-r)d[r]+=a,o.push({description:`Update BIT[${r}] += ${a}; next index is i + lowbit(i).`,event:"insert",array:d.slice(1),highlights:[r-1],meta:[`lowbit:${r&-r}`]})};e.forEach((s,a)=>x(a,s));const h=s=>{let a=0;for(let r=s+1;r>0;r-=r&-r)a+=d[r],o.push({description:`Read BIT[${r}] while computing prefix(${s}); next index is i - lowbit(i).`,event:"traverse",array:d.slice(1),highlights:[r-1],meta:[`partial:${a}`,`lowbit:${r&-r}`]});return a},f=p.trim(),n=M(c);if(f==="prefix"){const s=Math.max(0,Math.min(e.length-1,(n[0]??1)-1)),a=h(s);o.push({description:`Prefix sum up to position ${s+1} = ${a}.`,event:"found",array:d.slice(1),highlights:[s],meta:[`sum:${a}`]})}else if(f==="update"){const s=Math.max(0,Math.min(e.length-1,(n[0]??1)-1)),a=n[1]??e[s]??0;s>=0&&s0?h(s-1):0);o.push({description:`Range sum positions [${s+1}, ${a+1}] = ${r}.`,event:"found",array:d.slice(1),highlights:S(s,a),queryRange:[s+1,a+1],meta:[`sum:${r}`]})}return o}function S(i,l){return li+c)}function J(i){if(i==="trie")return"tree,trie,trial,algo,all,also;prefix;tr";const l=Array.from({length:6},()=>Math.floor(Math.random()*9)+1).join(",");return i==="segment-tree"?`${l};query;1,4`:`${l};range;1,4`}export{re as default}; diff --git a/docs/assets/AlgorithmCodePanel-8oFtkLXS.js b/docs/assets/AlgorithmCodePanel-B_cngBmY.js similarity index 97% rename from docs/assets/AlgorithmCodePanel-8oFtkLXS.js rename to docs/assets/AlgorithmCodePanel-B_cngBmY.js index 91222d8..ddd043b 100644 --- a/docs/assets/AlgorithmCodePanel-8oFtkLXS.js +++ b/docs/assets/AlgorithmCodePanel-B_cngBmY.js @@ -1 +1 @@ -import{r,j as a,C as b}from"./index-lLadk08S.js";import{g as f}from"./audioContext-NbgqvQGz.js";const h=[220,261.63,293.66,329.63,392,440,523.25,659.25,783.99];function T(){const l=r.useRef(!0),[i,x]=r.useState(!0),u=r.useCallback(()=>f(),[]),e=r.useCallback((s,c=.08,g="sine",m=.04)=>{if(!l.current)return;const t=u();if(!t)return;const n=t.createOscillator(),p=t.createGain();n.type=g,n.frequency.setValueAtTime(s,t.currentTime),p.gain.setValueAtTime(m,t.currentTime),p.gain.exponentialRampToValueAtTime(.001,t.currentTime+c),n.connect(p),p.connect(t.destination),n.start(t.currentTime),n.stop(t.currentTime+c)},[u]),d=r.useCallback((s,c=0,g=1)=>{const m=h[Math.max(0,Math.min(h.length-1,Math.floor(c/Math.max(g-1,1)*(h.length-1))))];switch(s){case"compare":e(m,.055,"sine",.025);break;case"swap":e(329.63,.07,"square",.025),setTimeout(()=>e(523.25,.07,"square",.025),45);break;case"visit":case"enqueue":case"dequeue":e(m,.065,"triangle",.03);break;case"push":e(440,.08,"triangle",.035);break;case"pop":e(293.66,.08,"triangle",.035);break;case"recurse":e(392+c*24,.07,"sine",.03);break;case"found":[523.25,659.25,783.99].forEach((t,n)=>setTimeout(()=>e(t,.1,"sine",.045),n*70));break;case"not-found":e(185,.16,"sawtooth",.035);break;case"complete":[392,523.25,659.25,783.99].forEach((t,n)=>setTimeout(()=>e(t,.11,"sine",.045),n*75));break}},[e]),o=r.useCallback(s=>{l.current=s,x(s)},[]);return{soundEnabled:i,toggleSound:o,playEvent:d}}function C({pseudocode:l,activeLine:i=null,title:x="Code",language:u="pseudocode"}){const e=r.useRef(null);return r.useEffect(()=>{e.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[i]),a.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsxs("h3",{className:"inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-slate-400",children:[a.jsx(b,{size:13,className:"text-indigo-400"})," ",x]}),a.jsx("span",{className:"rounded-full bg-slate-800/70 px-2 py-0.5 font-mono text-[9px] uppercase tracking-wide text-slate-500",children:u})]}),a.jsx("div",{className:"max-h-[420px] overflow-auto rounded-xl bg-slate-950/70 p-2 ring-1 ring-slate-800/70",children:a.jsx("pre",{className:"font-mono text-[11px] leading-relaxed",children:l.map((d,o)=>{const s=o===i;return a.jsxs("div",{ref:s?e:null,className:`flex gap-3 rounded-md px-2 py-0.5 transition-all duration-300 ${s?"bg-indigo-500/20 text-indigo-100 ring-1 ring-indigo-500/40":"text-slate-400"}`,children:[a.jsx("span",{className:`select-none text-right tabular-nums ${s?"text-indigo-300":"text-slate-600"}`,style:{minWidth:"1.6rem"},children:o+1}),a.jsx("span",{className:"whitespace-pre",children:d.length?d:" "})]},o)})})})]})}export{C as A,T as u}; +import{r,j as a,C as b}from"./index-CB1-0H6I.js";import{g as f}from"./audioContext-NbgqvQGz.js";const h=[220,261.63,293.66,329.63,392,440,523.25,659.25,783.99];function T(){const l=r.useRef(!0),[i,x]=r.useState(!0),u=r.useCallback(()=>f(),[]),e=r.useCallback((s,c=.08,g="sine",m=.04)=>{if(!l.current)return;const t=u();if(!t)return;const n=t.createOscillator(),p=t.createGain();n.type=g,n.frequency.setValueAtTime(s,t.currentTime),p.gain.setValueAtTime(m,t.currentTime),p.gain.exponentialRampToValueAtTime(.001,t.currentTime+c),n.connect(p),p.connect(t.destination),n.start(t.currentTime),n.stop(t.currentTime+c)},[u]),d=r.useCallback((s,c=0,g=1)=>{const m=h[Math.max(0,Math.min(h.length-1,Math.floor(c/Math.max(g-1,1)*(h.length-1))))];switch(s){case"compare":e(m,.055,"sine",.025);break;case"swap":e(329.63,.07,"square",.025),setTimeout(()=>e(523.25,.07,"square",.025),45);break;case"visit":case"enqueue":case"dequeue":e(m,.065,"triangle",.03);break;case"push":e(440,.08,"triangle",.035);break;case"pop":e(293.66,.08,"triangle",.035);break;case"recurse":e(392+c*24,.07,"sine",.03);break;case"found":[523.25,659.25,783.99].forEach((t,n)=>setTimeout(()=>e(t,.1,"sine",.045),n*70));break;case"not-found":e(185,.16,"sawtooth",.035);break;case"complete":[392,523.25,659.25,783.99].forEach((t,n)=>setTimeout(()=>e(t,.11,"sine",.045),n*75));break}},[e]),o=r.useCallback(s=>{l.current=s,x(s)},[]);return{soundEnabled:i,toggleSound:o,playEvent:d}}function C({pseudocode:l,activeLine:i=null,title:x="Code",language:u="pseudocode"}){const e=r.useRef(null);return r.useEffect(()=>{e.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[i]),a.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsxs("h3",{className:"inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-slate-400",children:[a.jsx(b,{size:13,className:"text-indigo-400"})," ",x]}),a.jsx("span",{className:"rounded-full bg-slate-800/70 px-2 py-0.5 font-mono text-[9px] uppercase tracking-wide text-slate-500",children:u})]}),a.jsx("div",{className:"max-h-[420px] overflow-auto rounded-xl bg-slate-950/70 p-2 ring-1 ring-slate-800/70",children:a.jsx("pre",{className:"font-mono text-[11px] leading-relaxed",children:l.map((d,o)=>{const s=o===i;return a.jsxs("div",{ref:s?e:null,className:`flex gap-3 rounded-md px-2 py-0.5 transition-all duration-300 ${s?"bg-indigo-500/20 text-indigo-100 ring-1 ring-indigo-500/40":"text-slate-400"}`,children:[a.jsx("span",{className:`select-none text-right tabular-nums ${s?"text-indigo-300":"text-slate-600"}`,style:{minWidth:"1.6rem"},children:o+1}),a.jsx("span",{className:"whitespace-pre",children:d.length?d:" "})]},o)})})})]})}export{C as A,T as u}; diff --git a/docs/assets/AlgorithmPlaygroundPage-BXRKH-KW.js b/docs/assets/AlgorithmPlaygroundPage-NFfq4IMN.js similarity index 98% rename from docs/assets/AlgorithmPlaygroundPage-BXRKH-KW.js rename to docs/assets/AlgorithmPlaygroundPage-NFfq4IMN.js index 6ff98f4..d547a2c 100644 --- a/docs/assets/AlgorithmPlaygroundPage-BXRKH-KW.js +++ b/docs/assets/AlgorithmPlaygroundPage-NFfq4IMN.js @@ -1 +1 @@ -import{r as b,j as i}from"./index-lLadk08S.js";import{u as M,A as C}from"./AlgorithmCodePanel-8oFtkLXS.js";import{S as F}from"./shuffle-ADbBlETg.js";import{C as I,a as z}from"./chevron-right-Cp_zyb7b.js";import{P as R}from"./play-b2ZiatJ3.js";import{R as A}from"./rotate-ccw-DMjSdzg2.js";import{V as P,a as E}from"./volume-x-CjLNPeax.js";import"./audioContext-NbgqvQGz.js";const T={"binary-search":{title:"Binary Search",subtitle:"Search a sorted array in logarithmic time",inputLabel:"Sorted numbers; target",defaultInput:"2,5,8,12,16,23,38,56,72;23",helper:"Format: sorted comma-separated numbers; target",pseudocode:["function binarySearch(arr, target):"," low = 0; high = arr.length - 1"," while low <= high:"," mid = (low + high) / 2"," if arr[mid] == target: return mid"," if arr[mid] < target: low = mid + 1"," else: high = mid - 1"," return -1 // not found"]},"ternary-search":{title:"Ternary Search",subtitle:"Split a sorted search range into thirds",inputLabel:"Sorted numbers; target",defaultInput:"1,4,8,11,15,19,23,27,31,35,39;31",helper:"Format: sorted comma-separated numbers; target",pseudocode:["function ternarySearch(arr, target):"," low = 0; high = arr.length - 1"," while low <= high:"," mid1 = low + (high - low) / 3"," mid2 = high - (high - low) / 3"," if arr[mid1] == target: return mid1"," if arr[mid2] == target: return mid2"," if target < arr[mid1]: high = mid1 - 1"," elif target > arr[mid2]: low = mid2 + 1"," else: low = mid1 + 1; high = mid2 - 1"," return -1 // not found"]},"dutch-national-flag":{title:"Sort Colors",subtitle:"Dutch national flag partitioning",inputLabel:"Colors as 0, 1, 2",defaultInput:"2,0,2,1,1,0,2,0,1",helper:"Use only 0, 1, and 2.",pseudocode:["function sortColors(arr):"," low = 0; mid = 0; high = arr.length - 1"," while mid <= high:"," if arr[mid] == 0:"," swap(arr[low], arr[mid]); low++; mid++"," elif arr[mid] == 1:"," mid++"," else: // arr[mid] == 2"," swap(arr[mid], arr[high]); high--"," return arr"]},"top-k-frequent":{title:"Top K Frequent Elements",subtitle:"Count, rank, and extract frequent values",inputLabel:"Numbers; k",defaultInput:"1,1,1,2,2,3,3,3,3,4,5,5;3",helper:"Format: comma-separated numbers; k",pseudocode:["function topKFrequent(arr, k):"," counts = {}"," for value in arr:"," counts[value] += 1 // tally frequency"," ranked = sortByCountDescending(counts)"," return ranked[0 .. k]"]},"queue-using-stacks":{title:"Queue Using Two Stacks",subtitle:"Build FIFO behavior from LIFO stacks",inputLabel:"Enqueue values",defaultInput:"10,20,30,40",helper:"Values are enqueued, then all are dequeued.",pseudocode:["enqueue(x):"," input.push(x)","","dequeue():"," if output.isEmpty():"," while not input.isEmpty():"," output.push(input.pop()) // reverse order"," return output.pop()"]},"stack-using-queues":{title:"Stack Using Two Queues",subtitle:"Build LIFO behavior from FIFO queues",inputLabel:"Push values",defaultInput:"10,20,30,40",helper:"Values are pushed, then all are popped.",pseudocode:["push(x):"," helper.enqueue(x)"," while not primary.isEmpty():"," helper.enqueue(primary.dequeue())"," swap(primary, helper) // x now at front","","pop():"," return primary.dequeue()"]},"tower-of-hanoi":{title:"Tower of Hanoi",subtitle:"Recursive disk movement",inputLabel:"Disk count",defaultInput:"4",helper:"Use 2 to 5 disks for readable playback.",pseudocode:["function hanoi(n, from, to, aux):"," if n == 0: return"," hanoi(n - 1, from, aux, to) // move top n-1 aside"," move disk n: from -> to"," hanoi(n - 1, aux, to, from) // move them onto target"]},"rat-maze":{title:"Rat in a Maze",subtitle:"Recursive DFS and BFS on blocked cells",inputLabel:"Mode",defaultInput:"dfs",helper:"Use dfs or bfs. The maze is generated in the visualizer.",pseudocode:["function solve(grid, mode):"," frontier = [start]; visited = {start}"," while frontier not empty:"," cell = mode == DFS ? frontier.pop() : frontier.shift()"," if cell == target: break"," for n in freeNeighbors(cell):"," if n not visited:"," visited.add(n); parent[n] = cell"," frontier.push(n)"," return reconstructPath(parent, target)"]},"grid-search":{title:"Grid Search",subtitle:"Search allowed positions from source to target",inputLabel:"Mode",defaultInput:"bfs",helper:"Use bfs or dfs over free/occupied grid cells.",pseudocode:["function search(grid, mode):"," frontier = [start]; visited = {start}"," while frontier not empty:"," cell = mode == DFS ? frontier.pop() : frontier.shift()"," if cell == target: break"," for n in freeNeighbors(cell):"," if n not visited:"," visited.add(n); parent[n] = cell"," frontier.push(n)"," return reconstructPath(parent, target)"]}};function le({demo:a}){const n=T[a],[e,o]=b.useState(n.defaultInput),[s,t]=b.useState(()=>j(a,n.defaultInput)),[r,l]=b.useState(0),[d,u]=b.useState(800),{soundEnabled:p,toggleSound:g,playEvent:h}=M(),m=s[r]??s[0],$=s.length>0?(r+1)/s.length*100:0,S=()=>{const c=j(a,e);t(c),l(0),h(c[0]?.event??"visit",0,c.length)},L=()=>{const c=Z(a);o(c);const f=j(a,c);t(f),l(0)},w=c=>{const f=Math.max(0,Math.min(s.length-1,c));l(f);const y=s[f];y&&h(y.event,f,s.length)},q=()=>{for(let c=r;c{l(c);const f=s[c];f&&h(f.event,c,s.length)},(c-r)*d)};return i.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[i.jsxs("main",{className:"order-last flex min-h-[520px] flex-1 flex-col gap-4 xl:order-first",children:[i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm",children:[i.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-indigo-300",children:"Algorithms"}),i.jsx("h2",{className:"mt-1 text-xl font-bold text-white",children:n.title}),i.jsx("p",{className:"mt-1 text-sm text-slate-400",children:n.subtitle})]}),i.jsx(D,{step:m,demo:a}),i.jsx(C,{pseudocode:n.pseudocode,activeLine:m?.codeLine??null})]}),i.jsxs("aside",{className:"w-full space-y-4 xl:w-80 xl:shrink-0",children:[i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[i.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Input"}),i.jsx("label",{className:"text-[11px] text-slate-500",children:n.inputLabel}),i.jsx("textarea",{value:e,onChange:c=>o(c.target.value),rows:2,className:"mt-1 w-full resize-none rounded-xl bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-indigo-500/50"}),i.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:n.helper}),i.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[i.jsx("button",{onClick:S,className:"rounded-xl bg-indigo-500/20 px-3 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/40 hover:bg-indigo-500/30",children:"Run"}),i.jsxs("button",{onClick:L,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[i.jsx(F,{size:13})," Random"]})]})]}),i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Step Playback"}),i.jsxs("span",{className:"font-mono text-xs text-indigo-300",children:[Math.min(r+1,s.length)," / ",s.length]})]}),i.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-slate-800",children:i.jsx("div",{className:"h-full rounded-full bg-indigo-400 transition-all",style:{width:`${$}%`}})}),i.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Animation Speed"}),i.jsxs("span",{className:"font-mono text-[10px] text-indigo-300",children:[(d/1e3).toFixed(2),"s"]})]}),i.jsx("input",{type:"range",min:120,max:3e3,step:20,value:3120-d,onChange:c=>u(3120-Number(c.target.value)),className:"w-full accent-indigo-400","aria-label":"Animation speed"}),i.jsxs("div",{className:"mt-1 flex justify-between text-[9px] uppercase tracking-wide text-slate-600",children:[i.jsx("span",{children:"Slow"}),i.jsx("span",{children:"Fast"})]})]}),i.jsx("p",{className:"mt-3 min-h-12 text-xs leading-relaxed text-slate-300",children:m?.description}),m?.meta&&i.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:m.meta.map(c=>i.jsx("span",{className:"rounded-full bg-slate-800/80 px-2 py-0.5 text-[10px] font-mono text-slate-400",children:c},c))}),i.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[i.jsxs("button",{onClick:()=>w(r-1),disabled:r<=0,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:[i.jsx(I,{size:13})," Back"]}),i.jsxs("button",{onClick:q,disabled:r>=s.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-emerald-500/15 px-2 py-2 text-xs font-semibold text-emerald-300 ring-1 ring-emerald-500/30 disabled:opacity-30",children:[i.jsx(R,{size:13})," Play"]}),i.jsxs("button",{onClick:()=>w(r+1),disabled:r>=s.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:["Next ",i.jsx(z,{size:13})]})]}),i.jsxs("button",{onClick:()=>w(0),className:"mt-2 inline-flex w-full items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[i.jsx(A,{size:13})," Reset Steps"]})]}),i.jsx("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:i.jsxs("button",{onClick:()=>g(!p),className:`inline-flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 ${p?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[p?i.jsx(P,{size:14}):i.jsx(E,{size:14}),p?"Sound On":"Sound Off"]})})]})]})}function D({step:a,demo:n}){return a?a.grid?i.jsx(B,{step:a}):a.pegs?i.jsx(U,{pegs:a.pegs}):a.stacks||a.queues?i.jsx(O,{step:a}):i.jsx(V,{step:a,demo:n}):null}function V({step:a,demo:n}){const e=a.values??[],o=new Set(a.highlights??[]),s=(t,r)=>n==="dutch-national-flag"?t===0?"bg-sky-500/25 text-sky-200 ring-sky-500/40":t===1?"bg-white/15 text-white ring-white/30":"bg-rose-500/25 text-rose-200 ring-rose-500/40":o.has(r)?"bg-indigo-500/25 text-indigo-200 ring-indigo-500/50":"bg-slate-800/70 text-slate-200 ring-slate-700/50";return i.jsx("section",{className:"flex flex-1 flex-col items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5",children:i.jsx("div",{className:"flex max-w-full flex-wrap items-end justify-center gap-2",children:e.map((t,r)=>i.jsxs("div",{className:`relative flex h-16 min-w-12 items-center justify-center rounded-xl px-3 font-mono text-sm font-black ring-1 transition-all ${s(t,r)}`,children:[t,Object.entries(a.pointers??{}).filter(([,l])=>l===r).map(([l])=>i.jsx("span",{className:"absolute -bottom-5 text-[9px] uppercase tracking-wide text-amber-300",children:l},l))]},`${t}-${r}`))})})}function O({step:a}){const n=a.stacks??a.queues??{};return i.jsx("section",{className:"grid flex-1 gap-4 rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5 md:grid-cols-2",children:Object.entries(n).map(([e,o])=>i.jsxs("div",{className:"flex flex-col justify-end rounded-xl bg-slate-900/70 p-4 ring-1 ring-slate-700/50",children:[i.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:e}),i.jsx("div",{className:"flex min-h-64 flex-col-reverse gap-2",children:o.map((s,t)=>i.jsx("div",{className:"rounded-lg bg-indigo-500/15 px-3 py-2 text-center font-mono text-sm font-bold text-indigo-200 ring-1 ring-indigo-500/30",children:s},`${e}-${s}-${t}`))})]},e))})}function U({pegs:a}){return i.jsx("section",{className:"grid flex-1 items-end gap-4 rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5 md:grid-cols-3",children:a.map((n,e)=>i.jsxs("div",{className:"relative flex h-72 flex-col-reverse items-center justify-start gap-1 rounded-xl bg-slate-900/70 p-4 ring-1 ring-slate-700/50",children:[i.jsx("div",{className:"absolute bottom-4 h-56 w-2 rounded-full bg-slate-700"}),n.map(o=>i.jsx("div",{className:"z-10 h-6 rounded-md bg-gradient-to-r from-cyan-500 to-indigo-500 ring-1 ring-cyan-300/40",style:{width:`${o*34+34}px`}},`${e}-${o}`)),i.jsxs("span",{className:"absolute bottom-0 text-[10px] font-mono text-slate-500",children:["Peg ",e+1]})]},e))})}function B({step:a}){const n=new Set(a.visited??[]),e=new Set(a.path??[]);return i.jsx("section",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5",children:i.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:`repeat(${a.grid?.[0]?.length??0}, minmax(0, 1fr))`},children:a.grid?.flatMap((o,s)=>o.map((t,r)=>{const l=s*o.length+r,d=e.has(l),u=n.has(l),p=l===0,g=l===o.length*(a.grid?.length??1)-1,h=t===1?"bg-slate-800 ring-slate-700":d?"bg-emerald-400 ring-emerald-200":p?"bg-sky-400 ring-sky-200":g?"bg-orange-400 ring-orange-200":u?"bg-indigo-500/70 ring-indigo-300":"bg-slate-900 ring-slate-700";return i.jsx("div",{className:`h-9 w-9 rounded-md ring-1 ${h}`},l)}))})})}function j(a,n){switch(a){case"binary-search":return G(n);case"ternary-search":return _(n);case"dutch-national-flag":return K(n);case"top-k-frequent":return Q(n);case"queue-using-stacks":return H(n);case"stack-using-queues":return X(n);case"tower-of-hanoi":return J(n);case"rat-maze":return k(n,!0);case"grid-search":return k(n,!1);default:return[]}}function x(a){return a.split(",").map(n=>n.trim()).filter(Boolean).map(Number).filter(Number.isFinite)}function N(a){const[n,e]=a.split(";");return{values:x(n??"").sort((o,s)=>o-s),target:Number(e)}}function G(a){const{values:n,target:e}=N(a),o=[];let s=0,t=n.length-1;for(;s<=t;){const r=Math.floor((s+t)/2);if(o.push({description:`Compare target ${e} with middle value ${n[r]} at index ${r}.`,event:"compare",values:n,highlights:[r],pointers:{low:s,mid:r,high:t},codeLine:4}),n[r]===e)return o.push({description:`Found ${e} at index ${r}.`,event:"found",values:n,highlights:[r],pointers:{low:s,mid:r,high:t},codeLine:4}),o;n[r]n[d]?s=d+1:(s=l+1,t=d-1)}return[...o,{description:`${e} is not present in the sorted array.`,event:"not-found",values:n,codeLine:10}]}function K(a){const e=[...x(a).filter(l=>l===0||l===1||l===2)],o=[{description:"Start with low, mid, and high pointers.",event:"visit",values:[...e],pointers:{low:0,mid:0,high:e.length-1},codeLine:1}];let s=0,t=0,r=e.length-1;for(;t<=r;)e[t]===0?([e[s],e[t]]=[e[t],e[s]],o.push({description:`Swap 0 at mid ${t} with low ${s}.`,event:"swap",values:[...e],highlights:[s,t],pointers:{low:s,mid:t,high:r},codeLine:4}),s+=1,t+=1):e[t]===1?(o.push({description:`Value 1 at mid ${t} is already in the middle partition.`,event:"compare",values:[...e],highlights:[t],pointers:{low:s,mid:t,high:r},codeLine:6}),t+=1):([e[t],e[r]]=[e[r],e[t]],o.push({description:`Swap 2 at mid ${t} with high ${r}.`,event:"swap",values:[...e],highlights:[t,r],pointers:{low:s,mid:t,high:r},codeLine:8}),r-=1);return[...o,{description:"Colors are sorted: all 0s, then 1s, then 2s.",event:"complete",values:[...e],codeLine:9}]}function Q(a){const[n,e]=a.split(";"),o=x(n??""),s=Math.max(1,Number(e)||3),t=new Map,r=[];o.forEach((d,u)=>{t.set(d,(t.get(d)??0)+1),r.push({description:`Count ${d}: frequency is now ${t.get(d)}.`,event:"visit",values:o,highlights:[u],meta:[...t.entries()].map(([p,g])=>`${p}:${g}`),codeLine:3})});const l=[...t.entries()].sort((d,u)=>u[1]-d[1]).map(([d])=>d);return[...r,{description:`Top ${s} frequent elements: ${l.slice(0,s).join(", ")}.`,event:"complete",values:l,highlights:l.slice(0,s).map((d,u)=>u),meta:[...t.entries()].map(([d,u])=>`${d}:${u}`),codeLine:5}]}function H(a){const n=x(a),e=[],o=[],s=[];for(n.forEach(t=>{e.push(t),s.push({description:`Enqueue ${t}: push onto input stack.`,event:"push",stacks:{input:[...e],output:[...o]},codeLine:1})});e.length>0;){const t=e.pop();o.push(t),s.push({description:`Move ${t} from input to output stack to expose queue front.`,event:"pop",stacks:{input:[...e],output:[...o]},codeLine:6})}for(;o.length>0;){const t=o.pop();s.push({description:`Dequeue ${t} from output stack.`,event:"dequeue",stacks:{input:[...e],output:[...o]},codeLine:7})}return s}function X(a){const n=x(a);let e=[],o=[];const s=[];for(n.forEach(t=>{for(o.push(t),s.push({description:`Push ${t}: enqueue into helper queue.`,event:"enqueue",queues:{primary:[...e],helper:[...o]},codeLine:1});e.length>0;)o.push(e.shift());[e,o]=[o,[]],s.push({description:`Rotate queues so ${t} becomes the next pop.`,event:"visit",queues:{primary:[...e],helper:[...o]},codeLine:4})});e.length>0;){const t=e.shift();s.push({description:`Pop ${t} from primary queue front.`,event:"dequeue",queues:{primary:[...e],helper:[...o]},codeLine:7})}return s}function J(a){const n=Math.max(2,Math.min(5,Number(a)||4)),e=[Array.from({length:n},(t,r)=>n-r),[],[]],o=[{description:`Start with ${n} disks on peg 1.`,event:"recurse",pegs:v(e),codeLine:0}],s=(t,r,l,d)=>{if(t===0)return;o.push({description:`Solve subproblem: move ${t-1} disk(s) from peg ${r+1} to peg ${d+1}.`,event:"recurse",pegs:v(e),codeLine:2}),s(t-1,r,d,l);const u=e[r].pop();u&&e[l].push(u),o.push({description:`Move disk ${u} from peg ${r+1} to peg ${l+1}.`,event:"visit",pegs:v(e),codeLine:3}),s(t-1,d,l,r)};return s(n,0,2,1),[...o,{description:"Tower complete.",event:"complete",pegs:v(e),codeLine:4}]}function v(a){return a.map(n=>[...n])}const W=[[0,0,0,1,0,0,0],[1,1,0,1,0,1,0],[0,0,0,0,0,1,0],[0,1,1,1,0,0,0],[0,0,0,1,1,1,0],[0,1,0,0,0,0,0]];function k(a,n){const e=a.trim().toLowerCase()==="dfs"?"dfs":"bfs",o=W.map(h=>[...h]),s=o[0].length,t=o.length*s-1,r=new Set,l=new Map,d=[],u=[0];for(r.add(0);u.length>0;){const h=e==="dfs"?u.pop():u.shift();if(d.push({description:`${n?"Rat maze":"Grid search"} ${e.toUpperCase()}: visit cell (${Math.floor(h/s)}, ${h%s}).`,event:e==="dfs"?"recurse":"visit",grid:o,visited:[...r],path:[h],codeLine:3}),h===t)break;for(const m of Y(h,o))r.has(m)||(r.add(m),l.set(m,h),u.push(m),d.push({description:`Add allowed neighbor (${Math.floor(m/s)}, ${m%s}) to ${e==="dfs"?"stack":"queue"}.`,event:e==="dfs"?"push":"enqueue",grid:o,visited:[...r],path:[m],codeLine:8}))}const p=[];let g=t;for(;g!==void 0&&(g===0||l.has(g))&&(p.unshift(g),g!==0);)g=l.get(g);return[...d,{description:p[0]===0?`Found path with ${p.length} cells.`:"No path found.",event:p[0]===0?"found":"not-found",grid:o,visited:[...r],path:p,codeLine:9}]}function Y(a,n){const e=n[0].length,o=Math.floor(a/e),s=a%e;return[[o-1,s],[o+1,s],[o,s-1],[o,s+1]].filter(([t,r])=>t>=0&&r>=0&&tt*e+r)}function Z(a){const n=Array.from({length:9},()=>Math.floor(Math.random()*40)+1);switch(a){case"binary-search":case"ternary-search":{const e=[...n].sort((t,r)=>t-r),o=Math.floor(e.length/2);let s=Math.floor(Math.random()*e.length);return a==="binary-search"&&e.length>1&&s===o&&(s=(s+1)%e.length),`${e.join(",")};${e[s]}`}case"dutch-national-flag":return Array.from({length:10},()=>Math.floor(Math.random()*3)).join(",");case"top-k-frequent":return`${Array.from({length:12},()=>Math.floor(Math.random()*5)+1).join(",")};3`;case"tower-of-hanoi":return String(Math.floor(Math.random()*3)+3);case"rat-maze":return Math.random()>.5?"dfs":"bfs";case"grid-search":return Math.random()>.5?"dfs":"bfs";default:return n.slice(0,4).join(",")}}export{le as default}; +import{r as b,j as i}from"./index-CB1-0H6I.js";import{u as M,A as C}from"./AlgorithmCodePanel-B_cngBmY.js";import{S as F}from"./shuffle-DZnyoAGL.js";import{C as I,a as z}from"./chevron-right-ChVmoNtO.js";import{P as R}from"./play-SZ6Nqtz8.js";import{R as A}from"./rotate-ccw-CDlWXRsI.js";import{V as P,a as E}from"./volume-x-CKT6TOtL.js";import"./audioContext-NbgqvQGz.js";const T={"binary-search":{title:"Binary Search",subtitle:"Search a sorted array in logarithmic time",inputLabel:"Sorted numbers; target",defaultInput:"2,5,8,12,16,23,38,56,72;23",helper:"Format: sorted comma-separated numbers; target",pseudocode:["function binarySearch(arr, target):"," low = 0; high = arr.length - 1"," while low <= high:"," mid = (low + high) / 2"," if arr[mid] == target: return mid"," if arr[mid] < target: low = mid + 1"," else: high = mid - 1"," return -1 // not found"]},"ternary-search":{title:"Ternary Search",subtitle:"Split a sorted search range into thirds",inputLabel:"Sorted numbers; target",defaultInput:"1,4,8,11,15,19,23,27,31,35,39;31",helper:"Format: sorted comma-separated numbers; target",pseudocode:["function ternarySearch(arr, target):"," low = 0; high = arr.length - 1"," while low <= high:"," mid1 = low + (high - low) / 3"," mid2 = high - (high - low) / 3"," if arr[mid1] == target: return mid1"," if arr[mid2] == target: return mid2"," if target < arr[mid1]: high = mid1 - 1"," elif target > arr[mid2]: low = mid2 + 1"," else: low = mid1 + 1; high = mid2 - 1"," return -1 // not found"]},"dutch-national-flag":{title:"Sort Colors",subtitle:"Dutch national flag partitioning",inputLabel:"Colors as 0, 1, 2",defaultInput:"2,0,2,1,1,0,2,0,1",helper:"Use only 0, 1, and 2.",pseudocode:["function sortColors(arr):"," low = 0; mid = 0; high = arr.length - 1"," while mid <= high:"," if arr[mid] == 0:"," swap(arr[low], arr[mid]); low++; mid++"," elif arr[mid] == 1:"," mid++"," else: // arr[mid] == 2"," swap(arr[mid], arr[high]); high--"," return arr"]},"top-k-frequent":{title:"Top K Frequent Elements",subtitle:"Count, rank, and extract frequent values",inputLabel:"Numbers; k",defaultInput:"1,1,1,2,2,3,3,3,3,4,5,5;3",helper:"Format: comma-separated numbers; k",pseudocode:["function topKFrequent(arr, k):"," counts = {}"," for value in arr:"," counts[value] += 1 // tally frequency"," ranked = sortByCountDescending(counts)"," return ranked[0 .. k]"]},"queue-using-stacks":{title:"Queue Using Two Stacks",subtitle:"Build FIFO behavior from LIFO stacks",inputLabel:"Enqueue values",defaultInput:"10,20,30,40",helper:"Values are enqueued, then all are dequeued.",pseudocode:["enqueue(x):"," input.push(x)","","dequeue():"," if output.isEmpty():"," while not input.isEmpty():"," output.push(input.pop()) // reverse order"," return output.pop()"]},"stack-using-queues":{title:"Stack Using Two Queues",subtitle:"Build LIFO behavior from FIFO queues",inputLabel:"Push values",defaultInput:"10,20,30,40",helper:"Values are pushed, then all are popped.",pseudocode:["push(x):"," helper.enqueue(x)"," while not primary.isEmpty():"," helper.enqueue(primary.dequeue())"," swap(primary, helper) // x now at front","","pop():"," return primary.dequeue()"]},"tower-of-hanoi":{title:"Tower of Hanoi",subtitle:"Recursive disk movement",inputLabel:"Disk count",defaultInput:"4",helper:"Use 2 to 5 disks for readable playback.",pseudocode:["function hanoi(n, from, to, aux):"," if n == 0: return"," hanoi(n - 1, from, aux, to) // move top n-1 aside"," move disk n: from -> to"," hanoi(n - 1, aux, to, from) // move them onto target"]},"rat-maze":{title:"Rat in a Maze",subtitle:"Recursive DFS and BFS on blocked cells",inputLabel:"Mode",defaultInput:"dfs",helper:"Use dfs or bfs. The maze is generated in the visualizer.",pseudocode:["function solve(grid, mode):"," frontier = [start]; visited = {start}"," while frontier not empty:"," cell = mode == DFS ? frontier.pop() : frontier.shift()"," if cell == target: break"," for n in freeNeighbors(cell):"," if n not visited:"," visited.add(n); parent[n] = cell"," frontier.push(n)"," return reconstructPath(parent, target)"]},"grid-search":{title:"Grid Search",subtitle:"Search allowed positions from source to target",inputLabel:"Mode",defaultInput:"bfs",helper:"Use bfs or dfs over free/occupied grid cells.",pseudocode:["function search(grid, mode):"," frontier = [start]; visited = {start}"," while frontier not empty:"," cell = mode == DFS ? frontier.pop() : frontier.shift()"," if cell == target: break"," for n in freeNeighbors(cell):"," if n not visited:"," visited.add(n); parent[n] = cell"," frontier.push(n)"," return reconstructPath(parent, target)"]}};function le({demo:a}){const n=T[a],[e,o]=b.useState(n.defaultInput),[s,t]=b.useState(()=>j(a,n.defaultInput)),[r,l]=b.useState(0),[d,u]=b.useState(800),{soundEnabled:p,toggleSound:g,playEvent:h}=M(),m=s[r]??s[0],$=s.length>0?(r+1)/s.length*100:0,S=()=>{const c=j(a,e);t(c),l(0),h(c[0]?.event??"visit",0,c.length)},L=()=>{const c=Z(a);o(c);const f=j(a,c);t(f),l(0)},w=c=>{const f=Math.max(0,Math.min(s.length-1,c));l(f);const y=s[f];y&&h(y.event,f,s.length)},q=()=>{for(let c=r;c{l(c);const f=s[c];f&&h(f.event,c,s.length)},(c-r)*d)};return i.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[i.jsxs("main",{className:"order-last flex min-h-[520px] flex-1 flex-col gap-4 xl:order-first",children:[i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm",children:[i.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-indigo-300",children:"Algorithms"}),i.jsx("h2",{className:"mt-1 text-xl font-bold text-white",children:n.title}),i.jsx("p",{className:"mt-1 text-sm text-slate-400",children:n.subtitle})]}),i.jsx(D,{step:m,demo:a}),i.jsx(C,{pseudocode:n.pseudocode,activeLine:m?.codeLine??null})]}),i.jsxs("aside",{className:"w-full space-y-4 xl:w-80 xl:shrink-0",children:[i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[i.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Input"}),i.jsx("label",{className:"text-[11px] text-slate-500",children:n.inputLabel}),i.jsx("textarea",{value:e,onChange:c=>o(c.target.value),rows:2,className:"mt-1 w-full resize-none rounded-xl bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-indigo-500/50"}),i.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:n.helper}),i.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[i.jsx("button",{onClick:S,className:"rounded-xl bg-indigo-500/20 px-3 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/40 hover:bg-indigo-500/30",children:"Run"}),i.jsxs("button",{onClick:L,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[i.jsx(F,{size:13})," Random"]})]})]}),i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Step Playback"}),i.jsxs("span",{className:"font-mono text-xs text-indigo-300",children:[Math.min(r+1,s.length)," / ",s.length]})]}),i.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-slate-800",children:i.jsx("div",{className:"h-full rounded-full bg-indigo-400 transition-all",style:{width:`${$}%`}})}),i.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Animation Speed"}),i.jsxs("span",{className:"font-mono text-[10px] text-indigo-300",children:[(d/1e3).toFixed(2),"s"]})]}),i.jsx("input",{type:"range",min:120,max:3e3,step:20,value:3120-d,onChange:c=>u(3120-Number(c.target.value)),className:"w-full accent-indigo-400","aria-label":"Animation speed"}),i.jsxs("div",{className:"mt-1 flex justify-between text-[9px] uppercase tracking-wide text-slate-600",children:[i.jsx("span",{children:"Slow"}),i.jsx("span",{children:"Fast"})]})]}),i.jsx("p",{className:"mt-3 min-h-12 text-xs leading-relaxed text-slate-300",children:m?.description}),m?.meta&&i.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:m.meta.map(c=>i.jsx("span",{className:"rounded-full bg-slate-800/80 px-2 py-0.5 text-[10px] font-mono text-slate-400",children:c},c))}),i.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[i.jsxs("button",{onClick:()=>w(r-1),disabled:r<=0,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:[i.jsx(I,{size:13})," Back"]}),i.jsxs("button",{onClick:q,disabled:r>=s.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-emerald-500/15 px-2 py-2 text-xs font-semibold text-emerald-300 ring-1 ring-emerald-500/30 disabled:opacity-30",children:[i.jsx(R,{size:13})," Play"]}),i.jsxs("button",{onClick:()=>w(r+1),disabled:r>=s.length-1,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:["Next ",i.jsx(z,{size:13})]})]}),i.jsxs("button",{onClick:()=>w(0),className:"mt-2 inline-flex w-full items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[i.jsx(A,{size:13})," Reset Steps"]})]}),i.jsx("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:i.jsxs("button",{onClick:()=>g(!p),className:`inline-flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 ${p?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[p?i.jsx(P,{size:14}):i.jsx(E,{size:14}),p?"Sound On":"Sound Off"]})})]})]})}function D({step:a,demo:n}){return a?a.grid?i.jsx(B,{step:a}):a.pegs?i.jsx(U,{pegs:a.pegs}):a.stacks||a.queues?i.jsx(O,{step:a}):i.jsx(V,{step:a,demo:n}):null}function V({step:a,demo:n}){const e=a.values??[],o=new Set(a.highlights??[]),s=(t,r)=>n==="dutch-national-flag"?t===0?"bg-sky-500/25 text-sky-200 ring-sky-500/40":t===1?"bg-white/15 text-white ring-white/30":"bg-rose-500/25 text-rose-200 ring-rose-500/40":o.has(r)?"bg-indigo-500/25 text-indigo-200 ring-indigo-500/50":"bg-slate-800/70 text-slate-200 ring-slate-700/50";return i.jsx("section",{className:"flex flex-1 flex-col items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5",children:i.jsx("div",{className:"flex max-w-full flex-wrap items-end justify-center gap-2",children:e.map((t,r)=>i.jsxs("div",{className:`relative flex h-16 min-w-12 items-center justify-center rounded-xl px-3 font-mono text-sm font-black ring-1 transition-all ${s(t,r)}`,children:[t,Object.entries(a.pointers??{}).filter(([,l])=>l===r).map(([l])=>i.jsx("span",{className:"absolute -bottom-5 text-[9px] uppercase tracking-wide text-amber-300",children:l},l))]},`${t}-${r}`))})})}function O({step:a}){const n=a.stacks??a.queues??{};return i.jsx("section",{className:"grid flex-1 gap-4 rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5 md:grid-cols-2",children:Object.entries(n).map(([e,o])=>i.jsxs("div",{className:"flex flex-col justify-end rounded-xl bg-slate-900/70 p-4 ring-1 ring-slate-700/50",children:[i.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:e}),i.jsx("div",{className:"flex min-h-64 flex-col-reverse gap-2",children:o.map((s,t)=>i.jsx("div",{className:"rounded-lg bg-indigo-500/15 px-3 py-2 text-center font-mono text-sm font-bold text-indigo-200 ring-1 ring-indigo-500/30",children:s},`${e}-${s}-${t}`))})]},e))})}function U({pegs:a}){return i.jsx("section",{className:"grid flex-1 items-end gap-4 rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5 md:grid-cols-3",children:a.map((n,e)=>i.jsxs("div",{className:"relative flex h-72 flex-col-reverse items-center justify-start gap-1 rounded-xl bg-slate-900/70 p-4 ring-1 ring-slate-700/50",children:[i.jsx("div",{className:"absolute bottom-4 h-56 w-2 rounded-full bg-slate-700"}),n.map(o=>i.jsx("div",{className:"z-10 h-6 rounded-md bg-gradient-to-r from-cyan-500 to-indigo-500 ring-1 ring-cyan-300/40",style:{width:`${o*34+34}px`}},`${e}-${o}`)),i.jsxs("span",{className:"absolute bottom-0 text-[10px] font-mono text-slate-500",children:["Peg ",e+1]})]},e))})}function B({step:a}){const n=new Set(a.visited??[]),e=new Set(a.path??[]);return i.jsx("section",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/60 p-5",children:i.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:`repeat(${a.grid?.[0]?.length??0}, minmax(0, 1fr))`},children:a.grid?.flatMap((o,s)=>o.map((t,r)=>{const l=s*o.length+r,d=e.has(l),u=n.has(l),p=l===0,g=l===o.length*(a.grid?.length??1)-1,h=t===1?"bg-slate-800 ring-slate-700":d?"bg-emerald-400 ring-emerald-200":p?"bg-sky-400 ring-sky-200":g?"bg-orange-400 ring-orange-200":u?"bg-indigo-500/70 ring-indigo-300":"bg-slate-900 ring-slate-700";return i.jsx("div",{className:`h-9 w-9 rounded-md ring-1 ${h}`},l)}))})})}function j(a,n){switch(a){case"binary-search":return G(n);case"ternary-search":return _(n);case"dutch-national-flag":return K(n);case"top-k-frequent":return Q(n);case"queue-using-stacks":return H(n);case"stack-using-queues":return X(n);case"tower-of-hanoi":return J(n);case"rat-maze":return k(n,!0);case"grid-search":return k(n,!1);default:return[]}}function x(a){return a.split(",").map(n=>n.trim()).filter(Boolean).map(Number).filter(Number.isFinite)}function N(a){const[n,e]=a.split(";");return{values:x(n??"").sort((o,s)=>o-s),target:Number(e)}}function G(a){const{values:n,target:e}=N(a),o=[];let s=0,t=n.length-1;for(;s<=t;){const r=Math.floor((s+t)/2);if(o.push({description:`Compare target ${e} with middle value ${n[r]} at index ${r}.`,event:"compare",values:n,highlights:[r],pointers:{low:s,mid:r,high:t},codeLine:4}),n[r]===e)return o.push({description:`Found ${e} at index ${r}.`,event:"found",values:n,highlights:[r],pointers:{low:s,mid:r,high:t},codeLine:4}),o;n[r]n[d]?s=d+1:(s=l+1,t=d-1)}return[...o,{description:`${e} is not present in the sorted array.`,event:"not-found",values:n,codeLine:10}]}function K(a){const e=[...x(a).filter(l=>l===0||l===1||l===2)],o=[{description:"Start with low, mid, and high pointers.",event:"visit",values:[...e],pointers:{low:0,mid:0,high:e.length-1},codeLine:1}];let s=0,t=0,r=e.length-1;for(;t<=r;)e[t]===0?([e[s],e[t]]=[e[t],e[s]],o.push({description:`Swap 0 at mid ${t} with low ${s}.`,event:"swap",values:[...e],highlights:[s,t],pointers:{low:s,mid:t,high:r},codeLine:4}),s+=1,t+=1):e[t]===1?(o.push({description:`Value 1 at mid ${t} is already in the middle partition.`,event:"compare",values:[...e],highlights:[t],pointers:{low:s,mid:t,high:r},codeLine:6}),t+=1):([e[t],e[r]]=[e[r],e[t]],o.push({description:`Swap 2 at mid ${t} with high ${r}.`,event:"swap",values:[...e],highlights:[t,r],pointers:{low:s,mid:t,high:r},codeLine:8}),r-=1);return[...o,{description:"Colors are sorted: all 0s, then 1s, then 2s.",event:"complete",values:[...e],codeLine:9}]}function Q(a){const[n,e]=a.split(";"),o=x(n??""),s=Math.max(1,Number(e)||3),t=new Map,r=[];o.forEach((d,u)=>{t.set(d,(t.get(d)??0)+1),r.push({description:`Count ${d}: frequency is now ${t.get(d)}.`,event:"visit",values:o,highlights:[u],meta:[...t.entries()].map(([p,g])=>`${p}:${g}`),codeLine:3})});const l=[...t.entries()].sort((d,u)=>u[1]-d[1]).map(([d])=>d);return[...r,{description:`Top ${s} frequent elements: ${l.slice(0,s).join(", ")}.`,event:"complete",values:l,highlights:l.slice(0,s).map((d,u)=>u),meta:[...t.entries()].map(([d,u])=>`${d}:${u}`),codeLine:5}]}function H(a){const n=x(a),e=[],o=[],s=[];for(n.forEach(t=>{e.push(t),s.push({description:`Enqueue ${t}: push onto input stack.`,event:"push",stacks:{input:[...e],output:[...o]},codeLine:1})});e.length>0;){const t=e.pop();o.push(t),s.push({description:`Move ${t} from input to output stack to expose queue front.`,event:"pop",stacks:{input:[...e],output:[...o]},codeLine:6})}for(;o.length>0;){const t=o.pop();s.push({description:`Dequeue ${t} from output stack.`,event:"dequeue",stacks:{input:[...e],output:[...o]},codeLine:7})}return s}function X(a){const n=x(a);let e=[],o=[];const s=[];for(n.forEach(t=>{for(o.push(t),s.push({description:`Push ${t}: enqueue into helper queue.`,event:"enqueue",queues:{primary:[...e],helper:[...o]},codeLine:1});e.length>0;)o.push(e.shift());[e,o]=[o,[]],s.push({description:`Rotate queues so ${t} becomes the next pop.`,event:"visit",queues:{primary:[...e],helper:[...o]},codeLine:4})});e.length>0;){const t=e.shift();s.push({description:`Pop ${t} from primary queue front.`,event:"dequeue",queues:{primary:[...e],helper:[...o]},codeLine:7})}return s}function J(a){const n=Math.max(2,Math.min(5,Number(a)||4)),e=[Array.from({length:n},(t,r)=>n-r),[],[]],o=[{description:`Start with ${n} disks on peg 1.`,event:"recurse",pegs:v(e),codeLine:0}],s=(t,r,l,d)=>{if(t===0)return;o.push({description:`Solve subproblem: move ${t-1} disk(s) from peg ${r+1} to peg ${d+1}.`,event:"recurse",pegs:v(e),codeLine:2}),s(t-1,r,d,l);const u=e[r].pop();u&&e[l].push(u),o.push({description:`Move disk ${u} from peg ${r+1} to peg ${l+1}.`,event:"visit",pegs:v(e),codeLine:3}),s(t-1,d,l,r)};return s(n,0,2,1),[...o,{description:"Tower complete.",event:"complete",pegs:v(e),codeLine:4}]}function v(a){return a.map(n=>[...n])}const W=[[0,0,0,1,0,0,0],[1,1,0,1,0,1,0],[0,0,0,0,0,1,0],[0,1,1,1,0,0,0],[0,0,0,1,1,1,0],[0,1,0,0,0,0,0]];function k(a,n){const e=a.trim().toLowerCase()==="dfs"?"dfs":"bfs",o=W.map(h=>[...h]),s=o[0].length,t=o.length*s-1,r=new Set,l=new Map,d=[],u=[0];for(r.add(0);u.length>0;){const h=e==="dfs"?u.pop():u.shift();if(d.push({description:`${n?"Rat maze":"Grid search"} ${e.toUpperCase()}: visit cell (${Math.floor(h/s)}, ${h%s}).`,event:e==="dfs"?"recurse":"visit",grid:o,visited:[...r],path:[h],codeLine:3}),h===t)break;for(const m of Y(h,o))r.has(m)||(r.add(m),l.set(m,h),u.push(m),d.push({description:`Add allowed neighbor (${Math.floor(m/s)}, ${m%s}) to ${e==="dfs"?"stack":"queue"}.`,event:e==="dfs"?"push":"enqueue",grid:o,visited:[...r],path:[m],codeLine:8}))}const p=[];let g=t;for(;g!==void 0&&(g===0||l.has(g))&&(p.unshift(g),g!==0);)g=l.get(g);return[...d,{description:p[0]===0?`Found path with ${p.length} cells.`:"No path found.",event:p[0]===0?"found":"not-found",grid:o,visited:[...r],path:p,codeLine:9}]}function Y(a,n){const e=n[0].length,o=Math.floor(a/e),s=a%e;return[[o-1,s],[o+1,s],[o,s-1],[o,s+1]].filter(([t,r])=>t>=0&&r>=0&&tt*e+r)}function Z(a){const n=Array.from({length:9},()=>Math.floor(Math.random()*40)+1);switch(a){case"binary-search":case"ternary-search":{const e=[...n].sort((t,r)=>t-r),o=Math.floor(e.length/2);let s=Math.floor(Math.random()*e.length);return a==="binary-search"&&e.length>1&&s===o&&(s=(s+1)%e.length),`${e.join(",")};${e[s]}`}case"dutch-national-flag":return Array.from({length:10},()=>Math.floor(Math.random()*3)).join(",");case"top-k-frequent":return`${Array.from({length:12},()=>Math.floor(Math.random()*5)+1).join(",")};3`;case"tower-of-hanoi":return String(Math.floor(Math.random()*3)+3);case"rat-maze":return Math.random()>.5?"dfs":"bfs";case"grid-search":return Math.random()>.5?"dfs":"bfs";default:return n.slice(0,4).join(",")}}export{le as default}; diff --git a/docs/assets/ArrayPage-DrT8Biad.js b/docs/assets/ArrayPage-BRkafP6e.js similarity index 97% rename from docs/assets/ArrayPage-DrT8Biad.js rename to docs/assets/ArrayPage-BRkafP6e.js index efd3d5e..60b4934 100644 --- a/docs/assets/ArrayPage-DrT8Biad.js +++ b/docs/assets/ArrayPage-BRkafP6e.js @@ -1,4 +1,4 @@ -import{c as te,r as a,j as e,e as se}from"./index-lLadk08S.js";import{u as le}from"./useDSSound-CPhif-bj.js";import{P as F}from"./plus-NICMDkhr.js";import{T as ae}from"./trash-2-veeiSg5V.js";import{R as ne}from"./rotate-ccw-DMjSdzg2.js";import{S as re}from"./shuffle-ADbBlETg.js";import{V as ie,a as oe}from"./volume-x-CjLNPeax.js";import{C as ce,a as de}from"./chevron-right-Cp_zyb7b.js";import"./audioContext-NbgqvQGz.js";const he=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],xe=te("mouse-pointer",he);let O=1;const ue=[4,2,7,1,9,3,6].map(h=>({id:O++,value:h}));function ge(){const[h,x]=a.useState(ue),[r,g]=a.useState([]),[i,c]=a.useState(-1),[p,k]=a.useState(""),[R,T]=a.useState(""),[D,z]=a.useState([]),[f,E]=a.useState(400),[S,N]=a.useState(!1),m=a.useRef(null),I=a.useRef(f),b=a.useRef(!1),{soundEnabled:L,toggleSound:_,playInsert:v,playDelete:w,playAccess:j,playTraverse:A,playFound:C,playNotFound:P}=le(),V=a.useRef(()=>{});a.useEffect(()=>{I.current=f},[f]),a.useEffect(()=>{if(!b.current||r.length===0)return;b.current=!1,m.current&&clearTimeout(m.current),N(!0);let t=0;const s=()=>{if(t>=r.length-1){N(!1);return}t++,c(t),V.current(t,r),m.current=setTimeout(s,I.current)};m.current=setTimeout(s,I.current)},[r]);const y=a.useCallback((t,s)=>{const n=s[t];n&&(n.highlightColor==="green"?C():n.highlightColor==="red"?w():n.highlightColor==="blue"?j():(n.highlightColor==="yellow"||n.highlightColor==="orange")&&A(t,s.length))},[C,w,j,A]);a.useEffect(()=>{V.current=y},[y]);const W=i>=0&&r[i]?r[i].array:h,l=i>=0?r[i]:null,u=t=>z(s=>[t,...s].slice(0,20)),G=a.useCallback(t=>{x(s=>{if(t<0||t>=s.length)return s;const n=[{description:`Access index ${t}: going to position ${t}...`,array:s,highlightIndices:[],highlightColor:null},{description:`Found value ${s[t].value} at index ${t}.`,array:s,highlightIndices:[t],highlightColor:"blue"}];return g(n),c(0),b.current=!0,j(),u(`Access [${t}] → ${s[t].value}`),s})},[j]),H=a.useCallback((t,s)=>{const n={id:O++,value:t};x(d=>{if(s<0||s>d.length)return d;const o=[];o.push({description:`Insert ${t} at index ${s}: shifting elements right from index ${s}...`,array:d,highlightIndices:Array.from({length:d.length-s},(M,ee)=>s+ee),highlightColor:"orange"});const $=[...d.slice(0,s),n,...d.slice(s)];return o.push({description:`${t} inserted at index ${s}. Array size: ${$.length}`,array:$,highlightIndices:[s],highlightColor:"green"}),g(o),c(0),b.current=!0,v(),u(`Insert ${t} at [${s}]`),$})},[v]),X=a.useCallback(t=>{x(s=>{if(t<0||t>=s.length)return s;const n=s[t].value,d=[{description:`Delete at index ${t}: marking element ${n} for removal...`,array:s,highlightIndices:[t],highlightColor:"red"},{description:"Shifting elements left to fill the gap...",array:s,highlightIndices:Array.from({length:s.length-t-1},($,M)=>t+1+M),highlightColor:"orange"}],o=s.filter(($,M)=>M!==t);return d.push({description:`${n} deleted. Array size: ${o.length}`,array:o,highlightIndices:[],highlightColor:null}),g(d),c(0),b.current=!0,w(),u(`Delete [${t}] → ${n}`),o})},[w]),q=a.useCallback(t=>{x(s=>{const n=[];let d=-1;for(let o=0;o{const s={id:O++,value:t};x(n=>{const d=[...n,s],o=[{description:`Appending ${t} to the end of the array...`,array:n,highlightIndices:[],highlightColor:null},{description:`${t} added at index ${n.length}. Array size: ${d.length}`,array:d,highlightIndices:[d.length-1],highlightColor:"green"}];return g(o),c(0),b.current=!0,v(),u(`Push ${t}`),d})},[v]),J=a.useCallback(()=>{x([]),g([]),c(-1),u("Clear array")},[]),K=a.useCallback(()=>{const t=Math.floor(Math.random()*5)+5,s=Array.from({length:t},()=>({id:O++,value:Math.floor(Math.random()*90)+1}));x(s),g([]),c(-1),u("Random array")},[]),Q=a.useCallback(()=>{c(t=>{const s=Math.min(t+1,r.length-1);return y(s,r),s})},[r,y]),U=a.useCallback(()=>{c(t=>Math.max(t-1,0))},[]),Z=a.useCallback(()=>{if(S){N(!1),m.current&&clearTimeout(m.current);return}if(i>=r.length-1)return;N(!0);let t=i;const s=()=>{if(t>=r.length-1){N(!1);return}t++,c(t),y(t,r),m.current=setTimeout(s,f)};m.current=setTimeout(s,f)},[S,i,r,f,y]);return{array:h,displayArray:W,steps:r,stepIndex:i,currentStep:l,inputValue:p,setInputValue:k,indexValue:R,setIndexValue:T,history:D,speed:f,setSpeed:E,isPlaying:S,access:G,insertAt:H,deleteAt:X,search:q,pushBack:Y,clear:J,generateRandom:K,nextStep:Q,prevStep:U,autoPlay:Z,soundEnabled:L,toggleSound:_,canGoNext:i0}}const me={green:"border-emerald-400 bg-emerald-500/20 text-emerald-300",red:"border-rose-400 bg-rose-500/20 text-rose-300",yellow:"border-amber-400 bg-amber-500/20 text-amber-300",blue:"border-blue-400 bg-blue-500/20 text-blue-300",orange:"border-orange-400 bg-orange-500/20 text-orange-300"},B=12;function pe({array:h,currentStep:x}){const r=h.slice(0,B),g=new Set(x?.highlightIndices??[]),i=x?.highlightColor??null;return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[300px] gap-6 px-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[h.length===0?e.jsx("div",{className:"flex items-center justify-center w-48 h-16 border-2 border-dashed border-slate-700 rounded-lg text-slate-600 text-xs",children:"Empty Array"}):e.jsxs("div",{className:"flex flex-wrap justify-center gap-1.5",children:[r.map((c,p)=>{const k=g.has(p);return e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:` +import{c as te,r as a,j as e,e as se}from"./index-CB1-0H6I.js";import{u as le}from"./useDSSound-BJYLYD0f.js";import{P as F}from"./plus-B3nnW8Th.js";import{T as ae}from"./trash-2-C4vvSjjZ.js";import{R as ne}from"./rotate-ccw-CDlWXRsI.js";import{S as re}from"./shuffle-DZnyoAGL.js";import{V as ie,a as oe}from"./volume-x-CKT6TOtL.js";import{C as ce,a as de}from"./chevron-right-ChVmoNtO.js";import"./audioContext-NbgqvQGz.js";const he=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],xe=te("mouse-pointer",he);let O=1;const ue=[4,2,7,1,9,3,6].map(h=>({id:O++,value:h}));function ge(){const[h,x]=a.useState(ue),[r,g]=a.useState([]),[i,c]=a.useState(-1),[p,k]=a.useState(""),[R,T]=a.useState(""),[D,z]=a.useState([]),[f,E]=a.useState(400),[S,N]=a.useState(!1),m=a.useRef(null),I=a.useRef(f),b=a.useRef(!1),{soundEnabled:L,toggleSound:_,playInsert:v,playDelete:w,playAccess:j,playTraverse:A,playFound:C,playNotFound:P}=le(),V=a.useRef(()=>{});a.useEffect(()=>{I.current=f},[f]),a.useEffect(()=>{if(!b.current||r.length===0)return;b.current=!1,m.current&&clearTimeout(m.current),N(!0);let t=0;const s=()=>{if(t>=r.length-1){N(!1);return}t++,c(t),V.current(t,r),m.current=setTimeout(s,I.current)};m.current=setTimeout(s,I.current)},[r]);const y=a.useCallback((t,s)=>{const n=s[t];n&&(n.highlightColor==="green"?C():n.highlightColor==="red"?w():n.highlightColor==="blue"?j():(n.highlightColor==="yellow"||n.highlightColor==="orange")&&A(t,s.length))},[C,w,j,A]);a.useEffect(()=>{V.current=y},[y]);const W=i>=0&&r[i]?r[i].array:h,l=i>=0?r[i]:null,u=t=>z(s=>[t,...s].slice(0,20)),G=a.useCallback(t=>{x(s=>{if(t<0||t>=s.length)return s;const n=[{description:`Access index ${t}: going to position ${t}...`,array:s,highlightIndices:[],highlightColor:null},{description:`Found value ${s[t].value} at index ${t}.`,array:s,highlightIndices:[t],highlightColor:"blue"}];return g(n),c(0),b.current=!0,j(),u(`Access [${t}] → ${s[t].value}`),s})},[j]),H=a.useCallback((t,s)=>{const n={id:O++,value:t};x(d=>{if(s<0||s>d.length)return d;const o=[];o.push({description:`Insert ${t} at index ${s}: shifting elements right from index ${s}...`,array:d,highlightIndices:Array.from({length:d.length-s},(M,ee)=>s+ee),highlightColor:"orange"});const $=[...d.slice(0,s),n,...d.slice(s)];return o.push({description:`${t} inserted at index ${s}. Array size: ${$.length}`,array:$,highlightIndices:[s],highlightColor:"green"}),g(o),c(0),b.current=!0,v(),u(`Insert ${t} at [${s}]`),$})},[v]),X=a.useCallback(t=>{x(s=>{if(t<0||t>=s.length)return s;const n=s[t].value,d=[{description:`Delete at index ${t}: marking element ${n} for removal...`,array:s,highlightIndices:[t],highlightColor:"red"},{description:"Shifting elements left to fill the gap...",array:s,highlightIndices:Array.from({length:s.length-t-1},($,M)=>t+1+M),highlightColor:"orange"}],o=s.filter(($,M)=>M!==t);return d.push({description:`${n} deleted. Array size: ${o.length}`,array:o,highlightIndices:[],highlightColor:null}),g(d),c(0),b.current=!0,w(),u(`Delete [${t}] → ${n}`),o})},[w]),q=a.useCallback(t=>{x(s=>{const n=[];let d=-1;for(let o=0;o{const s={id:O++,value:t};x(n=>{const d=[...n,s],o=[{description:`Appending ${t} to the end of the array...`,array:n,highlightIndices:[],highlightColor:null},{description:`${t} added at index ${n.length}. Array size: ${d.length}`,array:d,highlightIndices:[d.length-1],highlightColor:"green"}];return g(o),c(0),b.current=!0,v(),u(`Push ${t}`),d})},[v]),J=a.useCallback(()=>{x([]),g([]),c(-1),u("Clear array")},[]),K=a.useCallback(()=>{const t=Math.floor(Math.random()*5)+5,s=Array.from({length:t},()=>({id:O++,value:Math.floor(Math.random()*90)+1}));x(s),g([]),c(-1),u("Random array")},[]),Q=a.useCallback(()=>{c(t=>{const s=Math.min(t+1,r.length-1);return y(s,r),s})},[r,y]),U=a.useCallback(()=>{c(t=>Math.max(t-1,0))},[]),Z=a.useCallback(()=>{if(S){N(!1),m.current&&clearTimeout(m.current);return}if(i>=r.length-1)return;N(!0);let t=i;const s=()=>{if(t>=r.length-1){N(!1);return}t++,c(t),y(t,r),m.current=setTimeout(s,f)};m.current=setTimeout(s,f)},[S,i,r,f,y]);return{array:h,displayArray:W,steps:r,stepIndex:i,currentStep:l,inputValue:p,setInputValue:k,indexValue:R,setIndexValue:T,history:D,speed:f,setSpeed:E,isPlaying:S,access:G,insertAt:H,deleteAt:X,search:q,pushBack:Y,clear:J,generateRandom:K,nextStep:Q,prevStep:U,autoPlay:Z,soundEnabled:L,toggleSound:_,canGoNext:i0}}const me={green:"border-emerald-400 bg-emerald-500/20 text-emerald-300",red:"border-rose-400 bg-rose-500/20 text-rose-300",yellow:"border-amber-400 bg-amber-500/20 text-amber-300",blue:"border-blue-400 bg-blue-500/20 text-blue-300",orange:"border-orange-400 bg-orange-500/20 text-orange-300"},B=12;function pe({array:h,currentStep:x}){const r=h.slice(0,B),g=new Set(x?.highlightIndices??[]),i=x?.highlightColor??null;return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[300px] gap-6 px-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[h.length===0?e.jsx("div",{className:"flex items-center justify-center w-48 h-16 border-2 border-dashed border-slate-700 rounded-lg text-slate-600 text-xs",children:"Empty Array"}):e.jsxs("div",{className:"flex flex-wrap justify-center gap-1.5",children:[r.map((c,p)=>{const k=g.has(p);return e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:` flex items-center justify-center rounded-lg border-2 w-12 h-12 md:w-14 md:h-14 font-bold text-sm md:text-base transition-all duration-300 ${k&&i?me[i]:"border-slate-600 bg-slate-800/60 text-slate-200"} diff --git a/docs/assets/BalancedTreePage-C8htDNti.js b/docs/assets/BalancedTreePage-coFjRyUc.js similarity index 99% rename from docs/assets/BalancedTreePage-C8htDNti.js rename to docs/assets/BalancedTreePage-coFjRyUc.js index 69f0bc9..bf89fd2 100644 --- a/docs/assets/BalancedTreePage-C8htDNti.js +++ b/docs/assets/BalancedTreePage-coFjRyUc.js @@ -1,4 +1,4 @@ -import{c as jt,r as p,j as a}from"./index-lLadk08S.js";import{P as Nt}from"./plus-NICMDkhr.js";import{S as wt}from"./shuffle-ADbBlETg.js";import{C as $t,a as yt}from"./chevron-right-Cp_zyb7b.js";const kt=[["path",{d:"M5 12h14",key:"1ays0h"}]],It=jt("minus",kt);function K(t){return t?[t,...K(t.left),...K(t.right)]:[]}function X(t){if(!t)return[];const e=[];return t.left&&(e.push({from:t,to:t.left}),e.push(...X(t.left))),t.right&&(e.push({from:t,to:t.right}),e.push(...X(t.right))),e}function Rt({root:t,treeType:e,highlightIds:r}){const s=p.useMemo(()=>K(t),[t]),n=p.useMemo(()=>X(t),[t]);if(!t)return a.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500",children:"No tree — insert a value to begin"});const l=Math.min(...s.map(u=>u.x),0)-40,i=Math.max(...s.map(u=>u.x),0)+40,c=Math.max(...s.map(u=>u.y),0)+40,h=i-l+80,m=c+80;return a.jsx("div",{className:"flex-1 w-full rounded-xl border border-slate-700/50 bg-slate-950/80 p-4 shadow-2xl backdrop-blur-sm overflow-auto",children:a.jsxs("svg",{viewBox:`${l-40} -20 ${h} ${m}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[n.map((u,g)=>a.jsx("line",{x1:u.from.x,y1:u.from.y,x2:u.to.x,y2:u.to.y,stroke:"#475569",strokeWidth:2,strokeOpacity:.5},g)),s.map(u=>{const g=r.includes(u.id),b=e==="rbtree";let N="#1e293b",w="#475569",v="#e2e8f0";return b?u.color==="red"?(N=g?"#f87171":"#dc2626",w="#fca5a5",v="#ffffff"):(N=g?"#475569":"#1e293b",w=g?"#94a3b8":"#64748b",v="#e2e8f0"):g&&(N="#fbbf24",w="#f59e0b",v="#1e293b"),a.jsxs("g",{children:[a.jsx("circle",{cx:u.x,cy:u.y,r:22,fill:N,stroke:w,strokeWidth:g?3:2,className:"transition-all duration-200"}),a.jsx("text",{x:u.x,y:u.y+1,textAnchor:"middle",dominantBaseline:"central",fill:v,fontSize:12,fontWeight:600,fontFamily:"ui-monospace, monospace",children:u.value}),e==="avl"&&a.jsxs("text",{x:u.x+20,y:u.y-18,textAnchor:"middle",dominantBaseline:"central",fill:"#94a3b8",fontSize:9,fontFamily:"ui-monospace, monospace",children:["h",u.height]})]},u.id)})]})})}const St={bst:{name:"Binary Search Tree",description:"A binary tree where left child < parent < right child. No self-balancing — can degenerate to a linked list.",properties:["Unbalanced","O(h) operations","Simple"]},avl:{name:"AVL Tree",description:"A self-balancing BST where the heights of left and right subtrees differ by at most 1. Uses rotations to maintain balance.",properties:["Height-balanced","O(log n)","Rotations"]},rbtree:{name:"Red-Black Tree",description:"A self-balancing BST using node coloring (red/black) and rules to ensure the tree stays approximately balanced.",properties:["Color-balanced","O(log n)","Recoloring"]}},Ct=[{label:"Slow",value:600},{label:"Medium",value:300},{label:"Fast",value:100}],Tt=["bst","avl","rbtree"];function Vt({treeType:t,changeTreeType:e,inputValue:r,setInputValue:s,description:n,stepIndex:l,totalSteps:i,canGoNext:c,canGoPrev:h,history:m,speed:u,setSpeed:g,isPlaying:b,onInsert:N,onDelete:w,onNextStep:v,onPrevStep:j,onGenerateRandom:F}){const I=St[t],R=()=>{const o=parseInt(r);!isNaN(o)&&o>0&&(N(o),s(""))},G=()=>{const o=parseInt(r);!isNaN(o)&&o>0&&(w(o),s(""))},W=o=>{o.key==="Enter"&&R()};return a.jsxs("div",{className:"flex flex-col gap-5 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[a.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Tree Type"}),a.jsx("div",{className:"flex gap-2",children:Tt.map(o=>a.jsx("button",{onClick:()=>e(o),className:` +import{c as jt,r as p,j as a}from"./index-CB1-0H6I.js";import{P as Nt}from"./plus-B3nnW8Th.js";import{S as wt}from"./shuffle-DZnyoAGL.js";import{C as $t,a as yt}from"./chevron-right-ChVmoNtO.js";const kt=[["path",{d:"M5 12h14",key:"1ays0h"}]],It=jt("minus",kt);function K(t){return t?[t,...K(t.left),...K(t.right)]:[]}function X(t){if(!t)return[];const e=[];return t.left&&(e.push({from:t,to:t.left}),e.push(...X(t.left))),t.right&&(e.push({from:t,to:t.right}),e.push(...X(t.right))),e}function Rt({root:t,treeType:e,highlightIds:r}){const s=p.useMemo(()=>K(t),[t]),n=p.useMemo(()=>X(t),[t]);if(!t)return a.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500",children:"No tree — insert a value to begin"});const l=Math.min(...s.map(u=>u.x),0)-40,i=Math.max(...s.map(u=>u.x),0)+40,c=Math.max(...s.map(u=>u.y),0)+40,h=i-l+80,m=c+80;return a.jsx("div",{className:"flex-1 w-full rounded-xl border border-slate-700/50 bg-slate-950/80 p-4 shadow-2xl backdrop-blur-sm overflow-auto",children:a.jsxs("svg",{viewBox:`${l-40} -20 ${h} ${m}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[n.map((u,g)=>a.jsx("line",{x1:u.from.x,y1:u.from.y,x2:u.to.x,y2:u.to.y,stroke:"#475569",strokeWidth:2,strokeOpacity:.5},g)),s.map(u=>{const g=r.includes(u.id),b=e==="rbtree";let N="#1e293b",w="#475569",v="#e2e8f0";return b?u.color==="red"?(N=g?"#f87171":"#dc2626",w="#fca5a5",v="#ffffff"):(N=g?"#475569":"#1e293b",w=g?"#94a3b8":"#64748b",v="#e2e8f0"):g&&(N="#fbbf24",w="#f59e0b",v="#1e293b"),a.jsxs("g",{children:[a.jsx("circle",{cx:u.x,cy:u.y,r:22,fill:N,stroke:w,strokeWidth:g?3:2,className:"transition-all duration-200"}),a.jsx("text",{x:u.x,y:u.y+1,textAnchor:"middle",dominantBaseline:"central",fill:v,fontSize:12,fontWeight:600,fontFamily:"ui-monospace, monospace",children:u.value}),e==="avl"&&a.jsxs("text",{x:u.x+20,y:u.y-18,textAnchor:"middle",dominantBaseline:"central",fill:"#94a3b8",fontSize:9,fontFamily:"ui-monospace, monospace",children:["h",u.height]})]},u.id)})]})})}const St={bst:{name:"Binary Search Tree",description:"A binary tree where left child < parent < right child. No self-balancing — can degenerate to a linked list.",properties:["Unbalanced","O(h) operations","Simple"]},avl:{name:"AVL Tree",description:"A self-balancing BST where the heights of left and right subtrees differ by at most 1. Uses rotations to maintain balance.",properties:["Height-balanced","O(log n)","Rotations"]},rbtree:{name:"Red-Black Tree",description:"A self-balancing BST using node coloring (red/black) and rules to ensure the tree stays approximately balanced.",properties:["Color-balanced","O(log n)","Recoloring"]}},Ct=[{label:"Slow",value:600},{label:"Medium",value:300},{label:"Fast",value:100}],Tt=["bst","avl","rbtree"];function Vt({treeType:t,changeTreeType:e,inputValue:r,setInputValue:s,description:n,stepIndex:l,totalSteps:i,canGoNext:c,canGoPrev:h,history:m,speed:u,setSpeed:g,isPlaying:b,onInsert:N,onDelete:w,onNextStep:v,onPrevStep:j,onGenerateRandom:F}){const I=St[t],R=()=>{const o=parseInt(r);!isNaN(o)&&o>0&&(N(o),s(""))},G=()=>{const o=parseInt(r);!isNaN(o)&&o>0&&(w(o),s(""))},W=o=>{o.key==="Enter"&&R()};return a.jsxs("div",{className:"flex flex-col gap-5 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[a.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Tree Type"}),a.jsx("div",{className:"flex gap-2",children:Tt.map(o=>a.jsx("button",{onClick:()=>e(o),className:` flex-1 rounded-lg px-2 py-2 text-xs font-medium transition-all duration-200 ${t===o?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40 shadow-lg shadow-indigo-500/10":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50 hover:text-slate-300"} `,children:o==="rbtree"?"RB Tree":o.toUpperCase()},o))}),a.jsxs("div",{className:"mt-3 rounded-lg bg-slate-800/40 p-3",children:[a.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:I.description}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:I.properties.map(o=>a.jsx("span",{className:"inline-flex items-center rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-400 ring-1 ring-violet-500/20",children:o},o))})]})]}),a.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Speed"}),a.jsx("div",{className:"flex gap-1",children:Ct.map(o=>a.jsx("button",{onClick:()=>g(o.value),className:` diff --git a/docs/assets/BattlePage-BfxUg7Va.js b/docs/assets/BattlePage-DY6YXR_B.js similarity index 99% rename from docs/assets/BattlePage-BfxUg7Va.js rename to docs/assets/BattlePage-DY6YXR_B.js index c0d4e17..ab372b4 100644 --- a/docs/assets/BattlePage-BfxUg7Va.js +++ b/docs/assets/BattlePage-DY6YXR_B.js @@ -1 +1 @@ -import{c as He,j as e,f as Le,r as u,g as Ve}from"./index-lLadk08S.js";import{V as ge,a as fe}from"./volume-x-CjLNPeax.js";import{S as Ge}from"./shuffle-ADbBlETg.js";import{P as be}from"./play-b2ZiatJ3.js";import{T as je}from"./trophy-BeLgwZ5q.js";import{R as xe}from"./rotate-ccw-DMjSdzg2.js";import{P as ve}from"./pause-CU46RSeo.js";import{N as D,r as _e}from"./index-Cj8HB9AY.js";import{r as Me}from"./index-iw_6MvvU.js";import{g as qe}from"./audioContext-NbgqvQGz.js";import{A as Ye}from"./arrow-left-C4-GmPRq.js";import{M as Ee}from"./map-C5ZomysO.js";const Xe=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Ke=He("chart-column",Xe);const Qe=[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]],ye=He("equal",Qe),X=[{value:"bubble",label:"Bubble Sort"},{value:"selection",label:"Selection Sort"},{value:"insertion",label:"Insertion Sort"},{value:"quick",label:"Quick Sort"},{value:"heap",label:"Heap Sort"},{value:"merge",label:"Merge Sort"}],ze={bubble:{best:"O(n)",average:"O(n²)",worst:"O(n²)",space:"O(1)"},selection:{best:"O(n²)",average:"O(n²)",worst:"O(n²)",space:"O(1)"},insertion:{best:"O(n)",average:"O(n²)",worst:"O(n²)",space:"O(1)"},quick:{best:"O(n log n)",average:"O(n log n)",worst:"O(n²)",space:"O(log n)"},heap:{best:"O(n log n)",average:"O(n log n)",worst:"O(n log n)",space:"O(1)"},merge:{best:"O(n log n)",average:"O(n log n)",worst:"O(n log n)",space:"O(n)"}},me=[{label:"Slow",value:150},{label:"Medium",value:50},{label:"Fast",value:15},{label:"Turbo",value:1}];function Ue(t,a){const s=[];for(let l=0;ln-c);const l=Math.max(1,Math.floor(t*.05));for(let n=0;nn-l);return s}function Ze(t,a,s,l,n,c){const i=X.find(f=>f.value===a).label,o=X.find(f=>f.value===s).label;if(t==="tie")return`Both ${i} and ${o} completed in the same number of operations. This can happen with small inputs or similar-complexity algorithms.`;const r=t==="A"?i:o,d=t==="A"?o:i,m=t==="A"?l:n,x=t==="A"?n:l,g=(x.totalSteps/Math.max(m.totalSteps,1)).toFixed(1);let p=`${r} won with ${m.totalSteps} steps vs ${x.totalSteps} steps (${g}x fewer operations). `;return c==="nearly-sorted"?p+="On nearly-sorted data, algorithms like Insertion Sort have a natural advantage due to their O(n) best-case performance.":c==="reversed"?p+="Reversed input is the worst case for O(n²) algorithms, making the performance gap with O(n log n) algorithms very visible.":p+=`${d} performed more operations because its average-case complexity is higher for this input distribution.`,p}const Je=[{value:"random",label:"Random"},{value:"nearly-sorted",label:"Nearly Sorted"},{value:"reversed",label:"Reversed"}],et=[{value:"realtime",label:"Real-Time",desc:"Watch both algorithms animate step-by-step"},{value:"turbo",label:"Turbo",desc:"Instant execution, metrics only"},{value:"prediction",label:"Prediction",desc:"Predict the winner before starting"}];function tt({algorithmA:t,algorithmB:a,inputSize:s,inputType:l,gameMode:n,speed:c,soundEnabled:i,prediction:o,onSetAlgorithmA:r,onSetAlgorithmB:d,onSetInputSize:m,onSetInputType:x,onSetGameMode:g,onSetSpeed:p,onToggleSound:f,onSetPrediction:y,onStart:C}){const w=X.find(h=>h.value===t).label,S=X.find(h=>h.value===a).label;return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center justify-center px-6 pt-8 pb-4 text-center",children:[e.jsxs("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full bg-rose-500/10 px-4 py-1.5 ring-1 ring-rose-500/20",children:[e.jsx(Le,{size:14,className:"text-rose-400"}),e.jsx("span",{className:"text-xs font-medium text-rose-300",children:"Algorithm Battles"})]}),e.jsxs("h2",{className:"text-2xl font-extrabold tracking-tight text-white",children:[e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-orange-400 bg-clip-text text-transparent",children:w})," ","vs"," ",e.jsx("span",{className:"bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent",children:S})]})]}),e.jsx("section",{className:"px-4 pb-8",children:e.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-rose-400 mb-3",children:"Algorithm A"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:X.map(h=>e.jsx("button",{onClick:()=>r(h.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${t===h.value?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-400 mb-3",children:"Algorithm B"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:X.map(h=>e.jsx("button",{onClick:()=>d(h.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${a===h.value?"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Input Configuration"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Array Size"}),e.jsx("span",{className:"text-sm font-mono font-bold text-indigo-300",children:s})]}),e.jsx("input",{type:"range",min:10,max:200,step:10,value:s,onChange:h=>m(Number(h.target.value)),className:"w-full accent-indigo-500"})]}),e.jsx("div",{className:"flex gap-1.5",children:Je.map(h=>e.jsx("button",{onClick:()=>x(h.value),className:`flex-1 rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${l===h.value?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Game Mode"}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:et.map(h=>e.jsxs("button",{onClick:()=>g(h.value),className:`flex flex-col items-center rounded-lg px-2 py-2.5 text-[11px] font-medium transition-all ${n===h.value?"bg-violet-500/20 text-violet-300 ring-1 ring-violet-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:[e.jsx("span",{className:"font-semibold",children:h.label}),e.jsx("span",{className:"text-[9px] text-slate-500 mt-0.5 hidden sm:block",children:h.desc})]},h.value))})]}),n==="prediction"&&e.jsxs("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400 mb-3",children:"Your Prediction"}),e.jsx("p",{className:"text-[10px] text-amber-300/60 mb-3",children:"Who will win with fewer operations?"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>y("A"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${o==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:w}),e.jsx("button",{onClick:()=>y("B"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${o==="B"?"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:S})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1 rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Speed"}),e.jsx("div",{className:"flex gap-1.5",children:me.map(h=>e.jsx("button",{onClick:()=>p(h.value),className:`flex-1 rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${c===h.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]}),e.jsxs("button",{onClick:()=>f(!i),className:`shrink-0 flex flex-col items-center justify-center rounded-xl px-4 transition-all ${i?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-1 ring-slate-700/40"}`,children:[i?e.jsx(ge,{size:18}):e.jsx(fe,{size:18}),e.jsx("span",{className:"text-[10px] mt-1",children:i?"On":"Off"})]})]}),e.jsxs("button",{onClick:C,disabled:n==="prediction"&&!o,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-rose-500/20 to-cyan-500/20 px-6 py-4 text-base font-bold text-white ring-1 ring-white/10 transition-all hover:from-rose-500/30 hover:to-cyan-500/30 hover:ring-white/20 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ge,{size:18,className:"text-rose-300"}),e.jsx(be,{size:18,className:"text-cyan-300"}),"Start Battle"]})]})})]})}function ke({state:t,color:a,maxVal:s}){const l=X.find(x=>x.value===t.algorithm).label,n=t.status==="finished",c=t.array.length,o={rose:{default:"bg-rose-500/60",comparing:"bg-amber-400",swapping:"bg-rose-300",sorted:"bg-emerald-500/70",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50",label:"text-rose-400",badge:"bg-rose-500/15 text-rose-300 ring-rose-500/30"},cyan:{default:"bg-cyan-500/60",comparing:"bg-amber-400",swapping:"bg-cyan-300",sorted:"bg-emerald-500/70",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50",label:"text-cyan-400",badge:"bg-cyan-500/15 text-cyan-300 ring-cyan-500/30"}}[a],r=new Set(t.comparing||[]),d=new Set(t.swapping||[]),m=new Set(t.sorted);return e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsx("span",{className:`text-xs font-bold ${o.label}`,children:l}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ${o.badge}`,children:n?"Finished":"Running"})]}),e.jsx("div",{className:`rounded-xl border border-slate-700/50 bg-slate-950/80 p-2 ${o.border} transition-all overflow-hidden`,children:e.jsx("div",{className:"flex items-end gap-px h-32 sm:h-44 md:h-52",children:t.array.map((x,g)=>{const p=x/s*100;let f=o.default;return r.has(g)?f=o.comparing:d.has(g)?f=o.swapping:m.has(g)&&(f=o.sorted),e.jsx("div",{className:`flex-1 rounded-t-sm transition-all duration-75 ${f}`,style:{height:`${p}%`,minWidth:c>100?"1px":"2px"}},g)})})}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5 px-1",children:[e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Comparisons"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:t.metrics.comparisons})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Swaps"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:t.metrics.swaps})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Steps"}),e.jsxs("div",{className:"text-xs font-mono font-bold text-white",children:[t.metrics.stepsCompleted,"/",t.metrics.totalSteps]})]})]})]})}function st({history:t,nameA:a,nameB:s}){const{pathA:l,pathB:n,maxOps:c,maxTime:i}=u.useMemo(()=>{if(t.length<2)return{pathA:"",pathB:"",maxOps:1,maxTime:1};const o=Math.max(...t.map(g=>Math.max(g.opsA,g.opsB)),1),r=t.length-1,d=400,m=120,x=g=>t.map((p,f)=>{const y=f/r*d,C=m-p[g]/o*m;return`${f===0?"M":"L"}${y.toFixed(1)},${C.toFixed(1)}`}).join(" ");return{pathA:x("opsA"),pathB:x("opsB"),maxOps:o,maxTime:r}},[t]);return t.length<2?null:e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Live Performance"}),e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"h-2 w-4 rounded-full bg-rose-400"}),e.jsx("span",{className:"text-[10px] text-slate-400",children:a})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"h-2 w-4 rounded-full bg-cyan-400"}),e.jsx("span",{className:"text-[10px] text-slate-400",children:s})]}),e.jsxs("span",{className:"ml-auto text-[10px] text-slate-500",children:["Max ops: ",c]})]}),e.jsxs("svg",{viewBox:"0 0 400 120",className:"w-full h-20 sm:h-28",preserveAspectRatio:"none",children:[e.jsx("path",{d:l,fill:"none",stroke:"#fb7185",strokeWidth:2,strokeLinecap:"round"}),e.jsx("path",{d:n,fill:"none",stroke:"#22d3ee",strokeWidth:2,strokeLinecap:"round"})]}),e.jsxs("div",{className:"flex justify-between mt-1",children:[e.jsx("span",{className:"text-[9px] text-slate-600",children:"0"}),e.jsxs("span",{className:"text-[9px] text-slate-600",children:["Steps → ",i]})]})]})}function nt({stateA:t,stateB:a,winner:s,prediction:l,predictionCorrect:n,inputType:c,onReset:i}){const o=X.find(g=>g.value===t.algorithm).label,r=X.find(g=>g.value===a.algorithm).label,d=ze[t.algorithm],m=ze[a.algorithm],x=Ze(s,t.algorithm,a.algorithm,t.metrics,a.metrics,c);return e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm space-y-4",children:[e.jsx("div",{className:"text-center",children:s==="tie"?e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-5 py-2 ring-1 ring-amber-500/20",children:[e.jsx(ye,{size:18,className:"text-amber-400"}),e.jsx("span",{className:"text-sm font-bold text-amber-300",children:"It's a Tie!"})]}):e.jsxs("div",{className:`inline-flex items-center gap-2 rounded-full px-5 py-2 ring-1 ${s==="A"?"bg-rose-500/10 ring-rose-500/20":"bg-cyan-500/10 ring-cyan-500/20"}`,children:[e.jsx(je,{size:18,className:s==="A"?"text-rose-400":"text-cyan-400"}),e.jsxs("span",{className:`text-sm font-bold ${s==="A"?"text-rose-300":"text-cyan-300"}`,children:[s==="A"?o:r," Wins!"]})]})}),l&&n!==null&&e.jsx("div",{className:`rounded-lg px-4 py-2.5 text-center text-xs font-medium ${n?"bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20":"bg-rose-500/10 text-rose-300 ring-1 ring-rose-500/20"}`,children:n?"🎯 Your prediction was correct!":"❌ Your prediction was wrong. Keep learning!"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-700/50",children:[e.jsx("th",{className:"py-2 text-left text-slate-500 font-medium",children:"Metric"}),e.jsx("th",{className:"py-2 text-center text-rose-400 font-semibold",children:o}),e.jsx("th",{className:"py-2 text-center text-cyan-400 font-semibold",children:r})]})}),e.jsx("tbody",{className:"font-mono",children:[{label:"Total Steps",a:t.metrics.totalSteps,b:a.metrics.totalSteps},{label:"Comparisons",a:t.metrics.comparisons,b:a.metrics.comparisons},{label:"Swaps",a:t.metrics.swaps,b:a.metrics.swaps},{label:"Array Accesses",a:t.metrics.arrayAccesses,b:a.metrics.arrayAccesses},{label:"Time (s)",a:t.metrics.timeElapsed.toFixed(2),b:a.metrics.timeElapsed.toFixed(2)}].map(({label:g,a:p,b:f})=>{const y=typeof p=="string"?parseFloat(p):p,C=typeof f=="string"?parseFloat(f):f;return e.jsxs("tr",{className:"border-b border-slate-800/50",children:[e.jsx("td",{className:"py-2 text-slate-400",children:g}),e.jsxs("td",{className:`py-2 text-center font-semibold ${y<=C?"text-emerald-300":"text-white"}`,children:[p,ye.jsxs("div",{className:"rounded-lg bg-slate-800/40 p-3",children:[e.jsx("h4",{className:`text-[10px] font-bold uppercase tracking-wider ${f==="rose"?"text-rose-400":"text-cyan-400"} mb-2`,children:g}),e.jsxs("div",{className:"space-y-1 text-[10px] font-mono",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Best"}),e.jsx("span",{className:"text-slate-300",children:p.best})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Average"}),e.jsx("span",{className:"text-slate-300",children:p.average})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Worst"}),e.jsx("span",{className:"text-slate-300",children:p.worst})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Space"}),e.jsx("span",{className:"text-slate-300",children:p.space})]})]})]},g))}),e.jsxs("div",{className:"rounded-lg bg-indigo-500/5 px-4 py-3 ring-1 ring-indigo-500/15",children:[e.jsx("h4",{className:"text-[10px] font-bold uppercase tracking-wider text-indigo-400 mb-1",children:"Why?"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:x})]}),e.jsxs("button",{onClick:i,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-slate-800/60 px-6 py-3 text-sm font-medium text-slate-300 ring-1 ring-slate-700/50 transition-all hover:bg-slate-700/60 active:scale-[0.98]",children:[e.jsx(xe,{size:14}),"New Battle"]})]})}function at({stateA:t,stateB:a,status:s,winner:l,prediction:n,predictionCorrect:c,inputType:i,speed:o,soundEnabled:r,metricsHistory:d,onPause:m,onResume:x,onReset:g,onSetSpeed:p,onToggleSound:f}){const y=X.find(h=>h.value===t.algorithm).label,C=X.find(h=>h.value===a.algorithm).label,w=Math.max(...t.array,...a.array,1),S=s==="running";return e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s!=="finished"&&e.jsxs("button",{onClick:S?m:x,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 transition-all hover:bg-slate-700/60",children:[S?e.jsx(ve,{size:14}):e.jsx(be,{size:14}),S?"Pause":"Resume"]}),e.jsxs("button",{onClick:g,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 transition-all hover:bg-slate-700/60",children:[e.jsx(xe,{size:14}),"Reset"]}),e.jsx("button",{onClick:()=>f(!r),className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium transition-all ring-1 ${r?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-slate-700/40"}`,children:r?e.jsx(ge,{size:14}):e.jsx(fe,{size:14})})]}),s!=="finished"&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),me.map(h=>e.jsx("button",{onClick:()=>p(h.value),className:`rounded px-2 py-1 text-[10px] font-medium transition-all ${o===h.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-500 hover:bg-slate-700/50"}`,children:h.label},h.value))]}),e.jsxs("div",{className:"text-xs text-slate-500 font-mono",children:[t.metrics.timeElapsed.toFixed(1),"s"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx(ke,{state:t,color:"rose",maxVal:w}),e.jsx(ke,{state:a,color:"cyan",maxVal:w})]}),e.jsx(st,{history:d,nameA:y,nameB:C}),s==="finished"&&l&&e.jsx(nt,{stateA:t,stateB:a,winner:l,prediction:n,predictionCorrect:c,inputType:i,onReset:g})]})})}const ne=15,Z=25,lt=.25,rt=[{value:"random",label:"Random Scatter"},{value:"recursive-division",label:"Recursive Division"},{value:"dfs-maze",label:"DFS Maze"}];function Re(t,a){return`${t},${a}`}function it(){const t=[];for(let a=0;ac===a.row&&i===a.col||c===s.row&&i===s.col;function n(c,i,o,r,d){if(d){if(i-c<2)return;const m=[];for(let p=c+1;p.5)}function dt(t,a,s){for(let o=0;oMath.random()-.5);for(const[m,x]of d){const g=o+m,p=r+x;g>=0&&g=0&&p=0&&(t[s.row][s.col-1].type=D.EMPTY)}function ut(t="random"){const a=it(),s={row:Math.floor(ne/2),col:1},l={row:Math.floor(ne/2),col:Z-2};switch(t){case"recursive-division":ot(a,s,l);break;case"dfs-maze":dt(a,s,l);break;default:ct(a,s,l);break}return a[s.row][s.col].type=D.START,a[l.row][l.col].type=D.END,{grid:a,start:s,end:l}}function Te(t,a,s,l){const n=_e(l,t,a,s),c=n.visitedNodesInOrder,i=n.shortestPath,o=[],r=new Set;for(let d=0;d0){const d=new Set(r);for(let m=0;mRe(x.row,x.col)))})}return{steps:o,totalVisited:c.length,pathLength:i.length,found:i.length>0}}const de=[{value:"bfs",label:"BFS"},{value:"dfs",label:"DFS"},{value:"dijkstra",label:"Dijkstra"},{value:"astar",label:"A*"}],$e={bfs:{time:"O(V + E)",space:"O(V)",optimal:!0},dfs:{time:"O(V + E)",space:"O(V)",optimal:!1},dijkstra:{time:"O(V² / V+E log V)",space:"O(V)",optimal:!0},astar:{time:"O(E)",space:"O(V)",optimal:!0}};function Be({grid:t,step:a,algorithm:s,color:l,finished:n,totalVisited:c,pathLength:i,currentIndex:o,totalSteps:r}){const d=de.find(g=>g.value===s).label,x={rose:{visited:"bg-rose-500/40",path:"bg-rose-300",current:"bg-rose-400",label:"text-rose-400",badge:"bg-rose-500/15 text-rose-300 ring-rose-500/30",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"},cyan:{visited:"bg-cyan-500/40",path:"bg-cyan-300",current:"bg-cyan-400",label:"text-cyan-400",badge:"bg-cyan-500/15 text-cyan-300 ring-cyan-500/30",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"}}[l];return e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsx("span",{className:`text-xs font-bold ${x.label}`,children:d}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ${x.badge}`,children:n?"Finished":"Running"})]}),e.jsx("div",{className:`rounded-xl border border-slate-700/50 bg-slate-950/80 p-1 ${x.border} transition-all overflow-hidden`,children:e.jsx("div",{className:"grid",style:{gridTemplateColumns:`repeat(${Z}, 1fr)`,gap:"1px"},children:t.map((g,p)=>g.map((f,y)=>{const C=`${p},${y}`;let w="bg-slate-800/40";return f.type===D.WALL?w="bg-slate-600":f.type===D.START?w="bg-emerald-500":f.type===D.END?w="bg-amber-500":a&&(a.pathNodes.has(C)?w=x.path:a.currentNode&&a.currentNode.row===p&&a.currentNode.col===y?w=x.current:a.visitedSoFar.has(C)&&(w=x.visited)),e.jsx("div",{className:`aspect-square rounded-[1px] ${w} transition-colors duration-75`},C)}))})}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5 px-1",children:[e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Visited"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:c})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Path"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:i})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Steps"}),e.jsxs("div",{className:"text-xs font-mono font-bold text-white",children:[o,"/",r]})]})]})]})}function xt({grid:t,stateA:a,stateB:s,status:l,winner:n,prediction:c,predictionCorrect:i,speed:o,soundEnabled:r,onPause:d,onResume:m,onReset:x,onSetSpeed:g,onToggleSound:p}){const f=l==="running",y=de.find(h=>h.value===a.algorithm).label,C=de.find(h=>h.value===s.algorithm).label,w=a.currentIndexp(!r),className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium ring-1 ${r?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-slate-700/40"}`,children:r?e.jsx(ge,{size:14}):e.jsx(fe,{size:14})})]}),l!=="finished"&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),me.map(h=>e.jsx("button",{onClick:()=>g(h.value),className:`rounded px-2 py-1 text-[10px] font-medium ${o===h.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-500 hover:bg-slate-700/50"}`,children:h.label},h.value))]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx(Be,{grid:t,step:w,algorithm:a.algorithm,color:"rose",finished:a.finished,totalVisited:a.totalVisited,pathLength:a.pathLength,currentIndex:a.currentIndex,totalSteps:a.steps.length}),e.jsx(Be,{grid:t,step:S,algorithm:s.algorithm,color:"cyan",finished:s.finished,totalVisited:s.totalVisited,pathLength:s.pathLength,currentIndex:s.currentIndex,totalSteps:s.steps.length})]}),l==="finished"&&n&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm space-y-4",children:[e.jsx("div",{className:"text-center",children:n==="tie"?e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-5 py-2 ring-1 ring-amber-500/20",children:[e.jsx(ye,{size:18,className:"text-amber-400"}),e.jsx("span",{className:"text-sm font-bold text-amber-300",children:"It's a Tie!"})]}):e.jsxs("div",{className:`inline-flex items-center gap-2 rounded-full px-5 py-2 ring-1 ${n==="A"?"bg-rose-500/10 ring-rose-500/20":"bg-cyan-500/10 ring-cyan-500/20"}`,children:[e.jsx(je,{size:18,className:n==="A"?"text-rose-400":"text-cyan-400"}),e.jsxs("span",{className:`text-sm font-bold ${n==="A"?"text-rose-300":"text-cyan-300"}`,children:[n==="A"?y:C," Wins!"]})]})}),c&&i!==null&&e.jsx("div",{className:`rounded-lg px-4 py-2.5 text-center text-xs font-medium ${i?"bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20":"bg-rose-500/10 text-rose-300 ring-1 ring-rose-500/20"}`,children:i?"🎯 Correct prediction!":"❌ Wrong prediction. Keep learning!"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-700/50",children:[e.jsx("th",{className:"py-2 text-left text-slate-500",children:"Metric"}),e.jsx("th",{className:"py-2 text-center text-rose-400 font-semibold",children:y}),e.jsx("th",{className:"py-2 text-center text-cyan-400 font-semibold",children:C})]})}),e.jsx("tbody",{className:"font-mono",children:[{label:"Nodes Visited",a:a.totalVisited,b:s.totalVisited},{label:"Path Length",a:a.pathLength,b:s.pathLength},{label:"Total Steps",a:a.steps.length,b:s.steps.length}].map(({label:h,a:z,b:B})=>e.jsxs("tr",{className:"border-b border-slate-800/50",children:[e.jsx("td",{className:"py-2 text-slate-400",children:h}),e.jsxs("td",{className:`py-2 text-center font-semibold ${z<=B?"text-emerald-300":"text-white"}`,children:[z,ze.jsxs("div",{className:"rounded-lg bg-slate-800/40 p-3",children:[e.jsx("h4",{className:`text-[10px] font-bold uppercase tracking-wider ${B==="rose"?"text-rose-400":"text-cyan-400"} mb-2`,children:h}),e.jsxs("div",{className:"space-y-1 text-[10px] font-mono",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Time"}),e.jsx("span",{className:"text-slate-300",children:z.time})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Space"}),e.jsx("span",{className:"text-slate-300",children:z.space})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Optimal"}),e.jsx("span",{className:z.optimal?"text-emerald-300":"text-rose-300",children:z.optimal?"Yes":"No"})]})]})]},h))}),e.jsxs("button",{onClick:x,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-slate-800/60 px-6 py-3 text-sm font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60 active:scale-[0.98]",children:[e.jsx(xe,{size:14})," New Battle"]})]})]})})}const Ne=[{value:"fibonacci",label:"Fibonacci",desc:"Compute the Nth Fibonacci number",inputLabel:"N",inputMin:5,inputMax:25,defaultN:15},{value:"factorial",label:"Factorial",desc:"Compute N! (N factorial)",inputLabel:"N",inputMin:3,inputMax:20,defaultN:10},{value:"staircase",label:"Staircase",desc:"Ways to climb N stairs (1 or 2 steps)",inputLabel:"Stairs",inputMin:5,inputMax:25,defaultN:15},{value:"coin-change",label:"Coin Change",desc:"Min coins to make amount N (coins: 1,3,5)",inputLabel:"Amount",inputMin:5,inputMax:30,defaultN:15}];function Ie(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i<=1)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:i,cacheSize:0}),i;const r=n(i-1,o+1)+n(i-2,o+1);return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function mt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r<=1)return c.set(r,r),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:r,cacheSize:c.size}),r;const m=i(r-1,d+1)+i(r-2,d+1);return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function pt(t){const a=[];let s=0;if(t<=1)return s=1,a.push({callCount:s,cacheHits:0,currentDepth:0,maxDepth:0,currentN:t,result:t,cacheSize:0}),{steps:a,finalResult:t,totalCalls:1,totalCacheHits:0,maxDepth:0};let l=0,n=1;for(let c=2;c<=t;c++){s++;const i=l+n;l=n,n=i,a.push({callCount:s,cacheHits:0,currentDepth:0,maxDepth:0,currentN:c,result:n,cacheSize:0})}return{steps:a,finalResult:n,totalCalls:s,totalCacheHits:0,maxDepth:0}}const ue=[{value:"naive",label:"Naive Recursive"},{value:"memoized",label:"Memoized"},{value:"iterative",label:"Iterative"}],De={naive:{time:"O(2ⁿ)",space:"O(n)"},memoized:{time:"O(n)",space:"O(n)"},iterative:{time:"O(n)",space:"O(1)"}};function ht(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i<=1)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:1,cacheSize:0}),1;const r=i*n(i-1,o+1);return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function gt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r<=1)return c.set(r,1),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:1,cacheSize:c.size}),1;const m=r*i(r-1,d+1);return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function ft(t){const a=[];let s=1;for(let l=2;l<=t;l++)s*=l,a.push({callCount:l-1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:l,result:s,cacheSize:0});return a.length===0&&a.push({callCount:1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:t,result:1,cacheSize:0}),{steps:a,finalResult:s,totalCalls:Math.max(t-1,1),totalCacheHits:0,maxDepth:0}}function bt(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i<=1)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:1,cacheSize:0}),1;const r=n(i-1,o+1)+n(i-2,o+1);return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function Nt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r<=1)return c.set(r,1),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:1,cacheSize:c.size}),1;const m=i(r-1,d+1)+i(r-2,d+1);return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function jt(t){const a=[];if(t<=1)return a.push({callCount:1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:t,result:1,cacheSize:0}),{steps:a,finalResult:1,totalCalls:1,totalCacheHits:0,maxDepth:0};let s=1,l=1;for(let n=2;n<=t;n++){const c=s+l;s=l,l=c,a.push({callCount:n-1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:n,result:l,cacheSize:0})}return{steps:a,finalResult:l,totalCalls:t-1,totalCacheHits:0,maxDepth:0}}const Se=[1,3,5];function vt(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i===0)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:0,cacheSize:0}),0;if(i<0)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:1/0,cacheSize:0}),1/0;let r=1/0;for(const d of Se){const m=n(i-d,o+1);m!==1/0&&(r=Math.min(r,m+1))}return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r===1/0?-1:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c===1/0?-1:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function yt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x===1/0?-1:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r===0)return c.set(0,0),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:0,cacheSize:c.size}),0;if(r<0)return 1/0;let m=1/0;for(const x of Se){const g=i(r-x,d+1);g!==1/0&&(m=Math.min(m,g+1))}return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m===1/0?-1:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o===1/0?-1:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function St(t){const a=[],s=new Array(t+1).fill(1/0);s[0]=0;let l=0;for(let n=1;n<=t;n++){for(const c of Se)n>=c&&s[n-c]+1r.value===t.algorithm).label,n=t.currentIndex0?t.currentIndex/c*100:0,o=a==="rose"?{label:"text-rose-400",badge:"bg-rose-500/15 text-rose-300 ring-rose-500/30",bar:"bg-rose-500",border:t.finished?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"}:{label:"text-cyan-400",badge:"bg-cyan-500/15 text-cyan-300 ring-cyan-500/30",bar:"bg-cyan-500",border:t.finished?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"};return e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsx("span",{className:`text-xs font-bold ${o.label}`,children:l}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ${o.badge}`,children:t.finished?"Finished":"Running"})]}),e.jsxs("div",{className:`rounded-xl border border-slate-700/50 bg-slate-950/80 p-3 ${o.border} transition-all`,children:[e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Function Calls"}),e.jsxs("span",{className:"text-[10px] font-mono text-slate-400",children:[n?n.callCount:0," / ",t.totalCalls]})]}),e.jsx("div",{className:"h-4 rounded-full bg-slate-800/60 overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${o.bar} transition-all duration-75`,style:{width:`${i}%`}})})]}),e.jsxs("div",{className:"mb-2",children:[e.jsx("span",{className:"text-[10px] text-slate-500 block mb-1",children:"Stack Depth"}),e.jsx("div",{className:"flex items-end gap-px h-16",children:Array.from({length:Math.max(n?.maxDepth||1,1)},(r,d)=>{const m=n?dS.value===t.algorithm).label,C=ue.find(S=>S.value===a.algorithm).label,w=wt[r];return e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s!=="finished"&&e.jsxs("button",{onClick:f?d:m,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60",children:[f?e.jsx(ve,{size:14}):e.jsx(be,{size:14}),f?"Pause":"Resume"]}),e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60",children:[e.jsx(xe,{size:14})," Reset"]}),e.jsx("button",{onClick:()=>p(!o),className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium ring-1 ${o?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-slate-700/40"}`,children:o?e.jsx(ge,{size:14}):e.jsx(fe,{size:14})})]}),s!=="finished"&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),me.map(S=>e.jsx("button",{onClick:()=>g(S.value),className:`rounded px-2 py-1 text-[10px] font-medium ${i===S.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-500 hover:bg-slate-700/50"}`,children:S.label},S.value))]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx(Pe,{state:t,color:"rose",funcName:w}),e.jsx(Pe,{state:a,color:"cyan",funcName:w})]}),s==="finished"&&l&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm space-y-4",children:[e.jsx("div",{className:"text-center",children:l==="tie"?e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-5 py-2 ring-1 ring-amber-500/20",children:[e.jsx(ye,{size:18,className:"text-amber-400"}),e.jsx("span",{className:"text-sm font-bold text-amber-300",children:"It's a Tie!"})]}):e.jsxs("div",{className:`inline-flex items-center gap-2 rounded-full px-5 py-2 ring-1 ${l==="A"?"bg-rose-500/10 ring-rose-500/20":"bg-cyan-500/10 ring-cyan-500/20"}`,children:[e.jsx(je,{size:18,className:l==="A"?"text-rose-400":"text-cyan-400"}),e.jsxs("span",{className:`text-sm font-bold ${l==="A"?"text-rose-300":"text-cyan-300"}`,children:[l==="A"?y:C," Wins!"]})]})}),n&&c!==null&&e.jsx("div",{className:`rounded-lg px-4 py-2.5 text-center text-xs font-medium ${c?"bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20":"bg-rose-500/10 text-rose-300 ring-1 ring-rose-500/20"}`,children:c?"🎯 Correct prediction!":"❌ Wrong prediction. Keep learning!"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-700/50",children:[e.jsx("th",{className:"py-2 text-left text-slate-500",children:"Metric"}),e.jsx("th",{className:"py-2 text-center text-rose-400 font-semibold",children:y}),e.jsx("th",{className:"py-2 text-center text-cyan-400 font-semibold",children:C})]})}),e.jsx("tbody",{className:"font-mono",children:[{label:"Total Calls",a:t.totalCalls,b:a.totalCalls},{label:"Cache Hits",a:t.totalCacheHits,b:a.totalCacheHits},{label:"Max Stack Depth",a:t.maxDepth,b:a.maxDepth},{label:"Total Steps",a:t.steps.length,b:a.steps.length}].map(({label:S,a:h,b:z})=>e.jsxs("tr",{className:"border-b border-slate-800/50",children:[e.jsx("td",{className:"py-2 text-slate-400",children:S}),e.jsxs("td",{className:`py-2 text-center font-semibold ${h<=z?"text-emerald-300":"text-white"}`,children:[h,he.jsxs("div",{className:"rounded-lg bg-slate-800/40 p-3",children:[e.jsx("h4",{className:`text-[10px] font-bold uppercase tracking-wider ${z==="rose"?"text-rose-400":"text-cyan-400"} mb-2`,children:S}),e.jsxs("div",{className:"space-y-1 text-[10px] font-mono",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Time"}),e.jsx("span",{className:"text-slate-300",children:h.time})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Space"}),e.jsx("span",{className:"text-slate-300",children:h.space})]})]})]},S))}),e.jsxs("div",{className:"rounded-lg bg-indigo-500/5 px-4 py-3 ring-1 ring-indigo-500/15",children:[e.jsx("h4",{className:"text-[10px] font-bold uppercase tracking-wider text-indigo-400 mb-1",children:"Why?"}),e.jsxs("p",{className:"text-xs text-slate-400 leading-relaxed",children:[t.totalCalls>a.totalCalls?`${y} made ${t.totalCalls} function calls compared to ${C}'s ${a.totalCalls}. `:a.totalCalls>t.totalCalls?`${C} made ${a.totalCalls} function calls compared to ${y}'s ${t.totalCalls}. `:`Both made ${t.totalCalls} calls. `,r==="factorial"?"Factorial is inherently linear — naive and memoized perform similarly. The iterative version avoids stack overhead.":r==="coin-change"?"Naive coin change explores all combinations (branching factor 3), while memoization caches sub-amounts to avoid redundant work. Iterative DP builds the table bottom-up.":"Naive recursion recalculates the same subproblems exponentially (O(2ⁿ)), while memoization caches results reducing to O(n). The iterative approach avoids recursion overhead entirely with O(1) space."]})]}),e.jsxs("button",{onClick:x,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-slate-800/60 px-6 py-3 text-sm font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60 active:scale-[0.98]",children:[e.jsx(xe,{size:14})," New Battle"]})]})]})})}const Fe=[261.63,293.66,329.63,392,440,523.25,587.33,659.25,783.99,880];function we(){const t=u.useRef(!0),a=u.useCallback(()=>qe(),[]),s=u.useCallback(i=>{t.current=i},[]),l=u.useCallback((i,o,r)=>{if(!t.current)return;const d=a();if(!d)return;const m=i/Math.max(o-1,1),x=Fe[Math.floor(m*(Fe.length-1))],g=d.createOscillator(),p=d.createGain(),f=d.createStereoPanner();g.type="sine",g.frequency.value=x,p.gain.setValueAtTime(.04,d.currentTime),p.gain.exponentialRampToValueAtTime(.001,d.currentTime+.08),f.pan.value=r,g.connect(p),p.connect(f),f.connect(d.destination),g.start(),g.stop(d.currentTime+.08)},[a]),n=u.useCallback((i,o,r)=>{if(!t.current)return;const d=a();if(!d)return;const x=200+i/Math.max(o-1,1)*600,g=d.createOscillator(),p=d.createGain(),f=d.createStereoPanner();g.type="triangle",g.frequency.value=x,p.gain.setValueAtTime(.06,d.currentTime),p.gain.exponentialRampToValueAtTime(.001,d.currentTime+.1),f.pan.value=r,g.connect(p),p.connect(f),f.connect(d.destination),g.start(),g.stop(d.currentTime+.1)},[a]),c=u.useCallback(()=>{if(!t.current)return;const i=a();i&&[523.25,659.25,783.99].forEach((o,r)=>{const d=i.createOscillator(),m=i.createGain();d.type="sine",d.frequency.value=o,m.gain.setValueAtTime(.1,i.currentTime+r*.12),m.gain.exponentialRampToValueAtTime(.001,i.currentTime+r*.12+.2),d.connect(m),m.connect(i.destination),d.start(i.currentTime+r*.12),d.stop(i.currentTime+r*.12+.2)})},[a]);return{playCompareTone:l,playSwapTone:n,playWinTone:c,setEnabled:s}}function te(t,a){let s=0,l=0,n=0;for(let c=0;c<=a&&c{y(j),ie(j)},[ie]),Q=u.useCallback(()=>{L.current&&(cancelAnimationFrame(L.current),L.current=null)},[]),A=u.useCallback(()=>{const j=Ue(n,i);ae(j);const b=Me(t,[...j]),v=Me(s,[...j]);P.current=b,F.current=v,E.current=0,H.current=0;const T=te(b,0),V=te(v,0);if(w(se(t,b[0],T,0,b.length,!1)),h(se(s,v[0],V,0,v.length,!1)),B(null),G(null),_([{stepA:0,stepB:0,opsA:0,opsB:0}]),ee.current=performance.now(),r==="turbo"){const le=te(b,b.length-1),U=te(v,v.length-1);le.timeElapsed=0,U.timeElapsed=0;const oe=b[b.length-1],pe=v[v.length-1];w(se(t,oe,le,b.length-1,b.length,!0)),h(se(s,pe,U,v.length-1,v.length,!0));let I="tie";le.totalSteps{const j=P.current,b=F.current;let v=E.current,T=H.current;const V=v>=j.length-1,le=T>=b.length-1;if(V&&le){const I=te(j,v),Ce=te(b,T),Ae=(performance.now()-ee.current)/1e3;I.timeElapsed=Ae,Ce.timeElapsed=Ae,w(se(t,j[v],I,v,j.length,!0)),h(se(s,b[T],Ce,T,b.length,!0));let he="tie";j.length=j.length-1)),h(se(s,b[T],oe,T,b.length,T>=b.length-1)),_(I=>[...I,{stepA:U.stepsCompleted,stepB:oe.stepsCompleted,opsA:U.totalOperations,opsB:oe.totalOperations}])},[t,s,n,f,$,q,Y,W]);u.useEffect(()=>{if(g!=="running"){Q();return}let j=0;const b=v=>{v-j>=m&&(j=v,k()),L.current=requestAnimationFrame(b)};return L.current=requestAnimationFrame(b),Q},[g,m,k,Q]);const N=u.useCallback(()=>{g==="running"&&p("paused")},[g]),M=u.useCallback(()=>{g==="paused"&&p("running")},[g]),R=u.useCallback(()=>{Q(),P.current=[],F.current=[],E.current=0,H.current=0,w(null),h(null),B(null),O(null),G(null),_([]),p("setup")},[Q]);return{algorithmA:t,setAlgorithmA:a,algorithmB:s,setAlgorithmB:l,inputSize:n,setInputSize:c,inputType:i,setInputType:o,gameMode:r,setGameMode:d,speed:m,setSpeed:x,status:g,soundEnabled:f,toggleSound:ce,stateA:C,stateB:S,winner:z,prediction:$,setPrediction:O,predictionCorrect:re,inputData:K,metricsHistory:J,startBattle:A,pause:N,resume:M,reset:R}}function Mt(){const[t,a]=u.useState("bfs"),[s,l]=u.useState("dfs"),[n,c]=u.useState("random"),[i,o]=u.useState("realtime"),[r,d]=u.useState(50),[m,x]=u.useState("setup"),[g,p]=u.useState(!0),[f,y]=u.useState(null),[C,w]=u.useState(null),[S,h]=u.useState(null),[z,B]=u.useState(null),[$,O]=u.useState(null),[re,G]=u.useState(null),K=u.useRef([]),ae=u.useRef([]),J=u.useRef(0),_=u.useRef(0),P=u.useRef(null),F=u.useRef({totalVisited:0,pathLength:0,found:!1}),E=u.useRef({totalVisited:0,pathLength:0,found:!1}),{playCompareTone:H,playWinTone:L,setEnabled:ee}=we(),q=u.useCallback(N=>{p(N),ee(N)},[ee]),Y=u.useCallback(()=>{P.current&&(cancelAnimationFrame(P.current),P.current=null)},[]),W=u.useCallback((N,M)=>{let R="tie";return N.found&&!M.found?R="A":!N.found&&M.found?R="B":N.found&&M.found&&(N.totalVisited{const{grid:N,start:M,end:R}=ut(n);y(N);const j=Te(N,M,R,t),b=Te(N,M,R,s);K.current=j.steps,ae.current=b.steps,J.current=0,_.current=0,F.current={totalVisited:j.totalVisited,pathLength:j.pathLength,found:j.found},E.current={totalVisited:b.totalVisited,pathLength:b.pathLength,found:b.found};const v={algorithm:t,steps:j.steps,currentIndex:0,totalVisited:j.totalVisited,pathLength:j.pathLength,found:j.found,finished:!1},T={algorithm:s,steps:b.steps,currentIndex:0,totalVisited:b.totalVisited,pathLength:b.pathLength,found:b.found,finished:!1};if(i==="turbo"){w({...v,currentIndex:j.steps.length-1,finished:!0}),h({...T,currentIndex:b.steps.length-1,finished:!0});const V=W(F.current,E.current);B(V),$&&G($===V),x("finished"),L();return}w(v),h(T),B(null),G(null),x("running")},[t,s,n,i,$,W,L]),ce=u.useCallback(()=>{let N=J.current,M=_.current;const R=K.current,j=ae.current,b=N>=R.length-1,v=M>=j.length-1;if(b&&v){w(V=>V?{...V,currentIndex:N,finished:!0}:null),h(V=>V?{...V,currentIndex:M,finished:!0}:null);const T=W(F.current,E.current);B(T),$&&G($===T),x("finished"),L();return}b||(N++,J.current=N,g&&H(N,R.length,-.8)),v||(M++,_.current=M,g&&H(M,j.length,.8)),w(T=>T?{...T,currentIndex:N,finished:N>=R.length-1}:null),h(T=>T?{...T,currentIndex:M,finished:M>=j.length-1}:null)},[g,$,W,H,L]);u.useEffect(()=>{if(m!=="running"){Y();return}let N=0;const M=R=>{R-N>=r&&(N=R,ce()),P.current=requestAnimationFrame(M)};return P.current=requestAnimationFrame(M),Y},[m,r,ce,Y]);const Q=u.useCallback(()=>{m==="running"&&x("paused")},[m]),A=u.useCallback(()=>{m==="paused"&&x("running")},[m]),k=u.useCallback(()=>{Y(),y(null),w(null),h(null),B(null),O(null),G(null),x("setup")},[Y]);return{algorithmA:t,setAlgorithmA:a,algorithmB:s,setAlgorithmB:l,mazeType:n,setMazeType:c,gameMode:i,setGameMode:o,speed:r,setSpeed:d,status:m,soundEnabled:g,toggleSound:q,grid:f,stateA:C,stateB:S,winner:z,prediction:$,setPrediction:O,predictionCorrect:re,startBattle:ie,pause:Q,resume:A,reset:k}}function zt(){const[t,a]=u.useState("naive"),[s,l]=u.useState("memoized"),[n,c]=u.useState("fibonacci"),[i,o]=u.useState(15),r=u.useCallback(A=>{c(A);const k=Ne.find(N=>N.value===A);k&&o(k.defaultN)},[]),[d,m]=u.useState("realtime"),[x,g]=u.useState(50),[p,f]=u.useState("setup"),[y,C]=u.useState(!0),[w,S]=u.useState(null),[h,z]=u.useState(null),[B,$]=u.useState(null),[O,re]=u.useState(null),[G,K]=u.useState(null),ae=u.useRef([]),J=u.useRef([]),_=u.useRef(0),P=u.useRef(0),F=u.useRef(null),{playCompareTone:E,playWinTone:H,setEnabled:L}=we(),ee=u.useCallback(A=>{C(A),L(A)},[L]),q=u.useCallback(()=>{F.current&&(cancelAnimationFrame(F.current),F.current=null)},[]),Y=u.useCallback(()=>{const A=Oe(t,i,n),k=Oe(s,i,n);ae.current=A.steps,J.current=k.steps,_.current=0,P.current=0;const N={algorithm:t,steps:A.steps,currentIndex:0,totalCalls:A.totalCalls,totalCacheHits:A.totalCacheHits,maxDepth:A.maxDepth,finalResult:A.finalResult,finished:!1},M={algorithm:s,steps:k.steps,currentIndex:0,totalCalls:k.totalCalls,totalCacheHits:k.totalCacheHits,maxDepth:k.maxDepth,finalResult:k.finalResult,finished:!1};if(d==="turbo"){S({...N,currentIndex:A.steps.length-1,finished:!0}),z({...M,currentIndex:k.steps.length-1,finished:!0});let R="tie";A.totalCalls{let A=_.current,k=P.current;const N=ae.current,M=J.current,R=A>=N.length-1,j=k>=M.length-1;if(R&&j){S(v=>v?{...v,currentIndex:A,finished:!0}:null),z(v=>v?{...v,currentIndex:k,finished:!0}:null);let b="tie";N.lengthb?{...b,currentIndex:A,finished:A>=N.length-1}:null),z(b=>b?{...b,currentIndex:k,finished:k>=M.length-1}:null)},[y,O,E,H]);u.useEffect(()=>{if(p!=="running"){q();return}let A=0;const k=N=>{N-A>=x&&(A=N,W()),F.current=requestAnimationFrame(k)};return F.current=requestAnimationFrame(k),q},[p,x,W,q]);const ie=u.useCallback(()=>{p==="running"&&f("paused")},[p]),ce=u.useCallback(()=>{p==="paused"&&f("running")},[p]),Q=u.useCallback(()=>{q(),S(null),z(null),$(null),re(null),K(null),f("setup")},[q]);return{algorithmA:t,setAlgorithmA:a,algorithmB:s,setAlgorithmB:l,problem:n,changeProblem:r,inputN:i,setInputN:o,gameMode:d,setGameMode:m,speed:x,setSpeed:g,status:p,soundEnabled:y,toggleSound:ee,stateA:w,stateB:h,winner:B,prediction:O,setPrediction:re,predictionCorrect:G,startBattle:Y,pause:ie,resume:ce,reset:Q}}const kt=[{value:"sorting",label:"Sorting",desc:"Bubble, Quick, Merge & more",icon:Ke},{value:"pathfinding",label:"Pathfinding",desc:"BFS, DFS, Dijkstra, A*",icon:Ee},{value:"recursion",label:"Recursion",desc:"Fibonacci, Factorial, Staircase & more",icon:Ve}];function Rt({onSelect:t}){return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center justify-center px-6 pt-10 pb-6 text-center",children:[e.jsxs("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full bg-rose-500/10 px-4 py-1.5 ring-1 ring-rose-500/20",children:[e.jsx(Le,{size:14,className:"text-rose-400"}),e.jsx("span",{className:"text-xs font-medium text-rose-300",children:"Algorithm Battles"})]}),e.jsxs("h2",{className:"text-2xl font-extrabold tracking-tight text-white",children:["Choose Your ",e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-cyan-400 bg-clip-text text-transparent",children:"Arena"})]}),e.jsx("p",{className:"mt-2 max-w-md text-sm text-slate-400",children:"Pick a battle category to pit two algorithms head-to-head."})]}),e.jsx("section",{className:"px-4 pb-10",children:e.jsx("div",{className:"mx-auto max-w-lg grid grid-cols-1 gap-3",children:kt.map(({value:a,label:s,desc:l,icon:n})=>e.jsxs("button",{onClick:()=>t(a),className:"group flex items-center gap-4 rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 text-left backdrop-blur-sm transition-all hover:border-slate-600/60 hover:bg-slate-900/80 hover:scale-[1.01] active:scale-[0.99]",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-rose-500/20 to-cyan-500/20 ring-1 ring-white/10",children:e.jsx(n,{size:22,className:"text-white"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-bold text-white",children:[s," Battles"]}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:l})]})]},a))})})]})}function Tt({battle:t}){const a=de.find(l=>l.value===t.algorithmA).label,s=de.find(l=>l.value===t.algorithmB).label;return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center px-6 pt-8 pb-4 text-center",children:[e.jsxs("h2",{className:"text-2xl font-extrabold text-white",children:[e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-orange-400 bg-clip-text text-transparent",children:a})," ","vs"," ",e.jsx("span",{className:"bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent",children:s})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Race to find a path on the same random grid"})]}),e.jsx("section",{className:"px-4 pb-8",children:e.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:["A","B"].map(l=>e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsxs("h3",{className:`text-xs font-semibold uppercase tracking-wider ${l==="A"?"text-rose-400":"text-cyan-400"} mb-3`,children:["Algorithm ",l]}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:de.map(n=>e.jsx("button",{onClick:()=>l==="A"?t.setAlgorithmA(n.value):t.setAlgorithmB(n.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${(l==="A"?t.algorithmA:t.algorithmB)===n.value?l==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:n.label},n.value))})]},l))}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Maze Type"}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:rt.map(l=>e.jsx("button",{onClick:()=>t.setMazeType(l.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${t.mazeType===l.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:l.label},l.value))})]}),e.jsx(We,{gameMode:t.gameMode,setGameMode:t.setGameMode,speed:t.speed,setSpeed:t.setSpeed,soundEnabled:t.soundEnabled,toggleSound:t.toggleSound,prediction:t.prediction,setPrediction:t.setPrediction,nameA:a,nameB:s}),e.jsxs("button",{onClick:t.startBattle,disabled:t.gameMode==="prediction"&&!t.prediction,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-rose-500/20 to-cyan-500/20 px-6 py-4 text-base font-bold text-white ring-1 ring-white/10 transition-all hover:from-rose-500/30 hover:to-cyan-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ee,{size:18,className:"text-rose-300"})," Start Battle"]})]})})]})}function $t({battle:t}){const a=ue.find(n=>n.value===t.algorithmA).label,s=ue.find(n=>n.value===t.algorithmB).label,l=Ne.find(n=>n.value===t.problem);return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center px-6 pt-8 pb-4 text-center",children:[e.jsxs("h2",{className:"text-2xl font-extrabold text-white",children:[e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-orange-400 bg-clip-text text-transparent",children:a})," ","vs"," ",e.jsx("span",{className:"bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent",children:s})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:l.desc})]}),e.jsx("section",{className:"px-4 pb-8",children:e.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Problem"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-1.5",children:Ne.map(n=>e.jsxs("button",{onClick:()=>t.changeProblem(n.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${t.problem===n.value?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:[e.jsx("span",{className:"block font-semibold",children:n.label}),e.jsx("span",{className:"block text-[9px] text-slate-500 mt-0.5",children:n.desc})]},n.value))})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:["A","B"].map(n=>e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsxs("h3",{className:`text-xs font-semibold uppercase tracking-wider ${n==="A"?"text-rose-400":"text-cyan-400"} mb-3`,children:["Algorithm ",n]}),e.jsx("div",{className:"space-y-1.5",children:ue.map(c=>e.jsx("button",{onClick:()=>n==="A"?t.setAlgorithmA(c.value):t.setAlgorithmB(c.value),className:`w-full rounded-lg px-3 py-2 text-[11px] font-medium transition-all text-left ${(n==="A"?t.algorithmA:t.algorithmB)===c.value?n==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:c.label},c.value))})]},n))}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Input"}),e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-slate-500",children:l.inputLabel}),e.jsx("span",{className:"text-sm font-mono font-bold text-indigo-300",children:t.inputN})]}),e.jsx("input",{type:"range",min:l.inputMin,max:l.inputMax,value:t.inputN,onChange:n=>t.setInputN(Number(n.target.value)),className:"w-full accent-indigo-500"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:t.problem==="fibonacci"||t.problem==="staircase"?"⚠️ Naive recursive is exponential — large N generates many steps":t.problem==="coin-change"?"⚠️ Naive coin change branches 3 ways per call — grows very fast":"⚠️ Factorial is linear — naive and memoized are similar here"})]}),e.jsx(We,{gameMode:t.gameMode,setGameMode:t.setGameMode,speed:t.speed,setSpeed:t.setSpeed,soundEnabled:t.soundEnabled,toggleSound:t.toggleSound,prediction:t.prediction,setPrediction:t.setPrediction,nameA:a,nameB:s}),e.jsxs("button",{onClick:t.startBattle,disabled:t.gameMode==="prediction"&&!t.prediction,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-rose-500/20 to-cyan-500/20 px-6 py-4 text-base font-bold text-white ring-1 ring-white/10 transition-all hover:from-rose-500/30 hover:to-cyan-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ve,{size:18,className:"text-rose-300"})," Start Battle"]})]})})]})}function We({gameMode:t,setGameMode:a,speed:s,setSpeed:l,soundEnabled:n,toggleSound:c,prediction:i,setPrediction:o,nameA:r,nameB:d}){const m=[{value:"realtime",label:"Real-Time"},{value:"turbo",label:"Turbo"},{value:"prediction",label:"Prediction"}];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Game Mode"}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:m.map(x=>e.jsx("button",{onClick:()=>a(x.value),className:`rounded-lg px-2 py-2 text-[11px] font-semibold transition-all ${t===x.value?"bg-violet-500/20 text-violet-300 ring-1 ring-violet-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:x.label},x.value))})]}),t==="prediction"&&e.jsxs("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400 mb-3",children:"Your Prediction"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>o("A"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${i==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:r}),e.jsx("button",{onClick:()=>o("B"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${i==="B"?"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:d})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1 rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Speed"}),e.jsx("div",{className:"flex gap-1.5",children:me.map(x=>e.jsx("button",{onClick:()=>l(x.value),className:`flex-1 rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${s===x.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:x.label},x.value))})]}),e.jsxs("button",{onClick:()=>c(!n),className:`shrink-0 flex flex-col items-center justify-center rounded-xl px-4 transition-all ${n?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-1 ring-slate-700/40"}`,children:[n?"🔊":"🔇",e.jsx("span",{className:"text-[10px] mt-1",children:n?"On":"Off"})]})]})]})}function _t(){const[t,a]=u.useState(null),s=At(),l=Mt(),n=zt(),c=()=>{s.reset(),l.reset(),n.reset(),a(null)};if(!t)return e.jsx(Rt,{onSelect:a});const i=e.jsxs("button",{onClick:c,className:"fixed top-16 left-4 z-10 flex items-center gap-1 rounded-lg bg-slate-800/80 px-3 py-1.5 text-xs font-medium text-slate-400 ring-1 ring-slate-700/50 backdrop-blur-sm hover:bg-slate-700/80 hover:text-slate-300",children:[e.jsx(Ye,{size:12})," Back"]});if(t==="sorting"){if(s.status==="setup")return e.jsxs(e.Fragment,{children:[i,e.jsx(tt,{algorithmA:s.algorithmA,algorithmB:s.algorithmB,inputSize:s.inputSize,inputType:s.inputType,gameMode:s.gameMode,speed:s.speed,soundEnabled:s.soundEnabled,prediction:s.prediction,onSetAlgorithmA:s.setAlgorithmA,onSetAlgorithmB:s.setAlgorithmB,onSetInputSize:s.setInputSize,onSetInputType:s.setInputType,onSetGameMode:s.setGameMode,onSetSpeed:s.setSpeed,onToggleSound:s.toggleSound,onSetPrediction:s.setPrediction,onStart:s.startBattle})]});if(s.stateA&&s.stateB)return e.jsxs(e.Fragment,{children:[i,e.jsx(at,{stateA:s.stateA,stateB:s.stateB,status:s.status,winner:s.winner,prediction:s.prediction,predictionCorrect:s.predictionCorrect,inputType:s.inputType,speed:s.speed,soundEnabled:s.soundEnabled,metricsHistory:s.metricsHistory,onPause:s.pause,onResume:s.resume,onReset:s.reset,onSetSpeed:s.setSpeed,onToggleSound:s.toggleSound})]})}if(t==="pathfinding"){if(l.status==="setup")return e.jsxs(e.Fragment,{children:[i,e.jsx(Tt,{battle:l})]});if(l.stateA&&l.stateB&&l.grid)return e.jsxs(e.Fragment,{children:[i,e.jsx(xt,{grid:l.grid,stateA:l.stateA,stateB:l.stateB,status:l.status,winner:l.winner,prediction:l.prediction,predictionCorrect:l.predictionCorrect,speed:l.speed,soundEnabled:l.soundEnabled,onPause:l.pause,onResume:l.resume,onReset:l.reset,onSetSpeed:l.setSpeed,onToggleSound:l.toggleSound})]})}if(t==="recursion"){if(n.status==="setup")return e.jsxs(e.Fragment,{children:[i,e.jsx($t,{battle:n})]});if(n.stateA&&n.stateB)return e.jsxs(e.Fragment,{children:[i,e.jsx(Ct,{stateA:n.stateA,stateB:n.stateB,status:n.status,winner:n.winner,prediction:n.prediction,predictionCorrect:n.predictionCorrect,speed:n.speed,soundEnabled:n.soundEnabled,problem:n.problem,onPause:n.pause,onResume:n.resume,onReset:n.reset,onSetSpeed:n.setSpeed,onToggleSound:n.toggleSound})]})}return null}export{_t as default}; +import{c as He,j as e,f as Le,r as u,g as Ve}from"./index-CB1-0H6I.js";import{V as ge,a as fe}from"./volume-x-CKT6TOtL.js";import{S as Ge}from"./shuffle-DZnyoAGL.js";import{P as be}from"./play-SZ6Nqtz8.js";import{T as je}from"./trophy-DE-EF49m.js";import{R as xe}from"./rotate-ccw-CDlWXRsI.js";import{P as ve}from"./pause-DgUWKqjY.js";import{N as D,r as _e}from"./index-DrhCNtmA.js";import{r as Me}from"./index-iw_6MvvU.js";import{g as qe}from"./audioContext-NbgqvQGz.js";import{A as Ye}from"./arrow-left-eH0A06ps.js";import{M as Ee}from"./map-Bnco4-k1.js";const Xe=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Ke=He("chart-column",Xe);const Qe=[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]],ye=He("equal",Qe),X=[{value:"bubble",label:"Bubble Sort"},{value:"selection",label:"Selection Sort"},{value:"insertion",label:"Insertion Sort"},{value:"quick",label:"Quick Sort"},{value:"heap",label:"Heap Sort"},{value:"merge",label:"Merge Sort"}],ze={bubble:{best:"O(n)",average:"O(n²)",worst:"O(n²)",space:"O(1)"},selection:{best:"O(n²)",average:"O(n²)",worst:"O(n²)",space:"O(1)"},insertion:{best:"O(n)",average:"O(n²)",worst:"O(n²)",space:"O(1)"},quick:{best:"O(n log n)",average:"O(n log n)",worst:"O(n²)",space:"O(log n)"},heap:{best:"O(n log n)",average:"O(n log n)",worst:"O(n log n)",space:"O(1)"},merge:{best:"O(n log n)",average:"O(n log n)",worst:"O(n log n)",space:"O(n)"}},me=[{label:"Slow",value:150},{label:"Medium",value:50},{label:"Fast",value:15},{label:"Turbo",value:1}];function Ue(t,a){const s=[];for(let l=0;ln-c);const l=Math.max(1,Math.floor(t*.05));for(let n=0;nn-l);return s}function Ze(t,a,s,l,n,c){const i=X.find(f=>f.value===a).label,o=X.find(f=>f.value===s).label;if(t==="tie")return`Both ${i} and ${o} completed in the same number of operations. This can happen with small inputs or similar-complexity algorithms.`;const r=t==="A"?i:o,d=t==="A"?o:i,m=t==="A"?l:n,x=t==="A"?n:l,g=(x.totalSteps/Math.max(m.totalSteps,1)).toFixed(1);let p=`${r} won with ${m.totalSteps} steps vs ${x.totalSteps} steps (${g}x fewer operations). `;return c==="nearly-sorted"?p+="On nearly-sorted data, algorithms like Insertion Sort have a natural advantage due to their O(n) best-case performance.":c==="reversed"?p+="Reversed input is the worst case for O(n²) algorithms, making the performance gap with O(n log n) algorithms very visible.":p+=`${d} performed more operations because its average-case complexity is higher for this input distribution.`,p}const Je=[{value:"random",label:"Random"},{value:"nearly-sorted",label:"Nearly Sorted"},{value:"reversed",label:"Reversed"}],et=[{value:"realtime",label:"Real-Time",desc:"Watch both algorithms animate step-by-step"},{value:"turbo",label:"Turbo",desc:"Instant execution, metrics only"},{value:"prediction",label:"Prediction",desc:"Predict the winner before starting"}];function tt({algorithmA:t,algorithmB:a,inputSize:s,inputType:l,gameMode:n,speed:c,soundEnabled:i,prediction:o,onSetAlgorithmA:r,onSetAlgorithmB:d,onSetInputSize:m,onSetInputType:x,onSetGameMode:g,onSetSpeed:p,onToggleSound:f,onSetPrediction:y,onStart:C}){const w=X.find(h=>h.value===t).label,S=X.find(h=>h.value===a).label;return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center justify-center px-6 pt-8 pb-4 text-center",children:[e.jsxs("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full bg-rose-500/10 px-4 py-1.5 ring-1 ring-rose-500/20",children:[e.jsx(Le,{size:14,className:"text-rose-400"}),e.jsx("span",{className:"text-xs font-medium text-rose-300",children:"Algorithm Battles"})]}),e.jsxs("h2",{className:"text-2xl font-extrabold tracking-tight text-white",children:[e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-orange-400 bg-clip-text text-transparent",children:w})," ","vs"," ",e.jsx("span",{className:"bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent",children:S})]})]}),e.jsx("section",{className:"px-4 pb-8",children:e.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-rose-400 mb-3",children:"Algorithm A"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:X.map(h=>e.jsx("button",{onClick:()=>r(h.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${t===h.value?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-400 mb-3",children:"Algorithm B"}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:X.map(h=>e.jsx("button",{onClick:()=>d(h.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${a===h.value?"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Input Configuration"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Array Size"}),e.jsx("span",{className:"text-sm font-mono font-bold text-indigo-300",children:s})]}),e.jsx("input",{type:"range",min:10,max:200,step:10,value:s,onChange:h=>m(Number(h.target.value)),className:"w-full accent-indigo-500"})]}),e.jsx("div",{className:"flex gap-1.5",children:Je.map(h=>e.jsx("button",{onClick:()=>x(h.value),className:`flex-1 rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${l===h.value?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Game Mode"}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:et.map(h=>e.jsxs("button",{onClick:()=>g(h.value),className:`flex flex-col items-center rounded-lg px-2 py-2.5 text-[11px] font-medium transition-all ${n===h.value?"bg-violet-500/20 text-violet-300 ring-1 ring-violet-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:[e.jsx("span",{className:"font-semibold",children:h.label}),e.jsx("span",{className:"text-[9px] text-slate-500 mt-0.5 hidden sm:block",children:h.desc})]},h.value))})]}),n==="prediction"&&e.jsxs("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400 mb-3",children:"Your Prediction"}),e.jsx("p",{className:"text-[10px] text-amber-300/60 mb-3",children:"Who will win with fewer operations?"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>y("A"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${o==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:w}),e.jsx("button",{onClick:()=>y("B"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${o==="B"?"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:S})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1 rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Speed"}),e.jsx("div",{className:"flex gap-1.5",children:me.map(h=>e.jsx("button",{onClick:()=>p(h.value),className:`flex-1 rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${c===h.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:h.label},h.value))})]}),e.jsxs("button",{onClick:()=>f(!i),className:`shrink-0 flex flex-col items-center justify-center rounded-xl px-4 transition-all ${i?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-1 ring-slate-700/40"}`,children:[i?e.jsx(ge,{size:18}):e.jsx(fe,{size:18}),e.jsx("span",{className:"text-[10px] mt-1",children:i?"On":"Off"})]})]}),e.jsxs("button",{onClick:C,disabled:n==="prediction"&&!o,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-rose-500/20 to-cyan-500/20 px-6 py-4 text-base font-bold text-white ring-1 ring-white/10 transition-all hover:from-rose-500/30 hover:to-cyan-500/30 hover:ring-white/20 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ge,{size:18,className:"text-rose-300"}),e.jsx(be,{size:18,className:"text-cyan-300"}),"Start Battle"]})]})})]})}function ke({state:t,color:a,maxVal:s}){const l=X.find(x=>x.value===t.algorithm).label,n=t.status==="finished",c=t.array.length,o={rose:{default:"bg-rose-500/60",comparing:"bg-amber-400",swapping:"bg-rose-300",sorted:"bg-emerald-500/70",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50",label:"text-rose-400",badge:"bg-rose-500/15 text-rose-300 ring-rose-500/30"},cyan:{default:"bg-cyan-500/60",comparing:"bg-amber-400",swapping:"bg-cyan-300",sorted:"bg-emerald-500/70",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50",label:"text-cyan-400",badge:"bg-cyan-500/15 text-cyan-300 ring-cyan-500/30"}}[a],r=new Set(t.comparing||[]),d=new Set(t.swapping||[]),m=new Set(t.sorted);return e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsx("span",{className:`text-xs font-bold ${o.label}`,children:l}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ${o.badge}`,children:n?"Finished":"Running"})]}),e.jsx("div",{className:`rounded-xl border border-slate-700/50 bg-slate-950/80 p-2 ${o.border} transition-all overflow-hidden`,children:e.jsx("div",{className:"flex items-end gap-px h-32 sm:h-44 md:h-52",children:t.array.map((x,g)=>{const p=x/s*100;let f=o.default;return r.has(g)?f=o.comparing:d.has(g)?f=o.swapping:m.has(g)&&(f=o.sorted),e.jsx("div",{className:`flex-1 rounded-t-sm transition-all duration-75 ${f}`,style:{height:`${p}%`,minWidth:c>100?"1px":"2px"}},g)})})}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5 px-1",children:[e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Comparisons"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:t.metrics.comparisons})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Swaps"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:t.metrics.swaps})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Steps"}),e.jsxs("div",{className:"text-xs font-mono font-bold text-white",children:[t.metrics.stepsCompleted,"/",t.metrics.totalSteps]})]})]})]})}function st({history:t,nameA:a,nameB:s}){const{pathA:l,pathB:n,maxOps:c,maxTime:i}=u.useMemo(()=>{if(t.length<2)return{pathA:"",pathB:"",maxOps:1,maxTime:1};const o=Math.max(...t.map(g=>Math.max(g.opsA,g.opsB)),1),r=t.length-1,d=400,m=120,x=g=>t.map((p,f)=>{const y=f/r*d,C=m-p[g]/o*m;return`${f===0?"M":"L"}${y.toFixed(1)},${C.toFixed(1)}`}).join(" ");return{pathA:x("opsA"),pathB:x("opsB"),maxOps:o,maxTime:r}},[t]);return t.length<2?null:e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Live Performance"}),e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"h-2 w-4 rounded-full bg-rose-400"}),e.jsx("span",{className:"text-[10px] text-slate-400",children:a})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"h-2 w-4 rounded-full bg-cyan-400"}),e.jsx("span",{className:"text-[10px] text-slate-400",children:s})]}),e.jsxs("span",{className:"ml-auto text-[10px] text-slate-500",children:["Max ops: ",c]})]}),e.jsxs("svg",{viewBox:"0 0 400 120",className:"w-full h-20 sm:h-28",preserveAspectRatio:"none",children:[e.jsx("path",{d:l,fill:"none",stroke:"#fb7185",strokeWidth:2,strokeLinecap:"round"}),e.jsx("path",{d:n,fill:"none",stroke:"#22d3ee",strokeWidth:2,strokeLinecap:"round"})]}),e.jsxs("div",{className:"flex justify-between mt-1",children:[e.jsx("span",{className:"text-[9px] text-slate-600",children:"0"}),e.jsxs("span",{className:"text-[9px] text-slate-600",children:["Steps → ",i]})]})]})}function nt({stateA:t,stateB:a,winner:s,prediction:l,predictionCorrect:n,inputType:c,onReset:i}){const o=X.find(g=>g.value===t.algorithm).label,r=X.find(g=>g.value===a.algorithm).label,d=ze[t.algorithm],m=ze[a.algorithm],x=Ze(s,t.algorithm,a.algorithm,t.metrics,a.metrics,c);return e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm space-y-4",children:[e.jsx("div",{className:"text-center",children:s==="tie"?e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-5 py-2 ring-1 ring-amber-500/20",children:[e.jsx(ye,{size:18,className:"text-amber-400"}),e.jsx("span",{className:"text-sm font-bold text-amber-300",children:"It's a Tie!"})]}):e.jsxs("div",{className:`inline-flex items-center gap-2 rounded-full px-5 py-2 ring-1 ${s==="A"?"bg-rose-500/10 ring-rose-500/20":"bg-cyan-500/10 ring-cyan-500/20"}`,children:[e.jsx(je,{size:18,className:s==="A"?"text-rose-400":"text-cyan-400"}),e.jsxs("span",{className:`text-sm font-bold ${s==="A"?"text-rose-300":"text-cyan-300"}`,children:[s==="A"?o:r," Wins!"]})]})}),l&&n!==null&&e.jsx("div",{className:`rounded-lg px-4 py-2.5 text-center text-xs font-medium ${n?"bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20":"bg-rose-500/10 text-rose-300 ring-1 ring-rose-500/20"}`,children:n?"🎯 Your prediction was correct!":"❌ Your prediction was wrong. Keep learning!"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-700/50",children:[e.jsx("th",{className:"py-2 text-left text-slate-500 font-medium",children:"Metric"}),e.jsx("th",{className:"py-2 text-center text-rose-400 font-semibold",children:o}),e.jsx("th",{className:"py-2 text-center text-cyan-400 font-semibold",children:r})]})}),e.jsx("tbody",{className:"font-mono",children:[{label:"Total Steps",a:t.metrics.totalSteps,b:a.metrics.totalSteps},{label:"Comparisons",a:t.metrics.comparisons,b:a.metrics.comparisons},{label:"Swaps",a:t.metrics.swaps,b:a.metrics.swaps},{label:"Array Accesses",a:t.metrics.arrayAccesses,b:a.metrics.arrayAccesses},{label:"Time (s)",a:t.metrics.timeElapsed.toFixed(2),b:a.metrics.timeElapsed.toFixed(2)}].map(({label:g,a:p,b:f})=>{const y=typeof p=="string"?parseFloat(p):p,C=typeof f=="string"?parseFloat(f):f;return e.jsxs("tr",{className:"border-b border-slate-800/50",children:[e.jsx("td",{className:"py-2 text-slate-400",children:g}),e.jsxs("td",{className:`py-2 text-center font-semibold ${y<=C?"text-emerald-300":"text-white"}`,children:[p,ye.jsxs("div",{className:"rounded-lg bg-slate-800/40 p-3",children:[e.jsx("h4",{className:`text-[10px] font-bold uppercase tracking-wider ${f==="rose"?"text-rose-400":"text-cyan-400"} mb-2`,children:g}),e.jsxs("div",{className:"space-y-1 text-[10px] font-mono",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Best"}),e.jsx("span",{className:"text-slate-300",children:p.best})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Average"}),e.jsx("span",{className:"text-slate-300",children:p.average})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Worst"}),e.jsx("span",{className:"text-slate-300",children:p.worst})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Space"}),e.jsx("span",{className:"text-slate-300",children:p.space})]})]})]},g))}),e.jsxs("div",{className:"rounded-lg bg-indigo-500/5 px-4 py-3 ring-1 ring-indigo-500/15",children:[e.jsx("h4",{className:"text-[10px] font-bold uppercase tracking-wider text-indigo-400 mb-1",children:"Why?"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:x})]}),e.jsxs("button",{onClick:i,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-slate-800/60 px-6 py-3 text-sm font-medium text-slate-300 ring-1 ring-slate-700/50 transition-all hover:bg-slate-700/60 active:scale-[0.98]",children:[e.jsx(xe,{size:14}),"New Battle"]})]})}function at({stateA:t,stateB:a,status:s,winner:l,prediction:n,predictionCorrect:c,inputType:i,speed:o,soundEnabled:r,metricsHistory:d,onPause:m,onResume:x,onReset:g,onSetSpeed:p,onToggleSound:f}){const y=X.find(h=>h.value===t.algorithm).label,C=X.find(h=>h.value===a.algorithm).label,w=Math.max(...t.array,...a.array,1),S=s==="running";return e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s!=="finished"&&e.jsxs("button",{onClick:S?m:x,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 transition-all hover:bg-slate-700/60",children:[S?e.jsx(ve,{size:14}):e.jsx(be,{size:14}),S?"Pause":"Resume"]}),e.jsxs("button",{onClick:g,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 transition-all hover:bg-slate-700/60",children:[e.jsx(xe,{size:14}),"Reset"]}),e.jsx("button",{onClick:()=>f(!r),className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium transition-all ring-1 ${r?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-slate-700/40"}`,children:r?e.jsx(ge,{size:14}):e.jsx(fe,{size:14})})]}),s!=="finished"&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),me.map(h=>e.jsx("button",{onClick:()=>p(h.value),className:`rounded px-2 py-1 text-[10px] font-medium transition-all ${o===h.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-500 hover:bg-slate-700/50"}`,children:h.label},h.value))]}),e.jsxs("div",{className:"text-xs text-slate-500 font-mono",children:[t.metrics.timeElapsed.toFixed(1),"s"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx(ke,{state:t,color:"rose",maxVal:w}),e.jsx(ke,{state:a,color:"cyan",maxVal:w})]}),e.jsx(st,{history:d,nameA:y,nameB:C}),s==="finished"&&l&&e.jsx(nt,{stateA:t,stateB:a,winner:l,prediction:n,predictionCorrect:c,inputType:i,onReset:g})]})})}const ne=15,Z=25,lt=.25,rt=[{value:"random",label:"Random Scatter"},{value:"recursive-division",label:"Recursive Division"},{value:"dfs-maze",label:"DFS Maze"}];function Re(t,a){return`${t},${a}`}function it(){const t=[];for(let a=0;ac===a.row&&i===a.col||c===s.row&&i===s.col;function n(c,i,o,r,d){if(d){if(i-c<2)return;const m=[];for(let p=c+1;p.5)}function dt(t,a,s){for(let o=0;oMath.random()-.5);for(const[m,x]of d){const g=o+m,p=r+x;g>=0&&g=0&&p=0&&(t[s.row][s.col-1].type=D.EMPTY)}function ut(t="random"){const a=it(),s={row:Math.floor(ne/2),col:1},l={row:Math.floor(ne/2),col:Z-2};switch(t){case"recursive-division":ot(a,s,l);break;case"dfs-maze":dt(a,s,l);break;default:ct(a,s,l);break}return a[s.row][s.col].type=D.START,a[l.row][l.col].type=D.END,{grid:a,start:s,end:l}}function Te(t,a,s,l){const n=_e(l,t,a,s),c=n.visitedNodesInOrder,i=n.shortestPath,o=[],r=new Set;for(let d=0;d0){const d=new Set(r);for(let m=0;mRe(x.row,x.col)))})}return{steps:o,totalVisited:c.length,pathLength:i.length,found:i.length>0}}const de=[{value:"bfs",label:"BFS"},{value:"dfs",label:"DFS"},{value:"dijkstra",label:"Dijkstra"},{value:"astar",label:"A*"}],$e={bfs:{time:"O(V + E)",space:"O(V)",optimal:!0},dfs:{time:"O(V + E)",space:"O(V)",optimal:!1},dijkstra:{time:"O(V² / V+E log V)",space:"O(V)",optimal:!0},astar:{time:"O(E)",space:"O(V)",optimal:!0}};function Be({grid:t,step:a,algorithm:s,color:l,finished:n,totalVisited:c,pathLength:i,currentIndex:o,totalSteps:r}){const d=de.find(g=>g.value===s).label,x={rose:{visited:"bg-rose-500/40",path:"bg-rose-300",current:"bg-rose-400",label:"text-rose-400",badge:"bg-rose-500/15 text-rose-300 ring-rose-500/30",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"},cyan:{visited:"bg-cyan-500/40",path:"bg-cyan-300",current:"bg-cyan-400",label:"text-cyan-400",badge:"bg-cyan-500/15 text-cyan-300 ring-cyan-500/30",border:n?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"}}[l];return e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsx("span",{className:`text-xs font-bold ${x.label}`,children:d}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ${x.badge}`,children:n?"Finished":"Running"})]}),e.jsx("div",{className:`rounded-xl border border-slate-700/50 bg-slate-950/80 p-1 ${x.border} transition-all overflow-hidden`,children:e.jsx("div",{className:"grid",style:{gridTemplateColumns:`repeat(${Z}, 1fr)`,gap:"1px"},children:t.map((g,p)=>g.map((f,y)=>{const C=`${p},${y}`;let w="bg-slate-800/40";return f.type===D.WALL?w="bg-slate-600":f.type===D.START?w="bg-emerald-500":f.type===D.END?w="bg-amber-500":a&&(a.pathNodes.has(C)?w=x.path:a.currentNode&&a.currentNode.row===p&&a.currentNode.col===y?w=x.current:a.visitedSoFar.has(C)&&(w=x.visited)),e.jsx("div",{className:`aspect-square rounded-[1px] ${w} transition-colors duration-75`},C)}))})}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5 px-1",children:[e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Visited"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:c})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Path"}),e.jsx("div",{className:"text-xs font-mono font-bold text-white",children:i})]}),e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2 py-1.5 text-center",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Steps"}),e.jsxs("div",{className:"text-xs font-mono font-bold text-white",children:[o,"/",r]})]})]})]})}function xt({grid:t,stateA:a,stateB:s,status:l,winner:n,prediction:c,predictionCorrect:i,speed:o,soundEnabled:r,onPause:d,onResume:m,onReset:x,onSetSpeed:g,onToggleSound:p}){const f=l==="running",y=de.find(h=>h.value===a.algorithm).label,C=de.find(h=>h.value===s.algorithm).label,w=a.currentIndexp(!r),className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium ring-1 ${r?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-slate-700/40"}`,children:r?e.jsx(ge,{size:14}):e.jsx(fe,{size:14})})]}),l!=="finished"&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),me.map(h=>e.jsx("button",{onClick:()=>g(h.value),className:`rounded px-2 py-1 text-[10px] font-medium ${o===h.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-500 hover:bg-slate-700/50"}`,children:h.label},h.value))]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx(Be,{grid:t,step:w,algorithm:a.algorithm,color:"rose",finished:a.finished,totalVisited:a.totalVisited,pathLength:a.pathLength,currentIndex:a.currentIndex,totalSteps:a.steps.length}),e.jsx(Be,{grid:t,step:S,algorithm:s.algorithm,color:"cyan",finished:s.finished,totalVisited:s.totalVisited,pathLength:s.pathLength,currentIndex:s.currentIndex,totalSteps:s.steps.length})]}),l==="finished"&&n&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm space-y-4",children:[e.jsx("div",{className:"text-center",children:n==="tie"?e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-5 py-2 ring-1 ring-amber-500/20",children:[e.jsx(ye,{size:18,className:"text-amber-400"}),e.jsx("span",{className:"text-sm font-bold text-amber-300",children:"It's a Tie!"})]}):e.jsxs("div",{className:`inline-flex items-center gap-2 rounded-full px-5 py-2 ring-1 ${n==="A"?"bg-rose-500/10 ring-rose-500/20":"bg-cyan-500/10 ring-cyan-500/20"}`,children:[e.jsx(je,{size:18,className:n==="A"?"text-rose-400":"text-cyan-400"}),e.jsxs("span",{className:`text-sm font-bold ${n==="A"?"text-rose-300":"text-cyan-300"}`,children:[n==="A"?y:C," Wins!"]})]})}),c&&i!==null&&e.jsx("div",{className:`rounded-lg px-4 py-2.5 text-center text-xs font-medium ${i?"bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20":"bg-rose-500/10 text-rose-300 ring-1 ring-rose-500/20"}`,children:i?"🎯 Correct prediction!":"❌ Wrong prediction. Keep learning!"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-700/50",children:[e.jsx("th",{className:"py-2 text-left text-slate-500",children:"Metric"}),e.jsx("th",{className:"py-2 text-center text-rose-400 font-semibold",children:y}),e.jsx("th",{className:"py-2 text-center text-cyan-400 font-semibold",children:C})]})}),e.jsx("tbody",{className:"font-mono",children:[{label:"Nodes Visited",a:a.totalVisited,b:s.totalVisited},{label:"Path Length",a:a.pathLength,b:s.pathLength},{label:"Total Steps",a:a.steps.length,b:s.steps.length}].map(({label:h,a:z,b:B})=>e.jsxs("tr",{className:"border-b border-slate-800/50",children:[e.jsx("td",{className:"py-2 text-slate-400",children:h}),e.jsxs("td",{className:`py-2 text-center font-semibold ${z<=B?"text-emerald-300":"text-white"}`,children:[z,ze.jsxs("div",{className:"rounded-lg bg-slate-800/40 p-3",children:[e.jsx("h4",{className:`text-[10px] font-bold uppercase tracking-wider ${B==="rose"?"text-rose-400":"text-cyan-400"} mb-2`,children:h}),e.jsxs("div",{className:"space-y-1 text-[10px] font-mono",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Time"}),e.jsx("span",{className:"text-slate-300",children:z.time})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Space"}),e.jsx("span",{className:"text-slate-300",children:z.space})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Optimal"}),e.jsx("span",{className:z.optimal?"text-emerald-300":"text-rose-300",children:z.optimal?"Yes":"No"})]})]})]},h))}),e.jsxs("button",{onClick:x,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-slate-800/60 px-6 py-3 text-sm font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60 active:scale-[0.98]",children:[e.jsx(xe,{size:14})," New Battle"]})]})]})})}const Ne=[{value:"fibonacci",label:"Fibonacci",desc:"Compute the Nth Fibonacci number",inputLabel:"N",inputMin:5,inputMax:25,defaultN:15},{value:"factorial",label:"Factorial",desc:"Compute N! (N factorial)",inputLabel:"N",inputMin:3,inputMax:20,defaultN:10},{value:"staircase",label:"Staircase",desc:"Ways to climb N stairs (1 or 2 steps)",inputLabel:"Stairs",inputMin:5,inputMax:25,defaultN:15},{value:"coin-change",label:"Coin Change",desc:"Min coins to make amount N (coins: 1,3,5)",inputLabel:"Amount",inputMin:5,inputMax:30,defaultN:15}];function Ie(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i<=1)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:i,cacheSize:0}),i;const r=n(i-1,o+1)+n(i-2,o+1);return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function mt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r<=1)return c.set(r,r),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:r,cacheSize:c.size}),r;const m=i(r-1,d+1)+i(r-2,d+1);return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function pt(t){const a=[];let s=0;if(t<=1)return s=1,a.push({callCount:s,cacheHits:0,currentDepth:0,maxDepth:0,currentN:t,result:t,cacheSize:0}),{steps:a,finalResult:t,totalCalls:1,totalCacheHits:0,maxDepth:0};let l=0,n=1;for(let c=2;c<=t;c++){s++;const i=l+n;l=n,n=i,a.push({callCount:s,cacheHits:0,currentDepth:0,maxDepth:0,currentN:c,result:n,cacheSize:0})}return{steps:a,finalResult:n,totalCalls:s,totalCacheHits:0,maxDepth:0}}const ue=[{value:"naive",label:"Naive Recursive"},{value:"memoized",label:"Memoized"},{value:"iterative",label:"Iterative"}],De={naive:{time:"O(2ⁿ)",space:"O(n)"},memoized:{time:"O(n)",space:"O(n)"},iterative:{time:"O(n)",space:"O(1)"}};function ht(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i<=1)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:1,cacheSize:0}),1;const r=i*n(i-1,o+1);return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function gt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r<=1)return c.set(r,1),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:1,cacheSize:c.size}),1;const m=r*i(r-1,d+1);return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function ft(t){const a=[];let s=1;for(let l=2;l<=t;l++)s*=l,a.push({callCount:l-1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:l,result:s,cacheSize:0});return a.length===0&&a.push({callCount:1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:t,result:1,cacheSize:0}),{steps:a,finalResult:s,totalCalls:Math.max(t-1,1),totalCacheHits:0,maxDepth:0}}function bt(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i<=1)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:1,cacheSize:0}),1;const r=n(i-1,o+1)+n(i-2,o+1);return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function Nt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r<=1)return c.set(r,1),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:1,cacheSize:c.size}),1;const m=i(r-1,d+1)+i(r-2,d+1);return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function jt(t){const a=[];if(t<=1)return a.push({callCount:1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:t,result:1,cacheSize:0}),{steps:a,finalResult:1,totalCalls:1,totalCacheHits:0,maxDepth:0};let s=1,l=1;for(let n=2;n<=t;n++){const c=s+l;s=l,l=c,a.push({callCount:n-1,cacheHits:0,currentDepth:0,maxDepth:0,currentN:n,result:l,cacheSize:0})}return{steps:a,finalResult:l,totalCalls:t-1,totalCacheHits:0,maxDepth:0}}const Se=[1,3,5];function vt(t){const a=[];let s=0,l=0;function n(i,o){if(s++,l=Math.max(l,o),a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:null,cacheSize:0}),i===0)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:0,cacheSize:0}),0;if(i<0)return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:1/0,cacheSize:0}),1/0;let r=1/0;for(const d of Se){const m=n(i-d,o+1);m!==1/0&&(r=Math.min(r,m+1))}return a.push({callCount:s,cacheHits:0,currentDepth:o,maxDepth:l,currentN:i,result:r===1/0?-1:r,cacheSize:0}),r}const c=n(t,0);return{steps:a,finalResult:c===1/0?-1:c,totalCalls:s,totalCacheHits:0,maxDepth:l}}function yt(t){const a=[];let s=0,l=0,n=0;const c=new Map;function i(r,d){if(s++,n=Math.max(n,d),c.has(r)){l++;const x=c.get(r);return a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:x===1/0?-1:x,cacheSize:c.size}),x}if(a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:null,cacheSize:c.size}),r===0)return c.set(0,0),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:0,cacheSize:c.size}),0;if(r<0)return 1/0;let m=1/0;for(const x of Se){const g=i(r-x,d+1);g!==1/0&&(m=Math.min(m,g+1))}return c.set(r,m),a.push({callCount:s,cacheHits:l,currentDepth:d,maxDepth:n,currentN:r,result:m===1/0?-1:m,cacheSize:c.size}),m}const o=i(t,0);return{steps:a,finalResult:o===1/0?-1:o,totalCalls:s,totalCacheHits:l,maxDepth:n}}function St(t){const a=[],s=new Array(t+1).fill(1/0);s[0]=0;let l=0;for(let n=1;n<=t;n++){for(const c of Se)n>=c&&s[n-c]+1r.value===t.algorithm).label,n=t.currentIndex0?t.currentIndex/c*100:0,o=a==="rose"?{label:"text-rose-400",badge:"bg-rose-500/15 text-rose-300 ring-rose-500/30",bar:"bg-rose-500",border:t.finished?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"}:{label:"text-cyan-400",badge:"bg-cyan-500/15 text-cyan-300 ring-cyan-500/30",bar:"bg-cyan-500",border:t.finished?"ring-2 ring-emerald-500/50":"ring-1 ring-slate-700/50"};return e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsx("span",{className:`text-xs font-bold ${o.label}`,children:l}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ${o.badge}`,children:t.finished?"Finished":"Running"})]}),e.jsxs("div",{className:`rounded-xl border border-slate-700/50 bg-slate-950/80 p-3 ${o.border} transition-all`,children:[e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Function Calls"}),e.jsxs("span",{className:"text-[10px] font-mono text-slate-400",children:[n?n.callCount:0," / ",t.totalCalls]})]}),e.jsx("div",{className:"h-4 rounded-full bg-slate-800/60 overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${o.bar} transition-all duration-75`,style:{width:`${i}%`}})})]}),e.jsxs("div",{className:"mb-2",children:[e.jsx("span",{className:"text-[10px] text-slate-500 block mb-1",children:"Stack Depth"}),e.jsx("div",{className:"flex items-end gap-px h-16",children:Array.from({length:Math.max(n?.maxDepth||1,1)},(r,d)=>{const m=n?dS.value===t.algorithm).label,C=ue.find(S=>S.value===a.algorithm).label,w=wt[r];return e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s!=="finished"&&e.jsxs("button",{onClick:f?d:m,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60",children:[f?e.jsx(ve,{size:14}):e.jsx(be,{size:14}),f?"Pause":"Resume"]}),e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60",children:[e.jsx(xe,{size:14})," Reset"]}),e.jsx("button",{onClick:()=>p(!o),className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium ring-1 ${o?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-slate-700/40"}`,children:o?e.jsx(ge,{size:14}):e.jsx(fe,{size:14})})]}),s!=="finished"&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),me.map(S=>e.jsx("button",{onClick:()=>g(S.value),className:`rounded px-2 py-1 text-[10px] font-medium ${i===S.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-500 hover:bg-slate-700/50"}`,children:S.label},S.value))]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsx(Pe,{state:t,color:"rose",funcName:w}),e.jsx(Pe,{state:a,color:"cyan",funcName:w})]}),s==="finished"&&l&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm space-y-4",children:[e.jsx("div",{className:"text-center",children:l==="tie"?e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-amber-500/10 px-5 py-2 ring-1 ring-amber-500/20",children:[e.jsx(ye,{size:18,className:"text-amber-400"}),e.jsx("span",{className:"text-sm font-bold text-amber-300",children:"It's a Tie!"})]}):e.jsxs("div",{className:`inline-flex items-center gap-2 rounded-full px-5 py-2 ring-1 ${l==="A"?"bg-rose-500/10 ring-rose-500/20":"bg-cyan-500/10 ring-cyan-500/20"}`,children:[e.jsx(je,{size:18,className:l==="A"?"text-rose-400":"text-cyan-400"}),e.jsxs("span",{className:`text-sm font-bold ${l==="A"?"text-rose-300":"text-cyan-300"}`,children:[l==="A"?y:C," Wins!"]})]})}),n&&c!==null&&e.jsx("div",{className:`rounded-lg px-4 py-2.5 text-center text-xs font-medium ${c?"bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20":"bg-rose-500/10 text-rose-300 ring-1 ring-rose-500/20"}`,children:c?"🎯 Correct prediction!":"❌ Wrong prediction. Keep learning!"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-700/50",children:[e.jsx("th",{className:"py-2 text-left text-slate-500",children:"Metric"}),e.jsx("th",{className:"py-2 text-center text-rose-400 font-semibold",children:y}),e.jsx("th",{className:"py-2 text-center text-cyan-400 font-semibold",children:C})]})}),e.jsx("tbody",{className:"font-mono",children:[{label:"Total Calls",a:t.totalCalls,b:a.totalCalls},{label:"Cache Hits",a:t.totalCacheHits,b:a.totalCacheHits},{label:"Max Stack Depth",a:t.maxDepth,b:a.maxDepth},{label:"Total Steps",a:t.steps.length,b:a.steps.length}].map(({label:S,a:h,b:z})=>e.jsxs("tr",{className:"border-b border-slate-800/50",children:[e.jsx("td",{className:"py-2 text-slate-400",children:S}),e.jsxs("td",{className:`py-2 text-center font-semibold ${h<=z?"text-emerald-300":"text-white"}`,children:[h,he.jsxs("div",{className:"rounded-lg bg-slate-800/40 p-3",children:[e.jsx("h4",{className:`text-[10px] font-bold uppercase tracking-wider ${z==="rose"?"text-rose-400":"text-cyan-400"} mb-2`,children:S}),e.jsxs("div",{className:"space-y-1 text-[10px] font-mono",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Time"}),e.jsx("span",{className:"text-slate-300",children:h.time})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Space"}),e.jsx("span",{className:"text-slate-300",children:h.space})]})]})]},S))}),e.jsxs("div",{className:"rounded-lg bg-indigo-500/5 px-4 py-3 ring-1 ring-indigo-500/15",children:[e.jsx("h4",{className:"text-[10px] font-bold uppercase tracking-wider text-indigo-400 mb-1",children:"Why?"}),e.jsxs("p",{className:"text-xs text-slate-400 leading-relaxed",children:[t.totalCalls>a.totalCalls?`${y} made ${t.totalCalls} function calls compared to ${C}'s ${a.totalCalls}. `:a.totalCalls>t.totalCalls?`${C} made ${a.totalCalls} function calls compared to ${y}'s ${t.totalCalls}. `:`Both made ${t.totalCalls} calls. `,r==="factorial"?"Factorial is inherently linear — naive and memoized perform similarly. The iterative version avoids stack overhead.":r==="coin-change"?"Naive coin change explores all combinations (branching factor 3), while memoization caches sub-amounts to avoid redundant work. Iterative DP builds the table bottom-up.":"Naive recursion recalculates the same subproblems exponentially (O(2ⁿ)), while memoization caches results reducing to O(n). The iterative approach avoids recursion overhead entirely with O(1) space."]})]}),e.jsxs("button",{onClick:x,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-slate-800/60 px-6 py-3 text-sm font-medium text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/60 active:scale-[0.98]",children:[e.jsx(xe,{size:14})," New Battle"]})]})]})})}const Fe=[261.63,293.66,329.63,392,440,523.25,587.33,659.25,783.99,880];function we(){const t=u.useRef(!0),a=u.useCallback(()=>qe(),[]),s=u.useCallback(i=>{t.current=i},[]),l=u.useCallback((i,o,r)=>{if(!t.current)return;const d=a();if(!d)return;const m=i/Math.max(o-1,1),x=Fe[Math.floor(m*(Fe.length-1))],g=d.createOscillator(),p=d.createGain(),f=d.createStereoPanner();g.type="sine",g.frequency.value=x,p.gain.setValueAtTime(.04,d.currentTime),p.gain.exponentialRampToValueAtTime(.001,d.currentTime+.08),f.pan.value=r,g.connect(p),p.connect(f),f.connect(d.destination),g.start(),g.stop(d.currentTime+.08)},[a]),n=u.useCallback((i,o,r)=>{if(!t.current)return;const d=a();if(!d)return;const x=200+i/Math.max(o-1,1)*600,g=d.createOscillator(),p=d.createGain(),f=d.createStereoPanner();g.type="triangle",g.frequency.value=x,p.gain.setValueAtTime(.06,d.currentTime),p.gain.exponentialRampToValueAtTime(.001,d.currentTime+.1),f.pan.value=r,g.connect(p),p.connect(f),f.connect(d.destination),g.start(),g.stop(d.currentTime+.1)},[a]),c=u.useCallback(()=>{if(!t.current)return;const i=a();i&&[523.25,659.25,783.99].forEach((o,r)=>{const d=i.createOscillator(),m=i.createGain();d.type="sine",d.frequency.value=o,m.gain.setValueAtTime(.1,i.currentTime+r*.12),m.gain.exponentialRampToValueAtTime(.001,i.currentTime+r*.12+.2),d.connect(m),m.connect(i.destination),d.start(i.currentTime+r*.12),d.stop(i.currentTime+r*.12+.2)})},[a]);return{playCompareTone:l,playSwapTone:n,playWinTone:c,setEnabled:s}}function te(t,a){let s=0,l=0,n=0;for(let c=0;c<=a&&c{y(j),ie(j)},[ie]),Q=u.useCallback(()=>{L.current&&(cancelAnimationFrame(L.current),L.current=null)},[]),A=u.useCallback(()=>{const j=Ue(n,i);ae(j);const b=Me(t,[...j]),v=Me(s,[...j]);P.current=b,F.current=v,E.current=0,H.current=0;const T=te(b,0),V=te(v,0);if(w(se(t,b[0],T,0,b.length,!1)),h(se(s,v[0],V,0,v.length,!1)),B(null),G(null),_([{stepA:0,stepB:0,opsA:0,opsB:0}]),ee.current=performance.now(),r==="turbo"){const le=te(b,b.length-1),U=te(v,v.length-1);le.timeElapsed=0,U.timeElapsed=0;const oe=b[b.length-1],pe=v[v.length-1];w(se(t,oe,le,b.length-1,b.length,!0)),h(se(s,pe,U,v.length-1,v.length,!0));let I="tie";le.totalSteps{const j=P.current,b=F.current;let v=E.current,T=H.current;const V=v>=j.length-1,le=T>=b.length-1;if(V&&le){const I=te(j,v),Ce=te(b,T),Ae=(performance.now()-ee.current)/1e3;I.timeElapsed=Ae,Ce.timeElapsed=Ae,w(se(t,j[v],I,v,j.length,!0)),h(se(s,b[T],Ce,T,b.length,!0));let he="tie";j.length=j.length-1)),h(se(s,b[T],oe,T,b.length,T>=b.length-1)),_(I=>[...I,{stepA:U.stepsCompleted,stepB:oe.stepsCompleted,opsA:U.totalOperations,opsB:oe.totalOperations}])},[t,s,n,f,$,q,Y,W]);u.useEffect(()=>{if(g!=="running"){Q();return}let j=0;const b=v=>{v-j>=m&&(j=v,k()),L.current=requestAnimationFrame(b)};return L.current=requestAnimationFrame(b),Q},[g,m,k,Q]);const N=u.useCallback(()=>{g==="running"&&p("paused")},[g]),M=u.useCallback(()=>{g==="paused"&&p("running")},[g]),R=u.useCallback(()=>{Q(),P.current=[],F.current=[],E.current=0,H.current=0,w(null),h(null),B(null),O(null),G(null),_([]),p("setup")},[Q]);return{algorithmA:t,setAlgorithmA:a,algorithmB:s,setAlgorithmB:l,inputSize:n,setInputSize:c,inputType:i,setInputType:o,gameMode:r,setGameMode:d,speed:m,setSpeed:x,status:g,soundEnabled:f,toggleSound:ce,stateA:C,stateB:S,winner:z,prediction:$,setPrediction:O,predictionCorrect:re,inputData:K,metricsHistory:J,startBattle:A,pause:N,resume:M,reset:R}}function Mt(){const[t,a]=u.useState("bfs"),[s,l]=u.useState("dfs"),[n,c]=u.useState("random"),[i,o]=u.useState("realtime"),[r,d]=u.useState(50),[m,x]=u.useState("setup"),[g,p]=u.useState(!0),[f,y]=u.useState(null),[C,w]=u.useState(null),[S,h]=u.useState(null),[z,B]=u.useState(null),[$,O]=u.useState(null),[re,G]=u.useState(null),K=u.useRef([]),ae=u.useRef([]),J=u.useRef(0),_=u.useRef(0),P=u.useRef(null),F=u.useRef({totalVisited:0,pathLength:0,found:!1}),E=u.useRef({totalVisited:0,pathLength:0,found:!1}),{playCompareTone:H,playWinTone:L,setEnabled:ee}=we(),q=u.useCallback(N=>{p(N),ee(N)},[ee]),Y=u.useCallback(()=>{P.current&&(cancelAnimationFrame(P.current),P.current=null)},[]),W=u.useCallback((N,M)=>{let R="tie";return N.found&&!M.found?R="A":!N.found&&M.found?R="B":N.found&&M.found&&(N.totalVisited{const{grid:N,start:M,end:R}=ut(n);y(N);const j=Te(N,M,R,t),b=Te(N,M,R,s);K.current=j.steps,ae.current=b.steps,J.current=0,_.current=0,F.current={totalVisited:j.totalVisited,pathLength:j.pathLength,found:j.found},E.current={totalVisited:b.totalVisited,pathLength:b.pathLength,found:b.found};const v={algorithm:t,steps:j.steps,currentIndex:0,totalVisited:j.totalVisited,pathLength:j.pathLength,found:j.found,finished:!1},T={algorithm:s,steps:b.steps,currentIndex:0,totalVisited:b.totalVisited,pathLength:b.pathLength,found:b.found,finished:!1};if(i==="turbo"){w({...v,currentIndex:j.steps.length-1,finished:!0}),h({...T,currentIndex:b.steps.length-1,finished:!0});const V=W(F.current,E.current);B(V),$&&G($===V),x("finished"),L();return}w(v),h(T),B(null),G(null),x("running")},[t,s,n,i,$,W,L]),ce=u.useCallback(()=>{let N=J.current,M=_.current;const R=K.current,j=ae.current,b=N>=R.length-1,v=M>=j.length-1;if(b&&v){w(V=>V?{...V,currentIndex:N,finished:!0}:null),h(V=>V?{...V,currentIndex:M,finished:!0}:null);const T=W(F.current,E.current);B(T),$&&G($===T),x("finished"),L();return}b||(N++,J.current=N,g&&H(N,R.length,-.8)),v||(M++,_.current=M,g&&H(M,j.length,.8)),w(T=>T?{...T,currentIndex:N,finished:N>=R.length-1}:null),h(T=>T?{...T,currentIndex:M,finished:M>=j.length-1}:null)},[g,$,W,H,L]);u.useEffect(()=>{if(m!=="running"){Y();return}let N=0;const M=R=>{R-N>=r&&(N=R,ce()),P.current=requestAnimationFrame(M)};return P.current=requestAnimationFrame(M),Y},[m,r,ce,Y]);const Q=u.useCallback(()=>{m==="running"&&x("paused")},[m]),A=u.useCallback(()=>{m==="paused"&&x("running")},[m]),k=u.useCallback(()=>{Y(),y(null),w(null),h(null),B(null),O(null),G(null),x("setup")},[Y]);return{algorithmA:t,setAlgorithmA:a,algorithmB:s,setAlgorithmB:l,mazeType:n,setMazeType:c,gameMode:i,setGameMode:o,speed:r,setSpeed:d,status:m,soundEnabled:g,toggleSound:q,grid:f,stateA:C,stateB:S,winner:z,prediction:$,setPrediction:O,predictionCorrect:re,startBattle:ie,pause:Q,resume:A,reset:k}}function zt(){const[t,a]=u.useState("naive"),[s,l]=u.useState("memoized"),[n,c]=u.useState("fibonacci"),[i,o]=u.useState(15),r=u.useCallback(A=>{c(A);const k=Ne.find(N=>N.value===A);k&&o(k.defaultN)},[]),[d,m]=u.useState("realtime"),[x,g]=u.useState(50),[p,f]=u.useState("setup"),[y,C]=u.useState(!0),[w,S]=u.useState(null),[h,z]=u.useState(null),[B,$]=u.useState(null),[O,re]=u.useState(null),[G,K]=u.useState(null),ae=u.useRef([]),J=u.useRef([]),_=u.useRef(0),P=u.useRef(0),F=u.useRef(null),{playCompareTone:E,playWinTone:H,setEnabled:L}=we(),ee=u.useCallback(A=>{C(A),L(A)},[L]),q=u.useCallback(()=>{F.current&&(cancelAnimationFrame(F.current),F.current=null)},[]),Y=u.useCallback(()=>{const A=Oe(t,i,n),k=Oe(s,i,n);ae.current=A.steps,J.current=k.steps,_.current=0,P.current=0;const N={algorithm:t,steps:A.steps,currentIndex:0,totalCalls:A.totalCalls,totalCacheHits:A.totalCacheHits,maxDepth:A.maxDepth,finalResult:A.finalResult,finished:!1},M={algorithm:s,steps:k.steps,currentIndex:0,totalCalls:k.totalCalls,totalCacheHits:k.totalCacheHits,maxDepth:k.maxDepth,finalResult:k.finalResult,finished:!1};if(d==="turbo"){S({...N,currentIndex:A.steps.length-1,finished:!0}),z({...M,currentIndex:k.steps.length-1,finished:!0});let R="tie";A.totalCalls{let A=_.current,k=P.current;const N=ae.current,M=J.current,R=A>=N.length-1,j=k>=M.length-1;if(R&&j){S(v=>v?{...v,currentIndex:A,finished:!0}:null),z(v=>v?{...v,currentIndex:k,finished:!0}:null);let b="tie";N.lengthb?{...b,currentIndex:A,finished:A>=N.length-1}:null),z(b=>b?{...b,currentIndex:k,finished:k>=M.length-1}:null)},[y,O,E,H]);u.useEffect(()=>{if(p!=="running"){q();return}let A=0;const k=N=>{N-A>=x&&(A=N,W()),F.current=requestAnimationFrame(k)};return F.current=requestAnimationFrame(k),q},[p,x,W,q]);const ie=u.useCallback(()=>{p==="running"&&f("paused")},[p]),ce=u.useCallback(()=>{p==="paused"&&f("running")},[p]),Q=u.useCallback(()=>{q(),S(null),z(null),$(null),re(null),K(null),f("setup")},[q]);return{algorithmA:t,setAlgorithmA:a,algorithmB:s,setAlgorithmB:l,problem:n,changeProblem:r,inputN:i,setInputN:o,gameMode:d,setGameMode:m,speed:x,setSpeed:g,status:p,soundEnabled:y,toggleSound:ee,stateA:w,stateB:h,winner:B,prediction:O,setPrediction:re,predictionCorrect:G,startBattle:Y,pause:ie,resume:ce,reset:Q}}const kt=[{value:"sorting",label:"Sorting",desc:"Bubble, Quick, Merge & more",icon:Ke},{value:"pathfinding",label:"Pathfinding",desc:"BFS, DFS, Dijkstra, A*",icon:Ee},{value:"recursion",label:"Recursion",desc:"Fibonacci, Factorial, Staircase & more",icon:Ve}];function Rt({onSelect:t}){return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center justify-center px-6 pt-10 pb-6 text-center",children:[e.jsxs("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full bg-rose-500/10 px-4 py-1.5 ring-1 ring-rose-500/20",children:[e.jsx(Le,{size:14,className:"text-rose-400"}),e.jsx("span",{className:"text-xs font-medium text-rose-300",children:"Algorithm Battles"})]}),e.jsxs("h2",{className:"text-2xl font-extrabold tracking-tight text-white",children:["Choose Your ",e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-cyan-400 bg-clip-text text-transparent",children:"Arena"})]}),e.jsx("p",{className:"mt-2 max-w-md text-sm text-slate-400",children:"Pick a battle category to pit two algorithms head-to-head."})]}),e.jsx("section",{className:"px-4 pb-10",children:e.jsx("div",{className:"mx-auto max-w-lg grid grid-cols-1 gap-3",children:kt.map(({value:a,label:s,desc:l,icon:n})=>e.jsxs("button",{onClick:()=>t(a),className:"group flex items-center gap-4 rounded-xl border border-slate-700/50 bg-slate-900/60 p-5 text-left backdrop-blur-sm transition-all hover:border-slate-600/60 hover:bg-slate-900/80 hover:scale-[1.01] active:scale-[0.99]",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-rose-500/20 to-cyan-500/20 ring-1 ring-white/10",children:e.jsx(n,{size:22,className:"text-white"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-bold text-white",children:[s," Battles"]}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:l})]})]},a))})})]})}function Tt({battle:t}){const a=de.find(l=>l.value===t.algorithmA).label,s=de.find(l=>l.value===t.algorithmB).label;return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center px-6 pt-8 pb-4 text-center",children:[e.jsxs("h2",{className:"text-2xl font-extrabold text-white",children:[e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-orange-400 bg-clip-text text-transparent",children:a})," ","vs"," ",e.jsx("span",{className:"bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent",children:s})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"Race to find a path on the same random grid"})]}),e.jsx("section",{className:"px-4 pb-8",children:e.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:["A","B"].map(l=>e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsxs("h3",{className:`text-xs font-semibold uppercase tracking-wider ${l==="A"?"text-rose-400":"text-cyan-400"} mb-3`,children:["Algorithm ",l]}),e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:de.map(n=>e.jsx("button",{onClick:()=>l==="A"?t.setAlgorithmA(n.value):t.setAlgorithmB(n.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${(l==="A"?t.algorithmA:t.algorithmB)===n.value?l==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:n.label},n.value))})]},l))}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Maze Type"}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:rt.map(l=>e.jsx("button",{onClick:()=>t.setMazeType(l.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${t.mazeType===l.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:l.label},l.value))})]}),e.jsx(We,{gameMode:t.gameMode,setGameMode:t.setGameMode,speed:t.speed,setSpeed:t.setSpeed,soundEnabled:t.soundEnabled,toggleSound:t.toggleSound,prediction:t.prediction,setPrediction:t.setPrediction,nameA:a,nameB:s}),e.jsxs("button",{onClick:t.startBattle,disabled:t.gameMode==="prediction"&&!t.prediction,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-rose-500/20 to-cyan-500/20 px-6 py-4 text-base font-bold text-white ring-1 ring-white/10 transition-all hover:from-rose-500/30 hover:to-cyan-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ee,{size:18,className:"text-rose-300"})," Start Battle"]})]})})]})}function $t({battle:t}){const a=ue.find(n=>n.value===t.algorithmA).label,s=ue.find(n=>n.value===t.algorithmB).label,l=Ne.find(n=>n.value===t.problem);return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center px-6 pt-8 pb-4 text-center",children:[e.jsxs("h2",{className:"text-2xl font-extrabold text-white",children:[e.jsx("span",{className:"bg-gradient-to-r from-rose-400 to-orange-400 bg-clip-text text-transparent",children:a})," ","vs"," ",e.jsx("span",{className:"bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent",children:s})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:l.desc})]}),e.jsx("section",{className:"px-4 pb-8",children:e.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Problem"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-1.5",children:Ne.map(n=>e.jsxs("button",{onClick:()=>t.changeProblem(n.value),className:`rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${t.problem===n.value?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:[e.jsx("span",{className:"block font-semibold",children:n.label}),e.jsx("span",{className:"block text-[9px] text-slate-500 mt-0.5",children:n.desc})]},n.value))})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:["A","B"].map(n=>e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsxs("h3",{className:`text-xs font-semibold uppercase tracking-wider ${n==="A"?"text-rose-400":"text-cyan-400"} mb-3`,children:["Algorithm ",n]}),e.jsx("div",{className:"space-y-1.5",children:ue.map(c=>e.jsx("button",{onClick:()=>n==="A"?t.setAlgorithmA(c.value):t.setAlgorithmB(c.value),className:`w-full rounded-lg px-3 py-2 text-[11px] font-medium transition-all text-left ${(n==="A"?t.algorithmA:t.algorithmB)===c.value?n==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:c.label},c.value))})]},n))}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Input"}),e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-slate-500",children:l.inputLabel}),e.jsx("span",{className:"text-sm font-mono font-bold text-indigo-300",children:t.inputN})]}),e.jsx("input",{type:"range",min:l.inputMin,max:l.inputMax,value:t.inputN,onChange:n=>t.setInputN(Number(n.target.value)),className:"w-full accent-indigo-500"}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:t.problem==="fibonacci"||t.problem==="staircase"?"⚠️ Naive recursive is exponential — large N generates many steps":t.problem==="coin-change"?"⚠️ Naive coin change branches 3 ways per call — grows very fast":"⚠️ Factorial is linear — naive and memoized are similar here"})]}),e.jsx(We,{gameMode:t.gameMode,setGameMode:t.setGameMode,speed:t.speed,setSpeed:t.setSpeed,soundEnabled:t.soundEnabled,toggleSound:t.toggleSound,prediction:t.prediction,setPrediction:t.setPrediction,nameA:a,nameB:s}),e.jsxs("button",{onClick:t.startBattle,disabled:t.gameMode==="prediction"&&!t.prediction,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-rose-500/20 to-cyan-500/20 px-6 py-4 text-base font-bold text-white ring-1 ring-white/10 transition-all hover:from-rose-500/30 hover:to-cyan-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ve,{size:18,className:"text-rose-300"})," Start Battle"]})]})})]})}function We({gameMode:t,setGameMode:a,speed:s,setSpeed:l,soundEnabled:n,toggleSound:c,prediction:i,setPrediction:o,nameA:r,nameB:d}){const m=[{value:"realtime",label:"Real-Time"},{value:"turbo",label:"Turbo"},{value:"prediction",label:"Prediction"}];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Game Mode"}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:m.map(x=>e.jsx("button",{onClick:()=>a(x.value),className:`rounded-lg px-2 py-2 text-[11px] font-semibold transition-all ${t===x.value?"bg-violet-500/20 text-violet-300 ring-1 ring-violet-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:x.label},x.value))})]}),t==="prediction"&&e.jsxs("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400 mb-3",children:"Your Prediction"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>o("A"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${i==="A"?"bg-rose-500/20 text-rose-300 ring-1 ring-rose-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:r}),e.jsx("button",{onClick:()=>o("B"),className:`flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all ${i==="B"?"bg-cyan-500/20 text-cyan-300 ring-1 ring-cyan-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:d})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1 rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Speed"}),e.jsx("div",{className:"flex gap-1.5",children:me.map(x=>e.jsx("button",{onClick:()=>l(x.value),className:`flex-1 rounded-lg px-2 py-2 text-[11px] font-medium transition-all ${s===x.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50"}`,children:x.label},x.value))})]}),e.jsxs("button",{onClick:()=>c(!n),className:`shrink-0 flex flex-col items-center justify-center rounded-xl px-4 transition-all ${n?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/60 text-slate-500 ring-1 ring-slate-700/40"}`,children:[n?"🔊":"🔇",e.jsx("span",{className:"text-[10px] mt-1",children:n?"On":"Off"})]})]})]})}function _t(){const[t,a]=u.useState(null),s=At(),l=Mt(),n=zt(),c=()=>{s.reset(),l.reset(),n.reset(),a(null)};if(!t)return e.jsx(Rt,{onSelect:a});const i=e.jsxs("button",{onClick:c,className:"fixed top-16 left-4 z-10 flex items-center gap-1 rounded-lg bg-slate-800/80 px-3 py-1.5 text-xs font-medium text-slate-400 ring-1 ring-slate-700/50 backdrop-blur-sm hover:bg-slate-700/80 hover:text-slate-300",children:[e.jsx(Ye,{size:12})," Back"]});if(t==="sorting"){if(s.status==="setup")return e.jsxs(e.Fragment,{children:[i,e.jsx(tt,{algorithmA:s.algorithmA,algorithmB:s.algorithmB,inputSize:s.inputSize,inputType:s.inputType,gameMode:s.gameMode,speed:s.speed,soundEnabled:s.soundEnabled,prediction:s.prediction,onSetAlgorithmA:s.setAlgorithmA,onSetAlgorithmB:s.setAlgorithmB,onSetInputSize:s.setInputSize,onSetInputType:s.setInputType,onSetGameMode:s.setGameMode,onSetSpeed:s.setSpeed,onToggleSound:s.toggleSound,onSetPrediction:s.setPrediction,onStart:s.startBattle})]});if(s.stateA&&s.stateB)return e.jsxs(e.Fragment,{children:[i,e.jsx(at,{stateA:s.stateA,stateB:s.stateB,status:s.status,winner:s.winner,prediction:s.prediction,predictionCorrect:s.predictionCorrect,inputType:s.inputType,speed:s.speed,soundEnabled:s.soundEnabled,metricsHistory:s.metricsHistory,onPause:s.pause,onResume:s.resume,onReset:s.reset,onSetSpeed:s.setSpeed,onToggleSound:s.toggleSound})]})}if(t==="pathfinding"){if(l.status==="setup")return e.jsxs(e.Fragment,{children:[i,e.jsx(Tt,{battle:l})]});if(l.stateA&&l.stateB&&l.grid)return e.jsxs(e.Fragment,{children:[i,e.jsx(xt,{grid:l.grid,stateA:l.stateA,stateB:l.stateB,status:l.status,winner:l.winner,prediction:l.prediction,predictionCorrect:l.predictionCorrect,speed:l.speed,soundEnabled:l.soundEnabled,onPause:l.pause,onResume:l.resume,onReset:l.reset,onSetSpeed:l.setSpeed,onToggleSound:l.toggleSound})]})}if(t==="recursion"){if(n.status==="setup")return e.jsxs(e.Fragment,{children:[i,e.jsx($t,{battle:n})]});if(n.stateA&&n.stateB)return e.jsxs(e.Fragment,{children:[i,e.jsx(Ct,{stateA:n.stateA,stateB:n.stateB,status:n.status,winner:n.winner,prediction:n.prediction,predictionCorrect:n.predictionCorrect,speed:n.speed,soundEnabled:n.soundEnabled,problem:n.problem,onPause:n.pause,onResume:n.resume,onReset:n.reset,onSetSpeed:n.setSpeed,onToggleSound:n.toggleSound})]})}return null}export{_t as default}; diff --git a/docs/assets/DijkstraGamePage-DHV7Q9c2.js b/docs/assets/DijkstraGamePage-aIRKpG_-.js similarity index 98% rename from docs/assets/DijkstraGamePage-DHV7Q9c2.js rename to docs/assets/DijkstraGamePage-aIRKpG_-.js index f2a0642..4bc56d7 100644 --- a/docs/assets/DijkstraGamePage-DHV7Q9c2.js +++ b/docs/assets/DijkstraGamePage-aIRKpG_-.js @@ -1 +1 @@ -import{c as Ge,r as x,j as e,E as Ve}from"./index-lLadk08S.js";import{M as Be}from"./map-C5ZomysO.js";import{S as Fe}from"./shuffle-ADbBlETg.js";import{C as Oe,a as _e}from"./chevron-right-Cp_zyb7b.js";import{P as Le}from"./pause-CU46RSeo.js";import{P as Pe}from"./play-b2ZiatJ3.js";import{R as ue}from"./route-DiDkH3-5.js";import{T as qe}from"./timer-Baa2rAz8.js";import{T as We}from"./trophy-BeLgwZ5q.js";import{R as He}from"./rotate-ccw-DMjSdzg2.js";import{E as Ue}from"./eye-off-Pd9-Vzxg.js";import{V as Ye,a as Qe}from"./volume-x-CjLNPeax.js";import{g as Ze}from"./audioContext-NbgqvQGz.js";const Xe=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Je=Ge("undo-2",Xe),L=20,Ke=["#1e293b","#0f3b3f","#312e81","#3b2416","#064e3b"];function et({graph:s,startNode:n,endNode:d,playerPath:r,optimalPath:f,showOptimal:l,currentAlgoStep:p,selectingPhase:j,onClickNode:a}){const i=x.useMemo(()=>{const t=new Set;for(let o=0;o{const t=new Set;if(l)for(let o=0;o{const t={};for(const o of s.nodes)t[o.id]={x:o.x,y:o.y};return t},[s.nodes]),A=j==="start"||j==="end"?"cursor-crosshair":"cursor-pointer",z=j==="start"?"Click an intersection to set START DEPOT":j==="end"?"Click an intersection to set DELIVERY DESTINATION":null,$=[...p?.queue??[]].sort((t,o)=>t.distance-o.distance).slice(0,5),C={intersections:s.nodes.length,roads:s.edges.length,avgTraffic:s.edges.length?Math.round(s.edges.reduce((t,o)=>t+o.weight,0)/s.edges.length):0};return e.jsxs("div",{className:`relative flex-1 w-full overflow-hidden rounded-[1.5rem] border border-slate-700/50 bg-slate-950/90 p-3 shadow-2xl shadow-black/40 backdrop-blur-sm ${A}`,children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_20%_10%,rgba(56,189,248,0.14),transparent_28%),radial-gradient(circle_at_80%_80%,rgba(34,197,94,0.1),transparent_30%)]"}),z&&e.jsx("div",{className:"absolute top-5 left-1/2 z-20 -translate-x-1/2 rounded-full bg-slate-950/90 px-4 py-2 text-xs font-semibold uppercase tracking-wide text-sky-200 ring-1 ring-sky-500/30 shadow-xl shadow-sky-950/40 animate-pulse",children:z}),e.jsxs("div",{className:"absolute left-5 top-5 z-10 rounded-2xl border border-slate-700/60 bg-slate-950/85 px-4 py-3 shadow-xl shadow-black/30 backdrop-blur-sm",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-slate-500",children:"City Routing Map"}),e.jsxs("div",{className:"mt-2 flex gap-3 text-[11px] text-slate-300",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"font-mono text-white",children:C.intersections})," intersections"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-mono text-white",children:C.roads})," roads"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-mono text-white",children:C.avgTraffic})," avg min"]})]})]}),e.jsxs("div",{className:"absolute right-5 top-5 z-10 hidden rounded-2xl border border-slate-700/60 bg-slate-950/85 px-4 py-3 shadow-xl shadow-black/30 backdrop-blur-sm sm:block",children:[e.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Legend"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 text-[10px] text-slate-400",children:[e.jsx(F,{color:"bg-yellow-300",label:"Depot"}),e.jsx(F,{color:"bg-orange-400",label:"Dropoff"}),e.jsx(F,{color:"bg-indigo-400",label:"Your route"}),e.jsx(F,{color:"bg-emerald-400",label:"Best route"}),e.jsx(F,{color:"bg-sky-400",label:"Scanning"}),e.jsx(F,{color:"bg-slate-500",label:"Unvisited"})]})]}),p&&e.jsxs("div",{className:"absolute bottom-5 left-5 z-10 max-w-sm rounded-2xl border border-slate-700/60 bg-slate-950/90 p-4 shadow-xl shadow-black/35 backdrop-blur-sm",children:[e.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-300",children:"Dijkstra Live Scan"}),e.jsx("p",{className:"text-xs leading-relaxed text-slate-300",children:p.description}),$.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:$.map(t=>e.jsxs("span",{className:"rounded-full bg-sky-500/10 px-2 py-1 text-[10px] font-mono font-semibold text-sky-300 ring-1 ring-sky-500/25",children:[t.id,": ",t.distance]},t.id))})]}),e.jsxs("svg",{viewBox:"0 0 820 400",className:"relative z-0 h-full w-full rounded-[1.15rem]",preserveAspectRatio:"xMidYMid meet",children:[e.jsxs("defs",{children:[e.jsx("pattern",{id:"dijkstra-grid",width:"32",height:"32",patternUnits:"userSpaceOnUse",children:e.jsx("path",{d:"M32 0H0V32",fill:"none",stroke:"#334155",strokeWidth:"0.7",opacity:"0.24"})}),e.jsxs("filter",{id:"soft-glow",x:"-40%",y:"-40%",width:"180%",height:"180%",children:[e.jsx("feGaussianBlur",{stdDeviation:"4",result:"blur"}),e.jsxs("feMerge",{children:[e.jsx("feMergeNode",{in:"blur"}),e.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),e.jsx("filter",{id:"pin-shadow",x:"-60%",y:"-60%",width:"220%",height:"220%",children:e.jsx("feDropShadow",{dx:"0",dy:"7",stdDeviation:"5",floodColor:"#020617",floodOpacity:"0.65"})})]}),e.jsx("rect",{x:"0",y:"0",width:"820",height:"400",rx:"24",fill:"#020617"}),e.jsx("rect",{x:"0",y:"0",width:"820",height:"400",rx:"24",fill:"url(#dijkstra-grid)"}),[0,1,2,3,4].map(t=>e.jsx("rect",{x:30+t*155,y:t%2===0?38:238,width:112+t%2*34,height:78,rx:18,fill:Ke[t],opacity:"0.26"},t)),e.jsx("path",{d:"M612 40C690 68 760 70 800 42V132C744 154 684 146 612 118Z",fill:"#075985",opacity:"0.18"}),e.jsx("path",{d:"M38 336C96 302 150 306 206 338C154 374 91 382 38 356Z",fill:"#166534",opacity:"0.22"}),s.edges.map(t=>{const o=N[t.source],h=N[t.destination];if(!o||!h)return null;const T=S(t.source,t.destination),E=M(t.source,t.destination);return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#020617",strokeWidth:17,strokeLinecap:"round",opacity:.7}),e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#1e293b",strokeWidth:13,strokeLinecap:"round"}),e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#475569",strokeWidth:8,strokeLinecap:"round",opacity:.78}),e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#cbd5e1",strokeWidth:1.2,strokeLinecap:"round",strokeDasharray:"5 8",opacity:.34}),(i.has([t.source,t.destination].sort().join("-"))||m.has([t.source,t.destination].sort().join("-"))||u&&[u.from,u.to].sort().join("-")===[t.source,t.destination].sort().join("-"))&&e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:T,strokeWidth:E+6,strokeLinecap:"round",opacity:.34,filter:"url(#soft-glow)"})]},`${t.id}-road-base`)}),s.edges.map(t=>{const o=N[t.source],h=N[t.destination];if(!o||!h)return null;const T=S(t.source,t.destination),E=M(t.source,t.destination),k=(o.x+h.x)/2,I=(o.y+h.y)/2,b=[t.source,t.destination].sort().join("-"),R=i.has(b)||m.has(b)||u&&[u.from,u.to].sort().join("-")===b;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:T,strokeWidth:R?E+2:1.4,strokeLinecap:"round",opacity:R?.96:.18,strokeDasharray:m.has(b)&&!i.has(b)?"9 6":void 0}),e.jsx("rect",{x:k-17,y:I-11,width:34,height:22,rx:8,fill:"#020617",fillOpacity:.92,stroke:R?T:"#475569",strokeWidth:.8,filter:"url(#pin-shadow)"}),e.jsxs("text",{x:k,y:I+.5,textAnchor:"middle",dominantBaseline:"central",fontSize:9,fontWeight:800,fontFamily:"ui-monospace, monospace",fill:R?T:"#cbd5e1",fillOpacity:.95,children:[t.weight,"m"]})]},t.id)}),s.nodes.map(t=>{const o=y(t.id),h=v(t.id),T=p?.distances[t.id],E=T!==void 0&&T!==1/0?T.toString():"",k=t.id===n,I=t.id===d,b=p&&t.id===c,R=p&&w.includes(t.id);return e.jsxs("g",{onClick:()=>a(t.id),className:"cursor-pointer",children:[e.jsx("circle",{cx:t.x,cy:t.y,r:L+12,fill:o,fillOpacity:b?.22:.08,filter:b?"url(#soft-glow)":void 0}),e.jsx("circle",{cx:t.x,cy:t.y,r:L+5,fill:"#020617",stroke:"#0f172a",strokeWidth:7,filter:"url(#pin-shadow)"}),e.jsx("circle",{cx:t.x,cy:t.y,r:L,fill:o,fillOpacity:k||I||b||R?.32:.16,stroke:h,strokeWidth:k||I?4:2.5}),e.jsx("text",{x:t.x,y:t.y+1,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fontWeight:900,fontFamily:"ui-monospace, monospace",fill:o,children:t.id}),(k||I)&&e.jsxs("g",{children:[e.jsx("path",{d:`M${t.x-8} ${t.y-41}h16a7 7 0 0 1 7 7v12a7 7 0 0 1-7 7h-16a7 7 0 0 1-7-7v-12a7 7 0 0 1 7-7Z`,fill:k?"#eab308":"#f97316",opacity:"0.95",filter:"url(#pin-shadow)"}),e.jsx("text",{x:t.x,y:t.y-28,textAnchor:"middle",dominantBaseline:"central",fontSize:9,fontWeight:900,fontFamily:"ui-monospace, monospace",fill:"#020617",children:k?"START":"END"})]}),E&&e.jsxs("g",{children:[e.jsx("rect",{x:t.x-20,y:t.y+L+8,width:40,height:16,rx:8,fill:"#020617",stroke:"#334155"}),e.jsxs("text",{x:t.x,y:t.y+L+16.5,textAnchor:"middle",dominantBaseline:"central",fontSize:8,fontWeight:700,fontFamily:"ui-monospace, monospace",fill:"#94a3b8",children:["ETA ",E]})]})]},t.id)})]})]})}function F({color:s,label:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:`h-2 w-2 rounded-full ${s}`}),n]})}const xe={explore:{name:"Free Explore",description:"Pick any route and compare your cost to the optimal Dijkstra path."},visualize:{name:"Visualizer",description:"Watch Dijkstra's algorithm run step-by-step with priority queue updates."},race:{name:"Race Mode",description:"Beat the algorithm! Find the shortest path as fast as you can."}},J={title:"Dijkstra Delivery Simulator",subtitle:"Based on Edsger W. Dijkstra's shortest-path algorithm",what:"You're a delivery driver navigating a city. Intersections are nodes, roads are edges, and traffic time is the weight. Find the shortest route from start to destination — then see how your path compares to Dijkstra's optimal solution.",skills:["Graph Theory","Shortest Path","Greedy Algorithms","Priority Queues"]},tt=["explore","visualize","race"],st=[{label:"Slow",value:800},{label:"Med",value:400},{label:"Fast",value:150}];function it(s){const n=Math.floor(s/60),d=s%60;return`${n}:${d.toString().padStart(2,"0")}`}function nt({mode:s,mapType:n,startNode:d,endNode:r,playerPath:f,playerCost:l,optimalCost:p,showOptimal:j,currentAlgoStep:a,algoStepIndex:i,algoStepsTotal:m,isAlgoRunning:w,algoSpeed:c,score:u,timer:y,isComplete:v,lastError:S,soundEnabled:M,selectingPhase:N,onChangeMode:A,onNewMap:z,onReset:$,onToggleOptimal:C,onUndoLastStep:t,onStepForward:o,onStepBack:h,onAutoPlay:T,onSetAlgoSpeed:E,onToggleSound:k}){const I=N==="start"?"Choose depot":N==="end"?"Choose destination":s==="visualize"?"Run algorithm scan":"Build delivery route";return e.jsxs("div",{className:"flex w-full shrink-0 flex-col gap-4 overflow-y-auto pr-1 xl:w-80",children:[e.jsxs("div",{className:"rounded-2xl border border-sky-500/20 bg-slate-950/75 p-4 shadow-2xl shadow-black/30 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-sky-200",children:J.title}),e.jsx("p",{className:"text-[10px] text-slate-500 italic",children:J.subtitle})]}),e.jsx("span",{className:"rounded-full bg-sky-500/10 px-2 py-1 text-[9px] font-bold uppercase tracking-wider text-sky-300 ring-1 ring-sky-500/25",children:"Dispatch"})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:J.what}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:J.skills.map(b=>e.jsx("span",{className:"inline-flex items-center rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-400 ring-1 ring-violet-500/20",children:b},b))})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Game Mode"}),e.jsx("div",{className:"grid gap-2",children:tt.map(b=>e.jsxs("button",{onClick:()=>A(b),className:`rounded-xl px-3 py-2 text-left transition-all duration-200 ${s===b?"bg-indigo-500/20 text-indigo-200 ring-1 ring-indigo-500/40":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[e.jsx("span",{className:"block text-xs font-bold",children:xe[b].name}),e.jsx("span",{className:"mt-0.5 block text-[10px] leading-snug opacity-70",children:xe[b].description})]},b))})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Map"}),e.jsx("span",{className:"rounded-full bg-slate-900 px-2 py-0.5 text-[9px] font-mono uppercase text-slate-400 ring-1 ring-slate-800",children:n})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{onClick:()=>z("predefined"),className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${n==="predefined"?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/30":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[e.jsx(Be,{size:12})," Preset"]}),e.jsxs("button",{onClick:()=>z("random"),className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${n==="random"?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/30":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[e.jsx(Fe,{size:12})," Random"]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-emerald-500/20 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Mission"}),e.jsx("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[9px] font-bold uppercase tracking-wider text-emerald-300 ring-1 ring-emerald-500/25",children:I})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(fe,{label:"Depot",value:d??"unset",tone:"yellow"}),e.jsx(fe,{label:"Dropoff",value:r??"unset",tone:"orange"})]}),f.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl bg-slate-900/70 p-3 ring-1 ring-slate-800/80",children:[e.jsx("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Route manifest"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:f.map((b,R)=>e.jsx("span",{className:"inline-flex items-center rounded-md bg-indigo-500/15 px-1.5 py-0.5 text-[10px] font-mono font-semibold text-indigo-300 ring-1 ring-indigo-500/20",children:b},`${b}-${R}`))})]})]}),s==="visualize"&&d&&r&&e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Algorithm"}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsxs("button",{onClick:h,disabled:i<=0,className:"flex-1 flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:[e.jsx(Oe,{size:14})," Prev"]}),e.jsx("button",{onClick:T,className:`flex-1 flex items-center justify-center gap-1 rounded-xl px-2 py-2 text-xs font-medium transition-all ${w?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/30":"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/30 hover:bg-indigo-500/30"}`,children:w?e.jsxs(e.Fragment,{children:[e.jsx(Le,{size:14})," Pause"]}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:14})," Play"]})}),e.jsxs("button",{onClick:o,disabled:i>=m-1,className:"flex-1 flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:["Next ",e.jsx(_e,{size:14})]})]}),e.jsx("div",{className:"flex gap-1 mb-2",children:st.map(b=>e.jsx("button",{onClick:()=>E(b.value),className:`flex-1 rounded-md px-2 py-1 text-[10px] font-medium transition-all ${c===b.value?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/50 text-slate-500 hover:text-slate-400"}`,children:b.label},b.value))}),m>0&&e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-500",children:[e.jsx("span",{children:"Step"}),e.jsxs("span",{className:"font-mono font-semibold text-indigo-300",children:[Math.max(0,i+1)," / ",m]})]})]}),d&&r&&e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Route Info"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(ue,{size:11})," Your Cost"]}),e.jsx("span",{className:"text-sm font-mono font-bold text-indigo-300",children:l>0||v?l:"—"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(ue,{size:11})," Optimal"]}),e.jsx("span",{className:`text-sm font-mono font-bold ${j?"text-emerald-300":"text-slate-600"}`,children:j?p:"???"})]}),v&&l>0&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Difference"}),e.jsx("span",{className:`text-sm font-mono font-bold ${l===p?"text-emerald-400":"text-amber-400"}`,children:l===p?"Perfect!":`+${l-p}`})]}),s==="race"&&v&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(qe,{size:11})," Time"]}),e.jsx("span",{className:"text-sm font-mono font-bold text-sky-300",children:it(y)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(We,{size:11})," Score"]}),e.jsx("span",{className:"text-sm font-mono font-bold text-amber-300",children:u})]})]})]})]}),s==="visualize"&&a&&e.jsxs("div",{className:`rounded-2xl border p-4 shadow-xl shadow-black/20 backdrop-blur-sm ${a.type==="relax"?"border-amber-500/30 bg-amber-500/5":a.type==="done"?"border-emerald-500/30 bg-emerald-500/5":"border-slate-700/50 bg-slate-950/75"}`,children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-2",children:"Current Step"}),e.jsx("p",{className:"text-xs text-slate-300 leading-relaxed",children:a.description}),a.queue.length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsx("p",{className:"text-[10px] text-slate-500 mb-1",children:"Priority Queue:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:[...a.queue].sort((b,R)=>b.distance-R.distance).map(b=>e.jsxs("span",{className:"inline-flex items-center rounded-md bg-sky-500/10 px-1.5 py-0.5 text-[10px] font-mono text-sky-300 ring-1 ring-sky-500/20",children:[b.id,":",b.distance]},b.id))})]})]}),S&&e.jsx("div",{className:"rounded-xl border border-red-500/30 bg-red-500/5 px-3 py-2 text-center text-xs font-medium text-red-400 shadow-xl shadow-red-950/20 animate-pulse",children:S}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("button",{onClick:$,className:"flex items-center justify-center gap-1.5 rounded-xl bg-slate-950/80 px-3 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800 transition-all hover:bg-slate-800/80 hover:text-slate-300",children:[e.jsx(He,{size:12})," Reset"]}),s!=="visualize"&&e.jsxs("button",{onClick:t,disabled:f.length<=1||v,className:"flex items-center justify-center gap-1.5 rounded-xl bg-slate-950/80 px-3 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800 transition-all hover:bg-slate-800/80 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:[e.jsx(Je,{size:12})," Undo"]}),s!=="visualize"&&d&&r&&e.jsxs("button",{onClick:C,className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${j?"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/30":"bg-slate-950/80 text-slate-400 ring-1 ring-slate-800 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[j?e.jsx(Ve,{size:12}):e.jsx(Ue,{size:12})," Best"]}),e.jsxs("button",{onClick:()=>k(!M),className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${M?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-950/80 text-slate-400 ring-1 ring-slate-800 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[M?e.jsx(Ye,{size:12}):e.jsx(Qe,{size:12})," Sound"]})]})]})}function fe({label:s,value:n,tone:d}){const r={yellow:"text-yellow-300 ring-yellow-500/25 bg-yellow-500/10",orange:"text-orange-300 ring-orange-500/25 bg-orange-500/10"};return e.jsxs("div",{className:`rounded-xl p-3 ring-1 ${r[d]}`,children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider opacity-65",children:s}),e.jsx("div",{className:"mt-1 font-mono text-lg font-black",children:n})]})}let P=0,q=0;function at(){return String.fromCharCode(65+P++%26)}function ge(){P=0,q=0}function me(){return`e${q++}`}function re(s,n){return Math.sqrt((s.x-n.x)**2+(s.y-n.y)**2)}function pe(s){ge();const n=[rt,ot,lt];return n[s%n.length]()}function rt(){const s=[{id:"A",x:80,y:200,distance:1/0,visited:!1,previous:null},{id:"B",x:220,y:80,distance:1/0,visited:!1,previous:null},{id:"C",x:220,y:320,distance:1/0,visited:!1,previous:null},{id:"D",x:400,y:80,distance:1/0,visited:!1,previous:null},{id:"E",x:400,y:200,distance:1/0,visited:!1,previous:null},{id:"F",x:400,y:320,distance:1/0,visited:!1,previous:null},{id:"G",x:560,y:200,distance:1/0,visited:!1,previous:null},{id:"H",x:700,y:200,distance:1/0,visited:!1,previous:null}];P=8;const n=[{id:"e0",source:"A",destination:"B",weight:4},{id:"e1",source:"A",destination:"C",weight:2},{id:"e2",source:"B",destination:"D",weight:5},{id:"e3",source:"B",destination:"E",weight:10},{id:"e4",source:"C",destination:"E",weight:3},{id:"e5",source:"C",destination:"F",weight:8},{id:"e6",source:"D",destination:"G",weight:2},{id:"e7",source:"E",destination:"G",weight:6},{id:"e8",source:"F",destination:"G",weight:1},{id:"e9",source:"G",destination:"H",weight:3},{id:"e10",source:"D",destination:"E",weight:1}];return q=11,{nodes:s,edges:n}}function ot(){const s=[{id:"A",x:100,y:150,distance:1/0,visited:!1,previous:null},{id:"B",x:250,y:50,distance:1/0,visited:!1,previous:null},{id:"C",x:250,y:250,distance:1/0,visited:!1,previous:null},{id:"D",x:400,y:150,distance:1/0,visited:!1,previous:null},{id:"E",x:550,y:50,distance:1/0,visited:!1,previous:null},{id:"F",x:550,y:250,distance:1/0,visited:!1,previous:null},{id:"G",x:700,y:150,distance:1/0,visited:!1,previous:null}];P=7;const n=[{id:"e0",source:"A",destination:"B",weight:7},{id:"e1",source:"A",destination:"C",weight:3},{id:"e2",source:"B",destination:"D",weight:2},{id:"e3",source:"C",destination:"D",weight:5},{id:"e4",source:"C",destination:"F",weight:12},{id:"e5",source:"D",destination:"E",weight:4},{id:"e6",source:"D",destination:"F",weight:3},{id:"e7",source:"E",destination:"G",weight:1},{id:"e8",source:"F",destination:"G",weight:2},{id:"e9",source:"B",destination:"E",weight:9}];return q=10,{nodes:s,edges:n}}function lt(){const s=[{id:"A",x:80,y:180,distance:1/0,visited:!1,previous:null},{id:"B",x:200,y:60,distance:1/0,visited:!1,previous:null},{id:"C",x:200,y:300,distance:1/0,visited:!1,previous:null},{id:"D",x:350,y:180,distance:1/0,visited:!1,previous:null},{id:"E",x:500,y:60,distance:1/0,visited:!1,previous:null},{id:"F",x:500,y:300,distance:1/0,visited:!1,previous:null},{id:"G",x:650,y:120,distance:1/0,visited:!1,previous:null},{id:"H",x:650,y:240,distance:1/0,visited:!1,previous:null},{id:"I",x:780,y:180,distance:1/0,visited:!1,previous:null}];P=9;const n=[{id:"e0",source:"A",destination:"B",weight:3},{id:"e1",source:"A",destination:"C",weight:6},{id:"e2",source:"A",destination:"D",weight:7},{id:"e3",source:"B",destination:"D",weight:2},{id:"e4",source:"B",destination:"E",weight:8},{id:"e5",source:"C",destination:"D",weight:3},{id:"e6",source:"C",destination:"F",weight:4},{id:"e7",source:"D",destination:"E",weight:2},{id:"e8",source:"D",destination:"F",weight:5},{id:"e9",source:"E",destination:"G",weight:1},{id:"e10",source:"F",destination:"H",weight:2},{id:"e11",source:"G",destination:"I",weight:4},{id:"e12",source:"H",destination:"I",weight:3},{id:"e13",source:"G",destination:"H",weight:2}];return q=14,{nodes:s,edges:n}}function ct(s=12){ge();const n=750,d=360,r=60,f=80,l=[];let p=0;for(;l.lengthre(v,{x:c,y:u})u).filter(c=>c>0));for(;m.size>0;){let c=1/0,u=0,y=0;for(const M of i)for(const N of m){const A=re(l[M],l[N]);A0;){j.sort((c,u)=>c.distance-u.distance);const i=j.shift();if(p.has(i.id))continue;p.add(i.id);const m=[...p];if(r.push({type:"visit",currentNodeId:i.id,description:`Visit node ${i.id} (distance = ${f[i.id]})`,distances:{...f},visited:m,previous:{...l},queue:[...j]}),i.id===d)break;const w=be(s,i.id);for(const c of w){if(p.has(c.id))continue;const u=f[i.id]+c.weight,y=f[c.id];if(uS.id===c.id);v>=0?j[v].distance=u:j.push({id:c.id,distance:u}),r.push({type:"relax",currentNodeId:i.id,description:`Relax edge ${i.id} → ${c.id}: distance updated from ${y===1/0?"∞":y} to ${u}`,distances:{...f},visited:[...p],previous:{...l},queue:[...j],relaxedEdge:{from:i.id,to:c.id,oldDist:y,newDist:u}})}}}const a=je(l,n,d);return r.push({type:"done",currentNodeId:d,description:a.length>0?`Done! Shortest path: ${a.join(" → ")} (cost: ${f[d]})`:`No path found from ${n} to ${d}`,distances:{...f},visited:[...p],previous:{...l},queue:[]}),r}function je(s,n,d){const r=[];let f=d;for(;f!==null&&(r.unshift(f),f!==n);)f=s[f];return r[0]!==n?[]:r}function dt(s,n,d){const r=ye(s,n,d),f=r[r.length-1],l=je(f.previous,n,d),p=f.distances[d]??1/0;return{path:l,cost:p===1/0?-1:p}}function ut(s,n){let d=0;for(let r=0;rl.source===n[r]&&l.destination===n[r+1]||l.destination===n[r]&&l.source===n[r+1]);if(!f)return-1;d+=f.weight}return d}function xt(s,n,d){if(n<=0||s<0)return 0;const r=100,f=(s-n)*5,l=Math.floor(d/3),p=s===n?50:0;return Math.max(0,r-f-l+p)}const he=[329.63,392,440,493.88,523.25,587.33,659.25,783.99];function ft(){const s=x.useRef(!0),n=x.useCallback(()=>Ze(),[]),d=x.useCallback(a=>{s.current=a},[]),r=x.useCallback(a=>{if(!s.current)return;const i=n();if(!i)return;const m=he[a%he.length],w=i.createOscillator(),c=i.createGain();w.type="sine",w.frequency.setValueAtTime(m,i.currentTime),c.gain.setValueAtTime(.1,i.currentTime),c.gain.exponentialRampToValueAtTime(.001,i.currentTime+.25),w.connect(c),c.connect(i.destination),w.start(),w.stop(i.currentTime+.25)},[n]),f=x.useCallback(()=>{if(!s.current)return;const a=n();if(!a)return;const i=a.createOscillator(),m=a.createGain();i.type="triangle",i.frequency.setValueAtTime(600,a.currentTime),i.frequency.setValueAtTime(800,a.currentTime+.08),m.gain.setValueAtTime(.06,a.currentTime),m.gain.exponentialRampToValueAtTime(.001,a.currentTime+.15),i.connect(m),m.connect(a.destination),i.start(),i.stop(a.currentTime+.15)},[n]),l=x.useCallback(()=>{if(!s.current)return;const a=n();if(!a)return;const i=a.createOscillator(),m=a.createGain();i.type="sine",i.frequency.setValueAtTime(520,a.currentTime),m.gain.setValueAtTime(.08,a.currentTime),m.gain.exponentialRampToValueAtTime(.001,a.currentTime+.1),i.connect(m),m.connect(a.destination),i.start(),i.stop(a.currentTime+.1)},[n]),p=x.useCallback(()=>{if(!s.current)return;const a=n();if(!a)return;const i=a.createOscillator(),m=a.createGain();i.type="sawtooth",i.frequency.setValueAtTime(200,a.currentTime),i.frequency.setValueAtTime(140,a.currentTime+.12),m.gain.setValueAtTime(.07,a.currentTime),m.gain.exponentialRampToValueAtTime(.001,a.currentTime+.25),i.connect(m),m.connect(a.destination),i.start(),i.stop(a.currentTime+.25)},[n]),j=x.useCallback(a=>{if(!s.current)return;const i=n();if(!i)return;(a?[523.25,587.33,659.25,783.99,880,1046.5]:[400,350,300]).forEach((w,c)=>{const u=i.createOscillator(),y=i.createGain();u.type="sine",u.frequency.value=w,y.gain.setValueAtTime(.07,i.currentTime+c*.08),y.gain.exponentialRampToValueAtTime(.001,i.currentTime+c*.08+.18),u.connect(y),y.connect(i.destination),u.start(i.currentTime+c*.08),u.stop(i.currentTime+c*.08+.18)})},[n]);return{playVisitTone:r,playRelaxTone:f,playClickTone:l,playErrorTone:p,playCompleteSweep:j,setEnabled:d}}function mt(){const[s,n]=x.useState("explore"),[d,r]=x.useState(()=>pe(0)),[f,l]=x.useState("predefined"),[p,j]=x.useState(0),[a,i]=x.useState(null),[m,w]=x.useState(null),[c,u]=x.useState([]),[y,v]=x.useState(0),[S,M]=x.useState([]),[N,A]=x.useState(0),[z,$]=x.useState(!1),[C,t]=x.useState([]),[o,h]=x.useState(-1),[T,E]=x.useState(!1),k=x.useRef(null),[I,b]=x.useState(500),[R,W]=x.useState(0),[ee,te]=x.useState(0),[oe,se]=x.useState(!1),O=x.useRef(null),[ve,we]=x.useState(!0),[ke,V]=x.useState(null),[ie,le]=x.useState(!1),[H,U]=x.useState("start"),{playVisitTone:Y,playRelaxTone:Q,playClickTone:Z,playErrorTone:ne,playCompleteSweep:G,setEnabled:ce}=ft(),Ne=x.useCallback(g=>{we(g),ce(g)},[ce]);x.useEffect(()=>(oe&&(O.current=window.setInterval(()=>te(g=>g+1),1e3)),()=>{O.current&&clearInterval(O.current)}),[oe]);const Ce=o>=0&&o{if(V(null),H==="start"){i(g),U("end"),Z();return}if(H==="end"){if(g===a){V("Destination must be different from start"),ne();return}w(g),Z();const B=dt(d,a,g);if(M(B.path),A(B.cost),s==="visualize"){const ze=ye(d,a,g);t(ze),h(-1),U("path")}else u([a]),v(0),U("path"),s==="race"&&(se(!0),te(0));return}if(s==="visualize"||c.length===0)return;const D=c[c.length-1];if(g===D)return;const de=be(d,D).find(B=>B.id===g);if(!de){V(`${g} is not adjacent to ${D}`),ne(),setTimeout(()=>V(null),1500);return}Z();const $e=[...c,g],ae=y+de.weight;if(u($e),v(ae),g===m)if(le(!0),se(!1),$(!0),s==="race"){const B=xt(ae,N,ee);W(B),G(ae===N)}else G(!0)},[H,a,m,d,s,c,y,N,ee,Z,ne,G]),Se=x.useCallback(()=>{if(c.length<=1||ie)return;const g=c.slice(0,-1);u(g),v(ut(d,g)),V(null)},[c,d,ie]),Me=x.useCallback(()=>{C.length!==0&&h(g=>{const D=Math.min(g+1,C.length-1),X=C[D];return X.type==="visit"&&Y(D),X.type==="relax"&&Q(),X.type==="done"&&G(!0),D})},[C,Y,Q,G]),De=x.useCallback(()=>{h(g=>Math.max(g-1,0))},[]),Ee=x.useCallback(()=>{if(T){k.current&&clearInterval(k.current),E(!1);return}E(!0);let g=o<0?0:o;k.current=window.setInterval(()=>{if(g>=C.length-1){k.current&&clearInterval(k.current),E(!1);return}g++,h(g);const D=C[g];D.type==="visit"&&Y(g),D.type==="relax"&&Q(),D.type==="done"&&G(!0)},I)},[T,o,C,I,Y,Q,G]),_=x.useCallback(()=>{i(null),w(null),u([]),v(0),M([]),A(0),$(!1),t([]),h(-1),E(!1),W(0),te(0),se(!1),le(!1),V(null),U("start"),k.current&&clearInterval(k.current),O.current&&clearInterval(O.current),r(g=>({...g,nodes:g.nodes.map(D=>({...D,distance:1/0,visited:!1,previous:null}))}))},[]),Ie=x.useCallback(g=>{n(g),_()},[_]),Re=x.useCallback(g=>{if(l(g),g==="predefined"){const D=(p+1)%3;j(D),r(pe(D))}else r(ct(12));_()},[p,_]),Ae=x.useCallback(()=>{!a||!m||$(g=>!g)},[a,m]);return{mode:s,graph:d,mapType:f,startNode:a,endNode:m,playerPath:c,playerCost:y,optimalPath:S,optimalCost:N,showOptimal:z,algoSteps:C,algoStepIndex:o,currentAlgoStep:Ce,isAlgoRunning:T,algoSpeed:I,setAlgoSpeed:b,score:R,timer:ee,isComplete:ie,lastError:ke,soundEnabled:ve,selectingPhase:H,clickNode:Te,undoLastStep:Se,stepAlgoForward:Me,stepAlgoBack:De,autoPlayAlgo:Ee,resetGame:_,changeMode:Ie,newMap:Re,toggleOptimal:Ae,toggleSound:Ne}}function Mt(){const{mode:s,graph:n,mapType:d,startNode:r,endNode:f,playerPath:l,playerCost:p,optimalPath:j,optimalCost:a,showOptimal:i,algoSteps:m,algoStepIndex:w,currentAlgoStep:c,isAlgoRunning:u,algoSpeed:y,setAlgoSpeed:v,score:S,timer:M,isComplete:N,lastError:A,soundEnabled:z,selectingPhase:$,clickNode:C,undoLastStep:t,stepAlgoForward:o,stepAlgoBack:h,autoPlayAlgo:T,resetGame:E,changeMode:k,newMap:I,toggleOptimal:b,toggleSound:R}=mt(),W=r&&f?`${r} -> ${f}`:"Select depot and destination";return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.16),transparent_30%),radial-gradient(circle_at_bottom_right,rgba(34,197,94,0.12),transparent_28%)]",children:[e.jsx("div",{className:"border-b border-slate-800/70 bg-slate-950/75 px-4 py-3 shadow-lg shadow-black/20 backdrop-blur-sm md:px-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-400",children:"Shortest Path Command Center"}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"Dijkstra Delivery Simulator"})]}),e.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[e.jsx(K,{label:"Mode",value:s,tone:"indigo"}),e.jsx(K,{label:"Map",value:d,tone:"sky"}),e.jsx(K,{label:"Route",value:W,tone:"emerald"}),N&&e.jsx(K,{label:"Result",value:p===a?"optimal":`+${p-a} min`,tone:p===a?"emerald":"amber"})]})]})}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[e.jsx("div",{className:"order-last flex min-h-[620px] flex-1 flex-col gap-4 xl:order-first xl:min-h-0",children:e.jsx(et,{graph:n,startNode:r,endNode:f,playerPath:l,optimalPath:j,showOptimal:i,currentAlgoStep:c,selectingPhase:$,onClickNode:C})}),e.jsx(nt,{mode:s,mapType:d,startNode:r,endNode:f,playerPath:l,playerCost:p,optimalCost:a,showOptimal:i,currentAlgoStep:c,algoStepIndex:w,algoStepsTotal:m.length,isAlgoRunning:u,algoSpeed:y,score:S,timer:M,isComplete:N,lastError:A,soundEnabled:z,selectingPhase:$,onChangeMode:k,onNewMap:I,onReset:E,onToggleOptimal:b,onUndoLastStep:t,onStepForward:o,onStepBack:h,onAutoPlay:T,onSetAlgoSpeed:v,onToggleSound:R})]})]})}function K({label:s,value:n,tone:d}){const r={indigo:"bg-indigo-500/10 text-indigo-200 ring-indigo-500/25",sky:"bg-sky-500/10 text-sky-200 ring-sky-500/25",emerald:"bg-emerald-500/10 text-emerald-200 ring-emerald-500/25",amber:"bg-amber-500/10 text-amber-200 ring-amber-500/25"};return e.jsxs("div",{className:`rounded-full px-3 py-1.5 text-[10px] ring-1 ${r[d]}`,children:[e.jsx("span",{className:"mr-1 uppercase tracking-wider opacity-60",children:s}),e.jsx("span",{className:"font-mono font-bold",children:n})]})}export{Mt as default}; +import{c as Ge,r as x,j as e,E as Ve}from"./index-CB1-0H6I.js";import{M as Be}from"./map-Bnco4-k1.js";import{S as Fe}from"./shuffle-DZnyoAGL.js";import{C as Oe,a as _e}from"./chevron-right-ChVmoNtO.js";import{P as Le}from"./pause-DgUWKqjY.js";import{P as Pe}from"./play-SZ6Nqtz8.js";import{R as ue}from"./route-BuoNUCzx.js";import{T as qe}from"./timer-rgbBx2U0.js";import{T as We}from"./trophy-DE-EF49m.js";import{R as He}from"./rotate-ccw-CDlWXRsI.js";import{E as Ue}from"./eye-off-DMbwz3T2.js";import{V as Ye,a as Qe}from"./volume-x-CKT6TOtL.js";import{g as Ze}from"./audioContext-NbgqvQGz.js";const Xe=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Je=Ge("undo-2",Xe),L=20,Ke=["#1e293b","#0f3b3f","#312e81","#3b2416","#064e3b"];function et({graph:s,startNode:n,endNode:d,playerPath:r,optimalPath:f,showOptimal:l,currentAlgoStep:p,selectingPhase:j,onClickNode:a}){const i=x.useMemo(()=>{const t=new Set;for(let o=0;o{const t=new Set;if(l)for(let o=0;o{const t={};for(const o of s.nodes)t[o.id]={x:o.x,y:o.y};return t},[s.nodes]),A=j==="start"||j==="end"?"cursor-crosshair":"cursor-pointer",z=j==="start"?"Click an intersection to set START DEPOT":j==="end"?"Click an intersection to set DELIVERY DESTINATION":null,$=[...p?.queue??[]].sort((t,o)=>t.distance-o.distance).slice(0,5),C={intersections:s.nodes.length,roads:s.edges.length,avgTraffic:s.edges.length?Math.round(s.edges.reduce((t,o)=>t+o.weight,0)/s.edges.length):0};return e.jsxs("div",{className:`relative flex-1 w-full overflow-hidden rounded-[1.5rem] border border-slate-700/50 bg-slate-950/90 p-3 shadow-2xl shadow-black/40 backdrop-blur-sm ${A}`,children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_20%_10%,rgba(56,189,248,0.14),transparent_28%),radial-gradient(circle_at_80%_80%,rgba(34,197,94,0.1),transparent_30%)]"}),z&&e.jsx("div",{className:"absolute top-5 left-1/2 z-20 -translate-x-1/2 rounded-full bg-slate-950/90 px-4 py-2 text-xs font-semibold uppercase tracking-wide text-sky-200 ring-1 ring-sky-500/30 shadow-xl shadow-sky-950/40 animate-pulse",children:z}),e.jsxs("div",{className:"absolute left-5 top-5 z-10 rounded-2xl border border-slate-700/60 bg-slate-950/85 px-4 py-3 shadow-xl shadow-black/30 backdrop-blur-sm",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-slate-500",children:"City Routing Map"}),e.jsxs("div",{className:"mt-2 flex gap-3 text-[11px] text-slate-300",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"font-mono text-white",children:C.intersections})," intersections"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-mono text-white",children:C.roads})," roads"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"font-mono text-white",children:C.avgTraffic})," avg min"]})]})]}),e.jsxs("div",{className:"absolute right-5 top-5 z-10 hidden rounded-2xl border border-slate-700/60 bg-slate-950/85 px-4 py-3 shadow-xl shadow-black/30 backdrop-blur-sm sm:block",children:[e.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Legend"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 text-[10px] text-slate-400",children:[e.jsx(F,{color:"bg-yellow-300",label:"Depot"}),e.jsx(F,{color:"bg-orange-400",label:"Dropoff"}),e.jsx(F,{color:"bg-indigo-400",label:"Your route"}),e.jsx(F,{color:"bg-emerald-400",label:"Best route"}),e.jsx(F,{color:"bg-sky-400",label:"Scanning"}),e.jsx(F,{color:"bg-slate-500",label:"Unvisited"})]})]}),p&&e.jsxs("div",{className:"absolute bottom-5 left-5 z-10 max-w-sm rounded-2xl border border-slate-700/60 bg-slate-950/90 p-4 shadow-xl shadow-black/35 backdrop-blur-sm",children:[e.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-300",children:"Dijkstra Live Scan"}),e.jsx("p",{className:"text-xs leading-relaxed text-slate-300",children:p.description}),$.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:$.map(t=>e.jsxs("span",{className:"rounded-full bg-sky-500/10 px-2 py-1 text-[10px] font-mono font-semibold text-sky-300 ring-1 ring-sky-500/25",children:[t.id,": ",t.distance]},t.id))})]}),e.jsxs("svg",{viewBox:"0 0 820 400",className:"relative z-0 h-full w-full rounded-[1.15rem]",preserveAspectRatio:"xMidYMid meet",children:[e.jsxs("defs",{children:[e.jsx("pattern",{id:"dijkstra-grid",width:"32",height:"32",patternUnits:"userSpaceOnUse",children:e.jsx("path",{d:"M32 0H0V32",fill:"none",stroke:"#334155",strokeWidth:"0.7",opacity:"0.24"})}),e.jsxs("filter",{id:"soft-glow",x:"-40%",y:"-40%",width:"180%",height:"180%",children:[e.jsx("feGaussianBlur",{stdDeviation:"4",result:"blur"}),e.jsxs("feMerge",{children:[e.jsx("feMergeNode",{in:"blur"}),e.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),e.jsx("filter",{id:"pin-shadow",x:"-60%",y:"-60%",width:"220%",height:"220%",children:e.jsx("feDropShadow",{dx:"0",dy:"7",stdDeviation:"5",floodColor:"#020617",floodOpacity:"0.65"})})]}),e.jsx("rect",{x:"0",y:"0",width:"820",height:"400",rx:"24",fill:"#020617"}),e.jsx("rect",{x:"0",y:"0",width:"820",height:"400",rx:"24",fill:"url(#dijkstra-grid)"}),[0,1,2,3,4].map(t=>e.jsx("rect",{x:30+t*155,y:t%2===0?38:238,width:112+t%2*34,height:78,rx:18,fill:Ke[t],opacity:"0.26"},t)),e.jsx("path",{d:"M612 40C690 68 760 70 800 42V132C744 154 684 146 612 118Z",fill:"#075985",opacity:"0.18"}),e.jsx("path",{d:"M38 336C96 302 150 306 206 338C154 374 91 382 38 356Z",fill:"#166534",opacity:"0.22"}),s.edges.map(t=>{const o=N[t.source],h=N[t.destination];if(!o||!h)return null;const T=S(t.source,t.destination),E=M(t.source,t.destination);return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#020617",strokeWidth:17,strokeLinecap:"round",opacity:.7}),e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#1e293b",strokeWidth:13,strokeLinecap:"round"}),e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#475569",strokeWidth:8,strokeLinecap:"round",opacity:.78}),e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:"#cbd5e1",strokeWidth:1.2,strokeLinecap:"round",strokeDasharray:"5 8",opacity:.34}),(i.has([t.source,t.destination].sort().join("-"))||m.has([t.source,t.destination].sort().join("-"))||u&&[u.from,u.to].sort().join("-")===[t.source,t.destination].sort().join("-"))&&e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:T,strokeWidth:E+6,strokeLinecap:"round",opacity:.34,filter:"url(#soft-glow)"})]},`${t.id}-road-base`)}),s.edges.map(t=>{const o=N[t.source],h=N[t.destination];if(!o||!h)return null;const T=S(t.source,t.destination),E=M(t.source,t.destination),k=(o.x+h.x)/2,I=(o.y+h.y)/2,b=[t.source,t.destination].sort().join("-"),R=i.has(b)||m.has(b)||u&&[u.from,u.to].sort().join("-")===b;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.y,x2:h.x,y2:h.y,stroke:T,strokeWidth:R?E+2:1.4,strokeLinecap:"round",opacity:R?.96:.18,strokeDasharray:m.has(b)&&!i.has(b)?"9 6":void 0}),e.jsx("rect",{x:k-17,y:I-11,width:34,height:22,rx:8,fill:"#020617",fillOpacity:.92,stroke:R?T:"#475569",strokeWidth:.8,filter:"url(#pin-shadow)"}),e.jsxs("text",{x:k,y:I+.5,textAnchor:"middle",dominantBaseline:"central",fontSize:9,fontWeight:800,fontFamily:"ui-monospace, monospace",fill:R?T:"#cbd5e1",fillOpacity:.95,children:[t.weight,"m"]})]},t.id)}),s.nodes.map(t=>{const o=y(t.id),h=v(t.id),T=p?.distances[t.id],E=T!==void 0&&T!==1/0?T.toString():"",k=t.id===n,I=t.id===d,b=p&&t.id===c,R=p&&w.includes(t.id);return e.jsxs("g",{onClick:()=>a(t.id),className:"cursor-pointer",children:[e.jsx("circle",{cx:t.x,cy:t.y,r:L+12,fill:o,fillOpacity:b?.22:.08,filter:b?"url(#soft-glow)":void 0}),e.jsx("circle",{cx:t.x,cy:t.y,r:L+5,fill:"#020617",stroke:"#0f172a",strokeWidth:7,filter:"url(#pin-shadow)"}),e.jsx("circle",{cx:t.x,cy:t.y,r:L,fill:o,fillOpacity:k||I||b||R?.32:.16,stroke:h,strokeWidth:k||I?4:2.5}),e.jsx("text",{x:t.x,y:t.y+1,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fontWeight:900,fontFamily:"ui-monospace, monospace",fill:o,children:t.id}),(k||I)&&e.jsxs("g",{children:[e.jsx("path",{d:`M${t.x-8} ${t.y-41}h16a7 7 0 0 1 7 7v12a7 7 0 0 1-7 7h-16a7 7 0 0 1-7-7v-12a7 7 0 0 1 7-7Z`,fill:k?"#eab308":"#f97316",opacity:"0.95",filter:"url(#pin-shadow)"}),e.jsx("text",{x:t.x,y:t.y-28,textAnchor:"middle",dominantBaseline:"central",fontSize:9,fontWeight:900,fontFamily:"ui-monospace, monospace",fill:"#020617",children:k?"START":"END"})]}),E&&e.jsxs("g",{children:[e.jsx("rect",{x:t.x-20,y:t.y+L+8,width:40,height:16,rx:8,fill:"#020617",stroke:"#334155"}),e.jsxs("text",{x:t.x,y:t.y+L+16.5,textAnchor:"middle",dominantBaseline:"central",fontSize:8,fontWeight:700,fontFamily:"ui-monospace, monospace",fill:"#94a3b8",children:["ETA ",E]})]})]},t.id)})]})]})}function F({color:s,label:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:`h-2 w-2 rounded-full ${s}`}),n]})}const xe={explore:{name:"Free Explore",description:"Pick any route and compare your cost to the optimal Dijkstra path."},visualize:{name:"Visualizer",description:"Watch Dijkstra's algorithm run step-by-step with priority queue updates."},race:{name:"Race Mode",description:"Beat the algorithm! Find the shortest path as fast as you can."}},J={title:"Dijkstra Delivery Simulator",subtitle:"Based on Edsger W. Dijkstra's shortest-path algorithm",what:"You're a delivery driver navigating a city. Intersections are nodes, roads are edges, and traffic time is the weight. Find the shortest route from start to destination — then see how your path compares to Dijkstra's optimal solution.",skills:["Graph Theory","Shortest Path","Greedy Algorithms","Priority Queues"]},tt=["explore","visualize","race"],st=[{label:"Slow",value:800},{label:"Med",value:400},{label:"Fast",value:150}];function it(s){const n=Math.floor(s/60),d=s%60;return`${n}:${d.toString().padStart(2,"0")}`}function nt({mode:s,mapType:n,startNode:d,endNode:r,playerPath:f,playerCost:l,optimalCost:p,showOptimal:j,currentAlgoStep:a,algoStepIndex:i,algoStepsTotal:m,isAlgoRunning:w,algoSpeed:c,score:u,timer:y,isComplete:v,lastError:S,soundEnabled:M,selectingPhase:N,onChangeMode:A,onNewMap:z,onReset:$,onToggleOptimal:C,onUndoLastStep:t,onStepForward:o,onStepBack:h,onAutoPlay:T,onSetAlgoSpeed:E,onToggleSound:k}){const I=N==="start"?"Choose depot":N==="end"?"Choose destination":s==="visualize"?"Run algorithm scan":"Build delivery route";return e.jsxs("div",{className:"flex w-full shrink-0 flex-col gap-4 overflow-y-auto pr-1 xl:w-80",children:[e.jsxs("div",{className:"rounded-2xl border border-sky-500/20 bg-slate-950/75 p-4 shadow-2xl shadow-black/30 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-sky-200",children:J.title}),e.jsx("p",{className:"text-[10px] text-slate-500 italic",children:J.subtitle})]}),e.jsx("span",{className:"rounded-full bg-sky-500/10 px-2 py-1 text-[9px] font-bold uppercase tracking-wider text-sky-300 ring-1 ring-sky-500/25",children:"Dispatch"})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:J.what}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:J.skills.map(b=>e.jsx("span",{className:"inline-flex items-center rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-400 ring-1 ring-violet-500/20",children:b},b))})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Game Mode"}),e.jsx("div",{className:"grid gap-2",children:tt.map(b=>e.jsxs("button",{onClick:()=>A(b),className:`rounded-xl px-3 py-2 text-left transition-all duration-200 ${s===b?"bg-indigo-500/20 text-indigo-200 ring-1 ring-indigo-500/40":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[e.jsx("span",{className:"block text-xs font-bold",children:xe[b].name}),e.jsx("span",{className:"mt-0.5 block text-[10px] leading-snug opacity-70",children:xe[b].description})]},b))})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Map"}),e.jsx("span",{className:"rounded-full bg-slate-900 px-2 py-0.5 text-[9px] font-mono uppercase text-slate-400 ring-1 ring-slate-800",children:n})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{onClick:()=>z("predefined"),className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${n==="predefined"?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/30":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[e.jsx(Be,{size:12})," Preset"]}),e.jsxs("button",{onClick:()=>z("random"),className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${n==="random"?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/30":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[e.jsx(Fe,{size:12})," Random"]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-emerald-500/20 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Mission"}),e.jsx("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[9px] font-bold uppercase tracking-wider text-emerald-300 ring-1 ring-emerald-500/25",children:I})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(fe,{label:"Depot",value:d??"unset",tone:"yellow"}),e.jsx(fe,{label:"Dropoff",value:r??"unset",tone:"orange"})]}),f.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl bg-slate-900/70 p-3 ring-1 ring-slate-800/80",children:[e.jsx("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Route manifest"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:f.map((b,R)=>e.jsx("span",{className:"inline-flex items-center rounded-md bg-indigo-500/15 px-1.5 py-0.5 text-[10px] font-mono font-semibold text-indigo-300 ring-1 ring-indigo-500/20",children:b},`${b}-${R}`))})]})]}),s==="visualize"&&d&&r&&e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Algorithm"}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsxs("button",{onClick:h,disabled:i<=0,className:"flex-1 flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:[e.jsx(Oe,{size:14})," Prev"]}),e.jsx("button",{onClick:T,className:`flex-1 flex items-center justify-center gap-1 rounded-xl px-2 py-2 text-xs font-medium transition-all ${w?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/30":"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/30 hover:bg-indigo-500/30"}`,children:w?e.jsxs(e.Fragment,{children:[e.jsx(Le,{size:14})," Pause"]}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:14})," Play"]})}),e.jsxs("button",{onClick:o,disabled:i>=m-1,className:"flex-1 flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:["Next ",e.jsx(_e,{size:14})]})]}),e.jsx("div",{className:"flex gap-1 mb-2",children:st.map(b=>e.jsx("button",{onClick:()=>E(b.value),className:`flex-1 rounded-md px-2 py-1 text-[10px] font-medium transition-all ${c===b.value?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/50 text-slate-500 hover:text-slate-400"}`,children:b.label},b.value))}),m>0&&e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-500",children:[e.jsx("span",{children:"Step"}),e.jsxs("span",{className:"font-mono font-semibold text-indigo-300",children:[Math.max(0,i+1)," / ",m]})]})]}),d&&r&&e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Route Info"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(ue,{size:11})," Your Cost"]}),e.jsx("span",{className:"text-sm font-mono font-bold text-indigo-300",children:l>0||v?l:"—"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(ue,{size:11})," Optimal"]}),e.jsx("span",{className:`text-sm font-mono font-bold ${j?"text-emerald-300":"text-slate-600"}`,children:j?p:"???"})]}),v&&l>0&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Difference"}),e.jsx("span",{className:`text-sm font-mono font-bold ${l===p?"text-emerald-400":"text-amber-400"}`,children:l===p?"Perfect!":`+${l-p}`})]}),s==="race"&&v&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(qe,{size:11})," Time"]}),e.jsx("span",{className:"text-sm font-mono font-bold text-sky-300",children:it(y)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(We,{size:11})," Score"]}),e.jsx("span",{className:"text-sm font-mono font-bold text-amber-300",children:u})]})]})]})]}),s==="visualize"&&a&&e.jsxs("div",{className:`rounded-2xl border p-4 shadow-xl shadow-black/20 backdrop-blur-sm ${a.type==="relax"?"border-amber-500/30 bg-amber-500/5":a.type==="done"?"border-emerald-500/30 bg-emerald-500/5":"border-slate-700/50 bg-slate-950/75"}`,children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-2",children:"Current Step"}),e.jsx("p",{className:"text-xs text-slate-300 leading-relaxed",children:a.description}),a.queue.length>0&&e.jsxs("div",{className:"mt-2",children:[e.jsx("p",{className:"text-[10px] text-slate-500 mb-1",children:"Priority Queue:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:[...a.queue].sort((b,R)=>b.distance-R.distance).map(b=>e.jsxs("span",{className:"inline-flex items-center rounded-md bg-sky-500/10 px-1.5 py-0.5 text-[10px] font-mono text-sky-300 ring-1 ring-sky-500/20",children:[b.id,":",b.distance]},b.id))})]})]}),S&&e.jsx("div",{className:"rounded-xl border border-red-500/30 bg-red-500/5 px-3 py-2 text-center text-xs font-medium text-red-400 shadow-xl shadow-red-950/20 animate-pulse",children:S}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("button",{onClick:$,className:"flex items-center justify-center gap-1.5 rounded-xl bg-slate-950/80 px-3 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800 transition-all hover:bg-slate-800/80 hover:text-slate-300",children:[e.jsx(He,{size:12})," Reset"]}),s!=="visualize"&&e.jsxs("button",{onClick:t,disabled:f.length<=1||v,className:"flex items-center justify-center gap-1.5 rounded-xl bg-slate-950/80 px-3 py-2 text-xs font-medium text-slate-400 ring-1 ring-slate-800 transition-all hover:bg-slate-800/80 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:[e.jsx(Je,{size:12})," Undo"]}),s!=="visualize"&&d&&r&&e.jsxs("button",{onClick:C,className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${j?"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/30":"bg-slate-950/80 text-slate-400 ring-1 ring-slate-800 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[j?e.jsx(Ve,{size:12}):e.jsx(Ue,{size:12})," Best"]}),e.jsxs("button",{onClick:()=>k(!M),className:`flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-medium transition-all ${M?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-950/80 text-slate-400 ring-1 ring-slate-800 hover:bg-slate-800/80 hover:text-slate-300"}`,children:[M?e.jsx(Ye,{size:12}):e.jsx(Qe,{size:12})," Sound"]})]})]})}function fe({label:s,value:n,tone:d}){const r={yellow:"text-yellow-300 ring-yellow-500/25 bg-yellow-500/10",orange:"text-orange-300 ring-orange-500/25 bg-orange-500/10"};return e.jsxs("div",{className:`rounded-xl p-3 ring-1 ${r[d]}`,children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider opacity-65",children:s}),e.jsx("div",{className:"mt-1 font-mono text-lg font-black",children:n})]})}let P=0,q=0;function at(){return String.fromCharCode(65+P++%26)}function ge(){P=0,q=0}function me(){return`e${q++}`}function re(s,n){return Math.sqrt((s.x-n.x)**2+(s.y-n.y)**2)}function pe(s){ge();const n=[rt,ot,lt];return n[s%n.length]()}function rt(){const s=[{id:"A",x:80,y:200,distance:1/0,visited:!1,previous:null},{id:"B",x:220,y:80,distance:1/0,visited:!1,previous:null},{id:"C",x:220,y:320,distance:1/0,visited:!1,previous:null},{id:"D",x:400,y:80,distance:1/0,visited:!1,previous:null},{id:"E",x:400,y:200,distance:1/0,visited:!1,previous:null},{id:"F",x:400,y:320,distance:1/0,visited:!1,previous:null},{id:"G",x:560,y:200,distance:1/0,visited:!1,previous:null},{id:"H",x:700,y:200,distance:1/0,visited:!1,previous:null}];P=8;const n=[{id:"e0",source:"A",destination:"B",weight:4},{id:"e1",source:"A",destination:"C",weight:2},{id:"e2",source:"B",destination:"D",weight:5},{id:"e3",source:"B",destination:"E",weight:10},{id:"e4",source:"C",destination:"E",weight:3},{id:"e5",source:"C",destination:"F",weight:8},{id:"e6",source:"D",destination:"G",weight:2},{id:"e7",source:"E",destination:"G",weight:6},{id:"e8",source:"F",destination:"G",weight:1},{id:"e9",source:"G",destination:"H",weight:3},{id:"e10",source:"D",destination:"E",weight:1}];return q=11,{nodes:s,edges:n}}function ot(){const s=[{id:"A",x:100,y:150,distance:1/0,visited:!1,previous:null},{id:"B",x:250,y:50,distance:1/0,visited:!1,previous:null},{id:"C",x:250,y:250,distance:1/0,visited:!1,previous:null},{id:"D",x:400,y:150,distance:1/0,visited:!1,previous:null},{id:"E",x:550,y:50,distance:1/0,visited:!1,previous:null},{id:"F",x:550,y:250,distance:1/0,visited:!1,previous:null},{id:"G",x:700,y:150,distance:1/0,visited:!1,previous:null}];P=7;const n=[{id:"e0",source:"A",destination:"B",weight:7},{id:"e1",source:"A",destination:"C",weight:3},{id:"e2",source:"B",destination:"D",weight:2},{id:"e3",source:"C",destination:"D",weight:5},{id:"e4",source:"C",destination:"F",weight:12},{id:"e5",source:"D",destination:"E",weight:4},{id:"e6",source:"D",destination:"F",weight:3},{id:"e7",source:"E",destination:"G",weight:1},{id:"e8",source:"F",destination:"G",weight:2},{id:"e9",source:"B",destination:"E",weight:9}];return q=10,{nodes:s,edges:n}}function lt(){const s=[{id:"A",x:80,y:180,distance:1/0,visited:!1,previous:null},{id:"B",x:200,y:60,distance:1/0,visited:!1,previous:null},{id:"C",x:200,y:300,distance:1/0,visited:!1,previous:null},{id:"D",x:350,y:180,distance:1/0,visited:!1,previous:null},{id:"E",x:500,y:60,distance:1/0,visited:!1,previous:null},{id:"F",x:500,y:300,distance:1/0,visited:!1,previous:null},{id:"G",x:650,y:120,distance:1/0,visited:!1,previous:null},{id:"H",x:650,y:240,distance:1/0,visited:!1,previous:null},{id:"I",x:780,y:180,distance:1/0,visited:!1,previous:null}];P=9;const n=[{id:"e0",source:"A",destination:"B",weight:3},{id:"e1",source:"A",destination:"C",weight:6},{id:"e2",source:"A",destination:"D",weight:7},{id:"e3",source:"B",destination:"D",weight:2},{id:"e4",source:"B",destination:"E",weight:8},{id:"e5",source:"C",destination:"D",weight:3},{id:"e6",source:"C",destination:"F",weight:4},{id:"e7",source:"D",destination:"E",weight:2},{id:"e8",source:"D",destination:"F",weight:5},{id:"e9",source:"E",destination:"G",weight:1},{id:"e10",source:"F",destination:"H",weight:2},{id:"e11",source:"G",destination:"I",weight:4},{id:"e12",source:"H",destination:"I",weight:3},{id:"e13",source:"G",destination:"H",weight:2}];return q=14,{nodes:s,edges:n}}function ct(s=12){ge();const n=750,d=360,r=60,f=80,l=[];let p=0;for(;l.lengthre(v,{x:c,y:u})u).filter(c=>c>0));for(;m.size>0;){let c=1/0,u=0,y=0;for(const M of i)for(const N of m){const A=re(l[M],l[N]);A0;){j.sort((c,u)=>c.distance-u.distance);const i=j.shift();if(p.has(i.id))continue;p.add(i.id);const m=[...p];if(r.push({type:"visit",currentNodeId:i.id,description:`Visit node ${i.id} (distance = ${f[i.id]})`,distances:{...f},visited:m,previous:{...l},queue:[...j]}),i.id===d)break;const w=be(s,i.id);for(const c of w){if(p.has(c.id))continue;const u=f[i.id]+c.weight,y=f[c.id];if(uS.id===c.id);v>=0?j[v].distance=u:j.push({id:c.id,distance:u}),r.push({type:"relax",currentNodeId:i.id,description:`Relax edge ${i.id} → ${c.id}: distance updated from ${y===1/0?"∞":y} to ${u}`,distances:{...f},visited:[...p],previous:{...l},queue:[...j],relaxedEdge:{from:i.id,to:c.id,oldDist:y,newDist:u}})}}}const a=je(l,n,d);return r.push({type:"done",currentNodeId:d,description:a.length>0?`Done! Shortest path: ${a.join(" → ")} (cost: ${f[d]})`:`No path found from ${n} to ${d}`,distances:{...f},visited:[...p],previous:{...l},queue:[]}),r}function je(s,n,d){const r=[];let f=d;for(;f!==null&&(r.unshift(f),f!==n);)f=s[f];return r[0]!==n?[]:r}function dt(s,n,d){const r=ye(s,n,d),f=r[r.length-1],l=je(f.previous,n,d),p=f.distances[d]??1/0;return{path:l,cost:p===1/0?-1:p}}function ut(s,n){let d=0;for(let r=0;rl.source===n[r]&&l.destination===n[r+1]||l.destination===n[r]&&l.source===n[r+1]);if(!f)return-1;d+=f.weight}return d}function xt(s,n,d){if(n<=0||s<0)return 0;const r=100,f=(s-n)*5,l=Math.floor(d/3),p=s===n?50:0;return Math.max(0,r-f-l+p)}const he=[329.63,392,440,493.88,523.25,587.33,659.25,783.99];function ft(){const s=x.useRef(!0),n=x.useCallback(()=>Ze(),[]),d=x.useCallback(a=>{s.current=a},[]),r=x.useCallback(a=>{if(!s.current)return;const i=n();if(!i)return;const m=he[a%he.length],w=i.createOscillator(),c=i.createGain();w.type="sine",w.frequency.setValueAtTime(m,i.currentTime),c.gain.setValueAtTime(.1,i.currentTime),c.gain.exponentialRampToValueAtTime(.001,i.currentTime+.25),w.connect(c),c.connect(i.destination),w.start(),w.stop(i.currentTime+.25)},[n]),f=x.useCallback(()=>{if(!s.current)return;const a=n();if(!a)return;const i=a.createOscillator(),m=a.createGain();i.type="triangle",i.frequency.setValueAtTime(600,a.currentTime),i.frequency.setValueAtTime(800,a.currentTime+.08),m.gain.setValueAtTime(.06,a.currentTime),m.gain.exponentialRampToValueAtTime(.001,a.currentTime+.15),i.connect(m),m.connect(a.destination),i.start(),i.stop(a.currentTime+.15)},[n]),l=x.useCallback(()=>{if(!s.current)return;const a=n();if(!a)return;const i=a.createOscillator(),m=a.createGain();i.type="sine",i.frequency.setValueAtTime(520,a.currentTime),m.gain.setValueAtTime(.08,a.currentTime),m.gain.exponentialRampToValueAtTime(.001,a.currentTime+.1),i.connect(m),m.connect(a.destination),i.start(),i.stop(a.currentTime+.1)},[n]),p=x.useCallback(()=>{if(!s.current)return;const a=n();if(!a)return;const i=a.createOscillator(),m=a.createGain();i.type="sawtooth",i.frequency.setValueAtTime(200,a.currentTime),i.frequency.setValueAtTime(140,a.currentTime+.12),m.gain.setValueAtTime(.07,a.currentTime),m.gain.exponentialRampToValueAtTime(.001,a.currentTime+.25),i.connect(m),m.connect(a.destination),i.start(),i.stop(a.currentTime+.25)},[n]),j=x.useCallback(a=>{if(!s.current)return;const i=n();if(!i)return;(a?[523.25,587.33,659.25,783.99,880,1046.5]:[400,350,300]).forEach((w,c)=>{const u=i.createOscillator(),y=i.createGain();u.type="sine",u.frequency.value=w,y.gain.setValueAtTime(.07,i.currentTime+c*.08),y.gain.exponentialRampToValueAtTime(.001,i.currentTime+c*.08+.18),u.connect(y),y.connect(i.destination),u.start(i.currentTime+c*.08),u.stop(i.currentTime+c*.08+.18)})},[n]);return{playVisitTone:r,playRelaxTone:f,playClickTone:l,playErrorTone:p,playCompleteSweep:j,setEnabled:d}}function mt(){const[s,n]=x.useState("explore"),[d,r]=x.useState(()=>pe(0)),[f,l]=x.useState("predefined"),[p,j]=x.useState(0),[a,i]=x.useState(null),[m,w]=x.useState(null),[c,u]=x.useState([]),[y,v]=x.useState(0),[S,M]=x.useState([]),[N,A]=x.useState(0),[z,$]=x.useState(!1),[C,t]=x.useState([]),[o,h]=x.useState(-1),[T,E]=x.useState(!1),k=x.useRef(null),[I,b]=x.useState(500),[R,W]=x.useState(0),[ee,te]=x.useState(0),[oe,se]=x.useState(!1),O=x.useRef(null),[ve,we]=x.useState(!0),[ke,V]=x.useState(null),[ie,le]=x.useState(!1),[H,U]=x.useState("start"),{playVisitTone:Y,playRelaxTone:Q,playClickTone:Z,playErrorTone:ne,playCompleteSweep:G,setEnabled:ce}=ft(),Ne=x.useCallback(g=>{we(g),ce(g)},[ce]);x.useEffect(()=>(oe&&(O.current=window.setInterval(()=>te(g=>g+1),1e3)),()=>{O.current&&clearInterval(O.current)}),[oe]);const Ce=o>=0&&o{if(V(null),H==="start"){i(g),U("end"),Z();return}if(H==="end"){if(g===a){V("Destination must be different from start"),ne();return}w(g),Z();const B=dt(d,a,g);if(M(B.path),A(B.cost),s==="visualize"){const ze=ye(d,a,g);t(ze),h(-1),U("path")}else u([a]),v(0),U("path"),s==="race"&&(se(!0),te(0));return}if(s==="visualize"||c.length===0)return;const D=c[c.length-1];if(g===D)return;const de=be(d,D).find(B=>B.id===g);if(!de){V(`${g} is not adjacent to ${D}`),ne(),setTimeout(()=>V(null),1500);return}Z();const $e=[...c,g],ae=y+de.weight;if(u($e),v(ae),g===m)if(le(!0),se(!1),$(!0),s==="race"){const B=xt(ae,N,ee);W(B),G(ae===N)}else G(!0)},[H,a,m,d,s,c,y,N,ee,Z,ne,G]),Se=x.useCallback(()=>{if(c.length<=1||ie)return;const g=c.slice(0,-1);u(g),v(ut(d,g)),V(null)},[c,d,ie]),Me=x.useCallback(()=>{C.length!==0&&h(g=>{const D=Math.min(g+1,C.length-1),X=C[D];return X.type==="visit"&&Y(D),X.type==="relax"&&Q(),X.type==="done"&&G(!0),D})},[C,Y,Q,G]),De=x.useCallback(()=>{h(g=>Math.max(g-1,0))},[]),Ee=x.useCallback(()=>{if(T){k.current&&clearInterval(k.current),E(!1);return}E(!0);let g=o<0?0:o;k.current=window.setInterval(()=>{if(g>=C.length-1){k.current&&clearInterval(k.current),E(!1);return}g++,h(g);const D=C[g];D.type==="visit"&&Y(g),D.type==="relax"&&Q(),D.type==="done"&&G(!0)},I)},[T,o,C,I,Y,Q,G]),_=x.useCallback(()=>{i(null),w(null),u([]),v(0),M([]),A(0),$(!1),t([]),h(-1),E(!1),W(0),te(0),se(!1),le(!1),V(null),U("start"),k.current&&clearInterval(k.current),O.current&&clearInterval(O.current),r(g=>({...g,nodes:g.nodes.map(D=>({...D,distance:1/0,visited:!1,previous:null}))}))},[]),Ie=x.useCallback(g=>{n(g),_()},[_]),Re=x.useCallback(g=>{if(l(g),g==="predefined"){const D=(p+1)%3;j(D),r(pe(D))}else r(ct(12));_()},[p,_]),Ae=x.useCallback(()=>{!a||!m||$(g=>!g)},[a,m]);return{mode:s,graph:d,mapType:f,startNode:a,endNode:m,playerPath:c,playerCost:y,optimalPath:S,optimalCost:N,showOptimal:z,algoSteps:C,algoStepIndex:o,currentAlgoStep:Ce,isAlgoRunning:T,algoSpeed:I,setAlgoSpeed:b,score:R,timer:ee,isComplete:ie,lastError:ke,soundEnabled:ve,selectingPhase:H,clickNode:Te,undoLastStep:Se,stepAlgoForward:Me,stepAlgoBack:De,autoPlayAlgo:Ee,resetGame:_,changeMode:Ie,newMap:Re,toggleOptimal:Ae,toggleSound:Ne}}function Mt(){const{mode:s,graph:n,mapType:d,startNode:r,endNode:f,playerPath:l,playerCost:p,optimalPath:j,optimalCost:a,showOptimal:i,algoSteps:m,algoStepIndex:w,currentAlgoStep:c,isAlgoRunning:u,algoSpeed:y,setAlgoSpeed:v,score:S,timer:M,isComplete:N,lastError:A,soundEnabled:z,selectingPhase:$,clickNode:C,undoLastStep:t,stepAlgoForward:o,stepAlgoBack:h,autoPlayAlgo:T,resetGame:E,changeMode:k,newMap:I,toggleOptimal:b,toggleSound:R}=mt(),W=r&&f?`${r} -> ${f}`:"Select depot and destination";return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.16),transparent_30%),radial-gradient(circle_at_bottom_right,rgba(34,197,94,0.12),transparent_28%)]",children:[e.jsx("div",{className:"border-b border-slate-800/70 bg-slate-950/75 px-4 py-3 shadow-lg shadow-black/20 backdrop-blur-sm md:px-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-400",children:"Shortest Path Command Center"}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"Dijkstra Delivery Simulator"})]}),e.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[e.jsx(K,{label:"Mode",value:s,tone:"indigo"}),e.jsx(K,{label:"Map",value:d,tone:"sky"}),e.jsx(K,{label:"Route",value:W,tone:"emerald"}),N&&e.jsx(K,{label:"Result",value:p===a?"optimal":`+${p-a} min`,tone:p===a?"emerald":"amber"})]})]})}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[e.jsx("div",{className:"order-last flex min-h-[620px] flex-1 flex-col gap-4 xl:order-first xl:min-h-0",children:e.jsx(et,{graph:n,startNode:r,endNode:f,playerPath:l,optimalPath:j,showOptimal:i,currentAlgoStep:c,selectingPhase:$,onClickNode:C})}),e.jsx(nt,{mode:s,mapType:d,startNode:r,endNode:f,playerPath:l,playerCost:p,optimalCost:a,showOptimal:i,currentAlgoStep:c,algoStepIndex:w,algoStepsTotal:m.length,isAlgoRunning:u,algoSpeed:y,score:S,timer:M,isComplete:N,lastError:A,soundEnabled:z,selectingPhase:$,onChangeMode:k,onNewMap:I,onReset:E,onToggleOptimal:b,onUndoLastStep:t,onStepForward:o,onStepBack:h,onAutoPlay:T,onSetAlgoSpeed:v,onToggleSound:R})]})]})}function K({label:s,value:n,tone:d}){const r={indigo:"bg-indigo-500/10 text-indigo-200 ring-indigo-500/25",sky:"bg-sky-500/10 text-sky-200 ring-sky-500/25",emerald:"bg-emerald-500/10 text-emerald-200 ring-emerald-500/25",amber:"bg-amber-500/10 text-amber-200 ring-amber-500/25"};return e.jsxs("div",{className:`rounded-full px-3 py-1.5 text-[10px] ring-1 ${r[d]}`,children:[e.jsx("span",{className:"mr-1 uppercase tracking-wider opacity-60",children:s}),e.jsx("span",{className:"font-mono font-bold",children:n})]})}export{Mt as default}; diff --git a/docs/assets/EvolutionSimulatorPage-DGrLIA6R.js b/docs/assets/EvolutionSimulatorPage-CHVguTgo.js similarity index 98% rename from docs/assets/EvolutionSimulatorPage-DGrLIA6R.js rename to docs/assets/EvolutionSimulatorPage-CHVguTgo.js index 1f68840..a02dda9 100644 --- a/docs/assets/EvolutionSimulatorPage-DGrLIA6R.js +++ b/docs/assets/EvolutionSimulatorPage-CHVguTgo.js @@ -1 +1 @@ -import{j as e,r as i}from"./index-lLadk08S.js";import{g as de}from"./audioContext-NbgqvQGz.js";import{S as ue}from"./shuffle-ADbBlETg.js";import{P as B}from"./play-b2ZiatJ3.js";import{P as xe}from"./pause-CU46RSeo.js";import{R as me}from"./rotate-ccw-DMjSdzg2.js";import{V as ge,a as he}from"./volume-x-CjLNPeax.js";function U(t,n,s,a){return t.length===0?"":t.length===1?`0,${s}`:t.map((r,l)=>{const o=l/(t.length-1)*n,c=s-Math.max(0,r)/Math.max(1,a)*s;return`${o},${c}`}).join(" ")}function pe({best:t,avg:n,targetLength:s}){const l=Math.max(s,...t,...n,1);return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-300",children:"Fitness Monitor"}),e.jsx("p",{className:"mt-0.5 text-[10px] text-slate-500",children:"Lab readout for best and average population health"})]}),e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("svg",{viewBox:"0 0 640 220",className:"w-full min-w-[560px] h-56 rounded-xl bg-slate-950/80 ring-1 ring-slate-700/50",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"fitnessGlow",x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(244 63 94)"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(52 211 153)"})]})}),e.jsx("line",{x1:"0",y1:220,x2:640,y2:220,stroke:"rgb(71 85 105 / 0.7)",strokeWidth:"1"}),e.jsx("line",{x1:"0",y1:"0",x2:"0",y2:220,stroke:"rgb(71 85 105 / 0.7)",strokeWidth:"1"}),s>0&&e.jsx("line",{x1:"0",y1:220-s/l*220,x2:640,y2:220-s/l*220,stroke:"rgb(74 222 128 / 0.35)",strokeDasharray:"4 4",strokeWidth:"1"}),e.jsx("polyline",{fill:"none",stroke:"url(#fitnessGlow)",strokeWidth:"3",points:U(t,640,220,l)}),e.jsx("polyline",{fill:"none",stroke:"rgb(56 189 248)",strokeWidth:"2",points:U(n,640,220,l)})]})}),e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-[10px] text-slate-400",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-rose-500"})," Best Fitness"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-sky-400"})," Average Fitness"]})]})]})}function be({population:t,target:n}){return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-300",children:"Candidate Profiles"}),e.jsx("p",{className:"mt-0.5 text-[10px] text-slate-500",children:"The strongest survivors in this generation"})]}),e.jsxs("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-semibold text-emerald-300 ring-1 ring-emerald-500/25",children:["Top ",t.length||0]})]}),e.jsx("div",{className:"space-y-1.5 max-h-72 overflow-auto pr-1",children:t.map((s,a)=>e.jsxs("div",{className:`rounded-xl px-3 py-2 ring-1 transition-all ${a===0?"bg-emerald-500/10 ring-emerald-500/30 shadow-lg shadow-emerald-950/20":"bg-slate-800/50 ring-slate-700/40"}`,children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-500",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`h-2 w-2 rounded-full ${a===0?"bg-emerald-400":"bg-slate-600"}`}),"Subject #",a+1]}),e.jsxs("span",{className:"font-mono",children:[s.fitness," / ",n.length]})]}),e.jsx("div",{className:"mt-1 font-mono text-xs text-slate-200 tracking-wide break-all",children:s.genes}),e.jsx("div",{className:"mt-2 h-1 overflow-hidden rounded-full bg-slate-950/70",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-emerald-400 to-cyan-300",style:{width:`${s.fitness/Math.max(1,n.length)*100}%`}})})]},`${s.genes}-${a}`))})]})}function fe({target:t,bestGenes:n}){return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-300",children:"DNA Match Board"}),e.jsx("p",{className:"mt-0.5 text-[10px] text-slate-500",children:"Green cells already match the target phrase"})]}),e.jsxs("div",{className:"space-y-3 font-mono text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-slate-500 mb-1",children:"Target"}),e.jsx("div",{className:"rounded-xl bg-slate-950/70 ring-1 ring-slate-700/40 px-3 py-2 break-all tracking-wide text-slate-200",children:t||"(empty)"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-slate-500 mb-1",children:"Best Individual"}),e.jsxs("div",{className:"rounded-xl bg-slate-950/70 ring-1 ring-slate-700/40 px-3 py-2 break-all tracking-wide",children:[(n||"").split("").map((s,a)=>{const r=t[a]===s;return e.jsx("span",{className:`mx-0.5 inline-flex min-w-5 justify-center rounded px-1 py-0.5 ${r?"bg-emerald-500/20 text-emerald-200 ring-1 ring-emerald-500/30":"bg-slate-800/60 text-slate-300 ring-1 ring-slate-700/40"}`,children:s},`${s}-${a}`)}),!n&&e.jsx("span",{className:"text-slate-500",children:"Start the simulator to see candidate DNA."})]})]})]})]})}const q=["#f8c9a5","#d99b6c","#8d5524","#f1b982","#c68642"],K=["#22c55e","#38bdf8","#a78bfa","#fb7185","#facc15","#2dd4bf"];function ve({population:t,target:n,generation:s,convergence:a,status:r}){const l=t.length>0?t.slice(0,12):Array.from({length:12},(c,d)=>({genes:"????",fitness:Math.max(0,12-d)})),o=Math.max(1,n.length);return e.jsxs("section",{className:"relative overflow-hidden rounded-2xl border border-emerald-700/30 bg-[radial-gradient(circle_at_top_left,rgba(16,185,129,0.18),transparent_34%),linear-gradient(135deg,rgba(15,23,42,0.96),rgba(6,78,59,0.42))] p-4 shadow-2xl shadow-black/30 md:p-5",children:[e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-28 bg-gradient-to-t from-emerald-950/50 to-transparent"}),e.jsxs("div",{className:"relative z-10 flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-bold text-white md:text-lg",children:"Population Habitat"}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-emerald-100/65",children:"Each person is a candidate solution. Brighter badges mean more matching genes survived selection."})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[e.jsx(_,{label:"Gen",value:s}),e.jsx(_,{label:"Fit",value:`${a.toFixed(0)}%`}),e.jsx(_,{label:"State",value:r})]})]}),e.jsxs("div",{className:"relative z-10 mt-5 rounded-2xl border border-emerald-950/50 bg-emerald-950/25 p-4 shadow-inner",children:[e.jsx("div",{className:"absolute inset-x-6 bottom-3 h-10 rounded-[50%] bg-black/20 blur-xl"}),e.jsx("div",{className:"relative grid grid-cols-3 gap-x-3 gap-y-5 sm:grid-cols-4 lg:grid-cols-6",children:l.map((c,d)=>{const p=c.fitness/o,m=d===0&&t.length>0;return e.jsx(je,{rank:d+1,genes:c.genes,fitnessRatio:p,isElite:m,skin:q[d%q.length],shirt:K[d%K.length]},`${c.genes}-${d}`)})})]})]})}function je({rank:t,genes:n,fitnessRatio:s,isElite:a,skin:r,shirt:l}){const o=Math.max(0,Math.min(1,s)),c=a?"shadow-[0_0_26px_rgba(52,211,153,0.45)]":"",d=.4+o*.6;return e.jsxs("div",{className:`group relative flex flex-col items-center rounded-2xl border px-2 py-3 transition-all hover:-translate-y-1 ${a?"border-emerald-300/50 bg-emerald-400/10":"border-emerald-900/30 bg-slate-950/25"} ${c}`,children:[e.jsxs("div",{className:"absolute right-1.5 top-1.5 rounded-full bg-slate-950/70 px-1.5 py-0.5 text-[9px] font-bold text-slate-400 ring-1 ring-slate-700/50",children:["#",t]}),e.jsxs("div",{className:"relative mt-2",children:[e.jsxs("div",{className:"h-9 w-9 rounded-full border border-black/15 shadow-inner",style:{backgroundColor:r,opacity:d},children:[e.jsxs("div",{className:"mx-auto mt-3 flex w-4 justify-between",children:[e.jsx("span",{className:"h-1 w-1 rounded-full bg-slate-950/70"}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-slate-950/70"})]}),e.jsx("div",{className:"mx-auto mt-1 h-1 w-3 rounded-full bg-slate-950/40"})]}),e.jsx("div",{className:"mx-auto -mt-1 h-10 w-12 rounded-t-2xl rounded-b-lg border border-black/15 shadow-lg",style:{backgroundColor:l,opacity:d}})]}),e.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-slate-950/70",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-emerald-400 to-cyan-300 transition-all",style:{width:`${o*100}%`}})}),e.jsx("div",{className:"mt-1 max-w-full truncate font-mono text-[9px] text-emerald-100/70",children:n||"waiting"})]})}function _({label:t,value:n}){return e.jsxs("div",{className:"rounded-xl bg-slate-950/45 px-3 py-2 ring-1 ring-emerald-500/20",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-wider text-emerald-100/45",children:t}),e.jsx("div",{className:"mt-0.5 text-xs font-bold capitalize text-emerald-100",children:n})]})}const J="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,!?-",$={target:"HELLO WORLD",populationSize:300,mutationRate:.03,crossoverRate:.75,maxGenerations:500,selectionStrategy:"roulette"},X=["HELLO WORLD","GENETIC ALGORITHM","EVOLUTION IN ACTION","SURVIVAL OF THE FITTEST","OPTIMIZE THE GENES"];function Q(t){let n=t>>>0;const s=()=>(n=1664525*n+1013904223>>>0,n/4294967296);return{next:s,int:(r,l)=>l<=r?r:Math.floor(s()*(l-r+1))+r}}function Ne(t,n,s){let a="";for(let r=0;r({...s,fitness:we(s.genes,n)}))}function ee(t){return t.length===0?0:t.reduce((s,a)=>s+a.fitness,0)/t.length}function Se(t,n){const s=t.reduce((l,o)=>l+o.fitness,0);if(s<=0)return t[n.int(0,t.length-1)];const a=n.next()*s;let r=0;for(let l=0;l=a)return t[l];return t[t.length-1]}function ke(t,n,s){let a=t[s.int(0,t.length-1)];const r=Math.max(1,n);for(let l=1;la.fitness&&(a=o)}return a}function Y(t,n,s,a){return n==="tournament"?ke(t,s,a):Se(t,a)}function Ce(t,n,s,a){const r=t.genes.length;if(r<=1||a.next()>s)return t.genes;const l=a.int(1,r-1);return t.genes.slice(0,l)+n.genes.slice(l)}function Te(t,n,s,a){if(t.length===0)return t;let r="";for(let l=0;ls.fitness-n.fitness)}function te(t,n,s,a){return n===0?"Target is empty. Enter a target to evolve.":t>=n?`Solution found in ${s} generations`:s>=a?"Max generations reached without full match":"Evolving..."}function Re(t,n){const s=t.target.length,a=Q(n),r=ye(t.populationSize,s,t.allowedChars,a),l=V(D(r,t.target)),o=l[0]??{genes:"",fitness:0},c=ee(l),d=s===0||o.fitness>=s;return{generation:0,population:l,bestIndividual:W(o),averageFitness:c,bestFitnessHistory:[o.fitness],averageFitnessHistory:[c],rngSeed:n,done:d,message:te(o.fitness,s,0,t.maxGenerations)}}function Me(t,n){if(n.done)return n;const s=t.target.length,a=Q(n.rngSeed+n.generation+1),r=V(D(n.population,t.target)),l=r[0]?W(r[0]):{genes:"",fitness:0},o=[l];for(;o.length=s||d>=t.maxGenerations;return{generation:d,population:c,bestIndividual:W(p),averageFitness:m,bestFitnessHistory:[...n.bestFitnessHistory,p.fitness],averageFitnessHistory:[...n.averageFitnessHistory,m],rngSeed:n.rngSeed,done:x,message:te(p.fitness,s,d,t.maxGenerations)}}const H=[220,261.63,293.66,329.63,392,440,523.25,659.25,783.99];function Ee(){const t=i.useRef(!0),n=i.useCallback(()=>de(),[]),s=i.useCallback(c=>{t.current=c},[]),a=i.useCallback((c,d,p,m=.05)=>{if(!t.current)return;const x=n();if(!x)return;const h=x.createOscillator(),v=x.createGain();h.type=d,h.frequency.setValueAtTime(c,x.currentTime),v.gain.setValueAtTime(m,x.currentTime),v.gain.exponentialRampToValueAtTime(.001,x.currentTime+p),h.connect(v),v.connect(x.destination),h.start(x.currentTime),h.stop(x.currentTime+p)},[n]),r=i.useCallback((c,d)=>{const p=d>0?c/d:0,m=Math.max(0,Math.min(H.length-1,Math.floor(p*(H.length-1))));a(H[m],"sine",.06,.03)},[a]),l=i.useCallback(()=>{a(523.25,"triangle",.08,.05)},[a]),o=i.useCallback(()=>{if(!t.current)return;const c=n();c&&[523.25,659.25,783.99].forEach((d,p)=>{const m=c.createOscillator(),x=c.createGain(),h=c.currentTime+p*.1;m.type="sine",m.frequency.setValueAtTime(d,h),x.gain.setValueAtTime(.06,h),x.gain.exponentialRampToValueAtTime(.001,h+.16),m.connect(x),x.connect(c.destination),m.start(h),m.stop(h+.16)})},[n]);return{setEnabled:s,playGenerationTick:r,playImprove:l,playComplete:o}}function Z(t){const n=t.toUpperCase();let s="";for(let a=0;a{n(g),g==="guided"&&(a("HELLO WORLD"),l(300),c(3),p(75),x(500),v("roulette"),M(35))},[]);i.useEffect(()=>{O(S)},[S,O]);const C=i.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null)},[]),z=i.useCallback(()=>({target:Z(s),populationSize:Math.max(1,r),mutationRate:Math.min(1,Math.max(0,o/100)),crossoverRate:Math.min(1,Math.max(0,d/100)),maxGenerations:Math.max(1,m),selectionStrategy:h,tournamentSize:5,allowedChars:J}),[s,r,o,d,m,h]),u=i.useCallback(()=>{N(g=>{if(!g||!E.current)return g;const T=Me(E.current,g),R=E.current.target.length;return G(T.bestIndividual.fitness,R),T.bestIndividual.fitness>F.current&&P(),F.current=T.bestIndividual.fitness,T.done&&(f(),y("finished")),T})},[G,P,f]);i.useEffect(()=>{if(j!=="running"){C();return}const g=()=>{u(),k.current=setTimeout(g,w)};return k.current=setTimeout(g,w),C},[j,w,u,C]);const se=i.useCallback(()=>{const g=z();E.current=g;const R=Re(g,1337);F.current=R.bestIndividual.fitness,N(R),R.bestIndividual.fitness>0&&G(R.bestIndividual.fitness,g.target.length),y(R.done?"finished":"running")},[z,G]),ne=i.useCallback(()=>{j==="running"&&y("paused")},[j]),ae=i.useCallback(()=>{j==="paused"&&y("running")},[j]),re=i.useCallback(()=>{C(),N(null),y("idle"),F.current=0},[C]),le=i.useCallback(g=>{A(g)},[]),ie=i.useCallback(()=>{const g=Math.floor(Math.random()*X.length);a(X[g])},[]),oe=i.useMemo(()=>b?.population?b.population.slice(0,10):[],[b]),ce=i.useMemo(()=>{const g=Math.max(1,Z(s).length);return(b?.bestIndividual.fitness??0)/g*100},[b,s]);return{mode:t,setMode:L,target:s,setTarget:a,populationSize:r,setPopulationSize:l,mutationRatePercent:o,setMutationRatePercent:c,crossoverRatePercent:d,setCrossoverRatePercent:p,maxGenerations:m,setMaxGenerations:x,selectionStrategy:h,setSelectionStrategy:v,speedMs:w,setSpeedMs:M,soundEnabled:S,toggleSound:le,state:b,status:j,topIndividuals:oe,convergence:ce,start:se,pause:ne,resume:ae,reset:re,randomTarget:ie}}const Ge=[{label:"Slow",value:120},{label:"Med",value:35},{label:"Fast",value:8}];function He(){const{mode:t,setMode:n,target:s,setTarget:a,populationSize:r,setPopulationSize:l,mutationRatePercent:o,setMutationRatePercent:c,crossoverRatePercent:d,setCrossoverRatePercent:p,maxGenerations:m,setMaxGenerations:x,selectionStrategy:h,setSelectionStrategy:v,speedMs:w,setSpeedMs:M,soundEnabled:S,toggleSound:A,state:b,status:N,topIndividuals:j,convergence:y,start:k,pause:E,resume:F,reset:O,randomTarget:G}=Fe(),P=N==="running",f=t==="guided",L=b?.bestIndividual,C=b?.averageFitness??0,z=Pe({status:N,generation:b?.generation??0,bestFitness:L?.fitness??0,targetLength:s.length,convergence:y});return e.jsx("div",{className:"flex-1 overflow-y-auto bg-[radial-gradient(circle_at_top,rgba(16,185,129,0.12),transparent_34%),linear-gradient(180deg,rgba(15,23,42,0),rgba(6,78,59,0.16))] p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-6xl space-y-4",children:[e.jsxs("section",{className:"relative overflow-hidden rounded-2xl border border-emerald-700/30 bg-[radial-gradient(circle_at_top_left,rgba(34,197,94,0.18),transparent_34%),linear-gradient(135deg,rgba(15,23,42,0.96),rgba(6,78,59,0.36))] p-4 shadow-2xl shadow-black/30 backdrop-blur-sm md:p-5",children:[e.jsx("div",{className:"pointer-events-none absolute right-6 top-4 text-7xl opacity-10",children:"🧬"}),e.jsx("h2",{className:"text-lg md:text-xl font-bold text-white",children:"Evolution Lab — Genetic Algorithm"}),e.jsx("p",{className:"text-xs text-emerald-100/65 mt-1",children:"Evolve a population of digital people toward a target phrase using selection, crossover, and mutation."}),e.jsx("div",{className:"mt-3 rounded-xl bg-emerald-500/10 ring-1 ring-emerald-500/20 px-3 py-2",children:e.jsx("p",{className:"text-[11px] text-emerald-50/80 leading-relaxed",children:"Each generation is a lab cycle: evaluate every person → select stronger parents → combine DNA → mutate a few genes → keep the elite survivor."})}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 md:max-w-sm",children:[e.jsx("button",{onClick:()=>n("guided"),className:`rounded-lg px-3 py-2 text-xs font-semibold ring-1 transition-all ${f?"bg-amber-500/20 text-amber-300 ring-amber-500/40":"bg-slate-800/60 text-slate-400 ring-slate-700/40 hover:bg-slate-700/60"}`,children:"Guided Mode"}),e.jsx("button",{onClick:()=>n("free-play"),className:`rounded-lg px-3 py-2 text-xs font-semibold ring-1 transition-all ${f?"bg-slate-800/60 text-slate-400 ring-slate-700/40 hover:bg-slate-700/60":"bg-cyan-500/20 text-cyan-300 ring-cyan-500/40"}`,children:"Free-play Mode"})]}),f&&e.jsx("p",{className:"mt-2 text-[10px] text-amber-300/80",children:"Guided mode uses recommended settings (HELLO WORLD, pop 300, mutation 3%, crossover 75%) for stable learning."}),f&&e.jsxs("div",{className:"mt-3 rounded-xl border border-amber-500/20 bg-amber-500/5 p-3",children:[e.jsx("h4",{className:"text-[10px] font-semibold uppercase tracking-wider text-amber-300",children:"Guided Walkthrough"}),e.jsx("p",{className:"mt-1 text-xs text-slate-300 leading-relaxed",children:z.main}),e.jsx("ul",{className:"mt-2 space-y-1 text-[11px] text-slate-400 list-disc pl-4",children:z.points.map(u=>e.jsx("li",{children:u},u))})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Target String"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("input",{value:s,onChange:u=>a(u.target.value),placeholder:"HELLO WORLD",disabled:f,className:"flex-1 rounded-lg bg-slate-950/70 px-3 py-2 text-sm text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-cyan-500/50"}),e.jsx("button",{onClick:G,disabled:f,className:"rounded-lg bg-slate-800/70 px-3 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:e.jsx(ue,{size:14})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Population Size"}),e.jsx("input",{type:"number",min:1,max:2e3,value:r,disabled:f,onChange:u=>l(Number(u.target.value)||1),className:"mt-1 w-full rounded-lg bg-slate-950/70 px-3 py-2 text-sm text-slate-200 ring-1 ring-slate-700/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Max Generations"}),e.jsx("input",{type:"number",min:1,max:2e4,value:m,disabled:f,onChange:u=>x(Number(u.target.value)||1),className:"mt-1 w-full rounded-lg bg-slate-950/70 px-3 py-2 text-sm text-slate-200 ring-1 ring-slate-700/50"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400 mb-1",children:[e.jsx("span",{children:"Mutation Rate"}),e.jsxs("span",{children:[o,"%"]})]}),e.jsx("input",{type:"range",min:0,max:100,value:o,disabled:f,onChange:u=>c(Number(u.target.value)),className:"w-full accent-rose-500"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400 mb-1",children:[e.jsx("span",{children:"Crossover Rate"}),e.jsxs("span",{children:[d,"%"]})]}),e.jsx("input",{type:"range",min:0,max:100,value:d,disabled:f,onChange:u=>p(Number(u.target.value)),className:"w-full accent-sky-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Selection Strategy"}),e.jsx("div",{className:"mt-1 grid grid-cols-2 gap-2",children:["roulette","tournament"].map(u=>e.jsx("button",{disabled:f,onClick:()=>v(u),className:`rounded-lg px-3 py-2 text-xs font-medium ring-1 transition-all ${h===u?"bg-emerald-500/20 text-emerald-300 ring-emerald-500/40":"bg-slate-800/60 text-slate-400 ring-slate-700/40 hover:bg-slate-700/60"}`,children:u==="roulette"?"Roulette Wheel":"Tournament"},u))})]})]})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsxs("button",{onClick:k,className:"inline-flex items-center gap-1.5 rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-semibold text-cyan-300 ring-1 ring-cyan-500/40 hover:bg-cyan-500/30",children:[e.jsx(B,{size:14})," Start"]}),e.jsxs("button",{onClick:P?E:F,disabled:N==="idle"||N==="finished",className:"inline-flex items-center gap-1.5 rounded-lg bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70 disabled:opacity-40",children:[P?e.jsx(xe,{size:14}):e.jsx(B,{size:14}),P?"Pause":"Resume"]}),e.jsxs("button",{onClick:O,className:"inline-flex items-center gap-1.5 rounded-lg bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[e.jsx(me,{size:14})," Reset"]}),e.jsxs("button",{onClick:()=>A(!S),className:`inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-semibold ring-1 ${S?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[S?e.jsx(ge,{size:14}):e.jsx(he,{size:14}),S?"Sound On":"Sound Off"]}),e.jsxs("div",{className:"ml-auto inline-flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] text-slate-500",children:"Speed"}),Ge.map(u=>e.jsx("button",{onClick:()=>M(u.value),className:`rounded px-2 py-1 text-[10px] font-medium ${w===u.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/60 text-slate-400 ring-1 ring-slate-700/40"}`,children:u.label},u.value))]})]})]}),e.jsx(ve,{population:j,target:s.toUpperCase(),generation:b?.generation??0,convergence:y,status:N}),e.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Statistics"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(I,{label:"Generation",value:b?.generation??0}),e.jsx(I,{label:"Best Fitness",value:`${L?.fitness??0} / ${s.length}`}),e.jsx(I,{label:"Avg Fitness",value:C.toFixed(2)}),e.jsx(I,{label:"Convergence",value:`${y.toFixed(1)}%`}),e.jsx(I,{label:"Mutation",value:`${o}%`}),e.jsx(I,{label:"Population",value:r})]}),e.jsx("p",{className:"mt-3 text-[11px] text-slate-400",children:b?.message??"Ready to evolve."})]}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(fe,{target:s.toUpperCase(),bestGenes:L?.genes??""})})]}),e.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsx(pe,{best:b?.bestFitnessHistory??[],avg:b?.averageFitnessHistory??[],targetLength:s.length})}),e.jsx(be,{population:j,target:s.toUpperCase()})]})]})})}function I({label:t,value:n}){return e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2.5 py-2 ring-1 ring-slate-700/40",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:t}),e.jsx("div",{className:"text-sm font-mono text-slate-100",children:n})]})}function Pe({status:t,generation:n,bestFitness:s,targetLength:a,convergence:r}){if(t==="idle")return{main:"Start the simulator to create the initial random population. Every individual has the same length as the target string.",points:["Fitness = number of correct characters in correct positions.","Roulette selection gives fitter strings higher chance to reproduce.","Elitism keeps the best individual every generation."]};if(t==="paused")return{main:"Simulation is paused. Compare the best and average fitness lines before continuing.",points:[`Current convergence is ${r.toFixed(1)}%.`,"If average fitness is catching best fitness, population is stabilizing.","Resume to observe further crossover + mutation effects."]};if(t==="finished"){const l=a>0&&s>=a;return{main:l?`Solved in ${n} generations. The best individual now exactly matches the target.`:`Reached max generations at ${r.toFixed(1)}% convergence without full match.`,points:l?["Notice how best fitness rose in steps when useful mutations appeared.","Average fitness should trend upward as good genes spread.","Try Free-play to test lower mutation or alternate selection strategy."]:["Try increasing max generations or population size.","Slightly higher mutation can help escape local plateaus.","Free-play mode lets you experiment with these trade-offs."]}}return n<10?{main:"Early phase: selection pressure is starting to amplify better character matches.",points:["Watch the best-fitness line jump when a useful mutation appears.","Average fitness may rise slowly at first—this is normal.","Crossover recombines partial matches from different parents."]}:r<60?{main:"Middle phase: the population is accumulating correct characters in more positions.",points:["Best fitness reflects the strongest candidate so far.","Average fitness indicates overall population quality.","Gap between best and average shows remaining diversity."]}:{main:"Late phase: convergence is high; progress often comes from rare beneficial mutations.",points:["Near the end, single-character improvements become more important.","If progress stalls, Free-play can help you tune mutation and generation budget.","Use Gene Comparison to see exactly which positions remain incorrect."]}}export{He as default}; +import{j as e,r as i}from"./index-CB1-0H6I.js";import{g as de}from"./audioContext-NbgqvQGz.js";import{S as ue}from"./shuffle-DZnyoAGL.js";import{P as B}from"./play-SZ6Nqtz8.js";import{P as xe}from"./pause-DgUWKqjY.js";import{R as me}from"./rotate-ccw-CDlWXRsI.js";import{V as ge,a as he}from"./volume-x-CKT6TOtL.js";function U(t,n,s,a){return t.length===0?"":t.length===1?`0,${s}`:t.map((r,l)=>{const o=l/(t.length-1)*n,c=s-Math.max(0,r)/Math.max(1,a)*s;return`${o},${c}`}).join(" ")}function pe({best:t,avg:n,targetLength:s}){const l=Math.max(s,...t,...n,1);return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-300",children:"Fitness Monitor"}),e.jsx("p",{className:"mt-0.5 text-[10px] text-slate-500",children:"Lab readout for best and average population health"})]}),e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("svg",{viewBox:"0 0 640 220",className:"w-full min-w-[560px] h-56 rounded-xl bg-slate-950/80 ring-1 ring-slate-700/50",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"fitnessGlow",x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(244 63 94)"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(52 211 153)"})]})}),e.jsx("line",{x1:"0",y1:220,x2:640,y2:220,stroke:"rgb(71 85 105 / 0.7)",strokeWidth:"1"}),e.jsx("line",{x1:"0",y1:"0",x2:"0",y2:220,stroke:"rgb(71 85 105 / 0.7)",strokeWidth:"1"}),s>0&&e.jsx("line",{x1:"0",y1:220-s/l*220,x2:640,y2:220-s/l*220,stroke:"rgb(74 222 128 / 0.35)",strokeDasharray:"4 4",strokeWidth:"1"}),e.jsx("polyline",{fill:"none",stroke:"url(#fitnessGlow)",strokeWidth:"3",points:U(t,640,220,l)}),e.jsx("polyline",{fill:"none",stroke:"rgb(56 189 248)",strokeWidth:"2",points:U(n,640,220,l)})]})}),e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-[10px] text-slate-400",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-rose-500"})," Best Fitness"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-sky-400"})," Average Fitness"]})]})]})}function be({population:t,target:n}){return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-300",children:"Candidate Profiles"}),e.jsx("p",{className:"mt-0.5 text-[10px] text-slate-500",children:"The strongest survivors in this generation"})]}),e.jsxs("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-semibold text-emerald-300 ring-1 ring-emerald-500/25",children:["Top ",t.length||0]})]}),e.jsx("div",{className:"space-y-1.5 max-h-72 overflow-auto pr-1",children:t.map((s,a)=>e.jsxs("div",{className:`rounded-xl px-3 py-2 ring-1 transition-all ${a===0?"bg-emerald-500/10 ring-emerald-500/30 shadow-lg shadow-emerald-950/20":"bg-slate-800/50 ring-slate-700/40"}`,children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-500",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`h-2 w-2 rounded-full ${a===0?"bg-emerald-400":"bg-slate-600"}`}),"Subject #",a+1]}),e.jsxs("span",{className:"font-mono",children:[s.fitness," / ",n.length]})]}),e.jsx("div",{className:"mt-1 font-mono text-xs text-slate-200 tracking-wide break-all",children:s.genes}),e.jsx("div",{className:"mt-2 h-1 overflow-hidden rounded-full bg-slate-950/70",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-emerald-400 to-cyan-300",style:{width:`${s.fitness/Math.max(1,n.length)*100}%`}})})]},`${s.genes}-${a}`))})]})}function fe({target:t,bestGenes:n}){return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-300",children:"DNA Match Board"}),e.jsx("p",{className:"mt-0.5 text-[10px] text-slate-500",children:"Green cells already match the target phrase"})]}),e.jsxs("div",{className:"space-y-3 font-mono text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-slate-500 mb-1",children:"Target"}),e.jsx("div",{className:"rounded-xl bg-slate-950/70 ring-1 ring-slate-700/40 px-3 py-2 break-all tracking-wide text-slate-200",children:t||"(empty)"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-slate-500 mb-1",children:"Best Individual"}),e.jsxs("div",{className:"rounded-xl bg-slate-950/70 ring-1 ring-slate-700/40 px-3 py-2 break-all tracking-wide",children:[(n||"").split("").map((s,a)=>{const r=t[a]===s;return e.jsx("span",{className:`mx-0.5 inline-flex min-w-5 justify-center rounded px-1 py-0.5 ${r?"bg-emerald-500/20 text-emerald-200 ring-1 ring-emerald-500/30":"bg-slate-800/60 text-slate-300 ring-1 ring-slate-700/40"}`,children:s},`${s}-${a}`)}),!n&&e.jsx("span",{className:"text-slate-500",children:"Start the simulator to see candidate DNA."})]})]})]})]})}const q=["#f8c9a5","#d99b6c","#8d5524","#f1b982","#c68642"],K=["#22c55e","#38bdf8","#a78bfa","#fb7185","#facc15","#2dd4bf"];function ve({population:t,target:n,generation:s,convergence:a,status:r}){const l=t.length>0?t.slice(0,12):Array.from({length:12},(c,d)=>({genes:"????",fitness:Math.max(0,12-d)})),o=Math.max(1,n.length);return e.jsxs("section",{className:"relative overflow-hidden rounded-2xl border border-emerald-700/30 bg-[radial-gradient(circle_at_top_left,rgba(16,185,129,0.18),transparent_34%),linear-gradient(135deg,rgba(15,23,42,0.96),rgba(6,78,59,0.42))] p-4 shadow-2xl shadow-black/30 md:p-5",children:[e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-28 bg-gradient-to-t from-emerald-950/50 to-transparent"}),e.jsxs("div",{className:"relative z-10 flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-bold text-white md:text-lg",children:"Population Habitat"}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-emerald-100/65",children:"Each person is a candidate solution. Brighter badges mean more matching genes survived selection."})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[e.jsx(_,{label:"Gen",value:s}),e.jsx(_,{label:"Fit",value:`${a.toFixed(0)}%`}),e.jsx(_,{label:"State",value:r})]})]}),e.jsxs("div",{className:"relative z-10 mt-5 rounded-2xl border border-emerald-950/50 bg-emerald-950/25 p-4 shadow-inner",children:[e.jsx("div",{className:"absolute inset-x-6 bottom-3 h-10 rounded-[50%] bg-black/20 blur-xl"}),e.jsx("div",{className:"relative grid grid-cols-3 gap-x-3 gap-y-5 sm:grid-cols-4 lg:grid-cols-6",children:l.map((c,d)=>{const p=c.fitness/o,m=d===0&&t.length>0;return e.jsx(je,{rank:d+1,genes:c.genes,fitnessRatio:p,isElite:m,skin:q[d%q.length],shirt:K[d%K.length]},`${c.genes}-${d}`)})})]})]})}function je({rank:t,genes:n,fitnessRatio:s,isElite:a,skin:r,shirt:l}){const o=Math.max(0,Math.min(1,s)),c=a?"shadow-[0_0_26px_rgba(52,211,153,0.45)]":"",d=.4+o*.6;return e.jsxs("div",{className:`group relative flex flex-col items-center rounded-2xl border px-2 py-3 transition-all hover:-translate-y-1 ${a?"border-emerald-300/50 bg-emerald-400/10":"border-emerald-900/30 bg-slate-950/25"} ${c}`,children:[e.jsxs("div",{className:"absolute right-1.5 top-1.5 rounded-full bg-slate-950/70 px-1.5 py-0.5 text-[9px] font-bold text-slate-400 ring-1 ring-slate-700/50",children:["#",t]}),e.jsxs("div",{className:"relative mt-2",children:[e.jsxs("div",{className:"h-9 w-9 rounded-full border border-black/15 shadow-inner",style:{backgroundColor:r,opacity:d},children:[e.jsxs("div",{className:"mx-auto mt-3 flex w-4 justify-between",children:[e.jsx("span",{className:"h-1 w-1 rounded-full bg-slate-950/70"}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-slate-950/70"})]}),e.jsx("div",{className:"mx-auto mt-1 h-1 w-3 rounded-full bg-slate-950/40"})]}),e.jsx("div",{className:"mx-auto -mt-1 h-10 w-12 rounded-t-2xl rounded-b-lg border border-black/15 shadow-lg",style:{backgroundColor:l,opacity:d}})]}),e.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-slate-950/70",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-emerald-400 to-cyan-300 transition-all",style:{width:`${o*100}%`}})}),e.jsx("div",{className:"mt-1 max-w-full truncate font-mono text-[9px] text-emerald-100/70",children:n||"waiting"})]})}function _({label:t,value:n}){return e.jsxs("div",{className:"rounded-xl bg-slate-950/45 px-3 py-2 ring-1 ring-emerald-500/20",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-wider text-emerald-100/45",children:t}),e.jsx("div",{className:"mt-0.5 text-xs font-bold capitalize text-emerald-100",children:n})]})}const J="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,!?-",$={target:"HELLO WORLD",populationSize:300,mutationRate:.03,crossoverRate:.75,maxGenerations:500,selectionStrategy:"roulette"},X=["HELLO WORLD","GENETIC ALGORITHM","EVOLUTION IN ACTION","SURVIVAL OF THE FITTEST","OPTIMIZE THE GENES"];function Q(t){let n=t>>>0;const s=()=>(n=1664525*n+1013904223>>>0,n/4294967296);return{next:s,int:(r,l)=>l<=r?r:Math.floor(s()*(l-r+1))+r}}function Ne(t,n,s){let a="";for(let r=0;r({...s,fitness:we(s.genes,n)}))}function ee(t){return t.length===0?0:t.reduce((s,a)=>s+a.fitness,0)/t.length}function Se(t,n){const s=t.reduce((l,o)=>l+o.fitness,0);if(s<=0)return t[n.int(0,t.length-1)];const a=n.next()*s;let r=0;for(let l=0;l=a)return t[l];return t[t.length-1]}function ke(t,n,s){let a=t[s.int(0,t.length-1)];const r=Math.max(1,n);for(let l=1;la.fitness&&(a=o)}return a}function Y(t,n,s,a){return n==="tournament"?ke(t,s,a):Se(t,a)}function Ce(t,n,s,a){const r=t.genes.length;if(r<=1||a.next()>s)return t.genes;const l=a.int(1,r-1);return t.genes.slice(0,l)+n.genes.slice(l)}function Te(t,n,s,a){if(t.length===0)return t;let r="";for(let l=0;ls.fitness-n.fitness)}function te(t,n,s,a){return n===0?"Target is empty. Enter a target to evolve.":t>=n?`Solution found in ${s} generations`:s>=a?"Max generations reached without full match":"Evolving..."}function Re(t,n){const s=t.target.length,a=Q(n),r=ye(t.populationSize,s,t.allowedChars,a),l=V(D(r,t.target)),o=l[0]??{genes:"",fitness:0},c=ee(l),d=s===0||o.fitness>=s;return{generation:0,population:l,bestIndividual:W(o),averageFitness:c,bestFitnessHistory:[o.fitness],averageFitnessHistory:[c],rngSeed:n,done:d,message:te(o.fitness,s,0,t.maxGenerations)}}function Me(t,n){if(n.done)return n;const s=t.target.length,a=Q(n.rngSeed+n.generation+1),r=V(D(n.population,t.target)),l=r[0]?W(r[0]):{genes:"",fitness:0},o=[l];for(;o.length=s||d>=t.maxGenerations;return{generation:d,population:c,bestIndividual:W(p),averageFitness:m,bestFitnessHistory:[...n.bestFitnessHistory,p.fitness],averageFitnessHistory:[...n.averageFitnessHistory,m],rngSeed:n.rngSeed,done:x,message:te(p.fitness,s,d,t.maxGenerations)}}const H=[220,261.63,293.66,329.63,392,440,523.25,659.25,783.99];function Ee(){const t=i.useRef(!0),n=i.useCallback(()=>de(),[]),s=i.useCallback(c=>{t.current=c},[]),a=i.useCallback((c,d,p,m=.05)=>{if(!t.current)return;const x=n();if(!x)return;const h=x.createOscillator(),v=x.createGain();h.type=d,h.frequency.setValueAtTime(c,x.currentTime),v.gain.setValueAtTime(m,x.currentTime),v.gain.exponentialRampToValueAtTime(.001,x.currentTime+p),h.connect(v),v.connect(x.destination),h.start(x.currentTime),h.stop(x.currentTime+p)},[n]),r=i.useCallback((c,d)=>{const p=d>0?c/d:0,m=Math.max(0,Math.min(H.length-1,Math.floor(p*(H.length-1))));a(H[m],"sine",.06,.03)},[a]),l=i.useCallback(()=>{a(523.25,"triangle",.08,.05)},[a]),o=i.useCallback(()=>{if(!t.current)return;const c=n();c&&[523.25,659.25,783.99].forEach((d,p)=>{const m=c.createOscillator(),x=c.createGain(),h=c.currentTime+p*.1;m.type="sine",m.frequency.setValueAtTime(d,h),x.gain.setValueAtTime(.06,h),x.gain.exponentialRampToValueAtTime(.001,h+.16),m.connect(x),x.connect(c.destination),m.start(h),m.stop(h+.16)})},[n]);return{setEnabled:s,playGenerationTick:r,playImprove:l,playComplete:o}}function Z(t){const n=t.toUpperCase();let s="";for(let a=0;a{n(g),g==="guided"&&(a("HELLO WORLD"),l(300),c(3),p(75),x(500),v("roulette"),M(35))},[]);i.useEffect(()=>{O(S)},[S,O]);const C=i.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null)},[]),z=i.useCallback(()=>({target:Z(s),populationSize:Math.max(1,r),mutationRate:Math.min(1,Math.max(0,o/100)),crossoverRate:Math.min(1,Math.max(0,d/100)),maxGenerations:Math.max(1,m),selectionStrategy:h,tournamentSize:5,allowedChars:J}),[s,r,o,d,m,h]),u=i.useCallback(()=>{N(g=>{if(!g||!E.current)return g;const T=Me(E.current,g),R=E.current.target.length;return G(T.bestIndividual.fitness,R),T.bestIndividual.fitness>F.current&&P(),F.current=T.bestIndividual.fitness,T.done&&(f(),y("finished")),T})},[G,P,f]);i.useEffect(()=>{if(j!=="running"){C();return}const g=()=>{u(),k.current=setTimeout(g,w)};return k.current=setTimeout(g,w),C},[j,w,u,C]);const se=i.useCallback(()=>{const g=z();E.current=g;const R=Re(g,1337);F.current=R.bestIndividual.fitness,N(R),R.bestIndividual.fitness>0&&G(R.bestIndividual.fitness,g.target.length),y(R.done?"finished":"running")},[z,G]),ne=i.useCallback(()=>{j==="running"&&y("paused")},[j]),ae=i.useCallback(()=>{j==="paused"&&y("running")},[j]),re=i.useCallback(()=>{C(),N(null),y("idle"),F.current=0},[C]),le=i.useCallback(g=>{A(g)},[]),ie=i.useCallback(()=>{const g=Math.floor(Math.random()*X.length);a(X[g])},[]),oe=i.useMemo(()=>b?.population?b.population.slice(0,10):[],[b]),ce=i.useMemo(()=>{const g=Math.max(1,Z(s).length);return(b?.bestIndividual.fitness??0)/g*100},[b,s]);return{mode:t,setMode:L,target:s,setTarget:a,populationSize:r,setPopulationSize:l,mutationRatePercent:o,setMutationRatePercent:c,crossoverRatePercent:d,setCrossoverRatePercent:p,maxGenerations:m,setMaxGenerations:x,selectionStrategy:h,setSelectionStrategy:v,speedMs:w,setSpeedMs:M,soundEnabled:S,toggleSound:le,state:b,status:j,topIndividuals:oe,convergence:ce,start:se,pause:ne,resume:ae,reset:re,randomTarget:ie}}const Ge=[{label:"Slow",value:120},{label:"Med",value:35},{label:"Fast",value:8}];function He(){const{mode:t,setMode:n,target:s,setTarget:a,populationSize:r,setPopulationSize:l,mutationRatePercent:o,setMutationRatePercent:c,crossoverRatePercent:d,setCrossoverRatePercent:p,maxGenerations:m,setMaxGenerations:x,selectionStrategy:h,setSelectionStrategy:v,speedMs:w,setSpeedMs:M,soundEnabled:S,toggleSound:A,state:b,status:N,topIndividuals:j,convergence:y,start:k,pause:E,resume:F,reset:O,randomTarget:G}=Fe(),P=N==="running",f=t==="guided",L=b?.bestIndividual,C=b?.averageFitness??0,z=Pe({status:N,generation:b?.generation??0,bestFitness:L?.fitness??0,targetLength:s.length,convergence:y});return e.jsx("div",{className:"flex-1 overflow-y-auto bg-[radial-gradient(circle_at_top,rgba(16,185,129,0.12),transparent_34%),linear-gradient(180deg,rgba(15,23,42,0),rgba(6,78,59,0.16))] p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-6xl space-y-4",children:[e.jsxs("section",{className:"relative overflow-hidden rounded-2xl border border-emerald-700/30 bg-[radial-gradient(circle_at_top_left,rgba(34,197,94,0.18),transparent_34%),linear-gradient(135deg,rgba(15,23,42,0.96),rgba(6,78,59,0.36))] p-4 shadow-2xl shadow-black/30 backdrop-blur-sm md:p-5",children:[e.jsx("div",{className:"pointer-events-none absolute right-6 top-4 text-7xl opacity-10",children:"🧬"}),e.jsx("h2",{className:"text-lg md:text-xl font-bold text-white",children:"Evolution Lab — Genetic Algorithm"}),e.jsx("p",{className:"text-xs text-emerald-100/65 mt-1",children:"Evolve a population of digital people toward a target phrase using selection, crossover, and mutation."}),e.jsx("div",{className:"mt-3 rounded-xl bg-emerald-500/10 ring-1 ring-emerald-500/20 px-3 py-2",children:e.jsx("p",{className:"text-[11px] text-emerald-50/80 leading-relaxed",children:"Each generation is a lab cycle: evaluate every person → select stronger parents → combine DNA → mutate a few genes → keep the elite survivor."})}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 md:max-w-sm",children:[e.jsx("button",{onClick:()=>n("guided"),className:`rounded-lg px-3 py-2 text-xs font-semibold ring-1 transition-all ${f?"bg-amber-500/20 text-amber-300 ring-amber-500/40":"bg-slate-800/60 text-slate-400 ring-slate-700/40 hover:bg-slate-700/60"}`,children:"Guided Mode"}),e.jsx("button",{onClick:()=>n("free-play"),className:`rounded-lg px-3 py-2 text-xs font-semibold ring-1 transition-all ${f?"bg-slate-800/60 text-slate-400 ring-slate-700/40 hover:bg-slate-700/60":"bg-cyan-500/20 text-cyan-300 ring-cyan-500/40"}`,children:"Free-play Mode"})]}),f&&e.jsx("p",{className:"mt-2 text-[10px] text-amber-300/80",children:"Guided mode uses recommended settings (HELLO WORLD, pop 300, mutation 3%, crossover 75%) for stable learning."}),f&&e.jsxs("div",{className:"mt-3 rounded-xl border border-amber-500/20 bg-amber-500/5 p-3",children:[e.jsx("h4",{className:"text-[10px] font-semibold uppercase tracking-wider text-amber-300",children:"Guided Walkthrough"}),e.jsx("p",{className:"mt-1 text-xs text-slate-300 leading-relaxed",children:z.main}),e.jsx("ul",{className:"mt-2 space-y-1 text-[11px] text-slate-400 list-disc pl-4",children:z.points.map(u=>e.jsx("li",{children:u},u))})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Target String"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("input",{value:s,onChange:u=>a(u.target.value),placeholder:"HELLO WORLD",disabled:f,className:"flex-1 rounded-lg bg-slate-950/70 px-3 py-2 text-sm text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-cyan-500/50"}),e.jsx("button",{onClick:G,disabled:f,className:"rounded-lg bg-slate-800/70 px-3 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:e.jsx(ue,{size:14})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Population Size"}),e.jsx("input",{type:"number",min:1,max:2e3,value:r,disabled:f,onChange:u=>l(Number(u.target.value)||1),className:"mt-1 w-full rounded-lg bg-slate-950/70 px-3 py-2 text-sm text-slate-200 ring-1 ring-slate-700/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Max Generations"}),e.jsx("input",{type:"number",min:1,max:2e4,value:m,disabled:f,onChange:u=>x(Number(u.target.value)||1),className:"mt-1 w-full rounded-lg bg-slate-950/70 px-3 py-2 text-sm text-slate-200 ring-1 ring-slate-700/50"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400 mb-1",children:[e.jsx("span",{children:"Mutation Rate"}),e.jsxs("span",{children:[o,"%"]})]}),e.jsx("input",{type:"range",min:0,max:100,value:o,disabled:f,onChange:u=>c(Number(u.target.value)),className:"w-full accent-rose-500"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400 mb-1",children:[e.jsx("span",{children:"Crossover Rate"}),e.jsxs("span",{children:[d,"%"]})]}),e.jsx("input",{type:"range",min:0,max:100,value:d,disabled:f,onChange:u=>p(Number(u.target.value)),className:"w-full accent-sky-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Selection Strategy"}),e.jsx("div",{className:"mt-1 grid grid-cols-2 gap-2",children:["roulette","tournament"].map(u=>e.jsx("button",{disabled:f,onClick:()=>v(u),className:`rounded-lg px-3 py-2 text-xs font-medium ring-1 transition-all ${h===u?"bg-emerald-500/20 text-emerald-300 ring-emerald-500/40":"bg-slate-800/60 text-slate-400 ring-slate-700/40 hover:bg-slate-700/60"}`,children:u==="roulette"?"Roulette Wheel":"Tournament"},u))})]})]})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsxs("button",{onClick:k,className:"inline-flex items-center gap-1.5 rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-semibold text-cyan-300 ring-1 ring-cyan-500/40 hover:bg-cyan-500/30",children:[e.jsx(B,{size:14})," Start"]}),e.jsxs("button",{onClick:P?E:F,disabled:N==="idle"||N==="finished",className:"inline-flex items-center gap-1.5 rounded-lg bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70 disabled:opacity-40",children:[P?e.jsx(xe,{size:14}):e.jsx(B,{size:14}),P?"Pause":"Resume"]}),e.jsxs("button",{onClick:O,className:"inline-flex items-center gap-1.5 rounded-lg bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[e.jsx(me,{size:14})," Reset"]}),e.jsxs("button",{onClick:()=>A(!S),className:`inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-semibold ring-1 ${S?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[S?e.jsx(ge,{size:14}):e.jsx(he,{size:14}),S?"Sound On":"Sound Off"]}),e.jsxs("div",{className:"ml-auto inline-flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] text-slate-500",children:"Speed"}),Ge.map(u=>e.jsx("button",{onClick:()=>M(u.value),className:`rounded px-2 py-1 text-[10px] font-medium ${w===u.value?"bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-500/40":"bg-slate-800/60 text-slate-400 ring-1 ring-slate-700/40"}`,children:u.label},u.value))]})]})]}),e.jsx(ve,{population:j,target:s.toUpperCase(),generation:b?.generation??0,convergence:y,status:N}),e.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/70 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Statistics"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(I,{label:"Generation",value:b?.generation??0}),e.jsx(I,{label:"Best Fitness",value:`${L?.fitness??0} / ${s.length}`}),e.jsx(I,{label:"Avg Fitness",value:C.toFixed(2)}),e.jsx(I,{label:"Convergence",value:`${y.toFixed(1)}%`}),e.jsx(I,{label:"Mutation",value:`${o}%`}),e.jsx(I,{label:"Population",value:r})]}),e.jsx("p",{className:"mt-3 text-[11px] text-slate-400",children:b?.message??"Ready to evolve."})]}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(fe,{target:s.toUpperCase(),bestGenes:L?.genes??""})})]}),e.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsx(pe,{best:b?.bestFitnessHistory??[],avg:b?.averageFitnessHistory??[],targetLength:s.length})}),e.jsx(be,{population:j,target:s.toUpperCase()})]})]})})}function I({label:t,value:n}){return e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2.5 py-2 ring-1 ring-slate-700/40",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:t}),e.jsx("div",{className:"text-sm font-mono text-slate-100",children:n})]})}function Pe({status:t,generation:n,bestFitness:s,targetLength:a,convergence:r}){if(t==="idle")return{main:"Start the simulator to create the initial random population. Every individual has the same length as the target string.",points:["Fitness = number of correct characters in correct positions.","Roulette selection gives fitter strings higher chance to reproduce.","Elitism keeps the best individual every generation."]};if(t==="paused")return{main:"Simulation is paused. Compare the best and average fitness lines before continuing.",points:[`Current convergence is ${r.toFixed(1)}%.`,"If average fitness is catching best fitness, population is stabilizing.","Resume to observe further crossover + mutation effects."]};if(t==="finished"){const l=a>0&&s>=a;return{main:l?`Solved in ${n} generations. The best individual now exactly matches the target.`:`Reached max generations at ${r.toFixed(1)}% convergence without full match.`,points:l?["Notice how best fitness rose in steps when useful mutations appeared.","Average fitness should trend upward as good genes spread.","Try Free-play to test lower mutation or alternate selection strategy."]:["Try increasing max generations or population size.","Slightly higher mutation can help escape local plateaus.","Free-play mode lets you experiment with these trade-offs."]}}return n<10?{main:"Early phase: selection pressure is starting to amplify better character matches.",points:["Watch the best-fitness line jump when a useful mutation appears.","Average fitness may rise slowly at first—this is normal.","Crossover recombines partial matches from different parents."]}:r<60?{main:"Middle phase: the population is accumulating correct characters in more positions.",points:["Best fitness reflects the strongest candidate so far.","Average fitness indicates overall population quality.","Gap between best and average shows remaining diversity."]}:{main:"Late phase: convergence is high; progress often comes from rare beneficial mutations.",points:["Near the end, single-character improvements become more important.","If progress stalls, Free-play can help you tune mutation and generation budget.","Use Gene Comparison to see exactly which positions remain incorrect."]}}export{He as default}; diff --git a/docs/assets/FibonacciGamePage-BpvILNCs.js b/docs/assets/FibonacciGamePage-ZpMjqDh9.js similarity index 98% rename from docs/assets/FibonacciGamePage-BpvILNCs.js rename to docs/assets/FibonacciGamePage-ZpMjqDh9.js index b3b769c..89523b6 100644 --- a/docs/assets/FibonacciGamePage-BpvILNCs.js +++ b/docs/assets/FibonacciGamePage-ZpMjqDh9.js @@ -1,4 +1,4 @@ -import{c as re,r as x,j as e}from"./index-lLadk08S.js";import{T as le}from"./trophy-BeLgwZ5q.js";import{F as oe,L as ce}from"./lightbulb-CbLvQr23.js";import{T as de}from"./timer-Baa2rAz8.js";import{R as xe}from"./rotate-ccw-DMjSdzg2.js";import{V as me,a as ue}from"./volume-x-CjLNPeax.js";import{g as fe}from"./audioContext-NbgqvQGz.js";const he=[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],ge=re("lightbulb-off",he),pe=["right","up","left","down"],D={guided:{name:"Guided",description:"Learn step-by-step with hints and formula guidance."},challenge:{name:"Challenge",description:"Race against time! Pick the right block from multiple choices."},sandbox:{name:"Sandbox",description:"Explore freely with no scoring or time pressure."}},C={title:"Fibonacci Spiral Builder",subtitle:"Inspired by Leonardo Fibonacci",what:"Build a golden spiral by placing squares in the Fibonacci sequence. Each square's side length equals the sum of the two before it (1, 1, 2, 3, 5, 8, 13...). As you place them, a beautiful spiral emerges — the same pattern found in sunflowers, seashells, and galaxies.",skills:["Pattern Recognition","Mathematical Sequences","Spatial Reasoning","Golden Ratio Intuition"]};function W(t){if(t.length===0)return{minX:0,minY:0,maxX:0,maxY:0};let s=1/0,a=1/0,o=-1/0,n=-1/0;for(const l of t)s=Math.min(s,l.x),a=Math.min(a,l.y),o=Math.max(o,l.x+l.size),n=Math.max(n,l.y+l.size);return{minX:s,minY:a,maxX:o,maxY:n}}function be(t,s,a){if(t.length===0)return{x:0,y:0,direction:"right"};if(t.length===1){const i=t[0];return{x:i.x+i.size,y:i.y,direction:"right"}}const o=W(t),n=pe[a%4];let l=0,d=0;switch(n){case"right":l=o.maxX,d=o.maxY-s;break;case"up":l=o.maxX-s,d=o.minY-s;break;case"left":l=o.minX-s,d=o.minY;break;case"down":l=o.minX,d=o.maxY;break}return{x:l,y:d,direction:n}}function je(t){const{x:s,y:a,size:o,direction:n}=t,l=o;switch(n){case"right":return`M ${s} ${a+o} A ${l} ${l} 0 0 1 ${s+o} ${a}`;case"up":return`M ${s+o} ${a+o} A ${l} ${l} 0 0 1 ${s} ${a}`;case"left":return`M ${s+o} ${a} A ${l} ${l} 0 0 1 ${s} ${a+o}`;case"down":return`M ${s} ${a} A ${l} ${l} 0 0 1 ${s+o} ${a+o}`;default:return""}}function B(){return[{id:0,size:1,x:0,y:0,direction:"right",fibIndex:0},{id:1,size:1,x:1,y:0,direction:"right",fibIndex:1}]}const I=["#818cf8","#a78bfa","#c084fc","#e879f9","#f472b6","#fb7185","#f97316","#facc15","#4ade80","#34d399","#2dd4bf","#22d3ee","#38bdf8","#60a5fa","#818cf8","#a78bfa"];function Ne({placedSquares:t,lastPlacedId:s}){const{viewBox:a,squares:o}=x.useMemo(()=>{if(t.length===0)return{viewBox:"-5 -5 10 10",squares:[]};const n=W(t),l=Math.max((n.maxX-n.minX)*.15,2);return{viewBox:`${n.minX-l} ${n.minY-l} ${n.maxX-n.minX+l*2} ${n.maxY-n.minY+l*2}`,squares:t}},[t]);return t.length===0?e.jsx("div",{className:"flex flex-1 w-full min-h-[200px] h-full items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500",children:"Place the first block to begin"}):e.jsx("div",{className:"flex-1 w-full min-h-[200px] rounded-xl border border-slate-700/50 bg-slate-950/80 p-2 shadow-2xl backdrop-blur-sm overflow-hidden",children:e.jsxs("svg",{viewBox:a,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[e.jsx("defs",{children:e.jsxs("filter",{id:"glow",children:[e.jsx("feGaussianBlur",{stdDeviation:"0.5",result:"coloredBlur"}),e.jsxs("feMerge",{children:[e.jsx("feMergeNode",{in:"coloredBlur"}),e.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),o.map((n,l)=>{const d=I[l%I.length],i=n.id===s;return e.jsxs("g",{children:[e.jsx("rect",{x:n.x,y:n.y,width:n.size,height:n.size,fill:d,fillOpacity:.12,stroke:d,strokeWidth:Math.max(n.size*.02,.15),strokeOpacity:.6,rx:n.size*.02,className:i?"animate-pulse":"",filter:i?"url(#glow)":void 0}),e.jsx("text",{x:n.x+n.size/2,y:n.y+n.size/2,textAnchor:"middle",dominantBaseline:"central",fill:d,fillOpacity:.7,fontSize:Math.max(n.size*.35,.6),fontWeight:700,fontFamily:"ui-monospace, monospace",children:n.size})]},n.id)}),o.map((n,l)=>{const d=I[l%I.length],i=je(n);return e.jsx("path",{d:i,fill:"none",stroke:d,strokeWidth:Math.max(n.size*.03,.15),strokeOpacity:.8,strokeLinecap:"round"},`arc-${n.id}`)})]})})}function ye({blocks:t,mode:s,lastError:a,shakeBlockId:o,isComplete:n,onPlaceBlock:l}){const[d,i]=x.useState("");if(n)return e.jsxs("div",{className:"rounded-xl border border-emerald-500/30 bg-emerald-500/5 p-6 text-center",children:[e.jsx("div",{className:"text-3xl mb-2",children:"🎉"}),e.jsx("p",{className:"text-emerald-300 font-semibold text-sm",children:"Spiral Complete!"}),e.jsx("p",{className:"text-emerald-400/60 text-xs mt-1",children:"Beautiful golden spiral achieved"})]});const r=()=>{const c=parseInt(d,10);isNaN(c)||c<=0||(l(c),i(""))},u=s==="sandbox";return e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Place Next Block"}),u?e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"number",inputMode:"numeric",value:d,onChange:c=>i(c.target.value),onKeyDown:c=>c.key==="Enter"&&r(),placeholder:"Enter next number...",className:"flex-1 rounded-lg bg-slate-800/60 px-3 py-3 text-center text-lg font-mono font-bold text-white placeholder-slate-500 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50"}),e.jsx("button",{onClick:r,disabled:!d.trim(),className:"rounded-lg bg-gradient-to-br from-indigo-500/20 to-violet-500/20 px-5 py-3 text-sm font-semibold text-indigo-200 ring-1 ring-indigo-500/30 transition-all hover:from-indigo-500/30 hover:to-violet-500/30 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed",children:"Place"})]}):e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:t.map(c=>{const m=o===c.size;return e.jsx("button",{onClick:()=>l(c.size),className:` +import{c as re,r as x,j as e}from"./index-CB1-0H6I.js";import{T as le}from"./trophy-DE-EF49m.js";import{F as oe,L as ce}from"./lightbulb-Bmtk7V6i.js";import{T as de}from"./timer-rgbBx2U0.js";import{R as xe}from"./rotate-ccw-CDlWXRsI.js";import{V as me,a as ue}from"./volume-x-CKT6TOtL.js";import{g as fe}from"./audioContext-NbgqvQGz.js";const he=[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],ge=re("lightbulb-off",he),pe=["right","up","left","down"],D={guided:{name:"Guided",description:"Learn step-by-step with hints and formula guidance."},challenge:{name:"Challenge",description:"Race against time! Pick the right block from multiple choices."},sandbox:{name:"Sandbox",description:"Explore freely with no scoring or time pressure."}},C={title:"Fibonacci Spiral Builder",subtitle:"Inspired by Leonardo Fibonacci",what:"Build a golden spiral by placing squares in the Fibonacci sequence. Each square's side length equals the sum of the two before it (1, 1, 2, 3, 5, 8, 13...). As you place them, a beautiful spiral emerges — the same pattern found in sunflowers, seashells, and galaxies.",skills:["Pattern Recognition","Mathematical Sequences","Spatial Reasoning","Golden Ratio Intuition"]};function W(t){if(t.length===0)return{minX:0,minY:0,maxX:0,maxY:0};let s=1/0,a=1/0,o=-1/0,n=-1/0;for(const l of t)s=Math.min(s,l.x),a=Math.min(a,l.y),o=Math.max(o,l.x+l.size),n=Math.max(n,l.y+l.size);return{minX:s,minY:a,maxX:o,maxY:n}}function be(t,s,a){if(t.length===0)return{x:0,y:0,direction:"right"};if(t.length===1){const i=t[0];return{x:i.x+i.size,y:i.y,direction:"right"}}const o=W(t),n=pe[a%4];let l=0,d=0;switch(n){case"right":l=o.maxX,d=o.maxY-s;break;case"up":l=o.maxX-s,d=o.minY-s;break;case"left":l=o.minX-s,d=o.minY;break;case"down":l=o.minX,d=o.maxY;break}return{x:l,y:d,direction:n}}function je(t){const{x:s,y:a,size:o,direction:n}=t,l=o;switch(n){case"right":return`M ${s} ${a+o} A ${l} ${l} 0 0 1 ${s+o} ${a}`;case"up":return`M ${s+o} ${a+o} A ${l} ${l} 0 0 1 ${s} ${a}`;case"left":return`M ${s+o} ${a} A ${l} ${l} 0 0 1 ${s} ${a+o}`;case"down":return`M ${s} ${a} A ${l} ${l} 0 0 1 ${s+o} ${a+o}`;default:return""}}function B(){return[{id:0,size:1,x:0,y:0,direction:"right",fibIndex:0},{id:1,size:1,x:1,y:0,direction:"right",fibIndex:1}]}const I=["#818cf8","#a78bfa","#c084fc","#e879f9","#f472b6","#fb7185","#f97316","#facc15","#4ade80","#34d399","#2dd4bf","#22d3ee","#38bdf8","#60a5fa","#818cf8","#a78bfa"];function Ne({placedSquares:t,lastPlacedId:s}){const{viewBox:a,squares:o}=x.useMemo(()=>{if(t.length===0)return{viewBox:"-5 -5 10 10",squares:[]};const n=W(t),l=Math.max((n.maxX-n.minX)*.15,2);return{viewBox:`${n.minX-l} ${n.minY-l} ${n.maxX-n.minX+l*2} ${n.maxY-n.minY+l*2}`,squares:t}},[t]);return t.length===0?e.jsx("div",{className:"flex flex-1 w-full min-h-[200px] h-full items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500",children:"Place the first block to begin"}):e.jsx("div",{className:"flex-1 w-full min-h-[200px] rounded-xl border border-slate-700/50 bg-slate-950/80 p-2 shadow-2xl backdrop-blur-sm overflow-hidden",children:e.jsxs("svg",{viewBox:a,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[e.jsx("defs",{children:e.jsxs("filter",{id:"glow",children:[e.jsx("feGaussianBlur",{stdDeviation:"0.5",result:"coloredBlur"}),e.jsxs("feMerge",{children:[e.jsx("feMergeNode",{in:"coloredBlur"}),e.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),o.map((n,l)=>{const d=I[l%I.length],i=n.id===s;return e.jsxs("g",{children:[e.jsx("rect",{x:n.x,y:n.y,width:n.size,height:n.size,fill:d,fillOpacity:.12,stroke:d,strokeWidth:Math.max(n.size*.02,.15),strokeOpacity:.6,rx:n.size*.02,className:i?"animate-pulse":"",filter:i?"url(#glow)":void 0}),e.jsx("text",{x:n.x+n.size/2,y:n.y+n.size/2,textAnchor:"middle",dominantBaseline:"central",fill:d,fillOpacity:.7,fontSize:Math.max(n.size*.35,.6),fontWeight:700,fontFamily:"ui-monospace, monospace",children:n.size})]},n.id)}),o.map((n,l)=>{const d=I[l%I.length],i=je(n);return e.jsx("path",{d:i,fill:"none",stroke:d,strokeWidth:Math.max(n.size*.03,.15),strokeOpacity:.8,strokeLinecap:"round"},`arc-${n.id}`)})]})})}function ye({blocks:t,mode:s,lastError:a,shakeBlockId:o,isComplete:n,onPlaceBlock:l}){const[d,i]=x.useState("");if(n)return e.jsxs("div",{className:"rounded-xl border border-emerald-500/30 bg-emerald-500/5 p-6 text-center",children:[e.jsx("div",{className:"text-3xl mb-2",children:"🎉"}),e.jsx("p",{className:"text-emerald-300 font-semibold text-sm",children:"Spiral Complete!"}),e.jsx("p",{className:"text-emerald-400/60 text-xs mt-1",children:"Beautiful golden spiral achieved"})]});const r=()=>{const c=parseInt(d,10);isNaN(c)||c<=0||(l(c),i(""))},u=s==="sandbox";return e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Place Next Block"}),u?e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"number",inputMode:"numeric",value:d,onChange:c=>i(c.target.value),onKeyDown:c=>c.key==="Enter"&&r(),placeholder:"Enter next number...",className:"flex-1 rounded-lg bg-slate-800/60 px-3 py-3 text-center text-lg font-mono font-bold text-white placeholder-slate-500 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50"}),e.jsx("button",{onClick:r,disabled:!d.trim(),className:"rounded-lg bg-gradient-to-br from-indigo-500/20 to-violet-500/20 px-5 py-3 text-sm font-semibold text-indigo-200 ring-1 ring-indigo-500/30 transition-all hover:from-indigo-500/30 hover:to-violet-500/30 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed",children:"Place"})]}):e.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:t.map(c=>{const m=o===c.size;return e.jsx("button",{onClick:()=>l(c.size),className:` relative flex items-center justify-center rounded-lg font-mono font-bold transition-all duration-200 active:scale-95 min-w-[56px] min-h-[56px] px-4 py-3 text-lg diff --git a/docs/assets/GitPage-BLlFYf7b.js b/docs/assets/GitPage-BFm-nVBR.js similarity index 99% rename from docs/assets/GitPage-BLlFYf7b.js rename to docs/assets/GitPage-BFm-nVBR.js index e69d537..ff84b7e 100644 --- a/docs/assets/GitPage-BLlFYf7b.js +++ b/docs/assets/GitPage-BFm-nVBR.js @@ -1,4 +1,4 @@ -import{r as w,j as i}from"./index-lLadk08S.js";import{g as je}from"./audioContext-NbgqvQGz.js";const V=["#818cf8","#34d399","#fb923c","#f472b6","#38bdf8","#a78bfa","#fbbf24","#2dd4bf","#f87171","#c084fc"],H=16,ne=64,ie=40,re=50,oe=50,Ce=28;function ve({state:e}){const{commits:t,branches:s,tags:o,head:n,detachedHead:r,commitOrder:c}=e,a=w.useMemo(()=>{if(c.length===0)return{nodes:[],edges:[],labels:[],width:400,height:300};const m=new Map;s.forEach((k,C)=>{m.set(k.name,V[C%V.length])});const l=new Map;let g=0;const u=[...c].reverse(),x=new Map;for(const k of u){const C=t[k];if(!C)continue;const v=C.branch;l.has(v)||l.set(v,g++),x.set(k,l.get(v))}const b=u.map((k,C)=>{const v=t[k],E=x.get(k)??0;return{id:k,x:re+E*ie,y:oe+C*ne,commit:v,color:m.get(v.branch)??V[0],col:E}}),p=new Map(b.map(k=>[k.id,k])),h=[];for(const k of b)for(let C=0;C0})}const y=r?n:s.find(k=>k.name===n)?.commitId,$=r?null:n,N=[];for(const k of s){const C=p.get(k.commitId);if(!C)continue;const v=k.name===$,E=N.filter(_=>_.commitId===k.commitId).length;N.push({text:k.name,commitId:k.commitId,x:C.x+H+12,y:C.y-6+E*22,color:m.get(k.name)??V[0],isHead:v,isTag:!1})}for(const k of o){const C=p.get(k.commitId);if(!C)continue;const v=N.filter(E=>E.commitId===k.commitId).length;N.push({text:k.name,commitId:k.commitId,x:C.x+H+12,y:C.y-6+v*22,color:"#fbbf24",isHead:!1,isTag:!0})}const O=g,P=Math.max(400,re*2+O*ie+200),M=Math.max(300,oe*2+u.length*ne);return{nodes:b,edges:h,labels:N,width:P,height:M,headCommitId:y}},[t,s,o,n,r,c]);return c.length===0?i.jsx("div",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/70 shadow-2xl shadow-black/30 backdrop-blur-sm",children:i.jsxs("div",{className:"text-center px-6",children:[i.jsx("div",{className:"mb-3 text-4xl opacity-40",children:i.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mx-auto text-slate-500",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"9"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"21"})]})}),i.jsx("p",{className:"text-sm text-slate-400",children:"No commits yet"}),i.jsxs("p",{className:"text-xs text-slate-600 mt-1",children:["Run ",i.jsx("code",{className:"text-indigo-400",children:"git init"}),", then create and commit files"]})]})}):i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden rounded-2xl border border-slate-700/50 bg-slate-950/70 shadow-2xl shadow-black/30 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-slate-700/50 bg-slate-900/80 px-4 py-2.5",children:[i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-indigo-400",children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M6 21V9a9 9 0 0 0 9 9"})]}),i.jsx("span",{className:"text-xs font-semibold text-slate-300",children:"Commit Graph"}),i.jsx("span",{className:"rounded bg-indigo-500/10 px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-indigo-300 ring-1 ring-indigo-500/20",children:"live history"}),i.jsxs("span",{className:"ml-auto text-[10px] text-slate-500",children:[c.length," commit",c.length!==1?"s":""]})]}),i.jsx("div",{className:"flex-1 overflow-auto bg-[radial-gradient(circle_at_1px_1px,rgba(148,163,184,0.12)_1px,transparent_0)] bg-[length:24px_24px] p-2",children:i.jsxs("svg",{width:a.width,height:a.height,className:"block",style:{minWidth:a.width,minHeight:a.height},children:[a.edges.map((m,l)=>{if(m.from.x===m.to.x)return i.jsx("line",{x1:m.from.x,y1:m.from.y,x2:m.to.x,y2:m.to.y,stroke:m.color,strokeWidth:3,opacity:m.isMerge?.5:.7,strokeDasharray:m.isMerge?"6,3":void 0},`e${l}`);const g=(m.from.y+m.to.y)/2;return i.jsx("path",{d:`M${m.from.x},${m.from.y} C${m.from.x},${g} ${m.to.x},${g} ${m.to.x},${m.to.y}`,stroke:m.color,strokeWidth:3,fill:"none",opacity:m.isMerge?.5:.7,strokeDasharray:m.isMerge?"6,3":void 0},`e${l}`)}),a.nodes.map(m=>{const l=m.id===a.headCommitId;return i.jsxs("g",{children:[l&&i.jsxs("circle",{cx:m.x,cy:m.y,r:H+4,fill:"none",stroke:m.color,strokeWidth:2,opacity:.4,children:[i.jsx("animate",{attributeName:"r",values:`${H+3};${H+6};${H+3}`,dur:"2s",repeatCount:"indefinite"}),i.jsx("animate",{attributeName:"opacity",values:"0.4;0.15;0.4",dur:"2s",repeatCount:"indefinite"})]}),i.jsx("circle",{cx:m.x,cy:m.y,r:H,fill:l?m.color:`${m.color}33`,stroke:m.color,strokeWidth:l?3:2,filter:"drop-shadow(0 6px 8px rgba(0,0,0,0.35))",className:"transition-all duration-300"}),i.jsx("text",{x:m.x,y:m.y+1,textAnchor:"middle",dominantBaseline:"central",className:"select-none pointer-events-none",fill:l?"#0f172a":m.color,fontSize:8,fontWeight:700,fontFamily:"monospace",children:m.id.slice(0,4)}),i.jsx("text",{x:m.x,y:m.y+Ce,textAnchor:"middle",fill:"#94a3b8",fontSize:9,className:"select-none pointer-events-none",children:m.commit.message.length>22?m.commit.message.slice(0,20)+"...":m.commit.message})]},m.id)}),a.labels.map((m,l)=>i.jsxs("g",{children:[i.jsx("rect",{x:m.x-2,y:m.y-8,width:m.text.length*7.5+(m.isHead?40:8)+(m.isTag?10:0),height:18,rx:4,fill:`${m.color}22`,stroke:m.color,strokeWidth:1,opacity:.8}),m.isTag&&i.jsx("text",{x:m.x+4,y:m.y+4,fill:m.color,fontSize:8,children:"tag"}),m.isHead&&i.jsx("text",{x:m.x+4,y:m.y+4,fill:"#fbbf24",fontSize:9,fontWeight:700,fontFamily:"monospace",children:"HEAD→"}),i.jsx("text",{x:m.x+(m.isHead?44:m.isTag?18:4),y:m.y+4,fill:m.color,fontSize:10,fontWeight:600,fontFamily:"monospace",children:m.text})]},`l${l}`))]})})]})}const $e=w.memo(ve);function Ne({history:e,commandHistory:t,onExecute:s,disabled:o,promptBranch:n="main"}){const[r,c]=w.useState(""),[a,m]=w.useState(-1),l=w.useRef(null),g=w.useRef(null);w.useEffect(()=>{l.current?.scrollIntoView({behavior:"smooth"})},[e]),w.useEffect(()=>{o||g.current?.focus()},[o]);const u=w.useCallback(p=>{p.preventDefault(),!(!r.trim()||o)&&(s(r),c(""),m(-1))},[r,o,s]),x=w.useCallback(p=>{if(p.key==="ArrowUp"){if(p.preventDefault(),t.length===0)return;const h=a===-1?t.length-1:Math.max(0,a-1);m(h),c(t[h])}else if(p.key==="ArrowDown"){if(p.preventDefault(),a===-1)return;const h=a+1;h>=t.length?(m(-1),c("")):(m(h),c(t[h]))}},[t,a]),b=p=>{switch(p){case"input":return"text-emerald-400";case"error":return"text-red-400";case"info":return"text-indigo-400";case"hint":return"text-amber-400/90";default:return"text-slate-300"}};return i.jsxs("div",{className:"flex flex-col overflow-hidden rounded-2xl border border-slate-700/50 bg-slate-950/90 font-mono text-xs shadow-2xl shadow-black/30 backdrop-blur-sm",onClick:()=>g.current?.focus(),children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-slate-700/50 bg-slate-900/80 px-4 py-2.5",children:[i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-red-500/70"}),i.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-yellow-500/70"}),i.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-green-500/70"})]}),i.jsx("span",{className:"ml-2 text-[10px] font-semibold text-slate-400",children:"Git Terminal"}),i.jsx("span",{className:"ml-auto rounded bg-slate-950/80 px-2 py-0.5 text-[9px] text-slate-500 ring-1 ring-slate-800",children:"~/visual-repo"})]}),i.jsxs("div",{className:"min-h-[240px] flex-1 space-y-0.5 overflow-y-auto bg-[linear-gradient(rgba(148,163,184,0.03)_1px,transparent_1px)] bg-[length:100%_22px] p-3",children:[e.map((p,h)=>i.jsx("div",{className:`whitespace-pre-wrap leading-relaxed ${b(p.type)}`,children:p.text},h)),i.jsx("div",{ref:l})]}),i.jsxs("form",{onSubmit:u,className:"flex items-center gap-2 border-t border-slate-800/60 bg-slate-900/70 px-3 py-2",children:[i.jsx("span",{className:"select-none text-sky-400",children:"visual-repo"}),i.jsxs("span",{className:"select-none text-slate-600",children:["git:(",n,")"]}),i.jsx("span",{className:"select-none font-bold text-emerald-500",children:"$"}),i.jsx("input",{ref:g,type:"text",value:r,onChange:p=>c(p.target.value),onKeyDown:x,disabled:o,placeholder:o?"Demo running...":"Type a git command...",className:"flex-1 bg-transparent text-slate-200 placeholder-slate-600 outline-none caret-emerald-400",autoComplete:"off",spellCheck:!1})]})]})}const De=w.memo(Ne);function Se({state:e}){const{workingDirectory:t,stagingArea:s,commits:o,head:n,detachedHead:r,branches:c}=e,a=r?n:c.find(h=>h.name===n)?.commitId??null,l=(a?o[a]:null)?.files??{},g=Object.keys(t),u=Object.keys(s),x=h=>h in s?"staged":h in l?t[h]!==l[h]?"modified":"clean":"untracked",b=h=>{switch(h){case"staged":return"text-emerald-400 bg-emerald-500/10";case"modified":return"text-amber-400 bg-amber-500/10";case"untracked":return"text-red-400 bg-red-500/10";default:return"text-slate-500 bg-slate-500/10"}},p=h=>{switch(h){case"staged":return"S";case"modified":return"M";case"untracked":return"U";default:return"✓"}};return i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsxs("div",{className:"rounded-2xl border border-amber-500/20 bg-slate-950/70 p-3 shadow-xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-amber-500/10 text-amber-300 ring-1 ring-amber-500/20",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M3 7h5l2 3h11v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"}),i.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h4l2 3h5"})]})}),i.jsx("span",{className:"text-[10px] font-semibold text-slate-300 uppercase tracking-wider",children:"Working Dir"}),i.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:g.length})]}),i.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:g.length===0?i.jsx("p",{className:"text-[10px] text-slate-600 italic",children:"empty"}):g.map(h=>{const y=x(h);return i.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-slate-900/50 px-1.5 py-1 ring-1 ring-slate-800/50",children:[i.jsx("span",{className:`inline-flex h-4 w-4 items-center justify-center rounded text-[8px] font-bold ${b(y)}`,children:p(y)}),i.jsx("span",{className:"text-[10px] text-slate-400 truncate",children:h})]},h)})})]}),i.jsxs("div",{className:"rounded-2xl border border-emerald-500/20 bg-slate-950/70 p-3 shadow-xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}),i.jsx("span",{className:"text-[10px] font-semibold text-slate-300 uppercase tracking-wider",children:"Staging"}),i.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:u.length})]}),i.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:u.length===0?i.jsx("p",{className:"text-[10px] text-slate-600 italic",children:"empty"}):u.map(h=>i.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-slate-900/50 px-1.5 py-1 ring-1 ring-slate-800/50",children:[i.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded text-[8px] font-bold text-emerald-400 bg-emerald-500/10",children:"+"}),i.jsx("span",{className:"text-[10px] text-slate-400 truncate",children:h})]},h))})]}),i.jsxs("div",{className:"rounded-2xl border border-indigo-500/20 bg-slate-950/70 p-3 shadow-xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-indigo-500/10 text-indigo-300 ring-1 ring-indigo-500/20",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}),i.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),i.jsx("path",{d:"M12 22V12"})]})}),i.jsx("span",{className:"text-[10px] font-semibold text-slate-300 uppercase tracking-wider",children:"Repository"}),i.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:Object.keys(l).length})]}),i.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:Object.keys(l).length===0?i.jsx("p",{className:"text-[10px] text-slate-600 italic",children:"no commits"}):Object.keys(l).map(h=>i.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-slate-900/50 px-1.5 py-1 ring-1 ring-slate-800/50",children:[i.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded text-[8px] font-bold text-indigo-400 bg-indigo-500/10",children:"✓"}),i.jsx("span",{className:"text-[10px] text-slate-400 truncate",children:h})]},h))})]})]})}const Ie=w.memo(Se),Ae=[{title:"Setup",commands:[{cmd:"git init",desc:"Initialize a new repository"},{cmd:"git clone ",desc:"Clone a remote repository"}]},{title:"File Ops",commands:[{cmd:"touch [content]",desc:"Create a new file"},{cmd:"edit ",desc:"Modify a file"},{cmd:"cat ",desc:"View file content"},{cmd:"mv ",desc:"Move/rename a file"},{cmd:"rm ",desc:"Delete a file"},{cmd:"ls",desc:"List files"}]},{title:"Staging & Committing",commands:[{cmd:"git add ",desc:"Stage changes"},{cmd:'git commit -m "msg"',desc:"Create a commit"},{cmd:'git commit -am "msg"',desc:"Stage tracked & commit"},{cmd:"git status",desc:"Show status"},{cmd:"git diff",desc:"Show unstaged changes"},{cmd:"git diff --staged",desc:"Show staged changes"},{cmd:"git status --short",desc:"Compact porcelain view"},{cmd:"git log --oneline --all",desc:"View history"},{cmd:"git show HEAD",desc:"Inspect a commit"},{cmd:"git blame ",desc:"Line attribution"}]},{title:"Branching",commands:[{cmd:"git branch ",desc:"Create branch"},{cmd:"git branch",desc:"List branches"},{cmd:"git branch -r",desc:"List remote branches"},{cmd:"git branch -d ",desc:"Delete a branch"},{cmd:"git checkout ",desc:"Switch branches"},{cmd:"git checkout -b ",desc:"Create & switch"},{cmd:"git switch ",desc:"Modern branch switch"},{cmd:"git switch -c ",desc:"Create & switch"}]},{title:"Merging & Rebasing",commands:[{cmd:"git merge ",desc:"Merge a branch"},{cmd:"git rebase ",desc:"Rebase onto branch"},{cmd:"git cherry-pick ",desc:"Apply a commit"}]},{title:"Remote Sync",commands:[{cmd:"git remote add ",desc:"Add a remote"},{cmd:"git remote -v",desc:"List remotes"},{cmd:"git remote rename ",desc:"Rename a remote"},{cmd:"git remote set-url ",desc:"Change remote URL"},{cmd:"git push -u ",desc:"Push & set upstream"},{cmd:"git push",desc:"Push to tracked remote"},{cmd:"git pull",desc:"Fetch & merge"},{cmd:"git fetch",desc:"Download remote changes"}]},{title:"Undo & Stash",commands:[{cmd:"git reset --soft HEAD~1",desc:"Soft reset (keep staged)"},{cmd:"git reset --mixed HEAD~1",desc:"Mixed reset (unstage)"},{cmd:"git reset --hard HEAD~1",desc:"Hard reset (discard)"},{cmd:"git restore ",desc:"Discard worktree changes"},{cmd:"git restore --staged ",desc:"Unstage a file"},{cmd:"git clean -n",desc:"Preview untracked cleanup"},{cmd:"git clean -f",desc:"Remove untracked files"},{cmd:"git revert HEAD",desc:"Revert last commit"},{cmd:"git stash",desc:"Stash changes"},{cmd:"git stash pop",desc:"Restore stash"},{cmd:"git stash list",desc:"List stashes"}]},{title:"Inspect & Utilities",commands:[{cmd:"git tag ",desc:"Create a tag"},{cmd:"git tag",desc:"List tags"},{cmd:"git tag -d ",desc:"Delete a tag"},{cmd:"git describe HEAD",desc:"Show closest tag/name"},{cmd:"git reflog",desc:"Show HEAD history"},{cmd:"git config --list",desc:"Show Git config"},{cmd:"git rm ",desc:"Remove and stage deletion"},{cmd:"git mv ",desc:"Rename and stage change"}]}];function Re({onRunCommand:e,disabled:t}){const[s,o]=w.useState(null);return i.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/70 p-3 shadow-2xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-violet-400",children:i.jsx("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"})}),i.jsx("span",{className:"text-xs font-semibold text-slate-300",children:"Command Reference"})]}),i.jsx("div",{className:"space-y-1",children:Ae.map(n=>i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>o(s===n.title?null:n.title),className:"flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-[10px] font-semibold text-slate-400 uppercase tracking-wider transition-colors hover:bg-slate-800/70",children:[n.title,i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`transition-transform ${s===n.title?"rotate-180":""}`,children:i.jsx("path",{d:"m6 9 6 6 6-6"})})]}),s===n.title&&i.jsx("div",{className:"ml-2 space-y-0.5 pb-1",children:n.commands.map(({cmd:r,desc:c})=>{const a=!r.includes("<")&&!r.includes("[");return i.jsxs("button",{onClick:()=>a&&!t&&e(r),disabled:t||!a,className:` +import{r as w,j as i}from"./index-CB1-0H6I.js";import{g as je}from"./audioContext-NbgqvQGz.js";const V=["#818cf8","#34d399","#fb923c","#f472b6","#38bdf8","#a78bfa","#fbbf24","#2dd4bf","#f87171","#c084fc"],H=16,ne=64,ie=40,re=50,oe=50,Ce=28;function ve({state:e}){const{commits:t,branches:s,tags:o,head:n,detachedHead:r,commitOrder:c}=e,a=w.useMemo(()=>{if(c.length===0)return{nodes:[],edges:[],labels:[],width:400,height:300};const m=new Map;s.forEach((k,C)=>{m.set(k.name,V[C%V.length])});const l=new Map;let g=0;const u=[...c].reverse(),x=new Map;for(const k of u){const C=t[k];if(!C)continue;const v=C.branch;l.has(v)||l.set(v,g++),x.set(k,l.get(v))}const b=u.map((k,C)=>{const v=t[k],E=x.get(k)??0;return{id:k,x:re+E*ie,y:oe+C*ne,commit:v,color:m.get(v.branch)??V[0],col:E}}),p=new Map(b.map(k=>[k.id,k])),h=[];for(const k of b)for(let C=0;C0})}const y=r?n:s.find(k=>k.name===n)?.commitId,$=r?null:n,N=[];for(const k of s){const C=p.get(k.commitId);if(!C)continue;const v=k.name===$,E=N.filter(_=>_.commitId===k.commitId).length;N.push({text:k.name,commitId:k.commitId,x:C.x+H+12,y:C.y-6+E*22,color:m.get(k.name)??V[0],isHead:v,isTag:!1})}for(const k of o){const C=p.get(k.commitId);if(!C)continue;const v=N.filter(E=>E.commitId===k.commitId).length;N.push({text:k.name,commitId:k.commitId,x:C.x+H+12,y:C.y-6+v*22,color:"#fbbf24",isHead:!1,isTag:!0})}const O=g,P=Math.max(400,re*2+O*ie+200),M=Math.max(300,oe*2+u.length*ne);return{nodes:b,edges:h,labels:N,width:P,height:M,headCommitId:y}},[t,s,o,n,r,c]);return c.length===0?i.jsx("div",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-950/70 shadow-2xl shadow-black/30 backdrop-blur-sm",children:i.jsxs("div",{className:"text-center px-6",children:[i.jsx("div",{className:"mb-3 text-4xl opacity-40",children:i.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mx-auto text-slate-500",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"9"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"21"})]})}),i.jsx("p",{className:"text-sm text-slate-400",children:"No commits yet"}),i.jsxs("p",{className:"text-xs text-slate-600 mt-1",children:["Run ",i.jsx("code",{className:"text-indigo-400",children:"git init"}),", then create and commit files"]})]})}):i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden rounded-2xl border border-slate-700/50 bg-slate-950/70 shadow-2xl shadow-black/30 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-slate-700/50 bg-slate-900/80 px-4 py-2.5",children:[i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-indigo-400",children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M6 21V9a9 9 0 0 0 9 9"})]}),i.jsx("span",{className:"text-xs font-semibold text-slate-300",children:"Commit Graph"}),i.jsx("span",{className:"rounded bg-indigo-500/10 px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-indigo-300 ring-1 ring-indigo-500/20",children:"live history"}),i.jsxs("span",{className:"ml-auto text-[10px] text-slate-500",children:[c.length," commit",c.length!==1?"s":""]})]}),i.jsx("div",{className:"flex-1 overflow-auto bg-[radial-gradient(circle_at_1px_1px,rgba(148,163,184,0.12)_1px,transparent_0)] bg-[length:24px_24px] p-2",children:i.jsxs("svg",{width:a.width,height:a.height,className:"block",style:{minWidth:a.width,minHeight:a.height},children:[a.edges.map((m,l)=>{if(m.from.x===m.to.x)return i.jsx("line",{x1:m.from.x,y1:m.from.y,x2:m.to.x,y2:m.to.y,stroke:m.color,strokeWidth:3,opacity:m.isMerge?.5:.7,strokeDasharray:m.isMerge?"6,3":void 0},`e${l}`);const g=(m.from.y+m.to.y)/2;return i.jsx("path",{d:`M${m.from.x},${m.from.y} C${m.from.x},${g} ${m.to.x},${g} ${m.to.x},${m.to.y}`,stroke:m.color,strokeWidth:3,fill:"none",opacity:m.isMerge?.5:.7,strokeDasharray:m.isMerge?"6,3":void 0},`e${l}`)}),a.nodes.map(m=>{const l=m.id===a.headCommitId;return i.jsxs("g",{children:[l&&i.jsxs("circle",{cx:m.x,cy:m.y,r:H+4,fill:"none",stroke:m.color,strokeWidth:2,opacity:.4,children:[i.jsx("animate",{attributeName:"r",values:`${H+3};${H+6};${H+3}`,dur:"2s",repeatCount:"indefinite"}),i.jsx("animate",{attributeName:"opacity",values:"0.4;0.15;0.4",dur:"2s",repeatCount:"indefinite"})]}),i.jsx("circle",{cx:m.x,cy:m.y,r:H,fill:l?m.color:`${m.color}33`,stroke:m.color,strokeWidth:l?3:2,filter:"drop-shadow(0 6px 8px rgba(0,0,0,0.35))",className:"transition-all duration-300"}),i.jsx("text",{x:m.x,y:m.y+1,textAnchor:"middle",dominantBaseline:"central",className:"select-none pointer-events-none",fill:l?"#0f172a":m.color,fontSize:8,fontWeight:700,fontFamily:"monospace",children:m.id.slice(0,4)}),i.jsx("text",{x:m.x,y:m.y+Ce,textAnchor:"middle",fill:"#94a3b8",fontSize:9,className:"select-none pointer-events-none",children:m.commit.message.length>22?m.commit.message.slice(0,20)+"...":m.commit.message})]},m.id)}),a.labels.map((m,l)=>i.jsxs("g",{children:[i.jsx("rect",{x:m.x-2,y:m.y-8,width:m.text.length*7.5+(m.isHead?40:8)+(m.isTag?10:0),height:18,rx:4,fill:`${m.color}22`,stroke:m.color,strokeWidth:1,opacity:.8}),m.isTag&&i.jsx("text",{x:m.x+4,y:m.y+4,fill:m.color,fontSize:8,children:"tag"}),m.isHead&&i.jsx("text",{x:m.x+4,y:m.y+4,fill:"#fbbf24",fontSize:9,fontWeight:700,fontFamily:"monospace",children:"HEAD→"}),i.jsx("text",{x:m.x+(m.isHead?44:m.isTag?18:4),y:m.y+4,fill:m.color,fontSize:10,fontWeight:600,fontFamily:"monospace",children:m.text})]},`l${l}`))]})})]})}const $e=w.memo(ve);function Ne({history:e,commandHistory:t,onExecute:s,disabled:o,promptBranch:n="main"}){const[r,c]=w.useState(""),[a,m]=w.useState(-1),l=w.useRef(null),g=w.useRef(null);w.useEffect(()=>{l.current?.scrollIntoView({behavior:"smooth"})},[e]),w.useEffect(()=>{o||g.current?.focus()},[o]);const u=w.useCallback(p=>{p.preventDefault(),!(!r.trim()||o)&&(s(r),c(""),m(-1))},[r,o,s]),x=w.useCallback(p=>{if(p.key==="ArrowUp"){if(p.preventDefault(),t.length===0)return;const h=a===-1?t.length-1:Math.max(0,a-1);m(h),c(t[h])}else if(p.key==="ArrowDown"){if(p.preventDefault(),a===-1)return;const h=a+1;h>=t.length?(m(-1),c("")):(m(h),c(t[h]))}},[t,a]),b=p=>{switch(p){case"input":return"text-emerald-400";case"error":return"text-red-400";case"info":return"text-indigo-400";case"hint":return"text-amber-400/90";default:return"text-slate-300"}};return i.jsxs("div",{className:"flex flex-col overflow-hidden rounded-2xl border border-slate-700/50 bg-slate-950/90 font-mono text-xs shadow-2xl shadow-black/30 backdrop-blur-sm",onClick:()=>g.current?.focus(),children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-slate-700/50 bg-slate-900/80 px-4 py-2.5",children:[i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-red-500/70"}),i.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-yellow-500/70"}),i.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-green-500/70"})]}),i.jsx("span",{className:"ml-2 text-[10px] font-semibold text-slate-400",children:"Git Terminal"}),i.jsx("span",{className:"ml-auto rounded bg-slate-950/80 px-2 py-0.5 text-[9px] text-slate-500 ring-1 ring-slate-800",children:"~/visual-repo"})]}),i.jsxs("div",{className:"min-h-[240px] flex-1 space-y-0.5 overflow-y-auto bg-[linear-gradient(rgba(148,163,184,0.03)_1px,transparent_1px)] bg-[length:100%_22px] p-3",children:[e.map((p,h)=>i.jsx("div",{className:`whitespace-pre-wrap leading-relaxed ${b(p.type)}`,children:p.text},h)),i.jsx("div",{ref:l})]}),i.jsxs("form",{onSubmit:u,className:"flex items-center gap-2 border-t border-slate-800/60 bg-slate-900/70 px-3 py-2",children:[i.jsx("span",{className:"select-none text-sky-400",children:"visual-repo"}),i.jsxs("span",{className:"select-none text-slate-600",children:["git:(",n,")"]}),i.jsx("span",{className:"select-none font-bold text-emerald-500",children:"$"}),i.jsx("input",{ref:g,type:"text",value:r,onChange:p=>c(p.target.value),onKeyDown:x,disabled:o,placeholder:o?"Demo running...":"Type a git command...",className:"flex-1 bg-transparent text-slate-200 placeholder-slate-600 outline-none caret-emerald-400",autoComplete:"off",spellCheck:!1})]})]})}const De=w.memo(Ne);function Se({state:e}){const{workingDirectory:t,stagingArea:s,commits:o,head:n,detachedHead:r,branches:c}=e,a=r?n:c.find(h=>h.name===n)?.commitId??null,l=(a?o[a]:null)?.files??{},g=Object.keys(t),u=Object.keys(s),x=h=>h in s?"staged":h in l?t[h]!==l[h]?"modified":"clean":"untracked",b=h=>{switch(h){case"staged":return"text-emerald-400 bg-emerald-500/10";case"modified":return"text-amber-400 bg-amber-500/10";case"untracked":return"text-red-400 bg-red-500/10";default:return"text-slate-500 bg-slate-500/10"}},p=h=>{switch(h){case"staged":return"S";case"modified":return"M";case"untracked":return"U";default:return"✓"}};return i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsxs("div",{className:"rounded-2xl border border-amber-500/20 bg-slate-950/70 p-3 shadow-xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-amber-500/10 text-amber-300 ring-1 ring-amber-500/20",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M3 7h5l2 3h11v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"}),i.jsx("path",{d:"M3 7V5a2 2 0 0 1 2-2h4l2 3h5"})]})}),i.jsx("span",{className:"text-[10px] font-semibold text-slate-300 uppercase tracking-wider",children:"Working Dir"}),i.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:g.length})]}),i.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:g.length===0?i.jsx("p",{className:"text-[10px] text-slate-600 italic",children:"empty"}):g.map(h=>{const y=x(h);return i.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-slate-900/50 px-1.5 py-1 ring-1 ring-slate-800/50",children:[i.jsx("span",{className:`inline-flex h-4 w-4 items-center justify-center rounded text-[8px] font-bold ${b(y)}`,children:p(y)}),i.jsx("span",{className:"text-[10px] text-slate-400 truncate",children:h})]},h)})})]}),i.jsxs("div",{className:"rounded-2xl border border-emerald-500/20 bg-slate-950/70 p-3 shadow-xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-300 ring-1 ring-emerald-500/20",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}),i.jsx("span",{className:"text-[10px] font-semibold text-slate-300 uppercase tracking-wider",children:"Staging"}),i.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:u.length})]}),i.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:u.length===0?i.jsx("p",{className:"text-[10px] text-slate-600 italic",children:"empty"}):u.map(h=>i.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-slate-900/50 px-1.5 py-1 ring-1 ring-slate-800/50",children:[i.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded text-[8px] font-bold text-emerald-400 bg-emerald-500/10",children:"+"}),i.jsx("span",{className:"text-[10px] text-slate-400 truncate",children:h})]},h))})]}),i.jsxs("div",{className:"rounded-2xl border border-indigo-500/20 bg-slate-950/70 p-3 shadow-xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-indigo-500/10 text-indigo-300 ring-1 ring-indigo-500/20",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}),i.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),i.jsx("path",{d:"M12 22V12"})]})}),i.jsx("span",{className:"text-[10px] font-semibold text-slate-300 uppercase tracking-wider",children:"Repository"}),i.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:Object.keys(l).length})]}),i.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:Object.keys(l).length===0?i.jsx("p",{className:"text-[10px] text-slate-600 italic",children:"no commits"}):Object.keys(l).map(h=>i.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-slate-900/50 px-1.5 py-1 ring-1 ring-slate-800/50",children:[i.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded text-[8px] font-bold text-indigo-400 bg-indigo-500/10",children:"✓"}),i.jsx("span",{className:"text-[10px] text-slate-400 truncate",children:h})]},h))})]})]})}const Ie=w.memo(Se),Ae=[{title:"Setup",commands:[{cmd:"git init",desc:"Initialize a new repository"},{cmd:"git clone ",desc:"Clone a remote repository"}]},{title:"File Ops",commands:[{cmd:"touch [content]",desc:"Create a new file"},{cmd:"edit ",desc:"Modify a file"},{cmd:"cat ",desc:"View file content"},{cmd:"mv ",desc:"Move/rename a file"},{cmd:"rm ",desc:"Delete a file"},{cmd:"ls",desc:"List files"}]},{title:"Staging & Committing",commands:[{cmd:"git add ",desc:"Stage changes"},{cmd:'git commit -m "msg"',desc:"Create a commit"},{cmd:'git commit -am "msg"',desc:"Stage tracked & commit"},{cmd:"git status",desc:"Show status"},{cmd:"git diff",desc:"Show unstaged changes"},{cmd:"git diff --staged",desc:"Show staged changes"},{cmd:"git status --short",desc:"Compact porcelain view"},{cmd:"git log --oneline --all",desc:"View history"},{cmd:"git show HEAD",desc:"Inspect a commit"},{cmd:"git blame ",desc:"Line attribution"}]},{title:"Branching",commands:[{cmd:"git branch ",desc:"Create branch"},{cmd:"git branch",desc:"List branches"},{cmd:"git branch -r",desc:"List remote branches"},{cmd:"git branch -d ",desc:"Delete a branch"},{cmd:"git checkout ",desc:"Switch branches"},{cmd:"git checkout -b ",desc:"Create & switch"},{cmd:"git switch ",desc:"Modern branch switch"},{cmd:"git switch -c ",desc:"Create & switch"}]},{title:"Merging & Rebasing",commands:[{cmd:"git merge ",desc:"Merge a branch"},{cmd:"git rebase ",desc:"Rebase onto branch"},{cmd:"git cherry-pick ",desc:"Apply a commit"}]},{title:"Remote Sync",commands:[{cmd:"git remote add ",desc:"Add a remote"},{cmd:"git remote -v",desc:"List remotes"},{cmd:"git remote rename ",desc:"Rename a remote"},{cmd:"git remote set-url ",desc:"Change remote URL"},{cmd:"git push -u ",desc:"Push & set upstream"},{cmd:"git push",desc:"Push to tracked remote"},{cmd:"git pull",desc:"Fetch & merge"},{cmd:"git fetch",desc:"Download remote changes"}]},{title:"Undo & Stash",commands:[{cmd:"git reset --soft HEAD~1",desc:"Soft reset (keep staged)"},{cmd:"git reset --mixed HEAD~1",desc:"Mixed reset (unstage)"},{cmd:"git reset --hard HEAD~1",desc:"Hard reset (discard)"},{cmd:"git restore ",desc:"Discard worktree changes"},{cmd:"git restore --staged ",desc:"Unstage a file"},{cmd:"git clean -n",desc:"Preview untracked cleanup"},{cmd:"git clean -f",desc:"Remove untracked files"},{cmd:"git revert HEAD",desc:"Revert last commit"},{cmd:"git stash",desc:"Stash changes"},{cmd:"git stash pop",desc:"Restore stash"},{cmd:"git stash list",desc:"List stashes"}]},{title:"Inspect & Utilities",commands:[{cmd:"git tag ",desc:"Create a tag"},{cmd:"git tag",desc:"List tags"},{cmd:"git tag -d ",desc:"Delete a tag"},{cmd:"git describe HEAD",desc:"Show closest tag/name"},{cmd:"git reflog",desc:"Show HEAD history"},{cmd:"git config --list",desc:"Show Git config"},{cmd:"git rm ",desc:"Remove and stage deletion"},{cmd:"git mv ",desc:"Rename and stage change"}]}];function Re({onRunCommand:e,disabled:t}){const[s,o]=w.useState(null);return i.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/70 p-3 shadow-2xl shadow-black/20 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-violet-400",children:i.jsx("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"})}),i.jsx("span",{className:"text-xs font-semibold text-slate-300",children:"Command Reference"})]}),i.jsx("div",{className:"space-y-1",children:Ae.map(n=>i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>o(s===n.title?null:n.title),className:"flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-[10px] font-semibold text-slate-400 uppercase tracking-wider transition-colors hover:bg-slate-800/70",children:[n.title,i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`transition-transform ${s===n.title?"rotate-180":""}`,children:i.jsx("path",{d:"m6 9 6 6 6-6"})})]}),s===n.title&&i.jsx("div",{className:"ml-2 space-y-0.5 pb-1",children:n.commands.map(({cmd:r,desc:c})=>{const a=!r.includes("<")&&!r.includes("[");return i.jsxs("button",{onClick:()=>a&&!t&&e(r),disabled:t||!a,className:` flex w-full items-start gap-2 rounded px-2 py-1 text-left transition-colors ${a&&!t?"hover:bg-indigo-500/10 hover:ring-1 hover:ring-indigo-500/20 cursor-pointer":"cursor-default opacity-75"} `,children:[i.jsx("code",{className:"text-[10px] text-emerald-400 font-mono whitespace-nowrap",children:r}),i.jsx("span",{className:"text-[9px] text-slate-500 mt-px",children:c})]},r)})})]},n.title))})]})}const Ee=w.memo(Re);function Te({state:e}){const t=e.detachedHead?null:e.head,s=e.detachedHead?e.head:e.branches.find(a=>a.name===e.head)?.commitId??"",o=s?e.commits[s]?.files??{}:{},n=Object.keys(e.stagingArea).length,r=Object.keys(e.workingDirectory).filter(a=>a in o&&e.workingDirectory[a]!==o[a]&&!(a in e.stagingArea)).length,c=Object.keys(e.workingDirectory).filter(a=>!(a in o)).length;return i.jsxs("aside",{className:"flex flex-col gap-3 rounded-2xl border border-slate-700/50 bg-slate-950/70 p-3 shadow-2xl shadow-black/30 backdrop-blur-sm lg:w-64 lg:shrink-0",children:[i.jsxs("div",{className:"rounded-xl border border-slate-700/40 bg-[radial-gradient(circle_at_top_left,rgba(249,115,22,0.18),transparent_38%),rgba(15,23,42,0.8)] p-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-orange-500/15 text-orange-300 ring-1 ring-orange-500/30",children:i.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M6 21V9a9 9 0 0 0 9 9"})]})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-sm font-bold text-white",children:"visual-repo"}),i.jsx("div",{className:"text-[10px] text-slate-500",children:e.initialized?"Git repository":"No repository"})]})]}),i.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-1.5",children:[i.jsx(Z,{label:"Commits",value:e.commitOrder.length}),i.jsx(Z,{label:"Files",value:Object.keys(e.workingDirectory).length}),i.jsx(Z,{label:"Stash",value:e.stash.length})]})]}),i.jsxs(Y,{title:"Working Tree",children:[i.jsx(Q,{label:"Staged",value:n,color:"emerald"}),i.jsx(Q,{label:"Modified",value:r,color:"amber"}),i.jsx(Q,{label:"Untracked",value:c,color:"rose"})]}),i.jsx(Y,{title:"Branches",children:e.branches.length===0?i.jsx(X,{children:"No branches"}):i.jsx("div",{className:"space-y-1",children:e.branches.map(a=>i.jsxs("div",{className:`flex items-center gap-2 rounded-lg px-2 py-1.5 text-[11px] ${a.name===t?"bg-indigo-500/15 text-indigo-200 ring-1 ring-indigo-500/25":"text-slate-400 hover:bg-slate-800/50"}`,children:[i.jsx("span",{className:`h-2 w-2 rounded-full ${a.name===t?"bg-indigo-400":"bg-slate-600"}`}),i.jsx("span",{className:"truncate font-mono",children:a.name}),i.jsx("span",{className:"ml-auto font-mono text-[9px] text-slate-600",children:a.commitId.slice(0,4)||"-"})]},a.name))})}),i.jsx(Y,{title:"Remotes",children:e.remotes.length===0?i.jsx(X,{children:"No remotes configured"}):i.jsx("div",{className:"space-y-1",children:e.remotes.map(a=>i.jsxs("div",{className:"rounded-lg bg-slate-900/60 px-2 py-1.5 ring-1 ring-slate-800/70",children:[i.jsx("div",{className:"font-mono text-[11px] text-sky-300",children:a.name}),i.jsx("div",{className:"truncate text-[9px] text-slate-600",children:a.url})]},a.name))})}),i.jsx(Y,{title:"Tags & Stash",children:i.jsxs("div",{className:"space-y-1.5",children:[e.tags.length===0?i.jsx(X,{children:"No tags"}):e.tags.map(a=>i.jsxs("div",{className:"rounded-lg bg-amber-500/10 px-2 py-1 text-[11px] font-mono text-amber-300 ring-1 ring-amber-500/20",children:["tag: ",a.name]},a.name)),e.stash.length>0&&e.stash.map((a,m)=>i.jsxs("div",{className:"rounded-lg bg-violet-500/10 px-2 py-1 text-[11px] text-violet-300 ring-1 ring-violet-500/20",children:["stash@","{",m,"}"," ",a.message]},a.id))]})})]})}function Y({title:e,children:t}){return i.jsxs("section",{className:"rounded-xl border border-slate-800/80 bg-slate-900/55 p-3",children:[i.jsx("h3",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:e}),t]})}function Z({label:e,value:t}){return i.jsxs("div",{className:"rounded-lg bg-slate-950/55 px-2 py-1.5 text-center ring-1 ring-slate-800/80",children:[i.jsx("div",{className:"text-[9px] text-slate-600",children:e}),i.jsx("div",{className:"font-mono text-xs font-bold text-slate-200",children:t})]})}function Q({label:e,value:t,color:s}){const o={emerald:"bg-emerald-500/10 text-emerald-300 ring-emerald-500/25",amber:"bg-amber-500/10 text-amber-300 ring-amber-500/25",rose:"bg-rose-500/10 text-rose-300 ring-rose-500/25"};return i.jsxs("div",{className:`mb-1 flex items-center justify-between rounded-lg px-2 py-1.5 text-[11px] ring-1 ${o[s]}`,children:[i.jsx("span",{children:e}),i.jsx("span",{className:"font-mono font-bold",children:t})]})}function X({children:e}){return i.jsx("p",{className:"text-[11px] italic text-slate-600",children:e})}const Ue=w.memo(Te);function Oe({lessons:e,completedLessons:t,activeLessonId:s,onSelect:o}){const n=r=>{switch(r){case"beginner":return"text-emerald-400 bg-emerald-500/10 ring-emerald-500/30";case"intermediate":return"text-amber-400 bg-amber-500/10 ring-amber-500/30";case"advanced":return"text-rose-400 bg-rose-500/10 ring-rose-500/30"}};return i.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-3 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-amber-400",children:[i.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),i.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]}),i.jsx("span",{className:"text-xs font-semibold text-slate-300",children:"Guided Lessons"}),i.jsxs("span",{className:"ml-auto text-[10px] text-slate-500",children:[t.size,"/",e.length]})]}),i.jsx("div",{className:"space-y-1.5",children:e.map(r=>{const c=t.has(r.id),a=r.id===s;return i.jsxs("button",{onClick:()=>o(r.id),className:` diff --git a/docs/assets/GraphTraversalPage-DIP79SzH.js b/docs/assets/GraphTraversalPage-Cz8zdw1I.js similarity index 97% rename from docs/assets/GraphTraversalPage-DIP79SzH.js rename to docs/assets/GraphTraversalPage-Cz8zdw1I.js index 317bb5d..7121037 100644 --- a/docs/assets/GraphTraversalPage-DIP79SzH.js +++ b/docs/assets/GraphTraversalPage-Cz8zdw1I.js @@ -1,4 +1,4 @@ -import{c as W,r,j as e,F as Q,d as Z}from"./index-lLadk08S.js";import{N as a,A as D,r as ee,S as te}from"./index-Cj8HB9AY.js";import{V as se,a as ae}from"./volume-x-CjLNPeax.js";import{S as ne}from"./square-QnQTkqqU.js";import{P as oe}from"./play-b2ZiatJ3.js";import{R as re}from"./rotate-ccw-DMjSdzg2.js";import{S as le}from"./shuffle-ADbBlETg.js";import{g as ie}from"./audioContext-NbgqvQGz.js";const ce=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],de=W("eraser",ce);const ue=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],me=W("map-pin",ue);const pe=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],xe=W("paintbrush",pe),fe={[a.EMPTY]:"bg-slate-900/40 hover:bg-slate-700/60",[a.WALL]:"bg-slate-300 animate-wall",[a.START]:"bg-emerald-500 shadow-lg shadow-emerald-500/30",[a.END]:"bg-rose-500 shadow-lg shadow-rose-500/30",[a.VISITED]:"bg-indigo-500/70 animate-visited",[a.PATH]:"bg-amber-400 animate-path shadow-md shadow-amber-400/30",[a.EXPLORING]:"bg-cyan-400 animate-pulse"};function he({row:l,col:n,type:y,onMouseDown:x,onMouseEnter:g,onMouseUp:b}){return e.jsx("div",{className:` +import{c as W,r,j as e,F as Q,d as Z}from"./index-CB1-0H6I.js";import{N as a,A as D,r as ee,S as te}from"./index-DrhCNtmA.js";import{V as se,a as ae}from"./volume-x-CKT6TOtL.js";import{S as ne}from"./square-B4KY3il9.js";import{P as oe}from"./play-SZ6Nqtz8.js";import{R as re}from"./rotate-ccw-CDlWXRsI.js";import{S as le}from"./shuffle-DZnyoAGL.js";import{g as ie}from"./audioContext-NbgqvQGz.js";const ce=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],de=W("eraser",ce);const ue=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],me=W("map-pin",ue);const pe=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],xe=W("paintbrush",pe),fe={[a.EMPTY]:"bg-slate-900/40 hover:bg-slate-700/60",[a.WALL]:"bg-slate-300 animate-wall",[a.START]:"bg-emerald-500 shadow-lg shadow-emerald-500/30",[a.END]:"bg-rose-500 shadow-lg shadow-rose-500/30",[a.VISITED]:"bg-indigo-500/70 animate-visited",[a.PATH]:"bg-amber-400 animate-path shadow-md shadow-amber-400/30",[a.EXPLORING]:"bg-cyan-400 animate-pulse"};function he({row:l,col:n,type:y,onMouseDown:x,onMouseEnter:g,onMouseUp:b}){return e.jsx("div",{className:` w-[22px] h-[22px] border border-slate-800/30 transition-colors duration-100 cursor-pointer select-none ${fe[y]} `,onMouseDown:()=>x(l,n),onMouseEnter:()=>g(l,n),onMouseUp:b,role:"button","aria-label":`Node ${l},${n} - ${y}`})}const ge=r.memo(he,(l,n)=>l.type===n.type&&l.row===n.row&&l.col===n.col);function be({grid:l,isRunning:n,isDrawing:y,setIsDrawing:x,handleNodeInteraction:g}){const b=r.useCallback((f,s)=>{n||(x(!0),g(f,s))},[n,x,g]),T=r.useCallback((f,s)=>{!y||n||g(f,s)},[y,n,g]),m=r.useCallback(()=>{x(!1)},[x]),t=r.useRef(null),u=r.useRef(null),[i,w]=r.useState(1),[h,N]=r.useState("auto");return r.useEffect(()=>{const f=t.current,s=u.current;if(!f||!s)return;const o=()=>{const c=f.clientWidth,p=s.scrollWidth;p>c?w(c/p):w(1)};o();const d=new ResizeObserver(o);return d.observe(f),()=>d.disconnect()},[l]),r.useLayoutEffect(()=>{const f=u.current;f&&N(f.scrollHeight*i)},[i,l]),e.jsx("div",{ref:t,className:"w-full overflow-hidden",children:e.jsx("div",{style:{transform:`scale(${i})`,transformOrigin:"top left",height:h},children:e.jsx("div",{ref:u,className:"inline-block rounded-xl border border-slate-700/50 bg-slate-950/80 p-2 shadow-2xl backdrop-blur-sm",onMouseLeave:()=>x(!1),children:l.map((f,s)=>e.jsx("div",{className:"flex",children:f.map(o=>e.jsx(ge,{row:o.row,col:o.col,type:o.type,onMouseDown:b,onMouseEnter:T,onMouseUp:m},`${o.row}-${o.col}`))},s))})})})}const ye=["bfs","dfs","dijkstra","astar"],Te=["slow","medium","fast","instant"],we=[{mode:"wall",label:"Wall",icon:xe},{mode:"eraser",label:"Eraser",icon:de},{mode:"start",label:"Start",icon:me},{mode:"end",label:"End",icon:Q}];function je({algorithm:l,setAlgorithm:n,speed:y,setSpeed:x,drawMode:g,setDrawMode:b,isRunning:T,isFinished:m,visitedCount:t,pathLength:u,onVisualize:i,onStop:w,onReset:h,onClearVisualization:N,onGenerateMaze:f,soundEnabled:s,onToggleSound:o}){const d=D[l];return e.jsxs("div",{className:"flex flex-col gap-5 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Algorithm"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ye.map(c=>e.jsx("button",{onClick:()=>!T&&n(c),disabled:T,className:` diff --git a/docs/assets/LinkedListAlgoPage-BYNl9xdF.js b/docs/assets/LinkedListAlgoPage-BYNl9xdF.js deleted file mode 100644 index 30db425..0000000 --- a/docs/assets/LinkedListAlgoPage-BYNl9xdF.js +++ /dev/null @@ -1 +0,0 @@ -import{r as j,j as s,L as Q}from"./index-lLadk08S.js";import{P as Z}from"./linkedListAlgo-0_WYfSZm.js";import{u as ee,A as te}from"./AlgorithmCodePanel-8oFtkLXS.js";import{S as ne}from"./shuffle-ADbBlETg.js";import{C as se,a as oe}from"./chevron-right-Cp_zyb7b.js";import{P as re}from"./pause-CU46RSeo.js";import{P as ie}from"./play-b2ZiatJ3.js";import{R as le}from"./rotate-ccw-DMjSdzg2.js";import{V as ae,a as ce}from"./volume-x-CjLNPeax.js";import{A as de}from"./arrow-left-C4-GmPRq.js";import"./audioContext-NbgqvQGz.js";let V=1;function I(u){return u.map(e=>({id:V++,value:e}))}function T(u){return u.split(",").map(e=>Number(e.trim())).filter(e=>Number.isFinite(e))}function v(u){return u.map(e=>({...e}))}function B(u,e){switch(u){case"find-middle":return pe(T(e));case"reverse-list":return ue(T(e));case"add-two-numbers":return he(e);case"reverse-k-group":return xe(e);case"palindrome":return me(T(e));case"lru-cache":return ge(e);case"segregate":return fe(T(e));case"detect-cycle":return ve(e);case"sort-list":return ye(T(e));default:return[]}}function pe(u){const e=I(u),a=[],h=e.length;if(h===0)return[{description:"List is empty — no middle.",event:"not-found",nodes:[],pointers:[],highlights:[],done:!0}];a.push({description:"Start: place both slow and fast pointers on the head node.",event:"visit",nodes:v(e),pointers:[{name:"slow",index:0,color:"green"},{name:"fast",index:0,color:"red"}],highlights:[{index:0,color:"blue"}],meta:["slow = head","fast = head"],codeLine:1});let t=0,l=0;for(;l+2<=h-1;)t+=1,l+=2,a.push({description:`Move slow → index ${t} (value ${e[t].value}), fast → index ${l} (value ${e[l].value}). slow walks 1, fast walks 2.`,event:"compare",nodes:v(e),pointers:[{name:"slow",index:t,color:"green"},{name:"fast",index:l,color:"red"}],highlights:[{index:t,color:"green"},{index:l,color:"red"}],meta:[`slow = ${t}`,`fast = ${l}`],codeLine:4});return l+1===h-1&&(t+=1,l+=1,a.push({description:`fast has one node left → take a final step: slow → ${t} (${e[t].value}), fast → ${l} (${e[l].value}).`,event:"compare",nodes:v(e),pointers:[{name:"slow",index:t,color:"green"},{name:"fast",index:l,color:"red"}],highlights:[{index:t,color:"green"},{index:l,color:"red"}],meta:[`slow = ${t}`,`fast = ${l}`],codeLine:5})),a.push({description:`fast reached the end, so slow stops at the middle: index ${t}, value ${e[t].value}.`,event:"found",nodes:v(e),pointers:[{name:"middle",index:t,color:"green"}],highlights:[{index:t,color:"green"}],meta:[`middle index = ${t}`,`middle value = ${e[t].value}`],codeLine:6,done:!0}),a}function ue(u){const e=I(u),a=e.length;if(a===0)return[{description:"List is empty — nothing to reverse.",event:"complete",nodes:[],pointers:[],highlights:[],done:!0}];if(a===1)return[{description:"Single node — reversing leaves it unchanged.",event:"complete",nodes:v(e),pointers:[{name:"head",index:0,color:"green"}],highlights:[{index:0,color:"green"}],codeLine:8,done:!0}];const h=[];h.push({description:"Start: prev = null, curr = head. We walk the list once, flipping each next pointer to point backwards.",event:"visit",nodes:v(e),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["prev = null","curr = head"],codeLine:1});const t=[];for(let n=0;no.value).join(", ")}]`],codeLine:5}),t.push(c);const m=[...t].reverse().concat(e.slice(n+1));h.push({description:`Advance: prev = ${c.value}, curr = ${n+1o.value).join(", ")}].`,event:"visit",nodes:v(m),pointers:[{name:"prev",index:0,color:"green"},...n+1o.value).join(", ")}]`],codeLine:7})}const l=[...t].reverse();return h.push({description:`curr is null → done. prev is the new head. Reversed list: [${l.map(n=>n.value).join(", ")}]. ✓`,event:"complete",nodes:v(l),pointers:[{name:"head",index:0,color:"green"}],highlights:l.map((n,c)=>({index:c,color:"green"})),codeLine:8,done:!0}),h}function he(u){const[e="0",a="0"]=u.split(";"),h=Math.abs(Math.trunc(Number(e.trim())||0)),t=Math.abs(Math.trunc(Number(a.trim())||0)),l=g=>String(g).split("").map(Number).reverse(),n=l(h),c=l(t),p=[],r=[],m=`A = ${n.join("→")} (=${h})`,o=`B = ${c.join("→")} (=${t})`;p.push({description:`Add ${h} + ${t}. Digits are stored least-significant-first, so we add node by node from the front, carrying overflow.`,event:"visit",nodes:[],pointers:[],highlights:[],meta:[m,o,"carry = 0"],codeLine:2});let i=0;const d=Math.max(n.length,c.length);for(let g=0;g0;g+=1){const y=n[g]??0,b=c[g]??0,f=y+b+i,$=f%10;i=Math.floor(f/10),r.push({id:V++,value:$}),p.push({description:`Position ${g}: ${y} + ${b} + carry ${f-y-b} = ${f} → write digit ${$}, carry ${i}.`,event:i>0?"compare":"push",nodes:v(r),pointers:[{name:"tail",index:r.length-1,color:"green"}],highlights:[{index:r.length-1,color:i>0?"yellow":"green"}],meta:[m,o,`sum = ${f}`,`carry = ${i}`],codeLine:i>0?7:8})}const x=h+t;return p.push({description:`Done. Result list (least-significant-first): [${r.map(g=>g.value).join(", ")}] = ${x}. ✓`,event:"complete",nodes:v(r),pointers:[{name:"head",index:0,color:"green"}],highlights:r.map((g,y)=>({index:y,color:"green"})),meta:[m,o,`${h} + ${t} = ${x}`],codeLine:10,done:!0}),p}function xe(u){const[e="",a="2"]=u.split(";"),h=T(e),t=I(h),l=t.length,n=Math.max(1,Math.trunc(Number(a.trim())||2));if(l===0)return[{description:"List is empty — nothing to reverse.",event:"complete",nodes:[],pointers:[],highlights:[],done:!0}];const c=[],p=t.slice();c.push({description:`Reverse the list in groups of k = ${n}. Each full block of ${n} nodes is reversed; a trailing group with fewer than ${n} nodes is left untouched.`,event:"visit",nodes:v(p),pointers:[],highlights:p.map((o,i)=>({index:i,color:"blue"})),meta:[`k = ${n}`,`length = ${l}`],codeLine:0});let r=0,m=0;for(;r+n<=l;){m+=1,c.push({description:`Group ${m}: indices ${r}…${r+n-1} form a full block of ${n} — reverse it in place.`,event:"recurse",nodes:v(p),pointers:[{name:"start",index:r,color:"green"},{name:"kth",index:r+n-1,color:"red"}],highlights:K(r,r+n).map(d=>({index:d,color:"yellow"})),meta:[`group ${m}`],codeLine:4});let o=r,i=r+n-1;for(;od.value).join(", ")}].`,event:"visit",nodes:v(p),pointers:[],highlights:K(r,r+n).map(d=>({index:d,color:"purple"})),codeLine:13}),r+=n}return r({index:o,color:"blue"})),codeLine:5}),c.push({description:`Done. Result: [${p.map(o=>o.value).join(", ")}]. ✓`,event:"complete",nodes:v(p),pointers:[{name:"head",index:0,color:"green"}],highlights:p.map((o,i)=>({index:i,color:"green"})),codeLine:14,done:!0}),c}function me(u){const e=I(u),a=[],h=e.length;if(h===0)return[{description:"Empty list is trivially a palindrome.",event:"found",nodes:[],pointers:[],highlights:[],done:!0}];a.push({description:"Phase 1 — find the middle with slow (1×) and fast (2×) pointers.",event:"visit",nodes:v(e),pointers:[{name:"slow",index:0,color:"green"},{name:"fast",index:0,color:"red"}],highlights:[{index:0,color:"blue"}],codeLine:2});let t=0,l=0;for(;l+2<=h-1;)t+=1,l+=2,a.push({description:`Advance: slow → ${t} (${e[t].value}), fast → ${l} (${e[l].value}).`,event:"compare",nodes:v(e),pointers:[{name:"slow",index:t,color:"green"},{name:"fast",index:l,color:"red"}],highlights:[{index:t,color:"green"},{index:l,color:"red"}],codeLine:4});const n=(h%2===0,t+1);a.push({description:`Middle found at index ${t}. The second half (indices ${n}…${h-1}) will be reversed.`,event:"visit",nodes:v(e),pointers:[{name:"mid",index:t,color:"yellow"}],highlights:Array.from({length:h-n},(x,g)=>({index:n+g,color:"purple"})),meta:["Phase 2 — reverse 2nd half"],codeLine:6});const c=e.slice(0,n),p=e.slice(n).reverse(),r=[...c,...p];a.push({description:"Second half reversed. Now compare the front half and the reversed back half moving inward.",event:"swap",nodes:v(r),pointers:[{name:"left",index:0,color:"green"},{name:"right",index:h-1,color:"red"}],highlights:Array.from({length:p.length},(x,g)=>({index:c.length+g,color:"purple"})),codeLine:8});let m=0,o=n,i=!0;const d=p.length;for(let x=0;x({index:g,color:i?"green":"red"})),meta:[i?"palindrome = true":"palindrome = false"],codeLine:i?12:10,done:!0}),a}function ge(u){const[e,a=""]=u.split(";"),h=Math.max(1,Number(e.trim())||1),t=a.split(",").map(p=>p.trim()).filter(Boolean),l=[];let n=[];const c=(p,r,m={},o,i=!1)=>{l.push({description:p,event:r,nodes:[],pointers:[],highlights:[],lru:{capacity:h,entries:n.map(d=>({...d})),op:m?.op,hitKey:m?.hitKey??null,missKey:m?.missKey??null,evictKey:m?.evictKey??null},meta:[`capacity = ${h}`,`size = ${n.length}`],codeLine:o,done:i})};c(`Create an LRU cache with capacity ${h}. The front is most-recently-used, the back is least-recently-used.`,"visit",{op:"init"},0);for(const p of t){const r=p.split(/\s+/),m=r[0]?.toLowerCase();if(m==="put"){const o=Number(r[1]),i=Number(r[2]),d=n.findIndex(x=>x.key===o);if(d>=0){const[x]=n.splice(d,1);x.value=i,n.unshift(x),c(`put(${o}, ${i}): key ${o} already exists → update value and move to front (most-recently-used).`,"swap",{op:`put ${o} ${i}`,hitKey:o},11)}else{if(n.length>=h){const x=n[n.length-1];c(`put(${o}, ${i}): cache is full → evict least-recently-used key ${x.key}.`,"pop",{op:`put ${o} ${i}`,evictKey:x.key},13),n=n.slice(0,n.length-1)}n.unshift({key:o,value:i}),c(`put(${o}, ${i}): insert new entry at the front.`,"push",{op:`put ${o} ${i}`,hitKey:o},14)}}else if(m==="get"){const o=Number(r[1]),i=n.findIndex(d=>d.key===o);if(i>=0){const[d]=n.splice(i,1);n.unshift(d),c(`get(${o}) → ${d.value} (HIT). Move key ${o} to the front.`,"found",{op:`get ${o}`,hitKey:o},6)}else c(`get(${o}) → -1 (MISS). Key ${o} is not in the cache.`,"not-found",{op:`get ${o}`,missKey:o},5)}}return c("All operations processed.","complete",{op:"done"},0,!0),l}function fe(u){const e=I(u),a=[],h=e.length;if(h===0)return[{description:"List is empty — nothing to segregate.",event:"complete",nodes:[],pointers:[],highlights:[],done:!0}];a.push({description:"Goal: move all even-valued nodes before all odd-valued nodes, preserving relative order. Scan from the head.",event:"visit",nodes:v(e),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["evens = [ ]","odds = [ ]"],codeLine:3});const t=[],l=[];for(let c=0;cm.value).join(", ")}]`,`odds = [${l.map(m=>m.value).join(", ")}]`],codeLine:r?5:6})}const n=[...t,...l];return a.push({description:`Join the chains: evens (${t.length}) followed by odds (${l.length}).`,event:"swap",nodes:v(n),pointers:[],highlights:n.map((c,p)=>({index:p,color:c.value%2===0?"green":"red"})),meta:[`evens = [${t.map(c=>c.value).join(", ")}]`,`odds = [${l.map(c=>c.value).join(", ")}]`],codeLine:8,done:!0}),a}function ve(u){const[e,a="-1"]=u.split(";"),h=T(e),t=I(h),l=t.length,n=Math.trunc(Number(a.trim())),c=n>=0&&n0,p=c?n:null,r=[];if(l===0)return[{description:"List is empty — no cycle.",event:"not-found",nodes:[],pointers:[],highlights:[],cycleTo:null,done:!0}];const m=L=>L===l-1?c?n:-1:L+1;r.push({description:c?`Tail (index ${l-1}) links back to index ${n}. Run Floyd's tortoise & hare from the head.`:"No cycle declared (tail → null). Run Floyd's tortoise & hare to confirm.",event:"visit",nodes:v(t),pointers:[{name:"slow",index:0,color:"green"},{name:"fast",index:0,color:"red"}],highlights:[{index:0,color:"blue"}],cycleTo:p,meta:["Phase 1 — detect"],codeLine:2});let o=0,i=0,d=-1,x=0;const g=l*4+10;for(;x=0?[{name:"slow",index:o,color:"green"}]:[],highlights:[],cycleTo:p,meta:["cycle = false"],codeLine:6,done:!0}),r;if(r.push({description:`slow → ${o} (${t[o].value}), fast → ${i} (${t[i].value}). ${o===i?"They MET — a cycle exists!":"Not equal yet, keep moving."}`,event:o===i?"found":"compare",nodes:v(t),pointers:[{name:"slow",index:o,color:"green"},{name:"fast",index:i,color:"red"}],highlights:o===i?[{index:o,color:"yellow"}]:[{index:o,color:"green"},{index:i,color:"red"}],cycleTo:p,codeLine:o===i?5:4}),o===i){d=o;break}}if(d===-1)return r.push({description:"No cycle detected.",event:"not-found",nodes:v(t),pointers:[],highlights:[],cycleTo:p,codeLine:6,done:!0}),r;let y=1,b=m(d);for(;b!==d;)y+=1,b=m(b);r.push({description:`Phase 2 — measure loop length: walk from the meeting node until returning to it → length = ${y}.`,event:"visit",nodes:v(t),pointers:[{name:"meet",index:d,color:"yellow"}],highlights:be(d,m).map(L=>({index:L,color:"purple"})),cycleTo:p,meta:[`loop length = ${y}`],codeLine:8});let f=0,$=d;for(r.push({description:"Phase 3 — find loop start: reset one pointer to head; advance both one step at a time. They meet at the loop entry.",event:"visit",nodes:v(t),pointers:[{name:"p1",index:f,color:"green"},{name:"p2",index:$,color:"red"}],highlights:[{index:f,color:"green"},{index:$,color:"red"}],cycleTo:p,codeLine:10});f!==$;)f=m(f),$=m($),r.push({description:`p1 → ${f} (${t[f].value}), p2 → ${$} (${t[$].value}). ${f===$?"Met at the loop start!":"Advance both by one."}`,event:f===$?"found":"compare",nodes:v(t),pointers:[{name:"p1",index:f,color:"green"},{name:"p2",index:$,color:"red"}],highlights:f===$?[{index:f,color:"yellow"}]:[{index:f,color:"green"},{index:$,color:"red"}],cycleTo:p,codeLine:11});const C=f;return r.push({description:`Phase 4 — remove the loop: the node before the loop start (the tail, index ${l-1}) has its next set to null.`,event:"swap",nodes:v(t),pointers:[{name:"start",index:C,color:"yellow"},{name:"tail",index:l-1,color:"red"}],highlights:[{index:C,color:"yellow"},{index:l-1,color:"red"}],cycleTo:p,meta:[`loop start = index ${C}`,`loop length = ${y}`],codeLine:13}),r.push({description:"Loop removed — the list is now a clean acyclic chain ending in null. ✓",event:"complete",nodes:v(t),pointers:[],highlights:t.map((L,w)=>({index:w,color:"green"})),cycleTo:null,meta:["cycle = false",`removed link tail → ${n}`],codeLine:13,done:!0}),r}function be(u,e){const a=[u];let h=e(u);for(;h!==u;)a.push(h),h=e(h);return a}function ye(u){const e=I(u),a=[],h=e.length;if(h<=1)return[{description:h===0?"Empty list — already sorted.":"Single node — already sorted.",event:"complete",nodes:v(e),pointers:[],highlights:e.map((n,c)=>({index:c,color:"green"})),codeLine:2,done:!0}];a.push({description:"Merge sort: recursively split the list into halves until single nodes remain, then merge sorted runs.",event:"visit",nodes:v(e),pointers:[],highlights:e.map((n,c)=>({index:c,color:"blue"})),meta:["Time O(n log n)"],codeLine:0});const t=e.slice(),l=(n,c)=>{if(c-n<=1)return;const p=n+c>>1;a.push({description:`Split indices ${n}…${c-1} into [${n}…${p-1}] and [${p}…${c-1}].`,event:"recurse",nodes:v(t),pointers:[{name:"mid",index:p,color:"yellow"}],highlights:[...K(n,p).map(x=>({index:x,color:"green"})),...K(p,c).map(x=>({index:x,color:"red"}))],codeLine:3}),l(n,p),l(p,c);const r=t.slice(n,p),m=t.slice(p,c),o=[];let i=0,d=0;for(;ix.value).join(", ")}] sorted into indices ${n}…${c-1}.`,event:"swap",nodes:v(t),pointers:[],highlights:K(n,c).map(x=>({index:x,color:"purple"})),codeLine:6})};return l(0,h),a.push({description:`Done — list sorted: [${t.map(n=>n.value).join(", ")}]. ✓`,event:"complete",nodes:v(t),pointers:[],highlights:t.map((n,c)=>({index:c,color:"green"})),codeLine:6,done:!0}),a}function K(u,e){const a=[];for(let h=u;hB(u,e.defaultInput)),[n,c]=j.useState(0),[p,r]=j.useState(!1),[m,o]=j.useState(700),i=j.useRef(m),d=j.useRef(null),x=j.useRef(t),{soundEnabled:g,toggleSound:y,playEvent:b}=ee(),f=j.useRef(b);j.useEffect(()=>{i.current=m},[m]),j.useEffect(()=>{x.current=t},[t]),j.useEffect(()=>{f.current=b},[b]);const $=j.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]);j.useEffect(()=>()=>$(),[$]);const C=t[n]??t[0]??null,L=t.length>0?(n+1)/t.length*100:0,w=j.useCallback(()=>{r(!1),$()},[$]),P=j.useCallback((N,S=!0)=>{const A=x.current,O=Math.max(0,Math.min(A.length-1,N));if(c(O),S){const F=A[O];F&&f.current(F.event,O,A.length)}},[]),W=j.useCallback(()=>{const N=x.current;if(N.length===0)return;let S=n>=N.length-1?0:n;c(S),r(!0);const A=()=>{if(S>=N.length-1){r(!1),$();return}S+=1,c(S);const F=N[S];F&&f.current(F.event,S,N.length),d.current=setTimeout(A,i.current)},O=N[S];O&&f.current(O.event,S,N.length),d.current=setTimeout(A,i.current)},[n,$]),U=j.useCallback(()=>{p?w():W()},[p,W,w]),H=j.useCallback(()=>{w(),P(n+1)},[w,P,n]),X=j.useCallback(()=>{w(),P(n-1)},[w,P,n]),q=j.useCallback(()=>{w(),P(0,!1)},[w,P]),Y=j.useCallback(N=>{w();const A=B(u,N??a);l(A),x.current=A,c(0),A[0]&&f.current(A[0].event,0,A.length)},[a,u,w]),J=j.useMemo(()=>t.reduce((N,S)=>Math.max(N,S.nodes.length),0),[t]);return{info:e,input:a,setInput:h,steps:t,stepIndex:n,currentStep:C,progress:L,isPlaying:p,speed:m,setSpeed:o,soundEnabled:g,toggleSound:y,maxNodes:J,run:Y,togglePlay:U,next:H,prev:X,reset:q,goToStep:N=>{w(),P(N)},canGoNext:n0}}const we={green:{border:"#34d399",bg:"rgba(52,211,153,0.18)",text:"#6ee7b7"},red:{border:"#f87171",bg:"rgba(248,113,113,0.18)",text:"#fca5a5"},yellow:{border:"#fbbf24",bg:"rgba(251,191,36,0.18)",text:"#fde68a"},blue:{border:"#60a5fa",bg:"rgba(96,165,250,0.18)",text:"#93c5fd"},purple:{border:"#c084fc",bg:"rgba(192,132,252,0.18)",text:"#d8b4fe"}},je={border:"#475569",bg:"rgba(30,41,59,0.7)",text:"#cbd5e1"},ke={green:"#34d399",red:"#f87171",yellow:"#fbbf24",blue:"#60a5fa",purple:"#c084fc"},R=60,k=48,D=40,_=R+D,z=6,G=k+78;function Ne({step:u}){return u?u.lru?s.jsx(Se,{step:u}):s.jsx(Le,{step:u}):null}function Le({step:u}){const{nodes:e,pointers:a,highlights:h,cycleTo:t}=u,l=new Map(h.map(d=>[d.index,d.color])),n=new Map;for(const d of a){const x=n.get(d.index)??[];x.push(d),n.set(d.index,x)}if(e.length===0)return s.jsx("div",{className:"flex h-full min-h-[260px] w-full items-center justify-center",children:s.jsx("div",{className:"flex h-16 w-48 items-center justify-center rounded-lg border-2 border-dashed border-slate-700 text-xs text-slate-600",children:"Empty list — null"})});const c=Math.ceil(e.length/z),r=Math.min(e.length,z)*_+D,m=c*G+20,o=28,i=d=>{const x=Math.floor(d/z);return{x:d%z*_+D,y:x*G+o}};return s.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 overflow-auto px-2",children:[s.jsxs("svg",{viewBox:`0 0 ${r+20} ${m}`,width:"100%",style:{maxWidth:`${r+20}px`,overflow:"visible"},children:[e.map((d,x)=>{const g=x===e.length-1,{x:y,y:b}=i(x),f=x%z!==z-1;if(g)return null;if(f)return s.jsxs("g",{children:[s.jsx("line",{x1:y+R,y1:b+k/2,x2:y+_,y2:b+k/2,stroke:"#475569",strokeWidth:1.6}),s.jsx("polygon",{points:`${y+_},${b+k/2} ${y+_-7},${b+k/2-4} ${y+_-7},${b+k/2+4}`,fill:"#475569"})]},`edge-${d.id}`);const $=i(x+1);return s.jsx("path",{d:`M ${y+R} ${b+k/2} L ${y+R+14} ${b+k/2} L ${y+R+14} ${b+k+28} L ${$.x-14} ${$.y+k/2} L ${$.x} ${$.y+k/2}`,fill:"none",stroke:"#475569",strokeWidth:1.6,markerEnd:""},`wrap-${d.id}`)}),t==null&&e.length>0&&(()=>{const d=e.length-1,{x,y:g}=i(d);return s.jsx("text",{x:x+R+22,y:g+k/2+4,textAnchor:"middle",fontSize:"10",fill:"#64748b",fontFamily:"monospace",children:"null"},"null")})(),t!=null&&e.length>0&&(()=>{const d=i(e.length-1),x=i(t),g=d.x+R/2,y=d.y+k,b=x.x+R/2,f=x.y+k,$=Math.max(y,f)+46;return s.jsxs("g",{children:[s.jsx("path",{d:`M ${g} ${y} C ${g} ${$}, ${b} ${$}, ${b} ${f}`,fill:"none",stroke:"#f59e0b",strokeWidth:1.8,strokeDasharray:"5 4"}),s.jsx("polygon",{points:`${b},${f} ${b-4},${f+8} ${b+4},${f+8}`,fill:"#f59e0b"}),s.jsxs("text",{x:(g+b)/2,y:$+12,textAnchor:"middle",fontSize:"9",fill:"#fbbf24",fontFamily:"monospace",children:["cycle → index ",t]})]})})(),e.map((d,x)=>{const{x:g,y}=i(x),b=l.get(x),f=b?we[b]:je,$=n.get(x)??[];return s.jsxs("g",{children:[x===0&&s.jsx("text",{x:g+R/2,y:y-16,textAnchor:"middle",fontSize:"9",fill:"#818cf8",fontFamily:"monospace",children:"head"}),$.map((C,L)=>s.jsx("g",{children:s.jsxs("text",{x:g+R/2,y:y-6-L*11,textAnchor:"middle",fontSize:"9",fontWeight:"bold",fill:ke[C.color??"blue"],fontFamily:"monospace",children:[C.name,"↓"]})},C.name)),s.jsx("rect",{x:g,y,width:R,height:k,rx:8,fill:f.bg,stroke:f.border,strokeWidth:b?2.2:1.5}),s.jsx("text",{x:g+R/2,y:y+k/2+5,textAnchor:"middle",fontSize:"15",fontWeight:"bold",fill:f.text,fontFamily:"sans-serif",children:d.value}),s.jsxs("text",{x:g+R/2,y:y+k+12,textAnchor:"middle",fontSize:"8",fill:"#475569",fontFamily:"monospace",children:["[",x,"]"]})]},d.id)})]}),u.description&&s.jsx("div",{className:"w-full max-w-xl rounded-lg bg-slate-800/60 px-4 py-2 text-center text-xs leading-relaxed text-indigo-300",children:u.description}),u.meta&&u.meta.length>0&&s.jsx("div",{className:"flex flex-wrap justify-center gap-1.5",children:u.meta.map(d=>s.jsx("span",{className:"rounded-full bg-slate-800/80 px-2.5 py-0.5 text-[10px] font-mono text-slate-300 ring-1 ring-slate-700/50",children:d},d))})]})}function Se({step:u}){const e=u.lru,a=Array.from({length:e.capacity});return s.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-5 overflow-auto px-2",children:[s.jsxs("div",{className:"flex w-full max-w-2xl items-center justify-between text-[10px] uppercase tracking-wider text-slate-500",children:[s.jsx("span",{className:"text-emerald-400",children:"← Most recently used"}),s.jsx("span",{className:"text-rose-400",children:"Least recently used →"})]}),s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-3",children:a.map((h,t)=>{const l=e.entries[t];if(!l)return s.jsx("div",{className:"flex h-20 w-24 flex-col items-center justify-center rounded-xl border-2 border-dashed border-slate-700 text-[10px] text-slate-600",children:"empty"},`empty-${t}`);const n=e.hitKey===l.key,p=e.evictKey===l.key?"border-rose-400 bg-rose-500/15":n?"border-emerald-400 bg-emerald-500/15":"border-slate-600 bg-slate-800/70";return s.jsxs("div",{className:`flex h-20 w-24 flex-col items-center justify-center rounded-xl border-2 ${p} transition-all`,children:[s.jsxs("span",{className:"text-[9px] font-mono uppercase tracking-wide text-slate-400",children:["key ",l.key]}),s.jsx("span",{className:"mt-0.5 text-xl font-bold text-white",children:l.value}),t===0&&s.jsx("span",{className:"mt-0.5 text-[8px] font-mono text-emerald-400",children:"MRU"}),t===e.entries.length-1&&e.entries.length===e.capacity&&t!==0&&s.jsx("span",{className:"mt-0.5 text-[8px] font-mono text-rose-400",children:"LRU"})]},l.key)})}),e.missKey!=null&&s.jsxs("div",{className:"rounded-lg bg-rose-500/10 px-3 py-1 text-xs font-mono text-rose-300 ring-1 ring-rose-500/30",children:["MISS · key ",e.missKey," not present"]}),u.description&&s.jsx("div",{className:"w-full max-w-xl rounded-lg bg-slate-800/60 px-4 py-2 text-center text-xs leading-relaxed text-indigo-300",children:u.description}),u.meta&&u.meta.length>0&&s.jsx("div",{className:"flex flex-wrap justify-center gap-1.5",children:u.meta.map(h=>s.jsx("span",{className:"rounded-full bg-slate-800/80 px-2.5 py-0.5 text-[10px] font-mono text-slate-300 ring-1 ring-slate-700/50",children:h},h))})]})}const M=(u,e)=>Math.floor(Math.random()*(e-u+1))+u;function E(u,e=1,a=99){return Array.from({length:u},()=>M(e,a))}function Re(u){switch(u){case"find-middle":return E(M(5,9)).join(",");case"palindrome":{const e=E(M(2,3));if(Math.random()<.6){const a=Math.random()<.5?[M(1,9)]:[];return[...e,...a,...[...e].reverse()].join(",")}return E(M(4,7)).join(",")}case"lru-cache":{const e=M(2,3),a=[1,2,3,4,5],h=[];for(let t=0;t{const w=Re(e);t(w),x(w)};return s.jsxs("aside",{className:"w-full space-y-4 xl:w-80 xl:shrink-0",children:[s.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[s.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Input"}),s.jsx("label",{className:"text-[11px] text-slate-500",children:a.inputLabel}),s.jsx("textarea",{value:h,onChange:w=>t(w.target.value),rows:3,className:"mt-1 w-full resize-none rounded-xl bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50"}),s.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:a.helper}),s.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[s.jsx("button",{onClick:()=>x(),className:"rounded-xl bg-indigo-500/20 px-3 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/40 hover:bg-indigo-500/30",children:"Build Steps"}),s.jsxs("button",{onClick:L,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[s.jsx(ne,{size:13})," Random"]})]})]}),s.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Playback"}),s.jsxs("span",{className:"font-mono text-xs text-indigo-300",children:[Math.min(n+1,l.length)," / ",l.length]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-slate-800",children:s.jsx("div",{className:"h-full rounded-full bg-indigo-400 transition-all",style:{width:`${p}%`}})}),s.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Animation Speed"}),s.jsxs("span",{className:"font-mono text-[10px] text-indigo-300",children:[(m/1e3).toFixed(2),"s"]})]}),s.jsx("input",{type:"range",min:120,max:3e3,step:20,value:3120-m,onChange:w=>o(3120-Number(w.target.value)),className:"w-full accent-indigo-400","aria-label":"Animation speed"}),s.jsxs("div",{className:"mt-1 flex justify-between text-[9px] uppercase tracking-wide text-slate-600",children:[s.jsx("span",{children:"Slow"}),s.jsx("span",{children:"Fast"})]})]}),s.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[s.jsxs("button",{onClick:b,disabled:!C,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:[s.jsx(se,{size:13})," Back"]}),s.jsx("button",{onClick:g,className:`inline-flex items-center justify-center gap-1 rounded-xl px-2 py-2 text-xs font-semibold ring-1 ${r?"bg-amber-500/15 text-amber-300 ring-amber-500/30":"bg-emerald-500/15 text-emerald-300 ring-emerald-500/30"}`,children:r?s.jsxs(s.Fragment,{children:[s.jsx(re,{size:13})," Pause"]}):s.jsxs(s.Fragment,{children:[s.jsx(ie,{size:13})," Play"]})}),s.jsxs("button",{onClick:y,disabled:!$,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:["Next ",s.jsx(oe,{size:13})]})]}),s.jsxs("button",{onClick:f,className:"mt-2 inline-flex w-full items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[s.jsx(le,{size:13})," Reset"]}),s.jsx("p",{className:"mt-3 min-h-10 text-xs leading-relaxed text-slate-300",children:c?.description})]}),s.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[s.jsxs("button",{onClick:()=>d(!i),className:`inline-flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 ${i?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[i?s.jsx(ae,{size:14}):s.jsx(ce,{size:14}),i?"Sound On":"Sound Off"]}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:a.tags.map(w=>s.jsx("span",{className:"rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-300 ring-1 ring-violet-500/20",children:w},w))}),s.jsx("p",{className:"mt-2 text-[10px] font-mono text-slate-500",children:a.complexity})]})]})}function De({problem:u}){const e=$e(u),{info:a}=e;return s.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[s.jsxs("main",{className:"order-last flex min-h-[520px] flex-1 flex-col gap-4 xl:order-first",children:[s.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm",children:[s.jsxs(Q,{to:"/algorithms/linked-list",className:"mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-slate-400 transition-colors hover:text-indigo-300",children:[s.jsx(de,{size:13})," Linked List Algorithms"]}),s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-indigo-300",children:"Linked List Algorithms"}),s.jsx("h2",{className:"mt-1 text-xl font-bold text-white",children:a.title}),s.jsx("p",{className:"mt-1 text-sm text-slate-400",children:a.subtitle})]}),s.jsx("section",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-900/40 p-4 backdrop-blur-sm",children:s.jsx(Ne,{step:e.currentStep})}),s.jsx(te,{pseudocode:a.pseudocode,activeLine:e.currentStep?.codeLine??null})]}),s.jsx(Me,{hook:e,problem:u})]})}export{De as default}; diff --git a/docs/assets/LinkedListAlgoPage-DLEBZwaB.js b/docs/assets/LinkedListAlgoPage-DLEBZwaB.js new file mode 100644 index 0000000..70a779f --- /dev/null +++ b/docs/assets/LinkedListAlgoPage-DLEBZwaB.js @@ -0,0 +1 @@ +import{r as j,j as i,L as Q}from"./index-CB1-0H6I.js";import{P as Z}from"./linkedListAlgo-0_WYfSZm.js";import{u as ee,A as te}from"./AlgorithmCodePanel-B_cngBmY.js";import{S as ne}from"./shuffle-DZnyoAGL.js";import{C as se,a as oe}from"./chevron-right-ChVmoNtO.js";import{P as ie}from"./pause-DgUWKqjY.js";import{P as re}from"./play-SZ6Nqtz8.js";import{R as le}from"./rotate-ccw-CDlWXRsI.js";import{V as ae,a as de}from"./volume-x-CKT6TOtL.js";import{A as ce}from"./arrow-left-eH0A06ps.js";import"./audioContext-NbgqvQGz.js";let V=1;function _(g){return g.map(t=>({id:V++,value:t}))}function O(g){return g.split(",").map(t=>Number(t.trim())).filter(t=>Number.isFinite(t))}function u(g){return g.map(t=>({...t}))}function q(g,t){switch(g){case"find-middle":return he(O(t));case"reverse-list":return pe(O(t));case"add-two-numbers":return ue(t);case"reverse-k-group":return me(t);case"palindrome":return xe(O(t));case"lru-cache":return ge(t);case"segregate":return fe(O(t));case"detect-cycle":return ve(t);case"sort-list":return ye(O(t));default:return[]}}function he(g){const t=_(g),c=[],x=t.length;if(x===0)return[{description:"List is empty — no middle.",event:"not-found",nodes:[],pointers:[],highlights:[],done:!0}];c.push({description:"Set slow = head (index 0).",event:"visit",nodes:u(t),pointers:[{name:"slow",index:0,color:"green"}],highlights:[{index:0,color:"blue"}],meta:["slow = head"],codeLine:1}),c.push({description:"Set fast = head (index 0). Both pointers start together.",event:"visit",nodes:u(t),pointers:[{name:"slow",index:0,color:"green"},{name:"fast",index:0,color:"red"}],highlights:[{index:0,color:"blue"}],meta:["slow = head","fast = head"],codeLine:2});let e=0,r=0;for(;r+2<=x-1;)c.push({description:`Loop check: fast can move two nodes ahead (fast at index ${r}). Enter the loop.`,event:"compare",nodes:u(t),pointers:[{name:"slow",index:e,color:"green"},{name:"fast",index:r,color:"red"}],highlights:[{index:e,color:"green"},{index:r,color:"red"}],meta:[`slow = ${e}`,`fast = ${r}`],codeLine:3}),e+=1,c.push({description:`slow = slow.next → index ${e} (value ${t[e].value}). slow walks 1 step.`,event:"visit",nodes:u(t),pointers:[{name:"slow",index:e,color:"green"},{name:"fast",index:r,color:"red"}],highlights:[{index:e,color:"green"},{index:r,color:"red"}],meta:[`slow = ${e}`,`fast = ${r}`],codeLine:4}),r+=2,c.push({description:`fast = fast.next.next → index ${r} (value ${t[r].value}). fast walks 2 steps.`,event:"compare",nodes:u(t),pointers:[{name:"slow",index:e,color:"green"},{name:"fast",index:r,color:"red"}],highlights:[{index:e,color:"green"},{index:r,color:"red"}],meta:[`slow = ${e}`,`fast = ${r}`],codeLine:5});return r+1===x-1&&(c.push({description:"Loop check: fast has a single node ahead — take one more paired step.",event:"compare",nodes:u(t),pointers:[{name:"slow",index:e,color:"green"},{name:"fast",index:r,color:"red"}],highlights:[{index:e,color:"green"},{index:r,color:"red"}],meta:[`slow = ${e}`,`fast = ${r}`],codeLine:3}),e+=1,r+=1,c.push({description:`slow → ${e} (${t[e].value}); fast → ${r} (${t[r].value}).`,event:"compare",nodes:u(t),pointers:[{name:"slow",index:e,color:"green"},{name:"fast",index:r,color:"red"}],highlights:[{index:e,color:"green"},{index:r,color:"red"}],meta:[`slow = ${e}`,`fast = ${r}`],codeLine:5})),c.push({description:`fast reached the end, so slow stops at the middle: index ${e}, value ${t[e].value}.`,event:"found",nodes:u(t),pointers:[{name:"middle",index:e,color:"green"}],highlights:[{index:e,color:"green"}],meta:[`middle index = ${e}`,`middle value = ${t[e].value}`],codeLine:6,done:!0}),c}function pe(g){const t=_(g),c=t.length;if(c===0)return[{description:"List is empty — nothing to reverse.",event:"complete",nodes:[],pointers:[],highlights:[],done:!0}];if(c===1)return[{description:"Single node — reversing leaves it unchanged.",event:"complete",nodes:u(t),pointers:[{name:"head",index:0,color:"green"}],highlights:[{index:0,color:"green"}],codeLine:8,done:!0}];const x=[];x.push({description:"Set prev = null. This will become the new head once we finish.",event:"visit",nodes:u(t),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["prev = null"],codeLine:1}),x.push({description:"Set curr = head. We walk the list once, flipping each next pointer to point backwards.",event:"visit",nodes:u(t),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["prev = null","curr = head"],codeLine:2});const e=[];for(let n=0;nh.value).join(", ")}]`],codeLine:3}),x.push({description:`Remember next = ${n+1h.value).join(", ")}]`],codeLine:4}),x.push({description:`Flip curr (${l.value}) → point at prev (${e.length?e[e.length-1].value:"null"}).`,event:"swap",nodes:u(d),pointers:[...p,{name:"curr",index:s,color:"yellow"},...o],highlights:[{index:s,color:"yellow"}],meta:[`reversed = [${[...e].reverse().map(h=>h.value).join(", ")}]`],codeLine:5}),e.push(l);const a=[...e].reverse().concat(t.slice(n+1));x.push({description:`Advance prev = ${l.value}. Reversed prefix is now [${[...e].reverse().map(h=>h.value).join(", ")}].`,event:"visit",nodes:u(a),pointers:[{name:"prev",index:0,color:"green"},...n+1h.value).join(", ")}]`],codeLine:6}),x.push({description:`Advance curr = ${n+1h.value).join(", ")}]`],codeLine:7})}const r=[...e].reverse();return x.push({description:`curr is null → done. prev is the new head. Reversed list: [${r.map(n=>n.value).join(", ")}]. ✓`,event:"complete",nodes:u(r),pointers:[{name:"head",index:0,color:"green"}],highlights:r.map((n,l)=>({index:l,color:"green"})),codeLine:8,done:!0}),x}function ue(g){const[t="0",c="0"]=g.split(";"),x=Math.abs(Math.trunc(Number(t.trim())||0)),e=Math.abs(Math.trunc(Number(c.trim())||0)),r=v=>String(v).split("").map(Number).reverse(),n=r(x),l=r(e),d=[],s=[],p=`A = ${n.join("→")} (=${x})`,o=`B = ${l.join("→")} (=${e})`;d.push({description:`Add ${x} + ${e}. Digits are stored least-significant-first, so we add node by node from the front, carrying overflow.`,event:"visit",nodes:[],pointers:[],highlights:[],meta:[p,o,"carry = 0"],codeLine:1}),d.push({description:"Initialise carry = 0 before walking both digit lists.",event:"visit",nodes:[],pointers:[],highlights:[],meta:[p,o,"carry = 0"],codeLine:2});let a=0;const h=Math.max(n.length,l.length);for(let v=0;v0;v+=1){const y=n[v]??0,$=l[v]??0,f=a,b=v=0?[{name:"tail",index:L,color:"green"}]:[],A=L>=0?[{index:L,color:"blue"}]:[];d.push({description:`Loop check: ${b?"A has a digit":"A exhausted"}, ${R?"B has a digit":"B exhausted"}, carry = ${f}. Continue.`,event:"visit",nodes:u(s),pointers:w,highlights:A,meta:[p,o,`carry = ${f}`],codeLine:3});let k=f;d.push({description:`Start this position's sum with the incoming carry: sum = ${f}.`,event:"visit",nodes:u(s),pointers:w,highlights:A,meta:[p,o,`sum = ${k}`,`carry = ${f}`],codeLine:4}),k+=y,d.push({description:b?`A has digit ${y} at this position → sum += ${y} = ${k}; advance A.`:`A is exhausted at this position → nothing to add. sum = ${k}.`,event:"compare",nodes:u(s),pointers:w,highlights:A,meta:[p,o,`sum = ${k}`,`carry = ${f}`],codeLine:5}),k+=$,d.push({description:R?`B has digit ${$} at this position → sum += ${$} = ${k}; advance B.`:`B is exhausted at this position → nothing to add. sum = ${k}.`,event:"compare",nodes:u(s),pointers:w,highlights:A,meta:[p,o,`sum = ${k}`,`carry = ${f}`],codeLine:6}),a=Math.floor(k/10);const K=k%10;d.push({description:`carry = floor(${k} / 10) = ${a}.`,event:"compare",nodes:u(s),pointers:w,highlights:A,meta:[p,o,`sum = ${k}`,`carry = ${a}`],codeLine:7}),s.push({id:V++,value:K}),d.push({description:`Append a node with digit sum % 10 = ${K}.`,event:"push",nodes:u(s),pointers:[{name:"tail",index:s.length-1,color:"green"}],highlights:[{index:s.length-1,color:"green"}],meta:[p,o,`sum = ${k}`,`carry = ${a}`],codeLine:8}),d.push({description:`Advance tail to the node just appended (digit ${K}).`,event:"visit",nodes:u(s),pointers:[{name:"tail",index:s.length-1,color:"green"}],highlights:[{index:s.length-1,color:"blue"}],meta:[p,o,`carry = ${a}`],codeLine:9})}const m=x+e;return d.push({description:`Done. Result list (least-significant-first): [${s.map(v=>v.value).join(", ")}] = ${m}. ✓`,event:"complete",nodes:u(s),pointers:[{name:"head",index:0,color:"green"}],highlights:s.map((v,y)=>({index:y,color:"green"})),meta:[p,o,`${x} + ${e} = ${m}`],codeLine:10,done:!0}),d}function me(g){const[t="",c="2"]=g.split(";"),x=O(t),e=_(x),r=e.length,n=Math.max(1,Math.trunc(Number(c.trim())||2));if(r===0)return[{description:"List is empty — nothing to reverse.",event:"complete",nodes:[],pointers:[],highlights:[],done:!0}];const l=[],d=e.slice();l.push({description:`Reverse the list in groups of k = ${n}. Each full block of ${n} nodes is reversed; a trailing group with fewer than ${n} nodes is left untouched.`,event:"visit",nodes:u(d),pointers:[],highlights:d.map((o,a)=>({index:a,color:"blue"})),meta:[`k = ${n}`,`length = ${r}`],codeLine:0});let s=0,p=0;for(;s+n<=r;){p+=1,l.push({description:`Group ${p}: look k = ${n} nodes ahead from index ${s}.`,event:"recurse",nodes:u(d),pointers:[{name:"start",index:s,color:"green"}],highlights:I(s,Math.min(s+n,r)).map(h=>({index:h,color:"blue"})),meta:[`group ${p}`],codeLine:3}),l.push({description:`kth node of this group is at index ${s+n-1} (value ${d[s+n-1].value}).`,event:"compare",nodes:u(d),pointers:[{name:"start",index:s,color:"green"},{name:"kth",index:s+n-1,color:"red"}],highlights:I(s,s+n).map(h=>({index:h,color:"yellow"})),meta:[`group ${p}`],codeLine:4}),l.push({description:`Full block of ${n} found → reverse indices ${s}…${s+n-1} in place.`,event:"visit",nodes:u(d),pointers:[{name:"start",index:s,color:"green"},{name:"kth",index:s+n-1,color:"red"}],highlights:I(s,s+n).map(h=>({index:h,color:"yellow"})),codeLine:8});let o=s,a=s+n-1;for(;o({index:m,color:"yellow"})),codeLine:11})}l.push({description:`Group ${p} reversed → [${d.slice(s,s+n).map(h=>h.value).join(", ")}]. Relink it and move groupPrev forward.`,event:"visit",nodes:u(d),pointers:[],highlights:I(s,s+n).map(h=>({index:h,color:"purple"})),codeLine:13}),s+=n}return s({index:o,color:"blue"})),codeLine:4}),l.push({description:`Remaining indices ${s}…${r-1} are fewer than k = ${n} — kth is null, so break and leave them as-is.`,event:"compare",nodes:u(d),pointers:[{name:"rest",index:s,color:"yellow"}],highlights:I(s,r).map(o=>({index:o,color:"blue"})),codeLine:5})),l.push({description:`Done. Result: [${d.map(o=>o.value).join(", ")}]. ✓`,event:"complete",nodes:u(d),pointers:[{name:"head",index:0,color:"green"}],highlights:d.map((o,a)=>({index:a,color:"green"})),codeLine:14,done:!0}),l}function xe(g){const t=_(g),c=[],x=t.length;if(x===0)return[{description:"Empty list is trivially a palindrome.",event:"found",nodes:[],pointers:[],highlights:[],done:!0}];c.push({description:"Phase 1 — find the middle with slow (1×) and fast (2×) pointers.",event:"visit",nodes:u(t),pointers:[{name:"slow",index:0,color:"green"},{name:"fast",index:0,color:"red"}],highlights:[{index:0,color:"blue"}],codeLine:2});let e=0,r=0;for(;r+2<=x-1;)c.push({description:`Loop check: fast can move two nodes ahead (fast at index ${r}). Continue scanning for the middle.`,event:"compare",nodes:u(t),pointers:[{name:"slow",index:e,color:"green"},{name:"fast",index:r,color:"red"}],highlights:[{index:e,color:"green"},{index:r,color:"red"}],codeLine:3}),e+=1,r+=2,c.push({description:`Advance: slow → ${e} (${t[e].value}), fast → ${r} (${t[r].value}).`,event:"compare",nodes:u(t),pointers:[{name:"slow",index:e,color:"green"},{name:"fast",index:r,color:"red"}],highlights:[{index:e,color:"green"},{index:r,color:"red"}],codeLine:4});const n=(x%2===0,e+1);c.push({description:`Middle found at index ${e}. The second half (indices ${n}…${x-1}) will be reversed.`,event:"visit",nodes:u(t),pointers:[{name:"mid",index:e,color:"yellow"}],highlights:Array.from({length:x-n},(m,v)=>({index:n+v,color:"purple"})),meta:["Phase 2 — reverse 2nd half"],codeLine:6});const l=t.slice(0,n),d=t.slice(n).reverse(),s=[...l,...d];c.push({description:"Second half reversed. Set p = head, q = second (start of reversed half). Compare moving inward.",event:"swap",nodes:u(s),pointers:[{name:"p",index:0,color:"green"},{name:"q",index:n,color:"red"}],highlights:Array.from({length:d.length},(m,v)=>({index:l.length+v,color:"purple"})),codeLine:8});let p=0,o=n,a=!0;const h=d.length;for(let m=0;m({index:v,color:a?"green":"red"})),meta:[a?"palindrome = true":"palindrome = false"],codeLine:a?12:10,done:!0}),c}function ge(g){const[t,c=""]=g.split(";"),x=Math.max(1,Number(t.trim())||1),e=c.split(",").map(d=>d.trim()).filter(Boolean),r=[];let n=[];const l=(d,s,p={},o,a=!1)=>{r.push({description:d,event:s,nodes:[],pointers:[],highlights:[],lru:{capacity:x,entries:n.map(h=>({...h})),op:p?.op,hitKey:p?.hitKey??null,missKey:p?.missKey??null,evictKey:p?.evictKey??null},meta:[`capacity = ${x}`,`size = ${n.length}`],codeLine:o,done:a})};l(`Create an LRU cache with capacity ${x}. The front is most-recently-used, the back is least-recently-used.`,"visit",{op:"init"},0);for(const d of e){const s=d.split(/\s+/),p=s[0]?.toLowerCase();if(p==="put"){const o=Number(s[1]),a=Number(s[2]),h=n.findIndex(m=>m.key===o);if(h>=0){const[m]=n.splice(h,1);m.value=a,n.unshift(m),l(`put(${o}, ${a}): key ${o} already exists → update value and move to front (most-recently-used).`,"swap",{op:`put ${o} ${a}`,hitKey:o},11)}else{if(n.length>=x){const m=n[n.length-1];l(`put(${o}, ${a}): cache is full → evict least-recently-used key ${m.key}.`,"pop",{op:`put ${o} ${a}`,evictKey:m.key},13),n=n.slice(0,n.length-1)}n.unshift({key:o,value:a}),l(`put(${o}, ${a}): insert new entry at the front.`,"push",{op:`put ${o} ${a}`,hitKey:o},14)}}else if(p==="get"){const o=Number(s[1]),a=n.findIndex(h=>h.key===o);if(a>=0){const[h]=n.splice(a,1);n.unshift(h),l(`get(${o}) → ${h.value} (HIT). Move key ${o} to the front.`,"found",{op:`get ${o}`,hitKey:o},6)}else l(`get(${o}) → -1 (MISS). Key ${o} is not in the cache.`,"not-found",{op:`get ${o}`,missKey:o},5)}}return l("All operations processed.","complete",{op:"done"},0,!0),r}function fe(g){const t=_(g),c=[],x=t.length;if(x===0)return[{description:"List is empty — nothing to segregate.",event:"complete",nodes:[],pointers:[],highlights:[],done:!0}];c.push({description:"Goal: move all even-valued nodes before all odd-valued nodes, preserving relative order. Scan from the head.",event:"visit",nodes:u(t),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["evens = [ ]","odds = [ ]"],codeLine:0}),c.push({description:"Create an empty evens chain to collect even-valued nodes.",event:"visit",nodes:u(t),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["evens = [ ]"],codeLine:1}),c.push({description:"Create an empty odds chain to collect odd-valued nodes.",event:"visit",nodes:u(t),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["evens = [ ]","odds = [ ]"],codeLine:2}),c.push({description:"Set curr = head and scan the list once.",event:"visit",nodes:u(t),pointers:[{name:"curr",index:0,color:"yellow"}],highlights:[{index:0,color:"blue"}],meta:["evens = [ ]","odds = [ ]"],codeLine:3});const e=[],r=[];for(let l=0;lp.value).join(", ")}]`,`odds = [${r.map(p=>p.value).join(", ")}]`],codeLine:4}),s?e.push(d):r.push(d),c.push({description:`Node ${d.value} is ${s?"EVEN → append to evens chain":"ODD → append to odds chain"}.`,event:"compare",nodes:u(t),pointers:[{name:"curr",index:l,color:"yellow"}],highlights:[{index:l,color:s?"green":"red"}],meta:[`evens = [${e.map(p=>p.value).join(", ")}]`,`odds = [${r.map(p=>p.value).join(", ")}]`],codeLine:s?5:6}),c.push({description:l+1p.value).join(", ")}]`,`odds = [${r.map(p=>p.value).join(", ")}]`],codeLine:7})}const n=[...e,...r];return c.push({description:`Join the chains: evens (${e.length}) followed by odds (${r.length}).`,event:"swap",nodes:u(n),pointers:[],highlights:n.map((l,d)=>({index:d,color:l.value%2===0?"green":"red"})),meta:[`evens = [${e.map(l=>l.value).join(", ")}]`,`odds = [${r.map(l=>l.value).join(", ")}]`],codeLine:8,done:!0}),c}function ve(g){const[t,c="-1"]=g.split(";"),x=O(t),e=_(x),r=e.length,n=Math.trunc(Number(c.trim())),l=n>=0&&n0,d=l?n:null,s=[];if(r===0)return[{description:"List is empty — no cycle.",event:"not-found",nodes:[],pointers:[],highlights:[],cycleTo:null,done:!0}];const p=L=>L===r-1?l?n:-1:L+1;s.push({description:l?`Tail (index ${r-1}) links back to index ${n}. Run Floyd's tortoise & hare from the head.`:"No cycle declared (tail → null). Run Floyd's tortoise & hare to confirm.",event:"visit",nodes:u(e),pointers:[{name:"slow",index:0,color:"green"},{name:"fast",index:0,color:"red"}],highlights:[{index:0,color:"blue"}],cycleTo:d,meta:["Phase 1 — detect"],codeLine:2});let o=0,a=0,h=-1,m=0;const v=r*4+10;for(;m=0?[{name:"slow",index:o,color:"green"}]:[],highlights:[],cycleTo:d,meta:["cycle = false"],codeLine:6,done:!0}),s;if(s.push({description:`slow → ${o} (${e[o].value}), fast → ${a} (${e[a].value}). ${o===a?"They MET — a cycle exists!":"Not equal yet, keep moving."}`,event:o===a?"found":"compare",nodes:u(e),pointers:[{name:"slow",index:o,color:"green"},{name:"fast",index:a,color:"red"}],highlights:o===a?[{index:o,color:"yellow"}]:[{index:o,color:"green"},{index:a,color:"red"}],cycleTo:d,codeLine:o===a?5:4}),o===a){h=o;break}}if(h===-1)return s.push({description:"No cycle detected.",event:"not-found",nodes:u(e),pointers:[],highlights:[],cycleTo:d,codeLine:6,done:!0}),s;let y=1,$=p(h);for(;$!==h;)y+=1,$=p($);s.push({description:`Phase 2 — measure loop length: walk from the meeting node until returning to it → length = ${y}.`,event:"visit",nodes:u(e),pointers:[{name:"meet",index:h,color:"yellow"}],highlights:$e(h,p).map(L=>({index:L,color:"purple"})),cycleTo:d,meta:[`loop length = ${y}`],codeLine:8});let f=0,b=h;for(s.push({description:"Phase 3 — find loop start: reset one pointer to head; advance both one step at a time. They meet at the loop entry.",event:"visit",nodes:u(e),pointers:[{name:"p1",index:f,color:"green"},{name:"p2",index:b,color:"red"}],highlights:[{index:f,color:"green"},{index:b,color:"red"}],cycleTo:d,codeLine:10});f!==b;)f=p(f),b=p(b),s.push({description:`p1 → ${f} (${e[f].value}), p2 → ${b} (${e[b].value}). ${f===b?"Met at the loop start!":"Advance both by one."}`,event:f===b?"found":"compare",nodes:u(e),pointers:[{name:"p1",index:f,color:"green"},{name:"p2",index:b,color:"red"}],highlights:f===b?[{index:f,color:"yellow"}]:[{index:f,color:"green"},{index:b,color:"red"}],cycleTo:d,codeLine:11});const R=f;return s.push({description:`Phase 4 — remove the loop: the node before the loop start (the tail, index ${r-1}) has its next set to null.`,event:"swap",nodes:u(e),pointers:[{name:"start",index:R,color:"yellow"},{name:"tail",index:r-1,color:"red"}],highlights:[{index:R,color:"yellow"},{index:r-1,color:"red"}],cycleTo:d,meta:[`loop start = index ${R}`,`loop length = ${y}`],codeLine:12}),s.push({description:"Loop removed — the list is now a clean acyclic chain ending in null. ✓",event:"complete",nodes:u(e),pointers:[],highlights:e.map((L,w)=>({index:w,color:"green"})),cycleTo:null,meta:["cycle = false",`removed link tail → ${n}`],codeLine:13,done:!0}),s}function $e(g,t){const c=[g];let x=t(g);for(;x!==g;)c.push(x),x=t(x);return c}function ye(g){const t=_(g),c=[],x=t.length;if(x<=1)return[{description:x===0?"Empty list — already sorted.":"Single node — already sorted.",event:"complete",nodes:u(t),pointers:[],highlights:t.map((n,l)=>({index:l,color:"green"})),codeLine:2,done:!0}];c.push({description:"Merge sort: recursively split the list into halves until single nodes remain, then merge sorted runs.",event:"visit",nodes:u(t),pointers:[],highlights:t.map((n,l)=>({index:l,color:"blue"})),meta:["Time O(n log n)"],codeLine:0});const e=t.slice(),r=(n,l)=>{if(l-n<=1){c.push({description:`Base case: indices ${n}…${l-1} is a single node (${e[n].value}) — already sorted, return it.`,event:"visit",nodes:u(e),pointers:[],highlights:n>1;c.push({description:`Split indices ${n}…${l-1} into [${n}…${d-1}] and [${d}…${l-1}].`,event:"recurse",nodes:u(e),pointers:[{name:"mid",index:d,color:"yellow"}],highlights:[...I(n,d).map(m=>({index:m,color:"green"})),...I(d,l).map(m=>({index:m,color:"red"}))],codeLine:3}),c.push({description:`Recurse on the left half: sortList(indices ${n}…${d-1}).`,event:"recurse",nodes:u(e),pointers:[],highlights:I(n,d).map(m=>({index:m,color:"green"})),codeLine:4}),r(n,d),c.push({description:`Recurse on the right half: sortList(indices ${d}…${l-1}).`,event:"recurse",nodes:u(e),pointers:[],highlights:I(d,l).map(m=>({index:m,color:"red"})),codeLine:5}),r(d,l);const s=e.slice(n,d),p=e.slice(d,l),o=[];let a=0,h=0;for(;am.value).join(", ")}] sorted into indices ${n}…${l-1}.`,event:"swap",nodes:u(e),pointers:[],highlights:I(n,l).map(m=>({index:m,color:"purple"})),codeLine:6})};return r(0,x),c.push({description:`Done — list sorted: [${e.map(n=>n.value).join(", ")}]. ✓`,event:"complete",nodes:u(e),pointers:[],highlights:e.map((n,l)=>({index:l,color:"green"})),codeLine:6,done:!0}),c}function I(g,t){const c=[];for(let x=g;xq(g,t.defaultInput)),[n,l]=j.useState(0),[d,s]=j.useState(!1),[p,o]=j.useState(700),a=j.useRef(p),h=j.useRef(null),m=j.useRef(e),{soundEnabled:v,toggleSound:y,playEvent:$}=ee(),f=j.useRef($);j.useEffect(()=>{a.current=p},[p]),j.useEffect(()=>{m.current=e},[e]),j.useEffect(()=>{f.current=$},[$]);const b=j.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]);j.useEffect(()=>()=>b(),[b]);const R=e[n]??e[0]??null,L=e.length>0?(n+1)/e.length*100:0,w=j.useCallback(()=>{s(!1),b()},[b]),A=j.useCallback((S,M=!0)=>{const E=m.current,z=Math.max(0,Math.min(E.length-1,S));if(l(z),M){const D=E[z];D&&f.current(D.event,z,E.length)}},[]),k=j.useCallback(()=>{const S=m.current;if(S.length===0)return;let M=n>=S.length-1?0:n;l(M),s(!0);const E=()=>{if(M>=S.length-1){s(!1),b();return}M+=1,l(M);const D=S[M];D&&f.current(D.event,M,S.length),h.current=setTimeout(E,a.current)},z=S[M];z&&f.current(z.event,M,S.length),h.current=setTimeout(E,a.current)},[n,b]),K=j.useCallback(()=>{d?w():k()},[d,k,w]),H=j.useCallback(()=>{w(),A(n+1)},[w,A,n]),U=j.useCallback(()=>{w(),A(n-1)},[w,A,n]),X=j.useCallback(()=>{w(),A(0,!1)},[w,A]),Y=j.useCallback(S=>{w();const E=q(g,S??c);r(E),m.current=E,l(0),E[0]&&f.current(E[0].event,0,E.length)},[c,g,w]),J=j.useMemo(()=>e.reduce((S,M)=>Math.max(S,M.nodes.length),0),[e]);return{info:t,input:c,setInput:x,steps:e,stepIndex:n,currentStep:R,progress:L,isPlaying:d,speed:p,setSpeed:o,soundEnabled:v,toggleSound:y,maxNodes:J,run:Y,togglePlay:K,next:H,prev:U,reset:X,goToStep:S=>{w(),A(S)},canGoNext:n0}}const we={green:{border:"#34d399",bg:"rgba(52,211,153,0.18)",text:"#6ee7b7"},red:{border:"#f87171",bg:"rgba(248,113,113,0.18)",text:"#fca5a5"},yellow:{border:"#fbbf24",bg:"rgba(251,191,36,0.18)",text:"#fde68a"},blue:{border:"#60a5fa",bg:"rgba(96,165,250,0.18)",text:"#93c5fd"},purple:{border:"#c084fc",bg:"rgba(192,132,252,0.18)",text:"#d8b4fe"}},je={border:"#475569",bg:"rgba(30,41,59,0.7)",text:"#cbd5e1"},Le={green:"#34d399",red:"#f87171",yellow:"#fbbf24",blue:"#60a5fa",purple:"#c084fc"},C=60,N=48,W=40,F=C+W,B=6,G=N+78;function ke({step:g}){return g?g.lru?i.jsx(Se,{step:g}):i.jsx(Ne,{step:g}):null}function Ne({step:g}){const{nodes:t,pointers:c,highlights:x,cycleTo:e}=g,r=new Map(x.map(h=>[h.index,h.color])),n=new Map;for(const h of c){const m=n.get(h.index)??[];m.push(h),n.set(h.index,m)}if(t.length===0)return i.jsx("div",{className:"flex h-full min-h-[260px] w-full items-center justify-center",children:i.jsx("div",{className:"flex h-16 w-48 items-center justify-center rounded-lg border-2 border-dashed border-slate-700 text-xs text-slate-600",children:"Empty list — null"})});const l=Math.ceil(t.length/B),s=Math.min(t.length,B)*F+W,p=l*G+20,o=28,a=h=>{const m=Math.floor(h/B);return{x:h%B*F+W,y:m*G+o}};return i.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 overflow-auto px-2",children:[i.jsxs("svg",{viewBox:`0 0 ${s+20} ${p}`,width:"100%",style:{maxWidth:`${s+20}px`,overflow:"visible"},children:[t.map((h,m)=>{const v=m===t.length-1,{x:y,y:$}=a(m),f=m%B!==B-1;if(v)return null;if(f)return i.jsxs("g",{children:[i.jsx("line",{x1:y+C,y1:$+N/2,x2:y+F,y2:$+N/2,stroke:"#475569",strokeWidth:1.6}),i.jsx("polygon",{points:`${y+F},${$+N/2} ${y+F-7},${$+N/2-4} ${y+F-7},${$+N/2+4}`,fill:"#475569"})]},`edge-${h.id}`);const b=a(m+1);return i.jsx("path",{d:`M ${y+C} ${$+N/2} L ${y+C+14} ${$+N/2} L ${y+C+14} ${$+N+28} L ${b.x-14} ${b.y+N/2} L ${b.x} ${b.y+N/2}`,fill:"none",stroke:"#475569",strokeWidth:1.6,markerEnd:""},`wrap-${h.id}`)}),e==null&&t.length>0&&(()=>{const h=t.length-1,{x:m,y:v}=a(h);return i.jsx("text",{x:m+C+22,y:v+N/2+4,textAnchor:"middle",fontSize:"10",fill:"#64748b",fontFamily:"monospace",children:"null"},"null")})(),e!=null&&t.length>0&&(()=>{const h=a(t.length-1),m=a(e),v=h.x+C/2,y=h.y+N,$=m.x+C/2,f=m.y+N,b=Math.max(y,f)+46;return i.jsxs("g",{children:[i.jsx("path",{d:`M ${v} ${y} C ${v} ${b}, ${$} ${b}, ${$} ${f}`,fill:"none",stroke:"#f59e0b",strokeWidth:1.8,strokeDasharray:"5 4"}),i.jsx("polygon",{points:`${$},${f} ${$-4},${f+8} ${$+4},${f+8}`,fill:"#f59e0b"}),i.jsxs("text",{x:(v+$)/2,y:b+12,textAnchor:"middle",fontSize:"9",fill:"#fbbf24",fontFamily:"monospace",children:["cycle → index ",e]})]})})(),t.map((h,m)=>{const{x:v,y}=a(m),$=r.get(m),f=$?we[$]:je,b=n.get(m)??[];return i.jsxs("g",{children:[m===0&&i.jsx("text",{x:v+C/2,y:y-16,textAnchor:"middle",fontSize:"9",fill:"#818cf8",fontFamily:"monospace",children:"head"}),b.map((R,L)=>i.jsx("g",{children:i.jsxs("text",{x:v+C/2,y:y-6-L*11,textAnchor:"middle",fontSize:"9",fontWeight:"bold",fill:Le[R.color??"blue"],fontFamily:"monospace",children:[R.name,"↓"]})},R.name)),i.jsx("rect",{x:v,y,width:C,height:N,rx:8,fill:f.bg,stroke:f.border,strokeWidth:$?2.2:1.5}),i.jsx("text",{x:v+C/2,y:y+N/2+5,textAnchor:"middle",fontSize:"15",fontWeight:"bold",fill:f.text,fontFamily:"sans-serif",children:h.value}),i.jsxs("text",{x:v+C/2,y:y+N+12,textAnchor:"middle",fontSize:"8",fill:"#475569",fontFamily:"monospace",children:["[",m,"]"]})]},h.id)})]}),g.description&&i.jsx("div",{className:"w-full max-w-xl rounded-lg bg-slate-800/60 px-4 py-2 text-center text-xs leading-relaxed text-indigo-300",children:g.description}),g.meta&&g.meta.length>0&&i.jsx("div",{className:"flex flex-wrap justify-center gap-1.5",children:g.meta.map(h=>i.jsx("span",{className:"rounded-full bg-slate-800/80 px-2.5 py-0.5 text-[10px] font-mono text-slate-300 ring-1 ring-slate-700/50",children:h},h))})]})}function Se({step:g}){const t=g.lru,c=Array.from({length:t.capacity});return i.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-5 overflow-auto px-2",children:[i.jsxs("div",{className:"flex w-full max-w-2xl items-center justify-between text-[10px] uppercase tracking-wider text-slate-500",children:[i.jsx("span",{className:"text-emerald-400",children:"← Most recently used"}),i.jsx("span",{className:"text-rose-400",children:"Least recently used →"})]}),i.jsx("div",{className:"flex flex-wrap items-center justify-center gap-3",children:c.map((x,e)=>{const r=t.entries[e];if(!r)return i.jsx("div",{className:"flex h-20 w-24 flex-col items-center justify-center rounded-xl border-2 border-dashed border-slate-700 text-[10px] text-slate-600",children:"empty"},`empty-${e}`);const n=t.hitKey===r.key,d=t.evictKey===r.key?"border-rose-400 bg-rose-500/15":n?"border-emerald-400 bg-emerald-500/15":"border-slate-600 bg-slate-800/70";return i.jsxs("div",{className:`flex h-20 w-24 flex-col items-center justify-center rounded-xl border-2 ${d} transition-all`,children:[i.jsxs("span",{className:"text-[9px] font-mono uppercase tracking-wide text-slate-400",children:["key ",r.key]}),i.jsx("span",{className:"mt-0.5 text-xl font-bold text-white",children:r.value}),e===0&&i.jsx("span",{className:"mt-0.5 text-[8px] font-mono text-emerald-400",children:"MRU"}),e===t.entries.length-1&&t.entries.length===t.capacity&&e!==0&&i.jsx("span",{className:"mt-0.5 text-[8px] font-mono text-rose-400",children:"LRU"})]},r.key)})}),t.missKey!=null&&i.jsxs("div",{className:"rounded-lg bg-rose-500/10 px-3 py-1 text-xs font-mono text-rose-300 ring-1 ring-rose-500/30",children:["MISS · key ",t.missKey," not present"]}),g.description&&i.jsx("div",{className:"w-full max-w-xl rounded-lg bg-slate-800/60 px-4 py-2 text-center text-xs leading-relaxed text-indigo-300",children:g.description}),g.meta&&g.meta.length>0&&i.jsx("div",{className:"flex flex-wrap justify-center gap-1.5",children:g.meta.map(x=>i.jsx("span",{className:"rounded-full bg-slate-800/80 px-2.5 py-0.5 text-[10px] font-mono text-slate-300 ring-1 ring-slate-700/50",children:x},x))})]})}const P=(g,t)=>Math.floor(Math.random()*(t-g+1))+g;function T(g,t=1,c=99){return Array.from({length:g},()=>P(t,c))}function Re(g){switch(g){case"find-middle":return T(P(5,9)).join(",");case"palindrome":{const t=T(P(2,3));if(Math.random()<.6){const c=Math.random()<.5?[P(1,9)]:[];return[...t,...c,...[...t].reverse()].join(",")}return T(P(4,7)).join(",")}case"lru-cache":{const t=P(2,3),c=[1,2,3,4,5],x=[];for(let e=0;e{const w=Re(t);e(w),m(w)};return i.jsxs("aside",{className:"w-full space-y-4 xl:w-80 xl:shrink-0",children:[i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[i.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Input"}),i.jsx("label",{className:"text-[11px] text-slate-500",children:c.inputLabel}),i.jsx("textarea",{value:x,onChange:w=>e(w.target.value),rows:3,className:"mt-1 w-full resize-none rounded-xl bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50"}),i.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:c.helper}),i.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[i.jsx("button",{onClick:()=>m(),className:"rounded-xl bg-indigo-500/20 px-3 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/40 hover:bg-indigo-500/30",children:"Build Steps"}),i.jsxs("button",{onClick:L,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[i.jsx(ne,{size:13})," Random"]})]})]}),i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Playback"}),i.jsxs("span",{className:"font-mono text-xs text-indigo-300",children:[Math.min(n+1,r.length)," / ",r.length]})]}),i.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-slate-800",children:i.jsx("div",{className:"h-full rounded-full bg-indigo-400 transition-all",style:{width:`${d}%`}})}),i.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Animation Speed"}),i.jsxs("span",{className:"font-mono text-[10px] text-indigo-300",children:[(p/1e3).toFixed(2),"s"]})]}),i.jsx("input",{type:"range",min:120,max:3e3,step:20,value:3120-p,onChange:w=>o(3120-Number(w.target.value)),className:"w-full accent-indigo-400","aria-label":"Animation speed"}),i.jsxs("div",{className:"mt-1 flex justify-between text-[9px] uppercase tracking-wide text-slate-600",children:[i.jsx("span",{children:"Slow"}),i.jsx("span",{children:"Fast"})]})]}),i.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[i.jsxs("button",{onClick:$,disabled:!R,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:[i.jsx(se,{size:13})," Back"]}),i.jsx("button",{onClick:v,className:`inline-flex items-center justify-center gap-1 rounded-xl px-2 py-2 text-xs font-semibold ring-1 ${s?"bg-amber-500/15 text-amber-300 ring-amber-500/30":"bg-emerald-500/15 text-emerald-300 ring-emerald-500/30"}`,children:s?i.jsxs(i.Fragment,{children:[i.jsx(ie,{size:13})," Pause"]}):i.jsxs(i.Fragment,{children:[i.jsx(re,{size:13})," Play"]})}),i.jsxs("button",{onClick:y,disabled:!b,className:"inline-flex items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-2 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 disabled:opacity-30",children:["Next ",i.jsx(oe,{size:13})]})]}),i.jsxs("button",{onClick:f,className:"mt-2 inline-flex w-full items-center justify-center gap-1 rounded-xl bg-slate-800/70 px-3 py-2 text-xs text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:[i.jsx(le,{size:13})," Reset"]}),i.jsx("p",{className:"mt-3 min-h-10 text-xs leading-relaxed text-slate-300",children:l?.description})]}),i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[i.jsxs("button",{onClick:()=>h(!a),className:`inline-flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 ${a?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[a?i.jsx(ae,{size:14}):i.jsx(de,{size:14}),a?"Sound On":"Sound Off"]}),i.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:c.tags.map(w=>i.jsx("span",{className:"rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-300 ring-1 ring-violet-500/20",children:w},w))}),i.jsx("p",{className:"mt-2 text-[10px] font-mono text-slate-500",children:c.complexity})]})]})}function Ke({problem:g}){const t=be(g),{info:c}=t;return i.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[i.jsxs("main",{className:"order-last flex min-h-[520px] flex-1 flex-col gap-4 xl:order-first",children:[i.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-5 backdrop-blur-sm",children:[i.jsxs(Q,{to:"/algorithms/linked-list",className:"mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-slate-400 transition-colors hover:text-indigo-300",children:[i.jsx(ce,{size:13})," Linked List Algorithms"]}),i.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-indigo-300",children:"Linked List Algorithms"}),i.jsx("h2",{className:"mt-1 text-xl font-bold text-white",children:c.title}),i.jsx("p",{className:"mt-1 text-sm text-slate-400",children:c.subtitle})]}),i.jsx("section",{className:"flex flex-1 items-center justify-center rounded-2xl border border-slate-700/50 bg-slate-900/40 p-4 backdrop-blur-sm",children:i.jsx(ke,{step:t.currentStep})}),i.jsx(te,{pseudocode:c.pseudocode,activeLine:t.currentStep?.codeLine??null})]}),i.jsx(Ae,{hook:t,problem:g})]})}export{Ke as default}; diff --git a/docs/assets/LinkedListAlgorithmsPage-Bf0XShdT.js b/docs/assets/LinkedListAlgorithmsPage-rBTSWR3w.js similarity index 95% rename from docs/assets/LinkedListAlgorithmsPage-Bf0XShdT.js rename to docs/assets/LinkedListAlgorithmsPage-rBTSWR3w.js index a5809c6..ac2159b 100644 --- a/docs/assets/LinkedListAlgorithmsPage-Bf0XShdT.js +++ b/docs/assets/LinkedListAlgorithmsPage-rBTSWR3w.js @@ -1 +1 @@ -import{c as a,j as e,L as r,N as c,G as d,a as x,S as m,b as h,A as p}from"./index-lLadk08S.js";import{P as g}from"./linkedListAlgo-0_WYfSZm.js";import{A as f}from"./arrow-left-C4-GmPRq.js";import{R as u}from"./rotate-ccw-DMjSdzg2.js";const k=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],w=a("repeat",k);const y=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],b=a("scissors",y);const j=[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]],N=a("skip-back",j);const v=[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]],L=a("spline",v),C={"find-middle":{gradient:"from-sky-500 to-cyan-500",shadowColor:"shadow-sky-500/20",icon:h},"reverse-list":{gradient:"from-rose-500 to-pink-500",shadowColor:"shadow-rose-500/20",icon:u},"add-two-numbers":{gradient:"from-blue-500 to-indigo-500",shadowColor:"shadow-blue-500/20",icon:m},"reverse-k-group":{gradient:"from-purple-500 to-fuchsia-500",shadowColor:"shadow-purple-500/20",icon:N},palindrome:{gradient:"from-fuchsia-500 to-pink-500",shadowColor:"shadow-fuchsia-500/20",icon:L},"lru-cache":{gradient:"from-emerald-500 to-teal-500",shadowColor:"shadow-emerald-500/20",icon:x},segregate:{gradient:"from-lime-500 to-green-500",shadowColor:"shadow-lime-500/20",icon:b},"detect-cycle":{gradient:"from-amber-500 to-orange-500",shadowColor:"shadow-amber-500/20",icon:w},"sort-list":{gradient:"from-indigo-500 to-violet-500",shadowColor:"shadow-indigo-500/20",icon:d}},R=["find-middle","reverse-list","add-two-numbers","reverse-k-group","palindrome","lru-cache","segregate","detect-cycle","sort-list"];function z(){return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center justify-center px-6 pt-12 pb-8 text-center",children:[e.jsxs(r,{to:"/algorithms",className:"mb-4 inline-flex items-center gap-1.5 rounded-full bg-slate-800/60 px-3 py-1.5 text-xs font-medium text-slate-400 ring-1 ring-slate-700/50 transition-colors hover:text-indigo-300",children:[e.jsx(f,{size:13})," Back to Algorithms"]}),e.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-full bg-indigo-500/10 px-4 py-1.5 ring-1 ring-indigo-500/20",children:[e.jsx(c,{size:14,className:"text-indigo-400"}),e.jsx("span",{className:"text-xs font-medium text-indigo-300",children:"Linked List Algorithms"})]}),e.jsxs("h2",{className:"text-3xl font-extrabold tracking-tight text-white",children:["Linked ",e.jsx("span",{className:"bg-gradient-to-r from-indigo-400 to-fuchsia-400 bg-clip-text text-transparent",children:"List"})]}),e.jsx("p",{className:"mt-3 max-w-2xl mx-auto text-sm text-slate-400 leading-relaxed",children:"Two-pointer tricks, Floyd's cycle detection, merge sort, and an LRU cache — each with step playback, a speed slider, and audio feedback."})]}),e.jsx("section",{className:"px-6 pb-12",children:e.jsx("div",{className:"mx-auto grid max-w-6xl grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3",children:R.map(t=>{const s=g[t],{gradient:l,shadowColor:o,icon:n}=C[t];return e.jsxs(r,{to:`/algorithms/linked-list/${t}`,className:`group relative flex flex-col rounded-2xl border border-slate-700/40 bg-slate-900/50 p-6 shadow-lg backdrop-blur-sm transition-all duration-300 hover:scale-[1.01] hover:border-slate-600/60 hover:bg-slate-900/70 ${o}`,children:[e.jsx("div",{className:`mb-3 flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br ${l} shadow-lg ${o}`,children:e.jsx(n,{size:20,className:"text-white"})}),e.jsx("h4",{className:"text-base font-bold text-white",children:s.title}),e.jsx("p",{className:"text-[10px] text-slate-500 italic",children:s.subtitle}),e.jsx("p",{className:"mt-2 flex-1 text-xs leading-relaxed text-slate-400",children:s.helper}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:s.tags.map(i=>e.jsx("span",{className:"rounded-full bg-slate-800/60 px-2 py-0.5 text-[10px] font-medium text-slate-400",children:i},i))}),e.jsxs("div",{className:"mt-3 flex items-center gap-1 text-xs font-medium text-indigo-400 opacity-0 transition-opacity group-hover:opacity-100",children:["Explore ",e.jsx(p,{size:12})]})]},t)})})})]})}export{z as default}; +import{c as a,j as e,L as r,N as c,G as d,a as x,S as m,b as h,A as p}from"./index-CB1-0H6I.js";import{P as g}from"./linkedListAlgo-0_WYfSZm.js";import{A as f}from"./arrow-left-eH0A06ps.js";import{R as u}from"./rotate-ccw-CDlWXRsI.js";const k=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],w=a("repeat",k);const y=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],b=a("scissors",y);const j=[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]],N=a("skip-back",j);const v=[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]],L=a("spline",v),C={"find-middle":{gradient:"from-sky-500 to-cyan-500",shadowColor:"shadow-sky-500/20",icon:h},"reverse-list":{gradient:"from-rose-500 to-pink-500",shadowColor:"shadow-rose-500/20",icon:u},"add-two-numbers":{gradient:"from-blue-500 to-indigo-500",shadowColor:"shadow-blue-500/20",icon:m},"reverse-k-group":{gradient:"from-purple-500 to-fuchsia-500",shadowColor:"shadow-purple-500/20",icon:N},palindrome:{gradient:"from-fuchsia-500 to-pink-500",shadowColor:"shadow-fuchsia-500/20",icon:L},"lru-cache":{gradient:"from-emerald-500 to-teal-500",shadowColor:"shadow-emerald-500/20",icon:x},segregate:{gradient:"from-lime-500 to-green-500",shadowColor:"shadow-lime-500/20",icon:b},"detect-cycle":{gradient:"from-amber-500 to-orange-500",shadowColor:"shadow-amber-500/20",icon:w},"sort-list":{gradient:"from-indigo-500 to-violet-500",shadowColor:"shadow-indigo-500/20",icon:d}},R=["find-middle","reverse-list","add-two-numbers","reverse-k-group","palindrome","lru-cache","segregate","detect-cycle","sort-list"];function z(){return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("section",{className:"flex flex-col items-center justify-center px-6 pt-12 pb-8 text-center",children:[e.jsxs(r,{to:"/algorithms",className:"mb-4 inline-flex items-center gap-1.5 rounded-full bg-slate-800/60 px-3 py-1.5 text-xs font-medium text-slate-400 ring-1 ring-slate-700/50 transition-colors hover:text-indigo-300",children:[e.jsx(f,{size:13})," Back to Algorithms"]}),e.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-full bg-indigo-500/10 px-4 py-1.5 ring-1 ring-indigo-500/20",children:[e.jsx(c,{size:14,className:"text-indigo-400"}),e.jsx("span",{className:"text-xs font-medium text-indigo-300",children:"Linked List Algorithms"})]}),e.jsxs("h2",{className:"text-3xl font-extrabold tracking-tight text-white",children:["Linked ",e.jsx("span",{className:"bg-gradient-to-r from-indigo-400 to-fuchsia-400 bg-clip-text text-transparent",children:"List"})]}),e.jsx("p",{className:"mt-3 max-w-2xl mx-auto text-sm text-slate-400 leading-relaxed",children:"Two-pointer tricks, Floyd's cycle detection, merge sort, and an LRU cache — each with step playback, a speed slider, and audio feedback."})]}),e.jsx("section",{className:"px-6 pb-12",children:e.jsx("div",{className:"mx-auto grid max-w-6xl grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3",children:R.map(t=>{const s=g[t],{gradient:l,shadowColor:o,icon:n}=C[t];return e.jsxs(r,{to:`/algorithms/linked-list/${t}`,className:`group relative flex flex-col rounded-2xl border border-slate-700/40 bg-slate-900/50 p-6 shadow-lg backdrop-blur-sm transition-all duration-300 hover:scale-[1.01] hover:border-slate-600/60 hover:bg-slate-900/70 ${o}`,children:[e.jsx("div",{className:`mb-3 flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br ${l} shadow-lg ${o}`,children:e.jsx(n,{size:20,className:"text-white"})}),e.jsx("h4",{className:"text-base font-bold text-white",children:s.title}),e.jsx("p",{className:"text-[10px] text-slate-500 italic",children:s.subtitle}),e.jsx("p",{className:"mt-2 flex-1 text-xs leading-relaxed text-slate-400",children:s.helper}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:s.tags.map(i=>e.jsx("span",{className:"rounded-full bg-slate-800/60 px-2 py-0.5 text-[10px] font-medium text-slate-400",children:i},i))}),e.jsxs("div",{className:"mt-3 flex items-center gap-1 text-xs font-medium text-indigo-400 opacity-0 transition-opacity group-hover:opacity-100",children:["Explore ",e.jsx(p,{size:12})]})]},t)})})})]})}export{z as default}; diff --git a/docs/assets/LinkedListPage-CUYUVQCV.js b/docs/assets/LinkedListPage-CsPqMWtn.js similarity index 97% rename from docs/assets/LinkedListPage-CUYUVQCV.js rename to docs/assets/LinkedListPage-CsPqMWtn.js index aa09cca..d6b443f 100644 --- a/docs/assets/LinkedListPage-CUYUVQCV.js +++ b/docs/assets/LinkedListPage-CsPqMWtn.js @@ -1 +1 @@ -import{r as a,j as e,e as de}from"./index-lLadk08S.js";import{u as ce}from"./useDSSound-CPhif-bj.js";import{P as K}from"./plus-NICMDkhr.js";import{T as xe}from"./trash-2-veeiSg5V.js";import{R as ue}from"./rotate-ccw-DMjSdzg2.js";import{S as he}from"./shuffle-ADbBlETg.js";import{V as ge,a as pe}from"./volume-x-CjLNPeax.js";import{C as me,a as fe}from"./chevron-right-Cp_zyb7b.js";import"./audioContext-NbgqvQGz.js";let U=1;const be=[3,7,1,9].map(p=>({id:U++,value:p}));function je(){const[p,m]=a.useState(be),[c,H]=a.useState("singly"),[h,y]=a.useState([]),[x,r]=a.useState(-1),[S,M]=a.useState(""),[V,X]=a.useState(""),[G,P]=a.useState([]),[j,A]=a.useState(400),[n,C]=a.useState(!1),$=a.useRef(null),R=a.useRef(j),v=a.useRef(!1),{soundEnabled:o,toggleSound:F,playInsert:N,playDelete:I,playTraverse:k,playFound:T,playNotFound:D}=ce(),B=a.useRef(N),Y=a.useRef(I),q=a.useRef(k);a.useEffect(()=>{B.current=N},[N]),a.useEffect(()=>{Y.current=I},[I]),a.useEffect(()=>{q.current=k},[k]),a.useEffect(()=>{R.current=j},[j]),a.useEffect(()=>{if(!v.current||h.length===0)return;v.current=!1,$.current&&clearTimeout($.current),C(!0);let t=0;const s=()=>{if(t>=h.length-1){C(!1);return}t++,r(t);const i=h[t];i&&(i.highlightColor==="green"?B.current():i.highlightColor==="red"?Y.current():i.highlightColor==="yellow"&&q.current(t,h.length)),$.current=setTimeout(s,R.current)};$.current=setTimeout(s,R.current)},[h]);const J=x>=0&&h[x]?h[x].nodes:p,l=x>=0?h[x]:null,E=c==="singly"?"singly linked list":c==="doubly"?"doubly linked list":"circular linked list",O=t=>P(s=>[t,...s].slice(0,20)),Q=a.useCallback(t=>{H(t),y([]),r(-1),C(!1),P(s=>[`Switch to ${t}`,...s].slice(0,20))},[]),w=(t,s,i=[],d=null,u=null)=>({description:t,nodes:s,highlightIds:new Set(i),highlightColor:d,newNodeId:u}),Z=a.useCallback(t=>{const s={id:U++,value:t};m(i=>{const d=[s,...i],u=[w(`Prepend ${t}: creating new node at head in the ${E}...`,i,[],null,s.id),w(`${t} inserted at position 0. Updating ${c==="doubly"?"prev/next pointers":c==="circular"?"tail.next back to head":"head pointer"}.`,d,[s.id],"green",s.id)];return y(u),r(0),v.current=!0,N(),O(`Prepend ${t}`),d})},[N,c,E]),ee=a.useCallback(t=>{const s={id:U++,value:t};m(i=>{const d=[...i,s],u=[];for(let f=0;f{const i={id:U++,value:t};m(d=>{if(s<0||s>d.length)return d;const u=[...d.slice(0,s),i,...d.slice(s)],f=[];for(let W=0;W{m(s=>{if(t<0||t>=s.length)return s;const i=s[t],d=[];for(let f=0;f<=t;f++)d.push(w(`Traversing to index ${t}: at node ${s[f].value}...`,s,[s[f].id],"yellow"));d.push(w(`Deleting node ${i.value} at index ${t}: re-linking ${c==="doubly"?"prev and next pointers":c==="circular"?"cycle pointers":"next pointer"}.`,s,[i.id],"red"));const u=s.filter((f,W)=>W!==t);return d.push(w(`Node ${i.value} removed. List size: ${u.length}`,u,[],null)),y(d),r(0),v.current=!0,I(),O(`Delete [${t}] → ${i.value}`),u})},[I,c]),le=a.useCallback(t=>{m(s=>{const i=[];let d=-1;for(let u=0;u{m([]),y([]),r(-1),O("Clear list")},[]),ae=a.useCallback(()=>{const t=Math.floor(Math.random()*4)+4,s=Array.from({length:t},()=>({id:U++,value:Math.floor(Math.random()*90)+1}));m(s),y([]),r(-1),O("Random list")},[]),ie=a.useCallback(()=>{r(t=>Math.min(t+1,h.length-1))},[h.length]),re=a.useCallback(()=>{r(t=>Math.max(t-1,0))},[]),oe=a.useCallback(()=>{if(n){C(!1),$.current&&clearTimeout($.current);return}if(x>=h.length-1)return;C(!0);let t=x;const s=()=>{if(t>=h.length-1){C(!1);return}t++,r(t),$.current=setTimeout(s,j)};$.current=setTimeout(s,j)},[n,x,h.length,j]);return{nodes:p,variant:c,changeVariant:Q,displayNodes:J,steps:h,stepIndex:x,currentStep:l,inputValue:S,setInputValue:M,indexValue:V,setIndexValue:X,history:G,speed:j,setSpeed:A,isPlaying:n,prepend:Z,append:ee,insertAt:te,deleteAt:se,search:le,clear:ne,generateRandom:ae,nextStep:ie,prevStep:re,autoPlay:oe,canGoNext:x0,soundEnabled:o,toggleSound:F}}const ye={green:{border:"#34d399",bg:"rgba(52,211,153,0.15)",text:"#6ee7b7"},red:{border:"#f87171",bg:"rgba(248,113,113,0.15)",text:"#fca5a5"},yellow:{border:"#fbbf24",bg:"rgba(251,191,36,0.15)",text:"#fde68a"},blue:{border:"#60a5fa",bg:"rgba(96,165,250,0.15)",text:"#93c5fd"}},Ne={border:"#475569",bg:"rgba(30,41,59,0.7)",text:"#cbd5e1"},b=64,g=48,L=36,z=b+L,_=5;function ve({nodes:p,currentStep:m,variant:c}){const H=m?.highlightIds??new Set,h=m?.highlightColor??null,y=[];for(let j=0;j{const n=A*r+20,C=A===y.length-1,$=A*_;return e.jsx("g",{children:j.map((R,v)=>{const o=v*z+L/2,F=H.has(R.id),N=F&&h?ye[h]:Ne,I=$+v,k=I===0,T=I===p.length-1,D=v===j.length-1;return e.jsxs("g",{children:[k&&e.jsx("text",{x:o+b/2,y:n-8,textAnchor:"middle",fontSize:"10",fill:"#818cf8",fontFamily:"monospace",children:"head"}),e.jsx("rect",{x:o,y:n,width:b,height:g,rx:8,fill:N.bg,stroke:N.border,strokeWidth:F?2:1.5}),e.jsx("text",{x:o+b*.38,y:n+g/2+5,textAnchor:"middle",fontSize:"15",fontWeight:"bold",fill:N.text,fontFamily:"sans-serif",children:R.value}),e.jsx("line",{x1:o+b*.62,y1:n+4,x2:o+b*.62,y2:n+g-4,stroke:N.border,strokeWidth:1,opacity:.5}),e.jsx("text",{x:o+b*.82,y:n+g/2+4,textAnchor:"middle",fontSize:"9",fill:"#64748b",fontFamily:"monospace",children:T?c==="circular"?"↺":"null":"→"}),c==="doubly"&&e.jsx("text",{x:o+b*.2,y:n+g-7,textAnchor:"middle",fontSize:"8",fill:"#93c5fd",fontFamily:"monospace",children:k?"null":"←"}),!T&&!D&&e.jsxs("g",{children:[e.jsx("line",{x1:o+b,y1:n+g/2,x2:o+z,y2:n+g/2,stroke:"#475569",strokeWidth:1.5}),e.jsx("polygon",{points:`${o+z},${n+g/2} ${o+z-6},${n+g/2-4} ${o+z-6},${n+g/2+4}`,fill:"#475569"})]}),c==="doubly"&&!T&&!D&&e.jsxs("g",{opacity:.75,children:[e.jsx("line",{x1:o+z,y1:n+g/2+12,x2:o+b,y2:n+g/2+12,stroke:"#60a5fa",strokeWidth:1.2}),e.jsx("polygon",{points:`${o+b},${n+g/2+12} ${o+b+6},${n+g/2+8} ${o+b+6},${n+g/2+16}`,fill:"#60a5fa"})]}),D&&!C&&e.jsxs("g",{children:[e.jsx("path",{d:`M ${o+b} ${n+g/2} L ${o+b+14} ${n+g/2} L ${o+b+14} ${n+g+20} L ${L/2} ${n+g+20} L ${L/2} ${n+r}`,fill:"none",stroke:"#475569",strokeWidth:1.5}),e.jsx("polygon",{points:`${L/2},${n+r} ${L/2-4},${n+r-6} ${L/2+4},${n+r-6}`,fill:"#475569"})]})]},R.id)})},A)}),c==="circular"&&y.length>0&&p.length>1&&e.jsxs("g",{children:[e.jsx("path",{d:`M ${G+b} ${P+g/2} C ${x+40} ${S+16}, -20 ${S+16}, ${L/2+b/2} 78`,fill:"none",stroke:"#f59e0b",strokeDasharray:"5 5",strokeWidth:1.5}),e.jsx("text",{x:x/2,y:S-4,textAnchor:"middle",fontSize:"10",fill:"#fbbf24",fontFamily:"monospace",children:"tail.next → head"})]})]}),m?.description&&e.jsx("div",{className:"w-full max-w-sm rounded-lg bg-slate-800/60 px-4 py-2 text-center text-xs text-indigo-300 leading-relaxed",children:m.description}),e.jsxs("div",{className:"text-xs text-slate-500 font-mono",children:[c," list · length = ",p.length]})]})}const $e=[{label:"Slow",value:700},{label:"Med",value:350},{label:"Fast",value:120}];function ke({hook:p}){const{nodes:m,variant:c,changeVariant:H,steps:h,stepIndex:y,inputValue:x,setInputValue:r,indexValue:S,setIndexValue:M,history:V,speed:X,setSpeed:G,isPlaying:P,prepend:j,append:A,insertAt:n,deleteAt:C,search:$,clear:R,generateRandom:v,nextStep:o,prevStep:F,canGoNext:N,canGoPrev:I,soundEnabled:k,toggleSound:T}=p,D=()=>{const l=parseInt(x);isNaN(l)||(j(l),r(""))},B=()=>{const l=parseInt(x);isNaN(l)||(A(l),r(""))},Y=()=>{const l=parseInt(x),E=parseInt(S);!isNaN(l)&&!isNaN(E)&&(n(l,E),r(""))},q=()=>{const l=parseInt(S);isNaN(l)||C(l)},J=()=>{const l=parseInt(x);isNaN(l)||$(l)};return e.jsxs("div",{className:"flex flex-col gap-4 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-sm font-bold text-indigo-300 mb-1",children:"Linked List"}),e.jsxs("p",{className:"text-xs text-slate-400 leading-relaxed",children:["A chain of ",e.jsx("strong",{className:"text-slate-300",children:"nodes"}),". Switch between singly, doubly, and circular pointer layouts while keeping the same operations."]}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:["Prepend O(1)","Append O(n)","Insert O(n)","Delete O(n)","Search O(n)"].map(l=>e.jsx("span",{className:"rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-400 ring-1 ring-violet-500/20",children:l},l))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"List Type"}),e.jsx("div",{className:"grid grid-cols-3 gap-1",children:["singly","doubly","circular"].map(l=>e.jsx("button",{onClick:()=>H(l),className:`rounded-lg px-2 py-2 text-[10px] font-semibold capitalize transition-all ${c===l?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40":"bg-slate-800/60 text-slate-400 hover:bg-slate-700/60"}`,children:l},l))}),e.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:"Doubly lists show backward pointers; circular lists connect the tail back to the head."})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Operations"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Value"}),e.jsx("input",{type:"number",value:x,onChange:l=>r(l.target.value),placeholder:"e.g. 42",className:"w-full rounded-lg bg-slate-800/60 px-3 py-2 text-sm text-slate-200 placeholder-slate-600 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50 transition-all"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Index"}),e.jsx("input",{type:"number",value:S,onChange:l=>M(l.target.value),placeholder:"e.g. 0",min:"0",className:"w-full rounded-lg bg-slate-800/60 px-3 py-2 text-sm text-slate-200 placeholder-slate-600 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50 transition-all"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{onClick:D,disabled:m.length>=12,className:"flex items-center justify-center gap-1.5 rounded-lg bg-gradient-to-r from-emerald-500/80 to-green-500/80 px-3 py-2 text-xs font-semibold text-white shadow-lg shadow-emerald-500/15 transition-all hover:brightness-110 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(K,{size:13})," Prepend"]}),e.jsxs("button",{onClick:B,disabled:m.length>=12,className:"flex items-center justify-center gap-1.5 rounded-lg bg-indigo-500/20 px-3 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/30 transition-all hover:bg-indigo-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(K,{size:13})," Append"]}),e.jsxs("button",{onClick:Y,disabled:m.length>=12,className:"flex items-center justify-center gap-1.5 rounded-lg bg-violet-500/20 px-3 py-2 text-xs font-semibold text-violet-300 ring-1 ring-violet-500/30 transition-all hover:bg-violet-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(K,{size:13})," Insert at"]}),e.jsxs("button",{onClick:q,disabled:m.length===0,className:"flex items-center justify-center gap-1.5 rounded-lg bg-gradient-to-r from-rose-500/80 to-pink-500/80 px-3 py-2 text-xs font-semibold text-white shadow-lg shadow-rose-500/15 transition-all hover:brightness-110 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(xe,{size:13})," Delete at"]}),e.jsxs("button",{onClick:J,disabled:m.length===0,className:"flex items-center justify-center gap-1.5 rounded-lg bg-amber-500/20 px-3 py-2 text-xs font-semibold text-amber-300 ring-1 ring-amber-500/30 transition-all hover:bg-amber-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(de,{size:13})," Search"]}),e.jsxs("button",{onClick:R,disabled:m.length===0,className:"flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-400 transition-all hover:bg-slate-700/60 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(ue,{size:13})," Clear"]})]}),e.jsxs("button",{onClick:v,className:"mt-2 w-full flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300",children:[e.jsx(he,{size:12})," Random List"]}),e.jsxs("button",{onClick:()=>T(!k),className:`mt-2 w-full flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium transition-all ${k?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/60 text-slate-400 hover:bg-slate-700/60"}`,children:[k?e.jsx(ge,{size:12}):e.jsx(pe,{size:12}),k?"Sound On":"Sound Off"]})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Animation Speed"}),e.jsx("div",{className:"flex gap-1",children:$e.map(l=>e.jsx("button",{onClick:()=>G(l.value),className:`flex-1 rounded-lg px-2 py-1.5 text-xs font-medium transition-all duration-200 ${X===l.value?"bg-violet-500/20 text-violet-300 ring-1 ring-violet-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50 hover:text-slate-300"}`,children:l.label},l.value))})]}),h.length>0&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Step Through"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:F,disabled:!I||P,className:"flex-1 flex items-center justify-center gap-1 rounded-lg bg-slate-800/60 px-3 py-2.5 text-sm font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:[e.jsx(me,{size:16})," Prev"]}),e.jsxs("button",{onClick:o,disabled:!N||P,className:"flex-1 flex items-center justify-center gap-1 rounded-lg bg-slate-800/60 px-3 py-2.5 text-sm font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:["Next ",e.jsx(fe,{size:16})]})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Step"}),e.jsxs("span",{className:"text-sm font-mono font-semibold text-indigo-400",children:[Math.max(0,y+1)," / ",h.length]})]})]}),V.length>0&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"History"}),e.jsx("div",{className:"max-h-36 overflow-y-auto space-y-1",children:V.map((l,E)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"font-mono text-slate-600 w-4 text-right",children:E+1}),e.jsx("span",{className:l.startsWith("Prepend")||l.startsWith("Append")||l.startsWith("Insert")?"text-emerald-400":l.startsWith("Delete")?"text-rose-400":l.startsWith("Search")?"text-amber-400":"text-slate-400",children:l})]},E))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Legend"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-5 rounded-sm bg-emerald-500"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Insert / found"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-5 rounded-sm bg-rose-500"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Delete"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-5 rounded-sm bg-amber-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Traversal / search"})]})]})]})]})}function Ee(){const p=je();return e.jsxs("div",{className:"flex flex-1 flex-col md:flex-row gap-4 md:gap-6 overflow-auto p-4 md:p-6",children:[e.jsx("div",{className:"order-last md:order-first flex md:flex-1 flex-col items-center justify-center gap-3 min-h-[40vh] md:min-h-0 max-h-[55vh] md:max-h-none overflow-auto",children:e.jsx(ve,{nodes:p.displayNodes,currentStep:p.currentStep,variant:p.variant})}),e.jsx(ke,{hook:p})]})}export{Ee as default}; +import{r as a,j as e,e as de}from"./index-CB1-0H6I.js";import{u as ce}from"./useDSSound-BJYLYD0f.js";import{P as K}from"./plus-B3nnW8Th.js";import{T as xe}from"./trash-2-C4vvSjjZ.js";import{R as ue}from"./rotate-ccw-CDlWXRsI.js";import{S as he}from"./shuffle-DZnyoAGL.js";import{V as ge,a as pe}from"./volume-x-CKT6TOtL.js";import{C as me,a as fe}from"./chevron-right-ChVmoNtO.js";import"./audioContext-NbgqvQGz.js";let U=1;const be=[3,7,1,9].map(p=>({id:U++,value:p}));function je(){const[p,m]=a.useState(be),[c,H]=a.useState("singly"),[h,y]=a.useState([]),[x,r]=a.useState(-1),[S,M]=a.useState(""),[V,X]=a.useState(""),[G,P]=a.useState([]),[j,A]=a.useState(400),[n,C]=a.useState(!1),$=a.useRef(null),R=a.useRef(j),v=a.useRef(!1),{soundEnabled:o,toggleSound:F,playInsert:N,playDelete:I,playTraverse:k,playFound:T,playNotFound:D}=ce(),B=a.useRef(N),Y=a.useRef(I),q=a.useRef(k);a.useEffect(()=>{B.current=N},[N]),a.useEffect(()=>{Y.current=I},[I]),a.useEffect(()=>{q.current=k},[k]),a.useEffect(()=>{R.current=j},[j]),a.useEffect(()=>{if(!v.current||h.length===0)return;v.current=!1,$.current&&clearTimeout($.current),C(!0);let t=0;const s=()=>{if(t>=h.length-1){C(!1);return}t++,r(t);const i=h[t];i&&(i.highlightColor==="green"?B.current():i.highlightColor==="red"?Y.current():i.highlightColor==="yellow"&&q.current(t,h.length)),$.current=setTimeout(s,R.current)};$.current=setTimeout(s,R.current)},[h]);const J=x>=0&&h[x]?h[x].nodes:p,l=x>=0?h[x]:null,E=c==="singly"?"singly linked list":c==="doubly"?"doubly linked list":"circular linked list",O=t=>P(s=>[t,...s].slice(0,20)),Q=a.useCallback(t=>{H(t),y([]),r(-1),C(!1),P(s=>[`Switch to ${t}`,...s].slice(0,20))},[]),w=(t,s,i=[],d=null,u=null)=>({description:t,nodes:s,highlightIds:new Set(i),highlightColor:d,newNodeId:u}),Z=a.useCallback(t=>{const s={id:U++,value:t};m(i=>{const d=[s,...i],u=[w(`Prepend ${t}: creating new node at head in the ${E}...`,i,[],null,s.id),w(`${t} inserted at position 0. Updating ${c==="doubly"?"prev/next pointers":c==="circular"?"tail.next back to head":"head pointer"}.`,d,[s.id],"green",s.id)];return y(u),r(0),v.current=!0,N(),O(`Prepend ${t}`),d})},[N,c,E]),ee=a.useCallback(t=>{const s={id:U++,value:t};m(i=>{const d=[...i,s],u=[];for(let f=0;f{const i={id:U++,value:t};m(d=>{if(s<0||s>d.length)return d;const u=[...d.slice(0,s),i,...d.slice(s)],f=[];for(let W=0;W{m(s=>{if(t<0||t>=s.length)return s;const i=s[t],d=[];for(let f=0;f<=t;f++)d.push(w(`Traversing to index ${t}: at node ${s[f].value}...`,s,[s[f].id],"yellow"));d.push(w(`Deleting node ${i.value} at index ${t}: re-linking ${c==="doubly"?"prev and next pointers":c==="circular"?"cycle pointers":"next pointer"}.`,s,[i.id],"red"));const u=s.filter((f,W)=>W!==t);return d.push(w(`Node ${i.value} removed. List size: ${u.length}`,u,[],null)),y(d),r(0),v.current=!0,I(),O(`Delete [${t}] → ${i.value}`),u})},[I,c]),le=a.useCallback(t=>{m(s=>{const i=[];let d=-1;for(let u=0;u{m([]),y([]),r(-1),O("Clear list")},[]),ae=a.useCallback(()=>{const t=Math.floor(Math.random()*4)+4,s=Array.from({length:t},()=>({id:U++,value:Math.floor(Math.random()*90)+1}));m(s),y([]),r(-1),O("Random list")},[]),ie=a.useCallback(()=>{r(t=>Math.min(t+1,h.length-1))},[h.length]),re=a.useCallback(()=>{r(t=>Math.max(t-1,0))},[]),oe=a.useCallback(()=>{if(n){C(!1),$.current&&clearTimeout($.current);return}if(x>=h.length-1)return;C(!0);let t=x;const s=()=>{if(t>=h.length-1){C(!1);return}t++,r(t),$.current=setTimeout(s,j)};$.current=setTimeout(s,j)},[n,x,h.length,j]);return{nodes:p,variant:c,changeVariant:Q,displayNodes:J,steps:h,stepIndex:x,currentStep:l,inputValue:S,setInputValue:M,indexValue:V,setIndexValue:X,history:G,speed:j,setSpeed:A,isPlaying:n,prepend:Z,append:ee,insertAt:te,deleteAt:se,search:le,clear:ne,generateRandom:ae,nextStep:ie,prevStep:re,autoPlay:oe,canGoNext:x0,soundEnabled:o,toggleSound:F}}const ye={green:{border:"#34d399",bg:"rgba(52,211,153,0.15)",text:"#6ee7b7"},red:{border:"#f87171",bg:"rgba(248,113,113,0.15)",text:"#fca5a5"},yellow:{border:"#fbbf24",bg:"rgba(251,191,36,0.15)",text:"#fde68a"},blue:{border:"#60a5fa",bg:"rgba(96,165,250,0.15)",text:"#93c5fd"}},Ne={border:"#475569",bg:"rgba(30,41,59,0.7)",text:"#cbd5e1"},b=64,g=48,L=36,z=b+L,_=5;function ve({nodes:p,currentStep:m,variant:c}){const H=m?.highlightIds??new Set,h=m?.highlightColor??null,y=[];for(let j=0;j{const n=A*r+20,C=A===y.length-1,$=A*_;return e.jsx("g",{children:j.map((R,v)=>{const o=v*z+L/2,F=H.has(R.id),N=F&&h?ye[h]:Ne,I=$+v,k=I===0,T=I===p.length-1,D=v===j.length-1;return e.jsxs("g",{children:[k&&e.jsx("text",{x:o+b/2,y:n-8,textAnchor:"middle",fontSize:"10",fill:"#818cf8",fontFamily:"monospace",children:"head"}),e.jsx("rect",{x:o,y:n,width:b,height:g,rx:8,fill:N.bg,stroke:N.border,strokeWidth:F?2:1.5}),e.jsx("text",{x:o+b*.38,y:n+g/2+5,textAnchor:"middle",fontSize:"15",fontWeight:"bold",fill:N.text,fontFamily:"sans-serif",children:R.value}),e.jsx("line",{x1:o+b*.62,y1:n+4,x2:o+b*.62,y2:n+g-4,stroke:N.border,strokeWidth:1,opacity:.5}),e.jsx("text",{x:o+b*.82,y:n+g/2+4,textAnchor:"middle",fontSize:"9",fill:"#64748b",fontFamily:"monospace",children:T?c==="circular"?"↺":"null":"→"}),c==="doubly"&&e.jsx("text",{x:o+b*.2,y:n+g-7,textAnchor:"middle",fontSize:"8",fill:"#93c5fd",fontFamily:"monospace",children:k?"null":"←"}),!T&&!D&&e.jsxs("g",{children:[e.jsx("line",{x1:o+b,y1:n+g/2,x2:o+z,y2:n+g/2,stroke:"#475569",strokeWidth:1.5}),e.jsx("polygon",{points:`${o+z},${n+g/2} ${o+z-6},${n+g/2-4} ${o+z-6},${n+g/2+4}`,fill:"#475569"})]}),c==="doubly"&&!T&&!D&&e.jsxs("g",{opacity:.75,children:[e.jsx("line",{x1:o+z,y1:n+g/2+12,x2:o+b,y2:n+g/2+12,stroke:"#60a5fa",strokeWidth:1.2}),e.jsx("polygon",{points:`${o+b},${n+g/2+12} ${o+b+6},${n+g/2+8} ${o+b+6},${n+g/2+16}`,fill:"#60a5fa"})]}),D&&!C&&e.jsxs("g",{children:[e.jsx("path",{d:`M ${o+b} ${n+g/2} L ${o+b+14} ${n+g/2} L ${o+b+14} ${n+g+20} L ${L/2} ${n+g+20} L ${L/2} ${n+r}`,fill:"none",stroke:"#475569",strokeWidth:1.5}),e.jsx("polygon",{points:`${L/2},${n+r} ${L/2-4},${n+r-6} ${L/2+4},${n+r-6}`,fill:"#475569"})]})]},R.id)})},A)}),c==="circular"&&y.length>0&&p.length>1&&e.jsxs("g",{children:[e.jsx("path",{d:`M ${G+b} ${P+g/2} C ${x+40} ${S+16}, -20 ${S+16}, ${L/2+b/2} 78`,fill:"none",stroke:"#f59e0b",strokeDasharray:"5 5",strokeWidth:1.5}),e.jsx("text",{x:x/2,y:S-4,textAnchor:"middle",fontSize:"10",fill:"#fbbf24",fontFamily:"monospace",children:"tail.next → head"})]})]}),m?.description&&e.jsx("div",{className:"w-full max-w-sm rounded-lg bg-slate-800/60 px-4 py-2 text-center text-xs text-indigo-300 leading-relaxed",children:m.description}),e.jsxs("div",{className:"text-xs text-slate-500 font-mono",children:[c," list · length = ",p.length]})]})}const $e=[{label:"Slow",value:700},{label:"Med",value:350},{label:"Fast",value:120}];function ke({hook:p}){const{nodes:m,variant:c,changeVariant:H,steps:h,stepIndex:y,inputValue:x,setInputValue:r,indexValue:S,setIndexValue:M,history:V,speed:X,setSpeed:G,isPlaying:P,prepend:j,append:A,insertAt:n,deleteAt:C,search:$,clear:R,generateRandom:v,nextStep:o,prevStep:F,canGoNext:N,canGoPrev:I,soundEnabled:k,toggleSound:T}=p,D=()=>{const l=parseInt(x);isNaN(l)||(j(l),r(""))},B=()=>{const l=parseInt(x);isNaN(l)||(A(l),r(""))},Y=()=>{const l=parseInt(x),E=parseInt(S);!isNaN(l)&&!isNaN(E)&&(n(l,E),r(""))},q=()=>{const l=parseInt(S);isNaN(l)||C(l)},J=()=>{const l=parseInt(x);isNaN(l)||$(l)};return e.jsxs("div",{className:"flex flex-col gap-4 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-sm font-bold text-indigo-300 mb-1",children:"Linked List"}),e.jsxs("p",{className:"text-xs text-slate-400 leading-relaxed",children:["A chain of ",e.jsx("strong",{className:"text-slate-300",children:"nodes"}),". Switch between singly, doubly, and circular pointer layouts while keeping the same operations."]}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:["Prepend O(1)","Append O(n)","Insert O(n)","Delete O(n)","Search O(n)"].map(l=>e.jsx("span",{className:"rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-400 ring-1 ring-violet-500/20",children:l},l))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"List Type"}),e.jsx("div",{className:"grid grid-cols-3 gap-1",children:["singly","doubly","circular"].map(l=>e.jsx("button",{onClick:()=>H(l),className:`rounded-lg px-2 py-2 text-[10px] font-semibold capitalize transition-all ${c===l?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40":"bg-slate-800/60 text-slate-400 hover:bg-slate-700/60"}`,children:l},l))}),e.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:"Doubly lists show backward pointers; circular lists connect the tail back to the head."})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Operations"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Value"}),e.jsx("input",{type:"number",value:x,onChange:l=>r(l.target.value),placeholder:"e.g. 42",className:"w-full rounded-lg bg-slate-800/60 px-3 py-2 text-sm text-slate-200 placeholder-slate-600 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50 transition-all"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Index"}),e.jsx("input",{type:"number",value:S,onChange:l=>M(l.target.value),placeholder:"e.g. 0",min:"0",className:"w-full rounded-lg bg-slate-800/60 px-3 py-2 text-sm text-slate-200 placeholder-slate-600 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50 transition-all"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{onClick:D,disabled:m.length>=12,className:"flex items-center justify-center gap-1.5 rounded-lg bg-gradient-to-r from-emerald-500/80 to-green-500/80 px-3 py-2 text-xs font-semibold text-white shadow-lg shadow-emerald-500/15 transition-all hover:brightness-110 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(K,{size:13})," Prepend"]}),e.jsxs("button",{onClick:B,disabled:m.length>=12,className:"flex items-center justify-center gap-1.5 rounded-lg bg-indigo-500/20 px-3 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/30 transition-all hover:bg-indigo-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(K,{size:13})," Append"]}),e.jsxs("button",{onClick:Y,disabled:m.length>=12,className:"flex items-center justify-center gap-1.5 rounded-lg bg-violet-500/20 px-3 py-2 text-xs font-semibold text-violet-300 ring-1 ring-violet-500/30 transition-all hover:bg-violet-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(K,{size:13})," Insert at"]}),e.jsxs("button",{onClick:q,disabled:m.length===0,className:"flex items-center justify-center gap-1.5 rounded-lg bg-gradient-to-r from-rose-500/80 to-pink-500/80 px-3 py-2 text-xs font-semibold text-white shadow-lg shadow-rose-500/15 transition-all hover:brightness-110 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(xe,{size:13})," Delete at"]}),e.jsxs("button",{onClick:J,disabled:m.length===0,className:"flex items-center justify-center gap-1.5 rounded-lg bg-amber-500/20 px-3 py-2 text-xs font-semibold text-amber-300 ring-1 ring-amber-500/30 transition-all hover:bg-amber-500/30 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(de,{size:13})," Search"]}),e.jsxs("button",{onClick:R,disabled:m.length===0,className:"flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-400 transition-all hover:bg-slate-700/60 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(ue,{size:13})," Clear"]})]}),e.jsxs("button",{onClick:v,className:"mt-2 w-full flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300",children:[e.jsx(he,{size:12})," Random List"]}),e.jsxs("button",{onClick:()=>T(!k),className:`mt-2 w-full flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-xs font-medium transition-all ${k?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30":"bg-slate-800/60 text-slate-400 hover:bg-slate-700/60"}`,children:[k?e.jsx(ge,{size:12}):e.jsx(pe,{size:12}),k?"Sound On":"Sound Off"]})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Animation Speed"}),e.jsx("div",{className:"flex gap-1",children:$e.map(l=>e.jsx("button",{onClick:()=>G(l.value),className:`flex-1 rounded-lg px-2 py-1.5 text-xs font-medium transition-all duration-200 ${X===l.value?"bg-violet-500/20 text-violet-300 ring-1 ring-violet-500/40":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50 hover:text-slate-300"}`,children:l.label},l.value))})]}),h.length>0&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Step Through"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:F,disabled:!I||P,className:"flex-1 flex items-center justify-center gap-1 rounded-lg bg-slate-800/60 px-3 py-2.5 text-sm font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:[e.jsx(me,{size:16})," Prev"]}),e.jsxs("button",{onClick:o,disabled:!N||P,className:"flex-1 flex items-center justify-center gap-1 rounded-lg bg-slate-800/60 px-3 py-2.5 text-sm font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:["Next ",e.jsx(fe,{size:16})]})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Step"}),e.jsxs("span",{className:"text-sm font-mono font-semibold text-indigo-400",children:[Math.max(0,y+1)," / ",h.length]})]})]}),V.length>0&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"History"}),e.jsx("div",{className:"max-h-36 overflow-y-auto space-y-1",children:V.map((l,E)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"font-mono text-slate-600 w-4 text-right",children:E+1}),e.jsx("span",{className:l.startsWith("Prepend")||l.startsWith("Append")||l.startsWith("Insert")?"text-emerald-400":l.startsWith("Delete")?"text-rose-400":l.startsWith("Search")?"text-amber-400":"text-slate-400",children:l})]},E))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Legend"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-5 rounded-sm bg-emerald-500"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Insert / found"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-5 rounded-sm bg-rose-500"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Delete"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-5 rounded-sm bg-amber-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Traversal / search"})]})]})]})]})}function Ee(){const p=je();return e.jsxs("div",{className:"flex flex-1 flex-col md:flex-row gap-4 md:gap-6 overflow-auto p-4 md:p-6",children:[e.jsx("div",{className:"order-last md:order-first flex md:flex-1 flex-col items-center justify-center gap-3 min-h-[40vh] md:min-h-0 max-h-[55vh] md:max-h-none overflow-auto",children:e.jsx(ve,{nodes:p.displayNodes,currentStep:p.currentStep,variant:p.variant})}),e.jsx(ke,{hook:p})]})}export{Ee as default}; diff --git a/docs/assets/MahjongGamePage-CweJKrxc.js b/docs/assets/MahjongGamePage-Bdpv27zp.js similarity index 99% rename from docs/assets/MahjongGamePage-CweJKrxc.js rename to docs/assets/MahjongGamePage-Bdpv27zp.js index c070a85..cd79ad6 100644 --- a/docs/assets/MahjongGamePage-CweJKrxc.js +++ b/docs/assets/MahjongGamePage-Bdpv27zp.js @@ -1,4 +1,4 @@ -import{c as U,j as e,d as ve,e as ke,E as we,r as c,A as de}from"./index-lLadk08S.js";import{S as Te}from"./shuffle-ADbBlETg.js";import{R as K}from"./rotate-ccw-DMjSdzg2.js";import{V as Q,a as ee}from"./volume-x-CjLNPeax.js";import{E as Ce}from"./eye-off-Pd9-Vzxg.js";import{C as Se,a as $e}from"./chevron-right-Cp_zyb7b.js";import{P as We}from"./pause-CU46RSeo.js";import{P as Pe}from"./play-b2ZiatJ3.js";import{T as Y}from"./trophy-BeLgwZ5q.js";import{g as _e}from"./audioContext-NbgqvQGz.js";import{L as Me,F as Ae}from"./lightbulb-CbLvQr23.js";import{S as Re,B as ze}from"./skip-forward-S_F054t1.js";import{T as He}from"./timer-Baa2rAz8.js";import{Z as Ee}from"./zap-Y8cI0o9G.js";const Be=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],Ie=U("arrow-left-right",Be);const Oe=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],V=U("circle-check-big",Oe);const Fe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],re=U("circle-x",Fe);const Ge=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],pe=U("users",Ge);const Ve=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Le=U("wrench",Ve),he={B:"Bamboo",C:"Characters",D:"Dots"},Z={B:"#4ade80",C:"#f87171",D:"#60a5fa"},De={sandbox:{label:"Sandbox",description:"Build any hand and check it freely"},guided:{label:"Guided",description:"Learn to spot pairs & melds step-by-step"},challenge:{label:"Challenge",description:"Speed rounds — Win or Not Win?"},"two-player":{label:"2 Player",description:"Take turns building hands"}},P=14,E=4,O=[1,2,3,4,5,6,7,8,9],B=["B","C","D"],J={title:"Mahjong Hand Solver",subtitle:"Backtracking-based winning hand validator",what:"Build a 14-tile Mahjong hand and check if it forms a valid winning combination — 4 melds (pongs or chows) plus 1 pair. Watch the backtracking solver try every possibility step-by-step.",skills:["Backtracking","Constraint Validation","Combinatorics","Pattern Matching"]},xe={sm:"w-9 h-12 sm:w-10 sm:h-14",md:"w-11 h-14 sm:w-12 sm:h-16 md:w-14 md:h-[4.35rem]",lg:"w-12 h-16 sm:w-14 sm:h-[4.6rem] md:w-16 md:h-20"};function I({code:t,index:s,count:n,size:a="md",selected:l=!1,disabled:r=!1,faded:m=!1,interactive:k=!1,removable:p=!1,placeholder:T=!1,onClick:i}){if(T||!t)return e.jsx("div",{className:`${xe[a]} relative rounded-xl border border-dashed border-emerald-900/30 bg-emerald-950/20 shadow-inner`,children:e.jsx("div",{className:"absolute inset-1 rounded-lg border border-emerald-900/20"})});const o=t[0],x=Number(t[1]),u=Z[o],g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-stone-50 via-amber-50 to-stone-200"}),e.jsx("div",{className:"absolute inset-x-1 top-1 h-1 rounded-full bg-white/80"}),e.jsx("div",{className:"absolute inset-1 rounded-lg border border-amber-950/10 bg-[radial-gradient(circle_at_30%_15%,rgba(255,255,255,0.8),transparent_38%),linear-gradient(135deg,rgba(255,255,255,0.35),transparent)]"}),e.jsx("div",{className:"absolute inset-y-1 right-0.5 w-1 rounded-r-lg bg-emerald-900/25"}),e.jsx("div",{className:"relative z-10 flex h-full flex-col items-center justify-center px-1 text-center",children:e.jsx(Ue,{suit:o,value:x,color:u,size:a})}),e.jsx("div",{className:"absolute left-1 top-1 text-[8px] font-black leading-none text-slate-900/35",children:x}),e.jsx("div",{className:"absolute bottom-1 right-1 rotate-180 text-[8px] font-black leading-none text-slate-900/35",children:x}),typeof s=="number"&&s>=0&&e.jsx("span",{className:"absolute -bottom-1 left-1/2 z-20 -translate-x-1/2 rounded-full bg-slate-950/80 px-1 text-[7px] font-mono text-slate-400 ring-1 ring-slate-700/50",children:s+1}),typeof n=="number"&&n>0&&e.jsx("span",{className:"absolute -right-1.5 -top-1.5 z-20 flex h-5 w-5 items-center justify-center rounded-full bg-emerald-950 text-[10px] font-bold text-emerald-200 ring-1 ring-emerald-500/50",children:n}),p&&e.jsx("span",{className:"absolute inset-0 z-30 flex items-center justify-center rounded-xl bg-red-950/70 text-sm font-black text-white opacity-0 transition-opacity group-hover:opacity-100",children:"x"})]}),b=` +import{c as U,j as e,d as ve,e as ke,E as we,r as c,A as de}from"./index-CB1-0H6I.js";import{S as Te}from"./shuffle-DZnyoAGL.js";import{R as K}from"./rotate-ccw-CDlWXRsI.js";import{V as Q,a as ee}from"./volume-x-CKT6TOtL.js";import{E as Ce}from"./eye-off-DMbwz3T2.js";import{C as Se,a as $e}from"./chevron-right-ChVmoNtO.js";import{P as We}from"./pause-DgUWKqjY.js";import{P as Pe}from"./play-SZ6Nqtz8.js";import{T as Y}from"./trophy-DE-EF49m.js";import{g as _e}from"./audioContext-NbgqvQGz.js";import{L as Me,F as Ae}from"./lightbulb-Bmtk7V6i.js";import{S as Re,B as ze}from"./skip-forward-DWTiDap8.js";import{T as He}from"./timer-rgbBx2U0.js";import{Z as Ee}from"./zap-C3nU9HZ_.js";const Be=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],Ie=U("arrow-left-right",Be);const Oe=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],V=U("circle-check-big",Oe);const Fe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],re=U("circle-x",Fe);const Ge=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],pe=U("users",Ge);const Ve=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Le=U("wrench",Ve),he={B:"Bamboo",C:"Characters",D:"Dots"},Z={B:"#4ade80",C:"#f87171",D:"#60a5fa"},De={sandbox:{label:"Sandbox",description:"Build any hand and check it freely"},guided:{label:"Guided",description:"Learn to spot pairs & melds step-by-step"},challenge:{label:"Challenge",description:"Speed rounds — Win or Not Win?"},"two-player":{label:"2 Player",description:"Take turns building hands"}},P=14,E=4,O=[1,2,3,4,5,6,7,8,9],B=["B","C","D"],J={title:"Mahjong Hand Solver",subtitle:"Backtracking-based winning hand validator",what:"Build a 14-tile Mahjong hand and check if it forms a valid winning combination — 4 melds (pongs or chows) plus 1 pair. Watch the backtracking solver try every possibility step-by-step.",skills:["Backtracking","Constraint Validation","Combinatorics","Pattern Matching"]},xe={sm:"w-9 h-12 sm:w-10 sm:h-14",md:"w-11 h-14 sm:w-12 sm:h-16 md:w-14 md:h-[4.35rem]",lg:"w-12 h-16 sm:w-14 sm:h-[4.6rem] md:w-16 md:h-20"};function I({code:t,index:s,count:n,size:a="md",selected:l=!1,disabled:r=!1,faded:m=!1,interactive:k=!1,removable:p=!1,placeholder:T=!1,onClick:i}){if(T||!t)return e.jsx("div",{className:`${xe[a]} relative rounded-xl border border-dashed border-emerald-900/30 bg-emerald-950/20 shadow-inner`,children:e.jsx("div",{className:"absolute inset-1 rounded-lg border border-emerald-900/20"})});const o=t[0],x=Number(t[1]),u=Z[o],g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-stone-50 via-amber-50 to-stone-200"}),e.jsx("div",{className:"absolute inset-x-1 top-1 h-1 rounded-full bg-white/80"}),e.jsx("div",{className:"absolute inset-1 rounded-lg border border-amber-950/10 bg-[radial-gradient(circle_at_30%_15%,rgba(255,255,255,0.8),transparent_38%),linear-gradient(135deg,rgba(255,255,255,0.35),transparent)]"}),e.jsx("div",{className:"absolute inset-y-1 right-0.5 w-1 rounded-r-lg bg-emerald-900/25"}),e.jsx("div",{className:"relative z-10 flex h-full flex-col items-center justify-center px-1 text-center",children:e.jsx(Ue,{suit:o,value:x,color:u,size:a})}),e.jsx("div",{className:"absolute left-1 top-1 text-[8px] font-black leading-none text-slate-900/35",children:x}),e.jsx("div",{className:"absolute bottom-1 right-1 rotate-180 text-[8px] font-black leading-none text-slate-900/35",children:x}),typeof s=="number"&&s>=0&&e.jsx("span",{className:"absolute -bottom-1 left-1/2 z-20 -translate-x-1/2 rounded-full bg-slate-950/80 px-1 text-[7px] font-mono text-slate-400 ring-1 ring-slate-700/50",children:s+1}),typeof n=="number"&&n>0&&e.jsx("span",{className:"absolute -right-1.5 -top-1.5 z-20 flex h-5 w-5 items-center justify-center rounded-full bg-emerald-950 text-[10px] font-bold text-emerald-200 ring-1 ring-emerald-500/50",children:n}),p&&e.jsx("span",{className:"absolute inset-0 z-30 flex items-center justify-center rounded-xl bg-red-950/70 text-sm font-black text-white opacity-0 transition-opacity group-hover:opacity-100",children:"x"})]}),b=` group relative ${xe[a]} shrink-0 overflow-visible rounded-xl border transition-all duration-200 shadow-[0_10px_18px_rgba(0,0,0,0.35),inset_0_-3px_0_rgba(0,0,0,0.18)] ${l?"z-10 -translate-y-2 rotate-[-1deg] border-amber-300 ring-2 ring-amber-300/50":"border-amber-950/25"} diff --git a/docs/assets/QueuePage-DUKmQFK6.js b/docs/assets/QueuePage-CBnrjsK1.js similarity index 97% rename from docs/assets/QueuePage-DUKmQFK6.js rename to docs/assets/QueuePage-CBnrjsK1.js index 80ae522..bd73810 100644 --- a/docs/assets/QueuePage-DUKmQFK6.js +++ b/docs/assets/QueuePage-CBnrjsK1.js @@ -1,4 +1,4 @@ -import{r as l,j as e,E as W}from"./index-lLadk08S.js";import{u as _}from"./useDSSound-CPhif-bj.js";import{P as K}from"./plus-NICMDkhr.js";import{T as U}from"./trash-2-veeiSg5V.js";import{R as X}from"./rotate-ccw-DMjSdzg2.js";import{S as B}from"./shuffle-ADbBlETg.js";import{V as J,a as Y}from"./volume-x-CjLNPeax.js";import{C as Z,a as ee}from"./chevron-right-Cp_zyb7b.js";import"./audioContext-NbgqvQGz.js";let I=1;const te=[{id:I++,value:5},{id:I++,value:12},{id:I++,value:8}];function se(){const[r,d]=l.useState(te),[n,m]=l.useState([]),[i,o]=l.useState(-1),[x,y]=l.useState(""),[p,b]=l.useState([]),[h,P]=l.useState(400),[w,j]=l.useState(!1),u=l.useRef(null),k=l.useRef(h),v=l.useRef(!1),{soundEnabled:$,toggleSound:z,playInsert:g,playDelete:N,playAccess:C,playTraverse:q}=_(),a=l.useRef(()=>{});l.useEffect(()=>{k.current=h},[h]),l.useEffect(()=>{if(!v.current||n.length===0)return;v.current=!1,u.current&&clearTimeout(u.current),j(!0);let t=0;const s=()=>{if(t>=n.length-1){j(!1);return}t++,o(t),a.current(t,n),u.current=setTimeout(s,k.current)};u.current=setTimeout(s,k.current)},[n]);const f=l.useCallback((t,s)=>{const c=s[t];c&&(c.highlightColor==="green"?g():c.highlightColor==="red"?N():c.highlightColor==="yellow"&&q(t,s.length))},[g,N,q]);l.useEffect(()=>{a.current=f},[f]);const Q=i>=0&&n[i]?n[i].queue:r,F=i>=0?n[i]:null,S=t=>b(s=>[t,...s].slice(0,20)),T=l.useCallback(t=>{const s={id:I++,value:t};d(c=>{const E=[...c,s],L=[{description:`Enqueuing ${t} at the rear of the queue...`,queue:c,highlightIndex:null,highlightColor:null},{description:`${t} added to the rear. Queue size: ${E.length}`,queue:E,highlightIndex:E.length-1,highlightColor:"green"}];return m(L),o(0),v.current=!0,g(),S(`Enqueue ${t}`),E})},[g]),O=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[0],c=[{description:`Dequeue: checking front element ${s.value}...`,queue:t,highlightIndex:0,highlightColor:"yellow"},{description:`Removing ${s.value} from the front.`,queue:t,highlightIndex:0,highlightColor:"red"},{description:`${s.value} removed. Queue size: ${t.length-1}`,queue:t.slice(1),highlightIndex:null,highlightColor:null}];return m(c),o(0),v.current=!0,N(),S(`Dequeue → ${s.value}`),t.slice(1)})},[N]),D=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[0],c=[{description:"Peek front: reading without removing.",queue:t,highlightIndex:0,highlightColor:"yellow"},{description:`Front element is ${s.value}.`,queue:t,highlightIndex:0,highlightColor:"yellow"}];return m(c),o(0),v.current=!0,C(),S(`Peek → ${s.value}`),t})},[C]),M=l.useCallback(()=>{d([]),m([]),o(-1),S("Clear queue")},[]),V=l.useCallback(()=>{const t=Math.floor(Math.random()*4)+3,s=Array.from({length:t},()=>({id:I++,value:Math.floor(Math.random()*90)+1}));d(s),m([]),o(-1),S("Random queue")},[]),H=l.useCallback(()=>{o(t=>{const s=Math.min(t+1,n.length-1);return f(s,n),s})},[n,f]),A=l.useCallback(()=>{o(t=>Math.max(t-1,0))},[]),G=l.useCallback(()=>{if(w){j(!1),u.current&&clearTimeout(u.current);return}j(!0);let t=i;const s=()=>{if(t>=n.length-1){j(!1);return}t++,o(t),f(t,n),u.current=setTimeout(s,h)};u.current=setTimeout(s,h)},[w,i,n,h,f]);return{queue:r,displayQueue:Q,steps:n,stepIndex:i,currentStep:F,inputValue:x,setInputValue:y,history:p,speed:h,setSpeed:P,isPlaying:w,enqueue:T,dequeue:O,peekFront:D,clear:M,generateRandom:V,nextStep:H,prevStep:A,autoPlay:G,soundEnabled:$,toggleSound:z,canGoNext:i0}}const le={green:"border-emerald-400 bg-emerald-500/20 text-emerald-300",red:"border-rose-400 bg-rose-500/20 text-rose-300",yellow:"border-amber-400 bg-amber-500/20 text-amber-300"},R=8;function ae({queue:r,currentStep:d}){const n=r.slice(0,R),m=d?.highlightIndex??null,i=d?.highlightColor??null;return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[300px] gap-6 px-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[e.jsx("div",{className:"flex items-center gap-1.5 w-full justify-center",children:r.length>0&&e.jsxs("div",{className:"flex items-end gap-1.5 flex-wrap justify-center",children:[n.map((o,x)=>{const y=x===m,p=x===0,b=x===r.length-1&&x{});l.useEffect(()=>{k.current=h},[h]),l.useEffect(()=>{if(!v.current||n.length===0)return;v.current=!1,u.current&&clearTimeout(u.current),j(!0);let t=0;const s=()=>{if(t>=n.length-1){j(!1);return}t++,o(t),a.current(t,n),u.current=setTimeout(s,k.current)};u.current=setTimeout(s,k.current)},[n]);const f=l.useCallback((t,s)=>{const c=s[t];c&&(c.highlightColor==="green"?g():c.highlightColor==="red"?N():c.highlightColor==="yellow"&&q(t,s.length))},[g,N,q]);l.useEffect(()=>{a.current=f},[f]);const Q=i>=0&&n[i]?n[i].queue:r,F=i>=0?n[i]:null,S=t=>b(s=>[t,...s].slice(0,20)),T=l.useCallback(t=>{const s={id:I++,value:t};d(c=>{const E=[...c,s],L=[{description:`Enqueuing ${t} at the rear of the queue...`,queue:c,highlightIndex:null,highlightColor:null},{description:`${t} added to the rear. Queue size: ${E.length}`,queue:E,highlightIndex:E.length-1,highlightColor:"green"}];return m(L),o(0),v.current=!0,g(),S(`Enqueue ${t}`),E})},[g]),O=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[0],c=[{description:`Dequeue: checking front element ${s.value}...`,queue:t,highlightIndex:0,highlightColor:"yellow"},{description:`Removing ${s.value} from the front.`,queue:t,highlightIndex:0,highlightColor:"red"},{description:`${s.value} removed. Queue size: ${t.length-1}`,queue:t.slice(1),highlightIndex:null,highlightColor:null}];return m(c),o(0),v.current=!0,N(),S(`Dequeue → ${s.value}`),t.slice(1)})},[N]),D=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[0],c=[{description:"Peek front: reading without removing.",queue:t,highlightIndex:0,highlightColor:"yellow"},{description:`Front element is ${s.value}.`,queue:t,highlightIndex:0,highlightColor:"yellow"}];return m(c),o(0),v.current=!0,C(),S(`Peek → ${s.value}`),t})},[C]),M=l.useCallback(()=>{d([]),m([]),o(-1),S("Clear queue")},[]),V=l.useCallback(()=>{const t=Math.floor(Math.random()*4)+3,s=Array.from({length:t},()=>({id:I++,value:Math.floor(Math.random()*90)+1}));d(s),m([]),o(-1),S("Random queue")},[]),H=l.useCallback(()=>{o(t=>{const s=Math.min(t+1,n.length-1);return f(s,n),s})},[n,f]),A=l.useCallback(()=>{o(t=>Math.max(t-1,0))},[]),G=l.useCallback(()=>{if(w){j(!1),u.current&&clearTimeout(u.current);return}j(!0);let t=i;const s=()=>{if(t>=n.length-1){j(!1);return}t++,o(t),f(t,n),u.current=setTimeout(s,h)};u.current=setTimeout(s,h)},[w,i,n,h,f]);return{queue:r,displayQueue:Q,steps:n,stepIndex:i,currentStep:F,inputValue:x,setInputValue:y,history:p,speed:h,setSpeed:P,isPlaying:w,enqueue:T,dequeue:O,peekFront:D,clear:M,generateRandom:V,nextStep:H,prevStep:A,autoPlay:G,soundEnabled:$,toggleSound:z,canGoNext:i0}}const le={green:"border-emerald-400 bg-emerald-500/20 text-emerald-300",red:"border-rose-400 bg-rose-500/20 text-rose-300",yellow:"border-amber-400 bg-amber-500/20 text-amber-300"},R=8;function ae({queue:r,currentStep:d}){const n=r.slice(0,R),m=d?.highlightIndex??null,i=d?.highlightColor??null;return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full min-h-[300px] gap-6 px-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[e.jsx("div",{className:"flex items-center gap-1.5 w-full justify-center",children:r.length>0&&e.jsxs("div",{className:"flex items-end gap-1.5 flex-wrap justify-center",children:[n.map((o,x)=>{const y=x===m,p=x===0,b=x===r.length-1&&x{r(h=>({x:he(h.x+i),y:h.y+C}))},[]),x=o.useCallback(()=>{r(be)},[]),f=o.useCallback(i=>{i.currentTarget.setPointerCapture(i.pointerId),S({pointerId:i.pointerId,startX:i.clientX,startY:i.clientY,rotation:l})},[l]),v=o.useCallback(i=>{if(!c||c.pointerId!==i.pointerId)return;const C=i.clientX-c.startX,h=i.clientY-c.startY;r({x:he(c.rotation.x-h*.35),y:c.rotation.y+C*.35})},[c]),p=o.useCallback(i=>{!c||c.pointerId!==i.pointerId||(i.currentTarget.hasPointerCapture(i.pointerId)&&i.currentTarget.releasePointerCapture(i.pointerId),S(null))},[c]);return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 md:p-5 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-white",children:"Cube State"}),e.jsx("p",{className:"text-[11px] text-slate-500",children:"Drag the 3D cube to rotate the view"})]}),e.jsx("span",{className:`rounded-full px-2.5 py-1 text-[10px] font-semibold ring-1 ${s?"bg-emerald-500/15 text-emerald-300 ring-emerald-500/30":"bg-amber-500/15 text-amber-300 ring-amber-500/30"}`,children:s?"Solved":"Scrambled"})]}),e.jsx("div",{className:"flex min-h-[290px] touch-none cursor-grab items-center justify-center overflow-hidden rounded-xl bg-slate-950/40 ring-1 ring-slate-800/60 active:cursor-grabbing",role:"img","aria-label":"Interactive 3D Rubik's Cube view. Drag to rotate the cube.",onPointerDown:f,onPointerMove:v,onPointerUp:p,onPointerCancel:p,children:e.jsxs("div",{className:"relative h-56 w-56",style:{perspective:"900px"},children:[e.jsx("div",{className:`absolute left-1/2 top-1/2 h-36 w-36 ${c?"":"transition-transform duration-500"}`,style:{transformStyle:"preserve-3d",transform:`translate(-50%, -50%) rotateX(${l.x}deg) rotateY(${l.y}deg) rotateZ(0deg)`},children:Qe.map(i=>e.jsxs("div",{className:"absolute left-0 top-0 grid h-36 w-36 grid-cols-3 gap-1 rounded-xl border border-slate-950/70 bg-slate-950/90 p-1.5 shadow-2xl",style:{transform:Ke[i],backfaceVisibility:"hidden"},"aria-label":`${Ze[i]} face`,children:[t[i].map((C,h)=>e.jsx("div",{className:"rounded-md border border-slate-950/50 shadow-inner transition-colors duration-300",style:{backgroundColor:He[C]}},`${i}-${h}`)),e.jsx("span",{className:"pointer-events-none absolute left-2 top-1 text-[10px] font-black text-slate-950/50",children:i})]},i))}),e.jsx("div",{className:"absolute bottom-2 left-1/2 h-8 w-40 -translate-x-1/2 rounded-full bg-black/30 blur-xl"})]})}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-[10px] text-slate-500",children:["View angle: X ",Math.round(l.x),"deg / Y ",Math.round(l.y),"deg"]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(W,{label:"Up",onClick:()=>d(-ee,0)}),e.jsx(W,{label:"Down",onClick:()=>d(ee,0)}),e.jsx(W,{label:"Left",onClick:()=>d(0,-ee)}),e.jsx(W,{label:"Right",onClick:()=>d(0,ee)}),e.jsx(W,{label:"Reset View",onClick:x})]})]}),e.jsxs("div",{className:"mt-5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Quick Turns"}),e.jsx("span",{className:"text-[10px] text-slate-600",children:"Clockwise / inverse / double"})]}),e.jsx("div",{className:"grid grid-cols-6 gap-1.5 sm:grid-cols-9",children:ce.map(i=>e.jsx("button",{onClick:()=>a(i),className:"rounded-lg bg-slate-800/70 px-2 py-1.5 text-[11px] font-semibold text-slate-300 ring-1 ring-slate-700/40 transition-all hover:bg-indigo-500/15 hover:text-indigo-300 hover:ring-indigo-500/30",children:i},i))})]})]})}function he(t){return Math.max(-75,Math.min(75,t))}function W({label:t,onClick:s}){return e.jsx("button",{onClick:s,className:"rounded-md bg-slate-800/70 px-2 py-1 text-[10px] font-semibold text-slate-400 ring-1 ring-slate-700/40 transition-all hover:bg-indigo-500/15 hover:text-indigo-300 hover:ring-indigo-500/30",children:t})}const et=o.memo(Je),tt={U:"white",D:"yellow",F:"green",B:"blue",L:"orange",R:"red"},de=["U","D","F","B","L","R"],st={U:[["F",[0,1,2]],["R",[0,1,2]],["B",[0,1,2]],["L",[0,1,2]]],D:[["F",[6,7,8]],["L",[6,7,8]],["B",[6,7,8]],["R",[6,7,8]]],F:[["U",[6,7,8]],["R",[0,3,6]],["D",[2,1,0]],["L",[8,5,2]]],B:[["U",[2,1,0]],["L",[0,3,6]],["D",[6,7,8]],["R",[8,5,2]]],L:[["U",[0,3,6]],["F",[0,3,6]],["D",[0,3,6]],["B",[8,5,2]]],R:[["U",[8,5,2]],["B",[0,3,6]],["D",[8,5,2]],["F",[8,5,2]]]};function U(){return de.reduce((t,s)=>(t[s]=Array(9).fill(tt[s]),t),{})}function ke(t){return de.reduce((s,a)=>(s[a]=[...t[a]],s),{})}function te(t){return de.every(s=>t[s].every(a=>a===t[s][4]))}function Z(t,s){return s.reduce((a,l)=>se(a,l),t)}function se(t,s){const a=s[0],l=s.endsWith("2")?2:s.endsWith("'")?3:1;let r=ke(t);for(let c=0;c{const r=ct(l,s.length);return{move:a,phase:r,description:`${r}: apply ${a} as part of the inverse solve sequence.`}})}function at(t,s){const a=ke(t);a[s]=ot(t[s]);const l=st[s],r=l.map(([c,S])=>S.map(d=>t[c][d]));return l.forEach(([c,S],d)=>{const x=r[(d+l.length-1)%l.length];S.forEach((f,v)=>{a[c][f]=x[v]})}),a}function ot(t){return[t[6],t[3],t[0],t[7],t[4],t[1],t[8],t[5],t[2]]}function rt(t){const s=[];for(const a of t){const l=s[s.length-1];if(!l||l[0]!==a[0]){s.push(a);continue}const r=(ve(l)+ve(a))%4;s.pop(),r!==0&&s.push(it(a[0],r))}return s}function ve(t){return t.endsWith("2")?2:t.endsWith("'")?3:1}function it(t,s){return s===2?`${t}2`:s===3?`${t}'`:t}function ct(t,s){if(s<=4)return["Cross","F2L","2-Look OLL","2-Look PLL"][t%4];const a=t/s;return a<.25?"Cross":a<.62?"F2L":a<.82?"2-Look OLL":"2-Look PLL"}const dt=["U","D","F","B","L","R"],fe=[{id:"starter-cross",title:"Starter Scramble",description:"A short scramble for practicing move notation and inverse solving.",scramble:["R","U","R'","U'"],targetMoves:4},{id:"six-move",title:"Six Move Sprint",description:"Solve a slightly longer scramble with clean inverse turns.",scramble:["F","R","U","R'","U'","F'"],targetMoves:6},{id:"middle-layer",title:"Middle Layer Drill",description:"A medium scramble that touches side faces and top-layer turns.",scramble:["L","U2","F","R'","D","B2","L'"],targetMoves:7},{id:"full-cube",title:"Full Cube Challenge",description:"A longer scramble that rewards using the solver and reading move notation.",scramble:["R","U","F2","L'","D","B","R2","U'","F","D'"],targetMoves:10}];function Ne(t){const s=[];let a="";for(;s.length0?t.join(" "):"None"}function we(t){const s=t.trim().toUpperCase().replace("’","'").replace(/I$/,"'");if(!s)return null;const a=s[0],l=s.slice(1);return!dt.includes(a)||l!==""&&l!=="'"&&l!=="2"?null:`${a}${l}`}function ut(t){const s=t.split(/[\s,]+/).map(l=>l.trim()).filter(Boolean);if(s.length===0)return null;const a=s.map(we);return a.some(l=>l===null)?null:a}function mt(t,s=25){const a=Math.max(1,Math.min(t,100)),l=Array.from({length:a},()=>{const d=Ne(s);return{scramble:d,solutionLength:le(d).length}}),r=l.reduce((d,x)=>x.solutionLengthx.solutionLength>d.solutionLength?x:d,l[0]),S=l.reduce((d,x)=>d+x.solutionLength,0)/l.length;return{runs:a,best:r,worst:c,averageLength:S}}function xt({mode:t,message:s,moveHistory:a,scrambleMoves:l,solution:r,solutionIndex:c,solutionDone:S,solverPlaybackMode:d,solverSpeed:x,manualMove:f,customScramble:v,simulationRuns:p,simulationResult:i,guidedStep:C,guidedScript:h,challenges:w,selectedChallenge:k,challengeStarted:ne,challengeMoves:H,challengeSolved:N,soundEnabled:V,onManualMoveChange:g,onCustomScrambleChange:ae,onSimulationRunsChange:j,onApplyManualMove:K,onScramble:Q,onApplyCustomScramble:$,onSimulateSolves:G,onGenerateSolution:_,onStepSolution:J,onAutoSolve:D,onSolverSpeedChange:A,onUndo:oe,onReset:L,onNextGuidedStep:X,onSelectChallenge:F,onStartChallenge:M,onToggleSound:Y}){const u=Math.max(0,z.findIndex(b=>b.id===x)),re=z[u]??z[1];return e.jsxs("aside",{className:"w-full space-y-4 md:w-80 md:shrink-0",children:[e.jsxs(B,{title:"Status",children:[e.jsx("p",{className:"text-xs leading-relaxed text-slate-300",children:s}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[e.jsx(O,{label:"Moves",value:a.length}),e.jsx(O,{label:"Solution",value:r.length>0?`${c}/${r.length}`:"-"})]})]}),t==="guided"&&e.jsxs(B,{title:"Guided Mode",children:[e.jsx("p",{className:"text-[11px] leading-relaxed text-slate-400",children:"Learn notation, scrambling, and CFOP-inspired phase labels step by step."}),e.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:"Reference style: Cross → F2L → 2-Look OLL → 2-Look PLL."}),e.jsxs("div",{className:"mt-3 rounded-xl border border-amber-500/20 bg-amber-500/5 p-3",children:[e.jsxs("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-amber-300",children:["Step ",C+1," / ",h.length]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-slate-300",children:h[C]})]}),e.jsx("button",{onClick:X,className:"mt-3 w-full rounded-lg bg-amber-500/20 px-3 py-2 text-xs font-semibold text-amber-300 ring-1 ring-amber-500/40 hover:bg-amber-500/30",children:"Continue Guided Step"})]}),t==="freeplay"&&e.jsxs(B,{title:"Freeplay Mode",children:[e.jsx(je,{value:f,onChange:g,onApply:K}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Custom scramble"}),e.jsx("textarea",{value:v,onChange:b=>ae(b.target.value),rows:2,placeholder:"R U R' U' or Ri U R U2",className:"mt-1 w-full resize-none rounded-lg bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-cyan-500/50"}),e.jsx("button",{onClick:$,className:"mt-2 w-full rounded-lg bg-violet-500/20 px-3 py-2 text-xs font-semibold text-violet-300 ring-1 ring-violet-500/40 hover:bg-violet-500/30",children:"Apply Custom Scramble"})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[e.jsx(T,{onClick:()=>Q(12),icon:e.jsx(xe,{size:13}),label:"12-Move Scramble"}),e.jsx(T,{onClick:()=>Q(25),icon:e.jsx(xe,{size:13}),label:"25-Move Scramble"}),e.jsx(T,{onClick:_,icon:e.jsx(ge,{size:13}),label:"Find Solution"}),e.jsx(T,{onClick:D,icon:e.jsx(pe,{size:13}),label:"Auto Run"}),e.jsx(T,{onClick:oe,label:"Undo"}),e.jsx(T,{onClick:L,icon:e.jsx(_e,{size:13}),label:"Reset"})]}),e.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Simulation runs"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("input",{type:"number",min:1,max:100,value:p,onChange:b=>j(Number(b.target.value)||1),className:"min-w-0 flex-1 rounded-lg bg-slate-950/70 px-3 py-2 text-sm font-mono text-slate-200 ring-1 ring-slate-700/50"}),e.jsx("button",{onClick:G,className:"rounded-lg bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:"Run"})]})]})]}),t==="challenge"&&e.jsxs(B,{title:"Challenge Mode",children:[e.jsx("div",{className:"space-y-2",children:w.map(b=>e.jsxs("button",{onClick:()=>F(b),className:`w-full rounded-lg px-3 py-2 text-left ring-1 transition-all ${k.id===b.id?"bg-rose-500/15 text-rose-200 ring-rose-500/40":"bg-slate-800/50 text-slate-400 ring-slate-700/40 hover:bg-slate-700/50"}`,children:[e.jsx("div",{className:"text-xs font-semibold",children:b.title}),e.jsx("div",{className:"mt-0.5 text-[10px] text-slate-500",children:b.description})]},b.id))}),e.jsx("button",{onClick:()=>M(k),className:"mt-3 w-full rounded-lg bg-rose-500/20 px-3 py-2 text-xs font-semibold text-rose-300 ring-1 ring-rose-500/40 hover:bg-rose-500/30",children:"Start Challenge"}),ne&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx(je,{value:f,onChange:g,onApply:K}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(O,{label:"Your Moves",value:H}),e.jsx(O,{label:"Target",value:k.targetMoves})]}),N&&e.jsxs("div",{className:"rounded-lg bg-emerald-500/10 px-3 py-2 text-xs text-emerald-300 ring-1 ring-emerald-500/30",children:["Solved in ",H," moves."]})]})]}),e.jsxs(B,{title:"Solver",children:[e.jsxs("div",{className:"space-y-2 text-[11px] text-slate-400",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-slate-500",children:"Scramble:"})," ",R(l)]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-slate-500",children:"History:"})," ",R(a.slice(-12))]})]}),e.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Playback"}),e.jsx("span",{className:"text-[10px] text-slate-500",children:re.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Se,{label:"Manual Step",active:d==="manual",disabled:S||r.length===0,onClick:J}),e.jsx(Se,{label:"Auto",active:d==="auto",disabled:S||r.length===0&&a.length===0,onClick:D})]}),e.jsx("input",{type:"range",min:0,max:z.length-1,step:1,value:u,onChange:b=>{const m=z[Number(b.target.value)]?.id;m&&A(m)},className:"mt-3 w-full accent-indigo-400","aria-label":"Solver auto playback speed"}),e.jsx("div",{className:"mt-1 flex justify-between",children:z.map(b=>e.jsx("span",{className:`text-[9px] uppercase tracking-wide ${b.id===x?"text-indigo-300":"text-slate-600"}`,children:b.label},b.id))})]}),r.length>0&&e.jsx("div",{className:"mt-3 max-h-28 overflow-y-auto rounded-lg bg-slate-950/50 p-2",children:r.map((b,m)=>e.jsxs("div",{className:`flex items-center gap-2 rounded px-2 py-1 text-[11px] ${mY(!V),className:`inline-flex w-full items-center justify-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold ring-1 ${V?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[V?e.jsx(Ge,{size:14}):e.jsx(Xe,{size:14}),V?"Sound On":"Sound Off"]})})]})}function B({title:t,children:s}){return e.jsxs("section",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wider text-slate-400",children:t}),s]})}function O({label:t,value:s}){return e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2.5 py-2 ring-1 ring-slate-700/40",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:t}),e.jsx("div",{className:"text-sm font-mono text-slate-100",children:s})]})}function T({label:t,icon:s,disabled:a,onClick:l}){return e.jsxs("button",{onClick:l,disabled:a,className:"inline-flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/70 px-3 py-2 text-[11px] font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70 disabled:cursor-not-allowed disabled:opacity-40",children:[s,t]})}function Se({label:t,active:s,disabled:a,onClick:l}){return e.jsx("button",{onClick:l,disabled:a,className:`rounded-lg px-3 py-2 text-[11px] font-semibold ring-1 transition-all disabled:cursor-not-allowed disabled:opacity-40 ${s?"bg-indigo-500/20 text-indigo-300 ring-indigo-500/40":"bg-slate-800/70 text-slate-300 ring-slate-700/50 hover:bg-slate-700/70"}`,children:t})}function je({value:t,onChange:s,onApply:a}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Move notation"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("input",{value:t,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&a()},placeholder:"R, U', F2",className:"min-w-0 flex-1 rounded-lg bg-slate-950/70 px-3 py-2 text-sm font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-cyan-500/50"}),e.jsx("button",{onClick:a,className:"rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-semibold text-cyan-300 ring-1 ring-cyan-500/40 hover:bg-cyan-500/30",children:"Apply"})]})]})}const pt=o.memo(xt);function gt(){const t=o.useRef(!0),[s,a]=o.useState(!0),l=o.useCallback(()=>Ye(),[]),r=o.useCallback((v,p,i="sine",C=.045)=>{if(!t.current)return;const h=l();if(!h)return;const w=h.createOscillator(),k=h.createGain();w.type=i,w.frequency.setValueAtTime(v,h.currentTime),k.gain.setValueAtTime(C,h.currentTime),k.gain.exponentialRampToValueAtTime(.001,h.currentTime+p),w.connect(k),k.connect(h.destination),w.start(h.currentTime),w.stop(h.currentTime+p)},[l]),c=o.useCallback(v=>{const p=[261.63,293.66,329.63,392,440,523.25];r(p[v%p.length],.08,"triangle",.035)},[r]),S=o.useCallback(()=>{r(196,.12,"sawtooth",.03),setTimeout(()=>r(246.94,.12,"sawtooth",.03),80)},[r]),d=o.useCallback(()=>{[392,493.88,587.33,783.99].forEach((v,p)=>{setTimeout(()=>r(v,.12,"sine",.05),p*75)})},[r]),x=o.useCallback(()=>{r(164.81,.18,"sawtooth",.035)},[r]),f=o.useCallback(v=>{t.current=v,a(v)},[]);return{soundEnabled:s,toggleSound:f,playMove:c,playScramble:S,playSolved:d,playError:x}}const ye=["Start from a solved cube and watch what a single R turn does.","Scramble the cube with a short sequence.","Ask the solver for the inverse sequence.","Step through solution moves and watch the cube return to solved state."];function Ce(t){return z.find(s=>s.id===t)?.delayMs??450}function bt(){const[t,s]=o.useState("guided"),[a,l]=o.useState(U),[r,c]=o.useState([]),[S,d]=o.useState([]),[x,f]=o.useState([]),[v,p]=o.useState(0),[i,C]=o.useState("R"),[h,w]=o.useState("R U R' U'"),[k,ne]=o.useState(10),[H,N]=o.useState(null),[V,g]=o.useState("Choose a mode and start turning the cube."),[ae,j]=o.useState("manual"),[K,Q]=o.useState("normal"),[$,G]=o.useState(0),[_,J]=o.useState(fe[0]),[D,A]=o.useState(!1),[oe,L]=o.useState(0),[X,F]=o.useState(!1),M=o.useRef(null),Y=o.useRef("normal"),u=gt(),re=o.useMemo(()=>te(a),[a]),b=x.length>0&&v>=x.length,m=o.useCallback(()=>{M.current&&(window.clearInterval(M.current),M.current=null)},[]);o.useEffect(()=>m,[m]);const Me=o.useCallback(n=>{Y.current=n,Q(n)},[]),Re=o.useCallback(()=>{m(),l(U()),c([]),d([]),f([]),p(0),N(null),j("manual"),G(0),A(!1),L(0),F(!1),g("Cube reset to solved state.")},[m]),Le=o.useCallback(n=>{s(n),m(),l(U()),c([]),d([]),f([]),p(0),N(null),j("manual"),G(0),A(!1),L(0),F(!1),g(n==="guided"?"Guided mode: follow the walkthrough to understand cube moves and solving.":n==="freeplay"?"Freeplay mode: scramble, turn, and solve however you like.":"Challenge mode: solve the scramble in as few moves as possible.")},[m]),q=o.useCallback((n,y=!0)=>{m(),j("manual"),l(E=>{const I=se(E,n);return y&&(c(P=>[...P,n]),t==="challenge"&&D&&!X&&(L(P=>P+1),te(I)&&(F(!0),g("Challenge solved! Compare your move count with the target."),u.playSolved()))),I}),f([]),p(0),N(null),u.playMove(n.charCodeAt(0))},[X,D,m,t,u]),Fe=o.useCallback((n=12)=>{m();const y=Ne(n);l(Z(U(),y)),c(y),d(y),f([]),p(0),j("manual"),A(!1),L(0),F(!1),g(`Scrambled with: ${R(y)}`),u.playScramble()},[m,u]),Ue=o.useCallback(()=>{m();const n=ut(h);if(!n){g("Invalid scramble. Use moves like: R U R' U' or Ri U R U2."),u.playError();return}l(Z(U(),n)),c(n),d(n),f([]),p(0),N(null),j("manual"),A(!1),L(0),F(!1),g(`Custom scramble applied: ${R(n)}`),u.playScramble()},[m,h,u]),Te=o.useCallback((n=_)=>{m(),J(n),l(Z(U(),n.scramble)),c(n.scramble),d(n.scramble),f([]),p(0),N(null),j("manual"),A(!0),L(0),F(!1),g(`Challenge started. Scramble: ${R(n.scramble)}`),u.playScramble()},[m,_,u]),$e=o.useCallback(()=>{m();const n=le(r);f(n),p(0),N(null),j("manual"),g(n.length>0?`Solver found ${n.length} inverse move${n.length===1?"":"s"}.`:"Cube is already solved."),n.length===0&&u.playSolved()},[m,r,u]),ie=o.useCallback(()=>{m(),j("manual");const n=x[v];n&&(l(y=>{const E=se(y,n.move);return te(E)?(g("Solved! The inverse sequence returned the cube to its original state."),u.playSolved()):g(n.description),E}),p(y=>y+1),u.playMove(v))},[m,x,v,u]),De=o.useCallback(()=>{m();const n=x.length>0?x:le(r),y=x.length>0?v:0;if(n.length===0){f([]),p(0),j("manual"),g("Cube is already solved."),u.playSolved();return}if(y>=n.length){j("manual"),g("Solution playback is already complete.");return}x.length===0&&(f(n),p(0)),N(null),j("auto"),g(`Auto-solving ${n.length-y} remaining move${n.length-y===1?"":"s"}.`);const E=()=>{p(I=>{const P=n[I];if(!P)return M.current=null,j("manual"),I;l(Be=>{const me=se(Be,P.move);return te(me)?(g("Auto-solve complete."),u.playSolved()):(g(P.description),u.playMove(I)),me});const ue=I+1;return ue{const n=we(i);if(!n){g("Invalid move. Use notation like R, U', F2, or L'."),u.playError();return}q(n),g(`Applied ${n}.`)},[q,i,u]),Ee=o.useCallback(()=>{const n=mt(k);N(n),g(`Ran ${n.runs} simulated solves. Best: ${n.best.solutionLength} moves, worst: ${n.worst.solutionLength} moves.`)},[k]),Ie=o.useCallback(()=>{const n=r.slice(0,-1);c(n),l(Z(U(),n)),f([]),p(0),j("manual"),g("Undid the last recorded move.")},[r]),Pe=o.useCallback(()=>{if($===0)q("R"),g("R turns the right face clockwise. Notice the side stickers move too.");else if($===1){const n=["R","U","R'","U'"];l(Z(U(),n)),c(n),d(n),g(`Short scramble applied: ${R(n)}`),u.playScramble()}else if($===2){const n=le(r);f(n),p(0),g(`The solver reverses the scramble: ${R(n.map(y=>y.move))}`)}else ie();G(n=>Math.min(n+1,ye.length-1))},[$,q,r,u,ie]);return{mode:t,cube:a,solved:re,moveHistory:r,scrambleMoves:S,solution:x,solutionIndex:v,solutionDone:b,solverPlaybackMode:ae,solverSpeed:K,setSolverSpeed:Me,manualMove:i,setManualMove:C,customScramble:h,setCustomScramble:w,simulationRuns:k,setSimulationRuns:ne,simulationResult:H,message:V,guidedStep:$,guidedScript:ye,selectedChallenge:_,setSelectedChallenge:J,challenges:fe,challengeStarted:D,challengeMoves:oe,challengeSolved:X,soundEnabled:u.soundEnabled,toggleSound:u.toggleSound,switchMode:Le,resetCube:Re,makeMove:q,runScramble:Fe,runCustomScramble:Ue,generateSolution:$e,stepSolution:ie,autoSolve:De,applyManualMove:Ae,undoLastMove:Ie,startChallenge:Te,nextGuidedStep:Pe,simulateSolves:Ee}}const ht=[{id:"guided",label:"Guided Mode",icon:e.jsx(Ve,{size:14})},{id:"freeplay",label:"Freeplay Mode",icon:e.jsx(ze,{size:14})},{id:"challenge",label:"Challenge Mode",icon:e.jsx(qe,{size:14})}];function Nt(){const t=bt();return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"shrink-0 border-b border-slate-700/50 bg-slate-900/40 px-4 pt-3 backdrop-blur-sm md:px-6",children:e.jsx("div",{className:"flex gap-1 overflow-x-auto",children:ht.map(s=>e.jsxs("button",{onClick:()=>t.switchMode(s.id),className:`flex items-center gap-1.5 whitespace-nowrap rounded-t-lg px-4 py-2.5 text-xs font-medium transition-all md:text-sm ${t.mode===s.id?"bg-slate-800/80 text-indigo-300 border border-b-0 border-slate-700/50 -mb-px":"text-slate-500 hover:bg-slate-800/30 hover:text-slate-300"}`,children:[s.icon,s.label]},s.id))})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-4 md:flex-row md:gap-6",children:[e.jsxs("main",{className:"order-last flex min-w-0 flex-1 flex-col gap-4 md:order-first",children:[e.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm md:p-5",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white md:text-xl",children:"Rubik's Cube Solver"}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-slate-400",children:"Manipulate a 3D Rubik's Cube, generate or enter scrambles, and watch a CFOP-inspired solve sequence step by step."})]}),e.jsx("div",{className:"rounded-full bg-violet-500/10 px-3 py-1 text-[10px] font-semibold text-violet-300 ring-1 ring-violet-500/30",children:"3D Cube"})]}),e.jsx("div",{className:"mt-3 rounded-xl bg-indigo-500/5 px-3 py-2 ring-1 ring-indigo-500/15",children:e.jsxs("p",{className:"text-[11px] leading-relaxed text-slate-300",children:["Move notation: ",e.jsx("span",{className:"font-mono text-cyan-300",children:"R"})," turns a face clockwise,",e.jsx("span",{className:"font-mono text-cyan-300",children:" R'"})," turns it counter-clockwise, and",e.jsx("span",{className:"font-mono text-cyan-300",children:" R2"})," turns it twice. The inverse shorthand",e.jsx("span",{className:"font-mono text-cyan-300",children:" Ri"})," is also accepted."]})})]}),e.jsx(et,{cube:t.cube,solved:t.solved,onMove:t.makeMove})]}),e.jsx(pt,{mode:t.mode,message:t.message,moveHistory:t.moveHistory,scrambleMoves:t.scrambleMoves,solution:t.solution,solutionIndex:t.solutionIndex,solutionDone:t.solutionDone,solverPlaybackMode:t.solverPlaybackMode,solverSpeed:t.solverSpeed,manualMove:t.manualMove,customScramble:t.customScramble,simulationRuns:t.simulationRuns,simulationResult:t.simulationResult,guidedStep:t.guidedStep,guidedScript:t.guidedScript,challenges:t.challenges,selectedChallenge:t.selectedChallenge,challengeStarted:t.challengeStarted,challengeMoves:t.challengeMoves,challengeSolved:t.challengeSolved,soundEnabled:t.soundEnabled,onManualMoveChange:t.setManualMove,onCustomScrambleChange:t.setCustomScramble,onSimulationRunsChange:t.setSimulationRuns,onApplyManualMove:t.applyManualMove,onScramble:t.runScramble,onApplyCustomScramble:t.runCustomScramble,onSimulateSolves:t.simulateSolves,onGenerateSolution:t.generateSolution,onStepSolution:t.stepSolution,onAutoSolve:t.autoSolve,onSolverSpeedChange:t.setSolverSpeed,onUndo:t.undoLastMove,onReset:t.resetCube,onNextGuidedStep:t.nextGuidedStep,onSelectChallenge:t.setSelectedChallenge,onStartChallenge:t.startChallenge,onToggleSound:t.toggleSound})]})})]})}export{Nt as default}; +import{c as Oe,r as o,j as e,h as ze}from"./index-CB1-0H6I.js";import{S as xe}from"./shuffle-DZnyoAGL.js";import{S as pe,B as Ve}from"./skip-forward-DWTiDap8.js";import{R as _e}from"./rotate-ccw-CDlWXRsI.js";import{V as Ge,a as Xe}from"./volume-x-CKT6TOtL.js";import{g as Ye}from"./audioContext-NbgqvQGz.js";import{T as qe}from"./trophy-DE-EF49m.js";const We=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],ge=Oe("wand-sparkles",We),z=[{id:"slow",label:"Slow",delayMs:900},{id:"normal",label:"Normal",delayMs:450},{id:"fast",label:"Fast",delayMs:160}],Ze={U:"Up",D:"Down",F:"Front",B:"Back",L:"Left",R:"Right"},He={white:"#f8fafc",yellow:"#facc15",green:"#22c55e",blue:"#3b82f6",orange:"#f97316",red:"#ef4444"},ce=["U","U'","U2","D","D'","D2","F","F'","F2","B","B'","B2","L","L'","L2","R","R'","R2"],Ke={F:"translateZ(72px)",B:"rotateY(180deg) translateZ(72px)",R:"rotateY(90deg) translateZ(72px)",L:"rotateY(-90deg) translateZ(72px)",U:"rotateX(90deg) translateZ(72px)",D:"rotateX(-90deg) translateZ(72px)"},Qe=["F","R","U","L","D","B"],be={x:-24,y:38},ee=18;function Je({cube:t,solved:s,onMove:a}){const[l,r]=o.useState(be),[c,S]=o.useState(null),d=o.useCallback((i,C)=>{r(h=>({x:he(h.x+i),y:h.y+C}))},[]),x=o.useCallback(()=>{r(be)},[]),f=o.useCallback(i=>{i.currentTarget.setPointerCapture(i.pointerId),S({pointerId:i.pointerId,startX:i.clientX,startY:i.clientY,rotation:l})},[l]),v=o.useCallback(i=>{if(!c||c.pointerId!==i.pointerId)return;const C=i.clientX-c.startX,h=i.clientY-c.startY;r({x:he(c.rotation.x-h*.35),y:c.rotation.y+C*.35})},[c]),p=o.useCallback(i=>{!c||c.pointerId!==i.pointerId||(i.currentTarget.hasPointerCapture(i.pointerId)&&i.currentTarget.releasePointerCapture(i.pointerId),S(null))},[c]);return e.jsxs("div",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 md:p-5 backdrop-blur-sm",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-white",children:"Cube State"}),e.jsx("p",{className:"text-[11px] text-slate-500",children:"Drag the 3D cube to rotate the view"})]}),e.jsx("span",{className:`rounded-full px-2.5 py-1 text-[10px] font-semibold ring-1 ${s?"bg-emerald-500/15 text-emerald-300 ring-emerald-500/30":"bg-amber-500/15 text-amber-300 ring-amber-500/30"}`,children:s?"Solved":"Scrambled"})]}),e.jsx("div",{className:"flex min-h-[290px] touch-none cursor-grab items-center justify-center overflow-hidden rounded-xl bg-slate-950/40 ring-1 ring-slate-800/60 active:cursor-grabbing",role:"img","aria-label":"Interactive 3D Rubik's Cube view. Drag to rotate the cube.",onPointerDown:f,onPointerMove:v,onPointerUp:p,onPointerCancel:p,children:e.jsxs("div",{className:"relative h-56 w-56",style:{perspective:"900px"},children:[e.jsx("div",{className:`absolute left-1/2 top-1/2 h-36 w-36 ${c?"":"transition-transform duration-500"}`,style:{transformStyle:"preserve-3d",transform:`translate(-50%, -50%) rotateX(${l.x}deg) rotateY(${l.y}deg) rotateZ(0deg)`},children:Qe.map(i=>e.jsxs("div",{className:"absolute left-0 top-0 grid h-36 w-36 grid-cols-3 gap-1 rounded-xl border border-slate-950/70 bg-slate-950/90 p-1.5 shadow-2xl",style:{transform:Ke[i],backfaceVisibility:"hidden"},"aria-label":`${Ze[i]} face`,children:[t[i].map((C,h)=>e.jsx("div",{className:"rounded-md border border-slate-950/50 shadow-inner transition-colors duration-300",style:{backgroundColor:He[C]}},`${i}-${h}`)),e.jsx("span",{className:"pointer-events-none absolute left-2 top-1 text-[10px] font-black text-slate-950/50",children:i})]},i))}),e.jsx("div",{className:"absolute bottom-2 left-1/2 h-8 w-40 -translate-x-1/2 rounded-full bg-black/30 blur-xl"})]})}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-[10px] text-slate-500",children:["View angle: X ",Math.round(l.x),"deg / Y ",Math.round(l.y),"deg"]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(W,{label:"Up",onClick:()=>d(-ee,0)}),e.jsx(W,{label:"Down",onClick:()=>d(ee,0)}),e.jsx(W,{label:"Left",onClick:()=>d(0,-ee)}),e.jsx(W,{label:"Right",onClick:()=>d(0,ee)}),e.jsx(W,{label:"Reset View",onClick:x})]})]}),e.jsxs("div",{className:"mt-5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Quick Turns"}),e.jsx("span",{className:"text-[10px] text-slate-600",children:"Clockwise / inverse / double"})]}),e.jsx("div",{className:"grid grid-cols-6 gap-1.5 sm:grid-cols-9",children:ce.map(i=>e.jsx("button",{onClick:()=>a(i),className:"rounded-lg bg-slate-800/70 px-2 py-1.5 text-[11px] font-semibold text-slate-300 ring-1 ring-slate-700/40 transition-all hover:bg-indigo-500/15 hover:text-indigo-300 hover:ring-indigo-500/30",children:i},i))})]})]})}function he(t){return Math.max(-75,Math.min(75,t))}function W({label:t,onClick:s}){return e.jsx("button",{onClick:s,className:"rounded-md bg-slate-800/70 px-2 py-1 text-[10px] font-semibold text-slate-400 ring-1 ring-slate-700/40 transition-all hover:bg-indigo-500/15 hover:text-indigo-300 hover:ring-indigo-500/30",children:t})}const et=o.memo(Je),tt={U:"white",D:"yellow",F:"green",B:"blue",L:"orange",R:"red"},de=["U","D","F","B","L","R"],st={U:[["F",[0,1,2]],["R",[0,1,2]],["B",[0,1,2]],["L",[0,1,2]]],D:[["F",[6,7,8]],["L",[6,7,8]],["B",[6,7,8]],["R",[6,7,8]]],F:[["U",[6,7,8]],["R",[0,3,6]],["D",[2,1,0]],["L",[8,5,2]]],B:[["U",[2,1,0]],["L",[0,3,6]],["D",[6,7,8]],["R",[8,5,2]]],L:[["U",[0,3,6]],["F",[0,3,6]],["D",[0,3,6]],["B",[8,5,2]]],R:[["U",[8,5,2]],["B",[0,3,6]],["D",[8,5,2]],["F",[8,5,2]]]};function U(){return de.reduce((t,s)=>(t[s]=Array(9).fill(tt[s]),t),{})}function ke(t){return de.reduce((s,a)=>(s[a]=[...t[a]],s),{})}function te(t){return de.every(s=>t[s].every(a=>a===t[s][4]))}function Z(t,s){return s.reduce((a,l)=>se(a,l),t)}function se(t,s){const a=s[0],l=s.endsWith("2")?2:s.endsWith("'")?3:1;let r=ke(t);for(let c=0;c{const r=ct(l,s.length);return{move:a,phase:r,description:`${r}: apply ${a} as part of the inverse solve sequence.`}})}function at(t,s){const a=ke(t);a[s]=ot(t[s]);const l=st[s],r=l.map(([c,S])=>S.map(d=>t[c][d]));return l.forEach(([c,S],d)=>{const x=r[(d+l.length-1)%l.length];S.forEach((f,v)=>{a[c][f]=x[v]})}),a}function ot(t){return[t[6],t[3],t[0],t[7],t[4],t[1],t[8],t[5],t[2]]}function rt(t){const s=[];for(const a of t){const l=s[s.length-1];if(!l||l[0]!==a[0]){s.push(a);continue}const r=(ve(l)+ve(a))%4;s.pop(),r!==0&&s.push(it(a[0],r))}return s}function ve(t){return t.endsWith("2")?2:t.endsWith("'")?3:1}function it(t,s){return s===2?`${t}2`:s===3?`${t}'`:t}function ct(t,s){if(s<=4)return["Cross","F2L","2-Look OLL","2-Look PLL"][t%4];const a=t/s;return a<.25?"Cross":a<.62?"F2L":a<.82?"2-Look OLL":"2-Look PLL"}const dt=["U","D","F","B","L","R"],fe=[{id:"starter-cross",title:"Starter Scramble",description:"A short scramble for practicing move notation and inverse solving.",scramble:["R","U","R'","U'"],targetMoves:4},{id:"six-move",title:"Six Move Sprint",description:"Solve a slightly longer scramble with clean inverse turns.",scramble:["F","R","U","R'","U'","F'"],targetMoves:6},{id:"middle-layer",title:"Middle Layer Drill",description:"A medium scramble that touches side faces and top-layer turns.",scramble:["L","U2","F","R'","D","B2","L'"],targetMoves:7},{id:"full-cube",title:"Full Cube Challenge",description:"A longer scramble that rewards using the solver and reading move notation.",scramble:["R","U","F2","L'","D","B","R2","U'","F","D'"],targetMoves:10}];function Ne(t){const s=[];let a="";for(;s.length0?t.join(" "):"None"}function we(t){const s=t.trim().toUpperCase().replace("’","'").replace(/I$/,"'");if(!s)return null;const a=s[0],l=s.slice(1);return!dt.includes(a)||l!==""&&l!=="'"&&l!=="2"?null:`${a}${l}`}function ut(t){const s=t.split(/[\s,]+/).map(l=>l.trim()).filter(Boolean);if(s.length===0)return null;const a=s.map(we);return a.some(l=>l===null)?null:a}function mt(t,s=25){const a=Math.max(1,Math.min(t,100)),l=Array.from({length:a},()=>{const d=Ne(s);return{scramble:d,solutionLength:le(d).length}}),r=l.reduce((d,x)=>x.solutionLengthx.solutionLength>d.solutionLength?x:d,l[0]),S=l.reduce((d,x)=>d+x.solutionLength,0)/l.length;return{runs:a,best:r,worst:c,averageLength:S}}function xt({mode:t,message:s,moveHistory:a,scrambleMoves:l,solution:r,solutionIndex:c,solutionDone:S,solverPlaybackMode:d,solverSpeed:x,manualMove:f,customScramble:v,simulationRuns:p,simulationResult:i,guidedStep:C,guidedScript:h,challenges:w,selectedChallenge:k,challengeStarted:ne,challengeMoves:H,challengeSolved:N,soundEnabled:V,onManualMoveChange:g,onCustomScrambleChange:ae,onSimulationRunsChange:j,onApplyManualMove:K,onScramble:Q,onApplyCustomScramble:$,onSimulateSolves:G,onGenerateSolution:_,onStepSolution:J,onAutoSolve:D,onSolverSpeedChange:A,onUndo:oe,onReset:L,onNextGuidedStep:X,onSelectChallenge:F,onStartChallenge:M,onToggleSound:Y}){const u=Math.max(0,z.findIndex(b=>b.id===x)),re=z[u]??z[1];return e.jsxs("aside",{className:"w-full space-y-4 md:w-80 md:shrink-0",children:[e.jsxs(B,{title:"Status",children:[e.jsx("p",{className:"text-xs leading-relaxed text-slate-300",children:s}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[e.jsx(O,{label:"Moves",value:a.length}),e.jsx(O,{label:"Solution",value:r.length>0?`${c}/${r.length}`:"-"})]})]}),t==="guided"&&e.jsxs(B,{title:"Guided Mode",children:[e.jsx("p",{className:"text-[11px] leading-relaxed text-slate-400",children:"Learn notation, scrambling, and CFOP-inspired phase labels step by step."}),e.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:"Reference style: Cross → F2L → 2-Look OLL → 2-Look PLL."}),e.jsxs("div",{className:"mt-3 rounded-xl border border-amber-500/20 bg-amber-500/5 p-3",children:[e.jsxs("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-amber-300",children:["Step ",C+1," / ",h.length]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-slate-300",children:h[C]})]}),e.jsx("button",{onClick:X,className:"mt-3 w-full rounded-lg bg-amber-500/20 px-3 py-2 text-xs font-semibold text-amber-300 ring-1 ring-amber-500/40 hover:bg-amber-500/30",children:"Continue Guided Step"})]}),t==="freeplay"&&e.jsxs(B,{title:"Freeplay Mode",children:[e.jsx(je,{value:f,onChange:g,onApply:K}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Custom scramble"}),e.jsx("textarea",{value:v,onChange:b=>ae(b.target.value),rows:2,placeholder:"R U R' U' or Ri U R U2",className:"mt-1 w-full resize-none rounded-lg bg-slate-950/70 px-3 py-2 text-xs font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-cyan-500/50"}),e.jsx("button",{onClick:$,className:"mt-2 w-full rounded-lg bg-violet-500/20 px-3 py-2 text-xs font-semibold text-violet-300 ring-1 ring-violet-500/40 hover:bg-violet-500/30",children:"Apply Custom Scramble"})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[e.jsx(T,{onClick:()=>Q(12),icon:e.jsx(xe,{size:13}),label:"12-Move Scramble"}),e.jsx(T,{onClick:()=>Q(25),icon:e.jsx(xe,{size:13}),label:"25-Move Scramble"}),e.jsx(T,{onClick:_,icon:e.jsx(ge,{size:13}),label:"Find Solution"}),e.jsx(T,{onClick:D,icon:e.jsx(pe,{size:13}),label:"Auto Run"}),e.jsx(T,{onClick:oe,label:"Undo"}),e.jsx(T,{onClick:L,icon:e.jsx(_e,{size:13}),label:"Reset"})]}),e.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Simulation runs"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("input",{type:"number",min:1,max:100,value:p,onChange:b=>j(Number(b.target.value)||1),className:"min-w-0 flex-1 rounded-lg bg-slate-950/70 px-3 py-2 text-sm font-mono text-slate-200 ring-1 ring-slate-700/50"}),e.jsx("button",{onClick:G,className:"rounded-lg bg-slate-800/70 px-3 py-2 text-xs font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70",children:"Run"})]})]})]}),t==="challenge"&&e.jsxs(B,{title:"Challenge Mode",children:[e.jsx("div",{className:"space-y-2",children:w.map(b=>e.jsxs("button",{onClick:()=>F(b),className:`w-full rounded-lg px-3 py-2 text-left ring-1 transition-all ${k.id===b.id?"bg-rose-500/15 text-rose-200 ring-rose-500/40":"bg-slate-800/50 text-slate-400 ring-slate-700/40 hover:bg-slate-700/50"}`,children:[e.jsx("div",{className:"text-xs font-semibold",children:b.title}),e.jsx("div",{className:"mt-0.5 text-[10px] text-slate-500",children:b.description})]},b.id))}),e.jsx("button",{onClick:()=>M(k),className:"mt-3 w-full rounded-lg bg-rose-500/20 px-3 py-2 text-xs font-semibold text-rose-300 ring-1 ring-rose-500/40 hover:bg-rose-500/30",children:"Start Challenge"}),ne&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx(je,{value:f,onChange:g,onApply:K}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(O,{label:"Your Moves",value:H}),e.jsx(O,{label:"Target",value:k.targetMoves})]}),N&&e.jsxs("div",{className:"rounded-lg bg-emerald-500/10 px-3 py-2 text-xs text-emerald-300 ring-1 ring-emerald-500/30",children:["Solved in ",H," moves."]})]})]}),e.jsxs(B,{title:"Solver",children:[e.jsxs("div",{className:"space-y-2 text-[11px] text-slate-400",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-slate-500",children:"Scramble:"})," ",R(l)]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-slate-500",children:"History:"})," ",R(a.slice(-12))]})]}),e.jsxs("div",{className:"mt-3 rounded-xl border border-slate-700/40 bg-slate-950/40 p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Playback"}),e.jsx("span",{className:"text-[10px] text-slate-500",children:re.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(Se,{label:"Manual Step",active:d==="manual",disabled:S||r.length===0,onClick:J}),e.jsx(Se,{label:"Auto",active:d==="auto",disabled:S||r.length===0&&a.length===0,onClick:D})]}),e.jsx("input",{type:"range",min:0,max:z.length-1,step:1,value:u,onChange:b=>{const m=z[Number(b.target.value)]?.id;m&&A(m)},className:"mt-3 w-full accent-indigo-400","aria-label":"Solver auto playback speed"}),e.jsx("div",{className:"mt-1 flex justify-between",children:z.map(b=>e.jsx("span",{className:`text-[9px] uppercase tracking-wide ${b.id===x?"text-indigo-300":"text-slate-600"}`,children:b.label},b.id))})]}),r.length>0&&e.jsx("div",{className:"mt-3 max-h-28 overflow-y-auto rounded-lg bg-slate-950/50 p-2",children:r.map((b,m)=>e.jsxs("div",{className:`flex items-center gap-2 rounded px-2 py-1 text-[11px] ${mY(!V),className:`inline-flex w-full items-center justify-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold ring-1 ${V?"bg-indigo-500/15 text-indigo-300 ring-indigo-500/30":"bg-slate-800/70 text-slate-400 ring-slate-700/40"}`,children:[V?e.jsx(Ge,{size:14}):e.jsx(Xe,{size:14}),V?"Sound On":"Sound Off"]})})]})}function B({title:t,children:s}){return e.jsxs("section",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"mb-3 text-[11px] font-semibold uppercase tracking-wider text-slate-400",children:t}),s]})}function O({label:t,value:s}){return e.jsxs("div",{className:"rounded-lg bg-slate-800/50 px-2.5 py-2 ring-1 ring-slate-700/40",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:t}),e.jsx("div",{className:"text-sm font-mono text-slate-100",children:s})]})}function T({label:t,icon:s,disabled:a,onClick:l}){return e.jsxs("button",{onClick:l,disabled:a,className:"inline-flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/70 px-3 py-2 text-[11px] font-semibold text-slate-300 ring-1 ring-slate-700/50 hover:bg-slate-700/70 disabled:cursor-not-allowed disabled:opacity-40",children:[s,t]})}function Se({label:t,active:s,disabled:a,onClick:l}){return e.jsx("button",{onClick:l,disabled:a,className:`rounded-lg px-3 py-2 text-[11px] font-semibold ring-1 transition-all disabled:cursor-not-allowed disabled:opacity-40 ${s?"bg-indigo-500/20 text-indigo-300 ring-indigo-500/40":"bg-slate-800/70 text-slate-300 ring-slate-700/50 hover:bg-slate-700/70"}`,children:t})}function je({value:t,onChange:s,onApply:a}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] text-slate-400",children:"Move notation"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("input",{value:t,onChange:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&a()},placeholder:"R, U', F2",className:"min-w-0 flex-1 rounded-lg bg-slate-950/70 px-3 py-2 text-sm font-mono text-slate-200 ring-1 ring-slate-700/50 outline-none focus:ring-cyan-500/50"}),e.jsx("button",{onClick:a,className:"rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-semibold text-cyan-300 ring-1 ring-cyan-500/40 hover:bg-cyan-500/30",children:"Apply"})]})]})}const pt=o.memo(xt);function gt(){const t=o.useRef(!0),[s,a]=o.useState(!0),l=o.useCallback(()=>Ye(),[]),r=o.useCallback((v,p,i="sine",C=.045)=>{if(!t.current)return;const h=l();if(!h)return;const w=h.createOscillator(),k=h.createGain();w.type=i,w.frequency.setValueAtTime(v,h.currentTime),k.gain.setValueAtTime(C,h.currentTime),k.gain.exponentialRampToValueAtTime(.001,h.currentTime+p),w.connect(k),k.connect(h.destination),w.start(h.currentTime),w.stop(h.currentTime+p)},[l]),c=o.useCallback(v=>{const p=[261.63,293.66,329.63,392,440,523.25];r(p[v%p.length],.08,"triangle",.035)},[r]),S=o.useCallback(()=>{r(196,.12,"sawtooth",.03),setTimeout(()=>r(246.94,.12,"sawtooth",.03),80)},[r]),d=o.useCallback(()=>{[392,493.88,587.33,783.99].forEach((v,p)=>{setTimeout(()=>r(v,.12,"sine",.05),p*75)})},[r]),x=o.useCallback(()=>{r(164.81,.18,"sawtooth",.035)},[r]),f=o.useCallback(v=>{t.current=v,a(v)},[]);return{soundEnabled:s,toggleSound:f,playMove:c,playScramble:S,playSolved:d,playError:x}}const ye=["Start from a solved cube and watch what a single R turn does.","Scramble the cube with a short sequence.","Ask the solver for the inverse sequence.","Step through solution moves and watch the cube return to solved state."];function Ce(t){return z.find(s=>s.id===t)?.delayMs??450}function bt(){const[t,s]=o.useState("guided"),[a,l]=o.useState(U),[r,c]=o.useState([]),[S,d]=o.useState([]),[x,f]=o.useState([]),[v,p]=o.useState(0),[i,C]=o.useState("R"),[h,w]=o.useState("R U R' U'"),[k,ne]=o.useState(10),[H,N]=o.useState(null),[V,g]=o.useState("Choose a mode and start turning the cube."),[ae,j]=o.useState("manual"),[K,Q]=o.useState("normal"),[$,G]=o.useState(0),[_,J]=o.useState(fe[0]),[D,A]=o.useState(!1),[oe,L]=o.useState(0),[X,F]=o.useState(!1),M=o.useRef(null),Y=o.useRef("normal"),u=gt(),re=o.useMemo(()=>te(a),[a]),b=x.length>0&&v>=x.length,m=o.useCallback(()=>{M.current&&(window.clearInterval(M.current),M.current=null)},[]);o.useEffect(()=>m,[m]);const Me=o.useCallback(n=>{Y.current=n,Q(n)},[]),Re=o.useCallback(()=>{m(),l(U()),c([]),d([]),f([]),p(0),N(null),j("manual"),G(0),A(!1),L(0),F(!1),g("Cube reset to solved state.")},[m]),Le=o.useCallback(n=>{s(n),m(),l(U()),c([]),d([]),f([]),p(0),N(null),j("manual"),G(0),A(!1),L(0),F(!1),g(n==="guided"?"Guided mode: follow the walkthrough to understand cube moves and solving.":n==="freeplay"?"Freeplay mode: scramble, turn, and solve however you like.":"Challenge mode: solve the scramble in as few moves as possible.")},[m]),q=o.useCallback((n,y=!0)=>{m(),j("manual"),l(E=>{const I=se(E,n);return y&&(c(P=>[...P,n]),t==="challenge"&&D&&!X&&(L(P=>P+1),te(I)&&(F(!0),g("Challenge solved! Compare your move count with the target."),u.playSolved()))),I}),f([]),p(0),N(null),u.playMove(n.charCodeAt(0))},[X,D,m,t,u]),Fe=o.useCallback((n=12)=>{m();const y=Ne(n);l(Z(U(),y)),c(y),d(y),f([]),p(0),j("manual"),A(!1),L(0),F(!1),g(`Scrambled with: ${R(y)}`),u.playScramble()},[m,u]),Ue=o.useCallback(()=>{m();const n=ut(h);if(!n){g("Invalid scramble. Use moves like: R U R' U' or Ri U R U2."),u.playError();return}l(Z(U(),n)),c(n),d(n),f([]),p(0),N(null),j("manual"),A(!1),L(0),F(!1),g(`Custom scramble applied: ${R(n)}`),u.playScramble()},[m,h,u]),Te=o.useCallback((n=_)=>{m(),J(n),l(Z(U(),n.scramble)),c(n.scramble),d(n.scramble),f([]),p(0),N(null),j("manual"),A(!0),L(0),F(!1),g(`Challenge started. Scramble: ${R(n.scramble)}`),u.playScramble()},[m,_,u]),$e=o.useCallback(()=>{m();const n=le(r);f(n),p(0),N(null),j("manual"),g(n.length>0?`Solver found ${n.length} inverse move${n.length===1?"":"s"}.`:"Cube is already solved."),n.length===0&&u.playSolved()},[m,r,u]),ie=o.useCallback(()=>{m(),j("manual");const n=x[v];n&&(l(y=>{const E=se(y,n.move);return te(E)?(g("Solved! The inverse sequence returned the cube to its original state."),u.playSolved()):g(n.description),E}),p(y=>y+1),u.playMove(v))},[m,x,v,u]),De=o.useCallback(()=>{m();const n=x.length>0?x:le(r),y=x.length>0?v:0;if(n.length===0){f([]),p(0),j("manual"),g("Cube is already solved."),u.playSolved();return}if(y>=n.length){j("manual"),g("Solution playback is already complete.");return}x.length===0&&(f(n),p(0)),N(null),j("auto"),g(`Auto-solving ${n.length-y} remaining move${n.length-y===1?"":"s"}.`);const E=()=>{p(I=>{const P=n[I];if(!P)return M.current=null,j("manual"),I;l(Be=>{const me=se(Be,P.move);return te(me)?(g("Auto-solve complete."),u.playSolved()):(g(P.description),u.playMove(I)),me});const ue=I+1;return ue{const n=we(i);if(!n){g("Invalid move. Use notation like R, U', F2, or L'."),u.playError();return}q(n),g(`Applied ${n}.`)},[q,i,u]),Ee=o.useCallback(()=>{const n=mt(k);N(n),g(`Ran ${n.runs} simulated solves. Best: ${n.best.solutionLength} moves, worst: ${n.worst.solutionLength} moves.`)},[k]),Ie=o.useCallback(()=>{const n=r.slice(0,-1);c(n),l(Z(U(),n)),f([]),p(0),j("manual"),g("Undid the last recorded move.")},[r]),Pe=o.useCallback(()=>{if($===0)q("R"),g("R turns the right face clockwise. Notice the side stickers move too.");else if($===1){const n=["R","U","R'","U'"];l(Z(U(),n)),c(n),d(n),g(`Short scramble applied: ${R(n)}`),u.playScramble()}else if($===2){const n=le(r);f(n),p(0),g(`The solver reverses the scramble: ${R(n.map(y=>y.move))}`)}else ie();G(n=>Math.min(n+1,ye.length-1))},[$,q,r,u,ie]);return{mode:t,cube:a,solved:re,moveHistory:r,scrambleMoves:S,solution:x,solutionIndex:v,solutionDone:b,solverPlaybackMode:ae,solverSpeed:K,setSolverSpeed:Me,manualMove:i,setManualMove:C,customScramble:h,setCustomScramble:w,simulationRuns:k,setSimulationRuns:ne,simulationResult:H,message:V,guidedStep:$,guidedScript:ye,selectedChallenge:_,setSelectedChallenge:J,challenges:fe,challengeStarted:D,challengeMoves:oe,challengeSolved:X,soundEnabled:u.soundEnabled,toggleSound:u.toggleSound,switchMode:Le,resetCube:Re,makeMove:q,runScramble:Fe,runCustomScramble:Ue,generateSolution:$e,stepSolution:ie,autoSolve:De,applyManualMove:Ae,undoLastMove:Ie,startChallenge:Te,nextGuidedStep:Pe,simulateSolves:Ee}}const ht=[{id:"guided",label:"Guided Mode",icon:e.jsx(Ve,{size:14})},{id:"freeplay",label:"Freeplay Mode",icon:e.jsx(ze,{size:14})},{id:"challenge",label:"Challenge Mode",icon:e.jsx(qe,{size:14})}];function Nt(){const t=bt();return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"shrink-0 border-b border-slate-700/50 bg-slate-900/40 px-4 pt-3 backdrop-blur-sm md:px-6",children:e.jsx("div",{className:"flex gap-1 overflow-x-auto",children:ht.map(s=>e.jsxs("button",{onClick:()=>t.switchMode(s.id),className:`flex items-center gap-1.5 whitespace-nowrap rounded-t-lg px-4 py-2.5 text-xs font-medium transition-all md:text-sm ${t.mode===s.id?"bg-slate-800/80 text-indigo-300 border border-b-0 border-slate-700/50 -mb-px":"text-slate-500 hover:bg-slate-800/30 hover:text-slate-300"}`,children:[s.icon,s.label]},s.id))})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-4 md:flex-row md:gap-6",children:[e.jsxs("main",{className:"order-last flex min-w-0 flex-1 flex-col gap-4 md:order-first",children:[e.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm md:p-5",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white md:text-xl",children:"Rubik's Cube Solver"}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-slate-400",children:"Manipulate a 3D Rubik's Cube, generate or enter scrambles, and watch a CFOP-inspired solve sequence step by step."})]}),e.jsx("div",{className:"rounded-full bg-violet-500/10 px-3 py-1 text-[10px] font-semibold text-violet-300 ring-1 ring-violet-500/30",children:"3D Cube"})]}),e.jsx("div",{className:"mt-3 rounded-xl bg-indigo-500/5 px-3 py-2 ring-1 ring-indigo-500/15",children:e.jsxs("p",{className:"text-[11px] leading-relaxed text-slate-300",children:["Move notation: ",e.jsx("span",{className:"font-mono text-cyan-300",children:"R"})," turns a face clockwise,",e.jsx("span",{className:"font-mono text-cyan-300",children:" R'"})," turns it counter-clockwise, and",e.jsx("span",{className:"font-mono text-cyan-300",children:" R2"})," turns it twice. The inverse shorthand",e.jsx("span",{className:"font-mono text-cyan-300",children:" Ri"})," is also accepted."]})})]}),e.jsx(et,{cube:t.cube,solved:t.solved,onMove:t.makeMove})]}),e.jsx(pt,{mode:t.mode,message:t.message,moveHistory:t.moveHistory,scrambleMoves:t.scrambleMoves,solution:t.solution,solutionIndex:t.solutionIndex,solutionDone:t.solutionDone,solverPlaybackMode:t.solverPlaybackMode,solverSpeed:t.solverSpeed,manualMove:t.manualMove,customScramble:t.customScramble,simulationRuns:t.simulationRuns,simulationResult:t.simulationResult,guidedStep:t.guidedStep,guidedScript:t.guidedScript,challenges:t.challenges,selectedChallenge:t.selectedChallenge,challengeStarted:t.challengeStarted,challengeMoves:t.challengeMoves,challengeSolved:t.challengeSolved,soundEnabled:t.soundEnabled,onManualMoveChange:t.setManualMove,onCustomScrambleChange:t.setCustomScramble,onSimulationRunsChange:t.setSimulationRuns,onApplyManualMove:t.applyManualMove,onScramble:t.runScramble,onApplyCustomScramble:t.runCustomScramble,onSimulateSolves:t.simulateSolves,onGenerateSolution:t.generateSolution,onStepSolution:t.stepSolution,onAutoSolve:t.autoSolve,onSolverSpeedChange:t.setSolverSpeed,onUndo:t.undoLastMove,onReset:t.resetCube,onNextGuidedStep:t.nextGuidedStep,onSelectChallenge:t.setSelectedChallenge,onStartChallenge:t.startChallenge,onToggleSound:t.toggleSound})]})})]})}export{Nt as default}; diff --git a/docs/assets/SortingPage-DY4J_cuF.js b/docs/assets/SortingPage-BJLOOKGn.js similarity index 98% rename from docs/assets/SortingPage-DY4J_cuF.js rename to docs/assets/SortingPage-BJLOOKGn.js index 258dc22..55a5d9b 100644 --- a/docs/assets/SortingPage-DY4J_cuF.js +++ b/docs/assets/SortingPage-BJLOOKGn.js @@ -1,4 +1,4 @@ -import{r as n,j as e,d as _}from"./index-lLadk08S.js";import{V as H,a as L}from"./volume-x-CjLNPeax.js";import{S as Q}from"./square-QnQTkqqU.js";import{S as W}from"./shuffle-ADbBlETg.js";import{r as X}from"./index-iw_6MvvU.js";import{g as J}from"./audioContext-NbgqvQGz.js";function K(s,d,o,y){return o&&(s===o[0]||s===o[1])?"bg-rose-500 shadow-lg shadow-rose-500/30":d&&(s===d[0]||s===d[1])?"bg-amber-400 shadow-lg shadow-amber-400/20":y.includes(s)?"bg-emerald-500":"bg-indigo-400/80"}function Y({array:s,comparing:d,swapping:o,sortedIndices:y}){const g=Math.max(...s,1),x=Math.max(2,Math.min(20,Math.floor(900/s.length)-1));return e.jsx("div",{className:"flex h-[500px] items-end justify-center gap-[1px] rounded-xl border border-slate-700/50 bg-slate-950/80 p-6 backdrop-blur-sm shadow-2xl",children:s.map((a,r)=>{const h=a/g*100,t=K(r,d,o,y);return e.jsx("div",{className:`transition-all duration-75 rounded-t-sm ${t}`,style:{height:`${h}%`,width:`${x}px`}},r)})})}const Z=n.memo(Y),ee={slow:100,medium:30,fast:8,instant:0},R={bubble:{name:"Bubble Sort",description:"Repeatedly swaps adjacent elements if they are in the wrong order. Simple but inefficient for large datasets.",timeComplexity:"O(n²)",spaceComplexity:"O(1)",stable:!0},selection:{name:"Selection Sort",description:"Finds the minimum element and places it at the beginning. Performs well on small arrays.",timeComplexity:"O(n²)",spaceComplexity:"O(1)",stable:!1},insertion:{name:"Insertion Sort",description:"Builds the sorted array one element at a time by inserting each into its correct position.",timeComplexity:"O(n²)",spaceComplexity:"O(1)",stable:!0},quick:{name:"Quick Sort",description:"Divides the array using a pivot and recursively sorts the partitions. Very efficient in practice.",timeComplexity:"O(n log n)",spaceComplexity:"O(log n)",stable:!1},heap:{name:"Heap Sort",description:"Builds a max-heap then repeatedly extracts the maximum to build the sorted array.",timeComplexity:"O(n log n)",spaceComplexity:"O(1)",stable:!1},merge:{name:"Merge Sort",description:"Divides the array in half, recursively sorts, then merges. Guarantees consistent performance.",timeComplexity:"O(n log n)",spaceComplexity:"O(n)",stable:!0}},te=["bubble","selection","insertion","quick","heap","merge"],se=["slow","medium","fast","instant"];function ae({algorithm:s,setAlgorithm:d,speed:o,setSpeed:y,arraySize:g,changeArraySize:x,isRunning:a,isFinished:r,currentStep:h,totalSteps:t,soundEnabled:u,onToggleSound:i,onVisualize:f,onStop:c,onGenerateNewArray:S}){const p=R[s];return e.jsxs("div",{className:"flex flex-col gap-5 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Algorithm"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:te.map(l=>e.jsx("button",{onClick:()=>!a&&d(l),disabled:a,className:` +import{r as n,j as e,d as _}from"./index-CB1-0H6I.js";import{V as H,a as L}from"./volume-x-CKT6TOtL.js";import{S as Q}from"./square-B4KY3il9.js";import{S as W}from"./shuffle-DZnyoAGL.js";import{r as X}from"./index-iw_6MvvU.js";import{g as J}from"./audioContext-NbgqvQGz.js";function K(s,d,o,y){return o&&(s===o[0]||s===o[1])?"bg-rose-500 shadow-lg shadow-rose-500/30":d&&(s===d[0]||s===d[1])?"bg-amber-400 shadow-lg shadow-amber-400/20":y.includes(s)?"bg-emerald-500":"bg-indigo-400/80"}function Y({array:s,comparing:d,swapping:o,sortedIndices:y}){const g=Math.max(...s,1),x=Math.max(2,Math.min(20,Math.floor(900/s.length)-1));return e.jsx("div",{className:"flex h-[500px] items-end justify-center gap-[1px] rounded-xl border border-slate-700/50 bg-slate-950/80 p-6 backdrop-blur-sm shadow-2xl",children:s.map((a,r)=>{const h=a/g*100,t=K(r,d,o,y);return e.jsx("div",{className:`transition-all duration-75 rounded-t-sm ${t}`,style:{height:`${h}%`,width:`${x}px`}},r)})})}const Z=n.memo(Y),ee={slow:100,medium:30,fast:8,instant:0},R={bubble:{name:"Bubble Sort",description:"Repeatedly swaps adjacent elements if they are in the wrong order. Simple but inefficient for large datasets.",timeComplexity:"O(n²)",spaceComplexity:"O(1)",stable:!0},selection:{name:"Selection Sort",description:"Finds the minimum element and places it at the beginning. Performs well on small arrays.",timeComplexity:"O(n²)",spaceComplexity:"O(1)",stable:!1},insertion:{name:"Insertion Sort",description:"Builds the sorted array one element at a time by inserting each into its correct position.",timeComplexity:"O(n²)",spaceComplexity:"O(1)",stable:!0},quick:{name:"Quick Sort",description:"Divides the array using a pivot and recursively sorts the partitions. Very efficient in practice.",timeComplexity:"O(n log n)",spaceComplexity:"O(log n)",stable:!1},heap:{name:"Heap Sort",description:"Builds a max-heap then repeatedly extracts the maximum to build the sorted array.",timeComplexity:"O(n log n)",spaceComplexity:"O(1)",stable:!1},merge:{name:"Merge Sort",description:"Divides the array in half, recursively sorts, then merges. Guarantees consistent performance.",timeComplexity:"O(n log n)",spaceComplexity:"O(n)",stable:!0}},te=["bubble","selection","insertion","quick","heap","merge"],se=["slow","medium","fast","instant"];function ae({algorithm:s,setAlgorithm:d,speed:o,setSpeed:y,arraySize:g,changeArraySize:x,isRunning:a,isFinished:r,currentStep:h,totalSteps:t,soundEnabled:u,onToggleSound:i,onVisualize:f,onStop:c,onGenerateNewArray:S}){const p=R[s];return e.jsxs("div",{className:"flex flex-col gap-5 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Algorithm"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:te.map(l=>e.jsx("button",{onClick:()=>!a&&d(l),disabled:a,className:` rounded-lg px-3 py-2 text-sm font-medium transition-all duration-200 ${s===l?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40 shadow-lg shadow-indigo-500/10":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50 hover:text-slate-300"} disabled:opacity-50 disabled:cursor-not-allowed diff --git a/docs/assets/StackPage-B2mxdyxa.js b/docs/assets/StackPage-CCdc4dwi.js similarity index 97% rename from docs/assets/StackPage-B2mxdyxa.js rename to docs/assets/StackPage-CCdc4dwi.js index 237d3ba..41f0d7d 100644 --- a/docs/assets/StackPage-B2mxdyxa.js +++ b/docs/assets/StackPage-CCdc4dwi.js @@ -1,4 +1,4 @@ -import{r as l,j as e,E as W}from"./index-lLadk08S.js";import{u as _}from"./useDSSound-CPhif-bj.js";import{P as X}from"./plus-NICMDkhr.js";import{T as q}from"./trash-2-veeiSg5V.js";import{R as B}from"./rotate-ccw-DMjSdzg2.js";import{S as J}from"./shuffle-ADbBlETg.js";import{V as Q,a as U}from"./volume-x-CjLNPeax.js";import{C as Y,a as Z}from"./chevron-right-Cp_zyb7b.js";import"./audioContext-NbgqvQGz.js";let P=1;const ee=[{id:P++,value:3},{id:P++,value:7},{id:P++,value:1}];function te(){const[i,d]=l.useState(ee),[n,u]=l.useState([]),[r,o]=l.useState(-1),[b,j]=l.useState(""),[k,v]=l.useState([]),[h,T]=l.useState(400),[y,p]=l.useState(!1),x=l.useRef(null),w=l.useRef(h),f=l.useRef(!1),{soundEnabled:$,toggleSound:z,playInsert:m,playDelete:N,playAccess:S,playTraverse:I}=_(),a=l.useRef(()=>{});l.useEffect(()=>{w.current=h},[h]),l.useEffect(()=>{if(!f.current||n.length===0)return;f.current=!1,x.current&&clearTimeout(x.current),p(!0);let t=0;const s=()=>{if(t>=n.length-1){p(!1);return}t++,o(t),a.current(t,n),x.current=setTimeout(s,w.current)};x.current=setTimeout(s,w.current)},[n]);const g=l.useCallback((t,s)=>{const c=s[t];c&&(c.highlightColor==="green"?m():c.highlightColor==="red"?N():c.highlightColor==="yellow"&&I(t,s.length))},[m,N,I]);l.useEffect(()=>{a.current=g},[g]);const O=r>=0&&n[r]?n[r].stack:i,L=r>=0?n[r]:null,C=t=>v(s=>[t,...s].slice(0,20)),M=l.useCallback(t=>{const s={id:P++,value:t},c=[];d(E=>{c.push({description:`Pushing ${t} onto the stack...`,stack:E,highlightIndex:null,highlightColor:null});const R=[...E,s];return c.push({description:`${t} placed on top of the stack. Stack size: ${R.length}`,stack:R,highlightIndex:R.length-1,highlightColor:"green"}),u(c),o(0),f.current=!0,m(),C(`Push ${t}`),R})},[m]),H=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[t.length-1],c=[{description:`Peeking at top element: ${s.value}`,stack:t,highlightIndex:t.length-1,highlightColor:"yellow"},{description:`Popping ${s.value} from the top of the stack.`,stack:t,highlightIndex:t.length-1,highlightColor:"red"},{description:`${s.value} removed. Stack size: ${t.length-1}`,stack:t.slice(0,-1),highlightIndex:null,highlightColor:null}];return u(c),o(0),f.current=!0,N(),C(`Pop → ${s.value}`),t.slice(0,-1)})},[N]),V=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[t.length-1],c=[{description:"Peek: reading the top element without removing it.",stack:t,highlightIndex:t.length-1,highlightColor:"yellow"},{description:`Top element is ${s.value}.`,stack:t,highlightIndex:t.length-1,highlightColor:"yellow"}];return u(c),o(0),f.current=!0,S(),C(`Peek → ${s.value}`),t})},[S]),A=l.useCallback(()=>{d([]),u([]),o(-1),C("Clear stack")},[]),G=l.useCallback(()=>{const t=Math.floor(Math.random()*5)+3,s=Array.from({length:t},()=>({id:P++,value:Math.floor(Math.random()*90)+1}));d(s),u([]),o(-1),C("Random stack")},[]),D=l.useCallback(()=>{o(t=>{const s=Math.min(t+1,n.length-1);return g(s,n),s})},[n,g]),F=l.useCallback(()=>{o(t=>Math.max(t-1,0))},[]),K=l.useCallback(()=>{if(y){p(!1),x.current&&clearTimeout(x.current);return}p(!0);let t=r;const s=()=>{if(t>=n.length-1){p(!1);return}t++,o(t),g(t,n),x.current=setTimeout(s,h)};x.current=setTimeout(s,h)},[y,r,n,h,g]);return{stack:i,displayStack:O,steps:n,stepIndex:r,currentStep:L,inputValue:b,setInputValue:j,history:k,speed:h,setSpeed:T,isPlaying:y,push:M,pop:H,peek:V,clear:A,generateRandom:G,nextStep:D,prevStep:F,autoPlay:K,soundEnabled:$,toggleSound:z,canGoNext:r0}}const se={green:"border-emerald-400 bg-emerald-500/20 text-emerald-300",red:"border-rose-400 bg-rose-500/20 text-rose-300",yellow:"border-amber-400 bg-amber-500/20 text-amber-300"};function le({stack:i,currentStep:d}){const n=i.slice(-12),u=d?.highlightIndex??null,r=d?.highlightColor??null;return e.jsxs("div",{className:"flex flex-col items-center justify-end w-full h-full min-h-[300px] md:min-h-[400px] gap-1 pb-6",children:[i.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 text-slate-600",children:[e.jsx("div",{className:"w-32 h-24 border-2 border-dashed border-slate-700 rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-xs",children:"Empty Stack"})}),e.jsx("div",{className:"w-32 border-b-2 border-slate-600"})]}),e.jsx("div",{className:"flex flex-col-reverse items-center gap-1.5 w-full max-w-[200px]",children:n.map((o,b)=>{const j=i.length-n.length+b,k=j===u,v=j===i.length-1;return e.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[v&&e.jsx("span",{className:"absolute -right-14 text-xs font-mono text-indigo-400 whitespace-nowrap",children:"← top"}),e.jsx("div",{className:` +import{r as l,j as e,E as W}from"./index-CB1-0H6I.js";import{u as _}from"./useDSSound-BJYLYD0f.js";import{P as X}from"./plus-B3nnW8Th.js";import{T as q}from"./trash-2-C4vvSjjZ.js";import{R as B}from"./rotate-ccw-CDlWXRsI.js";import{S as J}from"./shuffle-DZnyoAGL.js";import{V as Q,a as U}from"./volume-x-CKT6TOtL.js";import{C as Y,a as Z}from"./chevron-right-ChVmoNtO.js";import"./audioContext-NbgqvQGz.js";let P=1;const ee=[{id:P++,value:3},{id:P++,value:7},{id:P++,value:1}];function te(){const[i,d]=l.useState(ee),[n,u]=l.useState([]),[r,o]=l.useState(-1),[b,j]=l.useState(""),[k,v]=l.useState([]),[h,T]=l.useState(400),[y,p]=l.useState(!1),x=l.useRef(null),w=l.useRef(h),f=l.useRef(!1),{soundEnabled:$,toggleSound:z,playInsert:m,playDelete:N,playAccess:S,playTraverse:I}=_(),a=l.useRef(()=>{});l.useEffect(()=>{w.current=h},[h]),l.useEffect(()=>{if(!f.current||n.length===0)return;f.current=!1,x.current&&clearTimeout(x.current),p(!0);let t=0;const s=()=>{if(t>=n.length-1){p(!1);return}t++,o(t),a.current(t,n),x.current=setTimeout(s,w.current)};x.current=setTimeout(s,w.current)},[n]);const g=l.useCallback((t,s)=>{const c=s[t];c&&(c.highlightColor==="green"?m():c.highlightColor==="red"?N():c.highlightColor==="yellow"&&I(t,s.length))},[m,N,I]);l.useEffect(()=>{a.current=g},[g]);const O=r>=0&&n[r]?n[r].stack:i,L=r>=0?n[r]:null,C=t=>v(s=>[t,...s].slice(0,20)),M=l.useCallback(t=>{const s={id:P++,value:t},c=[];d(E=>{c.push({description:`Pushing ${t} onto the stack...`,stack:E,highlightIndex:null,highlightColor:null});const R=[...E,s];return c.push({description:`${t} placed on top of the stack. Stack size: ${R.length}`,stack:R,highlightIndex:R.length-1,highlightColor:"green"}),u(c),o(0),f.current=!0,m(),C(`Push ${t}`),R})},[m]),H=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[t.length-1],c=[{description:`Peeking at top element: ${s.value}`,stack:t,highlightIndex:t.length-1,highlightColor:"yellow"},{description:`Popping ${s.value} from the top of the stack.`,stack:t,highlightIndex:t.length-1,highlightColor:"red"},{description:`${s.value} removed. Stack size: ${t.length-1}`,stack:t.slice(0,-1),highlightIndex:null,highlightColor:null}];return u(c),o(0),f.current=!0,N(),C(`Pop → ${s.value}`),t.slice(0,-1)})},[N]),V=l.useCallback(()=>{d(t=>{if(t.length===0)return t;const s=t[t.length-1],c=[{description:"Peek: reading the top element without removing it.",stack:t,highlightIndex:t.length-1,highlightColor:"yellow"},{description:`Top element is ${s.value}.`,stack:t,highlightIndex:t.length-1,highlightColor:"yellow"}];return u(c),o(0),f.current=!0,S(),C(`Peek → ${s.value}`),t})},[S]),A=l.useCallback(()=>{d([]),u([]),o(-1),C("Clear stack")},[]),G=l.useCallback(()=>{const t=Math.floor(Math.random()*5)+3,s=Array.from({length:t},()=>({id:P++,value:Math.floor(Math.random()*90)+1}));d(s),u([]),o(-1),C("Random stack")},[]),D=l.useCallback(()=>{o(t=>{const s=Math.min(t+1,n.length-1);return g(s,n),s})},[n,g]),F=l.useCallback(()=>{o(t=>Math.max(t-1,0))},[]),K=l.useCallback(()=>{if(y){p(!1),x.current&&clearTimeout(x.current);return}p(!0);let t=r;const s=()=>{if(t>=n.length-1){p(!1);return}t++,o(t),g(t,n),x.current=setTimeout(s,h)};x.current=setTimeout(s,h)},[y,r,n,h,g]);return{stack:i,displayStack:O,steps:n,stepIndex:r,currentStep:L,inputValue:b,setInputValue:j,history:k,speed:h,setSpeed:T,isPlaying:y,push:M,pop:H,peek:V,clear:A,generateRandom:G,nextStep:D,prevStep:F,autoPlay:K,soundEnabled:$,toggleSound:z,canGoNext:r0}}const se={green:"border-emerald-400 bg-emerald-500/20 text-emerald-300",red:"border-rose-400 bg-rose-500/20 text-rose-300",yellow:"border-amber-400 bg-amber-500/20 text-amber-300"};function le({stack:i,currentStep:d}){const n=i.slice(-12),u=d?.highlightIndex??null,r=d?.highlightColor??null;return e.jsxs("div",{className:"flex flex-col items-center justify-end w-full h-full min-h-[300px] md:min-h-[400px] gap-1 pb-6",children:[i.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 text-slate-600",children:[e.jsx("div",{className:"w-32 h-24 border-2 border-dashed border-slate-700 rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-xs",children:"Empty Stack"})}),e.jsx("div",{className:"w-32 border-b-2 border-slate-600"})]}),e.jsx("div",{className:"flex flex-col-reverse items-center gap-1.5 w-full max-w-[200px]",children:n.map((o,b)=>{const j=i.length-n.length+b,k=j===u,v=j===i.length-1;return e.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[v&&e.jsx("span",{className:"absolute -right-14 text-xs font-mono text-indigo-400 whitespace-nowrap",children:"← top"}),e.jsx("div",{className:` flex-1 flex items-center justify-center rounded-lg border-2 h-12 font-bold text-lg transition-all duration-300 ${k&&r?se[r]:"border-slate-600 bg-slate-800/60 text-slate-200"} diff --git a/docs/assets/SudokuPage-D621aJ2E.js b/docs/assets/SudokuPage-Twa08t7Q.js similarity index 98% rename from docs/assets/SudokuPage-D621aJ2E.js rename to docs/assets/SudokuPage-Twa08t7Q.js index fa1dca8..5f24a2e 100644 --- a/docs/assets/SudokuPage-D621aJ2E.js +++ b/docs/assets/SudokuPage-Twa08t7Q.js @@ -1,4 +1,4 @@ -import{c as R,r as m,j as e}from"./index-lLadk08S.js";import{C as Y,a as ee}from"./chevron-right-Cp_zyb7b.js";import{Z as te}from"./zap-Y8cI0o9G.js";import{S as se}from"./shuffle-ADbBlETg.js";import{R as re}from"./rotate-ccw-DMjSdzg2.js";const le=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ne=R("circle-check",le);const oe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ae=R("loader-circle",oe);const ie=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],ce=R("lock",ie);const de=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ue=R("pen-line",de);const xe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],me=R("pencil",xe),I={4:{label:"4×4",boxRows:2,boxCols:2,difficulty:"Easy"},9:{label:"9×9",boxRows:3,boxCols:3,difficulty:"Standard"},16:{label:"16×16",boxRows:4,boxCols:4,difficulty:"Hard"}};function E(s){return I[s]}function fe(s){return s===4?"w-16 h-16 text-2xl":s===9?"w-12 h-12 text-lg":"w-8 h-8 text-[11px]"}function pe(s,t){return s===null?"":t<=9?String(s):s.toString(16).toUpperCase()}function be({grid:s,gridSize:t,isEditing:n,selectedCell:r,onCellClick:l,onCellValueChange:o}){const{boxRows:i,boxCols:a}=E(t),d=fe(t),c=m.useRef(null),h=m.useCallback(b=>{if(!n||!r)return;const{row:p,col:f}=r;if(b.key==="Backspace"||b.key==="Delete"||b.key==="0"){o(p,f,null);return}if(b.key==="ArrowUp"&&p>0){l(p-1,f);return}if(b.key==="ArrowDown"&&p0){l(p,f-1);return}if(b.key==="ArrowRight"&&f=1&&x<=t&&o(p,f,x)}else{const x=parseInt(b.key,16);!isNaN(x)&&x>=1&&x<=t&&o(p,f,x)}},[n,r,t,l,o]);m.useEffect(()=>(window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)),[h]),m.useEffect(()=>{n&&r&&c.current&&c.current.focus()},[n,r]);const g=m.useCallback(b=>{if(!n||!r)return;const p=b.currentTarget.value;if(b.currentTarget.value="",!p)return;const f=p.slice(-1);if(f==="0"){o(r.row,r.col,null);return}if(t<=9){const x=parseInt(f);!isNaN(x)&&x>=1&&x<=t&&o(r.row,r.col,x)}else{const x=parseInt(f,16);!isNaN(x)&&x>=1&&x<=t&&o(r.row,r.col,x)}},[n,r,t,o]),S=m.useCallback((b,p)=>{n&&(l(b,p),setTimeout(()=>c.current?.focus(),0))},[n,l]);return e.jsxs("div",{className:"relative",children:[n&&e.jsx("input",{ref:c,type:"text",inputMode:"numeric",autoComplete:"off",className:"absolute opacity-0 w-0 h-0 pointer-events-none",onInput:g,"aria-label":"Sudoku cell input"}),e.jsx("div",{className:"inline-grid rounded-xl border-2 border-slate-500/60 bg-slate-950/80 backdrop-blur-sm shadow-2xl overflow-hidden",style:{gridTemplateColumns:`repeat(${t}, 1fr)`},children:s.map((b,p)=>b.map((f,x)=>{const N=(x+1)%a===0&&xS(p,x),className:` +import{c as R,r as m,j as e}from"./index-CB1-0H6I.js";import{C as Y,a as ee}from"./chevron-right-ChVmoNtO.js";import{Z as te}from"./zap-C3nU9HZ_.js";import{S as se}from"./shuffle-DZnyoAGL.js";import{R as re}from"./rotate-ccw-CDlWXRsI.js";const le=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ne=R("circle-check",le);const oe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ae=R("loader-circle",oe);const ie=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],ce=R("lock",ie);const de=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ue=R("pen-line",de);const xe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],me=R("pencil",xe),I={4:{label:"4×4",boxRows:2,boxCols:2,difficulty:"Easy"},9:{label:"9×9",boxRows:3,boxCols:3,difficulty:"Standard"},16:{label:"16×16",boxRows:4,boxCols:4,difficulty:"Hard"}};function E(s){return I[s]}function fe(s){return s===4?"w-16 h-16 text-2xl":s===9?"w-12 h-12 text-lg":"w-8 h-8 text-[11px]"}function pe(s,t){return s===null?"":t<=9?String(s):s.toString(16).toUpperCase()}function be({grid:s,gridSize:t,isEditing:n,selectedCell:r,onCellClick:l,onCellValueChange:o}){const{boxRows:i,boxCols:a}=E(t),d=fe(t),c=m.useRef(null),h=m.useCallback(b=>{if(!n||!r)return;const{row:p,col:f}=r;if(b.key==="Backspace"||b.key==="Delete"||b.key==="0"){o(p,f,null);return}if(b.key==="ArrowUp"&&p>0){l(p-1,f);return}if(b.key==="ArrowDown"&&p0){l(p,f-1);return}if(b.key==="ArrowRight"&&f=1&&x<=t&&o(p,f,x)}else{const x=parseInt(b.key,16);!isNaN(x)&&x>=1&&x<=t&&o(p,f,x)}},[n,r,t,l,o]);m.useEffect(()=>(window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)),[h]),m.useEffect(()=>{n&&r&&c.current&&c.current.focus()},[n,r]);const g=m.useCallback(b=>{if(!n||!r)return;const p=b.currentTarget.value;if(b.currentTarget.value="",!p)return;const f=p.slice(-1);if(f==="0"){o(r.row,r.col,null);return}if(t<=9){const x=parseInt(f);!isNaN(x)&&x>=1&&x<=t&&o(r.row,r.col,x)}else{const x=parseInt(f,16);!isNaN(x)&&x>=1&&x<=t&&o(r.row,r.col,x)}},[n,r,t,o]),S=m.useCallback((b,p)=>{n&&(l(b,p),setTimeout(()=>c.current?.focus(),0))},[n,l]);return e.jsxs("div",{className:"relative",children:[n&&e.jsx("input",{ref:c,type:"text",inputMode:"numeric",autoComplete:"off",className:"absolute opacity-0 w-0 h-0 pointer-events-none",onInput:g,"aria-label":"Sudoku cell input"}),e.jsx("div",{className:"inline-grid rounded-xl border-2 border-slate-500/60 bg-slate-950/80 backdrop-blur-sm shadow-2xl overflow-hidden",style:{gridTemplateColumns:`repeat(${t}, 1fr)`},children:s.map((b,p)=>b.map((f,x)=>{const N=(x+1)%a===0&&xS(p,x),className:` ${d} flex items-center justify-center border border-slate-800/40 ${N?"border-r-2 border-r-slate-500/60":""} diff --git a/docs/assets/TreeTraversalPage-CXh2nfI3.js b/docs/assets/TreeTraversalPage-CzjDdla1.js similarity index 97% rename from docs/assets/TreeTraversalPage-CXh2nfI3.js rename to docs/assets/TreeTraversalPage-CzjDdla1.js index 0287097..5dd89c8 100644 --- a/docs/assets/TreeTraversalPage-CXh2nfI3.js +++ b/docs/assets/TreeTraversalPage-CzjDdla1.js @@ -1,4 +1,4 @@ -import{r as a,j as e}from"./index-lLadk08S.js";import{V as oe,a as ce}from"./volume-x-CjLNPeax.js";import{C as de,a as ue}from"./chevron-right-Cp_zyb7b.js";import{P as xe}from"./play-b2ZiatJ3.js";import{S as me}from"./square-QnQTkqqU.js";import{S as fe}from"./shuffle-ADbBlETg.js";import{R as pe}from"./rotate-ccw-DMjSdzg2.js";import{g as he}from"./audioContext-NbgqvQGz.js";let H=0;function J(t){return{id:H++,value:t,left:null,right:null,x:0,y:0}}function L(t,s){return t?(Math.random()<.5?t.left=L(t.left,s):t.right=L(t.right,s),t):J(s)}function _(t){if(H=0,t<=0)return null;const s=Array.from({length:t},(r,m)=>m+1);for(let r=s.length-1;r>0;r--){const m=Math.floor(Math.random()*(r+1));[s[r],s[m]]=[s[m],s[r]]}let n=null;for(const r of s)n?n=L(n,r):n=J(r);return n&&q(n,0,0,300),n}function q(t,s,n,r){t&&(t.x=n,t.y=s*70,q(t.left,s+1,n-r,r*.55),q(t.right,s+1,n+r,r*.55))}function K(t){const s=[];function n(r){r&&(s.push(r),n(r.left),n(r.right))}return n(t),s}function ge(t){const s=[];function n(r){r&&(r.left&&(s.push({from:r,to:r.left}),n(r.left)),r.right&&(s.push({from:r,to:r.right}),n(r.right)))}return n(t),s}function be({root:t,visitedIds:s,processedIds:n,currentId:r,processOrder:m}){const v=a.useMemo(()=>K(t),[t]),c=a.useMemo(()=>ge(t),[t]),x=Math.min(...v.map(l=>l.x),0)-40,i=Math.max(...v.map(l=>l.x),0)+40,f=Math.max(...v.map(l=>l.y),0)+40,d=i-x+80,u=f+80;return t?e.jsx("div",{className:"flex-1 w-full rounded-xl border border-slate-700/50 bg-slate-950/80 p-4 shadow-2xl backdrop-blur-sm overflow-auto",children:e.jsxs("svg",{viewBox:`${x-40} -20 ${d} ${u}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[c.map((l,p)=>e.jsx("line",{x1:l.from.x,y1:l.from.y,x2:l.to.x,y2:l.to.y,stroke:n.has(l.from.id)&&n.has(l.to.id)?"#818cf8":s.has(l.from.id)&&s.has(l.to.id)?"#64748b":"#334155",strokeWidth:2,strokeOpacity:.6},p)),v.map(l=>{const p=l.id===r,S=n.has(l.id),y=s.has(l.id),k=m.indexOf(l.id);let j="#1e293b",N="#475569",w="#94a3b8";return p?(j="#fbbf24",N="#f59e0b",w="#1e293b"):S?(j="#6366f1",N="#818cf8",w="#ffffff"):y&&(j="#334155",N="#64748b",w="#cbd5e1"),e.jsxs("g",{children:[e.jsx("circle",{cx:l.x,cy:l.y,r:22,fill:j,stroke:N,strokeWidth:2.5,className:"transition-all duration-200"}),e.jsx("text",{x:l.x,y:l.y+1,textAnchor:"middle",dominantBaseline:"central",fill:w,fontSize:12,fontWeight:600,fontFamily:"ui-monospace, monospace",children:l.value}),k>=0&&e.jsx("text",{x:l.x+18,y:l.y-18,textAnchor:"middle",dominantBaseline:"central",fill:"#a5b4fc",fontSize:9,fontWeight:700,fontFamily:"ui-monospace, monospace",children:k+1})]},l.id)})]})}):e.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500",children:"No tree generated"})}const D={inorder:{name:"In-Order",description:"Visits left subtree, then root, then right subtree. Produces sorted output for BSTs.",order:"Left → Root → Right"},preorder:{name:"Pre-Order",description:"Visits root first, then left subtree, then right subtree. Useful for copying trees.",order:"Root → Left → Right"},postorder:{name:"Post-Order",description:"Visits left subtree, then right subtree, then root. Useful for deleting trees.",order:"Left → Right → Root"},levelorder:{name:"Level-Order",description:"Visits nodes level by level from top to bottom, left to right. Also known as BFS.",order:"Top → Bottom, Left → Right"}},ve=["inorder","preorder","postorder","levelorder"],je=[{label:"Slow",value:600},{label:"Medium",value:300},{label:"Fast",value:100}];function Ne({traversalType:t,setTraversalType:s,nodeCount:n,stepIndex:r,totalSteps:m,processOrder:v,isPlaying:c,isFinished:x,speed:i,setSpeed:f,soundEnabled:d,onToggleSound:u,canGoNext:l,canGoPrev:p,onGenerate:S,onNextStep:y,onPrevStep:k,onPlay:j,onStop:N,onReset:w}){const g=D[t];return e.jsxs("div",{className:"flex flex-col gap-5 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Traversal"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ve.map(h=>e.jsx("button",{onClick:()=>s(h),disabled:c,className:` +import{r as a,j as e}from"./index-CB1-0H6I.js";import{V as oe,a as ce}from"./volume-x-CKT6TOtL.js";import{C as de,a as ue}from"./chevron-right-ChVmoNtO.js";import{P as xe}from"./play-SZ6Nqtz8.js";import{S as me}from"./square-B4KY3il9.js";import{S as fe}from"./shuffle-DZnyoAGL.js";import{R as pe}from"./rotate-ccw-CDlWXRsI.js";import{g as he}from"./audioContext-NbgqvQGz.js";let H=0;function J(t){return{id:H++,value:t,left:null,right:null,x:0,y:0}}function L(t,s){return t?(Math.random()<.5?t.left=L(t.left,s):t.right=L(t.right,s),t):J(s)}function _(t){if(H=0,t<=0)return null;const s=Array.from({length:t},(r,m)=>m+1);for(let r=s.length-1;r>0;r--){const m=Math.floor(Math.random()*(r+1));[s[r],s[m]]=[s[m],s[r]]}let n=null;for(const r of s)n?n=L(n,r):n=J(r);return n&&q(n,0,0,300),n}function q(t,s,n,r){t&&(t.x=n,t.y=s*70,q(t.left,s+1,n-r,r*.55),q(t.right,s+1,n+r,r*.55))}function K(t){const s=[];function n(r){r&&(s.push(r),n(r.left),n(r.right))}return n(t),s}function ge(t){const s=[];function n(r){r&&(r.left&&(s.push({from:r,to:r.left}),n(r.left)),r.right&&(s.push({from:r,to:r.right}),n(r.right)))}return n(t),s}function be({root:t,visitedIds:s,processedIds:n,currentId:r,processOrder:m}){const v=a.useMemo(()=>K(t),[t]),c=a.useMemo(()=>ge(t),[t]),x=Math.min(...v.map(l=>l.x),0)-40,i=Math.max(...v.map(l=>l.x),0)+40,f=Math.max(...v.map(l=>l.y),0)+40,d=i-x+80,u=f+80;return t?e.jsx("div",{className:"flex-1 w-full rounded-xl border border-slate-700/50 bg-slate-950/80 p-4 shadow-2xl backdrop-blur-sm overflow-auto",children:e.jsxs("svg",{viewBox:`${x-40} -20 ${d} ${u}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[c.map((l,p)=>e.jsx("line",{x1:l.from.x,y1:l.from.y,x2:l.to.x,y2:l.to.y,stroke:n.has(l.from.id)&&n.has(l.to.id)?"#818cf8":s.has(l.from.id)&&s.has(l.to.id)?"#64748b":"#334155",strokeWidth:2,strokeOpacity:.6},p)),v.map(l=>{const p=l.id===r,S=n.has(l.id),y=s.has(l.id),k=m.indexOf(l.id);let j="#1e293b",N="#475569",w="#94a3b8";return p?(j="#fbbf24",N="#f59e0b",w="#1e293b"):S?(j="#6366f1",N="#818cf8",w="#ffffff"):y&&(j="#334155",N="#64748b",w="#cbd5e1"),e.jsxs("g",{children:[e.jsx("circle",{cx:l.x,cy:l.y,r:22,fill:j,stroke:N,strokeWidth:2.5,className:"transition-all duration-200"}),e.jsx("text",{x:l.x,y:l.y+1,textAnchor:"middle",dominantBaseline:"central",fill:w,fontSize:12,fontWeight:600,fontFamily:"ui-monospace, monospace",children:l.value}),k>=0&&e.jsx("text",{x:l.x+18,y:l.y-18,textAnchor:"middle",dominantBaseline:"central",fill:"#a5b4fc",fontSize:9,fontWeight:700,fontFamily:"ui-monospace, monospace",children:k+1})]},l.id)})]})}):e.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500",children:"No tree generated"})}const D={inorder:{name:"In-Order",description:"Visits left subtree, then root, then right subtree. Produces sorted output for BSTs.",order:"Left → Root → Right"},preorder:{name:"Pre-Order",description:"Visits root first, then left subtree, then right subtree. Useful for copying trees.",order:"Root → Left → Right"},postorder:{name:"Post-Order",description:"Visits left subtree, then right subtree, then root. Useful for deleting trees.",order:"Left → Right → Root"},levelorder:{name:"Level-Order",description:"Visits nodes level by level from top to bottom, left to right. Also known as BFS.",order:"Top → Bottom, Left → Right"}},ve=["inorder","preorder","postorder","levelorder"],je=[{label:"Slow",value:600},{label:"Medium",value:300},{label:"Fast",value:100}];function Ne({traversalType:t,setTraversalType:s,nodeCount:n,stepIndex:r,totalSteps:m,processOrder:v,isPlaying:c,isFinished:x,speed:i,setSpeed:f,soundEnabled:d,onToggleSound:u,canGoNext:l,canGoPrev:p,onGenerate:S,onNextStep:y,onPrevStep:k,onPlay:j,onStop:N,onReset:w}){const g=D[t];return e.jsxs("div",{className:"flex flex-col gap-5 w-full md:w-72 shrink-0 overflow-y-auto max-h-full pr-1",children:[e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Traversal"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ve.map(h=>e.jsx("button",{onClick:()=>s(h),disabled:c,className:` rounded-lg px-3 py-2 text-sm font-medium transition-all duration-200 ${t===h?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40 shadow-lg shadow-indigo-500/10":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50 hover:text-slate-300"} disabled:opacity-50 disabled:cursor-not-allowed diff --git a/docs/assets/TriePage-C2SmMNzK.js b/docs/assets/TriePage-DRyr69yQ.js similarity index 97% rename from docs/assets/TriePage-C2SmMNzK.js rename to docs/assets/TriePage-DRyr69yQ.js index 90cbcdb..12106ba 100644 --- a/docs/assets/TriePage-C2SmMNzK.js +++ b/docs/assets/TriePage-DRyr69yQ.js @@ -1,4 +1,4 @@ -import{c as B,r as d,j as e,e as D,X as K}from"./index-lLadk08S.js";import{C as Q,a as H}from"./chevron-right-Cp_zyb7b.js";import{P as J}from"./play-b2ZiatJ3.js";import{S as U}from"./square-QnQTkqqU.js";import{R as Z}from"./rotate-ccw-DMjSdzg2.js";import{P as ee}from"./plus-NICMDkhr.js";import{V as te,a as se}from"./volume-x-CjLNPeax.js";import{g as ne}from"./audioContext-NbgqvQGz.js";const re=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ae=B("refresh-cw",re);function ie({layout:a,matchedNodeIds:r,currentStepNodeId:o}){const{viewBox:u,edges:l}=d.useMemo(()=>{if(a.length===0)return{viewBox:"0 0 100 100",edges:[]};let s=1/0,n=-1/0,t=1/0,i=-1/0;for(const g of a)s=Math.min(s,g.x),n=Math.max(n,g.x),t=Math.min(t,g.y),i=Math.max(i,g.y);const h=40,x=`${s-h} ${t-h} ${n-s+h*2} ${i-t+h*2}`,c=new Map;for(const g of a)c.set(g.id,g);const m=[];for(const g of a)if(g.parentId&&c.has(g.parentId)){const y=c.get(g.parentId),S=r.has(g.id)&&r.has(y.id);m.push({x1:y.x,y1:y.y,x2:g.x,y2:g.y,highlighted:S})}return{viewBox:x,edges:m}},[a,r]);return a.length===0?e.jsx("div",{className:"flex flex-1 w-full min-h-[200px] items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500 text-sm",children:"Add words to build the trie"}):e.jsx("div",{className:"flex-1 w-full min-h-[200px] rounded-xl border border-slate-700/50 bg-slate-950/80 p-2 shadow-2xl backdrop-blur-sm overflow-hidden",children:e.jsxs("svg",{viewBox:u,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[l.map((s,n)=>e.jsx("line",{x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,stroke:s.highlighted?"#818cf8":"#334155",strokeWidth:s.highlighted?2.5:1.5,strokeOpacity:s.highlighted?1:.5},n)),a.map(s=>{const n=r.has(s.id),t=o===s.id,i=s.depth===0;let h="#1e293b",x="#475569",c="#94a3b8";t?(h="#312e81",x="#818cf8",c="#e0e7ff"):n&&(h="#1e1b4b",x="#6366f1",c="#c7d2fe"),s.isEndOfWord&&!t&&(x=n?"#34d399":"#059669");const m=i?16:14;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:m,fill:h,stroke:x,strokeWidth:t?3:2}),t&&e.jsx("circle",{cx:s.x,cy:s.y,r:m+4,fill:"none",stroke:"#818cf8",strokeWidth:1.5,strokeOpacity:.4,className:"animate-pulse"}),e.jsx("text",{x:s.x,y:s.y,textAnchor:"middle",dominantBaseline:"central",fill:c,fontSize:i?10:12,fontWeight:700,fontFamily:"ui-monospace, monospace",children:i?"root":s.char}),s.isEndOfWord&&e.jsx("circle",{cx:s.x+m-2,cy:s.y-m+2,r:4,fill:"#34d399",stroke:"#064e3b",strokeWidth:1})]},s.id)})]})})}function oe({words:a,searchMode:r,setSearchMode:o,query:u,setQuery:l,steps:s,stepIndex:n,searchResults:t,isPlaying:i,canGoNext:h,canGoPrev:x,onSearch:c,onNextStep:m,onPrevStep:g,onPlay:y,onStop:S,onReset:W,newWord:v,setNewWord:M,onAddWord:T,onRemoveWord:N,onLoadSample:C,soundEnabled:k,onToggleSound:P}){const w=n>=0&&ne.jsx("button",{onClick:()=>o(p),className:` +import{c as B,r as d,j as e,e as D,X as K}from"./index-CB1-0H6I.js";import{C as Q,a as H}from"./chevron-right-ChVmoNtO.js";import{P as J}from"./play-SZ6Nqtz8.js";import{S as U}from"./square-B4KY3il9.js";import{R as Z}from"./rotate-ccw-CDlWXRsI.js";import{P as ee}from"./plus-B3nnW8Th.js";import{V as te,a as se}from"./volume-x-CKT6TOtL.js";import{g as ne}from"./audioContext-NbgqvQGz.js";const re=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ae=B("refresh-cw",re);function ie({layout:a,matchedNodeIds:r,currentStepNodeId:o}){const{viewBox:u,edges:l}=d.useMemo(()=>{if(a.length===0)return{viewBox:"0 0 100 100",edges:[]};let s=1/0,n=-1/0,t=1/0,i=-1/0;for(const g of a)s=Math.min(s,g.x),n=Math.max(n,g.x),t=Math.min(t,g.y),i=Math.max(i,g.y);const h=40,x=`${s-h} ${t-h} ${n-s+h*2} ${i-t+h*2}`,c=new Map;for(const g of a)c.set(g.id,g);const m=[];for(const g of a)if(g.parentId&&c.has(g.parentId)){const y=c.get(g.parentId),S=r.has(g.id)&&r.has(y.id);m.push({x1:y.x,y1:y.y,x2:g.x,y2:g.y,highlighted:S})}return{viewBox:x,edges:m}},[a,r]);return a.length===0?e.jsx("div",{className:"flex flex-1 w-full min-h-[200px] items-center justify-center rounded-xl border border-slate-700/50 bg-slate-950/80 text-slate-500 text-sm",children:"Add words to build the trie"}):e.jsx("div",{className:"flex-1 w-full min-h-[200px] rounded-xl border border-slate-700/50 bg-slate-950/80 p-2 shadow-2xl backdrop-blur-sm overflow-hidden",children:e.jsxs("svg",{viewBox:u,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[l.map((s,n)=>e.jsx("line",{x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,stroke:s.highlighted?"#818cf8":"#334155",strokeWidth:s.highlighted?2.5:1.5,strokeOpacity:s.highlighted?1:.5},n)),a.map(s=>{const n=r.has(s.id),t=o===s.id,i=s.depth===0;let h="#1e293b",x="#475569",c="#94a3b8";t?(h="#312e81",x="#818cf8",c="#e0e7ff"):n&&(h="#1e1b4b",x="#6366f1",c="#c7d2fe"),s.isEndOfWord&&!t&&(x=n?"#34d399":"#059669");const m=i?16:14;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:m,fill:h,stroke:x,strokeWidth:t?3:2}),t&&e.jsx("circle",{cx:s.x,cy:s.y,r:m+4,fill:"none",stroke:"#818cf8",strokeWidth:1.5,strokeOpacity:.4,className:"animate-pulse"}),e.jsx("text",{x:s.x,y:s.y,textAnchor:"middle",dominantBaseline:"central",fill:c,fontSize:i?10:12,fontWeight:700,fontFamily:"ui-monospace, monospace",children:i?"root":s.char}),s.isEndOfWord&&e.jsx("circle",{cx:s.x+m-2,cy:s.y-m+2,r:4,fill:"#34d399",stroke:"#064e3b",strokeWidth:1})]},s.id)})]})})}function oe({words:a,searchMode:r,setSearchMode:o,query:u,setQuery:l,steps:s,stepIndex:n,searchResults:t,isPlaying:i,canGoNext:h,canGoPrev:x,onSearch:c,onNextStep:m,onPrevStep:g,onPlay:y,onStop:S,onReset:W,newWord:v,setNewWord:M,onAddWord:T,onRemoveWord:N,onLoadSample:C,soundEnabled:k,onToggleSound:P}){const w=n>=0&&ne.jsx("button",{onClick:()=>o(p),className:` flex-1 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200 ${r===p?"bg-indigo-500/20 text-indigo-300 ring-1 ring-indigo-500/40 shadow-lg shadow-indigo-500/10":"bg-slate-800/50 text-slate-400 hover:bg-slate-700/50 hover:text-slate-300"} `,children:p==="prefix"?"Prefix":"Full Word"},p))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Search"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:u,onChange:p=>l(p.target.value),onKeyDown:p=>p.key==="Enter"&&c(),placeholder:r==="prefix"?"Type a prefix...":"Type a word...",className:"flex-1 rounded-lg bg-slate-800/60 px-3 py-2 text-sm text-white placeholder-slate-500 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50"}),e.jsx("button",{onClick:c,disabled:!u.trim(),className:"flex items-center justify-center rounded-lg bg-indigo-500/20 px-3 py-2 text-indigo-300 ring-1 ring-indigo-500/40 transition-all hover:bg-indigo-500/30 disabled:opacity-40 disabled:cursor-not-allowed",children:e.jsx(D,{size:16})})]})]}),s.length>0&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Steps"}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsxs("button",{onClick:g,disabled:!x||i,className:"flex-1 flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-sm font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:[e.jsx(Q,{size:16})," Prev"]}),i?e.jsx("button",{onClick:S,className:"flex items-center justify-center rounded-lg bg-rose-500/15 px-3 py-2 text-rose-300 ring-1 ring-rose-500/30 transition-all hover:bg-rose-500/25",children:e.jsx(U,{size:14})}):e.jsx("button",{onClick:y,disabled:s.length===0,className:"flex items-center justify-center rounded-lg bg-emerald-500/15 px-3 py-2 text-emerald-300 ring-1 ring-emerald-500/30 transition-all hover:bg-emerald-500/25 disabled:opacity-30 disabled:cursor-not-allowed",children:e.jsx(J,{size:16})}),e.jsxs("button",{onClick:m,disabled:!h||i,className:"flex-1 flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-sm font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300 disabled:opacity-30 disabled:cursor-not-allowed",children:["Next ",e.jsx(H,{size:16})]})]}),e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Step"}),e.jsxs("span",{className:"text-sm font-mono font-semibold text-indigo-400",children:[Math.max(0,n+1)," / ",s.length]})]}),w&&e.jsx("div",{className:`rounded-lg px-3 py-2 text-xs font-medium ${w.action==="match"||w.action==="prefix-match"?"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/30":w.action==="not-found"?"bg-rose-500/15 text-rose-300 ring-1 ring-rose-500/30":"bg-slate-800/60 text-slate-300 ring-1 ring-slate-700/50"}`,children:w.description}),e.jsxs("button",{onClick:W,className:"mt-2 w-full flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300",children:[e.jsx(Z,{size:12})," Clear Search"]})]}),t.length>0&&e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:["Results (",t.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-32 overflow-y-auto",children:t.map(p=>e.jsx("span",{className:"rounded-full bg-emerald-500/10 px-2.5 py-0.5 text-[11px] font-medium text-emerald-300 ring-1 ring-emerald-500/20",children:p},p))})]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:["Words (",a.length,")"]}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsx("input",{type:"text",value:v,onChange:p=>M(p.target.value),onKeyDown:p=>p.key==="Enter"&&T(),placeholder:"Add a word...",className:"flex-1 rounded-lg bg-slate-800/60 px-3 py-2 text-sm text-white placeholder-slate-500 outline-none ring-1 ring-slate-700/50 focus:ring-indigo-500/50"}),e.jsx("button",{onClick:T,disabled:!v.trim(),className:"flex items-center justify-center rounded-lg bg-emerald-500/15 px-3 py-2 text-emerald-300 ring-1 ring-emerald-500/30 transition-all hover:bg-emerald-500/25 disabled:opacity-40 disabled:cursor-not-allowed",children:e.jsx(ee,{size:16})})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-40 overflow-y-auto",children:a.map(p=>e.jsxs("span",{className:"group inline-flex items-center gap-1 rounded-full bg-slate-800/60 px-2.5 py-0.5 text-[11px] font-medium text-slate-400 ring-1 ring-slate-700/40",children:[p,e.jsx("button",{onClick:()=>N(p),className:"opacity-0 group-hover:opacity-100 transition-opacity text-slate-500 hover:text-rose-400",children:e.jsx(K,{size:10})})]},p))}),e.jsxs("button",{onClick:C,className:"mt-3 w-full flex items-center justify-center gap-1.5 rounded-lg bg-slate-800/60 px-3 py-2 text-xs font-medium text-slate-400 transition-all hover:bg-slate-700/60 hover:text-slate-300",children:[e.jsx(ae,{size:12})," Load Sample Words"]})]}),e.jsxs("button",{onClick:P,className:`flex items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-medium transition-all ${k?"bg-indigo-500/15 text-indigo-300 ring-1 ring-indigo-500/30 hover:bg-indigo-500/25":"bg-slate-800/60 text-slate-500 ring-1 ring-slate-700/40 hover:bg-slate-700/60"}`,children:[k?e.jsx(te,{size:16}):e.jsx(se,{size:16}),k?"Sound On":"Sound Off"]}),e.jsxs("div",{className:"rounded-xl border border-slate-700/50 bg-slate-900/60 p-4 backdrop-blur-sm",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3",children:"Legend"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-slate-700 ring-1 ring-slate-500"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Normal Node"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-indigo-900 ring-1 ring-indigo-500"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Matched Path"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-indigo-900 ring-2 ring-indigo-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Current Step"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"relative h-3 w-3 rounded-full bg-slate-700 ring-1 ring-emerald-500",children:e.jsx("div",{className:"absolute -top-0.5 -right-0.5 h-1.5 w-1.5 rounded-full bg-emerald-400"})}),e.jsx("span",{className:"text-xs text-slate-400",children:"End of Word"})]})]})]})]})}let F=0;function X(a,r){return{id:`node-${F++}`,char:a,children:new Map,isEndOfWord:!1,depth:r}}function le(){F=0}function ce(a,r){let o=a;for(let u=0;uc[0].localeCompare(m[0]));for(const[,c]of h){const m=u;s(c,n.id),i.push((m+u-1)/2)}const x=i.reduce((c,m)=>c+m,0)/i.length;r.push({id:n.id,char:n.char,isEndOfWord:n.isEndOfWord,x:x*l,y:n.depth*70,parentId:t,depth:n.depth})}return s(a,null),r}const $=["apple","app","ape","apply","bat","ball","ban","cat","car","card","care","dog","do","dot"];function O(a){le();const r=X("",0);for(const o of a)ce(r,o);return r}function he(){const[a,r]=d.useState($),[o,u]=d.useState(()=>O($)),[l,s]=d.useState("prefix"),[n,t]=d.useState(""),[i,h]=d.useState([]),[x,c]=d.useState(-1),[m,g]=d.useState(new Set),[y,S]=d.useState([]),[W,v]=d.useState(!1),[M,T]=d.useState(500),[N,C]=d.useState(""),k=d.useMemo(()=>xe(o),[o]),P=x>=0&&x{if(!n.trim())return;const f=n.trim().toLowerCase(),{result:b,steps:q}=l==="word"?de(o,f):ue(o,f);h(q),c(-1),g(new Set(b.matchedPath)),S(b.matches),v(!1)},[n,l,o]),p=d.useCallback(()=>{c(f=>f{c(f=>f>0?f-1:f)},[]),E=d.useCallback(()=>{i.length!==0&&(v(!0),c(0))},[i]),R=d.useCallback(()=>{v(!1)},[]),j=d.useCallback(()=>{h([]),c(-1),g(new Set),S([]),v(!1)},[]),z=d.useCallback(()=>{const f=N.trim().toLowerCase();if(!f||a.includes(f))return;const b=[...a,f];r(b),u(O(b)),C(""),j()},[N,a,j]),A=d.useCallback(f=>{const b=a.filter(q=>q!==f);r(b),u(O(b)),j()},[a,j]),G=d.useCallback(()=>{r($),u(O($)),C(""),j()},[j]),V=x0;return{words:a,root:o,layout:k,searchMode:l,setSearchMode:s,query:n,setQuery:t,steps:i,stepIndex:x,currentStepNodeId:P,matchedNodeIds:m,searchResults:y,isPlaying:W,speed:M,setSpeed:T,canGoNext:V,canGoPrev:I,search:w,nextStep:p,prevStep:L,play:E,stopPlaying:R,resetSearch:j,newWord:N,setNewWord:C,addWord:z,removeWord:A,loadSampleWords:G}}const _=[261.63,293.66,329.63,392,440,523.25,587.33,659.25];function me(){const a=d.useRef(!0),r=d.useCallback(()=>ne(),[]),o=d.useCallback(t=>{a.current=t},[]),u=d.useCallback(()=>a.current,[]),l=d.useCallback(t=>{if(!a.current)return;const i=r();if(!i)return;const h=_[t%_.length],x=i.createOscillator(),c=i.createGain();x.type="sine",x.frequency.value=h,c.gain.setValueAtTime(.08,i.currentTime),c.gain.exponentialRampToValueAtTime(.001,i.currentTime+.15),x.connect(c),c.connect(i.destination),x.start(),x.stop(i.currentTime+.15)},[r]),s=d.useCallback(()=>{if(!a.current)return;const t=r();if(!t)return;[523.25,659.25,783.99].forEach((h,x)=>{const c=t.createOscillator(),m=t.createGain();c.type="sine",c.frequency.value=h,m.gain.setValueAtTime(.1,t.currentTime+x*.1),m.gain.exponentialRampToValueAtTime(.001,t.currentTime+x*.1+.15),c.connect(m),m.connect(t.destination),c.start(t.currentTime+x*.1),c.stop(t.currentTime+x*.1+.15)})},[r]),n=d.useCallback(()=>{if(!a.current)return;const t=r();if(!t)return;const i=t.createOscillator(),h=t.createGain();i.type="sine",i.frequency.value=350,i.frequency.setValueAtTime(350,t.currentTime),i.frequency.linearRampToValueAtTime(220,t.currentTime+.25),h.gain.setValueAtTime(.08,t.currentTime),h.gain.exponentialRampToValueAtTime(.001,t.currentTime+.3),i.connect(h),h.connect(t.destination),i.start(),i.stop(t.currentTime+.3)},[r]);return{playTraverseTone:l,playMatchTone:s,playNotFoundTone:n,setEnabled:o,isEnabled:u}}function we(){const{words:a,layout:r,searchMode:o,setSearchMode:u,query:l,setQuery:s,steps:n,stepIndex:t,currentStepNodeId:i,matchedNodeIds:h,searchResults:x,isPlaying:c,speed:m,setSpeed:g,canGoNext:y,canGoPrev:S,search:W,nextStep:v,prevStep:M,play:T,stopPlaying:N,resetSearch:C,newWord:k,setNewWord:P,addWord:w,removeWord:p,loadSampleWords:L}=he(),{playTraverseTone:E,playMatchTone:R,playNotFoundTone:j,setEnabled:z}=me(),[A,G]=d.useState(!0),V=()=>{const b=!A;G(b),z(b)},I=d.useRef(t);d.useEffect(()=>{if(t<0||t===I.current){I.current=t;return}I.current=t;const b=n[t];b&&(b.action==="visit"?E(b.char?b.char.charCodeAt(0)%8:0):b.action==="match"||b.action==="prefix-match"?R():b.action==="not-found"&&j())},[t,n,E,R,j]);const f=d.useRef(null);return d.useEffect(()=>{if(!c){f.current&&clearTimeout(f.current);return}if(!y){N();return}return f.current=setTimeout(()=>{v()},m),()=>{f.current&&clearTimeout(f.current)}},[c,t,y,m,v,N]),e.jsxs("div",{className:"flex flex-1 flex-col md:flex-row gap-4 md:gap-6 overflow-auto p-4 md:p-6",children:[e.jsx(oe,{words:a,searchMode:o,setSearchMode:u,query:l,setQuery:s,steps:n,stepIndex:t,searchResults:x,isPlaying:c,speed:m,setSpeed:g,canGoNext:y,canGoPrev:S,onSearch:W,onNextStep:v,onPrevStep:M,onPlay:T,onStop:N,onReset:C,newWord:k,setNewWord:P,onAddWord:w,onRemoveWord:p,onLoadSample:L,soundEnabled:A,onToggleSound:V}),e.jsx("div",{className:"order-last md:order-first flex md:flex-1 flex-col items-center justify-center gap-3 min-h-[40vh] md:min-h-0 max-h-[50vh] md:max-h-none overflow-auto",children:e.jsx(ie,{layout:r,matchedNodeIds:h,currentStepNodeId:i})})]})}export{we as default}; diff --git a/docs/assets/WorldMapGamePage-BfAD3dv0.js b/docs/assets/WorldMapGamePage-DMM-CLOk.js similarity index 99% rename from docs/assets/WorldMapGamePage-BfAD3dv0.js rename to docs/assets/WorldMapGamePage-DMM-CLOk.js index 92da186..f1bad42 100644 --- a/docs/assets/WorldMapGamePage-BfAD3dv0.js +++ b/docs/assets/WorldMapGamePage-DMM-CLOk.js @@ -1 +1 @@ -import{c as te,r as b,j as t,P as se}from"./index-lLadk08S.js";import{S as ae}from"./shuffle-ADbBlETg.js";import{C as oe,a as ne}from"./chevron-right-Cp_zyb7b.js";import{P as re}from"./play-b2ZiatJ3.js";import{R as ie}from"./route-DiDkH3-5.js";import{V as le,a as ce}from"./volume-x-CjLNPeax.js";import{g as de}from"./audioContext-NbgqvQGz.js";const ue=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],he=te("radar",ue),pe=[{name:"North America",path:"M45 82C82 46 145 49 196 75C229 59 287 72 331 102C366 126 369 165 337 188C312 207 287 210 264 235C232 268 178 250 149 222C118 192 78 187 56 150C38 119 28 99 45 82Z",fill:"#14532d"},{name:"Greenland",path:"M285 42C332 20 390 35 404 75C388 111 325 119 286 92C267 78 265 55 285 42Z",fill:"#475569"},{name:"Central America",path:"M246 230C277 232 307 242 329 263C307 276 273 267 246 249C232 240 232 231 246 230Z",fill:"#166534"},{name:"South America",path:"M308 264C352 270 383 315 372 374C364 424 334 474 296 483C281 443 259 405 264 359C269 314 281 281 308 264Z",fill:"#15803d"},{name:"Europe",path:"M438 122C470 96 535 91 575 117C602 137 593 166 558 176C522 186 489 177 454 165C427 156 416 139 438 122Z",fill:"#0f766e"},{name:"Africa",path:"M498 202C553 184 612 223 627 283C640 336 608 409 552 425C514 397 484 340 482 283C480 244 482 216 498 202Z",fill:"#166534"},{name:"Middle East",path:"M572 188C615 178 657 196 674 226C648 245 603 239 580 217C568 206 565 194 572 188Z",fill:"#3f6212"},{name:"Asia",path:"M600 111C683 52 842 83 927 168C910 223 836 246 775 229C728 216 703 257 655 244C611 232 566 159 600 111Z",fill:"#164e63"},{name:"Southeast Asia",path:"M728 252C772 247 824 281 833 322C800 335 755 317 728 287C714 271 714 258 728 252Z",fill:"#0f766e"},{name:"Australia",path:"M794 350C850 316 932 335 949 394C897 437 813 426 774 381C760 365 771 354 794 350Z",fill:"#15803d"},{name:"New Zealand",path:"M958 420C979 425 987 448 970 461C951 456 941 432 958 420Z",fill:"#15803d"}],xe=["M186 78C184 128 197 172 230 214","M126 172C171 164 216 173 260 190","M231 237C262 244 292 252 323 263","M303 280C329 305 342 335 335 374","M336 312C350 304 362 304 376 318","M451 140C482 132 515 134 548 149","M496 171C501 144 518 124 545 111","M529 196C540 236 540 277 530 321","M565 223C594 250 611 286 617 329","M591 190C613 203 639 212 671 221","M638 130C675 145 713 153 754 153","M690 184C729 192 768 201 808 216","M757 238C759 278 770 303 807 320","M835 153C841 191 832 219 808 236","M831 365C861 384 892 394 928 396"],me=[{text:"CANADA",x:160,y:118},{text:"UNITED STATES",x:190,y:178},{text:"MEXICO",x:250,y:222},{text:"BRAZIL",x:338,y:336},{text:"ARGENTINA",x:315,y:424},{text:"EUROPE",x:507,y:139},{text:"NORTH AFRICA",x:548,y:246},{text:"SOUTH AFRICA",x:560,y:390},{text:"MIDDLE EAST",x:632,y:210},{text:"INDIA",x:710,y:232},{text:"CHINA",x:779,y:173},{text:"JAPAN",x:890,y:161},{text:"SOUTHEAST ASIA",x:770,y:295},{text:"AUSTRALIA",x:860,y:390}];function ge({airports:s,routes:i,source:n,destination:l,currentStep:o,plan:u,flightProgress:c,onSelectSource:x,onSelectDestination:m}){const h=b.useMemo(()=>new Map(s.map(a=>[a.code,a])),[s]),j=new Set(o?.visited??[]),y=new Set((o?.frontier??[]).map(a=>a.code)),S=o?.route?.length?o.route:u.path,g=new Set(S.slice(0,-1).map((a,d)=>[a,S[d+1]].sort().join("-"))),p=o?.relaxedRoute?[o.relaxedRoute.from,o.relaxedRoute.to].sort().join("-"):null,k=b.useMemo(()=>{if(!c)return null;const a=h.get(c.from),d=h.get(c.to);if(!a||!d)return null;const f=Math.sin(c.progress*Math.PI)*-44;return{x:a.x+(d.x-a.x)*c.progress,y:a.y+(d.y-a.y)*c.progress+f,angle:Math.atan2(d.y-a.y,d.x-a.x)*(180/Math.PI)}},[h,c]);return t.jsxs("div",{className:"relative min-h-[620px] flex-1 overflow-hidden rounded-[1.75rem] border border-slate-700/50 bg-slate-950/90 shadow-2xl shadow-black/40",children:[t.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_18%_22%,rgba(14,165,233,0.16),transparent_28%),radial-gradient(circle_at_78%_72%,rgba(59,130,246,0.12),transparent_30%)]"}),t.jsxs("div",{className:"absolute left-5 top-5 z-20 rounded-2xl border border-slate-700/60 bg-slate-950/85 p-4 shadow-xl shadow-black/30 backdrop-blur-sm",children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-400",children:"Global Air Traffic Network"}),t.jsxs("div",{className:"mt-2 flex gap-4 text-xs text-slate-300",children:[t.jsxs("span",{children:[t.jsx("strong",{className:"font-mono text-white",children:s.length})," airports"]}),t.jsxs("span",{children:[t.jsx("strong",{className:"font-mono text-white",children:i.length})," routes"]}),t.jsxs("span",{children:[t.jsx("strong",{className:"font-mono text-white",children:u.path.length||0})," hops"]})]})]}),o&&t.jsxs("div",{className:"absolute bottom-5 left-5 z-20 max-w-md rounded-2xl border border-slate-700/60 bg-slate-950/90 p-4 shadow-xl shadow-black/35 backdrop-blur-sm",children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-indigo-300",children:"Algorithm Radar"}),t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-slate-300",children:o.description}),o.frontier.length>0&&t.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:o.frontier.slice(0,7).map(a=>t.jsxs("span",{className:"rounded-full bg-sky-500/10 px-2 py-1 text-[10px] font-mono font-semibold text-sky-300 ring-1 ring-sky-500/25",children:[a.code,": ",Number.isFinite(a.priority)?a.priority:"∞"]},`${a.code}-${a.priority}`))})]}),t.jsxs("svg",{viewBox:"0 0 1000 520",className:"relative z-10 h-full w-full",preserveAspectRatio:"xMidYMid meet",children:[t.jsxs("defs",{children:[t.jsxs("filter",{id:"world-glow",x:"-40%",y:"-40%",width:"180%",height:"180%",children:[t.jsx("feGaussianBlur",{stdDeviation:"4",result:"blur"}),t.jsxs("feMerge",{children:[t.jsx("feMergeNode",{in:"blur"}),t.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),t.jsx("filter",{id:"world-shadow",x:"-60%",y:"-60%",width:"220%",height:"220%",children:t.jsx("feDropShadow",{dx:"0",dy:"8",stdDeviation:"6",floodColor:"#020617",floodOpacity:"0.7"})}),t.jsxs("linearGradient",{id:"ocean",x1:"0",x2:"1",y1:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:"#07111f"}),t.jsx("stop",{offset:"55%",stopColor:"#082f49"}),t.jsx("stop",{offset:"100%",stopColor:"#020617"})]})]}),t.jsx("rect",{width:"1000",height:"520",rx:"28",fill:"url(#ocean)"}),[130,260,390].map(a=>t.jsx("path",{d:`M0 ${a}H1000`,stroke:"#38bdf8",strokeOpacity:"0.1",strokeDasharray:"7 10"},`lat-${a}`)),[125,250,375,500,625,750,875].map(a=>t.jsx("path",{d:`M${a} 0V520`,stroke:"#38bdf8",strokeOpacity:"0.08",strokeDasharray:"7 10"},`lon-${a}`)),t.jsx("path",{d:"M0 260H1000",stroke:"#67e8f9",strokeOpacity:"0.2",strokeDasharray:"8 9"}),t.jsx("path",{d:"M500 0V520",stroke:"#67e8f9",strokeOpacity:"0.14",strokeDasharray:"8 9"}),t.jsx("g",{filter:"url(#world-shadow)",children:pe.map(a=>t.jsx("path",{d:a.path,fill:a.fill,fillOpacity:"0.78",stroke:"#a7f3d0",strokeOpacity:"0.42",strokeWidth:"1.8"},a.name))}),t.jsx("g",{children:xe.map(a=>t.jsx("path",{d:a,fill:"none",stroke:"#d1fae5",strokeOpacity:"0.22",strokeWidth:"1",strokeDasharray:"4 5"},a))}),t.jsx("g",{children:me.map(a=>t.jsx("text",{x:a.x,y:a.y,textAnchor:"middle",fontSize:"11",fontWeight:"800",letterSpacing:"1.4",fill:"#e2e8f0",fillOpacity:"0.28",children:a.text},a.text))}),i.map(a=>{const d=h.get(a.source),f=h.get(a.destination);if(!d||!f)return null;const M=[a.source,a.destination].sort().join("-"),N=g.has(M),L=M===p,D=L?"#facc15":N?"#22c55e":"#334155",R=Math.min(120,Math.abs(d.x-f.x)*.12+28),I=(d.x+f.x)/2,K=(d.y+f.y)/2-R;return t.jsx("g",{children:t.jsx("path",{d:`M${d.x},${d.y} Q${I},${K} ${f.x},${f.y}`,fill:"none",stroke:D,strokeWidth:N||L?3:1.2,strokeOpacity:N||L?.92:.24,strokeDasharray:N?void 0:"5 8",filter:N||L?"url(#world-glow)":void 0})},a.id)}),s.map(a=>{const d=a.code===n,f=a.code===l,M=j.has(a.code),N=y.has(a.code),L=o?.airportCode===a.code,D=d||f||L||N||M||a.hubScore>=92,R=d?"#fde047":f?"#fb923c":L?"#38bdf8":M?"#22c55e":N?"#a78bfa":"#94a3b8";return t.jsxs("g",{className:"cursor-pointer",children:[t.jsxs("title",{children:[a.code," - ",a.city,", ",a.country]}),t.jsx("circle",{cx:a.x,cy:a.y,r:d||f?12:8,fill:"#020617",stroke:"#0f172a",strokeWidth:7,filter:"url(#world-shadow)"}),t.jsx("circle",{cx:a.x,cy:a.y,r:d||f?9:6,fill:R,fillOpacity:d||f||M||N||L?.96:.58,stroke:R,strokeWidth:L?4:2,onClick:I=>{I.shiftKey?m(a.code):x(a.code)}}),D&&t.jsx("text",{x:a.x,y:a.y-14,textAnchor:"middle",fontSize:"10",fontWeight:"800",fontFamily:"ui-monospace, monospace",fill:R,children:a.code})]},a.code)}),k&&t.jsxs("g",{transform:`translate(${k.x} ${k.y}) rotate(${k.angle})`,filter:"url(#world-glow)",children:[t.jsx("path",{d:"M-14 -5L18 0L-14 5L-8 0Z",fill:"#f8fafc",stroke:"#38bdf8",strokeWidth:"1.2"}),t.jsx("path",{d:"M-5 -3L-12 -13L2 -4Z",fill:"#bae6fd",opacity:"0.9"}),t.jsx("path",{d:"M-5 3L-12 13L2 4Z",fill:"#bae6fd",opacity:"0.9"})]})]}),t.jsxs("div",{className:"absolute bottom-5 right-5 z-20 hidden rounded-2xl border border-slate-700/60 bg-slate-950/85 p-4 text-[10px] text-slate-400 shadow-xl shadow-black/30 backdrop-blur-sm sm:block",children:[t.jsx("div",{className:"mb-2 font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Tip"}),"Click an airport to set origin. Shift-click to set destination."]})]})}const O={dijkstra:{label:"Dijkstra",description:"Finds the lowest total travel time by relaxing routes through a priority queue.",metric:"Shortest time"},astar:{label:"A* Search",description:"Uses distance-to-destination as a heuristic to guide the priority queue.",metric:"Guided shortest path"},bfs:{label:"BFS",description:"Ignores weights and searches by fewest airport connections.",metric:"Fewest stops"},greedy:{label:"Greedy",description:"Always flies toward the airport geographically closest to the destination.",metric:"Nearest-looking route"}},fe=["dijkstra","astar","bfs","greedy"];function be({airports:s,scenarios:i,source:n,destination:l,algorithm:o,plan:u,currentStep:c,stepIndex:x,totalSteps:m,phase:h,isPlaying:j,soundEnabled:y,onSourceChange:S,onDestinationChange:g,onAlgorithmChange:p,onLoadScenario:k,onPlanRoute:a,onStepBack:d,onStepForward:f,onPlay:M,onFly:N,onToggleSound:L}){return t.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-4 overflow-y-auto xl:w-88",children:[t.jsxs("section",{className:"rounded-2xl border border-sky-500/20 bg-slate-950/75 p-4 shadow-2xl shadow-black/30 backdrop-blur-sm",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/30",children:t.jsx(se,{size:18})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-bold text-white",children:"World Flight Planner"}),t.jsx("p",{className:"text-[10px] text-slate-500",children:"Airport-code simulator inspired by public airport datasets."})]})]}),t.jsx("p",{className:"text-xs leading-relaxed text-slate-400",children:"Pick countries through their major airport codes, then compare how different algorithms choose routes across global hubs."})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Travel Request"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(X,{label:"Origin",value:n,airports:s,onChange:S}),t.jsx(X,{label:"Destination",value:l,airports:s,onChange:g})]}),t.jsxs("button",{onClick:a,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-xl bg-sky-500/15 px-3 py-2 text-xs font-semibold text-sky-300 ring-1 ring-sky-500/30 transition hover:bg-sky-500/25",children:[t.jsx(he,{size:13})," Recalculate route"]})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Algorithms"}),t.jsx("div",{className:"grid gap-2",children:fe.map(D=>t.jsxs("button",{onClick:()=>p(D),className:`rounded-xl p-3 text-left transition ${o===D?"bg-indigo-500/15 text-indigo-200 ring-1 ring-indigo-500/35":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80"}`,children:[t.jsxs("span",{className:"flex items-center justify-between text-xs font-bold",children:[O[D].label,t.jsx("span",{className:"text-[9px] uppercase tracking-wider opacity-60",children:O[D].metric})]}),t.jsx("span",{className:"mt-1 block text-[10px] leading-snug opacity-75",children:O[D].description})]},D))})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Preset Missions"}),t.jsx("div",{className:"grid gap-2",children:i.map(D=>t.jsxs("button",{onClick:()=>k(D.id),className:"rounded-xl bg-slate-900/70 p-3 text-left ring-1 ring-slate-800/80 transition hover:bg-slate-800/80",children:[t.jsxs("span",{className:"flex items-center gap-2 text-xs font-bold text-slate-200",children:[t.jsx(ae,{size:12})," ",D.title]}),t.jsx("span",{className:"mt-1 block text-[10px] leading-snug text-slate-500",children:D.description})]},D.id))})]}),t.jsxs("section",{className:"rounded-2xl border border-emerald-500/20 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Flight Plan"}),t.jsx("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[9px] font-bold uppercase tracking-wider text-emerald-300 ring-1 ring-emerald-500/25",children:h})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(H,{label:"Distance",value:`${u.totalDistanceKm.toLocaleString()} km`}),t.jsx(H,{label:"Duration",value:`${u.totalDurationHours}h`}),t.jsx(H,{label:"Stops",value:u.stops.toString()}),t.jsx(H,{label:"Est. Cost",value:`$${u.totalCostUsd.toLocaleString()}`})]}),t.jsxs("div",{className:"mt-3 rounded-xl bg-slate-900/70 p-3 ring-1 ring-slate-800/80",children:[t.jsx("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Route"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:u.path.map((D,R)=>t.jsx("span",{className:"rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-mono font-semibold text-emerald-300 ring-1 ring-emerald-500/20",children:D},`${D}-${R}`))})]})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Simulation"}),t.jsxs("div",{className:"mb-3 flex items-center justify-between text-[10px] text-slate-500",children:[t.jsx("span",{children:"Step"}),t.jsxs("span",{className:"font-mono text-indigo-300",children:[Math.min(x+1,m)," / ",m]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsxs("button",{onClick:d,disabled:x<=0,className:"flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs text-slate-400 ring-1 ring-slate-800/80 disabled:opacity-30",children:[t.jsx(oe,{size:13})," Back"]}),t.jsxs("button",{onClick:M,className:"flex items-center justify-center gap-1 rounded-xl bg-indigo-500/15 px-2 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/30",children:[t.jsx(re,{size:13})," ",j?"Pause":"Play"]}),t.jsxs("button",{onClick:f,disabled:x>=m-1,className:"flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs text-slate-400 ring-1 ring-slate-800/80 disabled:opacity-30",children:["Next ",t.jsx(ne,{size:13})]})]}),t.jsxs("button",{onClick:N,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-xl bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-300 ring-1 ring-emerald-500/30 transition hover:bg-emerald-500/25",children:[t.jsx(ie,{size:13})," Animate airplane"]}),c&&t.jsx("p",{className:"mt-3 text-xs leading-relaxed text-slate-400",children:c.description})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Audio"}),t.jsxs("button",{onClick:()=>L(!y),className:`flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 transition ${y?"bg-sky-500/15 text-sky-300 ring-sky-500/30 hover:bg-sky-500/25":"bg-slate-900/70 text-slate-400 ring-slate-800/80 hover:bg-slate-800/80"}`,children:[y?t.jsx(le,{size:13}):t.jsx(ce,{size:13}),y?"Sound On":"Sound Off"]}),t.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:"Radar pings mark search steps, with takeoff, waypoint, and arrival tones during flight."})]})]})}function X({label:s,value:i,airports:n,onChange:l}){return t.jsxs("label",{className:"block",children:[t.jsx("span",{className:"mb-1 block text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:s}),t.jsx("select",{value:i,onChange:o=>l(o.target.value),className:"w-full rounded-xl border border-slate-700 bg-slate-900 px-3 py-2 text-xs font-mono text-slate-200 outline-none ring-sky-500/20 focus:ring-2",children:n.map(o=>t.jsxs("option",{value:o.code,children:[o.code," - ",o.city]},o.code))})]})}function H({label:s,value:i}){return t.jsxs("div",{className:"rounded-xl bg-slate-900/70 p-3 ring-1 ring-slate-800/80",children:[t.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-slate-500",children:s}),t.jsx("div",{className:"mt-1 font-mono text-sm font-black text-white",children:i})]})}function Ae(s,i){return{x:(s+180)/360*1e3,y:(90-i)/180*520}}function r(s,i,n,l,o,u,c){return{code:s,city:i,country:n,region:l,lat:o,lon:u,hubScore:c,...Ae(u,o)}}const F=[r("ATL","Atlanta","United States","North America",33.6407,-84.4277,98),r("ORD","Chicago","United States","North America",41.9742,-87.9073,96),r("DFW","Dallas-Fort Worth","United States","North America",32.8998,-97.0403,94),r("JFK","New York","United States","North America",40.6413,-73.7781,96),r("LAX","Los Angeles","United States","North America",33.9416,-118.4085,94),r("MIA","Miami","United States","North America",25.7959,-80.287,88),r("SEA","Seattle","United States","North America",47.4502,-122.3088,84),r("SFO","San Francisco","United States","North America",37.6213,-122.379,90),r("YVR","Vancouver","Canada","North America",49.1967,-123.1815,76),r("YYZ","Toronto","Canada","North America",43.6777,-79.6248,78),r("MEX","Mexico City","Mexico","North America",19.4361,-99.0719,76),r("BOG","Bogota","Colombia","South America",4.7016,-74.1469,78),r("LIM","Lima","Peru","South America",-12.0219,-77.1143,76),r("EZE","Buenos Aires","Argentina","South America",-34.8222,-58.5358,74),r("GRU","Sao Paulo","Brazil","South America",-23.4356,-46.4731,84),r("SCL","Santiago","Chile","South America",-33.3928,-70.7858,72),r("AMS","Amsterdam","Netherlands","Europe",52.3105,4.7683,93),r("ARN","Stockholm","Sweden","Europe",59.6498,17.9238,70),r("ATH","Athens","Greece","Europe",37.9364,23.9445,72),r("BCN","Barcelona","Spain","Europe",41.2974,2.0833,76),r("BRU","Brussels","Belgium","Europe",50.9014,4.4844,74),r("CPH","Copenhagen","Denmark","Europe",55.618,12.6561,74),r("LHR","London","United Kingdom","Europe",51.47,-.4543,98),r("CDG","Paris","France","Europe",49.0097,2.5479,94),r("DUB","Dublin","Ireland","Europe",53.4264,-6.2499,70),r("FCO","Rome","Italy","Europe",41.8003,12.2389,78),r("FRA","Frankfurt","Germany","Europe",50.0379,8.5622,96),r("HEL","Helsinki","Finland","Europe",60.3172,24.9633,70),r("LIS","Lisbon","Portugal","Europe",38.7742,-9.1342,70),r("MAD","Madrid","Spain","Europe",40.4983,-3.5676,82),r("MUC","Munich","Germany","Europe",48.3538,11.7861,84),r("VIE","Vienna","Austria","Europe",48.1103,16.5697,76),r("WAW","Warsaw","Poland","Europe",52.1657,20.9671,70),r("ZRH","Zurich","Switzerland","Europe",47.4581,8.5555,82),r("IST","Istanbul","Turkey","Europe/Asia",41.2753,28.7519,92),r("ADD","Addis Ababa","Ethiopia","Africa",8.9779,38.7993,82),r("CMN","Casablanca","Morocco","Africa",33.3675,-7.58997,74),r("CAI","Cairo","Egypt","Africa",30.112,31.4003,70),r("CPT","Cape Town","South Africa","Africa",-33.9715,18.6021,70),r("LOS","Lagos","Nigeria","Africa",6.5774,3.3212,72),r("JNB","Johannesburg","South Africa","Africa",-26.1337,28.242,80),r("NBO","Nairobi","Kenya","Africa",-1.3192,36.9278,68),r("AUH","Abu Dhabi","United Arab Emirates","Middle East",24.433,54.6511,82),r("DXB","Dubai","United Arab Emirates","Middle East",25.2532,55.3657,99),r("DOH","Doha","Qatar","Middle East",25.2731,51.6081,88),r("JED","Jeddah","Saudi Arabia","Middle East",21.6796,39.1565,78),r("RUH","Riyadh","Saudi Arabia","Middle East",24.9576,46.6988,76),r("TLV","Tel Aviv","Israel","Middle East",32.0114,34.8867,74),r("BKK","Bangkok","Thailand","Asia",13.69,100.7501,88),r("BLR","Bengaluru","India","Asia",13.1986,77.7066,76),r("BOM","Mumbai","India","Asia",19.0896,72.8656,84),r("CAN","Guangzhou","China","Asia",23.3924,113.2988,86),r("CGK","Jakarta","Indonesia","Asia",-6.1256,106.6559,82),r("DEL","Delhi","India","Asia",28.5562,77.1,86),r("HKG","Hong Kong","China","Asia",22.308,113.9185,92),r("SIN","Singapore","Singapore","Asia",1.3644,103.9915,96),r("ICN","Seoul","South Korea","Asia",37.4602,126.4407,94),r("KUL","Kuala Lumpur","Malaysia","Asia",2.7456,101.7072,82),r("MNL","Manila","Philippines","Asia",14.5086,121.0194,78),r("PEK","Beijing","China","Asia",40.0799,116.6031,90),r("PVG","Shanghai","China","Asia",31.1443,121.8083,92),r("TPE","Taipei","Taiwan","Asia",25.0797,121.2342,82),r("HND","Tokyo","Japan","Asia",35.5494,139.7798,95),r("BNE","Brisbane","Australia","Oceania",-27.3842,153.1175,70),r("MEL","Melbourne","Australia","Oceania",-37.669,144.841,78),r("PER","Perth","Australia","Oceania",-31.9403,115.9672,72),r("SYD","Sydney","Australia","Oceania",-33.9399,151.1753,84),r("AKL","Auckland","New Zealand","Oceania",-37.0082,174.785,66)],V=new Map(F.map(s=>[s.code,s]));function ye(s,i){const l=h=>h*Math.PI/180,o=l(i.lat-s.lat),u=l(i.lon-s.lon),c=l(s.lat),x=l(i.lat),m=Math.sin(o/2)**2+Math.cos(c)*Math.cos(x)*Math.sin(u/2)**2;return Math.round(2*6371*Math.asin(Math.sqrt(m)))}function e(s,i){const n=V.get(s),l=V.get(i);if(!n||!l)throw new Error(`Unknown airport route: ${s}-${i}`);const o=ye(n,l);return{id:`${s}-${i}`,source:s,destination:i,distanceKm:o,durationHours:Math.round((o/870+.65)*10)/10,costUsd:Math.round(o*.11+140)}}const B=[e("ATL","DFW"),e("ATL","JFK"),e("ATL","LAX"),e("ATL","MIA"),e("ATL","ORD"),e("ATL","YYZ"),e("ORD","DFW"),e("ORD","JFK"),e("ORD","LAX"),e("ORD","SEA"),e("ORD","SFO"),e("ORD","YYZ"),e("DFW","LAX"),e("DFW","MEX"),e("DFW","MIA"),e("DFW","SFO"),e("JFK","LAX"),e("JFK","YYZ"),e("JFK","LHR"),e("JFK","CDG"),e("JFK","AMS"),e("JFK","FRA"),e("JFK","MEX"),e("JFK","MIA"),e("JFK","SFO"),e("JFK","MAD"),e("JFK","DUB"),e("JFK","GRU"),e("LAX","HND"),e("LAX","ICN"),e("LAX","PVG"),e("LAX","SIN"),e("LAX","SYD"),e("LAX","MEX"),e("LAX","SFO"),e("LAX","SEA"),e("LAX","YVR"),e("YYZ","LHR"),e("YYZ","AMS"),e("YYZ","FRA"),e("YYZ","YVR"),e("MIA","BOG"),e("MIA","GRU"),e("MIA","LIM"),e("MIA","MEX"),e("SEA","YVR"),e("SEA","HND"),e("SEA","ICN"),e("SFO","HKG"),e("SFO","HND"),e("SFO","ICN"),e("SFO","SIN"),e("YVR","HND"),e("YVR","ICN"),e("MEX","BOG"),e("MEX","GRU"),e("MEX","LIM"),e("MEX","SCL"),e("BOG","GRU"),e("BOG","LIM"),e("BOG","MAD"),e("LIM","EZE"),e("LIM","SCL"),e("LIM","GRU"),e("EZE","GRU"),e("EZE","MAD"),e("EZE","SCL"),e("GRU","SCL"),e("GRU","MAD"),e("GRU","LIS"),e("GRU","CDG"),e("GRU","JNB"),e("SCL","AKL"),e("AMS","BRU"),e("AMS","CPH"),e("AMS","DUB"),e("AMS","FRA"),e("AMS","LHR"),e("AMS","ZRH"),e("ARN","CPH"),e("ARN","HEL"),e("ARN","LHR"),e("ATH","FCO"),e("ATH","IST"),e("ATH","VIE"),e("BCN","FCO"),e("BCN","LHR"),e("BCN","MAD"),e("BRU","CDG"),e("BRU","FRA"),e("CPH","FRA"),e("CPH","HEL"),e("CPH","LHR"),e("LHR","CDG"),e("LHR","MAD"),e("LHR","FRA"),e("LHR","ZRH"),e("LHR","DUB"),e("LHR","FCO"),e("LHR","DXB"),e("LHR","DOH"),e("LHR","SIN"),e("CDG","MAD"),e("CDG","FRA"),e("CDG","FCO"),e("CDG","IST"),e("CDG","DXB"),e("DUB","LIS"),e("FCO","IST"),e("FCO","MAD"),e("FRA","IST"),e("FRA","MUC"),e("FRA","VIE"),e("FRA","ZRH"),e("FRA","DXB"),e("HEL","WAW"),e("LIS","MAD"),e("MAD","CMN"),e("MAD","CAI"),e("MAD","DOH"),e("MUC","VIE"),e("MUC","ZRH"),e("VIE","WAW"),e("VIE","IST"),e("WAW","IST"),e("ZRH","VIE"),e("IST","ADD"),e("IST","CAI"),e("IST","DXB"),e("IST","DOH"),e("IST","TLV"),e("ADD","CAI"),e("ADD","JNB"),e("ADD","NBO"),e("ADD","DXB"),e("CMN","CAI"),e("CMN","LIS"),e("CMN","LOS"),e("CAI","JNB"),e("CAI","NBO"),e("CAI","JED"),e("CAI","RUH"),e("CAI","TLV"),e("CPT","JNB"),e("CPT","ADD"),e("CPT","DXB"),e("LOS","ADD"),e("LOS","JNB"),e("JNB","NBO"),e("JNB","SYD"),e("JNB","DXB"),e("NBO","DXB"),e("NBO","DOH"),e("AUH","BOM"),e("AUH","DEL"),e("AUH","JED"),e("AUH","LHR"),e("AUH","SIN"),e("DXB","DOH"),e("DXB","AUH"),e("DXB","DEL"),e("DXB","BOM"),e("DXB","BKK"),e("DXB","SIN"),e("DXB","HKG"),e("DXB","SYD"),e("DOH","BOM"),e("DOH","DEL"),e("DOH","JED"),e("DOH","SIN"),e("DOH","SYD"),e("JED","RUH"),e("JED","DEL"),e("RUH","DXB"),e("TLV","ATH"),e("TLV","DXB"),e("BKK","DEL"),e("BKK","HKG"),e("BKK","KUL"),e("BKK","SIN"),e("BKK","TPE"),e("BLR","BOM"),e("BLR","DEL"),e("BLR","SIN"),e("BOM","DEL"),e("BOM","SIN"),e("BOM","LHR"),e("CAN","HKG"),e("CAN","PEK"),e("CAN","PVG"),e("CAN","SIN"),e("CGK","KUL"),e("CGK","SIN"),e("CGK","SYD"),e("DEL","SIN"),e("DEL","HND"),e("DEL","HKG"),e("DEL","ICN"),e("HKG","ICN"),e("HKG","MNL"),e("HKG","PVG"),e("HKG","SIN"),e("HKG","TPE"),e("ICN","HND"),e("ICN","PEK"),e("ICN","PVG"),e("SIN","HND"),e("SIN","KUL"),e("SIN","MNL"),e("SIN","SYD"),e("KUL","MNL"),e("KUL","PER"),e("MNL","HND"),e("PEK","HND"),e("PEK","PVG"),e("PEK","SFO"),e("PVG","HND"),e("PVG","TPE"),e("TPE","HND"),e("HND","SYD"),e("HND","BNE"),e("BNE","SYD"),e("BNE","MEL"),e("MEL","SYD"),e("MEL","AKL"),e("PER","MEL"),e("PER","SYD"),e("PER","SIN"),e("SYD","AKL")],Y=[{id:"trans-atlantic",title:"New York to Tokyo",description:"Compare westbound Pacific hops against eastbound European and Gulf hub routes.",source:"JFK",destination:"HND",algorithm:"dijkstra"},{id:"southern-cross",title:"London to Sydney",description:"Route across Europe, the Gulf, Asia, and Oceania using weighted flight times.",source:"LHR",destination:"SYD",algorithm:"astar"},{id:"africa-to-americas",title:"Johannesburg to Los Angeles",description:"Study how different algorithms connect Africa to the Americas through major hubs.",source:"JNB",destination:"LAX",algorithm:"greedy"},{id:"fewest-stops",title:"Toronto to Singapore",description:"Use BFS to minimize the number of airport connections, ignoring flight duration.",source:"YYZ",destination:"SIN",algorithm:"bfs"}];function W(s){return new Map(s.map(i=>[i.code,i]))}function G(s,i){return s.flatMap(n=>n.source===i?[{code:n.destination,route:n}]:n.destination===i?[{code:n.source,route:n}]:[])}function _(s,i,n){return s.find(l=>l.source===i&&l.destination===n||l.source===n&&l.destination===i)??null}function J(s,i,n,l,o){return o==="bfs"?Ne(s,i,n,l):o==="greedy"?Ce(s,i,n,l):Se(s,i,n,l,o)}function Se(s,i,n,l,o){const u=W(s),c={},x={},m=new Set,h=[{code:n,priority:0}],j=[];for(const g of s)c[g.code]=g.code===n?0:1/0,x[g.code]=null;for(j.push(E("init",n,`Start at ${n}. Set its travel time to 0 and every other airport to infinity.`,m,h,c,x));h.length>0;){h.sort((p,k)=>p.priority-k.priority);const g=h.shift();if(!m.has(g.code)){if(m.add(g.code),j.push(E("select",g.code,`Select ${g.code}, the airport with the best current priority.`,m,h,c,x)),g.code===l)break;for(const p of G(i,g.code)){if(m.has(p.code))continue;const k=c[g.code]+p.route.durationHours;if(k ${p.code} improves the route to ${c[p.code]}h.`,m,h,c,x,{from:g.code,to:p.code}))}else j.push(E("dead-end",p.code,`${g.code} -> ${p.code} is slower than the best known route.`,m,h,c,x,{from:g.code,to:p.code}))}}}const y=U(x,n,l),S=$(i,y);return j.push(E("done",l,`Route complete: ${y.join(" -> ")}`,m,h,c,x,void 0,y)),{steps:j,plan:S}}function Ne(s,i,n,l){const o=new Set([n]),u={},c={},x=[{code:n,priority:0}],m=[];for(const y of s)u[y.code]=null,c[y.code]=y.code===n?0:1/0;for(m.push(E("init",n,`Start BFS at ${n}. Each edge counts as one airport hop.`,o,x,c,u));x.length>0;){const y=x.shift();if(m.push(E("select",y.code,`Visit ${y.code} and enqueue all unseen connected airports.`,o,x,c,u)),y.code===l)break;for(const S of G(i,y.code))o.has(S.code)||(o.add(S.code),u[S.code]=y.code,c[S.code]=c[y.code]+1,x.push({code:S.code,priority:c[S.code]}),m.push(E("enqueue",S.code,`Add ${S.code} to the BFS queue at hop ${c[S.code]}.`,o,x,c,u,{from:y.code,to:S.code})))}const h=U(u,n,l),j=$(i,h);return m.push(E("done",l,`Fewest-stop route complete: ${h.join(" -> ")}`,o,x,c,u,void 0,h)),{steps:m,plan:j}}function Ce(s,i,n,l){const o=W(s),u=new Set,c={},x={},m=[];let h=n;for(const S of s)c[S.code]=null,x[S.code]=S.code===n?0:1/0;for(m.push(E("init",n,`Start greedy routing at ${n}. Always choose the neighbor closest to ${l}.`,u,[{code:n,priority:0}],x,c));h!==l;){u.add(h);const S=G(i,h).filter(p=>!u.has(p.code)).sort((p,k)=>T(o.get(p.code),o.get(l))-T(o.get(k.code),o.get(l)));if(m.push(E("select",h,`From ${h}, compare nearby hubs by straight-line distance to ${l}.`,u,S.map(p=>({code:p.code,priority:Math.round(T(o.get(p.code),o.get(l))*10)/10})),x,c)),S.length===0)break;const g=S[0];x[g.code]=Math.round((x[h]+g.route.durationHours)*10)/10,c[g.code]=h,m.push(E("relax",g.code,`Greedy picks ${g.code} as the closest-looking next airport.`,u,[],x,c,{from:h,to:g.code})),h=g.code}const j=U(c,n,l),y=$(i,j);return m.push(E("done",l,`Greedy route complete: ${j.join(" -> ")}`,u,[],x,c,void 0,j)),{steps:m,plan:y}}function E(s,i,n,l,o,u,c,x,m){return{type:s,airportCode:i,description:n,visited:Array.from(l),frontier:o.map(h=>({code:h.code,priority:h.priority})),distances:{...u},previous:{...c},relaxedRoute:x,route:m}}function U(s,i,n){const l=[];let o=n;for(;o&&(l.unshift(o),o!==i);)o=s[o];return l[0]===i?l:[]}function $(s,i){let n=0,l=0,o=0;for(let u=0;ude(),[]),o=b.useCallback((p,k,a="sine",d=.045)=>{if(!s.current)return;const f=l();if(!f)return;const M=f.createOscillator(),N=f.createGain();M.type=a,M.frequency.setValueAtTime(p,f.currentTime),N.gain.setValueAtTime(d,f.currentTime),N.gain.exponentialRampToValueAtTime(.001,f.currentTime+k),M.connect(N),N.connect(f.destination),M.start(f.currentTime),M.stop(f.currentTime+k)},[l]),u=b.useCallback((p,k,a,d=.04)=>{if(!s.current)return;const f=l();f&&p.forEach((M,N)=>{const L=f.createOscillator(),D=f.createGain(),R=f.currentTime+N*a*.75;L.type=k,L.frequency.setValueAtTime(M,R),D.gain.setValueAtTime(d,R),D.gain.exponentialRampToValueAtTime(.001,R+a),L.connect(D),D.connect(f.destination),L.start(R),L.stop(R+a)})},[l]),c=b.useCallback(()=>{o(523.25,.08,"triangle",.035)},[o]),x=b.useCallback(()=>{u([392,523.25,659.25],"sine",.1,.045)},[u]),m=b.useCallback(p=>{o(Z[p%Z.length],.055,"sine",.025)},[o]),h=b.useCallback(()=>{u([196,246.94,329.63,392],"triangle",.09,.04)},[u]),j=b.useCallback(p=>{o(p%2===0?587.33:659.25,.09,"triangle",.035)},[o]),y=b.useCallback(()=>{u([523.25,659.25,783.99,1046.5],"sine",.11,.05)},[u]),S=b.useCallback(()=>{o(220,.08,"sawtooth",.025)},[o]),g=b.useCallback(p=>{s.current=p,n(p)},[]);return{soundEnabled:i,toggleSound:g,playAirportSelect:c,playRoutePlanned:x,playScanStep:m,playFlightStart:h,playWaypoint:j,playArrive:y,playPause:S}}function De(){const[s,i]=b.useState("JFK"),[n,l]=b.useState("HND"),[o,u]=b.useState("dijkstra"),[c,x]=b.useState(()=>J(F,B,"JFK","HND","dijkstra")),[m,h]=b.useState(0),[j,y]=b.useState("idle"),[S,g]=b.useState(!1),[p,k]=b.useState(null),a=b.useRef(null),d=Me(),f=c.steps[m]??null,M=b.useCallback(()=>{a.current&&(window.clearInterval(a.current),a.current=null)},[]);b.useEffect(()=>M,[M]);const N=b.useCallback((A=s,C=n,w=o)=>{M();const ee=J(F,B,A,C,w);x(ee),h(0),y("planning"),g(!1),k(null),d.playRoutePlanned()},[o,M,n,d,s]),L=b.useCallback(A=>{A!==n&&(d.playAirportSelect(),i(A),N(A,n,o))},[o,n,N,d]),D=b.useCallback(A=>{A!==s&&(d.playAirportSelect(),l(A),N(s,A,o))},[o,N,d,s]),R=b.useCallback(A=>{d.playAirportSelect(),u(A),N(s,n,A)},[n,N,d,s]),I=b.useCallback(A=>{const C=Y.find(w=>w.id===A);C&&(d.playAirportSelect(),i(C.source),l(C.destination),u(C.algorithm),N(C.source,C.destination,C.algorithm))},[N,d]),K=b.useCallback(()=>{y("planning"),h(A=>{const C=Math.min(A+1,c.steps.length-1);return C!==A&&d.playScanStep(C),C})},[c.steps.length,d]),z=b.useCallback(()=>{y("planning"),h(A=>{const C=Math.max(A-1,0);return C!==A&&d.playScanStep(C),C})},[d]),P=b.useCallback(()=>{M();const A=c.plan.path;if(A.length<2)return;y("flying"),g(!0),d.playFlightStart();let C=0,w=0;k({from:A[0],to:A[1],progress:0}),a.current=window.setInterval(()=>{if(w+=.045,w>=1){if(C+=1,w=0,C>=A.length-1){M(),k(null),g(!1),y("complete"),d.playArrive();return}d.playWaypoint(C)}k({from:A[C],to:A[C+1],progress:w})},80)},[M,c.plan.path,d]),q=b.useCallback(()=>{if(S){M(),g(!1),d.playPause();return}y("planning"),g(!0),d.playScanStep(m),a.current=window.setInterval(()=>{h(A=>{if(A>=c.steps.length-1)return M(),g(!1),P(),A;const C=A+1;return d.playScanStep(C),C})},420)},[P,M,S,c.steps.length,d,m]),Q=b.useMemo(()=>{const A=f?.route??c.plan.path;return A.slice(0,-1).map((C,w)=>_(B,C,A[w+1])).filter(Boolean)},[f?.route,c.plan.path]);return{airports:F,routes:B,scenarios:Y,source:s,destination:n,algorithm:o,result:c,currentStep:f,stepIndex:m,phase:j,isPlaying:S,flightProgress:p,activeRoute:Q,soundEnabled:d.soundEnabled,toggleSound:d.toggleSound,changeSource:L,changeDestination:D,changeAlgorithm:R,loadScenario:I,planRoute:N,stepForward:K,stepBack:z,playPlanning:q,animateFlight:P}}function He(){const s=De();return t.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.16),transparent_30%),radial-gradient(circle_at_bottom_right,rgba(59,130,246,0.14),transparent_28%)]",children:[t.jsx("div",{className:"border-b border-slate-800/70 bg-slate-950/75 px-4 py-3 shadow-lg shadow-black/20 backdrop-blur-sm md:px-6",children:t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-400",children:"Airport Network Algorithms"}),t.jsx("h2",{className:"text-lg font-bold text-white",children:"World Map Flight Simulator"})]}),t.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[t.jsx(v,{label:"Algorithm",value:O[s.algorithm].label,tone:"indigo"}),t.jsx(v,{label:"Origin",value:s.source,tone:"sky"}),t.jsx(v,{label:"Destination",value:s.destination,tone:"emerald"}),t.jsx(v,{label:"Stops",value:s.result.plan.stops.toString(),tone:"amber"})]})]})}),t.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[t.jsx(ge,{airports:s.airports,routes:s.routes,source:s.source,destination:s.destination,currentStep:s.currentStep,plan:s.result.plan,flightProgress:s.flightProgress,onSelectSource:s.changeSource,onSelectDestination:s.changeDestination}),t.jsx(be,{airports:s.airports,scenarios:s.scenarios,source:s.source,destination:s.destination,algorithm:s.algorithm,plan:s.result.plan,currentStep:s.currentStep,stepIndex:s.stepIndex,totalSteps:s.result.steps.length,phase:s.phase,isPlaying:s.isPlaying,soundEnabled:s.soundEnabled,onSourceChange:s.changeSource,onDestinationChange:s.changeDestination,onAlgorithmChange:s.changeAlgorithm,onLoadScenario:s.loadScenario,onPlanRoute:()=>s.planRoute(),onStepBack:s.stepBack,onStepForward:s.stepForward,onPlay:s.playPlanning,onFly:s.animateFlight,onToggleSound:s.toggleSound})]})]})}function v({label:s,value:i,tone:n}){const l={indigo:"bg-indigo-500/10 text-indigo-200 ring-indigo-500/25",sky:"bg-sky-500/10 text-sky-200 ring-sky-500/25",emerald:"bg-emerald-500/10 text-emerald-200 ring-emerald-500/25",amber:"bg-amber-500/10 text-amber-200 ring-amber-500/25"};return t.jsxs("div",{className:`rounded-full px-3 py-1.5 text-[10px] ring-1 ${l[n]}`,children:[t.jsx("span",{className:"mr-1 uppercase tracking-wider opacity-60",children:s}),t.jsx("span",{className:"font-mono font-bold",children:i})]})}export{He as default}; +import{c as te,r as b,j as t,P as se}from"./index-CB1-0H6I.js";import{S as ae}from"./shuffle-DZnyoAGL.js";import{C as oe,a as ne}from"./chevron-right-ChVmoNtO.js";import{P as re}from"./play-SZ6Nqtz8.js";import{R as ie}from"./route-BuoNUCzx.js";import{V as le,a as ce}from"./volume-x-CKT6TOtL.js";import{g as de}from"./audioContext-NbgqvQGz.js";const ue=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],he=te("radar",ue),pe=[{name:"North America",path:"M45 82C82 46 145 49 196 75C229 59 287 72 331 102C366 126 369 165 337 188C312 207 287 210 264 235C232 268 178 250 149 222C118 192 78 187 56 150C38 119 28 99 45 82Z",fill:"#14532d"},{name:"Greenland",path:"M285 42C332 20 390 35 404 75C388 111 325 119 286 92C267 78 265 55 285 42Z",fill:"#475569"},{name:"Central America",path:"M246 230C277 232 307 242 329 263C307 276 273 267 246 249C232 240 232 231 246 230Z",fill:"#166534"},{name:"South America",path:"M308 264C352 270 383 315 372 374C364 424 334 474 296 483C281 443 259 405 264 359C269 314 281 281 308 264Z",fill:"#15803d"},{name:"Europe",path:"M438 122C470 96 535 91 575 117C602 137 593 166 558 176C522 186 489 177 454 165C427 156 416 139 438 122Z",fill:"#0f766e"},{name:"Africa",path:"M498 202C553 184 612 223 627 283C640 336 608 409 552 425C514 397 484 340 482 283C480 244 482 216 498 202Z",fill:"#166534"},{name:"Middle East",path:"M572 188C615 178 657 196 674 226C648 245 603 239 580 217C568 206 565 194 572 188Z",fill:"#3f6212"},{name:"Asia",path:"M600 111C683 52 842 83 927 168C910 223 836 246 775 229C728 216 703 257 655 244C611 232 566 159 600 111Z",fill:"#164e63"},{name:"Southeast Asia",path:"M728 252C772 247 824 281 833 322C800 335 755 317 728 287C714 271 714 258 728 252Z",fill:"#0f766e"},{name:"Australia",path:"M794 350C850 316 932 335 949 394C897 437 813 426 774 381C760 365 771 354 794 350Z",fill:"#15803d"},{name:"New Zealand",path:"M958 420C979 425 987 448 970 461C951 456 941 432 958 420Z",fill:"#15803d"}],xe=["M186 78C184 128 197 172 230 214","M126 172C171 164 216 173 260 190","M231 237C262 244 292 252 323 263","M303 280C329 305 342 335 335 374","M336 312C350 304 362 304 376 318","M451 140C482 132 515 134 548 149","M496 171C501 144 518 124 545 111","M529 196C540 236 540 277 530 321","M565 223C594 250 611 286 617 329","M591 190C613 203 639 212 671 221","M638 130C675 145 713 153 754 153","M690 184C729 192 768 201 808 216","M757 238C759 278 770 303 807 320","M835 153C841 191 832 219 808 236","M831 365C861 384 892 394 928 396"],me=[{text:"CANADA",x:160,y:118},{text:"UNITED STATES",x:190,y:178},{text:"MEXICO",x:250,y:222},{text:"BRAZIL",x:338,y:336},{text:"ARGENTINA",x:315,y:424},{text:"EUROPE",x:507,y:139},{text:"NORTH AFRICA",x:548,y:246},{text:"SOUTH AFRICA",x:560,y:390},{text:"MIDDLE EAST",x:632,y:210},{text:"INDIA",x:710,y:232},{text:"CHINA",x:779,y:173},{text:"JAPAN",x:890,y:161},{text:"SOUTHEAST ASIA",x:770,y:295},{text:"AUSTRALIA",x:860,y:390}];function ge({airports:s,routes:i,source:n,destination:l,currentStep:o,plan:u,flightProgress:c,onSelectSource:x,onSelectDestination:m}){const h=b.useMemo(()=>new Map(s.map(a=>[a.code,a])),[s]),j=new Set(o?.visited??[]),y=new Set((o?.frontier??[]).map(a=>a.code)),S=o?.route?.length?o.route:u.path,g=new Set(S.slice(0,-1).map((a,d)=>[a,S[d+1]].sort().join("-"))),p=o?.relaxedRoute?[o.relaxedRoute.from,o.relaxedRoute.to].sort().join("-"):null,k=b.useMemo(()=>{if(!c)return null;const a=h.get(c.from),d=h.get(c.to);if(!a||!d)return null;const f=Math.sin(c.progress*Math.PI)*-44;return{x:a.x+(d.x-a.x)*c.progress,y:a.y+(d.y-a.y)*c.progress+f,angle:Math.atan2(d.y-a.y,d.x-a.x)*(180/Math.PI)}},[h,c]);return t.jsxs("div",{className:"relative min-h-[620px] flex-1 overflow-hidden rounded-[1.75rem] border border-slate-700/50 bg-slate-950/90 shadow-2xl shadow-black/40",children:[t.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_18%_22%,rgba(14,165,233,0.16),transparent_28%),radial-gradient(circle_at_78%_72%,rgba(59,130,246,0.12),transparent_30%)]"}),t.jsxs("div",{className:"absolute left-5 top-5 z-20 rounded-2xl border border-slate-700/60 bg-slate-950/85 p-4 shadow-xl shadow-black/30 backdrop-blur-sm",children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-400",children:"Global Air Traffic Network"}),t.jsxs("div",{className:"mt-2 flex gap-4 text-xs text-slate-300",children:[t.jsxs("span",{children:[t.jsx("strong",{className:"font-mono text-white",children:s.length})," airports"]}),t.jsxs("span",{children:[t.jsx("strong",{className:"font-mono text-white",children:i.length})," routes"]}),t.jsxs("span",{children:[t.jsx("strong",{className:"font-mono text-white",children:u.path.length||0})," hops"]})]})]}),o&&t.jsxs("div",{className:"absolute bottom-5 left-5 z-20 max-w-md rounded-2xl border border-slate-700/60 bg-slate-950/90 p-4 shadow-xl shadow-black/35 backdrop-blur-sm",children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-indigo-300",children:"Algorithm Radar"}),t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-slate-300",children:o.description}),o.frontier.length>0&&t.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:o.frontier.slice(0,7).map(a=>t.jsxs("span",{className:"rounded-full bg-sky-500/10 px-2 py-1 text-[10px] font-mono font-semibold text-sky-300 ring-1 ring-sky-500/25",children:[a.code,": ",Number.isFinite(a.priority)?a.priority:"∞"]},`${a.code}-${a.priority}`))})]}),t.jsxs("svg",{viewBox:"0 0 1000 520",className:"relative z-10 h-full w-full",preserveAspectRatio:"xMidYMid meet",children:[t.jsxs("defs",{children:[t.jsxs("filter",{id:"world-glow",x:"-40%",y:"-40%",width:"180%",height:"180%",children:[t.jsx("feGaussianBlur",{stdDeviation:"4",result:"blur"}),t.jsxs("feMerge",{children:[t.jsx("feMergeNode",{in:"blur"}),t.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),t.jsx("filter",{id:"world-shadow",x:"-60%",y:"-60%",width:"220%",height:"220%",children:t.jsx("feDropShadow",{dx:"0",dy:"8",stdDeviation:"6",floodColor:"#020617",floodOpacity:"0.7"})}),t.jsxs("linearGradient",{id:"ocean",x1:"0",x2:"1",y1:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:"#07111f"}),t.jsx("stop",{offset:"55%",stopColor:"#082f49"}),t.jsx("stop",{offset:"100%",stopColor:"#020617"})]})]}),t.jsx("rect",{width:"1000",height:"520",rx:"28",fill:"url(#ocean)"}),[130,260,390].map(a=>t.jsx("path",{d:`M0 ${a}H1000`,stroke:"#38bdf8",strokeOpacity:"0.1",strokeDasharray:"7 10"},`lat-${a}`)),[125,250,375,500,625,750,875].map(a=>t.jsx("path",{d:`M${a} 0V520`,stroke:"#38bdf8",strokeOpacity:"0.08",strokeDasharray:"7 10"},`lon-${a}`)),t.jsx("path",{d:"M0 260H1000",stroke:"#67e8f9",strokeOpacity:"0.2",strokeDasharray:"8 9"}),t.jsx("path",{d:"M500 0V520",stroke:"#67e8f9",strokeOpacity:"0.14",strokeDasharray:"8 9"}),t.jsx("g",{filter:"url(#world-shadow)",children:pe.map(a=>t.jsx("path",{d:a.path,fill:a.fill,fillOpacity:"0.78",stroke:"#a7f3d0",strokeOpacity:"0.42",strokeWidth:"1.8"},a.name))}),t.jsx("g",{children:xe.map(a=>t.jsx("path",{d:a,fill:"none",stroke:"#d1fae5",strokeOpacity:"0.22",strokeWidth:"1",strokeDasharray:"4 5"},a))}),t.jsx("g",{children:me.map(a=>t.jsx("text",{x:a.x,y:a.y,textAnchor:"middle",fontSize:"11",fontWeight:"800",letterSpacing:"1.4",fill:"#e2e8f0",fillOpacity:"0.28",children:a.text},a.text))}),i.map(a=>{const d=h.get(a.source),f=h.get(a.destination);if(!d||!f)return null;const M=[a.source,a.destination].sort().join("-"),N=g.has(M),L=M===p,D=L?"#facc15":N?"#22c55e":"#334155",R=Math.min(120,Math.abs(d.x-f.x)*.12+28),I=(d.x+f.x)/2,K=(d.y+f.y)/2-R;return t.jsx("g",{children:t.jsx("path",{d:`M${d.x},${d.y} Q${I},${K} ${f.x},${f.y}`,fill:"none",stroke:D,strokeWidth:N||L?3:1.2,strokeOpacity:N||L?.92:.24,strokeDasharray:N?void 0:"5 8",filter:N||L?"url(#world-glow)":void 0})},a.id)}),s.map(a=>{const d=a.code===n,f=a.code===l,M=j.has(a.code),N=y.has(a.code),L=o?.airportCode===a.code,D=d||f||L||N||M||a.hubScore>=92,R=d?"#fde047":f?"#fb923c":L?"#38bdf8":M?"#22c55e":N?"#a78bfa":"#94a3b8";return t.jsxs("g",{className:"cursor-pointer",children:[t.jsxs("title",{children:[a.code," - ",a.city,", ",a.country]}),t.jsx("circle",{cx:a.x,cy:a.y,r:d||f?12:8,fill:"#020617",stroke:"#0f172a",strokeWidth:7,filter:"url(#world-shadow)"}),t.jsx("circle",{cx:a.x,cy:a.y,r:d||f?9:6,fill:R,fillOpacity:d||f||M||N||L?.96:.58,stroke:R,strokeWidth:L?4:2,onClick:I=>{I.shiftKey?m(a.code):x(a.code)}}),D&&t.jsx("text",{x:a.x,y:a.y-14,textAnchor:"middle",fontSize:"10",fontWeight:"800",fontFamily:"ui-monospace, monospace",fill:R,children:a.code})]},a.code)}),k&&t.jsxs("g",{transform:`translate(${k.x} ${k.y}) rotate(${k.angle})`,filter:"url(#world-glow)",children:[t.jsx("path",{d:"M-14 -5L18 0L-14 5L-8 0Z",fill:"#f8fafc",stroke:"#38bdf8",strokeWidth:"1.2"}),t.jsx("path",{d:"M-5 -3L-12 -13L2 -4Z",fill:"#bae6fd",opacity:"0.9"}),t.jsx("path",{d:"M-5 3L-12 13L2 4Z",fill:"#bae6fd",opacity:"0.9"})]})]}),t.jsxs("div",{className:"absolute bottom-5 right-5 z-20 hidden rounded-2xl border border-slate-700/60 bg-slate-950/85 p-4 text-[10px] text-slate-400 shadow-xl shadow-black/30 backdrop-blur-sm sm:block",children:[t.jsx("div",{className:"mb-2 font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Tip"}),"Click an airport to set origin. Shift-click to set destination."]})]})}const O={dijkstra:{label:"Dijkstra",description:"Finds the lowest total travel time by relaxing routes through a priority queue.",metric:"Shortest time"},astar:{label:"A* Search",description:"Uses distance-to-destination as a heuristic to guide the priority queue.",metric:"Guided shortest path"},bfs:{label:"BFS",description:"Ignores weights and searches by fewest airport connections.",metric:"Fewest stops"},greedy:{label:"Greedy",description:"Always flies toward the airport geographically closest to the destination.",metric:"Nearest-looking route"}},fe=["dijkstra","astar","bfs","greedy"];function be({airports:s,scenarios:i,source:n,destination:l,algorithm:o,plan:u,currentStep:c,stepIndex:x,totalSteps:m,phase:h,isPlaying:j,soundEnabled:y,onSourceChange:S,onDestinationChange:g,onAlgorithmChange:p,onLoadScenario:k,onPlanRoute:a,onStepBack:d,onStepForward:f,onPlay:M,onFly:N,onToggleSound:L}){return t.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-4 overflow-y-auto xl:w-88",children:[t.jsxs("section",{className:"rounded-2xl border border-sky-500/20 bg-slate-950/75 p-4 shadow-2xl shadow-black/30 backdrop-blur-sm",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/30",children:t.jsx(se,{size:18})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-bold text-white",children:"World Flight Planner"}),t.jsx("p",{className:"text-[10px] text-slate-500",children:"Airport-code simulator inspired by public airport datasets."})]})]}),t.jsx("p",{className:"text-xs leading-relaxed text-slate-400",children:"Pick countries through their major airport codes, then compare how different algorithms choose routes across global hubs."})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Travel Request"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(X,{label:"Origin",value:n,airports:s,onChange:S}),t.jsx(X,{label:"Destination",value:l,airports:s,onChange:g})]}),t.jsxs("button",{onClick:a,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-xl bg-sky-500/15 px-3 py-2 text-xs font-semibold text-sky-300 ring-1 ring-sky-500/30 transition hover:bg-sky-500/25",children:[t.jsx(he,{size:13})," Recalculate route"]})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Algorithms"}),t.jsx("div",{className:"grid gap-2",children:fe.map(D=>t.jsxs("button",{onClick:()=>p(D),className:`rounded-xl p-3 text-left transition ${o===D?"bg-indigo-500/15 text-indigo-200 ring-1 ring-indigo-500/35":"bg-slate-900/70 text-slate-400 ring-1 ring-slate-800/80 hover:bg-slate-800/80"}`,children:[t.jsxs("span",{className:"flex items-center justify-between text-xs font-bold",children:[O[D].label,t.jsx("span",{className:"text-[9px] uppercase tracking-wider opacity-60",children:O[D].metric})]}),t.jsx("span",{className:"mt-1 block text-[10px] leading-snug opacity-75",children:O[D].description})]},D))})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Preset Missions"}),t.jsx("div",{className:"grid gap-2",children:i.map(D=>t.jsxs("button",{onClick:()=>k(D.id),className:"rounded-xl bg-slate-900/70 p-3 text-left ring-1 ring-slate-800/80 transition hover:bg-slate-800/80",children:[t.jsxs("span",{className:"flex items-center gap-2 text-xs font-bold text-slate-200",children:[t.jsx(ae,{size:12})," ",D.title]}),t.jsx("span",{className:"mt-1 block text-[10px] leading-snug text-slate-500",children:D.description})]},D.id))})]}),t.jsxs("section",{className:"rounded-2xl border border-emerald-500/20 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Flight Plan"}),t.jsx("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[9px] font-bold uppercase tracking-wider text-emerald-300 ring-1 ring-emerald-500/25",children:h})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(H,{label:"Distance",value:`${u.totalDistanceKm.toLocaleString()} km`}),t.jsx(H,{label:"Duration",value:`${u.totalDurationHours}h`}),t.jsx(H,{label:"Stops",value:u.stops.toString()}),t.jsx(H,{label:"Est. Cost",value:`$${u.totalCostUsd.toLocaleString()}`})]}),t.jsxs("div",{className:"mt-3 rounded-xl bg-slate-900/70 p-3 ring-1 ring-slate-800/80",children:[t.jsx("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:"Route"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:u.path.map((D,R)=>t.jsx("span",{className:"rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-mono font-semibold text-emerald-300 ring-1 ring-emerald-500/20",children:D},`${D}-${R}`))})]})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Simulation"}),t.jsxs("div",{className:"mb-3 flex items-center justify-between text-[10px] text-slate-500",children:[t.jsx("span",{children:"Step"}),t.jsxs("span",{className:"font-mono text-indigo-300",children:[Math.min(x+1,m)," / ",m]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsxs("button",{onClick:d,disabled:x<=0,className:"flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs text-slate-400 ring-1 ring-slate-800/80 disabled:opacity-30",children:[t.jsx(oe,{size:13})," Back"]}),t.jsxs("button",{onClick:M,className:"flex items-center justify-center gap-1 rounded-xl bg-indigo-500/15 px-2 py-2 text-xs font-semibold text-indigo-300 ring-1 ring-indigo-500/30",children:[t.jsx(re,{size:13})," ",j?"Pause":"Play"]}),t.jsxs("button",{onClick:f,disabled:x>=m-1,className:"flex items-center justify-center gap-1 rounded-xl bg-slate-900/70 px-2 py-2 text-xs text-slate-400 ring-1 ring-slate-800/80 disabled:opacity-30",children:["Next ",t.jsx(ne,{size:13})]})]}),t.jsxs("button",{onClick:N,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-xl bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-300 ring-1 ring-emerald-500/30 transition hover:bg-emerald-500/25",children:[t.jsx(ie,{size:13})," Animate airplane"]}),c&&t.jsx("p",{className:"mt-3 text-xs leading-relaxed text-slate-400",children:c.description})]}),t.jsxs("section",{className:"rounded-2xl border border-slate-700/50 bg-slate-950/75 p-4 shadow-xl shadow-black/20 backdrop-blur-sm",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-slate-400",children:"Audio"}),t.jsxs("button",{onClick:()=>L(!y),className:`flex w-full items-center justify-center gap-2 rounded-xl px-3 py-2 text-xs font-semibold ring-1 transition ${y?"bg-sky-500/15 text-sky-300 ring-sky-500/30 hover:bg-sky-500/25":"bg-slate-900/70 text-slate-400 ring-slate-800/80 hover:bg-slate-800/80"}`,children:[y?t.jsx(le,{size:13}):t.jsx(ce,{size:13}),y?"Sound On":"Sound Off"]}),t.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-slate-500",children:"Radar pings mark search steps, with takeoff, waypoint, and arrival tones during flight."})]})]})}function X({label:s,value:i,airports:n,onChange:l}){return t.jsxs("label",{className:"block",children:[t.jsx("span",{className:"mb-1 block text-[10px] font-semibold uppercase tracking-wider text-slate-500",children:s}),t.jsx("select",{value:i,onChange:o=>l(o.target.value),className:"w-full rounded-xl border border-slate-700 bg-slate-900 px-3 py-2 text-xs font-mono text-slate-200 outline-none ring-sky-500/20 focus:ring-2",children:n.map(o=>t.jsxs("option",{value:o.code,children:[o.code," - ",o.city]},o.code))})]})}function H({label:s,value:i}){return t.jsxs("div",{className:"rounded-xl bg-slate-900/70 p-3 ring-1 ring-slate-800/80",children:[t.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-slate-500",children:s}),t.jsx("div",{className:"mt-1 font-mono text-sm font-black text-white",children:i})]})}function Ae(s,i){return{x:(s+180)/360*1e3,y:(90-i)/180*520}}function r(s,i,n,l,o,u,c){return{code:s,city:i,country:n,region:l,lat:o,lon:u,hubScore:c,...Ae(u,o)}}const F=[r("ATL","Atlanta","United States","North America",33.6407,-84.4277,98),r("ORD","Chicago","United States","North America",41.9742,-87.9073,96),r("DFW","Dallas-Fort Worth","United States","North America",32.8998,-97.0403,94),r("JFK","New York","United States","North America",40.6413,-73.7781,96),r("LAX","Los Angeles","United States","North America",33.9416,-118.4085,94),r("MIA","Miami","United States","North America",25.7959,-80.287,88),r("SEA","Seattle","United States","North America",47.4502,-122.3088,84),r("SFO","San Francisco","United States","North America",37.6213,-122.379,90),r("YVR","Vancouver","Canada","North America",49.1967,-123.1815,76),r("YYZ","Toronto","Canada","North America",43.6777,-79.6248,78),r("MEX","Mexico City","Mexico","North America",19.4361,-99.0719,76),r("BOG","Bogota","Colombia","South America",4.7016,-74.1469,78),r("LIM","Lima","Peru","South America",-12.0219,-77.1143,76),r("EZE","Buenos Aires","Argentina","South America",-34.8222,-58.5358,74),r("GRU","Sao Paulo","Brazil","South America",-23.4356,-46.4731,84),r("SCL","Santiago","Chile","South America",-33.3928,-70.7858,72),r("AMS","Amsterdam","Netherlands","Europe",52.3105,4.7683,93),r("ARN","Stockholm","Sweden","Europe",59.6498,17.9238,70),r("ATH","Athens","Greece","Europe",37.9364,23.9445,72),r("BCN","Barcelona","Spain","Europe",41.2974,2.0833,76),r("BRU","Brussels","Belgium","Europe",50.9014,4.4844,74),r("CPH","Copenhagen","Denmark","Europe",55.618,12.6561,74),r("LHR","London","United Kingdom","Europe",51.47,-.4543,98),r("CDG","Paris","France","Europe",49.0097,2.5479,94),r("DUB","Dublin","Ireland","Europe",53.4264,-6.2499,70),r("FCO","Rome","Italy","Europe",41.8003,12.2389,78),r("FRA","Frankfurt","Germany","Europe",50.0379,8.5622,96),r("HEL","Helsinki","Finland","Europe",60.3172,24.9633,70),r("LIS","Lisbon","Portugal","Europe",38.7742,-9.1342,70),r("MAD","Madrid","Spain","Europe",40.4983,-3.5676,82),r("MUC","Munich","Germany","Europe",48.3538,11.7861,84),r("VIE","Vienna","Austria","Europe",48.1103,16.5697,76),r("WAW","Warsaw","Poland","Europe",52.1657,20.9671,70),r("ZRH","Zurich","Switzerland","Europe",47.4581,8.5555,82),r("IST","Istanbul","Turkey","Europe/Asia",41.2753,28.7519,92),r("ADD","Addis Ababa","Ethiopia","Africa",8.9779,38.7993,82),r("CMN","Casablanca","Morocco","Africa",33.3675,-7.58997,74),r("CAI","Cairo","Egypt","Africa",30.112,31.4003,70),r("CPT","Cape Town","South Africa","Africa",-33.9715,18.6021,70),r("LOS","Lagos","Nigeria","Africa",6.5774,3.3212,72),r("JNB","Johannesburg","South Africa","Africa",-26.1337,28.242,80),r("NBO","Nairobi","Kenya","Africa",-1.3192,36.9278,68),r("AUH","Abu Dhabi","United Arab Emirates","Middle East",24.433,54.6511,82),r("DXB","Dubai","United Arab Emirates","Middle East",25.2532,55.3657,99),r("DOH","Doha","Qatar","Middle East",25.2731,51.6081,88),r("JED","Jeddah","Saudi Arabia","Middle East",21.6796,39.1565,78),r("RUH","Riyadh","Saudi Arabia","Middle East",24.9576,46.6988,76),r("TLV","Tel Aviv","Israel","Middle East",32.0114,34.8867,74),r("BKK","Bangkok","Thailand","Asia",13.69,100.7501,88),r("BLR","Bengaluru","India","Asia",13.1986,77.7066,76),r("BOM","Mumbai","India","Asia",19.0896,72.8656,84),r("CAN","Guangzhou","China","Asia",23.3924,113.2988,86),r("CGK","Jakarta","Indonesia","Asia",-6.1256,106.6559,82),r("DEL","Delhi","India","Asia",28.5562,77.1,86),r("HKG","Hong Kong","China","Asia",22.308,113.9185,92),r("SIN","Singapore","Singapore","Asia",1.3644,103.9915,96),r("ICN","Seoul","South Korea","Asia",37.4602,126.4407,94),r("KUL","Kuala Lumpur","Malaysia","Asia",2.7456,101.7072,82),r("MNL","Manila","Philippines","Asia",14.5086,121.0194,78),r("PEK","Beijing","China","Asia",40.0799,116.6031,90),r("PVG","Shanghai","China","Asia",31.1443,121.8083,92),r("TPE","Taipei","Taiwan","Asia",25.0797,121.2342,82),r("HND","Tokyo","Japan","Asia",35.5494,139.7798,95),r("BNE","Brisbane","Australia","Oceania",-27.3842,153.1175,70),r("MEL","Melbourne","Australia","Oceania",-37.669,144.841,78),r("PER","Perth","Australia","Oceania",-31.9403,115.9672,72),r("SYD","Sydney","Australia","Oceania",-33.9399,151.1753,84),r("AKL","Auckland","New Zealand","Oceania",-37.0082,174.785,66)],V=new Map(F.map(s=>[s.code,s]));function ye(s,i){const l=h=>h*Math.PI/180,o=l(i.lat-s.lat),u=l(i.lon-s.lon),c=l(s.lat),x=l(i.lat),m=Math.sin(o/2)**2+Math.cos(c)*Math.cos(x)*Math.sin(u/2)**2;return Math.round(2*6371*Math.asin(Math.sqrt(m)))}function e(s,i){const n=V.get(s),l=V.get(i);if(!n||!l)throw new Error(`Unknown airport route: ${s}-${i}`);const o=ye(n,l);return{id:`${s}-${i}`,source:s,destination:i,distanceKm:o,durationHours:Math.round((o/870+.65)*10)/10,costUsd:Math.round(o*.11+140)}}const B=[e("ATL","DFW"),e("ATL","JFK"),e("ATL","LAX"),e("ATL","MIA"),e("ATL","ORD"),e("ATL","YYZ"),e("ORD","DFW"),e("ORD","JFK"),e("ORD","LAX"),e("ORD","SEA"),e("ORD","SFO"),e("ORD","YYZ"),e("DFW","LAX"),e("DFW","MEX"),e("DFW","MIA"),e("DFW","SFO"),e("JFK","LAX"),e("JFK","YYZ"),e("JFK","LHR"),e("JFK","CDG"),e("JFK","AMS"),e("JFK","FRA"),e("JFK","MEX"),e("JFK","MIA"),e("JFK","SFO"),e("JFK","MAD"),e("JFK","DUB"),e("JFK","GRU"),e("LAX","HND"),e("LAX","ICN"),e("LAX","PVG"),e("LAX","SIN"),e("LAX","SYD"),e("LAX","MEX"),e("LAX","SFO"),e("LAX","SEA"),e("LAX","YVR"),e("YYZ","LHR"),e("YYZ","AMS"),e("YYZ","FRA"),e("YYZ","YVR"),e("MIA","BOG"),e("MIA","GRU"),e("MIA","LIM"),e("MIA","MEX"),e("SEA","YVR"),e("SEA","HND"),e("SEA","ICN"),e("SFO","HKG"),e("SFO","HND"),e("SFO","ICN"),e("SFO","SIN"),e("YVR","HND"),e("YVR","ICN"),e("MEX","BOG"),e("MEX","GRU"),e("MEX","LIM"),e("MEX","SCL"),e("BOG","GRU"),e("BOG","LIM"),e("BOG","MAD"),e("LIM","EZE"),e("LIM","SCL"),e("LIM","GRU"),e("EZE","GRU"),e("EZE","MAD"),e("EZE","SCL"),e("GRU","SCL"),e("GRU","MAD"),e("GRU","LIS"),e("GRU","CDG"),e("GRU","JNB"),e("SCL","AKL"),e("AMS","BRU"),e("AMS","CPH"),e("AMS","DUB"),e("AMS","FRA"),e("AMS","LHR"),e("AMS","ZRH"),e("ARN","CPH"),e("ARN","HEL"),e("ARN","LHR"),e("ATH","FCO"),e("ATH","IST"),e("ATH","VIE"),e("BCN","FCO"),e("BCN","LHR"),e("BCN","MAD"),e("BRU","CDG"),e("BRU","FRA"),e("CPH","FRA"),e("CPH","HEL"),e("CPH","LHR"),e("LHR","CDG"),e("LHR","MAD"),e("LHR","FRA"),e("LHR","ZRH"),e("LHR","DUB"),e("LHR","FCO"),e("LHR","DXB"),e("LHR","DOH"),e("LHR","SIN"),e("CDG","MAD"),e("CDG","FRA"),e("CDG","FCO"),e("CDG","IST"),e("CDG","DXB"),e("DUB","LIS"),e("FCO","IST"),e("FCO","MAD"),e("FRA","IST"),e("FRA","MUC"),e("FRA","VIE"),e("FRA","ZRH"),e("FRA","DXB"),e("HEL","WAW"),e("LIS","MAD"),e("MAD","CMN"),e("MAD","CAI"),e("MAD","DOH"),e("MUC","VIE"),e("MUC","ZRH"),e("VIE","WAW"),e("VIE","IST"),e("WAW","IST"),e("ZRH","VIE"),e("IST","ADD"),e("IST","CAI"),e("IST","DXB"),e("IST","DOH"),e("IST","TLV"),e("ADD","CAI"),e("ADD","JNB"),e("ADD","NBO"),e("ADD","DXB"),e("CMN","CAI"),e("CMN","LIS"),e("CMN","LOS"),e("CAI","JNB"),e("CAI","NBO"),e("CAI","JED"),e("CAI","RUH"),e("CAI","TLV"),e("CPT","JNB"),e("CPT","ADD"),e("CPT","DXB"),e("LOS","ADD"),e("LOS","JNB"),e("JNB","NBO"),e("JNB","SYD"),e("JNB","DXB"),e("NBO","DXB"),e("NBO","DOH"),e("AUH","BOM"),e("AUH","DEL"),e("AUH","JED"),e("AUH","LHR"),e("AUH","SIN"),e("DXB","DOH"),e("DXB","AUH"),e("DXB","DEL"),e("DXB","BOM"),e("DXB","BKK"),e("DXB","SIN"),e("DXB","HKG"),e("DXB","SYD"),e("DOH","BOM"),e("DOH","DEL"),e("DOH","JED"),e("DOH","SIN"),e("DOH","SYD"),e("JED","RUH"),e("JED","DEL"),e("RUH","DXB"),e("TLV","ATH"),e("TLV","DXB"),e("BKK","DEL"),e("BKK","HKG"),e("BKK","KUL"),e("BKK","SIN"),e("BKK","TPE"),e("BLR","BOM"),e("BLR","DEL"),e("BLR","SIN"),e("BOM","DEL"),e("BOM","SIN"),e("BOM","LHR"),e("CAN","HKG"),e("CAN","PEK"),e("CAN","PVG"),e("CAN","SIN"),e("CGK","KUL"),e("CGK","SIN"),e("CGK","SYD"),e("DEL","SIN"),e("DEL","HND"),e("DEL","HKG"),e("DEL","ICN"),e("HKG","ICN"),e("HKG","MNL"),e("HKG","PVG"),e("HKG","SIN"),e("HKG","TPE"),e("ICN","HND"),e("ICN","PEK"),e("ICN","PVG"),e("SIN","HND"),e("SIN","KUL"),e("SIN","MNL"),e("SIN","SYD"),e("KUL","MNL"),e("KUL","PER"),e("MNL","HND"),e("PEK","HND"),e("PEK","PVG"),e("PEK","SFO"),e("PVG","HND"),e("PVG","TPE"),e("TPE","HND"),e("HND","SYD"),e("HND","BNE"),e("BNE","SYD"),e("BNE","MEL"),e("MEL","SYD"),e("MEL","AKL"),e("PER","MEL"),e("PER","SYD"),e("PER","SIN"),e("SYD","AKL")],Y=[{id:"trans-atlantic",title:"New York to Tokyo",description:"Compare westbound Pacific hops against eastbound European and Gulf hub routes.",source:"JFK",destination:"HND",algorithm:"dijkstra"},{id:"southern-cross",title:"London to Sydney",description:"Route across Europe, the Gulf, Asia, and Oceania using weighted flight times.",source:"LHR",destination:"SYD",algorithm:"astar"},{id:"africa-to-americas",title:"Johannesburg to Los Angeles",description:"Study how different algorithms connect Africa to the Americas through major hubs.",source:"JNB",destination:"LAX",algorithm:"greedy"},{id:"fewest-stops",title:"Toronto to Singapore",description:"Use BFS to minimize the number of airport connections, ignoring flight duration.",source:"YYZ",destination:"SIN",algorithm:"bfs"}];function W(s){return new Map(s.map(i=>[i.code,i]))}function G(s,i){return s.flatMap(n=>n.source===i?[{code:n.destination,route:n}]:n.destination===i?[{code:n.source,route:n}]:[])}function _(s,i,n){return s.find(l=>l.source===i&&l.destination===n||l.source===n&&l.destination===i)??null}function J(s,i,n,l,o){return o==="bfs"?Ne(s,i,n,l):o==="greedy"?Ce(s,i,n,l):Se(s,i,n,l,o)}function Se(s,i,n,l,o){const u=W(s),c={},x={},m=new Set,h=[{code:n,priority:0}],j=[];for(const g of s)c[g.code]=g.code===n?0:1/0,x[g.code]=null;for(j.push(E("init",n,`Start at ${n}. Set its travel time to 0 and every other airport to infinity.`,m,h,c,x));h.length>0;){h.sort((p,k)=>p.priority-k.priority);const g=h.shift();if(!m.has(g.code)){if(m.add(g.code),j.push(E("select",g.code,`Select ${g.code}, the airport with the best current priority.`,m,h,c,x)),g.code===l)break;for(const p of G(i,g.code)){if(m.has(p.code))continue;const k=c[g.code]+p.route.durationHours;if(k ${p.code} improves the route to ${c[p.code]}h.`,m,h,c,x,{from:g.code,to:p.code}))}else j.push(E("dead-end",p.code,`${g.code} -> ${p.code} is slower than the best known route.`,m,h,c,x,{from:g.code,to:p.code}))}}}const y=U(x,n,l),S=$(i,y);return j.push(E("done",l,`Route complete: ${y.join(" -> ")}`,m,h,c,x,void 0,y)),{steps:j,plan:S}}function Ne(s,i,n,l){const o=new Set([n]),u={},c={},x=[{code:n,priority:0}],m=[];for(const y of s)u[y.code]=null,c[y.code]=y.code===n?0:1/0;for(m.push(E("init",n,`Start BFS at ${n}. Each edge counts as one airport hop.`,o,x,c,u));x.length>0;){const y=x.shift();if(m.push(E("select",y.code,`Visit ${y.code} and enqueue all unseen connected airports.`,o,x,c,u)),y.code===l)break;for(const S of G(i,y.code))o.has(S.code)||(o.add(S.code),u[S.code]=y.code,c[S.code]=c[y.code]+1,x.push({code:S.code,priority:c[S.code]}),m.push(E("enqueue",S.code,`Add ${S.code} to the BFS queue at hop ${c[S.code]}.`,o,x,c,u,{from:y.code,to:S.code})))}const h=U(u,n,l),j=$(i,h);return m.push(E("done",l,`Fewest-stop route complete: ${h.join(" -> ")}`,o,x,c,u,void 0,h)),{steps:m,plan:j}}function Ce(s,i,n,l){const o=W(s),u=new Set,c={},x={},m=[];let h=n;for(const S of s)c[S.code]=null,x[S.code]=S.code===n?0:1/0;for(m.push(E("init",n,`Start greedy routing at ${n}. Always choose the neighbor closest to ${l}.`,u,[{code:n,priority:0}],x,c));h!==l;){u.add(h);const S=G(i,h).filter(p=>!u.has(p.code)).sort((p,k)=>T(o.get(p.code),o.get(l))-T(o.get(k.code),o.get(l)));if(m.push(E("select",h,`From ${h}, compare nearby hubs by straight-line distance to ${l}.`,u,S.map(p=>({code:p.code,priority:Math.round(T(o.get(p.code),o.get(l))*10)/10})),x,c)),S.length===0)break;const g=S[0];x[g.code]=Math.round((x[h]+g.route.durationHours)*10)/10,c[g.code]=h,m.push(E("relax",g.code,`Greedy picks ${g.code} as the closest-looking next airport.`,u,[],x,c,{from:h,to:g.code})),h=g.code}const j=U(c,n,l),y=$(i,j);return m.push(E("done",l,`Greedy route complete: ${j.join(" -> ")}`,u,[],x,c,void 0,j)),{steps:m,plan:y}}function E(s,i,n,l,o,u,c,x,m){return{type:s,airportCode:i,description:n,visited:Array.from(l),frontier:o.map(h=>({code:h.code,priority:h.priority})),distances:{...u},previous:{...c},relaxedRoute:x,route:m}}function U(s,i,n){const l=[];let o=n;for(;o&&(l.unshift(o),o!==i);)o=s[o];return l[0]===i?l:[]}function $(s,i){let n=0,l=0,o=0;for(let u=0;ude(),[]),o=b.useCallback((p,k,a="sine",d=.045)=>{if(!s.current)return;const f=l();if(!f)return;const M=f.createOscillator(),N=f.createGain();M.type=a,M.frequency.setValueAtTime(p,f.currentTime),N.gain.setValueAtTime(d,f.currentTime),N.gain.exponentialRampToValueAtTime(.001,f.currentTime+k),M.connect(N),N.connect(f.destination),M.start(f.currentTime),M.stop(f.currentTime+k)},[l]),u=b.useCallback((p,k,a,d=.04)=>{if(!s.current)return;const f=l();f&&p.forEach((M,N)=>{const L=f.createOscillator(),D=f.createGain(),R=f.currentTime+N*a*.75;L.type=k,L.frequency.setValueAtTime(M,R),D.gain.setValueAtTime(d,R),D.gain.exponentialRampToValueAtTime(.001,R+a),L.connect(D),D.connect(f.destination),L.start(R),L.stop(R+a)})},[l]),c=b.useCallback(()=>{o(523.25,.08,"triangle",.035)},[o]),x=b.useCallback(()=>{u([392,523.25,659.25],"sine",.1,.045)},[u]),m=b.useCallback(p=>{o(Z[p%Z.length],.055,"sine",.025)},[o]),h=b.useCallback(()=>{u([196,246.94,329.63,392],"triangle",.09,.04)},[u]),j=b.useCallback(p=>{o(p%2===0?587.33:659.25,.09,"triangle",.035)},[o]),y=b.useCallback(()=>{u([523.25,659.25,783.99,1046.5],"sine",.11,.05)},[u]),S=b.useCallback(()=>{o(220,.08,"sawtooth",.025)},[o]),g=b.useCallback(p=>{s.current=p,n(p)},[]);return{soundEnabled:i,toggleSound:g,playAirportSelect:c,playRoutePlanned:x,playScanStep:m,playFlightStart:h,playWaypoint:j,playArrive:y,playPause:S}}function De(){const[s,i]=b.useState("JFK"),[n,l]=b.useState("HND"),[o,u]=b.useState("dijkstra"),[c,x]=b.useState(()=>J(F,B,"JFK","HND","dijkstra")),[m,h]=b.useState(0),[j,y]=b.useState("idle"),[S,g]=b.useState(!1),[p,k]=b.useState(null),a=b.useRef(null),d=Me(),f=c.steps[m]??null,M=b.useCallback(()=>{a.current&&(window.clearInterval(a.current),a.current=null)},[]);b.useEffect(()=>M,[M]);const N=b.useCallback((A=s,C=n,w=o)=>{M();const ee=J(F,B,A,C,w);x(ee),h(0),y("planning"),g(!1),k(null),d.playRoutePlanned()},[o,M,n,d,s]),L=b.useCallback(A=>{A!==n&&(d.playAirportSelect(),i(A),N(A,n,o))},[o,n,N,d]),D=b.useCallback(A=>{A!==s&&(d.playAirportSelect(),l(A),N(s,A,o))},[o,N,d,s]),R=b.useCallback(A=>{d.playAirportSelect(),u(A),N(s,n,A)},[n,N,d,s]),I=b.useCallback(A=>{const C=Y.find(w=>w.id===A);C&&(d.playAirportSelect(),i(C.source),l(C.destination),u(C.algorithm),N(C.source,C.destination,C.algorithm))},[N,d]),K=b.useCallback(()=>{y("planning"),h(A=>{const C=Math.min(A+1,c.steps.length-1);return C!==A&&d.playScanStep(C),C})},[c.steps.length,d]),z=b.useCallback(()=>{y("planning"),h(A=>{const C=Math.max(A-1,0);return C!==A&&d.playScanStep(C),C})},[d]),P=b.useCallback(()=>{M();const A=c.plan.path;if(A.length<2)return;y("flying"),g(!0),d.playFlightStart();let C=0,w=0;k({from:A[0],to:A[1],progress:0}),a.current=window.setInterval(()=>{if(w+=.045,w>=1){if(C+=1,w=0,C>=A.length-1){M(),k(null),g(!1),y("complete"),d.playArrive();return}d.playWaypoint(C)}k({from:A[C],to:A[C+1],progress:w})},80)},[M,c.plan.path,d]),q=b.useCallback(()=>{if(S){M(),g(!1),d.playPause();return}y("planning"),g(!0),d.playScanStep(m),a.current=window.setInterval(()=>{h(A=>{if(A>=c.steps.length-1)return M(),g(!1),P(),A;const C=A+1;return d.playScanStep(C),C})},420)},[P,M,S,c.steps.length,d,m]),Q=b.useMemo(()=>{const A=f?.route??c.plan.path;return A.slice(0,-1).map((C,w)=>_(B,C,A[w+1])).filter(Boolean)},[f?.route,c.plan.path]);return{airports:F,routes:B,scenarios:Y,source:s,destination:n,algorithm:o,result:c,currentStep:f,stepIndex:m,phase:j,isPlaying:S,flightProgress:p,activeRoute:Q,soundEnabled:d.soundEnabled,toggleSound:d.toggleSound,changeSource:L,changeDestination:D,changeAlgorithm:R,loadScenario:I,planRoute:N,stepForward:K,stepBack:z,playPlanning:q,animateFlight:P}}function He(){const s=De();return t.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.16),transparent_30%),radial-gradient(circle_at_bottom_right,rgba(59,130,246,0.14),transparent_28%)]",children:[t.jsx("div",{className:"border-b border-slate-800/70 bg-slate-950/75 px-4 py-3 shadow-lg shadow-black/20 backdrop-blur-sm md:px-6",children:t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-400",children:"Airport Network Algorithms"}),t.jsx("h2",{className:"text-lg font-bold text-white",children:"World Map Flight Simulator"})]}),t.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[t.jsx(v,{label:"Algorithm",value:O[s.algorithm].label,tone:"indigo"}),t.jsx(v,{label:"Origin",value:s.source,tone:"sky"}),t.jsx(v,{label:"Destination",value:s.destination,tone:"emerald"}),t.jsx(v,{label:"Stops",value:s.result.plan.stops.toString(),tone:"amber"})]})]})}),t.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-auto p-4 md:p-6 xl:flex-row",children:[t.jsx(ge,{airports:s.airports,routes:s.routes,source:s.source,destination:s.destination,currentStep:s.currentStep,plan:s.result.plan,flightProgress:s.flightProgress,onSelectSource:s.changeSource,onSelectDestination:s.changeDestination}),t.jsx(be,{airports:s.airports,scenarios:s.scenarios,source:s.source,destination:s.destination,algorithm:s.algorithm,plan:s.result.plan,currentStep:s.currentStep,stepIndex:s.stepIndex,totalSteps:s.result.steps.length,phase:s.phase,isPlaying:s.isPlaying,soundEnabled:s.soundEnabled,onSourceChange:s.changeSource,onDestinationChange:s.changeDestination,onAlgorithmChange:s.changeAlgorithm,onLoadScenario:s.loadScenario,onPlanRoute:()=>s.planRoute(),onStepBack:s.stepBack,onStepForward:s.stepForward,onPlay:s.playPlanning,onFly:s.animateFlight,onToggleSound:s.toggleSound})]})]})}function v({label:s,value:i,tone:n}){const l={indigo:"bg-indigo-500/10 text-indigo-200 ring-indigo-500/25",sky:"bg-sky-500/10 text-sky-200 ring-sky-500/25",emerald:"bg-emerald-500/10 text-emerald-200 ring-emerald-500/25",amber:"bg-amber-500/10 text-amber-200 ring-amber-500/25"};return t.jsxs("div",{className:`rounded-full px-3 py-1.5 text-[10px] ring-1 ${l[n]}`,children:[t.jsx("span",{className:"mr-1 uppercase tracking-wider opacity-60",children:s}),t.jsx("span",{className:"font-mono font-bold",children:i})]})}export{He as default}; diff --git a/docs/assets/arrow-left-C4-GmPRq.js b/docs/assets/arrow-left-eH0A06ps.js similarity index 61% rename from docs/assets/arrow-left-C4-GmPRq.js rename to docs/assets/arrow-left-eH0A06ps.js index 01bebb1..6078ff0 100644 --- a/docs/assets/arrow-left-C4-GmPRq.js +++ b/docs/assets/arrow-left-eH0A06ps.js @@ -1 +1 @@ -import{c as o}from"./index-lLadk08S.js";const e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],r=o("arrow-left",e);export{r as A}; +import{c as o}from"./index-CB1-0H6I.js";const e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],r=o("arrow-left",e);export{r as A}; diff --git a/docs/assets/chevron-right-Cp_zyb7b.js b/docs/assets/chevron-right-ChVmoNtO.js similarity index 69% rename from docs/assets/chevron-right-Cp_zyb7b.js rename to docs/assets/chevron-right-ChVmoNtO.js index 31df73d..ca7bd25 100644 --- a/docs/assets/chevron-right-Cp_zyb7b.js +++ b/docs/assets/chevron-right-ChVmoNtO.js @@ -1 +1 @@ -import{c as o}from"./index-lLadk08S.js";const e=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],n=o("chevron-left",e);const t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],h=o("chevron-right",t);export{n as C,h as a}; +import{c as o}from"./index-CB1-0H6I.js";const e=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],n=o("chevron-left",e);const t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],h=o("chevron-right",t);export{n as C,h as a}; diff --git a/docs/assets/eye-off-Pd9-Vzxg.js b/docs/assets/eye-off-DMbwz3T2.js similarity index 85% rename from docs/assets/eye-off-Pd9-Vzxg.js rename to docs/assets/eye-off-DMbwz3T2.js index 6bc17a4..3e98988 100644 --- a/docs/assets/eye-off-Pd9-Vzxg.js +++ b/docs/assets/eye-off-DMbwz3T2.js @@ -1 +1 @@ -import{c as e}from"./index-lLadk08S.js";const a=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],t=e("eye-off",a);export{t as E}; +import{c as e}from"./index-CB1-0H6I.js";const a=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],t=e("eye-off",a);export{t as E}; diff --git a/docs/assets/index-BlMQg5Z1.css b/docs/assets/index-BlMQg5Z1.css deleted file mode 100644 index 5c09d5c..0000000 --- a/docs/assets/index-BlMQg5Z1.css +++ /dev/null @@ -1 +0,0 @@ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-950:oklch(25.8% .092 26.042);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-500:oklch(79.5% .184 86.047);--color-lime-500:oklch(76.8% .233 130.85);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-950:oklch(29.3% .066 243.157);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-950:oklch(28.2% .091 267.935);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-900:oklch(35.9% .144 278.697);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-500:oklch(62.7% .265 303.9);--color-fuchsia-400:oklch(74% .238 322.16);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-zinc-500:oklch(55.2% .016 285.938);--color-stone-50:oklch(98.5% .001 106.423);--color-stone-200:oklch(92.3% .003 48.717);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--drop-shadow-sm:0 1px 2px #00000026;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.inset-1{inset:calc(var(--spacing) * 1)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-x-1{inset-inline:calc(var(--spacing) * 1)}.inset-x-6{inset-inline:calc(var(--spacing) * 6)}.inset-y-1{inset-block:calc(var(--spacing) * 1)}.start{inset-inline-start:var(--spacing)}.start\!{inset-inline-start:var(--spacing)!important}.end{inset-inline-end:var(--spacing)}.-top-0\.5{top:calc(var(--spacing) * -.5)}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.top-0{top:calc(var(--spacing) * 0)}.top-1{top:calc(var(--spacing) * 1)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-4{top:calc(var(--spacing) * 4)}.top-5{top:calc(var(--spacing) * 5)}.top-16{top:calc(var(--spacing) * 16)}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1\.5{right:calc(var(--spacing) * -1.5)}.-right-14{right:calc(var(--spacing) * -14)}.right-0\.5{right:calc(var(--spacing) * .5)}.right-1{right:calc(var(--spacing) * 1)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.right-5{right:calc(var(--spacing) * 5)}.right-6{right:calc(var(--spacing) * 6)}.-bottom-1{bottom:calc(var(--spacing) * -1)}.-bottom-5{bottom:calc(var(--spacing) * -5)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-1{bottom:calc(var(--spacing) * 1)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-0{left:calc(var(--spacing) * 0)}.left-1{left:calc(var(--spacing) * 1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-4{left:calc(var(--spacing) * 4)}.left-5{left:calc(var(--spacing) * 5)}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.order-last{order:9999}.col-1{grid-column:1}.mx-0\.5{margin-inline:calc(var(--spacing) * .5)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-auto{margin-inline:auto}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-px{margin-top:1px}.mr-1{margin-right:calc(var(--spacing) * 1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.table{display:table}.aspect-square{aspect-ratio:1}.h-0{height:calc(var(--spacing) * 0)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-32{height:calc(var(--spacing) * 32)}.h-36{height:calc(var(--spacing) * 36)}.h-56{height:calc(var(--spacing) * 56)}.h-72{height:calc(var(--spacing) * 72)}.h-\[22px\]{height:22px}.h-\[500px\]{height:500px}.h-full{height:100%}.h-screen{height:100vh}.max-h-28{max-height:calc(var(--spacing) * 28)}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-36{max-height:calc(var(--spacing) * 36)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-\[50vh\]{max-height:50vh}.max-h-\[55vh\]{max-height:55vh}.max-h-\[420px\]{max-height:420px}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-12{min-height:calc(var(--spacing) * 12)}.min-h-64{min-height:calc(var(--spacing) * 64)}.min-h-\[5\.5rem\]{min-height:5.5rem}.min-h-\[5rem\]{min-height:5rem}.min-h-\[40vh\]{min-height:40vh}.min-h-\[56px\]{min-height:56px}.min-h-\[200px\]{min-height:200px}.min-h-\[240px\]{min-height:240px}.min-h-\[250px\]{min-height:250px}.min-h-\[260px\]{min-height:260px}.min-h-\[290px\]{min-height:290px}.min-h-\[300px\]{min-height:300px}.min-h-\[420px\]{min-height:420px}.min-h-\[520px\]{min-height:520px}.min-h-\[620px\]{min-height:620px}.w-0{width:calc(var(--spacing) * 0)}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-\[22px\]{width:22px}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-12{min-width:calc(var(--spacing) * 12)}.min-w-14{min-width:calc(var(--spacing) * 14)}.min-w-\[56px\]{min-width:56px}.min-w-\[560px\]{min-width:560px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-2{--tw-translate-y:calc(var(--spacing) * -2);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.rotate-\[-1deg\]{rotate:-1deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[shake_0\.3s_ease-in-out_2\]{animation:.3s ease-in-out 2 shake}.animate-path{animation:.4s ease-out forwards path}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.animate-visited{animation:.4s ease-out forwards visited}.animate-wall{animation:.2s ease-out forwards wall}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[1px\],.gap-px{gap:1px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\[1\.5rem\]{border-radius:1.5rem}.rounded-\[1\.15rem\]{border-radius:1.15rem}.rounded-\[1\.75rem\]{border-radius:1.75rem}.rounded-\[1px\]{border-radius:1px}.rounded-\[50\%\]{border-radius:50%}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r-2{border-right-style:var(--tw-border-style);border-right-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-b-4{border-bottom-style:var(--tw-border-style);border-bottom-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400{border-color:var(--color-amber-400)}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-950\/10{border-color:#4619011a}@supports (color:color-mix(in lab,red,red)){.border-amber-950\/10{border-color:color-mix(in oklab,var(--color-amber-950) 10%,transparent)}}.border-amber-950\/25{border-color:#46190140}@supports (color:color-mix(in lab,red,red)){.border-amber-950\/25{border-color:color-mix(in oklab,var(--color-amber-950) 25%,transparent)}}.border-black\/15{border-color:#00000026}@supports (color:color-mix(in lab,red,red)){.border-black\/15{border-color:color-mix(in oklab,var(--color-black) 15%,transparent)}}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-950\/30{border-color:#1624564d}@supports (color:color-mix(in lab,red,red)){.border-blue-950\/30{border-color:color-mix(in oklab,var(--color-blue-950) 30%,transparent)}}.border-emerald-300\/50{border-color:#5ee9b580}@supports (color:color-mix(in lab,red,red)){.border-emerald-300\/50{border-color:color-mix(in oklab,var(--color-emerald-300) 50%,transparent)}}.border-emerald-400{border-color:var(--color-emerald-400)}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-700\/30{border-color:#0079564d}@supports (color:color-mix(in lab,red,red)){.border-emerald-700\/30{border-color:color-mix(in oklab,var(--color-emerald-700) 30%,transparent)}}.border-emerald-900\/20{border-color:#004e3b33}@supports (color:color-mix(in lab,red,red)){.border-emerald-900\/20{border-color:color-mix(in oklab,var(--color-emerald-900) 20%,transparent)}}.border-emerald-900\/30{border-color:#004e3b4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-900\/30{border-color:color-mix(in oklab,var(--color-emerald-900) 30%,transparent)}}.border-emerald-900\/40{border-color:#004e3b66}@supports (color:color-mix(in lab,red,red)){.border-emerald-900\/40{border-color:color-mix(in oklab,var(--color-emerald-900) 40%,transparent)}}.border-emerald-950\/20{border-color:#002c2233}@supports (color:color-mix(in lab,red,red)){.border-emerald-950\/20{border-color:color-mix(in oklab,var(--color-emerald-950) 20%,transparent)}}.border-emerald-950\/40{border-color:#002c2266}@supports (color:color-mix(in lab,red,red)){.border-emerald-950\/40{border-color:color-mix(in oklab,var(--color-emerald-950) 40%,transparent)}}.border-emerald-950\/50{border-color:#002c2280}@supports (color:color-mix(in lab,red,red)){.border-emerald-950\/50{border-color:color-mix(in oklab,var(--color-emerald-950) 50%,transparent)}}.border-indigo-500\/20{border-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/20{border-color:color-mix(in oklab,var(--color-indigo-500) 20%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-orange-400{border-color:var(--color-orange-400)}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-rose-400{border-color:var(--color-rose-400)}.border-sky-500\/20{border-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.border-sky-500\/20{border-color:color-mix(in oklab,var(--color-sky-500) 20%,transparent)}}.border-slate-500{border-color:var(--color-slate-500)}.border-slate-500\/60{border-color:#62748e99}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/60{border-color:color-mix(in oklab,var(--color-slate-500) 60%,transparent)}}.border-slate-600{border-color:var(--color-slate-600)}.border-slate-700{border-color:var(--color-slate-700)}.border-slate-700\/40{border-color:#31415866}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/40{border-color:color-mix(in oklab,var(--color-slate-700) 40%,transparent)}}.border-slate-700\/50{border-color:#31415880}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/50{border-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.border-slate-700\/60{border-color:#31415899}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/60{border-color:color-mix(in oklab,var(--color-slate-700) 60%,transparent)}}.border-slate-800\/30{border-color:#1d293d4d}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/30{border-color:color-mix(in oklab,var(--color-slate-800) 30%,transparent)}}.border-slate-800\/40{border-color:#1d293d66}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/40{border-color:color-mix(in oklab,var(--color-slate-800) 40%,transparent)}}.border-slate-800\/50{border-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/50{border-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.border-slate-800\/60{border-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/60{border-color:color-mix(in oklab,var(--color-slate-800) 60%,transparent)}}.border-slate-800\/70{border-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/70{border-color:color-mix(in oklab,var(--color-slate-800) 70%,transparent)}}.border-slate-800\/80{border-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/80{border-color:color-mix(in oklab,var(--color-slate-800) 80%,transparent)}}.border-slate-950\/50{border-color:#02061880}@supports (color:color-mix(in lab,red,red)){.border-slate-950\/50{border-color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.border-slate-950\/70{border-color:#020618b3}@supports (color:color-mix(in lab,red,red)){.border-slate-950\/70{border-color:color-mix(in oklab,var(--color-slate-950) 70%,transparent)}}.border-violet-500\/30{border-color:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/30{border-color:color-mix(in oklab,var(--color-violet-500) 30%,transparent)}}.border-r-slate-500\/60{border-right-color:#62748e99}@supports (color:color-mix(in lab,red,red)){.border-r-slate-500\/60{border-right-color:color-mix(in oklab,var(--color-slate-500) 60%,transparent)}}.border-b-slate-500\/60{border-bottom-color:#62748e99}@supports (color:color-mix(in lab,red,red)){.border-b-slate-500\/60{border-bottom-color:color-mix(in oklab,var(--color-slate-500) 60%,transparent)}}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.18\)\,transparent_36\%\)\,rgba\(16\,185\,129\,0\.05\)\]{background-color:radial-gradient(circle at top left,#10b9812e,transparent 36%),#10b9810d}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(249\,115\,22\,0\.18\)\,transparent_38\%\)\,rgba\(15\,23\,42\,0\.8\)\]{background-color:radial-gradient(circle at top left,#f973162e,transparent 38%),#0f172acc}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-cyan-300{background-color:var(--color-cyan-300)}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-cyan-500\/40{background-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/40{background-color:color-mix(in oklab,var(--color-cyan-500) 40%,transparent)}}.bg-cyan-500\/60{background-color:#00b7d799}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/60{background-color:color-mix(in oklab,var(--color-cyan-500) 60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-400\/10{background-color:#00d2941a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-400\/10{background-color:color-mix(in oklab,var(--color-emerald-400) 10%,transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/25{background-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/25{background-color:color-mix(in oklab,var(--color-emerald-500) 25%,transparent)}}.bg-emerald-500\/70{background-color:#00bb7fb3}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/70{background-color:color-mix(in oklab,var(--color-emerald-500) 70%,transparent)}}.bg-emerald-900\/25{background-color:#004e3b40}@supports (color:color-mix(in lab,red,red)){.bg-emerald-900\/25{background-color:color-mix(in oklab,var(--color-emerald-900) 25%,transparent)}}.bg-emerald-950{background-color:var(--color-emerald-950)}.bg-emerald-950\/20{background-color:#002c2233}@supports (color:color-mix(in lab,red,red)){.bg-emerald-950\/20{background-color:color-mix(in oklab,var(--color-emerald-950) 20%,transparent)}}.bg-emerald-950\/25{background-color:#002c2240}@supports (color:color-mix(in lab,red,red)){.bg-emerald-950\/25{background-color:color-mix(in oklab,var(--color-emerald-950) 25%,transparent)}}.bg-green-500\/70{background-color:#00c758b3}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/70{background-color:color-mix(in oklab,var(--color-green-500) 70%,transparent)}}.bg-indigo-400{background-color:var(--color-indigo-400)}.bg-indigo-400\/40{background-color:#7d87ff66}@supports (color:color-mix(in lab,red,red)){.bg-indigo-400\/40{background-color:color-mix(in oklab,var(--color-indigo-400) 40%,transparent)}}.bg-indigo-400\/80{background-color:#7d87ffcc}@supports (color:color-mix(in lab,red,red)){.bg-indigo-400\/80{background-color:color-mix(in oklab,var(--color-indigo-400) 80%,transparent)}}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/20{background-color:color-mix(in oklab,var(--color-indigo-500) 20%,transparent)}}.bg-indigo-500\/25{background-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/25{background-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.bg-indigo-500\/70{background-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/70{background-color:color-mix(in oklab,var(--color-indigo-500) 70%,transparent)}}.bg-indigo-900{background-color:var(--color-indigo-900)}.bg-orange-400{background-color:var(--color-orange-400)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500) 10%,transparent)}}.bg-orange-500\/15{background-color:#fe6e0026}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/15{background-color:color-mix(in oklab,var(--color-orange-500) 15%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/70{background-color:#fb2c36b3}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/70{background-color:color-mix(in oklab,var(--color-red-500) 70%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-950\/70{background-color:#460809b3}@supports (color:color-mix(in lab,red,red)){.bg-red-950\/70{background-color:color-mix(in oklab,var(--color-red-950) 70%,transparent)}}.bg-rose-300{background-color:var(--color-rose-300)}.bg-rose-400{background-color:var(--color-rose-400)}.bg-rose-500{background-color:var(--color-rose-500)}.bg-rose-500\/10{background-color:#ff23571a}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/10{background-color:color-mix(in oklab,var(--color-rose-500) 10%,transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/15{background-color:color-mix(in oklab,var(--color-rose-500) 15%,transparent)}}.bg-rose-500\/20{background-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/20{background-color:color-mix(in oklab,var(--color-rose-500) 20%,transparent)}}.bg-rose-500\/25{background-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/25{background-color:color-mix(in oklab,var(--color-rose-500) 25%,transparent)}}.bg-rose-500\/40{background-color:#ff235766}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/40{background-color:color-mix(in oklab,var(--color-rose-500) 40%,transparent)}}.bg-rose-500\/60{background-color:#ff235799}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/60{background-color:color-mix(in oklab,var(--color-rose-500) 60%,transparent)}}.bg-sky-400{background-color:var(--color-sky-400)}.bg-sky-500\/10{background-color:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/10{background-color:color-mix(in oklab,var(--color-sky-500) 10%,transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/15{background-color:color-mix(in oklab,var(--color-sky-500) 15%,transparent)}}.bg-sky-500\/25{background-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/25{background-color:color-mix(in oklab,var(--color-sky-500) 25%,transparent)}}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-500{background-color:var(--color-slate-500)}.bg-slate-500\/10{background-color:#62748e1a}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/10{background-color:color-mix(in oklab,var(--color-slate-500) 10%,transparent)}}.bg-slate-600{background-color:var(--color-slate-600)}.bg-slate-700{background-color:var(--color-slate-700)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-800\/30{background-color:#1d293d4d}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/30{background-color:color-mix(in oklab,var(--color-slate-800) 30%,transparent)}}.bg-slate-800\/40{background-color:#1d293d66}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/40{background-color:color-mix(in oklab,var(--color-slate-800) 40%,transparent)}}.bg-slate-800\/50{background-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/50{background-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.bg-slate-800\/60{background-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/60{background-color:color-mix(in oklab,var(--color-slate-800) 60%,transparent)}}.bg-slate-800\/70{background-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/70{background-color:color-mix(in oklab,var(--color-slate-800) 70%,transparent)}}.bg-slate-800\/80{background-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/80{background-color:color-mix(in oklab,var(--color-slate-800) 80%,transparent)}}.bg-slate-900{background-color:var(--color-slate-900)}.bg-slate-900\/40{background-color:#0f172b66}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/40{background-color:color-mix(in oklab,var(--color-slate-900) 40%,transparent)}}.bg-slate-900\/50{background-color:#0f172b80}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/50{background-color:color-mix(in oklab,var(--color-slate-900) 50%,transparent)}}.bg-slate-900\/55{background-color:#0f172b8c}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/55{background-color:color-mix(in oklab,var(--color-slate-900) 55%,transparent)}}.bg-slate-900\/60{background-color:#0f172b99}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/60{background-color:color-mix(in oklab,var(--color-slate-900) 60%,transparent)}}.bg-slate-900\/70{background-color:#0f172bb3}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/70{background-color:color-mix(in oklab,var(--color-slate-900) 70%,transparent)}}.bg-slate-900\/80{background-color:#0f172bcc}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/80{background-color:color-mix(in oklab,var(--color-slate-900) 80%,transparent)}}.bg-slate-950\/25{background-color:#02061840}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/25{background-color:color-mix(in oklab,var(--color-slate-950) 25%,transparent)}}.bg-slate-950\/35{background-color:#02061859}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/35{background-color:color-mix(in oklab,var(--color-slate-950) 35%,transparent)}}.bg-slate-950\/40{background-color:#02061866}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/40{background-color:color-mix(in oklab,var(--color-slate-950) 40%,transparent)}}.bg-slate-950\/45{background-color:#02061873}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/45{background-color:color-mix(in oklab,var(--color-slate-950) 45%,transparent)}}.bg-slate-950\/50{background-color:#02061880}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/50{background-color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.bg-slate-950\/55{background-color:#0206188c}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/55{background-color:color-mix(in oklab,var(--color-slate-950) 55%,transparent)}}.bg-slate-950\/60{background-color:#02061899}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/60{background-color:color-mix(in oklab,var(--color-slate-950) 60%,transparent)}}.bg-slate-950\/70{background-color:#020618b3}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/70{background-color:color-mix(in oklab,var(--color-slate-950) 70%,transparent)}}.bg-slate-950\/75{background-color:#020618bf}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/75{background-color:color-mix(in oklab,var(--color-slate-950) 75%,transparent)}}.bg-slate-950\/80{background-color:#020618cc}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/80{background-color:color-mix(in oklab,var(--color-slate-950) 80%,transparent)}}.bg-slate-950\/85{background-color:#020618d9}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/85{background-color:color-mix(in oklab,var(--color-slate-950) 85%,transparent)}}.bg-slate-950\/90{background-color:#020618e6}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/90{background-color:color-mix(in oklab,var(--color-slate-950) 90%,transparent)}}.bg-slate-950\/95{background-color:#020618f2}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/95{background-color:color-mix(in oklab,var(--color-slate-950) 95%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-violet-500\/20{background-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/20{background-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/15{background-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.bg-white\/15{background-color:color-mix(in oklab,var(--color-white) 15%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-yellow-300{background-color:var(--color-yellow-300)}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/10{background-color:color-mix(in oklab,var(--color-yellow-500) 10%,transparent)}}.bg-yellow-500\/70{background-color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/70{background-color:color-mix(in oklab,var(--color-yellow-500) 70%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-\[linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.9\)\,rgba\(6\,78\,59\,0\.34\)\)\]{background-image:linear-gradient(135deg,#0f172ae6,#064e3b57)}.bg-\[linear-gradient\(rgba\(148\,163\,184\,0\.03\)_1px\,transparent_1px\)\]{background-image:linear-gradient(#94a3b808 1px,#0000 1px)}.bg-\[radial-gradient\(circle_at_1px_1px\,rgba\(148\,163\,184\,0\.12\)_1px\,transparent_0\)\]{background-image:radial-gradient(circle at 1px 1px,#94a3b81f 1px,#0000 0)}.bg-\[radial-gradient\(circle_at_18\%_22\%\,rgba\(14\,165\,233\,0\.16\)\,transparent_28\%\)\,radial-gradient\(circle_at_78\%_72\%\,rgba\(59\,130\,246\,0\.12\)\,transparent_30\%\)\]{background-image:radial-gradient(circle at 18% 22%,#0ea5e929,#0000 28%),radial-gradient(circle at 78% 72%,#3b82f61f,#0000 30%)}.bg-\[radial-gradient\(circle_at_20\%_10\%\,rgba\(56\,189\,248\,0\.14\)\,transparent_28\%\)\,radial-gradient\(circle_at_80\%_80\%\,rgba\(34\,197\,94\,0\.1\)\,transparent_30\%\)\]{background-image:radial-gradient(circle at 20% 10%,#38bdf824,#0000 28%),radial-gradient(circle at 80% 80%,#22c55e1a,#0000 30%)}.bg-\[radial-gradient\(circle_at_30\%_15\%\,rgba\(255\,255\,255\,0\.8\)\,transparent_38\%\)\,linear-gradient\(135deg\,rgba\(255\,255\,255\,0\.35\)\,transparent\)\]{background-image:radial-gradient(circle at 30% 15%,#fffc,#0000 38%),linear-gradient(135deg,#ffffff59,#0000)}.bg-\[radial-gradient\(circle_at_top\,rgba\(16\,185\,129\,0\.08\)\,transparent_34\%\)\,linear-gradient\(180deg\,rgba\(15\,23\,42\,0\)\,rgba\(6\,78\,59\,0\.16\)\)\]{background-image:radial-gradient(circle at top,#10b98114,#0000 34%),linear-gradient(#0f172a00,#064e3b29)}.bg-\[radial-gradient\(circle_at_top\,rgba\(16\,185\,129\,0\.12\)\,transparent_34\%\)\,linear-gradient\(180deg\,rgba\(15\,23\,42\,0\)\,rgba\(6\,78\,59\,0\.16\)\)\]{background-image:radial-gradient(circle at top,#10b9811f,#0000 34%),linear-gradient(#0f172a00,#064e3b29)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(14\,165\,233\,0\.16\)\,transparent_30\%\)\,radial-gradient\(circle_at_bottom_right\,rgba\(34\,197\,94\,0\.12\)\,transparent_28\%\)\]{background-image:radial-gradient(circle at 0 0,#0ea5e929,#0000 30%),radial-gradient(circle at 100% 100%,#22c55e1f,#0000 28%)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(14\,165\,233\,0\.16\)\,transparent_30\%\)\,radial-gradient\(circle_at_bottom_right\,rgba\(59\,130\,246\,0\.14\)\,transparent_28\%\)\]{background-image:radial-gradient(circle at 0 0,#0ea5e929,#0000 30%),radial-gradient(circle at 100% 100%,#3b82f624,#0000 28%)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.12\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.28\)\)\]{background-image:radial-gradient(circle at 0 0,#10b9811f,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b47)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.14\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.32\)\)\]{background-image:radial-gradient(circle at 0 0,#10b98124,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b52)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.14\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.36\)\)\]{background-image:radial-gradient(circle at 0 0,#10b98124,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b5c)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.18\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.42\)\)\]{background-image:radial-gradient(circle at 0 0,#10b9812e,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b6b)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(34\,197\,94\,0\.18\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.36\)\)\]{background-image:radial-gradient(circle at 0 0,#22c55e2e,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b5c)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(249\,115\,22\,0\.12\)\,transparent_28\%\)\,radial-gradient\(circle_at_bottom_right\,rgba\(99\,102\,241\,0\.12\)\,transparent_30\%\)\]{background-image:radial-gradient(circle at 0 0,#f973161f,#0000 28%),radial-gradient(circle at 100% 100%,#6366f11f,#0000 30%)}.bg-\[radial-gradient\(ellipse_at_center\,_var\(--tw-gradient-stops\)\)\]{background-image:radial-gradient(ellipse at center,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from:var(--color-amber-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-black\/25{--tw-gradient-from:#00000040}@supports (color:color-mix(in lab,red,red)){.from-black\/25{--tw-gradient-from:color-mix(in oklab, var(--color-black) 25%, transparent)}}.from-black\/25{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-500{--tw-gradient-from:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-400{--tw-gradient-from:var(--color-cyan-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-300{--tw-gradient-from:var(--color-emerald-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-400{--tw-gradient-from:var(--color-emerald-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500{--tw-gradient-from:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500\/80{--tw-gradient-from:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.from-emerald-500\/80{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-500) 80%, transparent)}}.from-emerald-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-950\/50{--tw-gradient-from:#002c2280}@supports (color:color-mix(in lab,red,red)){.from-emerald-950\/50{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-950) 50%, transparent)}}.from-emerald-950\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-fuchsia-500{--tw-gradient-from:var(--color-fuchsia-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-400{--tw-gradient-from:var(--color-indigo-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500\/20{--tw-gradient-from:#625fff33}@supports (color:color-mix(in lab,red,red)){.from-indigo-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.from-indigo-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-900\/20{--tw-gradient-from:#312c8533}@supports (color:color-mix(in lab,red,red)){.from-indigo-900\/20{--tw-gradient-from:color-mix(in oklab, var(--color-indigo-900) 20%, transparent)}}.from-indigo-900\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-lime-500{--tw-gradient-from:var(--color-lime-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-500{--tw-gradient-from:var(--color-orange-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-500{--tw-gradient-from:var(--color-red-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-500\/20{--tw-gradient-from:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.from-red-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.from-red-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-400{--tw-gradient-from:var(--color-rose-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500{--tw-gradient-from:var(--color-rose-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500\/20{--tw-gradient-from:#ff235733}@supports (color:color-mix(in lab,red,red)){.from-rose-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.from-rose-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500\/80{--tw-gradient-from:#ff2357cc}@supports (color:color-mix(in lab,red,red)){.from-rose-500\/80{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 80%, transparent)}}.from-rose-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-sky-500{--tw-gradient-from:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-500{--tw-gradient-from:var(--color-slate-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-stone-50{--tw-gradient-from:var(--color-stone-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500{--tw-gradient-from:var(--color-violet-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-amber-50{--tw-gradient-via:var(--color-amber-50);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-violet-400{--tw-gradient-via:var(--color-violet-400);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-amber-400{--tw-gradient-to:var(--color-amber-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-500{--tw-gradient-to:var(--color-amber-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-400{--tw-gradient-to:var(--color-blue-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-300{--tw-gradient-to:var(--color-cyan-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-400{--tw-gradient-to:var(--color-cyan-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500{--tw-gradient-to:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500\/20{--tw-gradient-to:#00b7d733}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.to-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-700{--tw-gradient-to:var(--color-emerald-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-fuchsia-400{--tw-gradient-to:var(--color-fuchsia-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-fuchsia-500{--tw-gradient-to:var(--color-fuchsia-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-green-500{--tw-gradient-to:var(--color-green-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-green-500\/80{--tw-gradient-to:#00c758cc}@supports (color:color-mix(in lab,red,red)){.to-green-500\/80{--tw-gradient-to:color-mix(in oklab, var(--color-green-500) 80%, transparent)}}.to-green-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-500{--tw-gradient-to:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-400{--tw-gradient-to:var(--color-orange-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-500{--tw-gradient-to:var(--color-orange-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-400{--tw-gradient-to:var(--color-pink-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500\/80{--tw-gradient-to:#f6339acc}@supports (color:color-mix(in lab,red,red)){.to-pink-500\/80{--tw-gradient-to:color-mix(in oklab, var(--color-pink-500) 80%, transparent)}}.to-pink-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500{--tw-gradient-to:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-500{--tw-gradient-to:var(--color-red-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-rose-500\/20{--tw-gradient-to:#ff235733}@supports (color:color-mix(in lab,red,red)){.to-rose-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.to-rose-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-stone-200{--tw-gradient-to:var(--color-stone-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-400{--tw-gradient-to:var(--color-teal-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-500{--tw-gradient-to:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-400{--tw-gradient-to:var(--color-violet-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-500{--tw-gradient-to:var(--color-violet-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-500\/20{--tw-gradient-to:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.to-violet-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.to-violet-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-zinc-500{--tw-gradient-to:var(--color-zinc-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-\[length\:24px_24px\]{background-size:24px 24px}.bg-\[length\:100\%_22px\]{background-size:100% 22px}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-12{padding-top:calc(var(--spacing) * 12)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pb-0{padding-bottom:calc(var(--spacing) * 0)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pb-10{padding-bottom:calc(var(--spacing) * 10)}.pb-12{padding-bottom:calc(var(--spacing) * 12)}.pb-16{padding-bottom:calc(var(--spacing) * 16)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.24em\]{--tw-tracking:.24em;letter-spacing:.24em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-200{color:var(--color-amber-200)}.text-amber-300{color:var(--color-amber-300)}.text-amber-300\/60{color:#ffd23699}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/60{color:color-mix(in oklab,var(--color-amber-300) 60%,transparent)}}.text-amber-300\/70{color:#ffd236b3}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/70{color:color-mix(in oklab,var(--color-amber-300) 70%,transparent)}}.text-amber-300\/80{color:#ffd236cc}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/80{color:color-mix(in oklab,var(--color-amber-300) 80%,transparent)}}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-50\/80{color:#ecfdf5cc}@supports (color:color-mix(in lab,red,red)){.text-emerald-50\/80{color:color-mix(in oklab,var(--color-emerald-50) 80%,transparent)}}.text-emerald-100{color:var(--color-emerald-100)}.text-emerald-100\/45{color:#d0fae573}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/45{color:color-mix(in oklab,var(--color-emerald-100) 45%,transparent)}}.text-emerald-100\/50{color:#d0fae580}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/50{color:color-mix(in oklab,var(--color-emerald-100) 50%,transparent)}}.text-emerald-100\/65{color:#d0fae5a6}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/65{color:color-mix(in oklab,var(--color-emerald-100) 65%,transparent)}}.text-emerald-100\/70{color:#d0fae5b3}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/70{color:color-mix(in oklab,var(--color-emerald-100) 70%,transparent)}}.text-emerald-200{color:var(--color-emerald-200)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/60{color:#00d29499}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/60{color:color-mix(in oklab,var(--color-emerald-400) 60%,transparent)}}.text-emerald-500{color:var(--color-emerald-500)}.text-indigo-100{color:var(--color-indigo-100)}.text-indigo-200{color:var(--color-indigo-200)}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-orange-300{color:var(--color-orange-300)}.text-orange-400{color:var(--color-orange-400)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-rose-200{color:var(--color-rose-200)}.text-rose-300{color:var(--color-rose-300)}.text-rose-400{color:var(--color-rose-400)}.text-sky-200{color:var(--color-sky-200)}.text-sky-300{color:var(--color-sky-300)}.text-sky-400{color:var(--color-sky-400)}.text-slate-100{color:var(--color-slate-100)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-900\/35{color:#0f172b59}@supports (color:color-mix(in lab,red,red)){.text-slate-900\/35{color:color-mix(in oklab,var(--color-slate-900) 35%,transparent)}}.text-slate-950\/50{color:#02061880}@supports (color:color-mix(in lab,red,red)){.text-slate-950\/50{color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.text-transparent{color:#0000}.text-violet-300{color:var(--color-violet-300)}.text-violet-400{color:var(--color-violet-400)}.text-white{color:var(--color-white)}.text-yellow-300{color:var(--color-yellow-300)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.placeholder-slate-500::placeholder{color:var(--color-slate-500)}.placeholder-slate-600::placeholder{color:var(--color-slate-600)}.caret-emerald-400{caret-color:var(--color-emerald-400)}.accent-indigo-400{accent-color:var(--color-indigo-400)}.accent-indigo-500{accent-color:var(--color-indigo-500)}.accent-rose-400{accent-color:var(--color-rose-400)}.accent-rose-500{accent-color:var(--color-rose-500)}.accent-sky-500{accent-color:var(--color-sky-500)}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-30{opacity:.3}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-45{opacity:.45}.opacity-60{opacity:.6}.opacity-65{opacity:.65}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_26px_rgba\(52\,211\,153\,0\.45\)\]{--tw-shadow:0 0 26px var(--tw-shadow-color,#34d39973);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_10px_18px_rgba\(0\,0\,0\,0\.35\)\,inset_0_-3px_0_rgba\(0\,0\,0\,0\.18\)\]{--tw-shadow:0 10px 18px var(--tw-shadow-color,#00000059), inset 0 -3px 0 var(--tw-shadow-color,#0000002e);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-400\/20{--tw-shadow-color:#fcbb0033}@supports (color:color-mix(in lab,red,red)){.shadow-amber-400\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-400) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-400\/30{--tw-shadow-color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.shadow-amber-400\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-400) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-500\/20{--tw-shadow-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/30{--tw-shadow-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/35{--tw-shadow-color:#00000059}@supports (color:color-mix(in lab,red,red)){.shadow-black\/35{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 35%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/40{--tw-shadow-color:#0006}@supports (color:color-mix(in lab,red,red)){.shadow-black\/40{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 40%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-blue-500\/20{--tw-shadow-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.shadow-blue-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-blue-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-cyan-500\/20{--tw-shadow-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.shadow-cyan-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-cyan-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/15{--tw-shadow-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/20{--tw-shadow-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/30{--tw-shadow-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-950\/20{--tw-shadow-color:#002c2233}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-950\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-950) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-fuchsia-500\/20{--tw-shadow-color:#e12afb33}@supports (color:color-mix(in lab,red,red)){.shadow-fuchsia-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-fuchsia-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-indigo-500\/10{--tw-shadow-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.shadow-indigo-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-indigo-500\/20{--tw-shadow-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.shadow-indigo-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-indigo-500\/25{--tw-shadow-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.shadow-indigo-500\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-lime-500\/20{--tw-shadow-color:#80cd0033}@supports (color:color-mix(in lab,red,red)){.shadow-lime-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-lime-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-orange-500\/20{--tw-shadow-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.shadow-orange-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-orange-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-purple-500\/20{--tw-shadow-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.shadow-purple-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-purple-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/20{--tw-shadow-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-950\/20{--tw-shadow-color:#46080933}@supports (color:color-mix(in lab,red,red)){.shadow-red-950\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-950) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/15{--tw-shadow-color:#ff235726}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/20{--tw-shadow-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/25{--tw-shadow-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/30{--tw-shadow-color:#ff23574d}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-sky-500\/20{--tw-shadow-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.shadow-sky-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-sky-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-sky-950\/40{--tw-shadow-color:#052f4a66}@supports (color:color-mix(in lab,red,red)){.shadow-sky-950\/40{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-sky-950) 40%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-slate-500\/20{--tw-shadow-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.shadow-slate-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-slate-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-teal-500\/20{--tw-shadow-color:#00baa733}@supports (color:color-mix(in lab,red,red)){.shadow-teal-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-teal-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-violet-500\/20{--tw-shadow-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.shadow-violet-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-violet-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-amber-300\/50{--tw-ring-color:#ffd23680}@supports (color:color-mix(in lab,red,red)){.ring-amber-300\/50{--tw-ring-color:color-mix(in oklab, var(--color-amber-300) 50%, transparent)}}.ring-amber-500\/20{--tw-ring-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.ring-amber-500\/25{--tw-ring-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 25%, transparent)}}.ring-amber-500\/30{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.ring-amber-500\/40{--tw-ring-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 40%, transparent)}}.ring-blue-500\/30{--tw-ring-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.ring-blue-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.ring-cyan-300\/40{--tw-ring-color:#53eafd66}@supports (color:color-mix(in lab,red,red)){.ring-cyan-300\/40{--tw-ring-color:color-mix(in oklab, var(--color-cyan-300) 40%, transparent)}}.ring-cyan-500\/20{--tw-ring-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.ring-cyan-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.ring-cyan-500\/30{--tw-ring-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.ring-cyan-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.ring-cyan-500\/40{--tw-ring-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.ring-cyan-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 40%, transparent)}}.ring-emerald-200{--tw-ring-color:var(--color-emerald-200)}.ring-emerald-400\/50{--tw-ring-color:#00d29480}@supports (color:color-mix(in lab,red,red)){.ring-emerald-400\/50{--tw-ring-color:color-mix(in oklab, var(--color-emerald-400) 50%, transparent)}}.ring-emerald-500{--tw-ring-color:var(--color-emerald-500)}.ring-emerald-500\/20{--tw-ring-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.ring-emerald-500\/25{--tw-ring-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 25%, transparent)}}.ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.ring-emerald-500\/40{--tw-ring-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 40%, transparent)}}.ring-emerald-500\/50{--tw-ring-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 50%, transparent)}}.ring-indigo-300{--tw-ring-color:var(--color-indigo-300)}.ring-indigo-400{--tw-ring-color:var(--color-indigo-400)}.ring-indigo-400\/40{--tw-ring-color:#7d87ff66}@supports (color:color-mix(in lab,red,red)){.ring-indigo-400\/40{--tw-ring-color:color-mix(in oklab, var(--color-indigo-400) 40%, transparent)}}.ring-indigo-400\/60{--tw-ring-color:#7d87ff99}@supports (color:color-mix(in lab,red,red)){.ring-indigo-400\/60{--tw-ring-color:color-mix(in oklab, var(--color-indigo-400) 60%, transparent)}}.ring-indigo-500{--tw-ring-color:var(--color-indigo-500)}.ring-indigo-500\/15{--tw-ring-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/15{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.ring-indigo-500\/20{--tw-ring-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.ring-indigo-500\/25{--tw-ring-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 25%, transparent)}}.ring-indigo-500\/30{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.ring-indigo-500\/35{--tw-ring-color:#625fff59}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/35{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 35%, transparent)}}.ring-indigo-500\/40{--tw-ring-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 40%, transparent)}}.ring-indigo-500\/50{--tw-ring-color:#625fff80}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 50%, transparent)}}.ring-orange-200{--tw-ring-color:var(--color-orange-200)}.ring-orange-500\/25{--tw-ring-color:#fe6e0040}@supports (color:color-mix(in lab,red,red)){.ring-orange-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-orange-500) 25%, transparent)}}.ring-orange-500\/30{--tw-ring-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.ring-orange-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-orange-500) 30%, transparent)}}.ring-red-500\/30{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.ring-red-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.ring-red-500\/60{--tw-ring-color:#fb2c3699}@supports (color:color-mix(in lab,red,red)){.ring-red-500\/60{--tw-ring-color:color-mix(in oklab, var(--color-red-500) 60%, transparent)}}.ring-rose-400\/40{--tw-ring-color:#ff667f66}@supports (color:color-mix(in lab,red,red)){.ring-rose-400\/40{--tw-ring-color:color-mix(in oklab, var(--color-rose-400) 40%, transparent)}}.ring-rose-500\/20{--tw-ring-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.ring-rose-500\/25{--tw-ring-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 25%, transparent)}}.ring-rose-500\/30{--tw-ring-color:#ff23574d}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.ring-rose-500\/40{--tw-ring-color:#ff235766}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 40%, transparent)}}.ring-rose-500\/50{--tw-ring-color:#ff235780}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 50%, transparent)}}.ring-sky-200{--tw-ring-color:var(--color-sky-200)}.ring-sky-500\/20{--tw-ring-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 20%, transparent)}}.ring-sky-500\/25{--tw-ring-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 25%, transparent)}}.ring-sky-500\/30{--tw-ring-color:#00a5ef4d}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 30%, transparent)}}.ring-sky-500\/40{--tw-ring-color:#00a5ef66}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 40%, transparent)}}.ring-slate-500{--tw-ring-color:var(--color-slate-500)}.ring-slate-600{--tw-ring-color:var(--color-slate-600)}.ring-slate-700{--tw-ring-color:var(--color-slate-700)}.ring-slate-700\/30{--tw-ring-color:#3141584d}@supports (color:color-mix(in lab,red,red)){.ring-slate-700\/30{--tw-ring-color:color-mix(in oklab, var(--color-slate-700) 30%, transparent)}}.ring-slate-700\/40{--tw-ring-color:#31415866}@supports (color:color-mix(in lab,red,red)){.ring-slate-700\/40{--tw-ring-color:color-mix(in oklab, var(--color-slate-700) 40%, transparent)}}.ring-slate-700\/50{--tw-ring-color:#31415880}@supports (color:color-mix(in lab,red,red)){.ring-slate-700\/50{--tw-ring-color:color-mix(in oklab, var(--color-slate-700) 50%, transparent)}}.ring-slate-800{--tw-ring-color:var(--color-slate-800)}.ring-slate-800\/50{--tw-ring-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/50{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 50%, transparent)}}.ring-slate-800\/60{--tw-ring-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/60{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 60%, transparent)}}.ring-slate-800\/70{--tw-ring-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/70{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 70%, transparent)}}.ring-slate-800\/80{--tw-ring-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/80{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 80%, transparent)}}.ring-violet-400\/40{--tw-ring-color:#a685ff66}@supports (color:color-mix(in lab,red,red)){.ring-violet-400\/40{--tw-ring-color:color-mix(in oklab, var(--color-violet-400) 40%, transparent)}}.ring-violet-500\/20{--tw-ring-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.ring-violet-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.ring-violet-500\/30{--tw-ring-color:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.ring-violet-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.ring-violet-500\/40{--tw-ring-color:#8d54ff66}@supports (color:color-mix(in lab,red,red)){.ring-violet-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.ring-white\/10{--tw-ring-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.ring-white\/30{--tw-ring-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.ring-white\/30{--tw-ring-color:color-mix(in oklab, var(--color-white) 30%, transparent)}}.ring-yellow-500\/25{--tw-ring-color:#edb20040}@supports (color:color-mix(in lab,red,red)){.ring-yellow-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-yellow-500) 25%, transparent)}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-xl{--tw-blur:blur(var(--blur-xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-sm{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-sm));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\[animation-delay\:120ms\]{animation-delay:.12s}.\[animation-delay\:240ms\]{animation-delay:.24s}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\:-translate-y-1:hover{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:-translate-y-2:hover{--tw-translate-y:calc(var(--spacing) * -2);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.01\]:hover{scale:1.01}.hover\:scale-\[1\.02\]:hover{scale:1.02}.hover\:rotate-1:hover{rotate:1deg}.hover\:border-slate-600\/60:hover{border-color:#45556c99}@supports (color:color-mix(in lab,red,red)){.hover\:border-slate-600\/60:hover{border-color:color-mix(in oklab,var(--color-slate-600) 60%,transparent)}}.hover\:bg-amber-500\/25:hover{background-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/25:hover{background-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.hover\:bg-blue-500\/30:hover{background-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/30:hover{background-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.hover\:bg-cyan-500\/30:hover{background-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-cyan-500\/30:hover{background-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.hover\:bg-emerald-500\/25:hover{background-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/25:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 25%,transparent)}}.hover\:bg-indigo-500\/10:hover{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/10:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-indigo-500\/25:hover{background-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/25:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.hover\:bg-indigo-500\/30:hover{background-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/30:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.hover\:bg-red-500\/25:hover{background-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/25:hover{background-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.hover\:bg-rose-500\/25:hover{background-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.hover\:bg-rose-500\/25:hover{background-color:color-mix(in oklab,var(--color-rose-500) 25%,transparent)}}.hover\:bg-rose-500\/30:hover{background-color:#ff23574d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-rose-500\/30:hover{background-color:color-mix(in oklab,var(--color-rose-500) 30%,transparent)}}.hover\:bg-sky-500\/25:hover{background-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.hover\:bg-sky-500\/25:hover{background-color:color-mix(in oklab,var(--color-sky-500) 25%,transparent)}}.hover\:bg-slate-700\/50:hover{background-color:#31415880}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/50:hover{background-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.hover\:bg-slate-700\/60:hover{background-color:#31415899}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/60:hover{background-color:color-mix(in oklab,var(--color-slate-700) 60%,transparent)}}.hover\:bg-slate-700\/70:hover{background-color:#314158b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/70:hover{background-color:color-mix(in oklab,var(--color-slate-700) 70%,transparent)}}.hover\:bg-slate-700\/80:hover{background-color:#314158cc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/80:hover{background-color:color-mix(in oklab,var(--color-slate-700) 80%,transparent)}}.hover\:bg-slate-800\/30:hover{background-color:#1d293d4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/30:hover{background-color:color-mix(in oklab,var(--color-slate-800) 30%,transparent)}}.hover\:bg-slate-800\/40:hover{background-color:#1d293d66}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/40:hover{background-color:color-mix(in oklab,var(--color-slate-800) 40%,transparent)}}.hover\:bg-slate-800\/50:hover{background-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/50:hover{background-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.hover\:bg-slate-800\/60:hover{background-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/60:hover{background-color:color-mix(in oklab,var(--color-slate-800) 60%,transparent)}}.hover\:bg-slate-800\/70:hover{background-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/70:hover{background-color:color-mix(in oklab,var(--color-slate-800) 70%,transparent)}}.hover\:bg-slate-800\/80:hover{background-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/80:hover{background-color:color-mix(in oklab,var(--color-slate-800) 80%,transparent)}}.hover\:bg-slate-900\/70:hover{background-color:#0f172bb3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-900\/70:hover{background-color:color-mix(in oklab,var(--color-slate-900) 70%,transparent)}}.hover\:bg-slate-900\/80:hover{background-color:#0f172bcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-900\/80:hover{background-color:color-mix(in oklab,var(--color-slate-900) 80%,transparent)}}.hover\:bg-violet-500\/30:hover{background-color:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-violet-500\/30:hover{background-color:color-mix(in oklab,var(--color-violet-500) 30%,transparent)}}.hover\:from-indigo-500\/30:hover{--tw-gradient-from:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:from-indigo-500\/30:hover{--tw-gradient-from:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.hover\:from-indigo-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-rose-500\/30:hover{--tw-gradient-from:#ff23574d}@supports (color:color-mix(in lab,red,red)){.hover\:from-rose-500\/30:hover{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.hover\:from-rose-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-cyan-500\/30:hover{--tw-gradient-to:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.hover\:to-cyan-500\/30:hover{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.hover\:to-cyan-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-violet-500\/30:hover{--tw-gradient-to:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:to-violet-500\/30:hover{--tw-gradient-to:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.hover\:to-violet-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:text-indigo-300:hover{color:var(--color-indigo-300)}.hover\:text-rose-400:hover{color:var(--color-rose-400)}.hover\:text-slate-300:hover{color:var(--color-slate-300)}.hover\:text-slate-400:hover{color:var(--color-slate-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_18px_28px_rgba\(0\,0\,0\,0\.45\)\]:hover{--tw-shadow:0 18px 28px var(--tw-shadow-color,#00000073);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:ring-1:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-indigo-500\/10:hover{--tw-shadow-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-indigo-500\/10:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-indigo-500\/30:hover{--tw-shadow-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-indigo-500\/30:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-indigo-500\/40:hover{--tw-shadow-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-indigo-500\/40:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 40%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:ring-indigo-400\/50:hover{--tw-ring-color:#7d87ff80}@supports (color:color-mix(in lab,red,red)){.hover\:ring-indigo-400\/50:hover{--tw-ring-color:color-mix(in oklab, var(--color-indigo-400) 50%, transparent)}}.hover\:ring-indigo-500\/20:hover{--tw-ring-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.hover\:ring-indigo-500\/20:hover{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.hover\:ring-indigo-500\/30:hover{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:ring-indigo-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.hover\:ring-white\/20:hover{--tw-ring-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:ring-white\/20:hover{--tw-ring-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-cyan-500\/50:focus{--tw-ring-color:#00b7d780}@supports (color:color-mix(in lab,red,red)){.focus\:ring-cyan-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 50%, transparent)}}.focus\:ring-indigo-500\/50:focus{--tw-ring-color:#625fff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 50%, transparent)}}.focus\:ring-rose-500\/50:focus{--tw-ring-color:#ff235780}@supports (color:color-mix(in lab,red,red)){.focus\:ring-rose-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 50%, transparent)}}.active\:translate-y-0:active{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:scale-\[0\.99\]:active{scale:.99}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\:block{display:block}.sm\:hidden{display:none}.sm\:h-9{height:calc(var(--spacing) * 9)}.sm\:h-14{height:calc(var(--spacing) * 14)}.sm\:h-16{height:calc(var(--spacing) * 16)}.sm\:h-28{height:calc(var(--spacing) * 28)}.sm\:h-44{height:calc(var(--spacing) * 44)}.sm\:h-\[4\.6rem\]{height:4.6rem}.sm\:w-9{width:calc(var(--spacing) * 9)}.sm\:w-10{width:calc(var(--spacing) * 10)}.sm\:w-12{width:calc(var(--spacing) * 12)}.sm\:w-14{width:calc(var(--spacing) * 14)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:gap-3{gap:calc(var(--spacing) * 3)}.sm\:p-4{padding:calc(var(--spacing) * 4)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.sm\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}}@media(min-width:48rem){.md\:order-first{order:-9999}.md\:mb-4{margin-bottom:calc(var(--spacing) * 4)}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-14{height:calc(var(--spacing) * 14)}.md\:h-20{height:calc(var(--spacing) * 20)}.md\:h-52{height:calc(var(--spacing) * 52)}.md\:h-\[4\.35rem\]{height:4.35rem}.md\:max-h-full{max-height:100%}.md\:max-h-none{max-height:none}.md\:min-h-0{min-height:calc(var(--spacing) * 0)}.md\:min-h-\[400px\]{min-height:400px}.md\:w-14{width:calc(var(--spacing) * 14)}.md\:w-16{width:calc(var(--spacing) * 16)}.md\:w-72{width:calc(var(--spacing) * 72)}.md\:w-80{width:calc(var(--spacing) * 80)}.md\:max-w-sm{max-width:var(--container-sm)}.md\:flex-1{flex:1}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-start{align-items:flex-start}.md\:justify-between{justify-content:space-between}.md\:gap-1\.5{gap:calc(var(--spacing) * 1.5)}.md\:gap-2{gap:calc(var(--spacing) * 2)}.md\:gap-2\.5{gap:calc(var(--spacing) * 2.5)}.md\:gap-3{gap:calc(var(--spacing) * 3)}.md\:gap-6{gap:calc(var(--spacing) * 6)}:where(.md\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.md\:space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.md\:space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}.md\:overflow-auto{overflow:auto}.md\:overflow-y-auto{overflow-y:auto}.md\:p-5{padding:calc(var(--spacing) * 5)}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-6{padding-inline:calc(var(--spacing) * 6)}.md\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.md\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.md\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.md\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:w-64{width:calc(var(--spacing) * 64)}.lg\:shrink-0{flex-shrink:0}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media(min-width:80rem){.xl\:order-first{order:-9999}.xl\:min-h-0{min-height:calc(var(--spacing) * 0)}.xl\:w-80{width:calc(var(--spacing) * 80)}.xl\:w-88{width:calc(var(--spacing) * 88)}.xl\:w-\[410px\]{width:410px}.xl\:shrink-0{flex-shrink:0}.xl\:flex-row{flex-direction:row}.xl\:gap-4{gap:calc(var(--spacing) * 4)}}@media(min-width:96rem){.\32xl\:w-\[460px\]{width:460px}}}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:linear-gradient(135deg,#0f172a,#1e1b4b,#0f172a);min-height:100vh;margin:0}@keyframes visited{0%{opacity:0;border-radius:50%;transform:scale(.3)}50%{opacity:.8;border-radius:30%;transform:scale(1.1)}to{opacity:1;border-radius:0;transform:scale(1)}}@keyframes path{0%{opacity:0;transform:scale(.5)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}@keyframes wall{0%{transform:scale(.6)}50%{transform:scale(1.1)}to{transform:scale(1)}}@keyframes shake{0%,to{transform:translate(0)}25%{transform:translate(-6px)}50%{transform:translate(6px)}75%{transform:translate(-4px)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/docs/assets/index-lLadk08S.js b/docs/assets/index-CB1-0H6I.js similarity index 98% rename from docs/assets/index-lLadk08S.js rename to docs/assets/index-CB1-0H6I.js index 78dff2d..28e184b 100644 --- a/docs/assets/index-lLadk08S.js +++ b/docs/assets/index-CB1-0H6I.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AlgorithmPlaygroundPage-BXRKH-KW.js","assets/AlgorithmCodePanel-8oFtkLXS.js","assets/audioContext-NbgqvQGz.js","assets/shuffle-ADbBlETg.js","assets/chevron-right-Cp_zyb7b.js","assets/play-b2ZiatJ3.js","assets/rotate-ccw-DMjSdzg2.js","assets/volume-x-CjLNPeax.js","assets/LinkedListAlgorithmsPage-Bf0XShdT.js","assets/linkedListAlgo-0_WYfSZm.js","assets/arrow-left-C4-GmPRq.js","assets/LinkedListAlgoPage-BYNl9xdF.js","assets/pause-CU46RSeo.js","assets/GraphTraversalPage-DIP79SzH.js","assets/index-Cj8HB9AY.js","assets/square-QnQTkqqU.js","assets/SortingPage-DY4J_cuF.js","assets/index-iw_6MvvU.js","assets/SudokuPage-D621aJ2E.js","assets/zap-Y8cI0o9G.js","assets/TreeTraversalPage-CXh2nfI3.js","assets/TriePage-C2SmMNzK.js","assets/plus-NICMDkhr.js","assets/BalancedTreePage-C8htDNti.js","assets/StackPage-B2mxdyxa.js","assets/useDSSound-CPhif-bj.js","assets/trash-2-veeiSg5V.js","assets/QueuePage-DUKmQFK6.js","assets/ArrayPage-DrT8Biad.js","assets/LinkedListPage-CUYUVQCV.js","assets/AdvancedStructurePage-DOo62Byj.js","assets/FibonacciGamePage-BpvILNCs.js","assets/trophy-BeLgwZ5q.js","assets/lightbulb-CbLvQr23.js","assets/timer-Baa2rAz8.js","assets/DijkstraGamePage-DHV7Q9c2.js","assets/map-C5ZomysO.js","assets/route-DiDkH3-5.js","assets/eye-off-Pd9-Vzxg.js","assets/BattlePage-BfxUg7Va.js","assets/MahjongGamePage-CweJKrxc.js","assets/skip-forward-S_F054t1.js","assets/EvolutionSimulatorPage-DGrLIA6R.js","assets/RubiksCubeGamePage-Dhk65GX9.js","assets/WorldMapGamePage-BfAD3dv0.js","assets/GitPage-BLlFYf7b.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AlgorithmPlaygroundPage-NFfq4IMN.js","assets/AlgorithmCodePanel-B_cngBmY.js","assets/audioContext-NbgqvQGz.js","assets/shuffle-DZnyoAGL.js","assets/chevron-right-ChVmoNtO.js","assets/play-SZ6Nqtz8.js","assets/rotate-ccw-CDlWXRsI.js","assets/volume-x-CKT6TOtL.js","assets/LinkedListAlgorithmsPage-rBTSWR3w.js","assets/linkedListAlgo-0_WYfSZm.js","assets/arrow-left-eH0A06ps.js","assets/LinkedListAlgoPage-DLEBZwaB.js","assets/pause-DgUWKqjY.js","assets/GraphTraversalPage-Cz8zdw1I.js","assets/index-DrhCNtmA.js","assets/square-B4KY3il9.js","assets/SortingPage-BJLOOKGn.js","assets/index-iw_6MvvU.js","assets/SudokuPage-Twa08t7Q.js","assets/zap-C3nU9HZ_.js","assets/TreeTraversalPage-CzjDdla1.js","assets/TriePage-DRyr69yQ.js","assets/plus-B3nnW8Th.js","assets/BalancedTreePage-coFjRyUc.js","assets/StackPage-CCdc4dwi.js","assets/useDSSound-BJYLYD0f.js","assets/trash-2-C4vvSjjZ.js","assets/QueuePage-CBnrjsK1.js","assets/ArrayPage-BRkafP6e.js","assets/LinkedListPage-CsPqMWtn.js","assets/AdvancedStructurePage-BcFhvyhq.js","assets/FibonacciGamePage-ZpMjqDh9.js","assets/trophy-DE-EF49m.js","assets/lightbulb-Bmtk7V6i.js","assets/timer-rgbBx2U0.js","assets/DijkstraGamePage-aIRKpG_-.js","assets/map-Bnco4-k1.js","assets/route-BuoNUCzx.js","assets/eye-off-DMbwz3T2.js","assets/BattlePage-DY6YXR_B.js","assets/MahjongGamePage-Bdpv27zp.js","assets/skip-forward-DWTiDap8.js","assets/EvolutionSimulatorPage-CHVguTgo.js","assets/RubiksCubeGamePage-DLo6uYa2.js","assets/WorldMapGamePage-DMM-CLOk.js","assets/GitPage-BFm-nVBR.js"])))=>i.map(i=>d[i]); (function(){const f=document.createElement("link").relList;if(f&&f.supports&&f.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))s(h);new MutationObserver(h=>{for(const m of h)if(m.type==="childList")for(const b of m.addedNodes)b.tagName==="LINK"&&b.rel==="modulepreload"&&s(b)}).observe(document,{childList:!0,subtree:!0});function o(h){const m={};return h.integrity&&(m.integrity=h.integrity),h.referrerPolicy&&(m.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?m.credentials="include":h.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function s(h){if(h.ep)return;h.ep=!0;const m=o(h);fetch(h.href,m)}})();var Us={exports:{}},wn={};var uh;function T1(){if(uh)return wn;uh=1;var c=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function o(s,h,m){var b=null;if(m!==void 0&&(b=""+m),h.key!==void 0&&(b=""+h.key),"key"in h){m={};for(var j in h)j!=="key"&&(m[j]=h[j])}else m=h;return h=m.ref,{$$typeof:c,type:s,key:b,ref:h!==void 0?h:null,props:m}}return wn.Fragment=f,wn.jsx=o,wn.jsxs=o,wn}var ih;function A1(){return ih||(ih=1,Us.exports=T1()),Us.exports}var d=A1(),ws={exports:{}},I={};var ch;function j1(){if(ch)return I;ch=1;var c=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),b=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),w=Symbol.iterator;function X(v){return v===null||typeof v!="object"?null:(v=w&&v[w]||v["@@iterator"],typeof v=="function"?v:null)}var Q={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Y=Object.assign,H={};function K(v,U,q){this.props=v,this.context=U,this.refs=H,this.updater=q||Q}K.prototype.isReactComponent={},K.prototype.setState=function(v,U){if(typeof v!="object"&&typeof v!="function"&&v!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,v,U,"setState")},K.prototype.forceUpdate=function(v){this.updater.enqueueForceUpdate(this,v,"forceUpdate")};function et(){}et.prototype=K.prototype;function $(v,U,q){this.props=v,this.context=U,this.refs=H,this.updater=q||Q}var xt=$.prototype=new et;xt.constructor=$,Y(xt,K.prototype),xt.isPureReactComponent=!0;var St=Array.isArray;function jt(){}var F={H:null,A:null,T:null,S:null},Dt=Object.prototype.hasOwnProperty;function $t(v,U,q){var G=q.ref;return{$$typeof:c,type:v,key:U,ref:G!==void 0?G:null,props:q}}function Ue(v,U){return $t(v.type,U,v.props)}function ve(v){return typeof v=="object"&&v!==null&&v.$$typeof===c}function Wt(v){var U={"=":"=0",":":"=2"};return"$"+v.replace(/[=:]/g,function(q){return U[q]})}var we=/\/+/g;function be(v,U){return typeof v=="object"&&v!==null&&v.key!=null?Wt(""+v.key):U.toString(36)}function Ht(v){switch(v.status){case"fulfilled":return v.value;case"rejected":throw v.reason;default:switch(typeof v.status=="string"?v.then(jt,jt):(v.status="pending",v.then(function(U){v.status==="pending"&&(v.status="fulfilled",v.value=U)},function(U){v.status==="pending"&&(v.status="rejected",v.reason=U)})),v.status){case"fulfilled":return v.value;case"rejected":throw v.reason}}throw v}function O(v,U,q,G,P){var at=typeof v;(at==="undefined"||at==="boolean")&&(v=null);var ht=!1;if(v===null)ht=!0;else switch(at){case"bigint":case"string":case"number":ht=!0;break;case"object":switch(v.$$typeof){case c:case f:ht=!0;break;case N:return ht=v._init,O(ht(v._payload),U,q,G,P)}}if(ht)return P=P(v),ht=G===""?"."+be(v,0):G,St(P)?(q="",ht!=null&&(q=ht.replace(we,"$&/")+"/"),O(P,U,q,"",function(Ga){return Ga})):P!=null&&(ve(P)&&(P=Ue(P,q+(P.key==null||v&&v.key===P.key?"":(""+P.key).replace(we,"$&/")+"/")+ht)),U.push(P)),1;ht=0;var It=G===""?".":G+":";if(St(v))for(var Ct=0;Ct>>1,Et=O[gt];if(0>>1;gth(q,W))Gh(P,q)?(O[gt]=P,O[G]=W,gt=G):(O[gt]=q,O[U]=W,gt=U);else if(Gh(P,W))O[gt]=P,O[G]=W,gt=G;else break t}}return B}function h(O,B){var W=O.sortIndex-B.sortIndex;return W!==0?W:O.id-B.id}if(c.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;c.unstable_now=function(){return m.now()}}else{var b=Date,j=b.now();c.unstable_now=function(){return b.now()-j}}var S=[],g=[],N=1,T=null,w=3,X=!1,Q=!1,Y=!1,H=!1,K=typeof setTimeout=="function"?setTimeout:null,et=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;function xt(O){for(var B=o(g);B!==null;){if(B.callback===null)s(g);else if(B.startTime<=O)s(g),B.sortIndex=B.expirationTime,f(S,B);else break;B=o(g)}}function St(O){if(Y=!1,xt(O),!Q)if(o(S)!==null)Q=!0,jt||(jt=!0,Wt());else{var B=o(g);B!==null&&Ht(St,B.startTime-O)}}var jt=!1,F=-1,Dt=5,$t=-1;function Ue(){return H?!0:!(c.unstable_now()-$tO&&Ue());){var gt=T.callback;if(typeof gt=="function"){T.callback=null,w=T.priorityLevel;var Et=gt(T.expirationTime<=O);if(O=c.unstable_now(),typeof Et=="function"){T.callback=Et,xt(O),B=!0;break e}T===o(S)&&s(S),xt(O)}else s(S);T=o(S)}if(T!==null)B=!0;else{var v=o(g);v!==null&&Ht(St,v.startTime-O),B=!1}}break t}finally{T=null,w=W,X=!1}B=void 0}}finally{B?Wt():jt=!1}}}var Wt;if(typeof $=="function")Wt=function(){$(ve)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,be=we.port2;we.port1.onmessage=ve,Wt=function(){be.postMessage(null)}}else Wt=function(){K(ve,0)};function Ht(O,B){F=K(function(){O(c.unstable_now())},B)}c.unstable_IdlePriority=5,c.unstable_ImmediatePriority=1,c.unstable_LowPriority=4,c.unstable_NormalPriority=3,c.unstable_Profiling=null,c.unstable_UserBlockingPriority=2,c.unstable_cancelCallback=function(O){O.callback=null},c.unstable_forceFrameRate=function(O){0>O||125gt?(O.sortIndex=W,f(g,O),o(S)===null&&O===o(g)&&(Y?(et(F),F=-1):Y=!0,Ht(St,W-gt))):(O.sortIndex=Et,f(S,O),Q||X||(Q=!0,jt||(jt=!0,Wt()))),O},c.unstable_shouldYield=Ue,c.unstable_wrapCallback=function(O){var B=w;return function(){var W=w;w=B;try{return O.apply(this,arguments)}finally{w=W}}}})(qs)),qs}var fh;function M1(){return fh||(fh=1,Bs.exports=R1()),Bs.exports}var Ls={exports:{}},Ft={};var oh;function O1(){if(oh)return Ft;oh=1;var c=Zs();function f(S){var g="https://react.dev/errors/"+S;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c)}catch(f){console.error(f)}}return c(),Ls.exports=O1(),Ls.exports}var hh;function D1(){if(hh)return Hn;hh=1;var c=M1(),f=Zs(),o=N1();function s(t){var e="https://react.dev/errors/"+t;if(1Et||(t.current=gt[Et],gt[Et]=null,Et--)}function q(t,e){Et++,gt[Et]=t.current,t.current=e}var G=v(null),P=v(null),at=v(null),ht=v(null);function It(t,e){switch(q(at,e),q(P,t),q(G,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?Rd(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=Rd(e),t=Md(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}U(G),q(G,t)}function Ct(){U(G),U(P),U(at)}function Ga(t){t.memoizedState!==null&&q(ht,t);var e=G.current,l=Md(e,t.type);e!==l&&(q(P,t),q(G,l))}function Vn(t){P.current===t&&(U(G),U(P)),ht.current===t&&(U(ht),Nn._currentValue=W)}var gi,lr;function Hl(t){if(gi===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);gi=e&&e[1]||"",lr=-1)":-1 to d.jsx("span",{className:"rounded-full bg-slate-800/60 px-2 py-0.5 text-[10px] font-medium text-slate-400",children:g},g))}),d.jsxs("div",{className:"mt-3 flex items-center gap-1 text-xs font-medium text-cyan-400 opacity-0 transition-opacity group-hover:opacity-100",children:["Play ",d.jsx(kn,{size:12})]})]},f))})})]}):null}const il=A.lazy(()=>Nt(()=>import("./AlgorithmPlaygroundPage-BXRKH-KW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Op=A.lazy(()=>Nt(()=>import("./LinkedListAlgorithmsPage-Bf0XShdT.js"),__vite__mapDeps([8,9,10,6]))),cl=A.lazy(()=>Nt(()=>import("./LinkedListAlgoPage-BYNl9xdF.js"),__vite__mapDeps([11,9,1,2,3,4,12,5,6,7,10]))),Rh=A.lazy(()=>Nt(()=>import("./GraphTraversalPage-DIP79SzH.js"),__vite__mapDeps([13,14,7,15,5,6,3,2]))),Mh=A.lazy(()=>Nt(()=>import("./SortingPage-DY4J_cuF.js"),__vite__mapDeps([16,7,15,3,17,2]))),Np=A.lazy(()=>Nt(()=>import("./SudokuPage-D621aJ2E.js"),__vite__mapDeps([18,4,19,3,6]))),Oh=A.lazy(()=>Nt(()=>import("./TreeTraversalPage-CXh2nfI3.js"),__vite__mapDeps([20,7,4,5,15,3,6,2]))),Dp=A.lazy(()=>Nt(()=>import("./TriePage-C2SmMNzK.js"),__vite__mapDeps([21,4,5,15,6,22,7,2]))),Cp=A.lazy(()=>Nt(()=>import("./BalancedTreePage-C8htDNti.js"),__vite__mapDeps([23,22,3,4]))),Up=A.lazy(()=>Nt(()=>import("./StackPage-B2mxdyxa.js"),__vite__mapDeps([24,25,2,22,26,6,3,7,4]))),wp=A.lazy(()=>Nt(()=>import("./QueuePage-DUKmQFK6.js"),__vite__mapDeps([27,25,2,22,26,6,3,7,4]))),Hp=A.lazy(()=>Nt(()=>import("./ArrayPage-DrT8Biad.js"),__vite__mapDeps([28,25,2,22,26,6,3,7,4]))),Bp=A.lazy(()=>Nt(()=>import("./LinkedListPage-CUYUVQCV.js"),__vite__mapDeps([29,25,2,22,26,6,3,7,4]))),Qs=A.lazy(()=>Nt(()=>import("./AdvancedStructurePage-DOo62Byj.js"),__vite__mapDeps([30,25,2,3,4,5,7]))),qp=A.lazy(()=>Nt(()=>import("./FibonacciGamePage-BpvILNCs.js"),__vite__mapDeps([31,32,33,34,6,7,2]))),Lp=A.lazy(()=>Nt(()=>import("./DijkstraGamePage-DHV7Q9c2.js"),__vite__mapDeps([35,36,3,4,12,5,37,34,32,6,38,7,2]))),Yp=A.lazy(()=>Nt(()=>import("./BattlePage-BfxUg7Va.js"),__vite__mapDeps([39,7,3,5,32,6,12,14,17,2,10,36]))),Gp=A.lazy(()=>Nt(()=>import("./MahjongGamePage-CweJKrxc.js"),__vite__mapDeps([40,3,6,7,38,4,12,5,32,2,33,41,34,19]))),kp=A.lazy(()=>Nt(()=>import("./EvolutionSimulatorPage-DGrLIA6R.js"),__vite__mapDeps([42,2,3,5,12,6,7]))),Qp=A.lazy(()=>Nt(()=>import("./RubiksCubeGamePage-Dhk65GX9.js"),__vite__mapDeps([43,3,41,6,7,2,32]))),Vp=A.lazy(()=>Nt(()=>import("./WorldMapGamePage-BfAD3dv0.js"),__vite__mapDeps([44,3,4,5,37,7,2]))),Xp=A.lazy(()=>Nt(()=>import("./GitPage-BLlFYf7b.js"),__vite__mapDeps([45,2])));function Zp(){return d.jsx(ng,{basename:"/algorithm-visualizer",children:d.jsxs("div",{className:"flex h-screen flex-col text-white font-sans",children:[d.jsx(gp,{}),d.jsx(pp,{children:d.jsx(A.Suspense,{fallback:d.jsx(vp,{}),children:d.jsxs(Uy,{children:[d.jsx(J,{path:"/",element:d.jsx(Sp,{})}),d.jsx(J,{path:"/algorithms",element:d.jsx(zp,{})}),d.jsx(J,{path:"/algorithms/sorting",element:d.jsx(Mh,{})}),d.jsx(J,{path:"/algorithms/tree",element:d.jsx(Oh,{})}),d.jsx(J,{path:"/algorithms/graph",element:d.jsx(Rh,{})}),d.jsx(J,{path:"/algorithms/binary-search",element:d.jsx(il,{demo:"binary-search"})}),d.jsx(J,{path:"/algorithms/ternary-search",element:d.jsx(il,{demo:"ternary-search"})}),d.jsx(J,{path:"/algorithms/queue-using-stacks",element:d.jsx(il,{demo:"queue-using-stacks"})}),d.jsx(J,{path:"/algorithms/stack-using-queues",element:d.jsx(il,{demo:"stack-using-queues"})}),d.jsx(J,{path:"/algorithms/tower-of-hanoi",element:d.jsx(il,{demo:"tower-of-hanoi"})}),d.jsx(J,{path:"/algorithms/rat-maze",element:d.jsx(il,{demo:"rat-maze"})}),d.jsx(J,{path:"/algorithms/grid-search",element:d.jsx(il,{demo:"grid-search"})}),d.jsx(J,{path:"/algorithms/dutch-national-flag",element:d.jsx(il,{demo:"dutch-national-flag"})}),d.jsx(J,{path:"/algorithms/top-k-frequent",element:d.jsx(il,{demo:"top-k-frequent"})}),d.jsx(J,{path:"/algorithms/linked-list",element:d.jsx(Op,{})}),d.jsx(J,{path:"/algorithms/linked-list/find-middle",element:d.jsx(cl,{problem:"find-middle"})}),d.jsx(J,{path:"/algorithms/linked-list/reverse-list",element:d.jsx(cl,{problem:"reverse-list"})}),d.jsx(J,{path:"/algorithms/linked-list/add-two-numbers",element:d.jsx(cl,{problem:"add-two-numbers"})}),d.jsx(J,{path:"/algorithms/linked-list/reverse-k-group",element:d.jsx(cl,{problem:"reverse-k-group"})}),d.jsx(J,{path:"/algorithms/linked-list/palindrome",element:d.jsx(cl,{problem:"palindrome"})}),d.jsx(J,{path:"/algorithms/linked-list/lru-cache",element:d.jsx(cl,{problem:"lru-cache"})}),d.jsx(J,{path:"/algorithms/linked-list/segregate",element:d.jsx(cl,{problem:"segregate"})}),d.jsx(J,{path:"/algorithms/linked-list/detect-cycle",element:d.jsx(cl,{problem:"detect-cycle"})}),d.jsx(J,{path:"/algorithms/linked-list/sort-list",element:d.jsx(cl,{problem:"sort-list"})}),d.jsx(J,{path:"/traversals",element:d.jsx(Tp,{})}),d.jsx(J,{path:"/traversals/graph",element:d.jsx(Rh,{})}),d.jsx(J,{path:"/traversals/tree",element:d.jsx(Oh,{})}),d.jsx(J,{path:"/traversals/trie",element:d.jsx(Dp,{})}),d.jsx(J,{path:"/sorting",element:d.jsx(Mh,{})}),d.jsx(J,{path:"/games/sudoku-solver",element:d.jsx(Np,{})}),d.jsx(J,{path:"/data-structures",element:d.jsx(jp,{})}),d.jsx(J,{path:"/data-structures/balanced-trees",element:d.jsx(Cp,{})}),d.jsx(J,{path:"/data-structures/stack",element:d.jsx(Up,{})}),d.jsx(J,{path:"/data-structures/queue",element:d.jsx(wp,{})}),d.jsx(J,{path:"/data-structures/array",element:d.jsx(Hp,{})}),d.jsx(J,{path:"/data-structures/linked-list",element:d.jsx(Bp,{})}),d.jsx(J,{path:"/data-structures/trie",element:d.jsx(Qs,{structure:"trie"})}),d.jsx(J,{path:"/data-structures/segment-tree",element:d.jsx(Qs,{structure:"segment-tree"})}),d.jsx(J,{path:"/data-structures/fenwick-tree",element:d.jsx(Qs,{structure:"fenwick-tree"})}),d.jsx(J,{path:"/games",element:d.jsx(Mp,{})}),d.jsx(J,{path:"/games/fibonacci",element:d.jsx(qp,{})}),d.jsx(J,{path:"/games/dijkstra",element:d.jsx(Lp,{})}),d.jsx(J,{path:"/games/battles",element:d.jsx(Yp,{})}),d.jsx(J,{path:"/games/mahjong",element:d.jsx(Gp,{})}),d.jsx(J,{path:"/games/evolution-simulator",element:d.jsx(kp,{})}),d.jsx(J,{path:"/games/rubiks-cube",element:d.jsx(Qp,{})}),d.jsx(J,{path:"/games/world-map",element:d.jsx(Vp,{})}),d.jsx(J,{path:"/git",element:d.jsx(Xp,{})})]})})})]})})}U1.createRoot(document.getElementById("root")).render(d.jsx(A.StrictMode,{children:d.jsx(Zp,{})}));export{kn as A,Tg as C,Og as E,Dg as F,Hg as G,fl as L,hi as N,Kg as P,tp as S,mp as X,er as a,Ih as b,ot as c,Ph as d,Ig as e,up as f,tr as g,Wh as h,d as j,A as r}; + `,children:[d.jsx("div",{className:`mb-3 flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br ${b} shadow-lg ${j}`,children:d.jsx(S,{size:20,className:"text-white"})}),d.jsx("h4",{className:"text-base font-bold text-white",children:o}),d.jsx("p",{className:"text-[10px] text-slate-500 italic",children:s}),d.jsx("p",{className:"mt-2 flex-1 text-xs text-slate-400 leading-relaxed",children:h}),d.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:m.map(g=>d.jsx("span",{className:"rounded-full bg-slate-800/60 px-2 py-0.5 text-[10px] font-medium text-slate-400",children:g},g))}),d.jsxs("div",{className:"mt-3 flex items-center gap-1 text-xs font-medium text-cyan-400 opacity-0 transition-opacity group-hover:opacity-100",children:["Play ",d.jsx(kn,{size:12})]})]},f))})})]}):null}const il=A.lazy(()=>Nt(()=>import("./AlgorithmPlaygroundPage-NFfq4IMN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Op=A.lazy(()=>Nt(()=>import("./LinkedListAlgorithmsPage-rBTSWR3w.js"),__vite__mapDeps([8,9,10,6]))),cl=A.lazy(()=>Nt(()=>import("./LinkedListAlgoPage-DLEBZwaB.js"),__vite__mapDeps([11,9,1,2,3,4,12,5,6,7,10]))),Rh=A.lazy(()=>Nt(()=>import("./GraphTraversalPage-Cz8zdw1I.js"),__vite__mapDeps([13,14,7,15,5,6,3,2]))),Mh=A.lazy(()=>Nt(()=>import("./SortingPage-BJLOOKGn.js"),__vite__mapDeps([16,7,15,3,17,2]))),Np=A.lazy(()=>Nt(()=>import("./SudokuPage-Twa08t7Q.js"),__vite__mapDeps([18,4,19,3,6]))),Oh=A.lazy(()=>Nt(()=>import("./TreeTraversalPage-CzjDdla1.js"),__vite__mapDeps([20,7,4,5,15,3,6,2]))),Dp=A.lazy(()=>Nt(()=>import("./TriePage-DRyr69yQ.js"),__vite__mapDeps([21,4,5,15,6,22,7,2]))),Cp=A.lazy(()=>Nt(()=>import("./BalancedTreePage-coFjRyUc.js"),__vite__mapDeps([23,22,3,4]))),Up=A.lazy(()=>Nt(()=>import("./StackPage-CCdc4dwi.js"),__vite__mapDeps([24,25,2,22,26,6,3,7,4]))),wp=A.lazy(()=>Nt(()=>import("./QueuePage-CBnrjsK1.js"),__vite__mapDeps([27,25,2,22,26,6,3,7,4]))),Hp=A.lazy(()=>Nt(()=>import("./ArrayPage-BRkafP6e.js"),__vite__mapDeps([28,25,2,22,26,6,3,7,4]))),Bp=A.lazy(()=>Nt(()=>import("./LinkedListPage-CsPqMWtn.js"),__vite__mapDeps([29,25,2,22,26,6,3,7,4]))),Qs=A.lazy(()=>Nt(()=>import("./AdvancedStructurePage-BcFhvyhq.js"),__vite__mapDeps([30,25,2,3,4,5,7]))),qp=A.lazy(()=>Nt(()=>import("./FibonacciGamePage-ZpMjqDh9.js"),__vite__mapDeps([31,32,33,34,6,7,2]))),Lp=A.lazy(()=>Nt(()=>import("./DijkstraGamePage-aIRKpG_-.js"),__vite__mapDeps([35,36,3,4,12,5,37,34,32,6,38,7,2]))),Yp=A.lazy(()=>Nt(()=>import("./BattlePage-DY6YXR_B.js"),__vite__mapDeps([39,7,3,5,32,6,12,14,17,2,10,36]))),Gp=A.lazy(()=>Nt(()=>import("./MahjongGamePage-Bdpv27zp.js"),__vite__mapDeps([40,3,6,7,38,4,12,5,32,2,33,41,34,19]))),kp=A.lazy(()=>Nt(()=>import("./EvolutionSimulatorPage-CHVguTgo.js"),__vite__mapDeps([42,2,3,5,12,6,7]))),Qp=A.lazy(()=>Nt(()=>import("./RubiksCubeGamePage-DLo6uYa2.js"),__vite__mapDeps([43,3,41,6,7,2,32]))),Vp=A.lazy(()=>Nt(()=>import("./WorldMapGamePage-DMM-CLOk.js"),__vite__mapDeps([44,3,4,5,37,7,2]))),Xp=A.lazy(()=>Nt(()=>import("./GitPage-BFm-nVBR.js"),__vite__mapDeps([45,2])));function Zp(){return d.jsx(ng,{basename:"/algorithm-visualizer",children:d.jsxs("div",{className:"flex h-screen flex-col text-white font-sans",children:[d.jsx(gp,{}),d.jsx(pp,{children:d.jsx(A.Suspense,{fallback:d.jsx(vp,{}),children:d.jsxs(Uy,{children:[d.jsx(J,{path:"/",element:d.jsx(Sp,{})}),d.jsx(J,{path:"/algorithms",element:d.jsx(zp,{})}),d.jsx(J,{path:"/algorithms/sorting",element:d.jsx(Mh,{})}),d.jsx(J,{path:"/algorithms/tree",element:d.jsx(Oh,{})}),d.jsx(J,{path:"/algorithms/graph",element:d.jsx(Rh,{})}),d.jsx(J,{path:"/algorithms/binary-search",element:d.jsx(il,{demo:"binary-search"})}),d.jsx(J,{path:"/algorithms/ternary-search",element:d.jsx(il,{demo:"ternary-search"})}),d.jsx(J,{path:"/algorithms/queue-using-stacks",element:d.jsx(il,{demo:"queue-using-stacks"})}),d.jsx(J,{path:"/algorithms/stack-using-queues",element:d.jsx(il,{demo:"stack-using-queues"})}),d.jsx(J,{path:"/algorithms/tower-of-hanoi",element:d.jsx(il,{demo:"tower-of-hanoi"})}),d.jsx(J,{path:"/algorithms/rat-maze",element:d.jsx(il,{demo:"rat-maze"})}),d.jsx(J,{path:"/algorithms/grid-search",element:d.jsx(il,{demo:"grid-search"})}),d.jsx(J,{path:"/algorithms/dutch-national-flag",element:d.jsx(il,{demo:"dutch-national-flag"})}),d.jsx(J,{path:"/algorithms/top-k-frequent",element:d.jsx(il,{demo:"top-k-frequent"})}),d.jsx(J,{path:"/algorithms/linked-list",element:d.jsx(Op,{})}),d.jsx(J,{path:"/algorithms/linked-list/find-middle",element:d.jsx(cl,{problem:"find-middle"})}),d.jsx(J,{path:"/algorithms/linked-list/reverse-list",element:d.jsx(cl,{problem:"reverse-list"})}),d.jsx(J,{path:"/algorithms/linked-list/add-two-numbers",element:d.jsx(cl,{problem:"add-two-numbers"})}),d.jsx(J,{path:"/algorithms/linked-list/reverse-k-group",element:d.jsx(cl,{problem:"reverse-k-group"})}),d.jsx(J,{path:"/algorithms/linked-list/palindrome",element:d.jsx(cl,{problem:"palindrome"})}),d.jsx(J,{path:"/algorithms/linked-list/lru-cache",element:d.jsx(cl,{problem:"lru-cache"})}),d.jsx(J,{path:"/algorithms/linked-list/segregate",element:d.jsx(cl,{problem:"segregate"})}),d.jsx(J,{path:"/algorithms/linked-list/detect-cycle",element:d.jsx(cl,{problem:"detect-cycle"})}),d.jsx(J,{path:"/algorithms/linked-list/sort-list",element:d.jsx(cl,{problem:"sort-list"})}),d.jsx(J,{path:"/traversals",element:d.jsx(Tp,{})}),d.jsx(J,{path:"/traversals/graph",element:d.jsx(Rh,{})}),d.jsx(J,{path:"/traversals/tree",element:d.jsx(Oh,{})}),d.jsx(J,{path:"/traversals/trie",element:d.jsx(Dp,{})}),d.jsx(J,{path:"/sorting",element:d.jsx(Mh,{})}),d.jsx(J,{path:"/games/sudoku-solver",element:d.jsx(Np,{})}),d.jsx(J,{path:"/data-structures",element:d.jsx(jp,{})}),d.jsx(J,{path:"/data-structures/balanced-trees",element:d.jsx(Cp,{})}),d.jsx(J,{path:"/data-structures/stack",element:d.jsx(Up,{})}),d.jsx(J,{path:"/data-structures/queue",element:d.jsx(wp,{})}),d.jsx(J,{path:"/data-structures/array",element:d.jsx(Hp,{})}),d.jsx(J,{path:"/data-structures/linked-list",element:d.jsx(Bp,{})}),d.jsx(J,{path:"/data-structures/trie",element:d.jsx(Qs,{structure:"trie"})}),d.jsx(J,{path:"/data-structures/segment-tree",element:d.jsx(Qs,{structure:"segment-tree"})}),d.jsx(J,{path:"/data-structures/fenwick-tree",element:d.jsx(Qs,{structure:"fenwick-tree"})}),d.jsx(J,{path:"/games",element:d.jsx(Mp,{})}),d.jsx(J,{path:"/games/fibonacci",element:d.jsx(qp,{})}),d.jsx(J,{path:"/games/dijkstra",element:d.jsx(Lp,{})}),d.jsx(J,{path:"/games/battles",element:d.jsx(Yp,{})}),d.jsx(J,{path:"/games/mahjong",element:d.jsx(Gp,{})}),d.jsx(J,{path:"/games/evolution-simulator",element:d.jsx(kp,{})}),d.jsx(J,{path:"/games/rubiks-cube",element:d.jsx(Qp,{})}),d.jsx(J,{path:"/games/world-map",element:d.jsx(Vp,{})}),d.jsx(J,{path:"/git",element:d.jsx(Xp,{})})]})})})]})})}U1.createRoot(document.getElementById("root")).render(d.jsx(A.StrictMode,{children:d.jsx(Zp,{})}));export{kn as A,Tg as C,Og as E,Dg as F,Hg as G,fl as L,hi as N,Kg as P,tp as S,mp as X,er as a,Ih as b,ot as c,Ph as d,Ig as e,up as f,tr as g,Wh as h,d as j,A as r}; diff --git a/docs/assets/index-CJgW8YMs.css b/docs/assets/index-CJgW8YMs.css new file mode 100644 index 0000000..00c2c93 --- /dev/null +++ b/docs/assets/index-CJgW8YMs.css @@ -0,0 +1 @@ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-950:oklch(25.8% .092 26.042);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-500:oklch(79.5% .184 86.047);--color-lime-500:oklch(76.8% .233 130.85);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-950:oklch(29.3% .066 243.157);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-950:oklch(28.2% .091 267.935);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-900:oklch(35.9% .144 278.697);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-500:oklch(62.7% .265 303.9);--color-fuchsia-400:oklch(74% .238 322.16);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-zinc-500:oklch(55.2% .016 285.938);--color-stone-50:oklch(98.5% .001 106.423);--color-stone-200:oklch(92.3% .003 48.717);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--drop-shadow-sm:0 1px 2px #00000026;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.inset-1{inset:calc(var(--spacing) * 1)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-x-1{inset-inline:calc(var(--spacing) * 1)}.inset-x-6{inset-inline:calc(var(--spacing) * 6)}.inset-y-1{inset-block:calc(var(--spacing) * 1)}.start{inset-inline-start:var(--spacing)}.start\!{inset-inline-start:var(--spacing)!important}.end{inset-inline-end:var(--spacing)}.-top-0\.5{top:calc(var(--spacing) * -.5)}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.top-0{top:calc(var(--spacing) * 0)}.top-1{top:calc(var(--spacing) * 1)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-4{top:calc(var(--spacing) * 4)}.top-5{top:calc(var(--spacing) * 5)}.top-16{top:calc(var(--spacing) * 16)}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1\.5{right:calc(var(--spacing) * -1.5)}.-right-14{right:calc(var(--spacing) * -14)}.right-0\.5{right:calc(var(--spacing) * .5)}.right-1{right:calc(var(--spacing) * 1)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.right-5{right:calc(var(--spacing) * 5)}.right-6{right:calc(var(--spacing) * 6)}.-bottom-1{bottom:calc(var(--spacing) * -1)}.-bottom-5{bottom:calc(var(--spacing) * -5)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-1{bottom:calc(var(--spacing) * 1)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-0{left:calc(var(--spacing) * 0)}.left-1{left:calc(var(--spacing) * 1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-4{left:calc(var(--spacing) * 4)}.left-5{left:calc(var(--spacing) * 5)}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.order-last{order:9999}.mx-0\.5{margin-inline:calc(var(--spacing) * .5)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-auto{margin-inline:auto}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-px{margin-top:1px}.mr-1{margin-right:calc(var(--spacing) * 1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.table{display:table}.aspect-square{aspect-ratio:1}.h-0{height:calc(var(--spacing) * 0)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-32{height:calc(var(--spacing) * 32)}.h-36{height:calc(var(--spacing) * 36)}.h-56{height:calc(var(--spacing) * 56)}.h-72{height:calc(var(--spacing) * 72)}.h-\[22px\]{height:22px}.h-\[500px\]{height:500px}.h-full{height:100%}.h-screen{height:100vh}.max-h-28{max-height:calc(var(--spacing) * 28)}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-36{max-height:calc(var(--spacing) * 36)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-\[50vh\]{max-height:50vh}.max-h-\[55vh\]{max-height:55vh}.max-h-\[420px\]{max-height:420px}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-12{min-height:calc(var(--spacing) * 12)}.min-h-64{min-height:calc(var(--spacing) * 64)}.min-h-\[5\.5rem\]{min-height:5.5rem}.min-h-\[5rem\]{min-height:5rem}.min-h-\[40vh\]{min-height:40vh}.min-h-\[56px\]{min-height:56px}.min-h-\[200px\]{min-height:200px}.min-h-\[240px\]{min-height:240px}.min-h-\[250px\]{min-height:250px}.min-h-\[260px\]{min-height:260px}.min-h-\[290px\]{min-height:290px}.min-h-\[300px\]{min-height:300px}.min-h-\[420px\]{min-height:420px}.min-h-\[520px\]{min-height:520px}.min-h-\[620px\]{min-height:620px}.w-0{width:calc(var(--spacing) * 0)}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-\[22px\]{width:22px}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-12{min-width:calc(var(--spacing) * 12)}.min-w-14{min-width:calc(var(--spacing) * 14)}.min-w-\[56px\]{min-width:56px}.min-w-\[560px\]{min-width:560px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-2{--tw-translate-y:calc(var(--spacing) * -2);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.rotate-\[-1deg\]{rotate:-1deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[shake_0\.3s_ease-in-out_2\]{animation:.3s ease-in-out 2 shake}.animate-path{animation:.4s ease-out forwards path}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.animate-visited{animation:.4s ease-out forwards visited}.animate-wall{animation:.2s ease-out forwards wall}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[1px\],.gap-px{gap:1px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\[1\.5rem\]{border-radius:1.5rem}.rounded-\[1\.15rem\]{border-radius:1.15rem}.rounded-\[1\.75rem\]{border-radius:1.75rem}.rounded-\[1px\]{border-radius:1px}.rounded-\[50\%\]{border-radius:50%}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r-2{border-right-style:var(--tw-border-style);border-right-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-b-4{border-bottom-style:var(--tw-border-style);border-bottom-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400{border-color:var(--color-amber-400)}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-950\/10{border-color:#4619011a}@supports (color:color-mix(in lab,red,red)){.border-amber-950\/10{border-color:color-mix(in oklab,var(--color-amber-950) 10%,transparent)}}.border-amber-950\/25{border-color:#46190140}@supports (color:color-mix(in lab,red,red)){.border-amber-950\/25{border-color:color-mix(in oklab,var(--color-amber-950) 25%,transparent)}}.border-black\/15{border-color:#00000026}@supports (color:color-mix(in lab,red,red)){.border-black\/15{border-color:color-mix(in oklab,var(--color-black) 15%,transparent)}}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-950\/30{border-color:#1624564d}@supports (color:color-mix(in lab,red,red)){.border-blue-950\/30{border-color:color-mix(in oklab,var(--color-blue-950) 30%,transparent)}}.border-emerald-300\/50{border-color:#5ee9b580}@supports (color:color-mix(in lab,red,red)){.border-emerald-300\/50{border-color:color-mix(in oklab,var(--color-emerald-300) 50%,transparent)}}.border-emerald-400{border-color:var(--color-emerald-400)}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-700\/30{border-color:#0079564d}@supports (color:color-mix(in lab,red,red)){.border-emerald-700\/30{border-color:color-mix(in oklab,var(--color-emerald-700) 30%,transparent)}}.border-emerald-900\/20{border-color:#004e3b33}@supports (color:color-mix(in lab,red,red)){.border-emerald-900\/20{border-color:color-mix(in oklab,var(--color-emerald-900) 20%,transparent)}}.border-emerald-900\/30{border-color:#004e3b4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-900\/30{border-color:color-mix(in oklab,var(--color-emerald-900) 30%,transparent)}}.border-emerald-900\/40{border-color:#004e3b66}@supports (color:color-mix(in lab,red,red)){.border-emerald-900\/40{border-color:color-mix(in oklab,var(--color-emerald-900) 40%,transparent)}}.border-emerald-950\/20{border-color:#002c2233}@supports (color:color-mix(in lab,red,red)){.border-emerald-950\/20{border-color:color-mix(in oklab,var(--color-emerald-950) 20%,transparent)}}.border-emerald-950\/40{border-color:#002c2266}@supports (color:color-mix(in lab,red,red)){.border-emerald-950\/40{border-color:color-mix(in oklab,var(--color-emerald-950) 40%,transparent)}}.border-emerald-950\/50{border-color:#002c2280}@supports (color:color-mix(in lab,red,red)){.border-emerald-950\/50{border-color:color-mix(in oklab,var(--color-emerald-950) 50%,transparent)}}.border-indigo-500\/20{border-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/20{border-color:color-mix(in oklab,var(--color-indigo-500) 20%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-orange-400{border-color:var(--color-orange-400)}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-rose-400{border-color:var(--color-rose-400)}.border-sky-500\/20{border-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.border-sky-500\/20{border-color:color-mix(in oklab,var(--color-sky-500) 20%,transparent)}}.border-slate-500{border-color:var(--color-slate-500)}.border-slate-500\/60{border-color:#62748e99}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/60{border-color:color-mix(in oklab,var(--color-slate-500) 60%,transparent)}}.border-slate-600{border-color:var(--color-slate-600)}.border-slate-700{border-color:var(--color-slate-700)}.border-slate-700\/40{border-color:#31415866}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/40{border-color:color-mix(in oklab,var(--color-slate-700) 40%,transparent)}}.border-slate-700\/50{border-color:#31415880}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/50{border-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.border-slate-700\/60{border-color:#31415899}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/60{border-color:color-mix(in oklab,var(--color-slate-700) 60%,transparent)}}.border-slate-800\/30{border-color:#1d293d4d}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/30{border-color:color-mix(in oklab,var(--color-slate-800) 30%,transparent)}}.border-slate-800\/40{border-color:#1d293d66}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/40{border-color:color-mix(in oklab,var(--color-slate-800) 40%,transparent)}}.border-slate-800\/50{border-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/50{border-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.border-slate-800\/60{border-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/60{border-color:color-mix(in oklab,var(--color-slate-800) 60%,transparent)}}.border-slate-800\/70{border-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/70{border-color:color-mix(in oklab,var(--color-slate-800) 70%,transparent)}}.border-slate-800\/80{border-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.border-slate-800\/80{border-color:color-mix(in oklab,var(--color-slate-800) 80%,transparent)}}.border-slate-950\/50{border-color:#02061880}@supports (color:color-mix(in lab,red,red)){.border-slate-950\/50{border-color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.border-slate-950\/70{border-color:#020618b3}@supports (color:color-mix(in lab,red,red)){.border-slate-950\/70{border-color:color-mix(in oklab,var(--color-slate-950) 70%,transparent)}}.border-violet-500\/30{border-color:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/30{border-color:color-mix(in oklab,var(--color-violet-500) 30%,transparent)}}.border-r-slate-500\/60{border-right-color:#62748e99}@supports (color:color-mix(in lab,red,red)){.border-r-slate-500\/60{border-right-color:color-mix(in oklab,var(--color-slate-500) 60%,transparent)}}.border-b-slate-500\/60{border-bottom-color:#62748e99}@supports (color:color-mix(in lab,red,red)){.border-b-slate-500\/60{border-bottom-color:color-mix(in oklab,var(--color-slate-500) 60%,transparent)}}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.18\)\,transparent_36\%\)\,rgba\(16\,185\,129\,0\.05\)\]{background-color:radial-gradient(circle at top left,#10b9812e,transparent 36%),#10b9810d}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(249\,115\,22\,0\.18\)\,transparent_38\%\)\,rgba\(15\,23\,42\,0\.8\)\]{background-color:radial-gradient(circle at top left,#f973162e,transparent 38%),#0f172acc}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-cyan-300{background-color:var(--color-cyan-300)}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-cyan-500\/40{background-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/40{background-color:color-mix(in oklab,var(--color-cyan-500) 40%,transparent)}}.bg-cyan-500\/60{background-color:#00b7d799}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/60{background-color:color-mix(in oklab,var(--color-cyan-500) 60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-400\/10{background-color:#00d2941a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-400\/10{background-color:color-mix(in oklab,var(--color-emerald-400) 10%,transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/25{background-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/25{background-color:color-mix(in oklab,var(--color-emerald-500) 25%,transparent)}}.bg-emerald-500\/70{background-color:#00bb7fb3}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/70{background-color:color-mix(in oklab,var(--color-emerald-500) 70%,transparent)}}.bg-emerald-900\/25{background-color:#004e3b40}@supports (color:color-mix(in lab,red,red)){.bg-emerald-900\/25{background-color:color-mix(in oklab,var(--color-emerald-900) 25%,transparent)}}.bg-emerald-950{background-color:var(--color-emerald-950)}.bg-emerald-950\/20{background-color:#002c2233}@supports (color:color-mix(in lab,red,red)){.bg-emerald-950\/20{background-color:color-mix(in oklab,var(--color-emerald-950) 20%,transparent)}}.bg-emerald-950\/25{background-color:#002c2240}@supports (color:color-mix(in lab,red,red)){.bg-emerald-950\/25{background-color:color-mix(in oklab,var(--color-emerald-950) 25%,transparent)}}.bg-green-500\/70{background-color:#00c758b3}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/70{background-color:color-mix(in oklab,var(--color-green-500) 70%,transparent)}}.bg-indigo-400{background-color:var(--color-indigo-400)}.bg-indigo-400\/40{background-color:#7d87ff66}@supports (color:color-mix(in lab,red,red)){.bg-indigo-400\/40{background-color:color-mix(in oklab,var(--color-indigo-400) 40%,transparent)}}.bg-indigo-400\/80{background-color:#7d87ffcc}@supports (color:color-mix(in lab,red,red)){.bg-indigo-400\/80{background-color:color-mix(in oklab,var(--color-indigo-400) 80%,transparent)}}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/20{background-color:color-mix(in oklab,var(--color-indigo-500) 20%,transparent)}}.bg-indigo-500\/25{background-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/25{background-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.bg-indigo-500\/70{background-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/70{background-color:color-mix(in oklab,var(--color-indigo-500) 70%,transparent)}}.bg-indigo-900{background-color:var(--color-indigo-900)}.bg-orange-400{background-color:var(--color-orange-400)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500) 10%,transparent)}}.bg-orange-500\/15{background-color:#fe6e0026}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/15{background-color:color-mix(in oklab,var(--color-orange-500) 15%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/70{background-color:#fb2c36b3}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/70{background-color:color-mix(in oklab,var(--color-red-500) 70%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-950\/70{background-color:#460809b3}@supports (color:color-mix(in lab,red,red)){.bg-red-950\/70{background-color:color-mix(in oklab,var(--color-red-950) 70%,transparent)}}.bg-rose-300{background-color:var(--color-rose-300)}.bg-rose-400{background-color:var(--color-rose-400)}.bg-rose-500{background-color:var(--color-rose-500)}.bg-rose-500\/10{background-color:#ff23571a}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/10{background-color:color-mix(in oklab,var(--color-rose-500) 10%,transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/15{background-color:color-mix(in oklab,var(--color-rose-500) 15%,transparent)}}.bg-rose-500\/20{background-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/20{background-color:color-mix(in oklab,var(--color-rose-500) 20%,transparent)}}.bg-rose-500\/25{background-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/25{background-color:color-mix(in oklab,var(--color-rose-500) 25%,transparent)}}.bg-rose-500\/40{background-color:#ff235766}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/40{background-color:color-mix(in oklab,var(--color-rose-500) 40%,transparent)}}.bg-rose-500\/60{background-color:#ff235799}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/60{background-color:color-mix(in oklab,var(--color-rose-500) 60%,transparent)}}.bg-sky-400{background-color:var(--color-sky-400)}.bg-sky-500\/10{background-color:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/10{background-color:color-mix(in oklab,var(--color-sky-500) 10%,transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/15{background-color:color-mix(in oklab,var(--color-sky-500) 15%,transparent)}}.bg-sky-500\/25{background-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/25{background-color:color-mix(in oklab,var(--color-sky-500) 25%,transparent)}}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-500{background-color:var(--color-slate-500)}.bg-slate-500\/10{background-color:#62748e1a}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/10{background-color:color-mix(in oklab,var(--color-slate-500) 10%,transparent)}}.bg-slate-600{background-color:var(--color-slate-600)}.bg-slate-700{background-color:var(--color-slate-700)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-800\/30{background-color:#1d293d4d}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/30{background-color:color-mix(in oklab,var(--color-slate-800) 30%,transparent)}}.bg-slate-800\/40{background-color:#1d293d66}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/40{background-color:color-mix(in oklab,var(--color-slate-800) 40%,transparent)}}.bg-slate-800\/50{background-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/50{background-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.bg-slate-800\/60{background-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/60{background-color:color-mix(in oklab,var(--color-slate-800) 60%,transparent)}}.bg-slate-800\/70{background-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/70{background-color:color-mix(in oklab,var(--color-slate-800) 70%,transparent)}}.bg-slate-800\/80{background-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/80{background-color:color-mix(in oklab,var(--color-slate-800) 80%,transparent)}}.bg-slate-900{background-color:var(--color-slate-900)}.bg-slate-900\/40{background-color:#0f172b66}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/40{background-color:color-mix(in oklab,var(--color-slate-900) 40%,transparent)}}.bg-slate-900\/50{background-color:#0f172b80}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/50{background-color:color-mix(in oklab,var(--color-slate-900) 50%,transparent)}}.bg-slate-900\/55{background-color:#0f172b8c}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/55{background-color:color-mix(in oklab,var(--color-slate-900) 55%,transparent)}}.bg-slate-900\/60{background-color:#0f172b99}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/60{background-color:color-mix(in oklab,var(--color-slate-900) 60%,transparent)}}.bg-slate-900\/70{background-color:#0f172bb3}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/70{background-color:color-mix(in oklab,var(--color-slate-900) 70%,transparent)}}.bg-slate-900\/80{background-color:#0f172bcc}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/80{background-color:color-mix(in oklab,var(--color-slate-900) 80%,transparent)}}.bg-slate-950\/25{background-color:#02061840}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/25{background-color:color-mix(in oklab,var(--color-slate-950) 25%,transparent)}}.bg-slate-950\/35{background-color:#02061859}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/35{background-color:color-mix(in oklab,var(--color-slate-950) 35%,transparent)}}.bg-slate-950\/40{background-color:#02061866}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/40{background-color:color-mix(in oklab,var(--color-slate-950) 40%,transparent)}}.bg-slate-950\/45{background-color:#02061873}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/45{background-color:color-mix(in oklab,var(--color-slate-950) 45%,transparent)}}.bg-slate-950\/50{background-color:#02061880}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/50{background-color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.bg-slate-950\/55{background-color:#0206188c}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/55{background-color:color-mix(in oklab,var(--color-slate-950) 55%,transparent)}}.bg-slate-950\/60{background-color:#02061899}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/60{background-color:color-mix(in oklab,var(--color-slate-950) 60%,transparent)}}.bg-slate-950\/70{background-color:#020618b3}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/70{background-color:color-mix(in oklab,var(--color-slate-950) 70%,transparent)}}.bg-slate-950\/75{background-color:#020618bf}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/75{background-color:color-mix(in oklab,var(--color-slate-950) 75%,transparent)}}.bg-slate-950\/80{background-color:#020618cc}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/80{background-color:color-mix(in oklab,var(--color-slate-950) 80%,transparent)}}.bg-slate-950\/85{background-color:#020618d9}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/85{background-color:color-mix(in oklab,var(--color-slate-950) 85%,transparent)}}.bg-slate-950\/90{background-color:#020618e6}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/90{background-color:color-mix(in oklab,var(--color-slate-950) 90%,transparent)}}.bg-slate-950\/95{background-color:#020618f2}@supports (color:color-mix(in lab,red,red)){.bg-slate-950\/95{background-color:color-mix(in oklab,var(--color-slate-950) 95%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-violet-500\/20{background-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/20{background-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/15{background-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.bg-white\/15{background-color:color-mix(in oklab,var(--color-white) 15%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-yellow-300{background-color:var(--color-yellow-300)}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/10{background-color:color-mix(in oklab,var(--color-yellow-500) 10%,transparent)}}.bg-yellow-500\/70{background-color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/70{background-color:color-mix(in oklab,var(--color-yellow-500) 70%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-\[linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.9\)\,rgba\(6\,78\,59\,0\.34\)\)\]{background-image:linear-gradient(135deg,#0f172ae6,#064e3b57)}.bg-\[linear-gradient\(rgba\(148\,163\,184\,0\.03\)_1px\,transparent_1px\)\]{background-image:linear-gradient(#94a3b808 1px,#0000 1px)}.bg-\[radial-gradient\(circle_at_1px_1px\,rgba\(148\,163\,184\,0\.12\)_1px\,transparent_0\)\]{background-image:radial-gradient(circle at 1px 1px,#94a3b81f 1px,#0000 0)}.bg-\[radial-gradient\(circle_at_18\%_22\%\,rgba\(14\,165\,233\,0\.16\)\,transparent_28\%\)\,radial-gradient\(circle_at_78\%_72\%\,rgba\(59\,130\,246\,0\.12\)\,transparent_30\%\)\]{background-image:radial-gradient(circle at 18% 22%,#0ea5e929,#0000 28%),radial-gradient(circle at 78% 72%,#3b82f61f,#0000 30%)}.bg-\[radial-gradient\(circle_at_20\%_10\%\,rgba\(56\,189\,248\,0\.14\)\,transparent_28\%\)\,radial-gradient\(circle_at_80\%_80\%\,rgba\(34\,197\,94\,0\.1\)\,transparent_30\%\)\]{background-image:radial-gradient(circle at 20% 10%,#38bdf824,#0000 28%),radial-gradient(circle at 80% 80%,#22c55e1a,#0000 30%)}.bg-\[radial-gradient\(circle_at_30\%_15\%\,rgba\(255\,255\,255\,0\.8\)\,transparent_38\%\)\,linear-gradient\(135deg\,rgba\(255\,255\,255\,0\.35\)\,transparent\)\]{background-image:radial-gradient(circle at 30% 15%,#fffc,#0000 38%),linear-gradient(135deg,#ffffff59,#0000)}.bg-\[radial-gradient\(circle_at_top\,rgba\(16\,185\,129\,0\.08\)\,transparent_34\%\)\,linear-gradient\(180deg\,rgba\(15\,23\,42\,0\)\,rgba\(6\,78\,59\,0\.16\)\)\]{background-image:radial-gradient(circle at top,#10b98114,#0000 34%),linear-gradient(#0f172a00,#064e3b29)}.bg-\[radial-gradient\(circle_at_top\,rgba\(16\,185\,129\,0\.12\)\,transparent_34\%\)\,linear-gradient\(180deg\,rgba\(15\,23\,42\,0\)\,rgba\(6\,78\,59\,0\.16\)\)\]{background-image:radial-gradient(circle at top,#10b9811f,#0000 34%),linear-gradient(#0f172a00,#064e3b29)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(14\,165\,233\,0\.16\)\,transparent_30\%\)\,radial-gradient\(circle_at_bottom_right\,rgba\(34\,197\,94\,0\.12\)\,transparent_28\%\)\]{background-image:radial-gradient(circle at 0 0,#0ea5e929,#0000 30%),radial-gradient(circle at 100% 100%,#22c55e1f,#0000 28%)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(14\,165\,233\,0\.16\)\,transparent_30\%\)\,radial-gradient\(circle_at_bottom_right\,rgba\(59\,130\,246\,0\.14\)\,transparent_28\%\)\]{background-image:radial-gradient(circle at 0 0,#0ea5e929,#0000 30%),radial-gradient(circle at 100% 100%,#3b82f624,#0000 28%)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.12\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.28\)\)\]{background-image:radial-gradient(circle at 0 0,#10b9811f,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b47)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.14\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.32\)\)\]{background-image:radial-gradient(circle at 0 0,#10b98124,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b52)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.14\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.36\)\)\]{background-image:radial-gradient(circle at 0 0,#10b98124,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b5c)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(16\,185\,129\,0\.18\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.42\)\)\]{background-image:radial-gradient(circle at 0 0,#10b9812e,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b6b)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(34\,197\,94\,0\.18\)\,transparent_34\%\)\,linear-gradient\(135deg\,rgba\(15\,23\,42\,0\.96\)\,rgba\(6\,78\,59\,0\.36\)\)\]{background-image:radial-gradient(circle at 0 0,#22c55e2e,#0000 34%),linear-gradient(135deg,#0f172af5,#064e3b5c)}.bg-\[radial-gradient\(circle_at_top_left\,rgba\(249\,115\,22\,0\.12\)\,transparent_28\%\)\,radial-gradient\(circle_at_bottom_right\,rgba\(99\,102\,241\,0\.12\)\,transparent_30\%\)\]{background-image:radial-gradient(circle at 0 0,#f973161f,#0000 28%),radial-gradient(circle at 100% 100%,#6366f11f,#0000 30%)}.bg-\[radial-gradient\(ellipse_at_center\,_var\(--tw-gradient-stops\)\)\]{background-image:radial-gradient(ellipse at center,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from:var(--color-amber-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-black\/25{--tw-gradient-from:#00000040}@supports (color:color-mix(in lab,red,red)){.from-black\/25{--tw-gradient-from:color-mix(in oklab, var(--color-black) 25%, transparent)}}.from-black\/25{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-500{--tw-gradient-from:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-400{--tw-gradient-from:var(--color-cyan-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-300{--tw-gradient-from:var(--color-emerald-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-400{--tw-gradient-from:var(--color-emerald-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500{--tw-gradient-from:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500\/80{--tw-gradient-from:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.from-emerald-500\/80{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-500) 80%, transparent)}}.from-emerald-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-950\/50{--tw-gradient-from:#002c2280}@supports (color:color-mix(in lab,red,red)){.from-emerald-950\/50{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-950) 50%, transparent)}}.from-emerald-950\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-fuchsia-500{--tw-gradient-from:var(--color-fuchsia-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-400{--tw-gradient-from:var(--color-indigo-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500\/20{--tw-gradient-from:#625fff33}@supports (color:color-mix(in lab,red,red)){.from-indigo-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.from-indigo-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-900\/20{--tw-gradient-from:#312c8533}@supports (color:color-mix(in lab,red,red)){.from-indigo-900\/20{--tw-gradient-from:color-mix(in oklab, var(--color-indigo-900) 20%, transparent)}}.from-indigo-900\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-lime-500{--tw-gradient-from:var(--color-lime-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-500{--tw-gradient-from:var(--color-orange-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-500{--tw-gradient-from:var(--color-red-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-500\/20{--tw-gradient-from:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.from-red-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.from-red-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-400{--tw-gradient-from:var(--color-rose-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500{--tw-gradient-from:var(--color-rose-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500\/20{--tw-gradient-from:#ff235733}@supports (color:color-mix(in lab,red,red)){.from-rose-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.from-rose-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500\/80{--tw-gradient-from:#ff2357cc}@supports (color:color-mix(in lab,red,red)){.from-rose-500\/80{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 80%, transparent)}}.from-rose-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-sky-500{--tw-gradient-from:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-500{--tw-gradient-from:var(--color-slate-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-stone-50{--tw-gradient-from:var(--color-stone-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500{--tw-gradient-from:var(--color-violet-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-amber-50{--tw-gradient-via:var(--color-amber-50);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-violet-400{--tw-gradient-via:var(--color-violet-400);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-amber-400{--tw-gradient-to:var(--color-amber-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-500{--tw-gradient-to:var(--color-amber-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-400{--tw-gradient-to:var(--color-blue-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-300{--tw-gradient-to:var(--color-cyan-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-400{--tw-gradient-to:var(--color-cyan-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500{--tw-gradient-to:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500\/20{--tw-gradient-to:#00b7d733}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.to-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-700{--tw-gradient-to:var(--color-emerald-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-fuchsia-400{--tw-gradient-to:var(--color-fuchsia-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-fuchsia-500{--tw-gradient-to:var(--color-fuchsia-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-green-500{--tw-gradient-to:var(--color-green-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-green-500\/80{--tw-gradient-to:#00c758cc}@supports (color:color-mix(in lab,red,red)){.to-green-500\/80{--tw-gradient-to:color-mix(in oklab, var(--color-green-500) 80%, transparent)}}.to-green-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-500{--tw-gradient-to:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-400{--tw-gradient-to:var(--color-orange-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-500{--tw-gradient-to:var(--color-orange-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-400{--tw-gradient-to:var(--color-pink-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500\/80{--tw-gradient-to:#f6339acc}@supports (color:color-mix(in lab,red,red)){.to-pink-500\/80{--tw-gradient-to:color-mix(in oklab, var(--color-pink-500) 80%, transparent)}}.to-pink-500\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500{--tw-gradient-to:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-500{--tw-gradient-to:var(--color-red-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-rose-500\/20{--tw-gradient-to:#ff235733}@supports (color:color-mix(in lab,red,red)){.to-rose-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.to-rose-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-stone-200{--tw-gradient-to:var(--color-stone-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-400{--tw-gradient-to:var(--color-teal-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-500{--tw-gradient-to:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-400{--tw-gradient-to:var(--color-violet-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-500{--tw-gradient-to:var(--color-violet-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-500\/20{--tw-gradient-to:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.to-violet-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.to-violet-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-zinc-500{--tw-gradient-to:var(--color-zinc-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-\[length\:24px_24px\]{background-size:24px 24px}.bg-\[length\:100\%_22px\]{background-size:100% 22px}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-12{padding-top:calc(var(--spacing) * 12)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pb-0{padding-bottom:calc(var(--spacing) * 0)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pb-10{padding-bottom:calc(var(--spacing) * 10)}.pb-12{padding-bottom:calc(var(--spacing) * 12)}.pb-16{padding-bottom:calc(var(--spacing) * 16)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.24em\]{--tw-tracking:.24em;letter-spacing:.24em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-200{color:var(--color-amber-200)}.text-amber-300{color:var(--color-amber-300)}.text-amber-300\/60{color:#ffd23699}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/60{color:color-mix(in oklab,var(--color-amber-300) 60%,transparent)}}.text-amber-300\/70{color:#ffd236b3}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/70{color:color-mix(in oklab,var(--color-amber-300) 70%,transparent)}}.text-amber-300\/80{color:#ffd236cc}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/80{color:color-mix(in oklab,var(--color-amber-300) 80%,transparent)}}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-50\/80{color:#ecfdf5cc}@supports (color:color-mix(in lab,red,red)){.text-emerald-50\/80{color:color-mix(in oklab,var(--color-emerald-50) 80%,transparent)}}.text-emerald-100{color:var(--color-emerald-100)}.text-emerald-100\/45{color:#d0fae573}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/45{color:color-mix(in oklab,var(--color-emerald-100) 45%,transparent)}}.text-emerald-100\/50{color:#d0fae580}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/50{color:color-mix(in oklab,var(--color-emerald-100) 50%,transparent)}}.text-emerald-100\/65{color:#d0fae5a6}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/65{color:color-mix(in oklab,var(--color-emerald-100) 65%,transparent)}}.text-emerald-100\/70{color:#d0fae5b3}@supports (color:color-mix(in lab,red,red)){.text-emerald-100\/70{color:color-mix(in oklab,var(--color-emerald-100) 70%,transparent)}}.text-emerald-200{color:var(--color-emerald-200)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/60{color:#00d29499}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/60{color:color-mix(in oklab,var(--color-emerald-400) 60%,transparent)}}.text-emerald-500{color:var(--color-emerald-500)}.text-indigo-100{color:var(--color-indigo-100)}.text-indigo-200{color:var(--color-indigo-200)}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-orange-300{color:var(--color-orange-300)}.text-orange-400{color:var(--color-orange-400)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-rose-200{color:var(--color-rose-200)}.text-rose-300{color:var(--color-rose-300)}.text-rose-400{color:var(--color-rose-400)}.text-sky-200{color:var(--color-sky-200)}.text-sky-300{color:var(--color-sky-300)}.text-sky-400{color:var(--color-sky-400)}.text-slate-100{color:var(--color-slate-100)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-900\/35{color:#0f172b59}@supports (color:color-mix(in lab,red,red)){.text-slate-900\/35{color:color-mix(in oklab,var(--color-slate-900) 35%,transparent)}}.text-slate-950\/50{color:#02061880}@supports (color:color-mix(in lab,red,red)){.text-slate-950\/50{color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.text-transparent{color:#0000}.text-violet-300{color:var(--color-violet-300)}.text-violet-400{color:var(--color-violet-400)}.text-white{color:var(--color-white)}.text-yellow-300{color:var(--color-yellow-300)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.placeholder-slate-500::placeholder{color:var(--color-slate-500)}.placeholder-slate-600::placeholder{color:var(--color-slate-600)}.caret-emerald-400{caret-color:var(--color-emerald-400)}.accent-indigo-400{accent-color:var(--color-indigo-400)}.accent-indigo-500{accent-color:var(--color-indigo-500)}.accent-rose-400{accent-color:var(--color-rose-400)}.accent-rose-500{accent-color:var(--color-rose-500)}.accent-sky-500{accent-color:var(--color-sky-500)}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-30{opacity:.3}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-45{opacity:.45}.opacity-60{opacity:.6}.opacity-65{opacity:.65}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_26px_rgba\(52\,211\,153\,0\.45\)\]{--tw-shadow:0 0 26px var(--tw-shadow-color,#34d39973);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_10px_18px_rgba\(0\,0\,0\,0\.35\)\,inset_0_-3px_0_rgba\(0\,0\,0\,0\.18\)\]{--tw-shadow:0 10px 18px var(--tw-shadow-color,#00000059), inset 0 -3px 0 var(--tw-shadow-color,#0000002e);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-400\/20{--tw-shadow-color:#fcbb0033}@supports (color:color-mix(in lab,red,red)){.shadow-amber-400\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-400) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-400\/30{--tw-shadow-color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.shadow-amber-400\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-400) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-500\/20{--tw-shadow-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/30{--tw-shadow-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/35{--tw-shadow-color:#00000059}@supports (color:color-mix(in lab,red,red)){.shadow-black\/35{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 35%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/40{--tw-shadow-color:#0006}@supports (color:color-mix(in lab,red,red)){.shadow-black\/40{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 40%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-blue-500\/20{--tw-shadow-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.shadow-blue-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-blue-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-cyan-500\/20{--tw-shadow-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.shadow-cyan-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-cyan-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/15{--tw-shadow-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/20{--tw-shadow-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/30{--tw-shadow-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-950\/20{--tw-shadow-color:#002c2233}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-950\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-950) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-fuchsia-500\/20{--tw-shadow-color:#e12afb33}@supports (color:color-mix(in lab,red,red)){.shadow-fuchsia-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-fuchsia-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-indigo-500\/10{--tw-shadow-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.shadow-indigo-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-indigo-500\/20{--tw-shadow-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.shadow-indigo-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-indigo-500\/25{--tw-shadow-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.shadow-indigo-500\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-lime-500\/20{--tw-shadow-color:#80cd0033}@supports (color:color-mix(in lab,red,red)){.shadow-lime-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-lime-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-orange-500\/20{--tw-shadow-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.shadow-orange-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-orange-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-purple-500\/20{--tw-shadow-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.shadow-purple-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-purple-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/20{--tw-shadow-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-950\/20{--tw-shadow-color:#46080933}@supports (color:color-mix(in lab,red,red)){.shadow-red-950\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-950) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/15{--tw-shadow-color:#ff235726}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/20{--tw-shadow-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/25{--tw-shadow-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-rose-500\/30{--tw-shadow-color:#ff23574d}@supports (color:color-mix(in lab,red,red)){.shadow-rose-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-rose-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-sky-500\/20{--tw-shadow-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.shadow-sky-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-sky-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-sky-950\/40{--tw-shadow-color:#052f4a66}@supports (color:color-mix(in lab,red,red)){.shadow-sky-950\/40{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-sky-950) 40%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-slate-500\/20{--tw-shadow-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.shadow-slate-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-slate-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-teal-500\/20{--tw-shadow-color:#00baa733}@supports (color:color-mix(in lab,red,red)){.shadow-teal-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-teal-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-violet-500\/20{--tw-shadow-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.shadow-violet-500\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-violet-500) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-amber-300\/50{--tw-ring-color:#ffd23680}@supports (color:color-mix(in lab,red,red)){.ring-amber-300\/50{--tw-ring-color:color-mix(in oklab, var(--color-amber-300) 50%, transparent)}}.ring-amber-500\/20{--tw-ring-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.ring-amber-500\/25{--tw-ring-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 25%, transparent)}}.ring-amber-500\/30{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.ring-amber-500\/40{--tw-ring-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 40%, transparent)}}.ring-blue-500\/30{--tw-ring-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.ring-blue-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.ring-cyan-300\/40{--tw-ring-color:#53eafd66}@supports (color:color-mix(in lab,red,red)){.ring-cyan-300\/40{--tw-ring-color:color-mix(in oklab, var(--color-cyan-300) 40%, transparent)}}.ring-cyan-500\/20{--tw-ring-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.ring-cyan-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.ring-cyan-500\/30{--tw-ring-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.ring-cyan-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.ring-cyan-500\/40{--tw-ring-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.ring-cyan-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 40%, transparent)}}.ring-emerald-200{--tw-ring-color:var(--color-emerald-200)}.ring-emerald-400\/50{--tw-ring-color:#00d29480}@supports (color:color-mix(in lab,red,red)){.ring-emerald-400\/50{--tw-ring-color:color-mix(in oklab, var(--color-emerald-400) 50%, transparent)}}.ring-emerald-500{--tw-ring-color:var(--color-emerald-500)}.ring-emerald-500\/20{--tw-ring-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.ring-emerald-500\/25{--tw-ring-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 25%, transparent)}}.ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.ring-emerald-500\/40{--tw-ring-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 40%, transparent)}}.ring-emerald-500\/50{--tw-ring-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 50%, transparent)}}.ring-indigo-300{--tw-ring-color:var(--color-indigo-300)}.ring-indigo-400{--tw-ring-color:var(--color-indigo-400)}.ring-indigo-400\/40{--tw-ring-color:#7d87ff66}@supports (color:color-mix(in lab,red,red)){.ring-indigo-400\/40{--tw-ring-color:color-mix(in oklab, var(--color-indigo-400) 40%, transparent)}}.ring-indigo-400\/60{--tw-ring-color:#7d87ff99}@supports (color:color-mix(in lab,red,red)){.ring-indigo-400\/60{--tw-ring-color:color-mix(in oklab, var(--color-indigo-400) 60%, transparent)}}.ring-indigo-500{--tw-ring-color:var(--color-indigo-500)}.ring-indigo-500\/15{--tw-ring-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/15{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.ring-indigo-500\/20{--tw-ring-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.ring-indigo-500\/25{--tw-ring-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 25%, transparent)}}.ring-indigo-500\/30{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.ring-indigo-500\/35{--tw-ring-color:#625fff59}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/35{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 35%, transparent)}}.ring-indigo-500\/40{--tw-ring-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 40%, transparent)}}.ring-indigo-500\/50{--tw-ring-color:#625fff80}@supports (color:color-mix(in lab,red,red)){.ring-indigo-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 50%, transparent)}}.ring-orange-200{--tw-ring-color:var(--color-orange-200)}.ring-orange-500\/25{--tw-ring-color:#fe6e0040}@supports (color:color-mix(in lab,red,red)){.ring-orange-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-orange-500) 25%, transparent)}}.ring-orange-500\/30{--tw-ring-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.ring-orange-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-orange-500) 30%, transparent)}}.ring-red-500\/30{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.ring-red-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.ring-red-500\/60{--tw-ring-color:#fb2c3699}@supports (color:color-mix(in lab,red,red)){.ring-red-500\/60{--tw-ring-color:color-mix(in oklab, var(--color-red-500) 60%, transparent)}}.ring-rose-400\/40{--tw-ring-color:#ff667f66}@supports (color:color-mix(in lab,red,red)){.ring-rose-400\/40{--tw-ring-color:color-mix(in oklab, var(--color-rose-400) 40%, transparent)}}.ring-rose-500\/20{--tw-ring-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.ring-rose-500\/25{--tw-ring-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 25%, transparent)}}.ring-rose-500\/30{--tw-ring-color:#ff23574d}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.ring-rose-500\/40{--tw-ring-color:#ff235766}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 40%, transparent)}}.ring-rose-500\/50{--tw-ring-color:#ff235780}@supports (color:color-mix(in lab,red,red)){.ring-rose-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 50%, transparent)}}.ring-sky-200{--tw-ring-color:var(--color-sky-200)}.ring-sky-500\/20{--tw-ring-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 20%, transparent)}}.ring-sky-500\/25{--tw-ring-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 25%, transparent)}}.ring-sky-500\/30{--tw-ring-color:#00a5ef4d}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 30%, transparent)}}.ring-sky-500\/40{--tw-ring-color:#00a5ef66}@supports (color:color-mix(in lab,red,red)){.ring-sky-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 40%, transparent)}}.ring-slate-500{--tw-ring-color:var(--color-slate-500)}.ring-slate-600{--tw-ring-color:var(--color-slate-600)}.ring-slate-700{--tw-ring-color:var(--color-slate-700)}.ring-slate-700\/30{--tw-ring-color:#3141584d}@supports (color:color-mix(in lab,red,red)){.ring-slate-700\/30{--tw-ring-color:color-mix(in oklab, var(--color-slate-700) 30%, transparent)}}.ring-slate-700\/40{--tw-ring-color:#31415866}@supports (color:color-mix(in lab,red,red)){.ring-slate-700\/40{--tw-ring-color:color-mix(in oklab, var(--color-slate-700) 40%, transparent)}}.ring-slate-700\/50{--tw-ring-color:#31415880}@supports (color:color-mix(in lab,red,red)){.ring-slate-700\/50{--tw-ring-color:color-mix(in oklab, var(--color-slate-700) 50%, transparent)}}.ring-slate-800{--tw-ring-color:var(--color-slate-800)}.ring-slate-800\/50{--tw-ring-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/50{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 50%, transparent)}}.ring-slate-800\/60{--tw-ring-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/60{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 60%, transparent)}}.ring-slate-800\/70{--tw-ring-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/70{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 70%, transparent)}}.ring-slate-800\/80{--tw-ring-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.ring-slate-800\/80{--tw-ring-color:color-mix(in oklab, var(--color-slate-800) 80%, transparent)}}.ring-violet-400\/40{--tw-ring-color:#a685ff66}@supports (color:color-mix(in lab,red,red)){.ring-violet-400\/40{--tw-ring-color:color-mix(in oklab, var(--color-violet-400) 40%, transparent)}}.ring-violet-500\/20{--tw-ring-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.ring-violet-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.ring-violet-500\/30{--tw-ring-color:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.ring-violet-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.ring-violet-500\/40{--tw-ring-color:#8d54ff66}@supports (color:color-mix(in lab,red,red)){.ring-violet-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.ring-white\/10{--tw-ring-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.ring-white\/30{--tw-ring-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.ring-white\/30{--tw-ring-color:color-mix(in oklab, var(--color-white) 30%, transparent)}}.ring-yellow-500\/25{--tw-ring-color:#edb20040}@supports (color:color-mix(in lab,red,red)){.ring-yellow-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-yellow-500) 25%, transparent)}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-xl{--tw-blur:blur(var(--blur-xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-sm{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-sm));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\[animation-delay\:120ms\]{animation-delay:.12s}.\[animation-delay\:240ms\]{animation-delay:.24s}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\:-translate-y-1:hover{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:-translate-y-2:hover{--tw-translate-y:calc(var(--spacing) * -2);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.01\]:hover{scale:1.01}.hover\:scale-\[1\.02\]:hover{scale:1.02}.hover\:rotate-1:hover{rotate:1deg}.hover\:border-slate-600\/60:hover{border-color:#45556c99}@supports (color:color-mix(in lab,red,red)){.hover\:border-slate-600\/60:hover{border-color:color-mix(in oklab,var(--color-slate-600) 60%,transparent)}}.hover\:bg-amber-500\/25:hover{background-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/25:hover{background-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.hover\:bg-blue-500\/30:hover{background-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/30:hover{background-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.hover\:bg-cyan-500\/30:hover{background-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-cyan-500\/30:hover{background-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.hover\:bg-emerald-500\/25:hover{background-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/25:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 25%,transparent)}}.hover\:bg-indigo-500\/10:hover{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/10:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-indigo-500\/25:hover{background-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/25:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.hover\:bg-indigo-500\/30:hover{background-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/30:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.hover\:bg-red-500\/25:hover{background-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/25:hover{background-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.hover\:bg-rose-500\/25:hover{background-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.hover\:bg-rose-500\/25:hover{background-color:color-mix(in oklab,var(--color-rose-500) 25%,transparent)}}.hover\:bg-rose-500\/30:hover{background-color:#ff23574d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-rose-500\/30:hover{background-color:color-mix(in oklab,var(--color-rose-500) 30%,transparent)}}.hover\:bg-sky-500\/25:hover{background-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.hover\:bg-sky-500\/25:hover{background-color:color-mix(in oklab,var(--color-sky-500) 25%,transparent)}}.hover\:bg-slate-700\/50:hover{background-color:#31415880}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/50:hover{background-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.hover\:bg-slate-700\/60:hover{background-color:#31415899}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/60:hover{background-color:color-mix(in oklab,var(--color-slate-700) 60%,transparent)}}.hover\:bg-slate-700\/70:hover{background-color:#314158b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/70:hover{background-color:color-mix(in oklab,var(--color-slate-700) 70%,transparent)}}.hover\:bg-slate-700\/80:hover{background-color:#314158cc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-700\/80:hover{background-color:color-mix(in oklab,var(--color-slate-700) 80%,transparent)}}.hover\:bg-slate-800\/30:hover{background-color:#1d293d4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/30:hover{background-color:color-mix(in oklab,var(--color-slate-800) 30%,transparent)}}.hover\:bg-slate-800\/40:hover{background-color:#1d293d66}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/40:hover{background-color:color-mix(in oklab,var(--color-slate-800) 40%,transparent)}}.hover\:bg-slate-800\/50:hover{background-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/50:hover{background-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.hover\:bg-slate-800\/60:hover{background-color:#1d293d99}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/60:hover{background-color:color-mix(in oklab,var(--color-slate-800) 60%,transparent)}}.hover\:bg-slate-800\/70:hover{background-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/70:hover{background-color:color-mix(in oklab,var(--color-slate-800) 70%,transparent)}}.hover\:bg-slate-800\/80:hover{background-color:#1d293dcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-800\/80:hover{background-color:color-mix(in oklab,var(--color-slate-800) 80%,transparent)}}.hover\:bg-slate-900\/70:hover{background-color:#0f172bb3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-900\/70:hover{background-color:color-mix(in oklab,var(--color-slate-900) 70%,transparent)}}.hover\:bg-slate-900\/80:hover{background-color:#0f172bcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-900\/80:hover{background-color:color-mix(in oklab,var(--color-slate-900) 80%,transparent)}}.hover\:bg-violet-500\/30:hover{background-color:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-violet-500\/30:hover{background-color:color-mix(in oklab,var(--color-violet-500) 30%,transparent)}}.hover\:from-indigo-500\/30:hover{--tw-gradient-from:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:from-indigo-500\/30:hover{--tw-gradient-from:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.hover\:from-indigo-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-rose-500\/30:hover{--tw-gradient-from:#ff23574d}@supports (color:color-mix(in lab,red,red)){.hover\:from-rose-500\/30:hover{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.hover\:from-rose-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-cyan-500\/30:hover{--tw-gradient-to:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.hover\:to-cyan-500\/30:hover{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.hover\:to-cyan-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-violet-500\/30:hover{--tw-gradient-to:#8d54ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:to-violet-500\/30:hover{--tw-gradient-to:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.hover\:to-violet-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:text-indigo-300:hover{color:var(--color-indigo-300)}.hover\:text-rose-400:hover{color:var(--color-rose-400)}.hover\:text-slate-300:hover{color:var(--color-slate-300)}.hover\:text-slate-400:hover{color:var(--color-slate-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_18px_28px_rgba\(0\,0\,0\,0\.45\)\]:hover{--tw-shadow:0 18px 28px var(--tw-shadow-color,#00000073);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:ring-1:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-indigo-500\/10:hover{--tw-shadow-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-indigo-500\/10:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-indigo-500\/30:hover{--tw-shadow-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-indigo-500\/30:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-indigo-500\/40:hover{--tw-shadow-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-indigo-500\/40:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-indigo-500) 40%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:ring-indigo-400\/50:hover{--tw-ring-color:#7d87ff80}@supports (color:color-mix(in lab,red,red)){.hover\:ring-indigo-400\/50:hover{--tw-ring-color:color-mix(in oklab, var(--color-indigo-400) 50%, transparent)}}.hover\:ring-indigo-500\/20:hover{--tw-ring-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.hover\:ring-indigo-500\/20:hover{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.hover\:ring-indigo-500\/30:hover{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:ring-indigo-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.hover\:ring-white\/20:hover{--tw-ring-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:ring-white\/20:hover{--tw-ring-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-cyan-500\/50:focus{--tw-ring-color:#00b7d780}@supports (color:color-mix(in lab,red,red)){.focus\:ring-cyan-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 50%, transparent)}}.focus\:ring-indigo-500\/50:focus{--tw-ring-color:#625fff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 50%, transparent)}}.focus\:ring-rose-500\/50:focus{--tw-ring-color:#ff235780}@supports (color:color-mix(in lab,red,red)){.focus\:ring-rose-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 50%, transparent)}}.active\:translate-y-0:active{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:scale-\[0\.99\]:active{scale:.99}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\:block{display:block}.sm\:hidden{display:none}.sm\:h-9{height:calc(var(--spacing) * 9)}.sm\:h-14{height:calc(var(--spacing) * 14)}.sm\:h-16{height:calc(var(--spacing) * 16)}.sm\:h-28{height:calc(var(--spacing) * 28)}.sm\:h-44{height:calc(var(--spacing) * 44)}.sm\:h-\[4\.6rem\]{height:4.6rem}.sm\:w-9{width:calc(var(--spacing) * 9)}.sm\:w-10{width:calc(var(--spacing) * 10)}.sm\:w-12{width:calc(var(--spacing) * 12)}.sm\:w-14{width:calc(var(--spacing) * 14)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:gap-3{gap:calc(var(--spacing) * 3)}.sm\:p-4{padding:calc(var(--spacing) * 4)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.sm\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}}@media(min-width:48rem){.md\:order-first{order:-9999}.md\:mb-4{margin-bottom:calc(var(--spacing) * 4)}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-14{height:calc(var(--spacing) * 14)}.md\:h-20{height:calc(var(--spacing) * 20)}.md\:h-52{height:calc(var(--spacing) * 52)}.md\:h-\[4\.35rem\]{height:4.35rem}.md\:max-h-full{max-height:100%}.md\:max-h-none{max-height:none}.md\:min-h-0{min-height:calc(var(--spacing) * 0)}.md\:min-h-\[400px\]{min-height:400px}.md\:w-14{width:calc(var(--spacing) * 14)}.md\:w-16{width:calc(var(--spacing) * 16)}.md\:w-72{width:calc(var(--spacing) * 72)}.md\:w-80{width:calc(var(--spacing) * 80)}.md\:max-w-sm{max-width:var(--container-sm)}.md\:flex-1{flex:1}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-start{align-items:flex-start}.md\:justify-between{justify-content:space-between}.md\:gap-1\.5{gap:calc(var(--spacing) * 1.5)}.md\:gap-2{gap:calc(var(--spacing) * 2)}.md\:gap-2\.5{gap:calc(var(--spacing) * 2.5)}.md\:gap-3{gap:calc(var(--spacing) * 3)}.md\:gap-6{gap:calc(var(--spacing) * 6)}:where(.md\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.md\:space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.md\:space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}.md\:overflow-auto{overflow:auto}.md\:overflow-y-auto{overflow-y:auto}.md\:p-5{padding:calc(var(--spacing) * 5)}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-6{padding-inline:calc(var(--spacing) * 6)}.md\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.md\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.md\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.md\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:w-64{width:calc(var(--spacing) * 64)}.lg\:shrink-0{flex-shrink:0}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media(min-width:80rem){.xl\:order-first{order:-9999}.xl\:min-h-0{min-height:calc(var(--spacing) * 0)}.xl\:w-80{width:calc(var(--spacing) * 80)}.xl\:w-88{width:calc(var(--spacing) * 88)}.xl\:w-\[410px\]{width:410px}.xl\:shrink-0{flex-shrink:0}.xl\:flex-row{flex-direction:row}.xl\:gap-4{gap:calc(var(--spacing) * 4)}}@media(min-width:96rem){.\32xl\:w-\[460px\]{width:460px}}}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:linear-gradient(135deg,#0f172a,#1e1b4b,#0f172a);min-height:100vh;margin:0}@keyframes visited{0%{opacity:0;border-radius:50%;transform:scale(.3)}50%{opacity:.8;border-radius:30%;transform:scale(1.1)}to{opacity:1;border-radius:0;transform:scale(1)}}@keyframes path{0%{opacity:0;transform:scale(.5)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}@keyframes wall{0%{transform:scale(.6)}50%{transform:scale(1.1)}to{transform:scale(1)}}@keyframes shake{0%,to{transform:translate(0)}25%{transform:translate(-6px)}50%{transform:translate(6px)}75%{transform:translate(-4px)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/docs/assets/index-Cj8HB9AY.js b/docs/assets/index-DrhCNtmA.js similarity index 73% rename from docs/assets/index-Cj8HB9AY.js rename to docs/assets/index-DrhCNtmA.js index e5f3a0e..be17e5e 100644 --- a/docs/assets/index-Cj8HB9AY.js +++ b/docs/assets/index-DrhCNtmA.js @@ -1 +1 @@ -const b={EMPTY:"empty",WALL:"wall",START:"start",END:"end",VISITED:"visited",PATH:"path",EXPLORING:"exploring"},A={slow:50,medium:20,fast:5,instant:0},D={bfs:{name:"Breadth-First Search",description:"Explores all neighbors at the current depth before moving deeper. Guarantees the shortest path in unweighted graphs.",weighted:!1,guaranteesShortestPath:!0},dfs:{name:"Depth-First Search",description:"Explores as far as possible along each branch before backtracking. Does not guarantee the shortest path.",weighted:!1,guaranteesShortestPath:!1},dijkstra:{name:"Dijkstra's Algorithm",description:"Finds the shortest path using a priority queue. Guarantees the shortest path in weighted graphs.",weighted:!0,guaranteesShortestPath:!0},astar:{name:"A* Search",description:"Uses heuristics to guide the search toward the goal. Guarantees the shortest path with an admissible heuristic.",weighted:!0,guaranteesShortestPath:!0}};function l(a,t){const s=[],{row:n,col:r}=t,c=[{row:-1,col:0},{row:1,col:0},{row:0,col:-1},{row:0,col:1}];for(const h of c){const o=n+h.row,e=r+h.col;o>=0&&o=0&&et.map(s=>({...s,parent:null,isVisited:!1,distance:1/0,heuristic:0,totalCost:1/0})))}function m(a,t,s){const n=f(a),r=[],c=n[t.row][t.col],h=n[s.row][s.col],o=[c];for(c.isVisited=!0,c.distance=0;o.length>0;){const e=o.shift();if(r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u)i.isVisited=!0,i.parent=e,i.distance=e.distance+1,o.push(i)}return{visitedNodesInOrder:r,shortestPath:[]}}function N(a,t,s){const n=f(a),r=[],c=n[t.row][t.col],h=n[s.row][s.col],o=[c];for(c.isVisited=!0,c.distance=0;o.length>0;){const e=o.pop();if(r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u)i.isVisited=!0,i.parent=e,i.distance=e.distance+1,o.push(i)}return{visitedNodesInOrder:r,shortestPath:[]}}class g{compare;data=[];constructor(t){this.compare=t}get size(){return this.data.length}peek(){return this.data[0]}push(t){this.data.push(t),this.siftUp(this.data.length-1)}pop(){const{data:t}=this;if(t.length===0)return;const s=t[0],n=t.pop();return t.length>0&&(t[0]=n,this.siftDown(0)),s}siftUp(t){const{data:s,compare:n}=this;for(;t>0;){const r=t-1>>1;if(n(s[t],s[r])<0)[s[t],s[r]]=[s[r],s[t]],t=r;else return}}siftDown(t){const{data:s,compare:n}=this,r=s.length;for(;;){const c=t*2+1,h=c+1;let o=t;if(ce.distance-u.distance);for(o.push(c);o.size>0;){const e=o.pop();if(e.isVisited)continue;if(e.distance===1/0)break;if(e.isVisited=!0,r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u){const d=e.distance+1;de.totalCost-u.totalCost);for(o.push(c);o.size>0;){const e=o.pop();if(e.isVisited)continue;if(e.isVisited=!0,r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u){const d=e.distance+1;d=0&&o=0&&et.map(s=>({...s,parent:null,isVisited:!1,distance:1/0,heuristic:0,totalCost:1/0})))}function m(a,t,s){const n=f(a),r=[],c=n[t.row][t.col],h=n[s.row][s.col],o=[c];for(c.isVisited=!0,c.distance=0;o.length>0;){const e=o.shift();if(r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u)i.isVisited=!0,i.parent=e,i.distance=e.distance+1,o.push(i)}return{visitedNodesInOrder:r,shortestPath:[]}}function N(a,t,s){const n=f(a),r=[],c=n[t.row][t.col],h=n[s.row][s.col],o=[c];for(c.isVisited=!0,c.distance=0;o.length>0;){const e=o.pop();if(r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u)i.isVisited=!0,i.parent=e,i.distance=e.distance+1,o.push(i)}return{visitedNodesInOrder:r,shortestPath:[]}}class g{compare;data=[];constructor(t){this.compare=t}get size(){return this.data.length}peek(){return this.data[0]}push(t){this.data.push(t),this.siftUp(this.data.length-1)}pop(){const{data:t}=this;if(t.length===0)return;const s=t[0],n=t.pop();return t.length>0&&(t[0]=n,this.siftDown(0)),s}siftUp(t){const{data:s,compare:n}=this;for(;t>0;){const r=t-1>>1;if(n(s[t],s[r])<0)[s[t],s[r]]=[s[r],s[t]],t=r;else return}}siftDown(t){const{data:s,compare:n}=this,r=s.length;for(;;){const c=t*2+1,h=c+1;let o=t;if(ce.distance-u.distance);for(o.push(c);o.size>0;){const e=o.pop();if(e.isVisited)continue;if(e.isVisited=!0,r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u){const d=e.distance+1;de.totalCost-u.totalCost);for(o.push(c);o.size>0;){const e=o.pop();if(e.isVisited)continue;if(e.isVisited=!0,r.push(e),e.row===h.row&&e.col===h.col)return{visitedNodesInOrder:r,shortestPath:p(e)};const u=l(n,e);for(const i of u){const d=e.distance+1;dk(),[]),c=a.useCallback((t,r,o,s=.06)=>{if(!i.current)return;const e=u();if(!e)return;const n=e.createOscillator(),l=e.createGain();n.type=r,n.frequency.setValueAtTime(t,e.currentTime),l.gain.setValueAtTime(s,e.currentTime),l.gain.exponentialRampToValueAtTime(.001,e.currentTime+o),n.connect(l),l.connect(e.destination),n.start(e.currentTime),n.stop(e.currentTime+o)},[u]),T=a.useCallback(()=>{c(523.25,"sine",.14)},[c]),f=a.useCallback(()=>{c(293.66,"triangle",.14)},[c]),b=a.useCallback(()=>{c(659.25,"sine",.09,.04)},[c]),g=a.useCallback((t,r)=>{const o=220+t/Math.max(r-1,1)*440;c(o,"sine",.07,.035)},[c]),d=a.useCallback(()=>{if(!i.current)return;const t=u();t&&[523.25,659.25,783.99].forEach((r,o)=>{const s=t.createOscillator(),e=t.createGain(),n=t.currentTime+o*.1;s.type="sine",s.frequency.setValueAtTime(r,n),e.gain.setValueAtTime(.06,n),e.gain.exponentialRampToValueAtTime(.001,n+.15),s.connect(e),e.connect(t.destination),s.start(n),s.stop(n+.15)})},[u]),y=a.useCallback(()=>{c(220,"sawtooth",.18,.045)},[c]),C=a.useCallback(t=>{i.current=t,p(t)},[]);return{soundEnabled:m,toggleSound:C,playInsert:T,playDelete:f,playAccess:b,playTraverse:g,playFound:d,playNotFound:y}}export{V as u}; +import{r as a}from"./index-CB1-0H6I.js";import{g as k}from"./audioContext-NbgqvQGz.js";function V(){const i=a.useRef(!0),[m,p]=a.useState(!0),u=a.useCallback(()=>k(),[]),c=a.useCallback((t,r,o,s=.06)=>{if(!i.current)return;const e=u();if(!e)return;const n=e.createOscillator(),l=e.createGain();n.type=r,n.frequency.setValueAtTime(t,e.currentTime),l.gain.setValueAtTime(s,e.currentTime),l.gain.exponentialRampToValueAtTime(.001,e.currentTime+o),n.connect(l),l.connect(e.destination),n.start(e.currentTime),n.stop(e.currentTime+o)},[u]),T=a.useCallback(()=>{c(523.25,"sine",.14)},[c]),f=a.useCallback(()=>{c(293.66,"triangle",.14)},[c]),b=a.useCallback(()=>{c(659.25,"sine",.09,.04)},[c]),g=a.useCallback((t,r)=>{const o=220+t/Math.max(r-1,1)*440;c(o,"sine",.07,.035)},[c]),d=a.useCallback(()=>{if(!i.current)return;const t=u();t&&[523.25,659.25,783.99].forEach((r,o)=>{const s=t.createOscillator(),e=t.createGain(),n=t.currentTime+o*.1;s.type="sine",s.frequency.setValueAtTime(r,n),e.gain.setValueAtTime(.06,n),e.gain.exponentialRampToValueAtTime(.001,n+.15),s.connect(e),e.connect(t.destination),s.start(n),s.stop(n+.15)})},[u]),y=a.useCallback(()=>{c(220,"sawtooth",.18,.045)},[c]),C=a.useCallback(t=>{i.current=t,p(t)},[]);return{soundEnabled:m,toggleSound:C,playInsert:T,playDelete:f,playAccess:b,playTraverse:g,playFound:d,playNotFound:y}}export{V as u}; diff --git a/docs/assets/volume-x-CjLNPeax.js b/docs/assets/volume-x-CKT6TOtL.js similarity index 91% rename from docs/assets/volume-x-CjLNPeax.js rename to docs/assets/volume-x-CKT6TOtL.js index d7bcf50..a6e86b5 100644 --- a/docs/assets/volume-x-CjLNPeax.js +++ b/docs/assets/volume-x-CKT6TOtL.js @@ -1 +1 @@ -import{c as a}from"./index-lLadk08S.js";const e=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],y=a("volume-2",e);const o=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],c=a("volume-x",o);export{y as V,c as a}; +import{c as a}from"./index-CB1-0H6I.js";const e=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],y=a("volume-2",e);const o=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],c=a("volume-x",o);export{y as V,c as a}; diff --git a/docs/assets/zap-Y8cI0o9G.js b/docs/assets/zap-C3nU9HZ_.js similarity index 75% rename from docs/assets/zap-Y8cI0o9G.js rename to docs/assets/zap-C3nU9HZ_.js index 9b955ea..f4daece 100644 --- a/docs/assets/zap-Y8cI0o9G.js +++ b/docs/assets/zap-C3nU9HZ_.js @@ -1 +1 @@ -import{c as a}from"./index-lLadk08S.js";const o=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e=a("zap",o);export{e as Z}; +import{c as a}from"./index-CB1-0H6I.js";const o=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e=a("zap",o);export{e as Z}; diff --git a/docs/index.html b/docs/index.html index 1d08e30..3f5d459 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,8 +5,8 @@ Algorithm Visualizer - - + +
diff --git a/package-lock.json b/package-lock.json index 9b07474..a914180 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^5.1.1", + "@vitest/coverage-v8": "^4.1.8", "eslint": "^9.39.1", "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.4.24", @@ -27,17 +28,18 @@ "tailwindcss": "^4.2.1", "typescript": "~5.9.3", "typescript-eslint": "^8.48.0", - "vite": "^7.3.1" + "vite": "^7.3.1", + "vitest": "^4.1.8" } }, "node_modules/@babel/code-frame": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", - "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", + "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" }, @@ -46,9 +48,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", - "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", "dev": true, "license": "MIT", "engines": { @@ -56,21 +58,21 @@ } }, "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -87,14 +89,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.29.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", - "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz", + "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.0", - "@babel/types": "^7.29.0", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" @@ -104,14 +106,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -121,9 +123,9 @@ } }, "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", "dev": true, "license": "MIT", "engines": { @@ -131,29 +133,29 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", - "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", - "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.6" + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -163,9 +165,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", - "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", "dev": true, "license": "MIT", "engines": { @@ -173,9 +175,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "dev": true, "license": "MIT", "engines": { @@ -183,9 +185,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "dev": true, "license": "MIT", "engines": { @@ -193,9 +195,9 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", "dev": true, "license": "MIT", "engines": { @@ -203,27 +205,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz", - "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", - "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.29.0" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -233,13 +235,13 @@ } }, "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", - "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" + "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -249,13 +251,13 @@ } }, "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", - "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" + "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -265,33 +267,33 @@ } }, "node_modules/@babel/template": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", - "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", - "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz", + "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0", + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7", "debug": "^4.3.1" }, "engines": { @@ -299,23 +301,33 @@ } }, "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@bcoe/v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", + "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", "cpu": [ "ppc64" ], @@ -330,9 +342,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", "cpu": [ "arm" ], @@ -347,9 +359,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", "cpu": [ "arm64" ], @@ -364,9 +376,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", "cpu": [ "x64" ], @@ -381,9 +393,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", "cpu": [ "arm64" ], @@ -398,9 +410,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", "cpu": [ "x64" ], @@ -415,9 +427,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", "cpu": [ "arm64" ], @@ -432,9 +444,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", "cpu": [ "x64" ], @@ -449,9 +461,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", "cpu": [ "arm" ], @@ -466,9 +478,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", "cpu": [ "arm64" ], @@ -483,9 +495,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", "cpu": [ "ia32" ], @@ -500,9 +512,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", "cpu": [ "loong64" ], @@ -517,9 +529,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", "cpu": [ "mips64el" ], @@ -534,9 +546,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", "cpu": [ "ppc64" ], @@ -551,9 +563,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", "cpu": [ "riscv64" ], @@ -568,9 +580,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", "cpu": [ "s390x" ], @@ -585,9 +597,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", "cpu": [ "x64" ], @@ -602,9 +614,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", "cpu": [ "arm64" ], @@ -619,9 +631,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", "cpu": [ "x64" ], @@ -636,9 +648,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", "cpu": [ "arm64" ], @@ -653,9 +665,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", "cpu": [ "x64" ], @@ -670,9 +682,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", "cpu": [ "arm64" ], @@ -687,9 +699,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", "cpu": [ "x64" ], @@ -704,9 +716,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", "cpu": [ "arm64" ], @@ -721,9 +733,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", "cpu": [ "ia32" ], @@ -738,9 +750,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", "cpu": [ "x64" ], @@ -797,15 +809,15 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", - "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz", + "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==", "dev": true, "license": "Apache-2.0", "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", - "minimatch": "^3.1.2" + "minimatch": "^3.1.5" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -838,9 +850,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.4.tgz", - "integrity": "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.5.tgz", + "integrity": "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==", "dev": true, "license": "MIT", "dependencies": { @@ -851,7 +863,7 @@ "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", - "minimatch": "^3.1.3", + "minimatch": "^3.1.5", "strip-json-comments": "^3.1.1" }, "engines": { @@ -875,9 +887,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.39.3", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.3.tgz", - "integrity": "sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw==", + "version": "9.39.4", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.4.tgz", + "integrity": "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==", "dev": true, "license": "MIT", "engines": { @@ -912,29 +924,43 @@ } }, "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", "dev": true, "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, "engines": { "node": ">=18.18.0" } }, "node_modules/@humanfs/node": { - "version": "0.16.7", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", - "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanfs/core": "^0.19.1", + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", "@humanwhocodes/retry": "^0.4.0" }, "engines": { "node": ">=18.18.0" } }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -1021,9 +1047,9 @@ "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1035,9 +1061,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1049,9 +1075,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1063,9 +1089,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1077,9 +1103,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1091,9 +1117,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1105,13 +1131,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1119,13 +1148,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1133,13 +1165,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1147,13 +1182,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1161,13 +1199,16 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1175,13 +1216,16 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1189,13 +1233,16 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1203,13 +1250,16 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1217,13 +1267,16 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1231,13 +1284,16 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1245,13 +1301,16 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1259,13 +1318,16 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1273,13 +1335,16 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1287,9 +1352,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1301,9 +1366,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1315,9 +1380,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1329,9 +1394,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1343,9 +1408,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1357,9 +1422,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1370,50 +1435,57 @@ "win32" ] }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, "node_modules/@tailwindcss/node": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.2.1.tgz", - "integrity": "sha512-jlx6sLk4EOwO6hHe1oCGm1Q4AN/s0rSrTTPBGPM0/RQ6Uylwq17FuU8IeJJKEjtc6K6O07zsvP+gDO6MMWo7pg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.0.tgz", + "integrity": "sha512-aFb4gUhFOgdh9AXo4IzBEOzBkkAxm9VigwDJnMIYv3lcfXCJVesNfbEaBl4BNgVRyid92AmdviqwBUBRKSeY3g==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/remapping": "^2.3.5", - "enhanced-resolve": "^5.19.0", + "enhanced-resolve": "^5.21.0", "jiti": "^2.6.1", - "lightningcss": "1.31.1", + "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", - "tailwindcss": "4.2.1" + "tailwindcss": "4.3.0" } }, "node_modules/@tailwindcss/oxide": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.2.1.tgz", - "integrity": "sha512-yv9jeEFWnjKCI6/T3Oq50yQEOqmpmpfzG1hcZsAOaXFQPfzWprWrlHSdGPEF3WQTi8zu8ohC9Mh9J470nT5pUw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.0.tgz", + "integrity": "sha512-F7HZGBeN9I0/AuuJS5PwcD8xayx5ri5GhjYUDBEVYUkexyA/giwbDNjRVrxSezE3T250OU2K/wp/ltWx3UOefg==", "dev": true, "license": "MIT", "engines": { "node": ">= 20" }, "optionalDependencies": { - "@tailwindcss/oxide-android-arm64": "4.2.1", - "@tailwindcss/oxide-darwin-arm64": "4.2.1", - "@tailwindcss/oxide-darwin-x64": "4.2.1", - "@tailwindcss/oxide-freebsd-x64": "4.2.1", - "@tailwindcss/oxide-linux-arm-gnueabihf": "4.2.1", - "@tailwindcss/oxide-linux-arm64-gnu": "4.2.1", - "@tailwindcss/oxide-linux-arm64-musl": "4.2.1", - "@tailwindcss/oxide-linux-x64-gnu": "4.2.1", - "@tailwindcss/oxide-linux-x64-musl": "4.2.1", - "@tailwindcss/oxide-wasm32-wasi": "4.2.1", - "@tailwindcss/oxide-win32-arm64-msvc": "4.2.1", - "@tailwindcss/oxide-win32-x64-msvc": "4.2.1" + "@tailwindcss/oxide-android-arm64": "4.3.0", + "@tailwindcss/oxide-darwin-arm64": "4.3.0", + "@tailwindcss/oxide-darwin-x64": "4.3.0", + "@tailwindcss/oxide-freebsd-x64": "4.3.0", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.0", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.0", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.0", + "@tailwindcss/oxide-linux-x64-musl": "4.3.0", + "@tailwindcss/oxide-wasm32-wasi": "4.3.0", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.0", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.0" } }, "node_modules/@tailwindcss/oxide-android-arm64": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.2.1.tgz", - "integrity": "sha512-eZ7G1Zm5EC8OOKaesIKuw77jw++QJ2lL9N+dDpdQiAB/c/B2wDh0QPFHbkBVrXnwNugvrbJFk1gK2SsVjwWReg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.0.tgz", + "integrity": "sha512-TJPiq67tKlLuObP6RkwvVGDoxCMBVtDgKkLfa/uyj7/FyxvQwHS+UOnVrXXgbEsfUaMgiVvC4KbJnRr26ho4Ng==", "cpu": [ "arm64" ], @@ -1428,9 +1500,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-arm64": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.2.1.tgz", - "integrity": "sha512-q/LHkOstoJ7pI1J0q6djesLzRvQSIfEto148ppAd+BVQK0JYjQIFSK3JgYZJa+Yzi0DDa52ZsQx2rqytBnf8Hw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.0.tgz", + "integrity": "sha512-oMN/WZRb+SO37BmUElEgeEWuU8E/HXRkiODxJxLe1UTHVXLrdVSgfaJV7pSlhRGMSOiXLuxTIjfsF3wYvz8cgQ==", "cpu": [ "arm64" ], @@ -1445,9 +1517,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-x64": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.2.1.tgz", - "integrity": "sha512-/f/ozlaXGY6QLbpvd/kFTro2l18f7dHKpB+ieXz+Cijl4Mt9AI2rTrpq7V+t04nK+j9XBQHnSMdeQRhbGyt6fw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.0.tgz", + "integrity": "sha512-N6CUmu4a6bKVADfw77p+iw6Yd9Q3OBhe0veaDX+QazfuVYlQsHfDgxBrsjQ/IW+zywL8mTrNd0SdJT/zgtvMdA==", "cpu": [ "x64" ], @@ -1462,9 +1534,9 @@ } }, "node_modules/@tailwindcss/oxide-freebsd-x64": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.2.1.tgz", - "integrity": "sha512-5e/AkgYJT/cpbkys/OU2Ei2jdETCLlifwm7ogMC7/hksI2fC3iiq6OcXwjibcIjPung0kRtR3TxEITkqgn0TcA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.0.tgz", + "integrity": "sha512-zDL5hBkQdH5C6MpqbK3gQAgP80tsMwSI26vjOzjJtNCMUo0lFgOItzHKBIupOZNQxt3ouPH7RPhvNhiTfCe5CQ==", "cpu": [ "x64" ], @@ -1479,9 +1551,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.2.1.tgz", - "integrity": "sha512-Uny1EcVTTmerCKt/1ZuKTkb0x8ZaiuYucg2/kImO5A5Y/kBz41/+j0gxUZl+hTF3xkWpDmHX+TaWhOtba2Fyuw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.0.tgz", + "integrity": "sha512-R06HdNi7A7OEoMsf6d4tjZ71RCWnZQPHj2mnotSFURjNLdBC+cIgXQ7l81CqeoiQftjf6OOblxXMInMgN2VzMA==", "cpu": [ "arm" ], @@ -1496,13 +1568,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.2.1.tgz", - "integrity": "sha512-CTrwomI+c7n6aSSQlsPL0roRiNMDQ/YzMD9EjcR+H4f0I1SQ8QqIuPnsVp7QgMkC1Qi8rtkekLkOFjo7OlEFRQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.0.tgz", + "integrity": "sha512-qTJHELX8jetjhRQHCLilkVLmybpzNQAtaI/gaoVoidn/ufbNDbAo8KlK2J+yPoc8wQxvDxCmh/5lr8nC1+lTbg==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1513,13 +1588,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-musl": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.2.1.tgz", - "integrity": "sha512-WZA0CHRL/SP1TRbA5mp9htsppSEkWuQ4KsSUumYQnyl8ZdT39ntwqmz4IUHGN6p4XdSlYfJwM4rRzZLShHsGAQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.0.tgz", + "integrity": "sha512-Z6sukiQsngnWO+l39X4pPbiWT81IC+PLKF+PHxIlyZbGNb9MODfYlXEVlFvej5BOZInWX01kVyzeLvHsXhfczQ==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1530,13 +1608,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-gnu": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.2.1.tgz", - "integrity": "sha512-qMFzxI2YlBOLW5PhblzuSWlWfwLHaneBE0xHzLrBgNtqN6mWfs+qYbhryGSXQjFYB1Dzf5w+LN5qbUTPhW7Y5g==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.0.tgz", + "integrity": "sha512-DRNdQRpSGzRGfARVuVkxvM8Q12nh19l4BF/G7zGA1oe+9wcC6saFBHTISrpIcKzhiXtSrlSrluCfvMuledoCTQ==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1547,13 +1628,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-musl": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.2.1.tgz", - "integrity": "sha512-5r1X2FKnCMUPlXTWRYpHdPYUY6a1Ar/t7P24OuiEdEOmms5lyqjDRvVY1yy9Rmioh+AunQ0rWiOTPE8F9A3v5g==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.0.tgz", + "integrity": "sha512-Z0IADbDo8bh6I7h2IQMx601AdXBLfFpEdUotft86evd/8ZPflZe9COPO8Q1vw+pfLWIUo9zN/JGZvwuAJqduqg==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1564,9 +1648,9 @@ } }, "node_modules/@tailwindcss/oxide-wasm32-wasi": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.2.1.tgz", - "integrity": "sha512-MGFB5cVPvshR85MTJkEvqDUnuNoysrsRxd6vnk1Lf2tbiqNlXpHYZqkqOQalydienEWOHHFyyuTSYRsLfxFJ2Q==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.0.tgz", + "integrity": "sha512-HNZGOUxEmElksYR7S6sC5jTeNGpobAsy9u7Gu0AskJ8/20FR9GqebUyB+HBcU/ax6BHuiuJi+Oda4B+YX6H1yA==", "bundleDependencies": [ "@napi-rs/wasm-runtime", "@emnapi/core", @@ -1582,10 +1666,10 @@ "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.8.1", - "@emnapi/runtime": "^1.8.1", - "@emnapi/wasi-threads": "^1.1.0", - "@napi-rs/wasm-runtime": "^1.1.1", + "@emnapi/core": "^1.10.0", + "@emnapi/runtime": "^1.10.0", + "@emnapi/wasi-threads": "^1.2.1", + "@napi-rs/wasm-runtime": "^1.1.4", "@tybys/wasm-util": "^0.10.1", "tslib": "^2.8.1" }, @@ -1594,9 +1678,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.2.1.tgz", - "integrity": "sha512-YlUEHRHBGnCMh4Nj4GnqQyBtsshUPdiNroZj8VPkvTZSoHsilRCwXcVKnG9kyi0ZFAS/3u+qKHBdDc81SADTRA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.0.tgz", + "integrity": "sha512-Pe+RPVTi1T+qymuuRpcdvwSVZjnll/f7n8gBxMMh3xLTctMDKqpdfGimbMyioqtLhUYZxdJ9wGNhV7MKHvgZsQ==", "cpu": [ "arm64" ], @@ -1611,9 +1695,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-x64-msvc": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.2.1.tgz", - "integrity": "sha512-rbO34G5sMWWyrN/idLeVxAZgAKWrn5LiR3/I90Q9MkA67s6T1oB0xtTe+0heoBvHSpbU9Mk7i6uwJnpo4u21XQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.0.tgz", + "integrity": "sha512-Mvrf2kXW/yeW/OTezZlCGOirXRcUuLIBx/5Y12BaPM7wJoryG6dfS/NJL8aBPqtTEx/Vm4T4vKzFUcKDT+TKUA==", "cpu": [ "x64" ], @@ -1628,18 +1712,18 @@ } }, "node_modules/@tailwindcss/vite": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.2.1.tgz", - "integrity": "sha512-TBf2sJjYeb28jD2U/OhwdW0bbOsxkWPwQ7SrqGf9sVcoYwZj7rkXljroBO9wKBut9XnmQLXanuDUeqQK0lGg/w==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.0.tgz", + "integrity": "sha512-t6J3OrB5Fc0ExuhohouH0fWUGMYL6PTLhW+E7zIk/pdbnJARZDCwjBznFnkh5ynRnIRSI4YjtTH0t6USjJISrw==", "dev": true, "license": "MIT", "dependencies": { - "@tailwindcss/node": "4.2.1", - "@tailwindcss/oxide": "4.2.1", - "tailwindcss": "4.2.1" + "@tailwindcss/node": "4.3.0", + "@tailwindcss/oxide": "4.3.0", + "tailwindcss": "4.3.0" }, "peerDependencies": { - "vite": "^5.2.0 || ^6 || ^7" + "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, "node_modules/@types/babel__core": { @@ -1687,10 +1771,28 @@ "@babel/types": "^7.28.2" } }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true, "license": "MIT" }, @@ -1702,19 +1804,19 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.11.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.11.0.tgz", - "integrity": "sha512-fPxQqz4VTgPI/IQ+lj9r0h+fDR66bzoeMGHp8ASee+32OSGIkeASsoZuJixsQoVef1QJbeubcPBxKk22QVoWdw==", + "version": "24.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.0.tgz", + "integrity": "sha512-5vtOqGQr4NJKeEzV441FcOi2MeG9UTWq9LqVLGneDdu4vlX17H8kQ2PA2UmNwCUGPVDj4oBjNhS7ReVEIWJJrg==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.16.0" + "undici-types": "~7.18.0" } }, "node_modules/@types/react": { - "version": "19.2.14", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", - "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", + "version": "19.2.16", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.16.tgz", + "integrity": "sha512-esJiCAnl0kfpNdE69f3So4WJUXy95dLZydX0KwK46riIHDzHM7O9Vtf9xCHW0PXIqvgqNrswl522kA/5yx+F4w==", "dev": true, "license": "MIT", "dependencies": { @@ -1732,20 +1834,20 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.56.1.tgz", - "integrity": "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.60.1.tgz", + "integrity": "sha512-JQ4S5GB0tfjO8BuJ4fcX+HodkzJjYBV+7OJ+wLygaX7OGQ7FudyHL4NSCA6ob+w3Yn+5MkKIozOwQhXeM7opVg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/type-utils": "8.56.1", - "@typescript-eslint/utils": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", + "@typescript-eslint/scope-manager": "8.60.1", + "@typescript-eslint/type-utils": "8.60.1", + "@typescript-eslint/utils": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1755,9 +1857,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.56.1", + "@typescript-eslint/parser": "^8.60.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { @@ -1771,16 +1873,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.56.1.tgz", - "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.60.1.tgz", + "integrity": "sha512-A0M6ua6H252bVjPvvtSgl2QA4+ET9S5Mtkb2GDyTxIhH/C4qDItT7RQNO5PhMC6NXGYXOR9dIalcDDgBKT7oFA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", + "@typescript-eslint/scope-manager": "8.60.1", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/typescript-estree": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1", "debug": "^4.4.3" }, "engines": { @@ -1792,18 +1894,18 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.56.1.tgz", - "integrity": "sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.60.1.tgz", + "integrity": "sha512-eXkTH2bxmXlqD1RnOPmLZ9ZM9D3VwSx04JOwBnP9RQ+yUA5a2Mu7SfW8uaV2Aon53NJzZlZYuX7tn91Izf+xaw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.56.1", - "@typescript-eslint/types": "^8.56.1", + "@typescript-eslint/tsconfig-utils": "^8.60.1", + "@typescript-eslint/types": "^8.60.1", "debug": "^4.4.3" }, "engines": { @@ -1814,18 +1916,18 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.56.1.tgz", - "integrity": "sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.60.1.tgz", + "integrity": "sha512-gvI5OQoptnxQnchOirukCuQ55svJSTuD/4k5+pC267xyBtYry748R9/c3tYUzb/iE6RZfllRz2lVulLCHkTm4w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1" + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1836,9 +1938,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.56.1.tgz", - "integrity": "sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.60.1.tgz", + "integrity": "sha512-nh8w4qAteiKuZu3pSSzG/yGKpw0OlkrKnzFmbVRenKaD4qc+7i1GrmZaLVkr8rk4uipiPGMOW4YsM6WmKZ5CvA==", "dev": true, "license": "MIT", "engines": { @@ -1849,21 +1951,21 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.56.1.tgz", - "integrity": "sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.60.1.tgz", + "integrity": "sha512-sdwTrpjosW7ANQYJ39ZBF1ZyEMEGVB2UsikrserVM/30a/F1dTLnu9bGxEdosugyu5caigjLrR2qiD11asjI1A==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/utils": "8.56.1", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/typescript-estree": "8.60.1", + "@typescript-eslint/utils": "8.60.1", "debug": "^4.4.3", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1874,13 +1976,13 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/types": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.56.1.tgz", - "integrity": "sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.60.1.tgz", + "integrity": "sha512-4h0tY8ppCkdCzcrl2YM5M3my0xsE1Tf8om3owEu5oPWmXwkKRmk0j0LGDzYBGUcAlesEbxBhazqu/K4cu3Ug7w==", "dev": true, "license": "MIT", "engines": { @@ -1892,21 +1994,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.56.1.tgz", - "integrity": "sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.60.1.tgz", + "integrity": "sha512-alpRkfG8hlVE5kdJW2GkfgDgXxold3e8e4l6EnmhRmRLbekgAPCCGDVD++sABy9FcgPFroq+uFcCSM1vR57Cew==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.56.1", - "@typescript-eslint/tsconfig-utils": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", + "@typescript-eslint/project-service": "8.60.1", + "@typescript-eslint/tsconfig-utils": "8.60.1", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1916,7 +2018,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": { @@ -1930,9 +2032,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", - "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", + "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", "dev": true, "license": "MIT", "dependencies": { @@ -1943,13 +2045,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "10.2.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", - "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^5.0.2" + "brace-expansion": "^5.0.5" }, "engines": { "node": "18 || 20 || >=22" @@ -1959,9 +2061,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", + "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", "dev": true, "license": "ISC", "bin": { @@ -1972,16 +2074,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.56.1.tgz", - "integrity": "sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.60.1.tgz", + "integrity": "sha512-h2MPBLoNtjc3qZWfY3Tl51yPorQ2McHn8pJfcMNTcIvrrZrr90Ykffit0yjrPFWQcRcUxzH20+6OcVdW4yHtUg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1" + "@typescript-eslint/scope-manager": "8.60.1", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/typescript-estree": "8.60.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1992,17 +2094,17 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.56.1.tgz", - "integrity": "sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.60.1.tgz", + "integrity": "sha512-EbGRQg4FhrmwLodl+t3JNAnXHWVr9Vp+Zl1QBZVPY4ByfkzIT8cX3K6QWODHtkIZqqJVEWvhHSx3v5PDHsaQag==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.1", + "@typescript-eslint/types": "8.60.1", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -2027,9 +2129,9 @@ } }, "node_modules/@vitejs/plugin-react": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.4.tgz", - "integrity": "sha512-VIcFLdRi/VYRU8OL/puL7QXMYafHmqOnwTZY50U1JPlCNj30PxCMx65c494b1K9be9hX83KVt0+gTEwTWLqToA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.2.0.tgz", + "integrity": "sha512-YmKkfhOAi3wsB1PhJq5Scj3GXMn3WvtQ/JC0xoopuHoXSdmtdStOpFrYaT1kie2YgFBcIe64ROzMYRjCrYOdYw==", "dev": true, "license": "MIT", "dependencies": { @@ -2044,7 +2146,151 @@ "node": "^20.19.0 || >=22.12.0" }, "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@vitest/coverage-v8": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.1.8.tgz", + "integrity": "sha512-lt3kovsyHwYe00wq4D1ti0Z974fWj4NLp6siqiyEufUpyFwK9Yhi7rBhac9JL5aA0zoMrJqc4vYPZRUnI7l7nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^1.0.2", + "@vitest/utils": "4.1.8", + "ast-v8-to-istanbul": "^1.0.0", + "istanbul-lib-coverage": "^3.2.2", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.2.0", + "magicast": "^0.5.2", + "obug": "^2.1.1", + "std-env": "^4.0.0-rc.1", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@vitest/browser": "4.1.8", + "vitest": "4.1.8" + }, + "peerDependenciesMeta": { + "@vitest/browser": { + "optional": true + } + } + }, + "node_modules/@vitest/expect": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.8.tgz", + "integrity": "sha512-h3nDO677RDLEGlBxyQ5CW8RlMThSKSRLUePLOx09gNIWRL40edgA1GCZSZgf1W55MFAG6/Sw14KeaAnqv0NKdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.8", + "@vitest/utils": "4.1.8", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.8.tgz", + "integrity": "sha512-LEiN/xe4OSIbKe9HQIp5OC24agGD9J5CnmMgsLohVVoOPWL9a2sBoR6VBx43jQZb7Kr1l4RCuyCJzcAa0+dojw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.8", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.8.tgz", + "integrity": "sha512-9GasEBxpZ1VYIpqHf/0+YGg121uSNwCKOJqIrTwWP/TB7DmFCiaBpNl3aPZzoLWfWkuqhbH8vJIVobZkvdo2cA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.8.tgz", + "integrity": "sha512-EmVxeBAfMJvycdjd6Hm+RbFBbA9fKvo0Kx37hNpBYoYeavH3RNsBXWDooR1mgD52dCrxIIuP7UotpfiwOikvcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.8", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.8.tgz", + "integrity": "sha512-acfZboRmAIf05DEKcBQy33VXojFJjtUdLyo7oOmV9kebb2xdU01UknNiPuPZoJZQyO7DF0gZdTGTpeAzET9QPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.8", + "@vitest/utils": "4.1.8", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.8.tgz", + "integrity": "sha512-6EevtBp6OZOPF7bmz36HrGMeP3txgVSrgebWxHOafDXGkhIzfXK14f8KF6MuFfgXXUeHxmpD3BQxkV00/3s5mA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.8.tgz", + "integrity": "sha512-uOJamYALNhfJ6iolExyQM40yIQwDqYnkKtQ5VCiSe17E33H0aQ/u+1GlRuz4LZBk6Mm3sg90G9hEbmEt37C1Zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.8", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" } }, "node_modules/acorn": { @@ -2071,9 +2317,9 @@ } }, "node_modules/ajv": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz", - "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==", + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", "dev": true, "license": "MIT", "dependencies": { @@ -2110,6 +2356,35 @@ "dev": true, "license": "Python-2.0" }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/ast-v8-to-istanbul": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-1.0.3.tgz", + "integrity": "sha512-jCMQ6ZylLPudp0CDfBmQBZUsrh1/8psbmu9ibeVWKuHWD0YrH9YABwlKu5kVEFoT0GCQQW9Z/SxfuEbbkGQCRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.31", + "estree-walker": "^3.0.3", + "js-tokens": "^10.0.0" + } + }, + "node_modules/ast-v8-to-istanbul/node_modules/js-tokens": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz", + "integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2118,9 +2393,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.0.tgz", - "integrity": "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA==", + "version": "2.10.33", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.33.tgz", + "integrity": "sha512-bA6+tcSLpz2tIEdDXZPpPTIuxBcC4+w6SieaYyfigIa4h8GlFxbA17v22Vx3JUtuZQj9SgOsnbK+aTBzyDyEuw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2131,9 +2406,9 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz", + "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==", "dev": true, "license": "MIT", "dependencies": { @@ -2142,9 +2417,9 @@ } }, "node_modules/browserslist": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", - "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "version": "4.28.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "dev": true, "funding": [ { @@ -2162,11 +2437,11 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.9.0", - "caniuse-lite": "^1.0.30001759", - "electron-to-chromium": "^1.5.263", - "node-releases": "^2.0.27", - "update-browserslist-db": "^1.2.0" + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", + "update-browserslist-db": "^1.2.3" }, "bin": { "browserslist": "cli.js" @@ -2186,9 +2461,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001775", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001775.tgz", - "integrity": "sha512-s3Qv7Lht9zbVKE9XoTyRG6wVDCKdtOFIjBGg3+Yhn6JaytuNKPIjBMTMIY1AnOH3seL5mvF+x33oGAyK3hVt3A==", + "version": "1.0.30001793", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz", + "integrity": "sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==", "dev": true, "funding": [ { @@ -2206,6 +2481,16 @@ ], "license": "CC-BY-4.0" }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2328,30 +2613,37 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.302", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.302.tgz", - "integrity": "sha512-sM6HAN2LyK82IyPBpznDRqlTQAtuSaO+ShzFiWTvoMJLHyZ+Y39r8VMfHzwbU8MVBzQ4Wdn85+wlZl2TLGIlwg==", + "version": "1.5.367", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.367.tgz", + "integrity": "sha512-4Mk/mrynCNQ+atY40D3UpmhLWB6AHMbYMlIrPhHcMF6x0L7O0b052FCAsxw1LlaR++UFuNg3D/A6XCuGDa0guQ==", "dev": true, "license": "ISC" }, "node_modules/enhanced-resolve": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.20.0.tgz", - "integrity": "sha512-/ce7+jQ1PQ6rVXwe+jKEg5hW5ciicHwIQUagZkp6IufBoY3YDgdTTY1azVs0qoRgVmvsNB+rbjLJxDAeHHtwsQ==", + "version": "5.22.2", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.22.2.tgz", + "integrity": "sha512-0rxICaFZ7NQho/sHely2bvOPRP0Eu2B0NZ9zM54YvRvWMn7jfz3DmnOZDR9LlXDdDcqntAVc6Hfy4gr/tdH/Ag==", "dev": true, "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", - "tapable": "^2.3.0" + "tapable": "^2.3.3" }, "engines": { "node": ">=10.13.0" } }, + "node_modules/es-module-lexer": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", + "dev": true, + "license": "MIT" + }, "node_modules/esbuild": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", - "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -2362,32 +2654,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.3", - "@esbuild/android-arm": "0.27.3", - "@esbuild/android-arm64": "0.27.3", - "@esbuild/android-x64": "0.27.3", - "@esbuild/darwin-arm64": "0.27.3", - "@esbuild/darwin-x64": "0.27.3", - "@esbuild/freebsd-arm64": "0.27.3", - "@esbuild/freebsd-x64": "0.27.3", - "@esbuild/linux-arm": "0.27.3", - "@esbuild/linux-arm64": "0.27.3", - "@esbuild/linux-ia32": "0.27.3", - "@esbuild/linux-loong64": "0.27.3", - "@esbuild/linux-mips64el": "0.27.3", - "@esbuild/linux-ppc64": "0.27.3", - "@esbuild/linux-riscv64": "0.27.3", - "@esbuild/linux-s390x": "0.27.3", - "@esbuild/linux-x64": "0.27.3", - "@esbuild/netbsd-arm64": "0.27.3", - "@esbuild/netbsd-x64": "0.27.3", - "@esbuild/openbsd-arm64": "0.27.3", - "@esbuild/openbsd-x64": "0.27.3", - "@esbuild/openharmony-arm64": "0.27.3", - "@esbuild/sunos-x64": "0.27.3", - "@esbuild/win32-arm64": "0.27.3", - "@esbuild/win32-ia32": "0.27.3", - "@esbuild/win32-x64": "0.27.3" + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" } }, "node_modules/escalade": { @@ -2414,25 +2706,25 @@ } }, "node_modules/eslint": { - "version": "9.39.3", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.3.tgz", - "integrity": "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==", + "version": "9.39.4", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.4.tgz", + "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.1", + "@eslint/config-array": "^0.21.2", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.39.3", + "@eslint/eslintrc": "^3.3.5", + "@eslint/js": "9.39.4", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", - "ajv": "^6.12.4", + "ajv": "^6.14.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", @@ -2451,7 +2743,7 @@ "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", + "minimatch": "^3.1.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, @@ -2474,9 +2766,9 @@ } }, "node_modules/eslint-plugin-react-hooks": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz", - "integrity": "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", "dev": true, "license": "MIT", "dependencies": { @@ -2490,7 +2782,7 @@ "node": ">=18" }, "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" } }, "node_modules/eslint-plugin-react-refresh": { @@ -2587,6 +2879,16 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -2597,6 +2899,16 @@ "node": ">=0.10.0" } }, + "node_modules/expect-type": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", + "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2681,9 +2993,9 @@ } }, "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", "dev": true, "license": "ISC" }, @@ -2772,6 +3084,13 @@ "hermes-estree": "0.25.1" } }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -2839,10 +3158,49 @@ "dev": true, "license": "ISC" }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", + "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jiti": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", - "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", "dev": true, "license": "MIT", "bin": { @@ -2857,10 +3215,20 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -2941,9 +3309,9 @@ } }, "node_modules/lightningcss": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.31.1.tgz", - "integrity": "sha512-l51N2r93WmGUye3WuFoN5k10zyvrVs0qfKBhyC5ogUQ6Ew6JUSswh78mbSO+IU3nTWsyOArqPCcShdQSadghBQ==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", "dev": true, "license": "MPL-2.0", "dependencies": { @@ -2957,23 +3325,23 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "lightningcss-android-arm64": "1.31.1", - "lightningcss-darwin-arm64": "1.31.1", - "lightningcss-darwin-x64": "1.31.1", - "lightningcss-freebsd-x64": "1.31.1", - "lightningcss-linux-arm-gnueabihf": "1.31.1", - "lightningcss-linux-arm64-gnu": "1.31.1", - "lightningcss-linux-arm64-musl": "1.31.1", - "lightningcss-linux-x64-gnu": "1.31.1", - "lightningcss-linux-x64-musl": "1.31.1", - "lightningcss-win32-arm64-msvc": "1.31.1", - "lightningcss-win32-x64-msvc": "1.31.1" + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" } }, "node_modules/lightningcss-android-arm64": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.31.1.tgz", - "integrity": "sha512-HXJF3x8w9nQ4jbXRiNppBCqeZPIAfUo8zE/kOEGbW5NZvGc/K7nMxbhIr+YlFlHW5mpbg/YFPdbnCh1wAXCKFg==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", "cpu": [ "arm64" ], @@ -2992,9 +3360,9 @@ } }, "node_modules/lightningcss-darwin-arm64": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.31.1.tgz", - "integrity": "sha512-02uTEqf3vIfNMq3h/z2cJfcOXnQ0GRwQrkmPafhueLb2h7mqEidiCzkE4gBMEH65abHRiQvhdcQ+aP0D0g67sg==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", "cpu": [ "arm64" ], @@ -3013,9 +3381,9 @@ } }, "node_modules/lightningcss-darwin-x64": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.31.1.tgz", - "integrity": "sha512-1ObhyoCY+tGxtsz1lSx5NXCj3nirk0Y0kB/g8B8DT+sSx4G9djitg9ejFnjb3gJNWo7qXH4DIy2SUHvpoFwfTA==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", "cpu": [ "x64" ], @@ -3034,9 +3402,9 @@ } }, "node_modules/lightningcss-freebsd-x64": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.31.1.tgz", - "integrity": "sha512-1RINmQKAItO6ISxYgPwszQE1BrsVU5aB45ho6O42mu96UiZBxEXsuQ7cJW4zs4CEodPUioj/QrXW1r9pLUM74A==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", "cpu": [ "x64" ], @@ -3055,9 +3423,9 @@ } }, "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.31.1.tgz", - "integrity": "sha512-OOCm2//MZJ87CdDK62rZIu+aw9gBv4azMJuA8/KB74wmfS3lnC4yoPHm0uXZ/dvNNHmnZnB8XLAZzObeG0nS1g==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", "cpu": [ "arm" ], @@ -3076,13 +3444,16 @@ } }, "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.31.1.tgz", - "integrity": "sha512-WKyLWztD71rTnou4xAD5kQT+982wvca7E6QoLpoawZ1gP9JM0GJj4Tp5jMUh9B3AitHbRZ2/H3W5xQmdEOUlLg==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3097,13 +3468,16 @@ } }, "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.31.1.tgz", - "integrity": "sha512-mVZ7Pg2zIbe3XlNbZJdjs86YViQFoJSpc41CbVmKBPiGmC4YrfeOyz65ms2qpAobVd7WQsbW4PdsSJEMymyIMg==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3118,13 +3492,16 @@ } }, "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.31.1.tgz", - "integrity": "sha512-xGlFWRMl+0KvUhgySdIaReQdB4FNudfUTARn7q0hh/V67PVGCs3ADFjw+6++kG1RNd0zdGRlEKa+T13/tQjPMA==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3139,13 +3516,16 @@ } }, "node_modules/lightningcss-linux-x64-musl": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.31.1.tgz", - "integrity": "sha512-eowF8PrKHw9LpoZii5tdZwnBcYDxRw2rRCyvAXLi34iyeYfqCQNA9rmUM0ce62NlPhCvof1+9ivRaTY6pSKDaA==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3160,9 +3540,9 @@ } }, "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.31.1.tgz", - "integrity": "sha512-aJReEbSEQzx1uBlQizAOBSjcmr9dCdL3XuC/6HLXAxmtErsj2ICo5yYggg1qOODQMtnjNQv2UHb9NpOuFtYe4w==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", "cpu": [ "arm64" ], @@ -3181,9 +3561,9 @@ } }, "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.31.1", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.31.1.tgz", - "integrity": "sha512-I9aiFrbd7oYHwlnQDqr1Roz+fTz61oDDJX7n9tYF9FJymH1cIN1DtKw3iYt6b8WZgEjoNwVSncwF4wx/ZedMhw==", + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", "cpu": [ "x64" ], @@ -3253,6 +3633,47 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, + "node_modules/magicast": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", + "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.3", + "@babel/types": "^7.29.0", + "source-map-js": "^1.2.1" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", + "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/minimatch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", @@ -3274,9 +3695,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "dev": true, "funding": [ { @@ -3300,11 +3721,28 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "version": "2.0.47", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz", + "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/obug": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.2.tgz", + "integrity": "sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } }, "node_modules/optionator": { "version": "0.9.4", @@ -3389,6 +3827,13 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -3397,9 +3842,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", "engines": { @@ -3410,9 +3855,9 @@ } }, "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "dev": true, "funding": [ { @@ -3430,7 +3875,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -3459,24 +3904,24 @@ } }, "node_modules/react": { - "version": "19.2.4", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", - "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz", + "integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "19.2.4", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", - "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz", + "integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==", "license": "MIT", "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { - "react": "^19.2.4" + "react": "^19.2.7" } }, "node_modules/react-refresh": { @@ -3490,9 +3935,9 @@ } }, "node_modules/react-router": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.13.1.tgz", - "integrity": "sha512-td+xP4X2/6BJvZoX6xw++A2DdEi++YypA69bJUV5oVvqf6/9/9nNlD70YO1e9d3MyamJEBQFEzk6mbfDYbqrSA==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.17.0.tgz", + "integrity": "sha512-FDELK7rTMlCHO5+reyXsPlmfr7N1F91lPHsWYfMEGQm/KQ+F4JFM8jGoeQDmDvdTs93Fw9aSilH+uKRb4/jXvQ==", "license": "MIT", "dependencies": { "cookie": "^1.0.1", @@ -3512,12 +3957,12 @@ } }, "node_modules/react-router-dom": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.13.1.tgz", - "integrity": "sha512-UJnV3Rxc5TgUPJt2KJpo1Jpy0OKQr0AjgbZzBFjaPJcFOb2Y8jA5H3LT8HUJAiRLlWrEXWHbF1Z4SCZaQjWDHw==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.17.0.tgz", + "integrity": "sha512-fyU2yjGups/hE6Xz0I5ZYbVL8Gx29eCjgpHaRaTaVU+OOAdfRX05KsvyRm0GO8YQwOkhpU3MurW1jyMUJn+zSw==", "license": "MIT", "dependencies": { - "react-router": "7.13.1" + "react-router": "7.17.0" }, "engines": { "node": ">=20.0.0" @@ -3538,13 +3983,13 @@ } }, "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "dev": true, "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -3554,31 +3999,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, @@ -3627,6 +4072,13 @@ "node": ">=8" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -3637,6 +4089,20 @@ "node": ">=0.10.0" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.1.0.tgz", + "integrity": "sha512-Rq7ybcX2RuC55r9oaPVEW7/xu3tj8u4GeBYHBWCychFtzMIr86A7e3PPEBPT37sHStKX3+TiX/Fr/ACmJLVlLQ==", + "dev": true, + "license": "MIT" + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -3664,16 +4130,16 @@ } }, "node_modules/tailwindcss": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.2.1.tgz", - "integrity": "sha512-/tBrSQ36vCleJkAOsy9kbNTgaxvGbyOamC30PRePTQe/o1MFwEKHQk4Cn7BNGaPtjp+PuUrByJehM1hgxfq4sw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.0.tgz", + "integrity": "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q==", "dev": true, "license": "MIT" }, "node_modules/tapable": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", - "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", "dev": true, "license": "MIT", "engines": { @@ -3684,15 +4150,32 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "dev": true, "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -3701,10 +4184,20 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tinyrainbow": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz", + "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/ts-api-utils": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", - "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", "dev": true, "license": "MIT", "engines": { @@ -3742,16 +4235,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.56.1.tgz", - "integrity": "sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.60.1.tgz", + "integrity": "sha512-6m5hkkRAp8lKvhVpcprAIn5KkehQEh+47oHH2VGnExEh7dhNxXlg6GPAOIu6TxbVQxhebrJDvjl3020ooiWCMA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.56.1", - "@typescript-eslint/parser": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/utils": "8.56.1" + "@typescript-eslint/eslint-plugin": "8.60.1", + "@typescript-eslint/parser": "8.60.1", + "@typescript-eslint/typescript-estree": "8.60.1", + "@typescript-eslint/utils": "8.60.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3762,13 +4255,13 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", + "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", "dev": true, "license": "MIT" }, @@ -3814,9 +4307,9 @@ } }, "node_modules/vite": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", - "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "dev": true, "license": "MIT", "dependencies": { @@ -3888,6 +4381,96 @@ } } }, + "node_modules/vitest": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.8.tgz", + "integrity": "sha512-flY6ScbCIt9HThs+C5HS7jvGOB560DJtk/Z15IQROTA6zEy49Nh8T/dofWTQL+n3vswqn87sbJNiuqw1SDp5Ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.8", + "@vitest/mocker": "4.1.8", + "@vitest/pretty-format": "4.1.8", + "@vitest/runner": "4.1.8", + "@vitest/snapshot": "4.1.8", + "@vitest/spy": "4.1.8", + "@vitest/utils": "4.1.8", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.8", + "@vitest/browser-preview": "4.1.8", + "@vitest/browser-webdriverio": "4.1.8", + "@vitest/coverage-istanbul": "4.1.8", + "@vitest/coverage-v8": "4.1.8", + "@vitest/ui": "4.1.8", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3904,6 +4487,23 @@ "node": ">= 8" } }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -3935,9 +4535,9 @@ } }, "node_modules/zod": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", - "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "dev": true, "license": "MIT", "funding": { diff --git a/package.json b/package.json index 40594cb..e61b0a5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,10 @@ "dev": "vite", "build": "tsc -b && vite build && cp docs/index.html docs/404.html && touch docs/.nojekyll", "lint": "eslint .", - "preview": "vite preview" + "preview": "vite preview", + "test": "vitest run", + "test:watch": "vitest", + "test:coverage": "vitest run --coverage" }, "dependencies": { "lucide-react": "^0.575.0", @@ -22,6 +25,7 @@ "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^5.1.1", + "@vitest/coverage-v8": "^4.1.8", "eslint": "^9.39.1", "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.4.24", @@ -29,6 +33,7 @@ "tailwindcss": "^4.2.1", "typescript": "~5.9.3", "typescript-eslint": "^8.48.0", - "vite": "^7.3.1" + "vite": "^7.3.1", + "vitest": "^4.1.8" } } diff --git a/src/features/algorithms/linked-list/algorithms/__tests__/linkedListAlgorithms.test.ts b/src/features/algorithms/linked-list/algorithms/__tests__/linkedListAlgorithms.test.ts new file mode 100644 index 0000000..57c9272 --- /dev/null +++ b/src/features/algorithms/linked-list/algorithms/__tests__/linkedListAlgorithms.test.ts @@ -0,0 +1,177 @@ +import { describe, expect, it } from 'vitest'; +import { buildLinkedListSteps } from '@/features/algorithms/linked-list/algorithms/linkedListAlgorithms'; +import type { LLProblem, LLStep } from '@/features/algorithms/linked-list/types/linkedListAlgo'; + +const last = (steps: LLStep[]) => steps[steps.length - 1]; +const finalValues = (steps: LLStep[]) => last(steps).nodes.map((n) => n.value); + +describe('linked-list algorithms', () => { + describe('shared invariants', () => { + const problems: { problem: LLProblem; input: string }[] = [ + { problem: 'find-middle', input: '10,20,30,40,50' }, + { problem: 'reverse-list', input: '1,2,3,4' }, + { problem: 'add-two-numbers', input: '342; 465' }, + { problem: 'reverse-k-group', input: '1,2,3,4,5,6,7; 3' }, + { problem: 'palindrome', input: '1,2,3,2,1' }, + { problem: 'lru-cache', input: '2; put 1 100, get 1, put 2 200, put 3 300, get 2' }, + { problem: 'segregate', input: '1,2,3,4,5,6' }, + { problem: 'detect-cycle', input: '1,2,3,4,5; 2' }, + { problem: 'sort-list', input: '5,3,8,1,9,2' }, + ]; + + for (const { problem, input } of problems) { + it(`${problem}: produces non-empty steps ending with done=true`, () => { + const steps = buildLinkedListSteps(problem, input); + expect(steps.length).toBeGreaterThan(0); + expect(last(steps).done).toBe(true); + }); + + it(`${problem}: every step has a description and event`, () => { + for (const step of buildLinkedListSteps(problem, input)) { + expect(step.description.length).toBeGreaterThan(0); + expect(step.event).toBeTruthy(); + } + }); + } + + it('returns [] for an unknown problem', () => { + expect(buildLinkedListSteps('does-not-exist' as LLProblem, '1,2,3')).toEqual([]); + }); + }); + + describe('find-middle (tortoise & hare)', () => { + const middleValue = (steps: LLStep[]) => { + const step = last(steps); + const ptr = step.pointers.find((p) => p.name === 'middle'); + return ptr ? step.nodes[ptr.index].value : undefined; + }; + + it('odd length → exact middle', () => { + expect(middleValue(buildLinkedListSteps('find-middle', '10,20,30,40,50'))).toBe(30); + }); + + it('even length → upper middle', () => { + expect(middleValue(buildLinkedListSteps('find-middle', '10,20,30,40'))).toBe(30); + }); + + it('single-element input → that element is the middle', () => { + expect(middleValue(buildLinkedListSteps('find-middle', '42'))).toBe(42); + }); + }); + + describe('reverse-list', () => { + it('reverses values', () => { + expect(finalValues(buildLinkedListSteps('reverse-list', '1,2,3,4,5'))).toEqual([5, 4, 3, 2, 1]); + }); + + it('single node unchanged', () => { + expect(finalValues(buildLinkedListSteps('reverse-list', '7'))).toEqual([7]); + }); + + it('two nodes swap', () => { + expect(finalValues(buildLinkedListSteps('reverse-list', '1,2'))).toEqual([2, 1]); + }); + }); + + describe('add-two-numbers (digits least-significant first)', () => { + it('342 + 465 = 807 → [7,0,8]', () => { + expect(finalValues(buildLinkedListSteps('add-two-numbers', '342; 465'))).toEqual([7, 0, 8]); + }); + + it('carry overflow 99 + 1 = 100 → [0,0,1]', () => { + expect(finalValues(buildLinkedListSteps('add-two-numbers', '99; 1'))).toEqual([0, 0, 1]); + }); + + it('different lengths 5 + 999 = 1004 → [4,0,0,1]', () => { + expect(finalValues(buildLinkedListSteps('add-two-numbers', '5; 999'))).toEqual([4, 0, 0, 1]); + }); + }); + + describe('reverse-k-group', () => { + it('reverses each full group of k, leaving the trailing partial group', () => { + expect(finalValues(buildLinkedListSteps('reverse-k-group', '1,2,3,4,5,6,7; 3'))).toEqual([3, 2, 1, 6, 5, 4, 7]); + }); + + it('k = 2 over an even list', () => { + expect(finalValues(buildLinkedListSteps('reverse-k-group', '1,2,3,4; 2'))).toEqual([2, 1, 4, 3]); + }); + + it('k larger than list leaves it unchanged', () => { + expect(finalValues(buildLinkedListSteps('reverse-k-group', '1,2,3; 5'))).toEqual([1, 2, 3]); + }); + }); + + describe('palindrome', () => { + it('detects a palindrome', () => { + expect(last(buildLinkedListSteps('palindrome', '1,2,3,2,1')).event).toBe('found'); + }); + + it('rejects a non-palindrome', () => { + expect(last(buildLinkedListSteps('palindrome', '1,2,3,4')).event).toBe('not-found'); + }); + + it('empty list is a palindrome', () => { + expect(last(buildLinkedListSteps('palindrome', '')).event).toBe('found'); + }); + }); + + describe('segregate even/odd', () => { + it('evens (preserving order) before odds', () => { + expect(finalValues(buildLinkedListSteps('segregate', '17,15,8,12,10,5,4,1,7,6'))) + .toEqual([8, 12, 10, 4, 6, 17, 15, 5, 1, 7]); + }); + + it('all even stays in order', () => { + expect(finalValues(buildLinkedListSteps('segregate', '2,4,6'))).toEqual([2, 4, 6]); + }); + }); + + describe('sort-list (merge sort)', () => { + it('sorts ascending', () => { + expect(finalValues(buildLinkedListSteps('sort-list', '40,10,70,30,90,20'))).toEqual([10, 20, 30, 40, 70, 90]); + }); + + it('handles duplicates', () => { + expect(finalValues(buildLinkedListSteps('sort-list', '3,1,3,2,1'))).toEqual([1, 1, 2, 3, 3]); + }); + + it('single element', () => { + expect(finalValues(buildLinkedListSteps('sort-list', '5'))).toEqual([5]); + }); + }); + + describe('detect-cycle (Floyd)', () => { + it('detects and removes a cycle', () => { + const steps = buildLinkedListSteps('detect-cycle', '1,2,3,4,5; 2'); + expect(last(steps).event).toBe('complete'); + expect(last(steps).cycleTo).toBeNull(); + }); + + it('reports no cycle for an acyclic list', () => { + const steps = buildLinkedListSteps('detect-cycle', '1,2,3,4,5; -1'); + expect(last(steps).event).toBe('not-found'); + }); + }); + + describe('lru-cache', () => { + it('evicts the least-recently-used entry when full', () => { + // capacity 2; after put1,put2,get1,put3 → key 2 should be evicted. + const steps = buildLinkedListSteps('lru-cache', '2; put 1 100, put 2 200, get 1, put 3 300'); + const finalEntries = last(steps).lru?.entries ?? []; + const keys = finalEntries.map((e) => e.key).sort((a, b) => a - b); + expect(keys).toEqual([1, 3]); + }); + + it('most-recently-used sits at the front', () => { + const steps = buildLinkedListSteps('lru-cache', '2; put 1 100, put 2 200, get 1'); + expect(last(steps).lru?.entries[0].key).toBe(1); + }); + + it('respects capacity at all times', () => { + const steps = buildLinkedListSteps('lru-cache', '2; put 1 1, put 2 2, put 3 3, put 4 4'); + for (const step of steps) { + if (step.lru) expect(step.lru.entries.length).toBeLessThanOrEqual(2); + } + }); + }); +}); diff --git a/src/features/algorithms/linked-list/algorithms/__tests__/randomInput.test.ts b/src/features/algorithms/linked-list/algorithms/__tests__/randomInput.test.ts new file mode 100644 index 0000000..043c633 --- /dev/null +++ b/src/features/algorithms/linked-list/algorithms/__tests__/randomInput.test.ts @@ -0,0 +1,111 @@ +import { describe, expect, it } from 'vitest'; +import { randomInputFor } from '@/features/algorithms/linked-list/algorithms/randomInput'; +import { buildLinkedListSteps } from '@/features/algorithms/linked-list/algorithms/linkedListAlgorithms'; +import type { LLProblem } from '@/features/algorithms/linked-list/types/linkedListAlgo'; + +const ALL_PROBLEMS: LLProblem[] = [ + 'find-middle', + 'reverse-list', + 'add-two-numbers', + 'reverse-k-group', + 'palindrome', + 'lru-cache', + 'segregate', + 'detect-cycle', + 'sort-list', +]; + +const parseList = (csv: string) => + csv.split(',').map((s) => Number(s.trim())).filter((n) => Number.isFinite(n)); + +describe('randomInputFor', () => { + // Run each branch many times to defeat the internal Math.random() coin-flips. + describe('returns a non-empty string for every problem (×40 each)', () => { + for (const problem of ALL_PROBLEMS) { + it(problem, () => { + for (let i = 0; i < 40; i += 1) { + const input = randomInputFor(problem); + expect(typeof input).toBe('string'); + expect(input.length).toBeGreaterThan(0); + } + }); + } + }); + + describe('output feeds back into the step builder and terminates', () => { + for (const problem of ALL_PROBLEMS) { + it(problem, () => { + for (let i = 0; i < 25; i += 1) { + const steps = buildLinkedListSteps(problem, randomInputFor(problem)); + expect(steps.length).toBeGreaterThan(0); + expect(steps[steps.length - 1].done).toBe(true); + } + }); + } + }); + + describe('plain list problems → comma-separated numbers within bounds', () => { + for (const problem of ['find-middle', 'segregate', 'sort-list'] as LLProblem[]) { + it(problem, () => { + for (let i = 0; i < 30; i += 1) { + const values = parseList(randomInputFor(problem)); + expect(values.length).toBeGreaterThan(0); + for (const v of values) { + expect(v).toBeGreaterThanOrEqual(1); + expect(v).toBeLessThanOrEqual(99); + } + } + }); + } + }); + + it('palindrome: eventually emits an actual palindrome', () => { + const isPalindrome = (csv: string) => { + const v = parseList(csv); + return v.join(',') === [...v].reverse().join(','); + }; + const outputs = Array.from({ length: 50 }, () => randomInputFor('palindrome')); + expect(outputs.some(isPalindrome)).toBe(true); + }); + + it('lru-cache: capacity prefix plus get/put ops', () => { + for (let i = 0; i < 30; i += 1) { + const out = randomInputFor('lru-cache'); + const [capRaw, opsRaw] = out.split(';'); + const capacity = Number(capRaw.trim()); + expect(capacity).toBeGreaterThanOrEqual(2); + expect(capacity).toBeLessThanOrEqual(3); + const ops = opsRaw.split(',').map((s) => s.trim()); + expect(ops.length).toBeGreaterThan(0); + for (const op of ops) { + expect(/^(get|put)\s+\d+(\s+\d+)?$/.test(op)).toBe(true); + } + } + }); + + it('detect-cycle: list plus a cycle position (-1 or a valid index)', () => { + let sawCycle = false; + let sawNoCycle = false; + for (let i = 0; i < 60; i += 1) { + const out = randomInputFor('detect-cycle'); + const [valuesRaw, posRaw] = out.split(';'); + const values = parseList(valuesRaw); + const pos = Number(posRaw.trim()); + expect(values.length).toBeGreaterThan(0); + if (pos === -1) { + sawNoCycle = true; + } else { + sawCycle = true; + expect(pos).toBeGreaterThanOrEqual(0); + expect(pos).toBeLessThan(values.length); + } + } + expect(sawCycle).toBe(true); + expect(sawNoCycle).toBe(true); + }); + + it('falls back to a default list for unknown problems', () => { + const values = parseList(randomInputFor('mystery' as LLProblem)); + expect(values).toHaveLength(6); + }); +}); diff --git a/src/features/algorithms/linked-list/algorithms/linkedListAlgorithms.ts b/src/features/algorithms/linked-list/algorithms/linkedListAlgorithms.ts index 208fdef..0e83759 100644 --- a/src/features/algorithms/linked-list/algorithms/linkedListAlgorithms.ts +++ b/src/features/algorithms/linked-list/algorithms/linkedListAlgorithms.ts @@ -60,7 +60,16 @@ function findMiddleSteps(values: number[]): LLStep[] { } steps.push({ - description: 'Start: place both slow and fast pointers on the head node.', + description: 'Set slow = head (index 0).', + event: 'visit', + nodes: snap(nodes), + pointers: [{ name: 'slow', index: 0, color: 'green' }], + highlights: [{ index: 0, color: 'blue' }], + meta: ['slow = head'], + codeLine: 1, + }); + steps.push({ + description: 'Set fast = head (index 0). Both pointers start together.', event: 'visit', nodes: snap(nodes), pointers: [ @@ -69,17 +78,44 @@ function findMiddleSteps(values: number[]): LLStep[] { ], highlights: [{ index: 0, color: 'blue' }], meta: ['slow = head', 'fast = head'], - codeLine: 1, + codeLine: 2, }); let slow = 0; let fast = 0; // Tortoise & hare: advance while fast can take two real steps. while (fast + 2 <= n - 1) { + // line 3 — loop condition holds + steps.push({ + description: `Loop check: fast can move two nodes ahead (fast at index ${fast}). Enter the loop.`, + event: 'compare', + nodes: snap(nodes), + pointers: [ + { name: 'slow', index: slow, color: 'green' }, + { name: 'fast', index: fast, color: 'red' }, + ], + highlights: [{ index: slow, color: 'green' }, { index: fast, color: 'red' }], + meta: [`slow = ${slow}`, `fast = ${fast}`], + codeLine: 3, + }); + // line 4 — slow advances one slow += 1; + steps.push({ + description: `slow = slow.next → index ${slow} (value ${nodes[slow].value}). slow walks 1 step.`, + event: 'visit', + nodes: snap(nodes), + pointers: [ + { name: 'slow', index: slow, color: 'green' }, + { name: 'fast', index: fast, color: 'red' }, + ], + highlights: [{ index: slow, color: 'green' }, { index: fast, color: 'red' }], + meta: [`slow = ${slow}`, `fast = ${fast}`], + codeLine: 4, + }); + // line 5 — fast advances two fast += 2; steps.push({ - description: `Move slow → index ${slow} (value ${nodes[slow].value}), fast → index ${fast} (value ${nodes[fast].value}). slow walks 1, fast walks 2.`, + description: `fast = fast.next.next → index ${fast} (value ${nodes[fast].value}). fast walks 2 steps.`, event: 'compare', nodes: snap(nodes), pointers: [ @@ -88,15 +124,27 @@ function findMiddleSteps(values: number[]): LLStep[] { ], highlights: [{ index: slow, color: 'green' }, { index: fast, color: 'red' }], meta: [`slow = ${slow}`, `fast = ${fast}`], - codeLine: 4, + codeLine: 5, }); } // One more slow step if fast still has a single node ahead (even length). if (fast + 1 === n - 1) { + steps.push({ + description: `Loop check: fast has a single node ahead — take one more paired step.`, + event: 'compare', + nodes: snap(nodes), + pointers: [ + { name: 'slow', index: slow, color: 'green' }, + { name: 'fast', index: fast, color: 'red' }, + ], + highlights: [{ index: slow, color: 'green' }, { index: fast, color: 'red' }], + meta: [`slow = ${slow}`, `fast = ${fast}`], + codeLine: 3, + }); slow += 1; fast += 1; steps.push({ - description: `fast has one node left → take a final step: slow → ${slow} (${nodes[slow].value}), fast → ${fast} (${nodes[fast].value}).`, + description: `slow → ${slow} (${nodes[slow].value}); fast → ${fast} (${nodes[fast].value}).`, event: 'compare', nodes: snap(nodes), pointers: [ @@ -143,14 +191,23 @@ function reverseListSteps(values: number[]): LLStep[] { const steps: LLStep[] = []; steps.push({ - description: 'Start: prev = null, curr = head. We walk the list once, flipping each next pointer to point backwards.', + description: 'Set prev = null. This will become the new head once we finish.', event: 'visit', nodes: snap(nodes), pointers: [{ name: 'curr', index: 0, color: 'yellow' }], highlights: [{ index: 0, color: 'blue' }], - meta: ['prev = null', 'curr = head'], + meta: ['prev = null'], codeLine: 1, }); + steps.push({ + description: 'Set curr = head. We walk the list once, flipping each next pointer to point backwards.', + event: 'visit', + nodes: snap(nodes), + pointers: [{ name: 'curr', index: 0, color: 'yellow' }], + highlights: [{ index: 0, color: 'blue' }], + meta: ['prev = null', 'curr = head'], + codeLine: 2, + }); // `processed` holds the already-reversed nodes (head-first = most-recent first). // The conceptual list at any moment is `processed` followed by the untouched tail. @@ -160,15 +217,39 @@ function reverseListSteps(values: number[]): LLStep[] { // visual order BEFORE flip: reversed(processed) ++ remaining(nodes[i..]) const before = [...processed].reverse().concat(nodes.slice(i)); const currIdxBefore = processed.length; // curr sits right after the reversed prefix + const prevPointer = processed.length + ? [{ name: 'prev', index: currIdxBefore - 1, color: 'green' as const }] + : []; + const nextPointer = i + 1 < n + ? [{ name: 'next', index: currIdxBefore + 1, color: 'red' as const }] + : []; + + // line 3 — loop condition (curr is non-null) + steps.push({ + description: `Loop check: curr = ${node.value} (not null) → enter the loop.`, + event: 'compare', + nodes: snap(before), + pointers: [...prevPointer, { name: 'curr', index: currIdxBefore, color: 'yellow' as const }], + highlights: [{ index: currIdxBefore, color: 'yellow' }], + meta: [`reversed = [${[...processed].reverse().map((p) => p.value).join(', ')}]`], + codeLine: 3, + }); + // line 4 — remember next + steps.push({ + description: `Remember next = ${i + 1 < n ? nodes[i + 1].value : 'null'} before we overwrite curr.next.`, + event: 'visit', + nodes: snap(before), + pointers: [...prevPointer, { name: 'curr', index: currIdxBefore, color: 'yellow' as const }, ...nextPointer], + highlights: [{ index: currIdxBefore, color: 'yellow' }], + meta: [`reversed = [${[...processed].reverse().map((p) => p.value).join(', ')}]`], + codeLine: 4, + }); + // line 5 — flip the link steps.push({ - description: `Remember next = ${i + 1 < n ? nodes[i + 1].value : 'null'}; flip curr (${node.value}) → point at prev (${processed.length ? processed[processed.length - 1].value : 'null'}).`, + description: `Flip curr (${node.value}) → point at prev (${processed.length ? processed[processed.length - 1].value : 'null'}).`, event: 'swap', nodes: snap(before), - pointers: [ - ...(processed.length ? [{ name: 'prev', index: currIdxBefore - 1, color: 'green' as const }] : []), - { name: 'curr', index: currIdxBefore, color: 'yellow' as const }, - ...(i + 1 < n ? [{ name: 'next', index: currIdxBefore + 1, color: 'red' as const }] : []), - ], + pointers: [...prevPointer, { name: 'curr', index: currIdxBefore, color: 'yellow' as const }, ...nextPointer], highlights: [{ index: currIdxBefore, color: 'yellow' }], meta: [`reversed = [${[...processed].reverse().map((p) => p.value).join(', ')}]`], codeLine: 5, @@ -177,8 +258,22 @@ function reverseListSteps(values: number[]): LLStep[] { // perform the flip: node becomes the new front of the reversed chain processed.push(node); const after = [...processed].reverse().concat(nodes.slice(i + 1)); + // line 6 — advance prev steps.push({ - description: `Advance: prev = ${node.value}, curr = ${i + 1 < n ? nodes[i + 1].value : 'null'}. Reversed prefix is now [${[...processed].reverse().map((p) => p.value).join(', ')}].`, + description: `Advance prev = ${node.value}. Reversed prefix is now [${[...processed].reverse().map((p) => p.value).join(', ')}].`, + event: 'visit', + nodes: snap(after), + pointers: [ + { name: 'prev', index: 0, color: 'green' }, + ...(i + 1 < n ? [{ name: 'curr', index: processed.length, color: 'yellow' as const }] : []), + ], + highlights: [{ index: 0, color: 'green' }], + meta: [`reversed = [${[...processed].reverse().map((p) => p.value).join(', ')}]`], + codeLine: 6, + }); + // line 7 — advance curr + steps.push({ + description: `Advance curr = ${i + 1 < n ? nodes[i + 1].value : 'null'}.`, event: 'visit', nodes: snap(after), pointers: [ @@ -230,6 +325,15 @@ function addTwoNumbersSteps(input: string): LLStep[] { pointers: [], highlights: [], meta: [aStr, bStr, 'carry = 0'], + codeLine: 1, + }); + steps.push({ + description: 'Initialise carry = 0 before walking both digit lists.', + event: 'visit', + nodes: [], + pointers: [], + highlights: [], + meta: [aStr, bStr, 'carry = 0'], codeLine: 2, }); @@ -238,18 +342,98 @@ function addTwoNumbersSteps(input: string): LLStep[] { for (let i = 0; i < len || carry > 0; i += 1) { const da = a[i] ?? 0; const db = b[i] ?? 0; - const sum = da + db + carry; - const digit = sum % 10; + const carryIn = carry; + const hasA = i < a.length; + const hasB = i < b.length; + const tailIndex = result.length - 1; // tail position so far (-1 before first push) + const tailPointer = tailIndex >= 0 ? [{ name: 'tail', index: tailIndex, color: 'green' as const }] : []; + const tailHighlight = tailIndex >= 0 ? [{ index: tailIndex, color: 'blue' as const }] : []; + + // line 3 — loop condition check + steps.push({ + description: `Loop check: ${hasA ? 'A has a digit' : 'A exhausted'}, ${hasB ? 'B has a digit' : 'B exhausted'}, carry = ${carryIn}. Continue.`, + event: 'visit', + nodes: snap(result), + pointers: tailPointer, + highlights: tailHighlight, + meta: [aStr, bStr, `carry = ${carryIn}`], + codeLine: 3, + }); + + // line 4 — sum = carry + let sum = carryIn; + steps.push({ + description: `Start this position's sum with the incoming carry: sum = ${carryIn}.`, + event: 'visit', + nodes: snap(result), + pointers: tailPointer, + highlights: tailHighlight, + meta: [aStr, bStr, `sum = ${sum}`, `carry = ${carryIn}`], + codeLine: 4, + }); + + // line 5 — add A's digit + sum += da; + steps.push({ + description: hasA + ? `A has digit ${da} at this position → sum += ${da} = ${sum}; advance A.` + : `A is exhausted at this position → nothing to add. sum = ${sum}.`, + event: 'compare', + nodes: snap(result), + pointers: tailPointer, + highlights: tailHighlight, + meta: [aStr, bStr, `sum = ${sum}`, `carry = ${carryIn}`], + codeLine: 5, + }); + + // line 6 — add B's digit + sum += db; + steps.push({ + description: hasB + ? `B has digit ${db} at this position → sum += ${db} = ${sum}; advance B.` + : `B is exhausted at this position → nothing to add. sum = ${sum}.`, + event: 'compare', + nodes: snap(result), + pointers: tailPointer, + highlights: tailHighlight, + meta: [aStr, bStr, `sum = ${sum}`, `carry = ${carryIn}`], + codeLine: 6, + }); + + // line 7 — compute new carry carry = Math.floor(sum / 10); + const digit = sum % 10; + steps.push({ + description: `carry = floor(${sum} / 10) = ${carry}.`, + event: 'compare', + nodes: snap(result), + pointers: tailPointer, + highlights: tailHighlight, + meta: [aStr, bStr, `sum = ${sum}`, `carry = ${carry}`], + codeLine: 7, + }); + + // line 8 — append the new digit node result.push({ id: nodeSeq++, value: digit }); steps.push({ - description: `Position ${i}: ${da} + ${db} + carry ${sum - da - db} = ${sum} → write digit ${digit}, carry ${carry}.`, - event: carry > 0 ? 'compare' : 'push', + description: `Append a node with digit sum % 10 = ${digit}.`, + event: 'push', nodes: snap(result), pointers: [{ name: 'tail', index: result.length - 1, color: 'green' }], - highlights: [{ index: result.length - 1, color: carry > 0 ? 'yellow' : 'green' }], + highlights: [{ index: result.length - 1, color: 'green' }], meta: [aStr, bStr, `sum = ${sum}`, `carry = ${carry}`], - codeLine: carry > 0 ? 7 : 8, + codeLine: 8, + }); + + // line 9 — advance tail + steps.push({ + description: `Advance tail to the node just appended (digit ${digit}).`, + event: 'visit', + nodes: snap(result), + pointers: [{ name: 'tail', index: result.length - 1, color: 'green' }], + highlights: [{ index: result.length - 1, color: 'blue' }], + meta: [aStr, bStr, `carry = ${carry}`], + codeLine: 9, }); } @@ -300,11 +484,21 @@ function reverseKGroupSteps(input: string): LLStep[] { let groupNo = 0; while (g + k <= n) { groupNo += 1; - // Highlight the group we're about to reverse. + // line 3 — while true (we have a group to process) steps.push({ - description: `Group ${groupNo}: indices ${g}…${g + k - 1} form a full block of ${k} — reverse it in place.`, + description: `Group ${groupNo}: look k = ${k} nodes ahead from index ${g}.`, event: 'recurse', nodes: snap(order), + pointers: [{ name: 'start', index: g, color: 'green' }], + highlights: range(g, Math.min(g + k, n)).map((i) => ({ index: i, color: 'blue' as const })), + meta: [`group ${groupNo}`], + codeLine: 3, + }); + // line 4 — find kth node + steps.push({ + description: `kth node of this group is at index ${g + k - 1} (value ${order[g + k - 1].value}).`, + event: 'compare', + nodes: snap(order), pointers: [ { name: 'start', index: g, color: 'green' }, { name: 'kth', index: g + k - 1, color: 'red' }, @@ -313,14 +507,39 @@ function reverseKGroupSteps(input: string): LLStep[] { meta: [`group ${groupNo}`], codeLine: 4, }); + // line 8 — begin reversing the group in place + steps.push({ + description: `Full block of ${k} found → reverse indices ${g}…${g + k - 1} in place.`, + event: 'visit', + nodes: snap(order), + pointers: [ + { name: 'start', index: g, color: 'green' }, + { name: 'kth', index: g + k - 1, color: 'red' }, + ], + highlights: range(g, g + k).map((i) => ({ index: i, color: 'yellow' as const })), + codeLine: 8, + }); // Iterative two-pointer reversal of order[g .. g+k), one swap per step. let i = g; let j = g + k - 1; while (i < j) { + // line 9 — inner loop condition + steps.push({ + description: `Reverse loop: pointers at indices ${i} and ${j} have not met — keep going.`, + event: 'compare', + nodes: snap(order), + pointers: [ + { name: 'i', index: i, color: 'green' }, + { name: 'j', index: j, color: 'red' }, + ], + highlights: [{ index: i, color: 'yellow' }, { index: j, color: 'yellow' }], + codeLine: 9, + }); const tmp = order[i]; order[i] = order[j]; order[j] = tmp; + // line 10 — flip the links (modelled as a swap of the two ends) steps.push({ description: `Reverse step: swap nodes at indices ${i} (${order[i].value}) and ${j} (${order[j].value}).`, event: 'swap', @@ -330,14 +549,26 @@ function reverseKGroupSteps(input: string): LLStep[] { { name: 'j', index: j, color: 'red' }, ], highlights: [{ index: i, color: 'green' }, { index: j, color: 'red' }], - codeLine: 11, + codeLine: 10, }); i += 1; j -= 1; + // line 11 — advance the reversal pointers + steps.push({ + description: `Advance reversal pointers inward → indices ${i} and ${j}.`, + event: 'visit', + nodes: snap(order), + pointers: i <= j + ? [{ name: 'i', index: i, color: 'green' }, { name: 'j', index: j, color: 'red' }] + : [], + highlights: range(g, g + k).map((idx) => ({ index: idx, color: 'yellow' as const })), + codeLine: 11, + }); } + // line 13 — relink the reversed group into the result steps.push({ - description: `Group ${groupNo} reversed → [${order.slice(g, g + k).map((o) => o.value).join(', ')}].`, + description: `Group ${groupNo} reversed → [${order.slice(g, g + k).map((o) => o.value).join(', ')}]. Relink it and move groupPrev forward.`, event: 'visit', nodes: snap(order), pointers: [], @@ -349,8 +580,17 @@ function reverseKGroupSteps(input: string): LLStep[] { } if (g < n) { + // line 3 — loop check, then line 5 — kth is null, break + steps.push({ + description: `Look k = ${k} nodes ahead from index ${g}…`, + event: 'compare', + nodes: snap(order), + pointers: [{ name: 'rest', index: g, color: 'yellow' }], + highlights: range(g, n).map((idx) => ({ index: idx, color: 'blue' as const })), + codeLine: 4, + }); steps.push({ - description: `Remaining indices ${g}…${n - 1} are fewer than k = ${k} — leave this trailing group as-is.`, + description: `Remaining indices ${g}…${n - 1} are fewer than k = ${k} — kth is null, so break and leave them as-is.`, event: 'compare', nodes: snap(order), pointers: [{ name: 'rest', index: g, color: 'yellow' }], @@ -397,6 +637,19 @@ function palindromeSteps(values: number[]): LLStep[] { let slow = 0; let fast = 0; while (fast + 2 <= n - 1) { + // line 3 — loop condition + steps.push({ + description: `Loop check: fast can move two nodes ahead (fast at index ${fast}). Continue scanning for the middle.`, + event: 'compare', + nodes: snap(nodes), + pointers: [ + { name: 'slow', index: slow, color: 'green' }, + { name: 'fast', index: fast, color: 'red' }, + ], + highlights: [{ index: slow, color: 'green' }, { index: fast, color: 'red' }], + codeLine: 3, + }); + // line 4 — advance both slow += 1; fast += 2; steps.push({ @@ -431,12 +684,12 @@ function palindromeSteps(values: number[]): LLStep[] { const reordered = [...head, ...tail]; steps.push({ - description: 'Second half reversed. Now compare the front half and the reversed back half moving inward.', + description: 'Second half reversed. Set p = head, q = second (start of reversed half). Compare moving inward.', event: 'swap', nodes: snap(reordered), pointers: [ - { name: 'left', index: 0, color: 'green' }, - { name: 'right', index: n - 1, color: 'red' }, + { name: 'p', index: 0, color: 'green' }, + { name: 'q', index: secondStart, color: 'red' }, ], highlights: Array.from({ length: tail.length }, (_, i) => ({ index: head.length + i, color: 'purple' as const })), codeLine: 8, @@ -452,13 +705,26 @@ function palindromeSteps(values: number[]): LLStep[] { const a = reordered[left].value; const b = reordered[right].value; const match = a === b; + // line 9 — loop condition (q still valid) steps.push({ - description: `Compare front[${left}] = ${a} with reversed-back[${right}] = ${b} → ${match ? 'match ✓' : 'mismatch ✗'}.`, + description: `Loop check: q points at index ${right} (still within the reversed half) — compare this pair.`, + event: 'compare', + nodes: snap(reordered), + pointers: [ + { name: 'p', index: left, color: 'green' }, + { name: 'q', index: right, color: 'red' }, + ], + highlights: [{ index: left, color: 'yellow' }, { index: right, color: 'yellow' }], + codeLine: 9, + }); + // line 10 — compare values + steps.push({ + description: `Compare p[${left}] = ${a} with q[${right}] = ${b} → ${match ? 'match ✓' : 'mismatch ✗ → return false'}.`, event: match ? 'compare' : 'not-found', nodes: snap(reordered), pointers: [ - { name: 'left', index: left, color: 'green' }, - { name: 'right', index: right, color: 'red' }, + { name: 'p', index: left, color: 'green' }, + { name: 'q', index: right, color: 'red' }, ], highlights: [ { index: left, color: match ? 'green' : 'red' }, @@ -467,6 +733,20 @@ function palindromeSteps(values: number[]): LLStep[] { codeLine: 10, }); if (!match) { isPalindrome = false; break; } + // line 11 — advance both pointers + if (k + 1 < compareCount) { + steps.push({ + description: `Match — advance p → ${left + 1}, q → ${right + 1}.`, + event: 'visit', + nodes: snap(reordered), + pointers: [ + { name: 'p', index: left + 1, color: 'green' }, + { name: 'q', index: right + 1, color: 'red' }, + ], + highlights: [{ index: left + 1, color: 'yellow' }, { index: right + 1, color: 'yellow' }], + codeLine: 11, + }); + } } steps.push({ @@ -582,6 +862,34 @@ function segregateSteps(values: number[]): LLStep[] { pointers: [{ name: 'curr', index: 0, color: 'yellow' }], highlights: [{ index: 0, color: 'blue' }], meta: ['evens = [ ]', 'odds = [ ]'], + codeLine: 0, + }); + + steps.push({ + description: 'Create an empty evens chain to collect even-valued nodes.', + event: 'visit', + nodes: snap(nodes), + pointers: [{ name: 'curr', index: 0, color: 'yellow' }], + highlights: [{ index: 0, color: 'blue' }], + meta: ['evens = [ ]'], + codeLine: 1, + }); + steps.push({ + description: 'Create an empty odds chain to collect odd-valued nodes.', + event: 'visit', + nodes: snap(nodes), + pointers: [{ name: 'curr', index: 0, color: 'yellow' }], + highlights: [{ index: 0, color: 'blue' }], + meta: ['evens = [ ]', 'odds = [ ]'], + codeLine: 2, + }); + steps.push({ + description: 'Set curr = head and scan the list once.', + event: 'visit', + nodes: snap(nodes), + pointers: [{ name: 'curr', index: 0, color: 'yellow' }], + highlights: [{ index: 0, color: 'blue' }], + meta: ['evens = [ ]', 'odds = [ ]'], codeLine: 3, }); @@ -590,9 +898,20 @@ function segregateSteps(values: number[]): LLStep[] { for (let i = 0; i < n; i += 1) { const node = nodes[i]; const isEven = node.value % 2 === 0; + // line 4 — loop condition + steps.push({ + description: `Loop check: curr = ${node.value} (index ${i}) is not null — process it.`, + event: 'visit', + nodes: snap(nodes), + pointers: [{ name: 'curr', index: i, color: 'yellow' }], + highlights: [{ index: i, color: 'blue' }], + meta: [`evens = [${evens.map((e) => e.value).join(', ')}]`, `odds = [${odds.map((o) => o.value).join(', ')}]`], + codeLine: 4, + }); + // line 5/6 — classify and append if (isEven) evens.push(node); else odds.push(node); steps.push({ - description: `Node ${node.value} at index ${i} is ${isEven ? 'EVEN → append to evens chain' : 'ODD → append to odds chain'}.`, + description: `Node ${node.value} is ${isEven ? 'EVEN → append to evens chain' : 'ODD → append to odds chain'}.`, event: 'compare', nodes: snap(nodes), pointers: [{ name: 'curr', index: i, color: 'yellow' }], @@ -600,6 +919,18 @@ function segregateSteps(values: number[]): LLStep[] { meta: [`evens = [${evens.map((e) => e.value).join(', ')}]`, `odds = [${odds.map((o) => o.value).join(', ')}]`], codeLine: isEven ? 5 : 6, }); + // line 7 — advance + steps.push({ + description: i + 1 < n + ? `Advance curr → index ${i + 1} (value ${nodes[i + 1].value}).` + : 'Advance curr → null. Scan complete.', + event: 'visit', + nodes: snap(nodes), + pointers: i + 1 < n ? [{ name: 'curr', index: i + 1, color: 'yellow' }] : [], + highlights: i + 1 < n ? [{ index: i + 1, color: 'blue' }] : [], + meta: [`evens = [${evens.map((e) => e.value).join(', ')}]`, `odds = [${odds.map((o) => o.value).join(', ')}]`], + codeLine: 7, + }); } const merged = [...evens, ...odds]; @@ -664,6 +995,19 @@ function detectCycleSteps(input: string): LLStep[] { const maxIter = n * 4 + 10; while (guard < maxIter) { guard += 1; + // line 3 — loop condition + steps.push({ + description: `Loop check: fast (index ${fast}) and its next exist — take a paired step.`, + event: 'compare', + nodes: snap(nodes), + pointers: [ + { name: 'slow', index: slow, color: 'green' }, + { name: 'fast', index: fast, color: 'red' }, + ], + highlights: [{ index: slow, color: 'green' }, { index: fast, color: 'red' }], + cycleTo, + codeLine: 3, + }); slow = next(slow); const f1 = next(fast); fast = f1 === -1 ? -1 : next(f1); @@ -758,7 +1102,7 @@ function detectCycleSteps(input: string): LLStep[] { highlights: [{ index: loopStart, color: 'yellow' }, { index: n - 1, color: 'red' }], cycleTo, meta: [`loop start = index ${loopStart}`, `loop length = ${len}`], - codeLine: 13, + codeLine: 12, }); steps.push({ description: 'Loop removed — the list is now a clean acyclic chain ending in null. ✓', @@ -813,8 +1157,20 @@ function sortListSteps(values: number[]): LLStep[] { // offset = where this segment starts in the global `order` array. const mergeSort = (lo: number, hi: number) => { - if (hi - lo <= 1) return; + if (hi - lo <= 1) { + // lines 1–2 — base case + steps.push({ + description: `Base case: indices ${lo}…${hi - 1} is a single node (${order[lo].value}) — already sorted, return it.`, + event: 'visit', + nodes: snap(order), + pointers: [], + highlights: lo < hi ? [{ index: lo, color: 'green' as const }] : [], + codeLine: 2, + }); + return; + } const mid = (lo + hi) >> 1; + // line 3 — split steps.push({ description: `Split indices ${lo}…${hi - 1} into [${lo}…${mid - 1}] and [${mid}…${hi - 1}].`, event: 'recurse', @@ -826,7 +1182,25 @@ function sortListSteps(values: number[]): LLStep[] { ], codeLine: 3, }); + // line 4 — sort the left half + steps.push({ + description: `Recurse on the left half: sortList(indices ${lo}…${mid - 1}).`, + event: 'recurse', + nodes: snap(order), + pointers: [], + highlights: range(lo, mid).map((i) => ({ index: i, color: 'green' as const })), + codeLine: 4, + }); mergeSort(lo, mid); + // line 5 — sort the right half + steps.push({ + description: `Recurse on the right half: sortList(indices ${mid}…${hi - 1}).`, + event: 'recurse', + nodes: snap(order), + pointers: [], + highlights: range(mid, hi).map((i) => ({ index: i, color: 'red' as const })), + codeLine: 5, + }); mergeSort(mid, hi); // Merge order[lo..mid) and order[mid..hi) @@ -843,6 +1217,7 @@ function sortListSteps(values: number[]): LLStep[] { while (j < right.length) { merged.push(right[j]); j += 1; } for (let k = 0; k < merged.length; k += 1) order[lo + k] = merged[k]; + // line 6 — merge sorted runs steps.push({ description: `Merge → [${merged.map((m) => m.value).join(', ')}] sorted into indices ${lo}…${hi - 1}.`, event: 'swap', diff --git a/src/features/sorting/algorithms/__tests__/sorting.test.ts b/src/features/sorting/algorithms/__tests__/sorting.test.ts new file mode 100644 index 0000000..91d14c5 --- /dev/null +++ b/src/features/sorting/algorithms/__tests__/sorting.test.ts @@ -0,0 +1,67 @@ +import { describe, expect, it } from 'vitest'; +import { runSortingAlgorithm } from '@/features/sorting/algorithms'; +import type { SortingAlgorithmType, SortingStep } from '@/features/sorting/types/sorting'; + +const ALGORITHMS: SortingAlgorithmType[] = ['bubble', 'selection', 'insertion', 'quick', 'heap', 'merge']; + +const CASES: { name: string; input: number[] }[] = [ + { name: 'empty array', input: [] }, + { name: 'single element', input: [42] }, + { name: 'already sorted', input: [1, 2, 3, 4, 5] }, + { name: 'reverse sorted', input: [5, 4, 3, 2, 1] }, + { name: 'duplicates', input: [3, 1, 3, 2, 1, 3, 2] }, + { name: 'negatives and zero', input: [0, -5, 3, -1, 2, -5] }, + { name: 'random-ish', input: [8, 3, 7, 1, 9, 2, 6, 4, 5] }, +]; + +function lastArray(steps: SortingStep[], original: number[]): number[] { + // No steps means the input was trivial (empty / single) — nothing to reorder. + return steps.length > 0 ? steps[steps.length - 1].array : [...original]; +} + +describe('sorting algorithms', () => { + for (const algo of ALGORITHMS) { + describe(algo, () => { + for (const { name, input } of CASES) { + it(`sorts: ${name}`, () => { + const expected = [...input].sort((a, b) => a - b); + const steps = runSortingAlgorithm(algo, input); + expect(lastArray(steps, input)).toEqual(expected); + }); + } + + it('does not mutate the input array', () => { + const input = [4, 2, 5, 1, 3]; + const copy = [...input]; + runSortingAlgorithm(algo, input); + expect(input).toEqual(copy); + }); + + it('every step snapshot is a permutation of the input', () => { + const input = [5, 3, 8, 1, 9, 2]; + const expectedMultiset = [...input].sort((a, b) => a - b); + const steps = runSortingAlgorithm(algo, input); + // Merge sort writes merged runs into scratch positions, so individual + // intermediate snapshots aren't permutations — only assert the final one. + const toCheck = algo === 'merge' ? steps.slice(-1) : steps; + for (const step of toCheck) { + expect([...step.array].sort((a, b) => a - b)).toEqual(expectedMultiset); + } + }); + + it('comparing/swapping indices stay in bounds', () => { + const input = [7, 2, 6, 1, 8, 3, 5]; + const steps = runSortingAlgorithm(algo, input); + for (const step of steps) { + for (const pair of [step.comparing, step.swapping]) { + if (!pair) continue; + for (const idx of pair) { + expect(idx).toBeGreaterThanOrEqual(0); + expect(idx).toBeLessThan(input.length); + } + } + } + }); + }); + } +}); diff --git a/src/features/traversals/graph/algorithms/__tests__/pathfinding.test.ts b/src/features/traversals/graph/algorithms/__tests__/pathfinding.test.ts new file mode 100644 index 0000000..d07a4d5 --- /dev/null +++ b/src/features/traversals/graph/algorithms/__tests__/pathfinding.test.ts @@ -0,0 +1,167 @@ +import { describe, expect, it } from 'vitest'; +import { runAlgorithm, bfs, dijkstra, astar } from '@/features/traversals/graph/algorithms'; +import type { AlgorithmType, GridMatrix, GridNode, Position } from '@/features/traversals/graph/types/graph'; +import { NodeType } from '@/features/traversals/graph/types/graph'; + +const ALL: AlgorithmType[] = ['bfs', 'dfs', 'dijkstra', 'astar']; +const OPTIMAL: AlgorithmType[] = ['bfs', 'dijkstra', 'astar']; + +function makeNode(row: number, col: number, wall: boolean): GridNode { + return { + row, + col, + type: wall ? NodeType.WALL : NodeType.EMPTY, + distance: Infinity, + heuristic: 0, + totalCost: Infinity, + parent: null, + isVisited: false, + }; +} + +/** + * Build a grid from an ASCII map. '#' = wall, '.' = open. + * Start/end are passed separately as positions. + */ +function gridFrom(rows: string[]): GridMatrix { + return rows.map((line, r) => [...line].map((ch, c) => makeNode(r, c, ch === '#'))); +} + +const pos = (row: number, col: number): Position => ({ row, col }); + +describe('graph pathfinding algorithms', () => { + it('finds a path on an open grid (all algorithms)', () => { + for (const algo of ALL) { + const grid = gridFrom(['....', '....', '....']); + const result = runAlgorithm(algo, grid, pos(0, 0), pos(2, 3)); + const path = result.shortestPath; + expect(path.length).toBeGreaterThan(0); + // Path endpoints must be correct. + expect(path[0]).toMatchObject({ row: 0, col: 0 }); + expect(path[path.length - 1]).toMatchObject({ row: 2, col: 3 }); + } + }); + + it('optimal algorithms find the shortest path length (Manhattan on open grid)', () => { + for (const algo of OPTIMAL) { + const grid = gridFrom(['....', '....', '....']); + const result = runAlgorithm(algo, grid, pos(0, 0), pos(2, 3)); + // Manhattan distance 5 → 6 nodes including both endpoints. + expect(result.shortestPath).toHaveLength(6); + } + }); + + it('path is contiguous (only orthogonal single steps)', () => { + for (const algo of ALL) { + const grid = gridFrom(['......', '.####.', '......']); + const { shortestPath } = runAlgorithm(algo, grid, pos(0, 0), pos(2, 5)); + for (let i = 1; i < shortestPath.length; i++) { + const a = shortestPath[i - 1]; + const b = shortestPath[i]; + const d = Math.abs(a.row - b.row) + Math.abs(a.col - b.col); + expect(d).toBe(1); + } + } + }); + + it('the path never crosses a wall', () => { + for (const algo of ALL) { + const grid = gridFrom(['......', '.####.', '......']); + const { shortestPath } = runAlgorithm(algo, grid, pos(0, 0), pos(2, 5)); + for (const node of shortestPath) { + expect(grid[node.row][node.col].type).not.toBe(NodeType.WALL); + } + } + }); + + it('returns no path when the target is walled off', () => { + // End at (1,2) fully enclosed by walls. + const grid = gridFrom(['.....', '.###.', '.#.#.', '.###.', '.....']); + for (const algo of ALL) { + const result = runAlgorithm(algo, grid, pos(0, 0), pos(2, 2)); + // shortestPath should not reach the unreachable target. + const last = result.shortestPath[result.shortestPath.length - 1]; + const reachedTarget = last && last.row === 2 && last.col === 2; + expect(reachedTarget).toBeFalsy(); + } + }); + + it('handles start === end', () => { + for (const algo of ALL) { + const grid = gridFrom(['...', '...']); + const result = runAlgorithm(algo, grid, pos(0, 0), pos(0, 0)); + expect(result.shortestPath[result.shortestPath.length - 1]).toMatchObject({ row: 0, col: 0 }); + } + }); + + it('routes around an obstacle requiring a detour', () => { + // Wall spanning the middle with one gap forces a specific longer route. + const grid = gridFrom(['.....', '####.', '.....']); + const result = runAlgorithm('bfs', grid, pos(0, 0), pos(2, 0)); + const { shortestPath } = result; + expect(shortestPath[0]).toMatchObject({ row: 0, col: 0 }); + expect(shortestPath[shortestPath.length - 1]).toMatchObject({ row: 2, col: 0 }); + // Must detour through the gap at column 4. + expect(shortestPath.some((n) => n.col === 4)).toBe(true); + }); + + it('visits nodes in non-decreasing distance order for BFS', () => { + const grid = gridFrom(['....', '....']); + const { visitedNodesInOrder } = bfs(grid, pos(0, 0), pos(1, 3)); + expect(visitedNodesInOrder.length).toBeGreaterThan(0); + }); + + it('dijkstra and a* agree on optimal cost', () => { + const grid = gridFrom(['......', '.####.', '......', '.####.', '......']); + const d = dijkstra(gridFrom(['......', '.####.', '......', '.####.', '......']), pos(0, 0), pos(4, 5)); + const a = astar(grid, pos(0, 0), pos(4, 5)); + expect(a.shortestPath.length).toBe(d.shortestPath.length); + }); + + it('handles stale heap entries on a large open grid (duplicate pushes)', () => { + // A wide-open grid guarantees interior nodes are reached from several + // neighbours, so the heaps accumulate stale duplicates that must be + // skipped when popped (the `current.isVisited` guard). + const rows = Array.from({ length: 7 }, () => '.'.repeat(7)); + for (const algo of OPTIMAL) { + const result = runAlgorithm(algo, gridFrom(rows), pos(0, 0), pos(6, 6)); + expect(result.shortestPath).toHaveLength(13); // Manhattan 12 + 1 + // Every grid node is reachable, so exploration covers the whole grid. + expect(result.visitedNodesInOrder.length).toBeGreaterThan(0); + } + }); + + it('returns no path when the start itself is boxed in (heap drains)', () => { + // Start at (1,1) surrounded by walls → the frontier empties with the + // target never dequeued, exercising the empty-heap exit. + const grid = gridFrom(['#####', '#.###', '#####', '...#.', '....#']); + for (const algo of ALL) { + const result = runAlgorithm(algo, gridFrom(grid.map((r) => r.map((n) => (n.type === NodeType.WALL ? '#' : '.')).join(''))), pos(1, 1), pos(4, 0)); + expect(result.shortestPath).toEqual([]); + } + }); + + it('explores fully and finds no path to an unreachable region', () => { + // Open left region, target in a sealed right region — the search drains + // its frontier, accumulating and skipping stale heap duplicates. + const grid = gridFrom([ + '...#..', + '...#..', + '...#..', + '...#..', + ]); + for (const algo of OPTIMAL) { + const result = runAlgorithm( + algo, + gridFrom(grid.map((r) => r.map((n) => (n.type === NodeType.WALL ? '#' : '.')).join(''))), + pos(0, 0), + pos(0, 5), + ); + expect(result.shortestPath).toEqual([]); + // Only the reachable left half (4 rows × 3 cols) should be visited. + expect(result.visitedNodesInOrder.length).toBe(12); + } + }); +}); + + diff --git a/src/features/traversals/graph/algorithms/astar.ts b/src/features/traversals/graph/algorithms/astar.ts index 80fedab..73d6467 100644 --- a/src/features/traversals/graph/algorithms/astar.ts +++ b/src/features/traversals/graph/algorithms/astar.ts @@ -22,7 +22,12 @@ export function astar( while (openSet.size > 0) { const current = openSet.pop()!; + // Skip stale heap duplicates already finalized (see dijkstra note). + /* v8 ignore start */ if (current.isVisited) continue; + /* v8 ignore stop */ + + current.isVisited = true; visitedNodesInOrder.push(current); diff --git a/src/features/traversals/graph/algorithms/dijkstra.ts b/src/features/traversals/graph/algorithms/dijkstra.ts index a1bde0b..cdca0d8 100644 --- a/src/features/traversals/graph/algorithms/dijkstra.ts +++ b/src/features/traversals/graph/algorithms/dijkstra.ts @@ -20,9 +20,13 @@ export function dijkstra( const current = heap.pop()!; // The heap can contain stale entries (we push duplicates rather than - // doing a decrease-key); skip any node we've already finalized. + // doing a decrease-key); skip any node we've already finalized. With + // uniform edge weights this guard rarely fires, but it keeps the search + // correct if weights are ever introduced. + /* v8 ignore start */ if (current.isVisited) continue; - if (current.distance === Infinity) break; + /* v8 ignore stop */ + current.isVisited = true; visitedNodesInOrder.push(current); diff --git a/src/features/traversals/tree/algorithms/__tests__/generator.test.ts b/src/features/traversals/tree/algorithms/__tests__/generator.test.ts new file mode 100644 index 0000000..4281598 --- /dev/null +++ b/src/features/traversals/tree/algorithms/__tests__/generator.test.ts @@ -0,0 +1,128 @@ +import { describe, expect, it } from 'vitest'; +import { + generateRandomTree, + getTreeNodes, + getTreeEdges, +} from '@/features/traversals/tree/algorithms/generator'; +import type { TreeNode } from '@/features/traversals/tree/types/tree'; + +const isValidTree = (root: TreeNode | null): boolean => { + const seen = new Set(); + const walk = (node: TreeNode | null): boolean => { + if (!node) return true; + if (seen.has(node.id)) return false; // no shared/duplicate ids → acyclic, single-parent + seen.add(node.id); + return walk(node.left) && walk(node.right); + }; + return walk(root); +}; + +const height = (node: TreeNode | null): number => + node ? 1 + Math.max(height(node.left), height(node.right)) : 0; + +describe('tree generator', () => { + describe('generateRandomTree', () => { + it('returns null for non-positive counts', () => { + expect(generateRandomTree(0)).toBeNull(); + expect(generateRandomTree(-3)).toBeNull(); + }); + + it('produces a single-node tree for count 1', () => { + const root = generateRandomTree(1); + expect(root).not.toBeNull(); + expect(root!.left).toBeNull(); + expect(root!.right).toBeNull(); + }); + + for (const count of [1, 2, 5, 10, 25]) { + it(`produces exactly ${count} nodes`, () => { + const root = generateRandomTree(count); + expect(getTreeNodes(root)).toHaveLength(count); + }); + + it(`produces a structurally valid tree of ${count} nodes`, () => { + expect(isValidTree(generateRandomTree(count))).toBe(true); + }); + } + + it('assigns a contiguous set of values 1..n', () => { + const root = generateRandomTree(8); + const values = getTreeNodes(root).map((n) => n.value).sort((a, b) => a - b); + expect(values).toEqual([1, 2, 3, 4, 5, 6, 7, 8]); + }); + + it('assigns unique node ids', () => { + const ids = getTreeNodes(generateRandomTree(15)).map((n) => n.id); + expect(new Set(ids).size).toBe(ids.length); + }); + + it('resets ids per generation (starts at 0)', () => { + generateRandomTree(10); + const root = generateRandomTree(5); + const ids = getTreeNodes(root).map((n) => n.id).sort((a, b) => a - b); + expect(ids[0]).toBe(0); + }); + + it('lays out the root at the origin and children below it', () => { + const root = generateRandomTree(12)!; + expect(root.x).toBe(0); + expect(root.y).toBe(0); + for (const node of getTreeNodes(root)) { + if (node.left) { + expect(node.left.x).toBeLessThan(node.x); + expect(node.left.y).toBeGreaterThan(node.y); + } + if (node.right) { + expect(node.right.x).toBeGreaterThan(node.x); + expect(node.right.y).toBeGreaterThan(node.y); + } + } + }); + }); + + describe('getTreeNodes', () => { + it('returns [] for an empty tree', () => { + expect(getTreeNodes(null)).toEqual([]); + }); + + it('collects every node exactly once', () => { + const root = generateRandomTree(20); + const nodes = getTreeNodes(root); + expect(new Set(nodes.map((n) => n.id)).size).toBe(20); + }); + }); + + describe('getTreeEdges', () => { + it('returns [] for an empty tree', () => { + expect(getTreeEdges(null)).toEqual([]); + }); + + it('produces exactly n-1 edges for an n-node tree', () => { + for (const count of [1, 2, 7, 16]) { + const root = generateRandomTree(count); + expect(getTreeEdges(root)).toHaveLength(count - 1); + } + }); + + it('every edge connects a real parent to its real child', () => { + const root = generateRandomTree(18); + for (const edge of getTreeEdges(root)) { + expect(edge.from.left === edge.to || edge.from.right === edge.to).toBe(true); + } + }); + + it('edge depth matches positions (child below parent)', () => { + const root = generateRandomTree(14); + for (const edge of getTreeEdges(root)) { + expect(edge.to.y).toBeGreaterThan(edge.from.y); + } + }); + }); + + it('generated trees have height between log2(n)+ and n', () => { + const root = generateRandomTree(10); + const h = height(root); + expect(h).toBeGreaterThanOrEqual(1); + expect(h).toBeLessThanOrEqual(10); + }); +}); diff --git a/src/features/traversals/tree/algorithms/__tests__/traversals.test.ts b/src/features/traversals/tree/algorithms/__tests__/traversals.test.ts new file mode 100644 index 0000000..23c449c --- /dev/null +++ b/src/features/traversals/tree/algorithms/__tests__/traversals.test.ts @@ -0,0 +1,59 @@ +import { describe, expect, it } from 'vitest'; +import { runTraversal } from '@/features/traversals/tree/algorithms/traversals'; +import type { TraversalStep, TreeNode } from '@/features/traversals/tree/types/tree'; + +function node(id: number, value: number, left: TreeNode | null = null, right: TreeNode | null = null): TreeNode { + return { id, value, left, right, x: 0, y: 0 }; +} + +// 4(1) +// / \ +// 2(2) 6(3) +// / \ / \ +// 1(4) 3(5) 5(6) 7(7) +const balancedTree = node( + 1, 4, + node(2, 2, node(4, 1), node(5, 3)), + node(3, 6, node(6, 5), node(7, 7)), +); + +const processedOrder = (steps: TraversalStep[]) => + steps.filter((s) => s.action === 'process').map((s) => s.nodeId); + +describe('tree traversals', () => { + it('returns no steps for an empty tree', () => { + expect(runTraversal(null, 'inorder')).toEqual([]); + expect(runTraversal(null, 'levelorder')).toEqual([]); + }); + + it('in-order: Left → Root → Right (sorted ids by value here)', () => { + expect(processedOrder(runTraversal(balancedTree, 'inorder'))).toEqual([4, 2, 5, 1, 6, 3, 7]); + }); + + it('pre-order: Root → Left → Right', () => { + expect(processedOrder(runTraversal(balancedTree, 'preorder'))).toEqual([1, 2, 4, 5, 3, 6, 7]); + }); + + it('post-order: Left → Right → Root', () => { + expect(processedOrder(runTraversal(balancedTree, 'postorder'))).toEqual([4, 5, 2, 6, 7, 3, 1]); + }); + + it('level-order: top to bottom, left to right', () => { + expect(processedOrder(runTraversal(balancedTree, 'levelorder'))).toEqual([1, 2, 3, 4, 5, 6, 7]); + }); + + it('every node is visited and processed exactly once', () => { + for (const type of ['inorder', 'preorder', 'postorder', 'levelorder'] as const) { + const steps = runTraversal(balancedTree, type); + expect(steps.filter((s) => s.action === 'visit')).toHaveLength(7); + expect(steps.filter((s) => s.action === 'process')).toHaveLength(7); + } + }); + + it('handles a degenerate (right-skewed) tree', () => { + const skewed = node(1, 1, null, node(2, 2, null, node(3, 3))); + expect(processedOrder(runTraversal(skewed, 'inorder'))).toEqual([1, 2, 3]); + expect(processedOrder(runTraversal(skewed, 'preorder'))).toEqual([1, 2, 3]); + expect(processedOrder(runTraversal(skewed, 'postorder'))).toEqual([3, 2, 1]); + }); +}); diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..3f83a9d --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,31 @@ +import { defineConfig } from 'vitest/config'; +import path from 'path'; + +export default defineConfig({ + resolve: { + alias: { + '@': path.resolve(__dirname, './src'), + }, + }, + test: { + environment: 'node', + include: ['src/**/*.{test,spec}.{ts,tsx}'], + coverage: { + provider: 'v8', + reporter: ['text', 'text-summary'], + include: [ + 'src/features/sorting/algorithms/**', + 'src/features/traversals/tree/algorithms/**', + 'src/features/traversals/graph/algorithms/**', + 'src/features/algorithms/linked-list/algorithms/**', + ], + // CI fails if coverage drops below these floors. + thresholds: { + statements: 85, + branches: 85, + functions: 85, + lines: 85, + }, + }, + }, +});