{"version":3,"file":"codec-shell-BLW0tEyh.mjs","names":[],"sources":["../src/codecs/_kernel/brand.ts","../src/wire/base32.ts","../src/wire/envelope.ts","../src/wire/invariants.ts","../src/codecs/_kernel/registry.ts","../src/wire/parse.ts","../src/wire/uuid.ts","../src/wire/codec-shell.ts"],"sourcesContent":["import { IdsError } from \"../../error.js\";\n\nconst brandPattern = /^[a-z]{3}$/;\n\n/** Validates a three-character lowercase brand. Throws on invalid input. */\nexport function validateBrand(brand: string): void {\n  if (!brandPattern.test(brand)) {\n    throw new IdsError(\"invalid_brand\", \"invalid brand: expected three lowercase a-z characters\");\n  }\n}\n","/*\n  This is based on Crockford's Base32 spec: https://www.crockford.com/base32.html\n  One difference is that it uses lowercase instead of uppercase when encoding.\n\n  These functions are internal: codec constructors guarantee that input is a\n  16-byte buffer for encode, or a string of characters drawn from the alphabet\n  for decode. Invalid input produces silent garbage rather than a thrown error,\n  consistent with the trust-the-type rule in ADR-0003.\n*/\n\nexport const alphabet = \"0123456789abcdefghjkmnpqrstvwxyz\";\n\n// 0–31 → ASCII char code, for write-into-codes-then-fromCharCode encoding.\nconst valueToCharCode = new Uint8Array(32);\nfor (let i = 0; i < 32; i++) valueToCharCode[i] = alphabet.charCodeAt(i);\n\n// charCode → 0–31 value. Canonical lowercase only; upstream resolves case and\n// o/i/l aliases before any string reaches decodeBase32.\nconst INVALID = 0xff;\nconst charCodeToValue = new Uint8Array(256).fill(INVALID);\nfor (let i = 0; i < alphabet.length; i++) charCodeToValue[alphabet.charCodeAt(i)] = i;\n\nexport function encodeBase32(bytes: Uint8Array): string {\n  // Build an Array<number> of char codes and pass it to fromCharCode.apply.\n  // Faster than `result += char` (avoids cons-string overhead) and than\n  // Uint8Array variants (apply has a fast path for plain Arrays).\n  // oxlint-disable-next-line no-new-array\n  const codes = new Array<number>(Math.ceil((bytes.length * 8) / 5));\n  let chi = 0;\n  let bits = 0;\n  let value = 0;\n\n  for (let i = 0; i < bytes.length; i++) {\n    value = (value << 8) | bytes[i]!;\n    bits += 8;\n    while (bits >= 5) {\n      bits -= 5;\n      codes[chi++] = valueToCharCode[(value >>> bits) & 0x1f]!;\n    }\n  }\n  if (bits > 0) {\n    codes[chi++] = valueToCharCode[(value << (5 - bits)) & 0x1f]!;\n  }\n  // Fixed-size precondition: encode is called only on 16-byte payloads, producing\n  // 26 chars — well below the V8 ~65535 apply() arg-count ceiling. A caller\n  // passing a larger buffer would need to chunk rather than use apply().\n  return String.fromCharCode.apply(null, codes);\n}\n\nexport function decodeBase32(str: string): Uint8Array {\n  const result = new Uint8Array(Math.floor((str.length * 5) / 8));\n  let bits = 0;\n  let value = 0;\n  let index = 0;\n\n  for (let i = 0; i < str.length; i++) {\n    // Input is pre-validated by the upstream parse regex (safeParse / safeVerify /\n    // safeUnwrap), so every charCode is in [0, 255] and in the Crockford alphabet.\n    // No per-char bounds guard is needed here — contrast decodeHex, which guards\n    // `hiCode >= hexCharCodeToNibble.length` because it receives untrusted caller input.\n    const v = charCodeToValue[str.charCodeAt(i)]!;\n    value = (value << 5) | v;\n    bits += 5;\n    if (bits >= 8) {\n      bits -= 8;\n      result[index++] = (value >>> bits) & 0xff;\n    }\n  }\n  return result;\n}\n","import { decodeBase32, encodeBase32 } from \"./base32.js\";\nimport type { Id, Prefix } from \"../types.js\";\n\n/** Composes a canonical wire ID from a prefix and 16-byte payload. */\nexport function toWireId<Brand extends string>(\n  prefix: Prefix<Brand>,\n  payload: Uint8Array,\n): Id<Brand> {\n  return (prefix + encodeBase32(payload)) as Id<Brand>;\n}\n\n/** Decodes the full 16-byte payload from a trusted wire ID. Trust-the-type.\n * Input always comes from `id.slice(prefix.length)` where `id: Id<Brand>` —\n * the Id brand guarantees that safeParse() / parse() normalised any alias chars\n * at the parse boundary (is() rejects aliases rather than normalising them),\n * so every character is canonical Crockford alphabet.\n */\nexport function payloadBytesFromId<Brand extends string>(\n  prefix: Prefix<Brand>,\n  id: Id<Brand>,\n): Uint8Array {\n  return decodeBase32(id.slice(prefix.length));\n}\n","import type { Id, Prefix } from \"../types.js\";\n\n// Payload is always 16 bytes on the wire (every codec). 16 bytes → 26 Crockford\n// base32 chars. ADR-0002 codifies this as the shared wire-format invariant.\nexport const payloadByteLength = 16 as const;\nexport const payloadBase32Length: number = Math.ceil((payloadByteLength * 8) / 5);\n\n// Compact regex character class for the canonical lowercase Crockford alphabet\n// (`0123456789abcdefghjkmnpqrstvwxyz` — excludes i, l, o, u). Used in the JSON\n// Schema `pattern`, which describes the canonical wire form only (ADR-0003).\nexport const base32CharClass: string = \"[0-9a-hjkmnp-tv-z]\";\n\n// The 8 alphabet values at indices divisible by 4 (low 2 bits = 00) that satisfy the\n// canonical padding-bit constraint for a 130-bit encoding of 16 bytes. ADR-0003.\nexport const base32FinalCharClass: string = \"[048cgmrw]\";\n\n/** Returns the zero-filled schema example ID string for a given prefix. */\nexport function schemaExampleId<Brand extends string>(prefix: Prefix<Brand>): Id<Brand> {\n  return (prefix + \"0\".repeat(payloadBase32Length)) as Id<Brand>;\n}\n","const registeredBrands = new Set<string>();\nconst warnedBrands = new Set<string>();\n\nexport function registerBrand(brand: string, allowDuplicateBrand: boolean | undefined): void {\n  if (\n    typeof process === \"undefined\" ||\n    process.env.NODE_ENV === \"production\" ||\n    allowDuplicateBrand\n  ) {\n    return;\n  }\n\n  if (registeredBrands.has(brand)) {\n    if (!warnedBrands.has(brand)) {\n      console.warn(\n        `[@smonn/ids] brand \"${brand}\" was registered more than once — this usually indicates a bundling or import bug, or that more than one codec variant is using the same brand. Pass { allowDuplicateBrand: true } to silence.`,\n      );\n      warnedBrands.add(brand);\n    }\n  } else {\n    registeredBrands.add(brand);\n  }\n}\n\n/**\n * Clears the process-global brand registry. Internal test hook only — not part\n * of the public API. Lets a test suite reset duplicate-detection state between\n * cases (e.g. in `beforeEach`) so it can reuse stable brands instead of minting\n * throwaway ones to dodge cross-test contamination. See ADR-0021.\n */\nexport function resetBrandRegistry(): void {\n  registeredBrands.clear();\n  warnedBrands.clear();\n}\n","import { alphabet } from \"./base32.js\";\nimport type { Id, ParseError, ParseResult, Prefix } from \"../types.js\";\nimport { base32FinalCharClass, payloadBase32Length } from \"./invariants.js\";\n\nconst replacePattern = /[ilo]/g;\nconst aliasTestPattern = /[ilo]/;\nconst replacer = (match: string): string => (match === \"o\" ? \"0\" : \"1\");\nconst base32Pattern = new RegExp(\n  `^[${alphabet}]{${payloadBase32Length - 1}}${base32FinalCharClass}$`,\n);\n\nconst asciiUpperPattern = /[A-Z]/g;\nconst asciiUpperTestPattern = /[A-Z]/;\nconst asciiLowerReplacer = (match: string): string => String.fromCharCode(match.charCodeAt(0) + 32);\n\n/**\n * Fold ASCII `A`–`Z` to `a`–`z`, and nothing else. Unlike\n * `String.prototype.toLowerCase()`, this applies no Unicode case folding, so a\n * non-ASCII code unit such as U+212A KELVIN SIGN is left intact — and therefore\n * rejected by base32 validation — rather than aliasing to `k`. SPEC\n * canonicalization step 1: case folding is ASCII-only.\n *\n * The `test` guard keeps the common already-lowercase input allocation-free\n * (the same short-circuit the alias resolution below uses): only strings that\n * actually contain an uppercase ASCII letter pay for the rewrite.\n */\nfunction asciiLowerFold(value: string): string {\n  return asciiUpperTestPattern.test(value)\n    ? value.replace(asciiUpperPattern, asciiLowerReplacer)\n    : value;\n}\n\nexport function safeParse<Brand extends string>(\n  prefix: Prefix<Brand>,\n  value: unknown,\n): ParseResult<Brand> {\n  if (typeof value !== \"string\") return { ok: false, error: \"not_string\" };\n  if (value.startsWith(prefix) && base32Pattern.test(value.slice(prefix.length))) {\n    return { ok: true, id: value as Id<Brand> };\n  }\n  if (value.length > prefix.length + payloadBase32Length) {\n    // Overlong: fail fast in O(1). Classify by the fixed-size prefix slice only —\n    // never fold or regex-test the oversized payload — so the reported layer still\n    // obeys SPEC's first-failing-layer rule: a wrong prefix is a prefix-layer\n    // rejection even when the input is also too long, while a correct prefix\n    // leaves the oversized payload as the first (base32-layer) failure.\n    return asciiLowerFold(value.slice(0, prefix.length)) === prefix\n      ? { ok: false, error: \"invalid_base32\" }\n      : { ok: false, error: \"invalid_prefix\" };\n  }\n  const folded = asciiLowerFold(value);\n  if (!folded.startsWith(prefix)) return { ok: false, error: \"invalid_prefix\" };\n\n  const sliced = folded.slice(prefix.length);\n  const base32 = aliasTestPattern.test(sliced)\n    ? sliced.replaceAll(replacePattern, replacer)\n    : sliced;\n\n  if (!base32Pattern.test(base32)) return { ok: false, error: \"invalid_base32\" };\n\n  const id = (prefix + base32) as Id<Brand>;\n  return { ok: true, id };\n}\n\nexport function is<Brand extends string>(\n  prefix: Prefix<Brand>,\n  value: unknown,\n): value is Id<Brand> {\n  if (typeof value !== \"string\") return false;\n  if (!value.startsWith(prefix)) return false;\n  return base32Pattern.test(value.slice(prefix.length));\n}\n\nconst parseErrorMessages: Record<Exclude<ParseError, \"invalid_prefix\">, string> = {\n  not_string: \"expected string\",\n  invalid_base32: \"invalid base32 payload\",\n  invalid_uuid: \"invalid UUID\",\n};\n\nfunction errorMessage<Brand extends string>(prefix: Prefix<Brand>, error: ParseError): string {\n  if (error === \"invalid_prefix\") return `expected prefix '${prefix}'`;\n  return parseErrorMessages[error];\n}\n\nexport function standardValidate<Brand extends string>(\n  prefix: Prefix<Brand>,\n  value: unknown,\n):\n  | { readonly value: Id<Brand>; readonly issues?: undefined }\n  | { readonly issues: ReadonlyArray<{ readonly message: string }> } {\n  const result = safeParse(prefix, value);\n  if (result.ok) return { value: result.id };\n  return { issues: [{ message: errorMessage(prefix, result.error) }] };\n}\n","import { IdsError } from \"../error.js\";\nimport type { Id, ParseResult, Prefix } from \"../types.js\";\nimport { payloadBytesFromId, toWireId } from \"./envelope.js\";\n\n// Byte value → 2-char lowercase hex string, e.g. 0x0a → \"0a\".\nconst byteToHex = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, \"0\"));\n\n// Hex char code → nibble value (0–15). Initialised for both cases; 0xff = invalid sentinel.\nconst hexNibble = new Uint8Array(256).fill(0xff);\nfor (let i = 0; i <= 9; i++) hexNibble[\"0\".charCodeAt(0) + i] = i;\nfor (let i = 0; i <= 5; i++) hexNibble[\"a\".charCodeAt(0) + i] = 10 + i;\nfor (let i = 0; i <= 5; i++) hexNibble[\"A\".charCodeAt(0) + i] = 10 + i;\n\nconst hexOffsets = [0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34] as const;\n\n// RFC 9562 canonical form: 8-4-4-4-12 hyphenated hex, case-insensitive.\n// Rejects braces, urn:uuid: prefix, and hyphenless 32-char forms.\nconst uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction bytesToUuidString(b: Uint8Array): string {\n  return (\n    byteToHex[b[0]!]! +\n    byteToHex[b[1]!]! +\n    byteToHex[b[2]!]! +\n    byteToHex[b[3]!]! +\n    \"-\" +\n    byteToHex[b[4]!]! +\n    byteToHex[b[5]!]! +\n    \"-\" +\n    byteToHex[b[6]!]! +\n    byteToHex[b[7]!]! +\n    \"-\" +\n    byteToHex[b[8]!]! +\n    byteToHex[b[9]!]! +\n    \"-\" +\n    byteToHex[b[10]!]! +\n    byteToHex[b[11]!]! +\n    byteToHex[b[12]!]! +\n    byteToHex[b[13]!]! +\n    byteToHex[b[14]!]! +\n    byteToHex[b[15]!]!\n  );\n}\n\nfunction uuidStringToBytes(uuid: string): Uint8Array {\n  const bytes = new Uint8Array(16);\n  for (let i = 0; i < 16; i++) {\n    const off = hexOffsets[i]!;\n    bytes[i] = (hexNibble[uuid.charCodeAt(off)]! << 4) | hexNibble[uuid.charCodeAt(off + 1)]!;\n  }\n  return bytes;\n}\n\n/**\n * Converts a trusted `Id<Brand>` to an RFC 9562 canonical (lowercase, hyphenated)\n * UUID string by reinterpreting the 16-byte payload verbatim as 128 bits.\n * Total (cannot fail). Returns a plain `string` — the brand is shed.\n * The output is raw/unversioned: all 128 bits are payload data.\n */\nexport function toUUID<Brand extends string>(prefix: Prefix<Brand>, id: Id<Brand>): string {\n  return bytesToUuidString(payloadBytesFromId(prefix, id));\n}\n\n/**\n * Parses a UUID string and returns a `ParseResult<Brand>`.\n * Accepts case-insensitive `8-4-4-4-12` hyphenated form only.\n * Returns `{ ok: false, error: \"not_string\" }` for non-string input,\n * `{ ok: false, error: \"invalid_uuid\" }` for malformed UUID strings,\n * or `{ ok: true, id }` on success. Never throws.\n */\nexport function safeFromUUID<Brand extends string>(\n  prefix: Prefix<Brand>,\n  value: unknown,\n): ParseResult<Brand> {\n  if (typeof value !== \"string\") return { ok: false, error: \"not_string\" };\n  if (!uuidPattern.test(value)) return { ok: false, error: \"invalid_uuid\" };\n  const bytes = uuidStringToBytes(value);\n  return { ok: true, id: toWireId(prefix, bytes) };\n}\n\n/**\n * Parses a UUID string and returns an `Id<Brand>`.\n * Accepts case-insensitive `8-4-4-4-12` hyphenated form only.\n * Throws `IdsError` with `code: \"invalid_id\"` and the `ParseError` on `cause` for bad input.\n */\nexport function fromUUID<Brand extends string>(prefix: Prefix<Brand>, value: string): Id<Brand> {\n  const result = safeFromUUID(prefix, value);\n  if (result.ok) return result.id;\n  throw new IdsError(\"invalid_id\", `invalid UUID: ${result.error}`, {\n    cause: result.error,\n  });\n}\n","import { IdsError } from \"../error.js\";\nimport type { Id, JsonSchema, ParseResult, Prefix, StandardSchemaProps } from \"../types.js\";\nimport {\n  base32CharClass,\n  base32FinalCharClass,\n  payloadBase32Length,\n  schemaExampleId,\n} from \"./invariants.js\";\nimport { is, safeParse, standardValidate } from \"./parse.js\";\nimport { fromUUID, safeFromUUID, toUUID } from \"./uuid.js\";\n\ntype WireMethods<Brand extends string> = {\n  is: (value: unknown) => value is Id<Brand>;\n  parse: (value: unknown) => Id<Brand>;\n  safeParse: (value: unknown) => ParseResult<Brand>;\n  toJsonSchema: () => JsonSchema;\n  \"~standard\": StandardSchemaProps<Brand>;\n  toUUID: (id: Id<Brand>) => string;\n  fromUUID: (value: string) => Id<Brand>;\n  safeFromUUID: (value: unknown) => ParseResult<Brand>;\n};\n\n/** Wire-only methods shared by every codec variant for a fixed prefix. */\nexport function wireMethods<Brand extends string>(prefix: Prefix<Brand>): WireMethods<Brand> {\n  const brand = prefix.slice(0, -1) as Brand;\n  const example = schemaExampleId(prefix);\n  const standard: StandardSchemaProps<Brand> = {\n    version: 1,\n    vendor: \"@smonn/ids\",\n    validate: (value: unknown) => standardValidate(prefix, value),\n  };\n  return {\n    is: (value: unknown): value is Id<Brand> => is(prefix, value),\n    parse: (value: unknown): Id<Brand> => {\n      const result = safeParse(prefix, value);\n      if (result.ok) return result.id;\n      throw new IdsError(\"invalid_id\", `invalid ID: ${result.error}`, { cause: result.error });\n    },\n    safeParse: (value: unknown): ParseResult<Brand> => safeParse(prefix, value),\n    toJsonSchema: (): JsonSchema => ({\n      type: \"string\",\n      pattern: `^${prefix}${base32CharClass}{${payloadBase32Length - 1}}${base32FinalCharClass}$`,\n      description: `Branded ID for '${brand}'`,\n      example,\n    }),\n    \"~standard\": standard,\n    toUUID: (id: Id<Brand>): string => toUUID(prefix, id),\n    fromUUID: (value: string): Id<Brand> => fromUUID(prefix, value),\n    safeFromUUID: (value: unknown): ParseResult<Brand> => safeFromUUID(prefix, value),\n  };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;;AAGrB,SAAgB,cAAc,OAAqB;CACjD,IAAI,CAAC,aAAa,KAAK,KAAK,GAC1B,MAAM,IAAI,SAAS,iBAAiB,wDAAwD;AAEhG;;;ACCA,MAAa,WAAW;AAGxB,MAAM,kCAAkB,IAAI,WAAW,EAAE;AACzC,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK,gBAAgB,KAAK,SAAS,WAAW,CAAC;AAKvE,MAAM,mCAAkB,IAAI,WAAW,GAAG,EAAA,CAAE,KAAK,GAAO;AACxD,KAAK,IAAI,IAAI,GAAG,IAAI,IAAiB,KAAK,gBAAgB,SAAS,WAAW,CAAC,KAAK;AAEpF,SAAgB,aAAa,OAA2B;CAKtD,MAAM,QAAQ,IAAI,MAAc,KAAK,K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