1import{j as e,I as A,y as z,z as L,m as g,az as S,aw as P,av as k,ax as E,au as I,f as O,b as w,as as R,ay as T,X as $}from"./index-0qbe4j-K.js";import{h as H,b as c,N as F,L as h}from"./react-vendor-CuqwDvgQ.js";import{A as M}from"./index-BEMDl0KX.js";import{C as B}from"./index-DRrqZmx6.js";import{D}from"./index-BCqtSsgj.js";import{R as Y}from"./index-bTBIJBxF.js";import{P as W}from"./public-layout-bkiBGzYg.js";import{P as _}from"./page-hero-B3IlbYIZ.js";import{P as G,R as y}from"./page-shell-Dusr2SKx.js";import{i as U,m as V}from"./progress-C8IeQ8Vc.js";import"./page-transition-DPFLNUVD.js";import"./separator-y_AUlMtH.js";import"./index-l9j0_l5U.js";import"./index-fQbr3YLv.js";import"./index-D9-iGJLB.js";import"./sheet-C6SrAI_i.js";import"./form-mhD-F1Ca.js";import"./use-reduced-motion-CqF7cx4E.js";const J={default:{path1:{initial:{rotate:0,fill:"transparent"},animate:{transformOrigin:"bottom center",fill:"currentColor",rotate:[0,-20,15,-7,0],fillOpacity:[0,1,0,1,0],transition:{duration:.8,ease:"easeInOut",rotate:{duration:.8,ease:"easeInOut",times:[0,.4,.6,.8,1]},fillOpacity:{duration:.3,ease:"easeInOut",times:[0,.4,.6,.8,1],delay:.4}}}},path2:{initial:{rotate:0},animate:{transformOrigin:"bottom center",rotate:[0,0,10,-5,0],transition:{duration:.8,ease:"easeInOut",times:[0,.4,.6,.8,1]}}},path3:{}}};function Q({size:s,...t}){const{controls:a}=z(),i=L(J);return e.jsxs(g.svg,{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...t,children:[e.jsx(g.path,{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",variants:i.path1,initial:"initial",animate:a}),e.jsx(g.path,{d:"M9 18h6",variants:i.path2,initial:"initial",animate:a}),e.jsx(g.path,{d:"M10 22h4",variants:i.path3,initial:"initial",animate:a})]})}function v(s){return e.jsx(A,{icon:Q,animateOnHover:!0,...s})}function C(s){return s.trim().toLowerCase().replace(/\\/g,"/").replace(/^\.\//,"").replace(/\s+/g," ")}async function X(s){const t=new TextEncoder().encode(C(s)),a=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(a)).map(i=>i.toString(16).padStart(2,"0")).join("")}async function K(s,t){return C(s)?await X(s)===t:!1}function Z(s){if(s.kind==="challenge"){const a=S(s.slug);return a&&{href:`/learn/challenges/${s.slug}`,title:a.title}}const t=k(s.slug);return t&&{href:`/learn/${s.slug}`,title:t.title}}const q={easy:"text-emerald-500",medium:"text-amber-500",hard:"text-red-500"};function ee({question:s,index:t,onSolved:a}){const[i,f]=c.useState(""),[o,d]=c.useState("unanswered"),[m,u]=c.useState(!1),b=async n=>{n.preventDefault();const x=await K(i,s.answerHash);d(x?"correct":"wrong"),a(s.id,x)};return e.jsxs("li",{className:"border-border rounded-xl border p-4",children:[e.jsxs("p",{className:"mb-3 text-sm font-medium",children:[e.jsxs("span",{className:"text-muted-foreground mr-2",children:[t+1,"."]}),s.prompt]}),e.jsxs("form",{onSubmit:b,className:"flex flex-wrap gap-2",children:[e.jsx("input",{value:i,onChange:n=>{f(n.target.value),o==="wrong"&&d("unanswered")},disabled:o==="correct",placeholder:s.placeholder,"aria-label":s.prompt,spellCheck:!1,autoComplete:"off",className:"border-border bg-background focus:border-primary min-w-0 flex-1 rounded-lg border p-2 font-mono text-sm outline-none disabled:opacity-60"}),e.jsx("button",{type:"submit",disabled:o==="correct",className:"bg-primary text-primary-foreground hover:bg-primary/90 rounded-lg px-4 py-2 text-sm disabled:opacity-50 transition-colors",children:o==="correct"?"Solved":"Check"})]}),o==="correct"&&e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-sm text-emerald-500",children:[e.jsx(B,{className:"size-4"}),"Correct"]}),o==="wrong"&&e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-sm text-red-500",children:[e.jsx($,{className:"size-4"}),"Not that. Check the tool's output again."]}),s.hint&&o!=="correct"&&e.jsx("div",{className:"mt-2",children:m?e.jsxs("p",{className:"text-muted-foreground flex items-start gap-1.5 text-xs",children:[e.jsx(v,{className:"mt-0.5 size-3 shrink-0"}),s.hint]}):e.jsxs("button",{type:"button",onClick:()=>u(!0),className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 text-xs transition-colors",children:[e.jsx(v,{className:"size-3"}),"Hint"]})})]})}function je(){const{slug:s}=H(),t=s?S(s):void 0,[a,i]=c.useState(new Set),[f,o]=c.useState(!1);c.useEffect(()=>{t&&U(t.slug).then(o)},[t]),c.useEffect(()=>{if(!t)return;const r=document.createElement("script");return r.type="application/ld+json",r.dataset.challenge=t.slug,r.textContent=JSON.stringify({"@context":"https://schema.org","@type":"LearningResource",name:t.title,de
1scription:t.description,abstract:t.brief,keywords:t.keywords.join(", "),learningResourceType:"Exercise",educationalLevel:t.difficulty,timeRequired:`PT${t.estimatedMinutes}M`,isAccessibleForFree:!0,teaches:t.questions.map(l=>l.prompt),provider:{"@type":"Organization",name:"Securoxen"}}),document.head.appendChild(r),()=>{r.remove()}},[t]);const d=t?a.size===t.questions.length:!1;if(c.useEffect(()=>{d&&t&&V(t.slug)},[d,t]),!t)return e.jsx(F,{to:"/errors/not-found",replace:!0});const m=P(t.toolSlug),u=t.articleSlug?k(t.articleSlug):void 0,b=(r,l)=>{l&&i(p=>new Set(p).add(r))},n=E("challenge",t.slug),x=a.size,j=t.questions.length;return e.jsxs(W,{children:[e.jsx(_,{size:"sm",align:"left",eyebrow:e.jsxs(h,{to:"/learn/challenges",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-2 text-sm transition-colors",children:[e.jsx(M,{className:"size-4"}),"All challenges"]}),title:t.title,description:t.brief,children:e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-3 text-sm",children:[e.jsx("span",{className:`capitalize ${q[t.difficulty]}`,children:t.difficulty}),e.jsx(h,{to:"/learn/challenges",className:"hover:text-foreground transition-colors",children:I[t.category]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(O,{className:"size-3.5"}),t.estimatedMinutes," min"]}),(f||d)&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[e.jsx(w,{className:"size-3.5"}),"Solved"]}),n&&e.jsxs("span",{className:"border-border rounded-full border px-2.5 py-0.5 text-xs",children:[n.path.title," · step ",n.index+1," of"," ",n.path.steps.length]})]})}),e.jsx(G,{aside:e.jsxs(e.Fragment,{children:[e.jsxs(y,{title:"Progress",icon:e.jsx(R,{className:"size-3.5"}),children:[e.jsxs("p",{className:"mb-2 text-sm",children:[e.jsx("span",{className:"text-2xl font-semibold tabular-nums",children:x}),e.jsxs("span",{className:"text-muted-foreground",children:[" of ",j," answered"]})]}),e.jsx("div",{className:"bg-muted h-1.5 w-full overflow-hidden rounded-full",children:e.jsx("div",{className:"h-full rounded-full bg-emerald-500 transition-[width] duration-500",style:{width:`${j===0?0:x/j*100}%`}})})]}),m&&e.jsxs(y,{title:"Solve it with",icon:e.jsx(T,{className:"size-3.5"}),children:[e.jsxs(h,{to:`/tools/${m.slug}`,className:"hover:bg-muted/60 -mx-2 flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm transition-colors",children:[e.jsx(m.icon,{className:"text-primary size-4 shrink-0"}),e.jsx("span",{className:"truncate font-medium",children:m.name})]}),e.jsx("p",{className:"text-muted-foreground mt-2 text-xs leading-relaxed",children:"Everything stays in your browser - nothing you open here is uploaded."})]}),n&&e.jsx(y,{title:n.path.title,icon:e.jsx(Y,{className:"size-3.5"}),children:e.jsx("ol",{className:"space-y-1 text-sm",children:n.path.steps.map((r,l)=>{const p=Z(r);if(!p)return null;const N=l===n.index;return e.jsx("li",{children:e.jsxs(h,{to:p.href,className:N?"text-foreground -mx-2 block rounded-lg px-2 py-1 font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/60 -mx-2 block rounded-lg px-2 py-1 transition-colors","aria-current":N?"step":void 0,children:[e.jsxs("span",{className:"text-muted-foreground/60 mr-1.5 tabular-nums",children:[l+1,"."]}),p.title]})},`${r.kind}:${r.slug}`)})})}),e.jsx("p",{className:"text-muted-foreground px-1 text-xs leading-relaxed",children:"Progress is stored in this browser only - there is no account and nothing is sent anywhere. Answers are checked against a hash locally, which keeps them out of the page source; it is a spoiler guard, not an exam."})]}),children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"border-border bg-muted/30 mb-6 rounded-xl border p-4",children:[e.jsx("h2",{className:"mb-3 text-sm font-medium",children:"Your evidence"}),t.assetPath&&e.jsxs("a",{href:t.assetPath,download:!0,"data-no-preview":!0,className:"border-border hover:bg-muted mb-3 inline-flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",children:[e.jsx(D,{className:"size-4"}),t.assetLabel]}),t.inlineAsset&&e.jsx("pre",{className:"border-border bg-background overflow-x-auto rounded-lg border p-3 text-xs break-all whitespace-pre-wrap",children:t.inlineAsset})]}),e.jsx("ol",{className:"mb-6 space-y-3",children:t.questions.map((r,l)=>e.jsx(ee,{question:r,index:l,onSolved:b},r.id))}),d&&e.jsxs("div",{className:"rounded-xl border border-emerald-500/30 bg-emerald-500/10 p-4",children:[e.jsxs("p",{className:"mb-1 flex items-center gap-2 text-sm font-medium text-emerald-500",children:[e.jsx(w,{className:"size-4"}),"Challenge complete"]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:u?e.jsxs(e.Fragment,{children:["The reasoning behind this one is in"," ",e.jsx(h,{to:`/learn/${u.slug}`,className:"text-primary underline",children:u.title}),"."]}):"Nicely done."})]})]})})]})}export{je as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.