{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "404-01",
  "title": "404 01",
  "description": "An interactive 404 page with Figma-inspired vector controls and editable Bézier points.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "src/registry/blocks/404-01/404-01.tsx",
      "content": "\"use client\";\n\nimport { ArrowLeft, RotateCcw } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { parsePath } from \"./parse\";\nimport { type EditorStyle, VectorEditor } from \"./vector-editor\";\n\nconst NOT_FOUND_PATH = `\n\tM 20 165 L 20 130 L 105 25 L 150 25 L 150 125 L 172 125 L 172 165 L 150 165 L 150 210 L 105 210 L 105 165 Z\n\tM 105 125 L 105 82 L 70 125 Z\n\tM 280 25 C 225 25 195 62 195 118 C 195 174 225 210 280 210 C 335 210 365 174 365 118 C 365 62 335 25 280 25 Z\n\tM 280 72 C 302 72 314 88 314 118 C 314 148 302 163 280 163 C 258 163 246 148 246 118 C 246 88 258 72 280 72 Z\n\tM 388 165 L 388 130 L 473 25 L 518 25 L 518 125 L 540 125 L 540 165 L 518 165 L 518 210 L 473 210 L 473 165 Z\n\tM 473 125 L 473 82 L 438 125 Z\n`;\n\nconst EDITOR_STYLE: EditorStyle = {\n\taccent: \"#0d99ff\",\n\tarm: \"#8dbce0\",\n\tanchorR: 4,\n\thandleR: 3.2,\n\tpointFill: \"var(--background)\",\n\tfill: \"none\",\n\tfillOpacity: 0,\n\tstroke: \"#0d99ff\",\n\tstrokeWidth: 1.25,\n\tshowRig: true,\n\tfillRule: \"evenodd\",\n};\n\nexport default function NotFound01() {\n\tconst [path, setPath] = useState(() => parsePath(NOT_FOUND_PATH));\n\n\treturn (\n\t\t<section className=\"relative isolate flex min-h-svh flex-col overflow-hidden bg-background text-foreground\">\n\t\t\t<div\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName=\"pointer-events-none absolute inset-0 -z-10 bg-[linear-gradient(to_right,var(--border)_1px,transparent_1px),linear-gradient(to_bottom,var(--border)_1px,transparent_1px)] bg-size-[24px_24px] opacity-35 [mask-image:radial-gradient(ellipse_70%_62%_at_50%_40%,black,transparent)]\"\n\t\t\t/>\n\n\t\t\t<main className=\"flex flex-1 flex-col items-center justify-center px-5 py-16 sm:px-8 sm:py-20\">\n\t\t\t\t<div className=\"relative w-full max-w-[40rem] px-4 sm:px-10\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"absolute top-0 right-0 text-muted-foreground\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\taria-label=\"Reset vector\"\n\t\t\t\t\t\ttitle=\"Reset vector\"\n\t\t\t\t\t\tonClick={() => setPath(parsePath(NOT_FOUND_PATH))}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RotateCcw />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<VectorEditor\n\t\t\t\t\t\tpath={path}\n\t\t\t\t\t\tonChange={setPath}\n\t\t\t\t\t\tstyle={EDITOR_STYLE}\n\t\t\t\t\t\tviewBox={[0, 0, 560, 235]}\n\t\t\t\t\t\twidth={560}\n\t\t\t\t\t\theight={235}\n\t\t\t\t\t\tclassName=\"h-auto w-full\"\n\t\t\t\t\t\tariaLabel=\"Editable 404 vector\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"mt-14 flex max-w-xl flex-col items-center text-center sm:mt-16\">\n\t\t\t\t\t<h1 className=\"text-balance font-medium text-3xl tracking-[-0.04em] sm:text-5xl\">\n\t\t\t\t\t\tThis page slipped off the canvas.\n\t\t\t\t\t</h1>\n\t\t\t\t\t<p className=\"mt-4 max-w-md text-pretty text-muted-foreground leading-6\">\n\t\t\t\t\t\tThe layer you were looking for was moved, renamed, or never made it\n\t\t\t\t\t\tpast the first draft.\n\t\t\t\t\t</p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"mt-7 transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] active:scale-[0.97] motion-reduce:transition-none\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tnativeButton={false}\n\t\t\t\t\t\trender={<a href=\"/\" />}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ArrowLeft data-icon=\"inline-start\" />\n\t\t\t\t\t\tBack to home\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</main>\n\t\t</section>\n\t);\n}\n",
      "type": "registry:component",
      "target": "@components/404-01/404-01.tsx"
    },
    {
      "path": "src/registry/blocks/404-01/vector-editor.tsx",
      "content": "\"use client\";\n\nimport {\n\ttype KeyboardEvent as ReactKeyboardEvent,\n\ttype PointerEvent as ReactPointerEvent,\n\tuseRef,\n} from \"react\";\n\nimport { serializePath } from \"./parse\";\nimport type { Anchor, Vec, VectorPath } from \"./types\";\nimport { add, sub, v } from \"./types\";\n\nexport type Mirror = \"none\" | \"angle\" | \"angle-length\";\n\nexport interface EditorStyle {\n\taccent: string;\n\tarm: string;\n\tanchorR: number;\n\thandleR: number;\n\tpointFill: string;\n\tfill: string;\n\tfillOpacity: number;\n\tstroke: string;\n\tstrokeWidth: number;\n\tshowRig: boolean;\n\tfillRule: \"nonzero\" | \"evenodd\";\n}\n\nexport const DEFAULT_EDITOR: EditorStyle = {\n\taccent: \"#0d99ff\",\n\tarm: \"#9bb7d4\",\n\tanchorR: 4,\n\thandleR: 3.2,\n\tpointFill: \"var(--background)\",\n\tfill: \"#0d99ff\",\n\tfillOpacity: 0.08,\n\tstroke: \"#0d99ff\",\n\tstrokeWidth: 1.5,\n\tshowRig: true,\n\tfillRule: \"evenodd\",\n};\n\ntype Drag =\n\t| { kind: \"anchor\"; index: number; offset: Vec }\n\t| {\n\t\t\tkind: \"handle\";\n\t\t\tindex: number;\n\t\t\tside: \"in\" | \"out\";\n\t\t\tmirror: Mirror;\n\t\t\toffset: Vec;\n\t  };\n\nfunction arrowDelta(key: string, amount: number): Vec | null {\n\tswitch (key) {\n\t\tcase \"ArrowLeft\":\n\t\t\treturn v(-amount, 0);\n\t\tcase \"ArrowRight\":\n\t\t\treturn v(amount, 0);\n\t\tcase \"ArrowUp\":\n\t\t\treturn v(0, -amount);\n\t\tcase \"ArrowDown\":\n\t\t\treturn v(0, amount);\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\nexport function VectorEditor({\n\tpath,\n\tonChange,\n\tstyle = DEFAULT_EDITOR,\n\tmirror = \"angle-length\",\n\tviewBox,\n\twidth,\n\theight,\n\tclassName,\n\tariaLabel = \"Editable vector\",\n\tariaDescribedBy,\n}: {\n\tpath: VectorPath;\n\tonChange: (next: VectorPath) => void;\n\tstyle?: EditorStyle;\n\tmirror?: Mirror;\n\tviewBox: [number, number, number, number];\n\twidth?: number;\n\theight?: number;\n\tclassName?: string;\n\tariaLabel?: string;\n\tariaDescribedBy?: string;\n}) {\n\tconst svgRef = useRef<SVGSVGElement>(null);\n\tconst drag = useRef<Drag | null>(null);\n\tconst pathRef = useRef(path);\n\tpathRef.current = path;\n\tconst pending = useRef<Vec | null>(null);\n\tconst animationFrame = useRef(0);\n\n\tfunction toUser(event: { clientX: number; clientY: number }): Vec {\n\t\tconst svg = svgRef.current;\n\t\tconst matrix = svg?.getScreenCTM();\n\t\tif (!svg || !matrix) return v(0, 0);\n\t\tconst point = svg.createSVGPoint();\n\t\tpoint.x = event.clientX;\n\t\tpoint.y = event.clientY;\n\t\tconst transformed = point.matrixTransform(matrix.inverse());\n\t\treturn v(transformed.x, transformed.y);\n\t}\n\n\tfunction startAnchor(event: ReactPointerEvent, index: number) {\n\t\tif (drag.current) return;\n\t\tevent.stopPropagation();\n\t\t(event.currentTarget as Element).setPointerCapture(event.pointerId);\n\t\tconst position = pathRef.current.anchors[index].p;\n\t\tdrag.current = {\n\t\t\tkind: \"anchor\",\n\t\t\tindex,\n\t\t\toffset: sub(position, toUser(event)),\n\t\t};\n\t}\n\n\tfunction startHandle(\n\t\tevent: ReactPointerEvent,\n\t\tindex: number,\n\t\tside: \"in\" | \"out\",\n\t) {\n\t\tif (drag.current) return;\n\t\tevent.stopPropagation();\n\t\t(event.currentTarget as Element).setPointerCapture(event.pointerId);\n\t\tconst anchor = pathRef.current.anchors[index];\n\t\tconst position = anchor[side];\n\t\tif (!position) return;\n\t\tdrag.current = {\n\t\t\tkind: \"handle\",\n\t\t\tindex,\n\t\t\tside,\n\t\t\tmirror: event.altKey ? \"none\" : mirror,\n\t\t\toffset: sub(position, toUser(event)),\n\t\t};\n\t}\n\n\tfunction applyDrag(activeDrag: Drag, pointer: Vec): VectorPath {\n\t\tconst anchors = pathRef.current.anchors.map((anchor) => ({\n\t\t\tp: { ...anchor.p },\n\t\t\tin: anchor.in ? { ...anchor.in } : null,\n\t\t\tout: anchor.out ? { ...anchor.out } : null,\n\t\t})) as Anchor[];\n\t\tconst target = add(pointer, activeDrag.offset);\n\t\tconst anchor = anchors[activeDrag.index];\n\n\t\tif (activeDrag.kind === \"anchor\") {\n\t\t\tconst delta = sub(target, anchor.p);\n\t\t\tanchor.p = target;\n\t\t\tif (anchor.in) anchor.in = add(anchor.in, delta);\n\t\t\tif (anchor.out) anchor.out = add(anchor.out, delta);\n\t\t} else {\n\t\t\tanchor[activeDrag.side] = target;\n\t\t\tconst other = activeDrag.side === \"out\" ? anchor.in : anchor.out;\n\t\t\tif (activeDrag.mirror !== \"none\" && other) {\n\t\t\t\tconst relative = sub(target, anchor.p);\n\t\t\t\tconst relativeLength = Math.hypot(relative.x, relative.y) || 1;\n\t\t\t\tconst length =\n\t\t\t\t\tactiveDrag.mirror === \"angle-length\"\n\t\t\t\t\t\t? relativeLength\n\t\t\t\t\t\t: Math.hypot(other.x - anchor.p.x, other.y - anchor.p.y);\n\t\t\t\tconst opposite = {\n\t\t\t\t\tx: anchor.p.x - (relative.x / relativeLength) * length,\n\t\t\t\t\ty: anchor.p.y - (relative.y / relativeLength) * length,\n\t\t\t\t};\n\t\t\t\tif (activeDrag.side === \"out\") anchor.in = opposite;\n\t\t\t\telse anchor.out = opposite;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tanchors,\n\t\t\tstarts: pathRef.current.starts,\n\t\t\tclosed: pathRef.current.closed,\n\t\t};\n\t}\n\n\tfunction commit(next: VectorPath) {\n\t\tpathRef.current = next;\n\t\tonChange(next);\n\t}\n\n\tfunction onMove(event: ReactPointerEvent) {\n\t\tif (!drag.current) return;\n\t\tpending.current = toUser(event);\n\t\tif (animationFrame.current) return;\n\t\tanimationFrame.current = requestAnimationFrame(() => {\n\t\t\tanimationFrame.current = 0;\n\t\t\tif (drag.current && pending.current) {\n\t\t\t\tcommit(applyDrag(drag.current, pending.current));\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction endDrag(event: ReactPointerEvent) {\n\t\tif (!drag.current) return;\n\t\tif (animationFrame.current) {\n\t\t\tcancelAnimationFrame(animationFrame.current);\n\t\t\tanimationFrame.current = 0;\n\t\t\tif (pending.current) commit(applyDrag(drag.current, pending.current));\n\t\t}\n\t\ttry {\n\t\t\t(event.target as Element).releasePointerCapture(event.pointerId);\n\t\t} catch {\n\t\t\t// Pointer capture may already be released by the browser.\n\t\t}\n\t\tdrag.current = null;\n\t\tpending.current = null;\n\t}\n\n\tfunction nudge(event: ReactKeyboardEvent, activeDrag: Drag, position: Vec) {\n\t\tconst delta = arrowDelta(event.key, event.shiftKey ? 10 : 1);\n\t\tif (!delta) return;\n\t\tevent.preventDefault();\n\t\tcommit(applyDrag({ ...activeDrag, offset: v(0, 0) }, add(position, delta)));\n\t}\n\n\tconst d = serializePath(path);\n\tconst arms: { ax: number; ay: number; hx: number; hy: number }[] = [];\n\tif (style.showRig) {\n\t\tfor (const anchor of path.anchors) {\n\t\t\tif (anchor.out) {\n\t\t\t\tarms.push({\n\t\t\t\t\tax: anchor.p.x,\n\t\t\t\t\tay: anchor.p.y,\n\t\t\t\t\thx: anchor.out.x,\n\t\t\t\t\thy: anchor.out.y,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (anchor.in) {\n\t\t\t\tarms.push({\n\t\t\t\t\tax: anchor.p.x,\n\t\t\t\t\tay: anchor.p.y,\n\t\t\t\t\thx: anchor.in.x,\n\t\t\t\t\thy: anchor.in.y,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (\n\t\t<svg\n\t\t\tref={svgRef}\n\t\t\trole=\"application\"\n\t\t\taria-label={ariaLabel}\n\t\t\taria-describedby={ariaDescribedBy}\n\t\t\tviewBox={viewBox.join(\" \")}\n\t\t\twidth={width ?? viewBox[2]}\n\t\t\theight={height ?? viewBox[3]}\n\t\t\tclassName={className}\n\t\t\tstyle={{\n\t\t\t\tdisplay: \"block\",\n\t\t\t\toverflow: \"visible\",\n\t\t\t\ttouchAction: \"none\",\n\t\t\t\tuserSelect: \"none\",\n\t\t\t}}\n\t\t\tonPointerMove={onMove}\n\t\t\tonPointerUp={endDrag}\n\t\t\tonPointerCancel={endDrag}\n\t\t>\n\t\t\t<path\n\t\t\t\td={d}\n\t\t\t\tfill={style.fill}\n\t\t\t\tfillRule={style.fillRule}\n\t\t\t\tfillOpacity={style.fillOpacity}\n\t\t\t\tstroke={style.stroke}\n\t\t\t\tstrokeWidth={style.strokeWidth}\n\t\t\t/>\n\n\t\t\t{style.showRig ? (\n\t\t\t\t<g>\n\t\t\t\t\t<g\n\t\t\t\t\t\tstroke={style.arm}\n\t\t\t\t\t\tstrokeWidth={Math.max(0.75, style.strokeWidth * 0.6)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{arms.map((arm, index) => (\n\t\t\t\t\t\t\t<line\n\t\t\t\t\t\t\t\tkey={`${arm.ax}-${arm.ay}-${arm.hx}-${arm.hy}-${index}`}\n\t\t\t\t\t\t\t\tx1={arm.ax}\n\t\t\t\t\t\t\t\ty1={arm.ay}\n\t\t\t\t\t\t\t\tx2={arm.hx}\n\t\t\t\t\t\t\t\ty2={arm.hy}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</g>\n\n\t\t\t\t\t{path.anchors.map((anchor, index) => (\n\t\t\t\t\t\t<g key={`handles-${index}`}>\n\t\t\t\t\t\t\t{anchor.out ? (\n\t\t\t\t\t\t\t\t<Diamond\n\t\t\t\t\t\t\t\t\tcx={anchor.out.x}\n\t\t\t\t\t\t\t\t\tcy={anchor.out.y}\n\t\t\t\t\t\t\t\t\tr={style.handleR}\n\t\t\t\t\t\t\t\t\tfill={style.pointFill}\n\t\t\t\t\t\t\t\t\tstroke={style.accent}\n\t\t\t\t\t\t\t\t\tlabel={`Outgoing handle ${index + 1}. Use arrow keys to move.`}\n\t\t\t\t\t\t\t\t\tonPointerDown={(event) => startHandle(event, index, \"out\")}\n\t\t\t\t\t\t\t\t\tonKeyDown={(event) =>\n\t\t\t\t\t\t\t\t\t\tnudge(\n\t\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tkind: \"handle\",\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tside: \"out\",\n\t\t\t\t\t\t\t\t\t\t\t\tmirror: event.altKey ? \"none\" : mirror,\n\t\t\t\t\t\t\t\t\t\t\t\toffset: v(0, 0),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tanchor.out as Vec,\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t{anchor.in ? (\n\t\t\t\t\t\t\t\t<Diamond\n\t\t\t\t\t\t\t\t\tcx={anchor.in.x}\n\t\t\t\t\t\t\t\t\tcy={anchor.in.y}\n\t\t\t\t\t\t\t\t\tr={style.handleR}\n\t\t\t\t\t\t\t\t\tfill={style.pointFill}\n\t\t\t\t\t\t\t\t\tstroke={style.accent}\n\t\t\t\t\t\t\t\t\tlabel={`Incoming handle ${index + 1}. Use arrow keys to move.`}\n\t\t\t\t\t\t\t\t\tonPointerDown={(event) => startHandle(event, index, \"in\")}\n\t\t\t\t\t\t\t\t\tonKeyDown={(event) =>\n\t\t\t\t\t\t\t\t\t\tnudge(\n\t\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tkind: \"handle\",\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tside: \"in\",\n\t\t\t\t\t\t\t\t\t\t\t\tmirror: event.altKey ? \"none\" : mirror,\n\t\t\t\t\t\t\t\t\t\t\t\toffset: v(0, 0),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tanchor.in as Vec,\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</g>\n\t\t\t\t\t))}\n\n\t\t\t\t\t{path.anchors.map((anchor, index) => (\n\t\t\t\t\t\t<g\n\t\t\t\t\t\t\tkey={`anchor-${index}`}\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\ttabIndex={0}\n\t\t\t\t\t\t\taria-label={`Anchor ${index + 1}. Use arrow keys to move.`}\n\t\t\t\t\t\t\tclassName=\"group outline-none\"\n\t\t\t\t\t\t\tstyle={{ cursor: \"grab\" }}\n\t\t\t\t\t\t\tonPointerDown={(event) => startAnchor(event, index)}\n\t\t\t\t\t\t\tonKeyDown={(event) =>\n\t\t\t\t\t\t\t\tnudge(\n\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t{ kind: \"anchor\", index, offset: v(0, 0) },\n\t\t\t\t\t\t\t\t\tanchor.p,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\t\tcx={anchor.p.x}\n\t\t\t\t\t\t\t\tcy={anchor.p.y}\n\t\t\t\t\t\t\t\tr={style.anchorR * 3}\n\t\t\t\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\t\tcx={anchor.p.x}\n\t\t\t\t\t\t\t\tcy={anchor.p.y}\n\t\t\t\t\t\t\t\tr={style.anchorR * 1.8}\n\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\tstroke={style.accent}\n\t\t\t\t\t\t\t\tstrokeWidth={1}\n\t\t\t\t\t\t\t\tclassName=\"opacity-0 group-focus-visible:opacity-100\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\t\tcx={anchor.p.x}\n\t\t\t\t\t\t\t\tcy={anchor.p.y}\n\t\t\t\t\t\t\t\tr={style.anchorR}\n\t\t\t\t\t\t\t\tfill={style.pointFill}\n\t\t\t\t\t\t\t\tstroke={style.accent}\n\t\t\t\t\t\t\t\tstrokeWidth={1.25}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</g>\n\t\t\t\t\t))}\n\t\t\t\t</g>\n\t\t\t) : null}\n\t\t</svg>\n\t);\n}\n\nfunction Diamond({\n\tcx,\n\tcy,\n\tr,\n\tfill,\n\tstroke,\n\tlabel,\n\tonPointerDown,\n\tonKeyDown,\n}: {\n\tcx: number;\n\tcy: number;\n\tr: number;\n\tfill: string;\n\tstroke: string;\n\tlabel: string;\n\tonPointerDown: (event: ReactPointerEvent<SVGGElement>) => void;\n\tonKeyDown: (event: ReactKeyboardEvent<SVGGElement>) => void;\n}) {\n\treturn (\n\t\t<g\n\t\t\trole=\"button\"\n\t\t\ttabIndex={0}\n\t\t\taria-label={label}\n\t\t\tclassName=\"group outline-none\"\n\t\t\tstyle={{ cursor: \"grab\" }}\n\t\t\tonPointerDown={onPointerDown}\n\t\t\tonKeyDown={onKeyDown}\n\t\t>\n\t\t\t<circle cx={cx} cy={cy} r={r * 3.5} fill=\"transparent\" />\n\t\t\t<circle\n\t\t\t\tcx={cx}\n\t\t\t\tcy={cy}\n\t\t\t\tr={r * 1.8}\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke={stroke}\n\t\t\t\tstrokeWidth={1}\n\t\t\t\tclassName=\"opacity-0 group-focus-visible:opacity-100\"\n\t\t\t/>\n\t\t\t<rect\n\t\t\t\tx={cx - r}\n\t\t\t\ty={cy - r}\n\t\t\t\twidth={r * 2}\n\t\t\t\theight={r * 2}\n\t\t\t\tfill={fill}\n\t\t\t\tstroke={stroke}\n\t\t\t\tstrokeWidth={1.1}\n\t\t\t\tstyle={{\n\t\t\t\t\ttransform: \"rotate(45deg)\",\n\t\t\t\t\ttransformBox: \"fill-box\",\n\t\t\t\t\ttransformOrigin: \"50% 50%\",\n\t\t\t\t}}\n\t\t\t/>\n\t\t</g>\n\t);\n}\n",
      "type": "registry:component",
      "target": "@components/404-01/vector-editor.tsx"
    },
    {
      "path": "src/registry/blocks/404-01/parse.ts",
      "content": "import type { Anchor, Vec, VectorPath } from \"./types\";\nimport { subRange, v } from \"./types\";\n\ntype Token = { cmd: string; args: number[] };\n\nfunction tokenize(d: string): Token[] {\n\tconst tokens: Token[] = [];\n\tconst pattern = /([MmLlHhVvCcSsQqTtAaZz])|(-?\\d*\\.?\\d+(?:e[-+]?\\d+)?)/gi;\n\tlet match = pattern.exec(d);\n\tlet current: Token | null = null;\n\n\twhile (match) {\n\t\tif (match[1]) {\n\t\t\tcurrent = { cmd: match[1], args: [] };\n\t\t\ttokens.push(current);\n\t\t} else if (current) {\n\t\t\tcurrent.args.push(Number.parseFloat(match[2]));\n\t\t}\n\t\tmatch = pattern.exec(d);\n\t}\n\n\treturn tokens;\n}\n\nexport function parsePath(d: string): VectorPath {\n\tconst tokens = tokenize(d);\n\tconst anchors: Anchor[] = [];\n\tconst starts: number[] = [];\n\tconst closed: boolean[] = [];\n\tlet current = v(0, 0);\n\tlet start = v(0, 0);\n\tlet previousControl: Vec | null = null;\n\tlet previousCommand = \"\";\n\n\tconst push = (p: Vec) => anchors.push({ p, out: null, in: null });\n\tconst last = () => anchors[anchors.length - 1];\n\tconst dedupeClose = () => {\n\t\tif (!starts.length) return;\n\t\tconst startIndex = starts.at(-1) ?? 0;\n\t\tif (anchors.length - startIndex < 2) return;\n\n\t\tconst first = anchors[startIndex].p;\n\t\tconst final = anchors.at(-1);\n\t\tif (\n\t\t\tfinal &&\n\t\t\tMath.abs(first.x - final.p.x) < 0.01 &&\n\t\t\tMath.abs(first.y - final.p.y) < 0.01\n\t\t) {\n\t\t\tanchors[startIndex].in = final.in;\n\t\t\tanchors.pop();\n\t\t}\n\t};\n\n\tfor (const { cmd, args } of tokens) {\n\t\tconst relative = cmd === cmd.toLowerCase();\n\t\tconst command = cmd.toUpperCase();\n\t\tlet index = 0;\n\t\tconst number = () => args[index++];\n\t\tconst point = (): Vec => {\n\t\t\tconst x = number();\n\t\t\tconst y = number();\n\t\t\treturn relative ? { x: current.x + x, y: current.y + y } : { x, y };\n\t\t};\n\n\t\tswitch (command) {\n\t\t\tcase \"M\": {\n\t\t\t\tif (starts.length && closed.at(-1)) dedupeClose();\n\t\t\t\tcurrent = point();\n\t\t\t\tstart = current;\n\t\t\t\tstarts.push(anchors.length);\n\t\t\t\tclosed.push(false);\n\t\t\t\tpush(current);\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tcurrent = point();\n\t\t\t\t\tpush(current);\n\t\t\t\t}\n\t\t\t\tpreviousControl = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"L\": {\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tcurrent = point();\n\t\t\t\t\tpush(current);\n\t\t\t\t}\n\t\t\t\tpreviousControl = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"H\": {\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tconst x = number();\n\t\t\t\t\tcurrent = { x: relative ? current.x + x : x, y: current.y };\n\t\t\t\t\tpush(current);\n\t\t\t\t}\n\t\t\t\tpreviousControl = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"V\": {\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tconst y = number();\n\t\t\t\t\tcurrent = { x: current.x, y: relative ? current.y + y : y };\n\t\t\t\t\tpush(current);\n\t\t\t\t}\n\t\t\t\tpreviousControl = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"C\": {\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tconst firstControl = point();\n\t\t\t\t\tconst secondControl = point();\n\t\t\t\t\tconst end = point();\n\t\t\t\t\tlast().out = firstControl;\n\t\t\t\t\tpush(end);\n\t\t\t\t\tlast().in = secondControl;\n\t\t\t\t\tcurrent = end;\n\t\t\t\t\tpreviousControl = secondControl;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"S\": {\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tconst canReflect =\n\t\t\t\t\t\tpreviousCommand === \"C\" || previousCommand === \"S\" || index > 0;\n\t\t\t\t\tconst firstControl = canReflect\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tx: 2 * current.x - (previousControl?.x ?? current.x),\n\t\t\t\t\t\t\t\ty: 2 * current.y - (previousControl?.y ?? current.y),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: current;\n\t\t\t\t\tconst secondControl = point();\n\t\t\t\t\tconst end = point();\n\t\t\t\t\tlast().out = firstControl;\n\t\t\t\t\tpush(end);\n\t\t\t\t\tlast().in = secondControl;\n\t\t\t\t\tcurrent = end;\n\t\t\t\t\tpreviousControl = secondControl;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"Q\": {\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tconst quadraticControl: Vec = point();\n\t\t\t\t\tconst end = point();\n\t\t\t\t\tlast().out = {\n\t\t\t\t\t\tx: current.x + (2 / 3) * (quadraticControl.x - current.x),\n\t\t\t\t\t\ty: current.y + (2 / 3) * (quadraticControl.y - current.y),\n\t\t\t\t\t};\n\t\t\t\t\tpush(end);\n\t\t\t\t\tlast().in = {\n\t\t\t\t\t\tx: end.x + (2 / 3) * (quadraticControl.x - end.x),\n\t\t\t\t\t\ty: end.y + (2 / 3) * (quadraticControl.y - end.y),\n\t\t\t\t\t};\n\t\t\t\t\tcurrent = end;\n\t\t\t\t\tpreviousControl = quadraticControl;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"T\": {\n\t\t\t\twhile (index < args.length) {\n\t\t\t\t\tconst canReflect =\n\t\t\t\t\t\tpreviousCommand === \"Q\" || previousCommand === \"T\" || index > 0;\n\t\t\t\t\tconst quadraticControl: Vec = canReflect\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tx: 2 * current.x - (previousControl?.x ?? current.x),\n\t\t\t\t\t\t\t\ty: 2 * current.y - (previousControl?.y ?? current.y),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: current;\n\t\t\t\t\tconst end = point();\n\t\t\t\t\tlast().out = {\n\t\t\t\t\t\tx: current.x + (2 / 3) * (quadraticControl.x - current.x),\n\t\t\t\t\t\ty: current.y + (2 / 3) * (quadraticControl.y - current.y),\n\t\t\t\t\t};\n\t\t\t\t\tpush(end);\n\t\t\t\t\tlast().in = {\n\t\t\t\t\t\tx: end.x + (2 / 3) * (quadraticControl.x - end.x),\n\t\t\t\t\t\ty: end.y + (2 / 3) * (quadraticControl.y - end.y),\n\t\t\t\t\t};\n\t\t\t\t\tcurrent = end;\n\t\t\t\t\tpreviousControl = quadraticControl;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"Z\": {\n\t\t\t\tif (closed.length) closed[closed.length - 1] = true;\n\t\t\t\tcurrent = start;\n\t\t\t\tpreviousControl = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"A\":\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Arc commands (A) are not supported by the point editor.\",\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unsupported path command: ${cmd}`);\n\t\t}\n\n\t\tpreviousCommand = command;\n\t}\n\n\tif (starts.length && closed.at(-1)) dedupeClose();\n\treturn { anchors, starts, closed };\n}\n\nconst formatNumber = (value: number) => String(Math.round(value * 100) / 100);\n\nexport function serializePath(path: VectorPath): string {\n\tconst { anchors, starts, closed } = path;\n\tif (!anchors.length || !starts.length) return \"\";\n\tconst parts: string[] = [];\n\n\tfor (let index = 0; index < starts.length; index++) {\n\t\tconst [begin, end] = subRange(path, index);\n\t\tconst count = end - begin;\n\t\tif (!count) continue;\n\n\t\tparts.push(\n\t\t\t`M ${formatNumber(anchors[begin].p.x)} ${formatNumber(anchors[begin].p.y)}`,\n\t\t);\n\t\tconst segmentCount = closed[index] ? count : count - 1;\n\n\t\tfor (let segment = 0; segment < segmentCount; segment++) {\n\t\t\tconst anchor = anchors[begin + segment];\n\t\t\tconst next = anchors[begin + ((segment + 1) % count)];\n\t\t\tif (anchor.out || next.in) {\n\t\t\t\tconst firstControl = anchor.out ?? anchor.p;\n\t\t\t\tconst secondControl = next.in ?? next.p;\n\t\t\t\tparts.push(\n\t\t\t\t\t`C ${formatNumber(firstControl.x)} ${formatNumber(firstControl.y)} ${formatNumber(secondControl.x)} ${formatNumber(secondControl.y)} ${formatNumber(next.p.x)} ${formatNumber(next.p.y)}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tparts.push(`L ${formatNumber(next.p.x)} ${formatNumber(next.p.y)}`);\n\t\t\t}\n\t\t}\n\n\t\tif (closed[index]) parts.push(\"Z\");\n\t}\n\n\treturn parts.join(\" \");\n}\n",
      "type": "registry:component",
      "target": "@components/404-01/parse.ts"
    },
    {
      "path": "src/registry/blocks/404-01/types.ts",
      "content": "export interface Vec {\n\tx: number;\n\ty: number;\n}\n\nexport interface Anchor {\n\tp: Vec;\n\tout: Vec | null;\n\tin: Vec | null;\n}\n\nexport interface VectorPath {\n\tanchors: Anchor[];\n\tstarts: number[];\n\tclosed: boolean[];\n}\n\nexport const v = (x: number, y: number): Vec => ({ x, y });\nexport const add = (a: Vec, b: Vec): Vec => ({\n\tx: a.x + b.x,\n\ty: a.y + b.y,\n});\nexport const sub = (a: Vec, b: Vec): Vec => ({\n\tx: a.x - b.x,\n\ty: a.y - b.y,\n});\n\nexport function subRange(path: VectorPath, index: number): [number, number] {\n\treturn [\n\t\tpath.starts[index],\n\t\tindex + 1 < path.starts.length\n\t\t\t? path.starts[index + 1]\n\t\t\t: path.anchors.length,\n\t];\n}\n",
      "type": "registry:component",
      "target": "@components/404-01/types.ts"
    }
  ],
  "meta": {
    "createdAt": "2026-06-25",
    "iframeHeight": 900,
    "previewClassName": "min-h-screen",
    "company": "Figma",
    "tags": [
      "SVG",
      "Bezier",
      "Editor"
    ],
    "source": "https://figma.com"
  },
  "categories": [
    "404"
  ],
  "type": "registry:block"
}