{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [
    "clsx",
    "lucide",
    "tailwind-merge"
  ],
  "description": "cn, variants, expr, safe URLs and the shared helpers of the primitives and compositions (plus the theme CSS in styles/)",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class values with Tailwind conflict resolution.\n * Mirrors shadcn's `cn` = clsx + tailwind-merge.\n * Caller-supplied classes win over recipe classes.\n */\nexport function cn(...inputs: ClassValue[]): string {\n  return twMerge(clsx(inputs));\n}\n",
      "path": "kit/utils/cn.ts",
      "target": "kit/utils/cn.ts"
    },
    {
      "content": "/**\n * Dev-only warnings switch, bundle-agnostic (no ESM-only meta property, so the utils work in ESM, CJS, IIFE / classic\n * script bundles, e.g. the web components). On when `globalThis.__UI8KIT_DEV__ === true`, or when a bundler\n * defines `process.env.NODE_ENV` as \"development\".\n */\nexport function isDevEnv(): boolean {\n  const g = globalThis as { __UI8KIT_DEV__?: unknown; process?: { env?: { NODE_ENV?: string } } };\n  if (typeof g.__UI8KIT_DEV__ === \"boolean\") return g.__UI8KIT_DEV__;\n  try {\n    return g.process?.env?.NODE_ENV === \"development\";\n  } catch {\n    return false;\n  }\n}\n",
      "path": "kit/utils/env.ts",
      "target": "kit/utils/env.ts"
    },
    {
      "content": "/**\n * Tiny attribute-logic helpers used by generated components. One\n * implementation per runtime family keeps every default-resolution decision\n * table byte-identical across React, Svelte, and Vue (mirrors `expr.go`).\n */\n\nexport const trimStr = (v: string | number | null | undefined): string =>\n  v === null || v === undefined ? \"\" : String(v).trim();\n\nexport const isSetStr = (v: string | null | undefined): boolean => trimStr(v) !== \"\";\n\nexport const isSetNum = (v: number | null | undefined): boolean => (v ?? 0) > 0;\n\n/**\n * `trim(v) === \"\" ? fallback : trim(v)` — DefaultInputType-style defaults.\n * Generic so enum-typed props keep their literal union through the default.\n */\nexport const defaultIfEmpty = <T extends string>(v: T | null | undefined, fallback: T): T => {\n  const t = trimStr(v) as T;\n  return t === \"\" ? fallback : t;\n};\n\n/** Whitelist: returns `trim(v)` when in `allowed`, otherwise `fallback`. */\nexport const oneOfOr = <T extends string>(\n  v: string | null | undefined,\n  fallback: T,\n  ...allowed: T[]\n): T => {\n  const t = trimStr(v) as T;\n  return allowed.includes(t) ? t : fallback;\n};\n\nexport const oneOfOrLower = <T extends string>(\n  v: string | null | undefined,\n  fallback: T,\n  ...allowed: T[]\n): T => {\n  const t = trimStr(v).toLowerCase() as T;\n  return allowed.includes(t) ? t : fallback;\n};\n\n/** Decision table: `mapping[trim(v)] ?? fallback`. */\nexport const mapOr = <T extends string>(\n  v: string | null | undefined,\n  mapping: Record<string, T>,\n  fallback: T\n): T => mapping[trimStr(v)] ?? fallback;\n\nexport const mapOrLower = <T extends string>(\n  v: string | null | undefined,\n  mapping: Record<string, T>,\n  fallback: T\n): T => mapping[trimStr(v).toLowerCase()] ?? fallback;\n\n/** Integer decision table: `mapping[v] ?? fallback`. */\nexport const intMapOr = <T extends string>(\n  v: number | null | undefined,\n  mapping: Record<number, T>,\n  fallback: T\n): T => mapping[v ?? 0] ?? fallback;\n\n/** Null-safe string equality (both sides normalized to \"\"). */\nexport const eqStr = (a: string | null | undefined, b: string | null | undefined): boolean =>\n  (a ?? \"\") === (b ?? \"\");\n\n/** ARIA state stringification: always \"true\"/\"false\", never omitted. */\nexport const boolStr = (v: boolean | null | undefined): \"true\" | \"false\" =>\n  v ? \"true\" : \"false\";\n\n/** Tri-state ARIA state: \"true\"/\"false\" when set, \"\" when unset (attribute omitted). */\nexport const optBoolStr = (v: boolean | null | undefined): \"true\" | \"false\" | \"\" =>\n  v === true ? \"true\" : v === false ? \"false\" : \"\";\n\n/** Concatenation of trimmed parts (icon `Prefix + Name`). */\nexport const concatTrim = (...parts: (string | null | undefined)[]): string =>\n  parts.map(trimStr).join(\"\");\n\n/** Omit-if-empty attribute value: `\"\"` → `undefined` so the attr is dropped. */\nexport const orUndef = <T extends string>(v: T | null | undefined): Exclude<T, \"\"> | undefined => {\n  const t = trimStr(v);\n  return t === \"\" ? undefined : (String(v) as Exclude<T, \"\">);\n};\n\n/**\n * Sync a form control's live `value` property (never an attribute, so SSR\n * markup is untouched). `undefined` leaves the current selection alone, so\n * the children's initial `selected` state stays in charge. Usable directly as\n * a Svelte action (`use:syncValue={value}`) and from Solid refs / WC renderers.\n */\nexport function syncValue(node: { value: string }, value?: string | null): { update(v?: string | null): void } {\n  const apply = (v?: string | null): void => {\n    if (v !== undefined && v !== null && node.value !== v) node.value = v;\n  };\n  apply(value);\n  return { update: apply };\n}\n\nconst DATA_IMAGE = /^data:image\\/(png|jpeg|gif|webp|avif|svg\\+xml)[;,]/;\n/**\n * URL attribute value: \"\" for javascript:, vbscript: and data: (ASCII whitespace/control chars removed,\n * case-insensitive). `dataImage` (only `<img src>`) allows data:image/(png|jpeg|gif|webp|avif|svg+xml).\n */\nexport const safeUrl = (v: string | null | undefined, dataImage = false): string => {\n  const k = String(v ?? \"\").replace(/[\\u0000-\\u0020]/g, \"\").toLowerCase();\n  return /^(javascript|vbscript|data):/.test(k) && !(dataImage && DATA_IMAGE.test(k)) ? \"\" : (v ?? \"\");\n};\n\n/** Per-element rest rule: `img` allows data:image in `src`; `blank` lists optional attrs (lowercase) omitted when blank. */\nexport type RestRule = { readonly img?: boolean; readonly blank?: readonly string[] };\n\nconst URL_KEYS = new Set([\"href\", \"src\", \"action\", \"formaction\", \"poster\", \"cite\", \"background\", \"xlink:href\", \"xlinkhref\"]);\n/** True when a rest entry must be omitted: an unsafe URL or a blank optional attribute (`value` is never in `blank`). */\nexport function dropRestKey(k: string, v: unknown, rule?: RestRule): boolean {\n  if (typeof v !== \"string\") return false;\n  const key = k.toLowerCase();\n  if (rule?.blank?.includes(key) && v.trim() === \"\") return true;\n  return v !== \"\" && URL_KEYS.has(key) && safeUrl(v, rule?.img === true && key === \"src\") === \"\";\n}\n/** Rest props / caller attrs without unsafe URLs and blank optional attributes; identity when clean. */\nexport function safeRest<T extends object>(rest: T, rule?: RestRule): T {\n  const bad = Object.keys(rest).filter((k) => dropRestKey(k, (rest as Record<string, unknown>)[k], rule));\n  if (bad.length === 0) return rest;\n  const out = { ...rest } as Record<string, unknown>;\n  for (const k of bad) delete out[k];\n  return out as T;\n}\n",
      "path": "kit/utils/expr.ts",
      "target": "kit/utils/expr.ts"
    },
    {
      "content": "export { cn } from \"./cn\";\nexport { isDevEnv } from \"./env\";\nexport type { RecipeKey, VariantRecipe } from \"./recipe-types\";\nexport {\n  compose,\n  composeRecipe,\n  recipeToVariants,\n  type RecipeSelection,\n  type Variants,\n} from \"./variants\";\nexport { BOX_TAGS, TEXT_TAGS, TagGroup, isAllowedTag, resolveTag, type BoxTag, type TextTag } from \"./tags\";\nexport * from \"./expr\";\n",
      "path": "kit/utils/index.ts",
      "target": "kit/utils/index.ts"
    },
    {
      "content": "/**\n * Type helpers to derive literal unions from `*.variants.json` recipes.\n * Usage:\n *   import buttonRecipe from \"./button.variants.json\";\n *   type ButtonVariant = RecipeKey<typeof buttonRecipe, \"variant\">;\n *   // ^? \"default\" | \"destructive\" | \"ghost\" | ...\n */\n\nexport type VariantRecipe = {\n  id: string;\n  base: string;\n  keys: string[];\n  defaults: Record<string, string>;\n  byKey: Record<string, Record<string, string>>;\n};\n\n/**\n * Extract the literal union of variant keys for a given recipe dimension.\n * Empty string (used as a fallback in some JSON recipes) is excluded so\n * consumers get only meaningful values in autocomplete.\n */\nexport type RecipeKey<\n  R extends VariantRecipe,\n  K extends keyof R[\"byKey\"] & string,\n> = Exclude<keyof R[\"byKey\"][K] & string, \"\">;\n",
      "path": "kit/utils/recipe-types.ts",
      "target": "kit/utils/recipe-types.ts"
    },
    {
      "content": "// Mirrors src/domain/tags.ts (the SSOT). DO NOT EDIT in generated output.\n\nimport { isDevEnv } from \"./env\";\n\nexport const BOX_TAGS = [\n  \"div\", \"section\", \"article\", \"aside\", \"header\", \"footer\", \"main\", \"nav\", \"figure\", \"search\",\n  \"ul\", \"ol\", \"li\", \"dl\", \"dt\", \"dd\", \"fieldset\",\n  \"table\", \"thead\", \"tbody\", \"tfoot\", \"tr\", \"th\", \"td\", \"caption\", \"colgroup\", \"col\",\n] as const;\nexport const TEXT_TAGS = [\n  \"p\", \"span\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"blockquote\", \"figcaption\", \"pre\", \"code\",\n  \"small\", \"strong\", \"em\", \"time\", \"legend\", \"del\", \"ins\",\n] as const;\n\nexport type BoxTag = (typeof BOX_TAGS)[number];\nexport type TextTag = (typeof TEXT_TAGS)[number];\n\nexport const TagGroup = { Box: \"Box\", Text: \"Text\" } as const;\nexport type TagGroup = (typeof TagGroup)[keyof typeof TagGroup];\n\nconst groups: Record<TagGroup, ReadonlySet<string>> = {\n  Box: new Set<string>(BOX_TAGS),\n  Text: new Set<string>(TEXT_TAGS),\n};\n\nconst warned = new Set<string>();\n\nexport function isAllowedTag(tag: string, group: TagGroup): boolean {\n  return groups[group]?.has(tag.trim().toLowerCase()) ?? false;\n}\n\nexport function resolveTag(tag: string | undefined, fallback: string, group: TagGroup): string {\n  const t = tag?.trim().toLowerCase() ?? \"\";\n  if (!t) return fallback;\n  if (isAllowedTag(t, group)) return t;\n  if (isDevEnv()) {\n    const key = `${group}:${t}`;\n    if (!warned.has(key)) {\n      warned.add(key);\n      console.warn(`[resolveTag] \"${t}\" is not an allowed ${group} tag; using \"${fallback}\".`);\n    }\n  }\n  return fallback;\n}\n",
      "path": "kit/utils/tags.ts",
      "target": "kit/utils/tags.ts"
    },
    {
      "content": "import { cn } from \"./cn\";\nimport { isDevEnv } from \"./env\";\nimport type { RecipeKey, VariantRecipe } from \"./recipe-types\";\n\nexport type { RecipeKey, VariantRecipe };\n\nexport type Variants = {\n  id?: string;\n  base: string;\n  keys: string[];\n  defaults: Record<string, string>;\n  byKey: Record<string, Record<string, string>>;\n};\n\nexport function recipeToVariants<R extends VariantRecipe>(recipe: R): Variants {\n  return {\n    id: recipe.id,\n    base: recipe.base,\n    keys: recipe.keys,\n    defaults: recipe.defaults ?? {},\n    byKey: recipe.byKey,\n  };\n}\n\n/**\n * Merge base, variant selections, and optional tail classes.\n * Mirrors the canonical `composeRecipe`.\n */\nexport function compose(\n  v: Variants,\n  selection: Record<string, string>,\n  ...extra: (string | undefined | null | false)[]\n): string {\n  const parts: string[] = [];\n  if (v.base.trim() !== \"\") {\n    parts.push(v.base.trim());\n  }\n  for (const key of v.keys) {\n    const choices = v.byKey[key];\n    if (!choices) continue;\n    const selected = (selection[key] ?? \"\").trim();\n    const fallback = (v.defaults[key] ?? \"\").trim();\n    const choice = selected || fallback;\n    if (!choice) {\n      if (isDevEnv() && Object.keys(choices).length > 0) {\n        throw new Error(\n          `[compose] missing default for key \"${key}\" (recipe id: ${String(v.id ?? \"?\")})`\n        );\n      }\n      continue;\n    }\n    const cls = choices[choice];\n    if (cls !== undefined) {\n      if (cls.trim() !== \"\") parts.push(cls.trim());\n    } else if (isDevEnv()) {\n      throw new Error(\n        `[compose] unknown variant \"${choice}\" for key \"${key}\" (recipe id: ${String(v.id ?? \"?\")})`\n      );\n    }\n    // Unknown choices are silently dropped in production to avoid leaking\n    // typos into the DOM as literal class names.\n  }\n  return cn(...parts, ...extra);\n}\n\n/** Selection type for `composeRecipe`. */\nexport type RecipeSelection<R extends VariantRecipe> = {\n  [K in keyof R[\"byKey\"] & string]?: RecipeKey<R, K> | undefined;\n};\n\n/** Compose classes from a typed recipe. */\nexport function composeRecipe<R extends VariantRecipe>(\n  recipe: R,\n  selection: RecipeSelection<R>,\n  ...extra: (string | undefined | null | false)[]\n): string {\n  return compose(recipeToVariants(recipe), selection as Record<string, string>, ...extra);\n}\n",
      "path": "kit/utils/variants.ts",
      "target": "kit/utils/variants.ts"
    },
    {
      "content": "/* Code generated by compose-gen. DO NOT EDIT. */\n/* Entry of the styles: theme tokens and the kit CSS. @source makes Tailwind v4 scan the compositions and the installed primitives. */\n@import \"./theme.css\";\n@import \"./kit.css\";\n\n@source \"../\";\n@source \"../kit\";\n",
      "path": "styles/index.css",
      "target": "styles/index.css"
    },
    {
      "content": "/* Kit-wide CSS: base layer, input glyph utilities, focus ring. Colors and the one corner token (--radius) come from theme.css (shadcn neutral);\n   shadows: only floating layers have one (shadow-md, shadow-lg), set in their specs; nothing here draws one. */\n@layer base {\n  html, body { margin: 0; background: var(--color-background); color: var(--color-foreground); }\n  body { -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; overflow-x: hidden; }\n  button { cursor: pointer; }\n  html { -webkit-text-size-adjust: 100%; color-scheme: light; }\n}\n\n/* the box of a checkbox: its corner is the theme radius scaled to the 16-20px box (0.4 x 10px = 4px), so it never reads as a radio */\n@utility checkbox-glyph {\n  display: inline-grid; place-content: center; border-radius: calc(var(--radius) * 0.4);\n  &::before { content: \"\"; width: 8px; height: 6px; opacity: 0; background: currentColor;\n    clip-path: polygon(0 55%, 14% 40%, 38% 64%, 86% 0, 100% 15%, 38% 95%); }\n  &:checked { color: var(--color-primary-foreground); }\n  &:checked::before { opacity: 1; }\n}\n/* a number field without the browser spin buttons (NumberField draws its own minus and plus) */\n@utility number-bare {\n  appearance: textfield; -moz-appearance: textfield;\n  &::-webkit-inner-spin-button, &::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }\n}\n@utility radio-glyph {\n  display: inline-grid; place-content: center;\n  &::before { content: \"\"; width: var(--dot); height: var(--dot); border-radius: 9999px; background: var(--color-primary-foreground); opacity: 0; }\n  &:checked::before { opacity: 1; }\n}\n@utility switch-knob {\n  &::before { content: \"\"; position: absolute; top: 50%; left: var(--pad); width: var(--knob); height: var(--knob); border-radius: 9999px;\n    background: var(--color-background); translate: 0 -50%; transition: left .15s; }\n  &:checked::before { left: calc(100% - var(--pad) - var(--knob)); }\n}\n@utility progress-bar {\n  &::-webkit-progress-bar { background: transparent; }\n  &::-webkit-progress-value { background: var(--bar); border-radius: var(--radius); }\n  &::-moz-progress-bar { background: var(--bar); border-radius: var(--radius); }\n  &::-webkit-meter-bar { background: transparent; border: 0; }\n  &::-webkit-meter-optimum-value { background: var(--bar); }\n}\n\n/* Focus ring sits above utility shadows. Keyboard only. The 4px halo is gray unless the element sets a ring colour\n   (shadcn style, e.g. focus-visible:ring-destructive/20 on the destructive variants); --tw-ring-color does not inherit. */\n:where(a, button, input, select, textarea, summary, [role=\"tab\"], [role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"option\"], [role=\"treeitem\"], [role=\"radio\"], [role=\"switch\"], [tabindex]):focus-visible {\n  outline: none;\n  box-shadow: var(--tw-inset-shadow, 0 0 #0000), var(--tw-inset-ring-shadow, 0 0 #0000), 0 0 0 4px var(--tw-ring-color, rgb(128 128 128 / 0.15)), var(--tw-shadow, 0 0 #0000);\n}\n[data-slot=\"prompt-input\"]:focus-within, [data-slot=\"smartbox\"]:focus-within { box-shadow: 0 0 0 4px rgb(128 128 128 / 0.15), inset 0 0 0 1px var(--color-border); }\n[data-slot=\"prompt-input\"] textarea:focus-visible, [data-slot=\"smartbox\"] input:focus-visible { box-shadow: none; }\n[data-slot=\"file-tree-item\"]:focus-visible, [data-slot=\"editor-tab\"]:focus-visible, [data-slot=\"icon-tab\"]:focus-visible, [data-slot=\"dropdown-item\"]:focus-visible {\n  box-shadow: inset 0 0 0 2px rgb(128 128 128 / 0.15), inset 0 0 0 1px var(--color-muted-foreground);\n}\n:where([data-screen]) :focus:not(:focus-visible) { outline: none; }\n::selection { background: color-mix(in srgb, var(--color-primary) 15%, transparent); }\n\n/* The disclosure indicator: the Lucide chevron-down drawn in the text colour; the Summary brick turns it over when its\n   details open (group-open:rotate-180), so an accordion needs no script. */\n[data-slot=\"summary-indicator\"] {\n  display: inline-block;\n  background-color: currentColor;\n  mask: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\") center / contain no-repeat;\n}\n\n/* Per-element tokens (UI8KIT-2.0 §11): badge, button, card, alert, media. An unset token falls back to the value of the utility class the\n   rule matches (p-6, px-4 h-10, ...), stated explicitly: a revert-layer fallback inside var() is not supported by every\n   browser (there the property became unset: buttons and badges lost their padding and height).\n   A skin or a scope (a wrapper, the magazine specimen) sets only the ones it wants.\n   Radius:  --radius-badge|button|card|alert|media   (unset: var(--radius); the badge unset: the pill). Only elements that carry plain `rounded` follow it.\n   Shadow:  --shadow-card|alert|media                (unset: the spec's own: none). A full box-shadow layer, e.g. var(--shadow-sm) or 0 0 #0000.\n   Density: data-density-badge|button|card|alert = compact | default | comfortable, on the element or any ancestor, sets --pad-*:\n            card 16/24/32 (padding of a default card), alert inline 8/8/16 with --min-alert 24/32/40,\n            button inline 12/16/20 and height 32/40/48 (default size), badge inline 8/12/16 and height 20/24/28 (default size).\n            4px steps only inside controls (button, badge); card and alert stay on the 8px step. */\n[data-slot=\"button\"].rounded { border-radius: var(--radius-button, var(--radius)); }\n[data-slot=\"card\"].rounded { border-radius: var(--radius-card, var(--radius)); }\n[data-slot=\"alert\"].rounded { border-radius: var(--radius-alert, var(--radius)); }\n[data-slot=\"media-frame\"].rounded { border-radius: var(--radius-media, var(--radius)); }\n[data-slot=\"badge\"].rounded-full { border-radius: var(--radius-badge, calc(infinity * 1px)); }\n[data-slot=\"card\"] { --tw-shadow: var(--shadow-card, 0 0 #0000); }\n[data-slot=\"alert\"] { --tw-shadow: var(--shadow-alert, 0 0 #0000); }\n[data-slot=\"media-frame\"] { --tw-shadow: var(--shadow-media, 0 0 #0000); }\n[data-slot=\"card\"].p-6 { padding: var(--pad-card, calc(var(--spacing) * 6)); }\n[data-slot=\"alert\"].px-2 { padding-inline: var(--pad-alert, calc(var(--spacing) * 2)); }\n[data-slot=\"alert\"].min-h-8 { min-height: var(--min-alert, calc(var(--spacing) * 8)); }\n[data-slot=\"button\"].px-4.h-10 { padding-inline: var(--pad-button, calc(var(--spacing) * 4)); height: var(--h-button, calc(var(--spacing) * 10)); }\n[data-slot=\"badge\"].px-3.h-6 { padding-inline: var(--pad-badge, calc(var(--spacing) * 3)); height: var(--h-badge, calc(var(--spacing) * 6)); }\n[data-density-card=\"compact\"] { --pad-card: 16px; }\n[data-density-card=\"comfortable\"] { --pad-card: 32px; }\n[data-density-alert=\"compact\"] { --pad-alert: 8px; --min-alert: 24px; }\n[data-density-alert=\"comfortable\"] { --pad-alert: 16px; --min-alert: 40px; }\n[data-density-button=\"compact\"] { --pad-button: 12px; --h-button: 32px; }\n[data-density-button=\"comfortable\"] { --pad-button: 20px; --h-button: 48px; }\n[data-density-badge=\"compact\"] { --pad-badge: 8px; --h-badge: 20px; }\n[data-density-badge=\"comfortable\"] { --pad-badge: 16px; --h-badge: 28px; }\n",
      "path": "styles/kit.css",
      "target": "styles/kit.css"
    },
    {
      "content": "/* Owned by codegen-x (UI8Kit 3: ui8kit/codegen ships no theme). Forked from vendor/codegen 2309848; adds --destructive-foreground (AA). */\n@import \"tailwindcss\";\n\n/* shadcn/ui neutral theme (Tailwind v4, written as hsl() for old browsers; same colours as the oklch values published at https://ui.shadcn.com/docs/theming\n   (\"Default Theme CSS\", base color neutral). Dark mode: the .dark class or data-theme=\"dark\" on an ancestor. */\n@custom-variant dark (&:is(.dark *, [data-theme=\"dark\"] *));\n\n/* The one corner token. Plain `rounded` reads the bare --radius theme key, so every corner of the kit follows it\n   (shadcn keeps --radius in :root; here it sits in @theme so that `rounded` resolves to it; same value, 0.625rem). */\n@theme {\n  --radius: 0.625rem;\n}\n\n@theme inline {\n  --color-background: var(--background);\n  --color-foreground: var(--foreground);\n  --color-card: var(--card);\n  --color-card-foreground: var(--card-foreground);\n  --color-popover: var(--popover);\n  --color-popover-foreground: var(--popover-foreground);\n  --color-primary: var(--primary);\n  --color-primary-foreground: var(--primary-foreground);\n  --color-secondary: var(--secondary);\n  --color-secondary-foreground: var(--secondary-foreground);\n  --color-muted: var(--muted);\n  --color-muted-foreground: var(--muted-foreground);\n  --color-accent: var(--accent);\n  --color-accent-foreground: var(--accent-foreground);\n  --color-destructive: var(--destructive);\n  --color-destructive-foreground: var(--destructive-foreground);\n  --color-destructive-hover: var(--destructive-hover);\n  --color-border: var(--border);\n  --color-input: var(--input);\n  --color-ring: var(--ring);\n  --color-chart-1: var(--chart-1);\n  --color-chart-2: var(--chart-2);\n  --color-chart-3: var(--chart-3);\n  --color-chart-4: var(--chart-4);\n  --color-chart-5: var(--chart-5);\n  --color-sidebar: var(--sidebar);\n  --color-sidebar-foreground: var(--sidebar-foreground);\n  --color-sidebar-primary: var(--sidebar-primary);\n  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);\n  --color-sidebar-accent: var(--sidebar-accent);\n  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);\n  --color-sidebar-border: var(--sidebar-border);\n  --color-sidebar-ring: var(--sidebar-ring);\n  --radius-sm: calc(var(--radius) * 0.6);\n  --radius-md: calc(var(--radius) * 0.8);\n  --radius-lg: var(--radius);\n  --radius-xl: calc(var(--radius) * 1.4);\n  --radius-2xl: calc(var(--radius) * 1.8);\n  --radius-3xl: calc(var(--radius) * 2.2);\n  --radius-4xl: calc(var(--radius) * 2.6);\n}\n\n:root {\n  --background: hsl(0 0% 100%);\n  --foreground: hsl(0 0% 4%);\n  --card: hsl(0 0% 100%);\n  --card-foreground: hsl(0 0% 4%);\n  --popover: hsl(0 0% 100%);\n  --popover-foreground: hsl(0 0% 4%);\n  --primary: hsl(0 0% 9%);\n  --primary-foreground: hsl(0 0% 98%);\n  --secondary: hsl(0 0% 96%);\n  --secondary-foreground: hsl(0 0% 9%);\n  --muted: hsl(0 0% 96%);\n  --muted-foreground: hsl(0 0% 43.5%);\n  --accent: hsl(0 0% 96%);\n  --accent-foreground: hsl(0 0% 9%);\n  --destructive: hsl(0.6 88.4% 48%); /* L 52.5% -> 48%: white text reaches AA (4.70) */\n  --destructive-foreground: hsl(0 0% 100%);\n  --destructive-hover: hsl(0.6 88.4% 42%); /* 6 points away from the foreground: hover keeps AA */\n  --border: hsl(0 0% 90%);\n  --input: hsl(0 0% 90%);\n  --ring: hsl(0 0% 63%);\n  --chart-1: hsl(18 100% 48%);\n  --chart-2: hsl(174.7 100% 29.5%);\n  --chart-3: hsl(196 72% 23%);\n  --chart-4: hsl(43.6 100% 50%);\n  --chart-5: hsl(36.3 100% 49.7%);\n  --sidebar: hsl(0 0% 98%);\n  --sidebar-foreground: hsl(0 0% 4%);\n  --sidebar-primary: hsl(0 0% 9%);\n  --sidebar-primary-foreground: hsl(0 0% 98%);\n  --sidebar-accent: hsl(0 0% 96%);\n  --sidebar-accent-foreground: hsl(0 0% 9%);\n  --sidebar-border: hsl(0 0% 90%);\n  --sidebar-ring: hsl(0 0% 63%);\n}\n\n:is(.dark, [data-theme=\"dark\"]) {\n  --background: hsl(0 0% 4%);\n  --foreground: hsl(0 0% 98%);\n  --card: hsl(0 0% 9%);\n  --card-foreground: hsl(0 0% 98%);\n  --popover: hsl(0 0% 9%);\n  --popover-foreground: hsl(0 0% 98%);\n  --primary: hsl(0 0% 90%);\n  --primary-foreground: hsl(0 0% 9%);\n  --secondary: hsl(0 0% 15%);\n  --secondary-foreground: hsl(0 0% 98%);\n  --muted: hsl(0 0% 15%);\n  --muted-foreground: hsl(0 0% 63%);\n  --accent: hsl(0 0% 15%);\n  --accent-foreground: hsl(0 0% 98%);\n  --destructive: hsl(356.1 62.4% 52%);\n  --destructive-foreground: hsl(0 0% 100%);\n  --destructive-hover: hsl(356.1 62.4% 46%);\n  --border: hsl(0 0% 100% / 10%);\n  --input: hsl(0 0% 100% / 15%);\n  --ring: hsl(0 0% 45%);\n  --chart-1: hsl(225.3 84.1% 49%);\n  --chart-2: hsl(160 100% 37%);\n  --chart-3: hsl(36.3 100% 49.7%);\n  --chart-4: hsl(273.3 100% 63.8%);\n  --chart-5: hsl(345 100% 56%);\n  --sidebar: hsl(0 0% 9%);\n  --sidebar-foreground: hsl(0 0% 98%);\n  --sidebar-primary: hsl(225.3 84.1% 49%);\n  --sidebar-primary-foreground: hsl(0 0% 98%);\n  --sidebar-accent: hsl(0 0% 15%);\n  --sidebar-accent-foreground: hsl(0 0% 98%);\n  --sidebar-border: hsl(0 0% 100% / 10%);\n  --sidebar-ring: hsl(0 0% 45%);\n}\n\n@layer base {\n  * {\n    @apply border-border outline-ring/50;\n  }\n  body {\n    @apply bg-background text-foreground;\n  }\n}\n",
      "path": "styles/theme.css",
      "target": "styles/theme.css"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Framework-free: the function takes the node and returns the cleanup. Svelte: call it from an action or an effect; React: call it in an effect.\nexport type DismissReason = \"escape\" | \"outside\";\nconst stack: object[] = [];   // topmost dismissable layer handles Escape first (menu inside off-canvas sidebar, …)\n\n/** Escape and pointer-down outside the node call onDismiss. Returns the cleanup. */\nexport function dismissable(node: HTMLElement, opts: () => { onDismiss: (reason: DismissReason) => void; ignore?: () => (Element | null | undefined)[]; outside?: boolean }): () => void {\n  {\n    const layer = {};\n    stack.push(layer);\n    const { onDismiss, ignore = () => [], outside = true } = opts();\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key !== \"Escape\" || e.defaultPrevented || stack[stack.length - 1] !== layer) return;\n      e.preventDefault(); e.stopPropagation();\n      onDismiss(\"escape\");\n    };\n    const onDown = (e: PointerEvent) => {\n      if (!outside || stack[stack.length - 1] !== layer) return;\n      const t = e.target as Node | null;\n      if (!t || node.contains(t) || ignore().some((el) => el?.contains(t))) return;\n      onDismiss(\"outside\");\n    };\n    document.addEventListener(\"keydown\", onKey, true);\n    document.addEventListener(\"pointerdown\", onDown, true);\n    return () => {\n      document.removeEventListener(\"keydown\", onKey, true);\n      document.removeEventListener(\"pointerdown\", onDown, true);\n      const i = stack.indexOf(layer); if (i >= 0) stack.splice(i, 1);\n    };\n  }\n}\n",
      "path": "utils/a11y/dismiss.ts",
      "target": "utils/a11y/dismiss.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Framework-free: the function takes the node and returns the cleanup. Svelte: call it from an action or an effect; React: call it in an effect.\nimport { focusables } from \"./focusable\";\n\n/** Tab/Shift+Tab cycle inside `node`; on cleanup focus returns to the element focused before. */\nexport function trapFocus(node: HTMLElement): () => void {\n  const previous = document.activeElement as HTMLElement | null;\n  if (!node.contains(previous)) queueMicrotask(() => focusables(node)[0]?.focus());\n  const onKey = (e: KeyboardEvent) => {\n    if (e.key !== \"Tab\") return;\n    const items = focusables(node);\n    if (!items.length) { e.preventDefault(); return; }\n    const first = items[0], last = items[items.length - 1], cur = document.activeElement;\n    if (e.shiftKey && (cur === first || !node.contains(cur))) { e.preventDefault(); last.focus(); }\n    else if (!e.shiftKey && (cur === last || !node.contains(cur))) { e.preventDefault(); first.focus(); }\n  };\n  node.addEventListener(\"keydown\", onKey);\n  return () => { node.removeEventListener(\"keydown\", onKey); /* after the page is no longer inert */ requestAnimationFrame(() => { if (previous?.isConnected) previous.focus(); }); };\n}\n",
      "path": "utils/a11y/focus-trap.ts",
      "target": "utils/a11y/focus-trap.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Small headless helpers shared by the interactive primitives (menus, dialogs, tabs, off-canvas sidebar).\nexport const FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]):not([type=\"hidden\"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\n\n/** visible, tabbable descendants of `root` in DOM order */\nexport function focusables(root: HTMLElement): HTMLElement[] {\n  return [...root.querySelectorAll<HTMLElement>(FOCUSABLE)].filter((el) => !el.closest(\"[inert]\") && el.getClientRects().length > 0 && getComputedStyle(el).visibility !== \"hidden\");\n}\n",
      "path": "utils/a11y/focusable.ts",
      "target": "utils/a11y/focusable.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\nexport { FOCUSABLE, focusables } from \"./focusable\";\nexport { moveFocus, typeahead, type RovingOptions } from \"./roving\";\nexport { lockScroll } from \"./scroll-lock\";\nexport { dismissable, type DismissReason } from \"./dismiss\";\nexport { trapFocus } from \"./focus-trap\";\n",
      "path": "utils/a11y/index.ts",
      "target": "utils/a11y/index.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Arrow-key navigation over a list of focusable items (menus, listboxes, tab lists, trees).\nexport type RovingOptions = { orientation?: \"vertical\" | \"horizontal\" | \"both\"; loop?: boolean; activate?: boolean };\n\n/** Handles ArrowUp/Down/Left/Right, Home, End. Returns true when the key was consumed. */\nexport function moveFocus(e: KeyboardEvent, items: HTMLElement[], { orientation = \"vertical\", loop = true, activate = false }: RovingOptions = {}): boolean {\n  if (!items.length || e.altKey || e.ctrlKey || e.metaKey) return false;\n  const prev = orientation !== \"horizontal\" ? [\"ArrowUp\"] : [];\n  const next = orientation !== \"horizontal\" ? [\"ArrowDown\"] : [];\n  if (orientation !== \"vertical\") { prev.push(\"ArrowLeft\"); next.push(\"ArrowRight\"); }\n  const cur = items.indexOf(document.activeElement as HTMLElement);\n  let idx = -1;\n  if (next.includes(e.key)) idx = cur < 0 ? 0 : cur + 1;\n  else if (prev.includes(e.key)) idx = cur < 0 ? items.length - 1 : cur - 1;\n  else if (e.key === \"Home\") idx = 0;\n  else if (e.key === \"End\") idx = items.length - 1;\n  else return false;\n  if (idx >= items.length) idx = loop ? 0 : items.length - 1;\n  if (idx < 0) idx = loop ? items.length - 1 : 0;\n  e.preventDefault();\n  const el = items[idx];\n  el.focus();\n  if (activate) el.click();\n  return true;\n}\n\n/** type-ahead: focus the next item whose text starts with the typed characters (reset after 600 ms) */\nexport function typeahead() {\n  let buf = \"\", t: ReturnType<typeof setTimeout> | undefined;\n  return (e: KeyboardEvent, items: HTMLElement[]): boolean => {\n    if (e.key.length !== 1 || e.ctrlKey || e.metaKey || e.altKey || e.key === \" \") return false;\n    buf += e.key.toLowerCase();\n    clearTimeout(t); t = setTimeout(() => (buf = \"\"), 600);\n    const start = Math.max(0, items.indexOf(document.activeElement as HTMLElement) + (buf.length === 1 ? 1 : 0));\n    const ordered = [...items.slice(start), ...items.slice(0, start)];\n    const hit = ordered.find((el) => (el.textContent ?? \"\").trim().toLowerCase().startsWith(buf));\n    if (hit) { hit.focus(); e.preventDefault(); return true; }\n    return false;\n  };\n}\n",
      "path": "utils/a11y/roving.ts",
      "target": "utils/a11y/roving.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Reference-counted page scroll lock (off-canvas sidebar, modal dialog). Compensates the scrollbar width on desktop.\nlet count = 0;\nlet saved = { overflow: \"\", paddingRight: \"\" };\n\nexport function lockScroll(): () => void {\n  const root = document.documentElement;\n  if (count++ === 0) {\n    const sw = window.innerWidth - root.clientWidth;\n    saved = { overflow: root.style.overflow, paddingRight: root.style.paddingRight };\n    root.style.overflow = \"hidden\";\n    if (sw > 0) root.style.paddingRight = `${sw}px`;\n    root.setAttribute(\"data-scroll-locked\", \"\");\n  }\n  let released = false;\n  return () => {\n    if (released) return; released = true;\n    if (--count === 0) {\n      root.style.overflow = saved.overflow; root.style.paddingRight = saved.paddingRight;\n      root.removeAttribute(\"data-scroll-locked\");\n    }\n  };\n}\n",
      "path": "utils/a11y/scroll-lock.ts",
      "target": "utils/a11y/scroll-lock.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/** Merge class values. Caller-supplied classes win over recipe classes. */\nexport function cn(...inputs: ClassValue[]): string {\n  return twMerge(clsx(inputs));\n}\n",
      "path": "utils/cn.ts",
      "target": "utils/cn.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\nexport function isDevEnv(): boolean {\r\n  try {\r\n    const env = (import.meta as unknown as { env?: { DEV?: boolean } }).env;\r\n    if (env && typeof env.DEV === \"boolean\") return env.DEV;\r\n  } catch {\r\n    // import.meta may be unavailable in some contexts\r\n  }\r\n  return false;\r\n}\r\n",
      "path": "utils/env.ts",
      "target": "utils/env.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\r\n * Tiny attribute-logic helpers used by generated components. One\r\n * implementation per runtime family keeps every default-resolution decision\r\n * table byte-identical across React, Svelte, and Vue (mirrors `expr.go`).\r\n */\r\n\r\nexport const trimStr = (v: string | number | null | undefined): string =>\r\n  v === null || v === undefined ? \"\" : String(v).trim();\r\n\r\nexport const isSetStr = (v: string | null | undefined): boolean => trimStr(v) !== \"\";\r\n\r\nexport const isSetNum = (v: number | null | undefined): boolean => (v ?? 0) > 0;\r\n\r\n/**\r\n * `trim(v) === \"\" ? fallback : trim(v)` — DefaultInputType-style defaults.\r\n * Generic so enum-typed props keep their literal union through the default.\r\n */\r\nexport const defaultIfEmpty = <T extends string>(v: T | null | undefined, fallback: T): T => {\r\n  const t = trimStr(v) as T;\r\n  return t === \"\" ? fallback : t;\r\n};\r\n\r\n/** Whitelist: returns `trim(v)` when in `allowed`, otherwise `fallback`. */\r\nexport const oneOfOr = <T extends string>(\r\n  v: string | null | undefined,\r\n  fallback: T,\r\n  ...allowed: T[]\r\n): T => {\r\n  const t = trimStr(v) as T;\r\n  return allowed.includes(t) ? t : fallback;\r\n};\r\n\r\nexport const oneOfOrLower = <T extends string>(\r\n  v: string | null | undefined,\r\n  fallback: T,\r\n  ...allowed: T[]\r\n): T => {\r\n  const t = trimStr(v).toLowerCase() as T;\r\n  return allowed.includes(t) ? t : fallback;\r\n};\r\n\r\n/** Decision table: `mapping[trim(v)] ?? fallback`. */\r\nexport const mapOr = <T extends string>(\r\n  v: string | null | undefined,\r\n  mapping: Record<string, T>,\r\n  fallback: T\r\n): T => mapping[trimStr(v)] ?? fallback;\r\n\r\nexport const mapOrLower = <T extends string>(\r\n  v: string | null | undefined,\r\n  mapping: Record<string, T>,\r\n  fallback: T\r\n): T => mapping[trimStr(v).toLowerCase()] ?? fallback;\r\n\r\n/** Integer decision table: `mapping[v] ?? fallback`. */\r\nexport const intMapOr = <T extends string>(\r\n  v: number | null | undefined,\r\n  mapping: Record<number, T>,\r\n  fallback: T\r\n): T => mapping[v ?? 0] ?? fallback;\r\n\r\n/** Null-safe string equality (both sides normalized to \"\"). */\r\nexport const eqStr = (a: string | null | undefined, b: string | null | undefined): boolean =>\r\n  (a ?? \"\") === (b ?? \"\");\r\n\r\n/** ARIA state stringification: always \"true\"/\"false\", never omitted. */\r\nexport const boolStr = (v: boolean | null | undefined): \"true\" | \"false\" =>\r\n  v ? \"true\" : \"false\";\r\n\r\n/** Concatenation of trimmed parts (icon `Prefix + Name`). */\r\nexport const concatTrim = (...parts: (string | null | undefined)[]): string =>\r\n  parts.map(trimStr).join(\"\");\r\n\r\n/** Omit-if-empty attribute value: `\"\"` → `undefined` so the attr is dropped. */\r\nexport const orUndef = (v: string | null | undefined): string | undefined => {\r\n  const t = trimStr(v);\r\n  return t === \"\" ? undefined : String(v);\r\n};\r\n\r\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\r\n\r\n/** h1–h6 from a heading level; 0/undefined/out-of-range default to h2. */\r\nexport const titleTag = (order: HeadingLevel | number | null | undefined): string => {\r\n  switch (order) {\r\n    case 1:\r\n      return \"h1\";\r\n    case 3:\r\n      return \"h3\";\r\n    case 4:\r\n      return \"h4\";\r\n    case 5:\r\n      return \"h5\";\r\n    case 6:\r\n      return \"h6\";\r\n    default:\r\n      return \"h2\";\r\n  }\r\n};\r\n",
      "path": "utils/expr.ts",
      "target": "utils/expr.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Text and number formatting shared by every generated organism and screen. Pure functions, no runtime dependency.\n\n/** fills {0}, {1}... of a content template */\nexport function tpl(template: string | undefined, ...values: Array<string | number | undefined>): string {\n  return (template ?? \"\").replace(/\\{(\\d+)\\}/g, (_m, i: string) => String(values[Number(i)] ?? \"\"));\n}\n\nconst nf = new Intl.NumberFormat(\"en-US\");\nexport function fmtNumber(n: number): string {\n  return nf.format(n);\n}\n\n/** digits of the minor unit (ISO 4217): cents for most currencies, none for JPY and KRW */\nexport function minorDigits(currency: string): number {\n  return currency === \"JPY\" || currency === \"KRW\" ? 0 : 2;\n}\n\nconst moneyCache = new Map<string, Intl.NumberFormat>();\n/** money in integer minor units (Codex v0.4: 1250 = 12.50 USD) -> \"$12.50\"; whole amounts drop the fraction: 1499_00 -> \"$1,499\" */\nexport function fmtMoney(minor: number, currency: string): string {\n  const d = minorDigits(currency);\n  const cents = Math.round(minor);\n  const frac = d > 0 && cents % 10 ** d !== 0 ? d : 0;\n  const key = `${currency}:${frac}`;\n  let f = moneyCache.get(key);\n  if (!f) {\n    f = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency, minimumFractionDigits: frac, maximumFractionDigits: frac });\n    moneyCache.set(key, f);\n  }\n  return f.format(cents / 10 ** d);\n}\n\n/** a content word by key (the status of a record -> its label); the key itself when the dictionary has no entry */\nexport function at(dict: Record<string, string> | undefined, key: string): string {\n  return dict?.[key] ?? key;\n}\n\n/** the page numbers a pager shows: the first, the last and the neighbours of the current page; null is a gap */\nexport function pageWindow(page: number, pages: number): (number | null)[] {\n  const keep = new Set([1, pages, page - 1, page, page + 1].filter((n) => n >= 1 && n <= pages));\n  const out: (number | null)[] = [];\n  let prev = 0;\n  for (const n of [...keep].sort((a, b) => a - b)) {\n    if (n - prev > 1) out.push(null);\n    out.push(n);\n    prev = n;\n  }\n  return out;\n}\n\n/** a responsive column variant of Grid capped by the number of items, so no column stays empty: (\"1-4\", 3) -> \"1-3\", (\"2-6\", 4) -> \"2-4\" */\nexport function fitCols(cols: string, n: number): string {\n  const m = /^(\\d+)-(\\d+)$/.exec(cols);\n  if (!m) return cols;\n  const lo = Number(m[1]), hi = Number(m[2]);\n  if (n >= hi) return cols;\n  const top = Math.max(lo, n);\n  const known = [\"1-2\", \"1-3\", \"1-4\", \"2-3\", \"2-4\", \"2-6\", \"3-6\"];\n  for (let h = top; h > lo; h--) if (known.includes(`${lo}-${h}`)) return `${lo}-${h}`;\n  return String(Math.min(lo, Math.max(n, 1)));\n}\n\n/** a label of segments joined by \", \" without a segment equal (case-insensitive) to the one before it:\n *  \"Footer, Footer, Centered\" -> \"Footer, Centered\" */\nexport function uniqLabel(label: string | undefined): string {\n  const parts = (label ?? \"\").split(\", \");\n  return parts.filter((s, i) => i === 0 || s.toLowerCase() !== (parts[i - 1] ?? \"\").toLowerCase()).join(\", \");\n}\n",
      "path": "utils/format.ts",
      "target": "utils/format.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\n * Trusted markup. A prop of type `TrustedHtml` carries markup from a trusted source (the `|html` pipe of readPath: the body of a\n * Codex entry, or the host), and an `html` view node prints it without escaping. Every other value is text, and is escaped.\n * The marker is React's own shape, `{ __html }`; a value without it (a plain string) is escaped by `htmlOf`, so markup is\n * printed raw only when it was marked trusted. The same rules on every runtime: og_html (PHP, Python) and Html (Go).\n */\nexport type TrustedHtml = { readonly __html: string };\n\n/** marks markup as trusted: only for a source the app trusts (the Codex body), never for user input */\nexport const trustHtml = (html: string): TrustedHtml => ({ __html: html });\n\nexport const isTrustedHtml = (v: unknown): v is TrustedHtml =>\n  v !== null && typeof v === \"object\" && typeof (v as { __html?: unknown }).__html === \"string\";\n\nconst ENTITIES: Record<string, string> = { \"&\": \"&amp;\", \"<\": \"&lt;\", \">\": \"&gt;\", '\"': \"&quot;\", \"'\": \"&#39;\" };\n\n/** text as markup: & < > \" ' as entities */\nexport const escapeHtml = (s: string): string => s.replace(/[&<>\"']/g, (c) => ENTITIES[c]!);\n\n/** the markup an `html` node prints: the trusted markup as it is, any other value escaped as text (nothing for null and booleans, like a text node) */\nexport const htmlOf = (v: TrustedHtml | string | number | boolean | null | undefined): string =>\n  isTrustedHtml(v) ? v.__html : v === null || v === undefined || typeof v === \"boolean\" ? \"\" : escapeHtml(String(v));\n",
      "path": "utils/html.ts",
      "target": "utils/html.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\nexport { cn } from \"./cn\";\nexport { isDevEnv } from \"./env\";\nexport { variants, type VariantFn, type VariantKey, type VariantSelection, type VariantTable } from \"./variants\";\nexport { TagGroup, isAllowedTag, resolveTag } from \"./tags\";\nexport * from \"./expr\";\nexport { tpl, fmtNumber, fmtMoney, minorDigits, at, pageWindow, fitCols, uniqLabel } from \"./format\";\nexport * from \"./a11y\";\nexport { type TrustedHtml, trustHtml, isTrustedHtml, escapeHtml, htmlOf } from \"./html\";\nexport { decodeEntities, isSafeUrl, urlOf, srcsetOf, cssValue, srcsetUrls, styleOf, isSafeAttrName, attrValueOf, URL_ATTRS, IMAGE_ATTRS, URL_SCHEMES, NAMED_ENTITIES } from \"./safe\";\n",
      "path": "utils/index.ts",
      "target": "utils/index.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\n * Output safety of the organism runtime (the same rules in PHP Runtime.php, Python runtime.py and Go dyn.go; the shared vectors\n * are in packages/compose-gen/runtimes/core/test/safety-vectors.json). An allowlist, not a denylist:\n *   - a URL (href, src, action, formaction, poster, cite, background, data, xlink:href) is kept only when, read as a browser\n *     reads it (entities decoded, ASCII whitespace and control characters removed), it is a path or a reference with no scheme\n *     (`/path`, `#a`, `?q`, `page.html`) or its scheme is http, https, mailto or tel; an image URL may also be\n *     data:image/(png|jpeg|gif|webp|avif|svg+xml). A protocol-relative URL (`//host`, `/\\host`, `\\\\host`) is refused.\n *     Anything else is \"\" (javascript:, vbscript:, data:text/html, livescript:, also behind case, entities or whitespace).\n *   - a srcset is checked candidate by candidate (each URL an image URL); one bad candidate refuses the whole value.\n *   - a style is refused (\"\") when a url(...) inside it is not an image URL, or it holds expression(, a script scheme,\n *     -moz-binding, behavior: or a CSS escape (a backslash).\n *   - an attribute name is printed only when it matches ^[a-zA-Z_:][-a-zA-Z0-9_:.]*$ and does not start with \"on\".\n */\n\n/** the named character references the check decodes (those that spell URL syntax, whitespace or the markup characters) */\nexport const NAMED_ENTITIES: Readonly<Record<string, string>> = {\n  Tab: \"\\t\", NewLine: \"\\n\", colon: \":\", sol: \"/\", bsol: \"\\\\\", lpar: \"(\", rpar: \")\", amp: \"&\", lt: \"<\", gt: \">\", quot: '\"', apos: \"'\",\n  nbsp: \"\\u00a0\", period: \".\", comma: \",\", excl: \"!\", num: \"#\", quest: \"?\", equals: \"=\", plus: \"+\", semi: \";\", percnt: \"%\", lowbar: \"_\",\n  ast: \"*\", commat: \"@\", dollar: \"$\", Hat: \"^\", grave: \"`\", lsqb: \"[\", rsqb: \"]\", lcub: \"{\", rcub: \"}\", verbar: \"|\", vert: \"|\",\n};\nexport const URL_SCHEMES: readonly string[] = [\"http\", \"https\", \"mailto\", \"tel\"];\nconst DATA_IMAGE = /^data:image\\/(png|jpeg|gif|webp|avif|svg\\+xml)[;,]/;\nconst ENTITY = /&(?:#[xX]([0-9a-fA-F]{1,8});?|#([0-9]{1,10});?|([a-zA-Z][a-zA-Z0-9]{0,31});)/g;\nconst fromCode = (n: number): string => (n > 0 && n <= 0x10ffff && !(n >= 0xd800 && n <= 0xdfff) ? String.fromCodePoint(n) : \"\\ufffd\");\n\n/** character references decoded as a browser would (numeric with or without `;`, the named ones of NAMED_ENTITIES), up to 3 rounds */\nexport function decodeEntities(s: string): string {\n  let out = s;\n  for (let i = 0; i < 3 && out.includes(\"&\"); i++) {\n    out = out.replace(ENTITY, (m, hex: string | undefined, dec: string | undefined, name: string | undefined) =>\n      hex !== undefined ? fromCode(parseInt(hex, 16)) : dec !== undefined ? fromCode(parseInt(dec, 10)) : NAMED_ENTITIES[name!] ?? m);\n  }\n  return out;\n}\n\n/** the value as a URL parser sees it: entities decoded, ASCII whitespace and control characters (C0, space, DEL) removed */\nconst compact = (s: string): string => decodeEntities(s).replace(/[\\u0000-\\u0020\\u007f]+/g, \"\");\n\n/** true when the URL is allowed (see the file comment); `image`: data:image/* too */\nexport function isSafeUrl(v: string, image = false): boolean {\n  const k = compact(v);\n  if (/^[/\\\\]{2}/.test(k)) return false;\n  const m = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(k);\n  // no scheme: a path, unless a \":\" comes before any \"/\" (as written or decoded), which templ.URL refuses too (one rule everywhere)\n  if (!m) return !/^[^/]*:/.test(k) && !/^[^/]*:/.test(v);\n  const scheme = m[1]!.toLowerCase();\n  if (scheme === \"data\") return image && DATA_IMAGE.test(k.toLowerCase());\n  return URL_SCHEMES.includes(scheme);\n}\n\nconst str = (v: unknown): string => (typeof v === \"string\" ? v : typeof v === \"number\" ? String(v) : \"\");\n\n/** a URL attribute value: the value when it is allowed, else \"\" (another non-string is \"\"); undefined and null stay as they are (the attribute is left out) */\nexport function urlOf<T>(v: T, image = false): string | Extract<T, null | undefined> {\n  if (v === undefined || v === null) return v as Extract<T, null | undefined>;\n  const s = str(v);\n  return isSafeUrl(s, image) ? s : \"\";\n}\n\n/** the URLs of a srcset, candidate by candidate (the URL of a candidate runs to the first whitespace; trailing commas end it) */\nexport function srcsetUrls(v: string): string[] {\n  const s = decodeEntities(v), out: string[] = [];\n  let i = 0;\n  const ws = (c: string | undefined) => c !== undefined && /[\\t\\n\\f\\r ]/.test(c);\n  while (i < s.length) {\n    while (i < s.length && (ws(s[i]) || s[i] === \",\")) i++;\n    if (i >= s.length) break;\n    let j = i;\n    while (j < s.length && !ws(s[j])) j++;\n    let url = s.slice(i, j);\n    const cut = /,+$/.exec(url);\n    if (cut) { url = url.slice(0, -cut[0].length); out.push(url); i = j; continue; }\n    out.push(url);\n    let depth = 0;\n    while (j < s.length && (depth > 0 || s[j] !== \",\")) { if (s[j] === \"(\") depth++; else if (s[j] === \")\") depth = Math.max(0, depth - 1); j++; }\n    i = j + 1;\n  }\n  return out;\n}\n\n/** a srcset value: the value when every candidate URL is an allowed image URL, else \"\" */\nexport function srcsetOf<T>(v: T): string | Extract<T, null | undefined> {\n  if (v === undefined || v === null) return v as Extract<T, null | undefined>;\n  const s = str(v);\n  return srcsetUrls(s).every((u) => isSafeUrl(u, true)) ? s : \"\";\n}\n\n/** a value of an inline style declaration (the css op): kept when it is plain (numbers, words, %, #, +, -, ., commas and spaces), else \"\"; no url(), no ; */\nexport const cssValue = (v: unknown): string => { const s = str(v); return /^[-+.%#a-zA-Z0-9 ,]*$/.test(s) ? s : \"\"; };\n\n/** a style value: \"\" when it could load or run something (see the file comment), else the value */\nexport function styleOf(v: unknown): string {\n  const s = str(v), d = decodeEntities(s), k = compact(s).toLowerCase();\n  if (d.includes(\"\\\\\") || /expression\\(|javascript:|vbscript:|-moz-binding|behavior:/.test(k)) return \"\";\n  for (const m of d.matchAll(/url\\(([^)]*)\\)?/gi)) if (!isSafeUrl(m[1]!.replace(/^[ \\t\\n\\r\\f\\v]+|[ \\t\\n\\r\\f\\v]+$/g, \"\").replace(/^([\"'])([^]*)\\1$/, \"$2\"), true)) return \"\";\n  return s;\n}\n\n/** an attribute name that may be printed: a valid XML-ish name, not an event handler (on*) */\nexport const isSafeAttrName = (name: string): boolean => /^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(name) && !/^on/i.test(name);\n\n/** the attributes whose value is a URL (a srcset and a style have their own checks) */\nexport const URL_ATTRS: readonly string[] = [\"href\", \"src\", \"action\", \"formaction\", \"poster\", \"cite\", \"background\", \"data\", \"xlink:href\"];\n/** the URL attributes whose URL is an image (data:image/* allowed) */\nexport const IMAGE_ATTRS: readonly string[] = [\"src\", \"poster\", \"background\"];\n/** the value of attribute `name` as it may be printed: URL, srcset and style checked, any other value as it is */\nexport function attrValueOf(name: string, v: unknown): unknown {\n  const n = name.toLowerCase();\n  if (n === \"srcset\" || n === \"imagesrcset\") return srcsetOf(v);\n  if (n === \"style\") return styleOf(v);\n  if (URL_ATTRS.includes(n)) return urlOf(v, IMAGE_ATTRS.includes(n));\n  return v;\n}\n",
      "path": "utils/safe.ts",
      "target": "utils/safe.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Code generated by tagsgen. DO NOT EDIT.\r\n\r\nimport { isDevEnv } from \"./env\";\r\n\r\nexport const TagGroup = {\r\n  Layout: \"Layout\",\r\n  BoxAllowed: \"BoxAllowed\",\r\n  BlockText: \"BlockText\",\r\n  Inline: \"Inline\",\r\n  Heading: \"Heading\",\r\n  List: \"List\",\r\n  ListItem: \"ListItem\",\r\n  Form: \"Form\",\r\n  FormControl: \"FormControl\",\r\n  FormLabel: \"FormLabel\",\r\n  Table: \"Table\",\r\n  TableSection: \"TableSection\",\r\n  TableRow: \"TableRow\",\r\n  TableCell: \"TableCell\",\r\n  TableColumn: \"TableColumn\",\r\n  Media: \"Media\",\r\n  Disclosure: \"Disclosure\",\r\n  Container: \"Container\",\r\n  Stack: \"Stack\",\r\n  Group: \"Group\",\r\n  Text: \"Text\",\r\n} as const;\r\n\r\nexport type TagGroup = (typeof TagGroup)[keyof typeof TagGroup];\r\n\r\nconst layoutTags = new Set([\"div\", \"section\", \"article\", \"aside\", \"header\", \"footer\", \"main\", \"nav\", \"figure\", \"search\", \"hgroup\"]);\r\nconst boxAllowedTags = new Set([\"div\"]);\r\nconst blockTextTags = new Set([\"p\", \"blockquote\", \"figcaption\", \"address\", \"pre\"]);\r\nconst inlineTags = new Set([\"span\", \"em\", \"strong\", \"small\", \"abbr\", \"cite\", \"code\", \"kbd\", \"mark\", \"time\", \"data\", \"var\", \"samp\", \"sub\", \"sup\", \"b\", \"i\", \"u\", \"s\", \"q\", \"dfn\", \"bdo\", \"bdi\", \"ins\", \"del\"]);\r\nconst headingTags = new Set([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]);\r\nconst listTags = new Set([\"ul\", \"ol\", \"dl\", \"menu\"]);\r\nconst listItemTags = new Set([\"li\", \"dt\", \"dd\"]);\r\nconst formTags = new Set([\"form\", \"fieldset\"]);\r\nconst formControlTags = new Set([\"input\", \"textarea\", \"select\", \"button\", \"option\", \"optgroup\", \"datalist\", \"output\", \"meter\", \"progress\"]);\r\nconst formLabelTags = new Set([\"label\", \"legend\"]);\r\nconst tableTags = new Set([\"table\"]);\r\nconst tableSectionTags = new Set([\"thead\", \"tbody\", \"tfoot\"]);\r\nconst tableRowTags = new Set([\"tr\"]);\r\nconst tableCellTags = new Set([\"th\", \"td\"]);\r\nconst tableColumnTags = new Set([\"colgroup\", \"col\"]);\r\nconst mediaTags = new Set([\"img\", \"picture\", \"source\"]);\r\nconst disclosureTags = new Set([\"details\", \"summary\"]);\r\nconst containerTags = new Set([\"div\", \"main\", \"section\"]);\r\nconst stackTags = new Set([\"div\", \"ul\", \"ol\"]);\r\nconst groupTags = new Set([\"div\", \"fieldset\", \"dl\"]);\r\n\r\nfunction oneOf(tag: string, options: Set<string>): boolean {\r\n  return options.has(tag);\r\n}\r\n\r\nconst warnedTagFallbacks = new Set<string>();\r\n\r\nfunction warnTagFallback(tag: string, fallback: string, group: TagGroup): void {\r\n  if (!isDevEnv()) return;\r\n  const key = `${group}:${tag}:${fallback}`;\r\n  if (warnedTagFallbacks.has(key)) return;\r\n  warnedTagFallbacks.add(key);\r\n  console.warn(`[resolveTag] disallowed tag \"${tag}\" for group \"${group}\", fallback \"${fallback}\" used.`);\r\n}\r\n\r\nexport function isAllowedTag(tag: string, group: TagGroup): boolean {\r\n  const t = tag.trim().toLowerCase();\r\n  switch (group) {\r\n    case TagGroup.Layout:\r\n      return oneOf(t, layoutTags);\r\n    case TagGroup.BoxAllowed:\r\n      return oneOf(t, boxAllowedTags);\r\n    case TagGroup.BlockText:\r\n      return oneOf(t, blockTextTags);\r\n    case TagGroup.Inline:\r\n      return oneOf(t, inlineTags);\r\n    case TagGroup.Heading:\r\n      return oneOf(t, headingTags);\r\n    case TagGroup.List:\r\n      return oneOf(t, listTags);\r\n    case TagGroup.ListItem:\r\n      return oneOf(t, listItemTags);\r\n    case TagGroup.Form:\r\n      return oneOf(t, formTags);\r\n    case TagGroup.FormControl:\r\n      return oneOf(t, formControlTags);\r\n    case TagGroup.FormLabel:\r\n      return oneOf(t, formLabelTags);\r\n    case TagGroup.Table:\r\n      return oneOf(t, tableTags);\r\n    case TagGroup.TableSection:\r\n      return oneOf(t, tableSectionTags);\r\n    case TagGroup.TableRow:\r\n      return oneOf(t, tableRowTags);\r\n    case TagGroup.TableCell:\r\n      return oneOf(t, tableCellTags);\r\n    case TagGroup.TableColumn:\r\n      return oneOf(t, tableColumnTags);\r\n    case TagGroup.Media:\r\n      return oneOf(t, mediaTags);\r\n    case TagGroup.Disclosure:\r\n      return oneOf(t, disclosureTags);\r\n    case TagGroup.Container:\r\n      return oneOf(t, containerTags);\r\n    case TagGroup.Stack:\r\n      return oneOf(t, stackTags);\r\n    case TagGroup.Group:\r\n      return oneOf(t, groupTags);\r\n    case TagGroup.Text:\r\n      return blockTextTags.has(t) || inlineTags.has(t);\r\n    default:\r\n      return false;\r\n  }\r\n}\r\n\r\nexport function resolveTag(tag: string | undefined, fallback: string, group: TagGroup): string {\r\n  const t = tag?.trim().toLowerCase() ?? \"\";\r\n  if (!t) return fallback;\r\n  if (isAllowedTag(t, group)) return t;\r\n  warnTagFallback(t, fallback, group);\r\n  return fallback;\r\n}\r\n",
      "path": "utils/tags.ts",
      "target": "utils/tags.ts"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\nimport { cn } from \"./cn\";\nimport { isDevEnv } from \"./env\";\n\n/**\n * A shadcn/cva-style variant table, without the dependency (same idea as `cva` from class-variance-authority).\n *\n *   const badgeVariants = variants({\n *     base: \"inline-flex items-center\",\n *     variants: { size: { sm: \"h-5 px-2\", lg: \"h-8 px-3\" } },\n *     defaultVariants: { size: \"sm\" },\n *     compoundVariants: [{ size: \"lg\", shape: \"rounded\", class: \"rounded-lg\" }],\n *   });\n *   badgeVariants({ size: \"lg\" }); // \"inline-flex items-center h-8 px-3\"\n *\n * Classes come in this order: base, each variant in table order, then the matching compound variants.\n * tailwind-merge (`cn`) resolves conflicts, the later class wins. A compound value may list alternatives: \"32|lg\".\n */\nexport type VariantTable = {\n  base?: string;\n  variants: Record<string, Record<string, string>>;\n  defaultVariants: Record<string, string>;\n  compoundVariants?: Array<{ class: string } & Record<string, string>>;\n};\n\n/** the props a table accepts: one optional value per variant */\nexport type VariantSelection<T extends VariantTable> = {\n  [K in keyof T[\"variants\"]]?: (keyof T[\"variants\"][K] & string) | undefined;\n};\n\n/** a variant function: call it with the selected values, read `.table` for the types */\nexport type VariantFn<T extends VariantTable> = ((selection?: VariantSelection<T>) => string) & { table: T };\n\n/** the values of one variant of a table: `VariantKey<typeof badgeVariants, \"size\">` is `\"sm\" | \"lg\"` */\nexport type VariantKey<F extends { table: VariantTable }, K extends keyof F[\"table\"][\"variants\"]> = Exclude<\n  keyof F[\"table\"][\"variants\"][K] & string,\n  \"\"\n>;\n\nexport function variants<T extends VariantTable>(table: T): VariantFn<T> {\n  const pick = (selection: Record<string, string | undefined>, key: string): string =>\n    (selection[key] ?? \"\").trim() || (table.defaultVariants[key] ?? \"\").trim();\n  const fn = (selection: VariantSelection<T> = {}): string => {\n    const sel = selection as Record<string, string | undefined>;\n    const parts: string[] = [table.base ?? \"\"];\n    for (const [key, choices] of Object.entries(table.variants)) {\n      const choice = pick(sel, key);\n      const cls = choices[choice];\n      // a typo in development is an error; in production the unknown value is dropped\n      if (cls === undefined && isDevEnv()) throw new Error(`[variants] unknown value \"${choice}\" for \"${key}\"`);\n      parts.push(cls ?? \"\");\n    }\n    for (const compound of table.compoundVariants ?? []) {\n      const matches = Object.entries(compound).every(([k, want]) => k === \"class\" || want.split(\"|\").includes(pick(sel, k)));\n      if (matches) parts.push(compound.class);\n    }\n    return cn(...parts.map((p) => p.trim()).filter(Boolean));\n  };\n  return Object.assign(fn, { table });\n}\n",
      "path": "utils/variants.ts",
      "target": "utils/variants.ts"
    }
  ],
  "meta": {
    "category": "utils",
    "kind": "utils",
    "tags": [
      "react",
      "utils"
    ]
  },
  "name": "utils",
  "registryDependencies": [],
  "runtime": "react",
  "title": "Utils",
  "type": "registry:utils"
}
