PageSourceSearch

https://www.deep-ml.com/_next/static/chunks/app/page-c09695d0b28e7331.js

js deep-ml.com collected 2026-10-03 20:14:18 UTC 149,591 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[41931],{29546:function(e,t,n){Promise.resolve().then(n.bind(n,11687))},98096:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(57437),a=n(2265);function i(e){let{className:t=""}=e,n=(0,a.useRef)(null),i=(0,a.useRef)(null),s=(0,a.useRef)(null),l=(0,a.useRef)({x:-9999,y:-9999,on:!1}),o=(0,a.useRef)([]),c=(0,a.useRef)(null),d=(0,a.useRef)({w:0,h:0,dpr:1}),u=(0,a.useCallback)((e,t)=>{let n=document.createElement("canvas");n.width=e,n.height=t;let r=n.getContext("2d",{willReadFrequently:!0});if(!r)return;r.clearRect(0,0,e,t);let a=Math.min(.82*e,1180),i=200;r.font="700 ".concat(i,'px "JetBrains Mono", ui-monospace, monospace'),i=Math.max(48,Math.min(a/r.measureText("DEEP\xb7ML").width*i,.52*t)),r.font="700 ".concat(i,'px "JetBrains Mono", ui-monospace, monospace'),r.textAlign="center",r.textBaseline="middle",r.fillStyle="#fff",r.fillText("DEEP\xb7ML",e/2,.47*t),s.current={data:r.getImageData(0,0,e,t).data,w:e,h:t}},[]),m=(0,a.useCallback)(()=>{let e=i.current,t=null==e?void 0:e.getContext("2d"),{w:n,h:r,dpr:a}=d.current;if(!e||!t||0===n||0===r)return;t.setTransform(a,0,0,a,0,0),t.clearRect(0,0,n,r),t.lineCap="butt";let c=s.current,u=performance.now()/1e3,m=[];for(let e of(l.current.on&&m.push({x:l.current.x,y:l.current.y,life:1}),o.current))m.push(e);for(let e=7;e<r;e+=7){let r=0;for(let t of m){let n=Math.abs(e-t.y);n<190&&(r=Math.max(r,(1-n/190)*t.life))}let i=!0,s=!1,l=()=>{if(i)return;let e=s?Math.min(.92,.55+.35*r):Math.min(.5,.085+.3*r);t.strokeStyle="rgba(244,244,245,".concat(e,")"),t.lineWidth=s?1.7:1,t.stroke()};for(let r=0;r<=n;r+=5){let n=1.6*Math.sin(r/190+e/90+.5*u);for(let t of m){let a=r-t.x,i=e-t.y,s=Math.hypot(a,i);if(s>190)continue;let l=1-s/190;n+=l*l*(3-2*l)*Math.sign(i||1)*34*t.life}let o=e+n,d=!1;if(c){let t=Math.min(c.w-1,Math.max(0,Math.round(r*a))),n=Math.min(c.h-1,Math.max(0,Math.round(e*a)));d=c.data[(n*c.w+t)*4+3]>128}if(i){t.beginPath(),t.moveTo(r,o),s=d,i=!1;continue}if(d===s){t.lineTo(r,o);continue}t.lineTo(r,o),l(),t.beginPath(),t.moveTo(r,o),s=d}l(),i=!0}o.current=o.current.map(e=>({...e,life:.94*e.life})).filter(e=>e.life>.02)},[]);(0,a.useEffect)(()=>{var e,t;let r=n.current,a=i.current;if(!r||!a)return;let s=()=>{let e=r.clientWidth,t=r.clientHeight;if(0===e||0===t)return;let n=Math.min(window.devicePixelRatio||1,2);d.current={w:e,h:t,dpr:n},a.width=Math.round(e*n),a.height=Math.round(t*n),a.style.width="".concat(e,"px"),a.style.height="".concat(t,"px"),u(a.width,a.height),m()};s();let l=new ResizeObserver(s);return l.observe(r),null===(t=document.fonts)||void 0===t||null===(e=t.ready)||void 0===e||e.then(s).catch(()=>{}),()=>l.disconnect()},[u,m]),(0,a.useEffect)(()=>{var e,t,n;if(null===(t=(n=window).matchMedia)||void 0===t?void 0:null===(e=t.call(n,"(prefers-reduced-motion: reduce)"))||void 0===e?void 0:e.matches){m();return}let r=()=>{m(),c.current=window.requestAnimationFrame(r)};return c.current=window.requestAnimationFrame(r),()=>{c.current&&window.cancelAnimationFrame(c.current)}},[m]);let h=e=>{var t;let r=null===(t=n.current)||void 0===t?void 0:t.getBoundingClientRect();return r?{x:e.clientX-r.left,y:e.clientY-r.top}:null},x=e=>{var t,n,r;let a=h(e);if(!a)return;l.current={...a,on:!0};let i=o.current[o.current.length-1];(!i||Math.hypot(i.x-a.x,i.y-a.y)>26)&&(o.current.push({...a,life:1}),o.current.length>14&&o.current.shift()),(null===(n=(r=window).matchMedia)||void 0===n?void 0:null===(t=n.call(r,"(prefers-reduced-motion: reduce)"))||void 0===t?void 0:t.matches)&&m()};return(0,r.jsxs)("section",{className:"dark relative overflow-hidden bg-zinc-950 ".concat(t),"aria-label":"Deep-ML",children:[(0,r.jsx)("div",{ref:n,onPointerMove:x,onPointerLeave:()=>{l.current={x:-9999,y:-9999,on:!1}},onPointerDown:x,className:"relative h-[280px] w-full touch-none sm:h-[360px]",children:(0,r.jsx)("canvas",{ref:i,"aria-hidden":"true",className:"block"})}),(0,r.jsx)("p",{className:"pointer-events-none absolute bottom-5 left-0 w-full px-6 text-center font-jetbrainsMono text-[10px] tracking-wider text-zinc-600 uppercase",children:"run your hand through it"})]})}},11687:function(e,t,n){"use strict";let r;n.d(t,{default:function(){return t7}
1});var a=n(57437),i=n(57043),s=n(2265),l=n(30166),o=n(27648),c=n(33498),d=n(33276),u=n(67891),m=n(6494),h=n(90277),x=n(62997),p=n(81735);let f=[{id:23,file:"softmax.py",title:"Numerically stable softmax",starter:"import math\n\ndef softmax(x):\n    shifted = ____\n    e = [math.exp(v) for v in shifted]\n    return [v / sum(e) for v in e]\n",tests:[{expression:"softmax([1.0, 2.0, 3.0])[2]",expected:.6652409557748218,label:"softmax([1, 2, 3])[2]",expects:"0.665241"},{expression:"sum(softmax([1.0, 2.0, 3.0]))",expected:1,label:"sum(softmax([1, 2, 3]))",expects:"1.0"},{expression:"softmax([1000.0, 1001.0, 1002.0])[2]",expected:.6652409557748218,label:"softmax([1000, 1001, 1002])[2]",expects:"0.665241"}],note:"the max subtraction is what stops exp overflowing"},{id:83,file:"dot.py",title:"Dot product",starter:"def dot(a, b):\n    return ____\n",tests:[{expression:"dot([1.0, 2.0, 3.0], [4.0, 5.0, 6.0])",expected:32,label:"dot([1,2,3], [4,5,6])",expects:"32.0"},{expression:"dot([0.0, 0.0], [7.0, 9.0])",expected:0,label:"dot([0,0], [7,9])",expects:"0.0"},{expression:"dot([-1.5, 2.0], [4.0, -3.0])",expected:-12,label:"dot([-1.5,2], [4,-3])",expects:"-12.0"}],note:"the operation underneath every layer you have ever used"},{id:42,file:"relu.py",title:"ReLU",starter:"def relu(x):\n    return ____\n",tests:[{expression:"relu([-2.0, 0.0, 3.5])[0]",expected:0,label:"relu([-2, 0, 3.5])[0]",expects:"0.0"},{expression:"relu([-2.0, 0.0, 3.5])[2]",expected:3.5,label:"relu([-2, 0, 3.5])[2]",expects:"3.5"},{expression:"sum(relu([-1.0, -2.0, 4.0]))",expected:4,label:"sum(relu([-1, -2, 4]))",expects:"4.0"}],note:"one line, and it is most of why deep networks train at all"},{id:1228,file:"mse.py",title:"Mean squared error",starter:"def mse(y, yhat):\n    return ____\n",tests:[{expression:"mse([1.0, 2.0, 3.0], [1.0, 2.0, 3.0])",expected:0,label:"mse([1,2,3], [1,2,3])",expects:"0.0"},{expression:"mse([0.0, 0.0], [3.0, 4.0])",expected:12.5,label:"mse([0,0], [3,4])",expects:"12.5"},{expression:"mse([1.0, 2.0], [2.0, 4.0])",expected:2.5,label:"mse([1,2], [2,4])",expects:"2.5"}],note:"the loss you will minimise a thousand times"},{id:328,file:"norm.py",title:"L2 norm",starter:"import math\n\ndef l2(v):\n    return ____\n",tests:[{expression:"l2([3.0, 4.0])",expected:5,label:"l2([3, 4])",expects:"5.0"},{expression:"l2([0.0, 0.0, 0.0])",expected:0,label:"l2([0, 0, 0])",expects:"0.0"},{expression:"l2([1.0, 1.0, 1.0, 1.0])",expected:2,label:"l2([1, 1, 1, 1])",expects:"2.0"}],note:"the 3-4-5 triangle, and every weight decay term since"}];function b(){let[e,t]=(0,s.useState)(!0);return(0,s.useEffect)(()=>{let e=document.documentElement,n=()=>t(e.classList.contains("dark"));n();let r=new MutationObserver(n);return r.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),e}let g=(0,l.default)(()=>Promise.all([n.e(40650),n.e(14161)]).then(n.bind(n,14161)),{loadableGenerated:{webpack:()=>[14161]},ssr:!1,loading:()=>null});var v=(0,s.memo)(function(e){let{className:t=""}=e,[n,r]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=window;if(e.requestIdleCallback){let t=e.requestIdleCallback(()=>r(!0),{timeout:1500});return()=>{var n;return null===(n=e.cancelIdleCallback)||void 0===n?void 0:n.call(e,t)}}let t=window.setTimeout(()=>r(!0),300);return()=>window.clearTimeout(t)},[]);let[i,l]=(0,s.useState)(!1),o=(0,s.useCallback)(()=>l(!0),[]),c=!b();return(0,a.jsxs)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 overflow-hidden ".concat(t),children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-cover bg-center transition-opacity duration-500 motion-reduce:transition-none dark:hidden ".concat(i?"opacity-0":"opacity-100"),style:{backgroundImage:"url(".concat("/hero/backdrop-light-v1.webp",")")}}),(0,a.jsx)("div",{className:"absolute inset-0 hidden bg-cover bg-center transition-opacity duration-500 motion-reduce:transition-none dark:block ".concat(i?"opacity-0":"opacity-100"),style:{backgroundImage:"url(".concat("/hero/backdrop-dark-v1.webp",")")}}),n&&(0,a.jsx)(g,{onFirstFrame:o,pageLoadAnimation:!1,invert:c?1:0,brightness:c?1:.7,tint:c?"#fafafa":"#e4e4e7"}),(0,a.jsx)("div",{className:"dml-hero-scrim-flat absolute inset-0"}),(0,a.jsx)("div",{className:"dml-hero-scrim-left absolute inset-y-0 left-0 w-full lg:w-[62%]"}),(0,a.jsx)("div",{className:"dml-hero-scrim-vignette absolute inset-0"})]})});function y(e){let{text:t,className:n="",radius:r=100,fromWeight:i=700,toWeight:l=800,glow:o=!0}=e,c=(0,s.useRef)(null),d=(0,s.useRef)([]),u=(0,s.useRef)([]),m=(0,s.useRef)([]),h=(0,s.useRef)(null),x=(0,s.useRef)(!1);(0,s.useEffect)(()=>{var e;let t=c.current;if(!t||window.matchMedia("(prefers-reduced-motion: reduce)").matches||window.matchMedia("(pointer: coarse)").matches)return;let n=()=>{let e=t.getBoundingClientRect();u.current=d.current.map(t=>{if(!t)return{x:0,y:0};let n=t.getBoundingClientRect();return{x:n.left+n.width/2-e.left,y:n.top+n.height/2-e.top}})};n(),null===(e=document.fonts)||void 0===e||e.ready.then(n).catch(()=>{});let a=new ResizeObserver(n);a.observe(t);let s=e=>{"mouse"===e.pointerType&&(h.current={x:e.clientX,y:e.clientY},x.current=!0)},p=e=>{null===e.relatedTarget&&(h.current=null,x.current=!0)};window.addEventListener("pointermove",s,{passive:!0}),document.addEventListener("pointerout",p,{passive:!0});let f=0,b=()=>{if(f=requestAnimationFrame(b),!x.current)return;x.current=!1;let e=t.getBoundingClientRect(),n=h.current;d.current.forEach((t,a)=>{var s;if(!t)return;let c=i;if(n){let t=u.current[a],s=n.x-(e.left+t.x),o=n.y-(e.top+t.y),d=Math.sqrt(s*s+o*o);
1d<r&&(c=i+(l-i)*(1-d/r)**2)}if(!(1>Math.abs((null!==(s=m.current[a])&&void 0!==s?s:i)-c))&&(m.current[a]=c,t.style.fontVariationSettings="'wght' ".concat(Math.round(c)),o)){let e=(c-i)/(l-i);t.style.textShadow=e>.05?"0 0 ".concat(Math.round(14*e),"px rgba(255,255,255,").concat((.35*e).toFixed(3),")"):""}})};return f=requestAnimationFrame(b),()=>{cancelAnimationFrame(f),a.disconnect(),window.removeEventListener("pointermove",s),document.removeEventListener("pointerout",p)}},[r,i,l,o]);let p=t.split(" "),f=0;return(0,a.jsxs)("span",{ref:c,className:n,children:[p.map((e,t)=>(0,a.jsxs)("span",{"aria-hidden":"true",className:"inline-block whitespace-nowrap",children:[e.split("").map(e=>{let t=f++;return(0,a.jsx)("span",{ref:e=>{d.current[t]=e},className:"inline-block",children:e},t)}),t<p.length-1&&(0,a.jsx)("span",{className:"inline-block",children:"\xa0"})]},t)),(0,a.jsx)("span",{className:"sr-only",children:t})]})}function j(e){let{children:t,className:n=""}=e,r=(0,s.useRef)(null),i=(0,s.useRef)(null),l=(0,s.useRef)([]),o=(0,s.useRef)(0),c=(0,s.useRef)(!1);return(0,s.useEffect)(()=>{c.current=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let e=r.current,t=i.current;if(!e||!t)return;let n=Math.min(window.devicePixelRatio||1,2),a=()=>{let r=e.getBoundingClientRect();t.width=Math.round((r.width+56)*n),t.height=Math.round((r.height+56)*n)},s=new ResizeObserver(a);s.observe(e),a();let d=t.getContext("2d"),u=e=>{d&&(d.clearRect(0,0,t.width,t.height),l.current=l.current.filter(t=>{let r=(e-t.start)/400;if(r>=1)return!1;let a=r*(2-r),i=18*a,s=8*(1-a),l=(t.x+i*Math.cos(t.angle))*n,o=(t.y+i*Math.sin(t.angle))*n,c=(t.x+(i+s)*Math.cos(t.angle))*n,u=(t.y+(i+s)*Math.sin(t.angle))*n;return d.strokeStyle="rgba(255,255,255,0.9)",d.lineWidth=1.5*n,d.beginPath(),d.moveTo(l,o),d.lineTo(c,u),d.stroke(),!0}),l.current.length>0?o.current=requestAnimationFrame(u):d&&(d.clearRect(0,0,t.width,t.height),o.current=0))},m=e=>{if(c.current)return;let n=t.getBoundingClientRect(),r=e.clientX-n.left,a=e.clientY-n.top,i=performance.now();for(let e=0;e<6;e++)l.current.push({x:r,y:a,angle:2*Math.PI*e/6+Math.PI/6,start:i});o.current||(o.current=requestAnimationFrame(u))};return e.addEventListener("pointerdown",m),()=>{e.removeEventListener("pointerdown",m),s.disconnect(),o.current&&cancelAnimationFrame(o.current),l.current=[]}},[]),(0,a.jsxs)("span",{ref:r,className:"relative inline-flex ".concat(n),children:[(0,a.jsx)("canvas",{ref:i,"aria-hidden":"true",className:"pointer-events-none absolute z-10",style:{to
1p:-28,left:-28,width:"calc(100% + ".concat(56,"px)"),height:"calc(100% + ".concat(56,"px)")}}),t]})}function w(e){let{active:t,successTick:n=0,radius:r=12,children:i,className:l=""}=e,o=(0,s.useRef)(null),[c,d]=(0,s.useState)(null),[u,m]=(0,s.useState)(!1);(0,s.useEffect)(()=>{m(window.matchMedia("(prefers-reduced-motion: reduce)").matches);let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();d({w:Math.round(t.width),h:Math.round(t.height)})});return t.observe(e),()=>t.disconnect()},[]);let h=t&&!u&&null!==c,x=t&&u&&null!==c,p=n>0&&null!==c&&!u;return(0,a.jsxs)("div",{ref:o,className:"relative ".concat(l),children:[i,(h||x||p)&&c&&(0,a.jsxs)("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-20 overflow-visible",width:c.w,height:c.h,fill:"none",children:[(0,a.jsx)("style",{children:"\n            @keyframes dml-border-lap { to { stroke-dashoffset: -100; } }\n            @keyframes dml-border-flash { from { opacity: 1; } to { opacity: 0; } }\n          "}),h&&(0,a.jsx)("rect",{x:"0.75",y:"0.75",width:c.w-1.5,height:c.h-1.5,rx:r-.75,pathLength:100,stroke:"rgba(255,255,255,0.7)",strokeWidth:"1.5",strokeDasharray:"14 86",style:{animation:"dml-border-lap 1.2s linear infinite"}}),x&&(0,a.jsx)("rect",{x:"0.75",y:"0.75",width:c.w-1.5,height:c.h-1.5,rx:r-.75,stroke:"rgba(255,255,255,0.35)",strokeWidth:"1.5"}),p&&(0,a.jsx)("rect",{x:"0.75",y:"0.75",width:c.w-1.5,height:c.h-1.5,rx:r-.75,stroke:"#22c55e",strokeWidth:"1.5",style:{animation:"dml-border-flash 500ms ease-out forwards"}},n)]})]})}var k=n(8413);let z=x.Wl.highest(h.$f.of([{key:"Escape",run:e=>(e.contentDOM.blur(),!0)}])),N=[(0,u.python)(),m.c.of("    "),z],M=(0,l.default)(()=>Promise.all([n.e(1266),n.e(92843),n.e(74610)]).then(n.bind(n,92843)).then(e=>e.default),{loadableGenerated:{webpack:()=>[null]},ssr:!1,loading:()=>(0,a.jsx)("div",{className:"h-[164px] bg-zinc-50 dark:bg-[#1e1e1e]","aria-hidden":"true"})}),S=e=>"landing-v2-solved-".concat(e),C={pending:"\xb7",pass:"✓",fail:"✗"},A={pending:"text-zinc-500 dark:text-zinc-500",pass:"text-green-600 dark:text-green-500",fail:"text-red-600 dark:text-red-500"};function E(e){let{className:t=""}=e,{warm:n,run:r,isRunning:i}=function(){let e=(0,s.useRef)(null),t=(0,s.useRef)(null),[n,r]=(0,s.useState)(!1),a=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/compute/session/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({template:"blank",ttl_seconds:600})});if(!e.ok)return null;let t=await e.json();return"string"==typeof t.session_id?t.session_id:null}catch(e){return null}},[]);return{warm:(0,s.useCallback)(()=>{e.current||t.current||(t.current=a().then(n=>(e.current=n,t.current=null,n)))},[a]),run:(0,s.useCallback)(async n=>{r(!0);try{let r=e.current;if(!r&&t.current&&(r=await t.current),r||(r=await a(),e.current=r),!r)return{stdout:"",error:"compute unavailable. solve it on the problem page",duration_ms:0};let i=async e=>fetch("/api/compute/session/".concat(e,"/execute"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:n})}),s=await i(r);if(404===s.status||410===s.status){if(e.current=await a(),!e.current)return{stdout:"",error:"compute unavailable. solve it on the problem page",duration_ms:0};s=await i(e.current)}if(!s.ok)return{stdout:"",error:"execution failed (".concat(s.status,")"),duration_ms:0};let l=await s.json();return{stdout:"string"==typeof l.stdout?l.stdout:"",error:"string"==typeof l.error?l.error:null,duration_ms:"number"==typeof l.duration_ms?l.duration_ms:0}}finally{r(!1)}},[a]),isRunning:n}}(),l=function(){let[e,t]=(0,s.useState)("ssr"),[n,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){r(!0);return}if(performance.now()>1200)return;t("from");let e=requestAnimationFrame(()=>requestAnimationFrame(()=>t("settled")));return()=>cancelAnimationFrame(e)},[]),(0,s.useCallback)(t=>n||"ssr"===e?{}:"from"===e?{transform:"translateY(16px)",opacity:.001}:{transform:"translateY(0)",opacity:1,transition:"transform 500ms ".concat("cubic-bezier(0.22, 1, 0.36, 1)"," ").concat(80*t,"ms, opacity 350ms ease-out ").concat(80*t,"ms")},[e,n])}
1(),u=b(),[m,h]=(0,s.useState)(0),x=f[m],g=x.tests;x.starter;let[z,E]=(0,s.useState)(f[0].starter),[F,R]=(0,s.useState)(f[0].tests.map(()=>"pending")),[L,I]=(0,s.useState)(f[0].tests.map(()=>null)),[P,T]=(0,s.useState)(""),[_,B]=(0,s.useState)(null),[D,W]=(0,s.useState)(!1),[q,J]=(0,s.useState)(!1),[U,X]=(0,s.useState)(!1),[Y,O]=(0,s.useState)(0),[Z,H]=(0,s.useState)(!1),[V,G]=(0,s.useState)(!1),[K,Q]=(0,s.useState)(0),$=(0,s.useRef)(f[0].starter),ee=(0,s.useRef)(!1),et=(0,s.useRef)(0),en=(0,s.useRef)(null),er=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=Math.floor(Math.random()*f.length),t=f[e];h(e),E(t.starter),$.current=t.starter,R(t.tests.map(()=>"pending")),I(t.tests.map(()=>null));try{"1"===localStorage.getItem(S(t.id))&&(W(!0),ee.current=!0)}catch(e){}H(window.matchMedia("(pointer: coarse)").matches),X(window.matchMedia("(prefers-reduced-motion: reduce)").matches)},[]);let ea=(0,s.useRef)(!1),ei=(0,s.useCallback)(()=>{ea.current||(ea.current=!0,n())},[n]),es=(0,s.useCallback)(e=>{var t;let n=null===(t=en.current)||void 0===t?void 0:t.getBoundingClientRect(),r=n?{x:n.left+n.width/2,y:n.top+n.height/2}:{x:window.innerWidth/2,y:window.innerHeight/2};window.dispatchEvent(new CustomEvent(e?"dml-hero-solved":"dml-hero-failed",{detail:r}))},[]),el=(0,s.useCallback)(async()=>{var e;let t=$.current+"\n\n"+g.map(e=>"print(".concat(e.expression,")")).join("\n"),n=performance.now(),a=await r(t),i=Math.round(performance.now()-n);if((e=a.error)&&(e.startsWith("compute unavailable")||e.startsWith("execution failed"))){et.current+=1,et.current>=2&&J(!0),T("compute unreachable. try again, or solve it on a problem page");return}if(B(i),a.error){R(g.map(()=>"fail")),I(g.map(()=>"error")),T(a.error.split("\n").slice(-2).join("\n")),O(e=>e+1),es(!1);return}let s=a.stdout.trim().split("\n"),l=g.map((e,t)=>{let n=parseFloat(s[t]);return Number.isFinite(n)&&1e-6>=Math.abs(n-e.expected)?"pass":"fail"});R(l),I(g.map((e,t)=>{var n;return"fail"===l[t]?null!==(n=s[t])&&void 0!==n?n:"no output":null})),T(a.stdout.trim());let o=l.every(e=>"pass"===e);if(es(o),!o){O(e=>e+1);return}if(Q(e=>e+1),!ee.current){ee.current=!0,W(!0);try{localStorage.setItem(S(x.id),"1")}catch(e){}}},[r,g,x.id,es]),eo=(0,s.useCallback)(()=>{i||el()},[i,el]),ec=F.filter(e=>"pending"!==e).length,ed=F.filter(e=>"pass"===e).length,eu=ec===F.length&&ed===F.length;return(0,a.jsxs)("section",{ref:er,"aria-label":"Deep-ML: implement machine learning from scratch",className:"relative overflow-hidden bg-zinc-50 [--dml-hero-ground:rgba(250,250,250,0.95)] dark:bg-zinc-950 dark:[--dml-hero-ground:rgba(9,9,11,0.95)]",children:[(0,a.jsx)(v,{}),(0,a.jsxs)("div",{className:"relative z-10 grid w-full grid-cols-12 items-center gap-x-0 gap-y-12 pb-20 sm:gap-y-14 lg:min-h-[calc(100svh-5rem)] lg:gap-x-12 lg:pb-28 ".concat(t),children:[(0,a.jsxs)("div",{className:"relative z-10 col-span-12 min-w-0 lg:col-span-7",children:[(0,a.jsx)("h1",{className:"max-w-[22ch] font-jetbrainsMono text-4xl font-bold text-balance text-zinc-900 sm:text-5xl dark:text-zinc-100",style:l(0),children:(0,a.jsx)(y,{text:"Implement machine learning from scratch.",radius:100,fromWeight:700,toWeight:800,glow:!0})}),(0,a.jsx)("p",{className:"mt-5 max-w-xl font-inter text-lg text-pretty text-zinc-600 dark:text-zinc-400",style:l(1),children:"Every problem here is one you implement yourself. No library call standing in for the thing you are trying to learn. Real Python, real compute, free."}),(0,a.jsxs)("div",{className:"mt-8",style:l(2),children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsx)(j,{children:(0,a.jsx)(o.default,{href:"/problems",className:"inline-flex h-11 items-center rounded-full bg-zinc-900 px-6 font-jetbrainsMono text-sm font-medium text-white transition-colors duration-150 hover:bg-zinc-800 active:bg-zinc-700 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-zinc-200 dark:active:bg-zinc-300",children:"Start solving"})}),(0,a.jsx)(o.default,{href:"/learn",className:"inline-flex h-11 items-center rounded-full border border-zinc-300 px-6 font-jetbrainsMono text-sm font-medium text-zinc-700 transition-colors duration-150 hover:bg-zinc-100 active:bg-zinc-200 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:active:bg-zinc-700",children:"Browse the curriculum"})]}),(0,a.jsx)(k.Z,{size:"hero",placeholder:"Search anything on Deep-ML…",className:"mt-4 max-w-xl"}),(0,a.jsx)("p",{className:"mt-3 font-jetbrainsMono text-[11px] tracking-wider text-zinc-500 uppercase",children:"free \xb7 no account to try"})]})]}),(0,a.jsxs)("div",{className:"relative z-10 col-span-12 min-w-0 lg:col-span-5",style:l(3),children:[(0,a.jsx)(w,{active:i,successTick:K,radius:12,children:(0,a.jsxs)("div",{ref:en,onPointerEnter:ei,onPointerDown:ei,onFocusCapture:ei,className:"relative flex flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-[0_8px_30px_rgba(0,0,0,0.06)] dark:border-zinc-800 dark:bg-zinc-900 dark:shadow-none",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-zinc-200 px-4 py-2.5 dark:border-zinc-800",children:[(0,a.jsx)("span",{className:"font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase dark:text-zinc-400",children:x.file}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-zinc-200 px-2.5 py-0.5 text-xs font-medium text-zinc-600 dark:border-zinc-700 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full transition-colors duration-300 ".concat(D?"bg-green-500":"bg-zinc-400 dark:bg-zinc-600")}),D?"solved":"unsolved"]})]}),(0,a.jsxs)("div",{className:"relative text-[13px]",children:[(0,a.jsx)(M,{value:z,onChange:e=>{$.current=e,E(e)},extensions:N,theme:u?p.Pc:p.Zp,height:"164px",readOnly:Z&&!V,indentWithTab:!0,basicSetup:{lineNumbers:!0,foldGutter:!1,highlightActiveLine:!1,autocompletion:!1},"aria-label":"Python editor"}),Z&&!V&&(0,a.jsx)("button",{type:"button",onClick:()=>G(!0),className:"absolute right-2 bottom-2 z-10 rounded-full border border-zinc-200 bg-white/80 px-2.5 py-0.5 font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase dark:border-zinc-700 dark:bg-zinc-900/80 dark:text-zinc-400",children:"tap to edit"})]}),(0,a.jsxs)("div",{className:"space-y-3 border-t border-zinc-200 px-4 py-3 dark:border-zinc-800",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[q?(0,a.jsx)(o.default,{href:"/problems/".concat(x.id),className:"inline-flex h-11 items-center gap-1.5 rounded-lg bg-zinc-900 px-4 font-jetbrainsMono text-xs font-medium text-white transition-colors duration-150 hover:bg-zinc-800 md:h-9 md:px-3 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-zinc-200",children:"Solve it on the problem page"}):(0,a.jsx)(j,{children:(0,a.jsxs)("button",{type:"button",onClick:eo,disabled:i,"aria-busy":i,className:"inline-flex h-11 items-center gap-1.5 rounded-lg px-4 font-jetbrainsMono text-xs font-medium text-white transition-colors duration-150 disabled:cursor-wait disabled:opacity-60 md:h-9 md:px-3 dark:text-zinc-900 ".concat(i?"bg-zinc-700 dark:bg-zinc-300":"bg-zinc-900 hover:bg-zinc-800 active:bg-zinc-700 dark:bg-zinc-100 dark:hover:bg-zinc-200 dark:active:bg-zinc-300"),children:[(0,a.jsx)(d.Z,{className:"h-3 w-3","aria-hidden":"true"}),i?"running":"Run"]})}),null!==_&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-zinc-200 px-2.5 py-0.5 font-jetbrainsMono text-xs tabular-nums text-zinc-600 dark:border-zinc-700 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),_," ms \xb7 live"]})]}),(0,a.jsx)(c.E.ul,{animate:Y>0&&F.some(e=>"fail"===e)?{x:[0,-4,4,-4,4,0]}:{x:0},transition:{duration:U?0:.4},className:"space-y-1.5",children:g.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-baseline gap-2 font-jetbrainsMono text-xs text-zinc-700 dark:text-zinc-300",children:[(0,a.jsxs)("span",{className:"w-2 shrink-0 text-center leading-none ".concat(A[F[t]]),children:[(0,a.jsxs)("span",{className:"sr-only",children:["pending"===F[t]?"not run":F[t],":"," "]}),(0,a.jsx)("span",{"aria-hidden":"true",children:C[F[t]]})]}),(0,a.jsx)("span",{className:"truncate",children:e.label}),"fail"===F[t]&&null!==L[t]?(0,a.jsxs)("span",{className:"truncate text-red-600 tabular-nums dark:text-red-500",children:["got ",L[t]]}):(0,a.jsxs)("span",{className:"truncate text-zinc-500 tabular-nums dark:text-zinc-400",children:["→ ",e.expects]})]},e.label))},Y),""!==P&&(0,a.jsx)("pre",{className:"max-h-20 overflow-x-auto rounded-lg bg-zinc-50 px-3 py-2 font-jetbrainsMono text-xs text-zinc-600 dark:bg-zinc-950 dark:text-zinc-400",children:P}),(0,a.jsx)("p",{"aria-live":"polite",className:"font-jetbrainsMono text-xs tabular-nums ".concat(eu?"text-green-600 dark:text-green-500":"text-zinc-600 dark:text-zinc-300"),children:ec>0?eu?"".concat(ed,"/").concat(F.length," passed"):"".concat(F.length-ed," of ").concat(F.length," failed"):"fill the blank, then Run"}),D&&(0,a.jsx)(c.E.div,{initial:!U&&{opacity:0,y:8}
1,animate:{opacity:1,y:0},transition:{duration:.3,ease:[.22,1,.36,1]},children:(0,a.jsx)(o.default,{href:"/problems",className:"font-jetbrainsMono text-xs font-medium text-zinc-900 underline decoration-zinc-400 underline-offset-4 transition-colors hover:decoration-zinc-900 dark:text-zinc-100 dark:decoration-zinc-600 dark:hover:decoration-zinc-100",children:"Pick your next problem"})})]})]})}),(0,a.jsxs)("p",{className:"mt-3 font-jetbrainsMono text-[10px] tracking-wider text-zinc-600 uppercase dark:text-zinc-400",style:{textShadow:"0 1px 6px var(--dml-hero-ground)"},children:[x.title," \xb7 runs on deep-ml compute"]}),(0,a.jsxs)("p",{className:"mt-1 font-jetbrainsMono text-[10px] tracking-wider text-zinc-700 uppercase dark:text-zinc-300",style:{textShadow:"0 1px 6px var(--dml-hero-ground)"},children:[x.note," \xb7"," ",(0,a.jsxs)(o.default,{href:"/problems/".concat(x.id),className:"underline decoration-zinc-400 underline-offset-4 transition-colors hover:text-zinc-900 dark:decoration-zinc-600 dark:hover:text-zinc-100",children:["problem ",x.id]})]})]})]})]})}var F=n(52345),R=n(37664),L=n(83355),I=n(83150);let P=[{value:"100k+",label:"engineers and students",source:"Aditya, 2026-08-06"},{value:"1.4M+",label:"solutions submitted",source:"Aditya, 2026-08-06"},{value:"700+",label:"universities represented",source:"university-usage-report.md, 2026-06-23 — 769 institutions, floored"}],T=["pytorch","tinygrad","triton","cuda","sql","pandas"];async function _(e,t){try{return await (0,R.cachedFetch)(t,async()=>{let t=await fetch("".concat("https://api.deep-ml.com").concat(e),{headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("Failed to fetch ".concat(e));return t.json()})}catch(e){return null}}async function B(){var e,t,n,r,a,i,s;let l,o,c;let[d,u,m,h,x,p]=await Promise.all([_("/list-problems","problems-list"),_("/labs","labs-list"),(0,L.fetchInterviewPrepCompanies)().catch(()=>null),(0,R.cachedFetch)("projects-list",I.bl).catch(()=>null),_("/math-problems","math-list"),_("/leaderboard","leaderboard-top")]),f=null!==(n=null==d?void 0:d.problems)&&void 0!==n?n:[];if(0===f.length)return null;let b=new Set(f.map(e=>e.category).filter(Boolean)),g=T.filter(e=>b.has(e)),v=null!=m?m:[];return{problems:f.length,categories:b.size,labs:null!==(r=null==u?void 0:null===(e=u.items)||void 0===e?void 0:e.length)&&void 0!==r?r:0,tracks:v.length,companyTracks:v.filter(e=>"other"!==e.tier).length,runtimeProblems:f.filter(e=>e.category&&T.includes(e.category)).length,runtimes:g,easy:(l="easy",f.filter(e=>e.difficulty===l).length),medium:(o="medium",f.filter(e=>e.difficulty===o).length),hard:(c="hard",f.filter(e=>e.difficulty===c).length),labTitles:(null!==(a=null==u?void 0:u.items)&&void 0!==a?a:[]).map(e=>e.title).filter(e=>"string"==typeof e).slice(0,5),trackNames:v.filter(e=>"other"!==e.tier).map(e=>e.company_name).filter(e=>"string"==typeof e),categoryNames:[...b].sort(),projects:null!==(i=null==h?void 0:h.length)&&void 0!==i?i:0,mathProblems:null!==(s=null==x?void 0:null===(t=x.items)||void 0===t?void 0:t.length)&&void 0!==s?s:0,topScores:(Array.isArray(p)?p:[]).map(e=>null==e?void 0:e.flameScore).filter(e=>"number"==typeof e).slice(0,7)}}let D=[.22,1,.36,1];function W(e){let{value:t,label:n,href:r}=e,i=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"block font-jetbrainsMono text-3xl font-bold tabular-nums text-zinc-900 md:text-4xl dark:text-zinc-100",children:t}),(0,a.jsx)("span",{className:"mt-2 block font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase dark:text-zinc-500",children:n})]});return(0,a.jsx)("div",{children:r?(0,a.jsx)(o.default,{href:r,className:"group block transition-opacity duration-150 hover:opacity-70",children:i}):i})}function q(e){let{className:t=""}=e,n=(0,s.useRef)(null),r=(0,s.useRef)(!1),[i,l]=(0,s.useState)(null),o=(0,F.J)();(0,s.useEffect)(()=>{let e=n.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&!r.current&&(r.current=!0,B().then(l),t.disconnect())},{rootMargin:"400px"});return t.observe(e),()=>t.disconnect()},[]);let d=e=>
1e.toLocaleString("en-US");return(0,a.jsxs)(c.E.section,{ref:n,className:t,"aria-label":"Deep-ML by the numbers",initial:!o&&{opacity:0,y:16},whileInView:{opacity:1,y:0},viewport:{once:!0,amount:.2},transition:{duration:.5,ease:D},children:[(0,a.jsx)("h2",{className:"max-w-[24ch] font-jetbrainsMono text-2xl font-bold text-balance text-zinc-900 md:text-3xl dark:text-zinc-100",children:"Built by ML engineers. Used by a hundred thousand of them."}),(0,a.jsxs)("div",{className:"mt-10 grid grid-cols-2 gap-x-8 gap-y-10 border-t border-zinc-200 pt-8 sm:grid-cols-4 lg:grid-cols-8 dark:border-zinc-800",children:[P.slice(0,2).map(e=>(0,a.jsx)(W,{value:e.value,label:e.label},e.label)),i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(W,{value:d(i.problems),label:"problems, all free",href:"/problems"}),(0,a.jsx)(W,{value:d(i.categories),label:"categories",href:"/problems"}),i.labs>0&&(0,a.jsx)(W,{value:d(i.labs),label:"hands-on labs",href:"/labs"}),i.tracks>0&&(0,a.jsx)(W,{value:d(i.tracks),label:"interview tracks",href:"/interview-prep"}),i.projects>0&&(0,a.jsx)(W,{value:d(i.projects),label:"multi-step projects",href:"/projects"}),i.mathProblems>0&&(0,a.jsx)(W,{value:d(i.mathProblems),label:"math problems",href:"/math-problems"})]})]}),i&&(0,a.jsxs)("div",{className:"mt-10 grid grid-cols-1 gap-8 border-t border-zinc-200 pt-8 md:grid-cols-2 dark:border-zinc-800",children:[(0,a.jsxs)("p",{className:"font-inter text-sm leading-relaxed text-pretty text-zinc-600 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"mb-2 block font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase",children:"weighted past the basics"}),(0,a.jsx)("span",{className:"tabular-nums",children:d(i.easy)})," easy,"," ",(0,a.jsx)("span",{className:"tabular-nums",children:d(i.medium)})," medium and"," ",(0,a.jsx)("span",{className:"tabular-nums",children:d(i.hard)})," hard. Most of the catalogue is past the point where a tutorial would have stopped."]}),i.runtimes.length>0&&(0,a.jsxs)("p",{className:"font-inter text-sm leading-relaxed text-pretty text-zinc-600 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"mb-2 block font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase",children:"not only numpy"}),(0,a.jsx)("span",{className:"tabular-nums",children:d(i.runtimeProblems)})," ","problems run in ",i.runtimes.join(", "),". You write kernels and queries here too, not just array code."]})]}),(0,a.jsxs)("p",{className:"mt-8 font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase",children:[P[2].value," ",P[2].label]})]})}var J=n(76858);let U=[{key:"problems",name:"Problems",href:"/problems",claim:"Hands-on ML problems, and you write every line.",body:"Browse and solve machine learning coding challenges. Filter by difficulty and category, and track your progress across the catalogue.",specimen:"difficulty",hint:"click a difficulty"},{key:"paths",name:"Learning Path",href:"/paths",claim:"Every path is a book. Take one down.",body:"An ordered route through the problems, labs and projects, built in the order they make sense. Each path is bound as a book, and beginner through advanced is inside it rather than split across three separate courses.",specimen:"steps",hint:"take one down"},{key:"interview",name:"Interview Prep",href:"/interview-prep",claim:"Prepare for the company you are actually interviewing at.",body:"Pick a company, follow a paced path, build the resume projects they screen for, run timed mock interviews, and track where you are.",specimen:"tracks",hint:"pick a company"},{key:"assistant",name:"AI Assistant",href:"/study",claim:"A coach that assigns the next rep, not a chatbot.",body:"Meet Zero. Ask him anything and he answers from the real catalogue: he recommends actual problems, builds a playlist you save with one click, and remembers what you are working on. On a problem page he reads the question and your editor code, so he is tutoring you on the thing in front of you.",specimen:"assistant",hint:"tap a starter to ask him something else"},{key:"labs",name:"Labs",href:"/labs",claim:"Interactive labs on real techniques.",body:"Implement an algorithm and test it on an actual dataset, with constraints, evaluation metrics and time limits. No CUDA install, no environment to break.",specimen:"labs",hint:"open a lab"},{key:"projects",name:"Projects",href:"/projects",claim:"Build a GPT, an RL agent, CUDA kernels.",body:"An atomised series of problems that compose into a complete build. Solve every step and run the model you built.",specimen:"stack",hint:"build one"},{key:"math",name:"Math",href:"/math-problems",claim:"Pen-and-paper math for ML.",body:"Each problem opens with a worked example, then three practice problems to build mastery. Inspired by Math Academy.",detail:"From the four fundamental subspaces to PCA.",specimen:"worked",hint:"work through it"},{key:"collections",name:"Collections",href:"/collections",claim:"Curated problem sets and videos.",body:"Collections of problems organised by topic. Track your progress through each one and earn a badge when you finish it.",specimen:"badges",hint:"hover a card"},{key:"playlists",name:"Playlists",href:"/playlists",claim:"Your own problem lists, shareable.",body:"Build a playlist of problems and labs into a study plan, then share it. Copy anyone else's into your own library.",specimen:"playlist",hint:"drag to reorder"},{key:"contests",name:"Contests",href:"/contests",claim:"Fresh problem sets, ranked live.",body:"Timed coding competitions against other practitioners. New problem sets, live ranking while the clock runs.",specimen:"timer",hint:"a sample \xb7 see the real ones"},{key:"leaderboard",name:"Leaderboard",href:"/leaderboard",claim:"Where you stand, globally.",body:"The top practitioners on Deep-ML. Climb it by solving problems and finishing labs.",specimen:"ladder",hint:"drag your heat"},{key:"research",name:"Research",href:"/research",claim:"Beat the baseline and your code becomes the baseline.",body:"The crowd-trained tiny LLM. Fork one slot of the canonical model, improve it, and if you beat the hidden test metric your code merges automatically.",specimen:"merge",hint:"every dot is a submission"},{key:"discuss",name:"Discuss",href:"/discuss",claim:"Interview experiences, ML questions, contest debriefs.",body:"The community forum. Reference any problem with # and it becomes a live chip: hover it for the full question, click it and 
1you are solving.",detail:"Post authors get notified on replies and upvote milestones.",specimen:"thread",hint:"upvote it, open the replies"}];var X=n(22135),Y=n(40875),O=n(10407),Z=n(48614),H=n(78380);let V=[{name:"Anthropic",slug:"anthropic",tier:"ai-first"},{name:"OpenAI",slug:"openai",tier:"ai-first"},{name:"Google DeepMind",slug:"google-deepmind",tier:"ai-first"},{name:"Google",slug:"google",tier:"faang"},{name:"Meta",slug:"meta",tier:"faang"},{name:"NVIDIA",slug:"nvidia",tier:"faang"},{name:"Amazon",slug:"amazon-data-scientist",tier:"faang"},{name:"Jane Street",slug:"jane-street",tier:"finance"}],G=["MIT","Stanford","Carnegie Mellon","UC Berkeley","Harvard","Princeton","Cornell","Columbia","UPenn","Brown","UIUC","University of Washington","UCLA","UC San Diego","University of Michigan","UT Austin","Rice","Northwestern","NYU","USC","Northeastern","Virginia Tech","Tsinghua","Peking University","NUS","Shanghai Jiao Tong","Zhejiang University","IIT Madras","IIT Roorkee","IIIT Delhi","BITS Pilani"],K=["OpenAI","Anthropic","Google","NVIDIA","Meta","Apple","Microsoft","Amazon","Tesla","Netflix","Stripe","Mistral AI","ByteDance","Character.AI","Together.ai","Airbnb","LinkedIn","Coinbase","Spotify","JPMorgan","Morgan Stanley","Tencent","Qualcomm","Intel","Samsung","Atlassian","MongoDB","Visa","Capital One","Revolut","BMW","Airbus","Bosch","Accenture","Deloitte","Flipkart"];var Q=n(31031),$=n(58714),ee=n(93006),et=n(58937),en=n(20870),er=n(31909),ea=n(56864),ei=n(78790),es=n(44745);let el="font-jetbrainsMono text-[10px] tracking-wider uppercase",eo="text-zinc-500 dark:text-zinc-500",ec="text-zinc-900 dark:text-zinc-100",ed=[.22,1,.36,1],eu={easy:"bg-green-500",medium:"bg-yellow-500",hard:"bg-red-500"};function em(e){var t;let{d:n}=e;return(0,a.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-zinc-200 px-2 py-0.5 font-jetbrainsMono text-[10px] ".concat(eo," dark:border-zinc-700"),children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full ".concat(null!==(t=eu[n])&&void 0!==t?t:"bg-zinc-400")}),n]})}function eh(e){let{route:t,action:n,children:r,className:i=""}=e;return(0,a.jsxs)("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-800 dark:bg-zinc-900 dark:shadow-none",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b border-zinc-200 px-4 py-2.5 dark:border-zinc-800",children:[(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," truncate"),children:t}),n]}),(0,a.jsx)("div",{className:"p-4 ".concat(i),children:r})]})}function ex(e){let{on:t,children:n,onClick:r}=e;return(0,a.jsx)("button",{type:"button",onClick:r,"aria-pressed":t,className:"shrink-0 rounded-full border px-2.5 py-1 font-jetbrainsMono text-[11px] transition-colors duration-150 ".concat(t?"border-zinc-900 text-zinc-900 dark:border-zinc-100 dark:text-zinc-100":"border-zinc-200 text-zinc-500 hover:border-zinc-300 dark:border-zinc-800 dark:hover:border-zinc-700"),children:n})}let ep="-mx-1 flex gap-1.5 overflow-x-auto px-1 pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [mask-image:linear-gradient(to_right,black_88%,transparent)]";function ef(e){let{label:t,failed:n,failedLabel:r="unavailable right now"}=e;return(0,a.jsx)("div",{className:"flex h-[220px] items-center justify-center",children:(0,a.jsx)("p",{className:"".concat(el," ").concat(eo),children:n?r:t})})}function eb(e){var t,n,r,i,l;let{data:o,failed:d}=e,[u,m]=(0,s.useState)(null),[h,x]=(0,s.useState)(null),p=(null!==(n=null==o?void 0:o.categories)&&void 0!==n?n:[]).slice(0,5),f=(null!==(r=null==o?void 0:o.problems)&&void 0!==r?r:[]).filter(e=>(!u||e.difficulty===u)&&(!h||e.category===h)),b=null==o?void 0:o.totals,g=b?u&&!h?null!==(i=b[u])&&void 0!==i?i:0:h&&!u?null!==(l=null==o?void 0:null===(t=o.categories.find(e=>e.name===h))||void 0===t?void 0:t.count)&&void 0!==l?l:0:u&&h?-1:b.problems:0;return o?(0,a.jsxs)(eh,{route:"deep-ml.com/problems",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0 tabular-nums"),children:g>
1=0?"".concat(g.toLocaleString("en-US")," match"):"filtered"}),children:[(0,a.jsxs)("div",{className:"".concat(ep," mb-3"),children:[["easy","medium","hard"].map(e=>(0,a.jsx)(ex,{on:u===e,onClick:()=>m(u===e?null:e),children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full ".concat(eu[e])}),e]})},e)),(0,a.jsx)("span",{className:"mx-1 w-px shrink-0 bg-zinc-200 dark:bg-zinc-800"}),p.map(e=>(0,a.jsx)(ex,{on:h===e.name,onClick:()=>x(h===e.name?null:e.name),children:e.name},e.name))]}),(0,a.jsxs)("ul",{className:"h-[212px] overflow-hidden",children:[(0,a.jsx)(Z.M,{initial:!1,children:f.slice(0,5).map(e=>(0,a.jsxs)(c.E.li,{layout:!0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18,ease:ed},className:"flex items-center gap-3 border-b border-zinc-100 py-2.5 last:border-0 dark:border-zinc-800/60",children:[(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," w-8 shrink-0 tabular-nums"),children:e.id}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate font-jetbrainsMono text-xs ".concat(ec),children:e.title}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," hidden shrink-0 truncate sm:block"),children:e.category}),(0,a.jsx)(em,{d:e.difficulty})]},e.id))}),0===f.length&&(0,a.jsx)("li",{className:"".concat(el," ").concat(eo," py-8 text-center"),children:"nothing in this sample matches — try one filter"})]})]}):(0,a.jsx)(eh,{route:"deep-ml.com/problems",children:(0,a.jsx)(ef,{label:"loading the catalogue",failed:d})})}function eg(){var e,t,n,r,i;let l=(0,s.useRef)(null),[c,d]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=l.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(d(!0),t.disconnect())},{rootMargin:"400px"});return t.observe(e),()=>t.disconnect()},[]);let{tracks:u,loading:m,error:h}
1=(0,H.I)(c),[x,p]=(0,s.useState)(null),[f,b]=(0,s.useState)("basics"),g=(0,s.useMemo)(()=>u.map(e=>{let t=(0,es.ae)(e).length,n=function(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}(e.slug);return{slug:e.slug,h:128+n%5*7,w:92+(n>>>8)%4*6,face:{title:e.title,tierLabel:"".concat(t," steps"),blurb:e.blurb,steps:t,done:0,cloth:(0,en.s5)(e.slug)}}}),[u]),v=Math.max(...g.map(e=>e.face.steps),1),y=null!==(n=u.find(e=>e.slug===x))&&void 0!==n?n:u[0],j=null!==(r=null==y?void 0:null===(e=y.tiers)||void 0===e?void 0:e.find(e=>e.tier===f))&&void 0!==r?r:null==y?void 0:null===(t=y.tiers)||void 0===t?void 0:t[0],w=(null!==(i=null==j?void 0:j.sections)&&void 0!==i?i:[]).slice(0,3);return m?(0,a.jsx)(eh,{route:"deep-ml.com/paths",children:(0,a.jsx)("div",{ref:l,children:(0,a.jsx)(ef,{label:"taking the books down"})})}):h||0===g.length?(0,a.jsx)(eh,{route:"deep-ml.com/paths",children:(0,a.jsx)(ef,{label:h?"shelf unavailable":"no paths yet"})}):(0,a.jsxs)(eh,{route:"deep-ml.com/paths",action:(0,a.jsxs)("span",{className:"".concat(el," ").concat(eo," shrink-0 tabular-nums"),children:[g.length," books"]}),children:[(0,a.jsx)("div",{className:"-mx-1 flex items-end gap-3 overflow-x-auto px-1 pb-3 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:g.map(e=>(0,a.jsx)(o.default,{href:"/paths?book=".concat(e.slug),onMouseEnter:()=>{p(e.slug),b("basics")},onFocus:()=>{p(e.slug),b("basics")},"aria-current":(null==y?void 0:y.slug)===e.slug?"true":void 0,className:"shrink-0 rounded-sm transition-opacity duration-200 focus:ring-1 focus:ring-zinc-400 focus:outline-none ".concat((null==y?void 0:y.slug)===e.slug?"opacity-100":"opacity-70 hover:opacity-100"),children:(0,a.jsx)(er.Z,{book:e.face,w:e.w,h:e.h,fill:e.face.steps/v,ms:260})},e.slug))}),(0,a.jsx)("div",{className:"border-t border-zinc-300 dark:border-zinc-700"}),y&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,a.jsx)("h4",{className:"font-jetbrainsMono text-sm font-semibold ".concat(ec),children:y.title}),(0,a.jsx)(o.default,{href:"/paths?book=".concat(y.slug),className:"".concat(el," ").concat(eo," shrink-0 transition-colors hover:text-zinc-900 dark:hover:text-zinc-100"),children:"open it →"})]}),(0,a.jsx)("div",{className:"".concat(ep," mt-3"),children:es.uD.filter(e=>{var t;return null===(t=y.tiers)||void 0===t?void 0:t.some(t=>t.tier===e)}).map(e=>(0,a.jsx)(ex,{on:f===e,onClick:()=>b(e),children:es.VX[e]},e))}),(0,a.jsx)("ol",{className:"mt-3 min-h-[84px]",children:w.map((e,t)=>{var n,r;return(0,a.jsxs)("li",{className:"flex items-center gap-3 border-b border-zinc-100 py-2 last:border-0 dark:border-zinc-800/60",children:[(0,a.jsxs)("span",{className:"".concat(el," ").concat(eo," w-8 shrink-0 tabular-nums"),children:["ch ",t+1]}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate font-jetbrainsMono text-xs ".concat(ec),children:e.title}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0 tabular-nums"),children:null!==(r=null===(n=e.steps)||void 0===n?void 0:n.length)&&void 0!==r?r:0})]},e.title)})})]})]})}function ev(e){let{data:t,failed:n}=e,r=(0,s.useMemo)(()=>{var e;return(null!==(e=null==t?void 0:t.labs)&&void 0!==e?e:[]).filter(e=>e.dataset||e.metric).slice(0,6)},[t]),[i,l]=(0,s.useState)(0),d=r[i%Math.max(1,r.length)];if(!t||!d)return(0,a.jsx)(eh,{route:"deep-ml.com/labs",children:(0,a.jsx)(ef,{label:"loading labs",failed:n})});let u=[["dataset",d.dataset||"provided in the lab"],["evaluated on",d.metric||"a held-out split"],["direction",d.lowerIsBetter?"lower is better":"higher is better"],["hardware",d.gpu?"GPU provided":"CPU, no setup"]];return(0,a.jsx)(eh,{route:"deep-ml.com/labs \xb7 ".concat(d.category.toLowerCase()),action:(0,a.jsx)("button",{type:"button",onClick:()=>l(e=>(e+1)%r.length),className:"".concat(el," ").concat(eo," shrink-0 transition-colors hover:text-zinc-900 dark:hover:text-zinc-100"),children:"next lab →"}),children:(0,a.jsx)(Z.M,{mode:"wait",initial:!1,children:(0,a.jsxs)(c.E.div,{initial:{opacity:0,y:6}
1,animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,ease:ed},children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsx)("h4",{className:"font-jetbrainsMono text-sm font-semibold ".concat(ec),children:d.title}),(0,a.jsx)(em,{d:d.difficulty})]}),(0,a.jsx)("dl",{className:"mt-4 space-y-0",children:u.map(e=>{let[t,n]=e;return(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-4 border-b border-zinc-100 py-2 last:border-0 dark:border-zinc-800/60",children:[(0,a.jsx)("dt",{className:"".concat(el," ").concat(eo," shrink-0"),children:t}),(0,a.jsx)("dd",{className:"truncate font-jetbrainsMono text-xs ".concat(ec),children:n})]},t)})}),(0,a.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,a.jsx)(o.default,{href:d.id?"/labs/".concat(d.id):"/labs",className:"inline-flex h-8 items-center rounded-lg bg-zinc-900 px-3 font-jetbrainsMono text-xs font-medium text-white transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white",children:"run against the dataset"}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo),children:"scored, not just passed"})]})]},d.id)})})}function ey(e){var t;let{data:n,failed:r}=e,i=(null!==(t=null==n?void 0:n.projects)&&void 0!==t?t:[]).slice(0,5),[l,o]=(0,s.use
1State)(0),[d,u]=(0,s.useState)(0),m=i[l],h=(0,F.J)();if((0,s.useEffect)(()=>{u(0)},[l]),(0,s.useEffect)(()=>{if(0===d||!m||h||d>=m.steps)return;let e=window.setInterval(()=>u(e=>e>=m.steps?e:e+1),24);return()=>window.clearInterval(e)},[d,m,h]),!n||!m)return(0,a.jsx)(eh,{route:"deep-ml.com/projects",children:(0,a.jsx)(ef,{label:"loading projects",failed:r})});let x=Math.round(d/m.steps*100);return(0,a.jsx)(eh,{route:"deep-ml.com/projects",action:(0,a.jsx)("button",{type:"button",onClick:()=>o(e=>(e+1)%i.length),className:"".concat(el," ").concat(eo," shrink-0 transition-colors hover:text-zinc-900 dark:hover:text-zinc-100"),children:"next project →"}),children:(0,a.jsx)(Z.M,{mode:"wait",initial:!1,children:(0,a.jsxs)(c.E.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,ease:ed},children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsx)("h4",{className:"font-jetbrainsMono text-sm font-semibold ".concat(ec),children:m.title}),(0,a.jsx)(em,{d:m.difficulty})]}),(0,a.jsx)("p",{className:"mt-2 line-clamp-3 font-inter text-xs leading-relaxed text-zinc-600 dark:text-zinc-400",children:m.description}),(0,a.jsxs)("div",{className:"mt-4 flex items-baseline gap-5",children:[(0,a.jsxs)("span",{className:"font-jetbrainsMono text-2xl tabular-nums ".concat(ec),children:[m.steps,(0,a.jsx)("span",{className:"ml-1.5 text-[10px] tracking-wider uppercase ".concat(eo),children:"steps"})]}),m.parts>0&&(0,a.jsxs)("span",{className:"font-jetbrainsMono text-2xl tabular-nums ".concat(ec),children:[m.parts,(0,a.jsx)("span",{className:"ml-1.5 text-[10px] tracking-wider uppercase ".concat(eo),children:"parts"})]})]}),(0,a.jsx)("div",{className:"mt-4 flex h-1.5 gap-[2px]",children:Array.from({length:Math.min(m.steps,48)},(e,t)=>(0,a.jsx)("span",{className:"flex-1 rounded-full transition-colors duration-100 ".concat(t<d/m.steps*Math.min(m.steps,48)?"bg-zinc-900 dark:bg-zinc-100":"bg-zinc-200 dark:bg-zinc-800")},t))}),(0,a.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,a.jsx)("button",{type:"button",onClick:()=>u(1),className:"inline-flex h-8 items-center rounded-lg bg-zinc-900 px-3 font-jetbrainsMono text-xs font-medium text-white transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white",children:"build it"}),(0,a.jsx)("span",{className:"".concat(el," ").concat(100===x?ec:eo," tabular-nums"),children:100===x?"complete — now it runs":"".concat(x,"% built")})]})]},m.id)})})}function ej(e){var t,n;let{data:r,failed:i}=e,l=(null!==(t=null==r?void 0:r.mathTopics)&&void 0!==t?t:[]).slice(0,4),[o,c]=(0,s.useState)(0),d=l[o],u=(null!==(n=null==r?void 0:r.math)&&void 0!==n?n:[]).filter(e=>e.topic===d).slice(0,4);return r&&d?(0,a.jsxs)(eh,{route:"deep-ml.com/math-problems",action:(0,a.jsxs)("span",{className:"".concat(el," ").concat(eo," shrink-0 tabular-nums"),children:[r.math.length," total"]}),children:[(0,a.jsx)("div",{className:"".concat(ep," mb-3"),children:l.map((e,t)=>(0,a.jsx)(ex,{on:o===t,onClick:()=>c(t),children:e},e))}),(0,a.jsx)("ul",{className:"min-h-[168px]",children:u.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-center gap-3 border-b border-zinc-100 py-2.5 last:border-0 dark:border-zinc-800/60",children:[(0,a.jsx)("span",{className:"".concat(el," shrink-0 rounded px-1.5 py-0.5 ").concat(0===t?"bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900":"".concat(eo," border border-dashed border-zinc-300 dark:border-zinc-700")),children:0===t?"worked":"you"}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate font-jetbrainsMono text-xs ".concat(ec),children:e.title}),(0,a.jsx)(em,{d:e.difficulty})]},e.id))}),(0,a.jsx)("p",{className:"".concat(el," ").concat(eo," mt-3"),children:"one is worked through in full, the rest are yours"})]}):(0,a.jsx)(eh,{route:"deep-ml.com/math-problems",children:(0,a.jsx)(ef,{label:"loading math",failed:i})})}function ew(e){var t;let{data:n}=e,[r,i]=(0,s.useState)(2),l=(0,s.useMemo)(()=>et.nb.slice(0,3).map(e=>({key:e,spec:et.ju[e]})),[]),[o,c]=(0,s.useState)(0),d=l[o],u=r>=8,m=null==n?void 0:null===(t=n.categories.find(e=>/deep learning/i.test(e.name)))||void 0===t?void 0:t.count;return d?(0,a.jsxs)(eh,{route:"deep-ml.com/collections",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0"),children:"hover a card"}),children:[(0,a.jsx)("div",{className:"grid grid-cols-3 gap-3",children:l.map((e,t)=>{var n,r,s;return(0,a.jsxs)("button",{type:"button",onClick:()=>{c(t),i(2)},"aria-pressed":o===t,className:"overflow-hidden rounded-lg border p-2 text-left transition-colors duration-150 ".concat(o===t?"border-zinc-900 dark:border-zinc-100":"border-zinc-200 hover:border-zinc-300 dark:border-zinc-800 dark:hover:border-zinc-700"),children:[(0,a.jsx)(ee.Z,{spec:e.spec,className:"w-full"}),(0,a.jsx)("span",{className:"mt-2 block truncate font-jetbrainsMono text-[11px] ".concat(ec),children:e.spec.title}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," mt-0.5 block truncate"),children:null!==(s=null===(r=e.spec.caption)||void 0===r?void 0:null===(n=r.split("\xb7")[0])||void 0===n?void 0:n.trim())&&void 0!==s?s:"architecture"})]},e.key)})}),(0,a.jsxs)("div",{className:"mt-4 border-t border-zinc-100 pt-3 dark:border-zinc-800/60",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,a.jsx)("span",{className:"truncate font-jetbrainsMono text-xs ".concat(ec),children:d.spec.title}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0 tabular-nums"),children:m?"".concat(m," in this topic"):"curated set"})]}),(0,a.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-4",children:[(0,a.jsx)("div",{className:"flex gap-1.5",children:Array.from({length:8},(e,t)=>(0,a.jsx)("button",{type:"button","aria-label":"Problem ".concat(t+1),onClick:()=>i(t+1),className:"h-5 w-5 rounded-full border transition-colors duration-150 ".concat(t<r?"border-zinc-900 bg-zinc-900 dark:border-zinc-100 dark:bg-zinc-100":"border-dashed border-zinc-300 hover:border-zinc-400 dark:border-zinc-700")},t))}),(0,a.jsx)("span",{className:"".concat(el," ").concat(u?ec:eo," shrink-0 tabular-nums"),children:u?"badge earned":"".concat(r,"/").concat(8)})]})]})]}):(0,a.jsx)(eh,{route:"deep-ml.com/collections",children:(0,a.jsx)(ef,{label:"loading collections"})})}function ek(e){let{data:t,failed:n}=e,r=(0,s.useMemo)(()=>{var e;return(null!==(e=null==t?void 0:t.problems)&&void 0!==e?e:[]).slice(2,7)}
1,[t]),[i,l]=(0,s.useState)([]),[c,d]=(0,s.useState)(null),u=(0,s.useRef)(null),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{l(r)},[r]);let h=(0,s.useCallback)((e,t)=>{l(n=>{if(t<0||t>=n.length||t===e)return n;let r=[...n],[a]=r.splice(e,1);return r.splice(t,0,a),r}),u.current=t,d(t)},[]),x=e=>{let t=m.current;if(!t||0===i.length)return null;let n=t.getBoundingClientRect(),r=n.height/i.length;return Math.min(i.length-1,Math.max(0,Math.floor((e-n.top)/r)))};return t&&0!==i.length?(0,a.jsxs)(eh,{route:"deep-ml.com/playlists \xb7 my study plan",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0"),children:"drag to reorder"}),children:[(0,a.jsx)("ul",{ref:m,className:"space-y-1.5 select-none",children:i.map((e,t)=>(0,a.jsxs)("li",{onPointerDown:e=>{u.current=t,d(t),function(e){try{var t,n;null===(t=(n=e.currentTarget).setPointerCapture)||void 0===t||t.call(n,e.pointerId)}catch(e){}}(e)},onPointerMove:e=>{let t=u.current;if(null===t)return;let n=x(e.clientY);null!==n&&h(t,n)},onPointerUp:()=>{u.current=null,d(null)},onPointerCancel:()=>{u.current=null,d(null)},className:"flex cursor-grab touch-none items-center gap-3 rounded-lg border px-3 py-2 transition-colors ".concat(c===t?"border-zinc-900 bg-zinc-50 dark:border-zinc-100 dark:bg-zinc-800":"border-zinc-200 hover:border-zinc-300 dark:border-zinc-800 dark:hover:border-zinc-700"),children:[(0,a.jsxs)("span",{"aria-hidden":"true",className:"flex shrink-0 flex-col gap-[3px]",children:[(0,a.jsx)("span",{className:"h-px w-3 bg-zinc-400 dark:bg-zinc-600"}),(0,a.jsx)("span",{className:"h-px w-3 bg-zinc-400 dark:bg-zinc-600"}),(0,a.jsx)("span",{className:"h-px w-3 bg-zinc-400 dark:bg-zinc-600"})]}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," w-4 shrink-0 tabular-nums"),children:t+1}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate font-jetbrainsMono text-xs ".concat(ec),children:e.title}),(0,a.jsx)(em,{d:e.difficulty})]},e.id))}),(0,a.jsxs)("div",{className:"mt-4 flex items-center gap-2 border-t border-zinc-100 pt-3 dark:border-zinc-800/60",children:[(0,a.jsx)("span",{className:"inline-flex h-8 items-center rounded-lg border border-zinc-200 px-3 font-jetbrainsMono text-[11px] text-zinc-500 dark:border-zinc-800",children:"deep-ml.com/playlists/…"}),(0,a.jsx)(o.default,{href:"/playlists",className:"inline-flex h-8 items-center rounded-lg bg-zinc-900 px-3 font-jetbrainsMono text-xs font-medium text-white transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white",children:"share"})]})]}):(0,a.jsx)(eh,{route:"deep-ml.com/playlists",children:(0,a.jsx)(ef,{label:"loading playlists",failed:n})})}function ez(e){var t;let{data:n,failed:r}=e,i=(0,s.useMemo)(()=>{var e;let t=(null!==(e=null==n?void 0:n.tracks)&&void 0!==e?e:[]).filter(e=>"other"!==e.tier);return t.length>0?t:V.map(e=>({slug:e.slug,name:e.name,tier:e.tier,roleCount:0,roleNames:[]}))}
1,[n]),[l,d]=(0,s.useState)(0),u=i[l];if(!u)return(0,a.jsx)(eh,{route:"deep-ml.com/interview-prep",children:(0,a.jsx)(ef,{label:"loading tracks",failed:r})});let m=u.roleCount||u.roleNames.length;return(0,a.jsxs)(eh,{route:"deep-ml.com/interview-prep",action:(0,a.jsxs)("span",{className:"".concat(el," ").concat(eo," shrink-0 tabular-nums"),children:[null!==(t=null==n?void 0:n.tracks.length)&&void 0!==t?t:i.length," tracks"]}),children:[(0,a.jsx)("div",{className:"".concat(ep," mb-4"),children:i.map((e,t)=>(0,a.jsx)(ex,{on:l===t,onClick:()=>d(t),children:e.name},e.slug))}),(0,a.jsx)(Z.M,{mode:"wait",initial:!1,children:(0,a.jsxs)(c.E.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,ease:ed},className:"min-h-[176px]",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,a.jsx)("h4",{className:"font-jetbrainsMono text-sm font-semibold ".concat(ec),children:u.name}),(0,a.jsxs)("span",{className:"".concat(el," ").concat(eo," shrink-0 tabular-nums"),children:[m," ",1===m?"role":"roles"]})]}),(0,a.jsx)("ul",{className:"mt-3 space-y-0",children:(u.roleNames.length?u.roleNames:["Machine Learning Engineer"]).slice(0,4).map(e=>(0,a.jsx)("li",{children:(0,a.jsxs)(o.default,{href:"/interview-prep/".concat(u.slug),className:"group flex items-center gap-3 border-b border-zinc-100 py-2 transition-colors hover:bg-zinc-50 dark:border-zinc-800/60 dark:hover:bg-zinc-800/40",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-zinc-300 transition-colors group-hover:bg-zinc-900 dark:bg-zinc-700 dark:group-hover:bg-zinc-100"}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate font-jetbrainsMono text-xs ".concat(ec),children:e}),(0,a.jsx)(J.Z,{className:"h-3 w-3 shrink-0 text-zinc-400 opacity-0 transition-all duration-150 group-hover:translate-x-0.5 group-hover:opacity-100 motion-reduce:transition-none dark:text-zinc-600","aria-hidden":"true"})]})},e))})]},u.slug)}),(0,a.jsx)("p",{className:"".concat(el," ").concat(eo," mt-3"),children:"paced path \xb7 resume projects \xb7 timed mocks"})]})}function eN(){let[e,t]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=window.setTimeout(()=>t(!0),200);return()=>window.clearTimeout(e)},[]),(0,a.jsx)(eh,{route:"deep-ml.com/contests",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0"),children:"sample"}),children:(0,a.jsxs)(o.default,{href:"/contests",className:"group block w-full overflow-hidden rounded-xl border border-zinc-200 bg-white p-5 transition-colors duration-150 hover:border-zinc-300 dark:border-zinc-800 dark:bg-zinc-900 dark:hover:border-zinc-700",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,a.jsx)("span",{className:"absolute inline-flex h-2 w-2 animate-ping rounded-full bg-green-500 opacity-60 motion-reduce:animate-none"}),(0,a.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo),children:"active"})]}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," tabular-nums"),children:e?"1d 6h left":"—"})]}),(0,a.jsx)("h4",{className:"mt-8 max-w-[18ch] font-jetbrainsMono text-xl leading-snug font-bold text-balance text-zinc-900 dark:text-zinc-100",children:"Tabular Classification Showdown"}),(0,a.jsx)("p",{className:"mt-2 max-w-[52ch] font-inter text-xs leading-relaxed text-zinc-600 dark:text-zinc-400",children:"Build the best classifier on a held-out synthetic tabular dataset, scored live while the clock runs."}),(0,a.jsxs)("div",{className:"mt-8 flex items-end justify-between gap-3 border-t border-zinc-100 pt-3 dark:border-zinc-800/60",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," block"),children:"open practice"}),(0,a.jsx)("span",{className:"font-jetbrainsMono text-sm font-semibold ".concat(ec),children:"Tabular Data"})]}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," transition-colors group-hover:text-zinc-900 dark:group-hover:text-zinc-100"),children:"see the real ones →"})]})]})})}function eM(e){let{score:t,size:n=14}=e;return(0,a.jsx)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"shrink-0 ".concat(t>500?"text-red-500":"text-orange-500"),children:(0,a.jsx)("path",{d:"M12 2c.6 3.2-1.2 4.6-2.6 6C7.7 9.6 6 11.2 6 14a6 6 0 0 0 12 0c0-2.4-1.1-4.2-2.4-5.6-.5 1-1.2 1.7-2 2 .4-2.6-.6-5.6-3.6-8.4Z",fill:"currentColor"})})}function eS(e){let{data:t,failed:n}=e,r=(0,s.useMemo)(()=>{var e;return null!==(e=null==t?void 0:t.topScores)&&void 0!==e?e:[]}
1,[t]),i=r[0],[l,o]=(0,s.useState)(0);if((0,s.useEffect)(()=>{i&&o(Math.round(.45*i))},[i]),!t||0===r.length)return(0,a.jsx)(eh,{route:"deep-ml.com/leaderboard",children:(0,a.jsx)(ef,{label:"loading the board",failed:n})});let c=r.filter(e=>e>l).length+1,d=r[0]||1,u=[...r.slice(0,6).map((e,t)=>({key:"s".concat(t),score:e,you:!1}))],m=Math.min(c-1,u.length);return u.splice(m,0,{key:"you",score:l,you:!0}),(0,a.jsxs)(eh,{route:"deep-ml.com/leaderboard",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0"),children:"heat, live"}),children:[(0,a.jsx)("ul",{children:u.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-center gap-3 border-b border-zinc-100 py-2 last:border-0 dark:border-zinc-800/60 ".concat(e.you?"bg-zinc-50 dark:bg-zinc-800/40":""),children:[(0,a.jsx)("span",{className:"".concat(el," w-6 shrink-0 tabular-nums ").concat(e.you?ec:eo),children:t+1}),(0,a.jsx)(eM,{score:e.score}),(0,a.jsx)("span",{className:"font-jetbrainsMono text-xs tabular-nums ".concat(e.score>500?"font-semibold text-red-600 dark:text-red-400":ec),children:Math.round(e.score).toLocaleString("en-US")}),e.you&&(0,a.jsx)("span",{className:"".concat(el," ").concat(ec," shrink-0"),children:"you"}),(0,a.jsx)("span",{className:"ml-auto shrink-0",children:(0,a.jsx)(ea.Z,{flame:e.score,showEvolution:e.you})})]},e.key))}),(0,a.jsx)("input",{type:"range",min:0,max:Math.round(1.05*d),value:l,onChange:e=>o(Number(e.target.value)),"aria-label":"Your Heat",className:"mt-4 h-1 w-full cursor-ew-resize appearance-none rounded-full bg-zinc-200 accent-zinc-900 dark:bg-zinc-800 dark:accent-zinc-100"}),(0,a.jsx)("p",{className:"".concat(el," ").concat(eo," mt-3"),children:"drag your heat \xb7 solves and labs earn it, levels come with it"})]})}let eC=[{q:"What should I solve next?",reply:"Start with the loop itself, then make it harder. These three are the same idea three times, each one taking a support away:",action:{kind:"recommend",items:[{type:"problem",id:"15",reason:"the whole training loop, in about twenty lines"},{type:"problem",id:"802",reason:"same loop, one sample at a time"},{type:"problem",id:"47",reason:"now swap the update rule and watch it change"}]}},{q:"Build me a study plan for ML interviews",reply:"Interviews lean on the classics you can derive on a whiteboard. Four, closed form first so you have something to check the iterative ones against:",action:{kind:"playlist",proposal:{name:"ML interview warm-up",description:"The four every loop asks about, closed form before iterative.",icon:"target",color:"#3b82f6",tags:["interviews","fundamentals"],items:[{id:"14",type:"problem"},{id:"15",type:"problem"},{id:"1228",type:"problem"},{id:"106",type:"problem"}]}}},{q:"Explain gradient descent from scratch",reply:"Take one weight, w = 3, and a loss that is just (w - 1)\xb2. The slope there is 2(w - 1) = 4, positive, so the loss grows as w grows and you should go the other way. Step a little against it: w = 3 - 0.1 x 4 = 2.6. Do that again and you crawl toward 1. That is the whole algorithm — the gradient points uphill, and you keep stepping downhill by a fraction of it. Here it is moving:",action:{kind:"visual",problemId:"15"}},{q:"What are my weakest topics?",reply:"I read your solve history for that, so it is thin until you have solved a few. What I look at is where you stop: attempts without a pass, and whole categories you have never opened. For most people at the start it is attention — everyone reads about it and nobody implements it:",action:{kind:"recommend",items:[{type:"problem",id:"1019",reason:"the memory cost nobody can estimate on the spot"},{type:"problem",id:"1014",reason:"then the cache that makes it survivable"}]}}],eA=Math.max(0,eC.findIndex(e=>"visual"===e.action.kind));function eE(e){let{data:t,failed:n}
1=e,[r,i]=(0,s.useState)(null),[l,o]=(0,s.useState)(null),[d,u]=(0,s.useState)(0),[m,h]=(0,s.useState)(!1),[x,p]=(0,s.useState)(!1),f=(0,s.useRef)(null),b=(0,F.J)();(0,s.useEffect)(()=>{let e=f.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(p(!0),t.disconnect())},{rootMargin:"400px"});return t.observe(e),()=>t.disconnect()},[t]),(0,s.useEffect)(()=>{if(!x)return;let e=!0;return(0,L.fetchPathCatalogs)().then(t=>e&&i(t)).catch(()=>{}),()=>{e=!1}},[x]),(0,s.useEffect)(()=>{let e=f.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(h(!0),t.disconnect())},{threshold:.35});return t.observe(e),()=>t.disconnect()},[t]),(0,s.useEffect)(()=>{if(!m)return;let e=()=>o(e=>null===e?eA:e);if(b){e();return}let t=window.setTimeout(e,700);return()=>window.clearTimeout(t)},[m,b]);let g=null===l?null:eC[l];(0,s.useEffect)(()=>{let e;if(!g)return;if(b){u(g.reply.length);return}u(0);let t=window.setTimeout(()=>{e=window.setInterval(()=>{u(t=>t>=g.reply.length?(e&&window.clearInterval(e),t):t+3)},16)},450);return()=>{window.clearTimeout(t),e&&window.clearInterval(e)}},[g,b]);let v=(0,s.useMemo)(()=>({problemIds:new Set,labIds:new Set,mathIds:new Set,projects:new Map,loading:!1,error:!1}),[]);if(!t)return(0,a.jsx)(eh,{route:"deep-ml.com/study",children:(0,a.jsx)(ef,{label:"waking the assistant",failed:n})});let y=!!g&&d>=g.reply.length;return(0,a.jsx)(eh,{route:"deep-ml.com/study",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0"),children:"scripted"}),children:(0,a.jsx)("div",{ref:f,className:"min-h-[320px]",children:g?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(c.E.div,{className:"flex justify-end",initial:!b&&{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,ease:ed},children:(0,a.jsx)("span",{className:"max-w-[80%] rounded-xl rounded-br-sm bg-zinc-900 px-3 py-2 font-jetbrainsMono text-xs text-white dark:bg-zinc-100 dark:text-zinc-900",children:g.q})},g.q),(0,a.jsxs)("div",{className:"group/zero flex gap-2.5",children:[(0,a.jsx)(c.E.span,{className:"mt-0.5 shrink-0",animate:y||b?{y:0}:{y:[0,-2,0]},transition:y||b?{duration:.2}:{duration:.7,repeat:1/0,ease:"easeInOut"},children:(0,a.jsx)(Q.Z,{awake:!0,className:"h-6 w-6 text-zinc-800 dark:text-zinc-200"})}),(0,a.jsxs)("p",{className:"font-inter text-xs leading-relaxed text-zinc-700 dark:text-zinc-300",children:[g.reply.slice(0,d),!y&&(0,a.jsx)("span",{className:"ml-0.5 inline-block h-3 w-1.5 translate-y-[1px] bg-zinc-400 dark:bg-zinc-600"})]})]}),y&&r&&(0,a.jsxs)(c.E.div,{initial:!b&&{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3,ease:ed},className:"pl-8",children:["recommend"===g.action.kind&&(0,a.jsx)($.VA,{items:g.action.items,catalogs:r,solved:v,openInNewTab:!0}),"playlist"===g.action.kind&&(0,a.jsx)($.ZQ,{proposal:g.action.proposal,catalogs:r,solved:v,openInNewTab:!0}
1),"visual"===g.action.kind&&(0,a.jsx)($.lG,{problemId:g.action.problemId,catalogs:r,openInNewTab:!0})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-2 pl-8",children:eC.map((e,t)=>t===l?null:(0,a.jsx)("button",{type:"button",onClick:()=>o(t),className:"".concat(el," ").concat(eo," max-w-full truncate transition-colors hover:text-zinc-900 dark:hover:text-zinc-100"),children:e.q},e.q))})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"group/zero flex items-center gap-3",children:[(0,a.jsx)(Q.Z,{className:"h-11 w-11 shrink-0 text-zinc-900 dark:text-zinc-100"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"".concat(el," ").concat(ec),children:"zero — the study bot"}),(0,a.jsx)("p",{className:"".concat(el," ").concat(eo," mt-0.5"),children:"asleep. ask him anything"})]})]}),(0,a.jsx)("div",{className:"mt-4 flex flex-col items-start gap-2",children:eC.map((e,t)=>(0,a.jsx)("button",{type:"button",onClick:()=>o(t),className:"max-w-full truncate rounded-full border border-zinc-200 px-3 py-1.5 text-left font-jetbrainsMono text-xs text-zinc-600 transition-colors duration-150 hover:border-zinc-900 hover:text-zinc-900 dark:border-zinc-800 dark:text-zinc-400 dark:hover:border-zinc-100 dark:hover:text-zinc-100",children:e.q},e.q))}),(0,a.jsx)("p",{className:"".concat(el," ").concat(eo," mt-5"),children:"on a problem page he reads your code too"})]})})})}function eF(e){var t,n,r;let{data:i,failed:l}=e,[o,c]=(0,s.useState)(null),d=null!==(n=null==i?void 0:i.research)&&void 0!==n?n:null,u=(0,s.useMemo)(()=>{if(!d||!d.canonicalMetric)return[];let e=Math.max(3,Math.min(d.canonicalVersion,11)),t=1.34*d.canonicalMetric,n=[],r=0;for(let a=0;a<26;a++){let i=a%2==1&&r<e,s=r/e,l=t+(d.canonicalMetric-t)*s,o=.02+37*a%11/140,c=i?t+(d.canonicalMetric-t)*((r+1)/e):l+o;n.push({id:"v".concat(a),slot_ids:[["tokenizer","architecture","recipe"][a%3]],version:i?r+1:null,generation:a,author_user_id:"",author_name:"",status:i?"promoted":"scored",reject_reason:null,promoted:i,val_metric:Number(c.toFixed(6)),test_metric:Number(c.toFixed(6)),baseline_test_metric:Number(l.toFixed(6)),improvement:i?Number((l-c).toFixed(6)):null,steps_run:2e3,wall_clock_seconds:900,created_at:new Date(Date.UTC(2026,5,1+a,12)).toISOString(),promoted_at:null}),i&&r++}return n},[d]);if(!i)return(0,a.jsx)(eh,{route:"deep-ml.com/research",children:(0,a.jsx)(ef,{label:"loading the challenge",failed:l})});if(!d||0===u.length)return(0,a.jsx)(eh,{route:"deep-ml.com/research",children:(0,a.jsx)(ef,{label:"challenge unavailable"})});let m=u.filter(e=>e.promoted).length;return(0,a.jsxs)(eh,{route:"deep-ml.com/research \xb7 experiments",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0"),children:"sample runs"}),children:[(0,a.jsx)(ei.Z,{versions:u,baseline:null!==(r=null===(t=u[0])||void 0===t?void 0:t.baseline_test_metric)&&void 0!==r?r:null,metricLabel:d.metricName.replace(/_/g," "),lowerIsBetter:d.lowerIsBetter,selectedId:o,onSelect:e=>{var t;return c(null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null)},height:188}),(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1",children:[(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," truncate"),children:d.title}),(0,a.jsxs)("span",{className:"".concat(el," ").concat(eo," tabular-nums"),children:["canonical v",d.canonicalVersion," \xb7"," ",d.canonicalMetric.toFixed(4)," ",d.metricName.replace(/_/g," ")]})]}),(0,a.jsxs)("p",{className:"".concat(el," ").concat(eo," mt-2"),children:[m," of ",u.length," merged \xb7 the rest were discarded"]})]})}function eR(){let[e,t]=(0,s.useState)(!1),[n,r]=(0,s.useState)(!1);return(0,a.jsx)(eh,{route:"deep-ml.com/discuss",action:(0,a.jsx)("span",{className:"".concat(el," ").concat(eo," shrink-0"),children:"sample"}),children:(0,a.jsxs)("div",{className:"w-full rounded-xl border border-zinc-200 bg-white p-5 dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-flex items-center whitespace-nowrap rounded-full border border-zinc-200 px-2 py-px text-[10px] font-medium text-zinc-600 dark:border-zinc-700 dark:text-zinc-400",children:"Interview Experiences"}),(0,a.jsx)("span",{className:"".concat(el," ").concat(eo),children:"2h ago"})]}),(0,a.jsx)("h4",{className:"mt-3 font-jetbrainsMono text-lg font-bold leading-snug text-balance text-zinc-900 dark:text-zinc-100",children:"Amazon MLE onsite: what they actually asked"}),(0,a.jsxs)("p",{className:"mt-2 font-inter text-xs leading-relaxed text-zinc-600 dark:text-zinc-400",children:["Round two was a coding screen. They asked me to implement"," ",(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-zinc-200 px-2 py-px align-middle font-jetbrainsMono text-[11px] font-medium text-zinc-700 dark:border-zinc-700 dark:text-zinc-300",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}
1),"Softmax"]})," ","from scratch, then walk through the numerical stability fix."]}),(0,a.jsxs)("div",{className:"mt-4 flex items-center gap-2 border-t border-zinc-100 pt-3 dark:border-zinc-800/60",children:[(0,a.jsxs)("button",{type:"button","aria-pressed":e,onClick:()=>t(e=>!e),className:"inline-flex h-7 items-center gap-1 rounded-lg border px-2 font-jetbrainsMono text-xs tabular-nums transition-colors duration-150 ".concat(e?"border-orange-300 bg-orange-50 text-orange-600 dark:border-orange-500/40 dark:bg-orange-500/10 dark:text-orange-400":"border-zinc-200 text-zinc-600 hover:bg-zinc-100 dark:border-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800"),children:[(0,a.jsx)(X.Z,{className:"h-3.5 w-3.5"}),41+(e?1:0)]}),(0,a.jsxs)("button",{type:"button",onClick:()=>r(e=>!e),className:"inline-flex h-7 items-center gap-1 rounded-lg px-2 font-jetbrainsMono text-xs tabular-nums text-zinc-500 transition-colors duration-150 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:[n?(0,a.jsx)(Y.Z,{className:"h-3.5 w-3.5"}):(0,a.jsx)(O.Z,{className:"h-3.5 w-3.5"}),n?"Hide replies":"3 replies"]}),(0,a.jsx)(o.default,{href:"/discuss",className:"".concat(el," ").concat(eo," ml-auto transition-colors hover:text-zinc-900 dark:hover:text-zinc-100"),children:"see the real threads →"})]}),n&&(0,a.jsxs)("div",{className:"mt-3 space-y-2 border-l border-zinc-200 pl-3 dark:border-zinc-800",children:[(0,a.jsx)("p",{className:"font-inter text-xs leading-relaxed text-zinc-600 dark:text-zinc-400",children:"Got the same question last month, so this is still current."}),(0,a.jsx)("p",{className:"font-inter text-xs leading-relaxed text-zinc-600 dark:text-zinc-400",children:"The stable version subtracts the max first - that follow-up is the whole interview."}),(0,a.jsx)("p",{className:"".concat(el," ").concat(eo),children:"1 more reply on the real thread"})]})]})})}function eL(e){let{kind:t,data:n,failed:r=!1}=e;switch(t){case"difficulty":return(0,a.jsx)(eb,{data:n,failed:r});case"steps":return(0,a.jsx)(eg,{});case"labs":return(0,a.jsx)(ev,{data:n,failed:r});case"stack":return(0,a.jsx)(ey,{data:n,failed:r});case"worked":return(0,a.jsx)(ej,{data:n,failed:r});case"badges":return(0,a.jsx)(ew,{data:n,failed:r});case"playlist":return(0,a.jsx)(ek,{data:n,failed:r});case"tracks":return(0,a.jsx)(ez,{data:n,failed:r});case"timer":return(0,a.jsx)(eN,{});case"ladder":return(0,a.jsx)(eS,{data:n,failed:r});case"assistant":return(0,a.jsx)(eE,{data:n,failed:r});case"thread":return(0,a.jsx)(eR,{});default:return(0,a.jsx)(eF,{data:n,failed:r})}}let eI=new Map;V.forEach((e,t)=>eI.set(e.name.toLowerCase(),t)),K.forEach((e,t)=>{let n=e.toLowerCase();eI.has(n)||eI.set(n,V.length+t)});let eP=e=>{var t;return null!==(t=eI.get(e.toLowerCase()))&&void 0!==t?t:Number.MAX_SAFE_INTEGER};async function eT(e,t){try{return await (0,R.cachedFetch)(t,async()=>{let t=await fetch("".concat("https://api.deep-ml.com").concat(e),{headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("Failed to fetch ".concat(e));return t.json()})}catch(e){return null}}let e_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof e&&e.trim()?e.trim():t},eB=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e&&Number.isFinite(e)?e:t};async function eD(){var e,t,n,r;let a,i,s;let[l,o,c,d,u,m,h]=await Promise.all([eT("/list-problems","problems-list"),eT("/labs","labs-list"),(0,R.cachedFetch)("projects-list",I.bl).catch(()=>null),eT("/math-problems","math-list"),(0,L.fetchInterviewPrepCompanies)().catch(()=>null),eT("/leaderboard","leaderboard-top"),eT("/research","research-challenges")]),x=null!==(e=null==l?void 0:l.problems)&&void 0!==e?e:[];if(0===x.length)return null;let p=x.map(e=>({id:e_(e.id),title:e_(e.title),category:e_(e.category,"General"),difficulty:e_(e.difficulty,"medium")})),f=new Map;for(let e of p)f.set(e.category,(null!==(t=f.get(e.category))&&void 0!==t?t:0)+1);let b=null!==(n=null==o?void 0:o.items)&&void 0!==n?n:[],g=(null!==(r=null==d?void 0:d.items)&&void 0!==r?r:[]).map(e=>({id:e_(e.id),title:e_(e.title),topic:e_(e.topic,"Mathematics"),difficulty:e_(e.difficulty,"medium")}));return{problems:function(e,t){if(e.length<=24)return e;let n=e.length/24;return Array.from({length:24},(t,r)=>e[Math.floor(r*n)])}(p.filter(e=>e.title),24),totals:{problems:p.length,easy:(a="easy",p.filter(e=>e.difficulty===a).length),medium:(i="medium",p.filter(e=>e.difficulty===i).length),hard:(s="hard",p.filter(e=>e.difficulty===s).length)},categories:[...f.entries()].map(e=>{let[t,n]=e;return{name:t,count:n}}).sort((e,t)=>
1t.count-e.count),labs:b.map(e=>({id:e_(e.id),title:e_(e.title),category:e_(e.category,"Machine Learning"),difficulty:e_(e.difficulty,"medium"),dataset:e_(e.dataset),metric:e_(e.evaluation_metric),gpu:!0===e.gpu,lowerIsBetter:!0===e.lower_is_better})).filter(e=>e.title),projects:(null!=c?c:[]).map(e=>({id:e_(e.id),title:e_(e.title),description:e_(e.description),difficulty:e_(e.difficulty,"medium"),steps:eB(e.total_steps),parts:Array.isArray(e.parts)?e.parts.length:eB(e.parts),tags:Array.isArray(e.tags)?e.tags.slice(0,3):[]})).filter(e=>e.title&&e.steps>0).sort((e,t)=>t.steps-e.steps),math:g,mathTopics:[...new Set(g.map(e=>e.topic))].filter(Boolean),tracks:(null!=u?u:[]).map(e=>({slug:e_(e.slug),name:e_(e.company_name),tier:e_(e.tier,"other"),roleCount:eB(e.role_count),roleNames:Array.isArray(e.role_names)?e.role_names:[]})).filter(e=>e.name).sort((e,t)=>eP(e.name)-eP(t.name)),research:(()=>{var e;let t=(null!==(e=null==h?void 0:h.items)&&void 0!==e?e:[])[0];return t?{title:e_(t.title,"Tiny-LLM"),metricName:e_(t.metric_name,"metric"),lowerIsBetter:!1!==t.lower_is_better,canonicalVersion:eB(t.current_canonical_version),canonicalMetric:eB(t.current_canonical_test_metric)}:null})(),topScores:(Array.isArray(m)?m:[]).map(e=>null==e?void 0:e.flameScore).filter(e=>"number"==typeof e).slice(0,8)}}let eW=[.22,1,.36,1],eq="font-jetbrainsMono text-[10px] tracking-wider uppercase",eJ=e=>String(e).padStart(2,"0");function eU(e){let{f:t,i:n,total:r,data:i,failed:s,reduced:l}=e,d=n%2==1;return(0,a.jsx)(c.E.article,{id:"feature-".concat(t.key),className:"scroll-mt-24 border-t border-zinc-200 py-14 md:py-20 dark:border-zinc-800",initial:!l&&{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0,amount:.15},transition:{duration:.5,ease:eW},children:(0,a.jsxs)("div",{className:"grid grid-cols-1 items-center gap-x-12 gap-y-8 lg:grid-cols-12",children:[(0,a.jsxs)("div",{className:"min-w-0 lg:col-span-5 ".concat(d?"lg:order-2":""),children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-4",children:[(0,a.jsxs)("span",{className:"".concat(eq," text-zinc-400 tabular-nums dark:text-zinc-600"),children:[eJ(n+1)," / ",eJ(r)]}),(0,a.jsx)("span",{className:"".concat(eq," text-zinc-500"),children:t.name})]}),(0,a.jsx)("h3",{className:"mt-5 max-w-[20ch] font-jetbrainsMono text-2xl font-bold text-balance text-zinc-900 md:text-3xl dark:text-zinc-100",children:t.claim}),(0,a.jsx)("p",{className:"mt-5 max-w-[52ch] font-inter text-sm leading-relaxed text-pretty text-zinc-600 dark:text-zinc-400",children:t.body}),t.detail&&(0,a.jsx)("p",{className:"mt-3 max-w-[52ch] font-jetbrainsMono text-[11px] leading-relaxed text-zinc-500",children:t.detail}),(0,a.jsxs)(o.default,{href:t.href,className:"group mt-7 inline-flex items-center gap-2 font-jetbrainsMono text-xs font-medium text-zinc-900 underline decoration-zinc-300 underline-offset-4 transition-colors hover:decoration-zinc-900 dark:text-zinc-100 dark:decoration-zinc-700 dark:hover:decoration-zinc-100",children:["open ",t.name.toLowerCase(),(0,a.jsx)(J.Z,{className:"h-3.5 w-3.5 transition-transform duration-200 group-hover:translate-x-1 motion-reduce:transition-none","aria-hidden":"true"})]})]}),(0,a.jsxs)("div",{className:"min-w-0 lg:col-span-7 ".concat(d?"lg:order-1":""),children:[(0,a.jsx)(eL,{kind:t.specimen,data:i,failed:s}),(0,a.jsx)("p",{className:"".concat(eq," mt-3 text-zinc-500"),children:t.hint})]})]})})}function eX(e){let{className:t=""}=e,n=(0,s.useRef)(null),r=(0,s.useRef)(!1),[i,l]=(0,s.useState)(null),[o,c]=(0,s.useState)(!1),d=(0,F.J)(),u=U.length;return(0,s.useEffect)(()=>{let e=n.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&!r.current&&(r.current=!0,eD().then(e=>{e?l(e):c(!0)}).catch(()=>c(!0)),t.disconnect())},{rootMargin:"800px"});return t.observe(e),()=>t.disconnect()},[]),(0,a.jsxs)("section",{ref:n,className:t,"aria-labelledby":"features-heading",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-4 border-t border-zinc-200 pt-3 dark:border-zinc-800",children:[(0,a.jsxs)("span",{className:"".concat(eq," text-zinc-500 tabular-nums"),children:["01 — ",eJ(u)]}),(0,a.jsx)("span",{className:"".concat(eq," text-zinc-500"),children:"everything on Deep-ML"})]}),(0,a.jsx)("h2",{id:"features-heading",className:"mt-8 max-w-[22ch] font-jetbrainsMono text-2xl font-bold text-balance text-zinc-900 md:text-3xl dark:text-zinc-100",children:"Every way in. All of them free to start."}),(0,a.jsx)("nav",{"aria-label":"Features",className:"mt-8 flex flex-wrap gap-x-5 gap-y-2",children:U.map(e=>(0,a.jsx)("a",{href:"#feature-".concat(e.key),className:"".concat(eq," text-zinc-500 transition-colors hover:text-zinc-900 dark:hover:text-zinc-100"),children:e.name},e.key))}),(0,a.jsx)("div",{className:"mt-12",children:U.map((e,t)=>(0,a.jsx)(eU,{f:e,i:t,total:u,data:i,failed:o,reduced:d},e.key))})]})}function eY(e){let{children:t,trigger:n,className:r="",onCovered:i}
1=e,[l,o]=(0,s.useState)(!1),c=(0,s.useRef)([]),d=(0,s.useRef)(!1),u=(0,s.useRef)(i);u.current=i;let m=(0,s.useMemo)(()=>{let e=[];for(let t=0;t<7;t++)for(let n=0;n<18;n++){let r=Math.min(1,Math.max(0,(n/17+t/6)/2+(function(e,t){let n=21374.7159*Math.sin(41.17*e+289.3*t);return n-Math.floor(n)}(n,t)-.5)*.22));e.push({cover:Math.round(19e3*r)/100,uncover:Math.round((1-r)*19e3)/100,origin:t%2==0?"left":"right"})}return e},[]);return(0,s.useEffect)(()=>{if(!d.current){d.current=!0;return}if(c.current.forEach(e=>window.clearTimeout(e)),c.current=[],window.matchMedia("(prefers-reduced-motion: reduce)").matches){queueMicrotask(()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.call(u)});return}o(!0),c.current.push(window.setTimeout(()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.call(u)},310),window.setTimeout(()=>o(!1),350))},[n]),(0,s.useEffect)(()=>()=>c.current.forEach(e=>window.clearTimeout(e)),[]),(0,a.jsxs)("div",{className:"relative overflow-hidden ".concat(r),children:[t,(0,a.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 grid motion-reduce:hidden",style:{gridTemplateColumns:"repeat(".concat(18,", 1fr)"),gridTemplateRows:"repeat(".concat(7,", 1fr)")},children:m.map((e,t)=>(0,a.jsx)("span",{className:"bg-zinc-900 will-change-transform dark:bg-zinc-100",style:{transform:l?"scaleX(1.04)":"scaleX(0)",transformOrigin:e.origin,transitionProperty:"transform",transitionDuration:"".concat(120,"ms"),transitionTimingFunction:l?"cubic-bezier(0.22, 1, 0.36, 1)":"cubic-bezier(0.64, 0, 0.78, 0)",transitionDelay:"".concat(l?e.cover:e.uncover,"ms")}},t))})]})}let eO=[.22,1,.36,1];function eZ(e){var t,n;let{problem:r}=e;return(0,a.jsxs)(o.default,{href:"/problems/".concat(r.id),className:"relative inline-flex max-w-full items-center gap-1.5 rounded-full border border-zinc-200 bg-white px-3 py-1.5 font-jetbrainsMono ".concat("easy"===(t=r.difficulty)?"text-xs":"hard"===t?"text-sm font-medium":"text-[13px]"," text-zinc-600 transition-[color,border-color,transform] duration-150 ease-out after:absolute after:-inset-2 after:content-[''] hover:-translate-y-0.5 hover:border-zinc-300 hover:text-zinc-900 motion-reduce:hover:translate-y-0 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400 dark:hover:border-zinc-600 dark:hover:text-zinc-100"),children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full ".concat("easy"===(n=r.difficulty)?"bg-green-500":"medium"===n?"bg-yellow-500":"hard"===n?"bg-red-500":"bg-zinc-400")}),(0,a.jsx)("span",{className:"truncate",children:r.title})]})}let eH={hidden:{opacity:0,y:8},visible:{opacity:1,y:0,transition:{duration:.3,ease:eO}}};function eV(e){let{data:t}=e,n=(0,F.J)(),r=t.categories.length-12;return(0,a.jsxs)("div",{children:[(0,a.jsxs)(c.E.div,{className:"flex flex-wrap gap-3",initial:!n&&"hidden",whileInView:"visible",viewport:{once:!0,amount:.2},variants:{visible:{transition:{staggerChildren:.04}}},children:[t.categories.slice(0,12).map(e=>(0,a.jsx)(c.E.span,{variants:eH,children:(0,a.jsxs)(o.default,{href:"/problems?category=".concat(encodeURIComponent(e.name)),className:"inline-flex min-h-11 items-center gap-1.5 rounded-full border border-zinc-200 px-4 font-jetbrainsMono text-xs font-medium text-zinc-600 transition-colors duration-200 hover:border-zinc-300 hover:text-zinc-900 dark:border-zinc-700 dark:text-zinc-400 dark:hover:border-zinc-500 dark:hover:text-zinc-100",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-zinc-400"}),e.name," \xb7 ",(0,a.jsx)("span",{className:"tabular-nums",children:e.count})]})},e.name)),r>0&&(0,a.jsx)(c.E.span,{variants:eH,children:(0,a.jsxs)(o.default,{href:"/problems",className:"inline-flex min-h-11 items-center gap-1.5 rounded-full border border-zinc-200 px-4 font-jetbrainsMono text-xs font-medium text-zinc-500 transition-colors duration-200 hover:border-zinc-300 hover:text-zinc-900 dark:border-zinc-700 dark:text-zinc-500 dark:hover:border-zinc-500 dark:hover:text-zinc-100",children:["+",(0,a.jsx)("span",{className:"tabular-nums",children:r})," more"]})})]}),(0,a.jsx)(c.E.div,{className:"mt-8 flex flex-wrap gap-2.5",initial:!n&&"hidden",
1whileInView:"visible",viewport:{once:!0,amount:.15},variants:{visible:{transition:{staggerChildren:.02}}},children:t.samples.map(e=>(0,a.jsx)(c.E.span,{className:"max-w-full",variants:{hidden:{opacity:0,y:8,scale:.96},visible:{opacity:1,y:0,scale:1,transition:{duration:.35,ease:eO}}},children:(0,a.jsx)(eZ,{problem:e})},String(e.id)))}),(0,a.jsx)("p",{className:"mt-6 font-inter text-sm text-zinc-500 dark:text-zinc-500",children:"Every problem free, written by ML engineers and the community."})]})}async function eG(){try{var e,t,n;let r=await (0,R.cachedFetch)("problems-list",async()=>{let e=await fetch("".concat("https://api.deep-ml.com","/list-problems"),{headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("Failed to fetch problems");return e.json()}),a=(Array.isArray(null==r?void 0:r.problems)?r.problems:[]).filter(e=>!!e&&"string"==typeof e.title&&"string"==typeof e.category);if(0===a.length)return null;let i=new Map;for(let t of a)i.set(t.category,(null!==(e=i.get(t.category))&&void 0!==e?e:0)+1);let s=[...i.entries()].map(e=>{let[t,n]=e;return{name:t,count:n}}).sort((e,t)=>t.count-e.count||e.name.localeCompare(t.name)),l=[...a].sort((e,t)=>Number(e.id)-Number(t.id)),o=l.filter(e=>"easy"===e.difficulty||"medium"===e.difficulty).slice(0,15),c=new Set(o.map(e=>String(e.id))),d=new Map;for(let e of l){if(c.has(String(e.id)))continue;let n=null!==(t=d.get(e.category))&&void 0!==t?t:[];n.push(e),d.set(e.category,n)}let u=[...d.entries()].sort((e,t)=>t[1].length-e[1].length).map(e=>{let[t]=e;return t}),m=[],h=0;for(;m.length<15&&u.length>0;){let e=u[h%u.length],t=null===(n=d.get(e))||void 0===n?void 0:n.shift();t?(m.push(t),h+=1):u.splice(h%u.length,1)}return{total:a.length,categories:s,samples:[...o,...m]}}catch(e){return null}}let eK=(0,s.createContext)(!0);function eQ(){return(0,s.useContext)(eK)}let e$=(0,s.createContext)("card");function e0(e){return"figure"===(0,s.useContext)(e$)?(0,a.jsx)(e1,{...e}):(0,a.jsx)(e2,{...e})}function e1(e){let{num:t,title:n,caption:r,href:i,linkLabel:s,children:l,className:c=""}=e;return(0,a.jsxs)("figure",{className:"m-0 ".concat(c),children:[(0,a.jsx)("div",{className:"relative aspect-[4/3] w-full overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-800 dark:bg-zinc-900 dark:shadow-none",children:l}),(0,a.jsxs)("figcaption",{className:"mt-2 flex items-start gap-2 border-t border-zinc-200 pt-2 dark:border-zinc-800",children:[(0,a.jsxs)("span",{className:"mt-[3px] shrink-0 font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase tabular-nums dark:text-zinc-500",children:["fig. ",t]}),(0,a.jsxs)("span",{className:"flex-1 font-inter text-[11px] leading-snug text-pretty text-zinc-600 dark:text-zinc-400",children:[(0,a.jsxs)("span",{className:"text-zinc-900 dark:text-zinc-100",children:[n,"."]})," ",r]}),(0,a.jsx)(o.default,{href:i,className:"relative mt-[3px] shrink-0 font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase underline decoration-zinc-300 underline-offset-4 transition-colors after:absolute after:-inset-2 after:content-[''] hover:text-zinc-900 dark:decoration-zinc-700 dark:hover:text-zinc-100",children:s})]})]})}function e2(e){let{num:t,title:n,caption:r,href:i,linkLabel:s,children:l,className:c=""}=e;return(0,a.jsxs)("div",{className:"group card-rise relative rounded-xl border border-zinc-200 bg-white p-5 shadow-sm transition-all hover:border-zinc-300 dark:border-zinc-800 dark:bg-zinc-900 dark:shadow-none dark:hover:border-zinc-700 ".concat(c),children:[(0,a.jsxs)("div",{className:"mb-3 flex items-baseline gap-2",children:[(0,a.jsxs)("span",{className:"font-jetbrainsMono text-[10px] uppercase tracking-wider text-zinc-500",children:["fig. ",t]}),(0,a.jsx)("span",{className:"font-jetbrainsMono text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:n})]}),(0,a.jsx)("div",{className:"relative aspect-[4/3] w-full overflow-hidden",children:l}),(0,a.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-3",children:[(0,a.jsx)("p",{className:"font-inter text-xs text-pretty text-zinc-500 dark:text-zinc-400",children:r}),(0,a.jsxs)(o.default,{href:i,className:"relative inline-flex shrink-0 items-center gap-1.5 rounded-full border border-zinc-200 px-2.5 py-0.5 text-xs font-medium text-zinc-600 transition-colors after:absolute after:-inset-2.5 after:content-[''] hover:bg-zinc-100 dark:border-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800",children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-zinc-400"}),s]})]})]})}let e5=.5*Math.atan2(1.2,2-1.1),e4={x:Math.cos(e5),y:Math.sin(e5)},e3={x:-e4.y,y:e4.x},e6="stroke-zinc-300 dark:stroke-zinc-700 transition-colors duration-200";function e8(){let e;let t=(e=20260727,()=>{e|=0;let t=Math.imul((e=e+1831565813|0)^e>>>15,1|e);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}),n=[];for(let e=0;e<20;e++){let r=.06+e/19*.88+(t()-.5)*.04,a=.22+.55*r+(t()-.5)*.22;n.push({x:Math.min(.97,Math.max(.03,r)),y:Math.min(.97,Math.max(.03,a))})}return n}let e9=e=>14+172*e,e7=e=>136-122*e,te=(e,t)=>
1({x:Math.min(1,Math.max(0,(e-14)/172)),y:Math.min(1,Math.max(0,(136-t)/122))});var tt=n(25922);let tn={dark:{dot:"#d4d4d8",dotFaded:"#3f3f46",curve:"#f4f4f5",boundaryLine:"#e4e4e7",fieldLow:"#09090b",fieldHigh:"#52525b"},light:{dot:"#3f3f46",dotFaded:"#d4d4d8",curve:"#18181b",boundaryLine:"#27272a",fieldLow:"#fafafa",fieldHigh:"#a1a1aa"}};function tr(e){return Math.sqrt(-2*Math.log(Math.max(e(),1e-12)))*Math.cos(2*Math.PI*e())}let ta=e=>e<0?0:e>1?1:e,ti=e=>e<0?0:e>1?1:e;function ts(e,t,n){let r=[];for(let a=0;a<t;a++){let i=Math.round(e*Math.pow(a/(t-1),n));(0===r.length||i>r[r.length-1])&&r.push(i)}return r}function tl(e){let t=2*e-1;return[1,t,t*t,t*t*t]}function to(e,t){let n=tl(t);return e[0]*n[0]+e[1]*n[1]+e[2]*n[2]+e[3]*n[3]}function tc(e,t){let n=ti(e)*(t-1),r=Math.floor(n);return{i0:r,i1:Math.min(r+1,t-1),f:n-r}}let td=null,tu={num:"03",title:"A decision boundary",caption:"2-16-1 MLP on two moons. Every training step recorded.",href:"/problems/25",linkLabel:"practice this"},tm=[[-1,0,1],[-2,0,2],[-1,0,1]],th=["................","................","......####......","......####......","......####......","......####......","..############..","..############..","..############..","..############..","......####......","......####......","......####......","......####......","................","................"].map(e=>e.split("").map(e=>"#"===e?1:0)),tx=function(){let e=[],t=1/0,n=-1/0;for(let r=0;r<14;r++){let a=[];for(let e=0;e<14;e++){let i=0;for(let t=0;t<3;t++)for(let n=0;n<3;n++)i+=th[r+t][e+n]*tm[t][n];a.push(i),i<t&&(t=i),i>n&&(n=i)}e.push(a)}let r=n-t||1,a=e.map(e=>e.map(e=>(e-t)/r));return{raw:e,norm:a}}(),tp={dark:{on:"#d4d4d8",grid:"#3f3f46",outline:"#71717a",outMin:"#18181b",outMax:"#a1a1aa",emph:"#f4f4f5"},light:{on:"#3f3f46",grid:"#d4d4d8",outline:"#71717a",outMin:"#fafafa",outMax:"#52525b",emph:"#18181b"}},tf=new Set(["a","an","the","and","or","of","in","into","on","with","by","to","from","as","is","its","it","that","this","so","how","each","every","when","until","more","than","must","through","nothing","during","new","many"]),tb="a machine learning model turns data into prediction. during training the network reads every example, computes a prediction, and measures its error with a loss function. the gradient of that loss tells each weight in the network how to change, so the model updates its weights, layer by layer, until the error falls. every feature of the data enters as a feature vector, and every layer multiplies that vector by a matrix of weights. learning is nothing more than repeating this loop: forward pass, loss, gradient, update. a deep network stacks many layers, so the gradient must flow backward through every matrix. when training works, the loss falls, the weights settle, and the model generalizes from training data to new data. when training fails, the gradient vanishes or the model memorizes noise. study the loop closely: data, prediction, error, gradient, update. every algorithm in machine learning is a variation on that loop.".split(/[^a-z]+/).filter(Boolean),tg=new Map;for(let e of tb)tf.has(e)||tg.set(e,(tg.get(e)||0)+1);let tv=[...tg.entries()].filter(e=>{let[,t]=e;return t>=2}).sort((e,t)=>t[1]-e[1]||(e[0]<t[0]?-1:1)).slice(0,36).map(e=>{let[t]=e;return t}),ty=new Map;tv.forEach((e,t)=>ty.set(e,t));let tj=tv.length,tw=Array.from({length:tj},()=>new Float64Array(tj));for(let e=0;e<tb.length;e++){let t=ty.get(tb[e]);if(void 0!==t)for(let n=e+1;n<=Math.min(e+4,tb.length-1);n++){let e=ty.get(tb[n]);void 0!==e&&(tw[t][e]+=1,tw[e][t]+=1)}}let tk=new Float64Array(tj),tz=0;for(let e=0;e<tj;e++){for(let t=0;t<tj;t++)tk[e]+=tw[e][t];tz+=tk[e]}let tN=Array.from({length:tj},()=>new Float64Array(tj));for(let e=0;e<tj;e++)for(let t=0;t<tj;t++){let n=tw[e][t];if(0===n)continue;let r=Math.log(n*tz/(tk[e]*tk[t]));r>0&&(tN[e][t]=r)}function tM(e,t){let n=new Float64Array(tj);for(let r=0;r<tj;r++){let a=0,i=e[r];for(let e=0;e<tj;e++)a+=i[e]*t[e];n[r]=a}return n}let tS=(r=20260727,()=>{r|=0;let e=Math.imul((r=r+1831565813|0)^r>>>15,1|r);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/4294967296}),tC=[],tA=[],tE=tN.map(e=>Float64Array.from(e));for(let e=0;e<8;e++){let e=new Float64Array(tj).map(()=>tS()-.5);for(let t=0;t<60;t++){let t=tM(tE,e),n=Math.hypot(...t);n<1e-12&&(n=1);for(let e=0;e<tj;e++)t[e]/=n;e=t}let t=tM(tE,e),n=0;for(let r=0;r<tj;r++)n+=e[r]*t[r];tC.push(n),tA.push(e);for(let t=0;t<tj;t++)for(let r=0;r<tj;r++)tE[t][r]-=n*e[t]*e[r]}let tF=Array.from({length:tj},(e,t)=>{let n=new Float64Array(8);for(let e=0;e<8;e++)n[e]=tA[e][t]*Math.sqrt(Math.abs(tC[e]));return n}),tR=new Map;function tL(e){let t=tR.get(e);if(!t)throw Error("unknown word: ".concat(e));return t}function tI(e){return Math.round(1e4*e)/1e4}tv.forEach((e,t)=>{let n=tF[t],r=Math.hypot(...n);r<1e-12&&(r=1),tR.set(e,Float64Array.from(n,e=>e/r))});let tP=["data","model","weights","gradient","loss","prediction"],tT=tP.length,t_=(400-26*tT)/2,tB={light:{lo:[244,244,245],hi:[24,24,27]},dark:{lo:[24,24,27],hi:[244,244,245]}};function tD(e){return 44+312*e/(tT-1)}let tW=[2,-.5,1,3.2,.2,-1.5],tq=192/tW.length;function tJ(e,t){let n=Math.max(...e),r=e.map(e=>Math.exp((e-n)/t)),a=r.reduce((e,t)=>
1e+t,0);return r.map(e=>e/a)}let tU=tJ(tW,1);function tX(e){return 24+e*tq+(tq-18)/2}function tY(e){let t=e>>>0;return()=>{t|=0;let e=Math.imul((t=t+1831565813|0)^t>>>15,1|t);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/4294967296}}function tO(e){return Math.sqrt(-2*Math.log(Math.max(e(),1e-9)))*Math.cos(2*Math.PI*e())}let tZ=[{c:{x:.26,y:.32},s:.07,n:27},{c:{x:.72,y:.28},s:.06,n:27},{c:{x:.5,y:.74},s:.08,n:26}];function tH(e,t){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r}let tV={dark:{dot:"#a1a1aa",centroid:"#f4f4f5",ring:"#52525b",line:"#a1a1aa"},light:{dot:"#52525b",centroid:"#18181b",ring:"#a1a1aa",line:"#52525b"}},tG=[{key:"eigenvectors",label:"eigenvectors",Plate:function(){let e=eQ(),t=(0,s.useRef)(null),n=(0,s.useRef)(null),r=(0,s.useRef)(null),i=(0,s.useRef)(null),l=(0,s.useRef)(null),o=(0,s.useRef)(null),c=(0,s.useRef)(e5+.9),d=(0,s.useRef)(!1),u=(0,s.useRef)(!1),m=(0,s.useCallback)(()=>{var e,a,s,d,u,m,h,x;let p=c.current,f={x:Math.cos(p),y:Math.sin(p)},b={x:2*(h=f.x)+.6*(x=f.y),y:.6*h+1.1*x};null===(e=t.current)||void 0===e||e.setAttribute("x2",String(100+30*f.x)),null===(a=t.current)||void 0===a||a.setAttribute("y2",String(75-30*f.y)),null===(s=n.current)||void 0===s||s.setAttribute("x2",String(100+30*b.x)),null===(d=n.current)||void 0===d||d.setAttribute("y2",String(75-30*b.y));let g=180*Math.acos(Math.min(1,Math.max(-1,(f.x*b.x+f.y*b.y)/(Math.hypot(b.x,b.y)||1))))/Math.PI,v=g<6?"stroke-zinc-600 dark:stroke-zinc-300 transition-colors duration-200":e6;null===(u=r.current)||void 0===u||u.setAttribute("class",v),null===(m=i.current)||void 0===m||m.setAttribute("class",v),l.current&&(l.current.textContent="".concat(g.toFixed(1),"\xb0"));let y=o.current;if(y){let e=Math.round((180*p/Math.PI+360)%360);y.setAttribute("aria-valuenow",String(e)),y.setAttribute("aria-valuetext","x at ".concat(e," degrees, ").concat(g.toFixed(1)," degrees from Ax"))}},[]);(0,s.useEffect)(()=>{let t=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(t&&(c.current=e5,u.current=!0),m(),t||!e||u.current)return;let n=e5+2*Math.PI,r=0,a=performance.now(),i=e=>{let t=e-a;if(a=e,!d.current){if(c.current+=t/8e3*Math.PI*2,c.current>=n){c.current=e5,u.current=!0,m();return}m()}r=requestAnimationFrame(i)};return r=requestAnimationFrame(i),()=>cancelAnimationFrame(r)},[e,m]);let h=e=>{let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width*200-100,r=75-(e.clientY-t.top)/t.height*150;(0!==n||0!==r)&&(u.current=!0,c.current=Math.atan2(r,n),m())};return(0,a.jsx)(e0,{num:"01",title:"Eigenvectors",caption:"Ax drawn against x. Two directions survive.",href:"/problems/6",linkLabel:"practice this",children:(0,a.jsxs)("svg",{ref:o,viewBox:"0 0 ".concat(200," ").concat(150),className:"h-full w-full rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 dark:focus-visible:ring-zinc-500",preserveAspectRatio:"xMidYMid meet",role:"slider",tabIndex:0,"aria-label":"Turn x. Arrow keys rotate, Home snaps to an eigenvector.","aria-valuemin":0,"aria-valuemax":360,onKeyDown:e=>{let t=e.shiftKey?.25:.05,n=null;"ArrowRight"===e.key||"ArrowUp"===e.key?n=c.current+t:"ArrowLeft"===e.key||"ArrowDown"===e.key?n=c.current-t:"Home"===e.key?n=e5:"End"===e.key&&(n=e5+Math.PI/2),null!==n&&(e.preventDefault(),u.current=!0,c.current=n,m())},onPointerMove:h,onPointerDown:h,onPointerEnter:e=>{"mouse"===e.pointerType&&(d.current=!0)},onPointerLeave:()=>{d.current=!1},children:[(0,a.jsxs)("defs",{children:[(0,a.jsx)("marker",{id:"lv2-eigen-arrow-x",viewBox:"0 0 8 8",refX:"6",refY:"4",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:(0,a.jsx)("path",{d:"M0 0 L8 4 L0 8 z",className:"fill-zinc-500"})}),(0,a.jsx)("marker",{id:"lv2-eigen-arrow-ax",viewBox:"0 0 8 8",refX:"6",refY:"4",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:(0,a.jsx)("path",{d:"M0 0 L8 4 L0 8 z",className:"fill-zinc-900 dark:fill-zinc-100"})})]}),(0,a.jsx)("line",{x1:0,y1:75,x2:200,y2:75,className:"stroke-zinc-200 dark:stroke-zinc-800",strokeWidth:"1"}),(0,a.jsx)("line",{x1:100,y1:0,x2:100,y2:150,className:"stroke-zinc-200 dark:stroke-zinc-800",strokeWidth:"1"}),(0,a.jsx)("circle",{cx:100,cy:75,r:30,fill:"none",className:"stroke-zinc-200 dark:stroke-zinc-800",strokeWidth:"1"}),(0,a.jsx)("line",{ref:r,x1:100-70*e4.x,y1:75+70*e4.y,x2:100+70*e4.x,y2:75-70*e4.y,className:e6,strokeWidth:"1",strokeDasharray:"3 3"}),(0,a.jsx)("line",{ref:i,x1:100-70*e3.x,y1:75+70*e3.y,x2:100+70*e3.x,y2:75-70*e3.y,className:e6,strokeWidth:"1",strokeDasharray:"3 3"}),(0,a.jsx)("line",{ref:t,x1:100,y1:75,x2:130,y2:75,className:"stroke-zinc-500",strokeWidth:"1.5",markerEnd:"url(#lv2-eigen-arrow-x)"}),(0,a.jsx)("line",{ref:n,x1:100,y1:75,x2:160,y2:75,className:"stroke-zinc-900 dark:stroke-zinc-100",strokeWidth:"2",markerEnd:"url(#lv2-eigen-arrow-ax)"}),(0,a.jsx)("text",{x:8,y:14,className:"fill-zinc-500",fontSize:"8",fontFamily:"JetBrains Mono, monospace",children:"x"}),(0,a.jsx)("text",{x:18,y:14,className:"fill-zinc-900 dark:fill-zinc-100",fontSize:"8",fontFamily:"JetBrains Mono, monospace",children:"Ax"}),(0,a.jsx)("text",{ref:l,x:192,y:14,textAnchor:"end",className:"fill-zinc-500",fontSize:"8",fontFamily:"JetBrains Mono, monospace",style:{fontVariantNumeric:"tabular-nums"},children:"0.0\xb0"})]})})}},{key:"least-squares",label:"least squares",Plate:function(){let[e,t]=(0,s.use
1State)(e8),[n,r]=(0,s.useState)(null),i=(0,s.useRef)(null),l=(0,s.useMemo)(()=>(function(e){let t=e.length,n=0,r=0,a=0,i=0;for(let t of e)n+=t.x,r+=t.y,a+=t.x*t.x,i+=t.x*t.y;let s=t*a-n*n||1,l=(t*i-n*r)/s,o=(r-l*n)/t,c=0;for(let t of e){let e=t.y-(l*t.x+o);c+=e*e}return{w:l,b:o,mse:c/t}})(e),[e]);(0,s.useEffect)(()=>{i.current&&(i.current.textContent="mse ".concat(l.mse.toFixed(4)))},[l.mse]);let o=l.b,c=l.w+l.b;return(0,a.jsx)(e0,{num:"02",title:"Least squares",caption:"Drag a point. The fit answers.",href:"/problems/14",linkLabel:"practice this",children:(0,a.jsxs)("svg",{viewBox:"0 0 ".concat(200," ").concat(150),className:"h-full w-full",preserveAspectRatio:"xMidYMid meet","aria-label":"Least squares",role:"img",onPointerMove:e=>{if(null===n)return;let r=e.currentTarget.getBoundingClientRect(),a=te((e.clientX-r.left)/r.width*200,(e.clientY-r.top)/r.height*150);t(e=>e.map((e,t)=>t===n?a:e))},onPointerUp:()=>r(null),onPointerCancel:()=>r(null),children:[e.map((e,t)=>(0,a.jsx)("line",{x1:e9(e.x),y1:e7(e.y),x2:e9(e.x),y2:e7(l.w*e.x+l.b),className:"stroke-zinc-300 dark:stroke-zinc-700",strokeWidth:"1"},"r-".concat(t))),(0,a.jsx)("line",{x1:e9(0),y1:e7(o),x2:e9(1),y2:e7(c),className:"stroke-zinc-900 dark:stroke-zinc-100",strokeWidth:"2"}),e.map((e,t)=>(0,a.jsxs)("g",{children:[(0,a.jsx)("circle",{cx:e9(e.x),cy:e7(e.y),r:3,className:t===n?"fill-zinc-900 dark:fill-zinc-100":"fill-zinc-500"}),(0,a.jsx)("circle",{cx:e9(e.x),cy:e7(e.y),r:12,fill:"transparent",style:{touchAction:"none",cursor:"grab"},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),r(t)}})]},"p-".concat(t))),(0,a.jsx)("text",{ref:i,x:192,y:14,textAnchor:"end",className:"fill-zinc-500",fontSize:"8",fontFamily:"JetBrains Mono, monospace",style:{fontVariantNumeric:"tabular-nums"},children:"mse 0.0000"})]})})}},{key:"boundary",label:"a decision boundary",Plate:function(e){let{className:t}=e,n=function(){let[e,t]=(0,s.useState)(td);return(0,s.useEffect)(()=>{td||t(td=function(){let e;let t=(e=1337,()=>{let t=Math.imul((e=e+1831565813|0)^e>>>15,1|e);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}),n=function(e){let t=[],n=[];for(let r=0;r<120;r++){let r=.04+.92*e(),a=ta(.5+.33*Math.sin(5.6*r-1.1)+.045*tr(e));t.push(r),n.push(a)}let r=[.85,.55,.25,-.45],a=[],i=[],s=ts(400,101,2.2),l=()=>{a.push([...r]);let e=0;for(let a=0;a<120;a++){let i=to(r,t[a])-n[a];e+=i*i}i.push(e/120)},o=0;for(let e=0;e<=400;e++){o<s.length&&s[o]===e&&(l(),o++);let a=[0,0,0,0];for(let e=0;e<120;e++){let i=tl(t[e]),s=to(r,t[e])-n[e];a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],a[3]+=s*i[3]}for(let e=0;e<4;e++)r[e]-=.5*a[e]/120}return{points:t.map((e,t)=>({x:e,y:1-n[t]})),snapshots:a,losses:i}}(t),r=function(e){let t=[];for(let n=0;n<110;n++){let r,a;let i=n<55?0:1,s=e()*Math.PI*54/55;0===i?(r=Math.cos(s),a=Math.sin(s)):(r=1-Math.cos(s),a=.5-Math.sin(s)),r+=.09*tr(e),a+=.09*tr(e);let l=ta((r+1.25)/3.5),o=ta((a+1.5)/3.5);t.push({x:l,y:1-o,label:i})}return{pts:t}}(t),a=function(e,t){let n=t.length,r=new Float64Array(n),a=new Float64Array(n),i=new Float64Array(n);for(let e=0;e<n;e++)r[e]=2*t[e].x-1,a[e]=(1-t[e].y)*2-1,i[e]=t[e].label;let s=new Float64Array(32),l=new Float64Array(16),o=new Float64Array(16),c=0;for(let t=0;t<32;t++)s[t]=.6*tr(e);for(let t=0;t<16;t++)o[t]=.25*tr(e);let d=new Float64Array(16),u=(e,t)=>{let n=c;for(let r=0;r<16;r++){let a=Math.tanh(s[2*r]*e+s[2*r+1]*t+l[r]);d[r]=a,n+=o[r]*a}return 1/(1+Math.exp(-n))},m=()=>{let e=new Float32Array(2304);for(let t=0;t<48;t++){let n=2*(1-(t+.5)/48)-1;for(let r=0;r<48;r++){let a=(r+.5)/48*2-1;e[48*t+r]=u(a,n)}}return e},h=()=>{let e=0;for(let t=0;t<n;t++){let n=Math.min(Math.max(u(r[t],a[t]),1e-7),1-1e-7);e+=-(i[t]*Math.log(n)+(1-i[t])*Math.log(1-n))}return e/n},x=[],p=[],f=ts(1400,24,2),b=0,g=new Float64Array(32),v=new Float64Array(16),y=new Float64Array(16);for(let e=0;e<=1400&&(b<f.length&&f[b]===e&&(x.push(m()),p.push(h()),b++),1400!==e);e++){g.fill(0),v.fill(0),y.fill(0);let e=0;for(let t=0;t<n;t++){let s=(u(r[t],a[t])-i[t])/n;e+=s;for(let e=0;e<16;e++){y[e]+=d[e]*s;let n=o[e]*s*(1-d[e]*d[e]);
1g[2*e]+=n*r[t],g[2*e+1]+=n*a[t],v[e]+=n}}for(let e=0;e<16;e++)o[e]-=2.2*y[e],l[e]-=2.2*v[e],s[2*e]-=2.2*g[2*e],s[2*e+1]-=2.2*g[2*e+1];c-=2.2*e}return{moons:t,grids:x,losses:p}}(t,r.pts),i=Array.from({length:96},()=>({x:0,y:0})),s=new Float32Array(2304),l=[0,0,0,0];return{points:n.points,curveAt:e=>{let{i0:t,i1:r,f:a}=tc(e,n.snapshots.length),s=n.snapshots[t],o=n.snapshots[r];for(let e=0;e<4;e++)l[e]=s[e]+(o[e]-s[e])*a;for(let e=0;e<96;e++){let t=e/95;i[e].x=t,i[e].y=1-to(l,t)}return i},lossAt:e=>{let{i0:t,i1:r,f:a}=tc(e,n.losses.length);return n.losses[t]+(n.losses[r]-n.losses[t])*a},moons:a.moons,boundaryGridSize:48,boundaryAt:e=>{let{i0:t,i1:n,f:r}=tc(e,a.grids.length),i=a.grids[t],l=a.grids[n];for(let e=0;e<s.length;e++)s[e]=i[e]+(l[e]-i[e])*r;return s},mlpLossAt:e=>{let{i0:t,i1:n,f:r}=tc(e,a.losses.length);return a.losses[t]+(a.losses[n]-a.losses[t])*r},finalLoss:n.losses[n.losses.length-1]}}())},[]),e}(),r=eQ(),i=(0,s.useRef)(null),l=(0,s.useRef)(null),{resolvedTheme:o}=(0,tt.F)();return(0,s.useEffect)(()=>{let e=i.current;if(!e||!n)return;let t=e.parentElement;if(!t)return;let a=e.getContext("2d");if(!a)return;let s="light"===o?tn.light:tn.dark,c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,d=n.boundaryGridSize,u=document.createElement("canvas");u.width=d,u.height=d;let m=u.getContext("2d");if(!m)return;let h=m.createImageData(d,d),x=0,p=0,f=0,b=1,g=0,v=-1,y=0,j=()=>{let n=Math.min(window.devicePixelRatio||1,2);x=t.clientWidth,p=t.clientHeight,e.width=Math.max(1,Math.round(x*n)),e.height=Math.max(1,Math.round(p*n)),a.setTransform(n,0,0,n,0,0),v=-1},w=null,k=new ResizeObserver(()=>{j(),null==w||w()});k.observe(t),j();let z=e=>{let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,255&t]},N=z(s.fieldLow),M=z(s.fieldHigh);f=c?1:0;let S=e=>{let t=n.boundaryAt(e);for(let e=0;e<t.length;e++){let n=t[e],r=4*e;h.data[r]=N[0]+(M[0]-N[0])*n,h.data[r+1]=N[1]+(M[1]-N[1])*n,h.data[r+2]=N[2]+(M[2]-N[2])*n,h.data[r+3]=2*Math.abs(n-.5)*89.25}m.putImageData(h,0,0),a.clearRect(0,0,x,p),a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(u,0,0,d,d,0,0,x,p),a.strokeStyle=s.boundaryLine,a.lineWidth=1.5,a.beginPath();let r=x/(d-1),i=p/(d-1);for(let e=0;e<d-1;e++)for(let n=0;n<d-1;n++){let s=t[e*d+n]-.5,l=t[e*d+n+1]-.5,o=t[(e+1)*d+n+1]-.5,c=t[(e+1)*d+n]-.5,u=[],m=(e,t)=>e*t<0;m(s,l)&&u.push([(n+s/(s-l))*r,e*i]),m(l,o)&&u.push([(n+1)*r,(e+l/(l-o))*i]),m(c,o)&&u.push([(n+c/(c-o))*r,(e+1)*i]),m(s,c)&&u.push([n*r,(e+s/(s-c))*i]),u.length>=2&&(a.moveTo(u[0][0],u[0][1]),a.lineTo(u[1][0],u[1][1]))}for(let e of(a.stroke(),n.moons)){let t=e.x*x,n=e.y*p;a.beginPath(),a.arc(t,n,2.5,0,2*Math.PI),0===e.label?(a.fillStyle=s.dot,a.fill()):(a.strokeStyle=s.dot,a.lineWidth=1.2,a.stroke())}l.current&&(l.current.textContent="loss ".concat(n.mlpLossAt(e).toFixed(4))),v=e},C=()=>{y=requestAnimationFrame(C),performance.now()-g>2e3&&(b=1),Math.abs((f=c?b:f+(b-f)*.08)-v)>5e-4&&S(f)};r?y=requestAnimationFrame(C):(w=()=>S(1),S(1));let A=t=>{let n=e.getBoundingClientRect();0!==n.width&&(b=Math.min(1,Math.max(0,(t.clientX-n.left)/n.width)),g=performance.now())};return e.addEventListener("pointermove",A,{passive:!0}),e.addEventListener("pointerdown",A,{passive:!0}),()=>{cancelAnimationFrame(y),k.disconnect(),e.removeEventListener("pointermove",A),e.removeEventListener("pointerdown",A)}},[n,r,o]),(0,a.jsxs)(e0,{...tu,className:t,children:[(0,a.jsx)("canvas",{ref:i,className:"absolute inset-0 h-full w-full touch-none","aria-hidden":"true"}),(0,a.jsx)("span",{ref:l,className:"absolute bottom-2 right-2 font-jetbrainsMono text-[10px] uppercase tracking-wider text-zinc-500 dark:text-zinc-500 tabular-nums",children:"loss --"})]})}},{key:"convolution",label:"convolution",Plate:function(e){let{className:t}=e,n=eQ(),r=(0,F.J)(),{resolvedTheme:i}=(0,tt.F)(),l=(0,s.useRef)(null),o=(0,s.useRef)(null),c=(0,s.useRef)(null),d=(0,s.useRef)(null),u=(0,s.useRef)(null),m=(0,s.useRef)(0),h=(0,s.useRef)(!1);return(0,s.useEffect)(()=>{let e=l.current,t=o.current;if(!e||!t)return;let a=t.getContext("2d");if(!a)return;let s=tp["light"===i?"light":"dark"],x=0,p=performance.now(),f=()=>{let n=Math.min(window.devicePixelRatio||1,2),r=e.clientWidth,i=e.clientHeight;t.width=Math.round(r*n),t.height=Math.round(i*n),a.setTransform(n,0,0,n,0,0);let s=Math.max(2,Math.floor(Math.min(.36*r/16,.82*i/16)));d.current={cell:s,inX:Math.round(.05*r),inY:Math.round((i-16*s)/2),outX:Math.round(r-.05*r-14*s),outY:Math.round((i-14*s)/2)}},b=e=>{let t=c.current;if(!t)return;if(!e){t.textContent="";return}let n=tx.raw[e.y];if(!n)return;let r=n[e.x];void 0!==r&&(t.textContent="sum ".concat(r>=0?"+":"").concat(r))},g=()=>{let t=d.current;if(!t)return;let i=e.clientWidth,l=e.clientHeight;a.clearRect(0,0,i,l);for(let e=0;e<16;e++)for(let n=0;n<16;n++)th[e][n]&&(a.fillStyle=s.on,a.fillRect(t.inX+n*t.cell,t.inY+e*t.cell,t.cell-1,t.cell-1));a.strokeStyle=s.grid,a.lineWidth=1,a.strokeRect(t.inX-.5,t.inY-.5,16*t.cell+1,16*t.cell+1),a.strokeRect(t.outX-.5,t.outY-.5,14*t.cell+1,14*t.cell+1);let o=u.current,c=null!=o?o:{x:m.current%14,y:Math.floor(m.current/14)},x=r||!n||h.current,p=m.current;for(let e=0;e<14;e++)for(let n=0;n<14;n++){let r=14*e+n;(x||r<=p||o&&o.x===n&&o.y===e)&&(a.fillStyle=function(e,t,n){let r=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),a=[1,3,5].map(e=>parseInt(t.slice(e,e+2),16)),i=r.map((e,t)=>Math.round(e+(a[t]-e)*n));return"rgb(".concat(i[0],",").concat(i[1],",").concat(i[2],")")}(s.outMin,s.outMax,tx.norm[e][n]),a.fillRect(t.outX+n*t.cell,t.outY+e*t.cell,t.cell-1,t.cell-1))}a.strokeStyle=s.outline,a.lineWidth=1,a.strokeRect(t.inX+c.x*t.cell-.5,t.inY+c.y*t.cell-.5,3*t.cell+1,3*t.cell+1),a.strokeStyle=s.emph,a.strokeRect(t.outX+c.x*t.cell-.5,t.outY+c.y*t.cell-.5,t.cell+1,t.cell+1),b(c)},v=e=>{if(!u.current){let t=Math.min(1,Math.max(0,(e-p)/6e3));if(t>=1){m.current=195,h.current=!0,g(),x=0;return}m.current=Math.floor(196*t)}
1g(),x=requestAnimationFrame(v)};f(),g();let y=new ResizeObserver(()=>{f(),g()});y.observe(e),!n||r||h.current||(p=performance.now()-m.current/196*6e3,x=requestAnimationFrame(v));let j=t=>{let n=d.current;if(!n)return;let r=e.getBoundingClientRect(),a=t.clientX-r.left,i=t.clientY-r.top;if(a>=n.inX&&a<n.inX+16*n.cell&&i>=n.inY&&i<n.inY+16*n.cell){let e=Math.min(15,Math.max(0,Math.floor((a-n.inX)/n.cell))),t=Math.min(15,Math.max(0,Math.floor((i-n.inY)/n.cell)));u.current={x:Math.min(13,Math.max(0,e-1)),y:Math.min(13,Math.max(0,t-1))}}else u.current=null;x||g()},w=()=>{u.current=null,x?b(null):g()};return e.addEventListener("pointermove",j),e.addEventListener("pointerleave",w),()=>{cancelAnimationFrame(x),x=0,y.disconnect(),e.removeEventListener("pointermove",j),e.removeEventListener("pointerleave",w)}},[n,r,i]),(0,a.jsx)(e0,{num:"04",title:"Convolution",caption:"A Sobel kernel over a bitmap, one patch at a time.",href:"/problems/41",linkLabel:"practice this",className:t,children:(0,a.jsxs)("div",{ref:l,role:"img","aria-label":"A Sobel edge detection kernel scanning a bitmap and producing its real convolution output",className:"absolute inset-0",children:[(0,a.jsx)("canvas",{ref:o,"aria-hidden":"true",className:"absolute inset-0 h-full w-full"}),(0,a.jsxs)("div",{"aria-hidden":"true",className:"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-center font-jetbrainsMono text-[9px] leading-relaxed text-zinc-500 dark:text-zinc-500",children:[(0,a.jsx)("div",{children:"-1\xa0\xa00\xa0+1"}),(0,a.jsx)("div",{children:"-2\xa0\xa00\xa0+2"}),(0,a.jsx)("div",{children:"-1\xa0\xa00\xa0+1"})]}),(0,a.jsx)("span",{ref:c,className:"absolute bottom-2 left-2 font-jetbrainsMono text-[10px] tabular-nums text-zinc-500 dark:text-zinc-400"})]})})}},{key:"attention",label:"attention",Plate:function(){let e=eQ(),t=(0,F.J)(),{resolvedTheme:n}=(0,tt.F)(),r="light"!==n,i=(0,s.useMemo)(()=>tP.map((e,t)=>(function(e){let t=tL(tP[e]),n=tP.map(e=>{let n=tL(e),r=0;for(let e=0;e<8;e++)r+=t[e]*n[e];return r/Math.sqrt(8)}),r=Math.max(...n),a=n.map(e=>Math.exp(e-r)),i=a.reduce((e,t)=>e+t,0);return a.map(e=>tI(e/i))}
1)(t)),[]),[l,o]=(0,s.useState)(0),d=(0,s.useRef)(!1),u=(0,s.useRef)(!1),m=(0,s.useRef)(0),h=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!e||t||u.current)return;let n=setInterval(()=>{if(d.current){u.current=!0,clearInterval(n);return}m.current+=1,o(m.current),m.current>=tT-1&&(u.current=!0,clearInterval(n))},2500);return()=>clearInterval(n)},[e,t]);let x=e=>{d.current=!0,u.current=!0,o(e)},p=(e,t)=>{h.current&&(h.current.textContent="a[".concat(e,"][").concat(t,"] ").concat(i[e][t].toFixed(3)))},f=i[l];return(0,a.jsxs)(e0,{num:"05",title:"Attention",caption:"softmax(QKᵀ/√d) over six words. Vectors from a 160-word corpus on this page.",href:"/problems/490",linkLabel:"practice this",children:[(0,a.jsxs)("svg",{viewBox:"0 0 ".concat(400," ").concat(300),className:"h-full w-full","aria-label":"Attention",children:[i.map((e,t)=>e.map((e,n)=>(0,a.jsx)("rect",{x:t_+26*n+1,y:26+26*t+1,width:24,height:24,rx:2,fill:function(e,t){let{lo:n,hi:r}=t?tB.dark:tB.light,a=n.map((t,n)=>Math.round(t+(r[n]-t)*e));return"rgb(".concat(a[0],", ").concat(a[1],", ").concat(a[2],")")}(e,r),onPointerEnter:()=>p(t,n)},"".concat(t,"-").concat(n)))),(0,a.jsx)("rect",{x:t_,y:26+26*l,width:26*tT,height:26,rx:3,fill:"none",strokeWidth:1,className:"stroke-zinc-900 dark:stroke-zinc-100"}),tP.map((e,n)=>{if(n===l)return null;let r=tD(l),i=tD(n);return(0,a.jsx)(c.E.path,{d:"M ".concat(r," ").concat(268," Q ").concat((r+i)/2," ").concat(250-.12*Math.abs(i-r)," ").concat(i," ").concat(268),fill:"none",strokeWidth:Math.max(.6,7*f[n]),className:"stroke-zinc-500",strokeLinecap:"round",initial:!t&&{pathLength:0},animate:{pathLength:1},transition:{duration:t?0:.2,ease:[.22,1,.36,1]}},"".concat(l,"-").concat(n))}),tP.map((e,t)=>(0,a.jsx)("text",{x:tD(t),y:284,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:11,role:"button",tabIndex:0,"aria-pressed":t===l,"aria-label":'Attend from "'.concat(e,'"'),className:"cursor-pointer rounded outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 dark:focus-visible:ring-zinc-500 ".concat(t===l?"fill-zinc-900 dark:fill-zinc-100":"fill-zinc-500 dark:fill-zinc-400"),onPointerEnter:()=>x(t),onFocus:()=>x(t),onClick:()=>x(t),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),x(t))},children:e},e))]}),(0,a.jsx)("span",{ref:h,className:"absolute right-2 top-2 font-jetbrainsMono text-[10px] tabular-nums text-zinc-500",children:"a[0][0] ".concat(i[0][0].toFixed(3))})]})}},{key:"word-space",label:"word space",Plate:function(){let e=(0,s.useMemo)(()=>(function(){let e=tv.map((e,t)=>tF[t][0]),t=tv.map((e,t)=>tF[t][1]),n=Math.min(...e),r=Math.max(...e),a=Math.min(...t),i=Math.max(...t),s=(e,t)=>t-e<1e-12?1:t-e;return tv.map((l,o)=>({word:l,x:tI(.08+(e[o]-n)/s(n,r)*.84),y:tI(.08+(t[o]-a)/s(a,i)*.84)}))})().map(e=>({...e,px:400*e.x,py:300*e.y})),[]),t=(0,s.useMemo)(()=>{let t=[],n=new Set;for(let r of e){let e={x:r.px+5,y:r.py-8,w:5.4*r.word.length,h:11};t.some(t=>t.x<e.x+e.w&&t.x+t.w>e.x&&t.y<e.y+e.h&&t.y+t.h>e.y)||(t.push(e),n.add(r.word))}return n},[e]),[n,r]=(0,s.useState)(null),i=(0,s.useMemo)(()=>n?tv.filter(e=>e!==n).map(e=>({w:e,sim:function(e,t){let n=tL(e),r=tL(t),a=0;for(let e=0;e<8;e++)a+=n[e]*r[e];return Math.round(1e4*a)/1e4}(n,e)})).sort((e,t)=>t.sim-e.sim).slice(0,4):[],[n]),l=(0,s.useMemo)(()=>new Set(i.map(e=>e.w)),[i]),o=(0,s.useMemo)(()=>new Map(e.map(e=>[e.word,e])),[e]),c=e=>null!==n&&e!==n&&!l.has(e);return(0,a.jsx)(e0,{num:"06",title:"Word space",caption:"PPMI and SVD on the same corpus, PCA to the plane. Cosine neighbors.",href:"/problems/76",linkLabel:"practice this",children:(0,a.jsxs)("svg",{viewBox:"0 0 ".concat(400," ").concat(300),className:"h-full w-full","aria-label":"Word space",onPointerLeave:()=>r(null),onClick:e=>{e.target===e.currentTarget&&r(null)},children:[n&&i.map(e=>{let{w:t,sim:r}=e,i=o.get(n),s=o.get(t);return i&&s?(0,a.jsxs)("g",{children:[(0,a.jsx)("line",{x1:i.px,y1:i.py,x2:s.px,y2:s.py,strokeWidth:1,className:"stroke-zinc-400 dark:stroke-zinc-600"}),(0,a.jsx)("text",{x:(i.px+s.px)/2+4,y:(i.py+s.py)/2-4,fontFamily:"JetBrains Mono, monospace",fontSize:9,className:"fill-zinc-500 tabular-nums",children:r.toFixed(2)})]},t):null}),e.map(e=>(0,a.jsxs)("g",{opacity:c(e.word)?.4:1,role:t.has(e.word)?"button":void 0,tabIndex:t.has(e.word)?0:void 0,"aria-pressed":t.has(e.word)?e.word===n:void 0,"aria-label":t.has(e.word)?'Nearest words to "'.concat(e.word,'"'):void 0,className:"cursor-pointer outline-none transition-opacity duration-150 focus-visible:[&>circle]:stroke-zinc-400 focus-visible:[&>circle]:stroke-2",onPointerEnter:()=>r(e.word),onFocus:()=>r(e.word),onClick:()=>r(e.word),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),r(e.word))},children:[(0,a.jsx)("circle",{cx:e.px,cy:e.py,r:e.word===n?4:2.5,className:e.word===n?"fill-zinc-900 dark:fill-zinc-100":"fill-zinc-500"}),(t.has(e.word)||e.word===n||l.has(e.word))&&(0,a.jsx)("text",{x:e.px+5,y:e.py+3,fontFamily:"JetBrains Mono, monospace",fontSize:9,className:e.word===n?"fill-zinc-900 dark:fill-zinc-100":"fill-zinc-600 dark:fill-zinc-400",children:e.word})]},e.word))]})})}},{key:"softmax",label:"softmax",Plate:function(e){let{className:t}=e,n=eQ(),r=(0,F.J)(),i=(0,s.useRef)(null),l=(0,s.useRef)([]),o=(0,s.useRef)(null),c=(0,s.useRef)(null),d=(0,s.useRef)(1),u=(0,s.useRef)(!1);return(0,s.useEffect)(()=>{let e=i.current;if(!e)return;let t=0,a=e=>{d.current=e;let t=tJ(tW,e);t.forEach((e,t)=>{let n=l.current[t];if(!n)return;let r=56*e;n.style.setProperty("height","".concat(r,"px")),n.style.setProperty("y","".concat(148-r,"px"))}),o.current&&(o.current.textContent="T ".concat(e.toFixed(2))),c.current&&(c.current.textContent="max ".concat(Math.max(...t).toFixed(2)))},s=t=>{let n=e.getBoundingClientRect();return Math.exp(Math.log(.2)+Math.min(1,Math.max(0,(t-n.left)/n.width))*(Math.log(5)-Math.log(.2)))},m=e=>{("mouse"===e.pointerType||u.current)&&(cancelAnimationFrame(t),t=0,a(s(e.clientX)))},h=e=>
1{u.current=!0,cancelAnimationFrame(t),t=0,a(s(e.clientX))},x=()=>{u.current=!1,f()},p=()=>{u.current=!1,f()},f=()=>{if(r||!n){a(1);return}let e=d.current,i=performance.now(),s=n=>{let r=1+(e-1)*Math.exp(-(n-i)/250);a(r),Math.abs(r-1)>.01?t=requestAnimationFrame(s):(a(1),t=0)};cancelAnimationFrame(t),t=requestAnimationFrame(s)};return a(d.current),e.addEventListener("pointermove",m),e.addEventListener("pointerdown",h),e.addEventListener("pointerup",x),e.addEventListener("pointerleave",p),()=>{cancelAnimationFrame(t),e.removeEventListener("pointermove",m),e.removeEventListener("pointerdown",h),e.removeEventListener("pointerup",x),e.removeEventListener("pointerleave",p)}},[n,r]),(0,a.jsx)(e0,{num:"07",title:"Softmax",caption:"exp(z/T), normalized. T under your cursor.",href:"/problems/23",linkLabel:"practice this",className:t,children:(0,a.jsxs)("div",{ref:i,role:"img","aria-label":"Six logits and their softmax distribution, sharpening and flattening as temperature changes under the cursor",className:"absolute inset-0",style:{touchAction:"pan-y"},children:[(0,a.jsxs)("svg",{viewBox:"0 0 ".concat(240," ").concat(168),preserveAspectRatio:"xMidYMid meet","aria-hidden":"true",className:"absolute inset-0 h-full w-full",children:[(0,a.jsx)("text",{x:24,y:16,className:"fill-zinc-500",fontFamily:"JetBrains Mono, monospace",fontSize:"8",children:"z"}),(0,a.jsx)("text",{x:24,y:92,className:"fill-zinc-500",fontFamily:"JetBrains Mono, monospace",fontSize:"8",children:"softmax(z/T)"}),(0,a.jsx)("line",{x1:20,x2:220,y1:46,y2:46,className:"stroke-zinc-200 dark:stroke-zinc-800",strokeWidth:"1"}),tW.map((e,t)=>{let n=9*Math.abs(e);return(0,a.jsx)("rect",{x:tX(t),y:e>=0?46-n:46,width:18,height:n,fill:"none",strokeWidth:"1",className:"stroke-zinc-400 dark:stroke-zinc-500"},"z".concat(t))}),tU.map((e,t)=>{let n=56*e;return(0,a.jsx)("rect",{ref:e=>{l.current[t]=e},x:tX(t),y:148-n,width:18,height:n,className:"fill-zinc-600 dark:fill-zinc-400",style:{transition:"y 80ms linear, height 80ms linear"}},"p".concat(t))}),(0,a.jsx)("line",{x1:20,x2:220,y1:148,y2:148,className:"stroke-zinc-200 dark:stroke-zinc-800",strokeWidth:"1"})]}),(0,a.jsxs)("div",{className:"absolute bottom-1.5 left-2 right-2 flex justify-between font-jetbrainsMono text-[10px] tabular-nums text-zinc-500 dark:text-zinc-400",children:[(0,a.jsx)("span",{ref:o,children:"T 1.00"}),(0,a.jsxs)("span",{ref:c,children:["max ",Math.max(...tU).toFixed(2)]})]})]})})}},{key:"k-means",label:"k-means",Plate:function(e){var t;let{className:n}=e,r=eQ(),i=(0,F.J)(),{resolvedTheme:l}=(0,tt.F)(),o=(0,s.useRef)(null),c=(0,s.useRef)(null),d=(0,s.useRef)(null),u=(0,s.useRef)(function(){let e=tY(20260727),t=[];for(let n of tZ)for(let r=0;r<n.n;r++)t.push({x:Math.min(.96,Math.max(.04,n.c.x+tO(e)*n.s)),y:Math.min(.96,Math.max(.04,n.c.y+tO(e)*n.s))});return t}()),m=(0,s.useRef)((t=tY(7),Array.from({length:3},()=>({x:.08+.14*t(),y:.78+.14*t()})))),h=(0,s.useRef)(u.current.map(()=>0)),x=(0,s.useRef)(new Set);return(0,s.useEffect)(()=>{let e=o.current,t=c.current;if(!e||!t)return;let n=t.getContext("2d");if(!n)return;let a=tV["light"===l?"light":"dark"],s=0,p=0,f=!1,b=()=>{let e=u.current,t=m.current,n=new Set;return e.forEach((e,r)=>{let a=0,i=1/0;t.forEach((t,n)=>{let r=tH(e,t);r<i&&(i=r,a=n)}),h.current[r]!==a&&n.add(r),h.current[r]=a}),x.current=n,n.size>0},g=()=>{let e=u.current,t=m.current,n=0;for(let r=0;r<3;r++){let a=0,i=0,s=0;if(e.forEach((e,t)=>{h.current[t]===r&&(a+=e.x,i+=e.y,s++)}),s>0){let e=a/s,l=i/s;n=Math.max(n,tH(t[r],{x:e,y:l})),t[r]={x:e,y:l}}}return n},v=()=>{let e=0;return u.current.forEach((t,n)=>{e+=tH(t,m.current[h.current[n]])}),e},y=()=>{d.current&&(d.current.textContent="inertia ".concat(v().toFixed(2)))},j=()=>{let r=Math.min(window.devicePixelRatio||1,2);t.width=Math.round(e.clientWidth*r),t.height=Math.round(e.clientHeight*r),n.setTransform(r,0,0,r,0,0)},w=t=>{let r=e.clientWidth,i=e.clientHeight;n.clearRect(0,0,r,i);let s=e=>[e.x*r,e.y*i];t&&(n.strokeStyle=a.line,n.globalAlpha=.15,n.lineWidth=1,x.current.forEach(e=>{let[t,r]=s(u.current[e]),[a,i]=s(m.current[h.current[e]]);n.beginPath(),n.moveTo(t,r),n.lineTo(a,i),n.stroke()}),n.globalAlpha=1),u.current.forEach((e,t)=>{let[r,i]=s(e),l=h.current[t];
1n.strokeStyle=a.dot,n.fillStyle=a.dot,n.lineWidth=1.2,0===l?(n.beginPath(),n.arc(r,i,2.4,0,2*Math.PI),n.fill()):(1===l?(n.beginPath(),n.arc(r,i,2.6,0,2*Math.PI)):(n.beginPath(),n.moveTo(r-2.6,i),n.lineTo(r+2.6,i),n.moveTo(r,i-2.6),n.lineTo(r,i+2.6)),n.stroke())}),m.current.forEach(e=>{let[t,r]=s(e);n.fillStyle=a.centroid,n.beginPath(),n.arc(t,r,3.2,0,2*Math.PI),n.fill(),n.strokeStyle=a.ring,n.lineWidth=1,n.beginPath(),n.arc(t,r,6,0,2*Math.PI),n.stroke()}),y()},k=()=>{let e=b(),t=g();!e&&t<1e-4&&(f=!0),w(!0)},z=e=>{!f&&e-p>=600?(p=e,k()):e-p>=600&&x.current.size>0&&(x.current=new Set,w(!1)),s=requestAnimationFrame(z)};j(),i||!r?((()=>{for(let e=0;e<40&&(b(),!(1e-4>g()));e++);x.current=new Set,f=!0})(),w(!1)):(b(),w(!0),p=performance.now(),s=requestAnimationFrame(z));let N=new ResizeObserver(()=>{j(),w(!1)});N.observe(e);let M=t=>{let n=e.getBoundingClientRect(),a={x:(t.clientX-n.left)/n.width,y:(t.clientY-n.top)/n.height};u.current.push(a),h.current.push(0),f=!1,i||!r?(b(),g(),x.current=new Set,f=!0,w(!1)):p=0};return e.addEventListener("pointerdown",M),()=>{cancelAnimationFrame(s),N.disconnect(),e.removeEventListener("pointerdown",M)}},[r,i,l]),(0,a.jsx)(e0,{num:"08",title:"k-means",caption:"Lloyd's algorithm on 80 points, three means.",href:"/problems/17",linkLabel:"practice this",className:n,children:(0,a.jsxs)("div",{ref:o,role:"img","aria-label":"Lloyd's k-means algorithm converging on clustered points; click to add a point",className:"absolute inset-0 cursor-crosshair",children:[(0,a.jsx)("canvas",{ref:c,"aria-hidden":"true",className:"absolute inset-0 h-full w-full"}),(0,a.jsx)("span",{ref:d,className:"absolute bottom-2 left-2 font-jetbrainsMono text-[10px] tabular-nums text-zinc-500 dark:text-zinc-400"})]})})}}];function tK(e){let{className:t=""}=e,[n,r]=(0,s.useState)(0),[i,l]=(0,s.useState)(0),[o,c]=(0,s.useState)(!1),[d,u]=(0,s.useState)(!1),[m,h]=(0,s.useState)(null),x=(0,s.useRef)(n),p=(0,s.useRef)(null),f=(0,s.useRef)(null),b=(0,s.useRef)([]),g=(0,s.useRef)([]),v=(0,s.useRef)(!1),y=(0,F.J)();(0,s.useEffect)(()=>{x.current=n},[n]),(0,s.useEffect)(()=>{let e=f.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;return u(t.isIntersecting)},{threshold:.2});return t.observe(e),()=>t.disconnect()},[]),(0,s.useEffect)(()=>{let e=f.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&!v.current&&(v.current=!0,eG().then(h),t.disconnect())},{rootMargin:"400px"});return t.observe(e),()=>t.disconnect()},[]);let j=(0,s.useCallback)(e=>{e!==x.current&&(x.current=e,r(e),c(!0))},[]),w=(0,s.useCallback)(()=>{if(l(x.current),null!==p.current&&window.clearTimeout(p.current),y){c(!1);return}p.current=window.setTimeout(()=>c(!1),320)},[y]);(0,s.useEffect)(()=>()=>{null!==p.current&&window.clearTimeout(p.current)},[]);let k=e=>t=>{var n;let r="ArrowDown"===t.key||"ArrowRight"===t.key?1:"ArrowUp"===t.key||"ArrowLeft"===t.key?-1:0;if(0===r)return;t.preventDefault();let a=(x.current+r+tG.length)%tG.length;j(a),null===(n=(e?g:b).current[a])||void 0===n||n.focus()},z=tG[i].Plate,N=(e,t)=>{let r=e===n;return(0,a.jsxs)("button",{ref:n=>{t?g.current[e]=n:b.current[e]=n},type:"button",role:"tab",id:"spotlight-tab-".concat(t?"m":"d","-").concat(tG[e].key),"aria-selected":r,"aria-controls":"spotlight-stage",tabIndex:r?0:-1,onClick:()=>j(e),className:t?"min-h-[44px] shrink-0 snap-start rounded-full border px-4 text-sm font-jetbrainsMono transition-colors ".concat(r?"border-zinc-900 text-zinc-900 dark:border-zinc-100 dark:text-zinc-100":"border-zinc-200 text-zinc-500 dark:border-zinc-800 dark:text-zinc-400"):"group flex w-full items-baseline gap-3 border-l-2 py-1.5 pl-3 text-left transition-all duration-200 ".concat(r?"border-zinc-900 text-zinc-900 dark:border-zinc-100 dark:text-zinc-100 [font-variation-settings:'wght'_700]":"border-transparent text-zinc-500 hover:text-zinc-900 dark:text-zinc-500 dark:hover:text-zinc-200 [font-variation-settings:'wght'_400]"),children:[!t&&(0,a.jsx)("span",{className:"text-xs tabular-nums text-zinc-500 dark:text-zinc-500",children:String(e+1).padStart(2,"0")}),(0,a.jsx)("span",{className:t?"":"font-jetbrainsMono text-xl md:text-2xl text-balance",children:tG[e].label})]},tG[e].key)};return(0,a.jsxs)("section",{ref:f,id:"spotlight","aria-labelledby":"spotlight-heading",className:t,children:[(0,a.jsx)("h2",{id:"spotlight-heading",className:"max-w-3xl font-jetbrainsMono text-3xl font-bold text-balance text-zinc-900 md:text-4xl dark:text-zinc-100",children:"What you actually implement"}),(0,a.jsxs)("p",{className:"mt-4 max-w-xl font-inter text-base text-pretty text-zinc-600 dark:text-zinc-400",children:["Every figure here is the real computation, running in the page.",m?" Each one is a problem you can open, across ".concat(m.categories.length," categories."):""]}),(0,a.jsx)("div",{role:"tablist","aria-label":"Topics","aria-orientation":"horizontal",onKeyDown:k(!0),className:"mt-6 flex snap-x gap-2 overflow-x-auto pb-2 md:hidden",children:tG.map((e,t)=>N(t,!0))}),(0,a.jsxs)("div",{className:"mt-2 grid grid-cols-1 gap-8 md:mt-10 md:grid-cols-12",children:[(0,a.jsx)("div",{role:"tablist","aria-label":"Topics","aria-orientation":"vertical",onKeyDown:k(!1),className:"hidden flex-col gap-1 self-center md:col-span-4 md:flex",children:tG.map((e,t)=>N(t,!1))}),(0,a.jsx)("div",{id:"spotlight-stage",role:"tabpanel","aria-labelledby":"spotlight-tab-d-".concat(tG[i].key," spotlight-tab-m-").concat(tG[i].key),className:"md:col-span-8",children:(0,a.jsx)(eY,{trigger:tG[n].key,onCovered:w,className:"mx-auto w-full max-w-2xl rounded-xl",children:(0,a.jsx)(eK.Provider,{value:d&&!o,children:(0,a.jsx)(z,{})})})})]}),(0,a.jsx)("div",{className:"mt-16 min-h-[22rem]",children:m&&(0,a.jsx)(eV,{data:m})})]})}let tQ=[.22,1,.36,1],t$=K.slice(0,18),t0=K.slice(18),t1=[...t$.slice(0,14),...t0.slice(0,14)];function t2(e){let{names:t,ariaHidden:n=!1}=e;return(0,a.jsx)("div",{className:"flex w-max items-center","aria-hidden":n||void 0,children:t.map(e=>(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"cursor-default font-jetbrainsMono text-sm whitespace-nowrap text-zinc-500 transition-colors duration-150 hover:text-zinc-900 dark:text-zinc-500 dark:hover:text-zinc-100",children:e}),(0,a.jsx)("span",{className:"mx-5 inline-block h-[3px] w-[3px] rounded-full bg-zinc-300 dark:bg-zinc-700"})]},e))})}function t5(e){let{names:t,reverse:n=!1,durationS:r}=e;return(0,a.jsx)("div",{className:"overflow-hidden py-2 [mask-image:linear-gradient(to_right,transparent,black_10%,black_90%,transparent)]","aria-hidden":"true",children:(0,a.jsxs)("div",{className:"flex w-max will-change-transform group-hover:[animation-play-state:paused]",style:{animation:"dml-marquee ".concat(r,"s linear infinite").concat(n?" reverse":"")},children:[(0,a.jsx)(t2,{names:t}),(0,a.jsx)(t2,{names:t,ariaHidden:!0})]})})}function t4(e){let{className:t=""}=e,n=(0,F.J)();return(0,a.jsxs)("section",{className:t,"aria-label":"Companies and universities where Deep-ML users work and study",children:[(0,a.jsx)("style",{children:"@keyframes dml-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }"}),(0,a.jsx)("p",{className:"mb-5 text-center font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase",children:"engineers at these companies practice here"}),(0,a.jsx)("p",{className:"sr-only",children:K.join(", ")}),(0,a.jsxs)("div",{className:"group motion-reduce:hidden",children:[(0,a.jsx)(t5,{names:t$,durationS:55}),(0,a.jsx)(t5,{names:t0,durationS:58,reverse:!0})]}),(0,a.jsx)("div",{className:"hidden flex-wrap items-center justify-center gap-y-2 motion-reduce:flex","aria-hidden":"true",children:t1.map(e=>(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"font-jetbrainsMono text-sm text-zinc-500 dark:text-zinc-500",children:e}),(0,a.jsx)("span",{className:"mx-4 inline-block h-[3px] w-[3px] rounded-full bg-zinc-300 dark:bg-zinc-700"})]},e))}),(0,a.jsxs)("p",{className:"mt-12 mb-5 text-center font-jetbrainsMono text-[10px] tracking-wider text-zinc-500 uppercase",children:["students at ",700,"+ universities practice here"]}),(0,a.jsx)(c.E.div,{className:"mx-auto flex max-w-4xl flex-wrap items-center justify-center gap-y-2 px-4",initial:!n&&"hidden",
1whileInView:"visible",viewport:{once:!0,amount:.3},variants:{visible:{transition:{staggerChildren:.015}}},children:G.map((e,t)=>(0,a.jsxs)(c.E.span,{className:"flex items-center",variants:{hidden:{opacity:0,y:4},visible:{opacity:1,y:0,transition:{duration:.3,ease:tQ}}},children:[(0,a.jsx)("span",{className:"cursor-default font-jetbrainsMono text-sm whitespace-nowrap text-zinc-500 transition-colors duration-150 hover:text-zinc-900 dark:text-zinc-500 dark:hover:text-zinc-100",children:e}),t<G.length-1&&(0,a.jsx)("span",{className:"mx-4 inline-block h-[3px] w-[3px] rounded-full bg-zinc-300 dark:bg-zinc-700"})]},e))})]})}let t3=[.22,1,.36,1];function t6(e){let{className:t=""}=e,n=(0,F.J)();return(0,a.jsxs)(c.E.section,{className:"flex min-h-[50vh] flex-col items-center justify-center gap-8 text-center ".concat(t),initial:!n&&{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0,amount:.4},transition:{duration:.5,ease:t3},"aria-label":"Start solving",children:[(0,a.jsx)(o.default,{href:"/problems",className:"font-jetbrainsMono font-bold text-zinc-900 underline decoration-zinc-900/30 underline-offset-8 transition-[text-decoration-color,text-shadow] duration-300 hover:decoration-zinc-900 dark:text-zinc-100 dark:decoration-zinc-100/30 dark:hover:decoration-zinc-100 dark:hover:[text-shadow:0_0_28px_rgba(255,255,255,0.3)] motion-reduce:transition-none",style:{fontSize:"clamp(2.5rem, 7vw, 6rem)"},children:"Start solving."}),(0,a.jsx)("p",{className:"font-inter text-sm text-zinc-600 dark:text-zinc-400",children:"Free to start."})]})}var t8=n(98096);let t9="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8";function t7(){return(0,a.jsxs)("div",{className:"bg-zinc-50 dark:bg-zinc-950 text-zinc-900 dark:text-zinc-100",children:[(0,a.jsx)(E,{className:"".concat(t9," pt-24 sm:pt-28 lg:pt-24")}),(0,a.jsx)(q,{className:"".concat(t9," pt-20 pb-24")}),(0,a.jsx)(t4,{className:"pb-20"}),(0,a.jsx)(eX,{className:"".concat(t9," pb-16")}),(0,a.jsx)(tK,{className:"".concat(t9," pt-4 pb-24")}),(0,a.jsx)(t6,{className:"px-4 pt-8 pb-24"}),(0,a.jsx)(i.Z,{}),(0,a.jsx)(t8.Z,{})]})}},60720:function(e,t,n){"use strict";n.d(t,{J:function(){return i}});var r=n(57437);let a={ember:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M12 11.4c-2.1 2.3-3.4 3.7-3.4 5.5a3.4 3.4 0 006.8 0c0-1.8-1.3-3.2-3.4-5.5z"}),(0,r.jsx)("circle",{cx:"15.6",cy:"7.4",r:"1"}),(0,r.jsx)("circle",{cx:"10.2",cy:"5.2",r:"0.7"})]}),blaze:(0,r.jsx)("path",{d:"M12 2.5C9.2 5.8 7 8.2 7 12a5 5 0 0010 0c0-3.8-2.2-6.2-5-9.5z"}),inferno:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M8 6C6.6 7.7 5.7 9 5.7 10.8a2.8 2.8 0 005.6 0c0-1.8-1.2-3.2-3.3-4.8z"}),(0,r.jsx)("path",{d:"M15.5 4.5C13.7 6.8 12.3 8.6 12.3 11a3.6 3.6 0 007.2 0c0-2.4-1.6-4.3-4-6.5z"})]}),wildfire:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M6.5 9C5.6 10 5 10.9 5 12a2 2 0 004 0c0-1.1-.8-2-2.5-3z"}),(0,r.jsx)("path",{d:"M17.5 9C16.6 10 16 10.9 16 12a2 2 0 004 0c0-1.1-.8-2-2.5-3z"}),(0,r.jsx)("path",{d:"M12 3.5C10.4 6 8.8 7.8 8.8 11a3.2 3.2 0 006.4 0c0-3.2-1.6-5.2-3.2-7.5z"})]}),phoenix:(0,r.jsx)("path",{d:"M12 6.5C9.2 9.4 5.6 11 2 11c2.6 1 4.2 2.9 4.7 5.6C8 14.2 9.9 13 12 13s4 1.2 5.3 3.6C17.8 13.9 19.4 12 22 11c-3.6 0-7.2-1.6-10-4.5z"}),eternal:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("path",{d:"M7.5 4l2 2.3L12 3l2.5 3.3 2-2.3-.6 3.6H8.1z"}),(0,r.jsx)("path",{d:"M12 8.9c-1.9 2.2-3.4 3.8-3.4 6.3a3.4 3.4 0 006.8 0c0-1.7-.9-3-2-4.6-.4.8-.8 1.1-.8 1.9a.95.95 0 01-1.9 0c0-1.9.7-2.6 1.3-3.5z"})]})};function i(e){var t;let{id:n,className:i="h-4 w-4",gradient:s,...l}=e,o=s?"url(#".concat(s.id,")"):"currentColor";return(0,r.jsxs)("svg",{viewBox:"0 0 24 24",fill:o,className:i,"aria-hidden":"true",...l,children:[s&&(0,r.jsx)("defs",{children:(0,r.jsx)("linearGradient",{id:s.id,x1:"0",y1:"1",x2:"0",y2:"0",children:s.stops.map((e,t)=>(0,r.jsx)("stop",{offset:e.offset,stopColor:e.color},t))})}),null!==(t=a[n])&&void 0!==t?t:a.ember]})}},56864:function(e,t,n){"use strict";n.d(t,{U:function(){return s}});var r=n(57437),a=n(29948),i=n(60720);function s(e){let{flame:t,showEvolution:n=!1,className:s=""}=e,l=(0,a.U_)(t);return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-zinc-200 dark:border-zinc-700 px-2 py-0.5 font-jetbrainsMono text-xs leading-none ".concat(s),title:l.isMax?"Level ".concat(l.level," \xb7 ").concat(l.evolution.name," \xb7 MAX"):"Level ".concat(l.level," \xb7 ").concat(l.evolution.name," \xb7 ").concat(l.flameToNext," Heat to Lv. ").concat(l.level+1),children:[n?(0,r.jsx)(i.J,{id:l.evolution.id,className:"h-3.5 w-3.5 ".concat(l.evolution.color)}):(0,r.jsx)("span",{className:"h-1.5 w-1.5 rounded-full ".concat(l.evolution.dot)}),(0,r.jsx)("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Lv."}),(0,r.jsx)("span",{className:"font-semibold tabular-nums text-zinc-900 dark:text-zinc-100",children:l.level}),n&&(0,r.jsx)("span",{className:"font-medium ".concat(l.evolution.color),children:l.evolution.name})]})}t.Z=s},78790:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(57437),a=n(2265);let i={top:18,right:20,bottom:30,left:52};function s(e){let{versions:t,baseline:n,metricLabel:s,lowerIsBetter:l,selectedId:o,onSelect:c,height:d=300}=e,[u,m]=(0,a.useState)(null),{dots:h,stepPath:x,yTicks:p,yMin:f,yMax:b,n:g}=(0,a.useMemo)(()=>{var e,r;let a=t.filter(e=>null!=e.test_metric).sort((e,t)=>
1(e.created_at||"").localeCompare(t.created_at||""));if(0===a.length)return{dots:[],stepPath:"",yTicks:[],yMin:0,yMax:0,n:0};let s=a.map(e=>e.test_metric),l=null!=n?[n]:[],o=Math.min(...s,...l),c=Math.max(...s,...l);c-o<1e-6&&(o-=.05,c+=.05);let u=(c-o)*.1;o-=u,c+=u;let m=a.length,h=e=>i.left+(e+1)/(m+1)*(860-i.left-i.right),x=e=>i.top+(1-(e-o)/(c-o))*(d-i.top-i.bottom),p=a.map((e,t)=>({x:h(t),y:x(e.test_metric),v:e})),f=i.left,b=null!=n?x(n):null!==(r=null===(e=p.find(e=>e.v.promoted))||void 0===e?void 0:e.y)&&void 0!==r?r:x(s[0]),g="M".concat(f.toFixed(1),",").concat(b.toFixed(1));for(let e of p)e.v.promoted&&(g+=" L".concat(e.x.toFixed(1),",").concat(b.toFixed(1)," L").concat(e.x.toFixed(1),",").concat(e.y.toFixed(1)),b=e.y);return{dots:p,stepPath:g+=" L".concat((860-i.right).toFixed(1),",").concat(b.toFixed(1)),yTicks:[o+u,(o+c)/2,c-u],yMin:o,yMax:c,n:m}},[t,n,d]),v=e=>i.top+(1-(e-f)/(b-f))*(d-i.top-i.bottom);if(0===g)return(0,r.jsx)("div",{className:"flex items-center justify-center rounded-xl border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900",style:{height:d},children:(0,r.jsx)("span",{className:"font-jetbrainsMono text-xs text-zinc-500 dark:text-zinc-400",children:"No scored submissions yet. The first experiment draws the first dot."})});let y=u?h.find(e=>e.v.id===u):null;return(0,r.jsxs)("div",{className:"depth-top rounded-xl border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 shadow-sm dark:shadow-none p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 px-1 pb-1.5",children:[(0,r.jsxs)("span",{className:"font-jetbrainsMono text-[10px] uppercase tracking-wider text-zinc-500 dark:text-zinc-400",children:["Progress \xb7 ",g," experiment",1===g?"":"s",", ",h.filter(e=>e.v.promoted).length," merged"]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 font-jetbrainsMono text-[10px] text-zinc-500 dark:text-zinc-400",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-green-500"})," merged"]}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-zinc-300 dark:bg-zinc-600"})," discarded"]}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"w-3 h-0.5 bg-green-500/70"})," canonical ",s]})]})]}),(0,r.jsxs)("svg",{viewBox:"0 0 ".concat(860," ").concat(d),className:"w-full",onMouseLeave:()=>m(null),children:[p.map((e,t)=>(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:i.left,x2:860-i.right,y1:v(e),y2:v(e),className:"stroke-zinc-200 dark:stroke-zinc-800",strokeWidth:1}),(0,r.jsx)("text",{x:i.left-6,y:v(e)+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:9,className:"fill-zinc-500 dark:fill-zinc-400",children:e.toFixed(3)})]},t)),(0,r.jsx)("path",{d:x,fill:"none",strokeWidth:1.5,className:"stroke-green-500/70"}),null!=n&&(0,r.jsxs)("g",{children:[(0,r.jsx)("circle",{cx:i.left,cy:v(n),r:4,className:"fill-green-500"}),(0,r.jsx)("text",{x:i.left+7,y:v(n)-7,fontFamily:"JetBrains Mono, monospace",fontSize:9,className:"fill-green-600 dark:fill-green-500",children:"baseline"})]}),h.filter(e=>!e.v.promoted).map(e=>(0,r.jsxs)("g",{role:"button",tabIndex:0,"aria-label":"".concat(e.v.author_name||"anonymous",", ").concat(s," ").concat(e.v.test_metric.toFixed(4),", discarded"),className:"cursor-pointer focus:outline-none",onMouseEnter:()=>m(e.v.id),onFocus:()=>m(e.v.id),onBlur:()=>m(null),onClick:()=>null==c?void 0:c(e.v),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),null==c||c(e.v))},children:[(0,r.jsx)("circle",{cx:e.x,cy:e.y,r:10,fill:"transparent"}),(0,r.jsx)("circle",{cx:e.x,cy:e.y,r:u===e.v.id?4.5:3,className:"transition-all ".concat(o===e.v.id?"fill-zinc-500 dark:fill-zinc-300":"fill-zinc-300 dark:fill-zinc-600 opacity-70")})]},e.v.id)),h.filter(e=>e.v.promoted).map(e=>(0,r.jsxs)("g",{children:[(0,r.jsxs)("g",{role:"button",tabIndex:0,"aria-label":"".concat(e.v.author_name||"anonymous",", ").concat(s," ").concat(e.v.test_metric.toFixed(4),", merged"),className:"cursor-pointer focus:outline-none",onMouseEnter:()=>m(e.v.id),onFocus:()=>m(e.v.id),onBlur:()=>m(null),onClick:()=>null==c?void 0:c(e.v),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),null==c||c(e.v))},children:[(0,r.jsx)("circle",{cx:e.x,cy:e.y,r:12,fill:"transparent"}),(0,r.jsx)("circle",{cx:e.x,cy:e.y,r:u===e.v.id||o===e.v.id?7:5,strokeWidth:1.5,className:"fill-green-500 stroke-white dark:stroke-zinc-900 transition-all"})]}),(0,r.jsxs)("text",{x:e.x+8,y:e.y-8,fontFamily:"JetBrains Mono, monospace",fontSize:9,transform:"rotate(-28 ".concat(e.x+8," ").concat(e.y-8,")"),className:"fill-green-600 dark:fill-green-500 pointer-events-none",children:[(e.v.author_name||"anonymous").slice(0,14)," \xb7 ",(e.v.slot_ids||[]).join("+").slice(0,22)]})]},e.v.id)),y&&(0,r.jsxs)("g",{className:"pointer-events-none",children:[(0,r.jsx)("line",{x1:y.x,x2:y.x,y1:i.top,y2:d-i.bottom,className:"stroke-zinc-300 dark:stroke-zinc-700",strokeWidth:1}),(0,r.jsxs)("text",{x:Math.min(y.x+8,670),y:d-i.bottom-8,fontFamily:"JetBrains Mono, monospace",fontSize:9,className:"fill-zinc-600 dark:fill-zinc-300",children:[(y.v.author_name||"anonymous").slice(0,16)," \xb7 ",s," ",y.v.test_metric.toFixed(4)," \xb7 click for details"]}
1)]}),(0,r.jsx)("text",{x:i.left,y:d-8,fontFamily:"JetBrains Mono, monospace",fontSize:9,className:"fill-zinc-500 dark:fill-zinc-400",children:"experiments →"}),(0,r.jsx)("text",{x:860-i.right,y:d-8,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:9,className:"fill-zinc-500 dark:fill-zinc-400",children:l?"lower is better":"higher is better"})]})]})}},8413:function(e,t,n){"use strict";var r=n(57437),a=n(2265),i=n(99376),s=n(33498),l=n(73247),o=n(44902);let c=(0,a.forwardRef)(function(e,t){let{size:n="compact",defaultValue:c="",autoFocus:d=!1,placeholder:u="Search problems, labs, projects, interview prep…",onSearch:m,className:h=""}=e,x=(0,i.useRouter)(),[p,f]=(0,a.useState)(c),b="hero"===n;return(0,r.jsxs)("form",{role:"search",onSubmit:e=>{e.preventDefault();let t=(0,o.T9)(p);t&&(m?m(t):x.push((0,o.bE)(t)))},className:"relative w-full ".concat(h),children:[(0,r.jsx)(l.Z,{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 text-zinc-400 dark:text-zinc-500 ".concat(b?"left-4 h-4 w-4":"left-3.5 h-4 w-4"),"aria-hidden":!0}),(0,r.jsx)("input",{ref:t,type:"search",name:"q",value:p,onChange:e=>f(e.target.value),autoFocus:d,autoComplete:"off",spellCheck:!1,enterKeyHint:"search",maxLength:200,placeholder:u,"aria-label":"Search the site",className:"w-full rounded-full border border-zinc-300 bg-white font-jetbrainsMono text-sm text-zinc-900 shadow-[inset_0_1px_2px_rgba(0,0,0,0.06)] transition-colors duration-150 placeholder:text-zinc-400 focus:border-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-400 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100 dark:shadow-[inset_0_1px_0_rgba(255,255,255,0.05)] dark:placeholder:text-zinc-500 dark:focus:border-zinc-500 dark:focus:ring-zinc-500 [&::-webkit-search-cancel-button]:hidden ".concat(b?"h-12 pl-11 pr-28":"h-11 pl-10 pr-24")}),(0,r.jsx)(s.E.button,{type:"submit",whileTap:{scale:.96},disabled:!p.trim(),className:"absolute right-1.5 top-1/2 inline-flex -translate-y-1/2 items-center rounded-full bg-zinc-900 px-3.5 font-jetbrainsMono text-xs font-medium text-white transition-colors duration-150 hover:bg-zinc-800 active:bg-zinc-700 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-zinc-200 dark:active:bg-zinc-300 ".concat(b?"h-9":"h-8"),children:"Search"})]})});t.Z=c},29948:function(e,t,n){"use strict";n.d(t,{IP:function(){return i},U_:function(){return l},c0:function(){return s},mu:function(){return a},rF:function(){return r}});let r=[{minLevel:1,id:"ember",name:"Ember",color:"text-amber-500",dot:"bg-amber-500",ring:"ring-amber-500",glow:"bg-amber-500/20"},{minLevel:20,id:"blaze",name:"Blaze",color:"text-orange-500",dot:"bg-orange-500",ring:"ring-orange-500",glow:"bg-orange-500/20"},{minLevel:40,id:"inferno",name:"Inferno",color:"text-orange-600",dot:"bg-orange-600",ring:"ring-orange-600",glow:"bg-orange-600/25"},{minLevel:60,id:"wildfire",name:"Wildfire",color:"text-red-500",dot:"bg-red-500",ring:"ring-red-500",glow:"bg-red-500/25"},{minLevel:80,id:"phoenix",name:"Phoenix",color:"text-red-600",dot:"bg-red-600",ring:"ring-red-600",glow:"bg-red-600/30"},{minLevel:100,id:"eternal",name:"Eternal Flame",color:"text-red-500",dot:"bg-red-500",ring:"ring-red-500",glow:"bg-red-500/40"}];function a(e){return 10*(Math.max(1,Math.min(100,Math.floor(e)))-1)**2}function i(e){return Math.max(1,Math.min(100,Math.floor(Math.sqrt(Math.max(0,e||0)/10))+1))}function s(e){let t=r[0];for(let n of r)e>=n.minLevel&&(t=n);return t}function l(e){let t=Math.floor(Math.max(0,e||0)),n=i(t),l=n>=100,o=s(n),c=a(n),d=r.find(e=>e.minLevel>n),u=d?d.minLevel:null;if(l)return{level:n,evolution:o,flame:t,isMax:!0,levelFloor:c,nextLevelFlame:null,flameIntoLevel:t-c,flameForCurrentLevel:0,flameToNext:0,progress:1,nextEvolutionLevel:null};let m=a(n+1),h=m-c,x=t-c;return{level:n,evolution:o,flame:t,isMax:!1,levelFloor:c,nextLevelFlame:m,flameIntoLevel:x,flameForCurrentLevel:h,flameToNext:Math.max(0,m-t),progress:h>0?x/h:0,nextEvolutionLevel:u}}},44902:function(e,t,n){"use strict";n.d(t,{CC:function(){return a},EJ:function(){return s},T9:function(){return l},bE:function(){return o},j$:function(){return i}}),n(82957).lW;let r="/search",a=["problem","lab","math","project","collection","company","path","article"],i={problem:{one:"Problem",many:"Problems"},lab:{one:"Lab",many:"Labs"},math:{one:"Math",many:"Math"},project:{one:"Project",many:"Projects"},collection:{one:"Collection",many:"Collections"},company:{one:"Interview prep",many:"Interview prep"},path:{one:"Path",many:"Paths"},article:{one:"Article",many:"Articles"}},s=e=>"string"==typeof e&&a.includes(e);function l(e){return String(null!=e?e:"").replace(/[\u0000-\u001f]/g," ").replace(/\s+/g," ").trim().slice(0,200)}function o(e,t){let n=new URLSearchParams,a=l(e);a&&n.set("q",a),t&&"all"!==t&&n.set("kind",t);let i=n.toString();return i?"".concat(r,"?").concat(i):r}},44745:function(e,t,n){"use strict";n.d(t,{DY:function(){return i},Py:function(){return c},S8:function(){return s},VX:function(){return a},ae:function(){return l},kR:function(){return o},uD:function(){return r}});let r=["basics","advanced","pro"],a={basics:"Basics",advanced:"Advanced",pro:"Pro"};function i(e,t){return"".concat(e,":").concat(t)}function s(e){return e?e.sections.flatMap(e=>e.steps):[]}function l(e){return e.tiers.flatMap(e=>s(e))}function o(e,t){return e.tiers.find(e=>e.tier===t)}function c(e){return r.includes(e)?e:null}}},function(e){e.O(0,[49637,24358,8310,86401,33498,54146,82957,99925,72972,68575,63572,67891,44701,38180,47049,83355,89412,68914,68395,91449,76122,92971,46447,1744],function(){return e(e.s=29546)}),_N_E=e.O()}]);

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