{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "qr-code",
  "title": "QR Code",
  "description": "A from-scratch, zero-dependency QR code generator rendered as pure scalable SVG.",
  "files": [
    {
      "path": "registry/default/qr-code/qr-code.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type {\n  ECLevel,\n  QRCodeHandle,\n  QRDotStyle,\n  QRFinderStyle,\n  QRFinderTuple,\n  QRLogo,\n  QRLogoObject,\n  QRRenderOptions,\n} from \"./lib/types\";\nimport { encode } from \"./lib/encoder\";\nimport { buildRenderModel, serializeModel, resolveEcLevel } from \"./lib/svg-builder\";\nimport { matrixToDataURL } from \"./lib/export\";\n\nexport type QRCodeProps = Omit<\n  React.ComponentProps<\"svg\">,\n  \"children\" | \"ref\"\n> & {\n  /** The data to encode (URL, text, etc.). */\n  value: string;\n  /** Error correction level. Defaults to `\"M\"`; auto-raised when a logo is set. */\n  ecLevel?: ECLevel;\n  /** Module dot style. Defaults to `\"square\"`. */\n  dotStyle?: QRDotStyle;\n  /** Quiet-zone width in modules. Defaults to `4`. */\n  margin?: number;\n  /** Foreground (dark module) color. Defaults to `\"currentColor\"`. */\n  foreground?: string;\n  /** Background color. Defaults to `\"transparent\"`. */\n  background?: string;\n  /** Unified or per-corner `[topLeft, topRight, bottomLeft]` finder styling. */\n  finder?: QRFinderStyle | QRFinderTuple;\n  /** A center logo: an image descriptor or any React element. */\n  logo?: QRLogo;\n  /** Fraction of the symbol width occupied by the logo (clamped to ≤ 0.3). */\n  logoSize?: number;\n  /** Quiet area in modules knocked out around the logo. Defaults to `1`. */\n  logoPadding?: number;\n  /** Minimum QR version (1–40). */\n  minVersion?: number;\n  /** Rendered size in pixels. The `viewBox` stays in module units. */\n  size?: number | string;\n  /**\n   * Accessible name, rendered as an SVG `<title>`. Defaults to `value`. Pass\n   * `aria-hidden` instead to mark a decorative code.\n   */\n  title?: string;\n  /** Imperative handle exposing `toSVGString`, `toDataURL`, and `getMatrix`. */\n  ref?: React.Ref<QRCodeHandle>;\n};\n\nfunction isImageLogo(logo: QRLogo): logo is QRLogoObject {\n  return (\n    typeof logo === \"object\" &&\n    logo !== null &&\n    \"src\" in logo &&\n    typeof (logo as QRLogoObject).src === \"string\"\n  );\n}\n\n/**\n * Renders a QR code as pure, scalable SVG with customizable dot styles, finder\n * patterns, and an optional center logo.\n */\nfunction QRCode({\n  value,\n  ecLevel,\n  dotStyle,\n  margin,\n  foreground,\n  background,\n  finder,\n  logo,\n  logoSize,\n  logoPadding,\n  minVersion,\n  size,\n  title,\n  className,\n  ref,\n  ...props\n}: QRCodeProps) {\n  const imageLogo = logo != null && isImageLogo(logo);\n  const hasLogo = logo != null && logo !== false;\n  const elementLogo = hasLogo && !imageLogo;\n  const resolvedEcLevel = resolveEcLevel(ecLevel, hasLogo);\n  // A consumer marking the code decorative (`aria-hidden`) shouldn't get an\n  // auto-filled accessible name from `value`.\n  const isDecorative =\n    props[\"aria-hidden\"] === true || props[\"aria-hidden\"] === \"true\";\n  const accessibleTitle = isDecorative ? title : (title ?? value);\n\n  // Encoding is the expensive step (8-mask penalty scoring), so it is memoized\n  // separately on primitive deps — style and logo changes never re-encode.\n  const matrix = React.useMemo(\n    () => encode(value, { ecLevel: resolvedEcLevel, minVersion }),\n    [value, resolvedEcLevel, minVersion],\n  );\n\n  const { model, renderOptions } = React.useMemo(() => {\n    const logoObject: QRLogoObject | undefined = imageLogo\n      ? (logo as QRLogoObject)\n      : hasLogo\n        ? { src: \"\" }\n        : undefined;\n\n    const options: QRRenderOptions = {\n      dotStyle,\n      margin,\n      foreground,\n      background,\n      finder,\n      logoSize,\n      logoPadding,\n      logo: logoObject,\n      title: accessibleTitle,\n    };\n\n    return { renderOptions: options, model: buildRenderModel(matrix, options) };\n  }, [\n    matrix,\n    dotStyle,\n    margin,\n    foreground,\n    background,\n    finder,\n    logo,\n    imageLogo,\n    hasLogo,\n    logoSize,\n    logoPadding,\n    accessibleTitle,\n  ]);\n\n  React.useImperativeHandle(\n    ref,\n    (): QRCodeHandle => ({\n      toSVGString: () => serializeModel(model, size),\n      toDataURL: (options) => matrixToDataURL(matrix, renderOptions, options),\n      getMatrix: () => matrix,\n    }),\n    [model, matrix, renderOptions, size],\n  );\n\n  const dimension = size != null ? { width: size, height: size } : {};\n\n  return (\n    <svg\n      {...props}\n      {...dimension}\n      data-slot=\"qr-code\"\n      data-dot-style={dotStyle ?? \"square\"}\n      role={props.role ?? \"img\"}\n      viewBox={`0 0 ${model.viewBox} ${model.viewBox}`}\n      shapeRendering={model.crisp ? \"crispEdges\" : undefined}\n      className={cn(\"block\", className)}\n    >\n      {model.title ? <title>{model.title}</title> : null}\n      {model.background ? (\n        <rect width={model.viewBox} height={model.viewBox} fill={model.background} />\n      ) : null}\n      {model.dataPath ? <path d={model.dataPath} fill={model.foreground} /> : null}\n      {model.finders.map((f) => (\n        <React.Fragment key={f.id}>\n          <path d={f.outerPath} fill={f.outerColor} fillRule=\"evenodd\" />\n          <path d={f.innerPath} fill={f.innerColor} />\n        </React.Fragment>\n      ))}\n      {model.knockout ? (\n        <rect\n          x={model.knockout.x}\n          y={model.knockout.y}\n          width={model.knockout.size}\n          height={model.knockout.size}\n          fill={model.knockout.color}\n        />\n      ) : null}\n      {imageLogo && model.image ? (\n        <image\n          href={model.image.href}\n          x={model.image.x}\n          y={model.image.y}\n          width={model.image.width}\n          height={model.image.height}\n          preserveAspectRatio=\"xMidYMid meet\"\n          aria-label={model.image.alt}\n        />\n      ) : null}\n      {elementLogo && model.image ? (\n        <foreignObject\n          x={model.image.x}\n          y={model.image.y}\n          width={model.image.width}\n          height={model.image.height}\n        >\n          <div className=\"flex h-full w-full items-center justify-center\">\n            {logo as React.ReactNode}\n          </div>\n        </foreignObject>\n      ) : null}\n    </svg>\n  );\n}\n\nexport { QRCode };\nexport { encode } from \"./lib/encoder\";\nexport { toSVGString, toDataURL } from \"./lib/export\";\nexport type {\n  ECLevel,\n  QRMode,\n  QRMatrix,\n  QRDotStyle,\n  QRFinderStyle,\n  QRFinderTuple,\n  QRLogo,\n  QRLogoObject,\n  QRCodeHandle,\n  QRExportOptions,\n  QRDataURLType,\n  QRDataURLOptions,\n} from \"./lib/types\";\n",
      "type": "registry:ui",
      "target": "components/ui/cubby-ui/qr-code/qr-code.tsx"
    },
    {
      "path": "registry/default/qr-code/lib/bit-buffer.ts",
      "content": "/**\n * A growable buffer of bits, used to assemble the QR data bit stream before it\n * is packed into codewords.\n */\nexport class BitBuffer {\n  private readonly bits: number[] = [];\n\n  /** The number of bits currently stored. */\n  get length(): number {\n    return this.bits.length;\n  }\n\n  /**\n   * Appends the lower `len` bits of `value`, most-significant bit first.\n   */\n  append(value: number, len: number): void {\n    if (len < 0 || len > 31 || value >>> len !== 0) {\n      throw new RangeError(\"Value does not fit in the given bit length\");\n    }\n    for (let i = len - 1; i >= 0; i--) {\n      this.bits.push((value >>> i) & 1);\n    }\n  }\n\n  /** Reads the bit at `index`. */\n  get(index: number): number {\n    return this.bits[index];\n  }\n\n  /**\n   * Packs the bit stream into a byte array, most-significant bit first. The\n   * buffer length must be a multiple of 8.\n   */\n  toBytes(): Uint8Array {\n    if (this.length % 8 !== 0) {\n      throw new Error(\"Bit buffer is not byte-aligned\");\n    }\n    const out = new Uint8Array(this.length / 8);\n    for (let i = 0; i < this.length; i++) {\n      out[i >>> 3] |= this.bits[i] << (7 - (i & 7));\n    }\n    return out;\n  }\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/bit-buffer.ts"
    },
    {
      "path": "registry/default/qr-code/lib/encoder.ts",
      "content": "/**\n * Top-level QR encoding pipeline.\n *\n * Implements ISO/IEC 18004 for Numeric, Alphanumeric, and Byte (UTF-8) modes\n * across versions 1–40 and all four error correction levels, with automatic\n * mode/version/mask selection.\n */\n\nimport type { ECLevel, EncodeOptions, QRMatrix, QRMode } from \"./types\";\nimport { BitBuffer } from \"./bit-buffer\";\nimport { detectMode, makeSegment, type Segment } from \"./mode\";\nimport { computeDivisor, computeRemainder } from \"./reed-solomon\";\nimport { buildMatrix } from \"./matrix\";\nimport {\n  MODE_INDICATOR,\n  getCharCountBits,\n  getNumDataCodewords,\n  getNumRawDataModules,\n  getNumEcBlocks,\n  getEccCodewordsPerBlock,\n} from \"./tables\";\n\nconst EC_BOOST_ORDER: ECLevel[] = [\"M\", \"Q\", \"H\"];\n\n/** Total bits a segment occupies at a given version (headers + payload). */\nfunction getTotalBits(segment: Segment, version: number): number {\n  return 4 + getCharCountBits(segment.mode, version) + segment.dataBits;\n}\n\n/**\n * Encodes `data` into a QR matrix.\n *\n * @throws if the data does not fit in any version up to `maxVersion`, or if a\n * forced mode cannot represent the data.\n */\nexport function encode(data: string, options: EncodeOptions = {}): QRMatrix {\n  const requestedEcl: ECLevel = options.ecLevel ?? \"M\";\n  const minVersion = clampVersion(options.minVersion ?? 1);\n  const maxVersion = clampVersion(options.maxVersion ?? 40);\n  const boostEcl = options.boostEcl ?? true;\n\n  const mode: QRMode =\n    !options.mode || options.mode === \"auto\"\n      ? detectMode(data)\n      : options.mode;\n  const segment = makeSegment(data, mode);\n\n  // Select the smallest version (≥ minVersion) that fits at the requested EC.\n  let version = -1;\n  for (let v = minVersion; v <= maxVersion; v++) {\n    if (getTotalBits(segment, v) <= getNumDataCodewords(v, requestedEcl) * 8) {\n      version = v;\n      break;\n    }\n  }\n  if (version === -1) {\n    throw new Error(\n      \"Data is too long to encode in a QR code at the requested error correction level\",\n    );\n  }\n\n  // Boost the EC level for free if the chosen version has spare capacity.\n  let ecLevel = requestedEcl;\n  if (boostEcl) {\n    const usedBits = getTotalBits(segment, version);\n    for (const candidate of EC_BOOST_ORDER) {\n      if (usedBits <= getNumDataCodewords(version, candidate) * 8) {\n        ecLevel = candidate;\n      }\n    }\n  }\n\n  // Assemble the data bit stream.\n  const buffer = new BitBuffer();\n  buffer.append(MODE_INDICATOR[mode], 4);\n  buffer.append(segment.numChars, getCharCountBits(mode, version));\n  segment.appendData(buffer);\n\n  const capacityBits = getNumDataCodewords(version, ecLevel) * 8;\n  buffer.append(0, Math.min(4, capacityBits - buffer.length)); // Terminator.\n  buffer.append(0, (8 - (buffer.length % 8)) % 8); // Byte-align.\n\n  // Pad bytes alternate 0xEC / 0x11 until the capacity is filled.\n  for (let pad = 0xec; buffer.length < capacityBits; pad ^= 0xec ^ 0x11) {\n    buffer.append(pad, 8);\n  }\n\n  const dataCodewords = buffer.toBytes();\n  const allCodewords = addEccAndInterleave(dataCodewords, version, ecLevel);\n  const { modules, size, mask } = buildMatrix(version, ecLevel, allCodewords);\n\n  return { size, modules, version, ecLevel, mode, maskPattern: mask };\n}\n\n/**\n * Splits data codewords into blocks, appends Reed–Solomon error correction,\n * and interleaves the result per ISO/IEC 18004.\n */\nexport function addEccAndInterleave(\n  data: Uint8Array,\n  version: number,\n  ecLevel: ECLevel,\n): Uint8Array {\n  const numBlocks = getNumEcBlocks(version, ecLevel);\n  const blockEccLen = getEccCodewordsPerBlock(version, ecLevel);\n  const rawCodewords = Math.floor(getNumRawDataModules(version) / 8);\n  const numShortBlocks = numBlocks - (rawCodewords % numBlocks);\n  const shortBlockLen = Math.floor(rawCodewords / numBlocks);\n  const maxDataLen = shortBlockLen - blockEccLen + 1;\n\n  const dataParts: Uint8Array[] = [];\n  const eccParts: Uint8Array[] = [];\n  const divisor = computeDivisor(blockEccLen);\n  let offset = 0;\n  for (let i = 0; i < numBlocks; i++) {\n    const dataLen = maxDataLen - (i < numShortBlocks ? 1 : 0);\n    const part = data.slice(offset, offset + dataLen);\n    offset += dataLen;\n    dataParts.push(part);\n    eccParts.push(computeRemainder(part, divisor));\n  }\n\n  const result: number[] = [];\n  for (let i = 0; i < maxDataLen; i++) {\n    for (let j = 0; j < numBlocks; j++) {\n      if (i < dataParts[j].length) {\n        result.push(dataParts[j][i]);\n      }\n    }\n  }\n  for (let i = 0; i < blockEccLen; i++) {\n    for (let j = 0; j < numBlocks; j++) {\n      result.push(eccParts[j][i]);\n    }\n  }\n  return Uint8Array.from(result);\n}\n\nfunction clampVersion(version: number): number {\n  return Math.max(1, Math.min(40, Math.floor(version)));\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/encoder.ts"
    },
    {
      "path": "registry/default/qr-code/lib/export.ts",
      "content": "/**\n * Export helpers: a pure SSR-safe SVG string builder and a client-side data URL\n * generator (PNG/JPEG via an offscreen canvas, or a vector SVG data URL).\n */\n\nimport type {\n  QRMatrix,\n  QRExportOptions,\n  QRRenderOptions,\n  QRDataURLOptions,\n} from \"./types\";\nimport { encode } from \"./encoder\";\nimport { buildQRCodeSVG, resolveEcLevel } from \"./svg-builder\";\n\nconst DEFAULT_PIXEL_SIZE = 1024;\n\n/**\n * Encodes and renders a QR code to an SVG string. Pure and dependency-free, so\n * it is safe to call on the server (route handlers, RSC, Node scripts).\n */\nexport function toSVGString(options: QRExportOptions): string {\n  const hasLogo = Boolean(options.logo);\n  const matrix = encode(options.value, {\n    ecLevel: resolveEcLevel(options.ecLevel, hasLogo),\n    minVersion: options.minVersion,\n  });\n  return buildQRCodeSVG(\n    matrix,\n    { ...options, title: options.title ?? options.value },\n    options.size,\n  );\n}\n\n/** Builds a vector `data:image/svg+xml` URL from an SVG string. */\nexport function svgToDataURL(svg: string): string {\n  return `data:image/svg+xml,${encodeURIComponent(svg)}`;\n}\n\n/**\n * Renders an SVG string to a data URL. `\"svg\"` returns a vector data URL with\n * no canvas; `\"png\"`/`\"jpeg\"` rasterize via an offscreen canvas and therefore\n * require a browser environment.\n */\nexport async function rasterize(\n  svg: string,\n  options: { type?: \"png\" | \"jpeg\" | \"svg\"; quality?: number; pixelSize?: number } = {},\n): Promise<string> {\n  const type = options.type ?? \"png\";\n  if (type === \"svg\") {\n    return svgToDataURL(svg);\n  }\n\n  if (typeof window === \"undefined\" && typeof OffscreenCanvas === \"undefined\") {\n    throw new Error(\n      \"Rasterizing to PNG/JPEG requires a browser environment; use toSVGString() or type: \\\"svg\\\" on the server.\",\n    );\n  }\n\n  const pixelSize = options.pixelSize ?? DEFAULT_PIXEL_SIZE;\n  const blob = new Blob([svg], { type: \"image/svg+xml\" });\n  const url = URL.createObjectURL(blob);\n  try {\n    const image = await loadImage(url);\n    const { canvas, context } = createCanvas(pixelSize);\n    if (type === \"jpeg\") {\n      context.fillStyle = \"#ffffff\";\n      context.fillRect(0, 0, pixelSize, pixelSize);\n    }\n    context.drawImage(image, 0, 0, pixelSize, pixelSize);\n    return await canvasToDataURL(canvas, type, options.quality);\n  } catch (error) {\n    if (error instanceof DOMException && error.name === \"SecurityError\") {\n      throw new Error(\n        \"Cannot export this QR code to PNG/JPEG: the canvas was tainted by a \" +\n          'cross-origin image. Use a same-origin or data-URI logo, or export with type: \"svg\".',\n      );\n    }\n    throw error;\n  } finally {\n    URL.revokeObjectURL(url);\n  }\n}\n\n/**\n * Encodes, renders, and converts a QR code to a data URL in one call (client\n * side for raster formats).\n */\nexport async function toDataURL(\n  options: QRDataURLOptions & { value: string },\n): Promise<string> {\n  const type = options.type ?? \"png\";\n  const pixelSize = options.pixelSize ?? DEFAULT_PIXEL_SIZE;\n  const hasLogo = Boolean(options.logo);\n  const matrix = encode(options.value, {\n    ecLevel: resolveEcLevel(options.ecLevel, hasLogo),\n    minVersion: options.minVersion,\n  });\n  // Size the SVG to the target raster resolution for a crisp rasterization.\n  const size = type === \"svg\" ? options.size : pixelSize;\n  const renderOptions =\n    type === \"svg\"\n      ? (options as QRRenderOptions)\n      : await inlineCrossOriginLogo(options as QRRenderOptions);\n  const svg = buildQRCodeSVG(matrix, renderOptions, size);\n  return rasterize(svg, { type, quality: options.quality, pixelSize });\n}\n\n/** Convenience: convert an already-encoded matrix to a data URL. */\nexport async function matrixToDataURL(\n  matrix: QRMatrix,\n  renderOptions: QRRenderOptions,\n  options: QRDataURLOptions = {},\n): Promise<string> {\n  const type = options.type ?? \"png\";\n  const pixelSize = options.pixelSize ?? DEFAULT_PIXEL_SIZE;\n  const size = type === \"svg\" ? options.size : pixelSize;\n  const resolved =\n    type === \"svg\" ? renderOptions : await inlineCrossOriginLogo(renderOptions);\n  const svg = buildQRCodeSVG(matrix, resolved, size);\n  return rasterize(svg, { type, quality: options.quality, pixelSize });\n}\n\nconst INLINE_URL_RE = /^(data:|blob:)/i;\nconst ABSOLUTE_URL_RE = /^[a-z]+:\\/\\//i;\n\n/** Whether a logo `src` points to a different origin (and is not inlined). */\nfunction isCrossOriginUrl(src: string): boolean {\n  if (INLINE_URL_RE.test(src)) {\n    return false;\n  }\n  if (typeof location === \"undefined\") {\n    return ABSOLUTE_URL_RE.test(src);\n  }\n  try {\n    return new URL(src, location.href).origin !== location.origin;\n  } catch {\n    return false;\n  }\n}\n\n/**\n * Rasterizing an SVG that references a cross-origin image taints the canvas, so\n * `toDataURL` would throw a `SecurityError`. When the logo is cross-origin we\n * fetch it (which only succeeds if the host sends CORS headers) and inline it as\n * a data URI. If that fails, we throw a clear, actionable error.\n */\nasync function inlineCrossOriginLogo(\n  options: QRRenderOptions,\n): Promise<QRRenderOptions> {\n  const src = options.logo?.src;\n  if (!src || !isCrossOriginUrl(src)) {\n    return options;\n  }\n  try {\n    const response = await fetch(src, { mode: \"cors\" });\n    if (!response.ok) {\n      throw new Error(`status ${response.status}`);\n    }\n    const dataUrl = await blobToDataURL(await response.blob());\n    return { ...options, logo: { ...options.logo!, src: dataUrl } };\n  } catch {\n    throw new Error(\n      `Cannot rasterize a QR code with a cross-origin logo (\"${src}\") to PNG/JPEG — ` +\n        `the canvas would be tainted. Use a same-origin or data-URI logo, ensure the ` +\n        `image host sends CORS headers, or export with type: \"svg\".`,\n    );\n  }\n}\n\nasync function loadImage(url: string): Promise<CanvasImageSource> {\n  if (typeof Image !== \"undefined\") {\n    return new Promise((resolve, reject) => {\n      const img = new Image();\n      img.onload = () => resolve(img);\n      img.onerror = () => reject(new Error(\"Failed to load SVG for rasterization\"));\n      img.src = url;\n    });\n  }\n  const response = await fetch(url);\n  return createImageBitmap(await response.blob());\n}\n\nfunction createCanvas(size: number): {\n  canvas: HTMLCanvasElement | OffscreenCanvas;\n  context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;\n} {\n  if (typeof document !== \"undefined\") {\n    const canvas = document.createElement(\"canvas\");\n    canvas.width = size;\n    canvas.height = size;\n    const context = canvas.getContext(\"2d\");\n    if (!context) {\n      throw new Error(\"Could not acquire a 2D canvas context\");\n    }\n    return { canvas, context };\n  }\n  const canvas = new OffscreenCanvas(size, size);\n  const context = canvas.getContext(\"2d\");\n  if (!context) {\n    throw new Error(\"Could not acquire a 2D canvas context\");\n  }\n  return { canvas, context };\n}\n\nasync function canvasToDataURL(\n  canvas: HTMLCanvasElement | OffscreenCanvas,\n  type: \"png\" | \"jpeg\",\n  quality?: number,\n): Promise<string> {\n  const mime = type === \"png\" ? \"image/png\" : \"image/jpeg\";\n  if (canvas instanceof OffscreenCanvas) {\n    const blob = await canvas.convertToBlob({ type: mime, quality });\n    return blobToDataURL(blob);\n  }\n  return canvas.toDataURL(mime, quality);\n}\n\nfunction blobToDataURL(blob: Blob): Promise<string> {\n  return new Promise((resolve, reject) => {\n    const reader = new FileReader();\n    reader.onloadend = () => resolve(reader.result as string);\n    reader.onerror = () => reject(new Error(\"Failed to read rasterized blob\"));\n    reader.readAsDataURL(blob);\n  });\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/export.ts"
    },
    {
      "path": "registry/default/qr-code/lib/galois.ts",
      "content": "/**\n * Arithmetic in the Galois field GF(256) used by QR Reed–Solomon coding.\n *\n * The field is defined modulo the primitive polynomial\n * `x^8 + x^4 + x^3 + x^2 + 1` (`0x11D`), per ISO/IEC 18004. Multiplication is\n * implemented with the carry-less \"Russian peasant\" method, so no lookup\n * tables are required and the module stays tiny and tree-shakeable.\n */\n\n/** The QR primitive polynomial for GF(256), with the high bit dropped. */\nconst PRIMITIVE = 0x11d;\n\n/**\n * Multiplies two field elements in GF(256). Both operands and the result are\n * bytes (0–255).\n */\nexport function gfMultiply(x: number, y: number): number {\n  let z = 0;\n  for (let i = 7; i >= 0; i--) {\n    // Multiply `z` by 2, reducing modulo the primitive polynomial.\n    z = (z << 1) ^ ((z >>> 7) * PRIMITIVE);\n    // Conditionally add `x` when bit `i` of `y` is set.\n    z ^= ((y >>> i) & 1) * x;\n  }\n  return z & 0xff;\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/galois.ts"
    },
    {
      "path": "registry/default/qr-code/lib/index.ts",
      "content": "/**\n * Public entry point for the QR code encoder and renderer library.\n *\n * Every export is named (no default exports) so consumers and bundlers can\n * tree-shake unused parts of the library.\n */\n\nexport { encode, addEccAndInterleave } from \"./encoder\";\nexport {\n  buildRenderModel,\n  serializeModel,\n  buildQRCodeSVG,\n  resolveEcLevel,\n} from \"./svg-builder\";\nexport type {\n  QRRenderModel,\n  FinderRender,\n  KnockoutRect,\n  ImageRender,\n} from \"./svg-builder\";\nexport {\n  toSVGString,\n  toDataURL,\n  svgToDataURL,\n  rasterize,\n  matrixToDataURL,\n} from \"./export\";\n\nexport type {\n  ECLevel,\n  QRMode,\n  EncodeOptions,\n  QRMatrix,\n  QRDotStyle,\n  QRFinderStyle,\n  QRFinderTuple,\n  QRLogoObject,\n  QRLogo,\n  QRRenderOptions,\n  QRExportOptions,\n  QRDataURLType,\n  QRDataURLOptions,\n  QRCodeHandle,\n} from \"./types\";\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/index.ts"
    },
    {
      "path": "registry/default/qr-code/lib/mask.ts",
      "content": "/**\n * Data masking and penalty scoring per ISO/IEC 18004.\n *\n * `maskBit` returns whether a module at (x, y) is inverted by a given mask\n * pattern, and `computePenalty` scores a finished matrix using the four\n * standard penalty rules so the lowest-scoring mask can be chosen.\n */\n\nconst PENALTY_N1 = 3;\nconst PENALTY_N2 = 3;\nconst PENALTY_N3 = 40;\nconst PENALTY_N4 = 10;\n\n/** Returns whether mask pattern `mask` (0–7) inverts the module at (x, y). */\nexport function maskBit(mask: number, x: number, y: number): boolean {\n  switch (mask) {\n    case 0:\n      return (x + y) % 2 === 0;\n    case 1:\n      return y % 2 === 0;\n    case 2:\n      return x % 3 === 0;\n    case 3:\n      return (x + y) % 3 === 0;\n    case 4:\n      return (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;\n    case 5:\n      return ((x * y) % 2) + ((x * y) % 3) === 0;\n    case 6:\n      return (((x * y) % 2) + ((x * y) % 3)) % 2 === 0;\n    case 7:\n      return (((x + y) % 2) + ((x * y) % 3)) % 2 === 0;\n    default:\n      throw new RangeError(\"Mask pattern out of range\");\n  }\n}\n\n/** Scores a finished matrix; lower is better. */\nexport function computePenalty(modules: boolean[][], size: number): number {\n  let result = 0;\n\n  // Rule 1 (rows) and rule 3 (finder-like patterns) along each row.\n  for (let y = 0; y < size; y++) {\n    let runColor = false;\n    let runLength = 0;\n    const history = [0, 0, 0, 0, 0, 0, 0];\n    for (let x = 0; x < size; x++) {\n      if (modules[y][x] === runColor) {\n        runLength++;\n        if (runLength === 5) {\n          result += PENALTY_N1;\n        } else if (runLength > 5) {\n          result++;\n        }\n      } else {\n        addHistory(runLength, history, size);\n        if (!runColor) {\n          result += countFinderPatterns(history) * PENALTY_N3;\n        }\n        runColor = modules[y][x];\n        runLength = 1;\n      }\n    }\n    result += terminateAndCount(runColor, runLength, history, size) * PENALTY_N3;\n  }\n\n  // Rule 1 (columns) and rule 3 along each column.\n  for (let x = 0; x < size; x++) {\n    let runColor = false;\n    let runLength = 0;\n    const history = [0, 0, 0, 0, 0, 0, 0];\n    for (let y = 0; y < size; y++) {\n      if (modules[y][x] === runColor) {\n        runLength++;\n        if (runLength === 5) {\n          result += PENALTY_N1;\n        } else if (runLength > 5) {\n          result++;\n        }\n      } else {\n        addHistory(runLength, history, size);\n        if (!runColor) {\n          result += countFinderPatterns(history) * PENALTY_N3;\n        }\n        runColor = modules[y][x];\n        runLength = 1;\n      }\n    }\n    result += terminateAndCount(runColor, runLength, history, size) * PENALTY_N3;\n  }\n\n  // Rule 2: 2×2 blocks of the same color.\n  for (let y = 0; y < size - 1; y++) {\n    for (let x = 0; x < size - 1; x++) {\n      const color = modules[y][x];\n      if (\n        color === modules[y][x + 1] &&\n        color === modules[y + 1][x] &&\n        color === modules[y + 1][x + 1]\n      ) {\n        result += PENALTY_N2;\n      }\n    }\n  }\n\n  // Rule 4: deviation of dark module proportion from 50%.\n  let dark = 0;\n  for (let y = 0; y < size; y++) {\n    for (let x = 0; x < size; x++) {\n      if (modules[y][x]) {\n        dark++;\n      }\n    }\n  }\n  const total = size * size;\n  const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;\n  result += k * PENALTY_N4;\n\n  return result;\n}\n\n/** Counts finder-like 1:1:3:1:1 patterns recorded in a run history. */\nfunction countFinderPatterns(history: number[]): number {\n  const n = history[1];\n  const core =\n    n > 0 &&\n    history[2] === n &&\n    history[3] === n * 3 &&\n    history[4] === n &&\n    history[5] === n;\n  return (\n    (core && history[0] >= n * 4 && history[6] >= n ? 1 : 0) +\n    (core && history[6] >= n * 4 && history[0] >= n ? 1 : 0)\n  );\n}\n\n/** Finishes a line's run history (adding light borders) and counts patterns. */\nfunction terminateAndCount(\n  runColor: boolean,\n  runLength: number,\n  history: number[],\n  size: number,\n): number {\n  if (runColor) {\n    addHistory(runLength, history, size);\n    runLength = 0;\n  }\n  runLength += size;\n  addHistory(runLength, history, size);\n  return countFinderPatterns(history);\n}\n\n/** Pushes a run length into the 7-entry history, padding the first run. */\nfunction addHistory(runLength: number, history: number[], size: number): void {\n  if (history[0] === 0) {\n    runLength += size;\n  }\n  history.pop();\n  history.unshift(runLength);\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/mask.ts"
    },
    {
      "path": "registry/default/qr-code/lib/matrix.ts",
      "content": "/**\n * QR symbol matrix construction: function patterns, codeword placement,\n * format/version information, and mask selection.\n */\n\nimport type { ECLevel } from \"./types\";\nimport {\n  getSize,\n  getEcFormatBits,\n  getAlignmentPatternPositions,\n} from \"./tables\";\nimport { maskBit, computePenalty } from \"./mask\";\n\ninterface BuiltMatrix {\n  modules: boolean[][];\n  size: number;\n  mask: number;\n}\n\n/** Returns bit `i` of `value` as a boolean. */\nfunction getBit(value: number, i: number): boolean {\n  return ((value >>> i) & 1) !== 0;\n}\n\n/**\n * Builds the full module matrix for a version + EC level from its already\n * interleaved data-and-EC codewords. When `forcedMask` is omitted, the mask\n * with the lowest penalty score is selected automatically.\n */\nexport function buildMatrix(\n  version: number,\n  ecLevel: ECLevel,\n  codewords: Uint8Array,\n  forcedMask?: number,\n): BuiltMatrix {\n  const size = getSize(version);\n  const modules: boolean[][] = Array.from({ length: size }, () =>\n    new Array<boolean>(size).fill(false),\n  );\n  const isFunction: boolean[][] = Array.from({ length: size }, () =>\n    new Array<boolean>(size).fill(false),\n  );\n\n  const setFunctionModule = (x: number, y: number, isDark: boolean): void => {\n    modules[y][x] = isDark;\n    isFunction[y][x] = true;\n  };\n\n  const drawFinderPattern = (cx: number, cy: number): void => {\n    for (let dy = -4; dy <= 4; dy++) {\n      for (let dx = -4; dx <= 4; dx++) {\n        const dist = Math.max(Math.abs(dx), Math.abs(dy));\n        const x = cx + dx;\n        const y = cy + dy;\n        if (x >= 0 && x < size && y >= 0 && y < size) {\n          setFunctionModule(x, y, dist !== 2 && dist !== 4);\n        }\n      }\n    }\n  };\n\n  const drawAlignmentPattern = (cx: number, cy: number): void => {\n    for (let dy = -2; dy <= 2; dy++) {\n      for (let dx = -2; dx <= 2; dx++) {\n        setFunctionModule(cx + dx, cy + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);\n      }\n    }\n  };\n\n  const drawFormatBits = (mask: number): void => {\n    const data = (getEcFormatBits(ecLevel) << 3) | mask;\n    let rem = data;\n    for (let i = 0; i < 10; i++) {\n      rem = (rem << 1) ^ ((rem >>> 9) * 0x537);\n    }\n    const bits = ((data << 10) | rem) ^ 0x5412;\n\n    // First copy, around the top-left finder.\n    for (let i = 0; i <= 5; i++) {\n      setFunctionModule(8, i, getBit(bits, i));\n    }\n    setFunctionModule(8, 7, getBit(bits, 6));\n    setFunctionModule(8, 8, getBit(bits, 7));\n    setFunctionModule(7, 8, getBit(bits, 8));\n    for (let i = 9; i < 15; i++) {\n      setFunctionModule(14 - i, 8, getBit(bits, i));\n    }\n\n    // Second copy, split across the other two finders.\n    for (let i = 0; i < 8; i++) {\n      setFunctionModule(size - 1 - i, 8, getBit(bits, i));\n    }\n    for (let i = 8; i < 15; i++) {\n      setFunctionModule(8, size - 15 + i, getBit(bits, i));\n    }\n    setFunctionModule(8, size - 8, true); // Always-dark module.\n  };\n\n  const drawVersion = (): void => {\n    if (version < 7) {\n      return;\n    }\n    let rem = version;\n    for (let i = 0; i < 12; i++) {\n      rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n    }\n    const bits = (version << 12) | rem;\n    for (let i = 0; i < 18; i++) {\n      const bit = getBit(bits, i);\n      const a = size - 11 + (i % 3);\n      const b = Math.floor(i / 3);\n      setFunctionModule(a, b, bit);\n      setFunctionModule(b, a, bit);\n    }\n  };\n\n  // Timing patterns.\n  for (let i = 0; i < size; i++) {\n    setFunctionModule(6, i, i % 2 === 0);\n    setFunctionModule(i, 6, i % 2 === 0);\n  }\n\n  // Finder patterns (their light borders form the separators).\n  drawFinderPattern(3, 3);\n  drawFinderPattern(size - 4, 3);\n  drawFinderPattern(3, size - 4);\n\n  // Alignment patterns, skipping the three that overlap finder patterns.\n  const align = getAlignmentPatternPositions(version);\n  const numAlign = align.length;\n  for (let i = 0; i < numAlign; i++) {\n    for (let j = 0; j < numAlign; j++) {\n      const corner =\n        (i === 0 && j === 0) ||\n        (i === 0 && j === numAlign - 1) ||\n        (i === numAlign - 1 && j === 0);\n      if (!corner) {\n        drawAlignmentPattern(align[i], align[j]);\n      }\n    }\n  }\n\n  // Reserve the format and version areas.\n  drawFormatBits(0);\n  drawVersion();\n\n  // Place the data and EC codewords in zig-zag order.\n  let bitIndex = 0;\n  for (let right = size - 1; right >= 1; right -= 2) {\n    if (right === 6) {\n      right = 5;\n    }\n    for (let vert = 0; vert < size; vert++) {\n      for (let j = 0; j < 2; j++) {\n        const x = right - j;\n        const upward = ((right + 1) & 2) === 0;\n        const y = upward ? size - 1 - vert : vert;\n        if (!isFunction[y][x] && bitIndex < codewords.length * 8) {\n          modules[y][x] = getBit(codewords[bitIndex >>> 3], 7 - (bitIndex & 7));\n          bitIndex++;\n        }\n      }\n    }\n  }\n\n  const applyMask = (mask: number): void => {\n    for (let y = 0; y < size; y++) {\n      for (let x = 0; x < size; x++) {\n        if (!isFunction[y][x] && maskBit(mask, x, y)) {\n          modules[y][x] = !modules[y][x];\n        }\n      }\n    }\n  };\n\n  // Select the lowest-penalty mask unless one is forced.\n  let mask = forcedMask;\n  if (mask === undefined) {\n    let minPenalty = Infinity;\n    for (let m = 0; m < 8; m++) {\n      applyMask(m);\n      drawFormatBits(m);\n      const penalty = computePenalty(modules, size);\n      if (penalty < minPenalty) {\n        mask = m;\n        minPenalty = penalty;\n      }\n      applyMask(m); // Undo (XOR is self-inverse).\n    }\n  }\n  mask = mask ?? 0;\n\n  applyMask(mask);\n  drawFormatBits(mask);\n\n  return { modules, size, mask };\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/matrix.ts"
    },
    {
      "path": "registry/default/qr-code/lib/mode.ts",
      "content": "/**\n * Mode detection and per-mode data segment encoding.\n *\n * Supports Numeric, Alphanumeric, and Byte (UTF-8) modes. A {@link Segment}\n * carries everything needed to emit its bit stream for a given version.\n */\n\nimport type { QRMode } from \"./types\";\nimport type { BitBuffer } from \"./bit-buffer\";\nimport { ALPHANUMERIC_CHARSET } from \"./tables\";\n\nconst NUMERIC_RE = /^[0-9]*$/;\nconst ALPHANUMERIC_RE = /^[0-9A-Z $%*+\\-./:]*$/;\n\n/** Char → value map for alphanumeric mode. */\nconst ALPHANUMERIC_MAP: Map<string, number> = new Map(\n  Array.from(ALPHANUMERIC_CHARSET, (char, value) => [char, value]),\n);\n\n/** A single encoded data segment. */\nexport interface Segment {\n  readonly mode: QRMode;\n  /** Character count used by the char-count indicator. */\n  readonly numChars: number;\n  /** Length, in bits, of the payload (excluding mode + count headers). */\n  readonly dataBits: number;\n  /** Appends the payload bits to a buffer. */\n  appendData(buffer: BitBuffer): void;\n}\n\n/** Selects the most compact mode that can represent `text`. */\nexport function detectMode(text: string): QRMode {\n  if (NUMERIC_RE.test(text)) {\n    return \"numeric\";\n  }\n  if (ALPHANUMERIC_RE.test(text)) {\n    return \"alphanumeric\";\n  }\n  return \"byte\";\n}\n\n/** Builds a segment for `text` in the given mode. */\nexport function makeSegment(text: string, mode: QRMode): Segment {\n  switch (mode) {\n    case \"numeric\":\n      return makeNumeric(text);\n    case \"alphanumeric\":\n      return makeAlphanumeric(text);\n    case \"byte\":\n      return makeBytes(text);\n  }\n}\n\nfunction makeNumeric(text: string): Segment {\n  if (!NUMERIC_RE.test(text)) {\n    throw new Error(\"Text contains non-numeric characters\");\n  }\n  const n = text.length;\n  const dataBits = Math.floor(n / 3) * 10 + (n % 3 === 0 ? 0 : n % 3 === 1 ? 4 : 7);\n  return {\n    mode: \"numeric\",\n    numChars: n,\n    dataBits,\n    appendData(buffer) {\n      for (let i = 0; i < n; i += 3) {\n        const chunk = text.slice(i, i + 3);\n        buffer.append(Number.parseInt(chunk, 10), chunk.length * 3 + 1);\n      }\n    },\n  };\n}\n\nfunction makeAlphanumeric(text: string): Segment {\n  const n = text.length;\n  const dataBits = Math.floor(n / 2) * 11 + (n % 2) * 6;\n  return {\n    mode: \"alphanumeric\",\n    numChars: n,\n    dataBits,\n    appendData(buffer) {\n      for (let i = 0; i < n; i += 2) {\n        const first = ALPHANUMERIC_MAP.get(text[i]);\n        if (first === undefined) {\n          throw new Error(\"Text contains non-alphanumeric characters\");\n        }\n        if (i + 1 < n) {\n          const second = ALPHANUMERIC_MAP.get(text[i + 1]);\n          if (second === undefined) {\n            throw new Error(\"Text contains non-alphanumeric characters\");\n          }\n          buffer.append(first * 45 + second, 11);\n        } else {\n          buffer.append(first, 6);\n        }\n      }\n    },\n  };\n}\n\nfunction makeBytes(text: string): Segment {\n  const bytes = new TextEncoder().encode(text);\n  return {\n    mode: \"byte\",\n    numChars: bytes.length,\n    dataBits: bytes.length * 8,\n    appendData(buffer) {\n      for (const byte of bytes) {\n        buffer.append(byte, 8);\n      }\n    },\n  };\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/mode.ts"
    },
    {
      "path": "registry/default/qr-code/lib/path-builders.ts",
      "content": "/**\n * SVG path (`d` attribute) builders for QR modules and finder patterns.\n *\n * All coordinates are in module units. The same builders are used by the React\n * component and the standalone string serializer, so the rendered DOM and\n * `toSVGString()` output are identical.\n */\n\nimport type { QRDotStyle } from \"./types\";\nimport { cornerRadii } from \"./rounded\";\n\n/** Corner radius (in module units) used by the rounded dot style. */\nconst DOT_RADIUS = 0.5;\n/** Inscribed radius used by the circle dot style. */\nconst DOT_CIRCLE_RADIUS = 0.5;\n\n/** Formats a number compactly: up to 3 decimals, no trailing zeros. */\nfunction f(n: number): string {\n  return Number(n.toFixed(3)).toString();\n}\n\n/** A full-cell square subpath at module (x, y), offset by `o`. */\nfunction squareCell(x: number, y: number, o: number): string {\n  const px = x + o;\n  const py = y + o;\n  return `M${f(px)} ${f(py)}h1v1h-1Z`;\n}\n\n/** A circle inscribed in the cell at module (x, y), offset by `o`. */\nfunction circleCell(x: number, y: number, o: number): string {\n  const cx = x + o + 0.5;\n  const cy = y + o + 0.5;\n  const r = DOT_CIRCLE_RADIUS;\n  return `M${f(cx - r)} ${f(cy)}a${f(r)} ${f(r)} 0 1 0 ${f(r * 2)} 0a${f(r)} ${f(r)} 0 1 0 ${f(-r * 2)} 0Z`;\n}\n\n/** A snake-rounded subpath at module (x, y), offset by `o`. */\nfunction roundedCell(\n  modules: boolean[][],\n  x: number,\n  y: number,\n  o: number,\n): string {\n  const r = DOT_RADIUS;\n  const { topLeft, topRight, bottomRight, bottomLeft } = cornerRadii(modules, x, y);\n  const px = x + o;\n  const py = y + o;\n  const x0 = px;\n  const y0 = py;\n  const x1 = px + 1;\n  const y1 = py + 1;\n\n  let d = `M${f(x0 + (topLeft ? r : 0))} ${f(y0)}`;\n  d += `H${f(x1 - (topRight ? r : 0))}`;\n  if (topRight) d += `A${f(r)} ${f(r)} 0 0 1 ${f(x1)} ${f(y0 + r)}`;\n  d += `V${f(y1 - (bottomRight ? r : 0))}`;\n  if (bottomRight) d += `A${f(r)} ${f(r)} 0 0 1 ${f(x1 - r)} ${f(y1)}`;\n  d += `H${f(x0 + (bottomLeft ? r : 0))}`;\n  if (bottomLeft) d += `A${f(r)} ${f(r)} 0 0 1 ${f(x0)} ${f(y1 - r)}`;\n  d += `V${f(y0 + (topLeft ? r : 0))}`;\n  if (topLeft) d += `A${f(r)} ${f(r)} 0 0 1 ${f(x0 + r)} ${f(y0)}`;\n  d += \"Z\";\n  return d;\n}\n\n/** Whether module (x, y) lies within one of the three finder pattern squares. */\nexport function isFinderModule(x: number, y: number, size: number): boolean {\n  const inTopLeft = x <= 6 && y <= 6;\n  const inTopRight = x >= size - 7 && y <= 6;\n  const inBottomLeft = x <= 6 && y >= size - 7;\n  return inTopLeft || inTopRight || inBottomLeft;\n}\n\n/**\n * Builds the merged data-module path for all dark modules, excluding the finder\n * patterns (which are rendered separately) and any cleared (knockout) modules.\n */\nexport function buildDataPath(\n  modules: boolean[][],\n  size: number,\n  offset: number,\n  style: QRDotStyle,\n): string {\n  let d = \"\";\n  for (let y = 0; y < size; y++) {\n    for (let x = 0; x < size; x++) {\n      if (!modules[y][x] || isFinderModule(x, y, size)) {\n        continue;\n      }\n      if (style === \"circle\") {\n        d += circleCell(x, y, offset);\n      } else if (style === \"rounded\") {\n        d += roundedCell(modules, x, y, offset);\n      } else {\n        d += squareCell(x, y, offset);\n      }\n    }\n  }\n  return d;\n}\n\n/** A rectangle subpath, wound clockwise or counter-clockwise. */\nfunction rectPath(\n  x: number,\n  y: number,\n  w: number,\n  h: number,\n  clockwise: boolean,\n): string {\n  return clockwise\n    ? `M${f(x)} ${f(y)}h${f(w)}v${f(h)}h${f(-w)}Z`\n    : `M${f(x)} ${f(y)}v${f(h)}h${f(w)}v${f(-h)}Z`;\n}\n\n/** A rounded-rectangle subpath, wound clockwise or counter-clockwise. */\nfunction roundRectPath(\n  x: number,\n  y: number,\n  w: number,\n  h: number,\n  radius: number,\n  clockwise: boolean,\n): string {\n  const r = Math.min(radius, w / 2, h / 2);\n  if (clockwise) {\n    return (\n      `M${f(x + r)} ${f(y)}H${f(x + w - r)}A${f(r)} ${f(r)} 0 0 1 ${f(x + w)} ${f(y + r)}` +\n      `V${f(y + h - r)}A${f(r)} ${f(r)} 0 0 1 ${f(x + w - r)} ${f(y + h)}` +\n      `H${f(x + r)}A${f(r)} ${f(r)} 0 0 1 ${f(x)} ${f(y + h - r)}` +\n      `V${f(y + r)}A${f(r)} ${f(r)} 0 0 1 ${f(x + r)} ${f(y)}Z`\n    );\n  }\n  return (\n    `M${f(x + r)} ${f(y)}A${f(r)} ${f(r)} 0 0 0 ${f(x)} ${f(y + r)}` +\n    `V${f(y + h - r)}A${f(r)} ${f(r)} 0 0 0 ${f(x + r)} ${f(y + h)}` +\n    `H${f(x + w - r)}A${f(r)} ${f(r)} 0 0 0 ${f(x + w)} ${f(y + h - r)}` +\n    `V${f(y + r)}A${f(r)} ${f(r)} 0 0 0 ${f(x + w - r)} ${f(y)}Z`\n  );\n}\n\n/** A ring (square with a concentric square hole) as an even-odd path. */\nfunction ringPath(\n  x: number,\n  y: number,\n  outer: number,\n  thickness: number,\n  style: QRDotStyle,\n): string {\n  const inner = outer - thickness * 2;\n  const ix = x + thickness;\n  const iy = y + thickness;\n  if (style === \"circle\") {\n    const oc = circleAt(x + outer / 2, y + outer / 2, outer / 2, true);\n    const ic = circleAt(x + outer / 2, y + outer / 2, inner / 2, false);\n    return oc + ic;\n  }\n  if (style === \"rounded\") {\n    return (\n      roundRectPath(x, y, outer, outer, outer / 3.5, true) +\n      roundRectPath(ix, iy, inner, inner, inner / 3, false)\n    );\n  }\n  return rectPath(x, y, outer, outer, true) + rectPath(ix, iy, inner, inner, false);\n}\n\n/** A circle path centered at (cx, cy), wound clockwise or counter-clockwise. */\nfunction circleAt(cx: number, cy: number, r: number, clockwise: boolean): string {\n  const sweep = clockwise ? 1 : 0;\n  return (\n    `M${f(cx - r)} ${f(cy)}a${f(r)} ${f(r)} 0 1 ${sweep} ${f(r * 2)} 0` +\n    `a${f(r)} ${f(r)} 0 1 ${sweep} ${f(-r * 2)} 0Z`\n  );\n}\n\n/** A filled shape (eye) of the given style filling a `n×n` cell at (x, y). */\nfunction fillShape(x: number, y: number, n: number, style: QRDotStyle): string {\n  if (style === \"circle\") {\n    return circleAt(x + n / 2, y + n / 2, n / 2, true);\n  }\n  if (style === \"rounded\") {\n    return roundRectPath(x, y, n, n, n / 3, true);\n  }\n  return rectPath(x, y, n, n, true);\n}\n\n/** Top-left module coordinates of each finder's 7×7 square. */\nexport function finderOrigins(size: number): Array<[number, number]> {\n  return [\n    [0, 0],\n    [size - 7, 0],\n    [0, size - 7],\n  ];\n}\n\n/** Builds the outer-ring path for a finder at origin (fx, fy), offset by `o`. */\nexport function buildFinderOuter(\n  fx: number,\n  fy: number,\n  offset: number,\n  style: QRDotStyle,\n): string {\n  return ringPath(fx + offset, fy + offset, 7, 1, style);\n}\n\n/** Builds the inner-eye path for a finder at origin (fx, fy), offset by `o`. */\nexport function buildFinderInner(\n  fx: number,\n  fy: number,\n  offset: number,\n  style: QRDotStyle,\n): string {\n  return fillShape(fx + offset + 2, fy + offset + 2, 3, style);\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/path-builders.ts"
    },
    {
      "path": "registry/default/qr-code/lib/reed-solomon.ts",
      "content": "/**\n * Reed–Solomon error correction over GF(256) for QR codes.\n *\n * `computeDivisor` builds the generator polynomial of a given degree, and\n * `computeRemainder` divides a block of data codewords by it to produce the\n * error correction codewords.\n */\n\nimport { gfMultiply } from \"./galois\";\n\n/**\n * Computes the Reed–Solomon generator polynomial divisor for the given number\n * of error correction codewords (`degree`). Coefficients are returned highest\n * power first, excluding the leading term (which is always 1).\n */\nexport function computeDivisor(degree: number): Uint8Array {\n  if (degree < 1 || degree > 255) {\n    throw new RangeError(\"Reed–Solomon degree out of range\");\n  }\n  // Start with the monomial \"1\" (i.e. the polynomial 0*x^(n-1) + … + 1).\n  const result = new Uint8Array(degree);\n  result[degree - 1] = 1;\n\n  // Repeatedly multiply by (x - r^i), where r = 0x02 is a field generator.\n  let root = 1;\n  for (let i = 0; i < degree; i++) {\n    for (let j = 0; j < result.length; j++) {\n      result[j] = gfMultiply(result[j], root);\n      if (j + 1 < result.length) {\n        result[j] ^= result[j + 1];\n      }\n    }\n    root = gfMultiply(root, 0x02);\n  }\n  return result;\n}\n\n/**\n * Computes the `divisor.length` error correction codewords for the given data\n * block by polynomial division over GF(256).\n */\nexport function computeRemainder(\n  data: ArrayLike<number>,\n  divisor: Uint8Array,\n): Uint8Array {\n  const result = new Uint8Array(divisor.length);\n  for (let i = 0; i < data.length; i++) {\n    const factor = data[i] ^ result[0];\n    result.copyWithin(0, 1);\n    result[result.length - 1] = 0;\n    for (let j = 0; j < divisor.length; j++) {\n      result[j] ^= gfMultiply(divisor[j], factor);\n    }\n  }\n  return result;\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/reed-solomon.ts"
    },
    {
      "path": "registry/default/qr-code/lib/rounded.ts",
      "content": "/**\n * Neighbor-aware corner rounding for the \"rounded\" (snake-connected) dot style.\n *\n * A module corner is rounded only when both of the edges meeting at that corner\n * face empty cells. Adjacent filled modules therefore keep their shared edges\n * flat, so runs of modules merge into a continuous rounded \"snake\", while\n * isolated modules become fully rounded dots.\n */\n\n/** Which of a module's four corners should be rounded. */\nexport interface CornerRadii {\n  topLeft: boolean;\n  topRight: boolean;\n  bottomRight: boolean;\n  bottomLeft: boolean;\n}\n\n/** Reads a module, treating out-of-bounds cells as empty. */\nfunction isFilled(modules: boolean[][], x: number, y: number): boolean {\n  return (\n    y >= 0 &&\n    y < modules.length &&\n    x >= 0 &&\n    x < modules[y].length &&\n    modules[y][x]\n  );\n}\n\n/** Computes which corners of the module at (x, y) are convex and rounded. */\nexport function cornerRadii(\n  modules: boolean[][],\n  x: number,\n  y: number,\n): CornerRadii {\n  const top = isFilled(modules, x, y - 1);\n  const bottom = isFilled(modules, x, y + 1);\n  const left = isFilled(modules, x - 1, y);\n  const right = isFilled(modules, x + 1, y);\n  return {\n    topLeft: !top && !left,\n    topRight: !top && !right,\n    bottomRight: !bottom && !right,\n    bottomLeft: !bottom && !left,\n  };\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/rounded.ts"
    },
    {
      "path": "registry/default/qr-code/lib/svg-builder.ts",
      "content": "/**\n * The single source of truth for QR SVG geometry.\n *\n * `buildRenderModel` resolves all render options into a plain data structure of\n * path strings and colors. The React component renders this model as JSX while\n * `buildQRCodeSVG` serializes the same model to a string, guaranteeing the\n * on-screen output and `toSVGString()` are identical.\n */\n\nimport type {\n  ECLevel,\n  QRMatrix,\n  QRRenderOptions,\n  QRDotStyle,\n  QRFinderStyle,\n  QRFinderTuple,\n} from \"./types\";\nimport {\n  buildDataPath,\n  buildFinderOuter,\n  buildFinderInner,\n  finderOrigins,\n} from \"./path-builders\";\n\nconst DEFAULT_MARGIN = 4;\nconst DEFAULT_FOREGROUND = \"currentColor\";\nconst DEFAULT_DOT_STYLE: QRDotStyle = \"square\";\nconst DEFAULT_LOGO_SIZE = 0.22;\nconst MAX_LOGO_SIZE = 0.3;\nconst DEFAULT_LOGO_PADDING = 1;\n/** Corner ids in `finderOrigins` order: top-left, top-right, bottom-left. */\nconst FINDER_IDS = [\"tl\", \"tr\", \"bl\"] as const;\n\n/** A resolved finder pattern: outer ring and inner eye, with paths and colors. */\nexport interface FinderRender {\n  /** Corner identity (top-left, top-right, bottom-left) — a stable React key. */\n  id: \"tl\" | \"tr\" | \"bl\";\n  outerPath: string;\n  outerColor: string;\n  innerPath: string;\n  innerColor: string;\n}\n\n/** A rectangle in viewBox units. */\nexport interface KnockoutRect {\n  x: number;\n  y: number;\n  size: number;\n  color: string;\n}\n\n/** An embedded image logo in viewBox units. */\nexport interface ImageRender {\n  href: string;\n  x: number;\n  y: number;\n  width: number;\n  height: number;\n  alt?: string;\n}\n\n/** Fully resolved geometry + colors ready to render or serialize. */\nexport interface QRRenderModel {\n  /** Number of modules per side. */\n  moduleCount: number;\n  /** ViewBox side length (`moduleCount + 2 * margin`). */\n  viewBox: number;\n  margin: number;\n  foreground: string;\n  background?: string;\n  dataPath: string;\n  finders: FinderRender[];\n  knockout?: KnockoutRect;\n  image?: ImageRender;\n  /** Accessible name, rendered as an SVG `<title>`. */\n  title?: string;\n  /** Whether every shape is axis-aligned (enables `crispEdges` rendering). */\n  crisp: boolean;\n}\n\nconst EC_RANK: Record<ECLevel, number> = { L: 0, M: 1, Q: 2, H: 3 };\n\n/**\n * Resolves the effective error correction level. When a logo is present and the\n * caller has not explicitly requested at least `\"Q\"`, the level is raised to\n * `\"H\"` so the symbol stays scannable despite the cleared center.\n */\nexport function resolveEcLevel(\n  ecLevel: ECLevel | undefined,\n  hasLogo: boolean,\n): ECLevel {\n  if (hasLogo && (ecLevel === undefined || EC_RANK[ecLevel] < EC_RANK.Q)) {\n    return \"H\";\n  }\n  return ecLevel ?? \"M\";\n}\n\nfunction normalizeFinders(\n  finder: QRFinderStyle | QRFinderTuple | undefined,\n): QRFinderTuple {\n  if (Array.isArray(finder)) {\n    return finder;\n  }\n  const single = finder ?? {};\n  return [single, single, single];\n}\n\nfunction resolveFinder(\n  style: QRFinderStyle,\n  dotStyle: QRDotStyle,\n  foreground: string,\n): { outerStyle: QRDotStyle; outerColor: string; innerStyle: QRDotStyle; innerColor: string } {\n  const outerStyle = style.outerStyle ?? dotStyle;\n  const outerColor = style.outerColor ?? foreground;\n  return {\n    outerStyle,\n    outerColor,\n    innerStyle: style.innerStyle ?? outerStyle,\n    innerColor: style.innerColor ?? outerColor,\n  };\n}\n\n/** Resolves render options against an encoded matrix into a {@link QRRenderModel}. */\nexport function buildRenderModel(\n  matrix: QRMatrix,\n  options: QRRenderOptions = {},\n): QRRenderModel {\n  const margin = Math.max(0, options.margin ?? DEFAULT_MARGIN);\n  const foreground = options.foreground ?? DEFAULT_FOREGROUND;\n  const background =\n    options.background && options.background !== \"transparent\"\n      ? options.background\n      : undefined;\n  const dotStyle = options.dotStyle ?? DEFAULT_DOT_STYLE;\n  const moduleCount = matrix.size;\n  const viewBox = moduleCount + margin * 2;\n\n  // Clone the matrix so logo knockout does not mutate the caller's data.\n  const modules = matrix.modules.map((row) => row.slice());\n\n  let knockout: KnockoutRect | undefined;\n  let image: ImageRender | undefined;\n  if (options.logo) {\n    const logoSize = Math.min(MAX_LOGO_SIZE, Math.max(0, options.logoSize ?? DEFAULT_LOGO_SIZE));\n    const padding = Math.max(0, options.logoPadding ?? DEFAULT_LOGO_PADDING);\n    const imageModules = moduleCount * logoSize;\n    const knockModules = imageModules + padding * 2;\n    const center = moduleCount / 2;\n\n    // Clear modules whose centers fall inside the knockout box.\n    const half = knockModules / 2;\n    const lo = center - half;\n    const hi = center + half;\n    for (let y = 0; y < moduleCount; y++) {\n      for (let x = 0; x < moduleCount; x++) {\n        const cx = x + 0.5;\n        const cy = y + 0.5;\n        if (cx >= lo && cx <= hi && cy >= lo && cy <= hi) {\n          modules[y][x] = false;\n        }\n      }\n    }\n\n    knockout = {\n      x: margin + center - half,\n      y: margin + center - half,\n      size: knockModules,\n      color: background ?? \"#ffffff\",\n    };\n\n    const w = options.logo.width ?? imageModules;\n    const h = options.logo.height ?? imageModules;\n    image = {\n      href: options.logo.src,\n      x: margin + center - w / 2,\n      y: margin + center - h / 2,\n      width: w,\n      height: h,\n      alt: options.logo.alt,\n    };\n  }\n\n  const dataPath = buildDataPath(modules, moduleCount, margin, dotStyle);\n\n  const finderStyles = normalizeFinders(options.finder);\n  const origins = finderOrigins(moduleCount);\n  let crisp = dotStyle === \"square\";\n  const finders: FinderRender[] = origins.map(([fx, fy], i) => {\n    const resolved = resolveFinder(finderStyles[i] ?? {}, dotStyle, foreground);\n    if (resolved.outerStyle !== \"square\" || resolved.innerStyle !== \"square\") {\n      crisp = false;\n    }\n    return {\n      id: FINDER_IDS[i],\n      outerPath: buildFinderOuter(fx, fy, margin, resolved.outerStyle),\n      outerColor: resolved.outerColor,\n      innerPath: buildFinderInner(fx, fy, margin, resolved.innerStyle),\n      innerColor: resolved.innerColor,\n    };\n  });\n\n  return {\n    moduleCount,\n    viewBox,\n    margin,\n    foreground,\n    background,\n    dataPath,\n    finders,\n    knockout,\n    image,\n    title: options.title,\n    crisp,\n  };\n}\n\n/** Escapes a string for safe use inside a double-quoted SVG attribute. */\nfunction escapeAttr(value: string): string {\n  return value\n    .replace(/&/g, \"&amp;\")\n    .replace(/\"/g, \"&quot;\")\n    .replace(/</g, \"&lt;\")\n    .replace(/>/g, \"&gt;\");\n}\n\n/** Serializes a {@link QRRenderModel} to an SVG string. */\nexport function serializeModel(\n  model: QRRenderModel,\n  size?: number | string,\n): string {\n  const vb = model.viewBox;\n  const dimension =\n    size === undefined\n      ? \"\"\n      : ` width=\"${escapeAttr(String(size))}\" height=\"${escapeAttr(String(size))}\"`;\n\n  const shapeRendering = model.crisp ? ` shape-rendering=\"crispEdges\"` : \"\";\n  let svg =\n    `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 ${vb} ${vb}\"${dimension}${shapeRendering} role=\"img\">`;\n\n  if (model.title) {\n    svg += `<title>${escapeAttr(model.title)}</title>`;\n  }\n  if (model.background) {\n    svg += `<rect width=\"${vb}\" height=\"${vb}\" fill=\"${escapeAttr(model.background)}\"/>`;\n  }\n  if (model.dataPath) {\n    svg += `<path d=\"${model.dataPath}\" fill=\"${escapeAttr(model.foreground)}\"/>`;\n  }\n  for (const finder of model.finders) {\n    svg += `<path d=\"${finder.outerPath}\" fill=\"${escapeAttr(finder.outerColor)}\" fill-rule=\"evenodd\"/>`;\n    svg += `<path d=\"${finder.innerPath}\" fill=\"${escapeAttr(finder.innerColor)}\"/>`;\n  }\n  if (model.knockout) {\n    const k = model.knockout;\n    svg += `<rect x=\"${k.x}\" y=\"${k.y}\" width=\"${k.size}\" height=\"${k.size}\" fill=\"${escapeAttr(k.color)}\"/>`;\n  }\n  // Element logos carry no `href` (they render as a live <foreignObject> and\n  // can't be serialized), so skip emitting an empty <image> on export.\n  if (model.image && model.image.href) {\n    const img = model.image;\n    const alt = img.alt ? ` aria-label=\"${escapeAttr(img.alt)}\"` : \"\";\n    svg +=\n      `<image href=\"${escapeAttr(img.href)}\" x=\"${img.x}\" y=\"${img.y}\" ` +\n      `width=\"${img.width}\" height=\"${img.height}\" preserveAspectRatio=\"xMidYMid meet\"${alt}/>`;\n  }\n  svg += \"</svg>\";\n  return svg;\n}\n\n/** Builds a complete SVG string for an encoded matrix. */\nexport function buildQRCodeSVG(\n  matrix: QRMatrix,\n  options: QRRenderOptions = {},\n  size?: number | string,\n): string {\n  return serializeModel(buildRenderModel(matrix, options), size);\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/svg-builder.ts"
    },
    {
      "path": "registry/default/qr-code/lib/tables.ts",
      "content": "/**\n * Constant tables and derived geometry from ISO/IEC 18004.\n *\n * The full per-version codeword/block layout is derived arithmetically from two\n * compact tables (error correction codewords per block, and number of error\n * correction blocks) rather than a large hard-coded table.\n */\n\nimport type { ECLevel, QRMode } from \"./types\";\n\n/** Ordinal index into the EC tables below, in ascending recovery order. */\nconst EC_ORDINAL: Record<ECLevel, number> = { L: 0, M: 1, Q: 2, H: 3 };\n\n/** 5-bit format-info value for each EC level (not the same as the ordinal). */\nconst EC_FORMAT_BITS: Record<ECLevel, number> = { L: 1, M: 0, Q: 3, H: 2 };\n\n/** 4-bit mode indicator emitted at the start of each segment. */\nexport const MODE_INDICATOR: Record<QRMode, number> = {\n  numeric: 0x1,\n  alphanumeric: 0x2,\n  byte: 0x4,\n};\n\n/** The 45-character alphanumeric set, indexed by value. */\nexport const ALPHANUMERIC_CHARSET =\n  \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:\";\n\n// Indexed by [ecOrdinal][version]; index 0 of each row is an unused placeholder.\n// prettier-ignore\nconst ECC_CODEWORDS_PER_BLOCK: number[][] = [\n  [-1,  7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], // L\n  [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28], // M\n  [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], // Q\n  [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], // H\n];\n\n// Indexed by [ecOrdinal][version]; index 0 of each row is an unused placeholder.\n// prettier-ignore\nconst NUM_ERROR_CORRECTION_BLOCKS: number[][] = [\n  [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2,  4,  4,  4,  4,  4,  6,  6,  6,  6,  7,  8,  8,  9,  9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25], // L\n  [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5,  5,  5,  8,  9,  9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49], // M\n  [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8,  8,  8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68], // Q\n  [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8,  8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81], // H\n];\n\n/** Returns the number of modules per side for a version (`17 + 4 * version`). */\nexport function getSize(version: number): number {\n  return version * 4 + 17;\n}\n\n/** Returns the EC ordinal for a level. */\nexport function getEcOrdinal(ecLevel: ECLevel): number {\n  return EC_ORDINAL[ecLevel];\n}\n\n/** Returns the 5-bit format-info value for a level. */\nexport function getEcFormatBits(ecLevel: ECLevel): number {\n  return EC_FORMAT_BITS[ecLevel];\n}\n\n/** Number of EC codewords per block for a version + level. */\nexport function getEccCodewordsPerBlock(\n  version: number,\n  ecLevel: ECLevel,\n): number {\n  return ECC_CODEWORDS_PER_BLOCK[EC_ORDINAL[ecLevel]][version];\n}\n\n/** Number of error correction blocks for a version + level. */\nexport function getNumEcBlocks(version: number, ecLevel: ECLevel): number {\n  return NUM_ERROR_CORRECTION_BLOCKS[EC_ORDINAL[ecLevel]][version];\n}\n\n/**\n * Total number of data-and-EC modules available for a version, excluding all\n * function patterns and format/version information.\n */\nexport function getNumRawDataModules(version: number): number {\n  if (version < 1 || version > 40) {\n    throw new RangeError(\"Version out of range\");\n  }\n  let result = (16 * version + 128) * version + 64;\n  if (version >= 2) {\n    const numAlign = Math.floor(version / 7) + 2;\n    result -= (25 * numAlign - 10) * numAlign - 55;\n    if (version >= 7) {\n      result -= 36;\n    }\n  }\n  return result;\n}\n\n/** Number of usable data codewords (excluding EC) for a version + level. */\nexport function getNumDataCodewords(version: number, ecLevel: ECLevel): number {\n  return (\n    Math.floor(getNumRawDataModules(version) / 8) -\n    getEccCodewordsPerBlock(version, ecLevel) * getNumEcBlocks(version, ecLevel)\n  );\n}\n\n/** Width, in bits, of the character-count indicator for a mode + version. */\nexport function getCharCountBits(mode: QRMode, version: number): number {\n  const band = version <= 9 ? 0 : version <= 26 ? 1 : 2;\n  switch (mode) {\n    case \"numeric\":\n      return [10, 12, 14][band];\n    case \"alphanumeric\":\n      return [9, 11, 13][band];\n    case \"byte\":\n      return [8, 16, 16][band];\n  }\n}\n\n/**\n * Returns the center coordinates of the alignment patterns for a version. The\n * three positions that collide with finder patterns are filtered out by the\n * caller.\n */\nexport function getAlignmentPatternPositions(version: number): number[] {\n  if (version === 1) {\n    return [];\n  }\n  const numAlign = Math.floor(version / 7) + 2;\n  const step =\n    version === 32\n      ? 26\n      : Math.ceil((version * 4 + 4) / (numAlign * 2 - 2)) * 2;\n  const result: number[] = [6];\n  for (\n    let pos = getSize(version) - 7;\n    result.length < numAlign;\n    pos -= step\n  ) {\n    result.splice(1, 0, pos);\n  }\n  return result;\n}\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/tables.ts"
    },
    {
      "path": "registry/default/qr-code/lib/types.ts",
      "content": "/**\n * Shared types for the QR code encoder and SVG renderer.\n *\n * Pure type declarations only — this file has zero runtime cost and is safe to\n * import from both server and client code.\n */\n\nimport type * as React from \"react\";\n\n/** Error correction level, in ascending order of recovery capacity. */\nexport type ECLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/** Supported encoding modes. Kanji is intentionally not implemented. */\nexport type QRMode = \"numeric\" | \"alphanumeric\" | \"byte\";\n\n/** Options accepted by {@link encode}. */\nexport interface EncodeOptions {\n  /** Error correction level. Defaults to `\"M\"`. */\n  ecLevel?: ECLevel;\n  /** Smallest version (1–40) to consider. Defaults to `1`. */\n  minVersion?: number;\n  /** Largest version (1–40) to consider. Defaults to `40`. */\n  maxVersion?: number;\n  /**\n   * Force a specific mode. `\"auto\"` (the default) selects the most compact\n   * mode that can represent the input.\n   */\n  mode?: QRMode | \"auto\";\n  /**\n   * When `true` (the default), the error correction level is silently upgraded\n   * to the highest level the chosen version can hold for free.\n   */\n  boostEcl?: boolean;\n}\n\n/** A fully encoded QR symbol: a square grid of dark/light modules. */\nexport interface QRMatrix {\n  /** Number of modules per side (`17 + 4 * version`). */\n  size: number;\n  /** Row-major grid; `modules[y][x] === true` means a dark module. */\n  modules: boolean[][];\n  /** The version (1–40) that was selected. */\n  version: number;\n  /** The error correction level actually used (may be boosted). */\n  ecLevel: ECLevel;\n  /** The mode actually used to encode the data. */\n  mode: QRMode;\n  /** The mask pattern (0–7) chosen during encoding. */\n  maskPattern: number;\n}\n\n/** Visual style of a single module / dot. */\nexport type QRDotStyle = \"square\" | \"circle\" | \"rounded\";\n\n/**\n * Independent styling for a finder pattern (\"eye\"). A finder has an outer 7×7\n * ring and an inner 3×3 eye that can be styled and colored separately.\n */\nexport interface QRFinderStyle {\n  /** Style of the outer ring. Falls back to the component's `dotStyle`. */\n  outerStyle?: QRDotStyle;\n  /** Color of the outer ring. Falls back to `foreground`. */\n  outerColor?: string;\n  /** Style of the inner eye. Falls back to `outerStyle`. */\n  innerStyle?: QRDotStyle;\n  /** Color of the inner eye. Falls back to `outerColor` / `foreground`. */\n  innerColor?: string;\n}\n\n/** A logo described by an image source rather than a React element. */\nexport interface QRLogoObject {\n  /** Image URL or data URI. */\n  src: string;\n  /** Logo width, in module units. */\n  width?: number;\n  /** Logo height, in module units. */\n  height?: number;\n  /** Alternative text for the embedded image. */\n  alt?: string;\n}\n\n/** The three finder patterns, ordered top-left, top-right, bottom-left. */\nexport type QRFinderTuple = [QRFinderStyle, QRFinderStyle, QRFinderStyle];\n\n/** Render options shared by the component and the standalone SVG builders. */\nexport interface QRRenderOptions {\n  ecLevel?: ECLevel;\n  dotStyle?: QRDotStyle;\n  /** Quiet-zone width, in modules. Defaults to `4`. */\n  margin?: number;\n  /** Foreground (dark module) color. Defaults to `\"currentColor\"`. */\n  foreground?: string;\n  /** Background color. Defaults to `\"transparent\"`. */\n  background?: string;\n  /** Unified or per-corner finder styling. */\n  finder?: QRFinderStyle | QRFinderTuple;\n  /** Fraction of the symbol width occupied by the logo (clamped to ≤ 0.3). */\n  logoSize?: number;\n  /** Quiet area, in modules, knocked out around the logo. Defaults to `1`. */\n  logoPadding?: number;\n  /** Logo image; only `QRLogoObject` logos are serialized by the SVG builder. */\n  logo?: QRLogoObject;\n  /** Minimum QR version. */\n  minVersion?: number;\n  /** Accessible name rendered as an SVG `<title>` element. */\n  title?: string;\n}\n\n/** Options for the standalone {@link toSVGString} / {@link toDataURL} helpers. */\nexport interface QRExportOptions extends QRRenderOptions {\n  /** The data to encode. */\n  value: string;\n  /** Rendered size, in pixels (used as the SVG `width`/`height`). */\n  size?: number;\n}\n\n/** Output format for {@link toDataURL}. */\nexport type QRDataURLType = \"png\" | \"jpeg\" | \"svg\";\n\n/** Options for {@link toDataURL}. */\nexport interface QRDataURLOptions extends Partial<QRExportOptions> {\n  /** Output format. Defaults to `\"png\"`. */\n  type?: QRDataURLType;\n  /** JPEG quality (0–1). Ignored for other formats. */\n  quality?: number;\n  /** Output raster size per side, in pixels. Defaults to `1024`. */\n  pixelSize?: number;\n}\n\n/** Imperative handle exposed by the `<QRCode>` ref. */\nexport interface QRCodeHandle {\n  /** Returns the rendered SVG as a string (SSR-safe). */\n  toSVGString: () => string;\n  /** Returns a data URL for the rendered code (PNG/JPEG via canvas, or SVG). */\n  toDataURL: (options?: QRDataURLOptions) => Promise<string>;\n  /** Returns the underlying encoded matrix. */\n  getMatrix: () => QRMatrix;\n}\n\n/** A logo accepted by the `<QRCode>` component. */\nexport type QRLogo = React.ReactNode | QRLogoObject;\n",
      "type": "registry:lib",
      "target": "components/ui/cubby-ui/qr-code/lib/types.ts"
    }
  ],
  "type": "registry:ui"
}