@vscode/markdown-editor 0.0.2-20 → 0.0.2-22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +73 -36
- package/dist/index.js +1424 -1535
- package/dist/index.js.map +1 -1
- package/dist/stringEdit-DzLs4E1d.js +177 -0
- package/dist/stringEdit-DzLs4E1d.js.map +1 -0
- package/dist/web-editors.d.ts +125 -0
- package/dist/web-editors.js +5185 -0
- package/dist/web-editors.js.map +1 -0
- package/package.json +17 -7
- package/src/view/editor.css +139 -40
- package/src/view/themes/default.css +5 -2
- package/src/view/themes/github.css +5 -2
- package/src/view/themes/vscode-default.css +6 -3
- package/src/view/themes/vscode-github.css +6 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-editors.js","sources":["../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js","../../hubrpc/hubrpc/dist/chunks/src-Bcqt3hMa.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js","../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js","../../web-editors/src/protocol.ts","../../web-editors/src/content/contentModel.ts","../../web-editors/src/content/textJsonCodec.ts","../../hubrpc/hubrpc/dist/web.js","../../web-editors/src/utils/event.ts","../../web-editors/src/host/WebEditorHost.ts","../src/view/iframeEmbeddedEditor.ts"],"sourcesContent":["var _a;\n/** A special constant with type `never` */\nexport const NEVER = /*@__PURE__*/ Object.freeze({\n status: \"aborted\",\n});\nexport /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer, params) {\n function init(inst, def) {\n if (!inst._zod) {\n Object.defineProperty(inst, \"_zod\", {\n value: {\n def,\n constr: _,\n traits: new Set(),\n },\n enumerable: false,\n });\n }\n if (inst._zod.traits.has(name)) {\n return;\n }\n inst._zod.traits.add(name);\n initializer(inst, def);\n // support prototype modifications\n const proto = _.prototype;\n const keys = Object.keys(proto);\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i];\n if (!(k in inst)) {\n inst[k] = proto[k].bind(inst);\n }\n }\n }\n // doesn't work if Parent has a constructor with arguments\n const Parent = params?.Parent ?? Object;\n class Definition extends Parent {\n }\n Object.defineProperty(Definition, \"name\", { value: name });\n function _(def) {\n var _a;\n const inst = params?.Parent ? new Definition() : this;\n init(inst, def);\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n for (const fn of inst._zod.deferred) {\n fn();\n }\n return inst;\n }\n Object.defineProperty(_, \"init\", { value: init });\n Object.defineProperty(_, Symbol.hasInstance, {\n value: (inst) => {\n if (params?.Parent && inst instanceof params.Parent)\n return true;\n return inst?._zod?.traits?.has(name);\n },\n });\n Object.defineProperty(_, \"name\", { value: name });\n return _;\n}\n////////////////////////////// UTILITIES ///////////////////////////////////////\nexport const $brand = Symbol(\"zod_brand\");\nexport class $ZodAsyncError extends Error {\n constructor() {\n super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);\n }\n}\nexport class $ZodEncodeError extends Error {\n constructor(name) {\n super(`Encountered unidirectional transform during encode: ${name}`);\n this.name = \"ZodEncodeError\";\n }\n}\n(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});\nexport const globalConfig = globalThis.__zod_globalConfig;\nexport function config(newConfig) {\n if (newConfig)\n Object.assign(globalConfig, newConfig);\n return globalConfig;\n}\n","import { globalConfig } from \"./core.js\";\n// functions\nexport function assertEqual(val) {\n return val;\n}\nexport function assertNotEqual(val) {\n return val;\n}\nexport function assertIs(_arg) { }\nexport function assertNever(_x) {\n throw new Error(\"Unexpected value in exhaustive check\");\n}\nexport function assert(_) { }\nexport function getEnumValues(entries) {\n const numericValues = Object.values(entries).filter((v) => typeof v === \"number\");\n const values = Object.entries(entries)\n .filter(([k, _]) => numericValues.indexOf(+k) === -1)\n .map(([_, v]) => v);\n return values;\n}\nexport function joinValues(array, separator = \"|\") {\n return array.map((val) => stringifyPrimitive(val)).join(separator);\n}\nexport function jsonStringifyReplacer(_, value) {\n if (typeof value === \"bigint\")\n return value.toString();\n return value;\n}\nexport function cached(getter) {\n const set = false;\n return {\n get value() {\n if (!set) {\n const value = getter();\n Object.defineProperty(this, \"value\", { value });\n return value;\n }\n throw new Error(\"cached value already set\");\n },\n };\n}\nexport function nullish(input) {\n return input === null || input === undefined;\n}\nexport function cleanRegex(source) {\n const start = source.startsWith(\"^\") ? 1 : 0;\n const end = source.endsWith(\"$\") ? source.length - 1 : source.length;\n return source.slice(start, end);\n}\nexport function floatSafeRemainder(val, step) {\n const ratio = val / step;\n const roundedRatio = Math.round(ratio);\n // Use a relative epsilon scaled to the magnitude of the result\n const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);\n if (Math.abs(ratio - roundedRatio) < tolerance)\n return 0;\n return ratio - roundedRatio;\n}\nconst EVALUATING = /* @__PURE__*/ Symbol(\"evaluating\");\nexport function defineLazy(object, key, getter) {\n let value = undefined;\n Object.defineProperty(object, key, {\n get() {\n if (value === EVALUATING) {\n // Circular reference detected, return undefined to break the cycle\n return undefined;\n }\n if (value === undefined) {\n value = EVALUATING;\n value = getter();\n }\n return value;\n },\n set(v) {\n Object.defineProperty(object, key, {\n value: v,\n // configurable: true,\n });\n // object[key] = v;\n },\n configurable: true,\n });\n}\nexport function objectClone(obj) {\n return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));\n}\nexport function assignProp(target, prop, value) {\n Object.defineProperty(target, prop, {\n value,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n}\nexport function mergeDefs(...defs) {\n const mergedDescriptors = {};\n for (const def of defs) {\n const descriptors = Object.getOwnPropertyDescriptors(def);\n Object.assign(mergedDescriptors, descriptors);\n }\n return Object.defineProperties({}, mergedDescriptors);\n}\nexport function cloneDef(schema) {\n return mergeDefs(schema._zod.def);\n}\nexport function getElementAtPath(obj, path) {\n if (!path)\n return obj;\n return path.reduce((acc, key) => acc?.[key], obj);\n}\nexport function promiseAllObject(promisesObj) {\n const keys = Object.keys(promisesObj);\n const promises = keys.map((key) => promisesObj[key]);\n return Promise.all(promises).then((results) => {\n const resolvedObj = {};\n for (let i = 0; i < keys.length; i++) {\n resolvedObj[keys[i]] = results[i];\n }\n return resolvedObj;\n });\n}\nexport function randomString(length = 10) {\n const chars = \"abcdefghijklmnopqrstuvwxyz\";\n let str = \"\";\n for (let i = 0; i < length; i++) {\n str += chars[Math.floor(Math.random() * chars.length)];\n }\n return str;\n}\nexport function esc(str) {\n return JSON.stringify(str);\n}\nexport function slugify(input) {\n return input\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\nexport const captureStackTrace = (\"captureStackTrace\" in Error ? Error.captureStackTrace : (..._args) => { });\nexport function isObject(data) {\n return typeof data === \"object\" && data !== null && !Array.isArray(data);\n}\nexport const allowsEval = /* @__PURE__*/ cached(() => {\n // Skip the probe under `jitless`: strict CSPs report the caught `new Function`\n // as a `securitypolicyviolation` even though the throw is swallowed.\n if (globalConfig.jitless) {\n return false;\n }\n // @ts-ignore\n if (typeof navigator !== \"undefined\" && navigator?.userAgent?.includes(\"Cloudflare\")) {\n return false;\n }\n try {\n const F = Function;\n new F(\"\");\n return true;\n }\n catch (_) {\n return false;\n }\n});\nexport function isPlainObject(o) {\n if (isObject(o) === false)\n return false;\n // modified constructor\n const ctor = o.constructor;\n if (ctor === undefined)\n return true;\n if (typeof ctor !== \"function\")\n return true;\n // modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false)\n return false;\n // ctor doesn't have static `isPrototypeOf`\n if (Object.prototype.hasOwnProperty.call(prot, \"isPrototypeOf\") === false) {\n return false;\n }\n return true;\n}\nexport function shallowClone(o) {\n if (isPlainObject(o))\n return { ...o };\n if (Array.isArray(o))\n return [...o];\n if (o instanceof Map)\n return new Map(o);\n if (o instanceof Set)\n return new Set(o);\n return o;\n}\nexport function numKeys(data) {\n let keyCount = 0;\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n keyCount++;\n }\n }\n return keyCount;\n}\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return \"undefined\";\n case \"string\":\n return \"string\";\n case \"number\":\n return Number.isNaN(data) ? \"nan\" : \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"function\":\n return \"function\";\n case \"bigint\":\n return \"bigint\";\n case \"symbol\":\n return \"symbol\";\n case \"object\":\n if (Array.isArray(data)) {\n return \"array\";\n }\n if (data === null) {\n return \"null\";\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return \"promise\";\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return \"map\";\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return \"set\";\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return \"date\";\n }\n // @ts-ignore\n if (typeof File !== \"undefined\" && data instanceof File) {\n return \"file\";\n }\n return \"object\";\n default:\n throw new Error(`Unknown data type: ${t}`);\n }\n};\nexport const propertyKeyTypes = /* @__PURE__*/ new Set([\"string\", \"number\", \"symbol\"]);\nexport const primitiveTypes = /* @__PURE__*/ new Set([\n \"string\",\n \"number\",\n \"bigint\",\n \"boolean\",\n \"symbol\",\n \"undefined\",\n]);\nexport function escapeRegex(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n// zod-specific utils\nexport function clone(inst, def, params) {\n const cl = new inst._zod.constr(def ?? inst._zod.def);\n if (!def || params?.parent)\n cl._zod.parent = inst;\n return cl;\n}\nexport function normalizeParams(_params) {\n const params = _params;\n if (!params)\n return {};\n if (typeof params === \"string\")\n return { error: () => params };\n if (params?.message !== undefined) {\n if (params?.error !== undefined)\n throw new Error(\"Cannot specify both `message` and `error` params\");\n params.error = params.message;\n }\n delete params.message;\n if (typeof params.error === \"string\")\n return { ...params, error: () => params.error };\n return params;\n}\nexport function createTransparentProxy(getter) {\n let target;\n return new Proxy({}, {\n get(_, prop, receiver) {\n target ?? (target = getter());\n return Reflect.get(target, prop, receiver);\n },\n set(_, prop, value, receiver) {\n target ?? (target = getter());\n return Reflect.set(target, prop, value, receiver);\n },\n has(_, prop) {\n target ?? (target = getter());\n return Reflect.has(target, prop);\n },\n deleteProperty(_, prop) {\n target ?? (target = getter());\n return Reflect.deleteProperty(target, prop);\n },\n ownKeys(_) {\n target ?? (target = getter());\n return Reflect.ownKeys(target);\n },\n getOwnPropertyDescriptor(_, prop) {\n target ?? (target = getter());\n return Reflect.getOwnPropertyDescriptor(target, prop);\n },\n defineProperty(_, prop, descriptor) {\n target ?? (target = getter());\n return Reflect.defineProperty(target, prop, descriptor);\n },\n });\n}\nexport function stringifyPrimitive(value) {\n if (typeof value === \"bigint\")\n return value.toString() + \"n\";\n if (typeof value === \"string\")\n return `\"${value}\"`;\n return `${value}`;\n}\nexport function optionalKeys(shape) {\n return Object.keys(shape).filter((k) => {\n return shape[k]._zod.optin === \"optional\" && shape[k]._zod.optout === \"optional\";\n });\n}\nexport const NUMBER_FORMAT_RANGES = {\n safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],\n int32: [-2147483648, 2147483647],\n uint32: [0, 4294967295],\n float32: [-3.4028234663852886e38, 3.4028234663852886e38],\n float64: [-Number.MAX_VALUE, Number.MAX_VALUE],\n};\nexport const BIGINT_FORMAT_RANGES = {\n int64: [/* @__PURE__*/ BigInt(\"-9223372036854775808\"), /* @__PURE__*/ BigInt(\"9223372036854775807\")],\n uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt(\"18446744073709551615\")],\n};\nexport function pick(schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".pick() cannot be used on object schemas containing refinements\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const newShape = {};\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n newShape[key] = currDef.shape[key];\n }\n assignProp(this, \"shape\", newShape); // self-caching\n return newShape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function omit(schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".omit() cannot be used on object schemas containing refinements\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const newShape = { ...schema._zod.def.shape };\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n delete newShape[key];\n }\n assignProp(this, \"shape\", newShape); // self-caching\n return newShape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function extend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to extend: expected a plain object\");\n }\n const checks = schema._zod.def.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n // Only throw if new shape overlaps with existing shape\n // Use getOwnPropertyDescriptor to check key existence without accessing values\n const existingShape = schema._zod.def.shape;\n for (const key in shape) {\n if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {\n throw new Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\");\n }\n }\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const _shape = { ...schema._zod.def.shape, ...shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n });\n return clone(schema, def);\n}\nexport function safeExtend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to safeExtend: expected a plain object\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const _shape = { ...schema._zod.def.shape, ...shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n });\n return clone(schema, def);\n}\nexport function merge(a, b) {\n if (a._zod.def.checks?.length) {\n throw new Error(\".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.\");\n }\n const def = mergeDefs(a._zod.def, {\n get shape() {\n const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n get catchall() {\n return b._zod.def.catchall;\n },\n checks: b._zod.def.checks ?? [],\n });\n return clone(a, def);\n}\nexport function partial(Class, schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".partial() cannot be used on object schemas containing refinements\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in oldShape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n // if (oldShape[key]!._zod.optin === \"optional\") continue;\n shape[key] = Class\n ? new Class({\n type: \"optional\",\n innerType: oldShape[key],\n })\n : oldShape[key];\n }\n }\n else {\n for (const key in oldShape) {\n // if (oldShape[key]!._zod.optin === \"optional\") continue;\n shape[key] = Class\n ? new Class({\n type: \"optional\",\n innerType: oldShape[key],\n })\n : oldShape[key];\n }\n }\n assignProp(this, \"shape\", shape); // self-caching\n return shape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function required(Class, schema, mask) {\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n // overwrite with non-optional\n shape[key] = new Class({\n type: \"nonoptional\",\n innerType: oldShape[key],\n });\n }\n }\n else {\n for (const key in oldShape) {\n // overwrite with non-optional\n shape[key] = new Class({\n type: \"nonoptional\",\n innerType: oldShape[key],\n });\n }\n }\n assignProp(this, \"shape\", shape); // self-caching\n return shape;\n },\n });\n return clone(schema, def);\n}\n// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom\nexport function aborted(x, startIndex = 0) {\n if (x.aborted === true)\n return true;\n for (let i = startIndex; i < x.issues.length; i++) {\n if (x.issues[i]?.continue !== true) {\n return true;\n }\n }\n return false;\n}\n// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined).\n// Used to respect `abort: true` in .refine() even for checks that have a `when` function.\nexport function explicitlyAborted(x, startIndex = 0) {\n if (x.aborted === true)\n return true;\n for (let i = startIndex; i < x.issues.length; i++) {\n if (x.issues[i]?.continue === false) {\n return true;\n }\n }\n return false;\n}\nexport function prefixIssues(path, issues) {\n return issues.map((iss) => {\n var _a;\n (_a = iss).path ?? (_a.path = []);\n iss.path.unshift(path);\n return iss;\n });\n}\nexport function unwrapMessage(message) {\n return typeof message === \"string\" ? message : message?.message;\n}\nexport function finalizeIssue(iss, ctx, config) {\n const message = iss.message\n ? iss.message\n : (unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??\n unwrapMessage(ctx?.error?.(iss)) ??\n unwrapMessage(config.customError?.(iss)) ??\n unwrapMessage(config.localeError?.(iss)) ??\n \"Invalid input\");\n const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;\n rest.path ?? (rest.path = []);\n rest.message = message;\n if (ctx?.reportInput) {\n rest.input = _input;\n }\n return rest;\n}\nexport function getSizableOrigin(input) {\n if (input instanceof Set)\n return \"set\";\n if (input instanceof Map)\n return \"map\";\n // @ts-ignore\n if (input instanceof File)\n return \"file\";\n return \"unknown\";\n}\nexport function getLengthableOrigin(input) {\n if (Array.isArray(input))\n return \"array\";\n if (typeof input === \"string\")\n return \"string\";\n return \"unknown\";\n}\nexport function parsedType(data) {\n const t = typeof data;\n switch (t) {\n case \"number\": {\n return Number.isNaN(data) ? \"nan\" : \"number\";\n }\n case \"object\": {\n if (data === null) {\n return \"null\";\n }\n if (Array.isArray(data)) {\n return \"array\";\n }\n const obj = data;\n if (obj && Object.getPrototypeOf(obj) !== Object.prototype && \"constructor\" in obj && obj.constructor) {\n return obj.constructor.name;\n }\n }\n }\n return t;\n}\nexport function issue(...args) {\n const [iss, input, inst] = args;\n if (typeof iss === \"string\") {\n return {\n message: iss,\n code: \"custom\",\n input,\n inst,\n };\n }\n return { ...iss };\n}\nexport function cleanEnum(obj) {\n return Object.entries(obj)\n .filter(([k, _]) => {\n // return true if NaN, meaning it's not a number, thus a string key\n return Number.isNaN(Number.parseInt(k, 10));\n })\n .map((el) => el[1]);\n}\n// Codec utility functions\nexport function base64ToUint8Array(base64) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes;\n}\nexport function uint8ArrayToBase64(bytes) {\n let binaryString = \"\";\n for (let i = 0; i < bytes.length; i++) {\n binaryString += String.fromCharCode(bytes[i]);\n }\n return btoa(binaryString);\n}\nexport function base64urlToUint8Array(base64url) {\n const base64 = base64url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padding = \"=\".repeat((4 - (base64.length % 4)) % 4);\n return base64ToUint8Array(base64 + padding);\n}\nexport function uint8ArrayToBase64url(bytes) {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\nexport function hexToUint8Array(hex) {\n const cleanHex = hex.replace(/^0x/, \"\");\n if (cleanHex.length % 2 !== 0) {\n throw new Error(\"Invalid hex string length\");\n }\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < cleanHex.length; i += 2) {\n bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);\n }\n return bytes;\n}\nexport function uint8ArrayToHex(bytes) {\n return Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n// instanceof\nexport class Class {\n constructor(..._args) { }\n}\n","import { $constructor } from \"./core.js\";\nimport * as util from \"./util.js\";\nconst initializer = (inst, def) => {\n inst.name = \"$ZodError\";\n Object.defineProperty(inst, \"_zod\", {\n value: inst._zod,\n enumerable: false,\n });\n Object.defineProperty(inst, \"issues\", {\n value: def,\n enumerable: false,\n });\n inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);\n Object.defineProperty(inst, \"toString\", {\n value: () => inst.message,\n enumerable: false,\n });\n};\nexport const $ZodError = $constructor(\"$ZodError\", initializer);\nexport const $ZodRealError = $constructor(\"$ZodError\", initializer, { Parent: Error });\nexport function flattenError(error, mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of error.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n}\nexport function formatError(error, mapper = (issue) => issue.message) {\n const fieldErrors = { _errors: [] };\n const processError = (error, path = []) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n }\n };\n processError(error);\n return fieldErrors;\n}\nexport function treeifyError(error, mapper = (issue) => issue.message) {\n const result = { errors: [] };\n const processError = (error, path = []) => {\n var _a, _b;\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n // regular union error\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n result.errors.push(mapper(issue));\n continue;\n }\n let curr = result;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (typeof el === \"string\") {\n curr.properties ?? (curr.properties = {});\n (_a = curr.properties)[el] ?? (_a[el] = { errors: [] });\n curr = curr.properties[el];\n }\n else {\n curr.items ?? (curr.items = []);\n (_b = curr.items)[el] ?? (_b[el] = { errors: [] });\n curr = curr.items[el];\n }\n if (terminal) {\n curr.errors.push(mapper(issue));\n }\n i++;\n }\n }\n }\n };\n processError(error);\n return result;\n}\n/** Format a ZodError as a human-readable string in the following form.\n *\n * From\n *\n * ```ts\n * ZodError {\n * issues: [\n * {\n * expected: 'string',\n * code: 'invalid_type',\n * path: [ 'username' ],\n * message: 'Invalid input: expected string'\n * },\n * {\n * expected: 'number',\n * code: 'invalid_type',\n * path: [ 'favoriteNumbers', 1 ],\n * message: 'Invalid input: expected number'\n * }\n * ];\n * }\n * ```\n *\n * to\n *\n * ```\n * username\n * ✖ Expected number, received string at \"username\n * favoriteNumbers[0]\n * ✖ Invalid input: expected number\n * ```\n */\nexport function toDotPath(_path) {\n const segs = [];\n const path = _path.map((seg) => (typeof seg === \"object\" ? seg.key : seg));\n for (const seg of path) {\n if (typeof seg === \"number\")\n segs.push(`[${seg}]`);\n else if (typeof seg === \"symbol\")\n segs.push(`[${JSON.stringify(String(seg))}]`);\n else if (/[^\\w$]/.test(seg))\n segs.push(`[${JSON.stringify(seg)}]`);\n else {\n if (segs.length)\n segs.push(\".\");\n segs.push(seg);\n }\n }\n return segs.join(\"\");\n}\nexport function prettifyError(error) {\n const lines = [];\n // sort by path length\n const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);\n // Process each issue\n for (const issue of issues) {\n lines.push(`✖ ${issue.message}`);\n if (issue.path?.length)\n lines.push(` → at ${toDotPath(issue.path)}`);\n }\n // Convert Map to formatted string\n return lines.join(\"\\n\");\n}\n","import * as core from \"./core.js\";\nimport * as errors from \"./errors.js\";\nimport * as util from \"./util.js\";\nexport const _parse = (_Err) => (schema, value, _ctx, _params) => {\n const ctx = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n if (result.issues.length) {\n const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, _params?.callee);\n throw e;\n }\n return result.value;\n};\nexport const parse = /* @__PURE__*/ _parse(errors.$ZodRealError);\nexport const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {\n const ctx = _ctx ? { ..._ctx, async: true } : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise)\n result = await result;\n if (result.issues.length) {\n const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));\n util.captureStackTrace(e, params?.callee);\n throw e;\n }\n return result.value;\n};\nexport const parseAsync = /* @__PURE__*/ _parseAsync(errors.$ZodRealError);\nexport const _safeParse = (_Err) => (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, async: false } : { async: false };\n const result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n return result.issues.length\n ? {\n success: false,\n error: new (_Err ?? errors.$ZodError)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n }\n : { success: true, data: result.value };\n};\nexport const safeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);\nexport const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, async: true } : { async: true };\n let result = schema._zod.run({ value, issues: [] }, ctx);\n if (result instanceof Promise)\n result = await result;\n return result.issues.length\n ? {\n success: false,\n error: new _Err(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n }\n : { success: true, data: result.value };\n};\nexport const safeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);\nexport const _encode = (_Err) => (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return _parse(_Err)(schema, value, ctx);\n};\nexport const encode = /* @__PURE__*/ _encode(errors.$ZodRealError);\nexport const _decode = (_Err) => (schema, value, _ctx) => {\n return _parse(_Err)(schema, value, _ctx);\n};\nexport const decode = /* @__PURE__*/ _decode(errors.$ZodRealError);\nexport const _encodeAsync = (_Err) => async (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return _parseAsync(_Err)(schema, value, ctx);\n};\nexport const encodeAsync = /* @__PURE__*/ _encodeAsync(errors.$ZodRealError);\nexport const _decodeAsync = (_Err) => async (schema, value, _ctx) => {\n return _parseAsync(_Err)(schema, value, _ctx);\n};\nexport const decodeAsync = /* @__PURE__*/ _decodeAsync(errors.$ZodRealError);\nexport const _safeEncode = (_Err) => (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return _safeParse(_Err)(schema, value, ctx);\n};\nexport const safeEncode = /* @__PURE__*/ _safeEncode(errors.$ZodRealError);\nexport const _safeDecode = (_Err) => (schema, value, _ctx) => {\n return _safeParse(_Err)(schema, value, _ctx);\n};\nexport const safeDecode = /* @__PURE__*/ _safeDecode(errors.$ZodRealError);\nexport const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {\n const ctx = _ctx ? { ..._ctx, direction: \"backward\" } : { direction: \"backward\" };\n return _safeParseAsync(_Err)(schema, value, ctx);\n};\nexport const safeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync(errors.$ZodRealError);\nexport const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {\n return _safeParseAsync(_Err)(schema, value, _ctx);\n};\nexport const safeDecodeAsync = /* @__PURE__*/ _safeDecodeAsync(errors.$ZodRealError);\n","import * as util from \"./util.js\";\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link cuid2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const cuid = /^[cC][0-9a-z]{6,}$/;\nexport const cuid2 = /^[0-9a-z]+$/;\nexport const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;\nexport const xid = /^[0-9a-vA-V]{20}$/;\nexport const ksuid = /^[A-Za-z0-9]{27}$/;\nexport const nanoid = /^[a-zA-Z0-9_-]{21}$/;\n/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */\nexport const duration = /^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;\n/** Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components. */\nexport const extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */\nexport const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;\n/** Returns a regex for validating an RFC 9562/4122 UUID.\n *\n * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */\nexport const uuid = (version) => {\n if (!version)\n return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;\n return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);\n};\nexport const uuid4 = /*@__PURE__*/ uuid(4);\nexport const uuid6 = /*@__PURE__*/ uuid(6);\nexport const uuid7 = /*@__PURE__*/ uuid(7);\n/** Practical email validation */\nexport const email = /^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;\n/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */\nexport const html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n/** The classic emailregex.com regex for RFC 5322-compliant emails */\nexport const rfc5322Email = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n/** A loose regex that allows Unicode characters, enforces length limits, and that's about it. */\nexport const unicodeEmail = /^[^\\s@\"]{1,64}@[^\\s@]{1,255}$/u;\nexport const idnEmail = unicodeEmail;\nexport const browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emoji = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nexport function emoji() {\n return new RegExp(_emoji, \"u\");\n}\nexport const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nexport const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;\nexport const mac = (delimiter) => {\n const escapedDelim = util.escapeRegex(delimiter ?? \":\");\n return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);\n};\nexport const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/;\nexport const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nexport const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;\nexport const base64url = /^[A-Za-z0-9_-]*$/;\n// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address\n// export const hostname: RegExp = /^([a-zA-Z0-9-]+\\.)*[a-zA-Z0-9-]+$/;\nexport const hostname = /^(?=.{1,253}\\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\\.?$/;\nexport const domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}$/;\nexport const httpProtocol = /^https?$/;\n// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)\n// E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15\nexport const e164 = /^\\+[1-9]\\d{6,14}$/;\n// const dateSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateSource = `(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))`;\nexport const date = /*@__PURE__*/ new RegExp(`^${dateSource}$`);\nfunction timeSource(args) {\n const hhmm = `(?:[01]\\\\d|2[0-3]):[0-5]\\\\d`;\n const regex = typeof args.precision === \"number\"\n ? args.precision === -1\n ? `${hhmm}`\n : args.precision === 0\n ? `${hhmm}:[0-5]\\\\d`\n : `${hhmm}:[0-5]\\\\d\\\\.\\\\d{${args.precision}}`\n : `${hhmm}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`;\n return regex;\n}\nexport function time(args) {\n return new RegExp(`^${timeSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetime(args) {\n const time = timeSource({ precision: args.precision });\n const opts = [\"Z\"];\n if (args.local)\n opts.push(\"\");\n // if (args.offset) opts.push(`([+-]\\\\d{2}:\\\\d{2})`);\n if (args.offset)\n opts.push(`([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)`);\n const timeRegex = `${time}(?:${opts.join(\"|\")})`;\n return new RegExp(`^${dateSource}T(?:${timeRegex})$`);\n}\nexport const string = (params) => {\n const regex = params ? `[\\\\s\\\\S]{${params?.minimum ?? 0},${params?.maximum ?? \"\"}}` : `[\\\\s\\\\S]*`;\n return new RegExp(`^${regex}$`);\n};\nexport const bigint = /^-?\\d+n?$/;\nexport const integer = /^-?\\d+$/;\nexport const number = /^-?\\d+(?:\\.\\d+)?$/;\nexport const boolean = /^(?:true|false)$/i;\nconst _null = /^null$/i;\nexport { _null as null };\nconst _undefined = /^undefined$/i;\nexport { _undefined as undefined };\n// regex for string with no uppercase letters\nexport const lowercase = /^[^A-Z]*$/;\n// regex for string with no lowercase letters\nexport const uppercase = /^[^a-z]*$/;\n// regex for hexadecimal strings (any length)\nexport const hex = /^[0-9a-fA-F]*$/;\n// Hash regexes for different algorithms and encodings\n// Helper function to create base64 regex with exact length and padding\nfunction fixedBase64(bodyLength, padding) {\n return new RegExp(`^[A-Za-z0-9+/]{${bodyLength}}${padding}$`);\n}\n// Helper function to create base64url regex with exact length (no padding)\nfunction fixedBase64url(length) {\n return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);\n}\n// MD5 (16 bytes): base64 = 24 chars total (22 + \"==\")\nexport const md5_hex = /^[0-9a-fA-F]{32}$/;\nexport const md5_base64 = /*@__PURE__*/ fixedBase64(22, \"==\");\nexport const md5_base64url = /*@__PURE__*/ fixedBase64url(22);\n// SHA1 (20 bytes): base64 = 28 chars total (27 + \"=\")\nexport const sha1_hex = /^[0-9a-fA-F]{40}$/;\nexport const sha1_base64 = /*@__PURE__*/ fixedBase64(27, \"=\");\nexport const sha1_base64url = /*@__PURE__*/ fixedBase64url(27);\n// SHA256 (32 bytes): base64 = 44 chars total (43 + \"=\")\nexport const sha256_hex = /^[0-9a-fA-F]{64}$/;\nexport const sha256_base64 = /*@__PURE__*/ fixedBase64(43, \"=\");\nexport const sha256_base64url = /*@__PURE__*/ fixedBase64url(43);\n// SHA384 (48 bytes): base64 = 64 chars total (no padding)\nexport const sha384_hex = /^[0-9a-fA-F]{96}$/;\nexport const sha384_base64 = /*@__PURE__*/ fixedBase64(64, \"\");\nexport const sha384_base64url = /*@__PURE__*/ fixedBase64url(64);\n// SHA512 (64 bytes): base64 = 88 chars total (86 + \"==\")\nexport const sha512_hex = /^[0-9a-fA-F]{128}$/;\nexport const sha512_base64 = /*@__PURE__*/ fixedBase64(86, \"==\");\nexport const sha512_base64url = /*@__PURE__*/ fixedBase64url(86);\n","// import { $ZodType } from \"./schemas.js\";\nimport * as core from \"./core.js\";\nimport * as regexes from \"./regexes.js\";\nimport * as util from \"./util.js\";\nexport const $ZodCheck = /*@__PURE__*/ core.$constructor(\"$ZodCheck\", (inst, def) => {\n var _a;\n inst._zod ?? (inst._zod = {});\n inst._zod.def = def;\n (_a = inst._zod).onattach ?? (_a.onattach = []);\n});\nconst numericOriginMap = {\n number: \"number\",\n bigint: \"bigint\",\n object: \"date\",\n};\nexport const $ZodCheckLessThan = /*@__PURE__*/ core.$constructor(\"$ZodCheckLessThan\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value];\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;\n if (def.value < curr) {\n if (def.inclusive)\n bag.maximum = def.value;\n else\n bag.exclusiveMaximum = def.value;\n }\n });\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {\n return;\n }\n payload.issues.push({\n origin,\n code: \"too_big\",\n maximum: typeof def.value === \"object\" ? def.value.getTime() : def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckGreaterThan = /*@__PURE__*/ core.$constructor(\"$ZodCheckGreaterThan\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const origin = numericOriginMap[typeof def.value];\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;\n if (def.value > curr) {\n if (def.inclusive)\n bag.minimum = def.value;\n else\n bag.exclusiveMinimum = def.value;\n }\n });\n inst._zod.check = (payload) => {\n if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {\n return;\n }\n payload.issues.push({\n origin,\n code: \"too_small\",\n minimum: typeof def.value === \"object\" ? def.value.getTime() : def.value,\n input: payload.value,\n inclusive: def.inclusive,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMultipleOf = \n/*@__PURE__*/ core.$constructor(\"$ZodCheckMultipleOf\", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.onattach.push((inst) => {\n var _a;\n (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);\n });\n inst._zod.check = (payload) => {\n if (typeof payload.value !== typeof def.value)\n throw new Error(\"Cannot mix number and bigint in multiple_of check.\");\n const isMultiple = typeof payload.value === \"bigint\"\n ? payload.value % def.value === BigInt(0)\n : util.floatSafeRemainder(payload.value, def.value) === 0;\n if (isMultiple)\n return;\n payload.issues.push({\n origin: typeof payload.value,\n code: \"not_multiple_of\",\n divisor: def.value,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckNumberFormat = /*@__PURE__*/ core.$constructor(\"$ZodCheckNumberFormat\", (inst, def) => {\n $ZodCheck.init(inst, def); // no format checks\n def.format = def.format || \"float64\";\n const isInt = def.format?.includes(\"int\");\n const origin = isInt ? \"int\" : \"number\";\n const [minimum, maximum] = util.NUMBER_FORMAT_RANGES[def.format];\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.format = def.format;\n bag.minimum = minimum;\n bag.maximum = maximum;\n if (isInt)\n bag.pattern = regexes.integer;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n if (isInt) {\n if (!Number.isInteger(input)) {\n // invalid_format issue\n // payload.issues.push({\n // expected: def.format,\n // format: def.format,\n // code: \"invalid_format\",\n // input,\n // inst,\n // });\n // invalid_type issue\n payload.issues.push({\n expected: origin,\n format: def.format,\n code: \"invalid_type\",\n continue: false,\n input,\n inst,\n });\n return;\n // not_multiple_of issue\n // payload.issues.push({\n // code: \"not_multiple_of\",\n // origin: \"number\",\n // input,\n // inst,\n // divisor: 1,\n // });\n }\n if (!Number.isSafeInteger(input)) {\n if (input > 0) {\n // too_big\n payload.issues.push({\n input,\n code: \"too_big\",\n maximum: Number.MAX_SAFE_INTEGER,\n note: \"Integers must be within the safe integer range.\",\n inst,\n origin,\n inclusive: true,\n continue: !def.abort,\n });\n }\n else {\n // too_small\n payload.issues.push({\n input,\n code: \"too_small\",\n minimum: Number.MIN_SAFE_INTEGER,\n note: \"Integers must be within the safe integer range.\",\n inst,\n origin,\n inclusive: true,\n continue: !def.abort,\n });\n }\n return;\n }\n }\n if (input < minimum) {\n payload.issues.push({\n origin: \"number\",\n input,\n code: \"too_small\",\n minimum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n if (input > maximum) {\n payload.issues.push({\n origin: \"number\",\n input,\n code: \"too_big\",\n maximum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodCheckBigIntFormat = /*@__PURE__*/ core.$constructor(\"$ZodCheckBigIntFormat\", (inst, def) => {\n $ZodCheck.init(inst, def); // no format checks\n const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.format = def.format;\n bag.minimum = minimum;\n bag.maximum = maximum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n if (input < minimum) {\n payload.issues.push({\n origin: \"bigint\",\n input,\n code: \"too_small\",\n minimum: minimum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n if (input > maximum) {\n payload.issues.push({\n origin: \"bigint\",\n input,\n code: \"too_big\",\n maximum,\n inclusive: true,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodCheckMaxSize = /*@__PURE__*/ core.$constructor(\"$ZodCheckMaxSize\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.size !== undefined;\n });\n inst._zod.onattach.push((inst) => {\n const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);\n if (def.maximum < curr)\n inst._zod.bag.maximum = def.maximum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size <= def.maximum)\n return;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n code: \"too_big\",\n maximum: def.maximum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMinSize = /*@__PURE__*/ core.$constructor(\"$ZodCheckMinSize\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.size !== undefined;\n });\n inst._zod.onattach.push((inst) => {\n const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);\n if (def.minimum > curr)\n inst._zod.bag.minimum = def.minimum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size >= def.minimum)\n return;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n code: \"too_small\",\n minimum: def.minimum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckSizeEquals = /*@__PURE__*/ core.$constructor(\"$ZodCheckSizeEquals\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.size !== undefined;\n });\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.minimum = def.size;\n bag.maximum = def.size;\n bag.size = def.size;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const size = input.size;\n if (size === def.size)\n return;\n const tooBig = size > def.size;\n payload.issues.push({\n origin: util.getSizableOrigin(input),\n ...(tooBig ? { code: \"too_big\", maximum: def.size } : { code: \"too_small\", minimum: def.size }),\n inclusive: true,\n exact: true,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMaxLength = /*@__PURE__*/ core.$constructor(\"$ZodCheckMaxLength\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.length !== undefined;\n });\n inst._zod.onattach.push((inst) => {\n const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);\n if (def.maximum < curr)\n inst._zod.bag.maximum = def.maximum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const length = input.length;\n if (length <= def.maximum)\n return;\n const origin = util.getLengthableOrigin(input);\n payload.issues.push({\n origin,\n code: \"too_big\",\n maximum: def.maximum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckMinLength = /*@__PURE__*/ core.$constructor(\"$ZodCheckMinLength\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.length !== undefined;\n });\n inst._zod.onattach.push((inst) => {\n const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);\n if (def.minimum > curr)\n inst._zod.bag.minimum = def.minimum;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const length = input.length;\n if (length >= def.minimum)\n return;\n const origin = util.getLengthableOrigin(input);\n payload.issues.push({\n origin,\n code: \"too_small\",\n minimum: def.minimum,\n inclusive: true,\n input,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckLengthEquals = /*@__PURE__*/ core.$constructor(\"$ZodCheckLengthEquals\", (inst, def) => {\n var _a;\n $ZodCheck.init(inst, def);\n (_a = inst._zod.def).when ?? (_a.when = (payload) => {\n const val = payload.value;\n return !util.nullish(val) && val.length !== undefined;\n });\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.minimum = def.length;\n bag.maximum = def.length;\n bag.length = def.length;\n });\n inst._zod.check = (payload) => {\n const input = payload.value;\n const length = input.length;\n if (length === def.length)\n return;\n const origin = util.getLengthableOrigin(input);\n const tooBig = length > def.length;\n payload.issues.push({\n origin,\n ...(tooBig ? { code: \"too_big\", maximum: def.length } : { code: \"too_small\", minimum: def.length }),\n inclusive: true,\n exact: true,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodCheckStringFormat\", (inst, def) => {\n var _a, _b;\n $ZodCheck.init(inst, def);\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.format = def.format;\n if (def.pattern) {\n bag.patterns ?? (bag.patterns = new Set());\n bag.patterns.add(def.pattern);\n }\n });\n if (def.pattern)\n (_a = inst._zod).check ?? (_a.check = (payload) => {\n def.pattern.lastIndex = 0;\n if (def.pattern.test(payload.value))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: def.format,\n input: payload.value,\n ...(def.pattern ? { pattern: def.pattern.toString() } : {}),\n inst,\n continue: !def.abort,\n });\n });\n else\n (_b = inst._zod).check ?? (_b.check = () => { });\n});\nexport const $ZodCheckRegex = /*@__PURE__*/ core.$constructor(\"$ZodCheckRegex\", (inst, def) => {\n $ZodCheckStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n def.pattern.lastIndex = 0;\n if (def.pattern.test(payload.value))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"regex\",\n input: payload.value,\n pattern: def.pattern.toString(),\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckLowerCase = /*@__PURE__*/ core.$constructor(\"$ZodCheckLowerCase\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.lowercase);\n $ZodCheckStringFormat.init(inst, def);\n});\nexport const $ZodCheckUpperCase = /*@__PURE__*/ core.$constructor(\"$ZodCheckUpperCase\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.uppercase);\n $ZodCheckStringFormat.init(inst, def);\n});\nexport const $ZodCheckIncludes = /*@__PURE__*/ core.$constructor(\"$ZodCheckIncludes\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const escapedRegex = util.escapeRegex(def.includes);\n const pattern = new RegExp(typeof def.position === \"number\" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);\n def.pattern = pattern;\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.patterns ?? (bag.patterns = new Set());\n bag.patterns.add(pattern);\n });\n inst._zod.check = (payload) => {\n if (payload.value.includes(def.includes, def.position))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"includes\",\n includes: def.includes,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckStartsWith = /*@__PURE__*/ core.$constructor(\"$ZodCheckStartsWith\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const pattern = new RegExp(`^${util.escapeRegex(def.prefix)}.*`);\n def.pattern ?? (def.pattern = pattern);\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.patterns ?? (bag.patterns = new Set());\n bag.patterns.add(pattern);\n });\n inst._zod.check = (payload) => {\n if (payload.value.startsWith(def.prefix))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"starts_with\",\n prefix: def.prefix,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckEndsWith = /*@__PURE__*/ core.$constructor(\"$ZodCheckEndsWith\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const pattern = new RegExp(`.*${util.escapeRegex(def.suffix)}$`);\n def.pattern ?? (def.pattern = pattern);\n inst._zod.onattach.push((inst) => {\n const bag = inst._zod.bag;\n bag.patterns ?? (bag.patterns = new Set());\n bag.patterns.add(pattern);\n });\n inst._zod.check = (payload) => {\n if (payload.value.endsWith(def.suffix))\n return;\n payload.issues.push({\n origin: \"string\",\n code: \"invalid_format\",\n format: \"ends_with\",\n suffix: def.suffix,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n///////////////////////////////////\n///// $ZodCheckProperty /////\n///////////////////////////////////\nfunction handleCheckPropertyResult(result, payload, property) {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(property, result.issues));\n }\n}\nexport const $ZodCheckProperty = /*@__PURE__*/ core.$constructor(\"$ZodCheckProperty\", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.check = (payload) => {\n const result = def.schema._zod.run({\n value: payload.value[def.property],\n issues: [],\n }, {});\n if (result instanceof Promise) {\n return result.then((result) => handleCheckPropertyResult(result, payload, def.property));\n }\n handleCheckPropertyResult(result, payload, def.property);\n return;\n };\n});\nexport const $ZodCheckMimeType = /*@__PURE__*/ core.$constructor(\"$ZodCheckMimeType\", (inst, def) => {\n $ZodCheck.init(inst, def);\n const mimeSet = new Set(def.mime);\n inst._zod.onattach.push((inst) => {\n inst._zod.bag.mime = def.mime;\n });\n inst._zod.check = (payload) => {\n if (mimeSet.has(payload.value.type))\n return;\n payload.issues.push({\n code: \"invalid_value\",\n values: def.mime,\n input: payload.value.type,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCheckOverwrite = /*@__PURE__*/ core.$constructor(\"$ZodCheckOverwrite\", (inst, def) => {\n $ZodCheck.init(inst, def);\n inst._zod.check = (payload) => {\n payload.value = def.tx(payload.value);\n };\n});\n","export class Doc {\n constructor(args = []) {\n this.content = [];\n this.indent = 0;\n if (this)\n this.args = args;\n }\n indented(fn) {\n this.indent += 1;\n fn(this);\n this.indent -= 1;\n }\n write(arg) {\n if (typeof arg === \"function\") {\n arg(this, { execution: \"sync\" });\n arg(this, { execution: \"async\" });\n return;\n }\n const content = arg;\n const lines = content.split(\"\\n\").filter((x) => x);\n const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));\n const dedented = lines.map((x) => x.slice(minIndent)).map((x) => \" \".repeat(this.indent * 2) + x);\n for (const line of dedented) {\n this.content.push(line);\n }\n }\n compile() {\n const F = Function;\n const args = this?.args;\n const content = this?.content ?? [``];\n const lines = [...content.map((x) => ` ${x}`)];\n // console.log(lines.join(\"\\n\"));\n return new F(...args, lines.join(\"\\n\"));\n }\n}\n","export const version = {\n major: 4,\n minor: 4,\n patch: 3,\n};\n","import * as checks from \"./checks.js\";\nimport * as core from \"./core.js\";\nimport { Doc } from \"./doc.js\";\nimport { parse, parseAsync, safeParse, safeParseAsync } from \"./parse.js\";\nimport * as regexes from \"./regexes.js\";\nimport * as util from \"./util.js\";\nimport { version } from \"./versions.js\";\nexport const $ZodType = /*@__PURE__*/ core.$constructor(\"$ZodType\", (inst, def) => {\n var _a;\n inst ?? (inst = {});\n inst._zod.def = def; // set _def property\n inst._zod.bag = inst._zod.bag || {}; // initialize _bag object\n inst._zod.version = version;\n const checks = [...(inst._zod.def.checks ?? [])];\n // if inst is itself a checks.$ZodCheck, run it as a check\n if (inst._zod.traits.has(\"$ZodCheck\")) {\n checks.unshift(inst);\n }\n for (const ch of checks) {\n for (const fn of ch._zod.onattach) {\n fn(inst);\n }\n }\n if (checks.length === 0) {\n // deferred initializer\n // inst._zod.parse is not yet defined\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n inst._zod.deferred?.push(() => {\n inst._zod.run = inst._zod.parse;\n });\n }\n else {\n const runChecks = (payload, checks, ctx) => {\n let isAborted = util.aborted(payload);\n let asyncResult;\n for (const ch of checks) {\n if (ch._zod.def.when) {\n if (util.explicitlyAborted(payload))\n continue;\n const shouldRun = ch._zod.def.when(payload);\n if (!shouldRun)\n continue;\n }\n else if (isAborted) {\n continue;\n }\n const currLen = payload.issues.length;\n const _ = ch._zod.check(payload);\n if (_ instanceof Promise && ctx?.async === false) {\n throw new core.$ZodAsyncError();\n }\n if (asyncResult || _ instanceof Promise) {\n asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {\n await _;\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n return;\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n });\n }\n else {\n const nextLen = payload.issues.length;\n if (nextLen === currLen)\n continue;\n if (!isAborted)\n isAborted = util.aborted(payload, currLen);\n }\n }\n if (asyncResult) {\n return asyncResult.then(() => {\n return payload;\n });\n }\n return payload;\n };\n const handleCanaryResult = (canary, payload, ctx) => {\n // abort if the canary is aborted\n if (util.aborted(canary)) {\n canary.aborted = true;\n return canary;\n }\n // run checks first, then\n const checkResult = runChecks(payload, checks, ctx);\n if (checkResult instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));\n }\n return inst._zod.parse(checkResult, ctx);\n };\n inst._zod.run = (payload, ctx) => {\n if (ctx.skipChecks) {\n return inst._zod.parse(payload, ctx);\n }\n if (ctx.direction === \"backward\") {\n // run canary\n // initial pass (no checks)\n const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });\n if (canary instanceof Promise) {\n return canary.then((canary) => {\n return handleCanaryResult(canary, payload, ctx);\n });\n }\n return handleCanaryResult(canary, payload, ctx);\n }\n // forward\n const result = inst._zod.parse(payload, ctx);\n if (result instanceof Promise) {\n if (ctx.async === false)\n throw new core.$ZodAsyncError();\n return result.then((result) => runChecks(result, checks, ctx));\n }\n return runChecks(result, checks, ctx);\n };\n }\n // Lazy initialize ~standard to avoid creating objects for every schema\n util.defineLazy(inst, \"~standard\", () => ({\n validate: (value) => {\n try {\n const r = safeParse(inst, value);\n return r.success ? { value: r.data } : { issues: r.error?.issues };\n }\n catch (_) {\n return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));\n }\n },\n vendor: \"zod\",\n version: 1,\n }));\n});\nexport { clone } from \"./util.js\";\nexport const $ZodString = /*@__PURE__*/ core.$constructor(\"$ZodString\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);\n inst._zod.parse = (payload, _) => {\n if (def.coerce)\n try {\n payload.value = String(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"string\")\n return payload;\n payload.issues.push({\n expected: \"string\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodStringFormat\", (inst, def) => {\n // check initialization must come first\n checks.$ZodCheckStringFormat.init(inst, def);\n $ZodString.init(inst, def);\n});\nexport const $ZodGUID = /*@__PURE__*/ core.$constructor(\"$ZodGUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.guid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodUUID = /*@__PURE__*/ core.$constructor(\"$ZodUUID\", (inst, def) => {\n if (def.version) {\n const versionMap = {\n v1: 1,\n v2: 2,\n v3: 3,\n v4: 4,\n v5: 5,\n v6: 6,\n v7: 7,\n v8: 8,\n };\n const v = versionMap[def.version];\n if (v === undefined)\n throw new Error(`Invalid UUID version: \"${def.version}\"`);\n def.pattern ?? (def.pattern = regexes.uuid(v));\n }\n else\n def.pattern ?? (def.pattern = regexes.uuid());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodEmail = /*@__PURE__*/ core.$constructor(\"$ZodEmail\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.email);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodURL = /*@__PURE__*/ core.$constructor(\"$ZodURL\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n try {\n // Trim whitespace from input\n const trimmed = payload.value.trim();\n // When normalize is off, require :// for http/https URLs\n // This prevents strings like \"http:example.com\" or \"https:/path\" from being silently accepted\n if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source) {\n if (!/^https?:\\/\\//i.test(trimmed)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid URL format\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n return;\n }\n }\n // @ts-ignore\n const url = new URL(trimmed);\n if (def.hostname) {\n def.hostname.lastIndex = 0;\n if (!def.hostname.test(url.hostname)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid hostname\",\n pattern: def.hostname.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n }\n if (def.protocol) {\n def.protocol.lastIndex = 0;\n if (!def.protocol.test(url.protocol.endsWith(\":\") ? url.protocol.slice(0, -1) : url.protocol)) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n note: \"Invalid protocol\",\n pattern: def.protocol.source,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n }\n // Set the output value based on normalize flag\n if (def.normalize) {\n // Use normalized URL\n payload.value = url.href;\n }\n else {\n // Preserve the original input (trimmed)\n payload.value = trimmed;\n }\n return;\n }\n catch (_) {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodEmoji = /*@__PURE__*/ core.$constructor(\"$ZodEmoji\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.emoji());\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodNanoID = /*@__PURE__*/ core.$constructor(\"$ZodNanoID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.nanoid);\n $ZodStringFormat.init(inst, def);\n});\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const $ZodCUID = /*@__PURE__*/ core.$constructor(\"$ZodCUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCUID2 = /*@__PURE__*/ core.$constructor(\"$ZodCUID2\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cuid2);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodULID = /*@__PURE__*/ core.$constructor(\"$ZodULID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ulid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodXID = /*@__PURE__*/ core.$constructor(\"$ZodXID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.xid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodKSUID = /*@__PURE__*/ core.$constructor(\"$ZodKSUID\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ksuid);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODateTime = /*@__PURE__*/ core.$constructor(\"$ZodISODateTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.datetime(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODate = /*@__PURE__*/ core.$constructor(\"$ZodISODate\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.date);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISOTime = /*@__PURE__*/ core.$constructor(\"$ZodISOTime\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.time(def));\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodISODuration = /*@__PURE__*/ core.$constructor(\"$ZodISODuration\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.duration);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodIPv4 = /*@__PURE__*/ core.$constructor(\"$ZodIPv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv4);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `ipv4`;\n});\nexport const $ZodIPv6 = /*@__PURE__*/ core.$constructor(\"$ZodIPv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.ipv6);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `ipv6`;\n inst._zod.check = (payload) => {\n try {\n // @ts-ignore\n new URL(`http://[${payload.value}]`);\n // return;\n }\n catch {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"ipv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\nexport const $ZodMAC = /*@__PURE__*/ core.$constructor(\"$ZodMAC\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.mac(def.delimiter));\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.format = `mac`;\n});\nexport const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv4\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv4);\n $ZodStringFormat.init(inst, def);\n});\nexport const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor(\"$ZodCIDRv6\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n const parts = payload.value.split(\"/\");\n try {\n if (parts.length !== 2)\n throw new Error();\n const [address, prefix] = parts;\n if (!prefix)\n throw new Error();\n const prefixNum = Number(prefix);\n if (`${prefixNum}` !== prefix)\n throw new Error();\n if (prefixNum < 0 || prefixNum > 128)\n throw new Error();\n // @ts-ignore\n new URL(`http://[${address}]`);\n }\n catch {\n payload.issues.push({\n code: \"invalid_format\",\n format: \"cidrv6\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n }\n };\n});\n////////////////////////////// ZodBase64 //////////////////////////////\nexport function isValidBase64(data) {\n if (data === \"\")\n return true;\n // atob ignores whitespace, so reject it up front.\n if (/\\s/.test(data))\n return false;\n if (data.length % 4 !== 0)\n return false;\n try {\n // @ts-ignore\n atob(data);\n return true;\n }\n catch {\n return false;\n }\n}\nexport const $ZodBase64 = /*@__PURE__*/ core.$constructor(\"$ZodBase64\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.base64);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.contentEncoding = \"base64\";\n inst._zod.check = (payload) => {\n if (isValidBase64(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\n////////////////////////////// ZodBase64 //////////////////////////////\nexport function isValidBase64URL(data) {\n if (!regexes.base64url.test(data))\n return false;\n const base64 = data.replace(/[-_]/g, (c) => (c === \"-\" ? \"+\" : \"/\"));\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, \"=\");\n return isValidBase64(padded);\n}\nexport const $ZodBase64URL = /*@__PURE__*/ core.$constructor(\"$ZodBase64URL\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.base64url);\n $ZodStringFormat.init(inst, def);\n inst._zod.bag.contentEncoding = \"base64url\";\n inst._zod.check = (payload) => {\n if (isValidBase64URL(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"base64url\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodE164 = /*@__PURE__*/ core.$constructor(\"$ZodE164\", (inst, def) => {\n def.pattern ?? (def.pattern = regexes.e164);\n $ZodStringFormat.init(inst, def);\n});\n////////////////////////////// ZodJWT //////////////////////////////\nexport function isValidJWT(token, algorithm = null) {\n try {\n const tokensParts = token.split(\".\");\n if (tokensParts.length !== 3)\n return false;\n const [header] = tokensParts;\n if (!header)\n return false;\n // @ts-ignore\n const parsedHeader = JSON.parse(atob(header));\n if (\"typ\" in parsedHeader && parsedHeader?.typ !== \"JWT\")\n return false;\n if (!parsedHeader.alg)\n return false;\n if (algorithm && (!(\"alg\" in parsedHeader) || parsedHeader.alg !== algorithm))\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nexport const $ZodJWT = /*@__PURE__*/ core.$constructor(\"$ZodJWT\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (isValidJWT(payload.value, def.alg))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: \"jwt\",\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor(\"$ZodCustomStringFormat\", (inst, def) => {\n $ZodStringFormat.init(inst, def);\n inst._zod.check = (payload) => {\n if (def.fn(payload.value))\n return;\n payload.issues.push({\n code: \"invalid_format\",\n format: def.format,\n input: payload.value,\n inst,\n continue: !def.abort,\n });\n };\n});\nexport const $ZodNumber = /*@__PURE__*/ core.$constructor(\"$ZodNumber\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Number(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"number\" && !Number.isNaN(input) && Number.isFinite(input)) {\n return payload;\n }\n const received = typeof input === \"number\"\n ? Number.isNaN(input)\n ? \"NaN\"\n : !Number.isFinite(input)\n ? \"Infinity\"\n : undefined\n : undefined;\n payload.issues.push({\n expected: \"number\",\n code: \"invalid_type\",\n input,\n inst,\n ...(received ? { received } : {}),\n });\n return payload;\n };\n});\nexport const $ZodNumberFormat = /*@__PURE__*/ core.$constructor(\"$ZodNumberFormat\", (inst, def) => {\n checks.$ZodCheckNumberFormat.init(inst, def);\n $ZodNumber.init(inst, def); // no format checks\n});\nexport const $ZodBoolean = /*@__PURE__*/ core.$constructor(\"$ZodBoolean\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.boolean;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = Boolean(payload.value);\n }\n catch (_) { }\n const input = payload.value;\n if (typeof input === \"boolean\")\n return payload;\n payload.issues.push({\n expected: \"boolean\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigInt = /*@__PURE__*/ core.$constructor(\"$ZodBigInt\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.bigint;\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce)\n try {\n payload.value = BigInt(payload.value);\n }\n catch (_) { }\n if (typeof payload.value === \"bigint\")\n return payload;\n payload.issues.push({\n expected: \"bigint\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor(\"$ZodBigIntFormat\", (inst, def) => {\n checks.$ZodCheckBigIntFormat.init(inst, def);\n $ZodBigInt.init(inst, def); // no format checks\n});\nexport const $ZodSymbol = /*@__PURE__*/ core.$constructor(\"$ZodSymbol\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"symbol\")\n return payload;\n payload.issues.push({\n expected: \"symbol\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodUndefined = /*@__PURE__*/ core.$constructor(\"$ZodUndefined\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.undefined;\n inst._zod.values = new Set([undefined]);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"undefined\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodNull = /*@__PURE__*/ core.$constructor(\"$ZodNull\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.pattern = regexes.null;\n inst._zod.values = new Set([null]);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (input === null)\n return payload;\n payload.issues.push({\n expected: \"null\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodAny = /*@__PURE__*/ core.$constructor(\"$ZodAny\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodUnknown = /*@__PURE__*/ core.$constructor(\"$ZodUnknown\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload) => payload;\n});\nexport const $ZodNever = /*@__PURE__*/ core.$constructor(\"$ZodNever\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n payload.issues.push({\n expected: \"never\",\n code: \"invalid_type\",\n input: payload.value,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodVoid = /*@__PURE__*/ core.$constructor(\"$ZodVoid\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (typeof input === \"undefined\")\n return payload;\n payload.issues.push({\n expected: \"void\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodDate = /*@__PURE__*/ core.$constructor(\"$ZodDate\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (def.coerce) {\n try {\n payload.value = new Date(payload.value);\n }\n catch (_err) { }\n }\n const input = payload.value;\n const isDate = input instanceof Date;\n const isValidDate = isDate && !Number.isNaN(input.getTime());\n if (isValidDate)\n return payload;\n payload.issues.push({\n expected: \"date\",\n code: \"invalid_type\",\n input,\n ...(isDate ? { received: \"Invalid Date\" } : {}),\n inst,\n });\n return payload;\n };\n});\nfunction handleArrayResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nexport const $ZodArray = /*@__PURE__*/ core.$constructor(\"$ZodArray\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n expected: \"array\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = Array(input.length);\n const proms = [];\n for (let i = 0; i < input.length; i++) {\n const item = input[i];\n const result = def.element._zod.run({\n value: item,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleArrayResult(result, payload, i)));\n }\n else {\n handleArrayResult(result, payload, i);\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload; //handleArrayResultsAsync(parseResults, final);\n };\n});\nfunction handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {\n const isPresent = key in input;\n if (result.issues.length) {\n // For optional-in/out schemas, ignore errors on absent keys.\n if (isOptionalIn && isOptionalOut && !isPresent) {\n return;\n }\n final.issues.push(...util.prefixIssues(key, result.issues));\n }\n if (!isPresent && !isOptionalIn) {\n if (!result.issues.length) {\n final.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [key],\n });\n }\n return;\n }\n if (result.value === undefined) {\n if (isPresent) {\n final.value[key] = undefined;\n }\n }\n else {\n final.value[key] = result.value;\n }\n}\nfunction normalizeDef(def) {\n const keys = Object.keys(def.shape);\n for (const k of keys) {\n if (!def.shape?.[k]?._zod?.traits?.has(\"$ZodType\")) {\n throw new Error(`Invalid element at key \"${k}\": expected a Zod schema`);\n }\n }\n const okeys = util.optionalKeys(def.shape);\n return {\n ...def,\n keys,\n keySet: new Set(keys),\n numKeys: keys.length,\n optionalKeys: new Set(okeys),\n };\n}\nfunction handleCatchall(proms, input, payload, ctx, def, inst) {\n const unrecognized = [];\n const keySet = def.keySet;\n const _catchall = def.catchall._zod;\n const t = _catchall.def.type;\n const isOptionalIn = _catchall.optin === \"optional\";\n const isOptionalOut = _catchall.optout === \"optional\";\n for (const key in input) {\n // skip __proto__ so it can't replace the result prototype via the\n // assignment setter on the plain {} we build into\n if (key === \"__proto__\")\n continue;\n if (keySet.has(key))\n continue;\n if (t === \"never\") {\n unrecognized.push(key);\n continue;\n }\n const r = _catchall.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));\n }\n else {\n handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);\n }\n }\n if (unrecognized.length) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n keys: unrecognized,\n input,\n inst,\n });\n }\n if (!proms.length)\n return payload;\n return Promise.all(proms).then(() => {\n return payload;\n });\n}\nexport const $ZodObject = /*@__PURE__*/ core.$constructor(\"$ZodObject\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodType.init(inst, def);\n // const sh = def.shape;\n const desc = Object.getOwnPropertyDescriptor(def, \"shape\");\n if (!desc?.get) {\n const sh = def.shape;\n Object.defineProperty(def, \"shape\", {\n get: () => {\n const newSh = { ...sh };\n Object.defineProperty(def, \"shape\", {\n value: newSh,\n });\n return newSh;\n },\n });\n }\n const _normalized = util.cached(() => normalizeDef(def));\n util.defineLazy(inst._zod, \"propValues\", () => {\n const shape = def.shape;\n const propValues = {};\n for (const key in shape) {\n const field = shape[key]._zod;\n if (field.values) {\n propValues[key] ?? (propValues[key] = new Set());\n for (const v of field.values)\n propValues[key].add(v);\n }\n }\n return propValues;\n });\n const isObject = util.isObject;\n const catchall = def.catchall;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n payload.value = {};\n const proms = [];\n const shape = value.shape;\n for (const key of value.keys) {\n const el = shape[key];\n const isOptionalIn = el._zod.optin === \"optional\";\n const isOptionalOut = el._zod.optout === \"optional\";\n const r = el._zod.run({ value: input[key], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));\n }\n else {\n handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);\n }\n }\n if (!catchall) {\n return proms.length ? Promise.all(proms).then(() => payload) : payload;\n }\n return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);\n };\n});\nexport const $ZodObjectJIT = /*@__PURE__*/ core.$constructor(\"$ZodObjectJIT\", (inst, def) => {\n // requires cast because technically $ZodObject doesn't extend\n $ZodObject.init(inst, def);\n const superParse = inst._zod.parse;\n const _normalized = util.cached(() => normalizeDef(def));\n const generateFastpass = (shape) => {\n const doc = new Doc([\"shape\", \"payload\", \"ctx\"]);\n const normalized = _normalized.value;\n const parseStr = (key) => {\n const k = util.esc(key);\n return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;\n };\n doc.write(`const input = payload.value;`);\n const ids = Object.create(null);\n let counter = 0;\n for (const key of normalized.keys) {\n ids[key] = `key_${counter++}`;\n }\n // A: preserve key order {\n doc.write(`const newResult = {};`);\n for (const key of normalized.keys) {\n const id = ids[key];\n const k = util.esc(key);\n const schema = shape[key];\n const isOptionalIn = schema?._zod?.optin === \"optional\";\n const isOptionalOut = schema?._zod?.optout === \"optional\";\n doc.write(`const ${id} = ${parseStr(key)};`);\n if (isOptionalIn && isOptionalOut) {\n // For optional-in/out schemas, ignore errors on absent keys\n doc.write(`\n if (${id}.issues.length) {\n if (${k} in input) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n }\n \n if (${id}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${id}.value;\n }\n \n `);\n }\n else if (!isOptionalIn) {\n doc.write(`\n const ${id}_present = ${k} in input;\n if (${id}.issues.length) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n if (!${id}_present && !${id}.issues.length) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: undefined,\n path: [${k}]\n });\n }\n\n if (${id}_present) {\n if (${id}.value === undefined) {\n newResult[${k}] = undefined;\n } else {\n newResult[${k}] = ${id}.value;\n }\n }\n\n `);\n }\n else {\n doc.write(`\n if (${id}.issues.length) {\n payload.issues = payload.issues.concat(${id}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${k}, ...iss.path] : [${k}]\n })));\n }\n \n if (${id}.value === undefined) {\n if (${k} in input) {\n newResult[${k}] = undefined;\n }\n } else {\n newResult[${k}] = ${id}.value;\n }\n \n `);\n }\n }\n doc.write(`payload.value = newResult;`);\n doc.write(`return payload;`);\n const fn = doc.compile();\n return (payload, ctx) => fn(shape, payload, ctx);\n };\n let fastpass;\n const isObject = util.isObject;\n const jit = !core.globalConfig.jitless;\n const allowsEval = util.allowsEval;\n const fastEnabled = jit && allowsEval.value; // && !def.catchall;\n const catchall = def.catchall;\n let value;\n inst._zod.parse = (payload, ctx) => {\n value ?? (value = _normalized.value);\n const input = payload.value;\n if (!isObject(input)) {\n payload.issues.push({\n expected: \"object\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {\n // always synchronous\n if (!fastpass)\n fastpass = generateFastpass(def.shape);\n payload = fastpass(payload, ctx);\n if (!catchall)\n return payload;\n return handleCatchall([], input, payload, ctx, value, inst);\n }\n return superParse(payload, ctx);\n };\n});\nfunction handleUnionResults(results, final, inst, ctx) {\n for (const result of results) {\n if (result.issues.length === 0) {\n final.value = result.value;\n return final;\n }\n }\n const nonaborted = results.filter((r) => !util.aborted(r));\n if (nonaborted.length === 1) {\n final.value = nonaborted[0].value;\n return nonaborted[0];\n }\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n return final;\n}\nexport const $ZodUnion = /*@__PURE__*/ core.$constructor(\"$ZodUnion\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"optin\", () => def.options.some((o) => o._zod.optin === \"optional\") ? \"optional\" : undefined);\n util.defineLazy(inst._zod, \"optout\", () => def.options.some((o) => o._zod.optout === \"optional\") ? \"optional\" : undefined);\n util.defineLazy(inst._zod, \"values\", () => {\n if (def.options.every((o) => o._zod.values)) {\n return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));\n }\n return undefined;\n });\n util.defineLazy(inst._zod, \"pattern\", () => {\n if (def.options.every((o) => o._zod.pattern)) {\n const patterns = def.options.map((o) => o._zod.pattern);\n return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join(\"|\")})$`);\n }\n return undefined;\n });\n const first = def.options.length === 1 ? def.options[0]._zod.run : null;\n inst._zod.parse = (payload, ctx) => {\n if (first) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n if (result.issues.length === 0)\n return result;\n results.push(result);\n }\n }\n if (!async)\n return handleUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleUnionResults(results, payload, inst, ctx);\n });\n };\n});\nfunction handleExclusiveUnionResults(results, final, inst, ctx) {\n const successes = results.filter((r) => r.issues.length === 0);\n if (successes.length === 1) {\n final.value = successes[0].value;\n return final;\n }\n if (successes.length === 0) {\n // No matches - same as regular union\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),\n });\n }\n else {\n // Multiple matches - exclusive union failure\n final.issues.push({\n code: \"invalid_union\",\n input: final.value,\n inst,\n errors: [],\n inclusive: false,\n });\n }\n return final;\n}\nexport const $ZodXor = /*@__PURE__*/ core.$constructor(\"$ZodXor\", (inst, def) => {\n $ZodUnion.init(inst, def);\n def.inclusive = false;\n const first = def.options.length === 1 ? def.options[0]._zod.run : null;\n inst._zod.parse = (payload, ctx) => {\n if (first) {\n return first(payload, ctx);\n }\n let async = false;\n const results = [];\n for (const option of def.options) {\n const result = option._zod.run({\n value: payload.value,\n issues: [],\n }, ctx);\n if (result instanceof Promise) {\n results.push(result);\n async = true;\n }\n else {\n results.push(result);\n }\n }\n if (!async)\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n return Promise.all(results).then((results) => {\n return handleExclusiveUnionResults(results, payload, inst, ctx);\n });\n };\n});\nexport const $ZodDiscriminatedUnion = \n/*@__PURE__*/\ncore.$constructor(\"$ZodDiscriminatedUnion\", (inst, def) => {\n def.inclusive = false;\n $ZodUnion.init(inst, def);\n const _super = inst._zod.parse;\n util.defineLazy(inst._zod, \"propValues\", () => {\n const propValues = {};\n for (const option of def.options) {\n const pv = option._zod.propValues;\n if (!pv || Object.keys(pv).length === 0)\n throw new Error(`Invalid discriminated union option at index \"${def.options.indexOf(option)}\"`);\n for (const [k, v] of Object.entries(pv)) {\n if (!propValues[k])\n propValues[k] = new Set();\n for (const val of v) {\n propValues[k].add(val);\n }\n }\n }\n return propValues;\n });\n const disc = util.cached(() => {\n const opts = def.options;\n const map = new Map();\n for (const o of opts) {\n const values = o._zod.propValues?.[def.discriminator];\n if (!values || values.size === 0)\n throw new Error(`Invalid discriminated union option at index \"${def.options.indexOf(o)}\"`);\n for (const v of values) {\n if (map.has(v)) {\n throw new Error(`Duplicate discriminator value \"${String(v)}\"`);\n }\n map.set(v, o);\n }\n }\n return map;\n });\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isObject(input)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"object\",\n input,\n inst,\n });\n return payload;\n }\n const opt = disc.value.get(input?.[def.discriminator]);\n if (opt) {\n return opt._zod.run(payload, ctx);\n }\n // Fall back to union matching when the fast discriminator path fails:\n // - explicitly enabled via unionFallback, or\n // - during backward direction (encode), since codec-based discriminators\n // have different values in forward vs backward directions\n if (def.unionFallback || ctx.direction === \"backward\") {\n return _super(payload, ctx);\n }\n // no matching discriminator\n payload.issues.push({\n code: \"invalid_union\",\n errors: [],\n note: \"No matching discriminator\",\n discriminator: def.discriminator,\n options: Array.from(disc.value.keys()),\n input,\n path: [def.discriminator],\n inst,\n });\n return payload;\n };\n});\nexport const $ZodIntersection = /*@__PURE__*/ core.$constructor(\"$ZodIntersection\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n const left = def.left._zod.run({ value: input, issues: [] }, ctx);\n const right = def.right._zod.run({ value: input, issues: [] }, ctx);\n const async = left instanceof Promise || right instanceof Promise;\n if (async) {\n return Promise.all([left, right]).then(([left, right]) => {\n return handleIntersectionResults(payload, left, right);\n });\n }\n return handleIntersectionResults(payload, left, right);\n };\n});\nfunction mergeValues(a, b) {\n // const aType = parse.t(a);\n // const bType = parse.t(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n if (a instanceof Date && b instanceof Date && +a === +b) {\n return { valid: true, data: a };\n }\n if (util.isPlainObject(a) && util.isPlainObject(b)) {\n const bKeys = Object.keys(b);\n const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [key, ...sharedValue.mergeErrorPath],\n };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return { valid: false, mergeErrorPath: [] };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return {\n valid: false,\n mergeErrorPath: [index, ...sharedValue.mergeErrorPath],\n };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n return { valid: false, mergeErrorPath: [] };\n}\nfunction handleIntersectionResults(result, left, right) {\n // Track which side(s) report each key as unrecognized\n const unrecKeys = new Map();\n let unrecIssue;\n for (const iss of left.issues) {\n if (iss.code === \"unrecognized_keys\") {\n unrecIssue ?? (unrecIssue = iss);\n for (const k of iss.keys) {\n if (!unrecKeys.has(k))\n unrecKeys.set(k, {});\n unrecKeys.get(k).l = true;\n }\n }\n else {\n result.issues.push(iss);\n }\n }\n for (const iss of right.issues) {\n if (iss.code === \"unrecognized_keys\") {\n for (const k of iss.keys) {\n if (!unrecKeys.has(k))\n unrecKeys.set(k, {});\n unrecKeys.get(k).r = true;\n }\n }\n else {\n result.issues.push(iss);\n }\n }\n // Report only keys unrecognized by BOTH sides\n const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);\n if (bothKeys.length && unrecIssue) {\n result.issues.push({ ...unrecIssue, keys: bothKeys });\n }\n if (util.aborted(result))\n return result;\n const merged = mergeValues(left.value, right.value);\n if (!merged.valid) {\n throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);\n }\n result.value = merged.data;\n return result;\n}\nexport const $ZodTuple = /*@__PURE__*/ core.$constructor(\"$ZodTuple\", (inst, def) => {\n $ZodType.init(inst, def);\n const items = def.items;\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!Array.isArray(input)) {\n payload.issues.push({\n input,\n inst,\n expected: \"tuple\",\n code: \"invalid_type\",\n });\n return payload;\n }\n payload.value = [];\n const proms = [];\n const optinStart = getTupleOptStart(items, \"optin\");\n const optoutStart = getTupleOptStart(items, \"optout\");\n if (!def.rest) {\n if (input.length < optinStart) {\n payload.issues.push({\n code: \"too_small\",\n minimum: optinStart,\n inclusive: true,\n input,\n inst,\n origin: \"array\",\n });\n return payload;\n }\n if (input.length > items.length) {\n payload.issues.push({\n code: \"too_big\",\n maximum: items.length,\n inclusive: true,\n input,\n inst,\n origin: \"array\",\n });\n }\n }\n // Run every item in parallel, collecting results into an indexed\n // array. The post-processing in `handleTupleResults` walks them in\n // order so it can decide whether an absent optional-output error can\n // truncate the tail or must be reported to preserve required output.\n const itemResults = new Array(items.length);\n for (let i = 0; i < items.length; i++) {\n const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);\n if (r instanceof Promise) {\n proms.push(r.then((rr) => {\n itemResults[i] = rr;\n }));\n }\n else {\n itemResults[i] = r;\n }\n }\n if (def.rest) {\n let i = items.length - 1;\n const rest = input.slice(items.length);\n for (const el of rest) {\n i++;\n const result = def.rest._zod.run({ value: el, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((r) => handleTupleResult(r, payload, i)));\n }\n else {\n handleTupleResult(result, payload, i);\n }\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));\n }\n return handleTupleResults(itemResults, payload, items, input, optoutStart);\n };\n});\nfunction getTupleOptStart(items, key) {\n for (let i = items.length - 1; i >= 0; i--) {\n if (items[i]._zod[key] !== \"optional\")\n return i + 1;\n }\n return 0;\n}\nfunction handleTupleResult(result, final, index) {\n if (result.issues.length) {\n final.issues.push(...util.prefixIssues(index, result.issues));\n }\n final.value[index] = result.value;\n}\nfunction handleTupleResults(itemResults, final, items, input, optoutStart) {\n // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional\n // rule, but only after `optoutStart`: the first index where the output\n // tuple tail can be absent.\n for (let i = 0; i < items.length; i++) {\n const r = itemResults[i];\n const isPresent = i < input.length;\n if (r.issues.length) {\n if (!isPresent && i >= optoutStart) {\n final.value.length = i;\n break;\n }\n final.issues.push(...util.prefixIssues(i, r.issues));\n }\n final.value[i] = r.value;\n }\n // Drop trailing slots that produced `undefined` for absent input\n // (the array analog of an absent optional key on an object). The\n // `i >= input.length` floor is critical: an explicit `undefined`\n // *inside* the input must be preserved even when the schema is\n // optional-out (e.g. `z.string().or(z.undefined())` accepting an\n // explicit undefined value).\n for (let i = final.value.length - 1; i >= input.length; i--) {\n if (items[i]._zod.optout === \"optional\" && final.value[i] === undefined) {\n final.value.length = i;\n }\n else {\n break;\n }\n }\n return final;\n}\nexport const $ZodRecord = /*@__PURE__*/ core.$constructor(\"$ZodRecord\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!util.isPlainObject(input)) {\n payload.issues.push({\n expected: \"record\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n const proms = [];\n const values = def.keyType._zod.values;\n if (values) {\n payload.value = {};\n const recordKeys = new Set();\n for (const key of values) {\n if (typeof key === \"string\" || typeof key === \"number\" || typeof key === \"symbol\") {\n recordKeys.add(typeof key === \"number\" ? key.toString() : key);\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n if (keyResult.issues.length) {\n payload.issues.push({\n code: \"invalid_key\",\n origin: \"record\",\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n input: key,\n path: [key],\n inst,\n });\n continue;\n }\n const outKey = keyResult.value;\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[outKey] = result.value;\n }\n }\n }\n let unrecognized;\n for (const key in input) {\n if (!recordKeys.has(key)) {\n unrecognized = unrecognized ?? [];\n unrecognized.push(key);\n }\n }\n if (unrecognized && unrecognized.length > 0) {\n payload.issues.push({\n code: \"unrecognized_keys\",\n input,\n inst,\n keys: unrecognized,\n });\n }\n }\n else {\n payload.value = {};\n // Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()\n for (const key of Reflect.ownKeys(input)) {\n if (key === \"__proto__\")\n continue;\n if (!Object.prototype.propertyIsEnumerable.call(input, key))\n continue;\n let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n if (keyResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n // Numeric string fallback: if key is a numeric string and failed, retry with Number(key)\n // This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals\n const checkNumericKey = typeof key === \"string\" && regexes.number.test(key) && keyResult.issues.length;\n if (checkNumericKey) {\n const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);\n if (retryResult instanceof Promise) {\n throw new Error(\"Async schemas not supported in object keys currently\");\n }\n if (retryResult.issues.length === 0) {\n keyResult = retryResult;\n }\n }\n if (keyResult.issues.length) {\n if (def.mode === \"loose\") {\n // Pass through unchanged\n payload.value[key] = input[key];\n }\n else {\n // Default \"strict\" behavior: error on invalid key\n payload.issues.push({\n code: \"invalid_key\",\n origin: \"record\",\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n input: key,\n path: [key],\n inst,\n });\n }\n continue;\n }\n const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[keyResult.value] = result.value;\n }));\n }\n else {\n if (result.issues.length) {\n payload.issues.push(...util.prefixIssues(key, result.issues));\n }\n payload.value[keyResult.value] = result.value;\n }\n }\n }\n if (proms.length) {\n return Promise.all(proms).then(() => payload);\n }\n return payload;\n };\n});\nexport const $ZodMap = /*@__PURE__*/ core.$constructor(\"$ZodMap\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Map)) {\n payload.issues.push({\n expected: \"map\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n }\n const proms = [];\n payload.value = new Map();\n for (const [key, value] of input) {\n const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);\n const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);\n if (keyResult instanceof Promise || valueResult instanceof Promise) {\n proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }));\n }\n else {\n handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);\n }\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {\n if (keyResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, keyResult.issues));\n }\n else {\n final.issues.push({\n code: \"invalid_key\",\n origin: \"map\",\n input,\n inst,\n issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n if (valueResult.issues.length) {\n if (util.propertyKeyTypes.has(typeof key)) {\n final.issues.push(...util.prefixIssues(key, valueResult.issues));\n }\n else {\n final.issues.push({\n origin: \"map\",\n code: \"invalid_element\",\n input,\n inst,\n key: key,\n issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n });\n }\n }\n final.value.set(keyResult.value, valueResult.value);\n}\nexport const $ZodSet = /*@__PURE__*/ core.$constructor(\"$ZodSet\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n const input = payload.value;\n if (!(input instanceof Set)) {\n payload.issues.push({\n input,\n inst,\n expected: \"set\",\n code: \"invalid_type\",\n });\n return payload;\n }\n const proms = [];\n payload.value = new Set();\n for (const item of input) {\n const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);\n if (result instanceof Promise) {\n proms.push(result.then((result) => handleSetResult(result, payload)));\n }\n else\n handleSetResult(result, payload);\n }\n if (proms.length)\n return Promise.all(proms).then(() => payload);\n return payload;\n };\n});\nfunction handleSetResult(result, final) {\n if (result.issues.length) {\n final.issues.push(...result.issues);\n }\n final.value.add(result.value);\n}\nexport const $ZodEnum = /*@__PURE__*/ core.$constructor(\"$ZodEnum\", (inst, def) => {\n $ZodType.init(inst, def);\n const values = util.getEnumValues(def.entries);\n const valuesSet = new Set(values);\n inst._zod.values = valuesSet;\n inst._zod.pattern = new RegExp(`^(${values\n .filter((k) => util.propertyKeyTypes.has(typeof k))\n .map((o) => (typeof o === \"string\" ? util.escapeRegex(o) : o.toString()))\n .join(\"|\")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (valuesSet.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodLiteral = /*@__PURE__*/ core.$constructor(\"$ZodLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n if (def.values.length === 0) {\n throw new Error(\"Cannot create literal schema with no valid values\");\n }\n const values = new Set(def.values);\n inst._zod.values = values;\n inst._zod.pattern = new RegExp(`^(${def.values\n .map((o) => (typeof o === \"string\" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))\n .join(\"|\")})$`);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n if (values.has(input)) {\n return payload;\n }\n payload.issues.push({\n code: \"invalid_value\",\n values: def.values,\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodFile = /*@__PURE__*/ core.$constructor(\"$ZodFile\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n const input = payload.value;\n // @ts-ignore\n if (input instanceof File)\n return payload;\n payload.issues.push({\n expected: \"file\",\n code: \"invalid_type\",\n input,\n inst,\n });\n return payload;\n };\n});\nexport const $ZodTransform = /*@__PURE__*/ core.$constructor(\"$ZodTransform\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(inst.constructor.name);\n }\n const _out = def.transform(payload.value, payload);\n if (ctx.async) {\n const output = _out instanceof Promise ? _out : Promise.resolve(_out);\n return output.then((output) => {\n payload.value = output;\n payload.fallback = true;\n return payload;\n });\n }\n if (_out instanceof Promise) {\n throw new core.$ZodAsyncError();\n }\n payload.value = _out;\n payload.fallback = true;\n return payload;\n };\n});\nfunction handleOptionalResult(result, input) {\n if (input === undefined && (result.issues.length || result.fallback)) {\n return { issues: [], value: undefined };\n }\n return result;\n}\nexport const $ZodOptional = /*@__PURE__*/ core.$constructor(\"$ZodOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n inst._zod.optout = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;\n });\n util.defineLazy(inst._zod, \"pattern\", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n if (def.innerType._zod.optin === \"optional\") {\n const input = payload.value;\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise)\n return result.then((r) => handleOptionalResult(r, input));\n return handleOptionalResult(result, input);\n }\n if (payload.value === undefined) {\n return payload;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodExactOptional = /*@__PURE__*/ core.$constructor(\"$ZodExactOptional\", (inst, def) => {\n // Call parent init - inherits optin/optout = \"optional\"\n $ZodOptional.init(inst, def);\n // Override values/pattern to NOT add undefined\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n util.defineLazy(inst._zod, \"pattern\", () => def.innerType._zod.pattern);\n // Override parse to just delegate (no undefined handling)\n inst._zod.parse = (payload, ctx) => {\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNullable = /*@__PURE__*/ core.$constructor(\"$ZodNullable\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"optin\", () => def.innerType._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.innerType._zod.optout);\n util.defineLazy(inst._zod, \"pattern\", () => {\n const pattern = def.innerType._zod.pattern;\n return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;\n });\n util.defineLazy(inst._zod, \"values\", () => {\n return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n // Forward direction (decode): allow null to pass through\n if (payload.value === null)\n return payload;\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodDefault = /*@__PURE__*/ core.$constructor(\"$ZodDefault\", (inst, def) => {\n $ZodType.init(inst, def);\n // inst._zod.qin = \"true\";\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply defaults for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n /**\n * $ZodDefault returns the default value immediately in forward direction.\n * It doesn't pass the default value into the validator (\"prefault\"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a \"prefault\" for the pipe. */\n return payload;\n }\n // Forward direction: continue with default handling\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleDefaultResult(result, def));\n }\n return handleDefaultResult(result, def);\n };\n});\nfunction handleDefaultResult(payload, def) {\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return payload;\n}\nexport const $ZodPrefault = /*@__PURE__*/ core.$constructor(\"$ZodPrefault\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply prefault for undefined input\n if (payload.value === undefined) {\n payload.value = def.defaultValue;\n }\n return def.innerType._zod.run(payload, ctx);\n };\n});\nexport const $ZodNonOptional = /*@__PURE__*/ core.$constructor(\"$ZodNonOptional\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => {\n const v = def.innerType._zod.values;\n return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;\n });\n inst._zod.parse = (payload, ctx) => {\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => handleNonOptionalResult(result, inst));\n }\n return handleNonOptionalResult(result, inst);\n };\n});\nfunction handleNonOptionalResult(payload, inst) {\n if (!payload.issues.length && payload.value === undefined) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"nonoptional\",\n input: payload.value,\n inst,\n });\n }\n return payload;\n}\nexport const $ZodSuccess = /*@__PURE__*/ core.$constructor(\"$ZodSuccess\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(\"ZodSuccess\");\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => {\n payload.value = result.issues.length === 0;\n return payload;\n });\n }\n payload.value = result.issues.length === 0;\n return payload;\n };\n});\nexport const $ZodCatch = /*@__PURE__*/ core.$constructor(\"$ZodCatch\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.optin = \"optional\";\n util.defineLazy(inst._zod, \"optout\", () => def.innerType._zod.optout);\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n // Forward direction (decode): apply catch logic\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then((result) => {\n payload.value = result.value;\n if (result.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n },\n input: payload.value,\n });\n payload.issues = [];\n payload.fallback = true;\n }\n return payload;\n });\n }\n payload.value = result.value;\n if (result.issues.length) {\n payload.value = def.catchValue({\n ...payload,\n error: {\n issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),\n },\n input: payload.value,\n });\n payload.issues = [];\n payload.fallback = true;\n }\n return payload;\n };\n});\nexport const $ZodNaN = /*@__PURE__*/ core.$constructor(\"$ZodNaN\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"number\" || !Number.isNaN(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"nan\",\n code: \"invalid_type\",\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodPipe = /*@__PURE__*/ core.$constructor(\"$ZodPipe\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => def.in._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.in._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.out._zod.optout);\n util.defineLazy(inst._zod, \"propValues\", () => def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handlePipeResult(right, def.in, ctx));\n }\n return handlePipeResult(right, def.in, ctx);\n }\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handlePipeResult(left, def.out, ctx));\n }\n return handlePipeResult(left, def.out, ctx);\n };\n});\nfunction handlePipeResult(left, next, ctx) {\n if (left.issues.length) {\n // prevent further checks\n left.aborted = true;\n return left;\n }\n return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);\n}\nexport const $ZodCodec = /*@__PURE__*/ core.$constructor(\"$ZodCodec\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"values\", () => def.in._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.in._zod.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.out._zod.optout);\n util.defineLazy(inst._zod, \"propValues\", () => def.in._zod.propValues);\n inst._zod.parse = (payload, ctx) => {\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const left = def.in._zod.run(payload, ctx);\n if (left instanceof Promise) {\n return left.then((left) => handleCodecAResult(left, def, ctx));\n }\n return handleCodecAResult(left, def, ctx);\n }\n else {\n const right = def.out._zod.run(payload, ctx);\n if (right instanceof Promise) {\n return right.then((right) => handleCodecAResult(right, def, ctx));\n }\n return handleCodecAResult(right, def, ctx);\n }\n };\n});\nfunction handleCodecAResult(result, def, ctx) {\n if (result.issues.length) {\n // prevent further checks\n result.aborted = true;\n return result;\n }\n const direction = ctx.direction || \"forward\";\n if (direction === \"forward\") {\n const transformed = def.transform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));\n }\n return handleCodecTxResult(result, transformed, def.out, ctx);\n }\n else {\n const transformed = def.reverseTransform(result.value, result);\n if (transformed instanceof Promise) {\n return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));\n }\n return handleCodecTxResult(result, transformed, def.in, ctx);\n }\n}\nfunction handleCodecTxResult(left, value, nextSchema, ctx) {\n // Check if transform added any issues\n if (left.issues.length) {\n left.aborted = true;\n return left;\n }\n return nextSchema._zod.run({ value, issues: left.issues }, ctx);\n}\nexport const $ZodPreprocess = /*@__PURE__*/ core.$constructor(\"$ZodPreprocess\", (inst, def) => {\n $ZodPipe.init(inst, def);\n});\nexport const $ZodReadonly = /*@__PURE__*/ core.$constructor(\"$ZodReadonly\", (inst, def) => {\n $ZodType.init(inst, def);\n util.defineLazy(inst._zod, \"propValues\", () => def.innerType._zod.propValues);\n util.defineLazy(inst._zod, \"values\", () => def.innerType._zod.values);\n util.defineLazy(inst._zod, \"optin\", () => def.innerType?._zod?.optin);\n util.defineLazy(inst._zod, \"optout\", () => def.innerType?._zod?.optout);\n inst._zod.parse = (payload, ctx) => {\n if (ctx.direction === \"backward\") {\n return def.innerType._zod.run(payload, ctx);\n }\n const result = def.innerType._zod.run(payload, ctx);\n if (result instanceof Promise) {\n return result.then(handleReadonlyResult);\n }\n return handleReadonlyResult(result);\n };\n});\nfunction handleReadonlyResult(payload) {\n payload.value = Object.freeze(payload.value);\n return payload;\n}\nexport const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor(\"$ZodTemplateLiteral\", (inst, def) => {\n $ZodType.init(inst, def);\n const regexParts = [];\n for (const part of def.parts) {\n if (typeof part === \"object\" && part !== null) {\n // is Zod schema\n if (!part._zod.pattern) {\n // if (!source)\n throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);\n }\n const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;\n if (!source)\n throw new Error(`Invalid template literal part: ${part._zod.traits}`);\n const start = source.startsWith(\"^\") ? 1 : 0;\n const end = source.endsWith(\"$\") ? source.length - 1 : source.length;\n regexParts.push(source.slice(start, end));\n }\n else if (part === null || util.primitiveTypes.has(typeof part)) {\n regexParts.push(util.escapeRegex(`${part}`));\n }\n else {\n throw new Error(`Invalid template literal part: ${part}`);\n }\n }\n inst._zod.pattern = new RegExp(`^${regexParts.join(\"\")}$`);\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"string\") {\n payload.issues.push({\n input: payload.value,\n inst,\n expected: \"string\",\n code: \"invalid_type\",\n });\n return payload;\n }\n inst._zod.pattern.lastIndex = 0;\n if (!inst._zod.pattern.test(payload.value)) {\n payload.issues.push({\n input: payload.value,\n inst,\n code: \"invalid_format\",\n format: def.format ?? \"template_literal\",\n pattern: inst._zod.pattern.source,\n });\n return payload;\n }\n return payload;\n };\n});\nexport const $ZodFunction = /*@__PURE__*/ core.$constructor(\"$ZodFunction\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._def = def;\n inst._zod.def = def;\n inst.implement = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implement() must be called with a function\");\n }\n return function (...args) {\n const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;\n const result = Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return parse(inst._def.output, result);\n }\n return result;\n };\n };\n inst.implementAsync = (func) => {\n if (typeof func !== \"function\") {\n throw new Error(\"implementAsync() must be called with a function\");\n }\n return async function (...args) {\n const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;\n const result = await Reflect.apply(func, this, parsedArgs);\n if (inst._def.output) {\n return await parseAsync(inst._def.output, result);\n }\n return result;\n };\n };\n inst._zod.parse = (payload, _ctx) => {\n if (typeof payload.value !== \"function\") {\n payload.issues.push({\n code: \"invalid_type\",\n expected: \"function\",\n input: payload.value,\n inst,\n });\n return payload;\n }\n // Check if output is a promise type to determine if we should use async implementation\n const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === \"promise\";\n if (hasPromiseOutput) {\n payload.value = inst.implementAsync(payload.value);\n }\n else {\n payload.value = inst.implement(payload.value);\n }\n return payload;\n };\n inst.input = (...args) => {\n const F = inst.constructor;\n if (Array.isArray(args[0])) {\n return new F({\n type: \"function\",\n input: new $ZodTuple({\n type: \"tuple\",\n items: args[0],\n rest: args[1],\n }),\n output: inst._def.output,\n });\n }\n return new F({\n type: \"function\",\n input: args[0],\n output: inst._def.output,\n });\n };\n inst.output = (output) => {\n const F = inst.constructor;\n return new F({\n type: \"function\",\n input: inst._def.input,\n output,\n });\n };\n return inst;\n});\nexport const $ZodPromise = /*@__PURE__*/ core.$constructor(\"$ZodPromise\", (inst, def) => {\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, ctx) => {\n return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));\n };\n});\nexport const $ZodLazy = /*@__PURE__*/ core.$constructor(\"$ZodLazy\", (inst, def) => {\n $ZodType.init(inst, def);\n // Cache the resolved inner type on the shared `def` so all clones of this\n // lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,\n // preserving identity for cycle detection on recursive schemas.\n util.defineLazy(inst._zod, \"innerType\", () => {\n const d = def;\n if (!d._cachedInner)\n d._cachedInner = def.getter();\n return d._cachedInner;\n });\n util.defineLazy(inst._zod, \"pattern\", () => inst._zod.innerType?._zod?.pattern);\n util.defineLazy(inst._zod, \"propValues\", () => inst._zod.innerType?._zod?.propValues);\n util.defineLazy(inst._zod, \"optin\", () => inst._zod.innerType?._zod?.optin ?? undefined);\n util.defineLazy(inst._zod, \"optout\", () => inst._zod.innerType?._zod?.optout ?? undefined);\n inst._zod.parse = (payload, ctx) => {\n const inner = inst._zod.innerType;\n return inner._zod.run(payload, ctx);\n };\n});\nexport const $ZodCustom = /*@__PURE__*/ core.$constructor(\"$ZodCustom\", (inst, def) => {\n checks.$ZodCheck.init(inst, def);\n $ZodType.init(inst, def);\n inst._zod.parse = (payload, _) => {\n return payload;\n };\n inst._zod.check = (payload) => {\n const input = payload.value;\n const r = def.fn(input);\n if (r instanceof Promise) {\n return r.then((r) => handleRefineResult(r, payload, input, inst));\n }\n handleRefineResult(r, payload, input, inst);\n return;\n };\n});\nfunction handleRefineResult(result, payload, input, inst) {\n if (!result) {\n const _iss = {\n code: \"custom\",\n input,\n inst, // incorporates params.error into issue reporting\n path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting\n continue: !inst._zod.def.abort,\n // params: inst._zod.def.params,\n };\n if (inst._zod.def.params)\n _iss.params = inst._zod.def.params;\n payload.issues.push(util.issue(_iss));\n }\n}\n","var _a;\nexport const $output = Symbol(\"ZodOutput\");\nexport const $input = Symbol(\"ZodInput\");\nexport class $ZodRegistry {\n constructor() {\n this._map = new WeakMap();\n this._idmap = new Map();\n }\n add(schema, ..._meta) {\n const meta = _meta[0];\n this._map.set(schema, meta);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.set(meta.id, schema);\n }\n return this;\n }\n clear() {\n this._map = new WeakMap();\n this._idmap = new Map();\n return this;\n }\n remove(schema) {\n const meta = this._map.get(schema);\n if (meta && typeof meta === \"object\" && \"id\" in meta) {\n this._idmap.delete(meta.id);\n }\n this._map.delete(schema);\n return this;\n }\n get(schema) {\n // return this._map.get(schema) as any;\n // inherit metadata\n const p = schema._zod.parent;\n if (p) {\n const pm = { ...(this.get(p) ?? {}) };\n delete pm.id; // do not inherit id\n const f = { ...pm, ...this._map.get(schema) };\n return Object.keys(f).length ? f : undefined;\n }\n return this._map.get(schema);\n }\n has(schema) {\n return this._map.has(schema);\n }\n}\n// registries\nexport function registry() {\n return new $ZodRegistry();\n}\n(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());\nexport const globalRegistry = globalThis.__zod_globalRegistry;\n","import * as checks from \"./checks.js\";\nimport * as registries from \"./registries.js\";\nimport * as schemas from \"./schemas.js\";\nimport * as util from \"./util.js\";\n// @__NO_SIDE_EFFECTS__\nexport function _string(Class, params) {\n return new Class({\n type: \"string\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedString(Class, params) {\n return new Class({\n type: \"string\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _email(Class, params) {\n return new Class({\n type: \"string\",\n format: \"email\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _guid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"guid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v4\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v6\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uuidv7(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v7\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _emoji(Class, params) {\n return new Class({\n type: \"string\",\n format: \"emoji\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nanoid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"nanoid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link _cuid2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\n// @__NO_SIDE_EFFECTS__\nexport function _cuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cuid2(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid2\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ulid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ulid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _xid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"xid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ksuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ksuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ipv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _ipv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _mac(Class, params) {\n return new Class({\n type: \"string\",\n format: \"mac\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cidrv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _cidrv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _base64(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _base64url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _e164(Class, params) {\n return new Class({\n type: \"string\",\n format: \"e164\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _jwt(Class, params) {\n return new Class({\n type: \"string\",\n format: \"jwt\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport const TimePrecision = {\n Any: null,\n Minute: -1,\n Second: 0,\n Millisecond: 3,\n Microsecond: 6,\n};\n// @__NO_SIDE_EFFECTS__\nexport function _isoDateTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"datetime\",\n check: \"string_format\",\n offset: false,\n local: false,\n precision: null,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoDate(Class, params) {\n return new Class({\n type: \"string\",\n format: \"date\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"time\",\n check: \"string_format\",\n precision: null,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _isoDuration(Class, params) {\n return new Class({\n type: \"string\",\n format: \"duration\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _number(Class, params) {\n return new Class({\n type: \"number\",\n checks: [],\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedNumber(Class, params) {\n return new Class({\n type: \"number\",\n coerce: true,\n checks: [],\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"safeint\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _float32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _float64(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"int32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uint32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"uint32\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _boolean(Class, params) {\n return new Class({\n type: \"boolean\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedBoolean(Class, params) {\n return new Class({\n type: \"boolean\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _bigint(Class, params) {\n return new Class({\n type: \"bigint\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedBigint(Class, params) {\n return new Class({\n type: \"bigint\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _int64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"int64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uint64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"uint64\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _symbol(Class, params) {\n return new Class({\n type: \"symbol\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _undefined(Class, params) {\n return new Class({\n type: \"undefined\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _null(Class, params) {\n return new Class({\n type: \"null\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _any(Class) {\n return new Class({\n type: \"any\",\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _unknown(Class) {\n return new Class({\n type: \"unknown\",\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _never(Class, params) {\n return new Class({\n type: \"never\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _void(Class, params) {\n return new Class({\n type: \"void\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _date(Class, params) {\n return new Class({\n type: \"date\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _coercedDate(Class, params) {\n return new Class({\n type: \"date\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nan(Class, params) {\n return new Class({\n type: \"nan\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lt(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lte(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.lte()` instead. */\n_lte as _max, };\n// @__NO_SIDE_EFFECTS__\nexport function _gt(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _gte(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.gte()` instead. */\n_gte as _min, };\n// @__NO_SIDE_EFFECTS__\nexport function _positive(params) {\n return _gt(0, params);\n}\n// negative\n// @__NO_SIDE_EFFECTS__\nexport function _negative(params) {\n return _lt(0, params);\n}\n// nonpositive\n// @__NO_SIDE_EFFECTS__\nexport function _nonpositive(params) {\n return _lte(0, params);\n}\n// nonnegative\n// @__NO_SIDE_EFFECTS__\nexport function _nonnegative(params) {\n return _gte(0, params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function _multipleOf(value, params) {\n return new checks.$ZodCheckMultipleOf({\n check: \"multiple_of\",\n ...util.normalizeParams(params),\n value,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _maxSize(maximum, params) {\n return new checks.$ZodCheckMaxSize({\n check: \"max_size\",\n ...util.normalizeParams(params),\n maximum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _minSize(minimum, params) {\n return new checks.$ZodCheckMinSize({\n check: \"min_size\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _size(size, params) {\n return new checks.$ZodCheckSizeEquals({\n check: \"size_equals\",\n ...util.normalizeParams(params),\n size,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _maxLength(maximum, params) {\n const ch = new checks.$ZodCheckMaxLength({\n check: \"max_length\",\n ...util.normalizeParams(params),\n maximum,\n });\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _minLength(minimum, params) {\n return new checks.$ZodCheckMinLength({\n check: \"min_length\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _length(length, params) {\n return new checks.$ZodCheckLengthEquals({\n check: \"length_equals\",\n ...util.normalizeParams(params),\n length,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _regex(pattern, params) {\n return new checks.$ZodCheckRegex({\n check: \"string_format\",\n format: \"regex\",\n ...util.normalizeParams(params),\n pattern,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lowercase(params) {\n return new checks.$ZodCheckLowerCase({\n check: \"string_format\",\n format: \"lowercase\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _uppercase(params) {\n return new checks.$ZodCheckUpperCase({\n check: \"string_format\",\n format: \"uppercase\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _includes(includes, params) {\n return new checks.$ZodCheckIncludes({\n check: \"string_format\",\n format: \"includes\",\n ...util.normalizeParams(params),\n includes,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _startsWith(prefix, params) {\n return new checks.$ZodCheckStartsWith({\n check: \"string_format\",\n format: \"starts_with\",\n ...util.normalizeParams(params),\n prefix,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _endsWith(suffix, params) {\n return new checks.$ZodCheckEndsWith({\n check: \"string_format\",\n format: \"ends_with\",\n ...util.normalizeParams(params),\n suffix,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _property(property, schema, params) {\n return new checks.$ZodCheckProperty({\n check: \"property\",\n property,\n schema,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _mime(types, params) {\n return new checks.$ZodCheckMimeType({\n check: \"mime_type\",\n mime: types,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _overwrite(tx) {\n return new checks.$ZodCheckOverwrite({\n check: \"overwrite\",\n tx,\n });\n}\n// normalize\n// @__NO_SIDE_EFFECTS__\nexport function _normalize(form) {\n return _overwrite((input) => input.normalize(form));\n}\n// trim\n// @__NO_SIDE_EFFECTS__\nexport function _trim() {\n return _overwrite((input) => input.trim());\n}\n// toLowerCase\n// @__NO_SIDE_EFFECTS__\nexport function _toLowerCase() {\n return _overwrite((input) => input.toLowerCase());\n}\n// toUpperCase\n// @__NO_SIDE_EFFECTS__\nexport function _toUpperCase() {\n return _overwrite((input) => input.toUpperCase());\n}\n// slugify\n// @__NO_SIDE_EFFECTS__\nexport function _slugify() {\n return _overwrite((input) => util.slugify(input));\n}\n// @__NO_SIDE_EFFECTS__\nexport function _array(Class, element, params) {\n return new Class({\n type: \"array\",\n element,\n // get element() {\n // return element;\n // },\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _union(Class, options, params) {\n return new Class({\n type: \"union\",\n options,\n ...util.normalizeParams(params),\n });\n}\nexport function _xor(Class, options, params) {\n return new Class({\n type: \"union\",\n options,\n inclusive: false,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _discriminatedUnion(Class, discriminator, options, params) {\n return new Class({\n type: \"union\",\n options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _intersection(Class, left, right) {\n return new Class({\n type: \"intersection\",\n left,\n right,\n });\n}\n// export function _tuple(\n// Class: util.SchemaClass<schemas.$ZodTuple>,\n// items: [],\n// params?: string | $ZodTupleParams\n// ): schemas.$ZodTuple<[], null>;\n// @__NO_SIDE_EFFECTS__\nexport function _tuple(Class, items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof schemas.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new Class({\n type: \"tuple\",\n items,\n rest,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _record(Class, keyType, valueType, params) {\n return new Class({\n type: \"record\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _map(Class, keyType, valueType, params) {\n return new Class({\n type: \"map\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _set(Class, valueType, params) {\n return new Class({\n type: \"set\",\n valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _enum(Class, values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n // if (Array.isArray(values)) {\n // for (const value of values) {\n // entries[value] = value;\n // }\n // } else {\n // Object.assign(entries, values);\n // }\n // const entries: util.EnumLike = {};\n // for (const val of values) {\n // entries[val] = val;\n // }\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function _nativeEnum(Class, entries, params) {\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _literal(Class, value, params) {\n return new Class({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _file(Class, params) {\n return new Class({\n type: \"file\",\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _transform(Class, fn) {\n return new Class({\n type: \"transform\",\n transform: fn,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _optional(Class, innerType) {\n return new Class({\n type: \"optional\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nullable(Class, innerType) {\n return new Class({\n type: \"nullable\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _default(Class, innerType, defaultValue) {\n return new Class({\n type: \"default\",\n innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _nonoptional(Class, innerType, params) {\n return new Class({\n type: \"nonoptional\",\n innerType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _success(Class, innerType) {\n return new Class({\n type: \"success\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _catch(Class, innerType, catchValue) {\n return new Class({\n type: \"catch\",\n innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : () => catchValue),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _pipe(Class, in_, out) {\n return new Class({\n type: \"pipe\",\n in: in_,\n out,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _readonly(Class, innerType) {\n return new Class({\n type: \"readonly\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _templateLiteral(Class, parts, params) {\n return new Class({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _lazy(Class, getter) {\n return new Class({\n type: \"lazy\",\n getter,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _promise(Class, innerType) {\n return new Class({\n type: \"promise\",\n innerType,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function _custom(Class, fn, _params) {\n const norm = util.normalizeParams(_params);\n norm.abort ?? (norm.abort = true); // default to abort:false\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...norm,\n });\n return schema;\n}\n// same as _custom but defaults to abort:false\n// @__NO_SIDE_EFFECTS__\nexport function _refine(Class, fn, _params) {\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...util.normalizeParams(_params),\n });\n return schema;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _superRefine(fn, params) {\n const ch = _check((payload) => {\n payload.addIssue = (issue) => {\n if (typeof issue === \"string\") {\n payload.issues.push(util.issue(issue, payload.value, ch._zod.def));\n }\n else {\n // for Zod 3 backwards compatibility\n const _issue = issue;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = \"custom\");\n _issue.input ?? (_issue.input = payload.value);\n _issue.inst ?? (_issue.inst = ch);\n _issue.continue ?? (_issue.continue = !ch._zod.def.abort); // abort is always undefined, so this is always true...\n payload.issues.push(util.issue(_issue));\n }\n };\n return fn(payload.value, payload);\n }, params);\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _check(fn, params) {\n const ch = new checks.$ZodCheck({\n check: \"custom\",\n ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function describe(description) {\n const ch = new checks.$ZodCheck({ check: \"describe\" });\n ch._zod.onattach = [\n (inst) => {\n const existing = registries.globalRegistry.get(inst) ?? {};\n registries.globalRegistry.add(inst, { ...existing, description });\n },\n ];\n ch._zod.check = () => { }; // no-op check\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function meta(metadata) {\n const ch = new checks.$ZodCheck({ check: \"meta\" });\n ch._zod.onattach = [\n (inst) => {\n const existing = registries.globalRegistry.get(inst) ?? {};\n registries.globalRegistry.add(inst, { ...existing, ...metadata });\n },\n ];\n ch._zod.check = () => { }; // no-op check\n return ch;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _stringbool(Classes, _params) {\n const params = util.normalizeParams(_params);\n let truthyArray = params.truthy ?? [\"true\", \"1\", \"yes\", \"on\", \"y\", \"enabled\"];\n let falsyArray = params.falsy ?? [\"false\", \"0\", \"no\", \"off\", \"n\", \"disabled\"];\n if (params.case !== \"sensitive\") {\n truthyArray = truthyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n falsyArray = falsyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n }\n const truthySet = new Set(truthyArray);\n const falsySet = new Set(falsyArray);\n const _Codec = Classes.Codec ?? schemas.$ZodCodec;\n const _Boolean = Classes.Boolean ?? schemas.$ZodBoolean;\n const _String = Classes.String ?? schemas.$ZodString;\n const stringSchema = new _String({ type: \"string\", error: params.error });\n const booleanSchema = new _Boolean({ type: \"boolean\", error: params.error });\n const codec = new _Codec({\n type: \"pipe\",\n in: stringSchema,\n out: booleanSchema,\n transform: ((input, payload) => {\n let data = input;\n if (params.case !== \"sensitive\")\n data = data.toLowerCase();\n if (truthySet.has(data)) {\n return true;\n }\n else if (falsySet.has(data)) {\n return false;\n }\n else {\n payload.issues.push({\n code: \"invalid_value\",\n expected: \"stringbool\",\n values: [...truthySet, ...falsySet],\n input: payload.value,\n inst: codec,\n continue: false,\n });\n return {};\n }\n }),\n reverseTransform: ((input, _payload) => {\n if (input === true) {\n return truthyArray[0] || \"true\";\n }\n else {\n return falsyArray[0] || \"false\";\n }\n }),\n error: params.error,\n });\n return codec;\n}\n// @__NO_SIDE_EFFECTS__\nexport function _stringFormat(Class, format, fnOrRegex, _params = {}) {\n const params = util.normalizeParams(_params);\n const def = {\n ...util.normalizeParams(_params),\n check: \"string_format\",\n type: \"string\",\n format,\n fn: typeof fnOrRegex === \"function\" ? fnOrRegex : (val) => fnOrRegex.test(val),\n ...params,\n };\n if (fnOrRegex instanceof RegExp) {\n def.pattern = fnOrRegex;\n }\n const inst = new Class(def);\n return inst;\n}\n","import { globalRegistry } from \"./registries.js\";\n// function initializeContext<T extends schemas.$ZodType>(inputs: JSONSchemaGeneratorParams<T>): ToJSONSchemaContext<T> {\n// return {\n// processor: inputs.processor,\n// metadataRegistry: inputs.metadata ?? globalRegistry,\n// target: inputs.target ?? \"draft-2020-12\",\n// unrepresentable: inputs.unrepresentable ?? \"throw\",\n// };\n// }\nexport function initializeContext(params) {\n // Normalize target: convert old non-hyphenated versions to hyphenated versions\n let target = params?.target ?? \"draft-2020-12\";\n if (target === \"draft-4\")\n target = \"draft-04\";\n if (target === \"draft-7\")\n target = \"draft-07\";\n return {\n processors: params.processors ?? {},\n metadataRegistry: params?.metadata ?? globalRegistry,\n target,\n unrepresentable: params?.unrepresentable ?? \"throw\",\n override: params?.override ?? (() => { }),\n io: params?.io ?? \"output\",\n counter: 0,\n seen: new Map(),\n cycles: params?.cycles ?? \"ref\",\n reused: params?.reused ?? \"inline\",\n external: params?.external ?? undefined,\n };\n}\nexport function process(schema, ctx, _params = { path: [], schemaPath: [] }) {\n var _a;\n const def = schema._zod.def;\n // check for schema in seens\n const seen = ctx.seen.get(schema);\n if (seen) {\n seen.count++;\n // check if cycle\n const isCycle = _params.schemaPath.includes(schema);\n if (isCycle) {\n seen.cycle = _params.path;\n }\n return seen.schema;\n }\n // initialize\n const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };\n ctx.seen.set(schema, result);\n // custom method overrides default behavior\n const overrideSchema = schema._zod.toJSONSchema?.();\n if (overrideSchema) {\n result.schema = overrideSchema;\n }\n else {\n const params = {\n ..._params,\n schemaPath: [..._params.schemaPath, schema],\n path: _params.path,\n };\n if (schema._zod.processJSONSchema) {\n schema._zod.processJSONSchema(ctx, result.schema, params);\n }\n else {\n const _json = result.schema;\n const processor = ctx.processors[def.type];\n if (!processor) {\n throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);\n }\n processor(schema, ctx, _json, params);\n }\n const parent = schema._zod.parent;\n if (parent) {\n // Also set ref if processor didn't (for inheritance)\n if (!result.ref)\n result.ref = parent;\n process(parent, ctx, params);\n ctx.seen.get(parent).isParent = true;\n }\n }\n // metadata\n const meta = ctx.metadataRegistry.get(schema);\n if (meta)\n Object.assign(result.schema, meta);\n if (ctx.io === \"input\" && isTransforming(schema)) {\n // examples/defaults only apply to output type of pipe\n delete result.schema.examples;\n delete result.schema.default;\n }\n // set prefault as default\n if (ctx.io === \"input\" && \"_prefault\" in result.schema)\n (_a = result.schema).default ?? (_a.default = result.schema._prefault);\n delete result.schema._prefault;\n // pulling fresh from ctx.seen in case it was overwritten\n const _result = ctx.seen.get(schema);\n return _result.schema;\n}\nexport function extractDefs(ctx, schema\n// params: EmitParams\n) {\n // iterate over seen map;\n const root = ctx.seen.get(schema);\n if (!root)\n throw new Error(\"Unprocessed schema. This is a bug in Zod.\");\n // Track ids to detect duplicates across different schemas\n const idToSchema = new Map();\n for (const entry of ctx.seen.entries()) {\n const id = ctx.metadataRegistry.get(entry[0])?.id;\n if (id) {\n const existing = idToSchema.get(id);\n if (existing && existing !== entry[0]) {\n throw new Error(`Duplicate schema id \"${id}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);\n }\n idToSchema.set(id, entry[0]);\n }\n }\n // returns a ref to the schema\n // defId will be empty if the ref points to an external schema (or #)\n const makeURI = (entry) => {\n // comparing the seen objects because sometimes\n // multiple schemas map to the same seen object.\n // e.g. lazy\n // external is configured\n const defsSegment = ctx.target === \"draft-2020-12\" ? \"$defs\" : \"definitions\";\n if (ctx.external) {\n const externalId = ctx.external.registry.get(entry[0])?.id; // ?? \"__shared\";// `__schema${ctx.counter++}`;\n // check if schema is in the external registry\n const uriGenerator = ctx.external.uri ?? ((id) => id);\n if (externalId) {\n return { ref: uriGenerator(externalId) };\n }\n // otherwise, add to __shared\n const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;\n entry[1].defId = id; // set defId so it will be reused if needed\n return { defId: id, ref: `${uriGenerator(\"__shared\")}#/${defsSegment}/${id}` };\n }\n if (entry[1] === root) {\n return { ref: \"#\" };\n }\n // self-contained schema\n const uriPrefix = `#`;\n const defUriPrefix = `${uriPrefix}/${defsSegment}/`;\n const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;\n return { defId, ref: defUriPrefix + defId };\n };\n // stored cached version in `def` property\n // remove all properties, set $ref\n const extractToDef = (entry) => {\n // if the schema is already a reference, do not extract it\n if (entry[1].schema.$ref) {\n return;\n }\n const seen = entry[1];\n const { ref, defId } = makeURI(entry);\n seen.def = { ...seen.schema };\n // defId won't be set if the schema is a reference to an external schema\n // or if the schema is the root schema\n if (defId)\n seen.defId = defId;\n // wipe away all properties except $ref\n const schema = seen.schema;\n for (const key in schema) {\n delete schema[key];\n }\n schema.$ref = ref;\n };\n // throw on cycles\n // break cycles\n if (ctx.cycles === \"throw\") {\n for (const entry of ctx.seen.entries()) {\n const seen = entry[1];\n if (seen.cycle) {\n throw new Error(\"Cycle detected: \" +\n `#/${seen.cycle?.join(\"/\")}/<root>` +\n '\\n\\nSet the `cycles` parameter to `\"ref\"` to resolve cyclical schemas with defs.');\n }\n }\n }\n // extract schemas into $defs\n for (const entry of ctx.seen.entries()) {\n const seen = entry[1];\n // convert root schema to # $ref\n if (schema === entry[0]) {\n extractToDef(entry); // this has special handling for the root schema\n continue;\n }\n // extract schemas that are in the external registry\n if (ctx.external) {\n const ext = ctx.external.registry.get(entry[0])?.id;\n if (schema !== entry[0] && ext) {\n extractToDef(entry);\n continue;\n }\n }\n // extract schemas with `id` meta\n const id = ctx.metadataRegistry.get(entry[0])?.id;\n if (id) {\n extractToDef(entry);\n continue;\n }\n // break cycles\n if (seen.cycle) {\n // any\n extractToDef(entry);\n continue;\n }\n // extract reused schemas\n if (seen.count > 1) {\n if (ctx.reused === \"ref\") {\n extractToDef(entry);\n // biome-ignore lint:\n continue;\n }\n }\n }\n}\nexport function finalize(ctx, schema) {\n const root = ctx.seen.get(schema);\n if (!root)\n throw new Error(\"Unprocessed schema. This is a bug in Zod.\");\n // flatten refs - inherit properties from parent schemas\n const flattenRef = (zodSchema) => {\n const seen = ctx.seen.get(zodSchema);\n // already processed\n if (seen.ref === null)\n return;\n const schema = seen.def ?? seen.schema;\n const _cached = { ...schema };\n const ref = seen.ref;\n seen.ref = null; // prevent infinite recursion\n if (ref) {\n flattenRef(ref);\n const refSeen = ctx.seen.get(ref);\n const refSchema = refSeen.schema;\n // merge referenced schema into current\n if (refSchema.$ref && (ctx.target === \"draft-07\" || ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\")) {\n // older drafts can't combine $ref with other properties\n schema.allOf = schema.allOf ?? [];\n schema.allOf.push(refSchema);\n }\n else {\n Object.assign(schema, refSchema);\n }\n // restore child's own properties (child wins)\n Object.assign(schema, _cached);\n const isParentRef = zodSchema._zod.parent === ref;\n // For parent chain, child is a refinement - remove parent-only properties\n if (isParentRef) {\n for (const key in schema) {\n if (key === \"$ref\" || key === \"allOf\")\n continue;\n if (!(key in _cached)) {\n delete schema[key];\n }\n }\n }\n // When ref was extracted to $defs, remove properties that match the definition\n if (refSchema.$ref && refSeen.def) {\n for (const key in schema) {\n if (key === \"$ref\" || key === \"allOf\")\n continue;\n if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {\n delete schema[key];\n }\n }\n }\n }\n // If parent was extracted (has $ref), propagate $ref to this schema\n // This handles cases like: readonly().meta({id}).describe()\n // where processor sets ref to innerType but parent should be referenced\n const parent = zodSchema._zod.parent;\n if (parent && parent !== ref) {\n // Ensure parent is processed first so its def has inherited properties\n flattenRef(parent);\n const parentSeen = ctx.seen.get(parent);\n if (parentSeen?.schema.$ref) {\n schema.$ref = parentSeen.schema.$ref;\n // De-duplicate with parent's definition\n if (parentSeen.def) {\n for (const key in schema) {\n if (key === \"$ref\" || key === \"allOf\")\n continue;\n if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {\n delete schema[key];\n }\n }\n }\n }\n }\n // execute overrides\n ctx.override({\n zodSchema: zodSchema,\n jsonSchema: schema,\n path: seen.path ?? [],\n });\n };\n for (const entry of [...ctx.seen.entries()].reverse()) {\n flattenRef(entry[0]);\n }\n const result = {};\n if (ctx.target === \"draft-2020-12\") {\n result.$schema = \"https://json-schema.org/draft/2020-12/schema\";\n }\n else if (ctx.target === \"draft-07\") {\n result.$schema = \"http://json-schema.org/draft-07/schema#\";\n }\n else if (ctx.target === \"draft-04\") {\n result.$schema = \"http://json-schema.org/draft-04/schema#\";\n }\n else if (ctx.target === \"openapi-3.0\") {\n // OpenAPI 3.0 schema objects should not include a $schema property\n }\n else {\n // Arbitrary string values are allowed but won't have a $schema property set\n }\n if (ctx.external?.uri) {\n const id = ctx.external.registry.get(schema)?.id;\n if (!id)\n throw new Error(\"Schema is missing an `id` property\");\n result.$id = ctx.external.uri(id);\n }\n Object.assign(result, root.def ?? root.schema);\n // The `id` in `.meta()` is a Zod-specific registration tag used to extract\n // schemas into $defs — it is not user-facing JSON Schema metadata. Strip it\n // from the output body where it would otherwise leak. The id is preserved\n // implicitly via the $defs key (and via $ref paths).\n const rootMetaId = ctx.metadataRegistry.get(schema)?.id;\n if (rootMetaId !== undefined && result.id === rootMetaId)\n delete result.id;\n // build defs object\n const defs = ctx.external?.defs ?? {};\n for (const entry of ctx.seen.entries()) {\n const seen = entry[1];\n if (seen.def && seen.defId) {\n if (seen.def.id === seen.defId)\n delete seen.def.id;\n defs[seen.defId] = seen.def;\n }\n }\n // set definitions in result\n if (ctx.external) {\n }\n else {\n if (Object.keys(defs).length > 0) {\n if (ctx.target === \"draft-2020-12\") {\n result.$defs = defs;\n }\n else {\n result.definitions = defs;\n }\n }\n }\n try {\n // this \"finalizes\" this schema and ensures all cycles are removed\n // each call to finalize() is functionally independent\n // though the seen map is shared\n const finalized = JSON.parse(JSON.stringify(result));\n Object.defineProperty(finalized, \"~standard\", {\n value: {\n ...schema[\"~standard\"],\n jsonSchema: {\n input: createStandardJSONSchemaMethod(schema, \"input\", ctx.processors),\n output: createStandardJSONSchemaMethod(schema, \"output\", ctx.processors),\n },\n },\n enumerable: false,\n writable: false,\n });\n return finalized;\n }\n catch (_err) {\n throw new Error(\"Error converting schema to JSON.\");\n }\n}\nfunction isTransforming(_schema, _ctx) {\n const ctx = _ctx ?? { seen: new Set() };\n if (ctx.seen.has(_schema))\n return false;\n ctx.seen.add(_schema);\n const def = _schema._zod.def;\n if (def.type === \"transform\")\n return true;\n if (def.type === \"array\")\n return isTransforming(def.element, ctx);\n if (def.type === \"set\")\n return isTransforming(def.valueType, ctx);\n if (def.type === \"lazy\")\n return isTransforming(def.getter(), ctx);\n if (def.type === \"promise\" ||\n def.type === \"optional\" ||\n def.type === \"nonoptional\" ||\n def.type === \"nullable\" ||\n def.type === \"readonly\" ||\n def.type === \"default\" ||\n def.type === \"prefault\") {\n return isTransforming(def.innerType, ctx);\n }\n if (def.type === \"intersection\") {\n return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);\n }\n if (def.type === \"record\" || def.type === \"map\") {\n return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);\n }\n if (def.type === \"pipe\") {\n if (_schema._zod.traits.has(\"$ZodCodec\"))\n return true;\n return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);\n }\n if (def.type === \"object\") {\n for (const key in def.shape) {\n if (isTransforming(def.shape[key], ctx))\n return true;\n }\n return false;\n }\n if (def.type === \"union\") {\n for (const option of def.options) {\n if (isTransforming(option, ctx))\n return true;\n }\n return false;\n }\n if (def.type === \"tuple\") {\n for (const item of def.items) {\n if (isTransforming(item, ctx))\n return true;\n }\n if (def.rest && isTransforming(def.rest, ctx))\n return true;\n return false;\n }\n return false;\n}\n/**\n * Creates a toJSONSchema method for a schema instance.\n * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.\n */\nexport const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {\n const ctx = initializeContext({ ...params, processors });\n process(schema, ctx);\n extractDefs(ctx, schema);\n return finalize(ctx, schema);\n};\nexport const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {\n const { libraryOptions, target } = params ?? {};\n const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });\n process(schema, ctx);\n extractDefs(ctx, schema);\n return finalize(ctx, schema);\n};\n","import { extractDefs, finalize, initializeContext, process, } from \"./to-json-schema.js\";\nimport { getEnumValues } from \"./util.js\";\nconst formatMap = {\n guid: \"uuid\",\n url: \"uri\",\n datetime: \"date-time\",\n json_string: \"json-string\",\n regex: \"\", // do not set\n};\n// ==================== SIMPLE TYPE PROCESSORS ====================\nexport const stringProcessor = (schema, ctx, _json, _params) => {\n const json = _json;\n json.type = \"string\";\n const { minimum, maximum, format, patterns, contentEncoding } = schema._zod\n .bag;\n if (typeof minimum === \"number\")\n json.minLength = minimum;\n if (typeof maximum === \"number\")\n json.maxLength = maximum;\n // custom pattern overrides format\n if (format) {\n json.format = formatMap[format] ?? format;\n if (json.format === \"\")\n delete json.format; // empty format is not valid\n // JSON Schema format: \"time\" requires a full time with offset or Z\n // z.iso.time() does not include timezone information, so format: \"time\" should never be used\n if (format === \"time\") {\n delete json.format;\n }\n }\n if (contentEncoding)\n json.contentEncoding = contentEncoding;\n if (patterns && patterns.size > 0) {\n const regexes = [...patterns];\n if (regexes.length === 1)\n json.pattern = regexes[0].source;\n else if (regexes.length > 1) {\n json.allOf = [\n ...regexes.map((regex) => ({\n ...(ctx.target === \"draft-07\" || ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\"\n ? { type: \"string\" }\n : {}),\n pattern: regex.source,\n })),\n ];\n }\n }\n};\nexport const numberProcessor = (schema, ctx, _json, _params) => {\n const json = _json;\n const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;\n if (typeof format === \"string\" && format.includes(\"int\"))\n json.type = \"integer\";\n else\n json.type = \"number\";\n // when both minimum and exclusiveMinimum exist, pick the more restrictive one\n const exMin = typeof exclusiveMinimum === \"number\" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);\n const exMax = typeof exclusiveMaximum === \"number\" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);\n const legacy = ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\";\n if (exMin) {\n if (legacy) {\n json.minimum = exclusiveMinimum;\n json.exclusiveMinimum = true;\n }\n else {\n json.exclusiveMinimum = exclusiveMinimum;\n }\n }\n else if (typeof minimum === \"number\") {\n json.minimum = minimum;\n }\n if (exMax) {\n if (legacy) {\n json.maximum = exclusiveMaximum;\n json.exclusiveMaximum = true;\n }\n else {\n json.exclusiveMaximum = exclusiveMaximum;\n }\n }\n else if (typeof maximum === \"number\") {\n json.maximum = maximum;\n }\n if (typeof multipleOf === \"number\")\n json.multipleOf = multipleOf;\n};\nexport const booleanProcessor = (_schema, _ctx, json, _params) => {\n json.type = \"boolean\";\n};\nexport const bigintProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"BigInt cannot be represented in JSON Schema\");\n }\n};\nexport const symbolProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Symbols cannot be represented in JSON Schema\");\n }\n};\nexport const nullProcessor = (_schema, ctx, json, _params) => {\n if (ctx.target === \"openapi-3.0\") {\n json.type = \"string\";\n json.nullable = true;\n json.enum = [null];\n }\n else {\n json.type = \"null\";\n }\n};\nexport const undefinedProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Undefined cannot be represented in JSON Schema\");\n }\n};\nexport const voidProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Void cannot be represented in JSON Schema\");\n }\n};\nexport const neverProcessor = (_schema, _ctx, json, _params) => {\n json.not = {};\n};\nexport const anyProcessor = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};\nexport const unknownProcessor = (_schema, _ctx, _json, _params) => {\n // empty schema accepts anything\n};\nexport const dateProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Date cannot be represented in JSON Schema\");\n }\n};\nexport const enumProcessor = (schema, _ctx, json, _params) => {\n const def = schema._zod.def;\n const values = getEnumValues(def.entries);\n // Number enums can have both string and number values\n if (values.every((v) => typeof v === \"number\"))\n json.type = \"number\";\n if (values.every((v) => typeof v === \"string\"))\n json.type = \"string\";\n json.enum = values;\n};\nexport const literalProcessor = (schema, ctx, json, _params) => {\n const def = schema._zod.def;\n const vals = [];\n for (const val of def.values) {\n if (val === undefined) {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Literal `undefined` cannot be represented in JSON Schema\");\n }\n else {\n // do not add to vals\n }\n }\n else if (typeof val === \"bigint\") {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"BigInt literals cannot be represented in JSON Schema\");\n }\n else {\n vals.push(Number(val));\n }\n }\n else {\n vals.push(val);\n }\n }\n if (vals.length === 0) {\n // do nothing (an undefined literal was stripped)\n }\n else if (vals.length === 1) {\n const val = vals[0];\n json.type = val === null ? \"null\" : typeof val;\n if (ctx.target === \"draft-04\" || ctx.target === \"openapi-3.0\") {\n json.enum = [val];\n }\n else {\n json.const = val;\n }\n }\n else {\n if (vals.every((v) => typeof v === \"number\"))\n json.type = \"number\";\n if (vals.every((v) => typeof v === \"string\"))\n json.type = \"string\";\n if (vals.every((v) => typeof v === \"boolean\"))\n json.type = \"boolean\";\n if (vals.every((v) => v === null))\n json.type = \"null\";\n json.enum = vals;\n }\n};\nexport const nanProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"NaN cannot be represented in JSON Schema\");\n }\n};\nexport const templateLiteralProcessor = (schema, _ctx, json, _params) => {\n const _json = json;\n const pattern = schema._zod.pattern;\n if (!pattern)\n throw new Error(\"Pattern not found in template literal\");\n _json.type = \"string\";\n _json.pattern = pattern.source;\n};\nexport const fileProcessor = (schema, _ctx, json, _params) => {\n const _json = json;\n const file = {\n type: \"string\",\n format: \"binary\",\n contentEncoding: \"binary\",\n };\n const { minimum, maximum, mime } = schema._zod.bag;\n if (minimum !== undefined)\n file.minLength = minimum;\n if (maximum !== undefined)\n file.maxLength = maximum;\n if (mime) {\n if (mime.length === 1) {\n file.contentMediaType = mime[0];\n Object.assign(_json, file);\n }\n else {\n Object.assign(_json, file); // shared props at root\n _json.anyOf = mime.map((m) => ({ contentMediaType: m })); // only contentMediaType differs\n }\n }\n else {\n Object.assign(_json, file);\n }\n};\nexport const successProcessor = (_schema, _ctx, json, _params) => {\n json.type = \"boolean\";\n};\nexport const customProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Custom types cannot be represented in JSON Schema\");\n }\n};\nexport const functionProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Function types cannot be represented in JSON Schema\");\n }\n};\nexport const transformProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Transforms cannot be represented in JSON Schema\");\n }\n};\nexport const mapProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Map cannot be represented in JSON Schema\");\n }\n};\nexport const setProcessor = (_schema, ctx, _json, _params) => {\n if (ctx.unrepresentable === \"throw\") {\n throw new Error(\"Set cannot be represented in JSON Schema\");\n }\n};\n// ==================== COMPOSITE TYPE PROCESSORS ====================\nexport const arrayProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n const { minimum, maximum } = schema._zod.bag;\n if (typeof minimum === \"number\")\n json.minItems = minimum;\n if (typeof maximum === \"number\")\n json.maxItems = maximum;\n json.type = \"array\";\n json.items = process(def.element, ctx, {\n ...params,\n path: [...params.path, \"items\"],\n });\n};\nexport const objectProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n json.type = \"object\";\n json.properties = {};\n const shape = def.shape;\n for (const key in shape) {\n json.properties[key] = process(shape[key], ctx, {\n ...params,\n path: [...params.path, \"properties\", key],\n });\n }\n // required keys\n const allKeys = new Set(Object.keys(shape));\n const requiredKeys = new Set([...allKeys].filter((key) => {\n const v = def.shape[key]._zod;\n if (ctx.io === \"input\") {\n return v.optin === undefined;\n }\n else {\n return v.optout === undefined;\n }\n }));\n if (requiredKeys.size > 0) {\n json.required = Array.from(requiredKeys);\n }\n // catchall\n if (def.catchall?._zod.def.type === \"never\") {\n // strict\n json.additionalProperties = false;\n }\n else if (!def.catchall) {\n // regular\n if (ctx.io === \"output\")\n json.additionalProperties = false;\n }\n else if (def.catchall) {\n json.additionalProperties = process(def.catchall, ctx, {\n ...params,\n path: [...params.path, \"additionalProperties\"],\n });\n }\n};\nexport const unionProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches)\n // This includes both z.xor() and discriminated unions\n const isExclusive = def.inclusive === false;\n const options = def.options.map((x, i) => process(x, ctx, {\n ...params,\n path: [...params.path, isExclusive ? \"oneOf\" : \"anyOf\", i],\n }));\n if (isExclusive) {\n json.oneOf = options;\n }\n else {\n json.anyOf = options;\n }\n};\nexport const intersectionProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n const a = process(def.left, ctx, {\n ...params,\n path: [...params.path, \"allOf\", 0],\n });\n const b = process(def.right, ctx, {\n ...params,\n path: [...params.path, \"allOf\", 1],\n });\n const isSimpleIntersection = (val) => \"allOf\" in val && Object.keys(val).length === 1;\n const allOf = [\n ...(isSimpleIntersection(a) ? a.allOf : [a]),\n ...(isSimpleIntersection(b) ? b.allOf : [b]),\n ];\n json.allOf = allOf;\n};\nexport const tupleProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n json.type = \"array\";\n const prefixPath = ctx.target === \"draft-2020-12\" ? \"prefixItems\" : \"items\";\n const restPath = ctx.target === \"draft-2020-12\" ? \"items\" : ctx.target === \"openapi-3.0\" ? \"items\" : \"additionalItems\";\n const prefixItems = def.items.map((x, i) => process(x, ctx, {\n ...params,\n path: [...params.path, prefixPath, i],\n }));\n const rest = def.rest\n ? process(def.rest, ctx, {\n ...params,\n path: [...params.path, restPath, ...(ctx.target === \"openapi-3.0\" ? [def.items.length] : [])],\n })\n : null;\n if (ctx.target === \"draft-2020-12\") {\n json.prefixItems = prefixItems;\n if (rest) {\n json.items = rest;\n }\n }\n else if (ctx.target === \"openapi-3.0\") {\n json.items = {\n anyOf: prefixItems,\n };\n if (rest) {\n json.items.anyOf.push(rest);\n }\n json.minItems = prefixItems.length;\n if (!rest) {\n json.maxItems = prefixItems.length;\n }\n }\n else {\n json.items = prefixItems;\n if (rest) {\n json.additionalItems = rest;\n }\n }\n // length\n const { minimum, maximum } = schema._zod.bag;\n if (typeof minimum === \"number\")\n json.minItems = minimum;\n if (typeof maximum === \"number\")\n json.maxItems = maximum;\n};\nexport const recordProcessor = (schema, ctx, _json, params) => {\n const json = _json;\n const def = schema._zod.def;\n json.type = \"object\";\n // For looseRecord with regex patterns, use patternProperties\n // This correctly represents \"only validate keys matching the pattern\" semantics\n // and composes well with allOf (intersections)\n const keyType = def.keyType;\n const keyBag = keyType._zod.bag;\n const patterns = keyBag?.patterns;\n if (def.mode === \"loose\" && patterns && patterns.size > 0) {\n // Use patternProperties for looseRecord with regex patterns\n const valueSchema = process(def.valueType, ctx, {\n ...params,\n path: [...params.path, \"patternProperties\", \"*\"],\n });\n json.patternProperties = {};\n for (const pattern of patterns) {\n json.patternProperties[pattern.source] = valueSchema;\n }\n }\n else {\n // Default behavior: use propertyNames + additionalProperties\n if (ctx.target === \"draft-07\" || ctx.target === \"draft-2020-12\") {\n json.propertyNames = process(def.keyType, ctx, {\n ...params,\n path: [...params.path, \"propertyNames\"],\n });\n }\n json.additionalProperties = process(def.valueType, ctx, {\n ...params,\n path: [...params.path, \"additionalProperties\"],\n });\n }\n // Add required for keys with discrete values (enum, literal, etc.)\n const keyValues = keyType._zod.values;\n if (keyValues) {\n const validKeyValues = [...keyValues].filter((v) => typeof v === \"string\" || typeof v === \"number\");\n if (validKeyValues.length > 0) {\n json.required = validKeyValues;\n }\n }\n};\nexport const nullableProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n const inner = process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n if (ctx.target === \"openapi-3.0\") {\n seen.ref = def.innerType;\n json.nullable = true;\n }\n else {\n json.anyOf = [inner, { type: \"null\" }];\n }\n};\nexport const nonoptionalProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\nexport const defaultProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n json.default = JSON.parse(JSON.stringify(def.defaultValue));\n};\nexport const prefaultProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n if (ctx.io === \"input\")\n json._prefault = JSON.parse(JSON.stringify(def.defaultValue));\n};\nexport const catchProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n let catchValue;\n try {\n catchValue = def.catchValue(undefined);\n }\n catch {\n throw new Error(\"Dynamic catch values are not supported in JSON Schema\");\n }\n json.default = catchValue;\n};\nexport const pipeProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n const inIsTransform = def.in._zod.traits.has(\"$ZodTransform\");\n const innerType = ctx.io === \"input\" ? (inIsTransform ? def.out : def.in) : def.out;\n process(innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = innerType;\n};\nexport const readonlyProcessor = (schema, ctx, json, params) => {\n const def = schema._zod.def;\n process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n json.readOnly = true;\n};\nexport const promiseProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\nexport const optionalProcessor = (schema, ctx, _json, params) => {\n const def = schema._zod.def;\n process(def.innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = def.innerType;\n};\nexport const lazyProcessor = (schema, ctx, _json, params) => {\n const innerType = schema._zod.innerType;\n process(innerType, ctx, params);\n const seen = ctx.seen.get(schema);\n seen.ref = innerType;\n};\n// ==================== ALL PROCESSORS ====================\nexport const allProcessors = {\n string: stringProcessor,\n number: numberProcessor,\n boolean: booleanProcessor,\n bigint: bigintProcessor,\n symbol: symbolProcessor,\n null: nullProcessor,\n undefined: undefinedProcessor,\n void: voidProcessor,\n never: neverProcessor,\n any: anyProcessor,\n unknown: unknownProcessor,\n date: dateProcessor,\n enum: enumProcessor,\n literal: literalProcessor,\n nan: nanProcessor,\n template_literal: templateLiteralProcessor,\n file: fileProcessor,\n success: successProcessor,\n custom: customProcessor,\n function: functionProcessor,\n transform: transformProcessor,\n map: mapProcessor,\n set: setProcessor,\n array: arrayProcessor,\n object: objectProcessor,\n union: unionProcessor,\n intersection: intersectionProcessor,\n tuple: tupleProcessor,\n record: recordProcessor,\n nullable: nullableProcessor,\n nonoptional: nonoptionalProcessor,\n default: defaultProcessor,\n prefault: prefaultProcessor,\n catch: catchProcessor,\n pipe: pipeProcessor,\n readonly: readonlyProcessor,\n promise: promiseProcessor,\n optional: optionalProcessor,\n lazy: lazyProcessor,\n};\nexport function toJSONSchema(input, params) {\n if (\"_idmap\" in input) {\n // Registry case\n const registry = input;\n const ctx = initializeContext({ ...params, processors: allProcessors });\n const defs = {};\n // First pass: process all schemas to build the seen map\n for (const entry of registry._idmap.entries()) {\n const [_, schema] = entry;\n process(schema, ctx);\n }\n const schemas = {};\n const external = {\n registry,\n uri: params?.uri,\n defs,\n };\n // Update the context with external configuration\n ctx.external = external;\n // Second pass: emit each schema\n for (const entry of registry._idmap.entries()) {\n const [key, schema] = entry;\n extractDefs(ctx, schema);\n schemas[key] = finalize(ctx, schema);\n }\n if (Object.keys(defs).length > 0) {\n const defsSegment = ctx.target === \"draft-2020-12\" ? \"$defs\" : \"definitions\";\n schemas.__shared = {\n [defsSegment]: defs,\n };\n }\n return { schemas };\n }\n // Single schema case\n const ctx = initializeContext({ ...params, processors: allProcessors });\n process(input, ctx);\n extractDefs(ctx, input);\n return finalize(ctx, input);\n}\n","import * as core from \"../core/index.js\";\nimport * as util from \"../core/util.js\";\nimport * as parse from \"./parse.js\";\nexport const ZodMiniType = /*@__PURE__*/ core.$constructor(\"ZodMiniType\", (inst, def) => {\n if (!inst._zod)\n throw new Error(\"Uninitialized schema in ZodMiniType.\");\n core.$ZodType.init(inst, def);\n inst.def = def;\n inst.type = def.type;\n inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });\n inst.safeParse = (data, params) => parse.safeParse(inst, data, params);\n inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });\n inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);\n inst.check = (...checks) => {\n return inst.clone({\n ...def,\n checks: [\n ...(def.checks ?? []),\n ...checks.map((ch) => typeof ch === \"function\"\n ? {\n _zod: { check: ch, def: { check: \"custom\" }, onattach: [] },\n }\n : ch),\n ],\n }, { parent: true });\n };\n inst.with = inst.check;\n inst.clone = (_def, params) => core.clone(inst, _def, params);\n inst.brand = () => inst;\n inst.register = ((reg, meta) => {\n reg.add(inst, meta);\n return inst;\n });\n inst.apply = (fn) => fn(inst);\n});\nexport const ZodMiniString = /*@__PURE__*/ core.$constructor(\"ZodMiniString\", (inst, def) => {\n core.$ZodString.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function string(params) {\n return core._string(ZodMiniString, params);\n}\nexport const ZodMiniStringFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniStringFormat\", (inst, def) => {\n core.$ZodStringFormat.init(inst, def);\n ZodMiniString.init(inst, def);\n});\nexport const ZodMiniEmail = /*@__PURE__*/ core.$constructor(\"ZodMiniEmail\", (inst, def) => {\n core.$ZodEmail.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function email(params) {\n return core._email(ZodMiniEmail, params);\n}\nexport const ZodMiniGUID = /*@__PURE__*/ core.$constructor(\"ZodMiniGUID\", (inst, def) => {\n core.$ZodGUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function guid(params) {\n return core._guid(ZodMiniGUID, params);\n}\nexport const ZodMiniUUID = /*@__PURE__*/ core.$constructor(\"ZodMiniUUID\", (inst, def) => {\n core.$ZodUUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function uuid(params) {\n return core._uuid(ZodMiniUUID, params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function uuidv4(params) {\n return core._uuidv4(ZodMiniUUID, params);\n}\n// ZodMiniUUIDv6\n// @__NO_SIDE_EFFECTS__\nexport function uuidv6(params) {\n return core._uuidv6(ZodMiniUUID, params);\n}\n// ZodMiniUUIDv7\n// @__NO_SIDE_EFFECTS__\nexport function uuidv7(params) {\n return core._uuidv7(ZodMiniUUID, params);\n}\nexport const ZodMiniURL = /*@__PURE__*/ core.$constructor(\"ZodMiniURL\", (inst, def) => {\n core.$ZodURL.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function url(params) {\n return core._url(ZodMiniURL, params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function httpUrl(params) {\n return core._url(ZodMiniURL, {\n protocol: core.regexes.httpProtocol,\n hostname: core.regexes.domain,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniEmoji = /*@__PURE__*/ core.$constructor(\"ZodMiniEmoji\", (inst, def) => {\n core.$ZodEmoji.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function emoji(params) {\n return core._emoji(ZodMiniEmoji, params);\n}\nexport const ZodMiniNanoID = /*@__PURE__*/ core.$constructor(\"ZodMiniNanoID\", (inst, def) => {\n core.$ZodNanoID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nanoid(params) {\n return core._nanoid(ZodMiniNanoID, params);\n}\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const ZodMiniCUID = /*@__PURE__*/ core.$constructor(\"ZodMiniCUID\", (inst, def) => {\n core.$ZodCUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n/**\n * Validates a CUID v1 string.\n *\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.\n * See https://github.com/paralleldrive/cuid.\n */\n// @__NO_SIDE_EFFECTS__\nexport function cuid(params) {\n return core._cuid(ZodMiniCUID, params);\n}\nexport const ZodMiniCUID2 = /*@__PURE__*/ core.$constructor(\"ZodMiniCUID2\", (inst, def) => {\n core.$ZodCUID2.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function cuid2(params) {\n return core._cuid2(ZodMiniCUID2, params);\n}\nexport const ZodMiniULID = /*@__PURE__*/ core.$constructor(\"ZodMiniULID\", (inst, def) => {\n core.$ZodULID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ulid(params) {\n return core._ulid(ZodMiniULID, params);\n}\nexport const ZodMiniXID = /*@__PURE__*/ core.$constructor(\"ZodMiniXID\", (inst, def) => {\n core.$ZodXID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function xid(params) {\n return core._xid(ZodMiniXID, params);\n}\nexport const ZodMiniKSUID = /*@__PURE__*/ core.$constructor(\"ZodMiniKSUID\", (inst, def) => {\n core.$ZodKSUID.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ksuid(params) {\n return core._ksuid(ZodMiniKSUID, params);\n}\nexport const ZodMiniIPv4 = /*@__PURE__*/ core.$constructor(\"ZodMiniIPv4\", (inst, def) => {\n core.$ZodIPv4.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ipv4(params) {\n return core._ipv4(ZodMiniIPv4, params);\n}\nexport const ZodMiniIPv6 = /*@__PURE__*/ core.$constructor(\"ZodMiniIPv6\", (inst, def) => {\n core.$ZodIPv6.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function ipv6(params) {\n return core._ipv6(ZodMiniIPv6, params);\n}\nexport const ZodMiniCIDRv4 = /*@__PURE__*/ core.$constructor(\"ZodMiniCIDRv4\", (inst, def) => {\n core.$ZodCIDRv4.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function cidrv4(params) {\n return core._cidrv4(ZodMiniCIDRv4, params);\n}\nexport const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor(\"ZodMiniCIDRv6\", (inst, def) => {\n core.$ZodCIDRv6.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function cidrv6(params) {\n return core._cidrv6(ZodMiniCIDRv6, params);\n}\nexport const ZodMiniMAC = /*@__PURE__*/ core.$constructor(\"ZodMiniMAC\", (inst, def) => {\n core.$ZodMAC.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function mac(params) {\n return core._mac(ZodMiniMAC, params);\n}\nexport const ZodMiniBase64 = /*@__PURE__*/ core.$constructor(\"ZodMiniBase64\", (inst, def) => {\n core.$ZodBase64.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function base64(params) {\n return core._base64(ZodMiniBase64, params);\n}\nexport const ZodMiniBase64URL = /*@__PURE__*/ core.$constructor(\"ZodMiniBase64URL\", (inst, def) => {\n core.$ZodBase64URL.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function base64url(params) {\n return core._base64url(ZodMiniBase64URL, params);\n}\nexport const ZodMiniE164 = /*@__PURE__*/ core.$constructor(\"ZodMiniE164\", (inst, def) => {\n core.$ZodE164.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function e164(params) {\n return core._e164(ZodMiniE164, params);\n}\nexport const ZodMiniJWT = /*@__PURE__*/ core.$constructor(\"ZodMiniJWT\", (inst, def) => {\n core.$ZodJWT.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function jwt(params) {\n return core._jwt(ZodMiniJWT, params);\n}\nexport const ZodMiniCustomStringFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniCustomStringFormat\", (inst, def) => {\n core.$ZodCustomStringFormat.init(inst, def);\n ZodMiniStringFormat.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function stringFormat(format, fnOrRegex, _params = {}) {\n return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function hostname(_params) {\n return core._stringFormat(ZodMiniCustomStringFormat, \"hostname\", core.regexes.hostname, _params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function hex(_params) {\n return core._stringFormat(ZodMiniCustomStringFormat, \"hex\", core.regexes.hex, _params);\n}\n// @__NO_SIDE_EFFECTS__\nexport function hash(alg, params) {\n const enc = params?.enc ?? \"hex\";\n const format = `${alg}_${enc}`;\n const regex = core.regexes[format];\n // check for unrecognized format\n if (!regex)\n throw new Error(`Unrecognized hash format: ${format}`);\n return core._stringFormat(ZodMiniCustomStringFormat, format, regex, params);\n}\nexport const ZodMiniNumber = /*@__PURE__*/ core.$constructor(\"ZodMiniNumber\", (inst, def) => {\n core.$ZodNumber.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function number(params) {\n return core._number(ZodMiniNumber, params);\n}\nexport const ZodMiniNumberFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniNumberFormat\", (inst, def) => {\n core.$ZodNumberFormat.init(inst, def);\n ZodMiniNumber.init(inst, def);\n});\n// int\n// @__NO_SIDE_EFFECTS__\nexport function int(params) {\n return core._int(ZodMiniNumberFormat, params);\n}\n// float32\n// @__NO_SIDE_EFFECTS__\nexport function float32(params) {\n return core._float32(ZodMiniNumberFormat, params);\n}\n// float64\n// @__NO_SIDE_EFFECTS__\nexport function float64(params) {\n return core._float64(ZodMiniNumberFormat, params);\n}\n// int32\n// @__NO_SIDE_EFFECTS__\nexport function int32(params) {\n return core._int32(ZodMiniNumberFormat, params);\n}\n// uint32\n// @__NO_SIDE_EFFECTS__\nexport function uint32(params) {\n return core._uint32(ZodMiniNumberFormat, params);\n}\nexport const ZodMiniBoolean = /*@__PURE__*/ core.$constructor(\"ZodMiniBoolean\", (inst, def) => {\n core.$ZodBoolean.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function boolean(params) {\n return core._boolean(ZodMiniBoolean, params);\n}\nexport const ZodMiniBigInt = /*@__PURE__*/ core.$constructor(\"ZodMiniBigInt\", (inst, def) => {\n core.$ZodBigInt.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function bigint(params) {\n return core._bigint(ZodMiniBigInt, params);\n}\nexport const ZodMiniBigIntFormat = /*@__PURE__*/ core.$constructor(\"ZodMiniBigIntFormat\", (inst, def) => {\n core.$ZodBigIntFormat.init(inst, def);\n ZodMiniBigInt.init(inst, def);\n});\n// int64\n// @__NO_SIDE_EFFECTS__\nexport function int64(params) {\n return core._int64(ZodMiniBigIntFormat, params);\n}\n// uint64\n// @__NO_SIDE_EFFECTS__\nexport function uint64(params) {\n return core._uint64(ZodMiniBigIntFormat, params);\n}\nexport const ZodMiniSymbol = /*@__PURE__*/ core.$constructor(\"ZodMiniSymbol\", (inst, def) => {\n core.$ZodSymbol.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function symbol(params) {\n return core._symbol(ZodMiniSymbol, params);\n}\nexport const ZodMiniUndefined = /*@__PURE__*/ core.$constructor(\"ZodMiniUndefined\", (inst, def) => {\n core.$ZodUndefined.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _undefined(params) {\n return core._undefined(ZodMiniUndefined, params);\n}\nexport { _undefined as undefined };\nexport const ZodMiniNull = /*@__PURE__*/ core.$constructor(\"ZodMiniNull\", (inst, def) => {\n core.$ZodNull.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _null(params) {\n return core._null(ZodMiniNull, params);\n}\nexport { _null as null };\nexport const ZodMiniAny = /*@__PURE__*/ core.$constructor(\"ZodMiniAny\", (inst, def) => {\n core.$ZodAny.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function any() {\n return core._any(ZodMiniAny);\n}\nexport const ZodMiniUnknown = /*@__PURE__*/ core.$constructor(\"ZodMiniUnknown\", (inst, def) => {\n core.$ZodUnknown.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function unknown() {\n return core._unknown(ZodMiniUnknown);\n}\nexport const ZodMiniNever = /*@__PURE__*/ core.$constructor(\"ZodMiniNever\", (inst, def) => {\n core.$ZodNever.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function never(params) {\n return core._never(ZodMiniNever, params);\n}\nexport const ZodMiniVoid = /*@__PURE__*/ core.$constructor(\"ZodMiniVoid\", (inst, def) => {\n core.$ZodVoid.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _void(params) {\n return core._void(ZodMiniVoid, params);\n}\nexport { _void as void };\nexport const ZodMiniDate = /*@__PURE__*/ core.$constructor(\"ZodMiniDate\", (inst, def) => {\n core.$ZodDate.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function date(params) {\n return core._date(ZodMiniDate, params);\n}\nexport const ZodMiniArray = /*@__PURE__*/ core.$constructor(\"ZodMiniArray\", (inst, def) => {\n core.$ZodArray.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function array(element, params) {\n return new ZodMiniArray({\n type: \"array\",\n element: element,\n ...util.normalizeParams(params),\n });\n}\n// .keyof\n// @__NO_SIDE_EFFECTS__\nexport function keyof(schema) {\n const shape = schema._zod.def.shape;\n return _enum(Object.keys(shape));\n}\nexport const ZodMiniObject = /*@__PURE__*/ core.$constructor(\"ZodMiniObject\", (inst, def) => {\n core.$ZodObject.init(inst, def);\n ZodMiniType.init(inst, def);\n util.defineLazy(inst, \"shape\", () => def.shape);\n});\n// @__NO_SIDE_EFFECTS__\nexport function object(shape, params) {\n const def = {\n type: \"object\",\n shape: shape ?? {},\n ...util.normalizeParams(params),\n };\n return new ZodMiniObject(def);\n}\n// strictObject\n// @__NO_SIDE_EFFECTS__\nexport function strictObject(shape, params) {\n return new ZodMiniObject({\n type: \"object\",\n shape,\n catchall: never(),\n ...util.normalizeParams(params),\n });\n}\n// looseObject\n// @__NO_SIDE_EFFECTS__\nexport function looseObject(shape, params) {\n return new ZodMiniObject({\n type: \"object\",\n shape,\n catchall: unknown(),\n ...util.normalizeParams(params),\n });\n}\n// object methods\n// @__NO_SIDE_EFFECTS__\nexport function extend(schema, shape) {\n return util.extend(schema, shape);\n}\n// @__NO_SIDE_EFFECTS__\nexport function safeExtend(schema, shape) {\n return util.safeExtend(schema, shape);\n}\n// @__NO_SIDE_EFFECTS__\nexport function merge(schema, shape) {\n return util.extend(schema, shape);\n}\n// @__NO_SIDE_EFFECTS__\nexport function pick(schema, mask) {\n return util.pick(schema, mask);\n}\n// .omit\n// @__NO_SIDE_EFFECTS__\nexport function omit(schema, mask) {\n return util.omit(schema, mask);\n}\n// @__NO_SIDE_EFFECTS__\nexport function partial(schema, mask) {\n return util.partial(ZodMiniOptional, schema, mask);\n}\n// @__NO_SIDE_EFFECTS__\nexport function required(schema, mask) {\n return util.required(ZodMiniNonOptional, schema, mask);\n}\n// @__NO_SIDE_EFFECTS__\nexport function catchall(inst, catchall) {\n return inst.clone({ ...inst._zod.def, catchall: catchall });\n}\nexport const ZodMiniUnion = /*@__PURE__*/ core.$constructor(\"ZodMiniUnion\", (inst, def) => {\n core.$ZodUnion.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function union(options, params) {\n return new ZodMiniUnion({\n type: \"union\",\n options: options,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniXor = /*@__PURE__*/ core.$constructor(\"ZodMiniXor\", (inst, def) => {\n ZodMiniUnion.init(inst, def);\n core.$ZodXor.init(inst, def);\n});\n/** Creates an exclusive union (XOR) where exactly one option must match.\n * Unlike regular unions that succeed when any option matches, xor fails if\n * zero or more than one option matches the input. */\nexport function xor(options, params) {\n return new ZodMiniXor({\n type: \"union\",\n options: options,\n inclusive: false,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniDiscriminatedUnion = /*@__PURE__*/ core.$constructor(\"ZodMiniDiscriminatedUnion\", (inst, def) => {\n core.$ZodDiscriminatedUnion.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function discriminatedUnion(discriminator, options, params) {\n return new ZodMiniDiscriminatedUnion({\n type: \"union\",\n options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniIntersection = /*@__PURE__*/ core.$constructor(\"ZodMiniIntersection\", (inst, def) => {\n core.$ZodIntersection.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function intersection(left, right) {\n return new ZodMiniIntersection({\n type: \"intersection\",\n left: left,\n right: right,\n });\n}\nexport const ZodMiniTuple = /*@__PURE__*/ core.$constructor(\"ZodMiniTuple\", (inst, def) => {\n core.$ZodTuple.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function tuple(items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof core.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new ZodMiniTuple({\n type: \"tuple\",\n items: items,\n rest,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniRecord = /*@__PURE__*/ core.$constructor(\"ZodMiniRecord\", (inst, def) => {\n core.$ZodRecord.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function record(keyType, valueType, params) {\n // v3-compat: z.record(valueType, params?) — defaults keyType to z.string()\n if (!valueType || !valueType._zod) {\n return new ZodMiniRecord({\n type: \"record\",\n keyType: string(),\n valueType: keyType,\n ...util.normalizeParams(valueType),\n });\n }\n return new ZodMiniRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function partialRecord(keyType, valueType, params) {\n const k = core.clone(keyType);\n k._zod.values = undefined;\n return new ZodMiniRecord({\n type: \"record\",\n keyType: k,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport function looseRecord(keyType, valueType, params) {\n return new ZodMiniRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n mode: \"loose\",\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniMap = /*@__PURE__*/ core.$constructor(\"ZodMiniMap\", (inst, def) => {\n core.$ZodMap.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function map(keyType, valueType, params) {\n return new ZodMiniMap({\n type: \"map\",\n keyType: keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniSet = /*@__PURE__*/ core.$constructor(\"ZodMiniSet\", (inst, def) => {\n core.$ZodSet.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function set(valueType, params) {\n return new ZodMiniSet({\n type: \"set\",\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniEnum = /*@__PURE__*/ core.$constructor(\"ZodMiniEnum\", (inst, def) => {\n core.$ZodEnum.init(inst, def);\n ZodMiniType.init(inst, def);\n inst.options = Object.values(def.entries);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _enum(values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n return new ZodMiniEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport { _enum as enum };\n// @__NO_SIDE_EFFECTS__\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function nativeEnum(entries, params) {\n return new ZodMiniEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniLiteral = /*@__PURE__*/ core.$constructor(\"ZodMiniLiteral\", (inst, def) => {\n core.$ZodLiteral.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function literal(value, params) {\n return new ZodMiniLiteral({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniFile = /*@__PURE__*/ core.$constructor(\"ZodMiniFile\", (inst, def) => {\n core.$ZodFile.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function file(params) {\n return core._file(ZodMiniFile, params);\n}\nexport const ZodMiniTransform = /*@__PURE__*/ core.$constructor(\"ZodMiniTransform\", (inst, def) => {\n core.$ZodTransform.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function transform(fn) {\n return new ZodMiniTransform({\n type: \"transform\",\n transform: fn,\n });\n}\nexport const ZodMiniOptional = /*@__PURE__*/ core.$constructor(\"ZodMiniOptional\", (inst, def) => {\n core.$ZodOptional.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function optional(innerType) {\n return new ZodMiniOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodMiniExactOptional = /*@__PURE__*/ core.$constructor(\"ZodMiniExactOptional\", (inst, def) => {\n core.$ZodExactOptional.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function exactOptional(innerType) {\n return new ZodMiniExactOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodMiniNullable = /*@__PURE__*/ core.$constructor(\"ZodMiniNullable\", (inst, def) => {\n core.$ZodNullable.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nullable(innerType) {\n return new ZodMiniNullable({\n type: \"nullable\",\n innerType: innerType,\n });\n}\n// nullish\n// @__NO_SIDE_EFFECTS__\nexport function nullish(innerType) {\n return optional(nullable(innerType));\n}\nexport const ZodMiniDefault = /*@__PURE__*/ core.$constructor(\"ZodMiniDefault\", (inst, def) => {\n core.$ZodDefault.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function _default(innerType, defaultValue) {\n return new ZodMiniDefault({\n type: \"default\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodMiniPrefault = /*@__PURE__*/ core.$constructor(\"ZodMiniPrefault\", (inst, def) => {\n core.$ZodPrefault.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function prefault(innerType, defaultValue) {\n return new ZodMiniPrefault({\n type: \"prefault\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodMiniNonOptional = /*@__PURE__*/ core.$constructor(\"ZodMiniNonOptional\", (inst, def) => {\n core.$ZodNonOptional.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nonoptional(innerType, params) {\n return new ZodMiniNonOptional({\n type: \"nonoptional\",\n innerType: innerType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniSuccess = /*@__PURE__*/ core.$constructor(\"ZodMiniSuccess\", (inst, def) => {\n core.$ZodSuccess.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function success(innerType) {\n return new ZodMiniSuccess({\n type: \"success\",\n innerType: innerType,\n });\n}\nexport const ZodMiniCatch = /*@__PURE__*/ core.$constructor(\"ZodMiniCatch\", (inst, def) => {\n core.$ZodCatch.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nfunction _catch(innerType, catchValue) {\n return new ZodMiniCatch({\n type: \"catch\",\n innerType: innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : () => catchValue),\n });\n}\nexport { _catch as catch };\nexport const ZodMiniNaN = /*@__PURE__*/ core.$constructor(\"ZodMiniNaN\", (inst, def) => {\n core.$ZodNaN.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function nan(params) {\n return core._nan(ZodMiniNaN, params);\n}\nexport const ZodMiniPipe = /*@__PURE__*/ core.$constructor(\"ZodMiniPipe\", (inst, def) => {\n core.$ZodPipe.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function pipe(in_, out) {\n return new ZodMiniPipe({\n type: \"pipe\",\n in: in_,\n out: out,\n });\n}\nexport const ZodMiniCodec = /*@__PURE__*/ core.$constructor(\"ZodMiniCodec\", (inst, def) => {\n ZodMiniPipe.init(inst, def);\n core.$ZodCodec.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function codec(in_, out, params) {\n return new ZodMiniCodec({\n type: \"pipe\",\n in: in_,\n out: out,\n transform: params.decode,\n reverseTransform: params.encode,\n });\n}\n// @__NO_SIDE_EFFECTS__\nexport function invertCodec(codec) {\n const def = codec._zod.def;\n return new ZodMiniCodec({\n type: \"pipe\",\n in: def.out,\n out: def.in,\n transform: def.reverseTransform,\n reverseTransform: def.transform,\n });\n}\nexport const ZodMiniReadonly = /*@__PURE__*/ core.$constructor(\"ZodMiniReadonly\", (inst, def) => {\n core.$ZodReadonly.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function readonly(innerType) {\n return new ZodMiniReadonly({\n type: \"readonly\",\n innerType: innerType,\n });\n}\nexport const ZodMiniTemplateLiteral = /*@__PURE__*/ core.$constructor(\"ZodMiniTemplateLiteral\", (inst, def) => {\n core.$ZodTemplateLiteral.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function templateLiteral(parts, params) {\n return new ZodMiniTemplateLiteral({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMiniLazy = /*@__PURE__*/ core.$constructor(\"ZodMiniLazy\", (inst, def) => {\n core.$ZodLazy.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// export function lazy<T extends object>(getter: () => T): T {\n// return util.createTransparentProxy<T>(getter);\n// }\n// @__NO_SIDE_EFFECTS__\nfunction _lazy(getter) {\n return new ZodMiniLazy({\n type: \"lazy\",\n getter: getter,\n });\n}\nexport { _lazy as lazy };\nexport const ZodMiniPromise = /*@__PURE__*/ core.$constructor(\"ZodMiniPromise\", (inst, def) => {\n core.$ZodPromise.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function promise(innerType) {\n return new ZodMiniPromise({\n type: \"promise\",\n innerType: innerType,\n });\n}\nexport const ZodMiniCustom = /*@__PURE__*/ core.$constructor(\"ZodMiniCustom\", (inst, def) => {\n core.$ZodCustom.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// custom checks\n// @__NO_SIDE_EFFECTS__\nexport function check(fn, params) {\n const ch = new core.$ZodCheck({\n check: \"custom\",\n ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\n// ZodCustom\n// custom schema\n// @__NO_SIDE_EFFECTS__\nexport function custom(fn, _params) {\n return core._custom(ZodMiniCustom, fn ?? (() => true), _params);\n}\n// refine\n// @__NO_SIDE_EFFECTS__\nexport function refine(fn, _params = {}) {\n return core._refine(ZodMiniCustom, fn, _params);\n}\n// superRefine\n// @__NO_SIDE_EFFECTS__\nexport function superRefine(fn, params) {\n return core._superRefine(fn, params);\n}\n// Re-export describe and meta from core\nexport const describe = core.describe;\nexport const meta = core.meta;\n// instanceof\nclass Class {\n constructor(..._args) { }\n}\n// @__NO_SIDE_EFFECTS__\nfunction _instanceof(cls, params = {}) {\n const inst = custom((data) => data instanceof cls, params);\n inst._zod.bag.Class = cls;\n // Override check to emit invalid_type instead of custom\n inst._zod.check = (payload) => {\n if (!(payload.value instanceof cls)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: cls.name,\n input: payload.value,\n inst,\n path: [...(inst._zod.def.path ?? [])],\n });\n }\n };\n return inst;\n}\nexport { _instanceof as instanceof };\n// stringbool\nexport const stringbool = (...args) => core._stringbool({\n Codec: ZodMiniCodec,\n Boolean: ZodMiniBoolean,\n String: ZodMiniString,\n}, ...args);\n// @__NO_SIDE_EFFECTS__\nexport function json() {\n const jsonSchema = _lazy(() => {\n return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);\n });\n return jsonSchema;\n}\nexport const ZodMiniFunction = /*@__PURE__*/ core.$constructor(\"ZodMiniFunction\", (inst, def) => {\n core.$ZodFunction.init(inst, def);\n ZodMiniType.init(inst, def);\n});\n// @__NO_SIDE_EFFECTS__\nexport function _function(params) {\n return new ZodMiniFunction({\n type: \"function\",\n input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),\n output: params?.output ?? unknown(),\n });\n}\nexport { _function as function };\n","/*---------------------------------------------------------------------------------------------\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License. See License.txt in the project root for license information.\n*--------------------------------------------------------------------------------------------*/\nimport { t as __exportAll } from \"./rolldown-runtime-4LSo1kEK.js\";\nimport { any, array, boolean, enum as enum$1, int, nonnegative, number, object, optional, positive, string, union, unknown, void as void$1 } from \"zod/mini\";\nimport { safeParse, toJSONSchema } from \"zod/v4/core\";\n//#region src/schema/normalize.ts\n/**\n* Keys that describe structural shape and are part of the decidable subset.\n* Everything else gets stripped during normalization.\n*\n* Note: `not` is intentionally NOT in this list. The special case `{\"not\":{}}`\n* (i.e. matches-nothing) is mapped to the literal `false` bottom; any other\n* `not` is dropped.\n*/\nconst KEPT_KEYS = /* @__PURE__ */ new Set([\n\t\"type\",\n\t\"format\",\n\t\"properties\",\n\t\"required\",\n\t\"additionalProperties\",\n\t\"items\",\n\t\"prefixItems\",\n\t\"const\",\n\t\"enum\",\n\t\"anyOf\",\n\t\"oneOf\",\n\t\"discriminator\",\n\t\"$ref\",\n\t\"title\",\n\t\"description\"\n]);\n/**\n* Normalize raw JSON Schema output (e.g. from `z.toJSONSchema`) into the\n* SvcJsonSchema subset:\n*\n* - drop annotation keys (`examples`, `default`, `$comment`, `readOnly`, ...)\n* - drop out-of-subset refinements (`pattern`, `minimum`, `multipleOf`,\n* `allOf`, `oneOf`, `if/then/else`, `patternProperties`, ...)\n* - empty schema `{}` ⇒ `true` (top)\n* - `{\"not\":{}}` ⇒ `false` (bottom); any other `not` is stripped\n* - `type:\"object\"` without `additionalProperties` ⇒ closed (`false`),\n* matching hubrpc's stricter contract\n*\n* The output is canonical: structurally equal inputs produce structurally\n* equal outputs, which is what `computeInterfaceHash` relies on.\n*/\nfunction normalizeJsonSchema(raw) {\n\tif (raw === true || raw === false) return raw;\n\tif (raw === null || typeof raw !== \"object\") throw new Error(`normalizeJsonSchema: expected object, got ${typeof raw}`);\n\tif (Array.isArray(raw)) throw new Error(\"normalizeJsonSchema: expected object, got array\");\n\tconst r = raw;\n\tif (\"not\" in r && isEmptyObject(r[\"not\"])) return false;\n\tconst out = {};\n\tfor (const [k, v] of Object.entries(r)) {\n\t\tif (!KEPT_KEYS.has(k)) continue;\n\t\tconst normalized = normalizeChild(k, v);\n\t\tif (normalized === void 0) continue;\n\t\tout[k] = normalized;\n\t}\n\tif (out[\"type\"] === \"object\" && !(\"additionalProperties\" in out)) out[\"additionalProperties\"] = false;\n\tif (Array.isArray(out[\"oneOf\"]) && !(\"discriminator\" in out)) {\n\t\tconst detected = _detectDiscriminator(out[\"oneOf\"]);\n\t\tif (detected !== void 0) out[\"discriminator\"] = detected;\n\t}\n\tif (\"discriminator\" in out && !Array.isArray(out[\"oneOf\"])) delete out[\"discriminator\"];\n\tif (Object.keys(out).length === 0) return true;\n\treturn out;\n}\nfunction normalizeChild(key, v) {\n\tswitch (key) {\n\t\tcase \"properties\": {\n\t\t\tif (!isPlainObject(v)) return {};\n\t\t\tconst out = {};\n\t\t\tfor (const [pk, pv] of Object.entries(v)) out[pk] = normalizeJsonSchema(pv);\n\t\t\treturn out;\n\t\t}\n\t\tcase \"items\":\n\t\tcase \"additionalProperties\":\n\t\t\tif (v === false) return false;\n\t\t\treturn normalizeJsonSchema(v);\n\t\tcase \"prefixItems\":\n\t\tcase \"anyOf\":\n\t\tcase \"oneOf\":\n\t\t\tif (!Array.isArray(v)) return [];\n\t\t\treturn v.map((s) => normalizeJsonSchema(s));\n\t\tcase \"discriminator\": {\n\t\t\tif (!isPlainObject(v)) return void 0;\n\t\t\tconst name = v[\"propertyName\"];\n\t\t\tif (typeof name !== \"string\" || name.length === 0) return void 0;\n\t\t\treturn { propertyName: name };\n\t\t}\n\t\tcase \"enum\":\n\t\t\tif (!Array.isArray(v)) return [];\n\t\t\treturn v.slice();\n\t\tcase \"required\":\n\t\t\tif (!Array.isArray(v)) return [];\n\t\t\treturn v.slice().sort();\n\t\tdefault: return v;\n\t}\n}\nfunction isEmptyObject(v) {\n\treturn isPlainObject(v) && Object.keys(v).length === 0;\n}\nfunction isPlainObject(v) {\n\treturn v !== null && typeof v === \"object\" && !Array.isArray(v);\n}\n/**\n* Inspect a `oneOf` branch list and return a `discriminator` hint when\n* every branch is an object schema and there is exactly one property name\n* that appears in every branch with a distinct `const`-valued schema.\n*\n* This is the canonical JSON-Schema-only encoding of a tagged union, and\n* the shape `z.toJSONSchema(z.discriminatedUnion(...))` emits.\n*/\nfunction _detectDiscriminator(branches) {\n\tif (branches.length < 2) return void 0;\n\tconst branchPropsList = [];\n\tfor (const b of branches) {\n\t\tif (b === true || b === false) return void 0;\n\t\tif (b.type !== \"object\") return void 0;\n\t\tconst props = b.properties;\n\t\tif (!props) return void 0;\n\t\tbranchPropsList.push(props);\n\t}\n\tlet candidates = _constPropNames(branchPropsList[0]);\n\tfor (let i = 1; i < branchPropsList.length; i++) {\n\t\tcandidates = candidates.filter((n) => _constPropNames(branchPropsList[i]).includes(n));\n\t\tif (candidates.length === 0) return void 0;\n\t}\n\tfor (const name of candidates) {\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\tlet allDistinct = true;\n\t\tfor (const props of branchPropsList) {\n\t\t\tconst s = props[name];\n\t\t\tconst key = JSON.stringify(s.const);\n\t\t\tif (seen.has(key)) {\n\t\t\t\tallDistinct = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tseen.add(key);\n\t\t}\n\t\tif (allDistinct) return { propertyName: name };\n\t}\n}\nfunction _constPropNames(props) {\n\tconst out = [];\n\tfor (const [k, v] of Object.entries(props)) {\n\t\tif (v === true || v === false) continue;\n\t\tif (\"const\" in v) out.push(k);\n\t}\n\treturn out;\n}\n//#endregion\n//#region src/schema/memberTypes.ts\nvar RequestType = class RequestType {\n\tparamsSchema;\n\tresultSchema;\n\terrorSchema;\n\tdocs;\n\tclientStreamSchema;\n\tserverStreamSchema;\n\tkind = \"request\";\n\tconstructor(paramsSchema, resultSchema, errorSchema, docs = {}, clientStreamSchema, serverStreamSchema) {\n\t\tthis.paramsSchema = paramsSchema;\n\t\tthis.resultSchema = resultSchema;\n\t\tthis.errorSchema = errorSchema;\n\t\tthis.docs = docs;\n\t\tthis.clientStreamSchema = clientStreamSchema;\n\t\tthis.serverStreamSchema = serverStreamSchema;\n\t}\n\t/**\n\t* Return a copy of this request type with stream payload schemas\n\t* attached. Pass `undefined` for either direction to leave it\n\t* closed.\n\t*/\n\twithStream(opts) {\n\t\treturn new RequestType(this.paramsSchema, this.resultSchema, this.errorSchema, this.docs, opts.client, opts.server);\n\t}\n};\nvar NotificationType = class {\n\tparamsSchema;\n\tdocs;\n\tkind = \"notification\";\n\tconstructor(paramsSchema, docs = {}) {\n\t\tthis.paramsSchema = paramsSchema;\n\t\tthis.docs = docs;\n\t}\n};\n/**\n* Define a request method.\n*\n* @example\n* bar: requestType(z.object({ to: z.string() }), z.string(), {\n* description: \"MUST resolve before the next call from the same caller.\",\n* })\n*/\nfunction requestType(params, result, docsOrError, maybeDocs) {\n\tconst isErrorSchema = (v) => typeof v === \"object\" && v !== null && \"_zod\" in v;\n\tconst error = isErrorSchema(docsOrError) ? docsOrError : void 0;\n\tconst docs = (!isErrorSchema(docsOrError) ? docsOrError : maybeDocs) ?? {};\n\treturn new RequestType(params, result ?? void$1(), error ?? void$1(), docs);\n}\n/**\n* Define a notification method.\n*\n* @example\n* foo: notificationType(z.object({ message: z.string() }))\n*/\nfunction notificationType(params, docs = {}) {\n\treturn new NotificationType(params, docs);\n}\n/** Convert a zod schema to our restricted SvcJsonSchema subset. */\nfunction zodToSvcJsonSchema(schema) {\n\tconst type = schema._zod?.def?.type;\n\tif (type === \"void\" || type === \"undefined\") return true;\n\treturn normalizeJsonSchema(toJSONSchema(schema));\n}\n//#endregion\n//#region src/protocol/jcs.ts\n/**\n* RFC 8785 JSON Canonicalization Scheme (JCS).\n*\n* Used as the byte-deterministic encoding under every hubrpc signature\n* (RPC calls, capabilities, hub-signed previews). Both signer and verifier\n* canonicalize the same value object and obtain byte-identical UTF-8 bytes.\n*\n* Implementation inlined from the `canonicalize` npm package (Apache-2.0,\n* https://github.com/erdtman/canonicalize) so this module stays\n* zero-dependency for browser bundlers that don't resolve transitive\n* npm specifiers (e.g. the in-house app-bundler).\n*/\n/** RFC 8785 canonical JSON string for `value`. */\nfunction jcsCanonicalize(value) {\n\tconst out = _canonicalize(value);\n\tif (out === void 0) throw new Error(\"jcsCanonicalize: value is not JSON-representable\");\n\treturn out;\n}\nconst _encoder$1 = new TextEncoder();\n/** UTF-8 bytes of the RFC 8785 canonical JSON for `value`. The thing actually signed / hashed. */\nfunction jcsCanonicalizeBytes(value) {\n\treturn _encoder$1.encode(jcsCanonicalize(value));\n}\nfunction _canonicalize(object, seen = /* @__PURE__ */ new Set()) {\n\tif (typeof object === \"number\" && Number.isNaN(object)) throw new Error(\"NaN is not allowed\");\n\tif (typeof object === \"number\" && !Number.isFinite(object)) throw new Error(\"Infinity is not allowed\");\n\tif (object === null || typeof object !== \"object\") return JSON.stringify(object);\n\tconst obj = object;\n\tif (typeof obj.toJSON === \"function\") {\n\t\tif (seen.has(obj)) throw new Error(\"Circular reference detected\");\n\t\tseen.add(obj);\n\t\tconst result = _canonicalize(obj.toJSON(), seen);\n\t\tseen.delete(obj);\n\t\treturn result;\n\t}\n\tif (seen.has(obj)) throw new Error(\"Circular reference detected\");\n\tseen.add(obj);\n\tlet result;\n\tif (Array.isArray(obj)) result = `[${obj.map((cv) => {\n\t\treturn _canonicalize(cv === void 0 || typeof cv === \"symbol\" ? null : cv, seen);\n\t}).join(\",\")}]`;\n\telse {\n\t\tconst parts = [];\n\t\tfor (const key of Object.keys(obj).sort()) {\n\t\t\tconst v = obj[key];\n\t\t\tif (v === void 0 || typeof v === \"symbol\") continue;\n\t\t\tparts.push(`${JSON.stringify(key)}:${_canonicalize(v, seen)}`);\n\t\t}\n\t\tresult = `{${parts.join(\",\")}}`;\n\t}\n\tseen.delete(obj);\n\treturn result;\n}\n//#endregion\n//#region src/crypto/sha256.ts\n/**\n* Pure-JS SHA-256 (RFC 6234 / FIPS 180-4). Synchronous, dependency-free,\n* isomorphic. Used internally by hubrpc for content-hashing interface\n* schemas and deriving identity slot names; also surfaced through the\n* `crypto` API as `crypto.sha256`. For signature work we go through the\n* `crypto` module (`./identity/crypto`).\n*\n* Replaces the previous `@noble/hashes/sha2` import so the bundle has\n* no runtime npm dependencies. Trades the well-vetted dep for ~80 lines\n* of straight-line code that has no branching on input contents and is\n* exercised by the existing test vectors plus `sha256.test.ts`.\n*/\nconst K = new Uint32Array([\n\t1116352408,\n\t1899447441,\n\t3049323471,\n\t3921009573,\n\t961987163,\n\t1508970993,\n\t2453635748,\n\t2870763221,\n\t3624381080,\n\t310598401,\n\t607225278,\n\t1426881987,\n\t1925078388,\n\t2162078206,\n\t2614888103,\n\t3248222580,\n\t3835390401,\n\t4022224774,\n\t264347078,\n\t604807628,\n\t770255983,\n\t1249150122,\n\t1555081692,\n\t1996064986,\n\t2554220882,\n\t2821834349,\n\t2952996808,\n\t3210313671,\n\t3336571891,\n\t3584528711,\n\t113926993,\n\t338241895,\n\t666307205,\n\t773529912,\n\t1294757372,\n\t1396182291,\n\t1695183700,\n\t1986661051,\n\t2177026350,\n\t2456956037,\n\t2730485921,\n\t2820302411,\n\t3259730800,\n\t3345764771,\n\t3516065817,\n\t3600352804,\n\t4094571909,\n\t275423344,\n\t430227734,\n\t506948616,\n\t659060556,\n\t883997877,\n\t958139571,\n\t1322822218,\n\t1537002063,\n\t1747873779,\n\t1955562222,\n\t2024104815,\n\t2227730452,\n\t2361852424,\n\t2428436474,\n\t2756734187,\n\t3204031479,\n\t3329325298\n]);\nfunction _rotr(x, n) {\n\treturn x >>> n | x << 32 - n;\n}\nfunction sha256$1(data) {\n\tconst inputLen = data.length;\n\tconst bitLen = inputLen * 8;\n\tconst paddedLen = inputLen + 9 + 63 & -64;\n\tconst padded = new Uint8Array(paddedLen);\n\tpadded.set(data);\n\tpadded[inputLen] = 128;\n\tconst view = new DataView(padded.buffer);\n\tview.setUint32(paddedLen - 8, Math.floor(bitLen / 4294967296), false);\n\tview.setUint32(paddedLen - 4, bitLen >>> 0, false);\n\tconst H = new Uint32Array([\n\t\t1779033703,\n\t\t3144134277,\n\t\t1013904242,\n\t\t2773480762,\n\t\t1359893119,\n\t\t2600822924,\n\t\t528734635,\n\t\t1541459225\n\t]);\n\tconst W = /* @__PURE__ */ new Uint32Array(64);\n\tfor (let block = 0; block < paddedLen; block += 64) {\n\t\tfor (let t = 0; t < 16; t++) W[t] = view.getUint32(block + t * 4, false);\n\t\tfor (let t = 16; t < 64; t++) {\n\t\t\tconst w15 = W[t - 15];\n\t\t\tconst w2 = W[t - 2];\n\t\t\tconst s0 = _rotr(w15, 7) ^ _rotr(w15, 18) ^ w15 >>> 3;\n\t\t\tconst s1 = _rotr(w2, 17) ^ _rotr(w2, 19) ^ w2 >>> 10;\n\t\t\tW[t] = W[t - 16] + s0 + W[t - 7] + s1 >>> 0;\n\t\t}\n\t\tlet a = H[0], b = H[1], c = H[2], d = H[3];\n\t\tlet e = H[4], f = H[5], g = H[6], h = H[7];\n\t\tfor (let t = 0; t < 64; t++) {\n\t\t\tconst S1 = _rotr(e, 6) ^ _rotr(e, 11) ^ _rotr(e, 25);\n\t\t\tconst ch = e & f ^ ~e & g;\n\t\t\tconst temp1 = h + S1 + ch + K[t] + W[t] >>> 0;\n\t\t\tconst temp2 = (_rotr(a, 2) ^ _rotr(a, 13) ^ _rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;\n\t\t\th = g;\n\t\t\tg = f;\n\t\t\tf = e;\n\t\t\te = d + temp1 >>> 0;\n\t\t\td = c;\n\t\t\tc = b;\n\t\t\tb = a;\n\t\t\ta = temp1 + temp2 >>> 0;\n\t\t}\n\t\tH[0] = H[0] + a >>> 0;\n\t\tH[1] = H[1] + b >>> 0;\n\t\tH[2] = H[2] + c >>> 0;\n\t\tH[3] = H[3] + d >>> 0;\n\t\tH[4] = H[4] + e >>> 0;\n\t\tH[5] = H[5] + f >>> 0;\n\t\tH[6] = H[6] + g >>> 0;\n\t\tH[7] = H[7] + h >>> 0;\n\t}\n\tconst out = /* @__PURE__ */ new Uint8Array(32);\n\tconst outView = new DataView(out.buffer);\n\tfor (let i = 0; i < 8; i++) outView.setUint32(i * 4, H[i], false);\n\treturn out;\n}\n//#endregion\n//#region src/schema/hash.ts\n/**\n* Compute the interface hash: SHA-256 of the canonicalized schema, truncated\n* to 16 hex chars (64 bits of collision budget per id).\n*\n* Canonicalization:\n* 1. Strip every `comment` field (non-normative — must not affect identity).\n* `description` is NORMATIVE and kept in the hash.\n* 2. Omit the top-level `hash` field itself.\n* 3. RFC 8785 JCS encode (recursive key sort, no whitespace) via {@link jcsCanonicalize}.\n*/\nfunction computeInterfaceHash(schema) {\n\tconst json = jcsCanonicalize(stripNonNormative(schema, true));\n\tconst digest = sha256$1(new TextEncoder().encode(json));\n\treturn Array.from(digest.subarray(0, 8), (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\nfunction stripNonNormative(value, isRoot = false) {\n\tif (value === null || typeof value !== \"object\") return value;\n\tif (Array.isArray(value)) return value.map((v) => stripNonNormative(v));\n\tconst out = {};\n\tfor (const k of Object.keys(value)) {\n\t\tif (k === \"comment\" || isRoot && k === \"hash\") continue;\n\t\tconst v = value[k];\n\t\tif (v === void 0) continue;\n\t\tout[k] = stripNonNormative(v);\n\t}\n\treturn out;\n}\n//#endregion\n//#region src/connection/interfaceDefinition.ts\nvar InterfaceDefinition = class {\n\tinfo;\n\tmembers;\n\tconstructor(info, members, opts = {}) {\n\t\tthis.info = info;\n\t\tthis.members = members;\n\t\tthis._frozenSchema = opts.frozenSchema;\n\t\tif (info.hash !== void 0 && this.schemaHash !== info.hash) throw new Error(`Interface hash mismatch for \"${info.id}\": expected \"${info.hash}\", got \"${this.schemaHash}\". The interface's wire contract changed — update the pinned hash to \"${this.schemaHash}\" after reviewing the change.`);\n\t}\n\t_frozenSchema;\n\t_schemaCache;\n\t_hashCache;\n\t/** Content hash of this interface (see `computeInterfaceHash`). */\n\tget schemaHash() {\n\t\tif (this._hashCache === void 0) {\n\t\t\tconst base = this._frozenSchema ?? this._buildSchema(\"\");\n\t\t\tthis._hashCache = computeInterfaceHash(base);\n\t\t}\n\t\treturn this._hashCache;\n\t}\n\t/** Lower the definition to a wire-format `HubRpcInterfaceSchema`, hash filled in. */\n\ttoSchema() {\n\t\tif (this._schemaCache === void 0) this._schemaCache = this._frozenSchema !== void 0 ? {\n\t\t\t...this._frozenSchema,\n\t\t\thash: this.schemaHash\n\t\t} : this._buildSchema(this.schemaHash);\n\t\treturn this._schemaCache;\n\t}\n\t_buildSchema(hash) {\n\t\tconst methods = [];\n\t\tfor (const [name, member] of Object.entries(this.members)) methods.push(toMethodSchema(name, member));\n\t\tconst schema = {\n\t\t\tid: this.info.id,\n\t\t\thash,\n\t\t\tmethods\n\t\t};\n\t\tif (this.info.description !== void 0) schema.description = this.info.description;\n\t\tif (this.info.comment !== void 0) schema.comment = this.info.comment;\n\t\treturn schema;\n\t}\n};\nfunction toMethodSchema(name, member) {\n\tconst params = {\n\t\tname: \"params\",\n\t\tschema: zodToSvcJsonSchema(member.paramsSchema),\n\t\trequired: true\n\t};\n\tconst docs = member.docs;\n\tif (member.kind === \"request\") {\n\t\tconst m = {\n\t\t\tname,\n\t\t\tparams: [params],\n\t\t\tresult: {\n\t\t\t\tname: \"result\",\n\t\t\t\tschema: zodToSvcJsonSchema(member.resultSchema),\n\t\t\t\trequired: true\n\t\t\t}\n\t\t};\n\t\tif (member.clientStreamSchema !== void 0) m.clientStream = {\n\t\t\tname: \"clientStream\",\n\t\t\tschema: zodToSvcJsonSchema(member.clientStreamSchema),\n\t\t\trequired: true\n\t\t};\n\t\tif (member.serverStreamSchema !== void 0) m.serverStream = {\n\t\t\tname: \"serverStream\",\n\t\t\tschema: zodToSvcJsonSchema(member.serverStreamSchema),\n\t\t\trequired: true\n\t\t};\n\t\tif (docs.description !== void 0) m.description = docs.description;\n\t\tif (docs.comment !== void 0) m.comment = docs.comment;\n\t\tif (docs.annotations !== void 0) m.annotations = docs.annotations;\n\t\treturn m;\n\t}\n\tconst m = {\n\t\tname,\n\t\tparams: [params]\n\t};\n\tif (docs.description !== void 0) m.description = docs.description;\n\tif (docs.comment !== void 0) m.comment = docs.comment;\n\tif (docs.annotations !== void 0) m.annotations = docs.annotations;\n\treturn m;\n}\n/**\n* Convenient builder for an interface definition. Tracks TypeScript types\n* through `requestType` / `notificationType` so client and server code can\n* derive their shapes from the definition.\n*\n* @example\n* const myInterface = defineInterface(\n* { id: \"de.hediet.notification-target\" },\n* {\n* send: requestType(z.object({ to: z.string() }), z.string()),\n* notify: notificationType(z.object({ message: z.string() })),\n* },\n* );\n*/\nfunction defineInterface(info, members) {\n\treturn new InterfaceDefinition(info, members);\n}\n/**\n* Build a runtime {@link InterfaceDefinition} from a previously-published\n* {@link HubRpcInterfaceSchema} — typically one received over the wire (e.g.\n* from `hubrpc.schemas::get`) or generated at runtime by tooling that does\n* not have the original zod sources at hand (codegen, faker / mock\n* services, dynamic gateways).\n*\n* The original schema is kept verbatim: `toSchema()` returns it (with\n* `hash` overlaid) and `schemaHash` is computed from it, so reflection\n* consumers see the real wire contract. Member-level params / results /\n* streams use `z.any()` because no zod source is available — call-site\n* validation is therefore a no-op and the caller is responsible for\n* shape-checking inputs and outputs.\n*\n* Methods with no `result` descriptor become notifications; methods with\n* `clientStream` / `serverStream` get pass-through stream payload\n* schemas attached.\n*/\nfunction interfaceFromSchema(schema) {\n\tconst members = {};\n\tfor (const m of schema.methods) {\n\t\tif (m.result === void 0) {\n\t\t\tmembers[m.name] = new NotificationType(any());\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = new RequestType(any(), any(), void$1());\n\t\tmembers[m.name] = m.clientStream !== void 0 || m.serverStream !== void 0 ? base.withStream({\n\t\t\tclient: m.clientStream !== void 0 ? any() : void 0,\n\t\t\tserver: m.serverStream !== void 0 ? any() : void 0\n\t\t}) : base;\n\t}\n\tconst info = { id: schema.id };\n\tif (schema.description !== void 0) info.description = schema.description;\n\tif (schema.comment !== void 0) info.comment = schema.comment;\n\treturn new InterfaceDefinition(info, members, { frozenSchema: schema });\n}\n//#endregion\n//#region src/schema/assignability.ts\n/**\n* Structural subtype check: returns `true` iff every JSON value matching\n* `sub` also matches `sup`, over the SvcJsonSchema subset.\n*\n* Cycles introduced by `$ref` are broken by assuming the recursive case\n* holds (standard coinductive subtyping). This is sound for productive\n* (non-degenerate) schemas; pathological inputs are out of scope.\n*/\nfunction isAssignable(sub, sup, components = {}) {\n\treturn _check(sub, sup, components, /* @__PURE__ */ new Set());\n}\nfunction _check(sub, sup, c, seen) {\n\tif (sup === true) return true;\n\tif (sub === false) return true;\n\tif (sup === false) return _isBottom(sub, c, seen);\n\tif (sub === true) return false;\n\tif (_isRef(sub)) {\n\t\tconst k = `S:${sub.$ref}|${_keyOf(sup)}`;\n\t\tif (seen.has(k)) return true;\n\t\tconst resolved = _resolveRef(sub, c);\n\t\tif (!resolved) return false;\n\t\treturn _check(resolved, sup, c, new Set(seen).add(k));\n\t}\n\tif (_isRef(sup)) {\n\t\tconst k = `${_keyOf(sub)}|T:${sup.$ref}`;\n\t\tif (seen.has(k)) return true;\n\t\tconst resolved = _resolveRef(sup, c);\n\t\tif (!resolved) return false;\n\t\treturn _check(sub, resolved, c, new Set(seen).add(k));\n\t}\n\tif (_isUnion(sub)) return _branches(sub).every((branch) => _check(branch, sup, c, seen));\n\tif (_isUnion(sup)) return _branches(sup).some((branch) => _check(sub, branch, c, seen));\n\tif (_isConst(sub)) return _matches(sub.const, sup, c, seen);\n\tif (_isEnum(sub)) return sub.enum.every((v) => _matches(v, sup, c, seen));\n\tif (_isConst(sup)) {\n\t\tif (_isConst(sub)) return _jsonEq(sub.const, sup.const);\n\t\treturn false;\n\t}\n\tif (_isEnum(sup)) {\n\t\tif (_isConst(sub)) return sup.enum.some((v) => _jsonEq(sub.const, v));\n\t\treturn false;\n\t}\n\tconst subType = sub.type;\n\tconst supType = sup.type;\n\tif (subType !== supType) {\n\t\tif (subType === \"integer\" && supType === \"number\") return true;\n\t\treturn false;\n\t}\n\tswitch (subType) {\n\t\tcase \"null\":\n\t\tcase \"boolean\": return true;\n\t\tcase \"number\":\n\t\tcase \"integer\": return _formatCompatible(sub.format, sup.format);\n\t\tcase \"string\": return _formatCompatible(sub.format, sup.format);\n\t\tcase \"array\": return _checkArrayLike(sub, sup, c, seen);\n\t\tcase \"object\": return _checkObject(sub, sup, c, seen);\n\t\tdefault: return false;\n\t}\n}\nfunction _checkObject(sub, sup, c, seen) {\n\tconst subReq = new Set(sub.required ?? []);\n\tconst supReq = new Set(sup.required ?? []);\n\tfor (const k of supReq) if (!subReq.has(k)) return false;\n\tfor (const [k, supProp] of Object.entries(sup.properties)) {\n\t\tconst subProp = sub.properties[k] ?? sub.additionalProperties;\n\t\tif (subProp === false) {\n\t\t\tif (supReq.has(k)) return false;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!_check(subProp, supProp, c, seen)) return false;\n\t}\n\tfor (const [k, subProp] of Object.entries(sub.properties)) {\n\t\tif (k in sup.properties) continue;\n\t\tif (sup.additionalProperties === false) return false;\n\t\tif (!_check(subProp, sup.additionalProperties, c, seen)) return false;\n\t}\n\tif (sub.additionalProperties === false) {} else if (sup.additionalProperties === false) return false;\n\telse if (!_check(sub.additionalProperties, sup.additionalProperties, c, seen)) return false;\n\treturn true;\n}\nfunction _checkArrayLike(sub, sup, c, seen) {\n\tconst subPrefix = sub.prefixItems ?? [];\n\tconst supPrefix = sup.prefixItems ?? [];\n\tconst subRest = _restOf(sub);\n\tconst supRest = _restOf(sup);\n\tconst n = Math.max(subPrefix.length, supPrefix.length);\n\tfor (let i = 0; i < n; i++) {\n\t\tconst a = subPrefix[i] ?? subRest;\n\t\tconst b = supPrefix[i] ?? supRest;\n\t\tif (a === false) {\n\t\t\tif (b !== false && b !== true) return false;\n\t\t\tcontinue;\n\t\t}\n\t\tif (b === false) return false;\n\t\tif (!_check(a, b, c, seen)) return false;\n\t}\n\tif (subRest === false) {} else if (supRest === false) return false;\n\telse if (!_check(subRest, supRest, c, seen)) return false;\n\treturn true;\n}\nfunction _restOf(s) {\n\tif (\"items\" in s) {\n\t\tif (s.items === void 0) return false;\n\t\treturn s.items;\n\t}\n\treturn true;\n}\nfunction _matches(v, sup, c, seen) {\n\tif (sup === true) return true;\n\tif (sup === false) return false;\n\tif (_isRef(sup)) {\n\t\tconst r = _resolveRef(sup, c);\n\t\treturn r ? _matches(v, r, c, seen) : false;\n\t}\n\tif (_isUnion(sup)) return _branches(sup).some((b) => _matches(v, b, c, seen));\n\tif (_isConst(sup)) return _jsonEq(v, sup.const);\n\tif (_isEnum(sup)) return sup.enum.some((e) => _jsonEq(v, e));\n\tswitch (sup.type) {\n\t\tcase \"null\": return v === null;\n\t\tcase \"boolean\": return typeof v === \"boolean\";\n\t\tcase \"number\": return typeof v === \"number\";\n\t\tcase \"integer\": return typeof v === \"number\" && Number.isInteger(v);\n\t\tcase \"string\": return typeof v === \"string\";\n\t\tcase \"array\": return Array.isArray(v) && _matchesArray(v, sup, c, seen);\n\t\tcase \"object\": return v !== null && typeof v === \"object\" && !Array.isArray(v) && _matchesObject(v, sup, c, seen);\n\t\tdefault: return false;\n\t}\n}\nfunction _matchesArray(v, sup, c, seen) {\n\tconst prefix = sup.prefixItems ?? [];\n\tconst rest = _restOf(sup);\n\tif (rest === false && v.length !== prefix.length) {\n\t\tif (v.length > prefix.length) return false;\n\t}\n\tfor (let i = 0; i < v.length; i++) {\n\t\tconst s = prefix[i] ?? (rest === false ? false : rest);\n\t\tif (s === false) return false;\n\t\tif (!_matches(v[i], s, c, seen)) return false;\n\t}\n\treturn true;\n}\nfunction _matchesObject(v, sup, c, seen) {\n\tfor (const k of sup.required ?? []) if (!(k in v)) return false;\n\tfor (const [k, val] of Object.entries(v)) {\n\t\tconst s = sup.properties[k] ?? sup.additionalProperties;\n\t\tif (s === false) return false;\n\t\tif (!_matches(val, s, c, seen)) return false;\n\t}\n\treturn true;\n}\nfunction _isBottom(s, c, seen) {\n\tif (s === false) return true;\n\tif (s === true) return false;\n\tif (_isRef(s)) {\n\t\tconst k = `B:${s.$ref}`;\n\t\tif (seen.has(k)) return false;\n\t\tconst r = _resolveRef(s, c);\n\t\treturn r ? _isBottom(r, c, new Set(seen).add(k)) : false;\n\t}\n\tif (_isUnion(s)) return _branches(s).every((b) => _isBottom(b, c, seen));\n\treturn false;\n}\nfunction _formatCompatible(subFmt, supFmt) {\n\tif (supFmt === void 0) return true;\n\treturn subFmt === supFmt;\n}\nfunction _isRef(s) {\n\treturn s !== true && s !== false && \"$ref\" in s;\n}\nfunction _isUnion(s) {\n\treturn s !== true && s !== false && (\"anyOf\" in s || \"oneOf\" in s);\n}\nfunction _branches(s) {\n\treturn \"anyOf\" in s ? s.anyOf : s.oneOf;\n}\nfunction _isConst(s) {\n\treturn s !== true && s !== false && \"const\" in s;\n}\nfunction _isEnum(s) {\n\treturn s !== true && s !== false && \"enum\" in s;\n}\nfunction _resolveRef(r, c) {\n\tif (!r.$ref.startsWith(\"#/components/schemas/\")) return void 0;\n\tconst name = r.$ref.slice(21);\n\treturn c.schemas?.[name];\n}\nfunction _keyOf(s) {\n\tif (s === true || s === false) return String(s);\n\tif (\"$ref\" in s) return `R:${s.$ref}`;\n\treturn JSON.stringify(s);\n}\nfunction _jsonEq(a, b) {\n\tif (a === b) return true;\n\tif (a === null || b === null) return false;\n\tif (typeof a !== typeof b) return false;\n\tif (Array.isArray(a)) {\n\t\tif (!Array.isArray(b) || a.length !== b.length) return false;\n\t\treturn a.every((v, i) => _jsonEq(v, b[i]));\n\t}\n\tif (typeof a === \"object\") {\n\t\tconst ao = a;\n\t\tconst bo = b;\n\t\tconst ak = Object.keys(ao).sort();\n\t\tconst bk = Object.keys(bo).sort();\n\t\tif (ak.length !== bk.length) return false;\n\t\treturn ak.every((k, i) => k === bk[i] && _jsonEq(ao[k], bo[k]));\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/schema/codegen/utils/codeWriter.ts\n/**\n* Minimal indentation-aware text builder for code generation.\n*\n* Usage pattern:\n* - {@link append} extends the *current* (unfinished) line. Indentation\n* is inserted lazily the first time content lands on a fresh line, so\n* blank lines stay blank.\n* - {@link newline} ends the current line.\n* - {@link writeLine} is `append` + `newline`.\n* - {@link indent} / {@link dedent} change the indent level used for\n* *future* fresh lines; they do not retroactively reformat the\n* in-progress line.\n*\n* Indentation is fixed at four spaces, matching the surrounding codebase.\n*/\nvar CodeWriter = class {\n\t_lines = [];\n\t_current = \"\";\n\t_indent = 0;\n\t_onFreshLine = true;\n\tindent() {\n\t\tthis._indent++;\n\t\treturn this;\n\t}\n\tdedent() {\n\t\tif (this._indent === 0) throw new Error(\"CodeWriter: dedent below 0\");\n\t\tthis._indent--;\n\t\treturn this;\n\t}\n\tappend(text) {\n\t\tif (text.length === 0) return this;\n\t\tif (this._onFreshLine) {\n\t\t\tthis._current = \" \".repeat(this._indent);\n\t\t\tthis._onFreshLine = false;\n\t\t}\n\t\tthis._current += text;\n\t\treturn this;\n\t}\n\tnewline() {\n\t\tthis._lines.push(this._current);\n\t\tthis._current = \"\";\n\t\tthis._onFreshLine = true;\n\t\treturn this;\n\t}\n\twriteLine(text = \"\") {\n\t\treturn this.append(text).newline();\n\t}\n\ttoString() {\n\t\tconst lines = [...this._lines];\n\t\tif (!this._onFreshLine) lines.push(this._current);\n\t\treturn lines.join(\"\\n\") + \"\\n\";\n\t}\n};\n//#endregion\n//#region src/schema/codegen/generateTsInterface.ts\n/**\n* Render a {@link HubRpcInterfaceSchema} as a stand-alone TypeScript source\n* file that, when evaluated, reproduces the same canonical schema (and\n* therefore the same `schemaHash`).\n*\n* Components in `components.schemas` are emitted as named `const`\n* declarations referenced from the bodies via `$ref`.\n*/\nfunction generateTsInterface(schema, options = {}) {\n\tconst hubRpcImport = options.hubRpcImport ?? \"@vscode/hubrpc\";\n\tconst exportName = options.exportName ?? _deriveExportName(schema.id);\n\tconst w = new CodeWriter();\n\tw.writeLine(`import { defineInterface, notificationType, requestType } from \"${hubRpcImport}\";`);\n\tw.writeLine(`import { z } from \"zod\";`);\n\tw.writeLine();\n\tconst componentSchemas = schema.components?.schemas ?? {};\n\tconst componentNames = /* @__PURE__ */ new Map();\n\tfor (const name of Object.keys(componentSchemas)) componentNames.set(name, _toComponentVar(name));\n\tfor (const [name, sub] of Object.entries(componentSchemas)) {\n\t\tconst varName = componentNames.get(name);\n\t\tw.append(`const ${varName} = `);\n\t\t_writeSchema(w, sub, componentNames);\n\t\tw.append(\";\");\n\t\tw.newline();\n\t\tw.writeLine();\n\t}\n\tw.append(`export const ${exportName} = defineInterface(`);\n\tw.newline();\n\tw.indent();\n\t_writeInterfaceInfo(w, schema);\n\tw.append(\",\");\n\tw.newline();\n\t_writeMembers(w, schema.methods, componentNames);\n\tw.append(\",\");\n\tw.newline();\n\tw.dedent();\n\tw.writeLine(\");\");\n\treturn w.toString();\n}\nfunction _writeInterfaceInfo(w, schema) {\n\tw.append(\"{\").newline();\n\tw.indent();\n\tw.append(`id: ${JSON.stringify(schema.id)},`).newline();\n\tif (schema.description !== void 0) w.append(`description: ${JSON.stringify(schema.description)},`).newline();\n\tif (schema.comment !== void 0) w.append(`comment: ${JSON.stringify(schema.comment)},`).newline();\n\tw.dedent();\n\tw.append(\"}\");\n}\nfunction _writeMembers(w, methods, components) {\n\tw.append(\"{\").newline();\n\tw.indent();\n\tfor (const method of methods) {\n\t\tw.append(`${_propKey(method.name)}: `);\n\t\t_writeMethod(w, method, components);\n\t\tw.append(\",\");\n\t\tw.newline();\n\t}\n\tw.dedent();\n\tw.append(\"}\");\n}\nfunction _writeMethod(w, method, components) {\n\tconst params = method.params[0];\n\tif (params === void 0) throw new Error(`generateInterface: method \"${method.name}\" has no params descriptor`);\n\tconst docs = _collectMemberDocs(method);\n\tif (method.result === void 0) {\n\t\tw.append(\"notificationType(\").newline();\n\t\tw.indent();\n\t\t_writeParamsSchema(w, params, components);\n\t\tw.append(\",\").newline();\n\t\tif (docs !== void 0) {\n\t\t\t_writeDocs(w, docs);\n\t\t\tw.append(\",\").newline();\n\t\t}\n\t\tw.dedent();\n\t\tw.append(\")\");\n\t\treturn;\n\t}\n\tw.append(\"requestType(\").newline();\n\tw.indent();\n\t_writeParamsSchema(w, params, components);\n\tw.append(\",\").newline();\n\t_writeSchema(w, method.result.schema, components);\n\tw.append(\",\").newline();\n\tif (docs !== void 0) {\n\t\t_writeDocs(w, docs);\n\t\tw.append(\",\").newline();\n\t}\n\tw.dedent();\n\tw.append(\")\");\n\tif (method.clientStream !== void 0 || method.serverStream !== void 0) {\n\t\tw.append(\".withStream({\").newline();\n\t\tw.indent();\n\t\tif (method.clientStream !== void 0) {\n\t\t\tw.append(\"client: \");\n\t\t\t_writeSchema(w, method.clientStream.schema, components);\n\t\t\tw.append(\",\").newline();\n\t\t}\n\t\tif (method.serverStream !== void 0) {\n\t\t\tw.append(\"server: \");\n\t\t\t_writeSchema(w, method.serverStream.schema, components);\n\t\t\tw.append(\",\").newline();\n\t\t}\n\t\tw.dedent();\n\t\tw.append(\"})\");\n\t}\n}\nfunction _writeParamsSchema(w, params, components) {\n\t_writeSchema(w, params.schema, components);\n}\nfunction _collectMemberDocs(method) {\n\tconst docs = {};\n\tif (method.description !== void 0) docs.description = method.description;\n\tif (method.comment !== void 0) docs.comment = method.comment;\n\tif (method.annotations !== void 0 && Object.keys(method.annotations).length > 0) docs.annotations = method.annotations;\n\treturn docs.description === void 0 && docs.comment === void 0 && docs.annotations === void 0 ? void 0 : docs;\n}\nfunction _writeDocs(w, docs) {\n\tw.append(\"{\").newline();\n\tw.indent();\n\tif (docs.description !== void 0) w.append(`description: ${JSON.stringify(docs.description)},`).newline();\n\tif (docs.comment !== void 0) w.append(`comment: ${JSON.stringify(docs.comment)},`).newline();\n\tif (docs.annotations !== void 0) w.append(`annotations: ${JSON.stringify(docs.annotations)},`).newline();\n\tw.dedent();\n\tw.append(\"}\");\n}\n/**\n* Emit a zod expression equivalent to `schema`. The expression begins at\n* the writer's current line position and may span multiple lines; it\n* ends without a trailing newline so the caller can append punctuation.\n*/\nfunction _writeSchema(w, schema, components) {\n\tif (schema === true) {\n\t\t_writeMetaWrapped(w, \"z.unknown()\", void 0);\n\t\treturn;\n\t}\n\tif (schema === false) {\n\t\t_writeMetaWrapped(w, \"z.never()\", void 0);\n\t\treturn;\n\t}\n\tconst s = schema;\n\tif (typeof s[\"$ref\"] === \"string\") {\n\t\tconst refName = _parseRef(s[\"$ref\"]);\n\t\tconst varName = components.get(refName);\n\t\tif (varName === void 0) throw new Error(`generateInterface: dangling $ref \"${s[\"$ref\"]}\"`);\n\t\t_writeMetaWrapped(w, varName, _metaOf(s));\n\t\treturn;\n\t}\n\tif (\"const\" in s) {\n\t\t_writeMetaWrapped(w, `z.literal(${_jsonLiteral(s[\"const\"])})`, _metaOf(s));\n\t\treturn;\n\t}\n\tif (Array.isArray(s[\"enum\"])) {\n\t\tconst values = s[\"enum\"];\n\t\tif (values.every((v) => typeof v === \"string\")) {\n\t\t\t_writeMetaWrapped(w, `z.enum([${values.map((v) => JSON.stringify(v)).join(\", \")}])`, _metaOf(s));\n\t\t\treturn;\n\t\t}\n\t\t_writeMetaWrapped(w, `z.union([${values.map((v) => `z.literal(${_jsonLiteral(v)})`).join(\", \")}])`, _metaOf(s));\n\t\treturn;\n\t}\n\tif (Array.isArray(s[\"oneOf\"])) {\n\t\tconst branches = s[\"oneOf\"];\n\t\tconst disc = s[\"discriminator\"];\n\t\tif (disc?.propertyName !== void 0) _writeUnion(w, \"z.discriminatedUnion\", branches, components, disc.propertyName);\n\t\telse throw new Error(\"generateInterface: `oneOf` without a `discriminator` is not representable.\");\n\t\t_writeMetaSuffix(w, _metaOf(s));\n\t\treturn;\n\t}\n\tif (Array.isArray(s[\"anyOf\"])) {\n\t\t_writeUnion(w, \"z.union\", s[\"anyOf\"], components);\n\t\t_writeMetaSuffix(w, _metaOf(s));\n\t\treturn;\n\t}\n\tif (s[\"type\"] === \"object\") {\n\t\t_writeObject(w, s, components);\n\t\t_writeMetaSuffix(w, _metaOf(s));\n\t\treturn;\n\t}\n\tif (s[\"type\"] === \"array\" && Array.isArray(s[\"prefixItems\"])) {\n\t\t_writeTuple(w, s, components);\n\t\t_writeMetaSuffix(w, _metaOf(s));\n\t\treturn;\n\t}\n\tif (s[\"type\"] === \"array\") {\n\t\tconst items = s[\"items\"] ?? true;\n\t\tw.append(\"z.array(\");\n\t\t_writeSchema(w, items, components);\n\t\tw.append(\")\");\n\t\t_writeMetaSuffix(w, _metaOf(s));\n\t\treturn;\n\t}\n\tconst primitive = _primitiveExpr(s);\n\tif (primitive !== void 0) {\n\t\t_writeMetaWrapped(w, primitive, _metaOf(s));\n\t\treturn;\n\t}\n\tthrow new Error(`generateInterface: unsupported schema: ${JSON.stringify(schema)}`);\n}\nfunction _writeObject(w, s, components) {\n\tconst properties = s[\"properties\"] ?? {};\n\tconst required = new Set(s[\"required\"] ?? []);\n\tconst additional = s[\"additionalProperties\"];\n\tconst constructor = additional === false || additional === void 0 ? \"z.object\" : \"z.looseObject\";\n\tconst keys = Object.keys(properties);\n\tif (keys.length === 0) w.append(`${constructor}({})`);\n\telse {\n\t\tw.append(`${constructor}({`).newline();\n\t\tw.indent();\n\t\tfor (const key of keys) {\n\t\t\tw.append(`${_propKey(key)}: `);\n\t\t\t_writeSchema(w, properties[key], components);\n\t\t\tif (!required.has(key)) w.append(\".optional()\");\n\t\t\tw.append(\",\").newline();\n\t\t}\n\t\tw.dedent();\n\t\tw.append(\"})\");\n\t}\n\tif (additional !== false && additional !== void 0 && additional !== true) {\n\t\tw.append(\".catchall(\");\n\t\t_writeSchema(w, additional, components);\n\t\tw.append(\")\");\n\t}\n}\nfunction _writeTuple(w, s, components) {\n\tconst prefix = s[\"prefixItems\"];\n\tw.append(\"z.tuple([\").newline();\n\tw.indent();\n\tfor (const item of prefix) {\n\t\t_writeSchema(w, item, components);\n\t\tw.append(\",\").newline();\n\t}\n\tw.dedent();\n\tw.append(\"])\");\n\tconst rest = s[\"items\"];\n\tif (rest !== void 0 && rest !== false) {\n\t\tw.append(\".rest(\");\n\t\t_writeSchema(w, rest, components);\n\t\tw.append(\")\");\n\t}\n}\nfunction _writeUnion(w, constructor, branches, components, discriminator) {\n\tif (constructor === \"z.discriminatedUnion\" && discriminator !== void 0) w.append(`${constructor}(${JSON.stringify(discriminator)}, [`).newline();\n\telse w.append(`${constructor}([`).newline();\n\tw.indent();\n\tfor (const branch of branches) {\n\t\t_writeSchema(w, branch, components);\n\t\tw.append(\",\").newline();\n\t}\n\tw.dedent();\n\tw.append(\"])\");\n}\nfunction _primitiveExpr(s) {\n\tconst type = s[\"type\"];\n\tconst format = s[\"format\"];\n\tswitch (type) {\n\t\tcase \"null\": return \"z.null()\";\n\t\tcase \"boolean\": return \"z.boolean()\";\n\t\tcase \"string\": return _stringExpr(format);\n\t\tcase \"integer\": return _integerExpr(format);\n\t\tcase \"number\": return _numberExpr(format);\n\t\tdefault: return;\n\t}\n}\nfunction _stringExpr(format) {\n\tif (format === void 0) return \"z.string()\";\n\tswitch (format) {\n\t\tcase \"email\": return \"z.email()\";\n\t\tcase \"uri\":\n\t\tcase \"url\": return \"z.url()\";\n\t\tcase \"uuid\": return \"z.uuid()\";\n\t\tcase \"date-time\": return \"z.iso.datetime()\";\n\t\tcase \"date\": return \"z.iso.date()\";\n\t\tcase \"time\": return \"z.iso.time()\";\n\t\tcase \"duration\": return \"z.iso.duration()\";\n\t\tcase \"ipv4\": return \"z.ipv4()\";\n\t\tcase \"ipv6\": return \"z.ipv6()\";\n\t\tcase \"base64\": return \"z.base64()\";\n\t\tcase \"base64url\": return \"z.base64url()\";\n\t\tcase \"nanoid\": return \"z.nanoid()\";\n\t\tcase \"cuid\": return \"z.cuid()\";\n\t\tcase \"cuid2\": return \"z.cuid2()\";\n\t\tcase \"ulid\": return \"z.ulid()\";\n\t\tdefault: return \"z.string()\";\n\t}\n}\nfunction _integerExpr(format) {\n\tswitch (format) {\n\t\tcase \"int32\": return \"z.int32()\";\n\t\tcase \"uint32\": return \"z.uint32()\";\n\t\tcase \"int64\": return \"z.int64()\";\n\t\tcase \"uint64\": return \"z.uint64()\";\n\t\tcase void 0: return \"z.int()\";\n\t\tdefault: return \"z.int()\";\n\t}\n}\nfunction _numberExpr(format) {\n\tswitch (format) {\n\t\tcase \"float32\": return \"z.float32()\";\n\t\tcase \"float64\": return \"z.float64()\";\n\t\tcase void 0: return \"z.number()\";\n\t\tdefault: return \"z.number()\";\n\t}\n}\nfunction _metaOf(s) {\n\tconst meta = {};\n\tif (typeof s[\"description\"] === \"string\") meta.description = s[\"description\"];\n\tif (typeof s[\"title\"] === \"string\") meta.title = s[\"title\"];\n\treturn meta.description === void 0 && meta.title === void 0 ? void 0 : meta;\n}\n/** Wrap a single-line zod expression with `.describe()` / `.meta()`. */\nfunction _writeMetaWrapped(w, expr, meta) {\n\tw.append(expr);\n\t_writeMetaSuffix(w, meta);\n}\nfunction _writeMetaSuffix(w, meta) {\n\tif (meta === void 0) return;\n\tif (meta.title === void 0 && meta.description !== void 0) {\n\t\tw.append(`.describe(${JSON.stringify(meta.description)})`);\n\t\treturn;\n\t}\n\tconst entries = [];\n\tif (meta.title !== void 0) entries.push(`title: ${JSON.stringify(meta.title)}`);\n\tif (meta.description !== void 0) entries.push(`description: ${JSON.stringify(meta.description)}`);\n\tw.append(`.meta({ ${entries.join(\", \")} })`);\n}\nfunction _propKey(name) {\n\treturn /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : JSON.stringify(name);\n}\nfunction _jsonLiteral(value) {\n\treturn JSON.stringify(value);\n}\nfunction _parseRef(ref) {\n\tif (!ref.startsWith(\"#/components/schemas/\")) throw new Error(`generateInterface: unsupported $ref \"${ref}\"`);\n\treturn ref.slice(21);\n}\nfunction _toComponentVar(name) {\n\tconst sanitized = name.replace(/[^A-Za-z0-9_$]/g, \"_\");\n\treturn (/^[A-Za-z_$]/.test(sanitized) ? sanitized : `_${sanitized}`) + \"Schema\";\n}\nfunction _deriveExportName(id) {\n\tconst parts = id.split(/[^A-Za-z0-9]+/).filter((p) => p.length > 0);\n\tif (parts.length === 0) return \"iface\";\n\treturn parts[0].toLowerCase() + parts.slice(1).map((p) => p[0].toUpperCase() + p.slice(1).toLowerCase()).join(\"\") + \"Interface\";\n}\n//#endregion\n//#region src/hub/common/reflection.interfaces.ts\nconst defaultsInterface = defineInterface({\n\tid: \"hubrpc.defaults\",\n\tdescription: \"Reflection: preset default service / interface on this connection.\"\n}, { get: requestType(object({}), object({\n\tserviceId: optional(string()),\n\tinterfaceId: optional(string()),\n\t/** Hash of the preset interface, if known. */\n\tinterfaceHash: optional(string())\n})) });\n/** One OR-set. The set is satisfied by holding *any one* of its principals. */\nconst zRootPrincipalSet = array(object({\n\tprincipal: string(),\n\ttransitive: optional(boolean())\n}));\nconst zServiceListing = object({\n\tserviceId: string(),\n\tinterfaceId: string(),\n\t/** Hash of the interface as implemented by this service. */\n\tinterfaceHash: string(),\n\t/** Optional non-normative description of the owning service. */\n\tserviceDescription: optional(string()),\n\t/**\n\t* Root principals required to access this service, in CNF: the caller must\n\t* satisfy **every** set (AND), and a set is satisfied by **any one** of its\n\t* principals (OR). Omitted/empty => no root-principal requirement.\n\t*/\n\trootPrincipalSets: optional(array(zRootPrincipalSet))\n});\nconst directoryInterface = defineInterface({\n\tid: \"hubrpc.directory\",\n\tdescription: \"Reflection: list services exposed by this endpoint. Can also list other directory services that can be explored.\"\n}, {\n\tlist: requestType(object({\n\t\t/** Filter: only return services implementing this interface id. */\n\t\tinterfaceId: optional(string()),\n\t\t/** Filter: only return entries for this service id. */\n\t\tserviceId: optional(string()),\n\t\t/** Paging: opaque continuation token from a previous response. */\n\t\tcursor: optional(string()),\n\t\t/** Paging: max items in this page. Server MAY return fewer. */\n\t\tlimit: optional(number().check(int(), positive())),\n\t\t/** Soft cap on time the server spends gathering this page, in ms. */\n\t\ttimeoutMs: optional(number().check(int(), nonnegative()))\n\t}), object({\n\t\titems: array(zServiceListing),\n\t\t/** Omitted => no more pages. */\n\t\tnextCursor: optional(string()),\n\t\t/** True if `timeoutMs` cut the page short before exhausting results. */\n\t\ttruncated: optional(boolean())\n\t})),\n\t/**\n\t* Coarse change tap on the directory.\n\t*\n\t* `watch` is a long-lived streaming request that emits an **empty tick**\n\t* whenever the (optionally filtered) directory *might* have changed. The\n\t* tick carries no delta and no payload — its only meaning is \"re-`list`\n\t* now\". The consumer reconciles against its own last snapshot.\n\t*\n\t* This keeps the server stateless: it never computes or replays\n\t* per-item deltas, never does an initial-sync replay. Over-emission is\n\t* allowed (the consumer re-lists and finds nothing new); under-emission\n\t* is not. Ticks are coalesced. The `interfaceId` / `serviceId` filters\n\t* mirror `list` and are a relevance hint, not a guarantee.\n\t*\n\t* The request resolves when the caller cancels (or the connection\n\t* drops); the runtime auto-detaches the stream when it settles.\n\t*/\n\twatch: requestType(object({\n\t\t/** Relevance hint: changes touching this interface id. */\n\t\tinterfaceId: optional(string()),\n\t\t/** Relevance hint: changes touching this service id. */\n\t\tserviceId: optional(string())\n\t}), object({})).withStream({ \n\t/** Empty tick: \"the directory may have changed; re-list.\" */\nserver: object({}) })\n});\n/**\n* A `directoryInterface.watch` handler for **static** directories that never\n* change (every plain reflection connection, e.g. {@link createHubServiceInterfaces}\n* participants and {@link HubRpcConnection.enableReflection}). It opens the\n* stream, never ticks, and resolves when the caller cancels — semantically\n* correct because a static directory's listing never changes. Only the hub's\n* global directory replaces this with a real, routing-driven implementation.\n*/\nfunction directoryWatchNever(_params, _ctx, stream) {\n\treturn new Promise((resolve) => {\n\t\tif (stream.signal.aborted) {\n\t\t\tresolve({});\n\t\t\treturn;\n\t\t}\n\t\tstream.signal.addEventListener(\"abort\", () => resolve({}), { once: true });\n\t});\n}\nconst schemasInterface = defineInterface({\n\tid: \"hubrpc.schemas\",\n\tdescription: \"Reflection: fetch interface schemas by id (+ optional hash). Must serve the interfaces advertised in this endpoint's directory.\"\n}, { get: requestType(object({\n\tinterfaceId: string(),\n\t/** Omit => server picks the version it exposes. */\n\thash: optional(string())\n}), object({ \n/** A full `SvcInterfaceSchema`. */\nschema: unknown() })) });\n//#endregion\n//#region src/connection/streaming.ts\n/**\n* Direction a {@link STREAM_METHOD} message travels, relative to the\n* request it is correlated with. Made explicit on the wire so that a\n* middlebox (the hub) can *author* a stream message — e.g. inject a\n* cancel when a caller disconnects — without an inbound message whose\n* arrival link it could infer the direction from.\n*/\nconst StreamDir = {\n\t/** callee → caller: progress, partial results. Routes like a response. */\n\ttoCaller: \"toCaller\",\n\t/** caller → callee: input, cancellation, keepalive ping. */\n\ttoCallee: \"toCallee\"\n};\n/**\n* Reserved control verbs. A control message carries no app `payload`; it\n* is interpreted by the runtime / hub itself, independently of the\n* originating method's stream schemas, so *any* request is cancellable\n* and keep-alive-able even when it declares no app stream.\n*/\nconst StreamControlType = {\n\t/**\n\t* Ask the callee to abort the in-flight request. Always {@link\n\t* StreamDir.toCallee}. The callee surfaces this as an `AbortSignal`\n\t* and is expected to settle the request (typically with a\n\t* `cancelled` error response).\n\t*/\n\tcancel: \"cancel\",\n\t/**\n\t* Keepalive / liveness probe. Resets the hub's per-request idle timer\n\t* so a long-running call is not reaped, and lets either side actively\n\t* probe the peer. Carries a `nonce` the peer echoes in its {@link\n\t* StreamControlType.pong}. May travel in either direction. Emitted\n\t* automatically (without awaiting a pong) by the channel for streaming\n\t* calls; see {@link STREAM_METHOD}.\n\t*/\n\tping: \"ping\",\n\t/**\n\t* Reply to a {@link StreamControlType.ping}, echoing the ping's\n\t* `nonce` so the prober can correlate it. Travels opposite the ping.\n\t* Carries no app effect — purely a liveness acknowledgement.\n\t*/\n\tpong: \"pong\"\n};\n/**\n* Well-known `control.reason` strings. The set is **open** — any string\n* is valid on the wire; these are the reasons hubrpc itself emits.\n*/\nconst StreamControlReason = {\n\t/**\n\t* The caller's transport dropped while the request was in flight; the\n\t* hub cancels the callee's now-orphaned work.\n\t*/\n\tclientDisconnected: \"clientDisconnected\",\n\t/**\n\t* The request exceeded the hub's idle timeout with no stream activity\n\t* (no ping, no stream message). See {@link STREAM_METHOD} docs.\n\t*/\n\tidleTimeout: \"idleTimeout\"\n};\n/**\n* Streaming sub-protocol. Long-running requests can emit additional\n* notifications correlated with the original call in either direction\n* (callee → caller progress, caller → callee input / cancellation /\n* keepalive).\n*\n* Wire form: a JSON-RPC notification whose method is\n* `${streamInterface.info.id}::send` and whose params match\n* `streamInterface.members.send.paramsSchema`. The hub routes purely on\n* `requestId` (following the originating request's established path, like\n* a response); the originating request's capability authorization covers\n* its full stream lifetime, so stream notifications carry no method /\n* interface namespace of their own. App `payload` contents are typed per\n* request via the originating method's\n* `RequestType.clientStreamSchema` / `serverStreamSchema`; reserved\n* `control` messages are schema-independent.\n*\n* Idle timeout: a request that never streams (no `control` ping, no\n* stream message) is subject to the hub's per-request idle timeout\n* (default 30 minutes) — at which point it is cancelled and its caller\n* gets a `requestTimeout` error. This bounds the hub's pending-request\n* table, which is also what protects it from a slow-loris / DDoS that\n* opens requests and never completes them. Streaming-enabled calls keep\n* themselves alive by emitting a periodic {@link StreamControlType.ping}.\n*\n* The interface is declarative: nobody calls\n* `HubRpcConnection.register(streamInterface, ...)`. The channel and the\n* hub intercept `$stream::send` directly. The definition exists so\n* reflection / consent UIs can describe the wire shape and so all wire\n* constants derive from one source.\n*/\nconst streamInterface = defineInterface({\n\tid: \"$stream\",\n\tdescription: \"Reserved sub-protocol for in-flight stream messages correlated to a request by `requestId`.\"\n}, { send: notificationType(object({\n\t/**\n\t* Id of the in-flight request the message belongs to.\n\t* The hub rewrites this across the forwarding boundary\n\t* in the same way it rewrites response ids.\n\t*/\n\trequestId: union([number(), string()]),\n\t/**\n\t* Which way this message travels relative to the request.\n\t* Explicit so the hub can author messages (e.g. cancel on\n\t* disconnect) without inferring direction from arrival.\n\t*/\n\tdir: enum$1([\"toCaller\", \"toCallee\"]),\n\t/**\n\t* Reserved control verb (cancel / ping / pong). Mutually\n\t* exclusive with `payload` in practice: a control message\n\t* is interpreted by the runtime, not the application.\n\t*/\n\tcontrol: optional(object({\n\t\ttype: enum$1([\n\t\t\t\"cancel\",\n\t\t\t\"ping\",\n\t\t\t\"pong\"\n\t\t]),\n\t\t/** Open-set human/diagnostic reason; see {@link StreamControlReason}. */\n\t\treason: optional(string()),\n\t\t/**\n\t\t* Correlation token. A `ping` carries a fresh nonce;\n\t\t* the matching `pong` echoes it back so the prober\n\t\t* can resolve the right outstanding probe.\n\t\t*/\n\t\tnonce: optional(string())\n\t})),\n\t/** Opaque app payload — typed per call by the request's stream schema. */\n\tpayload: optional(unknown())\n}), { description: \"Emit a stream message tied to the request `requestId`.\" }) });\n/**\n* Full wire method name for stream notifications. Pulled from the\n* interface object so we have a single source of truth.\n*/\nconst STREAM_METHOD = `${streamInterface.info.id}::send`;\n//#endregion\n//#region src/protocol/jsonRpc.ts\nconst ErrorCode = {\n\tparseError: -32700,\n\tinvalidRequest: -32600,\n\tmethodNotFound: -32601,\n\tinvalidParams: -32602,\n\tinternalError: -32603,\n\t/** Caller is authenticated but lacks a capability covering the call. */\n\tpermissionRequired: -32401,\n\t/** The peer a request was routed to detached before it could respond. */\n\tpeerDisconnected: -32402,\n\t/** The request exceeded the hub's idle timeout with no stream activity. */\n\trequestTimeout: -32403,\n\t/** The request was cancelled (by the caller, or by the hub on disconnect). */\n\tcancelled: -32800\n};\nfunction isRequest(m) {\n\treturn typeof m.method === \"string\" && m.id !== void 0;\n}\nfunction isNotification(m) {\n\treturn typeof m.method === \"string\" && m.id === void 0;\n}\nfunction isResponse(m) {\n\treturn typeof m.method !== \"string\";\n}\n//#endregion\n//#region src/protocol/capability.ts\n/**\n* Addressing match for a single permission: do its\n* `serviceId`/`interfaceId`/`interfaceHash`/`members` patterns admit\n* `target`?\n*/\nfunction permissionMatchesTarget(target, perm) {\n\tconst t = perm.target;\n\tif (!_patternMatches(target.serviceId, t.serviceId, \"/\")) return false;\n\tif (!_patternMatches(target.interfaceId, t.interfaceId, \".\")) return false;\n\tif (t.interfaceHash !== void 0 && target.interfaceHash !== t.interfaceHash) return false;\n\tif (!Array.isArray(t.members)) return false;\n\treturn t.members.some((m) => _patternMatches(target.member, m, \"\"));\n}\nfunction _patternMatches(value, pat, delim) {\n\tif (\"exact\" in pat) return value === pat.exact;\n\tconst p = pat.prefix;\n\tif (p === \"\") return true;\n\tif (value === p) return true;\n\tif (delim === \"\") return value.startsWith(p);\n\treturn value.startsWith(p + delim);\n}\n/**\n* Strict allowlist match for {@link Permission.params}. The set of\n* top-level keys in the call MUST equal the declared set; values must\n* satisfy their matchers. Nested objects/arrays are compared as opaque\n* JSON values via canonical-JSON equality. Pure (no crypto).\n*/\nfunction matchParams(declared, actualParams) {\n\tconst declaredKeys = Object.keys(declared).sort();\n\tconst actualObj = actualParams !== null && typeof actualParams === \"object\" && !Array.isArray(actualParams) ? actualParams : void 0;\n\tconst actualKeys = actualObj ? Object.keys(actualObj).sort() : [];\n\tif (declaredKeys.length !== actualKeys.length || declaredKeys.some((k, i) => k !== actualKeys[i])) return {\n\t\tok: false,\n\t\treason: `param keys mismatch (declared=${declaredKeys.join(\",\")}, actual=${actualKeys.join(\",\")})`\n\t};\n\tfor (const k of declaredKeys) if (!_matchParamValue(declared[k], actualObj[k])) return {\n\t\tok: false,\n\t\treason: `param \"${k}\" does not match`\n\t};\n\treturn { ok: true };\n}\nfunction _matchParamValue(matcher, value) {\n\tif (\"any\" in matcher) return true;\n\tif (\"prefix\" in matcher) return typeof value === \"string\" && value.startsWith(matcher.prefix);\n\tif (\"subsetOf\" in matcher) return Array.isArray(value) && value.every((v) => typeof v === \"string\" && matcher.subsetOf.includes(v));\n\tif (\"exact\" in matcher) return jcsCanonicalize(matcher.exact) === jcsCanonicalize(value);\n\tif (\"enum\" in matcher) {\n\t\tconst v = jcsCanonicalize(value);\n\t\treturn matcher.enum.some((opt) => jcsCanonicalize(opt) === v);\n\t}\n\treturn false;\n}\n/**\n* Does `permission` admit `call` for the given `ability`? Checks, in\n* order: the ability flag (`canInvoke`/`canDelegate`, both default\n* `false`), the target address, the optional `params` allowlist, and the\n* optional `callBind` hash-binding. Pure.\n*/\nfunction permissionPermits(call, permission, ability) {\n\tif (!(ability === \"invoke\" ? permission.canInvoke === true : permission.canDelegate === true)) return {\n\t\tok: false,\n\t\treason: `permission does not grant ${ability}`\n\t};\n\tif (!permissionMatchesTarget(call.target, permission)) return {\n\t\tok: false,\n\t\treason: \"permission does not address this call\"\n\t};\n\tif (permission.params !== void 0) {\n\t\tconst r = matchParams(permission.params, call.params);\n\t\tif (!r.ok) return {\n\t\t\tok: false,\n\t\t\treason: `params: ${r.reason}`\n\t\t};\n\t}\n\tif (permission.callBind !== void 0) {\n\t\tif (permission.callBind.alg !== \"sha256\") return {\n\t\t\tok: false,\n\t\t\treason: `callBind: unsupported hash alg (${permission.callBind.alg})`\n\t\t};\n\t\tif (call.callHash !== permission.callBind.payloadHash) return {\n\t\t\tok: false,\n\t\t\treason: \"callBind: payload hash mismatch\"\n\t\t};\n\t}\n\treturn { ok: true };\n}\n/**\n* Does `cap` admit `call` for the given `ability`? True iff **any** of its\n* permissions does (the union over permissions). This is one *link's*\n* judgment; chain intersection is enforced by {@link verifyChain}.\n*/\nfunction capabilityPermits(call, cap, ability) {\n\tlet lastReason = `no permission grants ${ability} for this call`;\n\tfor (const permission of cap.permissions) {\n\t\tconst r = permissionPermits(call, permission, ability);\n\t\tif (r.ok) return { ok: true };\n\t\tlastReason = r.reason;\n\t}\n\treturn {\n\t\tok: false,\n\t\treason: lastReason\n\t};\n}\n//#endregion\n//#region src/crypto/cryptoProvider.ts\nconst _b64UrlAlphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\";\nconst _b64UrlReverse = (() => {\n\tconst m = {};\n\tfor (let i = 0; i < 64; i++) m[_b64UrlAlphabet[i]] = i;\n\treturn m;\n})();\nfunction bytesToBase64Url(bytes) {\n\tlet out = \"\";\n\tlet i = 0;\n\tfor (; i + 3 <= bytes.length; i += 3) {\n\t\tconst n = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2];\n\t\tout += _b64UrlAlphabet[n >> 18 & 63] + _b64UrlAlphabet[n >> 12 & 63] + _b64UrlAlphabet[n >> 6 & 63] + _b64UrlAlphabet[n & 63];\n\t}\n\tconst rem = bytes.length - i;\n\tif (rem === 1) {\n\t\tconst n = bytes[i] << 16;\n\t\tout += _b64UrlAlphabet[n >> 18 & 63] + _b64UrlAlphabet[n >> 12 & 63];\n\t} else if (rem === 2) {\n\t\tconst n = bytes[i] << 16 | bytes[i + 1] << 8;\n\t\tout += _b64UrlAlphabet[n >> 18 & 63] + _b64UrlAlphabet[n >> 12 & 63] + _b64UrlAlphabet[n >> 6 & 63];\n\t}\n\treturn out;\n}\nfunction base64UrlToBytes$1(s) {\n\tconst len = s.length;\n\tconst fullGroups = Math.floor(len / 4);\n\tconst rem = len % 4;\n\tif (rem === 1) throw new Error(\"base64UrlToBytes: invalid length\");\n\tconst outLen = fullGroups * 3 + (rem === 0 ? 0 : rem - 1);\n\tconst out = new Uint8Array(outLen);\n\tlet oi = 0;\n\tlet i = 0;\n\tfor (let g = 0; g < fullGroups; g++, i += 4) {\n\t\tconst n = _lookup(s, i) << 18 | _lookup(s, i + 1) << 12 | _lookup(s, i + 2) << 6 | _lookup(s, i + 3);\n\t\tout[oi++] = n >> 16 & 255;\n\t\tout[oi++] = n >> 8 & 255;\n\t\tout[oi++] = n & 255;\n\t}\n\tif (rem === 2) {\n\t\tconst n = _lookup(s, i) << 18 | _lookup(s, i + 1) << 12;\n\t\tout[oi++] = n >> 16 & 255;\n\t} else if (rem === 3) {\n\t\tconst n = _lookup(s, i) << 18 | _lookup(s, i + 1) << 12 | _lookup(s, i + 2) << 6;\n\t\tout[oi++] = n >> 16 & 255;\n\t\tout[oi++] = n >> 8 & 255;\n\t}\n\treturn out;\n}\nfunction _lookup(s, i) {\n\tconst v = _b64UrlReverse[s[i]];\n\tif (v === void 0) throw new Error(`base64UrlToBytes: invalid char at ${i}`);\n\treturn v;\n}\n/** Role-tag prefix on a {@link KeyId}'s inline-key form. */\nconst KEY_ID_PREFIX = \"key:\";\n/** Role-tag prefix that wraps a genesis {@link KeyId} into a {@link PrincipalId}. */\nconst PRINCIPAL_PREFIX = \"id:\";\n/** The inline {@link KeyId} for a raw public key: `\"key:\" + b64url(pk)`. */\nfunction keyIdForPublicKey(pk) {\n\treturn KEY_ID_PREFIX + bytesToBase64Url(pk);\n}\n/** The perpetual {@link PrincipalId} for a raw public key: `\"id:key:\" + b64url(pk)`. */\nfunction principalForPublicKey(pk) {\n\treturn \"id:\" + keyIdForPublicKey(pk);\n}\n/**\n* The genesis {@link KeyId} embedded in a perpetual {@link PrincipalId}\n* (`\"id:\" + keyId`). Throws if `principal` is not a well-formed `id:` name.\n*/\nfunction keyIdForPrincipal(principal) {\n\tif (!principal.startsWith(\"id:\")) throw new Error(`malformed principal (missing \"id:\" prefix): ${principal}`);\n\treturn principal.slice(3);\n}\n/**\n* The raw public key carried inline by a `\"key:\"` {@link KeyId}. Throws on a\n* missing prefix or malformed base64url.\n*/\nfunction publicKeyForKeyId(keyId) {\n\tif (!keyId.startsWith(\"key:\")) throw new Error(`unsupported keyId (expected \"${KEY_ID_PREFIX}\" prefix): ${keyId}`);\n\treturn base64UrlToBytes$1(keyId.slice(4));\n}\n/**\n* Resolve the verifying public key for `(principal, keyId)`, or `undefined`\n* to **reject** (fail closed). This is the single seam every verifier goes\n* through, replacing the old \"the id *is* the key\" decode.\n*\n* Phase 1 supports only inline genesis keys: the `keyId` must be a `\"key:\"`\n* form and the principal must be exactly `\"id:\" + keyId` (genesis\n* self-certification by string equality). `keydoc:`/rotation forms resolve\n* through `bindings`/`timeMs` later and are intentionally not handled here.\n*/\nfunction resolveSigningKey(args) {\n\tconst { principal, keyId } = args;\n\tif (!keyId.startsWith(\"key:\")) return;\n\tif (\"id:\" + keyId !== principal) return;\n\ttry {\n\t\treturn { publicKey: base64UrlToBytes$1(keyId.slice(4)) };\n\t} catch {\n\t\treturn;\n\t}\n}\n//#endregion\n//#region src/protocol/signedObject.ts\n/**\n* The hubrpc **signed-object** standard: one rule for committing a\n* signature (and a content hash) over any JSON object.\n*\n* > The signature `obj.$hubrpcSignature[domain]` covers\n* > `pad(domain) ‖ jcs(obj without $hubrpcSignature and $hubrpcUnsigned)`.\n*\n* Both reserved keys are stripped before canonicalization — on **every**\n* object, call or capability alike:\n*\n* - {@link HUBRPC_SIGNATURE_KEY} (`$hubrpcSignature`) holds the signature\n* itself (a domain-keyed map of `{ keyId, sig }` entries). It can't sign\n* itself, so it's excluded.\n* - {@link HUBRPC_UNSIGNED_KEY} (`$hubrpcUnsigned`) holds extrinsic\n* *attachments* (e.g. the presented capability bag) authored by someone\n* other than this signer, so it's excluded too.\n*\n* Domain separation is intrinsic: the per-domain {@link signingPad pad} is\n* prefixed into the bytes that get signed/hashed. A `\"call\"` signature can\n* therefore never verify as a `\"capability\"` (or vice-versa) — the prefixed\n* bytes differ. The domain is *supplied by context* by signer and verifier;\n* the on-wire `$hubrpcSignature` key is a convenience index, never a trust\n* claim.\n*\n* This module is pure (no private keys, no `crypto.verify`): it only defines\n* the canonical bytes. Signing/verifying live in `../identity/signedObject`.\n*/\n/** Reserved wire-key: the signature map `{ [domain]: SignatureEnvelope }`. */\nconst HUBRPC_SIGNATURE_KEY = \"$hubrpcSignature\";\n/** Reserved wire-key: extrinsic unsigned attachments (e.g. the capability bag). */\nconst HUBRPC_UNSIGNED_KEY = \"$hubrpcUnsigned\";\n/** Reserved wire-key: signed call meta, present only on calls (dodges the JSON-RPC param namespace). */\nconst HUBRPC_META_KEY = \"$hubrpc\";\nconst _encoder = new TextEncoder();\n/**\n* The domain-separation prefix (\"the pad\"). Distinct, fixed bytes per\n* {@link SignDomain}. Folded into the signed/hashed bytes instead of being\n* compared as an on-wire `kind` field.\n*/\nfunction signingPad(domain) {\n\treturn _encoder.encode(`hubrpc-sig/v1/${domain}`);\n}\n/**\n* THE bytes a signature commits to (and a content hash hashes) for `obj` in\n* `domain`: `pad(domain) ‖ jcs(obj minus the two reserved keys)`.\n*/\nfunction signingInput(domain, obj) {\n\tconst signed = { ...obj };\n\tdelete signed[HUBRPC_SIGNATURE_KEY];\n\tdelete signed[HUBRPC_UNSIGNED_KEY];\n\tconst pad = signingPad(domain);\n\tconst body = jcsCanonicalizeBytes(signed);\n\tconst out = new Uint8Array(pad.length + body.length);\n\tout.set(pad, 0);\n\tout.set(body, pad.length);\n\treturn out;\n}\n/**\n* Content identity of a signed object: `base64url(sha256(signingInput(...)))`.\n* The single operation behind both a capability's `callBind.payloadHash`\n* (domain `\"call\"`) and a child capability's `parentHash` (domain\n* `\"capability\"`).\n*/\nfunction signedHash(domain, obj) {\n\treturn bytesToBase64Url(sha256$1(signingInput(domain, obj)));\n}\n/** Read the signature envelope for `domain` off an object's `$hubrpcSignature` map. */\nfunction readSignature(obj, domain) {\n\tconst sigs = obj[HUBRPC_SIGNATURE_KEY];\n\tif (sigs === null || typeof sigs !== \"object\") return void 0;\n\tconst entry = sigs[domain];\n\tif (entry === null || typeof entry !== \"object\") return void 0;\n\tconst { keyId, sig } = entry;\n\tif (typeof keyId !== \"string\" || typeof sig !== \"string\") return void 0;\n\treturn {\n\t\tkeyId,\n\t\tsig\n\t};\n}\n/** The {@link KeyId} the signer used for `domain` (the unsigned routing hint), if any. */\nfunction getKeyId(obj, domain) {\n\treturn readSignature(obj, domain)?.keyId;\n}\n/**\n* Return a copy of `obj` with `$hubrpcSignature[domain]` set to `envelope`,\n* preserving any sibling-domain signatures already present.\n*/\nfunction withSignature(obj, domain, envelope) {\n\tconst prev = obj[HUBRPC_SIGNATURE_KEY];\n\treturn {\n\t\t...obj,\n\t\t[HUBRPC_SIGNATURE_KEY]: {\n\t\t\t...prev,\n\t\t\t[domain]: envelope\n\t\t}\n\t};\n}\n//#endregion\n//#region src/protocol/methodName.ts\n/**\n* Parse a JSON-RPC method string. Returns `undefined` if any segment is\n* empty or the segment count is out of range.\n*/\nfunction parseMethodName(method) {\n\tconst parts = method.split(\"::\");\n\tif (parts.some((p) => p.length === 0)) return void 0;\n\tif (parts.length === 1) return {\n\t\tkind: \"bare\",\n\t\tmember: parts[0]\n\t};\n\tif (parts.length === 2) return {\n\t\tkind: \"interface\",\n\t\tinterfaceId: parts[0],\n\t\tmember: parts[1]\n\t};\n\tif (parts.length === 3) return {\n\t\tkind: \"full\",\n\t\tserviceId: parts[0],\n\t\tinterfaceId: parts[1],\n\t\tmember: parts[2]\n\t};\n}\n/**\n* Convert a parsed method string to a {@link CallTarget} for capability\n* matching. Interface-form calls are addressed to the root service —\n* represented as an empty `serviceId`. Throws on `bare` form (no\n* interface context) and on malformed input.\n*/\nfunction methodNameToTarget(method) {\n\tconst p = parseMethodName(method);\n\tif (!p) throw new Error(`hubrpc: malformed method: ${method}`);\n\tif (p.kind === \"bare\") throw new Error(`hubrpc: bare method has no interface context: ${method}`);\n\tif (p.kind === \"interface\") return {\n\t\tserviceId: \"\",\n\t\tinterfaceId: p.interfaceId,\n\t\tmember: p.member\n\t};\n\treturn {\n\t\tserviceId: p.serviceId,\n\t\tinterfaceId: p.interfaceId,\n\t\tmember: p.member\n\t};\n}\n//#endregion\n//#region src/protocol/hubRpcEnvelope.ts\n/**\n* The hubrpc signing/cap system accepts only plain-object user params (or\n* none). Reject arrays/primitives at the boundary so \"strip `$hubrpc*`, the\n* rest is the signed user params\" stays unambiguous.\n*/\nfunction requireObjectParams(userParams) {\n\tif (userParams === void 0) return {};\n\tif (userParams === null || typeof userParams !== \"object\" || Array.isArray(userParams)) throw new Error(\"hubrpc: user params must be a plain JSON object or undefined\");\n\treturn userParams;\n}\n//#endregion\n//#region src/transport/messageTransport.ts\n/**\n* Observe every message crossing a transport without changing its buffering or\n* lifecycle behavior.\n*/\nfunction traceMessageTransport(transport, trace) {\n\treturn {\n\t\tsend(message) {\n\t\t\ttrace(\"send\", message);\n\t\t\treturn transport.send(message);\n\t\t},\n\t\tsetListener(listener) {\n\t\t\ttransport.setListener(listener === void 0 ? void 0 : (message) => {\n\t\t\t\ttrace(\"receive\", message);\n\t\t\t\tlistener(message);\n\t\t\t});\n\t\t},\n\t\tdispose() {\n\t\t\ttransport.dispose();\n\t\t}\n\t};\n}\n/**\n* Pipe two transports together: every message one receives is forwarded to\n* the other's `send`. Returns a disposable that detaches both listeners.\n*\n* Neither transport is disposed — the caller owns their lifecycle. This is\n* the building block for relays (e.g. bridging a `WindowMessageTransport`\n* for an iframe to a multiplexer channel).\n*/\nfunction connectTransports(a, b) {\n\ta.setListener((m) => void b.send(m));\n\tb.setListener((m) => void a.send(m));\n\treturn { dispose() {\n\t\ta.setListener(void 0);\n\t\tb.setListener(void 0);\n\t} };\n}\n/**\n* Two in-memory transports wired back-to-back. Useful for tests and for\n* same-process bridges.\n*\n* Generic in the per-direction payload type so asymmetric pairs (e.g. one\n* side sends plain `JsonRpcMessage`, the other side sends\n* `JsonRpcMessage & { context: Participant }`) are expressible at the type\n* level. At runtime both halves just hand objects through by reference.\n*/\nvar TransportPair = class {\n\ta;\n\tb;\n\tconstructor() {\n\t\tconst aT = new _InMemoryTransport();\n\t\tconst bT = new _InMemoryTransport();\n\t\taT._peer = bT;\n\t\tbT._peer = aT;\n\t\tthis.a = aT;\n\t\tthis.b = bT;\n\t}\n};\nvar _InMemoryTransport = class {\n\t_peer;\n\t_listener;\n\t_buffer = [];\n\t_closed = false;\n\tsend(message) {\n\t\tif (this._closed || this._peer._closed) return;\n\t\tthis._peer._deliver(message);\n\t}\n\tsetListener(listener) {\n\t\tthis._listener = listener;\n\t\tif (listener) while (this._buffer.length > 0 && this._listener) {\n\t\t\tconst m = this._buffer.shift();\n\t\t\tthis._listener(m);\n\t\t}\n\t}\n\tdispose() {\n\t\tthis._closed = true;\n\t}\n\t_deliver(m) {\n\t\tif (this._listener) this._listener(m);\n\t\telse this._buffer.push(m);\n\t}\n};\n//#endregion\n//#region src/transport/multiplexedTransport.ts\nvar MultiplexedTransport = class MultiplexedTransport {\n\tstatic create(base, channels) {\n\t\treturn new MultiplexedTransport(base, channels);\n\t}\n\t/** Logical transports keyed by the friendly channel names. */\n\ttransports;\n\t_base;\n\t_byId = /* @__PURE__ */ new Map();\n\tconstructor(base, channels) {\n\t\tthis._base = base;\n\t\tconst transports = {};\n\t\tfor (const name of Object.keys(channels)) {\n\t\t\tconst id = channels[name];\n\t\t\tconst t = new _ChannelTransport(base, id);\n\t\t\ttransports[name] = t;\n\t\t\tthis._byId.set(id, t);\n\t\t}\n\t\tthis.transports = transports;\n\t\tbase.setListener((data) => {\n\t\t\t(data == null ? void 0 : this._byId.get(data.ch))?._deliver(data.m);\n\t\t});\n\t}\n\tdispose() {\n\t\tthis._base.setListener(void 0);\n\t\tfor (const t of this._byId.values()) t.dispose();\n\t}\n};\nvar _ChannelTransport = class {\n\t_base;\n\t_ch;\n\t_listener;\n\t_buffer = [];\n\t_closed = false;\n\tconstructor(_base, _ch) {\n\t\tthis._base = _base;\n\t\tthis._ch = _ch;\n\t}\n\tsend(message) {\n\t\tif (this._closed) return;\n\t\tthis._base.send({\n\t\t\t$mux: \"v1\",\n\t\t\tch: this._ch,\n\t\t\tm: message\n\t\t});\n\t}\n\tsetListener(listener) {\n\t\tthis._listener = listener;\n\t\tif (listener) while (this._buffer.length > 0 && this._listener) listener(this._buffer.shift());\n\t}\n\tdispose() {\n\t\tthis._closed = true;\n\t\tthis._listener = void 0;\n\t}\n\t_deliver(m) {\n\t\tif (this._closed) return;\n\t\tif (this._listener) this._listener(m);\n\t\telse this._buffer.push(m);\n\t}\n};\n//#endregion\n//#region src/connection/channel.ts\nvar Channel = class Channel {\n\tsender;\n\t_setHandler;\n\tconstructor(sender, _setHandler) {\n\t\tthis.sender = sender;\n\t\tthis._setHandler = _setHandler;\n\t}\n\t/** Bind the inbound request/notification handler. May be called before or after construction of {@link HubRpcConnection}. */\n\tsetRequestHandler(handler) {\n\t\tthis._setHandler(handler);\n\t}\n\t/**\n\t* Compose this channel with a sender-side decorator (typically the\n\t* signing layer). The decorator wraps {@link sender} only; the\n\t* {@link setRequestHandler} binding is shared with the original channel\n\t* so the receive side is bound exactly once regardless of decoration depth.\n\t*/\n\twithSender(decorate) {\n\t\treturn new Channel(decorate(this.sender), this._setHandler);\n\t}\n};\nvar RpcError = class extends Error {\n\tcode;\n\tdata;\n\tconstructor(message, code, data) {\n\t\tsuper(message);\n\t\tthis.code = code;\n\t\tthis.data = data;\n\t\tthis.name = \"RpcError\";\n\t}\n};\n//#endregion\n//#region src/connection/jsonRpcChannel.ts\n/**\n* How often a streaming-enabled call emits a `toCallee` keepalive ping so a\n* routing hub's per-request idle timer never reaps the in-flight request.\n* Must stay comfortably below the hub's idle timeout (default 30 min).\n*/\nconst KEEPALIVE_PING_INTERVAL_MS = 10 * 6e4;\n/**\n* Minimal JSON-RPC 2.0 channel: correlates requests with responses,\n* dispatches incoming requests/notifications to a handler.\n*\n* Construct via {@link JsonRpcChannel.create}: it returns a\n* {@link Channel} factory which materialises the live channel once a\n* handler is supplied via `.connect(handler)`. The handler is fixed for\n* the channel's lifetime — no setter, no mid-flight swap.\n*\n* The outbound `TOutCtx` of the produced sender is `unknown` — this\n* channel ignores per-call ctx entirely. Decorators (e.g.\n* `SigningSender`) lift it to a concrete shape.\n*/\nvar JsonRpcChannel = class JsonRpcChannel {\n\t_transport;\n\t/**\n\t* Wrap a transport in a {@link Channel}. The channel's sender is live\n\t* immediately; call {@link Channel.setRequestHandler} (or pass the channel\n\t* to {@link HubRpcConnection}) to bind the inbound handler.\n\t*/\n\tstatic create(transport) {\n\t\tconst jrc = new JsonRpcChannel(transport);\n\t\treturn new Channel(jrc, (h) => jrc.setRequestHandler(h));\n\t}\n\t_nextId = 1;\n\t_pending = /* @__PURE__ */ new Map();\n\t/**\n\t* Per-request callbacks invoked when a {@link STREAM_METHOD}\n\t* notification arrives with a matching `requestId`. Used in both\n\t* directions: outgoing-request callers register here keyed by the\n\t* id they sent; per-call incoming-request stream handles register\n\t* keyed by the id they observed. Entries are removed when the\n\t* corresponding request completes (response received for outgoing,\n\t* response sent for incoming).\n\t*/\n\t_streamListeners = /* @__PURE__ */ new Map();\n\t/**\n\t* Per-incoming-request handlers for reserved `control` messages\n\t* (cancel / ping / pong) arriving as stream notifications. Keyed\n\t* by the id observed; removed when the request settles.\n\t*/\n\t_streamControl = /* @__PURE__ */ new Map();\n\t_handler;\n\tsetRequestHandler(handler) {\n\t\tthis._handler = handler;\n\t}\n\tconstructor(_transport) {\n\t\tthis._transport = _transport;\n\t\tthis._transport.setListener((m) => this._onMessage(m));\n\t}\n\tasync sendRequest(method, params, _opts) {\n\t\tconst id = this._nextId++;\n\t\tconst req = {\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tid,\n\t\t\tmethod\n\t\t};\n\t\tif (params !== void 0) req.params = params;\n\t\tconst promise = new Promise((resolve, reject) => {\n\t\t\tthis._pending.set(String(id), {\n\t\t\t\tresolve,\n\t\t\t\treject\n\t\t\t});\n\t\t});\n\t\tawait this._transport.send(req);\n\t\treturn promise;\n\t}\n\tasync sendNotification(method, params, _opts) {\n\t\tconst n = {\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tmethod\n\t\t};\n\t\tif (params !== void 0) n.params = params;\n\t\tawait this._transport.send(n);\n\t}\n\tsendRequestWithStream(method, params, opts) {\n\t\tconst id = this._nextId++;\n\t\tconst key = String(id);\n\t\tlet resolveResult;\n\t\tlet rejectResult;\n\t\tconst result = new Promise((resolve, reject) => {\n\t\t\tresolveResult = resolve;\n\t\t\trejectResult = reject;\n\t\t});\n\t\tthis._pending.set(key, {\n\t\t\tresolve: resolveResult,\n\t\t\treject: rejectResult\n\t\t});\n\t\tif (opts?.onStreamMessage) this._streamListeners.set(key, opts.onStreamMessage);\n\t\tconst pinger = this._makePinger(id, StreamDir.toCallee);\n\t\tthis._streamControl.set(key, pinger.onControl);\n\t\tconst ping = setInterval(() => {\n\t\t\tthis._sendStream(id, StreamDir.toCallee, { control: { type: StreamControlType.ping } });\n\t\t}, KEEPALIVE_PING_INTERVAL_MS);\n\t\tping.unref?.();\n\t\tconst stopPing = () => {\n\t\t\tclearInterval(ping);\n\t\t\tpinger.dispose();\n\t\t\tthis._streamControl.delete(key);\n\t\t};\n\t\tresult.then(stopPing, stopPing);\n\t\t(async () => {\n\t\t\tconst req = {\n\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t\tid,\n\t\t\t\tmethod\n\t\t\t};\n\t\t\tif (params !== void 0) req.params = params;\n\t\t\tawait this._transport.send(req);\n\t\t})().catch((err) => {\n\t\t\tthis._pending.delete(key);\n\t\t\tthis._streamListeners.delete(key);\n\t\t\tstopPing();\n\t\t\trejectResult(err instanceof Error ? err : new Error(String(err)));\n\t\t});\n\t\treturn {\n\t\t\tresult,\n\t\t\tsend: (payload) => this._sendStream(id, StreamDir.toCallee, { payload }),\n\t\t\tcancel: (reason) => this._sendStream(id, StreamDir.toCallee, { control: reason !== void 0 ? {\n\t\t\t\ttype: StreamControlType.cancel,\n\t\t\t\treason\n\t\t\t} : { type: StreamControlType.cancel } }),\n\t\t\tping: pinger.ping\n\t\t};\n\t}\n\t/**\n\t* Build the symmetric ping/pong machinery for one in-flight request.\n\t*\n\t* `outboundDir` is the direction *this* side emits controls in\n\t* (`toCallee` for the caller, `toCaller` for the callee). A received\n\t* ping is answered with a pong in that same direction, echoing the\n\t* ping's nonce; a received pong resolves the matching outstanding\n\t* {@link ping} probe.\n\t*/\n\t_makePinger(requestId, outboundDir) {\n\t\tconst pending = /* @__PURE__ */ new Map();\n\t\tlet nextNonce = 1;\n\t\tconst ping = () => {\n\t\t\tconst nonce = `${requestId}:${nextNonce++}`;\n\t\t\tconst p = new Promise((resolve, reject) => pending.set(nonce, {\n\t\t\t\tresolve,\n\t\t\t\treject\n\t\t\t}));\n\t\t\tthis._sendStream(requestId, outboundDir, { control: {\n\t\t\t\ttype: StreamControlType.ping,\n\t\t\t\tnonce\n\t\t\t} });\n\t\t\treturn p;\n\t\t};\n\t\tconst onControl = (control) => {\n\t\t\tif (control.type === StreamControlType.ping) this._sendStream(requestId, outboundDir, { control: {\n\t\t\t\ttype: StreamControlType.pong,\n\t\t\t\tnonce: control.nonce\n\t\t\t} });\n\t\t\telse if (control.type === StreamControlType.pong && control.nonce !== void 0) {\n\t\t\t\tconst waiter = pending.get(control.nonce);\n\t\t\t\tif (waiter) {\n\t\t\t\t\tpending.delete(control.nonce);\n\t\t\t\t\twaiter.resolve();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst dispose = () => {\n\t\t\tconst err = new RpcError(\"Request settled before pong\", ErrorCode.cancelled);\n\t\t\tfor (const w of pending.values()) w.reject(err);\n\t\t\tpending.clear();\n\t\t};\n\t\treturn {\n\t\t\tping,\n\t\t\tonControl,\n\t\t\tdispose\n\t\t};\n\t}\n\t/**\n\t* Emit a stream notification ({@link STREAM_METHOD}) associated with\n\t* an in-flight request. Internal: outgoing-side callers reach this\n\t* via {@link RawStreamingCall.send} / `cancel`; incoming-side handlers\n\t* reach it via {@link IncomingStream.send}.\n\t*/\n\tasync _sendStream(requestId, dir, fields) {\n\t\tconst n = {\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tmethod: STREAM_METHOD,\n\t\t\tparams: {\n\t\t\t\trequestId,\n\t\t\t\tdir,\n\t\t\t\t...fields\n\t\t\t}\n\t\t};\n\t\tawait this._transport.send(n);\n\t}\n\tclose() {\n\t\tthis._transport.dispose();\n\t\tconst err = /* @__PURE__ */ new Error(\"Connection closed\");\n\t\tfor (const p of this._pending.values()) p.reject(err);\n\t\tthis._pending.clear();\n\t\tthis._streamListeners.clear();\n\t\tthis._streamControl.clear();\n\t}\n\t_onMessage(m) {\n\t\tconst ctx = m.context;\n\t\tif (isResponse(m)) {\n\t\t\tif (m.id === null) return;\n\t\t\tconst key = String(m.id);\n\t\t\tconst pending = this._pending.get(key);\n\t\t\tif (!pending) return;\n\t\t\tthis._pending.delete(key);\n\t\t\tthis._streamListeners.delete(key);\n\t\t\tif (\"error\" in m) {\n\t\t\t\tconst e = m.error;\n\t\t\t\tconst err = new RpcError(e.message, e.code, e.data);\n\t\t\t\tpending.reject(err);\n\t\t\t} else pending.resolve(m.result);\n\t\t\treturn;\n\t\t}\n\t\tif (isRequest(m)) {\n\t\t\tthis._handleRequest(m, ctx);\n\t\t\treturn;\n\t\t}\n\t\tif (isNotification(m)) {\n\t\t\tif (m.method === STREAM_METHOD) {\n\t\t\t\tthis._handleStreamNotification(m);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._handleNotification(m, ctx);\n\t\t\treturn;\n\t\t}\n\t}\n\t_handleStreamNotification(m) {\n\t\tconst params = m.params;\n\t\tif (!params) return;\n\t\tconst requestId = params.requestId;\n\t\tif (requestId === void 0) return;\n\t\tconst key = String(requestId);\n\t\tif (params.control) {\n\t\t\tthis._streamControl.get(key)?.(params.control);\n\t\t\treturn;\n\t\t}\n\t\tconst listener = this._streamListeners.get(key);\n\t\tif (!listener) return;\n\t\tlistener(params.payload);\n\t}\n\tasync _handleRequest(m, context) {\n\t\tconst key = String(m.id);\n\t\tconst pinger = this._makePinger(m.id, StreamDir.toCaller);\n\t\tconst stream = {\n\t\t\tsend: (payload) => this._sendStream(m.id, StreamDir.toCaller, { payload }),\n\t\t\tonMessage: (listener) => {\n\t\t\t\tif (listener) this._streamListeners.set(key, listener);\n\t\t\t\telse this._streamListeners.delete(key);\n\t\t\t},\n\t\t\tping: pinger.ping\n\t\t};\n\t\tconst abort = new AbortController();\n\t\tthis._streamControl.set(key, (control) => {\n\t\t\tif (control.type === StreamControlType.cancel) abort.abort(new RpcError(control.reason ?? \"cancelled\", ErrorCode.cancelled));\n\t\t\telse pinger.onControl(control);\n\t\t});\n\t\tlet result;\n\t\ttry {\n\t\t\tif (!this._handler) result = { error: {\n\t\t\t\tcode: ErrorCode.methodNotFound,\n\t\t\t\tmessage: `No handler registered on this endpoint (method: ${m.method}).`\n\t\t\t} };\n\t\t\telse try {\n\t\t\t\tresult = await this._handler.handleRequest({\n\t\t\t\t\tmethod: m.method,\n\t\t\t\t\tparams: m.params,\n\t\t\t\t\tcontext,\n\t\t\t\t\tstream,\n\t\t\t\t\tsignal: abort.signal\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\tresult = { error: {\n\t\t\t\t\tcode: ErrorCode.internalError,\n\t\t\t\t\tmessage: e instanceof Error ? e.message : String(e)\n\t\t\t\t} };\n\t\t\t}\n\t\t} finally {\n\t\t\tthis._streamListeners.delete(key);\n\t\t\tthis._streamControl.delete(key);\n\t\t\tpinger.dispose();\n\t\t}\n\t\tif (\"result\" in result) await this._transport.send({\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tid: m.id,\n\t\t\tresult: result.result\n\t\t});\n\t\telse {\n\t\t\tconst resp = {\n\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t\tid: m.id,\n\t\t\t\terror: result.error\n\t\t\t};\n\t\t\tawait this._transport.send(resp);\n\t\t}\n\t}\n\t_handleNotification(m, context) {\n\t\tif (!this._handler) return;\n\t\ttry {\n\t\t\tthis._handler.handleNotification({\n\t\t\t\tmethod: m.method,\n\t\t\t\tparams: m.params,\n\t\t\t\tcontext,\n\t\t\t\tstream: _NOOP_STREAM,\n\t\t\t\tsignal: _NEVER_ABORT\n\t\t\t});\n\t\t} catch {}\n\t}\n};\n/** Stub stream handle for notifications, which carry no request id. */\nconst _NOOP_STREAM = {\n\tsend: () => Promise.resolve(),\n\tonMessage: () => {},\n\tping: () => Promise.resolve()\n};\n/** A signal that never aborts — handed to notification handlers. */\nconst _NEVER_ABORT = new AbortController().signal;\n//#endregion\n//#region src/connection/hubRpcConnection.ts\n/**\n* High-level hubrpc connection. Layers method-name routing and zod-driven\n* validation on top of a plain JSON-RPC channel.\n*\n* Typed proxies built by this class merely forward each call's\n* `interfaceHash` hint to the channel so the signer stamps it into the\n* `$hubrpc` envelope.\n*\n* `TInCtx` is the per-call out-of-band context the connection's transport\n* carries. Default `undefined` covers cross-process and ordinary in-process\n* transports. The hub's self/overlay connections instantiate with a\n* concrete `TInCtx` (e.g. `Participant`) so handlers can see who originated\n* the call.\n*\n* `TOutCtx` is the per-call override / extension bag the outbound sender\n* understands (see {@link SendOpts.ctx}). It only ever flows into the\n* sender as input, so it is a contravariant type parameter. Default `any`\n* keeps the bare `HubRpcConnection` a valid supertype for holders that do\n* not care about the outbound ctx; pass a concrete shape (e.g.\n* `SigningCallCtx`) to get precise {@link get} typing. The connection\n* itself is agnostic to its contents — it merely forwards the `ctx`\n* defaults supplied to {@link get}.\n*/\nvar HubRpcConnection = class HubRpcConnection {\n\t/**\n\t* Convenience: build a {@link JsonRpcChannel} `Channel` from the\n\t* given transport and wrap it in an `HubRpcConnection`. Use this\n\t* when you have a transport at hand and don't need a decorator\n\t* stack (e.g. signing).\n\t*/\n\tstatic fromTransport(transport) {\n\t\treturn new HubRpcConnection(JsonRpcChannel.create(transport));\n\t}\n\t/** Underlying JSON-RPC sender — useful for callers that need raw access (e.g. to call hub-served methods that bypass the interface registry). */\n\tchannel;\n\t/** key = `${serviceId ?? \"\"}::${interfaceId}` */\n\t_registry = /* @__PURE__ */ new Map();\n\t/** Descriptions for services that have been registered with a `serviceDescription`. */\n\t_serviceDescriptions = /* @__PURE__ */ new Map();\n\t/** Root-node-id requirement sets recorded per serviceId. */\n\t_serviceRootPrincipalSets = /* @__PURE__ */ new Map();\n\t_preset;\n\t/**\n\t* Construct from a {@link Channel} (binds the inbound handler and uses\n\t* `channel.sender` for outbound calls) or from a bare\n\t* {@link IRequestSender} (send-only — no inbound handler is registered,\n\t* useful for bootstrap flows like `createManagedIdentity`).\n\t*/\n\tconstructor(channel) {\n\t\tif (\"sender\" in channel) {\n\t\t\tthis.channel = channel.sender;\n\t\t\tchannel.setRequestHandler({\n\t\t\t\thandleRequest: (c) => this._handleRequest(c),\n\t\t\t\thandleNotification: (c) => this._handleNotification(c)\n\t\t\t});\n\t\t} else this.channel = channel;\n\t}\n\t/** Get a typed client for `iface`, routed to the implicit (root) service. */\n\tget(iface, opts = {}) {\n\t\treturn this._buildClient(iface, opts);\n\t}\n\t/** Get a service-scoped handle; all interfaces obtained from it route via `serviceId` (form 3). */\n\tservice(serviceId) {\n\t\treturn new ServiceHandle(this, serviceId);\n\t}\n\t/** Register handlers for an interface on this connection's server side. */\n\tregister(iface, handlers, opts = {}) {\n\t\tconst serviceId = opts.serviceId;\n\t\tif (opts.serviceDescription !== void 0) {\n\t\t\tif (serviceId === void 0) throw new Error(\"register: `serviceDescription` requires `serviceId`.\");\n\t\t\tconst existing = this._serviceDescriptions.get(serviceId);\n\t\t\tif (existing !== void 0 && existing !== opts.serviceDescription) throw new Error(`register: conflicting descriptions for service \"${serviceId}\".`);\n\t\t\tthis._serviceDescriptions.set(serviceId, opts.serviceDescription);\n\t\t}\n\t\tif (opts.rootPrincipalSets !== void 0) {\n\t\t\tif (serviceId === void 0) throw new Error(\"register: `rootPrincipalSets` requires `serviceId`.\");\n\t\t\tconst existing = this._serviceRootPrincipalSets.get(serviceId);\n\t\t\tif (existing !== void 0 && !rootPrincipalSetsEqual(existing, opts.rootPrincipalSets)) throw new Error(`register: conflicting rootPrincipalSets for service \"${serviceId}\".`);\n\t\t\tthis._serviceRootPrincipalSets.set(serviceId, opts.rootPrincipalSets);\n\t\t}\n\t\tconst key = `${serviceId ?? \"\"}::${iface.info.id}`;\n\t\tif (this._registry.has(key)) throw new Error(`Interface \"${iface.info.id}\" already registered${serviceId ? ` under service \"${serviceId}\"` : \"\"}.`);\n\t\tthis._registry.set(key, {\n\t\t\tiface,\n\t\t\thandlers,\n\t\t\tserviceId\n\t\t});\n\t}\n\t/**\n\t* Declare the preset interface for form-1 (bare-method) dispatch. The\n\t* interface must already be registered under the root (no serviceId).\n\t* Surfaced via `hubrpc.defaults::get`.\n\t*/\n\tsetPreset(iface) {\n\t\tconst key = `::${iface.info.id}`;\n\t\tif (!this._registry.has(key)) throw new Error(`setPreset: interface \"${iface.info.id}\" is not registered under the root service.`);\n\t\tthis._preset = {\n\t\t\tserviceId: void 0,\n\t\t\tinterfaceId: iface.info.id,\n\t\t\thash: iface.schemaHash\n\t\t};\n\t}\n\t/** Snapshot of every interface currently registered on this connection. */\n\tlistRegisteredInterfaces() {\n\t\treturn Array.from(this._registry.values()).map((r) => {\n\t\t\tconst sid = r.serviceId ?? \"\";\n\t\t\tconst item = {\n\t\t\t\tserviceId: sid,\n\t\t\t\tinterfaceId: r.iface.info.id,\n\t\t\t\tinterfaceHash: r.iface.schemaHash\n\t\t\t};\n\t\t\tconst desc = sid === \"\" ? void 0 : this._serviceDescriptions.get(sid);\n\t\t\tif (desc !== void 0) item.serviceDescription = desc;\n\t\t\tconst sets = sid === \"\" ? void 0 : this._serviceRootPrincipalSets.get(sid);\n\t\t\tif (sets !== void 0) item.rootPrincipalSets = sets;\n\t\t\treturn item;\n\t\t});\n\t}\n\t/**\n\t* Look up a registered interface definition by id (and optional content\n\t* hash). Returns `undefined` if no registered interface matches.\n\t*/\n\tfindRegisteredInterface(interfaceId, hash) {\n\t\tfor (const r of this._registry.values()) {\n\t\t\tif (r.iface.info.id !== interfaceId) continue;\n\t\t\tif (hash !== void 0 && r.iface.schemaHash !== hash) continue;\n\t\t\treturn r.iface;\n\t\t}\n\t}\n\t/**\n\t* Register the three hubrpc reflection interfaces (`defaults`,\n\t* `directory`, `schemas`), backed by this connection's live registry.\n\t*\n\t* By default they live under the root service (form-2 reachable as\n\t* `hubrpc.directory::list`). Pass `serviceId` to additionally mount\n\t* them under a specific service — useful for participants that live\n\t* behind a hub, so callers can reach reflection via form-3\n\t* `<serviceId>::hubrpc.directory::list`.\n\t*\n\t* Idempotent: re-registering the same `(serviceId, interfaceId)` pair\n\t* is a no-op.\n\t*/\n\tenableReflection(opts = {}) {\n\t\tconst key = `${opts.serviceId ?? \"\"}::${defaultsInterface.info.id}`;\n\t\tif (this._registry.has(key)) return;\n\t\tconst regOpts = opts.serviceId !== void 0 ? { serviceId: opts.serviceId } : {};\n\t\tthis.register(defaultsInterface, { get: () => {\n\t\t\tif (!this._preset) return {};\n\t\t\treturn {\n\t\t\t\tserviceId: this._preset.serviceId,\n\t\t\t\tinterfaceId: this._preset.interfaceId,\n\t\t\t\tinterfaceHash: this._preset.hash\n\t\t\t};\n\t\t} }, regOpts);\n\t\tthis.register(directoryInterface, {\n\t\t\tlist: ({ interfaceId, serviceId, cursor, limit }) => {\n\t\t\t\tconst all = this.listRegisteredInterfaces().filter((r) => interfaceId === void 0 || r.interfaceId === interfaceId).filter((r) => serviceId === void 0 || r.serviceId === serviceId);\n\t\t\t\tconst start = cursor === void 0 ? 0 : Number.parseInt(cursor, 10) || 0;\n\t\t\t\tconst end = limit === void 0 ? all.length : Math.min(all.length, start + limit);\n\t\t\t\tconst page = all.slice(start, end).map((r) => ({\n\t\t\t\t\tserviceId: r.serviceId,\n\t\t\t\t\tinterfaceId: r.interfaceId,\n\t\t\t\t\tinterfaceHash: r.interfaceHash,\n\t\t\t\t\tserviceDescription: r.serviceDescription,\n\t\t\t\t\trootPrincipalSets: r.rootPrincipalSets?.map((set) => set.map((p) => ({ ...p })))\n\t\t\t\t}));\n\t\t\t\treturn end < all.length ? {\n\t\t\t\t\titems: page,\n\t\t\t\t\tnextCursor: String(end)\n\t\t\t\t} : { items: page };\n\t\t\t},\n\t\t\twatch: directoryWatchNever\n\t\t}, regOpts);\n\t\tthis.register(schemasInterface, { get: ({ interfaceId, hash }) => {\n\t\t\tconst iface = this.findRegisteredInterface(interfaceId, hash);\n\t\t\tif (!iface) throw new RpcError(\"Interface not found\", ErrorCode.methodNotFound, {\n\t\t\t\treason: \"unknown-interface\",\n\t\t\t\tinterfaceId,\n\t\t\t\thash\n\t\t\t});\n\t\t\treturn { schema: iface.toSchema() };\n\t\t} }, regOpts);\n\t\tif (opts.serviceId !== void 0) this.enableReflection();\n\t}\n\tclose() {\n\t\tthis.channel.close();\n\t}\n\t_buildClient(iface, opts) {\n\t\tconst { serviceId, ...ctxRest } = opts;\n\t\tconst baseCtx = ctxRest;\n\t\tconst interfaceHash = iface.schemaHash;\n\t\tconst proxy = {};\n\t\tfor (const [name, member] of Object.entries(iface.members)) {\n\t\t\tconst wireMethod = serviceId ? `${serviceId}::${iface.info.id}::${name}` : `${iface.info.id}::${name}`;\n\t\t\tif (member.kind === \"request\") if (member.clientStreamSchema !== void 0 || member.serverStreamSchema !== void 0) {\n\t\t\t\tconst serverStreamSchema = member.serverStreamSchema;\n\t\t\t\tproxy[name] = (params, callOpts) => {\n\t\t\t\t\tconst userListener = callOpts?.onMessage;\n\t\t\t\t\tconst onStreamMessage = userListener !== void 0 ? (raw) => {\n\t\t\t\t\t\tif (serverStreamSchema !== void 0) {\n\t\t\t\t\t\t\tconst r = safeParse(serverStreamSchema, raw);\n\t\t\t\t\t\t\tif (!r.success) return;\n\t\t\t\t\t\t\tuserListener(r.data);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tuserListener(raw);\n\t\t\t\t\t} : void 0;\n\t\t\t\t\tconst channelOpts = onStreamMessage !== void 0 ? {\n\t\t\t\t\t\tctx: baseCtx,\n\t\t\t\t\t\tinterfaceHash,\n\t\t\t\t\t\tonStreamMessage\n\t\t\t\t\t} : {\n\t\t\t\t\t\tctx: baseCtx,\n\t\t\t\t\t\tinterfaceHash\n\t\t\t\t\t};\n\t\t\t\t\tconst call = this.channel.sendRequestWithStream(wireMethod, params, channelOpts);\n\t\t\t\t\treturn Object.assign(call.result, {\n\t\t\t\t\t\tsend: (payload) => call.send(payload),\n\t\t\t\t\t\tcancel: (reason) => call.cancel(reason),\n\t\t\t\t\t\tping: () => call.ping()\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst resultSchema = member.resultSchema;\n\t\t\t\tproxy[name] = async (params) => {\n\t\t\t\t\tconst raw = await this.channel.sendRequest(wireMethod, params, {\n\t\t\t\t\t\tctx: baseCtx,\n\t\t\t\t\t\tinterfaceHash\n\t\t\t\t\t});\n\t\t\t\t\tconst checked = safeParse(resultSchema, raw === null ? void 0 : raw);\n\t\t\t\t\tif (!checked.success) throw new RpcError(ErrorCode.internalError, `Invalid result for ${wireMethod}`, { issues: checked.error.issues });\n\t\t\t\t\treturn raw;\n\t\t\t\t};\n\t\t\t}\n\t\t\telse proxy[name] = async (params) => {\n\t\t\t\tthis.channel.sendNotification(wireMethod, params, {\n\t\t\t\t\tctx: baseCtx,\n\t\t\t\t\tinterfaceHash\n\t\t\t\t});\n\t\t\t};\n\t\t}\n\t\treturn proxy;\n\t}\n\tasync _handleRequest(call) {\n\t\tconst parsed = this._parseRouted(call.method);\n\t\tif (!parsed.ok) return notFound(parsed.reason, call.method);\n\t\tconst { entry, memberName } = parsed;\n\t\tconst member = entry.iface.members[memberName];\n\t\tif (!member) return notFound(\"unknown-method\", call.method);\n\t\tconst handler = entry.handlers[memberName];\n\t\tif (!handler) return notFound(\"unknown-method\", call.method);\n\t\tconst parsedParams = safeParse(member.paramsSchema, call.params);\n\t\tif (!parsedParams.success) return { error: {\n\t\t\tcode: ErrorCode.invalidParams,\n\t\t\tmessage: \"Invalid params\",\n\t\t\tdata: { issues: parsedParams.error.issues }\n\t\t} };\n\t\tif (!(member instanceof RequestType)) return notFound(\"unknown-method\", call.method);\n\t\tconst stream = this._buildStreamApi(call.stream, call.signal, member);\n\t\ttry {\n\t\t\tconst result = await handler(parsedParams.data, call.context, stream);\n\t\t\tconst checked = safeParse(member.resultSchema, result);\n\t\t\tif (!checked.success) return { error: {\n\t\t\t\tcode: ErrorCode.internalError,\n\t\t\t\tmessage: `Invalid result for ${call.method}`,\n\t\t\t\tdata: { issues: checked.error.issues }\n\t\t\t} };\n\t\t\treturn { result: result === void 0 ? null : result };\n\t\t} catch (e) {\n\t\t\tif (e instanceof RpcError) return { error: {\n\t\t\t\tcode: e.code,\n\t\t\t\tmessage: e.message,\n\t\t\t\tdata: e.data\n\t\t\t} };\n\t\t\treturn { error: {\n\t\t\t\tcode: ErrorCode.internalError,\n\t\t\t\tmessage: e instanceof Error ? e.message : String(e)\n\t\t\t} };\n\t\t}\n\t}\n\t_buildStreamApi(callStream, signal, member) {\n\t\treturn {\n\t\t\tsend: (payload) => {\n\t\t\t\tif (member.serverStreamSchema) {\n\t\t\t\t\tconst r = safeParse(member.serverStreamSchema, payload);\n\t\t\t\t\tif (!r.success) throw new Error(`Server stream payload failed schema validation: ${r.error.message}`);\n\t\t\t\t}\n\t\t\t\tcallStream.send(payload);\n\t\t\t},\n\t\t\tonMessage: (listener) => {\n\t\t\t\tcallStream.onMessage((raw) => {\n\t\t\t\t\tif (member.clientStreamSchema) {\n\t\t\t\t\t\tconst r = safeParse(member.clientStreamSchema, raw);\n\t\t\t\t\t\tif (!r.success) return;\n\t\t\t\t\t\tlistener(r.data);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tping: () => callStream.ping(),\n\t\t\tsignal\n\t\t};\n\t}\n\t_handleNotification(call) {\n\t\tconst parsed = this._parseRouted(call.method);\n\t\tif (!parsed.ok) return;\n\t\tconst { entry, memberName } = parsed;\n\t\tconst member = entry.iface.members[memberName];\n\t\tif (!(member instanceof NotificationType)) return;\n\t\tconst handler = entry.handlers[memberName];\n\t\tif (!handler) return;\n\t\tconst parsedParams = safeParse(member.paramsSchema, call.params);\n\t\tif (!parsedParams.success) return;\n\t\thandler(parsedParams.data, call.context);\n\t}\n\t_parseRouted(method) {\n\t\tconst parsed = parseMethodName(method);\n\t\tif (!parsed) return {\n\t\t\tok: false,\n\t\t\treason: \"bad-method-grammar\"\n\t\t};\n\t\tif (parsed.kind === \"bare\") {\n\t\t\tif (!this._preset) return {\n\t\t\t\tok: false,\n\t\t\t\treason: \"no-preset\"\n\t\t\t};\n\t\t\tconst entry = this._registry.get(`::${this._preset.interfaceId}`);\n\t\t\tif (!entry) return {\n\t\t\t\tok: false,\n\t\t\t\treason: \"no-preset\"\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tentry,\n\t\t\t\tmemberName: parsed.member\n\t\t\t};\n\t\t}\n\t\tconst serviceId = parsed.kind === \"full\" ? parsed.serviceId : void 0;\n\t\tconst key = `${serviceId ?? \"\"}::${parsed.interfaceId}`;\n\t\tconst entry = this._registry.get(key);\n\t\tif (!entry) return {\n\t\t\tok: false,\n\t\t\treason: serviceId ? \"unknown-service\" : \"unknown-interface\"\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tentry,\n\t\t\tmemberName: parsed.member\n\t\t};\n\t}\n};\n/** Structural equality for two CNF root-node-id requirement collections. */\nfunction rootPrincipalSetsEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) {\n\t\tconst sa = a[i];\n\t\tconst sb = b[i];\n\t\tif (sa.length !== sb.length) return false;\n\t\tfor (let j = 0; j < sa.length; j++) {\n\t\t\tif (sa[j].principal !== sb[j].principal) return false;\n\t\t\tif (sa[j].transitive === true !== (sb[j].transitive === true)) return false;\n\t\t}\n\t}\n\treturn true;\n}\n/** Service-scoped handle returned by `connection.service(id)`. */\nvar ServiceHandle = class {\n\t_connection;\n\t_serviceId;\n\tconstructor(_connection, _serviceId) {\n\t\tthis._connection = _connection;\n\t\tthis._serviceId = _serviceId;\n\t}\n\tget(iface, opts = {}) {\n\t\treturn this._connection.get(iface, {\n\t\t\t...opts,\n\t\t\tserviceId: this._serviceId\n\t\t});\n\t}\n\tregister(iface, handlers, opts = {}) {\n\t\tthis._connection.register(iface, handlers, {\n\t\t\t...opts,\n\t\t\tserviceId: this._serviceId\n\t\t});\n\t}\n};\nfunction notFound(reason, method) {\n\treturn { error: {\n\t\tcode: ErrorCode.methodNotFound,\n\t\tmessage: `Method not found: ${method}`,\n\t\tdata: {\n\t\t\treason,\n\t\t\tmethod\n\t\t}\n\t} };\n}\n//#endregion\n//#region src/connection/channelConnector.ts\nconst DEFAULT_INITIAL_BACKOFF_MS = 250;\nconst DEFAULT_MAX_BACKOFF_MS = 1e4;\n/**\n* Drives a connect / (re)connect loop over a raw {@link ConnectableChannel}.\n*\n* Unlike connection-level helpers, this works at the channel layer: the\n* caller composes identity / signing on top of the channel handed to\n* {@link keepConnected} (e.g. `SigningSender.wrapChannel(channel, { principal })`).\n*\n* Construct via {@link ChannelConnector.once} (a single, already-open channel\n* that never redials) or {@link ChannelConnector.expBackoff} (re-open via a\n* factory with exponential backoff after each close).\n*/\nvar ChannelConnector = class ChannelConnector {\n\t_open;\n\t_redial;\n\t_initialBackoffMs;\n\t_maxBackoffMs;\n\tconstructor(_open, _redial, _initialBackoffMs, _maxBackoffMs) {\n\t\tthis._open = _open;\n\t\tthis._redial = _redial;\n\t\tthis._initialBackoffMs = _initialBackoffMs;\n\t\tthis._maxBackoffMs = _maxBackoffMs;\n\t}\n\t/**\n\t* A connector over a single channel (or a promise of one). Never redials;\n\t* the loop ends when the channel closes or {@link KeepConnectedHandle.stop}\n\t* fires.\n\t*/\n\tstatic once(channel) {\n\t\treturn new ChannelConnector(async () => channel, false, DEFAULT_INITIAL_BACKOFF_MS, DEFAULT_MAX_BACKOFF_MS);\n\t}\n\t/**\n\t* A redialing connector: `open` is called once per attempt, and the loop\n\t* reconnects with exponential backoff after each close (or failed open).\n\t*/\n\tstatic expBackoff(open, opts = {}) {\n\t\treturn new ChannelConnector(open, true, opts.initialBackoffMs ?? DEFAULT_INITIAL_BACKOFF_MS, opts.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS);\n\t}\n\t/**\n\t* Run `onConnect` on every (re)connect with the freshly opened channel.\n\t* The callback typically wraps the channel with signing and registers\n\t* handlers. Returns once the loop exits (see {@link KeepConnectedHandle}).\n\t*/\n\tkeepConnected(onConnect, opts = {}) {\n\t\tlet stopped = false;\n\t\tlet current;\n\t\tconst stop = () => {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\tconst c = current;\n\t\t\tcurrent = void 0;\n\t\t\tc?.close?.();\n\t\t};\n\t\tif (opts.signal) if (opts.signal.aborted) stopped = true;\n\t\telse opts.signal.addEventListener(\"abort\", stop, { once: true });\n\t\treturn {\n\t\t\tdone: (async () => {\n\t\t\t\tlet backoff = this._initialBackoffMs;\n\t\t\t\twhile (!stopped) {\n\t\t\t\t\tlet channel;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tchannel = await this._open();\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tif (stopped || !this._redial) throw e;\n\t\t\t\t\t\tawait _delay(backoff, opts.signal);\n\t\t\t\t\t\tbackoff = Math.min(backoff * 2, this._maxBackoffMs);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (stopped) {\n\t\t\t\t\t\tchannel.close?.();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tbackoff = this._initialBackoffMs;\n\t\t\t\t\tcurrent = channel;\n\t\t\t\t\tlet isClosed = false;\n\t\t\t\t\tconst closed = new Promise((resolve) => {\n\t\t\t\t\t\tchannel.onClose(() => {\n\t\t\t\t\t\t\tisClosed = true;\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait onConnect({ channel });\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tif (!isClosed) {\n\t\t\t\t\t\t\tchannel.close?.();\n\t\t\t\t\t\t\tthrow e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tawait closed;\n\t\t\t\t\tif (current === channel) current = void 0;\n\t\t\t\t\tif (stopped || !this._redial) return;\n\t\t\t\t}\n\t\t\t})(),\n\t\t\tstop\n\t\t};\n\t}\n};\nfunction _delay(ms, signal) {\n\treturn new Promise((resolve) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tresolve();\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n}\n//#endregion\n//#region src/connection/endpointUri.ts\nconst TOKEN_PARAM = \"token\";\nconst BROKER_PARAM = \"broker\";\nconst COMMAND_PARAM = \"command\";\nconst ARGV_PARAM = \"argv\";\nconst PROVISION_SLOT_PARAM = \"provisionSlot\";\nconst ENV_PARAM = \"env\";\nconst CWD_PARAM = \"cwd\";\nfunction _tryParseUrl(uri) {\n\ttry {\n\t\treturn new URL(uri);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction _looksLikeWsUrl(uri) {\n\treturn /^wss?:\\/\\//i.test(uri);\n}\n/** True for a Windows named-pipe path (`\\\\.\\pipe\\…` or `\\\\?\\pipe\\…`). */\nfunction _isWindowsPipePath(path) {\n\treturn /^\\\\\\\\[.?]\\\\pipe\\\\/i.test(path);\n}\nfunction _parseCommand(url) {\n\tconst argv = url.searchParams.getAll(ARGV_PARAM);\n\tif (argv.length > 0) return { argv };\n\tconst command = url.searchParams.get(COMMAND_PARAM);\n\tif (command !== null) return { command };\n\tthrow new Error(`endpoint '${url.protocol}' requires a '${COMMAND_PARAM}' or '${ARGV_PARAM}' query parameter`);\n}\n/** Parse repeated `env=KEY=VALUE` params into a record (first `=` splits). */\nfunction _parseEnv(url) {\n\tconst entries = url.searchParams.getAll(ENV_PARAM);\n\tif (entries.length === 0) return;\n\tconst env = {};\n\tfor (const entry of entries) {\n\t\tconst eq = entry.indexOf(\"=\");\n\t\tif (eq === -1) throw new Error(`endpoint '${ENV_PARAM}' param must be 'KEY=VALUE', got '${entry}'`);\n\t\tenv[entry.slice(0, eq)] = entry.slice(eq + 1);\n\t}\n\treturn env;\n}\n/**\n* Parse a strict endpoint URI into an {@link ResolvedEndpoint}. Throws on an\n* unknown scheme or a malformed command endpoint. A bare (scheme-less) string\n* is auto-detected as `ws`/`wss` URL or a socket path.\n*/\nfunction parseEndpointUri(uri) {\n\tconst trimmed = uri.trim();\n\tif (trimmed === \"\") throw new Error(\"endpoint URI is empty\");\n\tconst url = _tryParseUrl(trimmed);\n\tif (!url) {\n\t\tif (_looksLikeWsUrl(trimmed)) return {\n\t\t\tkind: \"ws\",\n\t\t\turl: trimmed\n\t\t};\n\t\treturn {\n\t\t\tkind: \"socket\",\n\t\t\tpath: trimmed\n\t\t};\n\t}\n\tswitch (url.protocol) {\n\t\tcase \"ws:\":\n\t\tcase \"wss:\": {\n\t\t\tconst token = url.searchParams.get(TOKEN_PARAM) ?? void 0;\n\t\t\turl.searchParams.delete(TOKEN_PARAM);\n\t\t\tconst cleanUrl = url.toString();\n\t\t\treturn token !== void 0 ? {\n\t\t\t\tkind: \"ws\",\n\t\t\t\turl: cleanUrl,\n\t\t\t\ttoken\n\t\t\t} : {\n\t\t\t\tkind: \"ws\",\n\t\t\t\turl: cleanUrl\n\t\t\t};\n\t\t}\n\t\tcase \"ws-no-init:\": return {\n\t\t\tkind: \"ws-no-init\",\n\t\t\turl: new URL(trimmed.replace(/^ws-no-init:/i, \"ws:\")).toString()\n\t\t};\n\t\tcase \"unix:\": {\n\t\t\tconst token = url.searchParams.get(TOKEN_PARAM) ?? void 0;\n\t\t\tconst brokerMode = _parseBrokerMode(url);\n\t\t\treturn {\n\t\t\t\tkind: \"socket\",\n\t\t\t\tpath: decodeURIComponent(url.pathname),\n\t\t\t\t...token !== void 0 ? { token } : {},\n\t\t\t\t...brokerMode !== void 0 ? { brokerMode } : {}\n\t\t\t};\n\t\t}\n\t\tcase \"npipe:\": {\n\t\t\tconst token = url.searchParams.get(TOKEN_PARAM) ?? void 0;\n\t\t\tconst brokerMode = _parseBrokerMode(url);\n\t\t\treturn {\n\t\t\t\tkind: \"socket\",\n\t\t\t\tpath: `\\\\\\\\${url.host === \"\" ? \".\" : url.host}${decodeURIComponent(url.pathname).replace(/\\//g, \"\\\\\")}`,\n\t\t\t\t...token !== void 0 ? { token } : {},\n\t\t\t\t...brokerMode !== void 0 ? { brokerMode } : {}\n\t\t\t};\n\t\t}\n\t\tcase \"cmd-stdio:\": {\n\t\t\tconst env = _parseEnv(url);\n\t\t\tconst cwd = url.searchParams.get(CWD_PARAM) ?? void 0;\n\t\t\treturn {\n\t\t\t\tkind: \"cmd-stdio\",\n\t\t\t\tcommand: _parseCommand(url),\n\t\t\t\t...env !== void 0 ? { env } : {},\n\t\t\t\t...cwd !== void 0 ? { cwd } : {}\n\t\t\t};\n\t\t}\n\t\tcase \"cmd:\": {\n\t\t\tconst command = _parseCommand(url);\n\t\t\tconst provisionSlot = url.searchParams.get(PROVISION_SLOT_PARAM) ?? void 0;\n\t\t\tconst env = _parseEnv(url);\n\t\t\tconst cwd = url.searchParams.get(CWD_PARAM) ?? void 0;\n\t\t\treturn {\n\t\t\t\tkind: \"cmd-env\",\n\t\t\t\tcommand,\n\t\t\t\t...provisionSlot !== void 0 ? { provisionSlot } : {},\n\t\t\t\t...env !== void 0 ? { env } : {},\n\t\t\t\t...cwd !== void 0 ? { cwd } : {}\n\t\t\t};\n\t\t}\n\t\tdefault: throw new Error(`unsupported endpoint scheme '${url.protocol}' (expected unix:, npipe:, ws:, wss:, ws-no-init:, cmd:, or cmd-stdio:)`);\n\t}\n}\nconst REDACTED = \"***\";\nfunction _appendToken(params, token, reveal) {\n\tif (token === void 0) return;\n\tparams.set(TOKEN_PARAM, reveal ? token : REDACTED);\n}\nfunction _parseBrokerMode(url) {\n\tconst value = url.searchParams.get(BROKER_PARAM);\n\tif (value === null) return void 0;\n\tif (value === \"hubrpc\" || value === \"raw\") return value;\n\tthrow new Error(`endpoint '${BROKER_PARAM}' param must be 'hubrpc' or 'raw', got '${value}'`);\n}\nfunction _appendCommand(params, command) {\n\tif (\"argv\" in command) for (const a of command.argv) params.append(ARGV_PARAM, a);\n\telse params.set(COMMAND_PARAM, command.command);\n}\nfunction _appendEnv(params, env) {\n\tif (env === void 0) return;\n\tfor (const [key, value] of Object.entries(env)) params.append(ENV_PARAM, `${key}=${value}`);\n}\n/**\n* Render an {@link ResolvedEndpoint} back to a canonical strict URI. The token is\n* redacted (`***`) unless `revealToken` is set, so the result is paste-safe for\n* logs. Round-trips with {@link parseEndpointUri} when `revealToken` is true.\n*/\nfunction formatEndpointUri(spec, options) {\n\tconst reveal = options?.revealToken === true;\n\tswitch (spec.kind) {\n\t\tcase \"socket\": {\n\t\t\tconst params = new URLSearchParams();\n\t\t\t_appendToken(params, spec.token, reveal);\n\t\t\tif (spec.brokerMode !== void 0) params.set(BROKER_PARAM, spec.brokerMode);\n\t\t\tconst query = params.toString();\n\t\t\tconst suffix = query === \"\" ? \"\" : `?${query}`;\n\t\t\tif (_isWindowsPipePath(spec.path)) {\n\t\t\t\tconst m = spec.path.match(/^\\\\\\\\([.?])\\\\(.*)$/);\n\t\t\t\treturn `npipe://${m ? m[1] : \".\"}/${(m ? m[2] : spec.path).replace(/\\\\/g, \"/\")}${suffix}`;\n\t\t\t}\n\t\t\treturn `unix:${spec.path}${suffix}`;\n\t\t}\n\t\tcase \"ws\": {\n\t\t\tconst url = new URL(spec.url);\n\t\t\t_appendToken(url.searchParams, spec.token, reveal);\n\t\t\treturn url.toString();\n\t\t}\n\t\tcase \"ws-no-init\": return spec.url.replace(/^ws:/i, \"ws-no-init:\");\n\t\tcase \"cmd-stdio\": {\n\t\t\tconst params = new URLSearchParams();\n\t\t\t_appendCommand(params, spec.command);\n\t\t\t_appendEnv(params, spec.env);\n\t\t\tif (spec.cwd !== void 0) params.set(CWD_PARAM, spec.cwd);\n\t\t\treturn `cmd-stdio:?${params.toString()}`;\n\t\t}\n\t\tcase \"cmd-env\": {\n\t\t\tconst params = new URLSearchParams();\n\t\t\t_appendCommand(params, spec.command);\n\t\t\tif (spec.provisionSlot !== void 0) params.set(PROVISION_SLOT_PARAM, spec.provisionSlot);\n\t\t\t_appendEnv(params, spec.env);\n\t\t\tif (spec.cwd !== void 0) params.set(CWD_PARAM, spec.cwd);\n\t\t\treturn `cmd:?${params.toString()}`;\n\t\t}\n\t}\n}\n/** True for endpoints that connect to existing, possibly-remote infrastructure. */\nfunction isHubEndpoint(spec) {\n\treturn spec.kind === \"socket\" && spec.brokerMode !== \"raw\" || spec.kind === \"ws\";\n}\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/errors.js\n/**\n* The base error class of hpke-js.\n* @group Errors\n*/\nvar HpkeError = class extends Error {\n\tconstructor(e) {\n\t\tlet message;\n\t\tif (e instanceof Error) message = e.message;\n\t\telse if (typeof e === \"string\") message = e;\n\t\telse message = \"\";\n\t\tsuper(message);\n\t\tthis.name = this.constructor.name;\n\t}\n};\n/**\n* Invalid parameter.\n* @group Errors\n*/\nvar InvalidParamError = class extends HpkeError {};\n/**\n* Public or private key serialization failure.\n* @group Errors\n*/\nvar SerializeError = class extends HpkeError {};\n/**\n* Public or private key deserialization failure.\n* @group Errors\n*/\nvar DeserializeError = class extends HpkeError {};\n/**\n* encap() failure.\n* @group Errors\n*/\nvar EncapError = class extends HpkeError {};\n/**\n* decap() failure.\n* @group Errors\n*/\nvar DecapError = class extends HpkeError {};\n/**\n* Secret export failure.\n* @group Errors\n*/\nvar ExportError = class extends HpkeError {};\n/**\n* seal() failure.\n* @group Errors\n*/\nvar SealError = class extends HpkeError {};\n/**\n* open() failure.\n* @group Errors\n*/\nvar OpenError = class extends HpkeError {};\n/**\n* Sequence number overflow on the encryption context.\n* @group Errors\n*/\nvar MessageLimitReachedError = class extends HpkeError {};\n/**\n* Key pair derivation failure.\n* @group Errors\n*/\nvar DeriveKeyPairError = class extends HpkeError {};\n/**\n* Not supported failure.\n* @group Errors\n*/\nvar NotSupportedError = class extends HpkeError {};\nconst dntGlobalThis = createMergeProxy(globalThis, {});\nfunction createMergeProxy(baseObj, extObj) {\n\treturn new Proxy(baseObj, {\n\t\tget(_target, prop, _receiver) {\n\t\t\tif (prop in extObj) return extObj[prop];\n\t\t\telse return baseObj[prop];\n\t\t},\n\t\tset(_target, prop, value) {\n\t\t\tif (prop in extObj) delete extObj[prop];\n\t\t\tbaseObj[prop] = value;\n\t\t\treturn true;\n\t\t},\n\t\tdeleteProperty(_target, prop) {\n\t\t\tlet success = false;\n\t\t\tif (prop in extObj) {\n\t\t\t\tdelete extObj[prop];\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t\tif (prop in baseObj) {\n\t\t\t\tdelete baseObj[prop];\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t\treturn success;\n\t\t},\n\t\townKeys(_target) {\n\t\t\tconst baseKeys = Reflect.ownKeys(baseObj);\n\t\t\tconst extKeys = Reflect.ownKeys(extObj);\n\t\t\tconst extKeysSet = new Set(extKeys);\n\t\t\treturn [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];\n\t\t},\n\t\tdefineProperty(_target, prop, desc) {\n\t\t\tif (prop in extObj) delete extObj[prop];\n\t\t\tReflect.defineProperty(baseObj, prop, desc);\n\t\t\treturn true;\n\t\t},\n\t\tgetOwnPropertyDescriptor(_target, prop) {\n\t\t\tif (prop in extObj) return Reflect.getOwnPropertyDescriptor(extObj, prop);\n\t\t\telse return Reflect.getOwnPropertyDescriptor(baseObj, prop);\n\t\t},\n\t\thas(_target, prop) {\n\t\t\treturn prop in extObj || prop in baseObj;\n\t\t}\n\t});\n}\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/algorithm.js\nasync function loadSubtleCrypto() {\n\tif (dntGlobalThis !== void 0 && globalThis.crypto !== void 0) return globalThis.crypto.subtle;\n\ttry {\n\t\tconst { webcrypto } = await import(\"./_empty-crypto-Bi0tGx5K.js\");\n\t\treturn webcrypto.subtle;\n\t} catch (e) {\n\t\tthrow new NotSupportedError(e);\n\t}\n}\nvar NativeAlgorithm = class {\n\tconstructor() {\n\t\tObject.defineProperty(this, \"_api\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t}\n\tasync _setup() {\n\t\tif (this._api !== void 0) return;\n\t\tthis._api = await loadSubtleCrypto();\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/identifiers.js\n/**\n* The supported HPKE modes.\n*/\nconst Mode = {\n\tBase: 0,\n\tPsk: 1,\n\tAuth: 2,\n\tAuthPsk: 3\n};\n/**\n* The supported Key Encapsulation Mechanism (KEM) identifiers.\n*/\nconst KemId = {\n\tNotAssigned: 0,\n\tDhkemP256HkdfSha256: 16,\n\tDhkemP384HkdfSha384: 17,\n\tDhkemP521HkdfSha512: 18,\n\tDhkemSecp256k1HkdfSha256: 19,\n\tDhkemX25519HkdfSha256: 32,\n\tDhkemX448HkdfSha512: 33,\n\tHybridkemX25519Kyber768: 48,\n\tMlKem512: 64,\n\tMlKem768: 65,\n\tMlKem1024: 66,\n\tXWing: 25722\n};\n/**\n* The supported Key Derivation Function (KDF) identifiers.\n*/\nconst KdfId = {\n\tHkdfSha256: 1,\n\tHkdfSha384: 2,\n\tHkdfSha512: 3,\n\tSha3256: 4,\n\tSha3384: 5,\n\tSha3512: 6,\n\tShake128: 16,\n\tShake256: 17,\n\tTurboShake128: 18,\n\tTurboShake256: 19\n};\n/**\n* The supported Authenticated Encryption with Associated Data (AEAD) identifiers.\n*/\nconst AeadId = {\n\tAes128Gcm: 1,\n\tAes256Gcm: 2,\n\tChacha20Poly1305: 3,\n\tExportOnly: 65535\n};\nconst EMPTY = /* @__PURE__ */ new Uint8Array(0);\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/kemInterface.js\nconst SUITE_ID_HEADER_KEM = /* @__PURE__ */ new Uint8Array([\n\t75,\n\t69,\n\t77,\n\t0,\n\t0\n]);\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kdfs/hkdf.js\nconst HPKE_VERSION = /* @__PURE__ */ new Uint8Array([\n\t72,\n\t80,\n\t75,\n\t69,\n\t45,\n\t118,\n\t49\n]);\nfunction toUint8Array(input) {\n\treturn new Uint8Array(toArrayBuffer(input));\n}\nfunction toArrayBuffer(input) {\n\tif (input instanceof ArrayBuffer) return input;\n\tif (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength).slice().buffer;\n\treturn new Uint8Array(input).slice().buffer;\n}\nvar HkdfNative = class extends NativeAlgorithm {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: KdfId.HkdfSha256\n\t\t});\n\t\tObject.defineProperty(this, \"hashSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 0\n\t\t});\n\t\tObject.defineProperty(this, \"_suiteId\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: EMPTY\n\t\t});\n\t\tObject.defineProperty(this, \"algHash\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: {\n\t\t\t\tname: \"HMAC\",\n\t\t\t\thash: \"SHA-256\",\n\t\t\t\tlength: 256\n\t\t\t}\n\t\t});\n\t}\n\tinit(suiteId) {\n\t\tthis._suiteId = suiteId;\n\t}\n\tbuildLabeledIkm(label, ikm) {\n\t\tthis._checkInit();\n\t\tconst ret = new Uint8Array(7 + this._suiteId.byteLength + label.byteLength + ikm.byteLength);\n\t\tret.set(HPKE_VERSION, 0);\n\t\tret.set(this._suiteId, 7);\n\t\tret.set(label, 7 + this._suiteId.byteLength);\n\t\tret.set(ikm, 7 + this._suiteId.byteLength + label.byteLength);\n\t\treturn ret;\n\t}\n\tbuildLabeledInfo(label, info, len) {\n\t\tthis._checkInit();\n\t\tconst ret = new Uint8Array(9 + this._suiteId.byteLength + label.byteLength + info.byteLength);\n\t\tret.set(new Uint8Array([0, len]), 0);\n\t\tret.set(HPKE_VERSION, 2);\n\t\tret.set(this._suiteId, 9);\n\t\tret.set(label, 9 + this._suiteId.byteLength);\n\t\tret.set(info, 9 + this._suiteId.byteLength + label.byteLength);\n\t\treturn ret;\n\t}\n\tasync extract(salt, ikm) {\n\t\tawait this._setup();\n\t\tconst saltBuf = salt.byteLength === 0 ? new ArrayBuffer(this.hashSize) : toArrayBuffer(salt);\n\t\tif (saltBuf.byteLength !== this.hashSize) throw new InvalidParamError(\"The salt length must be the same as the hashSize\");\n\t\tconst ikmBuf = toArrayBuffer(ikm);\n\t\tconst key = await this._api.importKey(\"raw\", saltBuf, this.algHash, false, [\"sign\"]);\n\t\treturn await this._api.sign(\"HMAC\", key, ikmBuf);\n\t}\n\tasync expand(prk, info, len) {\n\t\tawait this._setup();\n\t\tconst prkBuf = toArrayBuffer(prk);\n\t\tconst key = await this._api.importKey(\"raw\", prkBuf, this.algHash, false, [\"sign\"]);\n\t\tconst okm = new ArrayBuffer(len);\n\t\tconst okmBytes = new Uint8Array(okm);\n\t\tlet prev = EMPTY;\n\t\tconst mid = toUint8Array(info);\n\t\tconst tail = /* @__PURE__ */ new Uint8Array(1);\n\t\tif (len > 255 * this.hashSize) throw new Error(\"Entropy limit reached\");\n\t\tconst tmp = new Uint8Array(this.hashSize + mid.length + 1);\n\t\tfor (let i = 1, cur = 0; cur < okmBytes.length; i++) {\n\t\t\ttail[0] = i;\n\t\t\ttmp.set(prev, 0);\n\t\t\ttmp.set(mid, prev.length);\n\t\t\ttmp.set(tail, prev.length + mid.length);\n\t\t\tprev = new Uint8Array(await this._api.sign(\"HMAC\", key, tmp.slice(0, prev.length + mid.length + 1)));\n\t\t\tif (okmBytes.length - cur >= prev.length) {\n\t\t\t\tokmBytes.set(prev, cur);\n\t\t\t\tcur += prev.length;\n\t\t\t} else {\n\t\t\t\tokmBytes.set(prev.slice(0, okmBytes.length - cur), cur);\n\t\t\t\tcur += okmBytes.length - cur;\n\t\t\t}\n\t\t}\n\t\treturn okm;\n\t}\n\tasync extractAndExpand(salt, ikm, info, len) {\n\t\tawait this._setup();\n\t\tconst ikmBuf = toArrayBuffer(ikm);\n\t\tconst baseKey = await this._api.importKey(\"raw\", ikmBuf, \"HKDF\", false, [\"deriveBits\"]);\n\t\treturn await this._api.deriveBits({\n\t\t\tname: \"HKDF\",\n\t\t\thash: this.algHash.hash,\n\t\t\tsalt: toArrayBuffer(salt),\n\t\t\tinfo: toArrayBuffer(info)\n\t\t}, baseKey, len * 8);\n\t}\n\tasync labeledExtract(salt, label, ikm) {\n\t\treturn await this.extract(salt, this.buildLabeledIkm(label, ikm));\n\t}\n\tasync labeledExpand(prk, label, info, len) {\n\t\treturn await this.expand(prk, this.buildLabeledInfo(label, info, len), len);\n\t}\n\t_checkInit() {\n\t\tif (this._suiteId === EMPTY) throw new Error(\"Not initialized. Call init()\");\n\t}\n};\nvar HkdfSha256Native = class extends HkdfNative {\n\tconstructor() {\n\t\tsuper(...arguments);\n\t\t/** KdfId.HkdfSha256 (0x0001) */\n\t\tObject.defineProperty(this, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: KdfId.HkdfSha256\n\t\t});\n\t\t/** 32 */\n\t\tObject.defineProperty(this, \"hashSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 32\n\t\t});\n\t\t/** The parameters for Web Cryptography API */\n\t\tObject.defineProperty(this, \"algHash\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: {\n\t\t\t\tname: \"HMAC\",\n\t\t\t\thash: \"SHA-256\",\n\t\t\t\tlength: 256\n\t\t\t}\n\t\t});\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/utils/misc.js\n/**\n* Checks whetehr the type of input is CryptoKeyPair or not.\n*/\nconst isCryptoKeyPair = (x) => typeof x === \"object\" && x !== null && typeof x.privateKey === \"object\" && typeof x.publicKey === \"object\";\n/**\n* Converts integer to octet string. I2OSP implementation.\n*/\nfunction i2Osp(n, w) {\n\tif (w <= 0) throw new Error(\"i2Osp: too small size\");\n\tif (n >= 256 ** w) throw new Error(\"i2Osp: too large integer\");\n\tconst ret = new Uint8Array(w);\n\tfor (let i = 0; i < w && n; i++) {\n\t\tret[w - (i + 1)] = n % 256;\n\t\tn = Math.floor(n / 256);\n\t}\n\treturn ret;\n}\n/**\n* Concatenates two Uint8Arrays.\n* @param a Uint8Array\n* @param b Uint8Array\n* @returns Concatenated Uint8Array\n*/\nfunction concat(a, b) {\n\tconst ret = new Uint8Array(a.length + b.length);\n\tret.set(a, 0);\n\tret.set(b, a.length);\n\treturn ret;\n}\n/**\n* Decodes Base64Url-encoded data.\n* @param v Base64Url-encoded string\n* @returns Uint8Array\n*/\nfunction base64UrlToBytes(v) {\n\tconst base64 = v.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\tconst byteString = atob(base64);\n\tconst ret = new Uint8Array(byteString.length);\n\tfor (let i = 0; i < byteString.length; i++) ret[i] = byteString.charCodeAt(i);\n\treturn ret;\n}\n/**\n* XOR for Uint8Array.\n*/\nfunction xor(a, b) {\n\tif (a.byteLength !== b.byteLength) throw new Error(\"xor: different length inputs\");\n\tconst buf = new Uint8Array(a.byteLength);\n\tfor (let i = 0; i < a.byteLength; i++) buf[i] = a[i] ^ b[i];\n\treturn buf;\n}\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kems/dhkem.js\nconst LABEL_EAE_PRK = /* @__PURE__ */ new Uint8Array([\n\t101,\n\t97,\n\t101,\n\t95,\n\t112,\n\t114,\n\t107\n]);\nconst LABEL_SHARED_SECRET = /* @__PURE__ */ new Uint8Array([\n\t115,\n\t104,\n\t97,\n\t114,\n\t101,\n\t100,\n\t95,\n\t115,\n\t101,\n\t99,\n\t114,\n\t101,\n\t116\n]);\nfunction concat3(a, b, c) {\n\tconst ret = new Uint8Array(a.length + b.length + c.length);\n\tret.set(a, 0);\n\tret.set(b, a.length);\n\tret.set(c, a.length + b.length);\n\treturn ret;\n}\nvar Dhkem = class {\n\tconstructor(id, prim, kdf) {\n\t\tObject.defineProperty(this, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"secretSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 0\n\t\t});\n\t\tObject.defineProperty(this, \"encSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 0\n\t\t});\n\t\tObject.defineProperty(this, \"publicKeySize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 0\n\t\t});\n\t\tObject.defineProperty(this, \"privateKeySize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 0\n\t\t});\n\t\tObject.defineProperty(this, \"_prim\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_kdf\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tthis.id = id;\n\t\tthis._prim = prim;\n\t\tthis._kdf = kdf;\n\t\tconst suiteId = new Uint8Array(SUITE_ID_HEADER_KEM);\n\t\tsuiteId.set(i2Osp(this.id, 2), 3);\n\t\tthis._kdf.init(suiteId);\n\t}\n\tasync serializePublicKey(key) {\n\t\treturn await this._prim.serializePublicKey(key);\n\t}\n\tasync deserializePublicKey(key) {\n\t\treturn await this._prim.deserializePublicKey(toArrayBuffer(key));\n\t}\n\tasync serializePrivateKey(key) {\n\t\treturn await this._prim.serializePrivateKey(key);\n\t}\n\tasync deserializePrivateKey(key) {\n\t\treturn await this._prim.deserializePrivateKey(toArrayBuffer(key));\n\t}\n\tasync importKey(format, key, isPublic = true) {\n\t\treturn await this._prim.importKey(format, key, isPublic);\n\t}\n\tasync generateKeyPair() {\n\t\treturn await this._prim.generateKeyPair();\n\t}\n\tasync deriveKeyPair(ikm) {\n\t\tconst rawIkm = toArrayBuffer(ikm);\n\t\tif (rawIkm.byteLength > 8192) throw new InvalidParamError(\"Too long ikm\");\n\t\treturn await this._prim.deriveKeyPair(rawIkm);\n\t}\n\tasync encap(params) {\n\t\tlet ke;\n\t\tif (params.ekm === void 0) ke = await this.generateKeyPair();\n\t\telse if (isCryptoKeyPair(params.ekm)) ke = params.ekm;\n\t\telse ke = await this.deriveKeyPair(params.ekm);\n\t\tconst enc = await this._prim.serializePublicKey(ke.publicKey);\n\t\tconst pkrm = await this._prim.serializePublicKey(params.recipientPublicKey);\n\t\ttry {\n\t\t\tlet dh;\n\t\t\tif (params.senderKey === void 0) dh = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n\t\t\telse {\n\t\t\t\tconst sks = isCryptoKeyPair(params.senderKey) ? params.senderKey.privateKey : params.senderKey;\n\t\t\t\tdh = concat(new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey)), new Uint8Array(await this._prim.dh(sks, params.recipientPublicKey)));\n\t\t\t}\n\t\t\tlet kemContext;\n\t\t\tif (params.senderKey === void 0) kemContext = concat(new Uint8Array(enc), new Uint8Array(pkrm));\n\t\t\telse {\n\t\t\t\tconst pks = isCryptoKeyPair(params.senderKey) ? params.senderKey.publicKey : await this._prim.derivePublicKey(params.senderKey);\n\t\t\t\tconst pksm = await this._prim.serializePublicKey(pks);\n\t\t\t\tkemContext = concat3(new Uint8Array(enc), new Uint8Array(pkrm), new Uint8Array(pksm));\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tenc,\n\t\t\t\tsharedSecret: await this._generateSharedSecret(dh, kemContext)\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tthrow new EncapError(e);\n\t\t}\n\t}\n\tasync decap(params) {\n\t\tconst enc = toArrayBuffer(params.enc);\n\t\tconst pke = await this._prim.deserializePublicKey(enc);\n\t\tconst skr = isCryptoKeyPair(params.recipientKey) ? params.recipientKey.privateKey : params.recipientKey;\n\t\tconst pkr = isCryptoKeyPair(params.recipientKey) ? params.recipientKey.publicKey : await this._prim.derivePublicKey(params.recipientKey);\n\t\tconst pkrm = await this._prim.serializePublicKey(pkr);\n\t\ttry {\n\t\t\tlet dh;\n\t\t\tif (params.senderPublicKey === void 0) dh = new Uint8Array(await this._prim.dh(skr, pke));\n\t\t\telse dh = concat(new Uint8Array(await this._prim.dh(skr, pke)), new Uint8Array(await this._prim.dh(skr, params.senderPublicKey)));\n\t\t\tlet kemContext;\n\t\t\tif (params.senderPublicKey === void 0) kemContext = concat(new Uint8Array(enc), new Uint8Array(pkrm));\n\t\t\telse {\n\t\t\t\tconst pksm = await this._prim.serializePublicKey(params.senderPublicKey);\n\t\t\t\tkemContext = new Uint8Array(enc.byteLength + pkrm.byteLength + pksm.byteLength);\n\t\t\t\tkemContext.set(new Uint8Array(enc), 0);\n\t\t\t\tkemContext.set(new Uint8Array(pkrm), enc.byteLength);\n\t\t\t\tkemContext.set(new Uint8Array(pksm), enc.byteLength + pkrm.byteLength);\n\t\t\t}\n\t\t\treturn await this._generateSharedSecret(dh, kemContext);\n\t\t} catch (e) {\n\t\t\tthrow new DecapError(e);\n\t\t}\n\t}\n\tasync _generateSharedSecret(dh, kemContext) {\n\t\tconst labeledIkm = this._kdf.buildLabeledIkm(LABEL_EAE_PRK, dh);\n\t\tconst labeledInfo = this._kdf.buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, this.secretSize);\n\t\treturn await this._kdf.extractAndExpand(EMPTY, labeledIkm, labeledInfo, this.secretSize);\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/dhkemPrimitives.js\nconst KEM_USAGES = [\"deriveBits\"];\nconst LABEL_DKP_PRK = /* @__PURE__ */ new Uint8Array([\n\t100,\n\t107,\n\t112,\n\t95,\n\t112,\n\t114,\n\t107\n]);\nconst LABEL_SK = /* @__PURE__ */ new Uint8Array([115, 107]);\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/aeadEncryptionContext.js\nconst AEAD_USAGES = [\"encrypt\", \"decrypt\"];\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/aeads/aesGcm.js\nvar AesGcmContext = class extends NativeAlgorithm {\n\tconstructor(key) {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"_rawKey\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_key\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tthis._rawKey = toArrayBuffer(key);\n\t}\n\tasync seal(iv, data, aad) {\n\t\tawait this._setupKey();\n\t\tconst alg = {\n\t\t\tname: \"AES-GCM\",\n\t\t\tiv: toArrayBuffer(iv),\n\t\t\tadditionalData: toArrayBuffer(aad)\n\t\t};\n\t\treturn await this._api.encrypt(alg, this._key, toArrayBuffer(data));\n\t}\n\tasync open(iv, data, aad) {\n\t\tawait this._setupKey();\n\t\tconst alg = {\n\t\t\tname: \"AES-GCM\",\n\t\t\tiv: toArrayBuffer(iv),\n\t\t\tadditionalData: toArrayBuffer(aad)\n\t\t};\n\t\treturn await this._api.decrypt(alg, this._key, toArrayBuffer(data));\n\t}\n\tasync _setupKey() {\n\t\tif (this._key !== void 0) return;\n\t\tawait this._setup();\n\t\tconst key = await this._importKey(this._rawKey);\n\t\tnew Uint8Array(this._rawKey).fill(0);\n\t\tthis._key = key;\n\t}\n\tasync _importKey(key) {\n\t\treturn await this._api.importKey(\"raw\", key, { name: \"AES-GCM\" }, true, AEAD_USAGES);\n\t}\n};\n/**\n* The AES-128-GCM for HPKE AEAD implementing {@link AeadInterface}.\n*\n* When using `@hpke/core`, the instance of this class must be specified\n* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes128Gcm`.\n*\n* @example\n*\n* ```ts\n* import {\n* Aes128Gcm,\n* CipherSuite,\n* DhkemP256HkdfSha256,\n* HkdfSha256,\n* } from \"@hpke/core\";\n*\n* const suite = new CipherSuite({\n* kem: new DhkemP256HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes128Gcm(),\n* });\n* ```\n*/\nvar Aes128Gcm = class {\n\tconstructor() {\n\t\t/** AeadId.Aes128Gcm (0x0001) */\n\t\tObject.defineProperty(this, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: AeadId.Aes128Gcm\n\t\t});\n\t\t/** 16 */\n\t\tObject.defineProperty(this, \"keySize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 16\n\t\t});\n\t\t/** 12 */\n\t\tObject.defineProperty(this, \"nonceSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 12\n\t\t});\n\t\t/** 16 */\n\t\tObject.defineProperty(this, \"tagSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 16\n\t\t});\n\t}\n\tcreateEncryptionContext(key) {\n\t\treturn new AesGcmContext(key);\n\t}\n};\n/**\n* The AES-256-GCM for HPKE AEAD implementing {@link AeadInterface}.\n*\n* When using `@hpke/core`, the instance of this class must be specified\n* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes256Gcm`\n* as follows:\n*\n* @example\n*\n* ```ts\n* import {\n* Aes256Gcm,\n* CipherSuite,\n* DhkemP256HkdfSha256,\n* HkdfSha256,\n* } from \"@hpke/core\";\n*\n* const suite = new CipherSuite({\n* kem: new DhkemP256HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes256Gcm(),\n* });\n* ```\n*/\nvar Aes256Gcm = class extends Aes128Gcm {\n\tconstructor() {\n\t\tsuper(...arguments);\n\t\t/** AeadId.Aes256Gcm (0x0002) */\n\t\tObject.defineProperty(this, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: AeadId.Aes256Gcm\n\t\t});\n\t\t/** 32 */\n\t\tObject.defineProperty(this, \"keySize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 32\n\t\t});\n\t\t/** 12 */\n\t\tObject.defineProperty(this, \"nonceSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 12\n\t\t});\n\t\t/** 16 */\n\t\tObject.defineProperty(this, \"tagSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 16\n\t\t});\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js\nfunction emitNotSupported() {\n\treturn new Promise((_resolve, reject) => {\n\t\treject(new NotSupportedError(\"Not supported\"));\n\t});\n}\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/exporterContext.js\nconst LABEL_SEC = new Uint8Array([\n\t115,\n\t101,\n\t99\n]);\nvar ExporterContextImpl = class {\n\tconstructor(api, kdf, exporterSecret) {\n\t\tObject.defineProperty(this, \"_api\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"exporterSecret\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_kdf\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tthis._api = api;\n\t\tthis._kdf = kdf;\n\t\tthis.exporterSecret = exporterSecret;\n\t}\n\tasync seal(_data, _aad) {\n\t\treturn await emitNotSupported();\n\t}\n\tasync open(_data, _aad) {\n\t\treturn await emitNotSupported();\n\t}\n\tasync export(exporterContext, len) {\n\t\tconst rawExporterContext = toArrayBuffer(exporterContext);\n\t\tif (rawExporterContext.byteLength > 8192) throw new InvalidParamError(\"Too long exporter context\");\n\t\ttry {\n\t\t\treturn await this._kdf.labeledExpand(this.exporterSecret, LABEL_SEC, new Uint8Array(rawExporterContext), len);\n\t\t} catch (e) {\n\t\t\tthrow new ExportError(e);\n\t\t}\n\t}\n};\nvar RecipientExporterContextImpl = class extends ExporterContextImpl {};\nvar SenderExporterContextImpl = class extends ExporterContextImpl {\n\tconstructor(api, kdf, exporterSecret, enc) {\n\t\tsuper(api, kdf, exporterSecret);\n\t\tObject.defineProperty(this, \"enc\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tthis.enc = enc;\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/encryptionContext.js\nvar EncryptionContextImpl = class extends ExporterContextImpl {\n\tconstructor(api, kdf, params) {\n\t\tsuper(api, kdf, params.exporterSecret);\n\t\tObject.defineProperty(this, \"_aead\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_nK\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_nN\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_nT\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_ctx\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tif (params.key === void 0 || params.baseNonce === void 0 || params.seq === void 0) throw new Error(\"Required parameters are missing\");\n\t\tthis._aead = params.aead;\n\t\tthis._nK = this._aead.keySize;\n\t\tthis._nN = this._aead.nonceSize;\n\t\tthis._nT = this._aead.tagSize;\n\t\tconst key = this._aead.createEncryptionContext(params.key);\n\t\tthis._ctx = {\n\t\t\tkey,\n\t\t\tbaseNonce: params.baseNonce,\n\t\t\tseq: params.seq\n\t\t};\n\t}\n\tcomputeNonce(k) {\n\t\tconst seqBytes = i2Osp(k.seq, k.baseNonce.byteLength);\n\t\treturn xor(k.baseNonce, seqBytes).buffer;\n\t}\n\tincrementSeq(k) {\n\t\tif (k.seq > Number.MAX_SAFE_INTEGER) throw new MessageLimitReachedError(\"Message limit reached\");\n\t\tk.seq += 1;\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/mutex.js\nvar __classPrivateFieldGet$2 = function(receiver, state, kind, f) {\n\tif (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n\tif (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n\treturn kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {\n\tif (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n\tif (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n\tif (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n\treturn kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n};\nvar _Mutex_locked;\nvar Mutex = class {\n\tconstructor() {\n\t\t_Mutex_locked.set(this, Promise.resolve());\n\t}\n\tasync lock() {\n\t\tlet releaseLock;\n\t\tconst nextLock = new Promise((resolve) => {\n\t\t\treleaseLock = resolve;\n\t\t});\n\t\tconst previousLock = __classPrivateFieldGet$2(this, _Mutex_locked, \"f\");\n\t\t__classPrivateFieldSet$2(this, _Mutex_locked, nextLock, \"f\");\n\t\tawait previousLock;\n\t\treturn releaseLock;\n\t}\n};\n_Mutex_locked = /* @__PURE__ */ new WeakMap();\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/recipientContext.js\nvar __classPrivateFieldGet$1 = function(receiver, state, kind, f) {\n\tif (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n\tif (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n\treturn kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet$1 = function(receiver, state, value, kind, f) {\n\tif (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n\tif (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n\tif (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n\treturn kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n};\nvar _RecipientContextImpl_mutex;\nvar RecipientContextImpl = class extends EncryptionContextImpl {\n\tconstructor() {\n\t\tsuper(...arguments);\n\t\t_RecipientContextImpl_mutex.set(this, void 0);\n\t}\n\tasync open(data, aad = EMPTY.buffer) {\n\t\t__classPrivateFieldSet$1(this, _RecipientContextImpl_mutex, __classPrivateFieldGet$1(this, _RecipientContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n\t\tconst release = await __classPrivateFieldGet$1(this, _RecipientContextImpl_mutex, \"f\").lock();\n\t\tlet pt;\n\t\ttry {\n\t\t\tpt = await this._ctx.key.open(this.computeNonce(this._ctx), toArrayBuffer(data), toArrayBuffer(aad));\n\t\t} catch (e) {\n\t\t\tthrow new OpenError(e);\n\t\t} finally {\n\t\t\trelease();\n\t\t}\n\t\tthis.incrementSeq(this._ctx);\n\t\treturn pt;\n\t}\n};\n_RecipientContextImpl_mutex = /* @__PURE__ */ new WeakMap();\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/senderContext.js\nvar __classPrivateFieldGet = function(receiver, state, kind, f) {\n\tif (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n\tif (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n\treturn kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = function(receiver, state, value, kind, f) {\n\tif (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n\tif (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n\tif (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n\treturn kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n};\nvar _SenderContextImpl_mutex;\nvar SenderContextImpl = class extends EncryptionContextImpl {\n\tconstructor(api, kdf, params, enc) {\n\t\tsuper(api, kdf, params);\n\t\tObject.defineProperty(this, \"enc\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\t_SenderContextImpl_mutex.set(this, void 0);\n\t\tthis.enc = enc;\n\t}\n\tasync seal(data, aad = EMPTY.buffer) {\n\t\t__classPrivateFieldSet(this, _SenderContextImpl_mutex, __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n\t\tconst release = await __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\").lock();\n\t\tlet ct;\n\t\ttry {\n\t\t\tct = await this._ctx.key.seal(this.computeNonce(this._ctx), toArrayBuffer(data), toArrayBuffer(aad));\n\t\t} catch (e) {\n\t\t\tthrow new SealError(e);\n\t\t} finally {\n\t\t\trelease();\n\t\t}\n\t\tthis.incrementSeq(this._ctx);\n\t\treturn ct;\n\t}\n};\n_SenderContextImpl_mutex = /* @__PURE__ */ new WeakMap();\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/cipherSuiteNative.js\nconst LABEL_BASE_NONCE = new Uint8Array([\n\t98,\n\t97,\n\t115,\n\t101,\n\t95,\n\t110,\n\t111,\n\t110,\n\t99,\n\t101\n]);\nconst LABEL_EXP = new Uint8Array([\n\t101,\n\t120,\n\t112\n]);\nconst LABEL_INFO_HASH = new Uint8Array([\n\t105,\n\t110,\n\t102,\n\t111,\n\t95,\n\t104,\n\t97,\n\t115,\n\t104\n]);\nconst LABEL_KEY = new Uint8Array([\n\t107,\n\t101,\n\t121\n]);\nconst LABEL_PSK_ID_HASH = new Uint8Array([\n\t112,\n\t115,\n\t107,\n\t95,\n\t105,\n\t100,\n\t95,\n\t104,\n\t97,\n\t115,\n\t104\n]);\nconst LABEL_SECRET = new Uint8Array([\n\t115,\n\t101,\n\t99,\n\t114,\n\t101,\n\t116\n]);\nconst SUITE_ID_HEADER_HPKE = new Uint8Array([\n\t72,\n\t80,\n\t75,\n\t69,\n\t0,\n\t0,\n\t0,\n\t0,\n\t0,\n\t0\n]);\n/**\n* The Hybrid Public Key Encryption (HPKE) ciphersuite,\n* which is implemented using only\n* {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n*\n* This is the super class of {@link CipherSuite} and the same as\n* {@link https://jsr.io/@hpke/core/doc/~/CipherSuite | @hpke/core#CipherSuite} as follows:\n* which supports only the ciphersuites that can be implemented on the native\n* {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n* Therefore, the following cryptographic algorithms are not supported for now:\n* - DHKEM(X25519, HKDF-SHA256)\n* - DHKEM(X448, HKDF-SHA512)\n* - ChaCha20Poly1305\n*\n* In addtion, the HKDF functions contained in this class can only derive\n* keys of the same length as the `hashSize`.\n*\n* If you want to use the unsupported cryptographic algorithms\n* above or derive keys longer than the `hashSize`,\n* please use {@link CipherSuite}.\n*\n* This class provides following functions:\n*\n* - Creates encryption contexts both for senders and recipients.\n* - {@link createSenderContext}\n* - {@link createRecipientContext}\n* - Provides single-shot encryption API.\n* - {@link seal}\n* - {@link open}\n*\n* The calling of the constructor of this class is the starting\n* point for HPKE operations for both senders and recipients.\n*\n* @example Use only ciphersuites supported by Web Cryptography API.\n*\n* ```ts\n* import {\n* Aes128Gcm,\n* DhkemP256HkdfSha256,\n* HkdfSha256,\n* CipherSuite,\n* } from \"@hpke/core\";\n*\n* const suite = new CipherSuite({\n* kem: new DhkemP256HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes128Gcm(),\n* });\n* ```\n*\n* @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n*\n* ```ts\n* import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n* // Use an extension module.\n* import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n*\n* const suite = new CipherSuite({\n* kem: new DhkemX25519HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes128Gcm(),\n* });\n* ```\n*/\nvar CipherSuiteNative = class extends NativeAlgorithm {\n\t/**\n\t* @param params A set of parameters for building a cipher suite.\n\t*\n\t* If the error occurred, throws {@link InvalidParamError}.\n\t*\n\t* @throws {@link InvalidParamError}\n\t*/\n\tconstructor(params) {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"_kem\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_kdf\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_aead\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_suiteId\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tif (typeof params.kem === \"number\") throw new InvalidParamError(\"KemId cannot be used\");\n\t\tthis._kem = params.kem;\n\t\tif (typeof params.kdf === \"number\") throw new InvalidParamError(\"KdfId cannot be used\");\n\t\tthis._kdf = params.kdf;\n\t\tif (typeof params.aead === \"number\") throw new InvalidParamError(\"AeadId cannot be used\");\n\t\tthis._aead = params.aead;\n\t\tthis._suiteId = new Uint8Array(SUITE_ID_HEADER_HPKE);\n\t\tthis._suiteId.set(i2Osp(this._kem.id, 2), 4);\n\t\tthis._suiteId.set(i2Osp(this._kdf.id, 2), 6);\n\t\tthis._suiteId.set(i2Osp(this._aead.id, 2), 8);\n\t\tthis._kdf.init(this._suiteId);\n\t}\n\t/**\n\t* Gets the KEM context of the ciphersuite.\n\t*/\n\tget kem() {\n\t\treturn this._kem;\n\t}\n\t/**\n\t* Gets the KDF context of the ciphersuite.\n\t*/\n\tget kdf() {\n\t\treturn this._kdf;\n\t}\n\t/**\n\t* Gets the AEAD context of the ciphersuite.\n\t*/\n\tget aead() {\n\t\treturn this._aead;\n\t}\n\t/**\n\t* Creates an encryption context for a sender.\n\t*\n\t* If the error occurred, throws {@link DecapError} | {@link ValidationError}.\n\t*\n\t* @param params A set of parameters for the sender encryption context.\n\t* @returns A sender encryption context.\n\t* @throws {@link EncapError}, {@link ValidationError}\n\t*/\n\tasync createSenderContext(params) {\n\t\tthis._validateInputLength(params);\n\t\tawait this._setup();\n\t\tconst dh = await this._kem.encap(params);\n\t\tlet mode;\n\t\tif (params.psk !== void 0) mode = params.senderKey !== void 0 ? Mode.AuthPsk : Mode.Psk;\n\t\telse mode = params.senderKey !== void 0 ? Mode.Auth : Mode.Base;\n\t\treturn await this._keyScheduleS(mode, dh.sharedSecret, dh.enc, params);\n\t}\n\t/**\n\t* Creates an encryption context for a recipient.\n\t*\n\t* If the error occurred, throws {@link DecapError}\n\t* | {@link DeserializeError} | {@link ValidationError}.\n\t*\n\t* @param params A set of parameters for the recipient encryption context.\n\t* @returns A recipient encryption context.\n\t* @throws {@link DecapError}, {@link DeserializeError}, {@link ValidationError}\n\t*/\n\tasync createRecipientContext(params) {\n\t\tthis._validateInputLength(params);\n\t\tawait this._setup();\n\t\tconst sharedSecret = await this._kem.decap(params);\n\t\tlet mode;\n\t\tif (params.psk !== void 0) mode = params.senderPublicKey !== void 0 ? Mode.AuthPsk : Mode.Psk;\n\t\telse mode = params.senderPublicKey !== void 0 ? Mode.Auth : Mode.Base;\n\t\treturn await this._keyScheduleR(mode, sharedSecret, params);\n\t}\n\t/**\n\t* Encrypts a message to a recipient.\n\t*\n\t* If the error occurred, throws `EncapError` | `MessageLimitReachedError` | `SealError` | `ValidationError`.\n\t*\n\t* @param params A set of parameters for building a sender encryption context.\n\t* @param pt A plain text as bytes to be encrypted.\n\t* @param aad Additional authenticated data as bytes fed by an application.\n\t* @returns A cipher text and an encapsulated key as bytes.\n\t* @throws {@link EncapError}, {@link MessageLimitReachedError}, {@link SealError}, {@link ValidationError}\n\t*/\n\tasync seal(params, pt, aad = EMPTY.buffer) {\n\t\tconst ctx = await this.createSenderContext(params);\n\t\treturn {\n\t\t\tct: await ctx.seal(pt, aad),\n\t\t\tenc: ctx.enc\n\t\t};\n\t}\n\t/**\n\t* Decrypts a message from a sender.\n\t*\n\t* If the error occurred, throws `DecapError` | `DeserializeError` | `OpenError` | `ValidationError`.\n\t*\n\t* @param params A set of parameters for building a recipient encryption context.\n\t* @param ct An encrypted text as bytes to be decrypted.\n\t* @param aad Additional authenticated data as bytes fed by an application.\n\t* @returns A decrypted plain text as bytes.\n\t* @throws {@link DecapError}, {@link DeserializeError}, {@link OpenError}, {@link ValidationError}\n\t*/\n\tasync open(params, ct, aad = EMPTY.buffer) {\n\t\treturn await (await this.createRecipientContext(params)).open(ct, aad);\n\t}\n\tasync _keySchedule(mode, sharedSecret, params) {\n\t\tconst pskId = params.psk === void 0 ? EMPTY : toUint8Array(params.psk.id);\n\t\tconst pskIdHash = await this._kdf.labeledExtract(EMPTY, LABEL_PSK_ID_HASH, pskId);\n\t\tconst info = params.info === void 0 ? EMPTY : toUint8Array(params.info);\n\t\tconst infoHash = await this._kdf.labeledExtract(EMPTY, LABEL_INFO_HASH, info);\n\t\tconst keyScheduleContext = new Uint8Array(1 + pskIdHash.byteLength + infoHash.byteLength);\n\t\tkeyScheduleContext.set(new Uint8Array([mode]), 0);\n\t\tkeyScheduleContext.set(new Uint8Array(pskIdHash), 1);\n\t\tkeyScheduleContext.set(new Uint8Array(infoHash), 1 + pskIdHash.byteLength);\n\t\tconst psk = params.psk === void 0 ? EMPTY : toUint8Array(params.psk.key);\n\t\tconst ikm = this._kdf.buildLabeledIkm(LABEL_SECRET, psk);\n\t\tconst exporterSecretInfo = this._kdf.buildLabeledInfo(LABEL_EXP, keyScheduleContext, this._kdf.hashSize);\n\t\tconst exporterSecret = await this._kdf.extractAndExpand(sharedSecret, ikm, exporterSecretInfo, this._kdf.hashSize);\n\t\tif (this._aead.id === AeadId.ExportOnly) return {\n\t\t\taead: this._aead,\n\t\t\texporterSecret\n\t\t};\n\t\tconst keyInfo = this._kdf.buildLabeledInfo(LABEL_KEY, keyScheduleContext, this._aead.keySize);\n\t\tconst key = await this._kdf.extractAndExpand(sharedSecret, ikm, keyInfo, this._aead.keySize);\n\t\tconst baseNonceInfo = this._kdf.buildLabeledInfo(LABEL_BASE_NONCE, keyScheduleContext, this._aead.nonceSize);\n\t\tconst baseNonce = await this._kdf.extractAndExpand(sharedSecret, ikm, baseNonceInfo, this._aead.nonceSize);\n\t\treturn {\n\t\t\taead: this._aead,\n\t\t\texporterSecret,\n\t\t\tkey,\n\t\t\tbaseNonce: new Uint8Array(baseNonce),\n\t\t\tseq: 0\n\t\t};\n\t}\n\tasync _keyScheduleS(mode, sharedSecret, enc, params) {\n\t\tconst res = await this._keySchedule(mode, sharedSecret, params);\n\t\tif (res.key === void 0) return new SenderExporterContextImpl(this._api, this._kdf, res.exporterSecret, enc);\n\t\treturn new SenderContextImpl(this._api, this._kdf, res, enc);\n\t}\n\tasync _keyScheduleR(mode, sharedSecret, params) {\n\t\tconst res = await this._keySchedule(mode, sharedSecret, params);\n\t\tif (res.key === void 0) return new RecipientExporterContextImpl(this._api, this._kdf, res.exporterSecret);\n\t\treturn new RecipientContextImpl(this._api, this._kdf, res);\n\t}\n\t_validateInputLength(params) {\n\t\tif (params.info !== void 0 && params.info.byteLength > 268435456) throw new InvalidParamError(\"Too long info\");\n\t\tif (params.psk !== void 0) {\n\t\t\tif (params.psk.key.byteLength < 32) throw new InvalidParamError(`PSK must have at least 32 bytes`);\n\t\t\tif (params.psk.key.byteLength > 8192) throw new InvalidParamError(\"Too long psk.key\");\n\t\t\tif (params.psk.id.byteLength > 8192) throw new InvalidParamError(\"Too long psk.id\");\n\t\t}\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/native.js\n/**\n* The Hybrid Public Key Encryption (HPKE) ciphersuite,\n* which is implemented using only\n* {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n*\n* This class is the same as\n* {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteNative | @hpke/core#CipherSuiteNative} as follows:\n* which supports only the ciphersuites that can be implemented on the native\n* {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n* Therefore, the following cryptographic algorithms are not supported for now:\n* - `DHKEM(X448, HKDF-SHA512)`\n* - `ChaCha20Poly1305`\n*\n* In addtion, the HKDF functions contained in this `CipherSuiteNative`\n* class can only derive keys of the same length as the `hashSize`.\n*\n* If you want to use the unsupported cryptographic algorithms\n* above or derive keys longer than the `hashSize`,\n* please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n*\n* This class provides following functions:\n*\n* - Creates encryption contexts both for senders and recipients.\n* - {@link createSenderContext}\n* - {@link createRecipientContext}\n* - Provides single-shot encryption API.\n* - {@link seal}\n* - {@link open}\n*\n* The calling of the constructor of this class is the starting\n* point for HPKE operations for both senders and recipients.\n*\n* @example Use only ciphersuites supported by Web Cryptography API.\n*\n* ```ts\n* import {\n* Aes128Gcm,\n* DhkemP256HkdfSha256,\n* HkdfSha256,\n* CipherSuite,\n* } from \"@hpke/core\";\n*\n* const suite = new CipherSuite({\n* kem: new DhkemP256HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes128Gcm(),\n* });\n* ```\n*\n* @example Use DHKEM(X25519, HKDF-SHA256).\n*\n* ```ts\n* import {\n* Aes128Gcm,\n* CipherSuite,\n* DhkemX25519HkdfSha256,\n* HkdfSha256,\n* } from \"@hpke/core\";\n* const suite = new CipherSuite({\n* kem: new DhkemX25519HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes128Gcm(),\n* });\n* ```\n*/\nvar CipherSuite = class extends CipherSuiteNative {};\n/**\n* The HKDF-SHA256 for HPKE KDF implementing {@link KdfInterface}.\n*\n* When using `@hpke/core`, the instance of this class must be specified\n* to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha256`.\n*\n* The KDF class can only derive keys of the same length as the `hashSize`.\n* If you want to derive keys longer than the `hashSize`,\n* please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n*\n* @example\n*\n* ```ts\n* import {\n* Aes128Gcm,\n* CipherSuite,\n* DhkemP256HkdfSha256,\n* HkdfSha256,\n* } from \"@hpke/core\";\n*\n* const suite = new CipherSuite({\n* kem: new DhkemP256HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes128Gcm(),\n* });\n* ```\n*/\nvar HkdfSha256 = class extends HkdfSha256Native {};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js\nconst ALG_NAME = \"X25519\";\nconst PKCS8_ALG_ID_X25519 = new Uint8Array([\n\t48,\n\t46,\n\t2,\n\t1,\n\t0,\n\t48,\n\t5,\n\t6,\n\t3,\n\t43,\n\t101,\n\t110,\n\t4,\n\t34,\n\t4,\n\t32\n]);\nconst BASE_POINT_X25519 = /* @__PURE__ */ (() => {\n\tconst p = /* @__PURE__ */ new Uint8Array(32);\n\tp[0] = 9;\n\treturn p;\n})();\nvar X25519 = class extends NativeAlgorithm {\n\tconstructor(hkdf) {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"_hkdf\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_alg\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_nPk\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_nSk\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_nDh\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tObject.defineProperty(this, \"_pkcs8AlgId\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tthis._alg = { name: ALG_NAME };\n\t\tthis._hkdf = hkdf;\n\t\tthis._nPk = 32;\n\t\tthis._nSk = 32;\n\t\tthis._nDh = 32;\n\t\tthis._pkcs8AlgId = PKCS8_ALG_ID_X25519;\n\t}\n\tasync serializePublicKey(key) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\treturn await this._api.exportKey(\"raw\", key);\n\t\t} catch (e) {\n\t\t\tthrow new SerializeError(e);\n\t\t}\n\t}\n\tasync deserializePublicKey(key) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\treturn await this._importRawKey(toArrayBuffer(key), true);\n\t\t} catch (e) {\n\t\t\tthrow new DeserializeError(e);\n\t\t}\n\t}\n\tasync serializePrivateKey(key) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\tconst jwk = await this._api.exportKey(\"jwk\", key);\n\t\t\tif (!(\"d\" in jwk)) throw new Error(\"Not private key\");\n\t\t\treturn base64UrlToBytes(jwk[\"d\"]).buffer;\n\t\t} catch (e) {\n\t\t\tthrow new SerializeError(e);\n\t\t}\n\t}\n\tasync deserializePrivateKey(key) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\treturn await this._importRawKey(toArrayBuffer(key), false);\n\t\t} catch (e) {\n\t\t\tthrow new DeserializeError(e);\n\t\t}\n\t}\n\tasync importKey(format, key, isPublic) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\tif (format === \"raw\") return await this._importRawKey(key, isPublic);\n\t\t\tif (key instanceof ArrayBuffer) throw new Error(\"Invalid jwk key format\");\n\t\t\treturn await this._importJWK(key, isPublic);\n\t\t} catch (e) {\n\t\t\tthrow new DeserializeError(e);\n\t\t}\n\t}\n\tasync generateKeyPair() {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\treturn await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n\t\t} catch (e) {\n\t\t\tthrow new NotSupportedError(e);\n\t\t}\n\t}\n\tasync deriveKeyPair(ikm) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\tconst rawIkm = toArrayBuffer(ikm);\n\t\t\tconst dkpPrk = await this._hkdf.labeledExtract(EMPTY, LABEL_DKP_PRK, new Uint8Array(rawIkm));\n\t\t\tconst rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n\t\t\tconst rawSkBytes = new Uint8Array(rawSk);\n\t\t\tconst sk = await this._deserializePkcs8Key(rawSkBytes);\n\t\t\trawSkBytes.fill(0);\n\t\t\treturn {\n\t\t\t\tprivateKey: sk,\n\t\t\t\tpublicKey: await this.derivePublicKey(sk)\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tthrow new DeriveKeyPairError(e);\n\t\t}\n\t}\n\tasync derivePublicKey(key) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\tconst jwk = await this._api.exportKey(\"jwk\", key);\n\t\t\tdelete jwk[\"d\"];\n\t\t\tdelete jwk[\"key_ops\"];\n\t\t\treturn await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n\t\t} catch {\n\t\t\ttry {\n\t\t\t\tconst bp = await this._api.importKey(\"raw\", BASE_POINT_X25519.buffer, this._alg, true, []);\n\t\t\t\tconst bits = await this._api.deriveBits({\n\t\t\t\t\tname: ALG_NAME,\n\t\t\t\t\tpublic: bp\n\t\t\t\t}, key, this._nPk * 8);\n\t\t\t\treturn await this._api.importKey(\"raw\", bits, this._alg, true, []);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new DeserializeError(e);\n\t\t\t}\n\t\t}\n\t}\n\tasync dh(sk, pk) {\n\t\tawait this._setup();\n\t\ttry {\n\t\t\treturn await this._api.deriveBits({\n\t\t\t\tname: ALG_NAME,\n\t\t\t\tpublic: pk\n\t\t\t}, sk, this._nDh * 8);\n\t\t} catch (e) {\n\t\t\tthrow new SerializeError(e);\n\t\t}\n\t}\n\tasync _importRawKey(key, isPublic) {\n\t\tif (isPublic && key.byteLength !== this._nPk) throw new Error(\"Invalid public key for the ciphersuite\");\n\t\tif (!isPublic && key.byteLength !== this._nSk) throw new Error(\"Invalid private key for the ciphersuite\");\n\t\tif (isPublic) return await this._api.importKey(\"raw\", key, this._alg, true, []);\n\t\treturn await this._deserializePkcs8Key(new Uint8Array(key));\n\t}\n\tasync _importJWK(key, isPublic) {\n\t\tif (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") throw new Error(`Invalid kty: ${key.crv}`);\n\t\tif (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) throw new Error(`Invalid crv: ${key.crv}`);\n\t\tif (isPublic) {\n\t\t\tif (typeof key.d !== \"undefined\") throw new Error(\"Invalid key: `d` should not be set\");\n\t\t\treturn await this._api.importKey(\"jwk\", key, this._alg, true, []);\n\t\t}\n\t\tif (typeof key.d === \"undefined\") throw new Error(\"Invalid key: `d` not found\");\n\t\treturn await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n\t}\n\tasync _deserializePkcs8Key(k) {\n\t\tconst pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n\t\tpkcs8Key.set(this._pkcs8AlgId, 0);\n\t\tpkcs8Key.set(k, this._pkcs8AlgId.length);\n\t\treturn await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n\t}\n};\n//#endregion\n//#region ../../../../node_modules/.pnpm/@hpke+core@1.9.0/node_modules/@hpke/core/esm/src/kems/dhkemX25519.js\n/**\n* The DHKEM(X25519, HKDF-SHA256) for HPKE KEM implementing {@link KemInterface}.\n*\n* The instance of this class can be specified to the\n* {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteParams | CipherSuiteParams} as follows:\n*\n* @example\n*\n* ```ts\n* import {\n* Aes128Gcm,\n* CipherSuite,\n* HkdfSha256,\n* DhkemX25519HkdfSha256,\n* } from \"@hpke/core\";\n*\n* const suite = new CipherSuite({\n* kem: new DhkemX25519HkdfSha256(),\n* kdf: new HkdfSha256(),\n* aead: new Aes128Gcm(),\n* });\n* ```\n*/\nvar DhkemX25519HkdfSha256 = class extends Dhkem {\n\tconstructor() {\n\t\tconst kdf = new HkdfSha256Native();\n\t\tsuper(KemId.DhkemX25519HkdfSha256, new X25519(kdf), kdf);\n\t\t/** KemId.DhkemX25519HkdfSha256 (0x0020) */\n\t\tObject.defineProperty(this, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: KemId.DhkemX25519HkdfSha256\n\t\t});\n\t\t/** 32 */\n\t\tObject.defineProperty(this, \"secretSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 32\n\t\t});\n\t\t/** 32 */\n\t\tObject.defineProperty(this, \"encSize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 32\n\t\t});\n\t\t/** 32 */\n\t\tObject.defineProperty(this, \"publicKeySize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 32\n\t\t});\n\t\t/** 32 */\n\t\tObject.defineProperty(this, \"privateKeySize\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: 32\n\t\t});\n\t}\n};\n//#endregion\n//#region src/crypto/ed25519CryptoProvider.ts\n/**\n* The single place in hubrpc that touches the Web Crypto API\n* (`globalThis.crypto.subtle`). These low-level functions are surfaced to the\n* rest of the codebase through the `./crypto` facade — import from there, not\n* from this file.\n*\n* Web Crypto is available unchanged in modern browsers and in Node 20+, so\n* there is no longer a node-specific vs. web-specific implementation — this\n* one file works in both runtimes.\n*/\nconst _PKCS8_PREFIX = new Uint8Array([\n\t48,\n\t46,\n\t2,\n\t1,\n\t0,\n\t48,\n\t5,\n\t6,\n\t3,\n\t43,\n\t101,\n\t112,\n\t4,\n\t34,\n\t4,\n\t32\n]);\nconst _PKCS8_X25519_PREFIX = new Uint8Array([\n\t48,\n\t46,\n\t2,\n\t1,\n\t0,\n\t48,\n\t5,\n\t6,\n\t3,\n\t43,\n\t101,\n\t110,\n\t4,\n\t34,\n\t4,\n\t32\n]);\nfunction _wrapPkcs8(seed, prefix = _PKCS8_PREFIX) {\n\tconst out = new Uint8Array(prefix.length + seed.length);\n\tout.set(prefix, 0);\n\tout.set(seed, prefix.length);\n\treturn out;\n}\nconst _ALG = \"Ed25519\";\nconst _ENC_LEN = 32;\nlet _hpkeSuiteInstance;\nfunction _hpkeSuite() {\n\treturn _hpkeSuiteInstance ??= new CipherSuite({\n\t\tkem: new DhkemX25519HkdfSha256(),\n\t\tkdf: new HkdfSha256(),\n\t\taead: new Aes256Gcm()\n\t});\n}\nfunction _concat(a, b) {\n\tconst out = new Uint8Array(a.length + b.length);\n\tout.set(a, 0);\n\tout.set(b, a.length);\n\treturn out;\n}\nfunction _toBuffer(bytes) {\n\treturn bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);\n}\n/** Generate a fresh Ed25519 keypair (raw 32-byte seed + 32-byte public key). */\nasync function generateEd25519Keypair() {\n\tconst kp = await crypto.subtle.generateKey(_ALG, true, [\"sign\", \"verify\"]);\n\tconst pub = new Uint8Array(await crypto.subtle.exportKey(\"raw\", kp.publicKey));\n\tconst pkcs8 = new Uint8Array(await crypto.subtle.exportKey(\"pkcs8\", kp.privateKey));\n\treturn {\n\t\tpublicKey: pub,\n\t\tprivateKey: new Uint8Array(pkcs8.subarray(pkcs8.length - 32))\n\t};\n}\n/** Ed25519 sign `message` with a raw 32-byte seed private key. */\nasync function ed25519Sign(privateKey, message) {\n\tconst key = await crypto.subtle.importKey(\"pkcs8\", _wrapPkcs8(privateKey), _ALG, false, [\"sign\"]);\n\tconst sig = await crypto.subtle.sign(_ALG, key, new Uint8Array(message));\n\treturn new Uint8Array(sig);\n}\n/** Ed25519 verify. Returns `false` (never throws) on malformed input. */\nasync function ed25519Verify(publicKey, message, sig) {\n\ttry {\n\t\tconst key = await crypto.subtle.importKey(\"raw\", new Uint8Array(publicKey), _ALG, false, [\"verify\"]);\n\t\treturn await crypto.subtle.verify(_ALG, key, new Uint8Array(sig), new Uint8Array(message));\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Deterministically derive an Ed25519 keypair from a raw 32-byte seed (the\n* seed *is* the private key). The public key is recovered via a JWK round-trip\n* (`importKey` pkcs8 → `exportKey` jwk → `x`). For tests / reproducible\n* identities — NOT for production key generation, which must be random.\n*/\nasync function ed25519KeypairFromSeed(seed) {\n\tif (seed.length !== 32) throw new Error(\"ed25519KeypairFromSeed: seed must be 32 bytes\");\n\tconst key = await crypto.subtle.importKey(\"pkcs8\", _wrapPkcs8(seed), _ALG, true, [\"sign\"]);\n\tconst jwk = await crypto.subtle.exportKey(\"jwk\", key);\n\tif (!jwk.x) throw new Error(\"ed25519KeypairFromSeed: failed to derive public key\");\n\treturn {\n\t\tpublicKey: base64UrlToBytes$1(jwk.x),\n\t\tprivateKey: new Uint8Array(seed)\n\t};\n}\n/**\n* Deterministically derive an X25519 keypair from a raw 32-byte scalar (the\n* scalar *is* the private key). Public key recovered via the same JWK\n* round-trip. For tests / reproducible identities only.\n*/\nasync function x25519KeypairFromSeed$1(seed) {\n\tif (seed.length !== 32) throw new Error(\"x25519KeypairFromSeed: seed must be 32 bytes\");\n\tconst key = await crypto.subtle.importKey(\"pkcs8\", _wrapPkcs8(seed, _PKCS8_X25519_PREFIX), \"X25519\", true, [\"deriveBits\"]);\n\tconst jwk = await crypto.subtle.exportKey(\"jwk\", key);\n\tif (!jwk.x) throw new Error(\"x25519KeypairFromSeed: failed to derive public key\");\n\treturn {\n\t\tpublicKey: base64UrlToBytes$1(jwk.x),\n\t\tprivateKey: new Uint8Array(seed)\n\t};\n}\n/** Generate a fresh X25519 keypair (raw 32-byte scalar + 32-byte public key). */\nasync function generateX25519Keypair$1() {\n\tconst suite = _hpkeSuite();\n\tconst kp = await suite.kem.generateKeyPair();\n\treturn {\n\t\tpublicKey: new Uint8Array(await suite.kem.serializePublicKey(kp.publicKey)),\n\t\tprivateKey: new Uint8Array(await suite.kem.serializePrivateKey(kp.privateKey))\n\t};\n}\n/**\n* HPKE-base-mode single-shot seal. Output blob layout is\n* `enc (32 B) || ciphertext || tag (16 B)`. `domain` is bound into both the\n* HPKE `info` parameter and the AEAD AAD.\n*/\nasync function hpkeSeal$1(args) {\n\tconst recipientPublicKey = await _hpkeSuite().kem.deserializePublicKey(_toBuffer(args.recipientPublicKey));\n\tconst sender = await _hpkeSuite().createSenderContext({\n\t\trecipientPublicKey,\n\t\tinfo: _toBuffer(args.domain)\n\t});\n\tconst ctAndTag = new Uint8Array(await sender.seal(_toBuffer(args.plaintext), _toBuffer(args.domain)));\n\treturn _concat(new Uint8Array(sender.enc), ctAndTag);\n}\n/**\n* HPKE-base-mode single-shot open. Throws on any tag failure (wrong domain,\n* wrong recipient key, or tampered blob); the error deliberately does NOT\n* distinguish these cases.\n*/\nasync function hpkeOpen$1(args) {\n\tif (args.blob.length < 48) throw new Error(\"hpkeOpen: blob too short\");\n\tconst enc = args.blob.subarray(0, _ENC_LEN);\n\tconst ctAndTag = args.blob.subarray(_ENC_LEN);\n\tconst recipientKey = await _hpkeSuite().kem.deserializePrivateKey(_toBuffer(args.recipientPrivateKey));\n\tconst recipient = await _hpkeSuite().createRecipientContext({\n\t\trecipientKey,\n\t\tenc: _toBuffer(enc),\n\t\tinfo: _toBuffer(args.domain)\n\t});\n\treturn new Uint8Array(await recipient.open(_toBuffer(ctAndTag), _toBuffer(args.domain)));\n}\n//#endregion\n//#region src/crypto/crypto.ts\nvar crypto_exports = /* @__PURE__ */ __exportAll({\n\tgenerateKeypair: () => generateKeypair,\n\tgenerateX25519Keypair: () => generateX25519Keypair,\n\thpkeOpen: () => hpkeOpen,\n\thpkeSeal: () => hpkeSeal,\n\tkeypairFromSeed: () => keypairFromSeed,\n\tsha256: () => sha256,\n\tsign: () => sign,\n\tverify: () => verify,\n\tx25519KeypairFromSeed: () => x25519KeypairFromSeed\n});\n/** Generate a fresh Ed25519 keypair (raw 32-byte seed + 32-byte public key). */\nfunction generateKeypair() {\n\treturn generateEd25519Keypair();\n}\n/**\n* Deterministically derive an Ed25519 keypair from a raw 32-byte seed. For\n* tests / reproducible identities only — production keys must be random\n* (use {@link generateKeypair}).\n*/\nfunction keypairFromSeed(seed) {\n\treturn ed25519KeypairFromSeed(seed);\n}\n/**\n* Deterministically derive an X25519 keypair from a raw 32-byte scalar. For\n* tests / reproducible identities only.\n*/\nfunction x25519KeypairFromSeed(seed) {\n\treturn x25519KeypairFromSeed$1(seed);\n}\n/** Ed25519 sign `message` with a raw 32-byte seed private key. */\nfunction sign(privateKey, message) {\n\treturn ed25519Sign(privateKey, message);\n}\n/** Ed25519 verify. Returns `false` (never throws) on malformed input. */\nfunction verify(publicKey, message, sig) {\n\treturn ed25519Verify(publicKey, message, sig);\n}\n/** Generate a fresh X25519 keypair (raw 32-byte scalar + 32-byte public key). */\nfunction generateX25519Keypair() {\n\treturn generateX25519Keypair$1();\n}\n/**\n* HPKE-base-mode single-shot seal. Output blob layout is\n* `enc (32 B) || ciphertext || tag (16 B)`; `domain` is bound into both the\n* HPKE `info` parameter and the AEAD AAD.\n*/\nfunction hpkeSeal(args) {\n\treturn hpkeSeal$1(args);\n}\n/**\n* HPKE-base-mode single-shot open. Throws on any tag failure (wrong domain,\n* wrong recipient key, or tampered blob); the error deliberately does NOT\n* distinguish these cases.\n*/\nfunction hpkeOpen(args) {\n\treturn hpkeOpen$1(args);\n}\n/** SHA-256 digest (synchronous, dependency-free). */\nfunction sha256(bytes) {\n\treturn sha256$1(bytes);\n}\n//#endregion\n//#region src/identity/signedObject.ts\n/**\n* Identity-layer signing over the {@link signingInput hubrpc signed-object\n* standard}. These need a {@link SigningIdentity} / public key, so they live\n* in the identity layer; the pure byte definitions stay in\n* `../protocol/signedObject`.\n*/\n/**\n* Sign `obj` in `domain` with `identity`, returning a copy with\n* `$hubrpcSignature[domain]` populated (sibling signatures preserved). The\n* signature commits to {@link signingInput}`(domain, obj)`; the signer's\n* {@link SigningIdentity.publicSigningIdentity}.keyId is stamped alongside it\n* as the (unsigned) routing hint.\n*/\nasync function signObject(domain, obj, identity) {\n\tconst sig = await identity.sign(signingInput(domain, obj));\n\treturn withSignature(obj, domain, {\n\t\tkeyId: identity.publicSigningIdentity.keyId,\n\t\tsig: bytesToBase64Url(sig)\n\t});\n}\n/**\n* Verify `obj`'s `domain` signature against `signerKey` (a raw public key).\n* Returns `false` (never throws) on a missing/malformed signature.\n*/\nasync function verifyObject(domain, obj, signerKey) {\n\tconst env = readSignature(obj, domain);\n\tif (env === void 0) return false;\n\tlet sigBytes;\n\ttry {\n\t\tsigBytes = base64UrlToBytes$1(env.sig);\n\t} catch {\n\t\treturn false;\n\t}\n\treturn verify(signerKey, signingInput(domain, obj), sigBytes);\n}\n//#endregion\n//#region src/identity/signedRpcEnvelope.ts\n/**\n* Sign a single JSON-RPC call. Produces the wire-form params with the\n* `$hubrpc` (signed meta) and `$hubrpcSignature.call` envelopes attached,\n* plus the call content hash.\n*/\nasync function signRpcCall(opts) {\n\tconst userParams = requireObjectParams(opts.params);\n\tconst nonce = opts.nonce ?? _randomNonce();\n\tconst signedAtMs = opts.nowMs ?? Date.now();\n\tconst callMeta = {\n\t\tmethod: opts.method,\n\t\tnonce: bytesToBase64Url(nonce),\n\t\tsignedAtMs,\n\t\tprincipal: opts.signingIdentity.publicSigningIdentity.principal,\n\t\t...opts.interfaceHash !== void 0 ? { interfaceHash: opts.interfaceHash } : {}\n\t};\n\tconst signedParams = {\n\t\t...userParams,\n\t\t[HUBRPC_META_KEY]: callMeta\n\t};\n\tconst callHash = signedHash(\"call\", signedParams);\n\treturn {\n\t\twireParams: await signObject(\"call\", signedParams, opts.signingIdentity),\n\t\tcallMeta,\n\t\tcallHash\n\t};\n}\n/**\n* Attach capabilities to a {@link SignedRpcCall.wireParams}. Capabilities\n* ride in `$hubrpcUnsigned.capabilities` — they are NOT part of what the\n* signature commits to (which is why this is a separate step). Returns a\n* new wireParams object; the input is not mutated.\n*/\nfunction attachCapabilities(wireParams, capabilities) {\n\tif (capabilities.length === 0) return wireParams;\n\tconst obj = wireParams;\n\tconst merged = {\n\t\t...obj[HUBRPC_UNSIGNED_KEY],\n\t\tcapabilities\n\t};\n\treturn {\n\t\t...obj,\n\t\t[HUBRPC_UNSIGNED_KEY]: merged\n\t};\n}\n/**\n* Verify the identity envelope on a JSON-RPC call. Does **not** evaluate\n* capability chains or caveats — that is the hub / authoriser's job.\n*\n* A signed call carries `$hubrpc` (with `principal`) and a `call` signature\n* under `$hubrpcSignature`. The signature is checked against\n* `signingInput(\"call\", wireParams)` (the reserved keys are stripped by the\n* signed-object standard). Bare/unsigned calls return `identity: undefined`.\n*/\nasync function verifyRpcCall(opts) {\n\tconst { wireParams } = opts;\n\tconst meta = _extractObject(wireParams, HUBRPC_META_KEY);\n\tconst userParams = _stripReserved(wireParams);\n\tif (meta === void 0) {\n\t\tif (opts.requireSigned) return {\n\t\t\tok: false,\n\t\t\treason: \"missing $hubrpc envelope\"\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tidentity: void 0,\n\t\t\tparams: userParams\n\t\t};\n\t}\n\tif (typeof meta.method !== \"string\" || typeof meta.nonce !== \"string\" || typeof meta.signedAtMs !== \"number\" || meta.principal !== void 0 && typeof meta.principal !== \"string\" || meta.interfaceHash !== void 0 && typeof meta.interfaceHash !== \"string\") return {\n\t\tok: false,\n\t\treason: \"malformed hubrpc envelope\"\n\t};\n\tif (meta.method !== opts.wireMethod) return {\n\t\tok: false,\n\t\treason: \"method mismatch\"\n\t};\n\tconst now = opts.nowMs ?? Date.now();\n\tconst skew = opts.maxSkewMs ?? 3e5;\n\tif (Math.abs(meta.signedAtMs - now) > skew) return {\n\t\tok: false,\n\t\treason: `timestamp skew > ${skew}ms`\n\t};\n\tconst signature = readSignature(wireParams, \"call\");\n\tif (meta.principal === void 0 || signature === void 0) {\n\t\tif (opts.requireSigned) return {\n\t\t\tok: false,\n\t\t\treason: \"unsigned call\"\n\t\t};\n\t\treturn {\n\t\t\tok: true,\n\t\t\tidentity: void 0,\n\t\t\tparams: userParams\n\t\t};\n\t}\n\tconst resolved = resolveSigningKey({\n\t\tprincipal: meta.principal,\n\t\tkeyId: signature.keyId,\n\t\ttimeMs: meta.signedAtMs\n\t});\n\tif (resolved === void 0) return {\n\t\tok: false,\n\t\treason: `unresolvable signing key for principal ${meta.principal}`\n\t};\n\tif (!await verifyObject(\"call\", wireParams, resolved.publicKey)) return {\n\t\tok: false,\n\t\treason: \"bad signature\"\n\t};\n\tconst callHash = signedHash(\"call\", wireParams);\n\tconst unsigned = _extractObject(wireParams, HUBRPC_UNSIGNED_KEY);\n\tconst capabilities = Array.isArray(unsigned?.capabilities) ? unsigned.capabilities : [];\n\treturn {\n\t\tok: true,\n\t\tidentity: {\n\t\t\tcallMeta: meta,\n\t\t\tsigner: meta.principal,\n\t\t\tcallHash,\n\t\t\tcapabilities\n\t\t},\n\t\tparams: userParams\n\t};\n}\nfunction _extractObject(wireParams, key) {\n\tif (wireParams === null || typeof wireParams !== \"object\" || Array.isArray(wireParams)) return;\n\tconst env = wireParams[key];\n\tif (env === void 0 || env === null || typeof env !== \"object\" || Array.isArray(env)) return;\n\treturn env;\n}\nconst _RESERVED = [\n\tHUBRPC_META_KEY,\n\tHUBRPC_SIGNATURE_KEY,\n\tHUBRPC_UNSIGNED_KEY\n];\nfunction _stripReserved(wireParams) {\n\tif (wireParams === void 0) return void 0;\n\tif (wireParams === null || typeof wireParams !== \"object\" || Array.isArray(wireParams)) return wireParams;\n\tconst obj = wireParams;\n\tif (!_RESERVED.some((k) => k in obj)) return obj;\n\tconst out = {};\n\tfor (const k of Object.keys(obj)) {\n\t\tif (_RESERVED.includes(k)) continue;\n\t\tout[k] = obj[k];\n\t}\n\treturn out;\n}\nfunction _randomNonce() {\n\tconst out = /* @__PURE__ */ new Uint8Array(16);\n\tglobalThis.crypto.getRandomValues(out);\n\treturn out;\n}\n//#endregion\n//#region src/identity/principal.ts\n/**\n* A call identity bundled with its durable capability set. The {@link Identity}\n* is fixed for the life of the principal; the {@link CapBag} is mutable and\n* extensible — caps accumulate as the peer grants them.\n*\n* Transient, per-call (one-shot) grants are deliberately NOT part of a\n* principal: that is a separate policy, see `OneShotCapStaging`.\n*\n* Lives in its own module (rather than alongside `SigningSender`) so the\n* `SigningSender` ⇄ `createManagedPrincipal` factory cycle does not run through\n* a top-level `class … extends Principal`: such a cycle would hit a TDZ\n* (\"Class extends value undefined\") depending on module evaluation order.\n*/\nvar Principal = class {\n\tidentity;\n\tcapBag;\n\tconstructor(identity, capBag) {\n\t\tthis.identity = identity;\n\t\tthis.capBag = capBag;\n\t}\n};\n//#endregion\n//#region src/identity/capBag.ts\nconst DEFAULT_STORAGE_KEY = \"hubrpc.caps.v1\";\n/**\n* A process-lifetime bag of hub-issued capabilities. Plug\n* {@link CapBag.provider} straight into a connection's cap provider so every\n* outbound signed call carries whatever caps have been granted so far. The\n* hub picks whichever cap matches the call per dispatch.\n*\n* When constructed with {@link CapBagOptions.storage} the bag hydrates from\n* (and persists to) storage, so the next process spawn for the same identity\n* reuses its grants without re-prompting.\n*/\nvar CapBag = class CapBag {\n\t/** Create a bag, hydrating from storage when one was supplied. */\n\tstatic async load(options = {}) {\n\t\tconst bag = new CapBag(options);\n\t\tawait bag._hydrate();\n\t\treturn bag;\n\t}\n\t_caps = [];\n\t_storage;\n\t_storageKey;\n\t_onWarn;\n\tconstructor(options) {\n\t\tthis._storage = options.storage;\n\t\tthis._storageKey = options.storageKey ?? DEFAULT_STORAGE_KEY;\n\t\tthis._onWarn = options.onWarn ?? (() => {});\n\t}\n\tget capabilities() {\n\t\treturn this._caps;\n\t}\n\t/**\n\t* A {@link CapProvider} reflecting the bag at call-time. Assign it to\n\t* `HubClientHandle.signing.capProvider` or pass it through\n\t* `SigningSenderConfig.capProvider`.\n\t*/\n\tprovider = async () => this._caps.length > 0 ? { capabilities: this._caps } : {};\n\t/** Append capabilities and persist (when backed by storage). */\n\tasync add(...caps) {\n\t\tif (caps.length === 0) return;\n\t\tthis._caps.push(...caps);\n\t\tawait this._persist();\n\t}\n\t/** Drop all capabilities and persist the empty bag. */\n\tasync clear() {\n\t\tif (this._caps.length === 0) return;\n\t\tthis._caps.length = 0;\n\t\tawait this._persist();\n\t}\n\tasync _hydrate() {\n\t\tif (!this._storage) return;\n\t\ttry {\n\t\t\tconst persisted = await this._storage.get(this._storageKey);\n\t\t\tif (!Array.isArray(persisted)) return;\n\t\t\tfor (const cap of persisted) if (cap && typeof cap === \"object\" && \"$hubrpcSignature\" in cap) this._caps.push(cap);\n\t\t\telse this._onWarn(`skipping malformed persisted cap`);\n\t\t} catch (e) {\n\t\t\tthis._onWarn(`failed to read caps from storage: ${e.message}`);\n\t\t}\n\t}\n\tasync _persist() {\n\t\tif (!this._storage) return;\n\t\ttry {\n\t\t\tawait this._storage.set(this._storageKey, this._caps);\n\t\t} catch (e) {\n\t\t\tthis._onWarn(`failed to persist caps: ${e.message}`);\n\t\t}\n\t}\n};\n//#endregion\n//#region src/identity/identity.ts\n/**\n* The public face of a signing identity: its stable {@link PrincipalId} name\n* and the {@link KeyId} its signatures are stamped with. In Phase 1 (perpetual\n* identities) the keyId is the genesis key embedded in the principal, so it is\n* derived by stripping the `id:` prefix.\n*/\nvar PublicSigningIdentity = class {\n\tprincipal;\n\tconstructor(principal) {\n\t\tthis.principal = principal;\n\t}\n\t/** The {@link KeyId} this identity signs with (its genesis key, in Phase 1). */\n\tget keyId() {\n\t\treturn keyIdForPrincipal(this.principal);\n\t}\n};\n/**\n* {@link SigningIdentity} backed by an in-process keypair. For the common\n* case where the signing material lives in memory. For external HSM-style\n* backends, implement {@link SigningIdentity} directly.\n*/\nvar KeypairSigningIdentity = class KeypairSigningIdentity {\n\t_privateKey;\n\tpublicSigningIdentity;\n\tconstructor(principal, _privateKey) {\n\t\tthis._privateKey = _privateKey;\n\t\tthis.publicSigningIdentity = new PublicSigningIdentity(principal);\n\t}\n\tsign(message) {\n\t\treturn sign(this._privateKey, message);\n\t}\n\tstatic fromKeypair(keypair) {\n\t\treturn new KeypairSigningIdentity(principalForPublicKey(keypair.publicKey), keypair.privateKey);\n\t}\n\t/** Generate a fresh signing identity (Ed25519 keypair). */\n\tstatic async generateNew() {\n\t\treturn KeypairSigningIdentity.fromKeypair(await generateKeypair());\n\t}\n\t/** Restore an identity from its {@link toJson} form. */\n\tstatic fromJson(json) {\n\t\treturn KeypairSigningIdentity.fromKeypair({\n\t\t\tprivateKey: base64UrlToBytes$1(json.privateKey),\n\t\t\tpublicKey: base64UrlToBytes$1(json.publicKey)\n\t\t});\n\t}\n\t/** Serialize the keypair to a JSON-friendly form (base64url keys). */\n\ttoJson() {\n\t\treturn {\n\t\t\tprivateKey: bytesToBase64Url(this._privateKey),\n\t\t\tpublicKey: bytesToBase64Url(publicKeyForKeyId(this.publicSigningIdentity.keyId))\n\t\t};\n\t}\n};\nvar PublicWrappingIdentity = class {\n\twrapPublicKey;\n\tconstructor(wrapPublicKey) {\n\t\tthis.wrapPublicKey = wrapPublicKey;\n\t}\n};\n/**\n* Full {@link Identity} backed by in-process Ed25519 (signing) and X25519\n* (wrapping) keypairs. The local counterpart to a keystore/executor-backed\n* identity — used by self-managed principals that hold their own key\n* material (e.g. loaded from disk). For external HSM-style backends,\n* implement {@link Identity} directly.\n*/\nvar KeypairIdentity = class KeypairIdentity {\n\t_privateKey;\n\t_wrap;\n\tprincipal;\n\twrapPublicKey;\n\tpublicSigningIdentity;\n\tpublicWrappingIdentity;\n\tconstructor(principal, _privateKey, _wrap) {\n\t\tthis._privateKey = _privateKey;\n\t\tthis._wrap = _wrap;\n\t\tthis.principal = principal;\n\t\tthis.wrapPublicKey = _wrap.publicKey;\n\t\tthis.publicSigningIdentity = new PublicSigningIdentity(principal);\n\t\tthis.publicWrappingIdentity = new PublicWrappingIdentity(_wrap.publicKey);\n\t}\n\tsign(message) {\n\t\treturn sign(this._privateKey, message);\n\t}\n\twrap(domain, bytes) {\n\t\treturn hpkeSeal({\n\t\t\trecipientPublicKey: this._wrap.publicKey,\n\t\t\tdomain: new TextEncoder().encode(domain),\n\t\t\tplaintext: bytes\n\t\t});\n\t}\n\tunwrap(domain, blob) {\n\t\treturn hpkeOpen({\n\t\t\trecipientPrivateKey: this._wrap.privateKey,\n\t\t\tdomain: new TextEncoder().encode(domain),\n\t\t\tblob\n\t\t});\n\t}\n\t/** Generate a fresh identity (Ed25519 + X25519 keypairs). */\n\tstatic async generate() {\n\t\tconst ed = await generateKeypair();\n\t\tconst wrap = await generateX25519Keypair();\n\t\treturn new KeypairIdentity(principalForPublicKey(ed.publicKey), ed.privateKey, wrap);\n\t}\n};\n//#endregion\n//#region src/identity/identity.interfaces.ts\nconst zB64 = string();\n/**\n* Per-participant key oracle. Reached on the participant's root overlay\n* (form-2 method names like `identity::sign`). Private key material lives\n* in the executor; the participant only sees the operations.\n*\n* Wire shape:\n* sign / wrap / unwrap all take and return base64url-encoded bytes.\n* `domain` is a caller-chosen string bound into HPKE info and the AEAD\n* AAD. `unwrap` succeeds only when invoked with the exact `domain` that\n* `wrap` was called with. Use a stable, namespaced string (e.g.\n* `secrets.vault.master-key.v1`).\n*/\nconst identityInterface = defineInterface({\n\tid: \"identity\",\n\tdescription: \"Per-participant key oracle: exposes signing and HPKE-based wrap/unwrap for the identity the executor has attached to this participant's root overlay. Private keys never leave the executor.\"\n}, {\n\tgetPrincipal: requestType(object({}), object({ principal: string() })),\n\tgetWrapPublicKey: requestType(object({}), object({ wrapPublicKey: zB64 })),\n\tsign: requestType(object({ bytes: zB64 }), object({ signature: zB64 })),\n\twrap: requestType(object({\n\t\tdomain: string(),\n\t\tbytes: zB64\n\t}), object({ blob: zB64 })),\n\tunwrap: requestType(object({\n\t\tdomain: string(),\n\t\tblob: zB64\n\t}), object({ bytes: zB64 }))\n});\n/**\n* Per-identity persistent key/value store. Reached on the participant's\n* root overlay as `identity.storage::get` etc. — same overlay that serves\n* `identity::*`, same single-participant addressability.\n*\n* Storage scope is the executor's managed-identity slot (e.g.\n* `service:demo`). Lifecycle is bound to the identity: when the executor\n* deletes the identity for a slot, the storage for that slot is wiped in\n* the same operation. New identity issued for the same slot starts empty.\n*\n* The executor encrypts the backing file at rest with the same secret it\n* uses for identity files — see {@link IdentityKeystore} in\n* `@vscode/hubrpc/node`.\n*\n* Keys must match `^[A-Za-z0-9._/-]{1,256}$`. `/` is conventional for\n* namespacing (`caps.v1`, `prefs/foo`) and `list({ prefix })` honours\n* that. Values are arbitrary JSON.\n*/\nconst identityStorageInterface = defineInterface({\n\tid: \"identity.storage\",\n\tdescription: \"Per-identity persistent key/value store. Scope is the executor's managed-identity slot; lifecycle is tied to the identity itself. Backed by an at-rest-encrypted file in the executor.\"\n}, {\n\tget: requestType(object({ key: string() }), object({ value: optional(unknown()) })),\n\tset: requestType(object({\n\t\tkey: string(),\n\t\tvalue: unknown()\n\t}), object({})),\n\tdelete: requestType(object({ key: string() }), object({ existed: boolean() })),\n\tlist: requestType(object({ prefix: optional(string()) }), object({ keys: array(string()) }))\n});\n//#endregion\n//#region src/identity/managedIdentity.ts\n/**\n* Valid `identity.storage` key shape. The interface schema declares\n* `z.string()` so we don't break clients with regex errors at the wire;\n* the executor-side handler applies this stricter check.\n*/\nconst _STORAGE_KEY_RE = /^[A-Za-z0-9._/-]{1,256}$/;\n/**\n* In-process storage backend. Used by tests and by any executor that\n* doesn't need at-rest persistence.\n*/\nvar InMemoryManagedIdentityStorage = class {\n\t_data = /* @__PURE__ */ new Map();\n\tasync get(key) {\n\t\treturn this._data.has(key) ? this._data.get(key) : void 0;\n\t}\n\tasync set(key, value) {\n\t\tthis._data.set(key, value);\n\t}\n\tasync delete(key) {\n\t\treturn this._data.delete(key);\n\t}\n\tasync list(prefix) {\n\t\tconst all = [...this._data.keys()];\n\t\treturn prefix === void 0 ? all : all.filter((k) => k.startsWith(prefix));\n\t}\n};\n/**\n* In-process `ManagedIdentity` that holds the private key in memory and\n* uses the package crypto API. Useful for tests and for hub-side features\n* that want a short-lived identity without touching disk.\n*/\nvar InMemoryManagedIdentity = class InMemoryManagedIdentity {\n\t_ed;\n\t_wrap;\n\tprincipal;\n\twrapPublicKey;\n\tconstructor(_ed, _wrap) {\n\t\tthis._ed = _ed;\n\t\tthis._wrap = _wrap;\n\t\tthis.principal = principalForPublicKey(_ed.publicKey);\n\t\tthis.wrapPublicKey = _wrap.publicKey;\n\t}\n\tget publicSigningIdentity() {\n\t\treturn new PublicSigningIdentity(this.principal);\n\t}\n\tget publicWrappingIdentity() {\n\t\treturn new PublicWrappingIdentity(this.wrapPublicKey);\n\t}\n\tsign(bytes) {\n\t\treturn sign(this._ed.privateKey, bytes);\n\t}\n\twrap(domain, bytes) {\n\t\treturn hpkeSeal({\n\t\t\trecipientPublicKey: this._wrap.publicKey,\n\t\t\tdomain: _encodeDomain(domain),\n\t\t\tplaintext: bytes\n\t\t});\n\t}\n\tunwrap(domain, blob) {\n\t\treturn hpkeOpen({\n\t\t\trecipientPrivateKey: this._wrap.privateKey,\n\t\t\tdomain: _encodeDomain(domain),\n\t\t\tblob\n\t\t});\n\t}\n\t/** Generate a fresh in-memory identity (Ed25519 + X25519 keypairs). */\n\tstatic async generate() {\n\t\tconst ed = await generateKeypair();\n\t\tconst wrap = await generateX25519Keypair();\n\t\treturn new InMemoryManagedIdentity(ed, wrap);\n\t}\n};\n/**\n* Register the `identity` interface on `overlay` so the bound participant\n* can call `identity::sign` etc. on its root overlay. The overlay is\n* private to one participant — no other peer can reach these methods.\n*\n* When `storage` is supplied, the `identity.storage` interface is\n* registered alongside `identity::*`. Lifetime/scope of the backend is\n* the executor's responsibility — for keystore-backed identities the\n* backend lives as long as the identity slot does.\n*\n* Typical caller: the executor (e.g. the VS Code extension), right after\n* `Hub.attachParticipant`, on the `rootOverlay` returned from the attach\n* handle.\n*/\nfunction registerIdentityOnOverlay(overlay, identity, storage) {\n\toverlay.register(identityInterface, {\n\t\tgetPrincipal: async () => ({ principal: identity.principal }),\n\t\tgetWrapPublicKey: async () => ({ wrapPublicKey: bytesToBase64Url(identity.wrapPublicKey) }),\n\t\tsign: async ({ bytes }) => ({ signature: bytesToBase64Url(await identity.sign(base64UrlToBytes$1(bytes))) }),\n\t\twrap: async ({ domain, bytes }) => ({ blob: bytesToBase64Url(await identity.wrap(domain, base64UrlToBytes$1(bytes))) }),\n\t\tunwrap: async ({ domain, blob }) => ({ bytes: bytesToBase64Url(await identity.unwrap(domain, base64UrlToBytes$1(blob))) })\n\t});\n\tif (storage) _registerStorageInterface(overlay, storage);\n}\n/**\n* Like {@link registerIdentityOnOverlay}, but resolves the identity lazily on\n* first use via `resolveIdentity`. The identity is materialized only when the\n* bound participant actually calls `identity::*` — registering the overlay\n* does NOT create or load any identity.\n*\n* This is essential for the consent model: a host can serve `identity::*` on a\n* keystore slot without making the slot privileged (`hasState`) until the app\n* genuinely opts into an identity. `resolveIdentity` is expected to be cheap on\n* repeat calls (the keystore caches in memory), and to reflect lifecycle\n* changes — e.g. after a slot is wiped and re-created (\"Reset Identity\"), the\n* next call resolves the fresh identity.\n*\n* `storage` is registered eagerly because reading/writing storage is itself\n* the privileged act the app must perform to gain state — exposing the\n* interface costs nothing until used.\n*/\nfunction registerLazyIdentityOnOverlay(overlay, resolveIdentity, storage) {\n\toverlay.register(identityInterface, {\n\t\tgetPrincipal: async () => ({ principal: (await resolveIdentity()).principal }),\n\t\tgetWrapPublicKey: async () => ({ wrapPublicKey: bytesToBase64Url((await resolveIdentity()).wrapPublicKey) }),\n\t\tsign: async ({ bytes }) => ({ signature: bytesToBase64Url(await (await resolveIdentity()).sign(base64UrlToBytes$1(bytes))) }),\n\t\twrap: async ({ domain, bytes }) => ({ blob: bytesToBase64Url(await (await resolveIdentity()).wrap(domain, base64UrlToBytes$1(bytes))) }),\n\t\tunwrap: async ({ domain, blob }) => ({ bytes: bytesToBase64Url(await (await resolveIdentity()).unwrap(domain, base64UrlToBytes$1(blob))) })\n\t});\n\tif (storage) _registerStorageInterface(overlay, storage);\n}\nfunction _registerStorageInterface(overlay, storage) {\n\toverlay.register(identityStorageInterface, {\n\t\tget: async ({ key }) => {\n\t\t\t_assertStorageKey(key);\n\t\t\tconst value = await storage.get(key);\n\t\t\treturn value === void 0 ? {} : { value };\n\t\t},\n\t\tset: async ({ key, value }) => {\n\t\t\t_assertStorageKey(key);\n\t\t\tawait storage.set(key, value);\n\t\t\treturn {};\n\t\t},\n\t\tdelete: async ({ key }) => {\n\t\t\t_assertStorageKey(key);\n\t\t\treturn { existed: await storage.delete(key) };\n\t\t},\n\t\tlist: async ({ prefix }) => {\n\t\t\treturn { keys: await storage.list(prefix) };\n\t\t}\n\t});\n}\nfunction _assertStorageKey(key) {\n\tif (!_STORAGE_KEY_RE.test(key)) throw new Error(`identity.storage: invalid key '${key}'. Must match ${_STORAGE_KEY_RE}.`);\n}\n/**\n* Bootstrap a {@link ManagedIdentity} from a sender (typically the raw\n* unsigned sender obtained via `channel.sender` before wrapping with\n* {@link SigningSender}). Makes `identity::*` calls unsigned — the\n* executor's overlay is private to one participant so routing already\n* identifies the caller, preventing signing recursion.\n*\n* The returned identity signs / wraps / unwraps by round-tripping through\n* the executor's `identity::*` overlay; the caller wires it into their\n* {@link SigningSender} configuration (e.g. as a {@link Principal}). No\n* side effects on any existing connection or holder.\n*/\nasync function createManagedIdentity(sender) {\n\tconst conn = new HubRpcConnection(sender);\n\tconst id = conn.get(identityInterface, { signerOverride: null });\n\tconst storage = conn.get(identityStorageInterface, { signerOverride: null });\n\tconst { principal } = await id.getPrincipal({});\n\tpublicKeyForKeyId(keyIdForPrincipal(principal));\n\tconst { wrapPublicKey: wrapPublicKeyB64 } = await id.getWrapPublicKey({});\n\tconst wrapPublicKey = base64UrlToBytes$1(wrapPublicKeyB64);\n\treturn {\n\t\tprincipal,\n\t\twrapPublicKey,\n\t\tpublicSigningIdentity: new PublicSigningIdentity(principal),\n\t\tpublicWrappingIdentity: new PublicWrappingIdentity(wrapPublicKey),\n\t\tsign: async (message) => {\n\t\t\tconst { signature } = await id.sign({ bytes: bytesToBase64Url(message) });\n\t\t\treturn base64UrlToBytes$1(signature);\n\t\t},\n\t\twrap: async (domain, bytes) => {\n\t\t\tconst { blob } = await id.wrap({\n\t\t\t\tdomain,\n\t\t\t\tbytes: bytesToBase64Url(bytes)\n\t\t\t});\n\t\t\treturn base64UrlToBytes$1(blob);\n\t\t},\n\t\tunwrap: async (domain, blob) => {\n\t\t\tconst { bytes } = await id.unwrap({\n\t\t\t\tdomain,\n\t\t\t\tblob: bytesToBase64Url(blob)\n\t\t\t});\n\t\t\treturn base64UrlToBytes$1(bytes);\n\t\t},\n\t\tstorage: {\n\t\t\tget: async (key) => {\n\t\t\t\tconst { value } = await storage.get({ key });\n\t\t\t\treturn value === void 0 ? void 0 : value;\n\t\t\t},\n\t\t\tset: async (key, value) => {\n\t\t\t\tawait storage.set({\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue\n\t\t\t\t});\n\t\t\t},\n\t\t\tdelete: async (key) => {\n\t\t\t\tconst { existed } = await storage.delete({ key });\n\t\t\t\treturn existed;\n\t\t\t},\n\t\t\tlist: async (prefix) => {\n\t\t\t\tconst { keys } = await storage.list(prefix === void 0 ? {} : { prefix });\n\t\t\t\treturn keys;\n\t\t\t}\n\t\t}\n\t};\n}\nfunction _encodeDomain(domain) {\n\treturn new TextEncoder().encode(domain);\n}\n//#endregion\n//#region src/identity/managedPrincipal.ts\n/**\n* A {@link Principal} that also exposes the executor-backed per-identity\n* {@link ManagedIdentityStorage}. Returned by {@link createManagedPrincipal}\n* so callers can persist their own app state (e.g. a resolved serviceId)\n* alongside the granted capabilities, using the very same durable store the\n* {@link CapBag} hydrates from — no second storage wiring required.\n*/\nvar PrincipalWithStore = class extends Principal {\n\tstore;\n\tconstructor(identity, capBag, store) {\n\t\tsuper(identity, capBag);\n\t\tthis.store = store;\n\t}\n};\n/**\n* Executor-managed principal: the peer signs for us through its\n* `identity::sign` overlay (we never hold a private key). Bootstrapped purely\n* from the outbound `sender` — no side effects on any connection — and caps\n* persist in the executor-backed per-identity storage. Works over any\n* transport whose peer serves the identity overlay (hub *or* stdio).\n*\n* Call this exactly once per channel: it performs the `identity::*` handshake\n* and hydrates the {@link CapBag} from storage. The returned\n* {@link PrincipalWithStore} additionally surfaces that same durable\n* {@link ManagedIdentityStorage} as `store`.\n*/\nasync function createManagedPrincipal(sender) {\n\tconst identity = await createManagedIdentity(sender);\n\treturn new PrincipalWithStore(identity, await CapBag.load({ storage: identity.storage }), identity.storage);\n}\n//#endregion\n//#region src/identity/signingSender.ts\n/**\n* Side-policy for staging *one-shot* capabilities onto the next outbound\n* signed call, independent of any {@link Principal}. The {@link SigningSender}\n* drains the staged caps after attaching them once, so a spent cap never\n* leaks into a later call.\n*\n* Requesting the one-shot grant (prompting the user / hub) lives next to —\n* not inside — the principal: the principal owns identity and durable\n* capabilities; this owns the transient per-call grant.\n*/\nvar OneShotCapStaging = class {\n\t_staged = [];\n\t/** Stage caps for the next signed call. Replaces any still-pending caps. */\n\tstage(caps) {\n\t\tthis._staged = caps;\n\t}\n\t/**\n\t* Take (and clear) the staged caps. Called by {@link SigningSender} once\n\t* per outbound signed call.\n\t*/\n\ttake() {\n\t\tconst caps = this._staged;\n\t\tthis._staged = [];\n\t\treturn caps;\n\t}\n};\nvar SigningSender = class SigningSender {\n\t_inner;\n\t_config;\n\t/**\n\t* Wrap an inner channel with signing. Composes via {@link Channel.withSender}\n\t* so the resulting `Channel<TInCtx, SigningCallCtx>` plugs into\n\t* `HubRpcConnection`.\n\t*/\n\tstatic wrapChannel(inner, config) {\n\t\treturn inner.withSender((raw) => new SigningSender(raw, config));\n\t}\n\t/**\n\t* Bootstrap an executor-managed {@link Principal} over the **unsigned**\n\t* `channel`, then wrap that same channel with signing driven by it.\n\t*\n\t* Crucially, the `identity::*` handshake that mints the managed principal\n\t* rides the *raw* channel (`channel.sender`), so those bootstrap calls are\n\t* themselves never signed — there is no \"sign the sign call\" recursion and\n\t* no reliance on threading `signerOverride: null` through every transport\n\t* layer. The returned signing {@link Channel} is what callers hand to\n\t* `HubRpcConnection`; the {@link PrincipalWithStore} is returned alongside\n\t* for caps / per-identity storage / nodeId.\n\t*/\n\tstatic async fromChannelWithManagedPrincipal(channel, config) {\n\t\tconst principal = await createManagedPrincipal(channel.sender);\n\t\treturn {\n\t\t\tchannel: SigningSender.wrapChannel(channel, {\n\t\t\t\t...config,\n\t\t\t\tprincipal\n\t\t\t}),\n\t\t\tprincipal\n\t\t};\n\t}\n\t/**\n\t* Convenience over {@link fromChannelWithManagedPrincipal}: build the\n\t* unsigned {@link JsonRpcChannel} from `transport` first. The common entry\n\t* point for app hosts / services that own a raw {@link IMessageTransport}.\n\t*/\n\tstatic fromTransportWithManagedPrincipal(transport, config) {\n\t\treturn SigningSender.fromChannelWithManagedPrincipal(JsonRpcChannel.create(transport), config);\n\t}\n\tconstructor(_inner, _config) {\n\t\tthis._inner = _inner;\n\t\tthis._config = _config;\n\t}\n\tasync sendRequest(method, params, opts) {\n\t\tconst out = await this._prepareOutbound(method, params, opts);\n\t\treturn this._inner.sendRequest(out.method, out.params);\n\t}\n\tasync sendNotification(method, params, opts) {\n\t\tconst out = await this._prepareOutbound(method, params, opts);\n\t\tawait this._inner.sendNotification(out.method, out.params);\n\t}\n\tsendRequestWithStream(method, params, opts) {\n\t\tconst id$ = this._prepareOutbound(method, params, opts);\n\t\tlet realCall;\n\t\tlet queuedSends = [];\n\t\tlet resolveResult;\n\t\tlet rejectResult;\n\t\tconst result = new Promise((res, rej) => {\n\t\t\tresolveResult = res;\n\t\t\trejectResult = rej;\n\t\t});\n\t\tlet cancelled = false;\n\t\tid$.then((out) => {\n\t\t\tconst inner = this._inner.sendRequestWithStream(out.method, out.params, opts);\n\t\t\tif (cancelled) inner.cancel();\n\t\t\trealCall = inner;\n\t\t\tinner.result.then(resolveResult, rejectResult);\n\t\t\tif (queuedSends && queuedSends.length > 0) for (const p of queuedSends) inner.send(p);\n\t\t\tqueuedSends = void 0;\n\t\t}, (err) => rejectResult(err instanceof Error ? err : new Error(String(err))));\n\t\treturn {\n\t\t\tresult,\n\t\t\tcancel: () => {\n\t\t\t\tcancelled = true;\n\t\t\t\tif (realCall) realCall.cancel();\n\t\t\t},\n\t\t\tsend: async (payload) => {\n\t\t\t\tif (realCall) await realCall.send(payload);\n\t\t\t\telse queuedSends.push(payload);\n\t\t\t},\n\t\t\tping: () => realCall ? realCall.ping() : id$.then(() => realCall.ping())\n\t\t};\n\t}\n\tclose() {\n\t\tthis._inner.close();\n\t}\n\tasync _prepareOutbound(method, params, opts) {\n\t\tconst ctx = opts?.ctx;\n\t\tconst signer = this._resolveSigner(ctx);\n\t\tif (signer === void 0) return {\n\t\t\tmethod,\n\t\t\tparams\n\t\t};\n\t\tconst baseIntent = {\n\t\t\tmethod,\n\t\t\tparams,\n\t\t\t...opts?.interfaceHash !== void 0 ? { interfaceHash: opts.interfaceHash } : {}\n\t\t};\n\t\tconst coords = this._createSigningCoordinates();\n\t\tconst { intent, capabilities } = await this._resolveIntentAndCapabilities(baseIntent, signer, coords, ctx);\n\t\treturn this._signPreparedCall(intent, signer, coords.nonceBytes, capabilities);\n\t}\n\t_resolveSigner(ctx) {\n\t\treturn ctx?.signerOverride === null ? void 0 : ctx?.signerOverride ?? this._config.principal?.identity;\n\t}\n\t_createSigningCoordinates() {\n\t\tconst nonceBytes = _randomNonceBytes();\n\t\treturn {\n\t\t\tnonceBytes,\n\t\t\tnonce: bytesToBase64Url(nonceBytes),\n\t\t\tsignedAtMs: Date.now()\n\t\t};\n\t}\n\tasync _resolveIntentAndCapabilities(baseIntent, signer, coords, ctx) {\n\t\tconst intent = {\n\t\t\tmethod: baseIntent.method,\n\t\t\tparams: baseIntent.params,\n\t\t\t...baseIntent.interfaceHash !== void 0 ? { interfaceHash: baseIntent.interfaceHash } : {},\n\t\t\tsignedAtMs: coords.signedAtMs\n\t\t};\n\t\tlet capabilities;\n\t\tif (ctx?.capsOverride !== void 0) capabilities = ctx.capsOverride;\n\t\telse {\n\t\t\tconst persistent = this._config.principal?.capBag.capabilities ?? [];\n\t\t\tconst oneShot = this._config.oneShotCaps?.take() ?? [];\n\t\t\tcapabilities = oneShot.length > 0 ? [...persistent, ...oneShot] : persistent;\n\t\t\tconst provider = this._config.capProvider;\n\t\t\tif (provider) {\n\t\t\t\tconst provided = await provider({\n\t\t\t\t\tmethod: intent.method,\n\t\t\t\t\tparams: intent.params,\n\t\t\t\t\tsigner: signer.publicSigningIdentity.principal,\n\t\t\t\t\tnonce: coords.nonce,\n\t\t\t\t\tsignedAtMs: intent.signedAtMs,\n\t\t\t\t\t...intent.interfaceHash !== void 0 ? { interfaceHash: intent.interfaceHash } : {}\n\t\t\t\t});\n\t\t\t\tif (provided.method !== void 0) intent.method = provided.method;\n\t\t\t\tif (provided.params !== void 0) intent.params = provided.params;\n\t\t\t\tif (provided.interfaceHash !== void 0) intent.interfaceHash = provided.interfaceHash;\n\t\t\t\tif (provided.signedAtMs !== void 0) intent.signedAtMs = provided.signedAtMs;\n\t\t\t\tif (provided.capabilities !== void 0) capabilities = provided.capabilities;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tintent,\n\t\t\tcapabilities\n\t\t};\n\t}\n\tasync _signPreparedCall(intent, signer, nonceBytes, capabilities) {\n\t\tconst signed = await signRpcCall({\n\t\t\tmethod: intent.method,\n\t\t\tparams: intent.params,\n\t\t\tsigningIdentity: signer,\n\t\t\tnonce: nonceBytes,\n\t\t\tnowMs: intent.signedAtMs,\n\t\t\t...intent.interfaceHash !== void 0 ? { interfaceHash: intent.interfaceHash } : {}\n\t\t});\n\t\tconst outboundParams = capabilities.length > 0 ? attachCapabilities(signed.wireParams, capabilities) : signed.wireParams;\n\t\treturn {\n\t\t\tmethod: intent.method,\n\t\t\tparams: outboundParams\n\t\t};\n\t}\n};\nfunction _randomNonceBytes() {\n\tconst out = /* @__PURE__ */ new Uint8Array(16);\n\tcrypto.getRandomValues(out);\n\treturn out;\n}\n//#endregion\n//#region src/identity/capability.ts\n/**\n* Capability **semantics**: the authorization layer over the pure\n* protocol syntax in `../protocol/capability`. This module answers the\n* single question \"may this concrete signed call proceed?\" via\n* {@link permits}, built from the chain verifier {@link verifyChain} and\n* the membership predicate {@link capabilityPermits}. Signing lives here\n* too, since it needs a {@link SigningIdentity}.\n*/\n/**\n* Pure freshness check for a single capability link: `true` when the cap never\n* expires, or its `expiresAtMs` is still in the future at `now + marginMs`.\n*\n* Mirrors the gate's expiry rule in {@link verifyChain}'s link check\n* (`expiresAtMs < nowMs` ⇒ expired) so a producer can decide, *before signing*,\n* whether to re-acquire a cap rather than attach one the gate will reject as\n* `expired`. The `marginMs` safety window absorbs in-flight transit time and\n* client/hub clock skew — pass the call's `signedAtMs` as `now` so the check\n* evaluates expiry against the same instant baked into the envelope.\n*\n* This checks ONE link. Effective authority requires every link in a\n* delegation chain to be unexpired, so a producer attaching a bag should apply\n* this to every cap it would attach (see {@link capBagFreshAt}).\n*/\nfunction capabilityFreshAt(cap, now, marginMs = 0) {\n\treturn cap.expiresAtMs === void 0 || cap.expiresAtMs > now + marginMs;\n}\n/**\n* Freshness over a whole presented bag: `true` only when every cap is fresh at\n* `now + marginMs` (see {@link capabilityFreshAt}). An empty bag is trivially\n* fresh. Use this at the cap-production point to decide whether to re-acquire.\n*/\nfunction capBagFreshAt(caps, now, marginMs = 0) {\n\treturn caps.every((cap) => capabilityFreshAt(cap, now, marginMs));\n}\n/**\n* Verify that some delegation chain among the presented `capabilities`\n* authorizes `call`, and return the issuer at its top (the trust anchor the\n* caller then judges). The bag's topology is inferred: any capability whose\n* `audience` is the caller is tried as a leaf, and parents are resolved out\n* of the same bag by content hash (`parentHash`).\n*\n* Each link must be authentic (signature), unexpired, and bound to the next\n* link's issuer; the **leaf** must grant `invoke` for the call and every\n* **parent** must grant `delegate`. Effective authority is therefore the\n* intersection over the chain — a delegate can only narrow.\n*\n* @internal Chain *authenticity* only — it makes **no** trust decision. The\n* public authorization entry point is {@link permits}, which layers the\n* accepted-root policy on top.\n*/\nasync function verifyChain(capabilities, call, opts) {\n\tconst byHash = /* @__PURE__ */ new Map();\n\tfor (const c of capabilities) byHash.set(signedHash(\"capability\", c), c);\n\tconst resolveParent = (h) => byHash.get(h);\n\tconst maxDepth = opts.maxDepth ?? 16;\n\tlet leafReason;\n\tlet anyReason = \"no presented capability addresses this call\";\n\tlet unacceptedRoot;\n\tfor (const leaf of capabilities) {\n\t\tconst r = await _verifyLink(leaf, call, opts.expectedAudience, opts.nowMs, maxDepth, true, resolveParent);\n\t\tif (!r.ok) {\n\t\t\tanyReason = r.reason;\n\t\t\tif (leaf.audience === opts.expectedAudience) leafReason = r.reason;\n\t\t\tcontinue;\n\t\t}\n\t\tif (opts.acceptRoot !== void 0 && !opts.acceptRoot(r.rootIssuer)) {\n\t\t\tunacceptedRoot = r.rootIssuer;\n\t\t\tcontinue;\n\t\t}\n\t\treturn {\n\t\t\tok: true,\n\t\t\trootIssuer: r.rootIssuer,\n\t\t\tleafNonce: leaf.nonce\n\t\t};\n\t}\n\tif (unacceptedRoot !== void 0) return {\n\t\tok: false,\n\t\treason: \"no chain roots at an accepted issuer\",\n\t\tverifiedRootIssuer: unacceptedRoot\n\t};\n\treturn {\n\t\tok: false,\n\t\treason: leafReason ?? anyReason\n\t};\n}\nasync function _verifyLink(link, call, expectedAudience, nowMs, depthLeft, isLeaf, resolveParent) {\n\tif (depthLeft <= 0) return {\n\t\tok: false,\n\t\treason: \"chain too deep\"\n\t};\n\tif (link.audience !== expectedAudience) return {\n\t\tok: false,\n\t\treason: `audience mismatch (expected ${expectedAudience}, got ${link.audience})`\n\t};\n\tif (link.expiresAtMs !== void 0 && link.expiresAtMs < nowMs) return {\n\t\tok: false,\n\t\treason: \"expired\"\n\t};\n\tconst permitted = capabilityPermits(call, link, isLeaf ? \"invoke\" : \"delegate\");\n\tif (!permitted.ok) return {\n\t\tok: false,\n\t\treason: permitted.reason\n\t};\n\tlet issuerKey;\n\tconst resolved = resolveSigningKey({\n\t\tprincipal: link.issuer,\n\t\tkeyId: readSignature(link, \"capability\")?.keyId ?? \"\",\n\t\ttimeMs: nowMs\n\t});\n\tif (resolved === void 0) return {\n\t\tok: false,\n\t\treason: \"unresolvable issuer key\"\n\t};\n\tissuerKey = resolved.publicKey;\n\tif (!await verifyObject(\"capability\", link, issuerKey)) return {\n\t\tok: false,\n\t\treason: \"bad signature\"\n\t};\n\tif (link.parentHash === void 0) return {\n\t\tok: true,\n\t\trootIssuer: link.issuer\n\t};\n\tconst parent = resolveParent(link.parentHash);\n\tif (parent === void 0) return {\n\t\tok: false,\n\t\treason: \"parent capability not presented\"\n\t};\n\tif (signedHash(\"capability\", parent) !== link.parentHash) return {\n\t\tok: false,\n\t\treason: \"parent hash mismatch\"\n\t};\n\treturn _verifyLink(parent, call, link.issuer, nowMs, depthLeft - 1, false, resolveParent);\n}\n/**\n* **The** authorization predicate. A call is permitted iff some presented\n* capability (1) addresses the call, (2) has a genuine, well-delegated\n* chain whose leaf audience is the caller (`call.signer`), and (3) roots\n* at an issuer the verifier accepts **for the call's service**.\n*\n* Pure: it reports the verdict (and the `capabilityNonce` / `rootIssuer`\n* for audit) but performs no consumption. Replay is the caller's job — the\n* gate dedups `call.nonce`, so `callBind` grants are single-use for free.\n*\n* `acceptedRootIssuers` is consulted with the call's `serviceId` and returns\n* the accepted {@link AcceptedRootIssuer} anchors; an empty result rejects\n* every capability (fail closed) — trust is the verifier's, never the\n* token's. Anchors flagged `isPublic` are named in the rejection reason when\n* a chain roots at an unaccepted issuer.\n*/\nasync function permits(call, capabilities, acceptedRootIssuers, nowMs, opts) {\n\tif (capabilities.length === 0) return {\n\t\tok: false,\n\t\treason: \"no capabilities were presented with this call\"\n\t};\n\tconst accepted = acceptedRootIssuers(call.target.serviceId);\n\tconst acceptedIds = new Set(accepted.map((a) => a.principal));\n\tconst chain = await verifyChain(capabilities, call, {\n\t\texpectedAudience: call.signer,\n\t\tnowMs,\n\t\tacceptRoot: (rootIssuer) => acceptedIds.has(rootIssuer),\n\t\t...opts?.maxDepth !== void 0 ? { maxDepth: opts.maxDepth } : {}\n\t});\n\tif (chain.ok) return {\n\t\tok: true,\n\t\tcapabilityNonce: chain.leafNonce,\n\t\trootIssuer: chain.rootIssuer\n\t};\n\tif (chain.verifiedRootIssuer !== void 0) return {\n\t\tok: false,\n\t\treason: _rootIssuerRejectedReason(call.target.serviceId, chain.verifiedRootIssuer, accepted)\n\t};\n\treturn {\n\t\tok: false,\n\t\treason: chain.reason\n\t};\n}\n/**\n* Reason string for a chain that verified but rooted at an unaccepted issuer.\n* Names the (caller-owned) `rootIssuer` it actually rooted at, plus the\n* `isPublic` accepted anchors to point the caller at the right root.\n*/\nfunction _rootIssuerRejectedReason(serviceId, rootIssuer, accepted) {\n\tconst head = `capability root issuer ${rootIssuer} is not accepted for service \"${serviceId}\"`;\n\tif (accepted.length === 0) return `${head} (no root issuers are accepted for this service)`;\n\tconst publicIds = accepted.filter((a) => a.isPublic).map((a) => a.principal);\n\tif (publicIds.length === 0) return head;\n\treturn `${head}; accepted root issuer(s): ${publicIds.join(\", \")}`;\n}\n/**\n* Sign a `Capability` with a {@link SigningIdentity}. The private key never\n* leaves the identity. The result verifies via {@link verifyChain}.\n*/\nasync function signCapability(capability, issuer) {\n\treturn await signObject(\"capability\", capability, issuer);\n}\n//#endregion\n//#region src/identity/metaEnvelope.ts\n/**\n* Returns a wire-form params object carrying the `$hubrpc` envelope, the\n* `call` signature under `$hubrpcSignature`, and (optionally) capabilities\n* under `$hubrpcUnsigned`.\n*/\nasync function signParams(opts) {\n\tif (opts.params !== void 0 && (typeof opts.params !== \"object\" || Array.isArray(opts.params))) throw new Error(\"signParams: params must be an object or undefined\");\n\tconst signed = await signRpcCall({\n\t\tmethod: opts.method,\n\t\tparams: opts.params ?? void 0,\n\t\tsigningIdentity: opts.signingIdentity,\n\t\t...opts.nowMs !== void 0 ? { nowMs: opts.nowMs } : {},\n\t\t...opts.nonce !== void 0 ? { nonce: opts.nonce } : {},\n\t\t...opts.interfaceHash !== void 0 ? { interfaceHash: opts.interfaceHash } : {}\n\t});\n\treturn opts.capabilities && opts.capabilities.length > 0 ? attachCapabilities(signed.wireParams, opts.capabilities) : signed.wireParams;\n}\nasync function verifyCall(opts) {\n\tconst res = await verifyRpcCall({\n\t\twireMethod: opts.method,\n\t\twireParams: opts.params,\n\t\t...opts.nowMs !== void 0 ? { nowMs: opts.nowMs } : {},\n\t\t...opts.maxSkewMs !== void 0 ? { maxSkewMs: opts.maxSkewMs } : {},\n\t\trequireSigned: opts.requireCapability === true\n\t});\n\tif (!res.ok) return {\n\t\tok: false,\n\t\tkind: \"envelope\",\n\t\treason: res.reason\n\t};\n\tif (!res.identity) return {\n\t\tok: false,\n\t\tkind: \"envelope\",\n\t\treason: \"missing identity envelope\"\n\t};\n\tconst { identity } = res;\n\tif (opts.requireCapability && identity.capabilities.length === 0) return {\n\t\tok: false,\n\t\tkind: \"capability\",\n\t\treason: \"capability required but none provided\"\n\t};\n\tconst params = res.params;\n\tlet strippedParams;\n\tif (params === void 0 || params === null) strippedParams = void 0;\n\telse if (typeof params === \"object\" && !Array.isArray(params)) strippedParams = params;\n\telse strippedParams = void 0;\n\tconst target = opts.parseMethod(opts.method);\n\tif (identity.callMeta.interfaceHash !== void 0) target.interfaceHash = identity.callMeta.interfaceHash;\n\tconst call = {\n\t\ttarget,\n\t\tparams,\n\t\tnonce: identity.callMeta.nonce,\n\t\tsignedAtMs: identity.callMeta.signedAtMs,\n\t\tsigner: identity.signer,\n\t\tcallHash: identity.callHash\n\t};\n\treturn {\n\t\tok: true,\n\t\tsigner: identity.signer,\n\t\tcall,\n\t\tstrippedParams,\n\t\tcapabilities: identity.capabilities,\n\t\tnonce: identity.callMeta.nonce,\n\t\tcallHash: identity.callHash,\n\t\tcallMeta: identity.callMeta,\n\t\tinterfaceHash: identity.callMeta.interfaceHash\n\t};\n}\n//#endregion\n//#region src/identity/seededPrincipal.ts\n/** Derive a domain-separated 32-byte seed from the numeric seed. */\nfunction _seedBytes(domain, seed) {\n\treturn sha256(new TextEncoder().encode(`${domain}:${seed}`));\n}\n/**\n* Build a **random**, in-memory {@link Principal}: a fresh Ed25519 signing\n* identity + X25519 wrapping key, paired with an empty memory-only\n* {@link CapBag}. Full-entropy (unlike {@link createSeededMemoryPrincipal}), so\n* it is safe to sign trusted calls — e.g. an in-process \"agent\" identity a hub\n* admin delegates read authority to (via a minted capability) for directory\n* discovery. The identity is ephemeral: it vanishes with the process.\n*/\nasync function createMemoryPrincipal() {\n\tconst ed = await generateKeypair();\n\tconst wrap = await generateX25519Keypair();\n\treturn new Principal(new KeypairIdentity(principalForPublicKey(ed.publicKey), ed.privateKey, wrap), await CapBag.load());\n}\n/**\n* Build a deterministic {@link Principal} from a numeric seed: a reproducible\n* Ed25519 signing identity (so the nodeId is stable across runs) plus a matching\n* X25519 wrapping key, paired with an empty, memory-only {@link CapBag}.\n*\n* For tests and reproducible local setups ONLY — the key material is derived\n* from a low-entropy seed and must never be used to sign anything trusted.\n*/\nasync function createSeededMemoryPrincipal(opts) {\n\tconst ed = await keypairFromSeed(_seedBytes(\"hubrpc.seed.ed25519\", opts.seed));\n\tconst wrap = await x25519KeypairFromSeed(_seedBytes(\"hubrpc.seed.x25519\", opts.seed));\n\treturn new Principal(new KeypairIdentity(principalForPublicKey(ed.publicKey), ed.privateKey, wrap), await CapBag.load());\n}\n/**\n* Derive a deterministic {@link KeypairSigningIdentity} from a numeric seed: a\n* reproducible Ed25519 signing identity (so the nodeId is stable across runs),\n* with no wrapping key. Use it where only signing/issuing is needed — e.g. a\n* hub admin `issuer` that mints capabilities in tests.\n*\n* For tests and reproducible local setups ONLY — the key material is derived\n* from a low-entropy seed and must never be used to sign anything trusted.\n*/\nasync function createSeededSigningIdentity(opts) {\n\tconst ed = await keypairFromSeed(_seedBytes(\"hubrpc.seed.ed25519\", opts.seed));\n\treturn KeypairSigningIdentity.fromKeypair(ed);\n}\n//#endregion\nexport { readSignature as $, crypto_exports as A, generateTsInterface as At, Channel as B, RequestType as Bt, PublicSigningIdentity as C, StreamControlType as Ct, attachCapabilities as D, directoryInterface as Dt, Principal as E, defaultsInterface as Et, parseEndpointUri as F, computeInterfaceHash as Ft, traceMessageTransport as G, MultiplexedTransport as H, requestType as Ht, ChannelConnector as I, sha256$1 as It, parseMethodName as J, requireObjectParams as K, HubRpcConnection as L, jcsCanonicalize as Lt, generateX25519Keypair as M, InterfaceDefinition as Mt, formatEndpointUri as N, defineInterface as Nt, signRpcCall as O, directoryWatchNever as Ot, isHubEndpoint as P, interfaceFromSchema as Pt, getKeyId as Q, ServiceHandle as R, jcsCanonicalizeBytes as Rt, KeypairSigningIdentity as S, StreamControlReason as St, CapBag as T, streamInterface as Tt, TransportPair as U, zodToSvcJsonSchema as Ut, RpcError as V, notificationType as Vt, connectTransports as W, normalizeJsonSchema as Wt, HUBRPC_SIGNATURE_KEY as X, HUBRPC_META_KEY as Y, HUBRPC_UNSIGNED_KEY as Z, registerIdentityOnOverlay as _, ErrorCode as _t, verifyCall as a, PRINCIPAL_PREFIX as at, identityStorageInterface as b, isResponse as bt, permits as c, keyIdForPrincipal as ct, SigningSender as d, publicKeyForKeyId as dt, signedHash as et, PrincipalWithStore as f, resolveSigningKey as ft, createManagedIdentity as g, permissionPermits as gt, InMemoryManagedIdentityStorage as h, permissionMatchesTarget as ht, signParams as i, KEY_ID_PREFIX as it, generateKeypair as j, isAssignable as jt, verifyRpcCall as k, schemasInterface as kt, signCapability as l, keyIdForPublicKey as lt, InMemoryManagedIdentity as m, matchParams as mt, createSeededMemoryPrincipal as n, signingPad as nt, capBagFreshAt as o, base64UrlToBytes$1 as ot, createManagedPrincipal as p, capabilityPermits as pt, methodNameToTarget as q, createSeededSigningIdentity as r, withSignature as rt, capabilityFreshAt as s, bytesToBase64Url as st, createMemoryPrincipal as t, signingInput as tt, OneShotCapStaging as u, principalForPublicKey as ut, registerLazyIdentityOnOverlay as v, isNotification as vt, PublicWrappingIdentity as w, StreamDir as wt, KeypairIdentity as x, STREAM_METHOD as xt, identityInterface as y, isRequest as yt, JsonRpcChannel as z, NotificationType as zt };\n\n//# sourceMappingURL=src-Bcqt3hMa.js.map","import * as core from \"../core/index.js\";\nimport * as schemas from \"./schemas.js\";\nexport const ZodISODateTime = /*@__PURE__*/ core.$constructor(\"ZodISODateTime\", (inst, def) => {\n core.$ZodISODateTime.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function datetime(params) {\n return core._isoDateTime(ZodISODateTime, params);\n}\nexport const ZodISODate = /*@__PURE__*/ core.$constructor(\"ZodISODate\", (inst, def) => {\n core.$ZodISODate.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function date(params) {\n return core._isoDate(ZodISODate, params);\n}\nexport const ZodISOTime = /*@__PURE__*/ core.$constructor(\"ZodISOTime\", (inst, def) => {\n core.$ZodISOTime.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function time(params) {\n return core._isoTime(ZodISOTime, params);\n}\nexport const ZodISODuration = /*@__PURE__*/ core.$constructor(\"ZodISODuration\", (inst, def) => {\n core.$ZodISODuration.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function duration(params) {\n return core._isoDuration(ZodISODuration, params);\n}\n","import * as core from \"../core/index.js\";\nimport { $ZodError } from \"../core/index.js\";\nimport * as util from \"../core/util.js\";\nconst initializer = (inst, issues) => {\n $ZodError.init(inst, issues);\n inst.name = \"ZodError\";\n Object.defineProperties(inst, {\n format: {\n value: (mapper) => core.formatError(inst, mapper),\n // enumerable: false,\n },\n flatten: {\n value: (mapper) => core.flattenError(inst, mapper),\n // enumerable: false,\n },\n addIssue: {\n value: (issue) => {\n inst.issues.push(issue);\n inst.message = JSON.stringify(inst.issues, util.jsonStringifyReplacer, 2);\n },\n // enumerable: false,\n },\n addIssues: {\n value: (issues) => {\n inst.issues.push(...issues);\n inst.message = JSON.stringify(inst.issues, util.jsonStringifyReplacer, 2);\n },\n // enumerable: false,\n },\n isEmpty: {\n get() {\n return inst.issues.length === 0;\n },\n // enumerable: false,\n },\n });\n // Object.defineProperty(inst, \"isEmpty\", {\n // get() {\n // return inst.issues.length === 0;\n // },\n // });\n};\nexport const ZodError = /*@__PURE__*/ core.$constructor(\"ZodError\", initializer);\nexport const ZodRealError = /*@__PURE__*/ core.$constructor(\"ZodError\", initializer, {\n Parent: Error,\n});\n// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */\n// export type ErrorMapCtx = core.$ZodErrorMapCtx;\n","import * as core from \"../core/index.js\";\nimport { ZodRealError } from \"./errors.js\";\nexport const parse = /* @__PURE__ */ core._parse(ZodRealError);\nexport const parseAsync = /* @__PURE__ */ core._parseAsync(ZodRealError);\nexport const safeParse = /* @__PURE__ */ core._safeParse(ZodRealError);\nexport const safeParseAsync = /* @__PURE__ */ core._safeParseAsync(ZodRealError);\n// Codec functions\nexport const encode = /* @__PURE__ */ core._encode(ZodRealError);\nexport const decode = /* @__PURE__ */ core._decode(ZodRealError);\nexport const encodeAsync = /* @__PURE__ */ core._encodeAsync(ZodRealError);\nexport const decodeAsync = /* @__PURE__ */ core._decodeAsync(ZodRealError);\nexport const safeEncode = /* @__PURE__ */ core._safeEncode(ZodRealError);\nexport const safeDecode = /* @__PURE__ */ core._safeDecode(ZodRealError);\nexport const safeEncodeAsync = /* @__PURE__ */ core._safeEncodeAsync(ZodRealError);\nexport const safeDecodeAsync = /* @__PURE__ */ core._safeDecodeAsync(ZodRealError);\n","import * as core from \"../core/index.js\";\nimport { util } from \"../core/index.js\";\nimport * as processors from \"../core/json-schema-processors.js\";\nimport { createStandardJSONSchemaMethod, createToJSONSchemaMethod } from \"../core/to-json-schema.js\";\nimport * as checks from \"./checks.js\";\nimport * as iso from \"./iso.js\";\nimport * as parse from \"./parse.js\";\n// Lazy-bind builder methods.\n//\n// Builder methods (`.optional`, `.array`, `.refine`, ...) live as\n// non-enumerable getters on each concrete schema constructor's\n// prototype. On first access from an instance the getter allocates\n// `fn.bind(this)` and caches it as an own property on that instance,\n// so detached usage (`const m = schema.optional; m()`) still works\n// and the per-instance allocation only happens for methods actually\n// touched.\n//\n// One install per (prototype, group), memoized by `_installedGroups`.\nconst _installedGroups = /* @__PURE__ */ new WeakMap();\nfunction _installLazyMethods(inst, group, methods) {\n const proto = Object.getPrototypeOf(inst);\n let installed = _installedGroups.get(proto);\n if (!installed) {\n installed = new Set();\n _installedGroups.set(proto, installed);\n }\n if (installed.has(group))\n return;\n installed.add(group);\n for (const key in methods) {\n const fn = methods[key];\n Object.defineProperty(proto, key, {\n configurable: true,\n enumerable: false,\n get() {\n const bound = fn.bind(this);\n Object.defineProperty(this, key, {\n configurable: true,\n writable: true,\n enumerable: true,\n value: bound,\n });\n return bound;\n },\n set(v) {\n Object.defineProperty(this, key, {\n configurable: true,\n writable: true,\n enumerable: true,\n value: v,\n });\n },\n });\n }\n}\nexport const ZodType = /*@__PURE__*/ core.$constructor(\"ZodType\", (inst, def) => {\n core.$ZodType.init(inst, def);\n Object.assign(inst[\"~standard\"], {\n jsonSchema: {\n input: createStandardJSONSchemaMethod(inst, \"input\"),\n output: createStandardJSONSchemaMethod(inst, \"output\"),\n },\n });\n inst.toJSONSchema = createToJSONSchemaMethod(inst, {});\n inst.def = def;\n inst.type = def.type;\n Object.defineProperty(inst, \"_def\", { value: def });\n // Parse-family is intentionally kept as per-instance closures: these are\n // the hot path AND the most-detached methods (`arr.map(schema.parse)`,\n // `const { parse } = schema`, etc.). Eager closures here mean callers pay\n // ~12 closure allocations per schema but get monomorphic call sites and\n // detached usage that \"just works\".\n inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });\n inst.safeParse = (data, params) => parse.safeParse(inst, data, params);\n inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });\n inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);\n inst.spa = inst.safeParseAsync;\n inst.encode = (data, params) => parse.encode(inst, data, params);\n inst.decode = (data, params) => parse.decode(inst, data, params);\n inst.encodeAsync = async (data, params) => parse.encodeAsync(inst, data, params);\n inst.decodeAsync = async (data, params) => parse.decodeAsync(inst, data, params);\n inst.safeEncode = (data, params) => parse.safeEncode(inst, data, params);\n inst.safeDecode = (data, params) => parse.safeDecode(inst, data, params);\n inst.safeEncodeAsync = async (data, params) => parse.safeEncodeAsync(inst, data, params);\n inst.safeDecodeAsync = async (data, params) => parse.safeDecodeAsync(inst, data, params);\n // All builder methods are placed on the internal prototype as lazy-bind\n // getters. On first access per-instance, a bound thunk is allocated and\n // cached as an own property; subsequent accesses skip the getter. This\n // means: no per-instance allocation for unused methods, full\n // detachability preserved (`const m = schema.optional; m()` works), and\n // shared underlying function references across all instances.\n _installLazyMethods(inst, \"ZodType\", {\n check(...chks) {\n const def = this.def;\n return this.clone(util.mergeDefs(def, {\n checks: [\n ...(def.checks ?? []),\n ...chks.map((ch) => typeof ch === \"function\" ? { _zod: { check: ch, def: { check: \"custom\" }, onattach: [] } } : ch),\n ],\n }), { parent: true });\n },\n with(...chks) {\n return this.check(...chks);\n },\n clone(def, params) {\n return core.clone(this, def, params);\n },\n brand() {\n return this;\n },\n register(reg, meta) {\n reg.add(this, meta);\n return this;\n },\n refine(check, params) {\n return this.check(refine(check, params));\n },\n superRefine(refinement, params) {\n return this.check(superRefine(refinement, params));\n },\n overwrite(fn) {\n return this.check(checks.overwrite(fn));\n },\n optional() {\n return optional(this);\n },\n exactOptional() {\n return exactOptional(this);\n },\n nullable() {\n return nullable(this);\n },\n nullish() {\n return optional(nullable(this));\n },\n nonoptional(params) {\n return nonoptional(this, params);\n },\n array() {\n return array(this);\n },\n or(arg) {\n return union([this, arg]);\n },\n and(arg) {\n return intersection(this, arg);\n },\n transform(tx) {\n return pipe(this, transform(tx));\n },\n default(d) {\n return _default(this, d);\n },\n prefault(d) {\n return prefault(this, d);\n },\n catch(params) {\n return _catch(this, params);\n },\n pipe(target) {\n return pipe(this, target);\n },\n readonly() {\n return readonly(this);\n },\n describe(description) {\n const cl = this.clone();\n core.globalRegistry.add(cl, { description });\n return cl;\n },\n meta(...args) {\n // overloaded: meta() returns the registered metadata, meta(data)\n // returns a clone with `data` registered. The mapped type picks\n // up the second overload, so we accept variadic any-args and\n // return `any` to satisfy both at runtime.\n if (args.length === 0)\n return core.globalRegistry.get(this);\n const cl = this.clone();\n core.globalRegistry.add(cl, args[0]);\n return cl;\n },\n isOptional() {\n return this.safeParse(undefined).success;\n },\n isNullable() {\n return this.safeParse(null).success;\n },\n apply(fn) {\n return fn(this);\n },\n });\n Object.defineProperty(inst, \"description\", {\n get() {\n return core.globalRegistry.get(inst)?.description;\n },\n configurable: true,\n });\n return inst;\n});\n/** @internal */\nexport const _ZodString = /*@__PURE__*/ core.$constructor(\"_ZodString\", (inst, def) => {\n core.$ZodString.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.stringProcessor(inst, ctx, json, params);\n const bag = inst._zod.bag;\n inst.format = bag.format ?? null;\n inst.minLength = bag.minimum ?? null;\n inst.maxLength = bag.maximum ?? null;\n _installLazyMethods(inst, \"_ZodString\", {\n regex(...args) {\n return this.check(checks.regex(...args));\n },\n includes(...args) {\n return this.check(checks.includes(...args));\n },\n startsWith(...args) {\n return this.check(checks.startsWith(...args));\n },\n endsWith(...args) {\n return this.check(checks.endsWith(...args));\n },\n min(...args) {\n return this.check(checks.minLength(...args));\n },\n max(...args) {\n return this.check(checks.maxLength(...args));\n },\n length(...args) {\n return this.check(checks.length(...args));\n },\n nonempty(...args) {\n return this.check(checks.minLength(1, ...args));\n },\n lowercase(params) {\n return this.check(checks.lowercase(params));\n },\n uppercase(params) {\n return this.check(checks.uppercase(params));\n },\n trim() {\n return this.check(checks.trim());\n },\n normalize(...args) {\n return this.check(checks.normalize(...args));\n },\n toLowerCase() {\n return this.check(checks.toLowerCase());\n },\n toUpperCase() {\n return this.check(checks.toUpperCase());\n },\n slugify() {\n return this.check(checks.slugify());\n },\n });\n});\nexport const ZodString = /*@__PURE__*/ core.$constructor(\"ZodString\", (inst, def) => {\n core.$ZodString.init(inst, def);\n _ZodString.init(inst, def);\n inst.email = (params) => inst.check(core._email(ZodEmail, params));\n inst.url = (params) => inst.check(core._url(ZodURL, params));\n inst.jwt = (params) => inst.check(core._jwt(ZodJWT, params));\n inst.emoji = (params) => inst.check(core._emoji(ZodEmoji, params));\n inst.guid = (params) => inst.check(core._guid(ZodGUID, params));\n inst.uuid = (params) => inst.check(core._uuid(ZodUUID, params));\n inst.uuidv4 = (params) => inst.check(core._uuidv4(ZodUUID, params));\n inst.uuidv6 = (params) => inst.check(core._uuidv6(ZodUUID, params));\n inst.uuidv7 = (params) => inst.check(core._uuidv7(ZodUUID, params));\n inst.nanoid = (params) => inst.check(core._nanoid(ZodNanoID, params));\n inst.guid = (params) => inst.check(core._guid(ZodGUID, params));\n inst.cuid = (params) => inst.check(core._cuid(ZodCUID, params));\n inst.cuid2 = (params) => inst.check(core._cuid2(ZodCUID2, params));\n inst.ulid = (params) => inst.check(core._ulid(ZodULID, params));\n inst.base64 = (params) => inst.check(core._base64(ZodBase64, params));\n inst.base64url = (params) => inst.check(core._base64url(ZodBase64URL, params));\n inst.xid = (params) => inst.check(core._xid(ZodXID, params));\n inst.ksuid = (params) => inst.check(core._ksuid(ZodKSUID, params));\n inst.ipv4 = (params) => inst.check(core._ipv4(ZodIPv4, params));\n inst.ipv6 = (params) => inst.check(core._ipv6(ZodIPv6, params));\n inst.cidrv4 = (params) => inst.check(core._cidrv4(ZodCIDRv4, params));\n inst.cidrv6 = (params) => inst.check(core._cidrv6(ZodCIDRv6, params));\n inst.e164 = (params) => inst.check(core._e164(ZodE164, params));\n // iso\n inst.datetime = (params) => inst.check(iso.datetime(params));\n inst.date = (params) => inst.check(iso.date(params));\n inst.time = (params) => inst.check(iso.time(params));\n inst.duration = (params) => inst.check(iso.duration(params));\n});\nexport function string(params) {\n return core._string(ZodString, params);\n}\nexport const ZodStringFormat = /*@__PURE__*/ core.$constructor(\"ZodStringFormat\", (inst, def) => {\n core.$ZodStringFormat.init(inst, def);\n _ZodString.init(inst, def);\n});\nexport const ZodEmail = /*@__PURE__*/ core.$constructor(\"ZodEmail\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodEmail.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function email(params) {\n return core._email(ZodEmail, params);\n}\nexport const ZodGUID = /*@__PURE__*/ core.$constructor(\"ZodGUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodGUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function guid(params) {\n return core._guid(ZodGUID, params);\n}\nexport const ZodUUID = /*@__PURE__*/ core.$constructor(\"ZodUUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodUUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function uuid(params) {\n return core._uuid(ZodUUID, params);\n}\nexport function uuidv4(params) {\n return core._uuidv4(ZodUUID, params);\n}\n// ZodUUIDv6\nexport function uuidv6(params) {\n return core._uuidv6(ZodUUID, params);\n}\n// ZodUUIDv7\nexport function uuidv7(params) {\n return core._uuidv7(ZodUUID, params);\n}\nexport const ZodURL = /*@__PURE__*/ core.$constructor(\"ZodURL\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodURL.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function url(params) {\n return core._url(ZodURL, params);\n}\nexport function httpUrl(params) {\n return core._url(ZodURL, {\n protocol: core.regexes.httpProtocol,\n hostname: core.regexes.domain,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodEmoji = /*@__PURE__*/ core.$constructor(\"ZodEmoji\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodEmoji.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function emoji(params) {\n return core._emoji(ZodEmoji, params);\n}\nexport const ZodNanoID = /*@__PURE__*/ core.$constructor(\"ZodNanoID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodNanoID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function nanoid(params) {\n return core._nanoid(ZodNanoID, params);\n}\n/**\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link ZodCUID2} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport const ZodCUID = /*@__PURE__*/ core.$constructor(\"ZodCUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodCUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\n/**\n * Validates a CUID v1 string.\n *\n * @deprecated CUID v1 is deprecated by its authors due to information leakage\n * (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.\n * See https://github.com/paralleldrive/cuid.\n */\nexport function cuid(params) {\n return core._cuid(ZodCUID, params);\n}\nexport const ZodCUID2 = /*@__PURE__*/ core.$constructor(\"ZodCUID2\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodCUID2.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function cuid2(params) {\n return core._cuid2(ZodCUID2, params);\n}\nexport const ZodULID = /*@__PURE__*/ core.$constructor(\"ZodULID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodULID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ulid(params) {\n return core._ulid(ZodULID, params);\n}\nexport const ZodXID = /*@__PURE__*/ core.$constructor(\"ZodXID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodXID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function xid(params) {\n return core._xid(ZodXID, params);\n}\nexport const ZodKSUID = /*@__PURE__*/ core.$constructor(\"ZodKSUID\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodKSUID.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ksuid(params) {\n return core._ksuid(ZodKSUID, params);\n}\nexport const ZodIPv4 = /*@__PURE__*/ core.$constructor(\"ZodIPv4\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodIPv4.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ipv4(params) {\n return core._ipv4(ZodIPv4, params);\n}\nexport const ZodMAC = /*@__PURE__*/ core.$constructor(\"ZodMAC\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodMAC.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function mac(params) {\n return core._mac(ZodMAC, params);\n}\nexport const ZodIPv6 = /*@__PURE__*/ core.$constructor(\"ZodIPv6\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodIPv6.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function ipv6(params) {\n return core._ipv6(ZodIPv6, params);\n}\nexport const ZodCIDRv4 = /*@__PURE__*/ core.$constructor(\"ZodCIDRv4\", (inst, def) => {\n core.$ZodCIDRv4.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function cidrv4(params) {\n return core._cidrv4(ZodCIDRv4, params);\n}\nexport const ZodCIDRv6 = /*@__PURE__*/ core.$constructor(\"ZodCIDRv6\", (inst, def) => {\n core.$ZodCIDRv6.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function cidrv6(params) {\n return core._cidrv6(ZodCIDRv6, params);\n}\nexport const ZodBase64 = /*@__PURE__*/ core.$constructor(\"ZodBase64\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodBase64.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function base64(params) {\n return core._base64(ZodBase64, params);\n}\nexport const ZodBase64URL = /*@__PURE__*/ core.$constructor(\"ZodBase64URL\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodBase64URL.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function base64url(params) {\n return core._base64url(ZodBase64URL, params);\n}\nexport const ZodE164 = /*@__PURE__*/ core.$constructor(\"ZodE164\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodE164.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function e164(params) {\n return core._e164(ZodE164, params);\n}\nexport const ZodJWT = /*@__PURE__*/ core.$constructor(\"ZodJWT\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodJWT.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function jwt(params) {\n return core._jwt(ZodJWT, params);\n}\nexport const ZodCustomStringFormat = /*@__PURE__*/ core.$constructor(\"ZodCustomStringFormat\", (inst, def) => {\n // ZodStringFormat.init(inst, def);\n core.$ZodCustomStringFormat.init(inst, def);\n ZodStringFormat.init(inst, def);\n});\nexport function stringFormat(format, fnOrRegex, _params = {}) {\n return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);\n}\nexport function hostname(_params) {\n return core._stringFormat(ZodCustomStringFormat, \"hostname\", core.regexes.hostname, _params);\n}\nexport function hex(_params) {\n return core._stringFormat(ZodCustomStringFormat, \"hex\", core.regexes.hex, _params);\n}\nexport function hash(alg, params) {\n const enc = params?.enc ?? \"hex\";\n const format = `${alg}_${enc}`;\n const regex = core.regexes[format];\n if (!regex)\n throw new Error(`Unrecognized hash format: ${format}`);\n return core._stringFormat(ZodCustomStringFormat, format, regex, params);\n}\nexport const ZodNumber = /*@__PURE__*/ core.$constructor(\"ZodNumber\", (inst, def) => {\n core.$ZodNumber.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);\n _installLazyMethods(inst, \"ZodNumber\", {\n gt(value, params) {\n return this.check(checks.gt(value, params));\n },\n gte(value, params) {\n return this.check(checks.gte(value, params));\n },\n min(value, params) {\n return this.check(checks.gte(value, params));\n },\n lt(value, params) {\n return this.check(checks.lt(value, params));\n },\n lte(value, params) {\n return this.check(checks.lte(value, params));\n },\n max(value, params) {\n return this.check(checks.lte(value, params));\n },\n int(params) {\n return this.check(int(params));\n },\n safe(params) {\n return this.check(int(params));\n },\n positive(params) {\n return this.check(checks.gt(0, params));\n },\n nonnegative(params) {\n return this.check(checks.gte(0, params));\n },\n negative(params) {\n return this.check(checks.lt(0, params));\n },\n nonpositive(params) {\n return this.check(checks.lte(0, params));\n },\n multipleOf(value, params) {\n return this.check(checks.multipleOf(value, params));\n },\n step(value, params) {\n return this.check(checks.multipleOf(value, params));\n },\n finite() {\n return this;\n },\n });\n const bag = inst._zod.bag;\n inst.minValue =\n Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;\n inst.maxValue =\n Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;\n inst.isInt = (bag.format ?? \"\").includes(\"int\") || Number.isSafeInteger(bag.multipleOf ?? 0.5);\n inst.isFinite = true;\n inst.format = bag.format ?? null;\n});\nexport function number(params) {\n return core._number(ZodNumber, params);\n}\nexport const ZodNumberFormat = /*@__PURE__*/ core.$constructor(\"ZodNumberFormat\", (inst, def) => {\n core.$ZodNumberFormat.init(inst, def);\n ZodNumber.init(inst, def);\n});\nexport function int(params) {\n return core._int(ZodNumberFormat, params);\n}\nexport function float32(params) {\n return core._float32(ZodNumberFormat, params);\n}\nexport function float64(params) {\n return core._float64(ZodNumberFormat, params);\n}\nexport function int32(params) {\n return core._int32(ZodNumberFormat, params);\n}\nexport function uint32(params) {\n return core._uint32(ZodNumberFormat, params);\n}\nexport const ZodBoolean = /*@__PURE__*/ core.$constructor(\"ZodBoolean\", (inst, def) => {\n core.$ZodBoolean.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.booleanProcessor(inst, ctx, json, params);\n});\nexport function boolean(params) {\n return core._boolean(ZodBoolean, params);\n}\nexport const ZodBigInt = /*@__PURE__*/ core.$constructor(\"ZodBigInt\", (inst, def) => {\n core.$ZodBigInt.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);\n inst.gte = (value, params) => inst.check(checks.gte(value, params));\n inst.min = (value, params) => inst.check(checks.gte(value, params));\n inst.gt = (value, params) => inst.check(checks.gt(value, params));\n inst.gte = (value, params) => inst.check(checks.gte(value, params));\n inst.min = (value, params) => inst.check(checks.gte(value, params));\n inst.lt = (value, params) => inst.check(checks.lt(value, params));\n inst.lte = (value, params) => inst.check(checks.lte(value, params));\n inst.max = (value, params) => inst.check(checks.lte(value, params));\n inst.positive = (params) => inst.check(checks.gt(BigInt(0), params));\n inst.negative = (params) => inst.check(checks.lt(BigInt(0), params));\n inst.nonpositive = (params) => inst.check(checks.lte(BigInt(0), params));\n inst.nonnegative = (params) => inst.check(checks.gte(BigInt(0), params));\n inst.multipleOf = (value, params) => inst.check(checks.multipleOf(value, params));\n const bag = inst._zod.bag;\n inst.minValue = bag.minimum ?? null;\n inst.maxValue = bag.maximum ?? null;\n inst.format = bag.format ?? null;\n});\nexport function bigint(params) {\n return core._bigint(ZodBigInt, params);\n}\nexport const ZodBigIntFormat = /*@__PURE__*/ core.$constructor(\"ZodBigIntFormat\", (inst, def) => {\n core.$ZodBigIntFormat.init(inst, def);\n ZodBigInt.init(inst, def);\n});\n// int64\nexport function int64(params) {\n return core._int64(ZodBigIntFormat, params);\n}\n// uint64\nexport function uint64(params) {\n return core._uint64(ZodBigIntFormat, params);\n}\nexport const ZodSymbol = /*@__PURE__*/ core.$constructor(\"ZodSymbol\", (inst, def) => {\n core.$ZodSymbol.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.symbolProcessor(inst, ctx, json, params);\n});\nexport function symbol(params) {\n return core._symbol(ZodSymbol, params);\n}\nexport const ZodUndefined = /*@__PURE__*/ core.$constructor(\"ZodUndefined\", (inst, def) => {\n core.$ZodUndefined.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.undefinedProcessor(inst, ctx, json, params);\n});\nfunction _undefined(params) {\n return core._undefined(ZodUndefined, params);\n}\nexport { _undefined as undefined };\nexport const ZodNull = /*@__PURE__*/ core.$constructor(\"ZodNull\", (inst, def) => {\n core.$ZodNull.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nullProcessor(inst, ctx, json, params);\n});\nfunction _null(params) {\n return core._null(ZodNull, params);\n}\nexport { _null as null };\nexport const ZodAny = /*@__PURE__*/ core.$constructor(\"ZodAny\", (inst, def) => {\n core.$ZodAny.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.anyProcessor(inst, ctx, json, params);\n});\nexport function any() {\n return core._any(ZodAny);\n}\nexport const ZodUnknown = /*@__PURE__*/ core.$constructor(\"ZodUnknown\", (inst, def) => {\n core.$ZodUnknown.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.unknownProcessor(inst, ctx, json, params);\n});\nexport function unknown() {\n return core._unknown(ZodUnknown);\n}\nexport const ZodNever = /*@__PURE__*/ core.$constructor(\"ZodNever\", (inst, def) => {\n core.$ZodNever.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.neverProcessor(inst, ctx, json, params);\n});\nexport function never(params) {\n return core._never(ZodNever, params);\n}\nexport const ZodVoid = /*@__PURE__*/ core.$constructor(\"ZodVoid\", (inst, def) => {\n core.$ZodVoid.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.voidProcessor(inst, ctx, json, params);\n});\nfunction _void(params) {\n return core._void(ZodVoid, params);\n}\nexport { _void as void };\nexport const ZodDate = /*@__PURE__*/ core.$constructor(\"ZodDate\", (inst, def) => {\n core.$ZodDate.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);\n inst.min = (value, params) => inst.check(checks.gte(value, params));\n inst.max = (value, params) => inst.check(checks.lte(value, params));\n const c = inst._zod.bag;\n inst.minDate = c.minimum ? new Date(c.minimum) : null;\n inst.maxDate = c.maximum ? new Date(c.maximum) : null;\n});\nexport function date(params) {\n return core._date(ZodDate, params);\n}\nexport const ZodArray = /*@__PURE__*/ core.$constructor(\"ZodArray\", (inst, def) => {\n core.$ZodArray.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);\n inst.element = def.element;\n _installLazyMethods(inst, \"ZodArray\", {\n min(n, params) {\n return this.check(checks.minLength(n, params));\n },\n nonempty(params) {\n return this.check(checks.minLength(1, params));\n },\n max(n, params) {\n return this.check(checks.maxLength(n, params));\n },\n length(n, params) {\n return this.check(checks.length(n, params));\n },\n unwrap() {\n return this.element;\n },\n });\n});\nexport function array(element, params) {\n return core._array(ZodArray, element, params);\n}\n// .keyof\nexport function keyof(schema) {\n const shape = schema._zod.def.shape;\n return _enum(Object.keys(shape));\n}\nexport const ZodObject = /*@__PURE__*/ core.$constructor(\"ZodObject\", (inst, def) => {\n core.$ZodObjectJIT.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.objectProcessor(inst, ctx, json, params);\n util.defineLazy(inst, \"shape\", () => {\n return def.shape;\n });\n _installLazyMethods(inst, \"ZodObject\", {\n keyof() {\n return _enum(Object.keys(this._zod.def.shape));\n },\n catchall(catchall) {\n return this.clone({ ...this._zod.def, catchall: catchall });\n },\n passthrough() {\n return this.clone({ ...this._zod.def, catchall: unknown() });\n },\n loose() {\n return this.clone({ ...this._zod.def, catchall: unknown() });\n },\n strict() {\n return this.clone({ ...this._zod.def, catchall: never() });\n },\n strip() {\n return this.clone({ ...this._zod.def, catchall: undefined });\n },\n extend(incoming) {\n return util.extend(this, incoming);\n },\n safeExtend(incoming) {\n return util.safeExtend(this, incoming);\n },\n merge(other) {\n return util.merge(this, other);\n },\n pick(mask) {\n return util.pick(this, mask);\n },\n omit(mask) {\n return util.omit(this, mask);\n },\n partial(...args) {\n return util.partial(ZodOptional, this, args[0]);\n },\n required(...args) {\n return util.required(ZodNonOptional, this, args[0]);\n },\n });\n});\nexport function object(shape, params) {\n const def = {\n type: \"object\",\n shape: shape ?? {},\n ...util.normalizeParams(params),\n };\n return new ZodObject(def);\n}\n// strictObject\nexport function strictObject(shape, params) {\n return new ZodObject({\n type: \"object\",\n shape,\n catchall: never(),\n ...util.normalizeParams(params),\n });\n}\n// looseObject\nexport function looseObject(shape, params) {\n return new ZodObject({\n type: \"object\",\n shape,\n catchall: unknown(),\n ...util.normalizeParams(params),\n });\n}\nexport const ZodUnion = /*@__PURE__*/ core.$constructor(\"ZodUnion\", (inst, def) => {\n core.$ZodUnion.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);\n inst.options = def.options;\n});\nexport function union(options, params) {\n return new ZodUnion({\n type: \"union\",\n options: options,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodXor = /*@__PURE__*/ core.$constructor(\"ZodXor\", (inst, def) => {\n ZodUnion.init(inst, def);\n core.$ZodXor.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);\n inst.options = def.options;\n});\n/** Creates an exclusive union (XOR) where exactly one option must match.\n * Unlike regular unions that succeed when any option matches, xor fails if\n * zero or more than one option matches the input. */\nexport function xor(options, params) {\n return new ZodXor({\n type: \"union\",\n options: options,\n inclusive: false,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodDiscriminatedUnion = /*@__PURE__*/ core.$constructor(\"ZodDiscriminatedUnion\", (inst, def) => {\n ZodUnion.init(inst, def);\n core.$ZodDiscriminatedUnion.init(inst, def);\n});\nexport function discriminatedUnion(discriminator, options, params) {\n // const [options, params] = args;\n return new ZodDiscriminatedUnion({\n type: \"union\",\n options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodIntersection = /*@__PURE__*/ core.$constructor(\"ZodIntersection\", (inst, def) => {\n core.$ZodIntersection.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.intersectionProcessor(inst, ctx, json, params);\n});\nexport function intersection(left, right) {\n return new ZodIntersection({\n type: \"intersection\",\n left: left,\n right: right,\n });\n}\nexport const ZodTuple = /*@__PURE__*/ core.$constructor(\"ZodTuple\", (inst, def) => {\n core.$ZodTuple.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.tupleProcessor(inst, ctx, json, params);\n inst.rest = (rest) => inst.clone({\n ...inst._zod.def,\n rest: rest,\n });\n});\nexport function tuple(items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof core.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new ZodTuple({\n type: \"tuple\",\n items: items,\n rest,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodRecord = /*@__PURE__*/ core.$constructor(\"ZodRecord\", (inst, def) => {\n core.$ZodRecord.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.recordProcessor(inst, ctx, json, params);\n inst.keyType = def.keyType;\n inst.valueType = def.valueType;\n});\nexport function record(keyType, valueType, params) {\n // v3-compat: z.record(valueType, params?) — defaults keyType to z.string()\n if (!valueType || !valueType._zod) {\n return new ZodRecord({\n type: \"record\",\n keyType: string(),\n valueType: keyType,\n ...util.normalizeParams(valueType),\n });\n }\n return new ZodRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\n// type alksjf = core.output<core.$ZodRecordKey>;\nexport function partialRecord(keyType, valueType, params) {\n const k = core.clone(keyType);\n k._zod.values = undefined;\n return new ZodRecord({\n type: \"record\",\n keyType: k,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport function looseRecord(keyType, valueType, params) {\n return new ZodRecord({\n type: \"record\",\n keyType,\n valueType: valueType,\n mode: \"loose\",\n ...util.normalizeParams(params),\n });\n}\nexport const ZodMap = /*@__PURE__*/ core.$constructor(\"ZodMap\", (inst, def) => {\n core.$ZodMap.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.mapProcessor(inst, ctx, json, params);\n inst.keyType = def.keyType;\n inst.valueType = def.valueType;\n inst.min = (...args) => inst.check(core._minSize(...args));\n inst.nonempty = (params) => inst.check(core._minSize(1, params));\n inst.max = (...args) => inst.check(core._maxSize(...args));\n inst.size = (...args) => inst.check(core._size(...args));\n});\nexport function map(keyType, valueType, params) {\n return new ZodMap({\n type: \"map\",\n keyType: keyType,\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodSet = /*@__PURE__*/ core.$constructor(\"ZodSet\", (inst, def) => {\n core.$ZodSet.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);\n inst.min = (...args) => inst.check(core._minSize(...args));\n inst.nonempty = (params) => inst.check(core._minSize(1, params));\n inst.max = (...args) => inst.check(core._maxSize(...args));\n inst.size = (...args) => inst.check(core._size(...args));\n});\nexport function set(valueType, params) {\n return new ZodSet({\n type: \"set\",\n valueType: valueType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodEnum = /*@__PURE__*/ core.$constructor(\"ZodEnum\", (inst, def) => {\n core.$ZodEnum.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.enumProcessor(inst, ctx, json, params);\n inst.enum = def.entries;\n inst.options = Object.values(def.entries);\n const keys = new Set(Object.keys(def.entries));\n inst.extract = (values, params) => {\n const newEntries = {};\n for (const value of values) {\n if (keys.has(value)) {\n newEntries[value] = def.entries[value];\n }\n else\n throw new Error(`Key ${value} not found in enum`);\n }\n return new ZodEnum({\n ...def,\n checks: [],\n ...util.normalizeParams(params),\n entries: newEntries,\n });\n };\n inst.exclude = (values, params) => {\n const newEntries = { ...def.entries };\n for (const value of values) {\n if (keys.has(value)) {\n delete newEntries[value];\n }\n else\n throw new Error(`Key ${value} not found in enum`);\n }\n return new ZodEnum({\n ...def,\n checks: [],\n ...util.normalizeParams(params),\n entries: newEntries,\n });\n };\n});\nfunction _enum(values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n return new ZodEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport { _enum as enum };\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function nativeEnum(entries, params) {\n return new ZodEnum({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodLiteral = /*@__PURE__*/ core.$constructor(\"ZodLiteral\", (inst, def) => {\n core.$ZodLiteral.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.literalProcessor(inst, ctx, json, params);\n inst.values = new Set(def.values);\n Object.defineProperty(inst, \"value\", {\n get() {\n if (def.values.length > 1) {\n throw new Error(\"This schema contains multiple valid literal values. Use `.values` instead.\");\n }\n return def.values[0];\n },\n });\n});\nexport function literal(value, params) {\n return new ZodLiteral({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\nexport const ZodFile = /*@__PURE__*/ core.$constructor(\"ZodFile\", (inst, def) => {\n core.$ZodFile.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.fileProcessor(inst, ctx, json, params);\n inst.min = (size, params) => inst.check(core._minSize(size, params));\n inst.max = (size, params) => inst.check(core._maxSize(size, params));\n inst.mime = (types, params) => inst.check(core._mime(Array.isArray(types) ? types : [types], params));\n});\nexport function file(params) {\n return core._file(ZodFile, params);\n}\nexport const ZodTransform = /*@__PURE__*/ core.$constructor(\"ZodTransform\", (inst, def) => {\n core.$ZodTransform.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.transformProcessor(inst, ctx, json, params);\n inst._zod.parse = (payload, _ctx) => {\n if (_ctx.direction === \"backward\") {\n throw new core.$ZodEncodeError(inst.constructor.name);\n }\n payload.addIssue = (issue) => {\n if (typeof issue === \"string\") {\n payload.issues.push(util.issue(issue, payload.value, def));\n }\n else {\n // for Zod 3 backwards compatibility\n const _issue = issue;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = \"custom\");\n _issue.input ?? (_issue.input = payload.value);\n _issue.inst ?? (_issue.inst = inst);\n // _issue.continue ??= true;\n payload.issues.push(util.issue(_issue));\n }\n };\n const output = def.transform(payload.value, payload);\n if (output instanceof Promise) {\n return output.then((output) => {\n payload.value = output;\n payload.fallback = true;\n return payload;\n });\n }\n payload.value = output;\n payload.fallback = true;\n return payload;\n };\n});\nexport function transform(fn) {\n return new ZodTransform({\n type: \"transform\",\n transform: fn,\n });\n}\nexport const ZodOptional = /*@__PURE__*/ core.$constructor(\"ZodOptional\", (inst, def) => {\n core.$ZodOptional.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function optional(innerType) {\n return new ZodOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodExactOptional = /*@__PURE__*/ core.$constructor(\"ZodExactOptional\", (inst, def) => {\n core.$ZodExactOptional.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function exactOptional(innerType) {\n return new ZodExactOptional({\n type: \"optional\",\n innerType: innerType,\n });\n}\nexport const ZodNullable = /*@__PURE__*/ core.$constructor(\"ZodNullable\", (inst, def) => {\n core.$ZodNullable.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nullableProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function nullable(innerType) {\n return new ZodNullable({\n type: \"nullable\",\n innerType: innerType,\n });\n}\n// nullish\nexport function nullish(innerType) {\n return optional(nullable(innerType));\n}\nexport const ZodDefault = /*@__PURE__*/ core.$constructor(\"ZodDefault\", (inst, def) => {\n core.$ZodDefault.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.defaultProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n inst.removeDefault = inst.unwrap;\n});\nexport function _default(innerType, defaultValue) {\n return new ZodDefault({\n type: \"default\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodPrefault = /*@__PURE__*/ core.$constructor(\"ZodPrefault\", (inst, def) => {\n core.$ZodPrefault.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.prefaultProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function prefault(innerType, defaultValue) {\n return new ZodPrefault({\n type: \"prefault\",\n innerType: innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport const ZodNonOptional = /*@__PURE__*/ core.$constructor(\"ZodNonOptional\", (inst, def) => {\n core.$ZodNonOptional.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nonoptionalProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function nonoptional(innerType, params) {\n return new ZodNonOptional({\n type: \"nonoptional\",\n innerType: innerType,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodSuccess = /*@__PURE__*/ core.$constructor(\"ZodSuccess\", (inst, def) => {\n core.$ZodSuccess.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.successProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function success(innerType) {\n return new ZodSuccess({\n type: \"success\",\n innerType: innerType,\n });\n}\nexport const ZodCatch = /*@__PURE__*/ core.$constructor(\"ZodCatch\", (inst, def) => {\n core.$ZodCatch.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.catchProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n inst.removeCatch = inst.unwrap;\n});\nfunction _catch(innerType, catchValue) {\n return new ZodCatch({\n type: \"catch\",\n innerType: innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : () => catchValue),\n });\n}\nexport { _catch as catch };\nexport const ZodNaN = /*@__PURE__*/ core.$constructor(\"ZodNaN\", (inst, def) => {\n core.$ZodNaN.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.nanProcessor(inst, ctx, json, params);\n});\nexport function nan(params) {\n return core._nan(ZodNaN, params);\n}\nexport const ZodPipe = /*@__PURE__*/ core.$constructor(\"ZodPipe\", (inst, def) => {\n core.$ZodPipe.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.pipeProcessor(inst, ctx, json, params);\n inst.in = def.in;\n inst.out = def.out;\n});\nexport function pipe(in_, out) {\n return new ZodPipe({\n type: \"pipe\",\n in: in_,\n out: out,\n // ...util.normalizeParams(params),\n });\n}\nexport const ZodCodec = /*@__PURE__*/ core.$constructor(\"ZodCodec\", (inst, def) => {\n ZodPipe.init(inst, def);\n core.$ZodCodec.init(inst, def);\n});\nexport function codec(in_, out, params) {\n return new ZodCodec({\n type: \"pipe\",\n in: in_,\n out: out,\n transform: params.decode,\n reverseTransform: params.encode,\n });\n}\nexport function invertCodec(codec) {\n const def = codec._zod.def;\n return new ZodCodec({\n type: \"pipe\",\n in: def.out,\n out: def.in,\n transform: def.reverseTransform,\n reverseTransform: def.transform,\n });\n}\nexport const ZodPreprocess = /*@__PURE__*/ core.$constructor(\"ZodPreprocess\", (inst, def) => {\n ZodPipe.init(inst, def);\n core.$ZodPreprocess.init(inst, def);\n});\nexport const ZodReadonly = /*@__PURE__*/ core.$constructor(\"ZodReadonly\", (inst, def) => {\n core.$ZodReadonly.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.readonlyProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function readonly(innerType) {\n return new ZodReadonly({\n type: \"readonly\",\n innerType: innerType,\n });\n}\nexport const ZodTemplateLiteral = /*@__PURE__*/ core.$constructor(\"ZodTemplateLiteral\", (inst, def) => {\n core.$ZodTemplateLiteral.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.templateLiteralProcessor(inst, ctx, json, params);\n});\nexport function templateLiteral(parts, params) {\n return new ZodTemplateLiteral({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\nexport const ZodLazy = /*@__PURE__*/ core.$constructor(\"ZodLazy\", (inst, def) => {\n core.$ZodLazy.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.lazyProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.getter();\n});\nexport function lazy(getter) {\n return new ZodLazy({\n type: \"lazy\",\n getter: getter,\n });\n}\nexport const ZodPromise = /*@__PURE__*/ core.$constructor(\"ZodPromise\", (inst, def) => {\n core.$ZodPromise.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.promiseProcessor(inst, ctx, json, params);\n inst.unwrap = () => inst._zod.def.innerType;\n});\nexport function promise(innerType) {\n return new ZodPromise({\n type: \"promise\",\n innerType: innerType,\n });\n}\nexport const ZodFunction = /*@__PURE__*/ core.$constructor(\"ZodFunction\", (inst, def) => {\n core.$ZodFunction.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.functionProcessor(inst, ctx, json, params);\n});\nexport function _function(params) {\n return new ZodFunction({\n type: \"function\",\n input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),\n output: params?.output ?? unknown(),\n });\n}\nexport { _function as function };\nexport const ZodCustom = /*@__PURE__*/ core.$constructor(\"ZodCustom\", (inst, def) => {\n core.$ZodCustom.init(inst, def);\n ZodType.init(inst, def);\n inst._zod.processJSONSchema = (ctx, json, params) => processors.customProcessor(inst, ctx, json, params);\n});\n// custom checks\nexport function check(fn) {\n const ch = new core.$ZodCheck({\n check: \"custom\",\n // ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\nexport function custom(fn, _params) {\n return core._custom(ZodCustom, fn ?? (() => true), _params);\n}\nexport function refine(fn, _params = {}) {\n return core._refine(ZodCustom, fn, _params);\n}\n// superRefine\nexport function superRefine(fn, params) {\n return core._superRefine(fn, params);\n}\n// Re-export describe and meta from core\nexport const describe = core.describe;\nexport const meta = core.meta;\nfunction _instanceof(cls, params = {}) {\n const inst = new ZodCustom({\n type: \"custom\",\n check: \"custom\",\n fn: (data) => data instanceof cls,\n abort: true,\n ...util.normalizeParams(params),\n });\n inst._zod.bag.Class = cls;\n // Override check to emit invalid_type instead of custom\n inst._zod.check = (payload) => {\n if (!(payload.value instanceof cls)) {\n payload.issues.push({\n code: \"invalid_type\",\n expected: cls.name,\n input: payload.value,\n inst,\n path: [...(inst._zod.def.path ?? [])],\n });\n }\n };\n return inst;\n}\nexport { _instanceof as instanceof };\n// stringbool\nexport const stringbool = (...args) => core._stringbool({\n Codec: ZodCodec,\n Boolean: ZodBoolean,\n String: ZodString,\n}, ...args);\nexport function json(params) {\n const jsonSchema = lazy(() => {\n return union([string(params), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);\n });\n return jsonSchema;\n}\n// preprocess\nexport function preprocess(fn, schema) {\n return new ZodPreprocess({\n type: \"pipe\",\n in: transform(fn),\n out: schema,\n });\n}\n","import { z } from \"zod\";\nimport {\n defineInterface,\n requestType,\n notificationType,\n type InterfaceClient,\n} from \"@vscode/hubrpc\";\n\n// -- Shared zod schemas ------------------------------------------------------\n\nconst zJsonValue: z.ZodType<unknown> = z.unknown();\n\nconst zEditorCapabilities = z.object({\n supportsContentEdits: z.boolean().optional(),\n supportsOptions: z.boolean().optional(),\n});\n\nconst zHostCapabilities = z.object({\n supportsContentEdits: z.boolean().optional(),\n supportsOptions: z.boolean().optional(),\n supportsForceUpdate: z.boolean().optional(),\n});\n\nconst zTextEdit = z.object({\n offset: z.number().int().nonnegative(),\n length: z.number().int().nonnegative(),\n newText: z.string(),\n});\n\nconst zContentEdit = z.discriminatedUnion(\"kind\", [\n z.object({\n kind: z.literal(\"replace\"),\n path: z.array(z.string()),\n newValue: zJsonValue,\n }),\n z.object({\n kind: z.literal(\"stringEdits\"),\n path: z.array(z.string()),\n stringEdits: z.array(zTextEdit),\n }),\n]);\n\nexport type ContentEdit = z.infer<typeof zContentEdit>;\nexport type TextEdit = z.infer<typeof zTextEdit>;\nexport type EditorCapabilities = z.infer<typeof zEditorCapabilities>;\nexport type HostCapabilities = z.infer<typeof zHostCapabilities>;\n\nexport type ContentType = \"text\" | \"json\";\n\n// -- IHost (editor -> host) --------------------------------------------------\n\nexport const webEditorHostInterface = defineInterface(\n {\n id: \"web-editor-host\",\n description: \"Methods the host exposes to the editor (web-editor/0.12).\",\n },\n {\n initialized: requestType(\n z.object({\n protocolVersion: z.literal(\"web-editor/0.12\"),\n contentType: z.enum([\"text\", \"json\"]),\n capabilities: zEditorCapabilities.optional(),\n }),\n z.object({\n protocolVersion: z.literal(\"web-editor-host/0.12\"),\n capabilities: zHostCapabilities.optional(),\n }),\n ),\n\n applyContentEdit: notificationType(\n z.object({\n edits: z.array(zContentEdit),\n clientRevision: z.number().int().nonnegative(),\n basedOnServerRevision: z.number().int().nonnegative(),\n }),\n ),\n\n /**\n * The editor reports its laid-out content height (px). An embedding host\n * that reserves block space (e.g. an iframe with no intrinsic height)\n * uses this to size the frame once the guest has measured itself.\n */\n reportSize: notificationType(\n z.object({\n height: z.number().nonnegative(),\n }),\n ),\n },\n);\n\n// -- IEditor (host -> editor) ------------------------------------------------\n\nexport const webEditorInterface = defineInterface(\n {\n id: \"web-editor\",\n description: \"Methods the editor exposes to the host (web-editor/0.12).\",\n },\n {\n update: notificationType(\n z.object({\n content: zJsonValue.optional(),\n options: zJsonValue.optional(),\n readOnly: z.boolean().optional(),\n serverRevision: z.number().int().nonnegative().optional(),\n acknowledgedClientRevision: z.number().int().nonnegative().optional(),\n force: z.boolean().optional(),\n }),\n ),\n\n applyContentEdits: notificationType(\n z.object({\n edits: z.array(zContentEdit),\n serverRevision: z.number().int().nonnegative(),\n acknowledgedClientRevision: z.number().int().nonnegative(),\n }),\n ),\n\n getContentSchema: requestType(\n z.object({}),\n z.object({ schema: zJsonValue }),\n ),\n },\n);\n\n// -- VsCodeAppHost (editor -> host): always registered -----------------------\n\n/** Per-scope registration: `registered` (toolbar button) and `isDefault` (auto-open). */\nconst zScopeRegistration = z.object({\n registered: z.boolean(),\n isDefault: z.boolean(),\n});\n\nexport const vscodeAppHostInterface = defineInterface(\n {\n id: \"vscode-app-host\",\n description: \"Methods an app `.vscode-app.html` exposes to the host (vscode-app-host/0.1).\",\n },\n {\n getContext: requestType(\n z.object({}),\n z.object({\n dataDocument: z\n .object({ contentType: z.enum([\"text\", \"json\"]) })\n .nullable(),\n }),\n ),\n /**\n * This app's registration for `extension` (e.g. `\".csv\"`), reported per\n * scope. Served on the app's own (ungated) root overlay, so it needs no\n * capability. For each scope:\n * - `registered` — the app is wired up for the type (an \"Open as\n * Custom Editor\" toolbar button appears), via the `editorTypes`\n * setting.\n * - `isDefault` — the type *auto-opens* in the app (implies\n * `registered`), via `workbench.editorAssociations`.\n * `hasWorkspace` indicates whether a workspace is open. Changing any of\n * this is done via {@link configureEditorAssociation} (host-rendered).\n */\n getEditorRegistration: requestType(\n z.object({ extension: z.string() }),\n z.object({\n global: zScopeRegistration,\n workspace: zScopeRegistration,\n hasWorkspace: z.boolean(),\n }),\n ),\n /**\n * Ask the host to show its (trusted, host-rendered) editor-association\n * dialog for `extension` (e.g. `\".csv\"`). The host owns the UI and\n * applies any change to `editorTypes` / `workbench.editorAssociations`\n * itself — the app never writes settings and needs no capability.\n *\n * `dismissable` is a hint: when the app is opened directly (no bound\n * data document) the host shows the dialog *unclosable* (the user can\n * still just close the editor tab) regardless of the hint; when bound to\n * a data document the dialog is dismissable unless `dismissable` is\n * `false`. Resolves once the dialog is dismissed, reporting the final\n * per-scope registration and whether anything `changed`.\n */\n configureEditorAssociation: requestType(\n z.object({\n extension: z.string(),\n dismissable: z.boolean().optional(),\n }),\n z.object({\n global: zScopeRegistration,\n workspace: zScopeRegistration,\n hasWorkspace: z.boolean(),\n changed: z.boolean(),\n }),\n ),\n },\n);\n\n// -- Typed call-site shapes --------------------------------------------------\n\n/** Typed proxy used by the editor to invoke host methods. */\nexport type WebEditorHostProxy = InterfaceClient<typeof webEditorHostInterface>;\n\n/** Typed proxy used by the host to invoke editor methods. */\nexport type WebEditorProxy = InterfaceClient<typeof webEditorInterface>;\n\n/** Typed proxy used by an app to invoke `vscode-app-host` methods. */\nexport type VsCodeAppHostProxy = InterfaceClient<typeof vscodeAppHostInterface>;\n\n/** Scope a registration is written to. */\nexport type EditorScope = \"workspace\" | \"global\";\n\n/** This app's registration in one scope. */\nexport interface ScopeRegistration {\n /** Wired for the type (an \"Open as Custom Editor\" toolbar button appears). */\n readonly registered: boolean;\n /** The type auto-opens in this app (implies {@link registered}). */\n readonly isDefault: boolean;\n}\n\n/** Per-scope registration reported by `getEditorRegistration`. */\nexport interface EditorRegistrationStatus {\n /** Registration in user (global) settings. */\n readonly global: ScopeRegistration;\n /** Registration in the open workspace's settings. */\n readonly workspace: ScopeRegistration;\n /** Whether a workspace is open (so a workspace-scoped action applies). */\n readonly hasWorkspace: boolean;\n}\n\n/** Result of {@link vscodeAppHostInterface.configureEditorAssociation}. */\nexport interface EditorAssociationResult extends EditorRegistrationStatus {\n /** Whether the registration changed while the dialog was open. */\n readonly changed: boolean;\n}\n","import type { ContentEdit, TextEdit } from \"../protocol\";\n\nexport type JsonValue = unknown;\n\n/**\n * Apply a list of {@link ContentEdit}s to a JSON value.\n *\n * Edits are applied in order. Each edit either replaces the value at `path`\n * or applies a sequence of string edits to the string at `path`.\n *\n * Returns the new root value. May mutate intermediate containers — callers\n * should treat the input as consumed.\n */\nexport function applyContentEdits(root: JsonValue, edits: readonly ContentEdit[]): JsonValue {\n let current = root;\n for (const edit of edits) {\n if (edit.kind === \"replace\") {\n current = setAtPath(current, edit.path, edit.newValue);\n } else {\n const existing = getAtPath(current, edit.path);\n if (typeof existing !== \"string\") {\n throw new Error(\n `applyContentEdits: stringEdits at path [${edit.path.join(\", \")}] requires a string, got ${typeof existing}`,\n );\n }\n current = setAtPath(current, edit.path, applyTextEdits(existing, edit.stringEdits));\n }\n }\n return current;\n}\n\n/** Apply a list of {@link TextEdit}s to a string. Edits are applied in array order. */\nexport function applyTextEdits(text: string, edits: readonly TextEdit[]): string {\n let result = text;\n for (const e of edits) {\n result = result.slice(0, e.offset) + e.newText + result.slice(e.offset + e.length);\n }\n return result;\n}\n\nfunction getAtPath(root: JsonValue, path: readonly string[]): JsonValue {\n let cur: any = root;\n for (const key of path) {\n if (cur === null || cur === undefined) return undefined;\n cur = cur[key];\n }\n return cur;\n}\n\nfunction setAtPath(root: JsonValue, path: readonly string[], value: JsonValue): JsonValue {\n if (path.length === 0) return value;\n const rootObj: any = root === null || typeof root !== \"object\" ? {} : root;\n let cur: any = rootObj;\n for (let i = 0; i < path.length - 1; i++) {\n const key = path[i];\n const next = cur[key];\n if (next === null || typeof next !== \"object\") {\n cur[key] = {};\n }\n cur = cur[key];\n }\n cur[path[path.length - 1]] = value;\n return rootObj;\n}\n","import type { ContentType } from \"../protocol\";\nimport type { JsonValue } from \"./contentModel\";\n\n/**\n * Options for encoding text as JSON content.\n *\n * `indentation` is forwarded to `JSON.stringify`. The encoded value may\n * contain a `$web-editor.format-json` hint that overrides this.\n */\nexport interface JsonFormatOptions {\n indentation?: number | \"\\t\" | undefined;\n}\n\n/**\n * Encode a host-side text document into the value the editor sees.\n *\n * - `text`: identity.\n * - `json`: `JSON.parse(text)`. Throws on parse error.\n */\nexport function encodeForEditor(text: string, contentType: ContentType): JsonValue {\n if (contentType === \"text\") return text;\n if (text === \"\") return null;\n return JSON.parse(text);\n}\n\n/**\n * Decode the editor-side value back into the text the host stores.\n *\n * - `text`: must be a string; returned as-is.\n * - `json`: stringified. Honors `$web-editor.format-json` on the value\n * (number | \"\\t\") and otherwise the passed-in options.\n */\nexport function decodeFromEditor(\n value: JsonValue,\n contentType: ContentType,\n options: JsonFormatOptions = {},\n): string {\n if (contentType === \"text\") {\n if (typeof value !== \"string\") {\n throw new Error(`decodeFromEditor: expected string for text content, got ${typeof value}`);\n }\n return value;\n }\n\n let indentation = options.indentation;\n if (value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n const hint = (value as Record<string, unknown>)[\"$web-editor.format-json\"];\n if (typeof hint === \"number\" || hint === \"\\t\") {\n indentation = hint;\n } else if (hint !== undefined) {\n indentation = 4;\n }\n }\n return JSON.stringify(value, undefined, indentation);\n}\n","/*---------------------------------------------------------------------------------------------\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License. See License.txt in the project root for license information.\n*--------------------------------------------------------------------------------------------*/\nimport { $ as readSignature, A as crypto_exports, At as generateTsInterface, B as Channel, Bt as RequestType, C as PublicSigningIdentity, Ct as StreamControlType, D as attachCapabilities, Dt as directoryInterface, E as Principal, Et as defaultsInterface, F as parseEndpointUri, Ft as computeInterfaceHash, G as traceMessageTransport, H as MultiplexedTransport, Ht as requestType, I as ChannelConnector, J as parseMethodName, K as requireObjectParams, L as HubRpcConnection, Lt as jcsCanonicalize, Mt as InterfaceDefinition, N as formatEndpointUri, Nt as defineInterface, O as signRpcCall, Ot as directoryWatchNever, P as isHubEndpoint, Pt as interfaceFromSchema, Q as getKeyId, R as ServiceHandle, Rt as jcsCanonicalizeBytes, S as KeypairSigningIdentity, St as StreamControlReason, T as CapBag, Tt as streamInterface, U as TransportPair, Ut as zodToSvcJsonSchema, V as RpcError, Vt as notificationType, W as connectTransports, Wt as normalizeJsonSchema, X as HUBRPC_SIGNATURE_KEY, Y as HUBRPC_META_KEY, Z as HUBRPC_UNSIGNED_KEY, _ as registerIdentityOnOverlay, _t as ErrorCode, a as verifyCall, at as PRINCIPAL_PREFIX, b as identityStorageInterface, bt as isResponse, c as permits, ct as keyIdForPrincipal, d as SigningSender, dt as publicKeyForKeyId, et as signedHash, f as PrincipalWithStore, ft as resolveSigningKey, g as createManagedIdentity, gt as permissionPermits, h as InMemoryManagedIdentityStorage, ht as permissionMatchesTarget, i as signParams, it as KEY_ID_PREFIX, jt as isAssignable, k as verifyRpcCall, kt as schemasInterface, l as signCapability, lt as keyIdForPublicKey, m as InMemoryManagedIdentity, mt as matchParams, n as createSeededMemoryPrincipal, nt as signingPad, o as capBagFreshAt, ot as base64UrlToBytes, p as createManagedPrincipal, pt as capabilityPermits, q as methodNameToTarget, r as createSeededSigningIdentity, rt as withSignature, s as capabilityFreshAt, st as bytesToBase64Url, t as createMemoryPrincipal, tt as signingInput, u as OneShotCapStaging, ut as principalForPublicKey, v as registerLazyIdentityOnOverlay, vt as isNotification, w as PublicWrappingIdentity, wt as StreamDir, x as KeypairIdentity, xt as STREAM_METHOD, y as identityInterface, yt as isRequest, z as JsonRpcChannel, zt as NotificationType } from \"./chunks/src-Bcqt3hMa.js\";\n//#region src/transport/windowMessageTransport.ts\n/**\n* IMessageTransport for two `window`-like endpoints exchanging JSON-RPC\n* messages via `postMessage`. Outgoing messages go to `their`; incoming\n* `message` events are filtered to those whose `source` is `their`.\n*\n* Typical pairings:\n* - Editor in iframe: `new WindowMessageTransport(window, window.parent)`\n* - Host wrapping an iframe: `new WindowMessageTransport(window, iframe.contentWindow)`\n*/\nvar WindowMessageTransport = class {\n\t_our;\n\t_their;\n\t_filterSource;\n\t_listener;\n\t_buffer = [];\n\t_closed = false;\n\t_handler = (event) => {\n\t\tif (this._filterSource && event.source !== this._their) return;\n\t\tconst data = event.data;\n\t\tif (!isJsonRpcMessage(data)) return;\n\t\tif (this._listener) this._listener(data);\n\t\telse this._buffer.push(data);\n\t};\n\tconstructor(_our, _their, _filterSource = true) {\n\t\tthis._our = _our;\n\t\tthis._their = _their;\n\t\tthis._filterSource = _filterSource;\n\t\tif (_our === _their) throw new Error(\"WindowMessageTransport: cannot connect to self\");\n\t\t_our.addEventListener(\"message\", this._handler);\n\t}\n\tsend(message) {\n\t\tif (this._closed) return;\n\t\tthis._their.postMessage(message, \"*\");\n\t}\n\tsetListener(listener) {\n\t\tthis._listener = listener;\n\t\tif (listener) while (this._buffer.length > 0 && this._listener) listener(this._buffer.shift());\n\t}\n\tdispose() {\n\t\tif (this._closed) return;\n\t\tthis._closed = true;\n\t\tthis._our.removeEventListener(\"message\", this._handler);\n\t}\n};\nfunction isJsonRpcMessage(value) {\n\treturn typeof value === \"object\" && value !== null && value.jsonrpc === \"2.0\";\n}\n//#endregion\nexport { CapBag, Channel, ChannelConnector, ErrorCode, HUBRPC_META_KEY, HUBRPC_SIGNATURE_KEY, HUBRPC_UNSIGNED_KEY, HubRpcConnection, InMemoryManagedIdentity, InMemoryManagedIdentityStorage, InterfaceDefinition, JsonRpcChannel, KEY_ID_PREFIX, KeypairIdentity, KeypairSigningIdentity, MultiplexedTransport, NotificationType, OneShotCapStaging, PRINCIPAL_PREFIX, Principal, PrincipalWithStore, PublicSigningIdentity, PublicWrappingIdentity, RequestType, RpcError, STREAM_METHOD, ServiceHandle, SigningSender, StreamControlReason, StreamControlType, StreamDir, TransportPair, WindowMessageTransport, attachCapabilities, base64UrlToBytes, bytesToBase64Url, capBagFreshAt, capabilityFreshAt, capabilityPermits, computeInterfaceHash, connectTransports, createManagedIdentity, createManagedPrincipal, createMemoryPrincipal, createSeededMemoryPrincipal, createSeededSigningIdentity, crypto_exports as crypto, defaultsInterface, defineInterface, directoryInterface, directoryWatchNever, formatEndpointUri, generateTsInterface, getKeyId, identityInterface, identityStorageInterface, interfaceFromSchema, isAssignable, isHubEndpoint, isNotification, isRequest, isResponse, jcsCanonicalize, jcsCanonicalizeBytes, keyIdForPrincipal, keyIdForPublicKey, matchParams, methodNameToTarget, normalizeJsonSchema, notificationType, parseEndpointUri, parseMethodName, permissionMatchesTarget, permissionPermits, permits, principalForPublicKey, publicKeyForKeyId, readSignature, registerIdentityOnOverlay, registerLazyIdentityOnOverlay, requestType, requireObjectParams, resolveSigningKey, schemasInterface, signCapability, signParams, signRpcCall, signedHash, signingInput, signingPad, streamInterface, traceMessageTransport, verifyCall, verifyRpcCall, withSignature, zodToSvcJsonSchema };\n\n//# sourceMappingURL=web.js.map","export interface IDisposable {\n dispose(): void;\n}\n\nexport type EventListener<T> = (event: T) => void;\nexport type Event<T> = (listener: EventListener<T>) => IDisposable;\n\nexport class Emitter<T> {\n private readonly _listeners = new Set<EventListener<T>>();\n\n public readonly event: Event<T> = (listener) => {\n this._listeners.add(listener);\n return { dispose: () => this._listeners.delete(listener) };\n };\n\n public fire(value: T): void {\n for (const listener of this._listeners) {\n try {\n listener(value);\n } catch (e) {\n console.error(\"Emitter listener threw:\", e);\n }\n }\n }\n\n public dispose(): void {\n this._listeners.clear();\n }\n}\n","import type { HubRpcConnection } from \"@vscode/hubrpc\";\nimport {\n webEditorHostInterface,\n webEditorInterface,\n type ContentType,\n type HostCapabilities,\n type EditorCapabilities,\n type WebEditorProxy,\n type ContentEdit,\n} from \"../protocol\";\nimport { applyContentEdits, type JsonValue } from \"../content/contentModel\";\nimport {\n decodeFromEditor,\n encodeForEditor,\n type JsonFormatOptions,\n} from \"../content/textJsonCodec\";\nimport { Emitter, type Event, type IDisposable } from \"../utils/event\";\n\nexport interface WebEditorHostOptions {\n /**\n * A connection wired up with a {@link IMessageTransport} that talks to the editor.\n * The host takes ownership and closes it on dispose.\n */\n connection: HubRpcConnection;\n /**\n * What the host stores. `text` is plain text; `json` is round-tripped through\n * `JSON.parse` / `JSON.stringify`. Default `text`.\n *\n * The editor announces its own `contentType` in `initialized`. They must match.\n */\n contentType?: ContentType;\n /** Initial text. Default `\"\"`. */\n initialText?: string;\n /** Initial read-only state. Default `false`. */\n readOnly?: boolean;\n /** Indentation for JSON content. Ignored for text. */\n jsonFormat?: JsonFormatOptions;\n /** Host capabilities advertised on `initialized`. */\n capabilities?: HostCapabilities;\n /** Called when the editor sends malformed input. Defaults to `console.error`. */\n onError?: (message: string, detail?: unknown) => void;\n}\n\n/**\n * Host-side façade for the web-editor v0.12 protocol.\n *\n * Owns the canonical text content. Translates between text/JSON form and the\n * structural edits exchanged with the editor. Maintains the revision pair\n * required by the client-authority conflict policy.\n */\nexport class WebEditorHost implements IDisposable {\n private readonly _connection: HubRpcConnection;\n private readonly _editor: WebEditorProxy;\n private readonly _contentType: ContentType;\n private readonly _jsonFormat: JsonFormatOptions;\n private readonly _onError: (message: string, detail?: unknown) => void;\n private readonly _capabilities: HostCapabilities;\n\n private _text: string;\n private _readOnly: boolean;\n private _serverRevision = 0;\n private _acknowledgedClientRevision = 0;\n private _editorInitialized = false;\n private _editorCapabilities: EditorCapabilities | undefined;\n\n private readonly _onDidChangeText = new Emitter<{ text: string }>();\n public readonly onDidChangeText: Event<{ text: string }> = this._onDidChangeText.event;\n\n private readonly _onDidInitialize = new Emitter<{ capabilities: EditorCapabilities | undefined }>();\n public readonly onDidInitialize: Event<{ capabilities: EditorCapabilities | undefined }> = this._onDidInitialize.event;\n\n private readonly _onDidReportSize = new Emitter<{ height: number }>();\n public readonly onDidReportSize: Event<{ height: number }> = this._onDidReportSize.event;\n\n constructor(options: WebEditorHostOptions) {\n this._connection = options.connection;\n this._contentType = options.contentType ?? \"text\";\n this._text = options.initialText ?? \"\";\n this._readOnly = options.readOnly ?? false;\n this._jsonFormat = options.jsonFormat ?? {};\n this._onError = options.onError ?? ((m, d) => console.error(\"WebEditorHost:\", m, d));\n this._capabilities = options.capabilities ?? { supportsForceUpdate: true };\n\n this._editor = this._connection.get(webEditorInterface);\n\n this._connection.register(webEditorHostInterface, {\n initialized: (params) => {\n if (params.contentType !== this._contentType) {\n this._onError(\n `Editor contentType \"${params.contentType}\" does not match host \"${this._contentType}\"`,\n );\n }\n this._editorCapabilities = params.capabilities;\n this._editorInitialized = true;\n this._serverRevision = 0;\n this._acknowledgedClientRevision = 0;\n\n this._pushFullUpdate();\n this._onDidInitialize.fire({ capabilities: params.capabilities });\n\n return {\n protocolVersion: \"web-editor-host/0.12\",\n capabilities: this._capabilities,\n };\n },\n\n applyContentEdit: (params) => {\n if (this._readOnly) {\n this._onError(\"Editor sent applyContentEdit while readOnly\");\n return;\n }\n let newValue: JsonValue;\n try {\n const current = encodeForEditor(this._text, this._contentType);\n newValue = applyContentEdits(current, params.edits);\n } catch (e) {\n this._onError(\"Failed to apply content edits from editor\", e);\n return;\n }\n let newText: string;\n try {\n newText = decodeFromEditor(newValue, this._contentType, this._jsonFormat);\n } catch (e) {\n this._onError(\"Failed to decode editor content\", e);\n return;\n }\n\n this._acknowledgedClientRevision = params.clientRevision;\n if (newText !== this._text) {\n this._text = newText;\n this._onDidChangeText.fire({ text: newText });\n }\n },\n\n reportSize: (params) => {\n this._onDidReportSize.fire({ height: params.height });\n },\n });\n }\n\n /** The text the host believes the document currently holds. */\n public getText(): string {\n return this._text;\n }\n\n /**\n * Push a new full text to the editor. Sent as a `replace` at the document\n * root. If `force`, the editor must adopt it even with pending local edits.\n */\n public setText(text: string, opts: { force?: boolean } = {}): void {\n if (text === this._text) return;\n this._text = text;\n this._pushFullUpdate(opts.force);\n }\n\n public getReadOnly(): boolean {\n return this._readOnly;\n }\n\n public setReadOnly(readOnly: boolean): void {\n if (this._readOnly === readOnly) return;\n this._readOnly = readOnly;\n if (this._editorInitialized) {\n this._editor.update({\n readOnly,\n acknowledgedClientRevision: this._acknowledgedClientRevision,\n });\n }\n }\n\n /**\n * Push fine-grained edits to the editor.\n * The host is responsible for keeping its own `_text` consistent with these edits.\n */\n public applyEdits(edits: readonly ContentEdit[]): void {\n if (edits.length === 0 || !this._editorInitialized) return;\n let newValue: JsonValue;\n try {\n const current = encodeForEditor(this._text, this._contentType);\n newValue = applyContentEdits(current, edits);\n this._text = decodeFromEditor(newValue, this._contentType, this._jsonFormat);\n } catch (e) {\n this._onError(\"Failed to apply outgoing edits to local text\", e);\n return;\n }\n this._serverRevision++;\n this._editor.applyContentEdits({\n edits: edits as ContentEdit[],\n serverRevision: this._serverRevision,\n acknowledgedClientRevision: this._acknowledgedClientRevision,\n });\n }\n\n public dispose(): void {\n this._onDidChangeText.dispose();\n this._onDidInitialize.dispose();\n this._onDidReportSize.dispose();\n this._connection.close();\n }\n\n private _pushFullUpdate(force?: boolean): void {\n if (!this._editorInitialized) return;\n this._serverRevision++;\n let content: JsonValue;\n try {\n content = encodeForEditor(this._text, this._contentType);\n } catch (e) {\n this._onError(\"Failed to encode text for editor\", e);\n return;\n }\n this._editor.update({\n content,\n readOnly: this._readOnly,\n serverRevision: this._serverRevision,\n acknowledgedClientRevision: this._acknowledgedClientRevision,\n force,\n });\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * EXPERIMENTAL — the iframe-backed implementation of the {@link IEmbeddedCodeEditor}\n * seam (see `blockView.ts`). It embeds a third-party web editor (the *guest*,\n * e.g. `@vscode/sample-web-editor`) in an `<iframe>` and bridges it to the code\n * block using the `@vscode/web-editors` host↔guest protocol:\n *\n * - document → editor : {@link IEmbeddedCodeEditor.setContent} → `host.setText`\n * - editor → document : guest edit → `host.onDidChangeText` → {@link IEmbeddedCodeEditor.onEdit}\n * as a whole-content {@link StringEdit}\n * - sizing : guest `reportSize` → `host.onDidReportSize` → iframe height\n *\n * The host owns the wrapper HTML (theme + `<div id=\"app\">` mount + the guest\n * bundle inlined), so the guest implements only editor logic. The frame is\n * `sandbox=\"allow-scripts\"` (no `allow-same-origin`) → opaque origin, matching\n * the `WindowMessageTransport` posture.\n *\n * The implementation is exported by the markdown editor, while its web-editor\n * runtime is bundled into the package so consumers do not need a runtime\n * dependency on `@vscode/web-editors`.\n */\n\nimport { HubRpcConnection, JsonRpcChannel } from '@vscode/hubrpc';\nimport { WebEditorHost, WindowMessageTransport } from '@vscode/web-editors';\nimport { OffsetRange } from '../core/offsetRange.js';\nimport { StringEdit } from '../core/stringEdit.js';\nimport type { IEmbeddedCodeEditor, IEmbeddedCodeEditorFactory } from './content/blockView.js';\n\nexport interface IframeEmbeddedEditorOptions {\n\t/** The guest bundle source (an IIFE/ESM string), inlined into the iframe. */\n\treadonly bundleJs: string;\n\t/** Decide whether this factory handles `language`. */\n\treadonly handlesLanguage: (language: string) => boolean;\n\t/** Theme CSS injected into the iframe `<head>` (e.g. `--vscode-*` variables). */\n\treadonly themeCss?: string;\n\t/**\n\t * Optional synchronous height (px) reserved from content before the guest\n\t * measures itself. Return `undefined` to let the guest size the frame.\n\t */\n\treadonly estimateHeight?: (content: string) => number | undefined;\n}\n\nconst BASE_CSS = `\n\t:root { color-scheme: light dark; }\n\thtml, body { margin: 0; padding: 0; background: transparent; }\n\tbody {\n\t\tfont-family: var(--vscode-font-family, system-ui, sans-serif);\n\t\tfont-size: var(--vscode-font-size, 13px);\n\t\tcolor: var(--vscode-foreground, #1e1e1e);\n\t\tpadding: 10px 12px;\n\t\tbox-sizing: border-box;\n\t}\n\t.sample-editor-header {\n\t\tfont-size: 11px;\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: .06em;\n\t\topacity: .6;\n\t\tmargin-bottom: 8px;\n\t}\n\t.fields { display: flex; flex-direction: column; gap: 6px; }\n\t.field { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 8px; }\n\t.field-name { opacity: .7; }\n\t.field-input {\n\t\tfont: inherit;\n\t\tpadding: 4px 8px;\n\t\tborder: 1px solid var(--vscode-input-border, rgba(128,128,128,.4));\n\t\tborder-radius: 4px;\n\t\tbackground: var(--vscode-input-background, rgba(128,128,128,.08));\n\t\tcolor: var(--vscode-input-foreground, inherit);\n\t}\n\t.field-input:focus {\n\t\toutline: 1px solid var(--vscode-focusBorder, #007fd4);\n\t\toutline-offset: -1px;\n\t}\n`;\n\nfunction buildSrcdoc(bundleJs: string, themeCss: string | undefined): string {\n\t// A stray `</script>` in the bundle would close our inline block early.\n\tconst safeJs = bundleJs.replace(/<\\/(script)/gi, '<\\\\/$1');\n\treturn `<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<style>${BASE_CSS}</style>\n${themeCss ? `<style>${themeCss}</style>` : ''}\n</head>\n<body>\n<div class=\"sample-editor-header\">Sample web editor (iframe)</div>\n<div id=\"app\"></div>\n<script>${safeJs}</script>\n</body>\n</html>`;\n}\n\nclass IframeEmbeddedEditor implements IEmbeddedCodeEditor {\n\tpublic readonly element: HTMLElement;\n\tpublic onEdit?: (edit: StringEdit) => void;\n\tpublic estimateHeight?: (content: string) => number | undefined;\n\n\tprivate readonly _iframe: HTMLIFrameElement;\n\tprivate _host: WebEditorHost | undefined;\n\tprivate _transport: WindowMessageTransport | undefined;\n\tprivate _disposed = false;\n\t/** The text the host currently holds — used to build whole-content edits and drop echoes. */\n\tprivate _lastContent: string;\n\t/** A `setContent` that arrived before the transport was wired. */\n\tprivate _pendingContent: string | undefined;\n\n\tconstructor(private readonly _options: IframeEmbeddedEditorOptions, initialContent: string) {\n\t\tthis._lastContent = initialContent;\n\t\tthis.estimateHeight = _options.estimateHeight;\n\n\t\tconst wrapper = document.createElement('div');\n\t\twrapper.style.width = '100%';\n\n\t\tconst iframe = document.createElement('iframe');\n\t\tiframe.setAttribute('sandbox', 'allow-scripts');\n\t\tiframe.style.width = '100%';\n\t\tiframe.style.border = 'none';\n\t\tiframe.style.display = 'block';\n\t\tiframe.style.background = 'transparent';\n\t\tiframe.style.height = '0px';\n\t\twrapper.appendChild(iframe);\n\n\t\tthis.element = wrapper;\n\t\tthis._iframe = iframe;\n\n\t\t// The block view mounts `element` synchronously right after we return.\n\t\t// Install the host transport before loading srcdoc so the guest cannot\n\t\t// send its initialization message before the host is listening.\n\t\tqueueMicrotask(() => this._trySetup());\n\t}\n\n\tpublic setContent(content: string): void {\n\t\tif (content === this._lastContent) { return; }\n\t\tthis._lastContent = content;\n\t\tif (this._host) { this._host.setText(content); }\n\t\telse { this._pendingContent = content; }\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._disposed = true;\n\t\tthis._host?.dispose();\n\t\tthis._transport?.dispose();\n\t\tthis._iframe.remove();\n\t}\n\n\tprivate _trySetup(): void {\n\t\tif (this._disposed) { return; }\n\t\tconst cw = this._iframe.contentWindow;\n\t\tif (!cw) { requestAnimationFrame(() => this._trySetup()); return; }\n\n\t\tthis._transport = new WindowMessageTransport(window, cw);\n\t\tconst connection = new HubRpcConnection(JsonRpcChannel.create(this._transport));\n\t\tthis._host = new WebEditorHost({\n\t\t\tconnection,\n\t\t\tcontentType: 'text',\n\t\t\tinitialText: this._lastContent,\n\t\t});\n\n\t\tthis._host.onDidChangeText(({ text }) => {\n\t\t\tconst edit = StringEdit.replace(OffsetRange.ofLength(this._lastContent.length), text);\n\t\t\tthis._lastContent = text;\n\t\t\tthis.onEdit?.(edit);\n\t\t});\n\n\t\tthis._host.onDidReportSize(({ height }) => {\n\t\t\tthis._iframe.style.height = `${Math.max(1, Math.ceil(height))}px`;\n\t\t\t// The guest now drives the height; drop the synchronous reservation.\n\t\t\tthis.element.style.minHeight = '';\n\t\t});\n\n\t\tif (this._pendingContent !== undefined) {\n\t\t\tthis._host.setText(this._pendingContent);\n\t\t\tthis._pendingContent = undefined;\n\t\t}\n\n\t\tthis._iframe.srcdoc = buildSrcdoc(this._options.bundleJs, this._options.themeCss);\n\t}\n}\n\n/**\n * Build an {@link IEmbeddedCodeEditorFactory} that renders matching code blocks\n * with the sample web editor embedded in an iframe.\n */\nexport function createIframeEmbeddedEditorFactory(options: IframeEmbeddedEditorOptions): IEmbeddedCodeEditorFactory {\n\treturn {\n\t\tcreate(language, initialContent) {\n\t\t\tif (!options.handlesLanguage(language)) { return undefined; }\n\t\t\treturn new IframeEmbeddedEditor(options, initialContent);\n\t\t},\n\t};\n}\n"],"names":["_a","$constructor","name","initializer","params","init","inst","def","_","proto","keys","i","k","Parent","Definition","fn","$ZodAsyncError","$ZodEncodeError","globalConfig","config","newConfig","getEnumValues","entries","numericValues","v","jsonStringifyReplacer","value","cached","getter","nullish","input","cleanRegex","source","start","end","floatSafeRemainder","val","step","ratio","roundedRatio","tolerance","EVALUATING","defineLazy","object","key","assignProp","target","prop","mergeDefs","defs","mergedDescriptors","descriptors","esc","str","slugify","captureStackTrace","_args","isObject","data","allowsEval","F","isPlainObject","o","ctor","prot","shallowClone","propertyKeyTypes","escapeRegex","clone","cl","normalizeParams","_params","optionalKeys","shape","NUMBER_FORMAT_RANGES","pick","schema","mask","currDef","checks","newShape","omit","extend","existingShape","_shape","safeExtend","merge","a","b","partial","Class","oldShape","required","aborted","x","startIndex","explicitlyAborted","prefixIssues","path","issues","iss","unwrapMessage","message","finalizeIssue","ctx","_inst","_continue","_input","rest","getLengthableOrigin","issue","args","util.jsonStringifyReplacer","$ZodError","$ZodRealError","flattenError","error","mapper","fieldErrors","formErrors","sub","formatError","processError","fullpath","curr","el","_parse","_Err","_ctx","result","core.$ZodAsyncError","e","util.finalizeIssue","core.config","util.captureStackTrace","parse","errors.$ZodRealError","_parseAsync","parseAsync","_safeParse","errors.$ZodError","safeParse","_safeParseAsync","safeParseAsync","_encode","_decode","_encodeAsync","_decodeAsync","_safeEncode","_safeDecode","_safeEncodeAsync","_safeDecodeAsync","cuid","cuid2","ulid","xid","ksuid","nanoid","duration","guid","uuid","version","email","_emoji","emoji","ipv4","ipv6","cidrv4","cidrv6","base64","base64url","httpProtocol","e164","dateSource","date","timeSource","hhmm","time","datetime","opts","timeRegex","string","regex","integer","number","boolean","lowercase","uppercase","$ZodCheck","core.$constructor","numericOriginMap","$ZodCheckLessThan","origin","bag","payload","$ZodCheckGreaterThan","$ZodCheckMultipleOf","util.floatSafeRemainder","$ZodCheckNumberFormat","isInt","minimum","maximum","util.NUMBER_FORMAT_RANGES","regexes.integer","$ZodCheckMaxLength","util.nullish","util.getLengthableOrigin","$ZodCheckMinLength","$ZodCheckLengthEquals","length","tooBig","$ZodCheckStringFormat","_b","$ZodCheckRegex","$ZodCheckLowerCase","regexes.lowercase","$ZodCheckUpperCase","regexes.uppercase","$ZodCheckIncludes","escapedRegex","util.escapeRegex","pattern","$ZodCheckStartsWith","$ZodCheckEndsWith","$ZodCheckOverwrite","Doc","arg","lines","minIndent","dedented","line","$ZodType","ch","runChecks","isAborted","util.aborted","asyncResult","util.explicitlyAborted","currLen","handleCanaryResult","canary","checkResult","util.defineLazy","r","$ZodString","regexes.string","$ZodStringFormat","checks.$ZodCheckStringFormat","$ZodGUID","regexes.guid","$ZodUUID","regexes.uuid","$ZodEmail","regexes.email","$ZodURL","trimmed","regexes.httpProtocol","url","$ZodEmoji","regexes.emoji","$ZodNanoID","regexes.nanoid","$ZodCUID","regexes.cuid","$ZodCUID2","regexes.cuid2","$ZodULID","regexes.ulid","$ZodXID","regexes.xid","$ZodKSUID","regexes.ksuid","$ZodISODateTime","regexes.datetime","$ZodISODate","regexes.date","$ZodISOTime","regexes.time","$ZodISODuration","regexes.duration","$ZodIPv4","regexes.ipv4","$ZodIPv6","regexes.ipv6","$ZodCIDRv4","regexes.cidrv4","$ZodCIDRv6","regexes.cidrv6","parts","address","prefix","prefixNum","isValidBase64","$ZodBase64","regexes.base64","isValidBase64URL","regexes.base64url","c","padded","$ZodBase64URL","$ZodE164","regexes.e164","isValidJWT","token","algorithm","tokensParts","header","parsedHeader","$ZodJWT","$ZodNumber","regexes.number","received","$ZodNumberFormat","checks.$ZodCheckNumberFormat","$ZodBoolean","regexes.boolean","$ZodUnknown","$ZodNever","$ZodVoid","handleArrayResult","final","index","util.prefixIssues","$ZodArray","proms","item","handlePropertyResult","isOptionalIn","isOptionalOut","isPresent","normalizeDef","okeys","util.optionalKeys","handleCatchall","unrecognized","keySet","_catchall","t","$ZodObject","sh","newSh","_normalized","util.cached","propValues","field","util.isObject","catchall","$ZodObjectJIT","superParse","generateFastpass","doc","normalized","parseStr","util.esc","ids","counter","id","fastpass","jit","core.globalConfig","fastEnabled","util.allowsEval","handleUnionResults","results","nonaborted","$ZodUnion","option","patterns","p","util.cleanRegex","first","async","$ZodDiscriminatedUnion","_super","pv","disc","map","values","opt","$ZodIntersection","left","right","handleIntersectionResults","mergeValues","util.isPlainObject","bKeys","sharedKeys","newObj","sharedValue","newArray","itemA","itemB","unrecKeys","unrecIssue","bothKeys","f","merged","$ZodEnum","util.getEnumValues","valuesSet","util.propertyKeyTypes","$ZodLiteral","$ZodTransform","core.$ZodEncodeError","_out","output","handleOptionalResult","$ZodOptional","$ZodExactOptional","$ZodNullable","$ZodDefault","handleDefaultResult","$ZodPrefault","$ZodNonOptional","handleNonOptionalResult","$ZodCatch","$ZodPipe","handlePipeResult","next","$ZodReadonly","handleReadonlyResult","$ZodCustom","checks.$ZodCheck","handleRefineResult","_iss","util.issue","$ZodRegistry","_meta","meta","pm","registry","globalRegistry","_string","util.normalizeParams","_email","_guid","_uuid","_uuidv4","_uuidv6","_uuidv7","_url","_nanoid","_cuid","_cuid2","_ulid","_xid","_ksuid","_ipv4","_ipv6","_cidrv4","_cidrv6","_base64","_base64url","_e164","_jwt","_isoDateTime","_isoDate","_isoTime","_isoDuration","_number","_int","_boolean","_unknown","_never","_void","_lt","checks.$ZodCheckLessThan","_lte","_gt","checks.$ZodCheckGreaterThan","_gte","_positive","_nonnegative","_multipleOf","checks.$ZodCheckMultipleOf","_maxLength","checks.$ZodCheckMaxLength","_minLength","checks.$ZodCheckMinLength","_length","checks.$ZodCheckLengthEquals","_regex","checks.$ZodCheckRegex","_lowercase","checks.$ZodCheckLowerCase","_uppercase","checks.$ZodCheckUpperCase","_includes","includes","checks.$ZodCheckIncludes","_startsWith","checks.$ZodCheckStartsWith","_endsWith","suffix","checks.$ZodCheckEndsWith","_overwrite","tx","checks.$ZodCheckOverwrite","_normalize","form","_trim","_toLowerCase","_toUpperCase","_slugify","util.slugify","_array","element","_refine","_superRefine","_check","_issue","initializeContext","process","seen","overrideSchema","_json","processor","parent","isTransforming","extractDefs","root","idToSchema","entry","existing","makeURI","defsSegment","externalId","uriGenerator","defUriPrefix","defId","extractToDef","ref","ext","finalize","flattenRef","zodSchema","_cached","refSeen","refSchema","parentSeen","rootMetaId","finalized","createStandardJSONSchemaMethod","_schema","createToJSONSchemaMethod","processors","io","libraryOptions","formatMap","stringProcessor","json","format","contentEncoding","regexes","numberProcessor","multipleOf","exclusiveMaximum","exclusiveMinimum","exMin","exMax","legacy","booleanProcessor","bigintProcessor","symbolProcessor","nullProcessor","undefinedProcessor","voidProcessor","neverProcessor","anyProcessor","unknownProcessor","dateProcessor","enumProcessor","literalProcessor","vals","nanProcessor","templateLiteralProcessor","fileProcessor","file","mime","m","successProcessor","customProcessor","functionProcessor","transformProcessor","mapProcessor","setProcessor","arrayProcessor","objectProcessor","allKeys","requiredKeys","unionProcessor","isExclusive","options","intersectionProcessor","isSimpleIntersection","allOf","tupleProcessor","prefixPath","restPath","prefixItems","recordProcessor","keyType","valueSchema","keyValues","validKeyValues","nullableProcessor","inner","nonoptionalProcessor","defaultProcessor","prefaultProcessor","catchProcessor","catchValue","pipeProcessor","inIsTransform","innerType","readonlyProcessor","promiseProcessor","optionalProcessor","lazyProcessor","allProcessors","toJSONSchema","schemas","external","ZodMiniType","core.$ZodType","parse.parse","parse.safeParse","parse.parseAsync","parse.safeParseAsync","_def","core.clone","reg","ZodMiniString","core.$ZodString","core._string","ZodMiniNumber","core.$ZodNumber","core._number","ZodMiniNumberFormat","core.$ZodNumberFormat","int","core._int","ZodMiniBoolean","core.$ZodBoolean","core._boolean","ZodMiniUnknown","core.$ZodUnknown","unknown","core._unknown","ZodMiniVoid","core.$ZodVoid","core._void","ZodMiniArray","core.$ZodArray","array","ZodMiniObject","core.$ZodObject","ZodMiniUnion","core.$ZodUnion","union","ZodMiniEnum","core.$ZodEnum","_enum","ZodMiniOptional","core.$ZodOptional","optional","KEPT_KEYS","normalizeJsonSchema","raw","isEmptyObject","out","normalizeChild","detected","_detectDiscriminator","pk","s","branches","branchPropsList","props","candidates","_constPropNames","n","allDistinct","RequestType","paramsSchema","resultSchema","errorSchema","docs","clientStreamSchema","serverStreamSchema","NotificationType","requestType","docsOrError","maybeDocs","void$1","notificationType","zodToSvcJsonSchema","type","jcsCanonicalize","_canonicalize","obj","cv","K","_rotr","sha256$1","inputLen","bitLen","paddedLen","view","H","W","block","w15","w2","s0","s1","d","g","h","S1","temp1","temp2","outView","computeInterfaceHash","stripNonNormative","digest","isRoot","InterfaceDefinition","info","members","base","hash","methods","member","toMethodSchema","defineInterface","defaultsInterface","zRootPrincipalSet","zServiceListing","directoryInterface","positive","nonnegative","directoryWatchNever","stream","resolve","schemasInterface","StreamDir","StreamControlType","streamInterface","enum$1","STREAM_METHOD","ErrorCode","isRequest","isNotification","isResponse","parseMethodName","method","Channel","sender","_setHandler","handler","decorate","RpcError","code","KEEPALIVE_PING_INTERVAL_MS","JsonRpcChannel","transport","jrc","_transport","_opts","req","promise","reject","resolveResult","rejectResult","pinger","ping","stopPing","err","reason","requestId","outboundDir","pending","nextNonce","nonce","control","waiter","w","dir","fields","listener","context","abort","resp","_NOOP_STREAM","_NEVER_ABORT","HubRpcConnection","channel","iface","serviceId","ServiceHandle","handlers","rootPrincipalSetsEqual","sid","desc","sets","interfaceId","regOpts","cursor","limit","all","page","set","ctxRest","baseCtx","interfaceHash","proxy","wireMethod","callOpts","userListener","onStreamMessage","channelOpts","call","checked","parsed","notFound","memberName","parsedParams","callStream","signal","sa","sb","j","_connection","_serviceId","createMergeProxy","baseObj","extObj","_target","_receiver","success","baseKeys","extKeys","extKeysSet","zB64","ZodISODateTime","core.$ZodISODateTime","schemas.ZodStringFormat","core._isoDateTime","ZodISODate","core.$ZodISODate","core._isoDate","ZodISOTime","core.$ZodISOTime","core._isoTime","ZodISODuration","core.$ZodISODuration","core._isoDuration","core.formatError","core.flattenError","ZodRealError","core._parse","core._parseAsync","core._safeParse","core._safeParseAsync","encode","core._encode","decode","core._decode","encodeAsync","core._encodeAsync","decodeAsync","core._decodeAsync","safeEncode","core._safeEncode","safeDecode","core._safeDecode","safeEncodeAsync","core._safeEncodeAsync","safeDecodeAsync","core._safeDecodeAsync","_installedGroups","_installLazyMethods","group","installed","bound","ZodType","parse.encode","parse.decode","parse.encodeAsync","parse.decodeAsync","parse.safeEncode","parse.safeDecode","parse.safeEncodeAsync","parse.safeDecodeAsync","chks","util.mergeDefs","check","refine","refinement","superRefine","checks.overwrite","exactOptional","nullable","nonoptional","intersection","pipe","transform","_default","prefault","_catch","readonly","description","core.globalRegistry","_ZodString","processors.stringProcessor","checks.regex","checks.includes","checks.startsWith","checks.endsWith","checks.minLength","checks.maxLength","checks.length","checks.lowercase","checks.uppercase","checks.trim","checks.normalize","checks.toLowerCase","checks.toUpperCase","checks.slugify","ZodString","core._email","ZodEmail","core._url","ZodURL","core._jwt","ZodJWT","core._emoji","ZodEmoji","core._guid","ZodGUID","core._uuid","ZodUUID","core._uuidv4","core._uuidv6","core._uuidv7","core._nanoid","ZodNanoID","core._cuid","ZodCUID","core._cuid2","ZodCUID2","core._ulid","ZodULID","core._base64","ZodBase64","core._base64url","ZodBase64URL","core._xid","ZodXID","core._ksuid","ZodKSUID","core._ipv4","ZodIPv4","core._ipv6","ZodIPv6","core._cidrv4","ZodCIDRv4","core._cidrv6","ZodCIDRv6","core._e164","ZodE164","iso.datetime","iso.date","iso.time","iso.duration","ZodStringFormat","core.$ZodStringFormat","core.$ZodEmail","core.$ZodGUID","core.$ZodUUID","core.$ZodURL","core.$ZodEmoji","core.$ZodNanoID","core.$ZodCUID","core.$ZodCUID2","core.$ZodULID","core.$ZodXID","core.$ZodKSUID","core.$ZodIPv4","core.$ZodIPv6","core.$ZodCIDRv4","core.$ZodCIDRv6","core.$ZodBase64","core.$ZodBase64URL","core.$ZodE164","core.$ZodJWT","ZodNumber","processors.numberProcessor","checks.gt","checks.gte","checks.lt","checks.lte","checks.multipleOf","ZodNumberFormat","ZodBoolean","processors.booleanProcessor","ZodUnknown","processors.unknownProcessor","ZodNever","core.$ZodNever","processors.neverProcessor","never","core._never","ZodArray","processors.arrayProcessor","core._array","ZodObject","core.$ZodObjectJIT","processors.objectProcessor","incoming","util.extend","util.safeExtend","other","util.merge","util.pick","util.omit","util.partial","ZodOptional","util.required","ZodNonOptional","ZodUnion","processors.unionProcessor","ZodDiscriminatedUnion","core.$ZodDiscriminatedUnion","discriminatedUnion","discriminator","ZodIntersection","core.$ZodIntersection","processors.intersectionProcessor","ZodEnum","processors.enumProcessor","newEntries","ZodLiteral","core.$ZodLiteral","processors.literalProcessor","literal","ZodTransform","core.$ZodTransform","processors.transformProcessor","processors.optionalProcessor","ZodExactOptional","core.$ZodExactOptional","ZodNullable","core.$ZodNullable","processors.nullableProcessor","ZodDefault","core.$ZodDefault","processors.defaultProcessor","defaultValue","util.shallowClone","ZodPrefault","core.$ZodPrefault","processors.prefaultProcessor","core.$ZodNonOptional","processors.nonoptionalProcessor","ZodCatch","core.$ZodCatch","processors.catchProcessor","ZodPipe","core.$ZodPipe","processors.pipeProcessor","in_","ZodReadonly","core.$ZodReadonly","processors.readonlyProcessor","ZodCustom","core.$ZodCustom","processors.customProcessor","core._refine","core._superRefine","zJsonValue","z.unknown","zEditorCapabilities","z.object","z.boolean","zHostCapabilities","zTextEdit","z.number","z.string","zContentEdit","z.discriminatedUnion","z.literal","z.array","webEditorHostInterface","z.enum","webEditorInterface","zScopeRegistration","applyContentEdits","edits","current","edit","setAtPath","getAtPath","applyTextEdits","text","cur","rootObj","encodeForEditor","contentType","decodeFromEditor","indentation","hint","WindowMessageTransport","event","isJsonRpcMessage","_our","_their","_filterSource","Emitter","WebEditorHost","newValue","newText","readOnly","force","content","BASE_CSS","buildSrcdoc","bundleJs","themeCss","safeJs","IframeEmbeddedEditor","_options","initialContent","wrapper","iframe","cw","connection","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